Skip to content

Commit

Permalink
Merge tag 'net-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  ...
  • Loading branch information
torvalds committed Oct 3, 2024
2 parents 9c02404 + 8beee4d commit 8c245fe
Show file tree
Hide file tree
Showing 55 changed files with 310 additions and 127 deletions.
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ properties:
and length of the AXI DMA controller IO space, unless
axistream-connected is specified, in which case the reg
attribute of the node referenced by it is used.
minItems: 1
maxItems: 2

interrupts:
Expand Down Expand Up @@ -181,7 +182,7 @@ examples:
clock-names = "s_axi_lite_clk", "axis_clk", "ref_clk", "mgt_clk";
clocks = <&axi_clk>, <&axi_clk>, <&pl_enet_ref_clk>, <&mgt_clk>;
phy-mode = "mii";
reg = <0x00 0x40000000 0x00 0x40000>;
reg = <0x40000000 0x40000>;
xlnx,rxcsum = <0x2>;
xlnx,rxmem = <0x800>;
xlnx,txcsum = <0x2>;
Expand Down
5 changes: 2 additions & 3 deletions Documentation/networking/napi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ IRQ should only be unmasked after a successful call to napi_complete_done():
napi_schedule_irqoff() is a variant of napi_schedule() which takes advantage
of guarantees given by being invoked in IRQ context (no need to
mask interrupts). Note that PREEMPT_RT forces all interrupts
to be threaded so the interrupt may need to be marked ``IRQF_NO_THREAD``
to avoid issues on real-time kernel configurations.
mask interrupts). napi_schedule_irqoff() will fall back to napi_schedule() if
IRQs are threaded (such as if ``PREEMPT_RT`` is enabled).

