Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3036365imj; Mon, 11 Feb 2019 12:42:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IZQ/wLDYao3jYgH6fLmzYP0tLvzIKtftVo6/H3AuZ2U/5fZphE5uCSktXKZDSLGxTWjqzX6 X-Received: by 2002:a65:6105:: with SMTP id z5mr146363pgu.26.1549917739123; Mon, 11 Feb 2019 12:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917739; cv=none; d=google.com; s=arc-20160816; b=aPMkJmffv7H9ykiEIjddAYDQNwu18/ozNL+vmS+l4Jhn8k3YQxrK55vOM8DHmqPIHZ QQ7lzKmK00gnUyYctoAe8KyNh3K6Rq7FC1VV1OxyoDTP/ACGhXSoE+CZvIsGEy2KEeQO PKHnN6jNlRwuvxK1TYtkWGKIi+aIklpj7//BK/on1s/GjlHj5tN5a4QFs4gw6Be3SyAl 84TT1S90j1MyqUUGIW39sqHbe7soSszpfdCaPpDfKKZ8RpJQbvKh3XzRDCxwrdfm2onc Bo7g8wRwtM+3ntCWcRwyGqXBGWNAW5eHwHKISFJfpszivb4X+k4wkRt2FB8e7KOsv4ad QFDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=H1+HaPC+RDQ7Hf6AkrEO0q3vBnmPihvjrvc1H7LBVkM=; b=cHir+zyiP16QbCfcbz0y8+NEtNiKMXY/19JlBawZFBCw38hQkNMnLCzhDcPsJX/Cfq yRwmoN+R7PUz7eB2WsnZaDAEEeHmi7ZAa9pWTc1LUkuE6RSMQkqxNKA03vsx86cqpMkU 3ShB0JvdjtpA+MRNii5HJL/6QqHnE3bsOPL/OZFLGhUTDEYf8o0vwH5zx6LfQ8i2EY06 vgkeW2OnAlqiP0NONjuI7eiulY2RSpfvJJKvDCsjS3ua6txcrKcviEYaLt0BYFWeL99I 2nIldX3AHMmyWmwsuYetIiD4MIzT5c/1EVowJcOUVY4VCgw7Z3lRKKTIskS8ZhXVqFT3 GG2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vQhGIbL7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h67si5861567pfb.146.2019.02.11.12.42.03; Mon, 11 Feb 2019 12:42:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vQhGIbL7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387983AbfBKTLK (ORCPT + 99 others); Mon, 11 Feb 2019 14:11:10 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37331 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387928AbfBKTLJ (ORCPT ); Mon, 11 Feb 2019 14:11:09 -0500 Received: by mail-pl1-f194.google.com with SMTP id b5so5561plr.4; Mon, 11 Feb 2019 11:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H1+HaPC+RDQ7Hf6AkrEO0q3vBnmPihvjrvc1H7LBVkM=; b=vQhGIbL794frBcHb1jlXwfd5GP+9Z30Ja8S5bu65m4NA3wXSzLd80mvZHZosLNAd9x cbfH+WNeMhjCQnqOHCyViFFV4it6HnZ3wVdHms2njDPa+GFh2dSm4O9p7D/YpJB90NHI NvaVwDzT2uV+CsBRevK2s7GKYnsvCHi8kbNw3XVOIsVYVtYYbBqjhEdAvaVuTpgwXLy7 UXvtchcBUNVSWAMEpztpBuGoe6lYvB/nwhjSIWcR960IO+n/6h1Xh/NUKksiIw+OWEAK aX5qIYxFyo1B/5sU23jLaP2Op/y/BTv9thQYfSguMiUy9KmG1lKRcoDK56SYIL2CLmlH MNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H1+HaPC+RDQ7Hf6AkrEO0q3vBnmPihvjrvc1H7LBVkM=; b=rupA1V54w1lzCkmLI2sGbpkCnbfqpr835hafbilPkaNAgTE1CFu673OwtlMT7QNU0X UZXvLoxJoEdiOk8poo948eWsNeEf3grhAGWJuVPksTu7qOInQDYBJmVDDvuNh40kVbMI dtsCRBM+5gHfqkCV/J494vcZpQxtyPj140wPit7SrVodkcddMVqYvjmV5wRTuX0r8ZXE IdvPZOb3EtQY1xpRO0d5eHefH5nSILJbOFIzLjZA7JUpJkKtj2uauk/h8R4CUym5Ee0E bn1PoX15bVViGnhNScYLbwB+ntOjdTlM6H0x+QTh7KkUhaCTs5JJmYc4lzKlqDGn2Amr nVeQ== X-Gm-Message-State: AHQUAua3mWbgq15p6eQoOkmfHrZY2ZvbiHUguaCvzyV1B27Nw2nQ4GqI gz3jQUtXgs0KAK7Yjf96r5xgQnBI X-Received: by 2002:a17:902:8f8d:: with SMTP id z13mr26082335plo.95.1549912268266; Mon, 11 Feb 2019 11:11:08 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id i24sm2167206pgg.14.2019.02.11.11.11.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 11:11:07 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Ido Schimmel , linux-kernel@vger.kernel.org (open list), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE), jiri@mellanox.com, andrew@lunn.ch, vivien.didelot@gmail.com Subject: [PATCH net-next v4 9/9] net: Remove switchdev_ops Date: Mon, 11 Feb 2019 11:10:01 -0800 Message-Id: <20190211191001.8623-10-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190211191001.8623-1-f.fainelli@gmail.com> References: <20190211191001.8623-1-f.fainelli@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have converted all possible callers to using a switchdev notifier for attributes we do not have a need for implementing switchdev_ops anymore, and this can be removed from all drivers the net_device structure. Acked-by: Jiri Pirko Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 12 ------------ drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 -- .../mellanox/mlxsw/spectrum_switchdev.c | 13 ------------- drivers/net/ethernet/mscc/ocelot.c | 5 ----- drivers/net/ethernet/rocker/rocker_main.c | 6 ------ drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 6 ------ include/linux/netdevice.h | 3 --- include/net/switchdev.h | 18 ------------------ net/dsa/slave.c | 6 ------ 9 files changed, 71 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7c9745cecbbd..619965abab43 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3220,7 +3220,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, } mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; - mlxsw_sp_port_switchdev_init(mlxsw_sp_port); mlxsw_sp->ports[local_port] = mlxsw_sp_port; err = register_netdev(dev); if (err) { @@ -3237,7 +3236,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, err_register_netdev: mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); err_port_vlan_create: err_port_pvid_set: @@ -3280,7 +3278,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port) mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); mlxsw_sp_port_nve_fini(mlxsw_sp_port); mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); @@ -4001,12 +3998,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, goto err_span_init; } - err = mlxsw_sp_switchdev_init(mlxsw_sp); - if (err) { - dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n"); - goto err_switchdev_init; - } - err = mlxsw_sp_counter_pool_init(mlxsw_sp); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter pool\n"); @@ -4077,8 +4068,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, err_afa_init: mlxsw_sp_counter_pool_fini(mlxsw_sp); err_counter_pool_init: - mlxsw_sp_switchdev_fini(mlxsw_sp); -err_switchdev_init: mlxsw_sp_span_fini(mlxsw_sp); err_span_init: mlxsw_sp_lag_fini(mlxsw_sp); @@ -4141,7 +4130,6 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core) mlxsw_sp_nve_fini(mlxsw_sp); mlxsw_sp_afa_fini(mlxsw_sp); mlxsw_sp_counter_pool_fini(mlxsw_sp); - mlxsw_sp_switchdev_fini(mlxsw_sp); mlxsw_sp_span_fini(mlxsw_sp); mlxsw_sp_lag_fini(mlxsw_sp); mlxsw_sp_buffers_fini(mlxsw_sp); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ceebc91f4f1d..82e3e6dc81a1 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -375,8 +375,6 @@ u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes); /* spectrum_switchdev.c */ int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, bool adding); void diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 88d4994309a7..3e2ef69a1d22 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1957,11 +1957,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, return NULL; } -static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { - .switchdev_port_attr_get = mlxsw_sp_port_attr_get, - .switchdev_port_attr_set = mlxsw_sp_port_attr_set, -}; - static int mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, struct mlxsw_sp_bridge_port *bridge_port, @@ -3576,11 +3571,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) kfree(mlxsw_sp->bridge); } -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port) -{ - mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops; -} - -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port) -{ -} diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 2708809713ed..374636e8fcbe 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1324,10 +1324,6 @@ static int ocelot_port_obj_del(struct net_device *dev, return ret; } -static const struct switchdev_ops ocelot_port_switchdev_ops = { - .switchdev_port_attr_set = ocelot_port_attr_set, -}; - static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port, struct net_device *bridge) { @@ -1654,7 +1650,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port, dev->netdev_ops = &ocelot_port_netdev_ops; dev->ethtool_ops = &ocelot_ethtool_ops; - dev->switchdev_ops = &ocelot_port_switchdev_ops; dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS; dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 9a8fe49e32b6..b017543fd196 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2147,11 +2147,6 @@ static int rocker_port_obj_del(struct net_device *dev, return err; } -static const struct switchdev_ops rocker_port_switchdev_ops = { - .switchdev_port_attr_get = rocker_port_attr_get, - .switchdev_port_attr_set = rocker_port_attr_set, -}; - struct rocker_fib_event_work { struct work_struct work; union { @@ -2605,7 +2600,6 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number) rocker_port_dev_addr_init(rocker_port); dev->netdev_ops = &rocker_port_netdev_ops; dev->ethtool_ops = &rocker_port_ethtool_ops; - dev->switchdev_ops = &rocker_port_switchdev_ops; netif_tx_napi_add(dev, &rocker_port->napi_tx, rocker_port_poll_tx, NAPI_POLL_WEIGHT); netif_napi_add(dev, &rocker_port->napi_rx, rocker_port_poll_rx, diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 7c77fb43233e..f4489976a9ac 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -932,11 +932,6 @@ static int swdev_port_obj_del(struct net_device *netdev, return err; } -static const struct switchdev_ops ethsw_port_switchdev_ops = { - .switchdev_port_attr_get = swdev_port_attr_get, - .switchdev_port_attr_set = swdev_port_attr_set, -}; - /* For the moment, only flood setting needs to be updated */ static int port_bridge_join(struct net_device *netdev, struct net_device *upper_dev) @@ -1466,7 +1461,6 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx) SET_NETDEV_DEV(port_netdev, dev); port_netdev->netdev_ops = ðsw_port_ops; port_netdev->ethtool_ops = ðsw_port_ethtool_ops; - port_netdev->switchdev_ops = ðsw_port_switchdev_ops; /* Set MTU limits */ port_netdev->min_mtu = ETH_MIN_MTU; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1fb733f38a47..a747456b9d23 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1836,9 +1836,6 @@ struct net_device { #endif const struct net_device_ops *netdev_ops; const struct ethtool_ops *ethtool_ops; -#ifdef CONFIG_NET_SWITCHDEV - const struct switchdev_ops *switchdev_ops; -#endif #ifdef CONFIG_NET_L3_MASTER_DEV const struct l3mdev_ops *l3mdev_ops; #endif diff --git a/include/net/switchdev.h b/include/net/switchdev.h index b8becabbef38..e9aa920aba57 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -113,21 +113,6 @@ void *switchdev_trans_item_dequeue(struct switchdev_trans *trans); typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); -/** - * struct switchdev_ops - switchdev operations - * - * @switchdev_port_attr_get: Get a port attribute (see switchdev_attr). - * - * @switchdev_port_attr_set: Set a port attribute (see switchdev_attr). - */ -struct switchdev_ops { - int (*switchdev_port_attr_get)(struct net_device *dev, - struct switchdev_attr *attr); - int (*switchdev_port_attr_set)(struct net_device *dev, - const struct switchdev_attr *attr, - struct switchdev_trans *trans); -}; - enum switchdev_notifier_type { SWITCHDEV_FDB_ADD_TO_BRIDGE = 1, SWITCHDEV_FDB_DEL_TO_BRIDGE, @@ -229,7 +214,6 @@ int switchdev_handle_port_obj_del(struct net_device *dev, int (*del_cb)(struct net_device *dev, const struct switchdev_obj *obj)); -#define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops)) #else static inline void switchdev_deferred_process(void) @@ -322,8 +306,6 @@ switchdev_handle_port_obj_del(struct net_device *dev, return 0; } -#define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0) - #endif #endif /* _LINUX_SWITCHDEV_H_ */ diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 66c6c353f4f7..3deab965dad9 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1057,11 +1057,6 @@ static const struct net_device_ops dsa_slave_netdev_ops = { .ndo_get_port_parent_id = dsa_slave_get_port_parent_id, }; -static const struct switchdev_ops dsa_slave_switchdev_ops = { - .switchdev_port_attr_get = dsa_slave_port_attr_get, - .switchdev_port_attr_set = dsa_slave_port_attr_set, -}; - static struct device_type dsa_type = { .name = "dsa", }; @@ -1321,7 +1316,6 @@ int dsa_slave_create(struct dsa_port *port) eth_hw_addr_inherit(slave_dev, master); slave_dev->priv_flags |= IFF_NO_QUEUE; slave_dev->netdev_ops = &dsa_slave_netdev_ops; - slave_dev->switchdev_ops = &dsa_slave_switchdev_ops; slave_dev->min_mtu = 0; slave_dev->max_mtu = ETH_MAX_MTU; SET_NETDEV_DEVTYPE(slave_dev, &dsa_type); -- 2.17.1