* [PATCH 00/12] net: Introduce ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
Hi all,
Based on discussion with Ido and feedback from Jakub there are clearly
two classes of users that implement SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- PF/VF drivers which typically only implement return the port's parent
ID, yet have to implement switchdev_port_attr_get() just for that
- Ethernet switch drivers: mlxsw, ocelot, DSA, etc. which implement more
attributes which we want to be able to eventually veto in the context
of the caller, thus making them candidates for using a blocking notifier
chain
Changes from RFC:
- introduce a ndo_get_port_parent_id() and convert all relevant drivers
to use it
- get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
A subsequent set of patches will convert switchdev_port_attr_set() to
use a blocking notifier call, and still get rid of
switchdev_port_attr_get() altogether.
Florian Fainelli (12):
net: Introduce ndo_get_port_parent_id()
bnxt: Implement ndo_get_port_parent_id()
liquidio: Implement ndo_get_port_parent_id()
net/mlx5e: Implement ndo_get_port_parent_id()
mlxsw: Implement ndo_get_port_parent_id()
mscc: ocelot: Implement ndo_get_port_parent_id()
nfp: Implement ndo_get_port_parent_id()
rocker: Implement ndo_get_port_parent_id()
netdevsim: Implement ndo_get_port_parent_id()
staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
net: dsa: Implement ndo_get_port_parent_id()
net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 +++++----------
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +--
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 12 +++----
.../net/ethernet/cavium/liquidio/lio_main.c | 22 +++---------
.../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 ++++---------
.../net/ethernet/mellanox/mlx5/core/en_rep.c | 31 ++++++----------
.../net/ethernet/mellanox/mlxsw/spectrum.c | 13 +++++++
.../mellanox/mlxsw/spectrum_switchdev.c | 5 ---
.../net/ethernet/mellanox/mlxsw/switchx2.c | 36 +++++++------------
drivers/net/ethernet/mscc/ocelot.c | 33 +++++++----------
.../ethernet/netronome/nfp/nfp_net_common.c | 4 +--
.../net/ethernet/netronome/nfp/nfp_net_repr.c | 4 +--
drivers/net/ethernet/netronome/nfp/nfp_port.c | 23 ++++--------
drivers/net/ethernet/netronome/nfp/nfp_port.h | 4 ++-
drivers/net/ethernet/rocker/rocker_main.c | 17 ++++++---
drivers/net/netdevsim/netdev.c | 22 ++++--------
drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 17 ++++++---
include/linux/netdevice.h | 6 ++++
include/net/switchdev.h | 2 --
net/bridge/br_switchdev.c | 11 +++---
net/core/net-sysfs.c | 14 +++-----
net/core/rtnetlink.c | 16 ++++-----
net/dsa/slave.c | 18 ++++++----
net/ipv4/ipmr.c | 14 ++++----
net/switchdev/switchdev.c | 20 +++++------
26 files changed, 169 insertions(+), 233 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 00/12] net: Introduce ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
Hi all,
Based on discussion with Ido and feedback from Jakub there are clearly
two classes of users that implement SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- PF/VF drivers which typically only implement return the port's parent
ID, yet have to implement switchdev_port_attr_get() just for that
- Ethernet switch drivers: mlxsw, ocelot, DSA, etc. which implement more
attributes which we want to be able to eventually veto in the context
of the caller, thus making them candidates for using a blocking notifier
chain
Changes from RFC:
- introduce a ndo_get_port_parent_id() and convert all relevant drivers
to use it
- get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
A subsequent set of patches will convert switchdev_port_attr_set() to
use a blocking notifier call, and still get rid of
switchdev_port_attr_get() altogether.
Florian Fainelli (12):
net: Introduce ndo_get_port_parent_id()
bnxt: Implement ndo_get_port_parent_id()
liquidio: Implement ndo_get_port_parent_id()
net/mlx5e: Implement ndo_get_port_parent_id()
mlxsw: Implement ndo_get_port_parent_id()
mscc: ocelot: Implement ndo_get_port_parent_id()
nfp: Implement ndo_get_port_parent_id()
rocker: Implement ndo_get_port_parent_id()
netdevsim: Implement ndo_get_port_parent_id()
staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
net: dsa: Implement ndo_get_port_parent_id()
net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 +++++----------
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +--
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 12 +++----
.../net/ethernet/cavium/liquidio/lio_main.c | 22 +++---------
.../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 ++++---------
.../net/ethernet/mellanox/mlx5/core/en_rep.c | 31 ++++++----------
.../net/ethernet/mellanox/mlxsw/spectrum.c | 13 +++++++
.../mellanox/mlxsw/spectrum_switchdev.c | 5 ---
.../net/ethernet/mellanox/mlxsw/switchx2.c | 36 +++++++------------
drivers/net/ethernet/mscc/ocelot.c | 33 +++++++----------
.../ethernet/netronome/nfp/nfp_net_common.c | 4 +--
.../net/ethernet/netronome/nfp/nfp_net_repr.c | 4 +--
drivers/net/ethernet/netronome/nfp/nfp_port.c | 23 ++++--------
drivers/net/ethernet/netronome/nfp/nfp_port.h | 4 ++-
drivers/net/ethernet/rocker/rocker_main.c | 17 ++++++---
drivers/net/netdevsim/netdev.c | 22 ++++--------
drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 17 ++++++---
include/linux/netdevice.h | 6 ++++
include/net/switchdev.h | 2 --
net/bridge/br_switchdev.c | 11 +++---
net/core/net-sysfs.c | 14 +++-----
net/core/rtnetlink.c | 16 ++++-----
net/dsa/slave.c | 18 ++++++----
net/ipv4/ipmr.c | 14 ++++----
net/switchdev/switchdev.c | 20 +++++------
26 files changed, 169 insertions(+), 233 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 41+ messages in thread
* [PATCH 01/12] net: Introduce ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
In preparation for getting rid of switchdev_ops, create a dedicated NDO
operation for getting the port's parent identifier. There are
essentially two classes of drivers that need to implement getting the
port's parent ID which are VF/PF drivers with a built-in switch, and
pure switchdev drivers such as mlxsw, ocelot, dsa etc.
Convert the bridge, core and ipv4 multicast routing code to check for
such ndo_get_port_parent_id() and call it when valid before falling back
to switchdev_port_attr_get(). This will allow us to convert all relevant
drivers in one go instead of having to implement both
switchdev_port_attr_get() and ndo_get_port_parent_id() operations.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/linux/netdevice.h | 6 ++++++
net/bridge/br_switchdev.c | 6 +++++-
net/core/net-sysfs.c | 6 +++++-
net/core/rtnetlink.c | 6 +++++-
net/ipv4/ipmr.c | 8 +++++++-
5 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ba57d0ba425e..1bdfbbe1e768 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1188,6 +1188,10 @@ struct dev_ifalias {
* not implement this, it is assumed that the hw is not able to have
* multiple net devices on single physical port.
*
+ * int (*ndo_get_port_parent_id)(struct net_device *dev,
+ * struct netdev_phys_item_id *ppid);
+ * Called to get the parent ID of the physical port of this device.
+ *
* void (*ndo_udp_tunnel_add)(struct net_device *dev,
* struct udp_tunnel_info *ti);
* Called by UDP tunnel to notify a driver about the UDP port and socket
@@ -1412,6 +1416,8 @@ struct net_device_ops {
bool new_carrier);
int (*ndo_get_phys_port_id)(struct net_device *dev,
struct netdev_phys_item_id *ppid);
+ int (*ndo_get_port_parent_id)(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
int (*ndo_get_phys_port_name)(struct net_device *dev,
char *name, size_t len);
void (*ndo_udp_tunnel_add)(struct net_device *dev,
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 4d2b9eb7604a..501a4221220a 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -23,6 +23,7 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
int nbp_switchdev_mark_set(struct net_bridge_port *p)
{
+ const struct net_device_ops *ops = p->dev->netdev_ops;
struct switchdev_attr attr = {
.orig_dev = p->dev,
.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
@@ -31,7 +32,10 @@ int nbp_switchdev_mark_set(struct net_bridge_port *p)
ASSERT_RTNL();
- err = switchdev_port_attr_get(p->dev, &attr);
+ if (ops->ndo_get_port_parent_id)
+ err = ops->ndo_get_port_parent_id(p->dev, &attr.u.ppid);
+ else
+ err = switchdev_port_attr_get(p->dev, &attr);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index ff9fd2bb4ce4..cc05e8b72657 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -495,6 +495,7 @@ static ssize_t phys_switch_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct net_device *netdev = to_net_dev(dev);
+ const struct net_device_ops *ops = netdev->netdev_ops;
ssize_t ret = -EINVAL;
if (!rtnl_trylock())
@@ -507,7 +508,10 @@ static ssize_t phys_switch_id_show(struct device *dev,
.flags = SWITCHDEV_F_NO_RECURSE,
};
- ret = switchdev_port_attr_get(netdev, &attr);
+ if (ops->ndo_get_port_parent_id)
+ ret = ops->ndo_get_port_parent_id(netdev, &attr.u.ppid);
+ else
+ ret = switchdev_port_attr_get(netdev, &attr);
if (!ret)
ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
attr.u.ppid.id);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index f5a98082ac7a..ed8564eb97c8 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1146,6 +1146,7 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
{
+ const struct net_device_ops *ops = dev->netdev_ops;
int err;
struct switchdev_attr attr = {
.orig_dev = dev,
@@ -1153,7 +1154,10 @@ static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
.flags = SWITCHDEV_F_NO_RECURSE,
};
- err = switchdev_port_attr_get(dev, &attr);
+ if (ops->ndo_get_port_parent_id)
+ err = ops->ndo_get_port_parent_id(dev, &attr.u.ppid);
+ else
+ err = switchdev_port_attr_get(dev, &attr);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index fb99002c3d4e..9f67394b6691 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -837,6 +837,7 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
static int vif_add(struct net *net, struct mr_table *mrt,
struct vifctl *vifc, int mrtsock)
{
+ const struct net_device_ops *ops;
int vifi = vifc->vifc_vifi;
struct switchdev_attr attr = {
.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
@@ -920,7 +921,12 @@ static int vif_add(struct net *net, struct mr_table *mrt,
(VIFF_TUNNEL | VIFF_REGISTER));
attr.orig_dev = dev;
- if (!switchdev_port_attr_get(dev, &attr)) {
+ ops = dev->netdev_ops;
+ if (ops->ndo_get_port_parent_id &&
+ !ops->ndo_get_port_parent_id(dev, &attr.ppid)) {
+ memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
+ v->dev_parent_id.id_len = attr.u.ppid.id_len;
+ } else if (!switchdev_port_attr_get(dev, &attr)) {
memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
v->dev_parent_id.id_len = attr.u.ppid.id_len;
} else {
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 01/12] net: Introduce ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
In preparation for getting rid of switchdev_ops, create a dedicated NDO
operation for getting the port's parent identifier. There are
essentially two classes of drivers that need to implement getting the
port's parent ID which are VF/PF drivers with a built-in switch, and
pure switchdev drivers such as mlxsw, ocelot, dsa etc.
Convert the bridge, core and ipv4 multicast routing code to check for
such ndo_get_port_parent_id() and call it when valid before falling back
to switchdev_port_attr_get(). This will allow us to convert all relevant
drivers in one go instead of having to implement both
switchdev_port_attr_get() and ndo_get_port_parent_id() operations.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/linux/netdevice.h | 6 ++++++
net/bridge/br_switchdev.c | 6 +++++-
net/core/net-sysfs.c | 6 +++++-
net/core/rtnetlink.c | 6 +++++-
net/ipv4/ipmr.c | 8 +++++++-
5 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ba57d0ba425e..1bdfbbe1e768 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1188,6 +1188,10 @@ struct dev_ifalias {
* not implement this, it is assumed that the hw is not able to have
* multiple net devices on single physical port.
*
+ * int (*ndo_get_port_parent_id)(struct net_device *dev,
+ * struct netdev_phys_item_id *ppid);
+ * Called to get the parent ID of the physical port of this device.
+ *
* void (*ndo_udp_tunnel_add)(struct net_device *dev,
* struct udp_tunnel_info *ti);
* Called by UDP tunnel to notify a driver about the UDP port and socket
@@ -1412,6 +1416,8 @@ struct net_device_ops {
bool new_carrier);
int (*ndo_get_phys_port_id)(struct net_device *dev,
struct netdev_phys_item_id *ppid);
+ int (*ndo_get_port_parent_id)(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
int (*ndo_get_phys_port_name)(struct net_device *dev,
char *name, size_t len);
void (*ndo_udp_tunnel_add)(struct net_device *dev,
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 4d2b9eb7604a..501a4221220a 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -23,6 +23,7 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
int nbp_switchdev_mark_set(struct net_bridge_port *p)
{
+ const struct net_device_ops *ops = p->dev->netdev_ops;
struct switchdev_attr attr = {
.orig_dev = p->dev,
.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
@@ -31,7 +32,10 @@ int nbp_switchdev_mark_set(struct net_bridge_port *p)
ASSERT_RTNL();
- err = switchdev_port_attr_get(p->dev, &attr);
+ if (ops->ndo_get_port_parent_id)
+ err = ops->ndo_get_port_parent_id(p->dev, &attr.u.ppid);
+ else
+ err = switchdev_port_attr_get(p->dev, &attr);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index ff9fd2bb4ce4..cc05e8b72657 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -495,6 +495,7 @@ static ssize_t phys_switch_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct net_device *netdev = to_net_dev(dev);
+ const struct net_device_ops *ops = netdev->netdev_ops;
ssize_t ret = -EINVAL;
if (!rtnl_trylock())
@@ -507,7 +508,10 @@ static ssize_t phys_switch_id_show(struct device *dev,
.flags = SWITCHDEV_F_NO_RECURSE,
};
- ret = switchdev_port_attr_get(netdev, &attr);
+ if (ops->ndo_get_port_parent_id)
+ ret = ops->ndo_get_port_parent_id(netdev, &attr.u.ppid);
+ else
+ ret = switchdev_port_attr_get(netdev, &attr);
if (!ret)
ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
attr.u.ppid.id);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index f5a98082ac7a..ed8564eb97c8 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1146,6 +1146,7 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
{
+ const struct net_device_ops *ops = dev->netdev_ops;
int err;
struct switchdev_attr attr = {
.orig_dev = dev,
@@ -1153,7 +1154,10 @@ static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
.flags = SWITCHDEV_F_NO_RECURSE,
};
- err = switchdev_port_attr_get(dev, &attr);
+ if (ops->ndo_get_port_parent_id)
+ err = ops->ndo_get_port_parent_id(dev, &attr.u.ppid);
+ else
+ err = switchdev_port_attr_get(dev, &attr);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index fb99002c3d4e..9f67394b6691 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -837,6 +837,7 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
static int vif_add(struct net *net, struct mr_table *mrt,
struct vifctl *vifc, int mrtsock)
{
+ const struct net_device_ops *ops;
int vifi = vifc->vifc_vifi;
struct switchdev_attr attr = {
.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
@@ -920,7 +921,12 @@ static int vif_add(struct net *net, struct mr_table *mrt,
(VIFF_TUNNEL | VIFF_REGISTER));
attr.orig_dev = dev;
- if (!switchdev_port_attr_get(dev, &attr)) {
+ ops = dev->netdev_ops;
+ if (ops->ndo_get_port_parent_id &&
+ !ops->ndo_get_port_parent_id(dev, &attr.ppid)) {
+ memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
+ v->dev_parent_id.id_len = attr.u.ppid.id_len;
+ } else if (!switchdev_port_attr_get(dev, &attr)) {
memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
v->dev_parent_id.id_len = attr.u.ppid.id_len;
} else {
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 02/12] bnxt: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
BNXT only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get(). The conversion is
straight forward here since the PF and VF code use the same getter.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 ++++++-------------
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +--
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 12 +++-----
4 files changed, 15 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6a512871176b..1c2987c3d708 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -9981,8 +9981,11 @@ static int bnxt_get_phys_port_name(struct net_device *dev, char *buf,
return 0;
}
-int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr)
+int bnxt_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
+ struct bnxt *bp = netdev_priv(dev);
+
if (bp->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
return -EOPNOTSUPP;
@@ -9990,27 +9993,12 @@ int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr)
if (!BNXT_PF(bp))
return -EOPNOTSUPP;
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(bp->switch_id);
- memcpy(attr->u.ppid.id, bp->switch_id, attr->u.ppid.id_len);
- break;
- default:
- return -EOPNOTSUPP;
- }
- return 0;
-}
+ ppid->id_len = sizeof(bp->switch_id);
+ memcpy(ppid->id, bp->switch_id, ppid->id_len);
-static int bnxt_swdev_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
- return bnxt_port_attr_get(netdev_priv(dev), attr);
+ return 0;
}
-static const struct switchdev_ops bnxt_switchdev_ops = {
- .switchdev_port_attr_get = bnxt_swdev_port_attr_get
-};
-
static const struct net_device_ops bnxt_netdev_ops = {
.ndo_open = bnxt_open,
.ndo_start_xmit = bnxt_start_xmit,
@@ -10042,6 +10030,7 @@ static const struct net_device_ops bnxt_netdev_ops = {
.ndo_bpf = bnxt_xdp,
.ndo_bridge_getlink = bnxt_bridge_getlink,
.ndo_bridge_setlink = bnxt_bridge_setlink,
+ .ndo_get_port_parent_id = bnxt_get_port_parent_id,
.ndo_get_phys_port_name = bnxt_get_phys_port_name
};
@@ -10400,7 +10389,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->netdev_ops = &bnxt_netdev_ops;
dev->watchdog_timeo = BNXT_TX_TIMEOUT;
dev->ethtool_ops = &bnxt_ethtool_ops;
- SWITCHDEV_SET_OPS(dev, &bnxt_switchdev_ops);
pci_set_drvdata(pdev, dev);
rc = bnxt_alloc_hwrm_resources(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 5c886a700bcc..17554d4be651 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -22,7 +22,6 @@
#include <linux/rhashtable.h>
#include <net/devlink.h>
#include <net/dst_metadata.h>
-#include <net/switchdev.h>
#include <net/xdp.h>
#include <linux/net_dim.h>
@@ -1795,7 +1794,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
int bnxt_restore_pf_fw_resources(struct bnxt *bp);
-int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr);
+int bnxt_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
void bnxt_dim_work(struct work_struct *work);
int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
index c683b5e96b1d..a3a772fb6d67 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
@@ -12,6 +12,7 @@
#include <linux/if_vlan.h>
#include <net/flow_dissector.h>
#include <net/pkt_cls.h>
+#include <net/switchdev.h>
#include <net/tc_act/tc_gact.h>
#include <net/tc_act/tc_skbedit.h>
#include <net/tc_act/tc_mirred.h>
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
index 9a25c05aa571..29d03c0f4693 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
@@ -237,21 +237,17 @@ static void bnxt_vf_rep_get_drvinfo(struct net_device *dev,
strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
}
-static int bnxt_vf_rep_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
+static int bnxt_vf_rep_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
/* as only PORT_PARENT_ID is supported currently use common code
* between PF and VF-rep for now.
*/
- return bnxt_port_attr_get(vf_rep->bp, attr);
+ return bnxt_get_port_parent_id(vf_rep->bp->dev, attr);
}
-static const struct switchdev_ops bnxt_vf_rep_switchdev_ops = {
- .switchdev_port_attr_get = bnxt_vf_rep_port_attr_get
-};
-
static const struct ethtool_ops bnxt_vf_rep_ethtool_ops = {
.get_drvinfo = bnxt_vf_rep_get_drvinfo
};
@@ -262,6 +258,7 @@ static const struct net_device_ops bnxt_vf_rep_netdev_ops = {
.ndo_start_xmit = bnxt_vf_rep_xmit,
.ndo_get_stats64 = bnxt_vf_rep_get_stats64,
.ndo_setup_tc = bnxt_vf_rep_setup_tc,
+ .ndo_get_port_parent_id = bnxt_vf_rep_get_port_parent_id,
.ndo_get_phys_port_name = bnxt_vf_rep_get_phys_port_name
};
@@ -392,7 +389,6 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
dev->netdev_ops = &bnxt_vf_rep_netdev_ops;
dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops;
- SWITCHDEV_SET_OPS(dev, &bnxt_vf_rep_switchdev_ops);
/* Just inherit all the featues of the parent PF as the VF-R
* uses the RX/TX rings of the parent PF
*/
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 02/12] bnxt: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
BNXT only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get(). The conversion is
straight forward here since the PF and VF code use the same getter.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 28 ++++++-------------
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +--
drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 12 +++-----
4 files changed, 15 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6a512871176b..1c2987c3d708 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -9981,8 +9981,11 @@ static int bnxt_get_phys_port_name(struct net_device *dev, char *buf,
return 0;
}
-int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr)
+int bnxt_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
+ struct bnxt *bp = netdev_priv(dev);
+
if (bp->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
return -EOPNOTSUPP;
@@ -9990,27 +9993,12 @@ int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr)
if (!BNXT_PF(bp))
return -EOPNOTSUPP;
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(bp->switch_id);
- memcpy(attr->u.ppid.id, bp->switch_id, attr->u.ppid.id_len);
- break;
- default:
- return -EOPNOTSUPP;
- }
- return 0;
-}
+ ppid->id_len = sizeof(bp->switch_id);
+ memcpy(ppid->id, bp->switch_id, ppid->id_len);
-static int bnxt_swdev_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
- return bnxt_port_attr_get(netdev_priv(dev), attr);
+ return 0;
}
-static const struct switchdev_ops bnxt_switchdev_ops = {
- .switchdev_port_attr_get = bnxt_swdev_port_attr_get
-};
-
static const struct net_device_ops bnxt_netdev_ops = {
.ndo_open = bnxt_open,
.ndo_start_xmit = bnxt_start_xmit,
@@ -10042,6 +10030,7 @@ static const struct net_device_ops bnxt_netdev_ops = {
.ndo_bpf = bnxt_xdp,
.ndo_bridge_getlink = bnxt_bridge_getlink,
.ndo_bridge_setlink = bnxt_bridge_setlink,
+ .ndo_get_port_parent_id = bnxt_get_port_parent_id,
.ndo_get_phys_port_name = bnxt_get_phys_port_name
};
@@ -10400,7 +10389,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->netdev_ops = &bnxt_netdev_ops;
dev->watchdog_timeo = BNXT_TX_TIMEOUT;
dev->ethtool_ops = &bnxt_ethtool_ops;
- SWITCHDEV_SET_OPS(dev, &bnxt_switchdev_ops);
pci_set_drvdata(pdev, dev);
rc = bnxt_alloc_hwrm_resources(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 5c886a700bcc..17554d4be651 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -22,7 +22,6 @@
#include <linux/rhashtable.h>
#include <net/devlink.h>
#include <net/dst_metadata.h>
-#include <net/switchdev.h>
#include <net/xdp.h>
#include <linux/net_dim.h>
@@ -1795,7 +1794,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
int bnxt_restore_pf_fw_resources(struct bnxt *bp);
-int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr);
+int bnxt_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
void bnxt_dim_work(struct work_struct *work);
int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
index c683b5e96b1d..a3a772fb6d67 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
@@ -12,6 +12,7 @@
#include <linux/if_vlan.h>
#include <net/flow_dissector.h>
#include <net/pkt_cls.h>
+#include <net/switchdev.h>
#include <net/tc_act/tc_gact.h>
#include <net/tc_act/tc_skbedit.h>
#include <net/tc_act/tc_mirred.h>
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
index 9a25c05aa571..29d03c0f4693 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
@@ -237,21 +237,17 @@ static void bnxt_vf_rep_get_drvinfo(struct net_device *dev,
strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
}
-static int bnxt_vf_rep_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
+static int bnxt_vf_rep_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
/* as only PORT_PARENT_ID is supported currently use common code
* between PF and VF-rep for now.
*/
- return bnxt_port_attr_get(vf_rep->bp, attr);
+ return bnxt_get_port_parent_id(vf_rep->bp->dev, attr);
}
-static const struct switchdev_ops bnxt_vf_rep_switchdev_ops = {
- .switchdev_port_attr_get = bnxt_vf_rep_port_attr_get
-};
-
static const struct ethtool_ops bnxt_vf_rep_ethtool_ops = {
.get_drvinfo = bnxt_vf_rep_get_drvinfo
};
@@ -262,6 +258,7 @@ static const struct net_device_ops bnxt_vf_rep_netdev_ops = {
.ndo_start_xmit = bnxt_vf_rep_xmit,
.ndo_get_stats64 = bnxt_vf_rep_get_stats64,
.ndo_setup_tc = bnxt_vf_rep_setup_tc,
+ .ndo_get_port_parent_id = bnxt_vf_rep_get_port_parent_id,
.ndo_get_phys_port_name = bnxt_vf_rep_get_phys_port_name
};
@@ -392,7 +389,6 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
dev->netdev_ops = &bnxt_vf_rep_netdev_ops;
dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops;
- SWITCHDEV_SET_OPS(dev, &bnxt_vf_rep_switchdev_ops);
/* Just inherit all the featues of the parent PF as the VF-R
* uses the RX/TX rings of the parent PF
*/
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 03/12] liquidio: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
Liquidio only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it
a great candidate to be converted to use the ndo_get_port_parent_id()
NDO instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../net/ethernet/cavium/liquidio/lio_main.c | 22 ++++------------
.../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 ++++++-------------
2 files changed, 12 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 3d24133e5e49..e97e6754ee09 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -21,7 +21,6 @@
#include <linux/firmware.h>
#include <net/vxlan.h>
#include <linux/kthread.h>
-#include <net/switchdev.h>
#include "liquidio_common.h"
#include "octeon_droq.h"
#include "octeon_iq.h"
@@ -3184,7 +3183,8 @@ static const struct devlink_ops liquidio_devlink_ops = {
};
static int
-lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+liquidio_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct lio *lio = GET_LIO(dev);
struct octeon_device *oct = lio->oct_dev;
@@ -3192,24 +3192,12 @@ lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
return -EOPNOTSUPP;
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = ETH_ALEN;
- ether_addr_copy(attr->u.ppid.id,
- (void *)&lio->linfo.hw_addr + 2);
- break;
-
- default:
- return -EOPNOTSUPP;
- }
+ ppid->id_len = ETH_ALEN;
+ ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2);
return 0;
}
-static const struct switchdev_ops lio_pf_switchdev_ops = {
- .switchdev_port_attr_get = lio_pf_switchdev_attr_get,
-};
-
static int liquidio_get_vf_stats(struct net_device *netdev, int vfidx,
struct ifla_vf_stats *vf_stats)
{
@@ -3259,6 +3247,7 @@ static const struct net_device_ops lionetdevops = {
.ndo_set_vf_trust = liquidio_set_vf_trust,
.ndo_set_vf_link_state = liquidio_set_vf_link_state,
.ndo_get_vf_stats = liquidio_get_vf_stats,
+ .ndo_get_port_parent_id = liquidio_get_port_parent_id,
};
/** \brief Entry point for the liquidio module
@@ -3534,7 +3523,6 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
* netdev tasks.
*/
netdev->netdev_ops = &lionetdevops;
- SWITCHDEV_SET_OPS(netdev, &lio_pf_switchdev_ops);
retval = netif_set_real_num_rx_queues(netdev, num_oqueues);
if (retval) {
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
index de61060721c4..f3f2e71431ac 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
@@ -25,7 +25,6 @@
#include "octeon_nic.h"
#include "octeon_main.h"
#include "octeon_network.h"
-#include <net/switchdev.h>
#include "lio_vf_rep.h"
static int lio_vf_rep_open(struct net_device *ndev);
@@ -38,6 +37,8 @@ static int lio_vf_rep_phys_port_name(struct net_device *dev,
static void lio_vf_rep_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats64);
static int lio_vf_rep_change_mtu(struct net_device *ndev, int new_mtu);
+static int lio_vf_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
static const struct net_device_ops lio_vf_rep_ndev_ops = {
.ndo_open = lio_vf_rep_open,
@@ -47,6 +48,7 @@ static const struct net_device_ops lio_vf_rep_ndev_ops = {
.ndo_get_phys_port_name = lio_vf_rep_phys_port_name,
.ndo_get_stats64 = lio_vf_rep_get_stats64,
.ndo_change_mtu = lio_vf_rep_change_mtu,
+ .ndo_get_port_parent_id = lio_vf_get_port_parent_id,
};
static int
@@ -443,31 +445,19 @@ lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev)
return NETDEV_TX_OK;
}
-static int
-lio_vf_rep_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int lio_vf_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct lio_vf_rep_desc *vf_rep = netdev_priv(dev);
struct net_device *parent_ndev = vf_rep->parent_ndev;
struct lio *lio = GET_LIO(parent_ndev);
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = ETH_ALEN;
- ether_addr_copy(attr->u.ppid.id,
- (void *)&lio->linfo.hw_addr + 2);
- break;
-
- default:
- return -EOPNOTSUPP;
- }
+ ppid->id_len = ETH_ALEN;
+ ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2);
return 0;
}
-static const struct switchdev_ops lio_vf_rep_switchdev_ops = {
- .switchdev_port_attr_get = lio_vf_rep_attr_get,
-};
-
static void
lio_vf_rep_fetch_stats(struct work_struct *work)
{
@@ -524,7 +514,6 @@ lio_vf_rep_create(struct octeon_device *oct)
ndev->min_mtu = LIO_MIN_MTU_SIZE;
ndev->max_mtu = LIO_MAX_MTU_SIZE;
ndev->netdev_ops = &lio_vf_rep_ndev_ops;
- SWITCHDEV_SET_OPS(ndev, &lio_vf_rep_switchdev_ops);
vf_rep = netdev_priv(ndev);
memset(vf_rep, 0, sizeof(*vf_rep));
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 03/12] liquidio: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
Liquidio only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it
a great candidate to be converted to use the ndo_get_port_parent_id()
NDO instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../net/ethernet/cavium/liquidio/lio_main.c | 22 ++++------------
.../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 ++++++-------------
2 files changed, 12 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 3d24133e5e49..e97e6754ee09 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -21,7 +21,6 @@
#include <linux/firmware.h>
#include <net/vxlan.h>
#include <linux/kthread.h>
-#include <net/switchdev.h>
#include "liquidio_common.h"
#include "octeon_droq.h"
#include "octeon_iq.h"
@@ -3184,7 +3183,8 @@ static const struct devlink_ops liquidio_devlink_ops = {
};
static int
-lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+liquidio_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct lio *lio = GET_LIO(dev);
struct octeon_device *oct = lio->oct_dev;
@@ -3192,24 +3192,12 @@ lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
return -EOPNOTSUPP;
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = ETH_ALEN;
- ether_addr_copy(attr->u.ppid.id,
- (void *)&lio->linfo.hw_addr + 2);
- break;
-
- default:
- return -EOPNOTSUPP;
- }
+ ppid->id_len = ETH_ALEN;
+ ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2);
return 0;
}
-static const struct switchdev_ops lio_pf_switchdev_ops = {
- .switchdev_port_attr_get = lio_pf_switchdev_attr_get,
-};
-
static int liquidio_get_vf_stats(struct net_device *netdev, int vfidx,
struct ifla_vf_stats *vf_stats)
{
@@ -3259,6 +3247,7 @@ static const struct net_device_ops lionetdevops = {
.ndo_set_vf_trust = liquidio_set_vf_trust,
.ndo_set_vf_link_state = liquidio_set_vf_link_state,
.ndo_get_vf_stats = liquidio_get_vf_stats,
+ .ndo_get_port_parent_id = liquidio_get_port_parent_id,
};
/** \brief Entry point for the liquidio module
@@ -3534,7 +3523,6 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
* netdev tasks.
*/
netdev->netdev_ops = &lionetdevops;
- SWITCHDEV_SET_OPS(netdev, &lio_pf_switchdev_ops);
retval = netif_set_real_num_rx_queues(netdev, num_oqueues);
if (retval) {
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
index de61060721c4..f3f2e71431ac 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
@@ -25,7 +25,6 @@
#include "octeon_nic.h"
#include "octeon_main.h"
#include "octeon_network.h"
-#include <net/switchdev.h>
#include "lio_vf_rep.h"
static int lio_vf_rep_open(struct net_device *ndev);
@@ -38,6 +37,8 @@ static int lio_vf_rep_phys_port_name(struct net_device *dev,
static void lio_vf_rep_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats64);
static int lio_vf_rep_change_mtu(struct net_device *ndev, int new_mtu);
+static int lio_vf_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid);
static const struct net_device_ops lio_vf_rep_ndev_ops = {
.ndo_open = lio_vf_rep_open,
@@ -47,6 +48,7 @@ static const struct net_device_ops lio_vf_rep_ndev_ops = {
.ndo_get_phys_port_name = lio_vf_rep_phys_port_name,
.ndo_get_stats64 = lio_vf_rep_get_stats64,
.ndo_change_mtu = lio_vf_rep_change_mtu,
+ .ndo_get_port_parent_id = lio_vf_get_port_parent_id,
};
static int
@@ -443,31 +445,19 @@ lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev)
return NETDEV_TX_OK;
}
-static int
-lio_vf_rep_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int lio_vf_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct lio_vf_rep_desc *vf_rep = netdev_priv(dev);
struct net_device *parent_ndev = vf_rep->parent_ndev;
struct lio *lio = GET_LIO(parent_ndev);
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = ETH_ALEN;
- ether_addr_copy(attr->u.ppid.id,
- (void *)&lio->linfo.hw_addr + 2);
- break;
-
- default:
- return -EOPNOTSUPP;
- }
+ ppid->id_len = ETH_ALEN;
+ ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2);
return 0;
}
-static const struct switchdev_ops lio_vf_rep_switchdev_ops = {
- .switchdev_port_attr_get = lio_vf_rep_attr_get,
-};
-
static void
lio_vf_rep_fetch_stats(struct work_struct *work)
{
@@ -524,7 +514,6 @@ lio_vf_rep_create(struct octeon_device *oct)
ndev->min_mtu = LIO_MIN_MTU_SIZE;
ndev->max_mtu = LIO_MAX_MTU_SIZE;
ndev->netdev_ops = &lio_vf_rep_ndev_ops;
- SWITCHDEV_SET_OPS(ndev, &lio_vf_rep_switchdev_ops);
vf_rep = netdev_priv(ndev);
memset(vf_rep, 0, sizeof(*vf_rep));
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 04/12] net/mlx5e: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
mlx5e only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../net/ethernet/mellanox/mlx5/core/en_rep.c | 31 +++++++------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 5d2e0c2f6624..0b1988b330f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -381,7 +381,8 @@ static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = {
.set_pauseparam = mlx5e_uplink_rep_set_pauseparam,
};
-static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int mlx5e_rep_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
@@ -398,20 +399,14 @@ static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
uplink_priv = netdev_priv(uplink_dev);
}
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = ETH_ALEN;
- if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
- ether_addr_copy(attr->u.ppid.id, uplink_upper->dev_addr);
- } else {
- struct mlx5e_rep_priv *rpriv = priv->ppriv;
- struct mlx5_eswitch_rep *rep = rpriv->rep;
+ ppid->id_len = ETH_ALEN;
+ if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
+ ether_addr_copy(ppid->id, uplink_upper->dev_addr);
+ } else {
+ struct mlx5e_rep_priv *rpriv = priv->ppriv;
+ struct mlx5_eswitch_rep *rep = rpriv->rep;
- ether_addr_copy(attr->u.ppid.id, rep->hw_id);
- }
- break;
- default:
- return -EOPNOTSUPP;
+ ether_addr_copy(ppid->id, rep->hw_id);
}
return 0;
@@ -1284,10 +1279,6 @@ static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan
return 0;
}
-static const struct switchdev_ops mlx5e_rep_switchdev_ops = {
- .switchdev_port_attr_get = mlx5e_attr_get,
-};
-
static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
.ndo_open = mlx5e_vf_rep_open,
.ndo_stop = mlx5e_vf_rep_close,
@@ -1298,6 +1289,7 @@ static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
.ndo_has_offload_stats = mlx5e_rep_has_offload_stats,
.ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
.ndo_change_mtu = mlx5e_vf_rep_change_mtu,
+ .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id,
};
static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
@@ -1319,6 +1311,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
.ndo_get_vf_config = mlx5e_get_vf_config,
.ndo_get_vf_stats = mlx5e_get_vf_stats,
.ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan,
+ .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id,
};
bool mlx5e_eswitch_rep(struct net_device *netdev)
@@ -1393,8 +1386,6 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
netdev->watchdog_timeo = 15 * HZ;
- netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
-
netdev->features |= NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
netdev->hw_features |= NETIF_F_HW_TC;
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 04/12] net/mlx5e: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
mlx5e only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../net/ethernet/mellanox/mlx5/core/en_rep.c | 31 +++++++------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 5d2e0c2f6624..0b1988b330f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -381,7 +381,8 @@ static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = {
.set_pauseparam = mlx5e_uplink_rep_set_pauseparam,
};
-static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int mlx5e_rep_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
@@ -398,20 +399,14 @@ static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
uplink_priv = netdev_priv(uplink_dev);
}
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = ETH_ALEN;
- if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
- ether_addr_copy(attr->u.ppid.id, uplink_upper->dev_addr);
- } else {
- struct mlx5e_rep_priv *rpriv = priv->ppriv;
- struct mlx5_eswitch_rep *rep = rpriv->rep;
+ ppid->id_len = ETH_ALEN;
+ if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
+ ether_addr_copy(ppid->id, uplink_upper->dev_addr);
+ } else {
+ struct mlx5e_rep_priv *rpriv = priv->ppriv;
+ struct mlx5_eswitch_rep *rep = rpriv->rep;
- ether_addr_copy(attr->u.ppid.id, rep->hw_id);
- }
- break;
- default:
- return -EOPNOTSUPP;
+ ether_addr_copy(ppid->id, rep->hw_id);
}
return 0;
@@ -1284,10 +1279,6 @@ static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan
return 0;
}
-static const struct switchdev_ops mlx5e_rep_switchdev_ops = {
- .switchdev_port_attr_get = mlx5e_attr_get,
-};
-
static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
.ndo_open = mlx5e_vf_rep_open,
.ndo_stop = mlx5e_vf_rep_close,
@@ -1298,6 +1289,7 @@ static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
.ndo_has_offload_stats = mlx5e_rep_has_offload_stats,
.ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
.ndo_change_mtu = mlx5e_vf_rep_change_mtu,
+ .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id,
};
static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
@@ -1319,6 +1311,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
.ndo_get_vf_config = mlx5e_get_vf_config,
.ndo_get_vf_stats = mlx5e_get_vf_stats,
.ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan,
+ .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id,
};
bool mlx5e_eswitch_rep(struct net_device *netdev)
@@ -1393,8 +1386,6 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
netdev->watchdog_timeo = 15 * HZ;
- netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
-
netdev->features |= NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
netdev->hw_features |= NETIF_F_HW_TC;
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 05/12] mlxsw: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../net/ethernet/mellanox/mlxsw/spectrum.c | 13 +++++++
.../mellanox/mlxsw/spectrum_switchdev.c | 5 ---
.../net/ethernet/mellanox/mlxsw/switchx2.c | 36 +++++++------------
3 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index a88169738b4a..8dd808b7f931 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1700,6 +1700,18 @@ static int mlxsw_sp_set_features(struct net_device *dev,
mlxsw_sp_feature_hw_tc);
}
+static int mlxsw_sp_port_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
+ struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
+
+ ppid->id_len = sizeof(mlxsw_sp->base_mac);
+ memcpy(&ppid->id, &mlxsw_sp->base_mac, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
.ndo_open = mlxsw_sp_port_open,
.ndo_stop = mlxsw_sp_port_stop,
@@ -1715,6 +1727,7 @@ static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
.ndo_vlan_rx_kill_vid = mlxsw_sp_port_kill_vid,
.ndo_get_phys_port_name = mlxsw_sp_port_get_phys_port_name,
.ndo_set_features = mlxsw_sp_set_features,
+ .ndo_get_port_parent_id = mlxsw_sp_port_get_port_parent_id,
};
static void mlxsw_sp_port_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index a4a9fe992193..95e37de3e48f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -451,11 +451,6 @@ static int mlxsw_sp_port_attr_get(struct net_device *dev,
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(mlxsw_sp->base_mac);
- memcpy(&attr->u.ppid.id, &mlxsw_sp->base_mac,
- attr->u.ppid.id_len);
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
mlxsw_sp_port_bridge_flags_get(mlxsw_sp->bridge, attr->orig_dev,
&attr->u.brport_flags);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index 2d4f213e154d..3814ba8af517 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -390,6 +390,18 @@ static int mlxsw_sx_port_get_phys_port_name(struct net_device *dev, char *name,
name, len);
}
+static int mlxsw_sx_port_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
+ struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
+
+ ppid->id_len = sizeof(mlxsw_sx->hw_id);
+ memcpy(&ppid->id, &mlxsw_sx->hw_id, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops mlxsw_sx_port_netdev_ops = {
.ndo_open = mlxsw_sx_port_open,
.ndo_stop = mlxsw_sx_port_stop,
@@ -397,6 +409,7 @@ static const struct net_device_ops mlxsw_sx_port_netdev_ops = {
.ndo_change_mtu = mlxsw_sx_port_change_mtu,
.ndo_get_stats64 = mlxsw_sx_port_get_stats64,
.ndo_get_phys_port_name = mlxsw_sx_port_get_phys_port_name,
+ .ndo_get_port_parent_id = mlxsw_sx_port_get_port_parent_id,
};
static void mlxsw_sx_port_get_drvinfo(struct net_device *dev,
@@ -901,28 +914,6 @@ static const struct ethtool_ops mlxsw_sx_port_ethtool_ops = {
.set_link_ksettings = mlxsw_sx_port_set_link_ksettings,
};
-static int mlxsw_sx_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
- struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
- struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
-
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(mlxsw_sx->hw_id);
- memcpy(&attr->u.ppid.id, &mlxsw_sx->hw_id, attr->u.ppid.id_len);
- break;
- default:
- return -EOPNOTSUPP;
- }
-
- return 0;
-}
-
-static const struct switchdev_ops mlxsw_sx_port_switchdev_ops = {
- .switchdev_port_attr_get = mlxsw_sx_port_attr_get,
-};
-
static int mlxsw_sx_hw_id_get(struct mlxsw_sx *mlxsw_sx)
{
char spad_pl[MLXSW_REG_SPAD_LEN] = {0};
@@ -1034,7 +1025,6 @@ static int __mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port,
dev->netdev_ops = &mlxsw_sx_port_netdev_ops;
dev->ethtool_ops = &mlxsw_sx_port_ethtool_ops;
- dev->switchdev_ops = &mlxsw_sx_port_switchdev_ops;
err = mlxsw_sx_port_dev_addr_get(mlxsw_sx_port);
if (err) {
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 05/12] mlxsw: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../net/ethernet/mellanox/mlxsw/spectrum.c | 13 +++++++
.../mellanox/mlxsw/spectrum_switchdev.c | 5 ---
.../net/ethernet/mellanox/mlxsw/switchx2.c | 36 +++++++------------
3 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index a88169738b4a..8dd808b7f931 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1700,6 +1700,18 @@ static int mlxsw_sp_set_features(struct net_device *dev,
mlxsw_sp_feature_hw_tc);
}
+static int mlxsw_sp_port_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
+ struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
+
+ ppid->id_len = sizeof(mlxsw_sp->base_mac);
+ memcpy(&ppid->id, &mlxsw_sp->base_mac, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
.ndo_open = mlxsw_sp_port_open,
.ndo_stop = mlxsw_sp_port_stop,
@@ -1715,6 +1727,7 @@ static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
.ndo_vlan_rx_kill_vid = mlxsw_sp_port_kill_vid,
.ndo_get_phys_port_name = mlxsw_sp_port_get_phys_port_name,
.ndo_set_features = mlxsw_sp_set_features,
+ .ndo_get_port_parent_id = mlxsw_sp_port_get_port_parent_id,
};
static void mlxsw_sp_port_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index a4a9fe992193..95e37de3e48f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -451,11 +451,6 @@ static int mlxsw_sp_port_attr_get(struct net_device *dev,
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(mlxsw_sp->base_mac);
- memcpy(&attr->u.ppid.id, &mlxsw_sp->base_mac,
- attr->u.ppid.id_len);
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
mlxsw_sp_port_bridge_flags_get(mlxsw_sp->bridge, attr->orig_dev,
&attr->u.brport_flags);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index 2d4f213e154d..3814ba8af517 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -390,6 +390,18 @@ static int mlxsw_sx_port_get_phys_port_name(struct net_device *dev, char *name,
name, len);
}
+static int mlxsw_sx_port_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
+ struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
+
+ ppid->id_len = sizeof(mlxsw_sx->hw_id);
+ memcpy(&ppid->id, &mlxsw_sx->hw_id, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops mlxsw_sx_port_netdev_ops = {
.ndo_open = mlxsw_sx_port_open,
.ndo_stop = mlxsw_sx_port_stop,
@@ -397,6 +409,7 @@ static const struct net_device_ops mlxsw_sx_port_netdev_ops = {
.ndo_change_mtu = mlxsw_sx_port_change_mtu,
.ndo_get_stats64 = mlxsw_sx_port_get_stats64,
.ndo_get_phys_port_name = mlxsw_sx_port_get_phys_port_name,
+ .ndo_get_port_parent_id = mlxsw_sx_port_get_port_parent_id,
};
static void mlxsw_sx_port_get_drvinfo(struct net_device *dev,
@@ -901,28 +914,6 @@ static const struct ethtool_ops mlxsw_sx_port_ethtool_ops = {
.set_link_ksettings = mlxsw_sx_port_set_link_ksettings,
};
-static int mlxsw_sx_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
- struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
- struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
-
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(mlxsw_sx->hw_id);
- memcpy(&attr->u.ppid.id, &mlxsw_sx->hw_id, attr->u.ppid.id_len);
- break;
- default:
- return -EOPNOTSUPP;
- }
-
- return 0;
-}
-
-static const struct switchdev_ops mlxsw_sx_port_switchdev_ops = {
- .switchdev_port_attr_get = mlxsw_sx_port_attr_get,
-};
-
static int mlxsw_sx_hw_id_get(struct mlxsw_sx *mlxsw_sx)
{
char spad_pl[MLXSW_REG_SPAD_LEN] = {0};
@@ -1034,7 +1025,6 @@ static int __mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port,
dev->netdev_ops = &mlxsw_sx_port_netdev_ops;
dev->ethtool_ops = &mlxsw_sx_port_ethtool_ops;
- dev->switchdev_ops = &mlxsw_sx_port_switchdev_ops;
err = mlxsw_sx_port_dev_addr_get(mlxsw_sx_port);
if (err) {
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 06/12] mscc: ocelot: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
Ocelot only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID as a valid
switchdev attribute getter, convert it to use ndo_get_port_parent_id()
and get rid of the switchdev_ops::switchdev_port_attr_get altogether.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/mscc/ocelot.c | 33 ++++++++++++------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index c6a575eb0ff5..195306d05bcd 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev,
return 0;
}
+static int ocelot_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct ocelot_port *ocelot_port = netdev_priv(dev);
+ struct ocelot *ocelot = ocelot_port->ocelot;
+
+ ppid->id_len = sizeof(ocelot->base_mac);
+ memcpy(&ppid->id, &ocelot->base_mac, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops ocelot_port_netdev_ops = {
.ndo_open = ocelot_port_open,
.ndo_stop = ocelot_port_stop,
@@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = {
.ndo_vlan_rx_add_vid = ocelot_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = ocelot_vlan_rx_kill_vid,
.ndo_set_features = ocelot_set_features,
+ .ndo_get_port_parent_id = ocelot_get_port_parent_id,
};
static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data)
@@ -1013,25 +1026,6 @@ static const struct ethtool_ops ocelot_ethtool_ops = {
.set_link_ksettings = phy_ethtool_set_link_ksettings,
};
-static int ocelot_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
- struct ocelot_port *ocelot_port = netdev_priv(dev);
- struct ocelot *ocelot = ocelot_port->ocelot;
-
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(ocelot->base_mac);
- memcpy(&attr->u.ppid.id, &ocelot->base_mac,
- attr->u.ppid.id_len);
- break;
- default:
- return -EOPNOTSUPP;
- }
-
- return 0;
-}
-
static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port,
struct switchdev_trans *trans,
u8 state)
@@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
}
static const struct switchdev_ops ocelot_port_switchdev_ops = {
- .switchdev_port_attr_get = ocelot_port_attr_get,
.switchdev_port_attr_set = ocelot_port_attr_set,
};
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 06/12] mscc: ocelot: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
Ocelot only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID as a valid
switchdev attribute getter, convert it to use ndo_get_port_parent_id()
and get rid of the switchdev_ops::switchdev_port_attr_get altogether.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/mscc/ocelot.c | 33 ++++++++++++------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index c6a575eb0ff5..195306d05bcd 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev,
return 0;
}
+static int ocelot_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct ocelot_port *ocelot_port = netdev_priv(dev);
+ struct ocelot *ocelot = ocelot_port->ocelot;
+
+ ppid->id_len = sizeof(ocelot->base_mac);
+ memcpy(&ppid->id, &ocelot->base_mac, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops ocelot_port_netdev_ops = {
.ndo_open = ocelot_port_open,
.ndo_stop = ocelot_port_stop,
@@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = {
.ndo_vlan_rx_add_vid = ocelot_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = ocelot_vlan_rx_kill_vid,
.ndo_set_features = ocelot_set_features,
+ .ndo_get_port_parent_id = ocelot_get_port_parent_id,
};
static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data)
@@ -1013,25 +1026,6 @@ static const struct ethtool_ops ocelot_ethtool_ops = {
.set_link_ksettings = phy_ethtool_set_link_ksettings,
};
-static int ocelot_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
- struct ocelot_port *ocelot_port = netdev_priv(dev);
- struct ocelot *ocelot = ocelot_port->ocelot;
-
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(ocelot->base_mac);
- memcpy(&attr->u.ppid.id, &ocelot->base_mac,
- attr->u.ppid.id_len);
- break;
- default:
- return -EOPNOTSUPP;
- }
-
- return 0;
-}
-
static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port,
struct switchdev_trans *trans,
u8 state)
@@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
}
static const struct switchdev_ops ocelot_port_switchdev_ops = {
- .switchdev_port_attr_get = ocelot_port_attr_get,
.switchdev_port_attr_set = ocelot_port_attr_set,
};
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 07/12] nfp: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
NFP only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../ethernet/netronome/nfp/nfp_net_common.c | 4 +---
.../net/ethernet/netronome/nfp/nfp_net_repr.c | 4 +---
drivers/net/ethernet/netronome/nfp/nfp_port.c | 23 +++++--------------
drivers/net/ethernet/netronome/nfp/nfp_port.h | 4 +++-
4 files changed, 11 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 7d2d4241498f..776f6c07701b 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -36,7 +36,6 @@
#include <linux/vmalloc.h>
#include <linux/ktime.h>
-#include <net/switchdev.h>
#include <net/vxlan.h>
#include "nfpcore/nfp_nsp.h"
@@ -3531,6 +3530,7 @@ const struct net_device_ops nfp_net_netdev_ops = {
.ndo_udp_tunnel_add = nfp_net_add_vxlan_port,
.ndo_udp_tunnel_del = nfp_net_del_vxlan_port,
.ndo_bpf = nfp_net_xdp,
+ .ndo_get_port_parent_id = nfp_port_get_port_parent_id,
};
/**
@@ -3815,8 +3815,6 @@ static void nfp_net_netdev_init(struct nfp_net *nn)
netdev->netdev_ops = &nfp_net_netdev_ops;
netdev->watchdog_timeo = msecs_to_jiffies(5 * 1000);
- SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops);
-
/* MTU range: 68 - hw-specific max */
netdev->min_mtu = ETH_MIN_MTU;
netdev->max_mtu = nn->max_mtu;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 69d7aebda09b..62839807e21e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -5,7 +5,6 @@
#include <linux/io-64-nonatomic-hi-lo.h>
#include <linux/lockdep.h>
#include <net/dst_metadata.h>
-#include <net/switchdev.h>
#include "nfpcore/nfp_cpp.h"
#include "nfpcore/nfp_nsp.h"
@@ -273,6 +272,7 @@ const struct net_device_ops nfp_repr_netdev_ops = {
.ndo_fix_features = nfp_repr_fix_features,
.ndo_set_features = nfp_port_set_features,
.ndo_set_mac_address = eth_mac_addr,
+ .ndo_get_port_parent_id = nfp_port_get_port_parent_id,
};
void
@@ -336,8 +336,6 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
netdev->max_mtu = pf_netdev->max_mtu;
- SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops);
-
/* Set features the lower device can support with representors */
if (repr_cap & NFP_NET_CFG_CTRL_LIVE_ADDR)
netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
index 86bc149ca231..b9aa7eb99067 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -31,34 +31,23 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
return NULL;
}
-static int
-nfp_port_attr_get(struct net_device *netdev, struct switchdev_attr *attr)
+int nfp_port_get_port_parent_id(struct net_device *netdev,
+ struct netdev_phys_item_id *ppid)
{
struct nfp_port *port;
+ const u8 *serial;
port = nfp_port_from_netdev(netdev);
if (!port)
return -EOPNOTSUPP;
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: {
- const u8 *serial;
- /* N.B: attr->u.ppid.id is binary data */
- attr->u.ppid.id_len = nfp_cpp_serial(port->app->cpp, &serial);
- memcpy(&attr->u.ppid.id, serial, attr->u.ppid.id_len);
- break;
- }
- default:
- return -EOPNOTSUPP;
- }
+ /* N.B: attr->u.ppid.id is binary data */
+ ppid->id_len = nfp_cpp_serial(port->app->cpp, &serial);
+ memcpy(&ppid->id, serial, ppid->id_len);
return 0;
}
-const struct switchdev_ops nfp_port_switchdev_ops = {
- .switchdev_port_attr_get = nfp_port_attr_get,
-};
-
int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
void *type_data)
{
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index b2479a2a49e5..90ae053f5c07 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -7,6 +7,7 @@
#include <net/devlink.h>
struct net_device;
+struct netdev_phys_item_id;
struct nfp_app;
struct nfp_pf;
struct nfp_port;
@@ -90,7 +91,6 @@ struct nfp_port {
};
extern const struct ethtool_ops nfp_port_ethtool_ops;
-extern const struct switchdev_ops nfp_port_switchdev_ops;
__printf(2, 3) u8 *nfp_pr_et(u8 *data, const char *fmt, ...);
@@ -106,6 +106,8 @@ int
nfp_port_set_features(struct net_device *netdev, netdev_features_t features);
struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
+int nfp_port_get_port_parent_id(struct net_device *netdev,
+ struct netdev_phys_item_id *ppid);
struct nfp_port *
nfp_port_from_id(struct nfp_pf *pf, enum nfp_port_type type, unsigned int id);
struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 07/12] nfp: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
NFP only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../ethernet/netronome/nfp/nfp_net_common.c | 4 +---
.../net/ethernet/netronome/nfp/nfp_net_repr.c | 4 +---
drivers/net/ethernet/netronome/nfp/nfp_port.c | 23 +++++--------------
drivers/net/ethernet/netronome/nfp/nfp_port.h | 4 +++-
4 files changed, 11 insertions(+), 24 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 7d2d4241498f..776f6c07701b 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -36,7 +36,6 @@
#include <linux/vmalloc.h>
#include <linux/ktime.h>
-#include <net/switchdev.h>
#include <net/vxlan.h>
#include "nfpcore/nfp_nsp.h"
@@ -3531,6 +3530,7 @@ const struct net_device_ops nfp_net_netdev_ops = {
.ndo_udp_tunnel_add = nfp_net_add_vxlan_port,
.ndo_udp_tunnel_del = nfp_net_del_vxlan_port,
.ndo_bpf = nfp_net_xdp,
+ .ndo_get_port_parent_id = nfp_port_get_port_parent_id,
};
/**
@@ -3815,8 +3815,6 @@ static void nfp_net_netdev_init(struct nfp_net *nn)
netdev->netdev_ops = &nfp_net_netdev_ops;
netdev->watchdog_timeo = msecs_to_jiffies(5 * 1000);
- SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops);
-
/* MTU range: 68 - hw-specific max */
netdev->min_mtu = ETH_MIN_MTU;
netdev->max_mtu = nn->max_mtu;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 69d7aebda09b..62839807e21e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -5,7 +5,6 @@
#include <linux/io-64-nonatomic-hi-lo.h>
#include <linux/lockdep.h>
#include <net/dst_metadata.h>
-#include <net/switchdev.h>
#include "nfpcore/nfp_cpp.h"
#include "nfpcore/nfp_nsp.h"
@@ -273,6 +272,7 @@ const struct net_device_ops nfp_repr_netdev_ops = {
.ndo_fix_features = nfp_repr_fix_features,
.ndo_set_features = nfp_port_set_features,
.ndo_set_mac_address = eth_mac_addr,
+ .ndo_get_port_parent_id = nfp_port_get_port_parent_id,
};
void
@@ -336,8 +336,6 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
netdev->max_mtu = pf_netdev->max_mtu;
- SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops);
-
/* Set features the lower device can support with representors */
if (repr_cap & NFP_NET_CFG_CTRL_LIVE_ADDR)
netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
index 86bc149ca231..b9aa7eb99067 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -31,34 +31,23 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
return NULL;
}
-static int
-nfp_port_attr_get(struct net_device *netdev, struct switchdev_attr *attr)
+int nfp_port_get_port_parent_id(struct net_device *netdev,
+ struct netdev_phys_item_id *ppid)
{
struct nfp_port *port;
+ const u8 *serial;
port = nfp_port_from_netdev(netdev);
if (!port)
return -EOPNOTSUPP;
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: {
- const u8 *serial;
- /* N.B: attr->u.ppid.id is binary data */
- attr->u.ppid.id_len = nfp_cpp_serial(port->app->cpp, &serial);
- memcpy(&attr->u.ppid.id, serial, attr->u.ppid.id_len);
- break;
- }
- default:
- return -EOPNOTSUPP;
- }
+ /* N.B: attr->u.ppid.id is binary data */
+ ppid->id_len = nfp_cpp_serial(port->app->cpp, &serial);
+ memcpy(&ppid->id, serial, ppid->id_len);
return 0;
}
-const struct switchdev_ops nfp_port_switchdev_ops = {
- .switchdev_port_attr_get = nfp_port_attr_get,
-};
-
int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
void *type_data)
{
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index b2479a2a49e5..90ae053f5c07 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -7,6 +7,7 @@
#include <net/devlink.h>
struct net_device;
+struct netdev_phys_item_id;
struct nfp_app;
struct nfp_pf;
struct nfp_port;
@@ -90,7 +91,6 @@ struct nfp_port {
};
extern const struct ethtool_ops nfp_port_ethtool_ops;
-extern const struct switchdev_ops nfp_port_switchdev_ops;
__printf(2, 3) u8 *nfp_pr_et(u8 *data, const char *fmt, ...);
@@ -106,6 +106,8 @@ int
nfp_port_set_features(struct net_device *netdev, netdev_features_t features);
struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
+int nfp_port_get_port_parent_id(struct net_device *netdev,
+ struct netdev_phys_item_id *ppid);
struct nfp_port *
nfp_port_from_id(struct nfp_pf *pf, enum nfp_port_type type, unsigned int id);
struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 08/12] rocker: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/rocker/rocker_main.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 62a205eba9f7..596f44dbfae1 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2026,6 +2026,18 @@ static void rocker_port_neigh_destroy(struct net_device *dev,
err);
}
+static int rocker_port_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ const struct rocker_port *rocker_port = netdev_priv(dev);
+ const struct rocker *rocker = rocker_port->rocker;
+
+ ppid->id_len = sizeof(rocker->hw.id);
+ memcpy(&ppid->id, &rocker->hw.id, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_open = rocker_port_open,
.ndo_stop = rocker_port_stop,
@@ -2035,6 +2047,7 @@ static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_get_phys_port_name = rocker_port_get_phys_port_name,
.ndo_change_proto_down = rocker_port_change_proto_down,
.ndo_neigh_destroy = rocker_port_neigh_destroy,
+ .ndo_get_port_parent_id = rocker_port_get_port_parent_id,
};
/********************
@@ -2049,10 +2062,6 @@ static int rocker_port_attr_get(struct net_device *dev,
int err = 0;
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(rocker->hw.id);
- memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = rocker_world_port_attr_bridge_flags_get(rocker_port,
&attr->u.brport_flags);
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 08/12] rocker: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/rocker/rocker_main.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 62a205eba9f7..596f44dbfae1 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2026,6 +2026,18 @@ static void rocker_port_neigh_destroy(struct net_device *dev,
err);
}
+static int rocker_port_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ const struct rocker_port *rocker_port = netdev_priv(dev);
+ const struct rocker *rocker = rocker_port->rocker;
+
+ ppid->id_len = sizeof(rocker->hw.id);
+ memcpy(&ppid->id, &rocker->hw.id, ppid->id_len);
+
+ return 0;
+}
+
static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_open = rocker_port_open,
.ndo_stop = rocker_port_stop,
@@ -2035,6 +2047,7 @@ static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_get_phys_port_name = rocker_port_get_phys_port_name,
.ndo_change_proto_down = rocker_port_change_proto_down,
.ndo_neigh_destroy = rocker_port_neigh_destroy,
+ .ndo_get_port_parent_id = rocker_port_get_port_parent_id,
};
/********************
@@ -2049,10 +2062,6 @@ static int rocker_port_attr_get(struct net_device *dev,
int err = 0;
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(rocker->hw.id);
- memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = rocker_world_port_attr_bridge_flags_get(rocker_port,
&attr->u.brport_flags);
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 09/12] netdevsim: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
netdevsim only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/netdevsim/netdev.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 8d8e2b3f263e..be47603234da 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -148,26 +148,16 @@ static struct device_type nsim_dev_type = {
.release = nsim_dev_release,
};
-static int
-nsim_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int nsim_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct netdevsim *ns = netdev_priv(dev);
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(ns->sdev->switch_id);
- memcpy(&attr->u.ppid.id, &ns->sdev->switch_id,
- attr->u.ppid.id_len);
- return 0;
- default:
- return -EOPNOTSUPP;
- }
+ ppid->id_len = sizeof(ns->sdev->switch_id);
+ memcpy(&ppid->id, &ns->sdev->switch_id, ppid->id_len);
+ return 0;
}
-static const struct switchdev_ops nsim_switchdev_ops = {
- .switchdev_port_attr_get = nsim_port_attr_get,
-};
-
static int nsim_init(struct net_device *dev)
{
char sdev_ddir_name[10], sdev_link_name[32];
@@ -214,7 +204,6 @@ static int nsim_init(struct net_device *dev)
goto err_bpf_uninit;
SET_NETDEV_DEV(dev, &ns->dev);
- SWITCHDEV_SET_OPS(dev, &nsim_switchdev_ops);
err = nsim_devlink_setup(ns);
if (err)
@@ -493,6 +482,7 @@ static const struct net_device_ops nsim_netdev_ops = {
.ndo_setup_tc = nsim_setup_tc,
.ndo_set_features = nsim_set_features,
.ndo_bpf = nsim_bpf,
+ .ndo_get_port_paret_id = nsim_get_port_parent_id,
};
static void nsim_setup(struct net_device *dev)
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 09/12] netdevsim: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
netdevsim only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/netdevsim/netdev.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 8d8e2b3f263e..be47603234da 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -148,26 +148,16 @@ static struct device_type nsim_dev_type = {
.release = nsim_dev_release,
};
-static int
-nsim_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int nsim_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct netdevsim *ns = netdev_priv(dev);
- switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(ns->sdev->switch_id);
- memcpy(&attr->u.ppid.id, &ns->sdev->switch_id,
- attr->u.ppid.id_len);
- return 0;
- default:
- return -EOPNOTSUPP;
- }
+ ppid->id_len = sizeof(ns->sdev->switch_id);
+ memcpy(&ppid->id, &ns->sdev->switch_id, ppid->id_len);
+ return 0;
}
-static const struct switchdev_ops nsim_switchdev_ops = {
- .switchdev_port_attr_get = nsim_port_attr_get,
-};
-
static int nsim_init(struct net_device *dev)
{
char sdev_ddir_name[10], sdev_link_name[32];
@@ -214,7 +204,6 @@ static int nsim_init(struct net_device *dev)
goto err_bpf_uninit;
SET_NETDEV_DEV(dev, &ns->dev);
- SWITCHDEV_SET_OPS(dev, &nsim_switchdev_ops);
err = nsim_devlink_setup(ns);
if (err)
@@ -493,6 +482,7 @@ static const struct net_device_ops nsim_netdev_ops = {
.ndo_setup_tc = nsim_setup_tc,
.ndo_set_features = nsim_set_features,
.ndo_bpf = nsim_bpf,
+ .ndo_get_port_paret_id = nsim_get_port_parent_id,
};
static void nsim_setup(struct net_device *dev)
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 10/12] staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
ethsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index daabaceeea52..622f32377b91 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -505,6 +505,17 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
return NETDEV_TX_OK;
}
+static int swdev_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct ethsw_port_priv *port_priv = netdev_priv(dev);
+
+ ppid->id_len = 1;
+ ppid->id[0] = port_priv->ethsw_data->dev_id;
+
+ return 0;
+}
+
static const struct net_device_ops ethsw_port_ops = {
.ndo_open = port_open,
.ndo_stop = port_stop,
@@ -515,6 +526,7 @@ static const struct net_device_ops ethsw_port_ops = {
.ndo_get_offload_stats = port_get_offload_stats,
.ndo_start_xmit = port_dropframe,
+ .ndo_get_port_parent_id = swdev_get_port_parent_id,
};
static void ethsw_links_state_update(struct ethsw_core *ethsw)
@@ -634,10 +646,6 @@ static int swdev_port_attr_get(struct net_device *netdev,
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = 1;
- attr->u.ppid.id[0] = port_priv->ethsw_data->dev_id;
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
attr->u.brport_flags =
(port_priv->ethsw_data->learning ? BR_LEARNING : 0) |
@@ -1434,7 +1442,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;
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 10/12] staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
ethsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index daabaceeea52..622f32377b91 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -505,6 +505,17 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
return NETDEV_TX_OK;
}
+static int swdev_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
+{
+ struct ethsw_port_priv *port_priv = netdev_priv(dev);
+
+ ppid->id_len = 1;
+ ppid->id[0] = port_priv->ethsw_data->dev_id;
+
+ return 0;
+}
+
static const struct net_device_ops ethsw_port_ops = {
.ndo_open = port_open,
.ndo_stop = port_stop,
@@ -515,6 +526,7 @@ static const struct net_device_ops ethsw_port_ops = {
.ndo_get_offload_stats = port_get_offload_stats,
.ndo_start_xmit = port_dropframe,
+ .ndo_get_port_parent_id = swdev_get_port_parent_id,
};
static void ethsw_links_state_update(struct ethsw_core *ethsw)
@@ -634,10 +646,6 @@ static int swdev_port_attr_get(struct net_device *netdev,
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = 1;
- attr->u.ppid.id[0] = port_priv->ethsw_data->dev_id;
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
attr->u.brport_flags =
(port_priv->ethsw_data->learning ? BR_LEARNING : 0) |
@@ -1434,7 +1442,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;
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 11/12] net: dsa: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
DSA implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/slave.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 91de3a663226..70395a0ae52e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -362,18 +362,23 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
return err;
}
-static int dsa_slave_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
+static int dsa_slave_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct dsa_port *dp = dsa_slave_to_port(dev);
struct dsa_switch *ds = dp->ds;
struct dsa_switch_tree *dst = ds->dst;
+ ppid->id_len = sizeof(dst->index);
+ memcpy(&ppid->id, &dst->index, ppid->id_len);
+
+ return 0;
+}
+
+static int dsa_slave_port_attr_get(struct net_device *dev,
+ struct switchdev_attr *attr)
+{
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(dst->index);
- memcpy(&attr->u.ppid.id, &dst->index, attr->u.ppid.id_len);
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
attr->u.brport_flags_support = 0;
break;
@@ -1046,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
.ndo_setup_tc = dsa_slave_setup_tc,
.ndo_get_stats64 = dsa_slave_get_stats64,
+ .ndo_get_port_parent_id = dsa_slave_get_port_parent_id,
};
static const struct switchdev_ops dsa_slave_switchdev_ops = {
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 11/12] net: dsa: Implement ndo_get_port_parent_id()
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
DSA implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/slave.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 91de3a663226..70395a0ae52e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -362,18 +362,23 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
return err;
}
-static int dsa_slave_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
+static int dsa_slave_get_port_parent_id(struct net_device *dev,
+ struct netdev_phys_item_id *ppid)
{
struct dsa_port *dp = dsa_slave_to_port(dev);
struct dsa_switch *ds = dp->ds;
struct dsa_switch_tree *dst = ds->dst;
+ ppid->id_len = sizeof(dst->index);
+ memcpy(&ppid->id, &dst->index, ppid->id_len);
+
+ return 0;
+}
+
+static int dsa_slave_port_attr_get(struct net_device *dev,
+ struct switchdev_attr *attr)
+{
switch (attr->id) {
- case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
- attr->u.ppid.id_len = sizeof(dst->index);
- memcpy(&attr->u.ppid.id, &dst->index, attr->u.ppid.id_len);
- break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
attr->u.brport_flags_support = 0;
break;
@@ -1046,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
.ndo_setup_tc = dsa_slave_setup_tc,
.ndo_get_stats64 = dsa_slave_get_stats64,
+ .ndo_get_port_parent_id = dsa_slave_get_port_parent_id,
};
static const struct switchdev_ops dsa_slave_switchdev_ops = {
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-04 23:36 ` Florian Fainelli
-1 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, S
Now that we have a dedicated NDO for getting a port's parent ID, get rid
of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
NDO exclusively. This is a preliminary change to getting rid of
switchdev_ops eventually.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/switchdev.h | 2 --
net/bridge/br_switchdev.c | 11 +++--------
net/core/net-sysfs.c | 14 +++-----------
net/core/rtnetlink.c | 16 ++++------------
net/ipv4/ipmr.c | 14 ++++----------
net/switchdev/switchdev.c | 20 +++++++++-----------
6 files changed, 23 insertions(+), 54 deletions(-)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 63843ae5dc81..e1a5e8bc24b8 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -43,7 +43,6 @@ static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans)
enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_UNDEFINED,
- SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
SWITCHDEV_ATTR_ID_PORT_STP_STATE,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
@@ -61,7 +60,6 @@ struct switchdev_attr {
void *complete_priv;
void (*complete)(struct net_device *dev, int err, void *priv);
union {
- struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */
u8 stp_state; /* PORT_STP_STATE */
unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
unsigned long brport_flags_support; /* PORT_BRIDGE_FLAGS_SUPPORT */
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 501a4221220a..620fd645f6f1 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -24,18 +24,13 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
int nbp_switchdev_mark_set(struct net_bridge_port *p)
{
const struct net_device_ops *ops = p->dev->netdev_ops;
- struct switchdev_attr attr = {
- .orig_dev = p->dev,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
- int err;
+ struct netdev_phys_item_id ppid = { };
+ int err = -EOPNOTSUPP;
ASSERT_RTNL();
if (ops->ndo_get_port_parent_id)
- err = ops->ndo_get_port_parent_id(p->dev, &attr.u.ppid);
- else
- err = switchdev_port_attr_get(p->dev, &attr);
+ err = ops->ndo_get_port_parent_id(p->dev, &ppid);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index cc05e8b72657..1d2d76930afd 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -12,7 +12,6 @@
#include <linux/capability.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
-#include <net/switchdev.h>
#include <linux/if_arp.h>
#include <linux/slab.h>
#include <linux/sched/signal.h>
@@ -502,19 +501,12 @@ static ssize_t phys_switch_id_show(struct device *dev,
return restart_syscall();
if (dev_isalive(netdev)) {
- struct switchdev_attr attr = {
- .orig_dev = netdev,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- .flags = SWITCHDEV_F_NO_RECURSE,
- };
+ struct netdev_phys_item_id ppid = { };
if (ops->ndo_get_port_parent_id)
- ret = ops->ndo_get_port_parent_id(netdev, &attr.u.ppid);
- else
- ret = switchdev_port_attr_get(netdev, &attr);
+ ret = ops->ndo_get_port_parent_id(netdev, &ppid);
if (!ret)
- ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
- attr.u.ppid.id);
+ ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id);
}
rtnl_unlock();
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ed8564eb97c8..27bccf68538e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -46,7 +46,6 @@
#include <linux/inet.h>
#include <linux/netdevice.h>
-#include <net/switchdev.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <net/arp.h>
@@ -1147,25 +1146,18 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
{
const struct net_device_ops *ops = dev->netdev_ops;
- int err;
- struct switchdev_attr attr = {
- .orig_dev = dev,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- .flags = SWITCHDEV_F_NO_RECURSE,
- };
+ struct netdev_phys_item_id ppid = { };
+ int err = -EOPNOTSUPP;
if (ops->ndo_get_port_parent_id)
- err = ops->ndo_get_port_parent_id(dev, &attr.u.ppid);
- else
- err = switchdev_port_attr_get(dev, &attr);
+ err = ops->ndo_get_port_parent_id(dev, &ppid);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
return err;
}
- if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
- attr.u.ppid.id))
+ if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id))
return -EMSGSIZE;
return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9f67394b6691..ac592bd07be1 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -67,7 +67,6 @@
#include <net/fib_rules.h>
#include <linux/netconf.h>
#include <net/nexthop.h>
-#include <net/switchdev.h>
#include <linux/nospec.h>
@@ -837,11 +836,9 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
static int vif_add(struct net *net, struct mr_table *mrt,
struct vifctl *vifc, int mrtsock)
{
+ struct netdev_phys_item_id ppid = { };
const struct net_device_ops *ops;
int vifi = vifc->vifc_vifi;
- struct switchdev_attr attr = {
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
struct vif_device *v = &mrt->vif_table[vifi];
struct net_device *dev;
struct in_device *in_dev;
@@ -923,12 +920,9 @@ static int vif_add(struct net *net, struct mr_table *mrt,
attr.orig_dev = dev;
ops = dev->netdev_ops;
if (ops->ndo_get_port_parent_id &&
- !ops->ndo_get_port_parent_id(dev, &attr.ppid)) {
- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
- v->dev_parent_id.id_len = attr.u.ppid.id_len;
- } else if (!switchdev_port_attr_get(dev, &attr)) {
- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
- v->dev_parent_id.id_len = attr.u.ppid.id_len;
+ !ops->ndo_get_port_parent_id(dev, &ppid)) {
+ memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
+ v->dev_parent_id.id_len = ppid.id_len;
} else {
v->dev_parent_id.id_len = 0;
}
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index cd78253de31d..57e0bfde67b4 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -595,20 +595,18 @@ EXPORT_SYMBOL_GPL(call_switchdev_blocking_notifiers);
bool switchdev_port_same_parent_id(struct net_device *a,
struct net_device *b)
{
- struct switchdev_attr a_attr = {
- .orig_dev = a,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
- struct switchdev_attr b_attr = {
- .orig_dev = b,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
+ struct netdev_phys_item_id id_a = { };
+ struct netdev_phys_item_id id_b = { };
+
+ if (!a->netdev_ops->ndo_get_port_parent_id ||
+ !b->netdev_ops->ndo_get_port_parent_id)
+ return -EOPNOTSUPP;
- if (switchdev_port_attr_get(a, &a_attr) ||
- switchdev_port_attr_get(b, &b_attr))
+ if (a->netdev_ops->ndo_get_port_parent_id(a, &id_a) ||
+ b->netdev_ops->ndo_get_port_parent_id(b, &id_b))
return false;
- return netdev_phys_item_id_same(&a_attr.u.ppid, &b_attr.u.ppid);
+ return netdev_phys_item_id_same(&id_a, &id_b);
}
EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id);
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* [Bridge] [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
@ 2019-02-04 23:36 ` Florian Fainelli
0 siblings, 0 replies; 41+ messages in thread
From: Florian Fainelli @ 2019-02-04 23:36 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, Florian Fainelli,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, David Ahern,
Joe Perches, Derek Chickles, David S. Miller
Now that we have a dedicated NDO for getting a port's parent ID, get rid
of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
NDO exclusively. This is a preliminary change to getting rid of
switchdev_ops eventually.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/switchdev.h | 2 --
net/bridge/br_switchdev.c | 11 +++--------
net/core/net-sysfs.c | 14 +++-----------
net/core/rtnetlink.c | 16 ++++------------
net/ipv4/ipmr.c | 14 ++++----------
net/switchdev/switchdev.c | 20 +++++++++-----------
6 files changed, 23 insertions(+), 54 deletions(-)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 63843ae5dc81..e1a5e8bc24b8 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -43,7 +43,6 @@ static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans)
enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_UNDEFINED,
- SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
SWITCHDEV_ATTR_ID_PORT_STP_STATE,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
@@ -61,7 +60,6 @@ struct switchdev_attr {
void *complete_priv;
void (*complete)(struct net_device *dev, int err, void *priv);
union {
- struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */
u8 stp_state; /* PORT_STP_STATE */
unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
unsigned long brport_flags_support; /* PORT_BRIDGE_FLAGS_SUPPORT */
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 501a4221220a..620fd645f6f1 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -24,18 +24,13 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
int nbp_switchdev_mark_set(struct net_bridge_port *p)
{
const struct net_device_ops *ops = p->dev->netdev_ops;
- struct switchdev_attr attr = {
- .orig_dev = p->dev,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
- int err;
+ struct netdev_phys_item_id ppid = { };
+ int err = -EOPNOTSUPP;
ASSERT_RTNL();
if (ops->ndo_get_port_parent_id)
- err = ops->ndo_get_port_parent_id(p->dev, &attr.u.ppid);
- else
- err = switchdev_port_attr_get(p->dev, &attr);
+ err = ops->ndo_get_port_parent_id(p->dev, &ppid);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index cc05e8b72657..1d2d76930afd 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -12,7 +12,6 @@
#include <linux/capability.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
-#include <net/switchdev.h>
#include <linux/if_arp.h>
#include <linux/slab.h>
#include <linux/sched/signal.h>
@@ -502,19 +501,12 @@ static ssize_t phys_switch_id_show(struct device *dev,
return restart_syscall();
if (dev_isalive(netdev)) {
- struct switchdev_attr attr = {
- .orig_dev = netdev,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- .flags = SWITCHDEV_F_NO_RECURSE,
- };
+ struct netdev_phys_item_id ppid = { };
if (ops->ndo_get_port_parent_id)
- ret = ops->ndo_get_port_parent_id(netdev, &attr.u.ppid);
- else
- ret = switchdev_port_attr_get(netdev, &attr);
+ ret = ops->ndo_get_port_parent_id(netdev, &ppid);
if (!ret)
- ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
- attr.u.ppid.id);
+ ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id);
}
rtnl_unlock();
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ed8564eb97c8..27bccf68538e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -46,7 +46,6 @@
#include <linux/inet.h>
#include <linux/netdevice.h>
-#include <net/switchdev.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <net/arp.h>
@@ -1147,25 +1146,18 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
{
const struct net_device_ops *ops = dev->netdev_ops;
- int err;
- struct switchdev_attr attr = {
- .orig_dev = dev,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- .flags = SWITCHDEV_F_NO_RECURSE,
- };
+ struct netdev_phys_item_id ppid = { };
+ int err = -EOPNOTSUPP;
if (ops->ndo_get_port_parent_id)
- err = ops->ndo_get_port_parent_id(dev, &attr.u.ppid);
- else
- err = switchdev_port_attr_get(dev, &attr);
+ err = ops->ndo_get_port_parent_id(dev, &ppid);
if (err) {
if (err == -EOPNOTSUPP)
return 0;
return err;
}
- if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
- attr.u.ppid.id))
+ if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id))
return -EMSGSIZE;
return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9f67394b6691..ac592bd07be1 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -67,7 +67,6 @@
#include <net/fib_rules.h>
#include <linux/netconf.h>
#include <net/nexthop.h>
-#include <net/switchdev.h>
#include <linux/nospec.h>
@@ -837,11 +836,9 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
static int vif_add(struct net *net, struct mr_table *mrt,
struct vifctl *vifc, int mrtsock)
{
+ struct netdev_phys_item_id ppid = { };
const struct net_device_ops *ops;
int vifi = vifc->vifc_vifi;
- struct switchdev_attr attr = {
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
struct vif_device *v = &mrt->vif_table[vifi];
struct net_device *dev;
struct in_device *in_dev;
@@ -923,12 +920,9 @@ static int vif_add(struct net *net, struct mr_table *mrt,
attr.orig_dev = dev;
ops = dev->netdev_ops;
if (ops->ndo_get_port_parent_id &&
- !ops->ndo_get_port_parent_id(dev, &attr.ppid)) {
- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
- v->dev_parent_id.id_len = attr.u.ppid.id_len;
- } else if (!switchdev_port_attr_get(dev, &attr)) {
- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
- v->dev_parent_id.id_len = attr.u.ppid.id_len;
+ !ops->ndo_get_port_parent_id(dev, &ppid)) {
+ memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
+ v->dev_parent_id.id_len = ppid.id_len;
} else {
v->dev_parent_id.id_len = 0;
}
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index cd78253de31d..57e0bfde67b4 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -595,20 +595,18 @@ EXPORT_SYMBOL_GPL(call_switchdev_blocking_notifiers);
bool switchdev_port_same_parent_id(struct net_device *a,
struct net_device *b)
{
- struct switchdev_attr a_attr = {
- .orig_dev = a,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
- struct switchdev_attr b_attr = {
- .orig_dev = b,
- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
- };
+ struct netdev_phys_item_id id_a = { };
+ struct netdev_phys_item_id id_b = { };
+
+ if (!a->netdev_ops->ndo_get_port_parent_id ||
+ !b->netdev_ops->ndo_get_port_parent_id)
+ return -EOPNOTSUPP;
- if (switchdev_port_attr_get(a, &a_attr) ||
- switchdev_port_attr_get(b, &b_attr))
+ if (a->netdev_ops->ndo_get_port_parent_id(a, &id_a) ||
+ b->netdev_ops->ndo_get_port_parent_id(b, &id_b))
return false;
- return netdev_phys_item_id_same(&a_attr.u.ppid, &b_attr.u.ppid);
+ return netdev_phys_item_id_same(&id_a, &id_b);
}
EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id);
--
2.17.1
^ permalink raw reply related [flat|nested] 41+ messages in thread
* Re: [PATCH 00/12] net: Introduce ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
` (12 preceding siblings ...)
(?)
@ 2019-02-05 2:24 ` David Miller
-1 siblings, 0 replies; 41+ messages in thread
From: David Miller @ 2019-02-05 2:24 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev
Florian, your email headers, particularly the CC: list, were too huge.
So vger.kernel.org blocked them.
Please trim the CC: list down and make it more reasonable.
Thank you.
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 07/12] nfp: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-05 3:49 ` Jakub Kicinski
-1 siblings, 0 replies; 41+ messages in thread
From: Jakub Kicinski @ 2019-02-05 3:49 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Petr Machata,
Vivien Didelot, Alexander Duyck, open list:STAGING SUBSYSTEM,
Daniel
On Mon, 4 Feb 2019 15:36:28 -0800, Florian Fainelli wrote:
> NFP only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
> great candidate to be converted to use the ndo_get_port_parent_id() NDO
> instead of implementing switchdev_port_attr_get().
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Very nice!! Hopefully nobody hates this approach :)
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [Bridge] [PATCH 07/12] nfp: Implement ndo_get_port_parent_id()
@ 2019-02-05 3:49 ` Jakub Kicinski
0 siblings, 0 replies; 41+ messages in thread
From: Jakub Kicinski @ 2019-02-05 3:49 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, netdev, Joe Perches,
Derek Chickles, David S. Miller
On Mon, 4 Feb 2019 15:36:28 -0800, Florian Fainelli wrote:
> NFP only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
> great candidate to be converted to use the ndo_get_port_parent_id() NDO
> instead of implementing switchdev_port_attr_get().
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Very nice!! Hopefully nobody hates this approach :)
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 09/12] netdevsim: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-05 3:51 ` Jakub Kicinski
-1 siblings, 0 replies; 41+ messages in thread
From: Jakub Kicinski @ 2019-02-05 3:51 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM
On Mon, 4 Feb 2019 15:36:30 -0800, Florian Fainelli wrote:
> netdevsim only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
> great candidate to be converted to use the ndo_get_port_parent_id() NDO
> instead of implementing switchdev_port_attr_get().
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [Bridge] [PATCH 09/12] netdevsim: Implement ndo_get_port_parent_id()
@ 2019-02-05 3:51 ` Jakub Kicinski
0 siblings, 0 replies; 41+ messages in thread
From: Jakub Kicinski @ 2019-02-05 3:51 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Ido Schimmel, Jiri Pirko, Kirill Tkhai, Edwin Peer, Michael Chan,
Christian Brauner, Felix Manlunas, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, netdev, Joe Perches,
Derek Chickles, David S. Miller
On Mon, 4 Feb 2019 15:36:30 -0800, Florian Fainelli wrote:
> netdevsim only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
> great candidate to be converted to use the ndo_get_port_parent_id() NDO
> instead of implementing switchdev_port_attr_get().
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 00/12] net: Introduce ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-05 7:14 ` Ido Schimmel
-1 siblings, 0 replies; 41+ messages in thread
From: Ido Schimmel @ 2019-02-05 7:14 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck
On Mon, Feb 04, 2019 at 03:36:21PM -0800, Florian Fainelli wrote:
> Hi all,
>
> Based on discussion with Ido and feedback from Jakub there are clearly
> two classes of users that implement SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
>
> - PF/VF drivers which typically only implement return the port's parent
> ID, yet have to implement switchdev_port_attr_get() just for that
>
> - Ethernet switch drivers: mlxsw, ocelot, DSA, etc. which implement more
> attributes which we want to be able to eventually veto in the context
> of the caller, thus making them candidates for using a blocking notifier
> chain
Florian, thanks for working on this.
I think you're missing implementation over stacked devices. At least
8021q, bond and team need to implement this ndo as well. For bond and
team we can return an error if not all the slaves have the same parent
ID. It would be consistent with what switchdev_port_attr_get() is doing.
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [Bridge] [PATCH 00/12] net: Introduce ndo_get_port_parent_id()
@ 2019-02-05 7:14 ` Ido Schimmel
0 siblings, 0 replies; 41+ messages in thread
From: Ido Schimmel @ 2019-02-05 7:14 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Felix Manlunas, Jiri Pirko, Kirill Tkhai, Edwin Peer,
Michael Chan, Christian Brauner, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, netdev, Joe Perches,
Derek Chickles, David S. Miller
On Mon, Feb 04, 2019 at 03:36:21PM -0800, Florian Fainelli wrote:
> Hi all,
>
> Based on discussion with Ido and feedback from Jakub there are clearly
> two classes of users that implement SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
>
> - PF/VF drivers which typically only implement return the port's parent
> ID, yet have to implement switchdev_port_attr_get() just for that
>
> - Ethernet switch drivers: mlxsw, ocelot, DSA, etc. which implement more
> attributes which we want to be able to eventually veto in the context
> of the caller, thus making them candidates for using a blocking notifier
> chain
Florian, thanks for working on this.
I think you're missing implementation over stacked devices. At least
8021q, bond and team need to implement this ndo as well. For bond and
team we can return an error if not all the slaves have the same parent
ID. It would be consistent with what switchdev_port_attr_get() is doing.
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
@ 2019-02-05 7:47 ` Ido Schimmel
-1 siblings, 0 replies; 41+ messages in thread
From: Ido Schimmel @ 2019-02-05 7:47 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck
On Mon, Feb 04, 2019 at 03:36:33PM -0800, Florian Fainelli wrote:
> Now that we have a dedicated NDO for getting a port's parent ID, get rid
> of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
> NDO exclusively. This is a preliminary change to getting rid of
> switchdev_ops eventually.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> include/net/switchdev.h | 2 --
> net/bridge/br_switchdev.c | 11 +++--------
> net/core/net-sysfs.c | 14 +++-----------
> net/core/rtnetlink.c | 16 ++++------------
> net/ipv4/ipmr.c | 14 ++++----------
> net/switchdev/switchdev.c | 20 +++++++++-----------
> 6 files changed, 23 insertions(+), 54 deletions(-)
>
> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
> index 63843ae5dc81..e1a5e8bc24b8 100644
> --- a/include/net/switchdev.h
> +++ b/include/net/switchdev.h
> @@ -43,7 +43,6 @@ static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans)
>
> enum switchdev_attr_id {
> SWITCHDEV_ATTR_ID_UNDEFINED,
> - SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> SWITCHDEV_ATTR_ID_PORT_STP_STATE,
> SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
> SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
> @@ -61,7 +60,6 @@ struct switchdev_attr {
> void *complete_priv;
> void (*complete)(struct net_device *dev, int err, void *priv);
> union {
> - struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */
> u8 stp_state; /* PORT_STP_STATE */
> unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
> unsigned long brport_flags_support; /* PORT_BRIDGE_FLAGS_SUPPORT */
> diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
> index 501a4221220a..620fd645f6f1 100644
> --- a/net/bridge/br_switchdev.c
> +++ b/net/bridge/br_switchdev.c
> @@ -24,18 +24,13 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
> int nbp_switchdev_mark_set(struct net_bridge_port *p)
> {
> const struct net_device_ops *ops = p->dev->netdev_ops;
> - struct switchdev_attr attr = {
> - .orig_dev = p->dev,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> - int err;
> + struct netdev_phys_item_id ppid = { };
> + int err = -EOPNOTSUPP;
>
> ASSERT_RTNL();
>
> if (ops->ndo_get_port_parent_id)
> - err = ops->ndo_get_port_parent_id(p->dev, &attr.u.ppid);
> - else
> - err = switchdev_port_attr_get(p->dev, &attr);
> + err = ops->ndo_get_port_parent_id(p->dev, &ppid);
> if (err) {
> if (err == -EOPNOTSUPP)
> return 0;
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index cc05e8b72657..1d2d76930afd 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -12,7 +12,6 @@
> #include <linux/capability.h>
> #include <linux/kernel.h>
> #include <linux/netdevice.h>
> -#include <net/switchdev.h>
> #include <linux/if_arp.h>
> #include <linux/slab.h>
> #include <linux/sched/signal.h>
> @@ -502,19 +501,12 @@ static ssize_t phys_switch_id_show(struct device *dev,
> return restart_syscall();
>
> if (dev_isalive(netdev)) {
> - struct switchdev_attr attr = {
> - .orig_dev = netdev,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - .flags = SWITCHDEV_F_NO_RECURSE,
Florian, note this flag. We should not return the parent id in case this
is called for a stacked device. Maybe extend the ndo with a new
parameter called 'recurse' ? Or you can check here if device has lower
devices and bail.
> - };
> + struct netdev_phys_item_id ppid = { };
>
> if (ops->ndo_get_port_parent_id)
> - ret = ops->ndo_get_port_parent_id(netdev, &attr.u.ppid);
> - else
> - ret = switchdev_port_attr_get(netdev, &attr);
> + ret = ops->ndo_get_port_parent_id(netdev, &ppid);
> if (!ret)
> - ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
> - attr.u.ppid.id);
> + ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id);
> }
> rtnl_unlock();
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index ed8564eb97c8..27bccf68538e 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -46,7 +46,6 @@
>
> #include <linux/inet.h>
> #include <linux/netdevice.h>
> -#include <net/switchdev.h>
> #include <net/ip.h>
> #include <net/protocol.h>
> #include <net/arp.h>
> @@ -1147,25 +1146,18 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
> static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
> {
> const struct net_device_ops *ops = dev->netdev_ops;
> - int err;
> - struct switchdev_attr attr = {
> - .orig_dev = dev,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - .flags = SWITCHDEV_F_NO_RECURSE,
Same here.
> - };
> + struct netdev_phys_item_id ppid = { };
> + int err = -EOPNOTSUPP;
>
> if (ops->ndo_get_port_parent_id)
> - err = ops->ndo_get_port_parent_id(dev, &attr.u.ppid);
> - else
> - err = switchdev_port_attr_get(dev, &attr);
> + err = ops->ndo_get_port_parent_id(dev, &ppid);
> if (err) {
> if (err == -EOPNOTSUPP)
> return 0;
> return err;
> }
>
> - if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
> - attr.u.ppid.id))
> + if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id))
> return -EMSGSIZE;
>
> return 0;
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index 9f67394b6691..ac592bd07be1 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -67,7 +67,6 @@
> #include <net/fib_rules.h>
> #include <linux/netconf.h>
> #include <net/nexthop.h>
> -#include <net/switchdev.h>
>
> #include <linux/nospec.h>
>
> @@ -837,11 +836,9 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
> static int vif_add(struct net *net, struct mr_table *mrt,
> struct vifctl *vifc, int mrtsock)
> {
> + struct netdev_phys_item_id ppid = { };
> const struct net_device_ops *ops;
> int vifi = vifc->vifc_vifi;
> - struct switchdev_attr attr = {
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> struct vif_device *v = &mrt->vif_table[vifi];
> struct net_device *dev;
> struct in_device *in_dev;
> @@ -923,12 +920,9 @@ static int vif_add(struct net *net, struct mr_table *mrt,
> attr.orig_dev = dev;
> ops = dev->netdev_ops;
> if (ops->ndo_get_port_parent_id &&
> - !ops->ndo_get_port_parent_id(dev, &attr.ppid)) {
> - memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
> - v->dev_parent_id.id_len = attr.u.ppid.id_len;
> - } else if (!switchdev_port_attr_get(dev, &attr)) {
> - memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
> - v->dev_parent_id.id_len = attr.u.ppid.id_len;
> + !ops->ndo_get_port_parent_id(dev, &ppid)) {
> + memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
> + v->dev_parent_id.id_len = ppid.id_len;
> } else {
> v->dev_parent_id.id_len = 0;
> }
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index cd78253de31d..57e0bfde67b4 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -595,20 +595,18 @@ EXPORT_SYMBOL_GPL(call_switchdev_blocking_notifiers);
> bool switchdev_port_same_parent_id(struct net_device *a,
> struct net_device *b)
I suggest to rename this function and move it to net/core/dev.c
> {
> - struct switchdev_attr a_attr = {
> - .orig_dev = a,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> - struct switchdev_attr b_attr = {
> - .orig_dev = b,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> + struct netdev_phys_item_id id_a = { };
> + struct netdev_phys_item_id id_b = { };
> +
> + if (!a->netdev_ops->ndo_get_port_parent_id ||
> + !b->netdev_ops->ndo_get_port_parent_id)
> + return -EOPNOTSUPP;
>
> - if (switchdev_port_attr_get(a, &a_attr) ||
> - switchdev_port_attr_get(b, &b_attr))
> + if (a->netdev_ops->ndo_get_port_parent_id(a, &id_a) ||
> + b->netdev_ops->ndo_get_port_parent_id(b, &id_b))
> return false;
>
> - return netdev_phys_item_id_same(&a_attr.u.ppid, &b_attr.u.ppid);
> + return netdev_phys_item_id_same(&id_a, &id_b);
> }
> EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [Bridge] [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
@ 2019-02-05 7:47 ` Ido Schimmel
0 siblings, 0 replies; 41+ messages in thread
From: Ido Schimmel @ 2019-02-05 7:47 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Alexandre Belloni, Jakub Kicinski, John Hurley,
open list:NETRONOME ETHERNET DRIVERS, Eric Dumazet,
Ioana Ciornei, Tyler Hicks, Ivan Vecera, David Ahern,
Ioana Radulescu, open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Amritha Nambiar, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot,
Alexander Duyck, open list:STAGING SUBSYSTEM, Daniel Borkmann,
Nikolay Aleksandrov, Simon Horman, Roopa Prabhu, Satanand Burla,
Felix Manlunas, Jiri Pirko, Kirill Tkhai, Edwin Peer,
Michael Chan, Christian Brauner, Leon Romanovsky, Nic Viljoen,
Hideaki YOSHIFUJI, Greg Kroah-Hartman, Dmitry Torokhov,
open list, Microchip Linux Driver Support, netdev, Joe Perches,
Derek Chickles, David S. Miller
On Mon, Feb 04, 2019 at 03:36:33PM -0800, Florian Fainelli wrote:
> Now that we have a dedicated NDO for getting a port's parent ID, get rid
> of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
> NDO exclusively. This is a preliminary change to getting rid of
> switchdev_ops eventually.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> include/net/switchdev.h | 2 --
> net/bridge/br_switchdev.c | 11 +++--------
> net/core/net-sysfs.c | 14 +++-----------
> net/core/rtnetlink.c | 16 ++++------------
> net/ipv4/ipmr.c | 14 ++++----------
> net/switchdev/switchdev.c | 20 +++++++++-----------
> 6 files changed, 23 insertions(+), 54 deletions(-)
>
> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
> index 63843ae5dc81..e1a5e8bc24b8 100644
> --- a/include/net/switchdev.h
> +++ b/include/net/switchdev.h
> @@ -43,7 +43,6 @@ static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans)
>
> enum switchdev_attr_id {
> SWITCHDEV_ATTR_ID_UNDEFINED,
> - SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> SWITCHDEV_ATTR_ID_PORT_STP_STATE,
> SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
> SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
> @@ -61,7 +60,6 @@ struct switchdev_attr {
> void *complete_priv;
> void (*complete)(struct net_device *dev, int err, void *priv);
> union {
> - struct netdev_phys_item_id ppid; /* PORT_PARENT_ID */
> u8 stp_state; /* PORT_STP_STATE */
> unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
> unsigned long brport_flags_support; /* PORT_BRIDGE_FLAGS_SUPPORT */
> diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
> index 501a4221220a..620fd645f6f1 100644
> --- a/net/bridge/br_switchdev.c
> +++ b/net/bridge/br_switchdev.c
> @@ -24,18 +24,13 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
> int nbp_switchdev_mark_set(struct net_bridge_port *p)
> {
> const struct net_device_ops *ops = p->dev->netdev_ops;
> - struct switchdev_attr attr = {
> - .orig_dev = p->dev,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> - int err;
> + struct netdev_phys_item_id ppid = { };
> + int err = -EOPNOTSUPP;
>
> ASSERT_RTNL();
>
> if (ops->ndo_get_port_parent_id)
> - err = ops->ndo_get_port_parent_id(p->dev, &attr.u.ppid);
> - else
> - err = switchdev_port_attr_get(p->dev, &attr);
> + err = ops->ndo_get_port_parent_id(p->dev, &ppid);
> if (err) {
> if (err == -EOPNOTSUPP)
> return 0;
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index cc05e8b72657..1d2d76930afd 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -12,7 +12,6 @@
> #include <linux/capability.h>
> #include <linux/kernel.h>
> #include <linux/netdevice.h>
> -#include <net/switchdev.h>
> #include <linux/if_arp.h>
> #include <linux/slab.h>
> #include <linux/sched/signal.h>
> @@ -502,19 +501,12 @@ static ssize_t phys_switch_id_show(struct device *dev,
> return restart_syscall();
>
> if (dev_isalive(netdev)) {
> - struct switchdev_attr attr = {
> - .orig_dev = netdev,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - .flags = SWITCHDEV_F_NO_RECURSE,
Florian, note this flag. We should not return the parent id in case this
is called for a stacked device. Maybe extend the ndo with a new
parameter called 'recurse' ? Or you can check here if device has lower
devices and bail.
> - };
> + struct netdev_phys_item_id ppid = { };
>
> if (ops->ndo_get_port_parent_id)
> - ret = ops->ndo_get_port_parent_id(netdev, &attr.u.ppid);
> - else
> - ret = switchdev_port_attr_get(netdev, &attr);
> + ret = ops->ndo_get_port_parent_id(netdev, &ppid);
> if (!ret)
> - ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
> - attr.u.ppid.id);
> + ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id);
> }
> rtnl_unlock();
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index ed8564eb97c8..27bccf68538e 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -46,7 +46,6 @@
>
> #include <linux/inet.h>
> #include <linux/netdevice.h>
> -#include <net/switchdev.h>
> #include <net/ip.h>
> #include <net/protocol.h>
> #include <net/arp.h>
> @@ -1147,25 +1146,18 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
> static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
> {
> const struct net_device_ops *ops = dev->netdev_ops;
> - int err;
> - struct switchdev_attr attr = {
> - .orig_dev = dev,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - .flags = SWITCHDEV_F_NO_RECURSE,
Same here.
> - };
> + struct netdev_phys_item_id ppid = { };
> + int err = -EOPNOTSUPP;
>
> if (ops->ndo_get_port_parent_id)
> - err = ops->ndo_get_port_parent_id(dev, &attr.u.ppid);
> - else
> - err = switchdev_port_attr_get(dev, &attr);
> + err = ops->ndo_get_port_parent_id(dev, &ppid);
> if (err) {
> if (err == -EOPNOTSUPP)
> return 0;
> return err;
> }
>
> - if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
> - attr.u.ppid.id))
> + if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id))
> return -EMSGSIZE;
>
> return 0;
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index 9f67394b6691..ac592bd07be1 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -67,7 +67,6 @@
> #include <net/fib_rules.h>
> #include <linux/netconf.h>
> #include <net/nexthop.h>
> -#include <net/switchdev.h>
>
> #include <linux/nospec.h>
>
> @@ -837,11 +836,9 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
> static int vif_add(struct net *net, struct mr_table *mrt,
> struct vifctl *vifc, int mrtsock)
> {
> + struct netdev_phys_item_id ppid = { };
> const struct net_device_ops *ops;
> int vifi = vifc->vifc_vifi;
> - struct switchdev_attr attr = {
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> struct vif_device *v = &mrt->vif_table[vifi];
> struct net_device *dev;
> struct in_device *in_dev;
> @@ -923,12 +920,9 @@ static int vif_add(struct net *net, struct mr_table *mrt,
> attr.orig_dev = dev;
> ops = dev->netdev_ops;
> if (ops->ndo_get_port_parent_id &&
> - !ops->ndo_get_port_parent_id(dev, &attr.ppid)) {
> - memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
> - v->dev_parent_id.id_len = attr.u.ppid.id_len;
> - } else if (!switchdev_port_attr_get(dev, &attr)) {
> - memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
> - v->dev_parent_id.id_len = attr.u.ppid.id_len;
> + !ops->ndo_get_port_parent_id(dev, &ppid)) {
> + memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
> + v->dev_parent_id.id_len = ppid.id_len;
> } else {
> v->dev_parent_id.id_len = 0;
> }
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index cd78253de31d..57e0bfde67b4 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -595,20 +595,18 @@ EXPORT_SYMBOL_GPL(call_switchdev_blocking_notifiers);
> bool switchdev_port_same_parent_id(struct net_device *a,
> struct net_device *b)
I suggest to rename this function and move it to net/core/dev.c
> {
> - struct switchdev_attr a_attr = {
> - .orig_dev = a,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> - struct switchdev_attr b_attr = {
> - .orig_dev = b,
> - .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
> - };
> + struct netdev_phys_item_id id_a = { };
> + struct netdev_phys_item_id id_b = { };
> +
> + if (!a->netdev_ops->ndo_get_port_parent_id ||
> + !b->netdev_ops->ndo_get_port_parent_id)
> + return -EOPNOTSUPP;
>
> - if (switchdev_port_attr_get(a, &a_attr) ||
> - switchdev_port_attr_get(b, &b_attr))
> + if (a->netdev_ops->ndo_get_port_parent_id(a, &id_a) ||
> + b->netdev_ops->ndo_get_port_parent_id(b, &id_b))
> return false;
>
> - return netdev_phys_item_id_same(&a_attr.u.ppid, &b_attr.u.ppid);
> + return netdev_phys_item_id_same(&id_a, &id_b);
> }
> EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 09/12] netdevsim: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
(?)
(?)
@ 2019-02-05 9:23 ` kbuild test robot
-1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2019-02-05 9:23 UTC (permalink / raw)
Cc: John Hurley, Alexandre Belloni, Jakub Kicinski, Andrew Lunn,
open list:NETRONOME ETHERNET DRIVERS, Edwin Peer, Eric Dumazet,
Ioana Ciornei, Microchip Linux Driver Support, Ivan Vecera,
Florian Fainelli, Amritha Nambiar, David S. Miller,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 2698 bytes --]
Hi Florian,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on next-20190205]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Introduce-ndo_get_port_parent_id/20190205-163356
config: x86_64-randconfig-x014-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
>> drivers/net//netdevsim/netdev.c:485:3: error: 'const struct net_device_ops' has no member named 'ndo_get_port_paret_id'; did you mean 'ndo_get_port_parent_id'?
.ndo_get_port_paret_id = nsim_get_port_parent_id,
^~~~~~~~~~~~~~~~~~~~~
ndo_get_port_parent_id
>> drivers/net//netdevsim/netdev.c:485:27: error: initialization of 'int (*)(struct net_device *, int, struct xdp_frame **, u32)' {aka 'int (*)(struct net_device *, int, struct xdp_frame **, unsigned int)'} from incompatible pointer type 'int (*)(struct net_device *, struct netdev_phys_item_id *)' [-Werror=incompatible-pointer-types]
.ndo_get_port_paret_id = nsim_get_port_parent_id,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net//netdevsim/netdev.c:485:27: note: (near initialization for 'nsim_netdev_ops.ndo_xdp_xmit')
cc1: some warnings being treated as errors
vim +485 drivers/net//netdevsim/netdev.c
464
465 static const struct net_device_ops nsim_netdev_ops = {
466 .ndo_init = nsim_init,
467 .ndo_uninit = nsim_uninit,
468 .ndo_start_xmit = nsim_start_xmit,
469 .ndo_set_rx_mode = nsim_set_rx_mode,
470 .ndo_set_mac_address = eth_mac_addr,
471 .ndo_validate_addr = eth_validate_addr,
472 .ndo_change_mtu = nsim_change_mtu,
473 .ndo_get_stats64 = nsim_get_stats64,
474 .ndo_set_vf_mac = nsim_set_vf_mac,
475 .ndo_set_vf_vlan = nsim_set_vf_vlan,
476 .ndo_set_vf_rate = nsim_set_vf_rate,
477 .ndo_set_vf_spoofchk = nsim_set_vf_spoofchk,
478 .ndo_set_vf_trust = nsim_set_vf_trust,
479 .ndo_get_vf_config = nsim_get_vf_config,
480 .ndo_set_vf_link_state = nsim_set_vf_link_state,
481 .ndo_set_vf_rss_query_en = nsim_set_vf_rss_query_en,
482 .ndo_setup_tc = nsim_setup_tc,
483 .ndo_set_features = nsim_set_features,
484 .ndo_bpf = nsim_bpf,
> 485 .ndo_get_port_paret_id = nsim_get_port_parent_id,
486 };
487
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34616 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
(?)
(?)
@ 2019-02-05 9:23 ` kbuild test robot
-1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2019-02-05 9:23 UTC (permalink / raw)
Cc: John Hurley, Alexandre Belloni, Jakub Kicinski, Andrew Lunn,
open list:NETRONOME ETHERNET DRIVERS, Edwin Peer, Eric Dumazet,
Ioana Ciornei, Microchip Linux Driver Support, Ivan Vecera,
Florian Fainelli, Amritha Nambiar, David S. Miller,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 9168 bytes --]
Hi Florian,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on next-20190205]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Introduce-ndo_get_port_parent_id/20190205-163356
config: i386-randconfig-x002-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
net//ipv4/ipmr.c: In function 'vif_add':
>> net//ipv4/ipmr.c:920:2: error: 'attr' undeclared (first use in this function); did you mean 'xattr'?
attr.orig_dev = dev;
^~~~
xattr
net//ipv4/ipmr.c:920:2: note: each undeclared identifier is reported only once for each function it appears in
vim +920 net//ipv4/ipmr.c
^1da177e4 Linus Torvalds 2005-04-16 835
0c12295a7 Patrick McHardy 2010-04-13 836 static int vif_add(struct net *net, struct mr_table *mrt,
0c12295a7 Patrick McHardy 2010-04-13 837 struct vifctl *vifc, int mrtsock)
^1da177e4 Linus Torvalds 2005-04-16 838 {
ca3b84139 Florian Fainelli 2019-02-04 839 struct netdev_phys_item_id ppid = { };
f95ad5036 Florian Fainelli 2019-02-04 840 const struct net_device_ops *ops;
^1da177e4 Linus Torvalds 2005-04-16 841 int vifi = vifc->vifc_vifi;
0c12295a7 Patrick McHardy 2010-04-13 842 struct vif_device *v = &mrt->vif_table[vifi];
^1da177e4 Linus Torvalds 2005-04-16 843 struct net_device *dev;
^1da177e4 Linus Torvalds 2005-04-16 844 struct in_device *in_dev;
d607032db Wang Chen 2008-07-14 845 int err;
^1da177e4 Linus Torvalds 2005-04-16 846
^1da177e4 Linus Torvalds 2005-04-16 847 /* Is vif busy ? */
0c12295a7 Patrick McHardy 2010-04-13 848 if (VIF_EXISTS(mrt, vifi))
^1da177e4 Linus Torvalds 2005-04-16 849 return -EADDRINUSE;
^1da177e4 Linus Torvalds 2005-04-16 850
^1da177e4 Linus Torvalds 2005-04-16 851 switch (vifc->vifc_flags) {
^1da177e4 Linus Torvalds 2005-04-16 852 case VIFF_REGISTER:
1973a4ea6 Nikolay Aleksandrov 2015-11-26 853 if (!ipmr_pimsm_enabled())
c316c629f Nikolay Aleksandrov 2015-11-21 854 return -EINVAL;
c316c629f Nikolay Aleksandrov 2015-11-21 855 /* Special Purpose VIF in PIM
^1da177e4 Linus Torvalds 2005-04-16 856 * All the packets will be sent to the daemon
^1da177e4 Linus Torvalds 2005-04-16 857 */
0c12295a7 Patrick McHardy 2010-04-13 858 if (mrt->mroute_reg_vif_num >= 0)
^1da177e4 Linus Torvalds 2005-04-16 859 return -EADDRINUSE;
f0ad0860d Patrick McHardy 2010-04-13 860 dev = ipmr_reg_vif(net, mrt);
^1da177e4 Linus Torvalds 2005-04-16 861 if (!dev)
^1da177e4 Linus Torvalds 2005-04-16 862 return -ENOBUFS;
d607032db Wang Chen 2008-07-14 863 err = dev_set_allmulti(dev, 1);
d607032db Wang Chen 2008-07-14 864 if (err) {
d607032db Wang Chen 2008-07-14 865 unregister_netdevice(dev);
7dc00c82c Wang Chen 2008-07-14 866 dev_put(dev);
d607032db Wang Chen 2008-07-14 867 return err;
d607032db Wang Chen 2008-07-14 868 }
^1da177e4 Linus Torvalds 2005-04-16 869 break;
^1da177e4 Linus Torvalds 2005-04-16 870 case VIFF_TUNNEL:
4feb88e5c Benjamin Thery 2009-01-22 871 dev = ipmr_new_tunnel(net, vifc);
^1da177e4 Linus Torvalds 2005-04-16 872 if (!dev)
^1da177e4 Linus Torvalds 2005-04-16 873 return -ENOBUFS;
d607032db Wang Chen 2008-07-14 874 err = dev_set_allmulti(dev, 1);
d607032db Wang Chen 2008-07-14 875 if (err) {
d607032db Wang Chen 2008-07-14 876 ipmr_del_tunnel(dev, vifc);
7dc00c82c Wang Chen 2008-07-14 877 dev_put(dev);
d607032db Wang Chen 2008-07-14 878 return err;
d607032db Wang Chen 2008-07-14 879 }
^1da177e4 Linus Torvalds 2005-04-16 880 break;
ee5e81f00 Ilia K 2009-09-16 881 case VIFF_USE_IFINDEX:
^1da177e4 Linus Torvalds 2005-04-16 882 case 0:
ee5e81f00 Ilia K 2009-09-16 883 if (vifc->vifc_flags == VIFF_USE_IFINDEX) {
ee5e81f00 Ilia K 2009-09-16 884 dev = dev_get_by_index(net, vifc->vifc_lcl_ifindex);
51456b291 Ian Morris 2015-04-03 885 if (dev && !__in_dev_get_rtnl(dev)) {
ee5e81f00 Ilia K 2009-09-16 886 dev_put(dev);
ee5e81f00 Ilia K 2009-09-16 887 return -EADDRNOTAVAIL;
ee5e81f00 Ilia K 2009-09-16 888 }
a8cb16dd9 Eric Dumazet 2010-10-01 889 } else {
4feb88e5c Benjamin Thery 2009-01-22 890 dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
a8cb16dd9 Eric Dumazet 2010-10-01 891 }
^1da177e4 Linus Torvalds 2005-04-16 892 if (!dev)
^1da177e4 Linus Torvalds 2005-04-16 893 return -EADDRNOTAVAIL;
d607032db Wang Chen 2008-07-14 894 err = dev_set_allmulti(dev, 1);
7dc00c82c Wang Chen 2008-07-14 895 if (err) {
7dc00c82c Wang Chen 2008-07-14 896 dev_put(dev);
d607032db Wang Chen 2008-07-14 897 return err;
7dc00c82c Wang Chen 2008-07-14 898 }
^1da177e4 Linus Torvalds 2005-04-16 899 break;
^1da177e4 Linus Torvalds 2005-04-16 900 default:
^1da177e4 Linus Torvalds 2005-04-16 901 return -EINVAL;
^1da177e4 Linus Torvalds 2005-04-16 902 }
^1da177e4 Linus Torvalds 2005-04-16 903
a8cb16dd9 Eric Dumazet 2010-10-01 904 in_dev = __in_dev_get_rtnl(dev);
a8cb16dd9 Eric Dumazet 2010-10-01 905 if (!in_dev) {
d0490cfdf Dan Carpenter 2009-11-11 906 dev_put(dev);
^1da177e4 Linus Torvalds 2005-04-16 907 return -EADDRNOTAVAIL;
d0490cfdf Dan Carpenter 2009-11-11 908 }
42f811b8b Herbert Xu 2007-06-04 909 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
3b0228656 David Ahern 2017-03-28 910 inet_netconf_notify_devconf(net, RTM_NEWNETCONF, NETCONFA_MC_FORWARDING,
3b0228656 David Ahern 2017-03-28 911 dev->ifindex, &in_dev->cnf);
^1da177e4 Linus Torvalds 2005-04-16 912 ip_rt_multicast_event(in_dev);
^1da177e4 Linus Torvalds 2005-04-16 913
a8cb16dd9 Eric Dumazet 2010-10-01 914 /* Fill in the VIF structures */
6853f21f7 Yuval Mintz 2018-02-28 915 vif_device_init(v, dev, vifc->vifc_rate_limit,
6853f21f7 Yuval Mintz 2018-02-28 916 vifc->vifc_threshold,
6853f21f7 Yuval Mintz 2018-02-28 917 vifc->vifc_flags | (!mrtsock ? VIFF_STATIC : 0),
6853f21f7 Yuval Mintz 2018-02-28 918 (VIFF_TUNNEL | VIFF_REGISTER));
a8cb16dd9 Eric Dumazet 2010-10-01 919
5d8b3e69f Yotam Gigi 2017-10-03 @920 attr.orig_dev = dev;
f95ad5036 Florian Fainelli 2019-02-04 921 ops = dev->netdev_ops;
f95ad5036 Florian Fainelli 2019-02-04 922 if (ops->ndo_get_port_parent_id &&
ca3b84139 Florian Fainelli 2019-02-04 923 !ops->ndo_get_port_parent_id(dev, &ppid)) {
ca3b84139 Florian Fainelli 2019-02-04 924 memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
ca3b84139 Florian Fainelli 2019-02-04 925 v->dev_parent_id.id_len = ppid.id_len;
5d8b3e69f Yotam Gigi 2017-10-03 926 } else {
5d8b3e69f Yotam Gigi 2017-10-03 927 v->dev_parent_id.id_len = 0;
5d8b3e69f Yotam Gigi 2017-10-03 928 }
6853f21f7 Yuval Mintz 2018-02-28 929
^1da177e4 Linus Torvalds 2005-04-16 930 v->local = vifc->vifc_lcl_addr.s_addr;
^1da177e4 Linus Torvalds 2005-04-16 931 v->remote = vifc->vifc_rmt_addr.s_addr;
^1da177e4 Linus Torvalds 2005-04-16 932
^1da177e4 Linus Torvalds 2005-04-16 933 /* And finish update writing critical data */
^1da177e4 Linus Torvalds 2005-04-16 934 write_lock_bh(&mrt_lock);
^1da177e4 Linus Torvalds 2005-04-16 935 v->dev = dev;
^1da177e4 Linus Torvalds 2005-04-16 936 if (v->flags & VIFF_REGISTER)
0c12295a7 Patrick McHardy 2010-04-13 937 mrt->mroute_reg_vif_num = vifi;
0c12295a7 Patrick McHardy 2010-04-13 938 if (vifi+1 > mrt->maxvif)
0c12295a7 Patrick McHardy 2010-04-13 939 mrt->maxvif = vifi+1;
^1da177e4 Linus Torvalds 2005-04-16 940 write_unlock_bh(&mrt_lock);
b362053a7 Yotam Gigi 2017-09-27 941 call_ipmr_vif_entry_notifiers(net, FIB_EVENT_VIF_ADD, v, vifi, mrt->id);
^1da177e4 Linus Torvalds 2005-04-16 942 return 0;
^1da177e4 Linus Torvalds 2005-04-16 943 }
^1da177e4 Linus Torvalds 2005-04-16 944
:::::: The code at line 920 was first introduced by commit
:::::: 5d8b3e69fc5e5ccafc9db1251bb7c78a8622fddd ipv4: ipmr: Add the parent ID field to VIF struct
:::::: TO: Yotam Gigi <yotamg@mellanox.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32284 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 09/12] netdevsim: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
` (2 preceding siblings ...)
(?)
@ 2019-02-05 9:30 ` kbuild test robot
-1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2019-02-05 9:30 UTC (permalink / raw)
Cc: John Hurley, Alexandre Belloni, Jakub Kicinski, Andrew Lunn,
open list:NETRONOME ETHERNET DRIVERS, Edwin Peer, Eric Dumazet,
Ioana Ciornei, Microchip Linux Driver Support, Ivan Vecera,
Florian Fainelli, Amritha Nambiar, David S. Miller,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 2869 bytes --]
Hi Florian,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on next-20190205]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Introduce-ndo_get_port_parent_id/20190205-163356
config: i386-randconfig-x008-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/net/netdevsim/netdev.c:485:3: error: 'const struct net_device_ops' has no member named 'ndo_get_port_paret_id'; did you mean 'ndo_get_port_parent_id'?
.ndo_get_port_paret_id = nsim_get_port_parent_id,
^~~~~~~~~~~~~~~~~~~~~
ndo_get_port_parent_id
>> drivers/net/netdevsim/netdev.c:485:27: error: positional initialization of field in 'struct' declared with 'designated_init' attribute [-Werror=designated-init]
.ndo_get_port_paret_id = nsim_get_port_parent_id,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/netdev.c:485:27: note: (near initialization for 'nsim_netdev_ops')
drivers/net/netdevsim/netdev.c:485:27: error: initialization of 'void (*)(struct net_device *, struct udp_tunnel_info *)' from incompatible pointer type 'int (*)(struct net_device *, struct netdev_phys_item_id *)' [-Werror=incompatible-pointer-types]
drivers/net/netdevsim/netdev.c:485:27: note: (near initialization for 'nsim_netdev_ops.ndo_udp_tunnel_add')
cc1: some warnings being treated as errors
vim +485 drivers/net/netdevsim/netdev.c
464
465 static const struct net_device_ops nsim_netdev_ops = {
466 .ndo_init = nsim_init,
467 .ndo_uninit = nsim_uninit,
468 .ndo_start_xmit = nsim_start_xmit,
469 .ndo_set_rx_mode = nsim_set_rx_mode,
470 .ndo_set_mac_address = eth_mac_addr,
471 .ndo_validate_addr = eth_validate_addr,
472 .ndo_change_mtu = nsim_change_mtu,
473 .ndo_get_stats64 = nsim_get_stats64,
474 .ndo_set_vf_mac = nsim_set_vf_mac,
475 .ndo_set_vf_vlan = nsim_set_vf_vlan,
476 .ndo_set_vf_rate = nsim_set_vf_rate,
477 .ndo_set_vf_spoofchk = nsim_set_vf_spoofchk,
478 .ndo_set_vf_trust = nsim_set_vf_trust,
479 .ndo_get_vf_config = nsim_get_vf_config,
480 .ndo_set_vf_link_state = nsim_set_vf_link_state,
481 .ndo_set_vf_rss_query_en = nsim_set_vf_rss_query_en,
482 .ndo_setup_tc = nsim_setup_tc,
483 .ndo_set_features = nsim_set_features,
484 .ndo_bpf = nsim_bpf,
> 485 .ndo_get_port_paret_id = nsim_get_port_parent_id,
486 };
487
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30828 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 02/12] bnxt: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
(?)
@ 2019-02-05 9:48 ` kbuild test robot
-1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2019-02-05 9:48 UTC (permalink / raw)
Cc: John Hurley, Alexandre Belloni, Jakub Kicinski, Andrew Lunn,
open list:NETRONOME ETHERNET DRIVERS, Edwin Peer, Eric Dumazet,
Ioana Ciornei, Microchip Linux Driver Support, Ivan Vecera,
Florian Fainelli, Amritha Nambiar, David S. Miller,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]
Hi Florian,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on v5.0-rc4 next-20190205]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Introduce-ndo_get_port_parent_id/20190205-163356
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 8.2.0-11) 8.2.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=8.2.0 make.cross ARCH=sparc64
All error/warnings (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c: In function 'bnxt_vf_rep_get_port_parent_id':
>> drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:248:50: error: 'attr' undeclared (first use in this function); did you mean 'xattr'?
return bnxt_get_port_parent_id(vf_rep->bp->dev, attr);
^~~~
xattr
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:248:50: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:249:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +248 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
239
240 static int bnxt_vf_rep_get_port_parent_id(struct net_device *dev,
241 struct netdev_phys_item_id *ppid)
242 {
243 struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
244
245 /* as only PORT_PARENT_ID is supported currently use common code
246 * between PF and VF-rep for now.
247 */
> 248 return bnxt_get_port_parent_id(vf_rep->bp->dev, attr);
> 249 }
250
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56303 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
` (2 preceding siblings ...)
(?)
@ 2019-02-05 11:17 ` kbuild test robot
-1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2019-02-05 11:17 UTC (permalink / raw)
Cc: John Hurley, Alexandre Belloni, Jakub Kicinski, Andrew Lunn,
open list:NETRONOME ETHERNET DRIVERS, Edwin Peer, Eric Dumazet,
Ioana Ciornei, Microchip Linux Driver Support, Ivan Vecera,
Florian Fainelli, Amritha Nambiar, David S. Miller,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 9293 bytes --]
Hi Florian,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on next-20190205]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Introduce-ndo_get_port_parent_id/20190205-163356
config: nds32-allmodconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.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=6.4.0 make.cross ARCH=nds32
All errors (new ones prefixed by >>):
net/ipv4/ipmr.c: In function 'vif_add':
>> net/ipv4/ipmr.c:920:2: error: 'attr' undeclared (first use in this function)
attr.orig_dev = dev;
^~~~
net/ipv4/ipmr.c:920:2: note: each undeclared identifier is reported only once for each function it appears in
vim +/attr +920 net/ipv4/ipmr.c
^1da177e4 Linus Torvalds 2005-04-16 835
0c12295a7 Patrick McHardy 2010-04-13 836 static int vif_add(struct net *net, struct mr_table *mrt,
0c12295a7 Patrick McHardy 2010-04-13 837 struct vifctl *vifc, int mrtsock)
^1da177e4 Linus Torvalds 2005-04-16 838 {
ca3b84139 Florian Fainelli 2019-02-04 839 struct netdev_phys_item_id ppid = { };
f95ad5036 Florian Fainelli 2019-02-04 840 const struct net_device_ops *ops;
^1da177e4 Linus Torvalds 2005-04-16 841 int vifi = vifc->vifc_vifi;
0c12295a7 Patrick McHardy 2010-04-13 842 struct vif_device *v = &mrt->vif_table[vifi];
^1da177e4 Linus Torvalds 2005-04-16 843 struct net_device *dev;
^1da177e4 Linus Torvalds 2005-04-16 844 struct in_device *in_dev;
d607032db Wang Chen 2008-07-14 845 int err;
^1da177e4 Linus Torvalds 2005-04-16 846
^1da177e4 Linus Torvalds 2005-04-16 847 /* Is vif busy ? */
0c12295a7 Patrick McHardy 2010-04-13 848 if (VIF_EXISTS(mrt, vifi))
^1da177e4 Linus Torvalds 2005-04-16 849 return -EADDRINUSE;
^1da177e4 Linus Torvalds 2005-04-16 850
^1da177e4 Linus Torvalds 2005-04-16 851 switch (vifc->vifc_flags) {
^1da177e4 Linus Torvalds 2005-04-16 852 case VIFF_REGISTER:
1973a4ea6 Nikolay Aleksandrov 2015-11-26 853 if (!ipmr_pimsm_enabled())
c316c629f Nikolay Aleksandrov 2015-11-21 854 return -EINVAL;
c316c629f Nikolay Aleksandrov 2015-11-21 855 /* Special Purpose VIF in PIM
^1da177e4 Linus Torvalds 2005-04-16 856 * All the packets will be sent to the daemon
^1da177e4 Linus Torvalds 2005-04-16 857 */
0c12295a7 Patrick McHardy 2010-04-13 858 if (mrt->mroute_reg_vif_num >= 0)
^1da177e4 Linus Torvalds 2005-04-16 859 return -EADDRINUSE;
f0ad0860d Patrick McHardy 2010-04-13 860 dev = ipmr_reg_vif(net, mrt);
^1da177e4 Linus Torvalds 2005-04-16 861 if (!dev)
^1da177e4 Linus Torvalds 2005-04-16 862 return -ENOBUFS;
d607032db Wang Chen 2008-07-14 863 err = dev_set_allmulti(dev, 1);
d607032db Wang Chen 2008-07-14 864 if (err) {
d607032db Wang Chen 2008-07-14 865 unregister_netdevice(dev);
7dc00c82c Wang Chen 2008-07-14 866 dev_put(dev);
d607032db Wang Chen 2008-07-14 867 return err;
d607032db Wang Chen 2008-07-14 868 }
^1da177e4 Linus Torvalds 2005-04-16 869 break;
^1da177e4 Linus Torvalds 2005-04-16 870 case VIFF_TUNNEL:
4feb88e5c Benjamin Thery 2009-01-22 871 dev = ipmr_new_tunnel(net, vifc);
^1da177e4 Linus Torvalds 2005-04-16 872 if (!dev)
^1da177e4 Linus Torvalds 2005-04-16 873 return -ENOBUFS;
d607032db Wang Chen 2008-07-14 874 err = dev_set_allmulti(dev, 1);
d607032db Wang Chen 2008-07-14 875 if (err) {
d607032db Wang Chen 2008-07-14 876 ipmr_del_tunnel(dev, vifc);
7dc00c82c Wang Chen 2008-07-14 877 dev_put(dev);
d607032db Wang Chen 2008-07-14 878 return err;
d607032db Wang Chen 2008-07-14 879 }
^1da177e4 Linus Torvalds 2005-04-16 880 break;
ee5e81f00 Ilia K 2009-09-16 881 case VIFF_USE_IFINDEX:
^1da177e4 Linus Torvalds 2005-04-16 882 case 0:
ee5e81f00 Ilia K 2009-09-16 883 if (vifc->vifc_flags == VIFF_USE_IFINDEX) {
ee5e81f00 Ilia K 2009-09-16 884 dev = dev_get_by_index(net, vifc->vifc_lcl_ifindex);
51456b291 Ian Morris 2015-04-03 885 if (dev && !__in_dev_get_rtnl(dev)) {
ee5e81f00 Ilia K 2009-09-16 886 dev_put(dev);
ee5e81f00 Ilia K 2009-09-16 887 return -EADDRNOTAVAIL;
ee5e81f00 Ilia K 2009-09-16 888 }
a8cb16dd9 Eric Dumazet 2010-10-01 889 } else {
4feb88e5c Benjamin Thery 2009-01-22 890 dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
a8cb16dd9 Eric Dumazet 2010-10-01 891 }
^1da177e4 Linus Torvalds 2005-04-16 892 if (!dev)
^1da177e4 Linus Torvalds 2005-04-16 893 return -EADDRNOTAVAIL;
d607032db Wang Chen 2008-07-14 894 err = dev_set_allmulti(dev, 1);
7dc00c82c Wang Chen 2008-07-14 895 if (err) {
7dc00c82c Wang Chen 2008-07-14 896 dev_put(dev);
d607032db Wang Chen 2008-07-14 897 return err;
7dc00c82c Wang Chen 2008-07-14 898 }
^1da177e4 Linus Torvalds 2005-04-16 899 break;
^1da177e4 Linus Torvalds 2005-04-16 900 default:
^1da177e4 Linus Torvalds 2005-04-16 901 return -EINVAL;
^1da177e4 Linus Torvalds 2005-04-16 902 }
^1da177e4 Linus Torvalds 2005-04-16 903
a8cb16dd9 Eric Dumazet 2010-10-01 904 in_dev = __in_dev_get_rtnl(dev);
a8cb16dd9 Eric Dumazet 2010-10-01 905 if (!in_dev) {
d0490cfdf Dan Carpenter 2009-11-11 906 dev_put(dev);
^1da177e4 Linus Torvalds 2005-04-16 907 return -EADDRNOTAVAIL;
d0490cfdf Dan Carpenter 2009-11-11 908 }
42f811b8b Herbert Xu 2007-06-04 909 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
3b0228656 David Ahern 2017-03-28 910 inet_netconf_notify_devconf(net, RTM_NEWNETCONF, NETCONFA_MC_FORWARDING,
3b0228656 David Ahern 2017-03-28 911 dev->ifindex, &in_dev->cnf);
^1da177e4 Linus Torvalds 2005-04-16 912 ip_rt_multicast_event(in_dev);
^1da177e4 Linus Torvalds 2005-04-16 913
a8cb16dd9 Eric Dumazet 2010-10-01 914 /* Fill in the VIF structures */
6853f21f7 Yuval Mintz 2018-02-28 915 vif_device_init(v, dev, vifc->vifc_rate_limit,
6853f21f7 Yuval Mintz 2018-02-28 916 vifc->vifc_threshold,
6853f21f7 Yuval Mintz 2018-02-28 917 vifc->vifc_flags | (!mrtsock ? VIFF_STATIC : 0),
6853f21f7 Yuval Mintz 2018-02-28 918 (VIFF_TUNNEL | VIFF_REGISTER));
a8cb16dd9 Eric Dumazet 2010-10-01 919
5d8b3e69f Yotam Gigi 2017-10-03 @920 attr.orig_dev = dev;
f95ad5036 Florian Fainelli 2019-02-04 921 ops = dev->netdev_ops;
f95ad5036 Florian Fainelli 2019-02-04 922 if (ops->ndo_get_port_parent_id &&
ca3b84139 Florian Fainelli 2019-02-04 923 !ops->ndo_get_port_parent_id(dev, &ppid)) {
ca3b84139 Florian Fainelli 2019-02-04 924 memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
ca3b84139 Florian Fainelli 2019-02-04 925 v->dev_parent_id.id_len = ppid.id_len;
5d8b3e69f Yotam Gigi 2017-10-03 926 } else {
5d8b3e69f Yotam Gigi 2017-10-03 927 v->dev_parent_id.id_len = 0;
5d8b3e69f Yotam Gigi 2017-10-03 928 }
6853f21f7 Yuval Mintz 2018-02-28 929
^1da177e4 Linus Torvalds 2005-04-16 930 v->local = vifc->vifc_lcl_addr.s_addr;
^1da177e4 Linus Torvalds 2005-04-16 931 v->remote = vifc->vifc_rmt_addr.s_addr;
^1da177e4 Linus Torvalds 2005-04-16 932
^1da177e4 Linus Torvalds 2005-04-16 933 /* And finish update writing critical data */
^1da177e4 Linus Torvalds 2005-04-16 934 write_lock_bh(&mrt_lock);
^1da177e4 Linus Torvalds 2005-04-16 935 v->dev = dev;
^1da177e4 Linus Torvalds 2005-04-16 936 if (v->flags & VIFF_REGISTER)
0c12295a7 Patrick McHardy 2010-04-13 937 mrt->mroute_reg_vif_num = vifi;
0c12295a7 Patrick McHardy 2010-04-13 938 if (vifi+1 > mrt->maxvif)
0c12295a7 Patrick McHardy 2010-04-13 939 mrt->maxvif = vifi+1;
^1da177e4 Linus Torvalds 2005-04-16 940 write_unlock_bh(&mrt_lock);
b362053a7 Yotam Gigi 2017-09-27 941 call_ipmr_vif_entry_notifiers(net, FIB_EVENT_VIF_ADD, v, vifi, mrt->id);
^1da177e4 Linus Torvalds 2005-04-16 942 return 0;
^1da177e4 Linus Torvalds 2005-04-16 943 }
^1da177e4 Linus Torvalds 2005-04-16 944
:::::: The code at line 920 was first introduced by commit
:::::: 5d8b3e69fc5e5ccafc9db1251bb7c78a8622fddd ipv4: ipmr: Add the parent ID field to VIF struct
:::::: TO: Yotam Gigi <yotamg@mellanox.com>
:::::: CC: David S. Miller <davem@davemloft.net>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49796 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
* Re: [PATCH 02/12] bnxt: Implement ndo_get_port_parent_id()
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
(?)
(?)
@ 2019-02-05 13:24 ` kbuild test robot
-1 siblings, 0 replies; 41+ messages in thread
From: kbuild test robot @ 2019-02-05 13:24 UTC (permalink / raw)
Cc: John Hurley, Alexandre Belloni, Jakub Kicinski, Andrew Lunn,
open list:NETRONOME ETHERNET DRIVERS, Edwin Peer, Eric Dumazet,
Ioana Ciornei, Microchip Linux Driver Support, Ivan Vecera,
Florian Fainelli, Amritha Nambiar, David S. Miller,
open list:MELLANOX MLX5 core VPI driver,
moderated list:ETHERNET BRIDGE, Saeed Mahameed,
Dirk van der Merwe, Alexey Kuznetsov, Vivien Didelot
[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]
Hi Florian,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
[also build test ERROR on v5.0-rc4 next-20190205]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Florian-Fainelli/net-Introduce-ndo_get_port_parent_id/20190205-163356
config: i386-randconfig-b0-02041055 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c: In function 'bnxt_vf_rep_get_port_parent_id':
>> drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:248:50: error: 'attr' undeclared (first use in this function)
return bnxt_get_port_parent_id(vf_rep->bp->dev, attr);
^
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:248:50: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c:249:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +/attr +248 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
239
240 static int bnxt_vf_rep_get_port_parent_id(struct net_device *dev,
241 struct netdev_phys_item_id *ppid)
242 {
243 struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
244
245 /* as only PORT_PARENT_ID is supported currently use common code
246 * between PF and VF-rep for now.
247 */
> 248 return bnxt_get_port_parent_id(vf_rep->bp->dev, attr);
249 }
250
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33835 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 41+ messages in thread
end of thread, other threads:[~2019-02-05 18:25 UTC | newest]
Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 23:36 [PATCH 00/12] net: Introduce ndo_get_port_parent_id() Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 01/12] " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 02/12] bnxt: Implement ndo_get_port_parent_id() Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-05 9:48 ` kbuild test robot
2019-02-05 13:24 ` kbuild test robot
2019-02-04 23:36 ` [PATCH 03/12] liquidio: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 04/12] net/mlx5e: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 05/12] mlxsw: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 06/12] mscc: ocelot: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 07/12] nfp: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-05 3:49 ` Jakub Kicinski
2019-02-05 3:49 ` [Bridge] " Jakub Kicinski
2019-02-04 23:36 ` [PATCH 08/12] rocker: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 09/12] netdevsim: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-05 3:51 ` Jakub Kicinski
2019-02-05 3:51 ` [Bridge] " Jakub Kicinski
2019-02-05 9:23 ` kbuild test robot
2019-02-05 9:30 ` kbuild test robot
2019-02-04 23:36 ` [PATCH 10/12] staging: fsl-dpaa2: ethsw: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 11/12] net: dsa: " Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-04 23:36 ` [PATCH 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID Florian Fainelli
2019-02-04 23:36 ` [Bridge] " Florian Fainelli
2019-02-05 7:47 ` Ido Schimmel
2019-02-05 7:47 ` [Bridge] " Ido Schimmel
2019-02-05 9:23 ` kbuild test robot
2019-02-05 11:17 ` kbuild test robot
2019-02-05 2:24 ` [PATCH 00/12] net: Introduce ndo_get_port_parent_id() David Miller
2019-02-05 7:14 ` Ido Schimmel
2019-02-05 7:14 ` [Bridge] " Ido Schimmel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.