Skip to content

Commit e72e9e6

Browse files
committed
Merge tag 'net-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "No fixes from any subtree. Current release - regressions: - net: fix the missing unlock for detached devices Previous releases - regressions: - sched: fix UAF vulnerability in HFSC qdisc - lwtunnel: disable BHs when required - mptcp: pm: defer freeing of MPTCP userspace path manager entries - tipc: fix NULL pointer dereference in tipc_mon_reinit_self() - eth: virtio-net: disable delayed refill when pausing rx Previous releases - always broken: - phylink: fix suspend/resume with WoL enabled and link down - eth: - mlx5: fix null-ptr-deref in mlx5_create_{inner_,}ttc_table() - xen-netfront: handle NULL returned by xdp_convert_buff_to_frame() - enetc: fix frame corruption on bpf_xdp_adjust_head/tail() and XDP_PASS - stmmac: fix dwmac1000 ptp timestamp status offset - pds_core: prevent possible adminq overflow/stuck condition Misc: - a bunch of MAINTAINERS updates" * tag 'net-6.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (32 commits) net: stmmac: fix multiplication overflow when reading timestamp net: stmmac: fix dwmac1000 ptp timestamp status offset net: dp83822: Fix OF_MDIO config check pds_core: make wait_context part of q_info pds_core: Remove unnecessary check in pds_client_adminq_cmd() pds_core: handle unsupported PDS_CORE_CMD_FW_CONTROL result pds_core: Prevent possible adminq overflow/stuck condition net: dsa: mt7530: sync driver-specific behavior of MT7531 variants selftests/tc-testing: Add test for HFSC queue emptying during peek operation net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too net_sched: hfsc: Fix a UAF vulnerability in class handling selftests: mptcp: diag: use mptcp_lib_get_info_value mptcp: pm: Defer freeing of MPTCP userspace path manager entries net: ethernet: mtk_eth_soc: net: revise NETSYSv3 hardware configuration tipc: fix NULL pointer dereference in tipc_mon_reinit_self() virtio-net: disable delayed refill when pausing rx net: phy: leds: fix memory leak net: phylink: mac_link_(up|down)() clarifications net: phylink: fix suspend/resume with WoL enabled and link down net: lwtunnel: disable BHs when required ...
2 parents 288537d + cc0dec3 commit e72e9e6

File tree

29 files changed

+344
-195
lines changed

29 files changed

+344
-195
lines changed

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,6 +3191,12 @@ M: Dinh Nguyen <[email protected]>
31913191
S: Maintained
31923192
F: drivers/clk/socfpga/
31933193

3194+
ARM/SOCFPGA DWMAC GLUE LAYER
3195+
M: Maxime Chevallier <[email protected]>
3196+
S: Maintained
3197+
F: Documentation/devicetree/bindings/net/socfpga-dwmac.txt
3198+
F: drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
3199+
31943200
ARM/SOCFPGA EDAC BINDINGS
31953201
M: Matthew Gerlach <[email protected]>
31963202
S: Maintained
@@ -16812,6 +16818,7 @@ F: Documentation/networking/net_cachelines/net_device.rst
1681216818
F: drivers/connector/
1681316819
F: drivers/net/
1681416820
F: drivers/ptp/
16821+
F: drivers/s390/net/
1681516822
F: include/dt-bindings/net/
1681616823
F: include/linux/cn_proc.h
1681716824
F: include/linux/etherdevice.h
@@ -16821,6 +16828,7 @@ F: include/linux/fddidevice.h
1682116828
F: include/linux/hippidevice.h
1682216829
F: include/linux/if_*
1682316830
F: include/linux/inetdevice.h
16831+
F: include/linux/ism.h
1682416832
F: include/linux/netdev*
1682516833
F: include/linux/platform_data/wiznet.h
1682616834
F: include/uapi/linux/cn_proc.h
@@ -21312,6 +21320,7 @@ L: [email protected]
2131221320
2131321321
S: Supported
2131421322
F: drivers/s390/net/
21323+
F: include/linux/ism.h
2131521324

