ice: add a separate Rx handler for flow director commands
Subsystems (3)
PATCH v2 1/1 ice: add a separate Rx handler for flow director commands
The "ice" driver implementation uses the control VSI to handle the flow director configuration for PFs and VFs.
Unfortunately, although a separate VSI type was created to handle flow director queues, the Rx queue handler was shared between the flow director and a standard NAPI Rx handler.
Such a design approach was not very flexible. First, it mixed hotpath and slowpath code, blocking their further optimization. It also created a huge overkill for the flow director command processing, which is descriptor-based only, so there is no need to allocate Rx data buffers.
For the above reasons, implement a separate Rx handler for the control VSI. Also, remove from the NAPI handler the code dedicated to configuring the flow director rules on VFs.
Do not allocate Rx data buffers to the flow director queues because their processing is descriptor-based only.
Finally, allow Rx data queues to be allocated only for VSIs that have netdev assigned to them.
This handler splitting approach is the first step in converting the driver to use the Page Pool (which can only be used for data queues).
Test hints:
1. Create a VF for any PF managed by the ice driver.
2. In a loop, add and delete flow director rules for the VF, e.g.:
for i in {1..128}; do
q=$(( i % 16 ))
ethtool -N ens802f0v0 flow-type tcp4 dst-port "$i" action "$q"
done
for i in {0..127}; do
ethtool -N ens802f0v0 delete "$i"
done---
v2:
- declare the function ice_clean_rx_irq() as static, because now it is called from "ice_txrx.c" file only (Maciej),
- add RB tags from Jacob and Simon.
v1: https://lore.kernel.org/intel-wired-lan/[email protected]/
--- drivers/net/ethernet/intel/ice/ice_base.c | 5 +- drivers/net/ethernet/intel/ice/ice_lib.c | 3 +- drivers/net/ethernet/intel/ice/ice_txrx.c | 87 +++++++++++++++++++---- drivers/net/ethernet/intel/ice/ice_txrx.h | 3 +- 4 files changed, 79 insertions(+), 19 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +4 -1
@@ -623,7 +623,10 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)return 0 ; } -ice_alloc_rx_bufs (ring, num_bufs); +if (ring->vsi->type ==ICE_VSI_CTRL ) +ice_init_ctrl_rx_descs (ring, num_bufs); +else +ice_alloc_rx_bufs (ring, num_bufs);return 0 ; }
drivers/net/ethernet/intel/ice/ice_lib.c +1 -2
@@ -484,8 +484,7 @@ static irqreturn_t ice_msix_clean_ctrl_vsi(int __always_unused irq, void *data)if (!q_vector->tx.tx_ring)return IRQ_HANDLED ; -#define FDIR_RX_DESC_CLEAN_BUDGET 64 -ice_clean_rx_irq (q_vector->rx.rx_ring,FDIR_RX_DESC_CLEAN_BUDGET ); +ice_clean_ctrl_rx_irq (q_vector->rx.rx_ring);ice_clean_ctrl_tx_irq (q_vector->tx.tx_ring);return IRQ_HANDLED ;
drivers/net/ethernet/intel/ice/ice_txrx.c +72 -15
123 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_txrx.h +2 -1
@@ -491,6 +491,7 @@ static inline unsigned int ice_rx_pg_order(struct ice_rx_ring *ring)union ice_32b_rx_flex_desc ; +void ice_init_ctrl_rx_descs (struct ice_rx_ring *rx_ring,u32 num_descs);bool ice_alloc_rx_bufs (struct ice_rx_ring *rxr,unsigned int cleaned_count);netdev_tx_t ice_start_xmit (struct sk_buff *skb,struct net_device *netdev); u16
@@ -506,6 +507,6 @@ int ice_napi_poll(struct napi_struct *napi, int budget);int ice_prgm_fdir_fltr (struct ice_vsi *vsi,struct ice_fltr_desc *fdir_desc,u8 *raw_packet); -int ice_clean_rx_irq (struct ice_rx_ring *rx_ring,int budget);void ice_clean_ctrl_tx_irq (struct ice_tx_ring *tx_ring); +void ice_clean_ctrl_rx_irq (struct ice_rx_ring *rx_ring);#endif /* _ICE_TXRX_H_ */
Signature · 1 line
2.45.2
Quoted 36 lines · Michal Kubiak
The "ice" driver implementation uses the control VSI to handle the flow director configuration for PFs and VFs.
Unfortunately, although a separate VSI type was created to handle flow director queues, the Rx queue handler was shared between the flow director and a standard NAPI Rx handler.
Such a design approach was not very flexible. First, it mixed hotpath and slowpath code, blocking their further optimization. It also created a huge overkill for the flow director command processing, which is descriptor-based only, so there is no need to allocate Rx data buffers.
For the above reasons, implement a separate Rx handler for the control VSI. Also, remove from the NAPI handler the code dedicated to configuring the flow director rules on VFs.
Do not allocate Rx data buffers to the flow director queues because their processing is descriptor-based only.
Finally, allow Rx data queues to be allocated only for VSIs that have netdev assigned to them.This handler splitting approach is the first step in converting the driver to use the Page Pool (which can only be used for data queues).
Test hints:
1. Create a VF for any PF managed by the ice driver.
2. In a loop, add and delete flow director rules for the VF, e.g.:for i in {1..128}; do q=$(( i % 16 )) ethtool -N ens802f0v0 flow-type tcp4 dst-port "$i" action "$q" done for i in {0..127}; do ethtool -N ens802f0v0 delete "$i" done
Quoted 8 lines
Suggested-by Maciej Fijalkowski <[email protected]>Suggested-by Michal Swiatkowski <[email protected]>Reviewed-by Jacob Keller <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by Michal Kubiak <[email protected]>---
I assume you meant for this to be still targeted at iwl-next and the iwl-net was a typo?
I'll queue on the next dev-queue.
Thanks,
Jake
Quoted 48 lines · Jacob Keller
Quoted 36 lines · Michal Kubiak
The "ice" driver implementation uses the control VSI to handle the flow director configuration for PFs and VFs.
Unfortunately, although a separate VSI type was created to handle flow director queues, the Rx queue handler was shared between the flow director and a standard NAPI Rx handler.
Such a design approach was not very flexible. First, it mixed hotpath and slowpath code, blocking their further optimization. It also created a huge overkill for the flow director command processing, which is descriptor-based only, so there is no need to allocate Rx data buffers.
For the above reasons, implement a separate Rx handler for the control VSI. Also, remove from the NAPI handler the code dedicated to configuring the flow director rules on VFs.
Do not allocate Rx data buffers to the flow director queues because their processing is descriptor-based only.
Finally, allow Rx data queues to be allocated only for VSIs that have netdev assigned to them.This handler splitting approach is the first step in converting the driver to use the Page Pool (which can only be used for data queues).
Test hints:
1. Create a VF for any PF managed by the ice driver.
2. In a loop, add and delete flow director rules for the VF, e.g.:for i in {1..128}; do q=$(( i % 16 )) ethtool -N ens802f0v0 flow-type tcp4 dst-port "$i" action "$q" done for i in {0..127}; do ethtool -N ens802f0v0 delete "$i" doneQuoted 8 lines
Suggested-by Maciej Fijalkowski <[email protected]>Suggested-by Michal Swiatkowski <[email protected]>Reviewed-by Jacob Keller <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Simon Horman <[email protected]>Signed-off-by Michal Kubiak <[email protected]>---
Quoted 7 lines
I assume you meant for this to be still targeted at iwl-next and the iwl-net was a typo?
I'll queue on the next dev-queue.
Thanks,
Jake
You are right. Of course, it was a typo. My apologies for that! Thank you for your vigilance and double-checking!
Thanks,
Michal
Romanowski, Rafal
Tested-byQuoted 24 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Kubiak
Sent: Thursday, May 15, 2025 11:47 AM
To: Keller, Jacob E <[email protected]>
Cc: [email protected]; Fijalkowski, Maciej <[email protected]>; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; Nguyen, Anthony L <[email protected]>; Swiatkowski, Michal <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] ice: add a separate Rx handler for flow director commandsQuoted 10 lines · Jacob Keller
Quoted 7 lines · Michal Kubiak
The "ice" driver implementation uses the control VSI to handle the flow director configuration for PFs and VFs.
Unfortunately, although a separate VSI type was created to handle flow director queues, the Rx queue handler was shared between the flow director and a standard NAPI Rx handler.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Such a design approach was not very flexible. First, it mixed hotpath and slowpath code, blocking their further optimization. It also created a huge overkill for the flow director command processing, which is descriptor-based only, so there is no need to allocate Rx
data buffers.
Quoted 8 lines
Quoted 8 lines
For the above reasons, implement a separate Rx handler for the control VSI. Also, remove from the NAPI handler the code dedicated to configuring the flow director rules on VFs.
Do not allocate Rx data buffers to the flow director queues because their processing is descriptor-based only.
Finally, allow Rx data queues to be allocated only for VSIs that have netdev assigned to them.