Skip to content

Commit 73b193f

Browse files
committed
Merge tag 'net-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from bpf and netfilter. Current release - new code bugs: - mctp: correct mctp_i2c_header_create result - eth: fungible: fix reference to __udivdi3 on 32b builds - eth: micrel: remove latencies support lan8814 Previous releases - regressions: - bpf: resolve to prog->aux->dst_prog->type only for BPF_PROG_TYPE_EXT - vrf: fix packet sniffing for traffic originating from ip tunnels - rxrpc: fix a race in rxrpc_exit_net() - dsa: revert "net: dsa: stop updating master MTU from master.c" - eth: ice: fix MAC address setting Previous releases - always broken: - tls: fix slab-out-of-bounds bug in decrypt_internal - bpf: support dual-stack sockets in bpf_tcp_check_syncookie - xdp: fix coalescing for page_pool fragment recycling - ovs: fix leak of nested actions - eth: sfc: - add missing xdp queue reinitialization - fix using uninitialized xdp tx_queue - eth: ice: - clear default forwarding VSI during VSI release - fix broken IFF_ALLMULTI handling - synchronize_rcu() when terminating rings - eth: qede: confirm skb is allocated before using - eth: aqc111: fix out-of-bounds accesses in RX fixup - eth: slip: fix NPD bug in sl_tx_timeout()" * tag 'net-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (61 commits) drivers: net: slip: fix NPD bug in sl_tx_timeout() bpf: Adjust bpf_tcp_check_syncookie selftest to test dual-stack sockets bpf: Support dual-stack sockets in bpf_tcp_check_syncookie myri10ge: fix an incorrect free for skb in myri10ge_sw_tso net: usb: aqc111: Fix out-of-bounds accesses in RX fixup qede: confirm skb is allocated before using net: ipv6mr: fix unused variable warning with CONFIG_IPV6_PIMSM_V2=n net: phy: mscc-miim: reject clause 45 register accesses net: axiemac: use a phandle to reference pcs_phy dt-bindings: net: add pcs-handle attribute net: axienet: factor out phy_node in struct axienet_local net: axienet: setup mdio unconditionally net: sfc: fix using uninitialized xdp tx_queue rxrpc: fix a race in rxrpc_exit_net() net: openvswitch: fix leak of nested actions net: ethernet: mv643xx: Fix over zealous checking of_get_mac_address() net: openvswitch: don't send internal clone attribute to the userspace. net: micrel: Fix KS8851 Kconfig ice: clear cmd_type_offset_bsz for TX rings ice: xsk: fix VSI state check in ice_xsk_wakeup() ...
2 parents 42e7a03 + ec4eb8a commit 73b193f

65 files changed

Lines changed: 712 additions & 388 deletions

Some content is hidden

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

Documentation/devicetree/bindings/net/ethernet-controller.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ properties:
106106
phy-mode:
107107
$ref: "#/properties/phy-connection-type"
108108

109+
pcs-handle:
110+
$ref: /schemas/types.yaml#/definitions/phandle
111+
description:
112+
Specifies a reference to a node representing a PCS PHY device on a MDIO
113+
bus to link with an external PHY (phy-handle) if exists.
114+
109115
phy-handle:
110116
$ref: /schemas/types.yaml#/definitions/phandle
111117
description:

Documentation/devicetree/bindings/net/micrel.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,3 @@ Optional properties:
4545

4646
In fiber mode, auto-negotiation is disabled and the PHY can only work in
4747
100base-fx (full and half duplex) modes.
48-
49-
- lan8814,ignore-ts: If present the PHY will not support timestamping.
50-
51-
This option acts as check whether Timestamping is supported by
52-
hardware or not. LAN8814 phy support hardware tmestamping.
53-
54-
- lan8814,latency_rx_10: Configures Latency value of phy in ingress at 10 Mbps.
55-
56-
- lan8814,latency_tx_10: Configures Latency value of phy in egress at 10 Mbps.
57-
58-
- lan8814,latency_rx_100: Configures Latency value of phy in ingress at 100 Mbps.
59-
60-
- lan8814,latency_tx_100: Configures Latency value of phy in egress at 100 Mbps.
61-
62-
- lan8814,latency_rx_1000: Configures Latency value of phy in ingress at 1000 Mbps.
63-
64-
- lan8814,latency_tx_1000: Configures Latency value of phy in egress at 1000 Mbps.