2131621325
S390 PCI SUBSYSTEM
2131721326
M: Niklas Schnelle <[email protected]>

drivers/net/dsa/mt7530.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,9 @@ mt7531_setup_common(struct dsa_switch *ds)
24192419
struct mt7530_priv *priv = ds->priv;
24202420
int ret, i;
24212421

2422+
ds->assisted_learning_on_cpu_port = true;
2423+
ds->mtu_enforcement_ingress = true;
2424+
24222425
mt753x_trap_frames(priv);
24232426

24242427
/* Enable and reset MIB counters */
@@ -2571,9 +2574,6 @@ mt7531_setup(struct dsa_switch *ds)
25712574
if (ret)
25722575
return ret;
25732576

2574-
ds->assisted_learning_on_cpu_port = true;
2575-
ds->mtu_enforcement_ingress = true;
2576-
25772577
return 0;
25782578
}
25792579

drivers/net/ethernet/amd/pds_core/adminq.c

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
#include "core.h"
77

8-
struct pdsc_wait_context {
9-
struct pdsc_qcq *qcq;
10-
struct completion wait_completion;
11-
};
12-
138
static int pdsc_process_notifyq(struct pdsc_qcq *qcq)
149
{
1510
union pds_core_notifyq_comp *comp;
@@ -109,10 +104,10 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq)
109104
q_info = &q->info[q->tail_idx];
110105
q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1);
111106

112-
/* Copy out the completion data */
113-
memcpy(q_info->dest, comp, sizeof(*comp));
114-
115-
complete_all(&q_info->wc->wait_completion);
107+
if (!completion_done(&q_info->completion)) {
108+
memcpy(q_info->dest, comp, sizeof(*comp));
109+
complete(&q_info->completion);
110+
}
116111

