Devicetree
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/6] Add Northstar FA TCP/UDP NAT offload with a bridged LAN
@ 2026-12-01 18:22 Florian Fainelli
  2026-12-01 18:22 ` [PATCH net-next v2 1/6] dt-bindings: net: describe the Northstar flow accelerator Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2026-12-01 18:22 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, andrew+netdev, andrew, bcm-kernel-feedback-list,
	bridge, conor+dt, corbet, coreteam, davem, devicetree, edumazet,
	fw, horms, idosch, jonas.gorski, krzk+dt, kuba, linux-doc,
	linux-kernel, netfilter-devel, olteanv, pabeni, pablo, phil,
	rafal, razor, rdunlap, robh, skhan, willemb

Add nftables flowtable offload for the original flow accelerator in
BCM4708/BCM5301X. The six patches provide bindings, B53/DSA metadata and
exception paths, cached-path validation and invalidation, the bgmac
backend, KUnit tests and a hardware qualification guide.

Support the usual router layout: a standalone WAN and an untagged LAN
bridge containing four wired LAN ports and software members such as a
PCIe WLAN interface. Wired IPv4 TCP/UDP SNAT or DNAT can use FA. Software
members retain software forwarding. Two standalone DSA router ports also
remain supported. Use distinct LAN/WAN router MACs, MTU 1500 and one
hardware flowtable in the initial network namespace. Include only the
physical wired DSA ports in the hardware flowtable.

Data travels through GMAC2 and switch port 8 (IMP0). B53 CFP redirects
TCP control, low-TTL, oversized and ingress-policy exceptions through
GMAC0 and switch port 5 (IMP1), outside inline FA. Both protocols require
this auxiliary connection. Router-domain and source-MAC guards preserve
ordinary LAN switching and force continued tuples from another physical
ingress through Linux learning. Table or classifier exhaustion retains
software forwarding. Existing board device trees must explicitly opt in.

Validate both actual cached routes, neighbours and bridge FDB paths.
FDB notifications invalidate bridge flowtable generations, including
software-only and hardware-capacity fallback owners after client moves.
Retirement is conservative across bridge paths in the same namespace and
across notified IPv4 route, rule and nexthop changes. Non-bridge caches
retain their existing automatic route-validation policy. Unnotified
DSCP-specific route aliases must not be used for accelerated traffic.

Changes in v2:
  - Describe the GMAC3-hosted register window, restrict the GMAC2 consumer
    schema and correct the auxiliary CPU port name to IMP1.
  - Support the bridged-LAN router layout. Add shared source-MAC guards,
    preserve ordinary LAN switching and clear the forwarding mark on
    auxiliary redirects which may require software bridging.
  - Validate cached routes and neighbours without allocating entries;
    return the owner's reverse peer MAC for ingress guards. Resolve
    untagged bridge paths and permit STP state reads under RCU.
  - Notify caches around FDB changes and retire stale bridge generations
    during construction, packet lookup, GC and hardware admission,
    including software-only flows and hardware-capacity fallback.
  - Recheck every installed next hop, serialize block bookkeeping,
    reject non-initial namespaces and retire before ports can receive.
  - Match TCP control in both directions using exact tuples, including
    IP options, and close concurrent peer-installation races. Leave
    unparseable and non-initial fragments on the software path.
  - Handle guard failures, MAC-change vetoes, auxiliary VLAN membership
    and notifier teardown. Retire on bridge state and security changes.
  - Extend the combined KUnit suite to 37 cases and document bridge
    configuration, software-member tests and FDB movement qualification.
  - Fold intermediate fixes into their feature commits, wrap commit
    messages and remove redundant nftables transport matches. Every
    feature patch passes checkpatch.pl --strict without suppressions.
  - Repeat qualification and complete a fresh bridged-LAN mixed soak
    lasting 23 hours 58 minutes, including TCP/UDP capacity fallback.

v1: https://lore.kernel.org/all/20261116222519.1416501-1-florian.fainelli@broadcom.com/

Dependencies:
The base-commit trailer identifies the tested net-next snapshot. The five
prerequisite-patch-id trailers identify independent fixes supplied in a
separate prerequisite bundle, in this order:

  net: ethernet: bgmac: validate RX length against the DMA packet capacity
  netfilter: flowtable: do not forward frames not addressed to the host
  netfilter: flowtable: retain offload ownership until deletion completes
  net: dsa: tag_brcm: fix link-local detection with a prepended tag
  net: ethernet: bgmac: update netdev MTU after changing the MAC

Validation on BCM953012ER / BCM53012:
  - ARM W=1 built-in, module and disabled builds, including module link
    and modpost; targeted DT schemas, examples and board DTBs.
  - 37 combined QEMU KUnit cases, including bridge movement, cache
    generation, source guards and the RCU STP accessor regression.
  - Classic, software-flowtable and hardware TCP/UDP SNAT/DNAT controls
    with payload, checksum, TTL and raw hardware-key checks.
  - Prior boundary, ingress-policy, invalidation and read/insert/delete
    completion-timeout qualification, with fallback and recovery.
  - Software-to-wired continued-tuple movement, simultaneous wired HW
    NAT and software-member NAT/L2 traffic, wrong-ingress trapping,
    FDB updates and bridge/auxiliary-link control transitions.
  - The new bridge soak completed 21 mixed-traffic phases and 20 cycles
    each of UDP overflow, aging, recovery, TCP overflow, FIN drain and
    TCP recovery. Its 132,404,736 wired echo exchanges and 1,538,648
    exchanges on each software bridge stream had no loss or payload
    errors. All 144 periodic independent audits were healthy. There
    were no campaign restarts, host OOMs or unexpected kernel/FA errors.

The software bridge member was a veth; no actual WLAN radio was tested.
Traffic through every physical LAN port, BCM4708/BCM53011 hardware,
FA2/FA+, PPPoE and maximum throughput remain outside this qualification.
Earlier multicast-database diagnostics are tracked separately; the NAT
soak does not establish a fix for them. Register accessibility still
depends on the bootloader's GMAC3 state, as the binding and guide explain.

OpenAI Codex assistance covered implementation, tests, documentation,
changelogs, lab orchestration and submission preparation, using the
requested design, Broadcom documentation, the ISC downstream driver,
kernel sources and review feedback.

Florian Fainelli (6):
  dt-bindings: net: describe the Northstar flow accelerator
  net: dsa: add Broadcom FA metadata and IPv4 exception paths
  net: flow_offload: allow drivers to validate and invalidate cached
    paths
  net: bgmac: add Northstar IPv4 TCP/UDP NAT flowtable offload
  net: add KUnit coverage for FA and flowtable path validation
  docs: net: document Northstar FA setup and NAT qualification

 .../bindings/net/brcm,bcm4708-fa.yaml         |   52 +
 .../bindings/net/brcm,bcm5301x-gmac.yaml      |   33 +
 .../ethernet/broadcom/bcm-ns-fa.rst           |  638 +++++
 .../device_drivers/ethernet/index.rst         |    1 +
 MAINTAINERS                                   |    7 +
 drivers/net/dsa/b53/Kconfig                   |   12 +
 drivers/net/dsa/b53/b53_common.c              |  520 +++-
 drivers/net/dsa/b53/b53_fa_test.c             |  124 +
 drivers/net/dsa/b53/b53_priv.h                |   16 +
 drivers/net/dsa/b53/b53_regs.h                |   39 +
 drivers/net/ethernet/broadcom/.kunitconfig    |   24 +
 drivers/net/ethernet/broadcom/Kconfig         |   39 +
 drivers/net/ethernet/broadcom/Makefile        |    1 +
 .../net/ethernet/broadcom/bcm-ns-fa-test.c    |  795 ++++++
 drivers/net/ethernet/broadcom/bcm-ns-fa.c     | 2218 +++++++++++++++++
 drivers/net/ethernet/broadcom/bcm-ns-fa.h     |   30 +
 drivers/net/ethernet/broadcom/bgmac-bcma.c    |    5 +
 drivers/net/ethernet/broadcom/bgmac.c         |   30 +
 drivers/net/ethernet/broadcom/bgmac.h         |    2 +
 include/linux/dsa/brcm.h                      |   34 +
 include/net/dsa.h                             |    2 +
 include/net/flow_offload.h                    |   14 +
 include/net/netevent.h                        |    1 +
 include/net/netfilter/nf_flow_table.h         |   13 +-
 include/net/netns/flow_table.h                |    3 +
 net/bridge/br_fdb.c                           |   26 +-
 net/bridge/br_stp.c                           |    7 +-
 net/dsa/Kconfig                               |   23 +
 net/dsa/tag_brcm.c                            |  166 +-
 net/dsa/tag_brcm_test.c                       |  200 ++
 net/netfilter/Kconfig                         |   15 +-
 net/netfilter/nf_flow_table_core.c            |   57 +-
 net/netfilter/nf_flow_table_core_test.c       |  203 ++
 net/netfilter/nf_flow_table_offload.c         |  143 ++
 net/netfilter/nf_flow_table_offload_test.c    |  242 ++
 net/netfilter/nf_flow_table_path.c            |    8 +
 net/netfilter/nft_flow_offload.c              |    6 +-
 37 files changed, 5712 insertions(+), 37 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4708-fa.yaml
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm5301x-gmac.yaml
 create mode 100644 Documentation/networking/device_drivers/ethernet/broadcom/bcm-ns-fa.rst
 create mode 100644 drivers/net/dsa/b53/b53_fa_test.c
 create mode 100644 drivers/net/ethernet/broadcom/.kunitconfig
 create mode 100644 drivers/net/ethernet/broadcom/bcm-ns-fa-test.c
 create mode 100644 drivers/net/ethernet/broadcom/bcm-ns-fa.c
 create mode 100644 drivers/net/ethernet/broadcom/bcm-ns-fa.h
 create mode 100644 net/dsa/tag_brcm_test.c
 create mode 100644 net/netfilter/nf_flow_table_offload_test.c


base-commit: d1f4b7c6b997c29de67ad7178ababac2328cb1b4
prerequisite-patch-id: cc5740b3c0df34f00a185bc49b48af0de0b4f246
prerequisite-patch-id: 4a2aa7a8f7a1670091364bf8856b1286bdd4e371
prerequisite-patch-id: 4dac987af9eb210ace8e99bf06ce4273995692bb
prerequisite-patch-id: d322079467996d4b88d7f928251d11869862b32a
prerequisite-patch-id: bfc2b85226ebd6baac17d44e5909873c908e821c

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH net-next v2 1/6] dt-bindings: net: describe the Northstar flow accelerator
  2026-12-01 18:22 [PATCH net-next v2 0/6] Add Northstar FA TCP/UDP NAT offload with a bridged LAN Florian Fainelli
@ 2026-12-01 18:22 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2026-12-01 18:22 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, andrew+netdev, conor+dt, davem, devicetree,
	edumazet, krzk+dt, kuba, linux-kernel, pabeni, robh

Describe the BCM4708/BCM53011/BCM53012 accelerator register resource and
the GMAC2 consumer phandle. The accelerator is inline on switch CPU port
8 (IMP0); GMAC0 and GMAC1 bypass it. Document the additional port 5
(IMP1)/GMAC0 CPU connection for exceptions that cannot safely traverse
the inline lookup. Keep existing boards unchanged unless their topology
explicitly opts in.

The accelerator registers belong to the AXI MAC + flow accelerator block
and sit in the 4 KiB BCMA window of the GMAC3 core, outside of the range
described for the GMAC3 node. BCMA GMAC nodes have no compatible string,
so the consumer schema is selected by the property and restricted to the
GMAC2 node name.

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
Changes in v2:
  - Describe the AXI MAC/FA block and the register placement within the
    GMAC3 4 KiB BCMA window; clarify that FA has no separate DT clock or
    reset input and correct port 5 to IMP1.
  - Explain property-based schema selection for BCMA GMAC nodes and
    restrict the consumer to GMAC2 (ethernet@26000).

 .../bindings/net/brcm,bcm4708-fa.yaml         | 52 +++++++++++++++++++
 .../bindings/net/brcm,bcm5301x-gmac.yaml      | 33 ++++++++++++
 MAINTAINERS                                   |  2 +
 3 files changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm4708-fa.yaml
 create mode 100644 Documentation/devicetree/bindings/net/brcm,bcm5301x-gmac.yaml

diff --git a/Documentation/devicetree/bindings/net/brcm,bcm4708-fa.yaml b/Documentation/devicetree/bindings/net/brcm,bcm4708-fa.yaml
new file mode 100644
index 0000000000000..69dcfd060589b
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/brcm,bcm4708-fa.yaml
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm4708-fa.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Northstar BCM4708 and BCM5301X flow accelerator
+
+maintainers:
+  - Florian Fainelli <f.fainelli@gmail.com>
+
+description: |
+  The flow accelerator is part of the AXI MAC + flow accelerator block, which
+  also contains the four GMAC cores enumerated by BCMA. It is inline between
+  GMAC2 and switch port 8 (IMP0); GMAC0 and GMAC1 bypass it. The GMAC2 BCMA
+  Ethernet node references this register block through a
+  brcm,flow-accelerator phandle. Miss packets carry a prepended accelerator
+  descriptor in place of the embedded switch tag.
+
+  The registers are in the same 4 KiB BCMA window as the GMAC3 core (the
+  loopback port of the block), above the 0x800 bytes that the GMAC3 node
+  describes. The accelerator is part of that block and has no clock or reset
+  input of its own in the device tree.
+
+  Switch port 5 (IMP1), connected to GMAC0, provides a second CPU path for
+  exceptions that must bypass the accelerator, including TCP control,
+  low-TTL and oversized packets. Describe that CPU port with an ethernet
+  phandle to GMAC0 and an internal, 1 Gbps full-duplex fixed link in the
+  switch's ports node. Port 8 remains the data connection to GMAC2.
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm4708-fa
+      - brcm,bcm53011-fa
+      - brcm,bcm53012-fa
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    flow-accelerator@18027c00 {
+        compatible = "brcm,bcm53011-fa";
+        reg = <0x18027c00 0xc0>;
+    };
diff --git a/Documentation/devicetree/bindings/net/brcm,bcm5301x-gmac.yaml b/Documentation/devicetree/bindings/net/brcm,bcm5301x-gmac.yaml
new file mode 100644
index 0000000000000..c560731987bed
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/brcm,bcm5301x-gmac.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/brcm,bcm5301x-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Northstar BCMA GMAC flow accelerator connection
+
+maintainers:
+  - Florian Fainelli <f.fainelli@gmail.com>
+
+description: |
+  BCMA enumerates the Northstar GMACs, and their nodes have no compatible
+  string. This schema is therefore selected by the brcm,flow-accelerator
+  property and describes the optional inline flow accelerator connection on
+  GMAC2, connected to switch IMP0.
+
+select:
+  required:
+    - brcm,flow-accelerator
+
+properties:
+  $nodename:
+    pattern: "^ethernet@26000$"
+
+  brcm,flow-accelerator:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      Phandle to the BCM4708, BCM53011 or BCM53012 inline flow accelerator.
+      Only GMAC2 (BCMA Ethernet core unit 2, ethernet@26000) has this
+      connection.
+
+additionalProperties: true
diff --git a/MAINTAINERS b/MAINTAINERS
index 56212dbc9a0d0..dce9a88f4aef4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5669,6 +5669,8 @@ R:	Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
 L:	netdev@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/brcm,amac.yaml
+F:	Documentation/devicetree/bindings/net/brcm,bcm4708-fa.yaml
+F:	Documentation/devicetree/bindings/net/brcm,bcm5301x-gmac.yaml
 F:	drivers/net/ethernet/broadcom/bgmac*
 F:	drivers/net/ethernet/broadcom/unimac.h
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-01 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 18:22 [PATCH net-next v2 0/6] Add Northstar FA TCP/UDP NAT offload with a bridged LAN Florian Fainelli
2026-12-01 18:22 ` [PATCH net-next v2 1/6] dt-bindings: net: describe the Northstar flow accelerator Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox