Skip to content

Commit f8f5627

Browse files
committed
Merge tag 'net-7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Jakub Kicinski: "With fixes from wireless, bluetooth and netfilter included we're back to each PR carrying 30%+ more fixes than in previous era. The good news is that so far none of the "extra" fixes are themselves causing real regressions. Not sure how much comfort that is. Current release - fix to a fix: - netdevsim: fix build if SKB_EXTENSIONS=n - eth: stmmac: skip VLAN restore when VLAN hash ops are missing Previous releases - regressions: - wifi: iwlwifi: mvm: don't send a 6E related command when not supported Previous releases - always broken: - some info leak fixes - add missing clearing of skb->cb[] on ICMP paths from tunnels - ipv6: - flowlabel: defer exclusive option free until RCU teardown - avoid overflows in ip6_datagram_send_ctl() - mpls: add seqcount to protect platform_labels from OOB access - bridge: improve safety of parsing ND options - bluetooth: fix leaks, overflows and races in hci_sync - netfilter: add more input validation, some to address bugs directly some to prevent exploits from cooking up broken configurations - wifi: - ath: avoid poor performance due to stopping the wrong aggregation session - virt_wifi: remove SET_NETDEV_DEV to avoid use-after-free - eth: - fec: fix the PTP periodic output sysfs interface - enetc: safely reinitialize TX BD ring when it has unsent frames" * tag 'net-7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (95 commits) eth: fbnic: Increase FBNIC_QUEUE_SIZE_MIN to 64 ipv6: avoid overflows in ip6_datagram_send_ctl() net: hsr: fix VLAN add unwind on slave errors net: hsr: serialize seq_blocks merge across nodes vsock: initialize child_ns_mode_locked in vsock_net_init() selftests/tc-testing: add tests for cls_fw and cls_flow on shared blocks net/sched: cls_flow: fix NULL pointer dereference on shared blocks net/sched: cls_fw: fix NULL pointer dereference on shared blocks net/x25: Fix overflow when accumulating packets net/x25: Fix potential double free of skb bnxt_en: Restore default stat ctxs for ULP when resource is available bnxt_en: Don't assume XDP is never enabled in bnxt_init_dflt_ring_mode() bnxt_en: Refactor some basic ring setup and adjustment logic net/mlx5: Fix switchdev mode rollback in case of failure net/mlx5: Avoid "No data available" when FW version queries fail net/mlx5: lag: Check for LAG device before creating debugfs net: macb: properly unregister fixed rate clocks net: macb: fix clk handling on PCI glue driver removal virtio_net: clamp rss_max_key_size to NETDEV_RSS_KEY_LEN net/sched: sch_netem: fix out-of-bounds access in packet corruption ...
2 parents 4c2c526 + ec7067e commit f8f5627

98 files changed

Lines changed: 1147 additions & 493 deletions

File tree

Some content is hidden

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

