Skip to content

Commit 0aa64f7

Browse files
idoschNipaLocal
authored andcommitted
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/[email protected]/ Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Petr Machata <[email protected]> Reviewed-by: Amit Cohen <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Alexander Lobakin <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 43774dd commit 0aa64f7

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ struct mlxsw_tx_info {
7373
};
7474

7575
struct mlxsw_rx_md_info {
76+
struct napi_struct *napi;
7677
u32 cookie_index;
7778
u32 latency;
7879
u32 tx_congestion;

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ static void mlxsw_pci_cqe_rdq_md_init(struct sk_buff *skb, const char *cqe)
737737
}
738738

739739
static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
740+
struct napi_struct *napi,
740741
struct mlxsw_pci_queue *q,
741742
u16 consumer_counter_limit,
742743
enum mlxsw_pci_cqe_v cqe_v, char *cqe)
@@ -807,6 +808,7 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
807808
}
808809

809810
mlxsw_pci_skb_cb_ts_set(mlxsw_pci, skb, cqe_v, cqe);
811+
mlxsw_skb_cb(skb)->rx_md_info.napi = napi;
810812

811813
mlxsw_core_skb_receive(mlxsw_pci->core, skb, &rx_info);
812814

@@ -869,7 +871,7 @@ static int mlxsw_pci_napi_poll_cq_rx(struct napi_struct *napi, int budget)
869871
continue;
870872
}
871873

872-
mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq,
874+
mlxsw_pci_cqe_rdq_handle(mlxsw_pci, napi, rdq,
873875
wqe_counter, q->u.cq.v, cqe);
874876

875877
if (++work_done == budget)

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,7 @@ void mlxsw_sp_rx_listener_no_mark_func(struct sk_buff *skb,
24492449
u64_stats_update_end(&pcpu_stats->syncp);
24502450

24512451
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);
24532453
}
24542454

24552455
static void mlxsw_sp_rx_listener_mark_func(struct sk_buff *skb, u16 local_port,

drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void mlxsw_sp_rx_no_mark_listener(struct sk_buff *skb, u16 local_port,
173173
if (err)
174174
return;
175175

176-
netif_receive_skb(skb);
176+
napi_gro_receive(mlxsw_skb_cb(skb)->rx_md_info.napi, skb);
177177
}
178178

179179
static void mlxsw_sp_rx_mark_listener(struct sk_buff *skb, u16 local_port,

0 commit comments

Comments
 (0)