Skip to content

Commit 2a508c6

Browse files
osctobeJeff Kirsher
authored andcommitted
i40e: fix VLAN.TCI == 0 RX HW offload
This fixes two bugs in hardware VLAN offload: 1. VLAN.TCI == 0 was being dropped 2. there was a race between disabling of VLAN RX feature in hardware and processing RX queue, where packets processed in this window could have their VLAN information dropped Fix moves the VLAN handling into i40e_process_skb_fields() to save on duplicated code. i40e_receive_skb() becomes trivial and so is removed. Signed-off-by: Michał Mirosław <[email protected]> Signed-off-by: Michał Mirosław <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 158daed commit 2a508c6

File tree

3 files changed

+9
-30
lines changed

3 files changed

+9
-30
lines changed

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,24 +1558,6 @@ static bool i40e_alloc_mapped_page(struct i40e_ring *rx_ring,
15581558
return true;
15591559
}
15601560

1561-
/**
1562-
* i40e_receive_skb - Send a completed packet up the stack
1563-
* @rx_ring: rx ring in play
1564-
* @skb: packet to send up
1565-
* @vlan_tag: vlan tag for packet
1566-
**/
1567-
void i40e_receive_skb(struct i40e_ring *rx_ring,
1568-
struct sk_buff *skb, u16 vlan_tag)
1569-
{
1570-
struct i40e_q_vector *q_vector = rx_ring->q_vector;
1571-
1572-
if ((rx_ring->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
1573-
(vlan_tag & VLAN_VID_MASK))
1574-
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
1575-
1576-
napi_gro_receive(&q_vector->napi, skb);
1577-
}
1578-
15791561
/**
15801562
* i40e_alloc_rx_buffers - Replace used receive buffers
15811563
* @rx_ring: ring to place buffers on
@@ -1812,6 +1794,13 @@ void i40e_process_skb_fields(struct i40e_ring *rx_ring,
18121794

18131795
skb_record_rx_queue(skb, rx_ring->queue_index);
18141796

1797+
if (qword & BIT(I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
1798+
u16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1;
1799+
1800+
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
1801+
le16_to_cpu(vlan_tag));
1802+
}
1803+
18151804
/* modifies the skb - consumes the enet header */
18161805
skb->protocol = eth_type_trans(skb, rx_ring->netdev);
18171806
}
@@ -2350,7 +2339,6 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
23502339
struct i40e_rx_buffer *rx_buffer;
23512340
union i40e_rx_desc *rx_desc;
23522341
unsigned int size;
2353-
u16 vlan_tag;
23542342
u8 rx_ptype;
23552343
u64 qword;
23562344

@@ -2451,11 +2439,8 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
24512439
/* populate checksum, VLAN, and protocol */
24522440
i40e_process_skb_fields(rx_ring, rx_desc, skb, rx_ptype);
24532441

2454-
vlan_tag = (qword & BIT(I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
2455-
le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) : 0;
2456-
24572442
i40e_trace(clean_rx_irq_rx, rx_ring, rx_desc, skb);
2458-
i40e_receive_skb(rx_ring, skb, vlan_tag);
2443+
napi_gro_receive(&rx_ring->q_vector->napi, skb);
24592444
skb = NULL;
24602445

24612446
/* update budget accounting */

drivers/net/ethernet/intel/i40e/i40e_txrx_common.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ struct i40e_rx_buffer *i40e_clean_programming_status(
1414
void i40e_process_skb_fields(struct i40e_ring *rx_ring,
1515
union i40e_rx_desc *rx_desc, struct sk_buff *skb,
1616
u8 rx_ptype);
17-
void i40e_receive_skb(struct i40e_ring *rx_ring,
18-
struct sk_buff *skb, u16 vlan_tag);
1917
void i40e_xdp_ring_update_tail(struct i40e_ring *xdp_ring);
2018
void i40e_update_rx_stats(struct i40e_ring *rx_ring,
2119
unsigned int total_rx_bytes,

drivers/net/ethernet/intel/i40e/i40e_xsk.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
634634
struct i40e_rx_buffer *bi;
635635
union i40e_rx_desc *rx_desc;
636636
unsigned int size;
637-
u16 vlan_tag;
638637
u8 rx_ptype;
639638
u64 qword;
640639

@@ -717,10 +716,7 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
717716
rx_ptype = (qword & I40E_RXD_QW1_PTYPE_MASK) >>
718717
I40E_RXD_QW1_PTYPE_SHIFT;
719718
i40e_process_skb_fields(rx_ring, rx_desc, skb, rx_ptype);
720-
721-
vlan_tag = (qword & BIT(I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
722-
le16_to_cpu(rx_desc->wb.qword0.lo_dword.l2tag1) : 0;
723-
i40e_receive_skb(rx_ring, skb, vlan_tag);
719+
napi_gro_receive(&rx_ring->q_vector->napi, skb);
724720
}
725721

726722
i40e_finalize_xdp_rx(rx_ring, xdp_xmit);

0 commit comments

Comments
 (0)