linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: lan9303: add VLAN IDs to master device
@ 2022-02-16 15:11 Mans Rullgard
  2022-02-16 15:30 ` Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mans Rullgard @ 2022-02-16 15:11 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Jakub Kicinski, Juergen Borleis, netdev,
	linux-kernel

If the master device does VLAN filtering, the IDs used by the switch
must be added for any frames to be received.  Do this in the
port_enable() function, and remove them in port_disable().

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 drivers/net/dsa/lan9303-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 873a5588171b..f3bf642fbf92 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1084,20 +1084,32 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
 			       struct phy_device *phy)
 {
 	struct lan9303 *chip = ds->priv;
+	struct dsa_port *cpu_dp;
 
 	if (!dsa_is_user_port(ds, port))
 		return 0;
 
+	dsa_switch_for_each_cpu_port(cpu_dp, ds)
+		break;
+
+	vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
+
 	return lan9303_enable_processing_port(chip, port);
 }
 
 static void lan9303_port_disable(struct dsa_switch *ds, int port)
 {
 	struct lan9303 *chip = ds->priv;
+	struct dsa_port *cpu_dp;
 
 	if (!dsa_is_user_port(ds, port))
 		return;
 
+	dsa_switch_for_each_cpu_port(cpu_dp, ds)
+		break;
+
+	vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
+
 	lan9303_disable_processing_port(chip, port);
 	lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: dsa: lan9303: add VLAN IDs to master device
  2022-02-16 15:11 [PATCH] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
@ 2022-02-16 15:30 ` Vladimir Oltean
  2022-02-16 19:33 ` kernel test robot
  2022-02-16 19:33 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2022-02-16 15:30 UTC (permalink / raw)
  To: Mans Rullgard
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Jakub Kicinski, Juergen Borleis, netdev, linux-kernel

On Wed, Feb 16, 2022 at 03:11:11PM +0000, Mans Rullgard wrote:
> If the master device does VLAN filtering, the IDs used by the switch
> must be added for any frames to be received.  Do this in the
> port_enable() function, and remove them in port_disable().
> 
> Signed-off-by: Mans Rullgard <mans@mansr.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: dsa: lan9303: add VLAN IDs to master device
  2022-02-16 15:11 [PATCH] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
  2022-02-16 15:30 ` Vladimir Oltean
