* [PATCH net-next] net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode
@ 2020-04-13 18:16 DENG Qingfang
2020-04-14 4:58 ` kbuild test robot
0 siblings, 1 reply; 2+ messages in thread
From: DENG Qingfang @ 2020-04-13 18:16 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Paul Fertser, Sean Wang, riddlariddla,
René van Dorst, linux-mediatek, Stijn Segers, CHEN Minqiang,
John Crispin, Szabolcs Hubai, Chuanhong Guo, Vivien Didelot
In VLAN-unaware mode, the Egress Tag (EG_TAG) field in Port VLAN
Control register must be set to Consistent to let tagged frames pass
through as is, otherwise their tags will be stripped.
Fixes: 83163f7dca56 ("net: dsa: mediatek: add VLAN support for MT7530")
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
---
drivers/net/dsa/mt7530.c | 18 ++++++++++++------
drivers/net/dsa/mt7530.h | 7 +++++++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 2d0d91db0ddb..951a65ac7f73 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -846,8 +846,9 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port)
*/
mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK,
MT7530_PORT_MATRIX_MODE);
- mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK,
- VLAN_ATTR(MT7530_VLAN_TRANSPARENT));
+ mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK,
+ VLAN_ATTR(MT7530_VLAN_TRANSPARENT) |
+ PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
for (i = 0; i < MT7530_NUM_PORTS; i++) {
if (dsa_is_user_port(ds, i) &&
@@ -863,8 +864,8 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port)
if (all_user_ports_removed) {
mt7530_write(priv, MT7530_PCR_P(MT7530_CPU_PORT),
PCR_MATRIX(dsa_user_ports(priv->ds)));
- mt7530_write(priv, MT7530_PVC_P(MT7530_CPU_PORT),
- PORT_SPEC_TAG);
+ mt7530_write(priv, MT7530_PVC_P(MT7530_CPU_PORT), PORT_SPEC_TAG
+ | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
}
}
@@ -890,8 +891,9 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port)
/* Set the port as a user port which is to be able to recognize VID
* from incoming packets before fetching entry within the VLAN table.
*/
- mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK,
- VLAN_ATTR(MT7530_VLAN_USER));
+ mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK,
+ VLAN_ATTR(MT7530_VLAN_USER) |
+ PVC_EG_TAG(MT7530_VLAN_EG_DISABLED));
}
static void
@@ -1380,6 +1382,10 @@ mt7530_setup(struct dsa_switch *ds)
mt7530_cpu_port_enable(priv, i);
else
mt7530_port_disable(ds, i);
+
+ /* Enable consistent egress tag */
+ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK,
+ PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
}
/* Setup port 5 */
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index ef9b52f3152b..aaf8b88c864f 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -172,9 +172,16 @@ enum mt7530_port_mode {
/* Register for port vlan control */
#define MT7530_PVC_P(x) (0x2010 + ((x) * 0x100))
#define PORT_SPEC_TAG BIT(5)
+#define PVC_EG_TAG(x) (((x) & 0x7) << 8)
+#define PVC_EG_TAG_MASK PVC_EG_TAG(7)
#define VLAN_ATTR(x) (((x) & 0x3) << 6)
#define VLAN_ATTR_MASK VLAN_ATTR(3)
+enum mt7530_vlan_port_eg_tag {
+ MT7530_VLAN_EG_DISABLED = 0;
+ MT7530_VLAN_EG_CONSISTENT = 1;
+};
+
enum mt7530_vlan_port_attr {
MT7530_VLAN_USER = 0,
MT7530_VLAN_TRANSPARENT = 3,
--
2.26.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode
2020-04-13 18:16 [PATCH net-next] net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode DENG Qingfang
@ 2020-04-14 4:58 ` kbuild test robot
0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2020-04-14 4:58 UTC (permalink / raw)
To: DENG Qingfang
Cc: Andrew Lunn, kbuild-all, Paul Fertser,
netdev@vger.kernel.org, Sean Wang, riddlariddla,
René van Dorst, linux-mediatek, Stijn Segers, CHEN Minqiang,
John Crispin, Szabolcs Hubai, Chuanhong Guo, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 3085 bytes --]
Hi DENG,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on net/master linus/master v5.7-rc1 next-20200413]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/DENG-Qingfang/net-dsa-mt7530-fix-tagged-frames-pass-through-in-VLAN-unaware-mode/20200414-045838
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 7f80ccfe996871ca69648efee74a60ae7ad0dcd9
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/net/dsa/mt7530.c:23:
>> drivers/net/dsa/mt7530.h:181:29: error: expected ',' or '}' before ';' token
181 | MT7530_VLAN_EG_DISABLED = 0;
| ^
drivers/net/dsa/mt7530.c: In function 'mt7530_port_set_vlan_unaware':
>> drivers/net/dsa/mt7530.c:851:17: error: 'MT7530_VLAN_EG_CONSISTENT' undeclared (first use in this function); did you mean 'MT7530_VLAN_TRANSPARENT'?
851 | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mt7530.h:175:29: note: in definition of macro 'PVC_EG_TAG'
175 | #define PVC_EG_TAG(x) (((x) & 0x7) << 8)
| ^
drivers/net/dsa/mt7530.c:851:17: note: each undeclared identifier is reported only once for each function it appears in
851 | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mt7530.h:175:29: note: in definition of macro 'PVC_EG_TAG'
175 | #define PVC_EG_TAG(x) (((x) & 0x7) << 8)
| ^
drivers/net/dsa/mt7530.c: In function 'mt7530_setup':
drivers/net/dsa/mt7530.c:1388:18: error: 'MT7530_VLAN_EG_CONSISTENT' undeclared (first use in this function); did you mean 'MT7530_VLAN_TRANSPARENT'?
1388 | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mt7530.h:175:29: note: in definition of macro 'PVC_EG_TAG'
175 | #define PVC_EG_TAG(x) (((x) & 0x7) << 8)
| ^
vim +181 drivers/net/dsa/mt7530.h
179
180 enum mt7530_vlan_port_eg_tag {
> 181 MT7530_VLAN_EG_DISABLED = 0;
182 MT7530_VLAN_EG_CONSISTENT = 1;
183 };
184
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52979 bytes --]
[-- Attachment #3: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-14 4:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13 18:16 [PATCH net-next] net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode DENG Qingfang
2020-04-14 4:58 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).