lede/target/linux/generic/backport-5.10/610-v5.13-16-net-dsa-resolve-forwarding-path-for-dsa-slave-ports.patch
Beginner 931b793a06
kernel: bump 5.10 to 5.10.142 (#10084)
* kernel: bump 5.10 to 5.10.139

All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>

* kernel: bump 5.10 to 5.10.141

All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>

* kernel: bump 5.10 to 5.10.142

All patches automatically rebased.

Signed-off-by: John Audia <therealgraysky@proton.me>

* kernel: refresh 5.10 patches

Manual rebase:
  target/linux/generic/hack-5.10/953-net-patch-linux-kernel-to-support-shortcut-fe.patch

Build system: x86_64
Build-tested: x86_64
Run-tested: x86_64

Signed-off-by: Beginner-Go <70857188+Beginner-Go@users.noreply.github.com>

Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Beginner-Go <70857188+Beginner-Go@users.noreply.github.com>
Co-authored-by: John Audia <therealgraysky@proton.me>
2022-09-12 01:25:26 +08:00

64 lines
1.6 KiB
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 24 Mar 2021 02:30:37 +0100
Subject: [PATCH] net: dsa: resolve forwarding path for dsa slave ports
Add .ndo_fill_forward_path for dsa slave port devices
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -846,6 +846,7 @@ enum net_device_path_type {
DEV_PATH_VLAN,
DEV_PATH_BRIDGE,
DEV_PATH_PPPOE,
+ DEV_PATH_DSA,
};
struct net_device_path {
@@ -866,6 +867,10 @@ struct net_device_path {
u16 vlan_id;
__be16 vlan_proto;
} bridge;
+ struct {
+ int port;
+ u16 proto;
+ } dsa;
};
};
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1619,6 +1619,21 @@ static struct devlink_port *dsa_slave_ge
return dp->ds->devlink ? &dp->devlink_port : NULL;
}
+static int dsa_slave_fill_forward_path(struct net_device_path_ctx *ctx,
+ struct net_device_path *path)
+{
+ struct dsa_port *dp = dsa_slave_to_port(ctx->dev);
+ struct dsa_port *cpu_dp = dp->cpu_dp;
+
+ path->dev = ctx->dev;
+ path->type = DEV_PATH_DSA;
+ path->dsa.proto = cpu_dp->tag_ops->proto;
+ path->dsa.port = dp->index;
+ ctx->dev = cpu_dp->master;
+
+ return 0;
+}
+
static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_open = dsa_slave_open,
.ndo_stop = dsa_slave_close,
@@ -1644,6 +1659,7 @@ static const struct net_device_ops dsa_s
.ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid,
.ndo_get_devlink_port = dsa_slave_get_devlink_port,
.ndo_change_mtu = dsa_slave_change_mtu,
+ .ndo_fill_forward_path = dsa_slave_fill_forward_path,
};
static struct device_type dsa_type = {