Skip to contentSkip to conversation

mlxsw: spectrum_trap: Push Ethernet header before reporting trap

PATCH Applied Ido Schimmel 2 participants 2 messages Oct 17, 2019 – Oct 18, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlxsw: spectrum_trap: Push Ethernet header before reporting trap

From: Ido Schimmel <[email protected]>

devlink maintains packets and bytes statistics for each trap. Since eth_type_trans() was called to set the skb's protocol, the data pointer no longer points to the start of the packet and the bytes accounting is off by 14 bytes.

Fix this by pushing the skb's data pointer to the start of the packet.

Fixes b5ce611fd96e ("mlxsw: spectrum: Add devlink-trap support")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c +1 -0
index 899450b28621..7c03b661ae7e 100644
@@ -99,6 +99,7 @@ static void mlxsw_sp_rx_drop_listener(struct sk_buff *skb, u8 local_port,
 	devlink = priv_to_devlink(mlxsw_sp->core);
 	in_devlink_port = mlxsw_core_port_devlink_port_get(mlxsw_sp->core,
 							   local_port);
+	skb_push(skb, ETH_HLEN);
 	devlink_trap_report(devlink, skb, trap_ctx, in_devlink_port);
 	consume_skb(skb);
 }
Signature · 1 line
2.21.0
maintainer Applied
#1 lore raw

From: Ido Schimmel <[email protected]>
Date: Thu, 17 Oct 2019 10:11:03 +0300

Quoted 7 lines

From: Ido Schimmel <[email protected]>

devlink maintains packets and bytes statistics for each trap. Since eth_type_trans() was called to set the skb's protocol, the data pointer no longer points to the start of the packet and the bytes accounting is off by 14 bytes.

Quoted 7 lines

Fix this by pushing the skb's data pointer to the start of the packet.

Fixes b5ce611fd96e ("mlxsw: spectrum: Add devlink-trap support")

Applied, thanks.