Skip to content

Commit d1352f7

Browse files
author
Paolo Abeni
committed
Merge branch 'introduce-flowtable-hw-offloading-in-airoha_eth-driver'
Lorenzo Bianconi says: ==================== Introduce flowtable hw offloading in airoha_eth driver Introduce netfilter flowtable integration in airoha_eth driver to offload 5-tuple flower rules learned by the PPE module if the user accelerates them using a nft configuration similar to the one reported below: table inet filter { flowtable ft { hook ingress priority filter devices = { lan1, lan2, lan3, lan4, eth1 } flags offload; } chain forward { type filter hook forward priority filter; policy accept; meta l4proto { tcp, udp } flow add @ft } } Packet Processor Engine (PPE) module available on EN7581 SoC populates the PPE table with 5-tuples flower rules learned from traffic forwarded between the GDM ports connected to the Packet Switch Engine (PSE) module. airoha_eth driver configures and collects data from the PPE module via a Network Processor Unit (NPU) RISC-V module available on the EN7581 SoC. Move airoha_eth driver in a dedicated folder (drivers/net/ethernet/airoha). v7: https://lore.kernel.org/r/20250224-airoha-en7581-flowtable-offload-v7-0-b4a22ad8364e@kernel.org v6: https://lore.kernel.org/r/20250221-airoha-en7581-flowtable-offload-v6-0-d593af0e9487@kernel.org v5: https://lore.kernel.org/r/20250217-airoha-en7581-flowtable-offload-v5-0-28be901cb735@kernel.org v4: https://lore.kernel.org/r/20250213-airoha-en7581-flowtable-offload-v4-0-b69ca16d74db@kernel.org v3: https://lore.kernel.org/r/20250209-airoha-en7581-flowtable-offload-v3-0-dba60e755563@kernel.org v2: https://lore.kernel.org/r/20250207-airoha-en7581-flowtable-offload-v2-0-3a2239692a67@kernel.org v1: https://lore.kernel.org/r/20250205-airoha-en7581-flowtable-offload-v1-0-d362cfa97b01@kernel.org ==================== Link: https://patch.msgid.link/20250228-airoha-en7581-flowtable-offload-v8-0-01dc1653f46e@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
2 parents 265e352 + 3fe15c6 commit d1352f7

File tree

17 files changed

+3422
-1000
lines changed

17 files changed

+3422
-1000
lines changed

Documentation/devicetree/bindings/net/airoha,en7581-eth.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ properties:
6363
"#size-cells":
6464
const: 0
6565

66+
airoha,npu:
67+
$ref: /schemas/types.yaml#/definitions/phandle
68+
description:
69+
Phandle to the node used to configure the NPU module.
70+
The Airoha Network Processor Unit (NPU) provides a configuration
71+
interface to implement hardware flow offloading programming Packet
72+
Processor Engine (PPE) flow table.
73+
6674
patternProperties:
6775
"^ethernet@[1-4]$":
6876
type: object
@@ -132,6 +140,8 @@ examples:
132140
<GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>,
133141
<GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
134142
143+
airoha,npu = <&npu>;
144+
135145
#address-cells = <1>;
136146
#size-cells = <0>;
137147
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/airoha,en7581-npu.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Airoha Network Processor Unit for EN7581 SoC
8+
9+
maintainers:
10+
- Lorenzo Bianconi <[email protected]>
11+
12+
description:
13+
The Airoha Network Processor Unit (NPU) provides a configuration interface
14+
to implement wired and wireless hardware flow offloading programming Packet
15+
Processor Engine (PPE) flow table.
16+
17+
properties:
18+
compatible:
19+
enum:
20+
- airoha,en7581-npu
21+
22+
reg:
23+
maxItems: 1
24+
25+
interrupts:
26+
items:
27+
- description: mbox host irq line
28+
- description: watchdog0 irq line
29+
- description: watchdog1 irq line
30+
- description: watchdog2 irq line
31+
- description: watchdog3 irq line
32+
- description: watchdog4 irq line
33+
- description: watchdog5 irq line
34+
- description: watchdog6 irq line
35+
- description: watchdog7 irq line
36+
- description: wlan irq line0
37+
- description: wlan irq line1
38+
- description: wlan irq line2
39+
- description: wlan irq line3
40+
- description: wlan irq line4
41+
- description: wlan irq line5
42+
43+
memory-region:
44+
maxItems: 1
45+
description:
46+
Memory used to store NPU firmware binary.
47+
48+
required:
49+
- compatible
50+
- reg
51+
- interrupts
52+
- memory-region
53+
54+
additionalProperties: false
55+
56+
examples:
57+
- |
58+
#include <dt-bindings/interrupt-controller/arm-gic.h>
59+
#include <dt-bindings/interrupt-controller/irq.h>
60+
soc {
61+
#address-cells = <2>;
62+
#size-cells = <2>;
63+
64+
npu@1e900000 {
65+
compatible = "airoha,en7581-npu";
66+
reg = <0 0x1e900000 0 0x313000>;
67+
interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
68+
<GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
69+
<GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
70+
<GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
71+
<GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
72+
<GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
73+
<GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
74+
<GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>,
75+
<GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
76+
<GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
77+
<GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
78+
<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
79+
<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
80+
<GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
81+
<GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
82+
memory-region = <&npu_binary>;
83+
};
84+
};