@ 2022-02-16 19:33 ` kernel test robot
  2022-02-16 19:33 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-16 19:33 UTC (permalink / raw)
  To: Mans Rullgard, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	Vladimir Oltean, David S. Miller, Jakub Kicinski,
	Juergen Borleis, linux-kernel
  Cc: kbuild-all, netdev

Hi Mans,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc4 next-20220216]
[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]

url:    https://github.com/0day-ci/linux/commits/Mans-Rullgard/net-dsa-lan9303-add-VLAN-IDs-to-master-device/20220216-231201
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c5d9ae265b105d9a67575fb67bd4650a6fc08e25
config: openrisc-randconfig-r004-20220216 (https://download.01.org/0day-ci/archive/20220217/202202170354.djrMhJqt-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/960beb0e82f5d219a4f7e8bdcc49fb548a82a69d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mans-Rullgard/net-dsa-lan9303-add-VLAN-IDs-to-master-device/20220216-231201
        git checkout 960beb0e82f5d219a4f7e8bdcc49fb548a82a69d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/net/dsa/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/dsa/lan9303-core.c: In function 'lan9303_port_enable':
>> drivers/net/dsa/lan9303-core.c:1095:9: error: implicit declaration of function 'vlan_vid_add' [-Werror=implicit-function-declaration]
    1095 |         vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
         |         ^~~~~~~~~~~~
   drivers/net/dsa/lan9303-core.c: In function 'lan9303_port_disable':
>> drivers/net/dsa/lan9303-core.c:1111:9: error: implicit declaration of function 'vlan_vid_del' [-Werror=implicit-function-declaration]
    1111 |         vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
         |         ^~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/vlan_vid_add +1095 drivers/net/dsa/lan9303-core.c

  1082	
  1083	static int lan9303_port_enable(struct dsa_switch *ds, int port,
  1084				       struct phy_device *phy)
  1085	{
  1086		struct lan9303 *chip = ds->priv;
  1087		struct dsa_port *cpu_dp;
  1088	
  1089		if (!dsa_is_user_port(ds, port))
  1090			return 0;
  1091	
  1092		dsa_switch_for_each_cpu_port(cpu_dp, ds)
  1093			break;
  1094	
> 1095		vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
  1096	
  1097		return lan9303_enable_processing_port(chip, port);
  1098	}
  1099	
  1100	static void lan9303_port_disable(struct dsa_switch *ds, int port)
  1101	{
  1102		struct lan9303 *chip = ds->priv;
  1103		struct dsa_port *cpu_dp;
  1104	
  1105		if (!dsa_is_user_port(ds, port))
  1106			return;
  1107	
  1108		dsa_switch_for_each_cpu_port(cpu_dp, ds)
  1109			break;
  1110	
> 1111		vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
  1112	
  1113		lan9303_disable_processing_port(chip, port);
  1114		lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
  1115	}
  1116	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: dsa: lan9303: add VLAN IDs to master device
  2022-02-16 15:11 [PATCH] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
  2022-02-16 15:30 ` Vladimir Oltean
  2022-02-16 19:33 ` kernel test robot
@ 2022-02-16 19:33 ` kernel test robot
  2022-02-16 19:55   ` Vladimir Oltean
  2 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2022-02-16 19:33 UTC (permalink / raw)
  To: Mans Rullgard, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	Vladimir Oltean, David S. Miller, Jakub Kicinski,
	Juergen Borleis, linux-kernel
  Cc: llvm, kbuild-all, netdev

Hi Mans,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc4 next-20220216]
[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]

url:    https://github.com/0day-ci/linux/commits/Mans-Rullgard/net-dsa-lan9303-add-VLAN-IDs-to-master-device/20220216-231201
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c5d9ae265b105d9a67575fb67bd4650a6fc08e25
config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220217/202202170327.RiXqUeGc-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0e628a783b935c70c80815db6c061ec84f884af5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/960beb0e82f5d219a4f7e8bdcc49fb548a82a69d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mans-Rullgard/net-dsa-lan9303-add-VLAN-IDs-to-master-device/20220216-231201
        git checkout 960beb0e82f5d219a4f7e8bdcc49fb548a82a69d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/dsa/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/net/dsa/lan9303-core.c:1095:2: error: implicit declaration of function 'vlan_vid_add' [-Werror,-Wimplicit-function-declaration]
           vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
           ^
>> drivers/net/dsa/lan9303-core.c:1111:2: error: implicit declaration of function 'vlan_vid_del' [-Werror,-Wimplicit-function-declaration]
           vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
           ^
   2 errors generated.


vim +/vlan_vid_add +1095 drivers/net/dsa/lan9303-core.c

  1082	
  1083	static int lan9303_port_enable(struct dsa_switch *ds, int port,
  1084				       struct phy_device *phy)
  1085	{
  1086		struct lan9303 *chip = ds->priv;
  1087		struct dsa_port *cpu_dp;
  1088	
  1089		if (!dsa_is_user_port(ds, port))
  1090			return 0;
  1091	
  1092		dsa_switch_for_each_cpu_port(cpu_dp, ds)
  1093			break;
  1094	
> 1095		vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
  1096	
  1097		return lan9303_enable_processing_port(chip, port);
  1098	}
  1099	
  1100	static void lan9303_port_disable(struct dsa_switch *ds, int port)
  1101	{
  1102		struct lan9303 *chip = ds->priv;
  1103		struct dsa_port *cpu_dp;
  1104	
  1105		if (!dsa_is_user_port(ds, port))
  1106			return;
  1107	
  1108		dsa_switch_for_each_cpu_port(cpu_dp, ds)
  1109			break;
  1110	
> 1111		vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
  1112	
  1113		lan9303_disable_processing_port(chip, port);
  1114		lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
  1115	}
  1116	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: dsa: lan9303: add VLAN IDs to master device
  2022-02-16 19:33 ` kernel test robot
@ 2022-02-16 19:55   ` Vladimir Oltean
  0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2022-02-16 19:55 UTC (permalink / raw)
  To: kernel test robot
  Cc: Mans Rullgard, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S. Miller, Jakub Kicinski, Juergen Borleis, linux-kernel,
	llvm, kbuild-all, netdev

On Thu, Feb 17, 2022 at 03:33:39AM +0800, kernel test robot wrote:
> >> drivers/net/dsa/lan9303-core.c:1095:2: error: implicit declaration of function 'vlan_vid_add' [-Werror,-Wimplicit-function-declaration]
>            vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
>            ^
> >> drivers/net/dsa/lan9303-core.c:1111:2: error: implicit declaration of function 'vlan_vid_del' [-Werror,-Wimplicit-function-declaration]
>            vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
>            ^

#include <linux/if_vlan.h>

drivers/net/dsa/Kconfig:

config NET_DSA_SMSC_LAN9303
	depends on VLAN_8021Q || VLAN_8021Q=n

and maybe you can access using dp->cpu_dp in the next revision.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-16 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 15:11 [PATCH] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
2022-02-16 15:30 ` Vladimir Oltean
2022-02-16 19:33 ` kernel test robot
2022-02-16 19:33 ` kernel test robot
2022-02-16 19:55   ` Vladimir Oltean

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).