Documentation/devicetree/bindings/net/xilinx_axienet.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Required properties:
2626
specified, the TX/RX DMA interrupts should be on that node
2727
instead, and only the Ethernet core interrupt is optionally
2828
specified here.
29-
- phy-handle : Should point to the external phy device.
29+
- phy-handle : Should point to the external phy device if exists. Pointing
30+
this to the PCS/PMA PHY is deprecated and should be avoided.
3031
See ethernet.txt file in the same directory.
3132
- xlnx,rxmem : Set to allocated memory buffer for Rx/Tx in the hardware
3233

@@ -68,6 +69,11 @@ Optional properties:
6869
required through the core's MDIO interface (i.e. always,
6970
unless the PHY is accessed through a different bus).
7071

72+
- pcs-handle: Phandle to the internal PCS/PMA PHY in SGMII or 1000Base-X
73+
modes, where "pcs-handle" should be used to point
74+
to the PCS/PMA PHY, and "phy-handle" should point to an
75+
external PHY if exists.
76+
7177
Example:
7278
axi_ethernet_eth: ethernet@40c00000 {
7379
compatible = "xlnx,axi-ethernet-1.00.a";

Documentation/networking/dsa/dsa.rst

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ in joining the effort.
1010
Design principles
1111
=================
1212

13-
The Distributed Switch Architecture is a subsystem which was primarily designed
14-
to support Marvell Ethernet switches (MV88E6xxx, a.k.a Linkstreet product line)
15-
using Linux, but has since evolved to support other vendors as well.
13+
The Distributed Switch Architecture subsystem was primarily designed to
14+
support Marvell Ethernet switches (MV88E6xxx, a.k.a. Link Street product
15+
line) using Linux, but has since evolved to support other vendors as well.
1616

1717
The original philosophy behind this design was to be able to use unmodified
1818
Linux tools such as bridge, iproute2, ifconfig to work transparently whether
1919
they configured/queried a switch port network device or a regular network
2020
device.
2121

22-
An Ethernet switch is typically comprised of multiple front-panel ports, and one
23-
or more CPU or management port. The DSA subsystem currently relies on the
22+
An Ethernet switch typically comprises multiple front-panel ports and one
23+
or more CPU or management ports. The DSA subsystem currently relies on the
2424
presence of a management port connected to an Ethernet controller capable of
2525
receiving Ethernet frames from the switch. This is a very common setup for all
2626
kinds of Ethernet switches found in Small Home and Office products: routers,
27-
gateways, or even top-of-the rack switches. This host Ethernet controller will
27+
gateways, or even top-of-rack switches. This host Ethernet controller will
2828
be later referred to as "master" and "cpu" in DSA terminology and code.
2929

3030
The D in DSA stands for Distributed, because the subsystem has been designed
@@ -33,14 +33,14 @@ using upstream and downstream Ethernet links between switches. These specific
3333
ports are referred to as "dsa" ports in DSA terminology and code. A collection
3434
of multiple switches connected to each other is called a "switch tree".
3535

36-
For each front-panel port, DSA will create specialized network devices which are
36+
For each front-panel port, DSA creates specialized network devices which are
3737
used as controlling and data-flowing endpoints for use by the Linux networking
3838
stack. These specialized network interfaces are referred to as "slave" network
3939
interfaces in DSA terminology and code.
4040

4141
The ideal case for using DSA is when an Ethernet switch supports a "switch tag"
4242
which is a hardware feature making the switch insert a specific tag for each
43-
Ethernet frames it received to/from specific ports to help the management
43+
Ethernet frame it receives to/from specific ports to help the management
4444
interface figure out:
4545

4646
- what port is this frame coming from
@@ -125,7 +125,7 @@ other switches from the same fabric, and in this case, the outermost switch
125125
ports must decapsulate the packet.
126126

127127
Note that in certain cases, it might be the case that the tagging format used
128-
by a leaf switch (not connected directly to the CPU) to not be the same as what
128+
by a leaf switch (not connected directly to the CPU) is not the same as what
129129
the network stack sees. This can be seen with Marvell switch trees, where the
130130
CPU port can be configured to use either the DSA or the Ethertype DSA (EDSA)
131131
format, but the DSA links are configured to use the shorter (without Ethertype)
@@ -270,21 +270,21 @@ These interfaces are specialized in order to:
270270
to/from specific switch ports
271271
- query the switch for ethtool operations: statistics, link state,
272272
Wake-on-LAN, register dumps...
273-
- external/internal PHY management: link, auto-negotiation etc.
273+
- manage external/internal PHY: link, auto-negotiation, etc.
274274

275275
These slave network devices have custom net_device_ops and ethtool_ops function
276276
pointers which allow DSA to introduce a level of layering between the networking
277-
stack/ethtool, and the switch driver implementation.
277+
stack/ethtool and the switch driver implementation.
278278

279279
Upon frame transmission from these slave network devices, DSA will look up which
280-
switch tagging protocol is currently registered with these network devices, and
280+
switch tagging protocol is currently registered with these network devices and
281281
invoke a specific transmit routine which takes care of adding the relevant
282282
switch tag in the Ethernet frames.
283283

284284
These frames are then queued for transmission using the master network device
285-
``ndo_start_xmit()`` function, since they contain the appropriate switch tag, the
285+
``ndo_start_xmit()`` function. Since they contain the appropriate switch tag, the
286286
Ethernet switch will be able to process these incoming frames from the
287-
management interface and delivers these frames to the physical switch port.
287+
management interface and deliver them to the physical switch port.
288288

289289
Graphical representation
290290
------------------------
@@ -330,9 +330,9 @@ MDIO reads/writes towards specific PHY addresses. In most MDIO-connected
330330
switches, these functions would utilize direct or indirect PHY addressing mode
331331
to return standard MII registers from the switch builtin PHYs, allowing the PHY
332332
library and/or to return link status, link partner pages, auto-negotiation
333-
results etc..
333+
results, etc.
334334

335-
For Ethernet switches which have both external and internal MDIO busses, the
335+
For Ethernet switches which have both external and internal MDIO buses, the
336336
slave MII bus can be utilized to mux/demux MDIO reads and writes towards either
337337
internal or external MDIO devices this switch might be connected to: internal
338338
PHYs, external PHYs, or even external switches.
@@ -349,7 +349,7 @@ DSA data structures are defined in ``include/net/dsa.h`` as well as
349349
table indication (when cascading switches)
350350

351351
- ``dsa_platform_data``: platform device configuration data which can reference
352-
a collection of dsa_chip_data structure if multiples switches are cascaded,
352+
a collection of dsa_chip_data structures if multiple switches are cascaded,
353353
the master network device this switch tree is attached to needs to be
354354
referenced
355355

@@ -426,7 +426,7 @@ logic basically looks like this:
426426
"phy-handle" property, if found, this PHY device is created and registered
427427
using ``of_phy_connect()``
428428

429-
- if Device Tree is used, and the PHY device is "fixed", that is, conforms to
429+
- if Device Tree is used and the PHY device is "fixed", that is, conforms to
430430
the definition of a non-MDIO managed PHY as defined in
431431
``Documentation/devicetree/bindings/net/fixed-link.txt``, the PHY is registered
432432
and connected transparently using the special fixed MDIO bus driver
@@ -481,7 +481,7 @@ Device Tree
481481
DSA features a standardized binding which is documented in
482482
``Documentation/devicetree/bindings/net/dsa/dsa.txt``. PHY/MDIO library helper
483483
functions such as ``of_get_phy_mode()``, ``of_phy_connect()`` are also used to query
484-
per-port PHY specific details: interface connection, MDIO bus location etc..
484+
per-port PHY specific details: interface connection, MDIO bus location, etc.
485485

486486
Driver development
487487
==================
@@ -509,7 +509,7 @@ Switch configuration
509509

510510
- ``setup``: setup function for the switch, this function is responsible for setting
511511
up the ``dsa_switch_ops`` private structure with all it needs: register maps,
512-
interrupts, mutexes, locks etc.. This function is also expected to properly
512+
interrupts, mutexes, locks, etc. This function is also expected to properly
513513
configure the switch to separate all network interfaces from each other, that
514514
is, they should be isolated by the switch hardware itself, typically by creating
515515
a Port-based VLAN ID for each port and allowing only the CPU port and the
@@ -526,13 +526,13 @@ PHY devices and link management
526526
- ``get_phy_flags``: Some switches are interfaced to various kinds of Ethernet PHYs,
527527
if the PHY library PHY driver needs to know about information it cannot obtain
528528
on its own (e.g.: coming from switch memory mapped registers), this function
529-
should return a 32-bits bitmask of "flags", that is private between the switch
529+
should return a 32-bit bitmask of "flags" that is private between the switch
530530
driver and the Ethernet PHY driver in ``drivers/net/phy/\*``.
531531

532532
- ``phy_read``: Function invoked by the DSA slave MDIO bus when attempting to read
533533
the switch port MDIO registers. If unavailable, return 0xffff for each read.
534534
For builtin switch Ethernet PHYs, this function should allow reading the link
535-
status, auto-negotiation results, link partner pages etc..
535+
status, auto-negotiation results, link partner pages, etc.
536536

537537
- ``phy_write``: Function invoked by the DSA slave MDIO bus when attempting to write
538538
to the switch port MDIO registers. If unavailable return a negative error
@@ -554,7 +554,7 @@ Ethtool operations
554554
------------------
555555

556556
- ``get_strings``: ethtool function used to query the driver's strings, will
557-
typically return statistics strings, private flags strings etc.
557+
typically return statistics strings, private flags strings, etc.
558558

559559
- ``get_ethtool_stats``: ethtool function used to query per-port statistics and
560560
return their values. DSA overlays slave network devices general statistics:
@@ -564,7 +564,7 @@ Ethtool operations
564564
- ``get_sset_count``: ethtool function used to query the number of statistics items
565565

566566
- ``get_wol``: ethtool function used to obtain Wake-on-LAN settings per-port, this
567-
function may, for certain implementations also query the master network device
567+
function may for certain implementations also query the master network device
568568
Wake-on-LAN settings if this interface needs to participate in Wake-on-LAN
569569

570570
- ``set_wol``: ethtool function used to configure Wake-on-LAN settings per-port,
@@ -607,27 +607,27 @@ Power management
607607
in a fully active state
608608

609609
- ``port_enable``: function invoked by the DSA slave network device ndo_open
610-
function when a port is administratively brought up, this function should be
611-
fully enabling a given switch port. DSA takes care of marking the port with
610+
function when a port is administratively brought up, this function should
611+
fully enable a given switch port. DSA takes care of marking the port with
612612
``BR_STATE_BLOCKING`` if the port is a bridge member, or ``BR_STATE_FORWARDING`` if it
613613
was not, and propagating these changes down to the hardware
614614

615615
- ``port_disable``: function invoked by the DSA slave network device ndo_close
616-
function when a port is administratively brought down, this function should be
617-
fully disabling a given switch port. DSA takes care of marking the port with
616+
function when a port is administratively brought down, this function should
617+
fully disable a given switch port. DSA takes care of marking the port with
618618
``BR_STATE_DISABLED`` and propagating changes to the hardware if this port is
619619
disabled while being a bridge member
620620

621621
Bridge layer
622622
------------
623623

624624
- ``port_bridge_join``: bridge layer function invoked when a given switch port is
625-
added to a bridge, this function should be doing the necessary at the switch
626-
level to permit the joining port from being added to the relevant logical
625+
added to a bridge, this function should do what's necessary at the switch
626+
level to permit the joining port to be added to the relevant logical
627627
domain for it to ingress/egress traffic with other members of the bridge.
628628

629629
- ``port_bridge_leave``: bridge layer function invoked when a given switch port is
630-
removed from a bridge, this function should be doing the necessary at the
630+
removed from a bridge, this function should do what's necessary at the
631631
switch level to deny the leaving port from ingress/egress traffic from the
632632
remaining bridge members. When the port leaves the bridge, it should be aged
633633
out at the switch hardware for the switch to (re) learn MAC addresses behind
@@ -663,7 +663,7 @@ Bridge layer
663663
point for drivers that need to configure the hardware for enabling this
664664
feature.
665665

666-
- ``port_bridge_tx_fwd_unoffload``: bridge layer function invoken when a driver
666+
- ``port_bridge_tx_fwd_unoffload``: bridge layer function invoked when a driver
667667
leaves a bridge port which had the TX forwarding offload feature enabled.
668668

669669
Bridge VLAN filtering

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,6 +3253,7 @@ static int bnxt_alloc_tx_rings(struct bnxt *bp)
32533253
}
32543254
qidx = bp->tc_to_qidx[j];
32553255
ring->queue_id = bp->q_info[qidx].queue_id;
3256+
spin_lock_init(&txr->xdp_tx_lock);
32563257
if (i < bp->tx_nr_rings_xdp)
32573258
continue;
32583259
if (i % bp->tx_nr_rings_per_tc == (bp->tx_nr_rings_per_tc - 1))
@@ -10338,6 +10339,12 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1033810339
if (irq_re_init)
1033910340
udp_tunnel_nic_reset_ntf(bp->dev);
1034010341