117112
if (cq->tail_idx == cq->num_descs - 1)
118113
cq->done_color = !cq->done_color;
@@ -162,8 +157,7 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data)
162157
static int __pdsc_adminq_post(struct pdsc *pdsc,
163158
struct pdsc_qcq *qcq,
164159
union pds_core_adminq_cmd *cmd,
165-
union pds_core_adminq_comp *comp,
166-
struct pdsc_wait_context *wc)
160+
union pds_core_adminq_comp *comp)
167161
{
168162
struct pdsc_queue *q = &qcq->q;
169163
struct pdsc_q_info *q_info;
@@ -205,9 +199,9 @@ static int __pdsc_adminq_post(struct pdsc *pdsc,
205199
/* Post the request */
206200
index = q->head_idx;
207201
q_info = &q->info[index];
208-
q_info->wc = wc;
209202
q_info->dest = comp;
210203
memcpy(q_info->desc, cmd, sizeof(*cmd));
204+
reinit_completion(&q_info->completion);
211205

212206
dev_dbg(pdsc->dev, "head_idx %d tail_idx %d\n",
213207
q->head_idx, q->tail_idx);
@@ -231,16 +225,13 @@ int pdsc_adminq_post(struct pdsc *pdsc,
231225
union pds_core_adminq_comp *comp,
232226
bool fast_poll)
233227
{
234-
struct pdsc_wait_context wc = {
235-
.wait_completion =
236-
COMPLETION_INITIALIZER_ONSTACK(wc.wait_completion),
237-
};
238228
unsigned long poll_interval = 1;
239229
unsigned long poll_jiffies;
240230
unsigned long time_limit;
241231
unsigned long time_start;
242232
unsigned long time_done;
243233
unsigned long remaining;
234+
struct completion *wc;
244235
int err = 0;
245236
int index;
246237

@@ -250,20 +241,19 @@ int pdsc_adminq_post(struct pdsc *pdsc,
250241
return -ENXIO;
251242
}
252243

253-
wc.qcq = &pdsc->adminqcq;
254-
index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp, &wc);
244+
index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp);
255245
if (index < 0) {
256246
err = index;
257247
goto err_out;
258248
}
259249

250+
wc = &pdsc->adminqcq.q.info[index].completion;
260251
time_start = jiffies;
261252
time_limit = time_start + HZ * pdsc->devcmd_timeout;
262253
do {
263254
/* Timeslice the actual wait to catch IO errors etc early */
264255
poll_jiffies = msecs_to_jiffies(poll_interval);
265-
remaining = wait_for_completion_timeout(&wc.wait_completion,
266-
poll_jiffies);
256+
remaining = wait_for_completion_timeout(wc, poll_jiffies);
267257
if (remaining)
268258
break;
269259

@@ -292,9 +282,11 @@ int pdsc_adminq_post(struct pdsc *pdsc,
292282
dev_dbg(pdsc->dev, "%s: elapsed %d msecs\n",
293283
__func__, jiffies_to_msecs(time_done - time_start));
294284

295-
/* Check the results */
296-
if (time_after_eq(time_done, time_limit))
285+
/* Check the results and clear an un-completed timeout */
286+
if (time_after_eq(time_done, time_limit) && !completion_done(wc)) {
297287
err = -ETIMEDOUT;
288+
complete(wc);
289+
}
298290

299291
dev_dbg(pdsc->dev, "read admin queue completion idx %d:\n", index);
300292
dynamic_hex_dump("comp ", DUMP_PREFIX_OFFSET, 16, 1,

drivers/net/ethernet/amd/pds_core/auxbus.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ int pds_client_adminq_cmd(struct pds_auxiliary_dev *padev,
107107
dev_dbg(pf->dev, "%s: %s opcode %d\n",
108108
__func__, dev_name(&padev->aux_dev.dev), req->opcode);
109109

110-
if (pf->state)
111-
return -ENXIO;
112-
113110
/* Wrap the client's request */
114111
cmd.client_request.opcode = PDS_AQ_CMD_CLIENT_CMD;
115112
cmd.client_request.client_id = cpu_to_le16(padev->client_id);

drivers/net/ethernet/amd/pds_core/core.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,10 @@ static void pdsc_q_map(struct pdsc_queue *q, void *base, dma_addr_t base_pa)
167167
q->base = base;
168168
q->base_pa = base_pa;
169169

170-
for (i = 0, cur = q->info; i < q->num_descs; i++, cur++)
170+
for (i = 0, cur = q->info; i < q->num_descs; i++, cur++) {
171171
cur->desc = base + (i * q->desc_size);
172+
init_completion(&cur->completion);
173+
}
172174
}
173175

174176
static void pdsc_cq_map(struct pdsc_cq *cq, void *base, dma_addr_t base_pa)
@@ -325,10 +327,7 @@ static int pdsc_core_init(struct pdsc *pdsc)
325327
size_t sz;
326328
int err;
327329

328-
/* Scale the descriptor ring length based on number of CPUs and VFs */
329-
numdescs = max_t(int, PDSC_ADMINQ_MIN_LENGTH, num_online_cpus());
330-
numdescs += 2 * pci_sriov_get_totalvfs(pdsc->pdev);
331-
numdescs = roundup_pow_of_two(numdescs);
330+
numdescs = PDSC_ADMINQ_MAX_LENGTH;
332331
err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_ADMINQ, 0, "adminq",
333332
PDS_CORE_QCQ_F_CORE | PDS_CORE_QCQ_F_INTR,
334333
numdescs,

drivers/net/ethernet/amd/pds_core/core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define PDSC_WATCHDOG_SECS 5
1818
#define PDSC_QUEUE_NAME_MAX_SZ 16
19-
#define PDSC_ADMINQ_MIN_LENGTH 16 /* must be a power of two */
19+
#define PDSC_ADMINQ_MAX_LENGTH 16 /* must be a power of two */
2020
#define PDSC_NOTIFYQ_LENGTH 64 /* must be a power of two */
2121
#define PDSC_TEARDOWN_RECOVERY false
2222
#define PDSC_TEARDOWN_REMOVING true
@@ -96,7 +96,7 @@ struct pdsc_q_info {
9696
unsigned int bytes;
9797
unsigned int nbufs;
9898
struct pdsc_buf_info bufs[PDS_CORE_MAX_FRAGS];
99-
struct pdsc_wait_context *wc;
99+
struct completion completion;
100100
void *dest;
101101
};
102102

drivers/net/ethernet/amd/pds_core/devlink.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
105105
.fw_control.opcode = PDS_CORE_CMD_FW_CONTROL,
106106
.fw_control.oper = PDS_CORE_FW_GET_LIST,
107107
};
108-
struct pds_core_fw_list_info fw_list;
108+
struct pds_core_fw_list_info fw_list = {};
109109
struct pdsc *pdsc = devlink_priv(dl);
110110
union pds_core_dev_comp comp;
111111
char buf[32];
@@ -118,8 +118,6 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
118118
if (!err)
119119
memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list));
120120
mutex_unlock(&pdsc->devcmd_lock);
121-
if (err && err != -EIO)
122-
return err;
123121

124122
listlen = min(fw_list.num_fw_slots, ARRAY_SIZE(fw_list.fw_names));
125123
for (i = 0; i < listlen; i++) {

drivers/net/ethernet/freescale/enetc/enetc.c

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,16 @@ static void enetc_xdp_drop(struct enetc_bdr *rx_ring, int rx_ring_first,
18501850
}
18511851
}
18521852

1853+
static void enetc_bulk_flip_buff(struct enetc_bdr *rx_ring, int rx_ring_first,
1854+
int rx_ring_last)
1855+
{
1856+
while (rx_ring_first != rx_ring_last) {
1857+
enetc_flip_rx_buff(rx_ring,
1858+
&rx_ring->rx_swbd[rx_ring_first]);
1859+
enetc_bdr_idx_inc(rx_ring, &rx_ring_first);
1860+
}
1861+
}
1862+
18531863
static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
18541864
struct napi_struct *napi, int work_limit,
18551865
struct bpf_prog *prog)
@@ -1868,11 +1878,10 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
18681878

