@@ -90,6 +90,11 @@ enum {
PRESTERA_PORT_TP_AUTO,
};
+enum {
+ PRESTERA_PORT_FLOOD_TYPE_UC = 0,
+ PRESTERA_PORT_FLOOD_TYPE_MC = 1,
+};
+
enum {
PRESTERA_PORT_GOOD_OCTETS_RCV_CNT,
PRESTERA_PORT_BAD_OCTETS_RCV_CNT,
@@ -201,6 +206,11 @@ struct prestera_msg_port_mdix_param {
u8 admin_mode;
};
+struct prestera_msg_port_flood_param {
+ u8 type;
+ u8 enable;
+};
+
union prestera_msg_port_param {
u8 admin_state;
u8 oper_state;
@@ -209,7 +219,6 @@ union prestera_msg_port_param {
u8 accept_frm_type;
u32 speed;
u8 learning;
- u8 flood;
u32 link_mode;
u8 type;
u8 duplex;
@@ -218,6 +227,7 @@ union prestera_msg_port_param {
struct prestera_msg_port_mdix_param mdix;
struct prestera_msg_port_autoneg_param autoneg;
struct prestera_msg_port_cap_param cap;
+ struct prestera_msg_port_flood_param flood;
};
struct prestera_msg_port_attr_req {
@@ -1030,14 +1040,35 @@ int prestera_hw_port_learning_set(struct prestera_port *port, bool enable)
&req.cmd, sizeof(req));
}
-int prestera_hw_port_flood_set(struct prestera_port *port, bool flood)
+int prestera_hw_port_uc_flood_set(struct prestera_port *port, bool flood)
+{
+ struct prestera_msg_port_attr_req req = {
+ .attr = PRESTERA_CMD_PORT_ATTR_FLOOD,
+ .port = port->hw_id,
+ .dev = port->dev_id,
+ .param = {
+ .flood = {
+ .type = PRESTERA_PORT_FLOOD_TYPE_UC,
+ .enable = flood,
+ }
+ }
+ };
+
+ return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET,
+ &req.cmd, sizeof(req));
+}
+
+int prestera_hw_port_mc_flood_set(struct prestera_port *port, bool flood)
{
struct prestera_msg_port_attr_req req = {
.attr = PRESTERA_CMD_PORT_ATTR_FLOOD,
.port = port->hw_id,
.dev = port->dev_id,
.param = {
- .flood = flood,
+ .flood = {
+ .type = PRESTERA_PORT_FLOOD_TYPE_MC,
+ .enable = flood,
+ }
}
};
@@ -138,7 +138,8 @@ int prestera_hw_port_mdix_get(const struct prestera_port *port, u8 *status,
int prestera_hw_port_mdix_set(const struct prestera_port *port, u8 mode);
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_flood_set(struct prestera_port *port, bool flood);
+int prestera_hw_port_uc_flood_set(struct prestera_port *port, bool flood);
+int prestera_hw_port_mc_flood_set(struct prestera_port *port, bool flood);
int prestera_hw_port_accept_frm_type(struct prestera_port *port,
enum prestera_accept_frm_type type);
/* Vlan API */
@@ -443,9 +443,13 @@ prestera_bridge_1d_port_join(struct prestera_bridge_port *br_port,
if (err)
return err;
- err = prestera_hw_port_flood_set(port, br_port->flags & BR_FLOOD);
+ err = prestera_hw_port_uc_flood_set(port, br_port->flags & BR_FLOOD);
if (err)
- goto err_port_flood_set;
+ goto err_port_uc_flood_set;
+
+ err = prestera_hw_port_mc_flood_set(port, br_port->flags & BR_MCAST_FLOOD);
+ if (err)
+ goto err_port_mc_flood_set;
err = prestera_hw_port_learning_set(port, br_port->flags & BR_LEARNING);
if (err)
@@ -454,8 +458,10 @@ prestera_bridge_1d_port_join(struct prestera_bridge_port *br_port,
return 0;
err_port_learning_set:
- prestera_hw_port_flood_set(port, false);
-err_port_flood_set:
+ prestera_hw_port_mc_flood_set(port, false);
+err_port_mc_flood_set:
+ prestera_hw_port_uc_flood_set(port, false);
+err_port_uc_flood_set:
prestera_hw_bridge_port_delete(port, bridge->bridge_id);
return err;
@@ -567,7 +573,8 @@ static void prestera_port_bridge_leave(struct prestera_port *port,
prestera_bridge_1d_port_leave(br_port, port);
prestera_hw_port_learning_set(port, false);
- prestera_hw_port_flood_set(port, false);
+ prestera_hw_port_uc_flood_set(port, false);
+ prestera_hw_port_mc_flood_set(port, false);
prestera_port_vid_stp_set(port, PRESTERA_VID_ALL, BR_STATE_FORWARDING);
prestera_bridge_port_put(br_port);
}
@@ -609,17 +616,28 @@ static int prestera_port_attr_br_flags_set(struct prestera_port *port,
if (!br_port)
return 0;
- err = prestera_hw_port_flood_set(port, flags & BR_FLOOD);
+ err = prestera_hw_port_uc_flood_set(port, flags & BR_FLOOD);
if (err)
- return err;
+ goto err_port_uc_flood_set;
+
+ err = prestera_hw_port_mc_flood_set(port, flags & BR_MCAST_FLOOD);
+ if (err)
+ goto err_port_mc_flood_set;
err = prestera_hw_port_learning_set(port, flags & BR_LEARNING);
if (err)
- return err;
+ goto err_port_learning_set;
memcpy(&br_port->flags, &flags, sizeof(flags));
return 0;
+
+err_port_learning_set:
+ prestera_hw_port_mc_flood_set(port, false);
+err_port_mc_flood_set:
+ prestera_hw_port_uc_flood_set(port, false);
+err_port_uc_flood_set:
+ return err;
}
static int prestera_port_attr_br_ageing_set(struct prestera_port *port,
@@ -914,9 +932,13 @@ prestera_port_vlan_bridge_join(struct prestera_port_vlan *port_vlan,
if (port_vlan->br_port)
return 0;
- err = prestera_hw_port_flood_set(port, br_port->flags & BR_FLOOD);
+ err = prestera_hw_port_uc_flood_set(port, br_port->flags & BR_FLOOD);
if (err)
- return err;
+ goto err_port_uc_flood_set;
+
+ err = prestera_hw_port_mc_flood_set(port, br_port->flags & BR_MCAST_FLOOD);
+ if (err)
+ goto err_port_mc_flood_set;
err = prestera_hw_port_learning_set(port, br_port->flags & BR_LEARNING);
if (err)
@@ -947,6 +969,10 @@ prestera_port_vlan_bridge_join(struct prestera_port_vlan *port_vlan,
err_port_vid_stp_set:
prestera_hw_port_learning_set(port, false);
err_port_learning_set:
+ prestera_hw_port_mc_flood_set(port, false);
+err_port_mc_flood_set:
+ prestera_hw_port_uc_flood_set(port, false);
+err_port_uc_flood_set:
return err;
}
Latest FW IPC floow message format was changed to configure uc/mc flooding separately, so change code according to this. Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu> --- .../ethernet/marvell/prestera/prestera_hw.c | 37 +++++++++++++-- .../ethernet/marvell/prestera/prestera_hw.h | 3 +- .../marvell/prestera/prestera_switchdev.c | 46 +++++++++++++++---- 3 files changed, 72 insertions(+), 14 deletions(-)