10342+
if (bp->tx_nr_rings_xdp < num_possible_cpus()) {
10343+
if (!static_key_enabled(&bnxt_xdp_locking_key))
10344+
static_branch_enable(&bnxt_xdp_locking_key);
10345+
} else if (static_key_enabled(&bnxt_xdp_locking_key)) {
10346+
static_branch_disable(&bnxt_xdp_locking_key);
10347+
}
1034110348
set_bit(BNXT_STATE_OPEN, &bp->state);
1034210349
bnxt_enable_int(bp);
1034310350
/* Enable TX queues */

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,8 @@ struct nqe_cn {
593593
#define BNXT_MAX_MTU 9500
594594
#define BNXT_MAX_PAGE_MODE_MTU \
595595
((unsigned int)PAGE_SIZE - VLAN_ETH_HLEN - NET_IP_ALIGN - \
596-
XDP_PACKET_HEADROOM)
596+
XDP_PACKET_HEADROOM - \
597+
SKB_DATA_ALIGN((unsigned int)sizeof(struct skb_shared_info)))
597598

598599
#define BNXT_MIN_PKT_SIZE 52
599600

@@ -800,6 +801,8 @@ struct bnxt_tx_ring_info {
800801
u32 dev_state;
801802

802803
struct bnxt_ring_struct tx_ring_struct;
804+
/* Synchronize simultaneous xdp_xmit on same ring */
805+
spinlock_t xdp_tx_lock;
803806
};
804807