drivers/bluetooth/hci_h4.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ static int h4_recv(struct hci_uart *hu, const void *data, int count)
109109
{
110110
struct h4_struct *h4 = hu->priv;
111111

112-
if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
113-
return -EUNATCH;
114-
115112
h4->rx_skb = h4_recv_buf(hu, h4->rx_skb, data, count,
116113
h4_recv_pkts, ARRAY_SIZE(h4_recv_pkts));
117114
if (IS_ERR(h4->rx_skb)) {

drivers/net/bonding/bond_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5326,7 +5326,7 @@ static netdev_tx_t bond_xmit_broadcast(struct sk_buff *skb,
53265326
if (!(bond_slave_is_up(slave) && slave->link == BOND_LINK_UP))
53275327
continue;
53285328

5329-
if (bond_is_last_slave(bond, slave)) {
5329+
if (i + 1 == slaves_count) {
53305330
skb2 = skb;
53315331
skb_used = true;
53325332
} else {

drivers/net/ethernet/airoha/airoha_eth.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,18 +794,34 @@ static int airoha_qdma_init_rx_queue(struct airoha_queue *q,
794794

795795
static void airoha_qdma_cleanup_rx_queue(struct airoha_queue *q)
796796
{
797-
struct airoha_eth *eth = q->qdma->eth;
797+
struct airoha_qdma *qdma = q->qdma;
798+
struct airoha_eth *eth = qdma->eth;
799+
int qid = q - &qdma->q_rx[0];
798800

799801
while (q->queued) {
800802
struct airoha_queue_entry *e = &q->entry[q->tail];
803+
struct airoha_qdma_desc *desc = &q->desc[q->tail];
801804
struct page *page = virt_to_head_page(e->buf);
802805

803806
dma_sync_single_for_cpu(eth->dev, e->dma_addr, e->dma_len,
804807
page_pool_get_dma_dir(q->page_pool));
805808
page_pool_put_full_page(q->page_pool, page, false);
809+
/* Reset DMA descriptor */
810+
WRITE_ONCE(desc->ctrl, 0);
811+
WRITE_ONCE(desc->addr, 0);
812+
WRITE_ONCE(desc->data, 0);
813+
WRITE_ONCE(desc->msg0, 0);
814+
WRITE_ONCE(desc->msg1, 0);
815+
WRITE_ONCE(desc->msg2, 0);
816+
WRITE_ONCE(desc->msg3, 0);
817+
806818
q->tail = (q->tail + 1) % q->ndesc;
807819
q->queued--;
808820
}
821+
822+
q->head = q->tail;
823+
airoha_qdma_rmw(qdma, REG_RX_DMA_IDX(qid), RX_RING_DMA_IDX_MASK,
824+
FIELD_PREP(RX_RING_DMA_IDX_MASK, q->tail));
809825
}
810826

811827
static int airoha_qdma_init_rx(struct airoha_qdma *qdma)
@@ -2946,6 +2962,8 @@ static int airoha_register_gdm_devices(struct airoha_eth *eth)
29462962
return err;
29472963
}
29482964

2965+
set_bit(DEV_STATE_REGISTERED, &eth->state);
2966+
29492967
return 0;
29502968
}
29512969

drivers/net/ethernet/airoha/airoha_eth.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ enum {
8888

8989
enum {
9090
DEV_STATE_INITIALIZED,
91+
DEV_STATE_REGISTERED,
9192
};
9293

9394
enum {

drivers/net/ethernet/airoha/airoha_ppe.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,13 @@ int airoha_ppe_setup_tc_block_cb(struct airoha_ppe_dev *dev, void *type_data)
13681368
struct airoha_eth *eth = ppe->eth;
13691369
int err = 0;
13701370

1371+
/* Netfilter flowtable can try to offload flower rules while not all
1372+
* the net_devices are registered or initialized. Delay offloading
1373+
* until all net_devices are registered in the system.
1374+
*/
1375+
if (!test_bit(DEV_STATE_REGISTERED, &eth->state))
1376+
return -EBUSY;
1377+
13711378
mutex_lock(&flow_offload_mutex);
13721379

13731380
if (!eth->npu)

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8045,6 +8045,8 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
80458045
ulp_msix = bnxt_get_avail_msix(bp, bp->ulp_num_msix_want);
80468046
if (!ulp_msix)
80478047
bnxt_set_ulp_stat_ctxs(bp, 0);
8048+
else
8049+
bnxt_set_dflt_ulp_stat_ctxs(bp);
80488050

80498051
if (ulp_msix > bp->ulp_num_msix_want)
80508052
ulp_msix = bp->ulp_num_msix_want;
@@ -8671,7 +8673,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
86718673
struct hwrm_func_backing_store_qcaps_v2_output *resp;
86728674
struct hwrm_func_backing_store_qcaps_v2_input *req;
86738675
struct bnxt_ctx_mem_info *ctx = bp->ctx;
8674-
u16 type;
8676+
u16 type, next_type = 0;
86758677
int rc;
86768678

86778679
rc = hwrm_req_init(bp, req, HWRM_FUNC_BACKING_STORE_QCAPS_V2);
@@ -8687,7 +8689,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
86878689

86888690
resp = hwrm_req_hold(bp, req);
86898691

8690-
for (type = 0; type < BNXT_CTX_V2_MAX; ) {
8692+
for (type = 0; type < BNXT_CTX_V2_MAX; type = next_type) {
86918693
struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type];
86928694
u8 init_val, init_off, i;
86938695
u32 max_entries;
@@ -8700,7 +8702,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
87008702
if (rc)
87018703
goto ctx_done;
87028704
flags = le32_to_cpu(resp->flags);
8703-
type = le16_to_cpu(resp->next_valid_type);
8705+
next_type = le16_to_cpu(resp->next_valid_type);
87048706
if (!(flags & BNXT_CTX_MEM_TYPE_VALID)) {
87058707
bnxt_free_one_ctx_mem(bp, ctxm, true);
87068708
continue;
@@ -8715,7 +8717,7 @@ static int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp)
87158717
else
87168718
continue;
87178719
}
8718-
ctxm->type = le16_to_cpu(resp->type);
8720+
ctxm->type = type;
87198721
ctxm->entry_size = entry_size;
87208722
ctxm->flags = flags;
87218723
ctxm->instance_bmap = le32_to_cpu(resp->instance_bit_map);
@@ -12992,6 +12994,21 @@ static int bnxt_tx_nr_rings_per_tc(struct bnxt *bp)
1299212994
return bp->num_tc ? bp->tx_nr_rings / bp->num_tc : bp->tx_nr_rings;
1299312995
}
1299412996

12997+
static void bnxt_set_xdp_tx_rings(struct bnxt *bp)
12998+
{
12999+
bp->tx_nr_rings_xdp = bp->tx_nr_rings_per_tc;
13000+
bp->tx_nr_rings += bp->tx_nr_rings_xdp;
13001+
}
13002+
13003+
static void bnxt_adj_tx_rings(struct bnxt *bp)
13004+
{
13005+
/* Make adjustments if reserved TX rings are less than requested */
13006+
bp->tx_nr_rings -= bp->tx_nr_rings_xdp;
13007+
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
13008+
if (bp->tx_nr_rings_xdp)
13009+
bnxt_set_xdp_tx_rings(bp);
13010+
}
13011+
1299513012
static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1299613013
{
1299713014
int rc = 0;
@@ -13009,13 +13026,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1300913026
if (rc)
1301013027
return rc;
1301113028

13012-
/* Make adjustments if reserved TX rings are less than requested */
13013-
bp->tx_nr_rings -= bp->tx_nr_rings_xdp;
13014-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
13015-
if (bp->tx_nr_rings_xdp) {
13016-
bp->tx_nr_rings_xdp = bp->tx_nr_rings_per_tc;
13017-
bp->tx_nr_rings += bp->tx_nr_rings_xdp;
13018-
}
13029+
bnxt_adj_tx_rings(bp);
1301913030
rc = bnxt_alloc_mem(bp, irq_re_init);
1302013031
if (rc) {
1302113032
netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
@@ -15436,11 +15447,19 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu)
1543615447
return 0;
1543715448
}
1543815449

15450+
void bnxt_set_cp_rings(struct bnxt *bp, bool sh)
15451+
{
15452+
int tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
15453+
15454+
bp->cp_nr_rings = sh ? max_t(int, tx_cp, bp->rx_nr_rings) :
15455+
tx_cp + bp->rx_nr_rings;
15456+
}
15457+
1543915458
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
1544015459
{
1544115460
struct bnxt *bp = netdev_priv(dev);
1544215461
bool sh = false;
15443-
int rc, tx_cp;
15462+
int rc;
1544415463

1544515464
if (tc > bp->max_tc) {
1544615465
netdev_err(dev, "Too many traffic classes requested: %d. Max supported is %d.\n",
@@ -15473,9 +15492,7 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
1547315492
bp->num_tc = 0;
1547415493
}
1547515494
bp->tx_nr_rings += bp->tx_nr_rings_xdp;
15476-
tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
15477-
bp->cp_nr_rings = sh ? max_t(int, tx_cp, bp->rx_nr_rings) :
15478-
tx_cp + bp->rx_nr_rings;
15495+
bnxt_set_cp_rings(bp, sh);
1547915496

1548015497
if (netif_running(bp->dev))
1548115498
return bnxt_open_nic(bp, true, false);
@@ -16525,6 +16542,19 @@ static void bnxt_trim_dflt_sh_rings(struct bnxt *bp)
1652516542
bp->tx_nr_rings = bnxt_tx_nr_rings(bp);
1652616543
}
1652716544

16545+
static void bnxt_adj_dflt_rings(struct bnxt *bp, bool sh)
16546+
{
16547+
if (sh)
16548+
bnxt_trim_dflt_sh_rings(bp);
16549+
else
16550+
bp->cp_nr_rings = bp->tx_nr_rings_per_tc + bp->rx_nr_rings;
16551+
bp->tx_nr_rings = bnxt_tx_nr_rings(bp);
16552+
if (sh && READ_ONCE(bp->xdp_prog)) {
16553+
bnxt_set_xdp_tx_rings(bp);
16554+
bnxt_set_cp_rings(bp, true);
16555+
}
16556+
}
16557+
1652816558
static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1652916559
{
1653016560
int dflt_rings, max_rx_rings, max_tx_rings, rc;
@@ -16550,11 +16580,8 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1655016580
return rc;
1655116581
bp->rx_nr_rings = min_t(int, dflt_rings, max_rx_rings);
1655216582
bp->tx_nr_rings_per_tc = min_t(int, dflt_rings, max_tx_rings);
16553-
if (sh)
16554-
bnxt_trim_dflt_sh_rings(bp);
16555-
else
16556-
bp->cp_nr_rings = bp->tx_nr_rings_per_tc + bp->rx_nr_rings;
16557-
bp->tx_nr_rings = bnxt_tx_nr_rings(bp);
16583+
16584+
bnxt_adj_dflt_rings(bp, sh);
1655816585

1655916586
avail_msix = bnxt_get_max_func_irqs(bp) - bp->cp_nr_rings;
1656016587
if (avail_msix >= BNXT_MIN_ROCE_CP_RINGS) {
@@ -16567,16 +16594,17 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
1656716594
rc = __bnxt_reserve_rings(bp);
1656816595
if (rc && rc != -ENODEV)
1656916596
netdev_warn(bp->dev, "Unable to reserve tx rings\n");
16570-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
16597+
16598+
bnxt_adj_tx_rings(bp);
1657116599
if (sh)
16572-
bnxt_trim_dflt_sh_rings(bp);
16600+
bnxt_adj_dflt_rings(bp, true);
1657316601

1657416602
/* Rings may have been trimmed, re-reserve the trimmed rings. */
1657516603
if (bnxt_need_reserve_rings(bp)) {
1657616604
rc = __bnxt_reserve_rings(bp);
1657716605
if (rc && rc != -ENODEV)
1657816606
netdev_warn(bp->dev, "2nd rings reservation failed.\n");
16579-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
16607+
bnxt_adj_tx_rings(bp);
1658016608
}
1658116609
if (BNXT_CHIP_TYPE_NITRO_A0(bp)) {
1658216610
bp->rx_nr_rings++;
@@ -16610,7 +16638,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp)
1661016638
if (rc)
1661116639
goto init_dflt_ring_err;
1661216640

16613-
bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
16641+
bnxt_adj_tx_rings(bp);
1661416642

1661516643
bnxt_set_dflt_rfs(bp);
1661616644

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,6 +2985,7 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
29852985
int tx_xdp);
29862986
int bnxt_fw_init_one(struct bnxt *bp);
29872987
bool bnxt_hwrm_reset_permitted(struct bnxt *bp);
2988+
void bnxt_set_cp_rings(struct bnxt *bp, bool sh);
29882989
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
29892990
struct bnxt_ntuple_filter *bnxt_lookup_ntp_filter_from_idx(struct bnxt *bp,
29902991
struct bnxt_ntuple_filter *fltr, u32 idx);

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,6 @@ static int bnxt_set_channels(struct net_device *dev,
945945
bool sh = false;
946946
int tx_xdp = 0;
947947
int rc = 0;
948-
int tx_cp;
949948

950949
if (channel->other_count)
951950
return -EINVAL;
@@ -1013,9 +1012,7 @@ static int bnxt_set_channels(struct net_device *dev,
10131012
if (tcs > 1)
10141013
bp->tx_nr_rings = bp->tx_nr_rings_per_tc * tcs + tx_xdp;
10151014

1016-
tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
1017-
bp->cp_nr_rings = sh ? max_t(int, tx_cp, bp->rx_nr_rings) :
1018-
tx_cp + bp->rx_nr_rings;
1015+
bnxt_set_cp_rings(bp, sh);
10191016

10201017
/* After changing number of rx channels, update NTUPLE feature. */
10211018
netdev_update_features(dev);

drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ int bnxt_xdp_xmit(struct net_device *dev, int num_frames,
384384
static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog)
385385
{
386386
struct net_device *dev = bp->dev;
387-
int tx_xdp = 0, tx_cp, rc, tc;
387+
int tx_xdp = 0, rc, tc;
388388
struct bpf_prog *old;
389389

390390
netdev_assert_locked(dev);
@@ -431,8 +431,7 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog)
431431
}
432432
bp->tx_nr_rings_xdp = tx_xdp;
433433
bp->tx_nr_rings = bp->tx_nr_rings_per_tc * tc + tx_xdp;
434-
tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
435-
bp->cp_nr_rings = max_t(int, tx_cp, bp->rx_nr_rings);
434+
bnxt_set_cp_rings(bp, true);
436435
bnxt_set_tpa_flags(bp);
437436
bnxt_set_ring_params(bp);
438437

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12299,7 +12299,7 @@ static int tg3_get_link_ksettings(struct net_device *dev,
1229912299
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
1230012300
advertising);
1230112301

12302-
if (netif_running(dev) && tp->link_up) {
12302+
if (netif_running(dev) && netif_carrier_ok(dev)) {
1230312303
cmd->base.speed = tp->link_config.active_speed;
1230412304
cmd->base.duplex = tp->link_config.active_duplex;
1230512305
ethtool_convert_legacy_u32_to_link_mode(

0 commit comments

Comments
 (0)