Instance to queue mapping
-------------------------
Expand Down
3 changes: 1 addition & 2 deletions drivers/bluetooth/btmrvl_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int btmrvl_sdio_probe_of(struct device *dev,
} else {
ret = devm_request_irq(dev, cfg->irq_bt,
btmrvl_wake_irq_bt,
0, "bt_wake", card);
IRQF_NO_AUTOEN, "bt_wake", card);
if (ret) {
dev_err(dev,
"Failed to request irq_bt %d (%d)\n",
Expand All @@ -101,7 +101,6 @@ static int btmrvl_sdio_probe_of(struct device *dev,

/* Configure wakeup (enabled by default) */
device_init_wakeup(dev, true);
disable_irq(cfg->irq_bt);
}
}

Expand Down
9 changes: 9 additions & 0 deletions drivers/net/ethernet/freescale/fec.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,19 @@ struct fec_enet_private {
/* XDP BPF Program */
struct bpf_prog *xdp_prog;

struct {
int pps_enable;
u64 ns_sys, ns_phc;
u32 at_corr;
u8 at_inc_corr;
} ptp_saved_state;

u64 ethtool_stats[];
};

void fec_ptp_init(struct platform_device *pdev, int irq_idx);
void fec_ptp_restore_state(struct fec_enet_private *fep);
void fec_ptp_save_state(struct fec_enet_private *fep);
void fec_ptp_stop(struct platform_device *pdev);
void fec_ptp_start_cyclecounter(struct net_device *ndev);
int fec_ptp_set(struct net_device *ndev, struct kernel_hwtstamp_config *config,
Expand Down
11 changes: 10 additions & 1 deletion drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@ fec_restart(struct net_device *ndev)
u32 rcntl = OPT_FRAME_SIZE | 0x04;
u32 ecntl = FEC_ECR_ETHEREN;

fec_ptp_save_state(fep);

/* Whack a reset. We should wait for this.
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
* instead of reset MAC itself.
Expand Down Expand Up @@ -1244,8 +1246,10 @@ fec_restart(struct net_device *ndev)
writel(ecntl, fep->hwp + FEC_ECNTRL);
fec_enet_active_rxring(ndev);

if (fep->bufdesc_ex)
if (fep->bufdesc_ex) {
fec_ptp_start_cyclecounter(ndev);
fec_ptp_restore_state(fep);
}

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

fec_ptp_save_state(fep);

/* Whack a reset. We should wait for this.
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
* instead of reset MAC itself.
Expand Down Expand Up @@ -1366,6 +1372,9 @@ fec_stop(struct net_device *ndev)
val = readl(fep->hwp + FEC_ECNTRL);
val |= FEC_ECR_EN1588;
writel(val, fep->hwp + FEC_ECNTRL);

fec_ptp_start_cyclecounter(ndev);
fec_ptp_restore_state(fep);
}
}

Expand Down
50 changes: 50 additions & 0 deletions drivers/net/ethernet/freescale/fec_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,56 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
schedule_delayed_work(&fep->time_keep, HZ);
}

void fec_ptp_save_state(struct fec_enet_private *fep)
{
unsigned long flags;
u32 atime_inc_corr;

spin_lock_irqsave(&fep->tmreg_lock, flags);

fep->ptp_saved_state.pps_enable = fep->pps_enable;

fep->ptp_saved_state.ns_phc = timecounter_read(&fep->tc);
fep->ptp_saved_state.ns_sys = ktime_get_ns();

fep->ptp_saved_state.at_corr = readl(fep->hwp + FEC_ATIME_CORR);
atime_inc_corr = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_CORR_MASK;
fep->ptp_saved_state.at_inc_corr = (u8)(atime_inc_corr >> FEC_T_INC_CORR_OFFSET);

spin_unlock_irqrestore(&fep->tmreg_lock, flags);
}

/* Restore PTP functionality after a reset */
void fec_ptp_restore_state(struct fec_enet_private *fep)
{
u32 atime_inc = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_MASK;
unsigned long flags;
u32 counter;
u64 ns;

spin_lock_irqsave(&fep->tmreg_lock, flags);

/* Reset turned it off, so adjust our status flag */
fep->pps_enable = 0;

writel(fep->ptp_saved_state.at_corr, fep->hwp + FEC_ATIME_CORR);
atime_inc |= ((u32)fep->ptp_saved_state.at_inc_corr) << FEC_T_INC_CORR_OFFSET;
writel(atime_inc, fep->hwp + FEC_ATIME_INC);

ns = ktime_get_ns() - fep->ptp_saved_state.ns_sys + fep->ptp_saved_state.ns_phc;
counter = ns & fep->cc.mask;
writel(counter, fep->hwp + FEC_ATIME);
timecounter_init(&fep->tc, &fep->cc, ns);

spin_unlock_irqrestore(&fep->tmreg_lock, flags);

/* Restart PPS if needed */
if (fep->ptp_saved_state.pps_enable) {
/* Re-enable PPS */
fec_ptp_enable_pps(fep, 1);
}
}

void fec_ptp_stop(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/ethernet/lantiq_etop.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
unsigned long flags;
u32 byte_offset;

len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
if (skb_put_padto(skb, ETH_ZLEN))
return NETDEV_TX_OK;
len = skb->len;

if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
netdev_err(dev, "tx ring full\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ struct mlx5e_shampo_hd {
struct mlx5e_dma_info *info;
struct mlx5e_frag_page *pages;
u16 curr_page_index;
u16 hd_per_wq;
u32 hd_per_wq;
u16 hd_per_wqe;
unsigned long *bitmap;
u16 pi;
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct mlx5e_tir_builder *mlx5e_tir_builder_alloc(bool modify)
struct mlx5e_tir_builder *builder;

builder = kvzalloc(sizeof(*builder), GFP_KERNEL);
if (!builder)
return NULL;

builder->modify = modify;

return builder;
Expand Down
8 changes: 7 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,20 @@ static void mlx5e_ipsec_handle_sw_limits(struct work_struct *_work)
return;

spin_lock_bh(&x->lock);
xfrm_state_check_expire(x);
if (x->km.state == XFRM_STATE_EXPIRED) {
sa_entry->attrs.drop = true;
spin_unlock_bh(&x->lock);

mlx5e_accel_ipsec_fs_modify(sa_entry);
return;
}

if (x->km.state != XFRM_STATE_VALID) {
spin_unlock_bh(&x->lock);
return;
}

xfrm_state_check_expire(x);
spin_unlock_bh(&x->lock);

queue_delayed_work(sa_entry->ipsec->wq, &dwork->dwork,
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,6 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
return;

err_unmap:
mlx5e_dma_unmap_wqe_err(sq, 1);
sq->stats->dropped++;
dev_kfree_skb_any(skb);
mlx5e_tx_flush(sq);
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
pci_write_config_dword((dev)->pdev, (dev)->vsc_addr + (offset), (val))
#define VSC_MAX_RETRIES 2048

/* Reading VSC registers can take relatively long time.
* Yield the cpu every 128 registers read.
*/
#define VSC_GW_READ_BLOCK_COUNT 128

enum {
VSC_CTRL_OFFSET = 0x4,
VSC_COUNTER_OFFSET = 0x8,
Expand Down Expand Up @@ -273,13 +278,18 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
{
unsigned int next_read_addr = 0;
unsigned int read_addr = 0;
unsigned int count = 0;

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

read_addr = next_read_addr;
if (++count == VSC_GW_READ_BLOCK_COUNT) {
cond_resched();
count = 0;
}
}
return length;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool mlx5hws_bwc_match_params_is_complex(struct mlx5hws_context *ctx,
* and let the usual match creation path handle it,
* both for good and bad flows.
*/
if (ret == E2BIG) {
if (ret == -E2BIG) {
is_complex = true;
mlx5hws_dbg(ctx, "Matcher definer layout: need complex matcher\n");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ hws_definer_find_best_match_fit(struct mlx5hws_context *ctx,
return 0;
}

return E2BIG;
return -E2BIG;
}

static void
Expand Down Expand Up @@ -1931,7 +1931,7 @@ mlx5hws_definer_calc_layout(struct mlx5hws_context *ctx,
/* Find the match definer layout for header layout match union */
ret = hws_definer_find_best_match_fit(ctx, match_definer, match_hl);
if (ret) {
if (ret == E2BIG)
if (ret == -E2BIG)
mlx5hws_dbg(ctx,
"Failed to create match definer from header layout - E2BIG\n");
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ static int hws_matcher_bind_mt(struct mlx5hws_matcher *matcher)
if (!(matcher->flags & MLX5HWS_MATCHER_FLAGS_COLLISION)) {
ret = mlx5hws_definer_mt_init(ctx, matcher->mt);
if (ret) {
if (ret == E2BIG)
if (ret == -E2BIG)
mlx5hws_err(ctx, "Failed to set matcher templates with match definers\n");
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ static int hws_send_ring_create_sq(struct mlx5_core_dev *mdev, u32 pdn,
return err;
}

static void hws_send_ring_destroy_sq(struct mlx5_core_dev *mdev,
struct mlx5hws_send_ring_sq *sq)
{
mlx5_core_destroy_sq(mdev, sq->sqn);
}

static int hws_send_ring_set_sq_rdy(struct mlx5_core_dev *mdev, u32 sqn)
{
void *in, *sqc;
Expand Down Expand Up @@ -696,7 +702,7 @@ static int hws_send_ring_create_sq_rdy(struct mlx5_core_dev *mdev, u32 pdn,

err = hws_send_ring_set_sq_rdy(mdev, sq->sqn);
if (err)
hws_send_ring_close_sq(sq);
hws_send_ring_destroy_sq(mdev, sq);

return err;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/microchip/fdma/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
if NET_VENDOR_MICROCHIP

config FDMA
bool "FDMA API"
bool "FDMA API" if COMPILE_TEST
help
Provides the basic FDMA functionality for multiple Microchip
switchcores.
Expand Down
6 changes: 5 additions & 1 deletion drivers/net/ethernet/microchip/sparx5/sparx5_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ void sparx5_ifh_parse(u32 *ifh, struct frame_info *info)
fwd = (fwd >> 5);
info->src_port = FIELD_GET(GENMASK(7, 1), fwd);

/*
* Bit 270-271 are occasionally unexpectedly set by the hardware,
* clear bits before extracting timestamp
*/
info->timestamp =
((u64)xtr_hdr[2] << 24) |
((u64)(xtr_hdr[2] & GENMASK(5, 0)) << 24) |
((u64)xtr_hdr[3] << 16) |
((u64)xtr_hdr[4] << 8) |
((u64)xtr_hdr[5] << 0);
Expand Down
18 changes: 9 additions & 9 deletions drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/slab.h>
#include <linux/ethtool.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include "stmmac.h"
#include "stmmac_pcs.h"
#include "dwmac4.h"
Expand Down Expand Up @@ -471,7 +472,7 @@ static int dwmac4_write_vlan_filter(struct net_device *dev,
u8 index, u32 data)
{
void __iomem *ioaddr = (void __iomem *)dev->base_addr;
int i, timeout = 10;
int ret;
u32 val;

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

writel(val, ioaddr + GMAC_VLAN_TAG);

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

netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");

return -EBUSY;
return 0;
}

static int dwmac4_add_hw_vlan_rx_fltr(struct net_device *dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/ti/am65-cpsw-nuss.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common)
k3_udma_glue_disable_rx_chn(rx_chn->rx_chn);

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

Expand Down
Loading

0 comments on commit 8c245fe

Please sign in to comment.