805808
#define BNXT_LEGACY_COAL_CMPL_PARAMS \

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "bnxt.h"
2121
#include "bnxt_xdp.h"
2222

23+
DEFINE_STATIC_KEY_FALSE(bnxt_xdp_locking_key);
24+
2325
struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp,
2426
struct bnxt_tx_ring_info *txr,
2527
dma_addr_t mapping, u32 len)
@@ -227,11 +229,16 @@ int bnxt_xdp_xmit(struct net_device *dev, int num_frames,
227229
ring = smp_processor_id() % bp->tx_nr_rings_xdp;
228230
txr = &bp->tx_ring[ring];
229231

232+
if (READ_ONCE(txr->dev_state) == BNXT_DEV_STATE_CLOSING)
233+
return -EINVAL;
234+
235+
if (static_branch_unlikely(&bnxt_xdp_locking_key))
236+
spin_lock(&txr->xdp_tx_lock);
237+
230238
for (i = 0; i < num_frames; i++) {
231239
struct xdp_frame *xdp = frames[i];
232240

233-
if (!txr || !bnxt_tx_avail(bp, txr) ||
234-
!(bp->bnapi[ring]->flags & BNXT_NAPI_FLAG_XDP))
241+
if (!bnxt_tx_avail(bp, txr))
235242
break;
236243

237244
mapping = dma_map_single(&pdev->dev, xdp->data, xdp->len,
@@ -250,6 +257,9 @@ int bnxt_xdp_xmit(struct net_device *dev, int num_frames,
250257
bnxt_db_write(bp, &txr->tx_db, txr->tx_prod);
251258
}
252259

260+
if (static_branch_unlikely(&bnxt_xdp_locking_key))
261+
spin_unlock(&txr->xdp_tx_lock);
262+
253263
return nxmit;
254264
}
255265

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#ifndef BNXT_XDP_H
1111
#define BNXT_XDP_H
1212

13+
DECLARE_STATIC_KEY_FALSE(bnxt_xdp_locking_key);
14+
1315
struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp,
1416
struct bnxt_tx_ring_info *txr,
1517
dma_addr_t mapping, u32 len);

drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev)
167167
base = of_iomap(node, 0);
168168
if (!base) {
169169
err = -ENOMEM;
170-
goto err_close;
170+
goto err_put;
171171
}
172172

173173
err = fsl_mc_allocate_irqs(mc_dev);
@@ -210,6 +210,8 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev)
210210
fsl_mc_free_irqs(mc_dev);
211211
err_unmap:
212212
iounmap(base);
213+
err_put:
214+
of_node_put(node);
213215
err_close:
214216
dprtc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);
215217
err_free_mcp:

drivers/net/ethernet/fungible/funcore/fun_dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,8 @@ static int fun_get_dev_limits(struct fun_dev *fdev)
586586
/* Calculate the max QID based on SQ/CQ/doorbell counts.
587587
* SQ/CQ doorbells alternate.
588588
*/
589-
num_dbs = (pci_resource_len(pdev, 0) - NVME_REG_DBS) /
590-
(fdev->db_stride * 4);
589+
num_dbs = (pci_resource_len(pdev, 0) - NVME_REG_DBS) >>
590+
(2 + NVME_CAP_STRIDE(fdev->cap_reg));
591591
fdev->max_qid = min3(cq_count, sq_count, num_dbs / 2) - 1;
592592
fdev->kern_end_qid = fdev->max_qid + 1;
593593
return 0;

0 commit comments

Comments
 (0)