Commit 634da4c1 authored by Benita Bose's avatar Benita Bose Committed by Tony Nguyen

ice: Add Support for XPS

Enable and configure XPS. The driver code implemented sets up the Transmit
Packet Steering Map, which in turn will be used by the kernel in queue
selection during Tx.
Signed-off-by: default avatarBenita Bose <benita.bose@intel.com>
Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 28110056
...@@ -214,6 +214,26 @@ static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc) ...@@ -214,6 +214,26 @@ static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc)
return ring->q_index - vsi->tc_cfg.tc_info[tc].qoffset; return ring->q_index - vsi->tc_cfg.tc_info[tc].qoffset;
} }
/**
* ice_cfg_xps_tx_ring - Configure XPS for a Tx ring
* @ring: The Tx ring to configure
*
* This enables/disables XPS for a given Tx descriptor ring
* based on the TCs enabled for the VSI that ring belongs to.
*/
static void ice_cfg_xps_tx_ring(struct ice_ring *ring)
{
if (!ring->q_vector || !ring->netdev)
return;
/* We only initialize XPS once, so as not to overwrite user settings */
if (test_and_set_bit(ICE_TX_XPS_INIT_DONE, ring->xps_state))
return;
netif_set_xps_queue(ring->netdev, &ring->q_vector->affinity_mask,
ring->q_index);
}
/** /**
* ice_setup_tx_ctx - setup a struct ice_tlan_ctx instance * ice_setup_tx_ctx - setup a struct ice_tlan_ctx instance
* @ring: The Tx ring to configure * @ring: The Tx ring to configure
...@@ -664,6 +684,9 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring, ...@@ -664,6 +684,9 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
u16 pf_q; u16 pf_q;
u8 tc; u8 tc;
/* Configure XPS */
ice_cfg_xps_tx_ring(ring);
pf_q = ring->reg_idx; pf_q = ring->reg_idx;
ice_setup_tx_ctx(ring, &tlan_ctx, pf_q); ice_setup_tx_ctx(ring, &tlan_ctx, pf_q);
/* copy context contents into the qg_buf */ /* copy context contents into the qg_buf */
......
...@@ -195,6 +195,11 @@ struct ice_rxq_stats { ...@@ -195,6 +195,11 @@ struct ice_rxq_stats {
u64 gro_dropped; /* GRO returned dropped */ u64 gro_dropped; /* GRO returned dropped */
}; };
enum ice_ring_state_t {
ICE_TX_XPS_INIT_DONE,
ICE_TX_NBITS,
};
/* this enum matches hardware bits and is meant to be used by DYN_CTLN /* this enum matches hardware bits and is meant to be used by DYN_CTLN
* registers and QINT registers or more generally anywhere in the manual * registers and QINT registers or more generally anywhere in the manual
* mentioning ITR_INDX, ITR_NONE cannot be used as an index 'n' into any * mentioning ITR_INDX, ITR_NONE cannot be used as an index 'n' into any
...@@ -292,6 +297,7 @@ struct ice_ring { ...@@ -292,6 +297,7 @@ struct ice_ring {
}; };
struct rcu_head rcu; /* to avoid race on free */ struct rcu_head rcu; /* to avoid race on free */
DECLARE_BITMAP(xps_state, ICE_TX_NBITS); /* XPS Config State */
struct bpf_prog *xdp_prog; struct bpf_prog *xdp_prog;
struct xsk_buff_pool *xsk_pool; struct xsk_buff_pool *xsk_pool;
u16 rx_offset; u16 rx_offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment