Skip to content

Commit 033575e

Browse files
committed
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Fixes 2019-02-21 This series contains fixes to ixgbe and i40e. Majority of the fixes are to resolve XDP issues found in both drivers, there is only one fix which is not XDP related. That one fix resolves an issue seen on older 10GbE devices, where UDP traffic was either being dropped or being transmitted out of order when the bit to enable L3/L4 filtering for transmit switched packets is enabled on older devices that did not support this option. Magnus fixes an XDP issue for both ixgbe and i40e, where receive rings are created but no buffers are allocated for AF_XDP in zero-copy mode, so no packets can be received and no interrupts will be generated so that NAPI poll function that allocates buffers to the rings will never get executed. Björn fixes a race in XDP xmit ring cleanup for i40e, where ndo_xdp_xmit() must be taken into consideration. Added a synchronize_rcu() to wait for napi(s) before clearing the queue. Jan fixes a ixgbe AF_XDP zero-copy transmit issue which can cause a reset to be triggered, so add a check to ensure that netif carrier is 'ok' before trying to transmit packets. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d7cf4a3 + c685c69 commit 033575e

File tree

5 files changed

+60
-10
lines changed

5 files changed

+60
-10
lines changed

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,8 +3289,11 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
32893289
i40e_alloc_rx_buffers_zc(ring, I40E_DESC_UNUSED(ring)) :
32903290
!i40e_alloc_rx_buffers(ring, I40E_DESC_UNUSED(ring));
32913291
if (!ok) {
3292+
/* Log this in case the user has forgotten to give the kernel
3293+
* any buffers, even later in the application.
3294+
*/
32923295
dev_info(&vsi->back->pdev->dev,
3293-
"Failed allocate some buffers on %sRx ring %d (pf_q %d)\n",
3296+
"Failed to allocate some buffers on %sRx ring %d (pf_q %d)\n",
32943297
ring->xsk_umem ? "UMEM enabled " : "",
32953298
ring->queue_index, pf_q);
32963299
}
@@ -6725,8 +6728,13 @@ void i40e_down(struct i40e_vsi *vsi)
67256728

67266729
for (i = 0; i < vsi->num_queue_pairs; i++) {
67276730
i40e_clean_tx_ring(vsi->tx_rings[i]);
6728-
if (i40e_enabled_xdp_vsi(vsi))
6731+
if (i40e_enabled_xdp_vsi(vsi)) {
6732+
/* Make sure that in-progress ndo_xdp_xmit
6733+
* calls are completed.
6734+
*/
6735+
synchronize_rcu();
67296736
i40e_clean_tx_ring(vsi->xdp_rings[i]);
6737+
}
67306738
i40e_clean_rx_ring(vsi->rx_rings[i]);
67316739
}
67326740

@@ -11895,6 +11903,14 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi,
1189511903
if (old_prog)
1189611904
bpf_prog_put(old_prog);
1189711905

11906+
/* Kick start the NAPI context if there is an AF_XDP socket open
11907+
* on that queue id. This so that receiving will start.
11908+
*/
11909+
if (need_reset && prog)
11910+
for (i = 0; i < vsi->num_queue_pairs; i++)
11911+
if (vsi->xdp_rings[i]->xsk_umem)
11912+
(void)i40e_xsk_async_xmit(vsi->netdev, i);
11913+
1189811914
return 0;
1189911915
}
1190011916

@@ -11955,8 +11971,13 @@ static void i40e_queue_pair_reset_stats(struct i40e_vsi *vsi, int queue_pair)
1195511971
static void i40e_queue_pair_clean_rings(struct i40e_vsi *vsi, int queue_pair)
1195611972
{
1195711973
i40e_clean_tx_ring(vsi->tx_rings[queue_pair]);
11958-
if (i40e_enabled_xdp_vsi(vsi))
11974+
if (i40e_enabled_xdp_vsi(vsi)) {
11975+
/* Make sure that in-progress ndo_xdp_xmit calls are
11976+
* completed.
11977+
*/
11978+
synchronize_rcu();
1195911979
i40e_clean_tx_ring(vsi->xdp_rings[queue_pair]);
11980+
}
1196011981
i40e_clean_rx_ring(vsi->rx_rings[queue_pair]);
1196111982
}
1196211983

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3709,14 +3709,16 @@ int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
37093709
struct i40e_netdev_priv *np = netdev_priv(dev);
37103710
unsigned int queue_index = smp_processor_id();
37113711
struct i40e_vsi *vsi = np->vsi;
3712+
struct i40e_pf *pf = vsi->back;
37123713
struct i40e_ring *xdp_ring;
37133714
int drops = 0;
37143715
int i;
37153716

