[PATCH] net: dsa: b53: support legacy FCS tags

Álvaro Fernández Rojas posted 1 patch 6 months, 2 weeks ago
drivers/net/dsa/b53/Kconfig      | 1 +
drivers/net/dsa/b53/b53_common.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
[PATCH] net: dsa: b53: support legacy FCS tags
Posted by Álvaro Fernández Rojas 6 months, 2 weeks ago
Commit 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.

Fixes: 46c5176c586c ("net: dsa: b53: support legacy tags")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/net/dsa/b53/Kconfig      | 1 +
 drivers/net/dsa/b53/b53_common.c | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/b53/Kconfig b/drivers/net/dsa/b53/Kconfig
index ebaa4a80d5444..915008e8eff53 100644
--- a/drivers/net/dsa/b53/Kconfig
+++ b/drivers/net/dsa/b53/Kconfig
@@ -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
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 132683ed3abe6..28a20bf0c669e 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -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;
 	}
-- 
2.39.5

Re: [PATCH] net: dsa: b53: support legacy FCS tags
Posted by kernel test robot 6 months, 2 weeks ago
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/202505310308.8veTfz2G-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250531/202505310308.8veTfz2G-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505310308.8veTfz2G-lkp@intel.com/

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	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki