Skip to content

Commit 76657ea

Browse files
committed
Merge tag 'net-5.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Jakub Kicinski: "Including fixes from netfilter. Current release - regressions: - revert "tipc: use consistent GFP flags" Previous releases - regressions: - igb: fix deadlock caused by taking RTNL in runtime resume path - accept UFOv6 packages in virtio_net_hdr_to_skb - netfilter: fix regression in looped (broad|multi)cast's MAC handling - bridge: fix ioctl old_deviceless bridge argument - ice: xsk: do not clear status_error0 for ntu + nb_buffs descriptor, avoid stalls when multiple sockets use an interface Previous releases - always broken: - inet: fully convert sk->sk_rx_dst to RCU rules - veth: ensure skb entering GRO are not cloned - sched: fix zone matching for invalid conntrack state - bonding: fix ad_actor_system option setting to default - nf_tables: fix use-after-free in nft_set_catchall_destroy() - lantiq_xrx200: increase buffer reservation to avoid mem corruption - ice: xsk: avoid leaking app buffers during clean up - tun: avoid double free in tun_free_netdev" * tag 'net-5.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (45 commits) net: stmmac: dwmac-visconti: Fix value of ETHER_CLK_SEL_FREQ_SEL_2P5M r8152: sync ocp base r8152: fix the force speed doesn't work for RTL8156 net: bridge: fix ioctl old_deviceless bridge argument net: stmmac: ptp: fix potentially overflowing expression net: dsa: tag_ocelot: use traffic class to map priority on injected header veth: ensure skb entering GRO are not cloned. asix: fix wrong return value in asix_check_host_enable() asix: fix uninit-value in asix_mdio_read() sfc: falcon: Check null pointer of rx_queue->page_ring sfc: Check null pointer of rx_queue->page_ring net: ks8851: Check for error irq drivers: net: smc911x: Check for error irq fjes: Check for error irq bonding: fix ad_actor_system option setting to default igb: fix deadlock caused by taking RTNL in RPM resume path gve: Correct order of processing device options net: skip virtio_net_hdr_set_proto if protocol already set net: accept UFOv6 packages in virtio_net_hdr_to_skb docs: networking: replace skb_hwtstamp_tx with skb_tstamp_tx ...
2 parents 996a18e + 391e597 commit 76657ea

57 files changed

Lines changed: 405 additions & 213 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/networking/bonding.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ ad_actor_sys_prio
196196
ad_actor_system
197197

198198
In an AD system, this specifies the mac-address for the actor in
199-
protocol packet exchanges (LACPDUs). The value cannot be NULL or
200-
multicast. It is preferred to have the local-admin bit set for this
201-
mac but driver does not enforce it. If the value is not given then
202-
system defaults to using the masters' mac address as actors' system
203-
address.
199+
protocol packet exchanges (LACPDUs). The value cannot be a multicast
200+
address. If the all-zeroes MAC is specified, bonding will internally
201+
use the MAC of the bond itself. It is preferred to have the
202+
local-admin bit set for this mac but driver does not enforce it. If
203+
the value is not given then system defaults to using the masters'
204+
mac address as actors' system address.
204205

205206
This parameter has effect only in 802.3ad mode and is available through
206207
SysFs interface.

Documentation/networking/device_drivers/ethernet/freescale/dpaa2/overview.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ PHY and allows physical transmission and reception of Ethernet frames.
183183
IRQ config, enable, reset
184184

185185
DPNI (Datapath Network Interface)
186+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186187
Contains TX/RX queues, network interface configuration, and RX buffer pool
187188
configuration mechanisms. The TX/RX queues are in memory and are identified
188189
by queue number.

Documentation/networking/timestamping.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ Time stamps for outgoing packets are to be generated as follows:
582582
and hardware timestamping is not possible (SKBTX_IN_PROGRESS not set).
583583
- As soon as the driver has sent the packet and/or obtained a
584584
hardware time stamp for it, it passes the time stamp back by
585-
calling skb_hwtstamp_tx() with the original skb, the raw
586-
hardware time stamp. skb_hwtstamp_tx() clones the original skb and
585+
calling skb_tstamp_tx() with the original skb, the raw
586+
hardware time stamp. skb_tstamp_tx() clones the original skb and
587587
adds the timestamps, therefore the original skb has to be freed now.
588588
If obtaining the hardware time stamp somehow fails, then the driver
589589
should not fall back to software time stamping. The rationale is that

