Lines Matching +full:num +full:- +full:tx +full:- +full:queues
1 /* SPDX-License-Identifier: GPL-2.0 */
19 #include <linux/dma-mapping.h>
110 #define ICE_MAX_RXQS_PER_TC 256 /* Used when setting VSI context per TC Rx queues */
120 #define ICE_MAX_MTU (ICE_AQ_SET_MAC_FRAME_SIZE_MAX - ICE_ETH_PKT_HDR_PAD)
128 #define ICE_TX_DESC(R, i) (&(((struct ice_tx_desc *)((R)->desc))[i]))
129 #define ICE_RX_DESC(R, i) (&(((union ice_32b_rx_flex_desc *)((R)->desc))[i]))
130 #define ICE_TX_CTX_DESC(R, i) (&(((struct ice_tx_ctx_desc *)((R)->desc))[i]))
131 #define ICE_TX_FDIRDESC(R, i) (&(((struct ice_fltr_desc *)((R)->desc))[i]))
157 for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++)
159 /* Macros for each Tx/Xdp/Rx ring in a VSI */
161 for ((i) = 0; (i) < (vsi)->num_txq; (i)++)
164 for ((i) = 0; (i) < (vsi)->num_xdp_txq; (i)++)
167 for ((i) = 0; (i) < (vsi)->num_rxq; (i)++)
169 /* Macros for each allocated Tx/Rx ring whether used or not in a VSI */
171 for ((i) = 0; (i) < (vsi)->alloc_txq; (i)++)
174 for ((i) = 0; (i) < (vsi)->alloc_rxq; (i)++)
177 for ((i) = 0; (i) < (vsi)->num_q_vectors; (i)++)
194 #define ice_pf_to_dev(pf) (&((pf)->pdev->dev))
228 u32 q_teid; /* Tx-scheduler element identifier */
230 u16 q_handle; /* Relative index of Tx queue within TC */
231 u16 vsi_idx; /* VSI index that Tx queue belongs to */
232 u8 tc; /* TC number that Tx queue belongs to */
244 u16 ena_tc; /* Tx map */
249 struct mutex *qs_mutex; /* will be assigned to &pf->avail_q_mutex */
322 struct ice_ring_stats **tx_ring_stats; /* Tx ring stats array */
332 struct ice_tx_ring **tx_rings; /* Tx ring array */
349 u16 idx; /* software index in pf->vsi[] */
356 u16 rss_size; /* Allocated RSS queues */
364 #define ICE_ARFS_LST_MASK (ICE_MAX_ARFS_LIST - 1)
392 u16 *txq_map; /* index in pf->avail_txqs */
393 u16 *rxq_map; /* index in pf->avail_rxqs */
394 u16 alloc_txq; /* Allocated Tx queues */
395 u16 num_txq; /* Used Tx queues */
396 u16 alloc_rxq; /* Allocated Rx queues */
397 u16 num_rxq; /* Used Rx queues */
398 u16 req_txq; /* User requested Tx queues */
399 u16 req_rxq; /* User requested Rx queues */
405 u16 num_xdp_txq; /* Used XDP queues */
423 * it can be used after tc-qdisc delete, to get back RSS setting as
428 * and inclusive of ADQ, vsi->mqprio_opt keeps track of queue
461 u16 v_idx; /* index in the vsi->q_vector array. */
464 u8 num_ring_tx; /* total number of Tx rings in vector */
474 struct ice_ring_container tx; member
561 u16 ctrl_vsi_idx; /* control VSI index in pf->vsi array */
576 unsigned long *avail_txqs; /* bitmap to track PF Tx queue usage */
582 struct mutex avail_q_mutex; /* protects access to avail_[rx|tx]qs */
606 u16 max_pf_txqs; /* Total Tx queues PF wide */
607 u16 max_pf_rxqs; /* Total Rx queues PF wide */
609 u16 num_lan_tx; /* num LAN Tx queues setup */
610 u16 num_lan_rx; /* num LAN Rx queues setup */
611 u16 next_vsi; /* Next free slot in pf->vsi[] - 0-based! */
688 return !!qv->ch; /* Enable it to run with TC */ in ice_vector_ch_enabled()
692 * ice_ptp_pf_handles_tx_interrupt - Check if PF handles Tx interrupt
695 * Return true if this PF should respond to the Tx timestamp interrupt
700 return pf->ptp.tx_interrupt_mode != ICE_PTP_TX_INTERRUPT_NONE; in ice_ptp_pf_handles_tx_interrupt()
704 * ice_irq_dynamic_ena - Enable default interrupt generation settings
713 u32 vector = (vsi && q_vector) ? q_vector->reg_idx : in ice_irq_dynamic_ena()
714 ((struct ice_pf *)hw->back)->oicr_irq.index; in ice_irq_dynamic_ena()
724 if (test_bit(ICE_VSI_DOWN, vsi->state)) in ice_irq_dynamic_ena()
730 * ice_netdev_to_pf - Retrieve the PF struct associated with a netdev
737 return np->vsi->back; in ice_netdev_to_pf()
742 return !!READ_ONCE(vsi->xdp_prog); in ice_is_xdp_ena_vsi()
747 ring->flags |= ICE_TX_FLAGS_RING_XDP; in ice_set_ring_xdp()
751 * ice_get_xp_from_qid - get ZC XSK buffer pool bound to a queue ID
756 * attached and configured as zero-copy, NULL otherwise.
761 struct xsk_buff_pool *pool = xsk_get_pool_from_qid(vsi->netdev, qid); in ice_get_xp_from_qid()
766 return (pool && pool->dev) ? pool : NULL; in ice_get_xp_from_qid()
770 * ice_rx_xsk_pool - assign XSK buff pool to Rx ring
777 struct ice_vsi *vsi = ring->vsi; in ice_rx_xsk_pool()
778 u16 qid = ring->q_index; in ice_rx_xsk_pool()
780 WRITE_ONCE(ring->xsk_pool, ice_get_xp_from_qid(vsi, qid)); in ice_rx_xsk_pool()
784 * ice_tx_xsk_pool - assign XSK buff pool to XDP ring
795 * rx_ring->xdp_ring assignment that was done during XDP rings initialization.
801 ring = vsi->rx_rings[qid]->xdp_ring; in ice_tx_xsk_pool()
805 WRITE_ONCE(ring->xsk_pool, ice_get_xp_from_qid(vsi, qid)); in ice_tx_xsk_pool()
809 * ice_get_main_vsi - Get the PF VSI
812 * returns pf->vsi[0], which by definition is the PF VSI
816 if (pf->vsi) in ice_get_main_vsi()
817 return pf->vsi[0]; in ice_get_main_vsi()
823 * ice_get_netdev_priv_vsi - return VSI associated with netdev priv.
829 if (np->repr) in ice_get_netdev_priv_vsi()
830 return np->repr->src_vsi; in ice_get_netdev_priv_vsi()
832 return np->vsi; in ice_get_netdev_priv_vsi()
836 * ice_get_ctrl_vsi - Get the control VSI
841 /* if pf->ctrl_vsi_idx is ICE_NO_VSI, control VSI was not set up */ in ice_get_ctrl_vsi()
842 if (!pf->vsi || pf->ctrl_vsi_idx == ICE_NO_VSI) in ice_get_ctrl_vsi()
845 return pf->vsi[pf->ctrl_vsi_idx]; in ice_get_ctrl_vsi()
849 * ice_find_vsi - Find the VSI from VSI ID
858 if (pf->vsi[i] && pf->vsi[i]->vsi_num == vsi_num) in ice_find_vsi()
859 return pf->vsi[i]; in ice_find_vsi()
864 * ice_is_switchdev_running - check if switchdev is configured
872 return pf->eswitch.is_running; in ice_is_switchdev_running()
884 * ice_is_adq_active - any active ADQs
900 if (vsi->tc_cfg.numtc > ICE_CHNL_START_TC && in ice_is_adq_active()
901 test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) in ice_is_adq_active()
1017 * ice_set_rdma_cap - enable RDMA support
1022 if (pf->hw.func_caps.common_cap.rdma && pf->num_rdma_msix) { in ice_set_rdma_cap()
1023 set_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_set_rdma_cap()
1024 set_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags); in ice_set_rdma_cap()
1029 * ice_clear_rdma_cap - disable RDMA support
1037 clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags); in ice_clear_rdma_cap()
1038 set_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags); in ice_clear_rdma_cap()
1039 clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); in ice_clear_rdma_cap()
1045 * ice_is_dual - Check if given config is multi-NAC
1048 * Return: true if the device is running in mutli-NAC (Network
1050 * (always false for non-E825 devices).
1054 return hw->mac_type == ICE_MAC_GENERIC_3K_E825 && in ice_is_dual()
1055 (hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_DUAL_M); in ice_is_dual()
1059 * ice_is_primary - Check if given device belongs to the primary complex
1062 * Check if given PF/HW is running on primary complex in multi-NAC
1066 * for non-E825 devices).
1070 return hw->mac_type != ICE_MAC_GENERIC_3K_E825 || in ice_is_primary()
1072 (hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M); in ice_is_primary()
1076 * ice_pf_src_tmr_owned - Check if a primary timer is owned by PF
1083 return pf->hw.func_caps.ts_func_info.src_tmr_owned && in ice_pf_src_tmr_owned()
1084 ice_is_primary(&pf->hw); in ice_pf_src_tmr_owned()
1088 * ice_get_primary_hw - Get pointer to primary ice_hw structure
1096 if (!pf->adapter->ctrl_pf) in ice_get_primary_hw()
1097 return &pf->hw; in ice_get_primary_hw()
1099 return &pf->adapter->ctrl_pf->hw; in ice_get_primary_hw()