Skip to content

Commit 8c245fe

Browse files
committed
Merge tag 'net-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from ieee802154, bluetooth and netfilter. Current release - regressions: - eth: mlx5: fix wrong reserved field in hca_cap_2 in mlx5_ifc - eth: am65-cpsw: fix forever loop in cleanup code Current release - new code bugs: - eth: mlx5: HWS, fixed double-free in error flow of creating SQ Previous releases - regressions: - core: avoid potential underflow in qdisc_pkt_len_init() with UFO - core: test for not too small csum_start in virtio_net_hdr_to_skb() - vrf: revert "vrf: remove unnecessary RCU-bh critical section" - bluetooth: - fix uaf in l2cap_connect - fix possible crash on mgmt_index_removed - dsa: improve shutdown sequence - eth: mlx5e: SHAMPO, fix overflow of hd_per_wq - eth: ip_gre: fix drops of small packets in ipgre_xmit Previous releases - always broken: - core: fix gso_features_check to check for both dev->gso_{ipv4_,}max_size - core: fix tcp fraglist segmentation after pull from frag_list - netfilter: nf_tables: prevent nf_skb_duplicated corruption - sctp: set sk_state back to CLOSED if autobind fails in sctp_listen_start - mac802154: fix potential RCU dereference issue in mac802154_scan_worker - eth: fec: restart PPS after link state change" * tag 'net-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (48 commits) sctp: set sk_state back to CLOSED if autobind fails in sctp_listen_start dt-bindings: net: xlnx,axi-ethernet: Add missing reg minItems doc: net: napi: Update documentation for napi_schedule_irqoff net/ncsi: Disable the ncsi work before freeing the associated structure net: phy: qt2025: Fix warning: unused import DeviceId gso: fix udp gso fraglist segmentation after pull from frag_list bridge: mcast: Fail MDB get request on empty entry vrf: revert "vrf: Remove unnecessary RCU-bh critical section" net: ethernet: ti: am65-cpsw: Fix forever loop in cleanup code net: phy: realtek: Check the index value in led_hw_control_get ppp: do not assume bh is held in ppp_channel_bridge_input() selftests: rds: move include.sh to TEST_FILES net: test for not too small csum_start in virtio_net_hdr_to_skb() net: gso: fix tcp fraglist segmentation after pull from frag_list ipv4: ip_gre: Fix drops of small packets in ipgre_xmit net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check net: add more sanity checks to qdisc_pkt_len_init() net: avoid potential underflow in qdisc_pkt_len_init() with UFO net: ethernet: ti: cpsw_ale: Fix warning on some platforms net: microchip: Make FDMA config symbol invisible ...
2 parents 9c02404 + 8beee4d commit 8c245fe

File tree

55 files changed

+310
-127
lines changed

Some content is hidden

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

55 files changed

+310
-127
lines changed

Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ properties:
3434
and length of the AXI DMA controller IO space, unless
3535
axistream-connected is specified, in which case the reg
3636
attribute of the node referenced by it is used.
37+
minItems: 1
3738
maxItems: 2
3839

3940
interrupts:
@@ -181,7 +182,7 @@ examples:
181182
clock-names = "s_axi_lite_clk", "axis_clk", "ref_clk", "mgt_clk";
182183
clocks = <&axi_clk>, <&axi_clk>, <&pl_enet_ref_clk>, <&mgt_clk>;
183184
phy-mode = "mii";
184-
reg = <0x00 0x40000000 0x00 0x40000>;
185+
reg = <0x40000000 0x40000>;
185186
xlnx,rxcsum = <0x2>;
186187
xlnx,rxmem = <0x800>;
187188
xlnx,txcsum = <0x2>;

