rocker: Check Handle PORT_PRE_BRIDGE_FLAGS
In preparation for getting rid of switchdev_port_attr_get(), have rocker check for the bridge flags being set through switchdev_port_attr_set() with the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ea87005a00
commit
93700458ff
|
@ -1565,6 +1565,43 @@ static int rocker_world_port_attr_stp_state_set(struct rocker_port *rocker_port,
|
|||
return wops->port_attr_stp_state_set(rocker_port, state);
|
||||
}
|
||||
|
||||
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_pre_bridge_flags_set(struct rocker_port *rocker_port,
|
||||
unsigned long brport_flags,
|
||||
struct switchdev_trans *trans)
|
||||
{
|
||||
struct rocker_world_ops *wops = rocker_port->rocker->wops;
|
||||
unsigned long brport_flags_s;
|
||||
int err;
|
||||
|
||||
if (!wops->port_attr_bridge_flags_set)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
err = rocker_world_port_attr_bridge_flags_support_get(rocker_port,
|
||||
&brport_flags_s);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (brport_flags & ~brport_flags_s)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port,
|
||||
unsigned long brport_flags,
|
||||
|
@ -1582,20 +1619,6 @@ rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port,
|
|||
trans);
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -2074,6 +2097,10 @@ static int rocker_port_attr_set(struct net_device *dev,
|
|||
attr->u.stp_state,
|
||||
trans);
|
||||
break;
|
||||
case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
|
||||
err = rocker_world_port_attr_pre_bridge_flags_set(rocker_port,
|
||||
attr->u.brport_flags,
|
||||
trans);
|
||||
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
|
||||
err = rocker_world_port_attr_bridge_flags_set(rocker_port,
|
||||
attr->u.brport_flags,
|
||||
|
|
Loading…
Reference in New Issue