Skip to content

Commit e4cf27b

Browse files
Achiad Shochatdavem330
authored andcommitted
net/mlx5e: Re-eanble client vlan TX acceleration
This reverts commit cd58c71 "net/mlx5e: Disable client vlan TX acceleration". Bring back client vlan insertion offload, the original performance issue was found and fixed in the next patch. Signed-off-by: Achiad Shochat <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fe9f4fe commit e4cf27b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,6 +2004,7 @@ static void mlx5e_build_netdev(struct net_device *netdev)
20042004
netdev->vlan_features |= NETIF_F_LRO;
20052005

20062006
netdev->hw_features = netdev->vlan_features;
2007+
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX;
20072008
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
20082009
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
20092010

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,21 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq *sq,
124124
return MLX5E_MIN_INLINE;
125125
}
126126

127+
static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs)
128+
{
129+
struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start;
130+
int cpy1_sz = 2 * ETH_ALEN;
131+
int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN;
132+
133+
skb_copy_from_linear_data(skb, vhdr, cpy1_sz);
134+
skb_pull_inline(skb, cpy1_sz);
135+
vhdr->h_vlan_proto = skb->vlan_proto;
136+
vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));
137+
skb_copy_from_linear_data(skb, &vhdr->h_vlan_encapsulated_proto,
138+
cpy2_sz);
139+
skb_pull_inline(skb, cpy2_sz);
140+
}
141+
127142
static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
128143
{
129144
struct mlx5_wq_cyc *wq = &sq->wq;
@@ -175,8 +190,12 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
175190
ETH_ZLEN);
176191
}
177192

178-
skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
179-
skb_pull_inline(skb, ihs);
193+
if (skb_vlan_tag_present(skb)) {
194+
mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs);
195+
} else {
196+
skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
197+
skb_pull_inline(skb, ihs);
198+
}
180199

181200
eseg->inline_hdr_sz = cpu_to_be16(ihs);
182201

0 commit comments

Comments
 (0)