Documentation/networking/napi.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,8 @@ IRQ should only be unmasked after a successful call to napi_complete_done():
144144
145145
napi_schedule_irqoff() is a variant of napi_schedule() which takes advantage
146146
of guarantees given by being invoked in IRQ context (no need to
147-
mask interrupts). Note that PREEMPT_RT forces all interrupts
148-
to be threaded so the interrupt may need to be marked ``IRQF_NO_THREAD``
149-
to avoid issues on real-time kernel configurations.
147+
mask interrupts). napi_schedule_irqoff() will fall back to napi_schedule() if
148+
IRQs are threaded (such as if ``PREEMPT_RT`` is enabled).
150149

151150
Instance to queue mapping
152151
-------------------------

drivers/bluetooth/btmrvl_sdio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int btmrvl_sdio_probe_of(struct device *dev,
9292
} else {
9393
ret = devm_request_irq(dev, cfg->irq_bt,
9494
btmrvl_wake_irq_bt,
95-
0, "bt_wake", card);
95+
IRQF_NO_AUTOEN, "bt_wake", card);
9696
if (ret) {
9797
dev_err(dev,
9898
"Failed to request irq_bt %d (%d)\n",
@@ -101,7 +101,6 @@ static int btmrvl_sdio_probe_of(struct device *dev,
101101

102102
/* Configure wakeup (enabled by default) */
103103
device_init_wakeup(dev, true);
104-
disable_irq(cfg->irq_bt);
105104
}
106105
}
107106

drivers/net/ethernet/freescale/fec.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,19 @@ struct fec_enet_private {
691691
/* XDP BPF Program */
692692
struct bpf_prog *xdp_prog;
693693

694+
struct {
695+
int pps_enable;
696+
u64 ns_sys, ns_phc;
697+
u32 at_corr;
698+
u8 at_inc_corr;
699+
} ptp_saved_state;
700+
694701
u64 ethtool_stats[];
695702
};
696703

697704
void fec_ptp_init(struct platform_device *pdev, int irq_idx);
705+
void fec_ptp_restore_state(struct fec_enet_private *fep);
706+
void fec_ptp_save_state(struct fec_enet_private *fep);
698707
void fec_ptp_stop(struct platform_device *pdev);
699708
void fec_ptp_start_cyclecounter(struct net_device *ndev);
700709
int fec_ptp_set(struct net_device *ndev, struct kernel_hwtstamp_config *config,

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,8 @@ fec_restart(struct net_device *ndev)
10771077
u32 rcntl = OPT_FRAME_SIZE | 0x04;
10781078
u32 ecntl = FEC_ECR_ETHEREN;
10791079

1080+
fec_ptp_save_state(fep);
1081+
10801082
/* Whack a reset. We should wait for this.
10811083
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
10821084
* instead of reset MAC itself.
@@ -1244,8 +1246,10 @@ fec_restart(struct net_device *ndev)
12441246
writel(ecntl, fep->hwp + FEC_ECNTRL);
12451247
fec_enet_active_rxring(ndev);
12461248

1247-
if (fep->bufdesc_ex)
1249+
if (fep->bufdesc_ex) {
12481250
fec_ptp_start_cyclecounter(ndev);
1251+
fec_ptp_restore_state(fep);
1252+
}
12491253

12501254
/* Enable interrupts we wish to service */
12511255
if (fep->link)
@@ -1336,6 +1340,8 @@ fec_stop(struct net_device *ndev)
13361340
netdev_err(ndev, "Graceful transmit stop did not complete!\n");
13371341
}
13381342

1343+
fec_ptp_save_state(fep);
1344+
13391345
/* Whack a reset. We should wait for this.
13401346
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
13411347
* instead of reset MAC itself.
@@ -1366,6 +1372,9 @@ fec_stop(struct net_device *ndev)
13661372
val = readl(fep->hwp + FEC_ECNTRL);
13671373
val |= FEC_ECR_EN1588;
13681374
writel(val, fep->hwp + FEC_ECNTRL);
1375+
1376+
fec_ptp_start_cyclecounter(ndev);
1377+
fec_ptp_restore_state(fep);
13691378
}
13701379
}
13711380

drivers/net/ethernet/freescale/fec_ptp.c

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,56 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
764764
schedule_delayed_work(&fep->time_keep, HZ);
765765
}
766766

767+
void fec_ptp_save_state(struct fec_enet_private *fep)
768+
{
769+
unsigned long flags;
770+
u32 atime_inc_corr;
771+
772+
spin_lock_irqsave(&fep->tmreg_lock, flags);
773+
774+
fep->ptp_saved_state.pps_enable = fep->pps_enable;
775+
776+
fep->ptp_saved_state.ns_phc = timecounter_read(&fep->tc);
777+
fep->ptp_saved_state.ns_sys = ktime_get_ns();
778+
779+
fep->ptp_saved_state.at_corr = readl(fep->hwp + FEC_ATIME_CORR);
780+
atime_inc_corr = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_CORR_MASK;
781+
fep->ptp_saved_state.at_inc_corr = (u8)(atime_inc_corr >> FEC_T_INC_CORR_OFFSET);
782+
783+
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
784+
}
785+
786+
/* Restore PTP functionality after a reset */
787+
void fec_ptp_restore_state(struct fec_enet_private *fep)
788+
{
789+
u32 atime_inc = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_MASK;
790+
unsigned long flags;
791+
u32 counter;
792+
u64 ns;
793+
794+
spin_lock_irqsave(&fep->tmreg_lock, flags);
795+
796+
/* Reset turned it off, so adjust our status flag */
797+
fep->pps_enable = 0;
798+
799+
writel(fep->ptp_saved_state.at_corr, fep->hwp + FEC_ATIME_CORR);
800+
atime_inc |= ((u32)fep->ptp_saved_state.at_inc_corr) << FEC_T_INC_CORR_OFFSET;
801+
writel(atime_inc, fep->hwp + FEC_ATIME_INC);
802+
803+
ns = ktime_get_ns() - fep->ptp_saved_state.ns_sys + fep->ptp_saved_state.ns_phc;
804+
counter = ns & fep->cc.mask;
805+
writel(counter, fep->hwp + FEC_ATIME);
806+
timecounter_init(&fep->tc, &fep->cc, ns);
807+
808+
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
809+
810+
/* Restart PPS if needed */
811+
if (fep->ptp_saved_state.pps_enable) {
812+
/* Re-enable PPS */
813+
fec_ptp_enable_pps(fep, 1);
814+
}
815+
}
816+
767817
void fec_ptp_stop(struct platform_device *pdev)
768818
{
769819
struct net_device *ndev = platform_get_drvdata(pdev);

drivers/net/ethernet/lantiq_etop.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,9 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
481481
unsigned long flags;
482482
u32 byte_offset;
483483

484-
len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
484+
if (skb_put_padto(skb, ETH_ZLEN))
485+
return NETDEV_TX_OK;
486+
len = skb->len;
485487

486488
if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
487489
netdev_err(dev, "tx ring full\n");

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ struct mlx5e_shampo_hd {
627627
struct mlx5e_dma_info *info;
628628
struct mlx5e_frag_page *pages;
629629
u16 curr_page_index;
630-
u16 hd_per_wq;
630+
u32 hd_per_wq;
631631
u16 hd_per_wqe;
632632
unsigned long *bitmap;
633633
u16 pi;

drivers/net/ethernet/mellanox/mlx5/core/en/tir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ struct mlx5e_tir_builder *mlx5e_tir_builder_alloc(bool modify)
2323
struct mlx5e_tir_builder *builder;
2424

2525
builder = kvzalloc(sizeof(*builder), GFP_KERNEL);
26+
if (!builder)
27+
return NULL;
28+
2629
builder->modify = modify;
2730

2831
return builder;

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,20 @@ static void mlx5e_ipsec_handle_sw_limits(struct work_struct *_work)
6767
return;
6868

6969
spin_lock_bh(&x->lock);
70-
xfrm_state_check_expire(x);
7170
if (x->km.state == XFRM_STATE_EXPIRED) {
7271
sa_entry->attrs.drop = true;
7372
spin_unlock_bh(&x->lock);
7473

7574
mlx5e_accel_ipsec_fs_modify(sa_entry);
7675
return;
7776
}
77+
78+
if (x->km.state != XFRM_STATE_VALID) {
79+
spin_unlock_bh(&x->lock);
80+
return;
81+
}
82+
83+
xfrm_state_check_expire(x);
7884
spin_unlock_bh(&x->lock);
7985

8086
queue_delayed_work(sa_entry->ipsec->wq, &dwork->dwork,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
642642
return;
643643

644644
err_unmap:
645-
mlx5e_dma_unmap_wqe_err(sq, 1);
646645
sq->stats->dropped++;
647646
dev_kfree_skb_any(skb);
648647
mlx5e_tx_flush(sq);

drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
pci_write_config_dword((dev)->pdev, (dev)->vsc_addr + (offset), (val))
2525
#define VSC_MAX_RETRIES 2048
2626

27+
/* Reading VSC registers can take relatively long time.
28+
* Yield the cpu every 128 registers read.
29+
*/
30+
#define VSC_GW_READ_BLOCK_COUNT 128
31+
2732
enum {
2833
VSC_CTRL_OFFSET = 0x4,
2934
VSC_COUNTER_OFFSET = 0x8,
@@ -273,13 +278,18 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
273278
{
274279
unsigned int next_read_addr = 0;
275280
unsigned int read_addr = 0;
281+
unsigned int count = 0;
276282

277283
while (read_addr < length) {
278284
if (mlx5_vsc_gw_read_fast(dev, read_addr, &next_read_addr,
279285
&data[(read_addr >> 2)]))
280286
return read_addr;
281287

282288
read_addr = next_read_addr;
289+
if (++count == VSC_GW_READ_BLOCK_COUNT) {
290+
cond_resched();
291+
count = 0;
292+
}
283293
}
284294
return length;
285295
}

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_bwc_complex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bool mlx5hws_bwc_match_params_is_complex(struct mlx5hws_context *ctx,
3333
* and let the usual match creation path handle it,
3434
* both for good and bad flows.
3535
*/
36-
if (ret == E2BIG) {
36+
if (ret == -E2BIG) {
3737
is_complex = true;
3838
mlx5hws_dbg(ctx, "Matcher definer layout: need complex matcher\n");
3939
} else {

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_definer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ hws_definer_find_best_match_fit(struct mlx5hws_context *ctx,
18451845
return 0;
18461846
}
18471847

1848-
return E2BIG;
1848+
return -E2BIG;
18491849
}
18501850

18511851
static void
@@ -1931,7 +1931,7 @@ mlx5hws_definer_calc_layout(struct mlx5hws_context *ctx,
19311931
/* Find the match definer layout for header layout match union */
19321932
ret = hws_definer_find_best_match_fit(ctx, match_definer, match_hl);
19331933
if (ret) {
1934-
if (ret == E2BIG)
1934+
if (ret == -E2BIG)
19351935
mlx5hws_dbg(ctx,
19361936
"Failed to create match definer from header layout - E2BIG\n");
19371937
else

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_matcher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher *matcher)
675675
if (!(matcher->flags & MLX5HWS_MATCHER_FLAGS_COLLISION)) {
676676
ret = mlx5hws_definer_mt_init(ctx, matcher->mt);
677677
if (ret) {
678-
if (ret == E2BIG)
678+
if (ret == -E2BIG)
679679
mlx5hws_err(ctx, "Failed to set matcher templates with match definers\n");
680680
return ret;
681681
}

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,12 @@ static int hws_send_ring_create_sq(struct mlx5_core_dev *mdev, u32 pdn,
653653
return err;
654654
}
655655

656+
static void hws_send_ring_destroy_sq(struct mlx5_core_dev *mdev,
657+
struct mlx5hws_send_ring_sq *sq)
658+
{
659+
mlx5_core_destroy_sq(mdev, sq->sqn);
660+
}
661+
656662
static int hws_send_ring_set_sq_rdy(struct mlx5_core_dev *mdev, u32 sqn)
657663
{
658664
void *in, *sqc;
@@ -696,7 +702,7 @@ static int hws_send_ring_create_sq_rdy(struct mlx5_core_dev *mdev, u32 pdn,
696702

697703
err = hws_send_ring_set_sq_rdy(mdev, sq->sqn);
698704
if (err)
699-
hws_send_ring_close_sq(sq);
705+
hws_send_ring_destroy_sq(mdev, sq);
700706

701707
return err;
702708
}

drivers/net/ethernet/microchip/fdma/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if NET_VENDOR_MICROCHIP
77

88
config FDMA
9-
bool "FDMA API"
9+
bool "FDMA API" if COMPILE_TEST
1010
help
1111
Provides the basic FDMA functionality for multiple Microchip
1212
switchcores.

drivers/net/ethernet/microchip/sparx5/sparx5_packet.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ void sparx5_ifh_parse(u32 *ifh, struct frame_info *info)
4545
fwd = (fwd >> 5);
4646
info->src_port = FIELD_GET(GENMASK(7, 1), fwd);
4747

48+
/*
49+
* Bit 270-271 are occasionally unexpectedly set by the hardware,
50+
* clear bits before extracting timestamp
51+
*/
4852
info->timestamp =
49-
((u64)xtr_hdr[2] << 24) |
53+
((u64)(xtr_hdr[2] & GENMASK(5, 0)) << 24) |
5054
((u64)xtr_hdr[3] << 16) |
5155
((u64)xtr_hdr[4] << 8) |
5256
((u64)xtr_hdr[5] << 0);

drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/slab.h>
1515
#include <linux/ethtool.h>
1616
#include <linux/io.h>
17+
#include <linux/iopoll.h>
1718
#include "stmmac.h"
1819
#include "stmmac_pcs.h"
1920
#include "dwmac4.h"
@@ -471,7 +472,7 @@ static int dwmac4_write_vlan_filter(struct net_device *dev,
471472
u8 index, u32 data)
472473
{
473474
void __iomem *ioaddr = (void __iomem *)dev->base_addr;
474-
int i, timeout = 10;
475+
int ret;
475476
u32 val;
476477

477478
if (index >= hw->num_vlan)
@@ -487,16 +488,15 @@ static int dwmac4_write_vlan_filter(struct net_device *dev,
487488

488489
writel(val, ioaddr + GMAC_VLAN_TAG);
489490

490-
for (i = 0; i < timeout; i++) {
491-
val = readl(ioaddr + GMAC_VLAN_TAG);
492-
if (!(val & GMAC_VLAN_TAG_CTRL_OB))
493-
return 0;
494-
udelay(1);
491+
ret = readl_poll_timeout(ioaddr + GMAC_VLAN_TAG, val,
492+
!(val & GMAC_VLAN_TAG_CTRL_OB),
493+
1000, 500000);
494+
if (ret) {
495+
netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
496+
return -EBUSY;
495497
}
496498

497-
netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
498-
499-
return -EBUSY;
499+
return 0;
500500
}
501501

502502
static int dwmac4_add_hw_vlan_rx_fltr(struct net_device *dev,

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common)
763763
k3_udma_glue_disable_rx_chn(rx_chn->rx_chn);
764764

765765
fail_rx:
766-
for (i = 0; i < common->rx_ch_num_flows; i--)
766+
for (i = 0; i < common->rx_ch_num_flows; i++)
767767
k3_udma_glue_reset_rx_chn(rx_chn->rx_chn, i, &rx_chn->flows[i],
768768
am65_cpsw_nuss_rx_cleanup, 0);
769769

0 commit comments

Comments
 (0)