Commit 73ef239c authored by Oleksandr Mazur's avatar Oleksandr Mazur Committed by David S. Miller

net: marvell: prestera: implement br_port_locked flag offloading

Both <port> br_port_locked and <lag> interfaces's flag
offloading is supported. No new ABI is being added,
rather existing (port_param_set) API call gets extended.
Signed-off-by: default avatarOleksandr Mazur <oleksandr.mazur@plvision.eu>

V2:
  add missing receipents (linux-kernel, netdev)
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0d0f034d
...@@ -367,6 +367,8 @@ int prestera_port_learning_set(struct prestera_port *port, bool learn_enable); ...@@ -367,6 +367,8 @@ int prestera_port_learning_set(struct prestera_port *port, bool learn_enable);
int prestera_port_uc_flood_set(struct prestera_port *port, bool flood); int prestera_port_uc_flood_set(struct prestera_port *port, bool flood);
int prestera_port_mc_flood_set(struct prestera_port *port, bool flood); int prestera_port_mc_flood_set(struct prestera_port *port, bool flood);
int prestera_port_br_locked_set(struct prestera_port *port, bool br_locked);
int prestera_port_pvid_set(struct prestera_port *port, u16 vid); int prestera_port_pvid_set(struct prestera_port *port, u16 vid);
bool prestera_netdev_check(const struct net_device *dev); bool prestera_netdev_check(const struct net_device *dev);
......
...@@ -101,6 +101,7 @@ enum { ...@@ -101,6 +101,7 @@ enum {
PRESTERA_CMD_PORT_ATTR_LEARNING = 7, PRESTERA_CMD_PORT_ATTR_LEARNING = 7,
PRESTERA_CMD_PORT_ATTR_FLOOD = 8, PRESTERA_CMD_PORT_ATTR_FLOOD = 8,
PRESTERA_CMD_PORT_ATTR_CAPABILITY = 9, PRESTERA_CMD_PORT_ATTR_CAPABILITY = 9,
PRESTERA_CMD_PORT_ATTR_LOCKED = 10,
PRESTERA_CMD_PORT_ATTR_PHY_MODE = 12, PRESTERA_CMD_PORT_ATTR_PHY_MODE = 12,
PRESTERA_CMD_PORT_ATTR_TYPE = 13, PRESTERA_CMD_PORT_ATTR_TYPE = 13,
PRESTERA_CMD_PORT_ATTR_STATS = 17, PRESTERA_CMD_PORT_ATTR_STATS = 17,
...@@ -285,6 +286,7 @@ union prestera_msg_port_param { ...@@ -285,6 +286,7 @@ union prestera_msg_port_param {
u8 duplex; u8 duplex;
u8 fec; u8 fec;
u8 fc; u8 fc;
u8 br_locked;
union { union {
struct { struct {
u8 admin; u8 admin;
...@@ -1640,6 +1642,22 @@ int prestera_hw_port_mc_flood_set(const struct prestera_port *port, bool flood) ...@@ -1640,6 +1642,22 @@ int prestera_hw_port_mc_flood_set(const struct prestera_port *port, bool flood)
&req.cmd, sizeof(req)); &req.cmd, sizeof(req));
} }
int prestera_hw_port_br_locked_set(const struct prestera_port *port,
bool br_locked)
{
struct prestera_msg_port_attr_req req = {
.attr = __cpu_to_le32(PRESTERA_CMD_PORT_ATTR_LOCKED),
.port = __cpu_to_le32(port->hw_id),
.dev = __cpu_to_le32(port->dev_id),
.param = {
.br_locked = br_locked,
}
};
return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET,
&req.cmd, sizeof(req));
}
int prestera_hw_vlan_create(struct prestera_switch *sw, u16 vid) int prestera_hw_vlan_create(struct prestera_switch *sw, u16 vid)
{ {
struct prestera_msg_vlan_req req = { struct prestera_msg_vlan_req req = {
......
...@@ -183,6 +183,8 @@ int prestera_hw_port_speed_get(const struct prestera_port *port, u32 *speed); ...@@ -183,6 +183,8 @@ int prestera_hw_port_speed_get(const struct prestera_port *port, u32 *speed);
int prestera_hw_port_learning_set(struct prestera_port *port, bool enable); int prestera_hw_port_learning_set(struct prestera_port *port, bool enable);
int prestera_hw_port_uc_flood_set(const struct prestera_port *port, bool flood); int prestera_hw_port_uc_flood_set(const struct prestera_port *port, bool flood);
int prestera_hw_port_mc_flood_set(const struct prestera_port *port, bool flood); int prestera_hw_port_mc_flood_set(const struct prestera_port *port, bool flood);
int prestera_hw_port_br_locked_set(const struct prestera_port *port,
bool br_locked);
int prestera_hw_port_accept_frm_type(struct prestera_port *port, int prestera_hw_port_accept_frm_type(struct prestera_port *port,
enum prestera_accept_frm_type type); enum prestera_accept_frm_type type);
/* Vlan API */ /* Vlan API */
......
...@@ -51,6 +51,11 @@ int prestera_port_mc_flood_set(struct prestera_port *port, bool flood) ...@@ -51,6 +51,11 @@ int prestera_port_mc_flood_set(struct prestera_port *port, bool flood)
return prestera_hw_port_mc_flood_set(port, flood); return prestera_hw_port_mc_flood_set(port, flood);
} }
int prestera_port_br_locked_set(struct prestera_port *port, bool br_locked)
{
return prestera_hw_port_br_locked_set(port, br_locked);
}
int prestera_port_pvid_set(struct prestera_port *port, u16 vid) int prestera_port_pvid_set(struct prestera_port *port, u16 vid)
{ {
enum prestera_accept_frm_type frm_type; enum prestera_accept_frm_type frm_type;
......
...@@ -143,6 +143,7 @@ prestera_br_port_flags_reset(struct prestera_bridge_port *br_port, ...@@ -143,6 +143,7 @@ prestera_br_port_flags_reset(struct prestera_bridge_port *br_port,
prestera_port_uc_flood_set(port, false); prestera_port_uc_flood_set(port, false);
prestera_port_mc_flood_set(port, false); prestera_port_mc_flood_set(port, false);
prestera_port_learning_set(port, false); prestera_port_learning_set(port, false);
prestera_port_br_locked_set(port, false);
} }
static int prestera_br_port_flags_set(struct prestera_bridge_port *br_port, static int prestera_br_port_flags_set(struct prestera_bridge_port *br_port,
...@@ -162,6 +163,11 @@ static int prestera_br_port_flags_set(struct prestera_bridge_port *br_port, ...@@ -162,6 +163,11 @@ static int prestera_br_port_flags_set(struct prestera_bridge_port *br_port,
if (err) if (err)
goto err_out; goto err_out;
err = prestera_port_br_locked_set(port,
br_port->flags & BR_PORT_LOCKED);
if (err)
goto err_out;
return 0; return 0;
err_out: err_out:
...@@ -1163,7 +1169,7 @@ static int prestera_port_obj_attr_set(struct net_device *dev, const void *ctx, ...@@ -1163,7 +1169,7 @@ static int prestera_port_obj_attr_set(struct net_device *dev, const void *ctx,
break; break;
case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS: case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
if (attr->u.brport_flags.mask & if (attr->u.brport_flags.mask &
~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD)) ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_PORT_LOCKED))
err = -EINVAL; err = -EINVAL;
break; break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment