[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202208130009.zZwyAwf9-lkp@intel.com>
Date: Sat, 13 Aug 2022 00:06:20 +0800
From: kernel test robot <lkp@...el.com>
To: Jiri Pirko <jiri@...dia.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [jpirko-mlxsw:jiri_devel_devlink_locking 33/40]
net/dsa/slave.c:2339:13: warning: unused variable 'ret'
tree: https://github.com/jpirko/linux_mlxsw jiri_devel_devlink_locking
head: 3752df45a64c94afd110eeb956cd9adaeec586c1
commit: 95a8f1859e438effd49d5c1ae7828e87b8471180 [33/40] net: make drivers to use SET_NETDEV_DEVLINK_PORT to set devlink_port
config: i386-allyesconfig
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/jpirko/linux_mlxsw/commit/95a8f1859e438effd49d5c1ae7828e87b8471180
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw jiri_devel_devlink_locking
git checkout 95a8f1859e438effd49d5c1ae7828e87b8471180
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/ethernet/broadcom/bnxt/ drivers/net/ethernet/fungible/funeth/ drivers/net/ethernet/intel/ice/ drivers/net/ethernet/marvell/prestera/ drivers/net/ethernet/mellanox/mlx4/ drivers/net/ethernet/mellanox/mlx5/core/ drivers/net/ethernet/mellanox/mlxsw/ drivers/net/ethernet/mscc/ drivers/net/ethernet/netronome/nfp/ drivers/net/netdevsim/ net/dsa/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/etherdevice.h:21,
from net/dsa/slave.c:8:
net/dsa/slave.c: In function 'dsa_slave_create':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
net/dsa/slave.c:2367:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
2367 | SET_NETDEV_DEVLINK_PORT(slave_dev, &port->devlink_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
net/dsa/slave.c:2367:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
2367 | SET_NETDEV_DEVLINK_PORT(slave_dev, &port->devlink_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
net/dsa/slave.c:2367:64: error: expected ')' before ';' token
2367 | SET_NETDEV_DEVLINK_PORT(slave_dev, &port->devlink_port);
| ^
net/dsa/slave.c:2445:20: error: expected ';' before '}' token
2445 | return ret;
| ^
| ;
2446 | }
| ~
>> net/dsa/slave.c:2339:13: warning: unused variable 'ret' [-Wunused-variable]
2339 | int ret;
| ^~~
>> net/dsa/slave.c:2338:32: warning: unused variable 'p' [-Wunused-variable]
2338 | struct dsa_slave_priv *p;
| ^
net/dsa/slave.c:2446:1: error: control reaches end of non-void function [-Werror=return-type]
2446 | }
| ^
At top level:
net/dsa/slave.c:2228:12: warning: 'dsa_slave_phy_setup' defined but not used [-Wunused-function]
2228 | static int dsa_slave_phy_setup(struct net_device *slave_dev)
| ^~~~~~~~~~~~~~~~~~~
net/dsa/slave.c:2041:12: warning: 'dsa_slave_dcbnl_init' defined but not used [-Wunused-function]
2041 | static int dsa_slave_dcbnl_init(struct net_device *dev)
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/etherdevice.h:21,
from drivers/net/netdevsim/netdev.c:17:
drivers/net/netdevsim/netdev.c: In function 'nsim_create':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
drivers/net/netdevsim/netdev.c:363:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
363 | SET_NETDEV_DEVLINK_PORT(dev, &nsim_dev_port->devlink_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
drivers/net/netdevsim/netdev.c:363:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
363 | SET_NETDEV_DEVLINK_PORT(dev, &nsim_dev_port->devlink_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/netdev.c:363:67: error: expected ')' before ';' token
363 | SET_NETDEV_DEVLINK_PORT(dev, &nsim_dev_port->devlink_port);
| ^
drivers/net/netdevsim/netdev.c:375:29: error: expected ';' before '}' token
375 | return ERR_PTR(err);
| ^
| ;
376 | }
| ~
>> drivers/net/netdevsim/netdev.c:348:13: warning: unused variable 'err' [-Wunused-variable]
348 | int err;
| ^~~
drivers/net/netdevsim/netdev.c:376:1: error: control reaches end of non-void function [-Werror=return-type]
376 | }
| ^
At top level:
drivers/net/netdevsim/netdev.c:332:12: warning: 'nsim_init_netdevsim_vf' defined but not used [-Wunused-function]
332 | static int nsim_init_netdevsim_vf(struct netdevsim *ns)
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/netdev.c:300:12: warning: 'nsim_init_netdevsim' defined but not used [-Wunused-function]
300 | static int nsim_init_netdevsim(struct netdevsim *ns)
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from drivers/net/ethernet/broadcom/bnxt/bnxt.c:22:
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_init_one':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13540:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
13540 | SET_NETDEV_DEVLINK_PORT(dev, &bp->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13540:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
13540 | SET_NETDEV_DEVLINK_PORT(dev, &bp->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13540:51: error: expected ')' before ';' token
13540 | SET_NETDEV_DEVLINK_PORT(dev, &bp->dl_port);
| ^
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13747:19: error: expected ';' before '}' token
13747 | return rc;
| ^
| ;
13748 | }
| ~
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:13521:13: warning: unused variable 'rc' [-Wunused-variable]
13521 | int rc, max_irqs;
| ^~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13748:1: error: control reaches end of non-void function [-Werror=return-type]
13748 | }
| ^
At top level:
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13498:12: warning: 'bnxt_map_db_bar' defined but not used [-Wunused-function]
13498 | static int bnxt_map_db_bar(struct bnxt *bp)
| ^~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13481:12: warning: 'bnxt_pcie_dsn_get' defined but not used [-Wunused-function]
13481 | static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
| ^~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13447:13: warning: 'bnxt_vpd_read_info' defined but not used [-Wunused-function]
13447 | static void bnxt_vpd_read_info(struct bnxt *bp)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:13420:12: warning: 'bnxt_init_mac_addr' defined but not used [-Wunused-function]
13420 | static int bnxt_init_mac_addr(struct bnxt *bp)
| ^~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:13086:36: warning: 'bnxt_netdev_ops' defined but not used [-Wunused-const-variable=]
13086 | static const struct net_device_ops bnxt_netdev_ops = {
| ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:13006:41: warning: 'bnxt_udp_tunnels' defined but not used [-Wunused-const-variable=]
13006 | static const struct udp_tunnel_nic_info bnxt_udp_tunnels = {
| ^~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:12586:12: warning: 'bnxt_init_board' defined but not used [-Wunused-function]
12586 | static int bnxt_init_board(struct pci_dev *pdev, struct net_device *dev)
| ^~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:12144:13: warning: 'bnxt_init_dflt_coal' defined but not used [-Wunused-function]
12144 | static void bnxt_init_dflt_coal(struct bnxt *bp)
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:9060:13: warning: 'bnxt_set_max_func_irqs' defined but not used [-Wunused-function]
9060 | static void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max_irqs)
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:5192:12: warning: 'bnxt_alloc_rss_indir_tbl' defined but not used [-Wunused-function]
5192 | static int bnxt_alloc_rss_indir_tbl(struct bnxt *bp)
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4168:12: warning: 'bnxt_alloc_hwrm_resources' defined but not used [-Wunused-function]
4168 | static int bnxt_alloc_hwrm_resources(struct bnxt *bp)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:1536:24: warning: 'bnxt_gro_func_5730x' defined but not used [-Wunused-function]
1536 | static struct sk_buff *bnxt_gro_func_5730x(struct bnxt_tpa_info *tpa_info,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:1504:24: warning: 'bnxt_gro_func_5750x' defined but not used [-Wunused-function]
1504 | static struct sk_buff *bnxt_gro_func_5750x(struct bnxt_tpa_info *tpa_info,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:1438:24: warning: 'bnxt_gro_func_5731x' defined but not used [-Wunused-function]
1438 | static struct sk_buff *bnxt_gro_func_5731x(struct bnxt_tpa_info *tpa_info,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:242:13: warning: 'bnxt_vf_pciid' defined but not used [-Wunused-function]
242 | static bool bnxt_vf_pciid(enum board_idx idx)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/etherdevice.h:21,
from drivers/net/ethernet/fungible/funeth/funeth_main.c:5:
drivers/net/ethernet/fungible/funeth/funeth_main.c: In function 'fun_create_netdev':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
drivers/net/ethernet/fungible/funeth/funeth_main.c:1764:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
1764 | SET_NETDEV_DEVLINK_PORT(netdev, &fp->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
drivers/net/ethernet/fungible/funeth/funeth_main.c:1764:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
1764 | SET_NETDEV_DEVLINK_PORT(netdev, &fp->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/fungible/funeth/funeth_main.c:1764:54: error: expected ')' before ';' token
1764 | SET_NETDEV_DEVLINK_PORT(netdev, &fp->dl_port);
| ^
drivers/net/ethernet/fungible/funeth/funeth_main.c:1821:19: error: expected ';' before '}' token
1821 | return rc;
| ^
| ;
1822 | }
| ~
drivers/net/ethernet/fungible/funeth/funeth_main.c:1761:17: error: label 'free_rss' used but not defined
1761 | goto free_rss;
| ^~~~
drivers/net/ethernet/fungible/funeth/funeth_main.c:1757:17: error: label 'destroy_port' used but not defined
1757 | goto destroy_port;
| ^~~~
drivers/net/ethernet/fungible/funeth/funeth_main.c:1743:17: error: label 'free_netdev' used but not defined
1743 | goto free_netdev;
| ^~~~
drivers/net/ethernet/fungible/funeth/funeth_main.c:1726:17: error: label 'done' used but not defined
1726 | goto done;
| ^~~~
drivers/net/ethernet/fungible/funeth/funeth_main.c:1822:1: error: control reaches end of non-void function [-Werror=return-type]
1822 | }
| ^
At top level:
drivers/net/ethernet/fungible/funeth/funeth_main.c:1505:12: warning: 'fun_dl_port_register' defined but not used [-Wunused-function]
1505 | static int fun_dl_port_register(struct net_device *netdev)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/fungible/funeth/funeth_main.c:1338:36: warning: 'fun_netdev_ops' defined but not used [-Wunused-const-variable=]
1338 | static const struct net_device_ops fun_netdev_ops = {
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/etherdevice.h:21,
from drivers/net/ethernet/marvell/prestera/prestera_main.c:4:
drivers/net/ethernet/marvell/prestera/prestera_main.c: In function 'prestera_port_create':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
drivers/net/ethernet/marvell/prestera/prestera_main.c:629:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
629 | SET_NETDEV_DEVLINK_PORT(dev, &port->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
drivers/net/ethernet/marvell/prestera/prestera_main.c:629:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
629 | SET_NETDEV_DEVLINK_PORT(dev, &port->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/prestera/prestera_main.c:629:53: error: expected ')' before ';' token
629 | SET_NETDEV_DEVLINK_PORT(dev, &port->dl_port);
| ^
drivers/net/ethernet/marvell/prestera/prestera_main.c:737:20: error: expected ';' before '}' token
737 | return err;
| ^
| ;
738 | }
| ~
drivers/net/ethernet/marvell/prestera/prestera_main.c:623:17: error: label 'err_dl_port_register' used but not defined
623 | goto err_dl_port_register;
| ^~~~
drivers/net/ethernet/marvell/prestera/prestera_main.c:618:17: error: label 'err_port_info_get' used but not defined
618 | goto err_port_info_get;
| ^~~~
>> drivers/net/ethernet/marvell/prestera/prestera_main.c:594:41: warning: unused variable 'cfg_mac' [-Wunused-variable]
594 | struct prestera_port_mac_config cfg_mac;
| ^~~~~~~
drivers/net/ethernet/marvell/prestera/prestera_main.c:738:1: error: control reaches end of non-void function [-Werror=return-type]
738 | }
| ^
At top level:
drivers/net/ethernet/marvell/prestera/prestera_main.c:578:13: warning: 'prestera_port_list_add' defined but not used [-Wunused-function]
578 | static void prestera_port_list_add(struct prestera_port *port)
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/prestera/prestera_main.c:520:13: warning: 'prestera_port_stats_update' defined but not used [-Wunused-function]
520 | static void prestera_port_stats_update(struct work_struct *work)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/prestera/prestera_main.c:360:12: warning: 'prestera_port_sfp_bind' defined but not used [-Wunused-function]
360 | static int prestera_port_sfp_bind(struct prestera_port *port)
| ^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/net/sch_generic.h:5,
from include/net/act_api.h:11,
from include/net/tc_act/tc_gact.h:5,
from drivers/net/ethernet/mellanox/mlx5/core/en_main.c:33:
drivers/net/ethernet/mellanox/mlx5/core/en_main.c: In function 'mlx5e_probe':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5759:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
5759 | SET_NETDEV_DEVLINK_PORT(netdev, mlx5e_devlink_get_dl_port(priv));
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5759:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
5759 | SET_NETDEV_DEVLINK_PORT(netdev, mlx5e_devlink_get_dl_port(priv));
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5759:73: error: expected ')' before ';' token
5759 | SET_NETDEV_DEVLINK_PORT(netdev, mlx5e_devlink_get_dl_port(priv));
| ^
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5778:20: error: expected ';' before '}' token
5778 | return err;
| ^
| ;
5779 | }
| ~
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5756:17: error: label 'err_profile_cleanup' used but not defined
5756 | goto err_profile_cleanup;
| ^~~~
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5750:17: error: label 'err_devlink_cleanup' used but not defined
5750 | goto err_devlink_cleanup;
| ^~~~
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5744:17: error: label 'err_destroy_netdev' used but not defined
5744 | goto err_destroy_netdev;
| ^~~~
>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5723:22: warning: unused variable 'state' [-Wunused-variable]
5723 | pm_message_t state = {};
| ^~~~~
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:5779:1: error: control reaches end of non-void function [-Werror=return-type]
5779 | }
| ^
cc1: some warnings being treated as errors
--
In file included from include/linux/rtnetlink.h:7,
from drivers/net/ethernet/netronome/nfp/nfp_devlink.c:4:
drivers/net/ethernet/netronome/nfp/nfp_devlink.c: In function 'nfp_devlink_port_register':
include/linux/netdevice.h:2348:1: error: expected ';' before ')' token
2348 | )}
| ^
drivers/net/ethernet/netronome/nfp/nfp_devlink.c:337:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
337 | SET_NETDEV_DEVLINK_PORT(port->netdev, &port->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:2348:1: error: expected statement before ')' token
2348 | )}
| ^
drivers/net/ethernet/netronome/nfp/nfp_devlink.c:337:9: note: in expansion of macro 'SET_NETDEV_DEVLINK_PORT'
337 | SET_NETDEV_DEVLINK_PORT(port->netdev, &port->dl_port);
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/netronome/nfp/nfp_devlink.c:337:62: error: expected ')' before ';' token
337 | SET_NETDEV_DEVLINK_PORT(port->netdev, &port->dl_port);
| ^
drivers/net/ethernet/netronome/nfp/nfp_devlink.c:358:74: error: expected ';' before '}' token
358 | return devl_port_register(devlink, &port->dl_port, port->eth_id);
| ^
| ;
359 | }
| ~
>> drivers/net/ethernet/netronome/nfp/nfp_devlink.c:335:13: warning: unused variable 'ret' [-Wunused-variable]
335 | int ret;
| ^~~
>> drivers/net/ethernet/netronome/nfp/nfp_devlink.c:334:13: warning: unused variable 'serial_len' [-Wunused-variable]
334 | int serial_len;
| ^~~~~~~~~~
>> drivers/net/ethernet/netronome/nfp/nfp_devlink.c:333:19: warning: unused variable 'serial' [-Wunused-variable]
333 | const u8 *serial;
| ^~~~~~
>> drivers/net/ethernet/netronome/nfp/nfp_devlink.c:332:25: warning: unused variable 'devlink' [-Wunused-variable]
332 | struct devlink *devlink;
| ^~~~~~~
>> drivers/net/ethernet/netronome/nfp/nfp_devlink.c:331:35: warning: unused variable 'eth_port' [-Wunused-variable]
331 | struct nfp_eth_table_port eth_port;
| ^~~~~~~~
>> drivers/net/ethernet/netronome/nfp/nfp_devlink.c:330:35: warning: unused variable 'attrs' [-Wunused-variable]
330 | struct devlink_port_attrs attrs = {};
| ^~~~~
drivers/net/ethernet/netronome/nfp/nfp_devlink.c:359:1: error: control reaches end of non-void function [-Werror=return-type]
359 | }
| ^
cc1: some warnings being treated as errors
vim +/ret +2339 net/dsa/slave.c
2446254915a7d6 Florian Fainelli 2014-09-18 2330
951259aa60180e Vivien Didelot 2017-10-27 2331 int dsa_slave_create(struct dsa_port *port)
91da11f870f00a Lennert Buytenhek 2008-10-07 2332 {
24a9332a58b7f4 Vivien Didelot 2017-11-06 2333 const struct dsa_port *cpu_dp = port->cpu_dp;
f8b8b1cd5aadd2 Vivien Didelot 2017-10-16 2334 struct net_device *master = cpu_dp->master;
4cfbf09cf97f26 Vivien Didelot 2017-08-05 2335 struct dsa_switch *ds = port->ds;
951259aa60180e Vivien Didelot 2017-10-27 2336 const char *name = port->name;
91da11f870f00a Lennert Buytenhek 2008-10-07 2337 struct net_device *slave_dev;
91da11f870f00a Lennert Buytenhek 2008-10-07 @2338 struct dsa_slave_priv *p;
91da11f870f00a Lennert Buytenhek 2008-10-07 @2339 int ret;
91da11f870f00a Lennert Buytenhek 2008-10-07 2340
55199df6d2af55 Florian Fainelli 2017-09-03 2341 if (!ds->num_tx_queues)
55199df6d2af55 Florian Fainelli 2017-09-03 2342 ds->num_tx_queues = 1;
55199df6d2af55 Florian Fainelli 2017-09-03 2343
55199df6d2af55 Florian Fainelli 2017-09-03 2344 slave_dev = alloc_netdev_mqs(sizeof(struct dsa_slave_priv), name,
55199df6d2af55 Florian Fainelli 2017-09-03 2345 NET_NAME_UNKNOWN, ether_setup,
55199df6d2af55 Florian Fainelli 2017-09-03 2346 ds->num_tx_queues, 1);
91da11f870f00a Lennert Buytenhek 2008-10-07 2347 if (slave_dev == NULL)
d87d6f44d7c125 Guenter Roeck 2015-02-24 2348 return -ENOMEM;
91da11f870f00a Lennert Buytenhek 2008-10-07 2349
7ad24ea4bf620a Wilfried Klaebe 2014-05-11 2350 slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2351 #if IS_ENABLED(CONFIG_DCB)
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2352 slave_dev->dcbnl_ops = &dsa_slave_dcbnl_ops;
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2353 #endif
83216e3988cd19 Michael Walle 2021-04-12 2354 if (!is_zero_ether_addr(port->mac))
e35b8d7dbb094c Jakub Kicinski 2021-10-01 2355 eth_hw_addr_set(slave_dev, port->mac);
a2c7023f7075ca Xiaofei Shen 2019-03-29 2356 else
2fcc8005834a39 Bjørn Mork 2013-08-30 2357 eth_hw_addr_inherit(slave_dev, master);
0a5f107b6774aa Phil Sutter 2015-08-18 2358 slave_dev->priv_flags |= IFF_NO_QUEUE;
5e8a1e03aa4dc5 Vladimir Oltean 2022-03-02 2359 if (dsa_switch_supports_uc_filtering(ds))
5e8a1e03aa4dc5 Vladimir Oltean 2022-03-02 2360 slave_dev->priv_flags |= IFF_UNICAST_FLT;
3e8a72d1dae374 Florian Fainelli 2014-08-27 2361 slave_dev->netdev_ops = &dsa_slave_netdev_ops;
bfcb813203e619 Vladimir Oltean 2020-03-27 2362 if (ds->ops->port_max_mtu)
bfcb813203e619 Vladimir Oltean 2020-03-27 2363 slave_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index);
f37db85d0c1eb6 Florian Fainelli 2015-09-23 2364 SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
d442ad4ab1c86b Stephen Hemminger 2009-01-06 2365
4cfbf09cf97f26 Vivien Didelot 2017-08-05 2366 SET_NETDEV_DEV(slave_dev, port->ds->dev);
95a8f1859e438e Jiri Pirko 2022-08-10 2367 SET_NETDEV_DEVLINK_PORT(slave_dev, &port->devlink_port);
4cfbf09cf97f26 Vivien Didelot 2017-08-05 2368 slave_dev->dev.of_node = port->dn;
5075314e4e4b55 Alexander Duyck 2014-09-15 2369 slave_dev->vlan_features = master->vlan_features;
5075314e4e4b55 Alexander Duyck 2014-09-15 2370
5075314e4e4b55 Alexander Duyck 2014-09-15 2371 p = netdev_priv(slave_dev);
6a9006287959ef Heiner Kallweit 2020-11-07 2372 slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
6a9006287959ef Heiner Kallweit 2020-11-07 2373 if (!slave_dev->tstats) {
5f6b4e14cada6d Florian Fainelli 2017-08-03 2374 free_netdev(slave_dev);
5f6b4e14cada6d Florian Fainelli 2017-08-03 2375 return -ENOMEM;
5f6b4e14cada6d Florian Fainelli 2017-08-03 2376 }
e131a563483004 Alexander Lobakin 2020-04-21 2377
e131a563483004 Alexander Lobakin 2020-04-21 2378 ret = gro_cells_init(&p->gcells, slave_dev);
e131a563483004 Alexander Lobakin 2020-04-21 2379 if (ret)
e131a563483004 Alexander Lobakin 2020-04-21 2380 goto out_free;
e131a563483004 Alexander Lobakin 2020-04-21 2381
4cfbf09cf97f26 Vivien Didelot 2017-08-05 2382 p->dp = port;
f50f212749e8a2 Florian Fainelli 2017-01-30 2383 INIT_LIST_HEAD(&p->mall_tc_list);
f8b8b1cd5aadd2 Vivien Didelot 2017-10-16 2384 port->slave = slave_dev;
53da0ebaad1026 Vladimir Oltean 2021-01-29 2385 dsa_slave_setup_tagger(slave_dev);
e804441cfe0b60 Florian Fainelli 2017-09-25 2386
e804441cfe0b60 Florian Fainelli 2017-09-25 2387 netif_carrier_off(slave_dev);
e804441cfe0b60 Florian Fainelli 2017-09-25 2388
53954cf8c5d205 David S. Miller 2017-10-05 2389 ret = dsa_slave_phy_setup(slave_dev);
e804441cfe0b60 Florian Fainelli 2017-09-25 2390 if (ret) {
c9ebf126f12778 Vladimir Oltean 2020-09-08 2391 netdev_err(slave_dev,
c9ebf126f12778 Vladimir Oltean 2020-09-08 2392 "error %d setting up PHY for tree %d, switch %d, port %d\n",
c9ebf126f12778 Vladimir Oltean 2020-09-08 2393 ret, ds->dst->index, ds->index, port->index);
e131a563483004 Alexander Lobakin 2020-04-21 2394 goto out_gcells;
e804441cfe0b60 Florian Fainelli 2017-09-25 2395 }
e804441cfe0b60 Florian Fainelli 2017-09-25 2396
904e112ad43149 Vladimir Oltean 2022-01-06 2397 rtnl_lock();
e31dbd3b6aba58 Vladimir Oltean 2022-01-06 2398
904e112ad43149 Vladimir Oltean 2022-01-06 2399 ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
904e112ad43149 Vladimir Oltean 2022-01-06 2400 if (ret && ret != -EOPNOTSUPP)
904e112ad43149 Vladimir Oltean 2022-01-06 2401 dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
904e112ad43149 Vladimir Oltean 2022-01-06 2402 ret, ETH_DATA_LEN, port->index);
904e112ad43149 Vladimir Oltean 2022-01-06 2403
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2404 ret = register_netdevice(slave_dev);
91da11f870f00a Lennert Buytenhek 2008-10-07 2405 if (ret) {
a2ae6007a442d6 Joe Perches 2014-11-09 2406 netdev_err(master, "error %d registering interface %s\n",
a2ae6007a442d6 Joe Perches 2014-11-09 2407 ret, slave_dev->name);
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2408 rtnl_unlock();
e804441cfe0b60 Florian Fainelli 2017-09-25 2409 goto out_phy;
91da11f870f00a Lennert Buytenhek 2008-10-07 2410 }
91da11f870f00a Lennert Buytenhek 2008-10-07 2411
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2412 if (IS_ENABLED(CONFIG_DCB)) {
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2413 ret = dsa_slave_dcbnl_init(slave_dev);
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2414 if (ret) {
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2415 netdev_err(slave_dev,
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2416 "failed to initialize DCB: %pe\n",
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2417 ERR_PTR(ret));
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2418 rtnl_unlock();
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2419 goto out_unregister;
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2420 }
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2421 }
d538eca85c2aa6 Vladimir Oltean 2022-03-11 2422
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2423 ret = netdev_upper_dev_link(master, slave_dev, NULL);
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2424
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2425 rtnl_unlock();
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2426
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2427 if (ret)
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2428 goto out_unregister;
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2429
e804441cfe0b60 Florian Fainelli 2017-09-25 2430 return 0;
91da11f870f00a Lennert Buytenhek 2008-10-07 2431
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2432 out_unregister:
2f1e8ea726e902 Vladimir Oltean 2020-09-08 2433 unregister_netdev(slave_dev);
e804441cfe0b60 Florian Fainelli 2017-09-25 2434 out_phy:
aab9c4067d2389 Florian Fainelli 2018-05-10 2435 rtnl_lock();
aab9c4067d2389 Florian Fainelli 2018-05-10 2436 phylink_disconnect_phy(p->dp->pl);
aab9c4067d2389 Florian Fainelli 2018-05-10 2437 rtnl_unlock();
aab9c4067d2389 Florian Fainelli 2018-05-10 2438 phylink_destroy(p->dp->pl);
e131a563483004 Alexander Lobakin 2020-04-21 2439 out_gcells:
e131a563483004 Alexander Lobakin 2020-04-21 2440 gro_cells_destroy(&p->gcells);
e804441cfe0b60 Florian Fainelli 2017-09-25 2441 out_free:
6a9006287959ef Heiner Kallweit 2020-11-07 2442 free_percpu(slave_dev->tstats);
0071f56e46dadb Andrew Lunn 2016-01-06 2443 free_netdev(slave_dev);
f8b8b1cd5aadd2 Vivien Didelot 2017-10-16 2444 port->slave = NULL;
0071f56e46dadb Andrew Lunn 2016-01-06 2445 return ret;
0071f56e46dadb Andrew Lunn 2016-01-06 2446 }
0071f56e46dadb Andrew Lunn 2016-01-06 2447
:::::: The code at line 2339 was first introduced by commit
:::::: 91da11f870f00a3322b81c73042291d7f0be5a17 net: Distributed Switch Architecture protocol support
:::::: TO: Lennert Buytenhek <buytenh@...tstofly.org>
:::::: CC: David S. Miller <davem@...emloft.net>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (283987 bytes)
Powered by blists - more mailing lists