18691879
while (likely(rx_frm_cnt < work_limit)) {
18701880
union enetc_rx_bd *rxbd, *orig_rxbd;
1871-
int orig_i, orig_cleaned_cnt;
18721881
struct xdp_buff xdp_buff;
18731882
struct sk_buff *skb;
1883+
int orig_i, err;
18741884
u32 bd_status;
1875-
int err;
18761885

18771886
rxbd = enetc_rxbd(rx_ring, i);
18781887
bd_status = le32_to_cpu(rxbd->r.lstatus);
@@ -1887,7 +1896,6 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
18871896
break;
18881897

18891898
orig_rxbd = rxbd;
1890-
orig_cleaned_cnt = cleaned_cnt;
18911899
orig_i = i;
18921900

18931901
enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i,
@@ -1915,15 +1923,21 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
19151923
rx_ring->stats.xdp_drops++;
19161924
break;
19171925
case XDP_PASS:
1918-
rxbd = orig_rxbd;
1919-
cleaned_cnt = orig_cleaned_cnt;
1920-
i = orig_i;
1921-
1922-
skb = enetc_build_skb(rx_ring, bd_status, &rxbd,
1923-
&i, &cleaned_cnt,
1924-
ENETC_RXB_DMA_SIZE_XDP);
1925-
if (unlikely(!skb))
1926+
skb = xdp_build_skb_from_buff(&xdp_buff);
1927+
/* Probably under memory pressure, stop NAPI */
1928+
if (unlikely(!skb)) {
1929+
enetc_xdp_drop(rx_ring, orig_i, i);
1930+
rx_ring->stats.xdp_drops++;
19261931
goto out;
1932+
}
1933+
1934+
enetc_get_offloads(rx_ring, orig_rxbd, skb);
1935+
1936+
/* These buffers are about to be owned by the stack.
1937+
* Update our buffer cache (the rx_swbd array elements)
1938+
* with their other page halves.
1939+
*/
1940+
enetc_bulk_flip_buff(rx_ring, orig_i, i);
19271941

19281942
napi_gro_receive(napi, skb);
19291943
break;
@@ -1965,11 +1979,7 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
19651979
enetc_xdp_drop(rx_ring, orig_i, i);
19661980
rx_ring->stats.xdp_redirect_failures++;
19671981
} else {
1968-
while (orig_i != i) {
1969-
enetc_flip_rx_buff(rx_ring,
1970-
&rx_ring->rx_swbd[orig_i]);
1971-
enetc_bdr_idx_inc(rx_ring, &orig_i);
1972-
}
1982+
enetc_bulk_flip_buff(rx_ring, orig_i, i);
19731983
xdp_redirect_frm_cnt++;
19741984
rx_ring->stats.xdp_redirect++;
19751985
}
@@ -3362,7 +3372,8 @@ static int enetc_int_vector_init(struct enetc_ndev_priv *priv, int i,
33623372
bdr->buffer_offset = ENETC_RXB_PAD;
33633373
priv->rx_ring[i] = bdr;
33643374

3365-
err = xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0);
3375+
err = __xdp_rxq_info_reg(&bdr->xdp.rxq, priv->ndev, i, 0,
3376+
ENETC_RXB_DMA_SIZE_XDP);
33663377
if (err)
33673378
goto free_vector;
33683379

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4043,11 +4043,27 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
40434043
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
40444044

