Lines Matching +full:num +full:- +full:rx +full:- +full:queues
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2005 - 2016 Broadcom
7 * linux-drivers@emulex.com
31 #include <linux/hwmon-sysfs.h>
60 /* Number of bytes of an RX frame that are copied to skb->data */
67 #define BE_MAX_MTU (BE_MAX_JUMBO_FRAME_SIZE - \
71 #define BE_MAX_GSO_SIZE (65535 - 2 * VLAN_HLEN)
105 #define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST)
111 #define CNTL_SERIAL_NUM_WORD_SZ (sizeof(u16)) /* Byte-sz of serial num word */
136 BUG_ON(limit & (limit - 1)); in MODULO()
137 return val & (limit - 1); in MODULO()
152 return q->dma_mem.va + q->head * q->entry_size; in queue_head_node()
157 return q->dma_mem.va + q->tail * q->entry_size; in queue_tail_node()
162 return q->dma_mem.va + index * q->entry_size; in queue_index_node()
167 index_inc(&q->head, q->len); in queue_head_inc()
172 *index = MODULO((*index - 1), limit); in index_dec()
177 index_inc(&q->tail, q->len); in queue_tail_inc()
198 u64 rx_pkts_prev; /* Used to calculate RX pps */
244 u16 last_req_hdr; /* index of the last req's hdr-wrb */
247 /* Struct to remember the pages posted for rx frags */
250 /* set to page-addr for last frag of the page & frag-addr otherwise */
297 bool rx_post_starved; /* Zero rx frags have been posted to BE */
341 /* A vlan-id of 0xFFFF must be used to clear transparent vlan-tagging */
383 /* From SFF-8472 spec */
419 * the FW, but is a self-imposed driver limitation.
424 /* These are port-wide values */
430 #define be_is_os2bmc_enabled(adapter) (adapter->flags & BE_FLAGS_OS2BMC)
469 /* The structure below provides a HW-agnostic abstraction of WRB params
491 /* UE-detection-duration in BEx/Skyhawk:
514 ERR_RECOVERY_ST_PRE_POLL = 3, /* Pre-Poll Phase (all PFs) */
515 ERR_RECOVERY_ST_REINIT = 4 /* Re-initialize Phase */
527 * the chip - PF0 only
568 u16 cfg_num_rx_irqs; /* configured via set-channels */
569 u16 cfg_num_tx_irqs; /* configured via set-channels */
580 /* Rx rings */
585 u32 big_page_size; /* Compounded page size shared by rx wrbs */
592 struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */
612 struct be_eth_addr *uc_list;/* list of uc-addrs programmed (not perm) */
629 u32 rx_fc; /* Rx flow control */
655 __be16 vxlan_port; /* offloaded vxlan port num */
681 #define be_physfn(adapter) (!adapter->virtfn)
682 #define be_virtfn(adapter) (adapter->virtfn)
683 #define sriov_enabled(adapter) (adapter->flags & \
687 for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
693 #define be_max_vlans(adapter) (adapter->res.max_vlans)
694 #define be_max_uc(adapter) (adapter->res.max_uc_mac)
695 #define be_max_mc(adapter) (adapter->res.max_mcast_mac)
696 #define be_max_vfs(adapter) (adapter->pool_res.max_vfs)
697 #define be_max_rss(adapter) (adapter->res.max_rss_qs)
698 #define be_max_txqs(adapter) (adapter->res.max_tx_qs)
699 #define be_max_prio_txqs(adapter) (adapter->res.max_prio_tx_qs)
700 #define be_max_rxqs(adapter) (adapter->res.max_rx_qs)
702 #define be_max_func_eqs(adapter) (adapter->res.max_evt_qs)
704 #define be_max_nic_eqs(adapter) (adapter->res.max_nic_evt_qs)
705 #define be_if_cap_flags(adapter) (adapter->res.if_cap_flags)
707 (adapter->pool_res.max_rss_tables)
712 /* Max irqs *needed* for RX queues */
715 /* If no RSS, need atleast one irq for def-RXQ */ in be_max_rx_irqs()
716 u16 num = max_t(u16, be_max_rss(adapter), 1); in be_max_rx_irqs() local
718 return min_t(u16, num, be_max_irqs(adapter)); in be_max_rx_irqs()
721 /* Max irqs *needed* for TX queues */
727 /* Max irqs *needed* for combined queues */
733 /* Max irqs *needed* for RX and TX queues together */
740 #define be_pvid_tagging_enabled(adapter) (adapter->pvid)
742 /* Is BE in QNQ multi-channel mode */
743 #define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE)
746 #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \
747 adapter->pdev->device == OC_DEVICE_ID4)
753 #define skyhawk_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID5 || \
754 adapter->pdev->device == OC_DEVICE_ID6)
760 #define BE3_chip(adapter) (adapter->pdev->device == BE_DEVICE_ID2 || \
761 adapter->pdev->device == OC_DEVICE_ID2)
767 #define BE2_chip(adapter) (adapter->pdev->device == BE_DEVICE_ID1 || \
768 adapter->pdev->device == OC_DEVICE_ID1)
776 (adapter->function_mode & RDMA_ENABLED))
780 #define msix_enabled(adapter) (adapter->num_msix_vec > 0)
782 adapter->num_msix_vec : 1)
783 #define tx_stats(txo) (&(txo)->stats)
784 #define rx_stats(rxo) (&(rxo)->stats)
787 #define default_rxo(adpt) (&adpt->rx_obj[adpt->num_rx_qs - 1])
790 for (i = 0, rxo = &adapter->rx_obj[i]; i < adapter->num_rx_qs; \
794 for (i = 0, rxo = &adapter->rx_obj[i]; i < adapter->num_rss_qs; \
798 for (i = 0, txo = &adapter->tx_obj[i]; i < adapter->num_tx_qs; \
802 for (i = 0, eqo = &adapter->eq_obj[i]; i < adapter->num_evt_qs; \
806 for (i = eqo->idx, rxo = &adapter->rx_obj[i]; i < adapter->num_rx_qs;\
807 i += adapter->num_evt_qs, rxo += adapter->num_evt_qs)
810 for (i = eqo->idx, txo = &adapter->tx_obj[i]; i < adapter->num_tx_qs;\
811 i += adapter->num_evt_qs, txo += adapter->num_evt_qs)
813 #define is_mcc_eqo(eqo) (eqo->idx == 0)
814 #define mcc_eqo(adapter) (&adapter->eq_obj[0])
821 ((u32)((((size_t)(_address) & (PAGE_SIZE_4K - 1)) + \
822 (size) + (PAGE_SIZE_4K - 1)) >> PAGE_SHIFT_4K))
826 (((size_t)&(((_struct *)0)->field))%32)
831 return (bitsize == 32 ? 0xFFFFFFFF : (1 << bitsize) - 1); in amap_mask()
845 amap_mask(sizeof(((_struct *)0)->field)), \
858 amap_mask(sizeof(((_struct *)0)->field)), \
883 len -= 4; in swap_dws()
888 #define be_cmd_status(status) (status > 0 ? -EIO : status)
894 if (ip_hdr(skb)->version == 4) in is_tcp_pkt()
895 val = (ip_hdr(skb)->protocol == IPPROTO_TCP); in is_tcp_pkt()
896 else if (ip_hdr(skb)->version == 6) in is_tcp_pkt()
897 val = (ipv6_hdr(skb)->nexthdr == NEXTHDR_TCP); in is_tcp_pkt()
906 if (ip_hdr(skb)->version == 4) in is_udp_pkt()
907 val = (ip_hdr(skb)->protocol == IPPROTO_UDP); in is_udp_pkt()
908 else if (ip_hdr(skb)->version == 6) in is_udp_pkt()
909 val = (ipv6_hdr(skb)->nexthdr == NEXTHDR_UDP); in is_udp_pkt()
916 return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; in is_ipv4_pkt()
921 if (ip_hdr(skb)->version == 6) in is_ipv6_ext_hdr()
922 return ipv6_ext_hdr(ipv6_hdr(skb)->nexthdr); in is_ipv6_ext_hdr()
928 (adapter->flags & BE_FLAGS_TRY_RECOVERY)
941 return (adapter->err_flags & err_type); in be_check_error()
946 struct net_device *netdev = adapter->netdev; in be_set_error()
948 adapter->err_flags |= err_type; in be_set_error()
951 dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name); in be_set_error()
956 adapter->err_flags &= ~err_type; in be_clear_error()
961 return adapter->num_rx_qs > 1; in be_multi_rxq()
975 * internal function to initialize-cleanup roce device.
981 * internal function to open-close roce device during ifup-ifdown.