drivers/net/bonding/bond_options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
15261526
mac = (u8 *)&newval->value;
15271527
}
15281528

1529-
if (!is_valid_ether_addr(mac))
1529+
if (is_multicast_ether_addr(mac))
15301530
goto err;
15311531

15321532
netdev_dbg(bond->dev, "Setting ad_actor_system to %pM\n", mac);

drivers/net/ethernet/google/gve/gve_adminq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,7 @@ int gve_adminq_describe_device(struct gve_priv *priv)
738738
* is not set to GqiRda, choose the queue format in a priority order:
739739
* DqoRda, GqiRda, GqiQpl. Use GqiQpl as default.
740740
*/
741-
if (priv->queue_format == GVE_GQI_RDA_FORMAT) {
742-
dev_info(&priv->pdev->dev,
743-
"Driver is running with GQI RDA queue format.\n");
744-
} else if (dev_op_dqo_rda) {
741+
if (dev_op_dqo_rda) {
745742
priv->queue_format = GVE_DQO_RDA_FORMAT;
746743
dev_info(&priv->pdev->dev,
747744
"Driver is running with DQO RDA queue format.\n");
@@ -753,6 +750,9 @@ int gve_adminq_describe_device(struct gve_priv *priv)
753750
"Driver is running with GQI RDA queue format.\n");
754751
supported_features_mask =
755752
be32_to_cpu(dev_op_gqi_rda->supported_features_mask);
753+
} else if (priv->queue_format == GVE_GQI_RDA_FORMAT) {
754+
dev_info(&priv->pdev->dev,
755+
"Driver is running with GQI RDA queue format.\n");
756756
} else {
757757
priv->queue_format = GVE_GQI_QPL_FORMAT;
758758
if (dev_op_gqi_qpl)

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
#include "ice_lib.h"
77
#include "ice_dcb_lib.h"
88

9+
static bool ice_alloc_rx_buf_zc(struct ice_rx_ring *rx_ring)
10+
{
11+
rx_ring->xdp_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->xdp_buf), GFP_KERNEL);
12+
return !!rx_ring->xdp_buf;
13+
}
14+
15+
static bool ice_alloc_rx_buf(struct ice_rx_ring *rx_ring)
16+
{
17+
rx_ring->rx_buf = kcalloc(rx_ring->count, sizeof(*rx_ring->rx_buf), GFP_KERNEL);
18+
return !!rx_ring->rx_buf;
19+
}
20+
921
/**
1022
* __ice_vsi_get_qs_contig - Assign a contiguous chunk of queues to VSI
1123
* @qs_cfg: gathered variables needed for PF->VSI queues assignment
@@ -492,8 +504,11 @@ int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
492504
xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
493505
ring->q_index, ring->q_vector->napi.napi_id);
494506

507+
kfree(ring->rx_buf);
495508
ring->xsk_pool = ice_xsk_pool(ring);
496509
if (ring->xsk_pool) {
510+
if (!ice_alloc_rx_buf_zc(ring))
511+
return -ENOMEM;
497512
xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);
498513

499514
ring->rx_buf_len =
@@ -508,6 +523,8 @@ int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
508523
dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n",
509524
ring->q_index);
510525
} else {
526+
if (!ice_alloc_rx_buf(ring))
527+
return -ENOMEM;
511528
if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
512529
/* coverity[check_return] */
513530
xdp_rxq_info_reg(&ring->xdp_rxq,

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,10 @@ void ice_clean_rx_ring(struct ice_rx_ring *rx_ring)
419419
}
420420

421421
rx_skip_free:
422-
memset(rx_ring->rx_buf, 0, sizeof(*rx_ring->rx_buf) * rx_ring->count);
422+
if (rx_ring->xsk_pool)
423+
memset(rx_ring->xdp_buf, 0, array_size(rx_ring->count, sizeof(*rx_ring->xdp_buf)));
424+
else
425+
memset(rx_ring->rx_buf, 0, array_size(rx_ring->count, sizeof(*rx_ring->rx_buf)));
423426

