Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mlxsw: Switch to napi_gro_receive()

Benefit from the recent conversion of the driver to NAPI and enable GRO
support through the use of napi_gro_receive(). Pass the NAPI pointer
from the bus driver (mlxsw_pci) to the switch driver (mlxsw_spectrum)
through the skb control block where various packet metadata is already
encoded.

The main motivation is to improve forwarding performance through the use
of GRO fraglist [1]. In my testing, when the forwarding data path is
simple (routing between two ports) there is not much difference in
forwarding performance between GRO disabled and GRO enabled with
fraglist.

The improvement becomes more noticeable as the data path becomes more
complex since it is traversed less times with GRO enabled. For example,
with 10 ingress and 10 egress flower filters with different priorities
on the two ports between which routing is performed, there is an
improvement of about 140% in forwarded bandwidth.

[1] https://lore.kernel.org/netdev/20200125102645.4782-1-steffen.klassert@secunet.com/

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://patch.msgid.link/21258fe55f608ccf1ee2783a5a4534220af28903.1734354812.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ido Schimmel and committed by
Jakub Kicinski
1ba06ca9 3a413055

+6 -3
+1
drivers/net/ethernet/mellanox/mlxsw/core.h
··· 73 73 }; 74 74 75 75 struct mlxsw_rx_md_info { 76 + struct napi_struct *napi; 76 77 u32 cookie_index; 77 78 u32 latency; 78 79 u32 tx_congestion;
+3 -1
drivers/net/ethernet/mellanox/mlxsw/pci.c
··· 737 737 } 738 738 739 739 static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci, 740 + struct napi_struct *napi, 740 741 struct mlxsw_pci_queue *q, 741 742 u16 consumer_counter_limit, 742 743 enum mlxsw_pci_cqe_v cqe_v, char *cqe) ··· 808 807 } 809 808 810 809 mlxsw_pci_skb_cb_ts_set(mlxsw_pci, skb, cqe_v, cqe); 810 + mlxsw_skb_cb(skb)->rx_md_info.napi = napi; 811 811 812 812 mlxsw_core_skb_receive(mlxsw_pci->core, skb, &rx_info); 813 813 ··· 871 869 continue; 872 870 } 873 871 874 - mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq, 872 + mlxsw_pci_cqe_rdq_handle(mlxsw_pci, napi, rdq, 875 873 wqe_counter, q->u.cq.v, cqe); 876 874 877 875 if (++work_done == budget)
+1 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 2449 2449 u64_stats_update_end(&pcpu_stats->syncp); 2450 2450 2451 2451 skb->protocol = eth_type_trans(skb, skb->dev); 2452 - netif_receive_skb(skb); 2452 + napi_gro_receive(mlxsw_skb_cb(skb)->rx_md_info.napi, skb); 2453 2453 } 2454 2454 2455 2455 static void mlxsw_sp_rx_listener_mark_func(struct sk_buff *skb, u16 local_port,
+1 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
··· 173 173 if (err) 174 174 return; 175 175 176 - netif_receive_skb(skb); 176 + napi_gro_receive(mlxsw_skb_cb(skb)->rx_md_info.napi, skb); 177 177 } 178 178 179 179 static void mlxsw_sp_rx_mark_listener(struct sk_buff *skb, u16 local_port,