drivers/net/dsa/mt7530.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,11 @@ mt7531_setup_common(struct dsa_switch *ds)
25862586
/* Allow mirroring frames received on the local port (monitor port). */
25872587
mt7530_set(priv, MT753X_AGC, LOCAL_EN);
25882588

2589+
/* Enable Special Tag for rx frames */
2590+
if (priv->id == ID_EN7581)
2591+
mt7530_write(priv, MT753X_CPORT_SPTAG_CFG,
2592+
CPORT_SW2FE_STAG_EN | CPORT_FE2SW_STAG_EN);
2593+
25892594
/* Flush the FDB table */
25902595
ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL);
25912596
if (ret < 0)

drivers/net/dsa/mt7530.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,10 @@ enum mt7531_xtal_fsel {
627627
#define MT7531_GPIO12_RG_RXD3_MASK GENMASK(19, 16)
628628
#define MT7531_EXT_P_MDIO_12 (2 << 16)
629629

630+
#define MT753X_CPORT_SPTAG_CFG 0x7c10
631+
#define CPORT_SW2FE_STAG_EN BIT(1)
632+
#define CPORT_FE2SW_STAG_EN BIT(0)
633+
630634
/* Registers for LED GPIO control (MT7530 only)
631635
* All registers follow this pattern:
632636
* [ 2: 0] port 0

drivers/net/ethernet/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ source "drivers/net/ethernet/actions/Kconfig"
2020
source "drivers/net/ethernet/adaptec/Kconfig"
2121
source "drivers/net/ethernet/aeroflex/Kconfig"
2222
source "drivers/net/ethernet/agere/Kconfig"
23+
source "drivers/net/ethernet/airoha/Kconfig"
24+
source "drivers/net/ethernet/mellanox/Kconfig"
2325
source "drivers/net/ethernet/alacritech/Kconfig"
2426
source "drivers/net/ethernet/allwinner/Kconfig"
2527
source "drivers/net/ethernet/alteon/Kconfig"

drivers/net/ethernet/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ obj-$(CONFIG_NET_VENDOR_ADAPTEC) += adaptec/
1010
obj-$(CONFIG_GRETH) += aeroflex/
1111
obj-$(CONFIG_NET_VENDOR_ADI) += adi/
1212
obj-$(CONFIG_NET_VENDOR_AGERE) += agere/
13+
obj-$(CONFIG_NET_VENDOR_AIROHA) += airoha/
1314
obj-$(CONFIG_NET_VENDOR_ALACRITECH) += alacritech/
1415
obj-$(CONFIG_NET_VENDOR_ALLWINNER) += allwinner/
1516
obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
config NET_VENDOR_AIROHA
3+
bool "Airoha devices"
4+
depends on ARCH_AIROHA || COMPILE_TEST
5+
help
6+
If you have a Airoha SoC with ethernet, say Y.
7+
8+
if NET_VENDOR_AIROHA
9+
10+
config NET_AIROHA_NPU
11+
tristate "Airoha NPU support"
12+
select WANT_DEV_COREDUMP
13+
select REGMAP_MMIO
14+
help
15+
This driver supports Airoha Network Processor (NPU) available
16+
on the Airoha Soc family.
17+
18+
config NET_AIROHA
19+
tristate "Airoha SoC Gigabit Ethernet support"
20+
depends on NET_DSA || !NET_DSA
21+
select NET_AIROHA_NPU
22+
select PAGE_POOL
23+
help
24+
This driver supports the gigabit ethernet MACs in the
25+
Airoha SoC family.
26+
27+
endif #NET_VENDOR_AIROHA
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# Airoha for the Mediatek SoCs built-in ethernet macs
4+
#
5+
6+
obj-$(CONFIG_NET_AIROHA) += airoha-eth.o
7+
airoha-eth-y := airoha_eth.o airoha_ppe.o
8+
airoha-eth-$(CONFIG_DEBUG_FS) += airoha_ppe_debugfs.o
9+
obj-$(CONFIG_NET_AIROHA_NPU) += airoha_npu.o

0 commit comments

Comments
 (0)