40454045
if (mtk_is_netsys_v3_or_greater(eth)) {
4046-
/* PSE should not drop port1, port8 and port9 packets */
4047-
mtk_w32(eth, 0x00000302, PSE_DROP_CFG);
4046+
/* PSE dummy page mechanism */
4047+
mtk_w32(eth, PSE_DUMMY_WORK_GDM(1) | PSE_DUMMY_WORK_GDM(2) |
4048+
PSE_DUMMY_WORK_GDM(3) | DUMMY_PAGE_THR, PSE_DUMY_REQ);
4049+
4050+
/* PSE free buffer drop threshold */
4051+
mtk_w32(eth, 0x00600009, PSE_IQ_REV(8));
4052+
4053+
/* PSE should not drop port8, port9 and port13 packets from
4054+
* WDMA Tx
4055+
*/
4056+
mtk_w32(eth, 0x00002300, PSE_DROP_CFG);
4057+
4058+
/* PSE should drop packets to port8, port9 and port13 on WDMA Rx
4059+
* ring full
4060+
*/
4061+
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(0));
4062+
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(1));
4063+
mtk_w32(eth, 0x00002300, PSE_PPE_DROP(2));
40484064

40494065
/* GDM and CDM Threshold */
4050-
mtk_w32(eth, 0x00000707, MTK_CDMW0_THRES);
4066+
mtk_w32(eth, 0x08000707, MTK_CDMW0_THRES);
40514067
mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES);
40524068

40534069
/* Disable GDM1 RX CRC stripping */
@@ -4064,7 +4080,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
40644080
mtk_w32(eth, 0x00000300, PSE_DROP_CFG);
40654081

40664082
/* PSE should drop packets to port 8/9 on WDMA Rx ring full */
4067-
mtk_w32(eth, 0x00000300, PSE_PPE0_DROP);
4083+
mtk_w32(eth, 0x00000300, PSE_PPE_DROP(0));
40684084

40694085
/* PSE Free Queue Flow Control */
40704086
mtk_w32(eth, 0x01fa01f4, PSE_FQFC_CFG2);

drivers/net/ethernet/mediatek/mtk_eth_soc.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,15 @@
151151
#define PSE_FQFC_CFG1 0x100
152152
#define PSE_FQFC_CFG2 0x104
153153
#define PSE_DROP_CFG 0x108
154-
#define PSE_PPE0_DROP 0x110
154+
#define PSE_PPE_DROP(x) (0x110 + ((x) * 0x4))
155+
156+
/* PSE Last FreeQ Page Request Control */
157+
#define PSE_DUMY_REQ 0x10C
158+
/* PSE_DUMY_REQ is not a typo but actually called like that also in
159+
* MediaTek's datasheet
160+
*/
161+
#define PSE_DUMMY_WORK_GDM(x) BIT(16 + (x))
162+
#define DUMMY_PAGE_THR 0x1
155163

156164
/* PSE Input Queue Reservation Register*/
157165
#define PSE_IQ_REV(x) (0x140 + (((x) - 1) << 2))

0 commit comments

Comments
 (0)