diff options
author | Maciej Fijalkowski <maciej.fijalkowski@intel.com> | 2021-08-19 14:59:58 +0300 |
---|---|---|
committer | Tony Nguyen <anthony.l.nguyen@intel.com> | 2021-10-15 17:39:02 +0300 |
commit | e72bba21355dbb67512a0d666fec9f4b56dbfc2f (patch) | |
tree | 4494fb0ec64233a7423a693efb0994739f192f44 /drivers/net/ethernet/intel/ice/ice_eswitch.c | |
parent | dc23715cf30a9acb808f5b08962877c390d3e6ea (diff) | |
download | linux-e72bba21355dbb67512a0d666fec9f4b56dbfc2f.tar.xz |
ice: split ice_ring onto Tx/Rx separate structs
While it was convenient to have a generic ring structure that served
both Tx and Rx sides, next commits are going to introduce several
Tx-specific fields, so in order to avoid hurting the Rx side, let's
pull out the Tx ring onto new ice_tx_ring and ice_rx_ring structs.
Rx ring could be handled by the old ice_ring which would reduce the code
churn within this patch, but this would make things asymmetric.
Make the union out of the ring container within ice_q_vector so that it
is possible to iterate over newly introduced ice_tx_ring.
Remove the @size as it's only accessed from control path and it can be
calculated pretty easily.
Change definitions of ice_update_ring_stats and
ice_fetch_u64_stats_per_ring so that they are ring agnostic and can be
used for both Rx and Tx rings.
Sizes of Rx and Tx ring structs are 256 and 192 bytes, respectively. In
Rx ring xdp_rxq_info occupies its own cacheline, so it's the major
difference now.
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_eswitch.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_eswitch.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c index d91a7834f91f..a20c38446e76 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c @@ -69,21 +69,6 @@ err_def_rx: } /** - * ice_eswitch_remap_ring - reconfigure ring of switchdev ctrl VSI - * @ring: pointer to ring - * @q_vector: pointer of q_vector which is connected with this ring - * @netdev: netdevice connected with this ring - */ -static void -ice_eswitch_remap_ring(struct ice_ring *ring, struct ice_q_vector *q_vector, - struct net_device *netdev) -{ - ring->q_vector = q_vector; - ring->next = NULL; - ring->netdev = netdev; -} - -/** * ice_eswitch_remap_rings_to_vectors - reconfigure rings of switchdev ctrl VSI * @pf: pointer to PF struct * @@ -102,23 +87,27 @@ static void ice_eswitch_remap_rings_to_vectors(struct ice_pf *pf) ice_for_each_txq(vsi, q_id) { struct ice_repr *repr = pf->vf[q_id].repr; struct ice_q_vector *q_vector = repr->q_vector; - struct ice_ring *tx_ring = vsi->tx_rings[q_id]; - struct ice_ring *rx_ring = vsi->rx_rings[q_id]; + struct ice_tx_ring *tx_ring = vsi->tx_rings[q_id]; + struct ice_rx_ring *rx_ring = vsi->rx_rings[q_id]; q_vector->vsi = vsi; q_vector->reg_idx = vsi->q_vectors[0]->reg_idx; q_vector->num_ring_tx = 1; - q_vector->tx.ring = tx_ring; - ice_eswitch_remap_ring(tx_ring, q_vector, repr->netdev); + q_vector->tx.tx_ring = tx_ring; + tx_ring->q_vector = q_vector; + tx_ring->next = NULL; + tx_ring->netdev = repr->netdev; /* In switchdev mode, from OS stack perspective, there is only * one queue for given netdev, so it needs to be indexed as 0. */ tx_ring->q_index = 0; q_vector->num_ring_rx = 1; - q_vector->rx.ring = rx_ring; - ice_eswitch_remap_ring(rx_ring, q_vector, repr->netdev); + q_vector->rx.rx_ring = rx_ring; + rx_ring->q_vector = q_vector; + rx_ring->next = NULL; + rx_ring->netdev = repr->netdev; } } @@ -390,7 +379,7 @@ static void ice_eswitch_set_rxdid(struct ice_vsi *vsi, u32 rxdid) int i; ice_for_each_rxq(vsi, i) { - struct ice_ring *ring = vsi->rx_rings[i]; + struct ice_rx_ring *ring = vsi->rx_rings[i]; u16 pf_q = vsi->rxq_map[ring->q_index]; ice_write_qrxflxp_cntxt(hw, pf_q, rxdid, 0x3, true); @@ -511,7 +500,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode, * context, regular netdev associated with Rx ring is returned. */ struct net_device * -ice_eswitch_get_target_netdev(struct ice_ring *rx_ring, +ice_eswitch_get_target_netdev(struct ice_rx_ring *rx_ring, union ice_32b_rx_flex_desc *rx_desc) { struct ice_32b_rx_flex_desc_nic_2 *desc; |