@@ -85,6 +85,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,
@@ -188,6 +193,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;
@@ -196,7 +206,6 @@ union prestera_msg_port_param {
u8 accept_frm_type;
u32 speed;
u8 learning;
- u8 flood;
u32 link_mode;
u8 type;
u8 duplex;
@@ -205,6 +214,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 {
@@ -988,14 +998,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 */
@@ -404,9 +404,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)
@@ -415,8 +419,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;
@@ -528,7 +534,8 @@ static void prestera_port_bridge_leave(struct prestera_port *port,
prestera_bridge_1d_port_leave(br_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);
}
@@ -591,21 +598,36 @@ static int prestera_port_attr_br_flags_set(struct prestera_port *port,
return 0;
if (flags.mask & BR_FLOOD) {
- err = prestera_hw_port_flood_set(port, flags.val & BR_FLOOD);
+ err = prestera_hw_port_uc_flood_set(port,
+ flags.val & BR_FLOOD);
+ if (err)
+ goto err_port_uc_flood_set;
+ }
+
+ if (flags.mask & BR_MCAST_FLOOD) {
+ err = prestera_hw_port_mc_flood_set(port,
+ flags.val & BR_MCAST_FLOOD);
if (err)
- return err;
+ goto err_port_mc_flood_set;
}
if (flags.mask & BR_LEARNING) {
err = prestera_hw_port_learning_set(port,
flags.val & BR_LEARNING);
if (err)
- return err;
+ goto err_port_learning_set;
}
memcpy(&br_port->flags, &flags.val, sizeof(flags.val));
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,
@@ -901,9 +923,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)
@@ -934,6 +960,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;
}