net: dsa: brcm: add legacy FCS tag
PATCH 1/1 net: dsa: brcm: add legacy FCS tag
The existing brcm legacy tag only works with BCM63xx switches. These patches add a new legacy tag for BCM5325 and BCM5365 switches, which require including the FCS and length.
Álvaro Fernández Rojas (3):
net: dsa: tag_brcm: legacy: reorganize functions
net: dsa: tag_brcm: add support for legacy FCS tags
net: dsa: b53: support legacy FCS tags
drivers/net/dsa/b53/Kconfig | 1 + drivers/net/dsa/b53/b53_common.c | 7 +- include/net/dsa.h | 2 + net/dsa/Kconfig | 8 +++ net/dsa/tag_brcm.c | 117 ++++++++++++++++++++++++------- 5 files changed, 109 insertions(+), 26 deletions(-)
Signature · 1 line
2.39.5
PATCH 1/1 net: dsa: tag_brcm: legacy: reorganize functions
Move brcm_leg_tag_rcv() definition to top.
This function is going to be shared between two different tags.
--- net/dsa/tag_brcm.c | 64 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-)
net/dsa/tag_brcm.c +32 -32
@@ -213,6 +213,38 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM, BRCM_NAME);#endif #if IS_ENABLED (CONFIG_NET_DSA_TAG_BRCM_LEGACY ) +static struct sk_buff *brcm_leg_tag_rcv (struct sk_buff *skb, +struct net_device *dev) +{ +int len =BRCM_LEG_TAG_LEN ; +int source_port; +u8 *brcm_tag; + +if (unlikely (!pskb_may_pull (skb,BRCM_LEG_TAG_LEN +VLAN_HLEN ))) +return NULL ; + + brcm_tag =dsa_etype_header_pos_rx (skb); + + source_port = brcm_tag[5 ] &BRCM_LEG_PORT_ID ; + + skb->dev =dsa_conduit_find_user (dev,0 , source_port); +if (!skb->dev) +return NULL ; + +/* VLAN tag is added by BCM63xx internal switch */ +if (netdev_uses_dsa (skb->dev)) + len +=VLAN_HLEN ; + +/* Remove Broadcom tag and update checksum */ +skb_pull_rcsum (skb, len); + +dsa_default_offload_fwd_mark (skb); + +dsa_strip_etype_header (skb, len); + +return skb; +} +static struct sk_buff *brcm_leg_tag_xmit (struct sk_buff *skb,struct net_device *dev) {
@@ -250,38 +282,6 @@ static struct sk_buff *brcm_leg_tag_xmit(struct sk_buff *skb,return skb; } -static struct sk_buff *brcm_leg_tag_rcv (struct sk_buff *skb, -struct net_device *dev) -{ -int len =BRCM_LEG_TAG_LEN ; -int source_port; -u8 *brcm_tag; - -if (unlikely (!pskb_may_pull (skb,BRCM_LEG_TAG_LEN +VLAN_HLEN ))) -return NULL ; - - brcm_tag =dsa_etype_header_pos_rx (skb); - - source_port = brcm_tag[5 ] &BRCM_LEG_PORT_ID ; - - skb->dev =dsa_conduit_find_user (dev,0 , source_port); -if (!skb->dev) -return NULL ; - -/* VLAN tag is added by BCM63xx internal switch */ -if (netdev_uses_dsa (skb->dev)) - len +=VLAN_HLEN ; - -/* Remove Broadcom tag and update checksum */ -skb_pull_rcsum (skb, len); - -dsa_default_offload_fwd_mark (skb); - -dsa_strip_etype_header (skb, len); - -return skb; -} -static const struct dsa_device_ops brcm_legacy_netdev_ops = { .name =BRCM_LEGACY_NAME , .proto =DSA_TAG_PROTO_BRCM_LEGACY ,
Signature · 1 line
2.39.5
PATCH 1/1 net: dsa: tag_brcm: add support for legacy FCS tags
In reply to Álvaro Fernández RojasAdd support for legacy Broadcom FCS tags, which are similar to DSA_TAG_PROTO_BRCM_LEGACY.
BCM5325 and BCM5365 switches require including the original FCS value and length, as opposed to BCM63xx switches.
Adding the original FCS value and length to DSA_TAG_PROTO_BRCM_LEGACY would impact performance of BCM63xx switches, so it's better to create a new tag.
--- include/net/dsa.h | 2 ++ net/dsa/Kconfig | 8 ++++++ net/dsa/tag_brcm.c | 71 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 1 deletion(-)
include/net/dsa.h +2 -0
@@ -54,11 +54,13 @@ struct tc_action;#define DSA_TAG_PROTO_RZN1_A5PSW_VALUE 26#define DSA_TAG_PROTO_LAN937X_VALUE 27#define DSA_TAG_PROTO_VSC73XX_8021Q_VALUE 28 +#define DSA_TAG_PROTO_BRCM_LEGACY_FCS_VALUE 29enum dsa_tag_protocol {DSA_TAG_PROTO_NONE =DSA_TAG_PROTO_NONE_VALUE ,DSA_TAG_PROTO_BRCM =DSA_TAG_PROTO_BRCM_VALUE ,DSA_TAG_PROTO_BRCM_LEGACY =DSA_TAG_PROTO_BRCM_LEGACY_VALUE , +DSA_TAG_PROTO_BRCM_LEGACY_FCS =DSA_TAG_PROTO_BRCM_LEGACY_FCS_VALUE ,DSA_TAG_PROTO_BRCM_PREPEND =DSA_TAG_PROTO_BRCM_PREPEND_VALUE ,DSA_TAG_PROTO_DSA =DSA_TAG_PROTO_DSA_VALUE ,DSA_TAG_PROTO_EDSA =DSA_TAG_PROTO_EDSA_VALUE ,
net/dsa/Kconfig +8 -0
@@ -49,6 +49,14 @@ config NET_DSA_TAG_BRCM_LEGACY Broadcom legacy switches which place the tag after the MAC source address. +config NET_DSA_TAG_BRCM_LEGACY_FCS + tristate "Tag driver for Broadcom legacy switches using in-frame headers, FCS and length" + select NET_DSA_TAG_BRCM_COMMON + help + Say Y if you want to enable support for tagging frames for the + Broadcom legacy switches which place the tag after the MAC source + address and require the original FCS and length. + config NET_DSA_TAG_BRCM_PREPEND tristate "Tag driver for Broadcom switches using prepended headers" select NET_DSA_TAG_BRCM_COMMON
net/dsa/tag_brcm.c +70 -1
108 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH 1/1 net: dsa: b53: support legacy FCS tags
In reply to Álvaro Fernández RojasCommit 46c5176c586c ("net: dsa: b53: support legacy tags") introduced support for legacy tags, but it turns out that BCM5325 and BCM5365 switches require the original FCS value and length, so they have to be treated differently.
--- drivers/net/dsa/b53/Kconfig | 1 + drivers/net/dsa/b53/b53_common.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/dsa/b53/Kconfig +1 -0
@@ -5,6 +5,7 @@ menuconfig B53 select NET_DSA_TAG_NONE select NET_DSA_TAG_BRCM select NET_DSA_TAG_BRCM_LEGACY + select NET_DSA_TAG_BRCM_LEGACY_FCS select NET_DSA_TAG_BRCM_PREPEND help This driver adds support for Broadcom managed switch chips. It supports
drivers/net/dsa/b53/b53_common.c +5 -2
@@ -2262,8 +2262,11 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, goto out; } -/* Older models require a different 6 byte tag */ -if (is5325 (dev) ||is5365 (dev) ||is63xx (dev)) { +/* Older models require different 6 byte tags */ +if (is5325 (dev) ||is5365 (dev)) { + dev->tag_protocol =DSA_TAG_PROTO_BRCM_LEGACY_FCS ; + goto out; + }else if (is63xx (dev)) { dev->tag_protocol =DSA_TAG_PROTO_BRCM_LEGACY ; goto out; }
Signature · 1 line
2.39.5
kernel test robot
build botRe: [PATCH] net: dsa: b53: support legacy FCS tags
kernel test robot noticed the following build errors:
Hi Álvaro,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
[also build test ERROR on net/main linus/master v6.15 next-20250530] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/lvaro-Fern-ndez-Rojas/net-dsa-b53-support-legacy-FCS-tags/20250530-235844 base: net-next/main patch link: https://lore.kernel.org/r/20250530155618.273567-4-noltari%40gmail.com patch subject: [PATCH] net: dsa: b53: support legacy FCS tags config: sparc-randconfig-001-20250531 (https://download.01.org/0day-ci/archive/20250531/[email protected]/config) compiler: sparc64-linux-gcc (GCC) 8.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250531/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/net/dsa/b53/b53_common.c: In function 'b53_get_tag_protocol':
>> drivers/net/dsa/b53/b53_common.c:2267:23: error: 'DSA_TAG_PROTO_BRCM_LEGACY_FCS' undeclared (first use in this function); did you mean 'DSA_TAG_PROTO_BRCM_LEGACY'?
dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY_FCS;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DSA_TAG_PROTO_BRCM_LEGACY drivers/net/dsa/b53/b53_common.c:2267:23: note: each undeclared identifier is reported only once for each function it appears in
vim +2267 drivers/net/dsa/b53/b53_common.c
2254
2255 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
2256 enum dsa_tag_protocol mprot)
2257 {
2258 struct b53_device *dev = ds->priv;
2259
2260 if (!b53_can_enable_brcm_tags(ds, port, mprot)) {
2261 dev->tag_protocol = DSA_TAG_PROTO_NONE;
2262 goto out;
2263 }
2264
2265 /* Older models require different 6 byte tags */
2266 if (is5325(dev) || is5365(dev)) {
> 2267 dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY_FCS;
2268 goto out;
2269 } else if (is63xx(dev)) {
2270 dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY;
2271 goto out;
2272 }
2273
2274 /* Broadcom BCM58xx chips have a flow accelerator on Port 8
2275 * which requires us to use the prepended Broadcom tag type
2276 */
2277 if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) {
2278 dev->tag_protocol = DSA_TAG_PROTO_BRCM_PREPEND;
2279 goto out;
2280 }
2281
2282 dev->tag_protocol = DSA_TAG_PROTO_BRCM;
2283 out:
2284 return dev->tag_protocol;
2285 }
2286 EXPORT_SYMBOL(b53_get_tag_protocol);
2287
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 17 lines · Álvaro Fernández Rojas
The existing brcm legacy tag only works with BCM63xx switches. These patches add a new legacy tag for BCM5325 and BCM5365 switches, which require including the FCS and length.
Álvaro Fernández Rojas (3):
net: dsa:tag_brcm: legacy: reorganize functions
net: dsa:tag_brcm: add support for legacy FCS tags
net: dsa: b53: support legacy FCS tagsdrivers/net/dsa/b53/Kconfig | 1 + drivers/net/dsa/b53/b53_common.c | 7 +- include/net/dsa.h | 2 + net/dsa/Kconfig | 8 +++ net/dsa/tag_brcm.c | 117 ++++++++++++++++++++++++------- 5 files changed, 109 insertions(+), 26 deletions(-)
Quoted 3 lines
--
2.39.5
Sorry, but I've just realized that I generated the patches with "-N"...
Jakub Kicinski
maintainerQuoted 1 line · On Fri, 30 May 2025 17:58:36 +0200 Álvaro Fernández Rojas wrote:
Sorry, but I've just realized that I generated the patches with "-N"...
FWIW networking tree is closed during the merge window (for another week), so we can't process this anyway.. If you wanna repost please do so as an RFC.