summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/rocker/rocker.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2015-08-27 09:31:22 +0200
committerDavid S. Miller <davem@davemloft.net>2015-08-27 16:28:35 -0700
commitfb4bf214346e37778bcf00a89bfb90112859b23c (patch)
treef48a7221dbef82f138746c04948cf7ce21dbbbb0 /drivers/net/ethernet/rocker/rocker.c
parent0dc1549bfd67053181415a3f7544628a6bcd2a08 (diff)
rocker: use new helper to figure out master kind
Looking at rtnl kind string is kind of ugly. So use new helpers to do this in nicer way. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Scott Feldman <sfeldma@gmail.com Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/rocker/rocker.c')
-rw-r--r--drivers/net/ethernet/rocker/rocker.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index a7cb74ac4758..62f383c84a66 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -322,21 +322,16 @@ static u16 rocker_port_vlan_to_vid(const struct rocker_port *rocker_port,
return ntohs(vlan_id);
}
-static bool rocker_port_is_slave(const struct rocker_port *rocker_port,
- const char *kind)
-{
- return rocker_port->bridge_dev &&
- !strcmp(rocker_port->bridge_dev->rtnl_link_ops->kind, kind);
-}
-
static bool rocker_port_is_bridged(const struct rocker_port *rocker_port)
{
- return rocker_port_is_slave(rocker_port, "bridge");
+ return rocker_port->bridge_dev &&
+ netif_is_bridge_master(rocker_port->bridge_dev);
}
static bool rocker_port_is_ovsed(const struct rocker_port *rocker_port)
{
- return rocker_port_is_slave(rocker_port, "openvswitch");
+ return rocker_port->bridge_dev &&
+ netif_is_ovs_master(rocker_port->bridge_dev);
}
#define ROCKER_OP_FLAG_REMOVE BIT(0)
@@ -5338,10 +5333,10 @@ static int rocker_port_master_changed(struct net_device *dev)
int err = 0;
/* N.B: Do nothing if the type of master is not supported */
- if (master && master->rtnl_link_ops) {
- if (!strcmp(master->rtnl_link_ops->kind, "bridge"))
+ if (master) {
+ if (netif_is_bridge_master(master))
err = rocker_port_bridge_join(rocker_port, master);
- else if (!strcmp(master->rtnl_link_ops->kind, "openvswitch"))
+ else if (netif_is_ovs_master(master))
err = rocker_port_ovs_changed(rocker_port, master);
} else if (rocker_port_is_bridged(rocker_port)) {
err = rocker_port_bridge_leave(rocker_port);