424427
/* Zero out the descriptor ring */
425428
size = ALIGN(rx_ring->count * sizeof(union ice_32byte_rx_desc),
@@ -446,8 +449,13 @@ void ice_free_rx_ring(struct ice_rx_ring *rx_ring)
446449
if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq))
447450
xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
448451
rx_ring->xdp_prog = NULL;
449-
devm_kfree(rx_ring->dev, rx_ring->rx_buf);
450-
rx_ring->rx_buf = NULL;
452+
if (rx_ring->xsk_pool) {
453+
kfree(rx_ring->xdp_buf);
454+
rx_ring->xdp_buf = NULL;
455+
} else {
456+
kfree(rx_ring->rx_buf);
457+
rx_ring->rx_buf = NULL;
458+
}
451459

452460
if (rx_ring->desc) {
453461
size = ALIGN(rx_ring->count * sizeof(union ice_32byte_rx_desc),
@@ -475,8 +483,7 @@ int ice_setup_rx_ring(struct ice_rx_ring *rx_ring)
475483
/* warn if we are about to overwrite the pointer */
476484
WARN_ON(rx_ring->rx_buf);
477485
rx_ring->rx_buf =
478-
devm_kcalloc(dev, sizeof(*rx_ring->rx_buf), rx_ring->count,
479-
GFP_KERNEL);
486+
kcalloc(rx_ring->count, sizeof(*rx_ring->rx_buf), GFP_KERNEL);
480487
if (!rx_ring->rx_buf)
481488
return -ENOMEM;
482489

@@ -505,7 +512,7 @@ int ice_setup_rx_ring(struct ice_rx_ring *rx_ring)
505512
return 0;
506513

507514
err:
508-
devm_kfree(dev, rx_ring->rx_buf);
515+
kfree(rx_ring->rx_buf);
509516
rx_ring->rx_buf = NULL;
510517
return -ENOMEM;
511518
}

drivers/net/ethernet/intel/ice/ice_txrx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#define ICE_MAX_DATA_PER_TXD_ALIGNED \
2525
(~(ICE_MAX_READ_REQ_SIZE - 1) & ICE_MAX_DATA_PER_TXD)
2626

27-
#define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */
2827
#define ICE_MAX_TXQ_PER_TXQG 128
2928

3029
/* Attempt to maximize the headroom available for incoming frames. We use a 2K

drivers/net/ethernet/intel/ice/ice_xsk.c

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
#include "ice_txrx_lib.h"
1313
#include "ice_lib.h"
1414

15+
static struct xdp_buff **ice_xdp_buf(struct ice_rx_ring *rx_ring, u32 idx)
16+
{
17+
return &rx_ring->xdp_buf[idx];
18+
}
19+
1520
/**
1621
* ice_qp_reset_stats - Resets all stats for rings of given index
1722
* @vsi: VSI that contains rings of interest
@@ -372,7 +377,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count)
372377
dma_addr_t dma;
373378

374379
rx_desc = ICE_RX_DESC(rx_ring, ntu);
375-
xdp = &rx_ring->xdp_buf[ntu];
380+
xdp = ice_xdp_buf(rx_ring, ntu);
376381

377382
nb_buffs = min_t(u16, count, rx_ring->count - ntu);
378383
nb_buffs = xsk_buff_alloc_batch(rx_ring->xsk_pool, xdp, nb_buffs);
@@ -390,14 +395,9 @@ bool ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring, u16 count)
390395
}
391396

392397
ntu += nb_buffs;
393-
if (ntu == rx_ring->count) {
394-
rx_desc = ICE_RX_DESC(rx_ring, 0);
395-
xdp = rx_ring->xdp_buf;
398+
if (ntu == rx_ring->count)
396399
ntu = 0;
397-
}
398400

399-
/* clear the status bits for the next_to_use descriptor */
400-
rx_desc->wb.status_error0 = 0;
401401
ice_release_rx_desc(rx_ring, ntu);
402402

403403
return count == nb_buffs;
@@ -419,19 +419,18 @@ static void ice_bump_ntc(struct ice_rx_ring *rx_ring)
419419
/**
420420
* ice_construct_skb_zc - Create an sk_buff from zero-copy buffer
421421
* @rx_ring: Rx ring
422-
* @xdp_arr: Pointer to the SW ring of xdp_buff pointers
422+
* @xdp: Pointer to XDP buffer
423423
*
424424
* This function allocates a new skb from a zero-copy Rx buffer.
425425
*
426426
* Returns the skb on success, NULL on failure.
427427
*/
428428
static struct sk_buff *
429-
ice_construct_skb_zc(struct ice_rx_ring *rx_ring, struct xdp_buff **xdp_arr)
429+
ice_construct_skb_zc(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp)
430430
{
431-
struct xdp_buff *xdp = *xdp_arr;
431+
unsigned int datasize_hard = xdp->data_end - xdp->data_hard_start;
432432
unsigned int metasize = xdp->data - xdp->data_meta;
433433
unsigned int datasize = xdp->data_end - xdp->data;
434-
unsigned int datasize_hard = xdp->data_end - xdp->data_hard_start;
435434
struct sk_buff *skb;
436435

437436
skb = __napi_alloc_skb(&rx_ring->q_vector->napi, datasize_hard,
@@ -445,7 +444,6 @@ ice_construct_skb_zc(struct ice_rx_ring *rx_ring, struct xdp_buff **xdp_arr)
445444
skb_metadata_set(skb, metasize);
446445

447446
xsk_buff_free(xdp);
448-
*xdp_arr = NULL;
449447
return skb;
450448
}
451449

@@ -507,7 +505,6 @@ ice_run_xdp_zc(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp,
507505
int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
508506
{
509507
unsigned int total_rx_bytes = 0, total_rx_packets = 0;
510-
u16 cleaned_count = ICE_DESC_UNUSED(rx_ring);
511508
struct ice_tx_ring *xdp_ring;
512509
unsigned int xdp_xmit = 0;
513510
struct bpf_prog *xdp_prog;
@@ -522,7 +519,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
522519
while (likely(total_rx_packets < (unsigned int)budget)) {
523520
union ice_32b_rx_flex_desc *rx_desc;
524521
unsigned int size, xdp_res = 0;
525-
struct xdp_buff **xdp;
522+
struct xdp_buff *xdp;
526523
struct sk_buff *skb;
527524
u16 stat_err_bits;
528525
u16 vlan_tag = 0;
@@ -540,39 +537,42 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
540537
*/
541538
dma_rmb();
542539

540+
xdp = *ice_xdp_buf(rx_ring, rx_ring->next_to_clean);
541+
543542
size = le16_to_cpu(rx_desc->wb.pkt_len) &
544543
ICE_RX_FLX_DESC_PKT_LEN_M;
545-
if (!size)
546-
break;
544+
if (!size) {
545+
xdp->data = NULL;
546+
xdp->data_end = NULL;
547+
xdp->data_hard_start = NULL;
548+
xdp->data_meta = NULL;
549+
goto construct_skb;
550+
}
547551

548-
xdp = &rx_ring->xdp_buf[rx_ring->next_to_clean];
549-
xsk_buff_set_size(*xdp, size);
550-
xsk_buff_dma_sync_for_cpu(*xdp, rx_ring->xsk_pool);
552+
xsk_buff_set_size(xdp, size);
553+
xsk_buff_dma_sync_for_cpu(xdp, rx_ring->xsk_pool);
551554

552-
xdp_res = ice_run_xdp_zc(rx_ring, *xdp, xdp_prog, xdp_ring);
555+
xdp_res = ice_run_xdp_zc(rx_ring, xdp, xdp_prog, xdp_ring);
553556
if (xdp_res) {
554557
if (xdp_res & (ICE_XDP_TX | ICE_XDP_REDIR))
555558
xdp_xmit |= xdp_res;
556559
else
557-
xsk_buff_free(*xdp);
560+
xsk_buff_free(xdp);
558561

559-
*xdp = NULL;
560562
total_rx_bytes += size;
561563
total_rx_packets++;
562-
cleaned_count++;
563564

564565
ice_bump_ntc(rx_ring);
565566
continue;
566567
}
567-
568+
construct_skb:
568569
/* XDP_PASS path */
569570
skb = ice_construct_skb_zc(rx_ring, xdp);
570571
if (!skb) {
571572
rx_ring->rx_stats.alloc_buf_failed++;
572573
break;
573574
}
574575

575-
cleaned_count++;
576576
ice_bump_ntc(rx_ring);
577577

578578
if (eth_skb_pad(skb)) {
@@ -594,8 +594,7 @@ int ice_clean_rx_irq_zc(struct ice_rx_ring *rx_ring, int budget)
594594
ice_receive_skb(rx_ring, skb, vlan_tag);
595595
}
596596

597-
if (cleaned_count >= ICE_RX_BUF_WRITE)
598-
failure = !ice_alloc_rx_bufs_zc(rx_ring, cleaned_count);
597+
failure = !ice_alloc_rx_bufs_zc(rx_ring, ICE_DESC_UNUSED(rx_ring));
599598

600599
ice_finalize_xdp_rx(xdp_ring, xdp_xmit);
601600
ice_update_rx_ring_stats(rx_ring, total_rx_packets, total_rx_bytes);
@@ -811,15 +810,14 @@ bool ice_xsk_any_rx_ring_ena(struct ice_vsi *vsi)
811810
*/
812811
void ice_xsk_clean_rx_ring(struct ice_rx_ring *rx_ring)
813812
{
814-
u16 i;
815-
816-
for (i = 0; i < rx_ring->count; i++) {
817-
struct xdp_buff **xdp = &rx_ring->xdp_buf[i];
813+
u16 count_mask = rx_ring->count - 1;
814+
u16 ntc = rx_ring->next_to_clean;
815+
u16 ntu = rx_ring->next_to_use;
818816

819-
if (!xdp)
820-
continue;
817+
for ( ; ntc != ntu; ntc = (ntc + 1) & count_mask) {
818+
struct xdp_buff *xdp = *ice_xdp_buf(rx_ring, ntc);
821819

822-
*xdp = NULL;
820+
xsk_buff_free(xdp);
823821
}
824822
}
825823

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9254,7 +9254,7 @@ static int __maybe_unused igb_suspend(struct device *dev)
92549254
return __igb_shutdown(to_pci_dev(dev), NULL, 0);
92559255
}
92569256

9257-
static int __maybe_unused igb_resume(struct device *dev)
9257+
static int __maybe_unused __igb_resume(struct device *dev, bool rpm)
92589258
{
92599259
struct pci_dev *pdev = to_pci_dev(dev);
92609260
struct net_device *netdev = pci_get_drvdata(pdev);
@@ -9297,17 +9297,24 @@ static int __maybe_unused igb_resume(struct device *dev)
92979297

92989298
wr32(E1000_WUS, ~0);
92999299

9300-
rtnl_lock();
9300+
if (!rpm)
9301+
rtnl_lock();
93019302
if (!err && netif_running(netdev))
93029303
err = __igb_open(netdev, true);
93039304

93049305
if (!err)
93059306
netif_device_attach(netdev);
9306-
rtnl_unlock();
9307+
if (!rpm)
9308+
rtnl_unlock();
93079309

93089310
return err;
93099311
}
93109312

9313+
static int __maybe_unused igb_resume(struct device *dev)
9314+
{
9315+
return __igb_resume(dev, false);
9316+
}
9317+
93119318
static int __maybe_unused igb_runtime_idle(struct device *dev)
93129319
{
93139320
struct net_device *netdev = dev_get_drvdata(dev);
@@ -9326,7 +9333,7 @@ static int __maybe_unused igb_runtime_suspend(struct device *dev)
93269333

93279334
static int __maybe_unused igb_runtime_resume(struct device *dev)
93289335
{
9329-
return igb_resume(dev);
9336+
return __igb_resume(dev, true);
93309337
}
93319338

93329339
static void igb_shutdown(struct pci_dev *pdev)
@@ -9442,7 +9449,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
94429449
* @pdev: Pointer to PCI device
94439450
*
94449451
* Restart the card from scratch, as if from a cold-boot. Implementation
9445-
* resembles the first-half of the igb_resume routine.
9452+
* resembles the first-half of the __igb_resume routine.
94469453
**/
94479454
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
94489455
{
@@ -9482,7 +9489,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
94829489
*
94839490
* This callback is called when the error recovery driver tells us that
94849491
* its OK to resume normal operation. Implementation resembles the
9485-
* second-half of the igb_resume routine.
9492+
* second-half of the __igb_resume routine.
94869493
*/
94879494
static void igb_io_resume(struct pci_dev *pdev)
94889495
{

0 commit comments

Comments
 (0)