rocker: Add support for querying supported bridge flags
authorArkadi Sharshevsky <arkadis@mellanox.com>
Thu, 8 Jun 2017 06:44:24 +0000 (08:44 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Jun 2017 18:16:29 +0000 (14:16 -0400)
Add support for querying supported bridge flags.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.h
drivers/net/ethernet/rocker/rocker_main.c
drivers/net/ethernet/rocker/rocker_ofdpa.c

index ee9675db5bf953b92cf46ead04e19f744ba36204..c25e331f2061e99d821390c24550949804325043 100644 (file)
@@ -112,6 +112,10 @@ struct rocker_world_ops {
                                          struct switchdev_trans *trans);
        int (*port_attr_bridge_flags_get)(const struct rocker_port *rocker_port,
                                          unsigned long *p_brport_flags);
+       int (*port_attr_bridge_flags_support_get)(const struct rocker_port *
+                                                 rocker_port,
+                                                 unsigned long *
+                                                 p_brport_flags);
        int (*port_attr_bridge_ageing_time_set)(struct rocker_port *rocker_port,
                                                u32 ageing_time,
                                                struct switchdev_trans *trans);
index bab13613b138cc15c734d9e9fff5f465ef480a44..a741e5163d04616fc8bbf9290af87096f48d5023 100644 (file)
@@ -1584,6 +1584,20 @@ rocker_world_port_attr_bridge_flags_get(const struct rocker_port *rocker_port,
        return wops->port_attr_bridge_flags_get(rocker_port, p_brport_flags);
 }
 
+static int
+rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port *
+                                               rocker_port,
+                                               unsigned long *
+                                               p_brport_flags_support)
+{
+       struct rocker_world_ops *wops = rocker_port->rocker->wops;
+
+       if (!wops->port_attr_bridge_flags_support_get)
+               return -EOPNOTSUPP;
+       return wops->port_attr_bridge_flags_support_get(rocker_port,
+                                                       p_brport_flags_support);
+}
+
 static int
 rocker_world_port_attr_bridge_ageing_time_set(struct rocker_port *rocker_port,
                                              u32 ageing_time,
@@ -2053,6 +2067,10 @@ static int rocker_port_attr_get(struct net_device *dev,
                err = rocker_world_port_attr_bridge_flags_get(rocker_port,
                                                              &attr->u.brport_flags);
                break;
+       case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
+               err = rocker_world_port_attr_bridge_flags_support_get(rocker_port,
+                                                                     &attr->u.brport_flags_support);
+               break;
        default:
                return -EOPNOTSUPP;
        }
index 0b5a58fee9bfdd45e26bd09e82d784ef20aedd75..7528ee7453f51070b59f0a516dee722369658009 100644 (file)
@@ -2642,6 +2642,16 @@ ofdpa_port_attr_bridge_flags_get(const struct rocker_port *rocker_port,
        return 0;
 }
 
+static int
+ofdpa_port_attr_bridge_flags_support_get(const struct rocker_port *
+                                        rocker_port,
+                                        unsigned long *
+                                        p_brport_flags_support)
+{
+       *p_brport_flags_support = BR_LEARNING;
+       return 0;
+}
+
 static int
 ofdpa_port_attr_bridge_ageing_time_set(struct rocker_port *rocker_port,
                                       u32 ageing_time,
@@ -2989,6 +2999,7 @@ struct rocker_world_ops rocker_ofdpa_ops = {
        .port_attr_stp_state_set = ofdpa_port_attr_stp_state_set,
        .port_attr_bridge_flags_set = ofdpa_port_attr_bridge_flags_set,
        .port_attr_bridge_flags_get = ofdpa_port_attr_bridge_flags_get,
+       .port_attr_bridge_flags_support_get = ofdpa_port_attr_bridge_flags_support_get,
        .port_attr_bridge_ageing_time_set = ofdpa_port_attr_bridge_ageing_time_set,
        .port_obj_vlan_add = ofdpa_port_obj_vlan_add,
        .port_obj_vlan_del = ofdpa_port_obj_vlan_del,