37163717
if (test_bit(__I40E_VSI_DOWN, vsi->state))
37173718
return -ENETDOWN;
37183719

3719-
if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs)
3720+
if (!i40e_enabled_xdp_vsi(vsi) || queue_index >= vsi->num_queue_pairs ||
3721+
test_bit(__I40E_CONFIG_BUSY, pf->state))
37203722
return -ENXIO;
37213723

37223724
if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ static int i40e_xsk_umem_enable(struct i40e_vsi *vsi, struct xdp_umem *umem,
183183
err = i40e_queue_pair_enable(vsi, qid);
184184
if (err)
185185
return err;
186+
187+
/* Kick start the NAPI context so that receiving will start */
188+
err = i40e_xsk_async_xmit(vsi->netdev, qid);
189+
if (err)
190+
return err;
186191
}
187192

188193
return 0;

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3953,8 +3953,11 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
39533953
else
39543954
mrqc = IXGBE_MRQC_VMDQRSS64EN;
39553955

3956-
/* Enable L3/L4 for Tx Switched packets */
3957-
mrqc |= IXGBE_MRQC_L3L4TXSWEN;
3956+
/* Enable L3/L4 for Tx Switched packets only for X550,
3957+
* older devices do not support this feature
3958+
*/
3959+
if (hw->mac.type >= ixgbe_mac_X550)
3960+
mrqc |= IXGBE_MRQC_L3L4TXSWEN;
39583961
} else {
39593962
if (tcs > 4)
39603963
mrqc = IXGBE_MRQC_RTRSS8TCEN;
@@ -10225,6 +10228,7 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
1022510228
int i, frame_size = dev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
1022610229
struct ixgbe_adapter *adapter = netdev_priv(dev);
1022710230
struct bpf_prog *old_prog;
10231+
bool need_reset;
1022810232

1022910233
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
1023010234
return -EINVAL;
@@ -10247,9 +10251,10 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
1024710251
return -ENOMEM;
1024810252

1024910253
old_prog = xchg(&adapter->xdp_prog, prog);
10254+
need_reset = (!!prog != !!old_prog);
1025010255

1025110256
/* If transitioning XDP modes reconfigure rings */
10252-
if (!!prog != !!old_prog) {
10257+
if (need_reset) {
1025310258
int err = ixgbe_setup_tc(dev, adapter->hw_tcs);
1025410259

1025510260
if (err) {
@@ -10265,6 +10270,14 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)
1026510270
if (old_prog)
1026610271
bpf_prog_put(old_prog);
1026710272

10273+
/* Kick start the NAPI context if there is an AF_XDP socket open
10274+
* on that queue id. This so that receiving will start.
10275+
*/
10276+
if (need_reset && prog)
10277+
for (i = 0; i < adapter->num_rx_queues; i++)
10278+
if (adapter->xdp_ring[i]->xsk_umem)
10279+
(void)ixgbe_xsk_async_xmit(adapter->netdev, i);
10280+
1026810281
return 0;
1026910282
}
1027010283

drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,19 @@ static int ixgbe_xsk_umem_enable(struct ixgbe_adapter *adapter,
144144
ixgbe_txrx_ring_disable(adapter, qid);
145145

146146
err = ixgbe_add_xsk_umem(adapter, umem, qid);
147+
if (err)
148+
return err;
147149

148-
if (if_running)
150+
if (if_running) {
149151
ixgbe_txrx_ring_enable(adapter, qid);
150152

151-
return err;
153+
/* Kick start the NAPI context so that receiving will start */
154+
err = ixgbe_xsk_async_xmit(adapter->netdev, qid);
155+
if (err)
156+
return err;
157+
}
158+
159+
return 0;
152160
}
153161

154162
static int ixgbe_xsk_umem_disable(struct ixgbe_adapter *adapter, u16 qid)
@@ -634,7 +642,8 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)
634642
dma_addr_t dma;
635643

636644
while (budget-- > 0) {
637-
if (unlikely(!ixgbe_desc_unused(xdp_ring))) {
645+
if (unlikely(!ixgbe_desc_unused(xdp_ring)) ||
646+
!netif_carrier_ok(xdp_ring->netdev)) {
638647
work_done = false;
639648
break;
640649
}

0 commit comments

Comments
 (0)