[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210203165458.28717-7-vadym.kochan@plvision.eu>
Date: Wed, 3 Feb 2021 18:54:57 +0200
From: Vadym Kochan <vadym.kochan@...ision.eu>
To: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oleksandr Mazur <oleksandr.mazur@...ision.eu>,
Serhiy Boiko <serhiy.boiko@...ision.eu>,
Serhiy Pshyk <serhiy.pshyk@...ision.eu>,
Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>,
Taras Chornyi <taras.chornyi@...ision.eu>,
netdev@...r.kernel.org
Cc: Mickey Rachamim <mickeyr@...vell.com>,
Vadym Kochan <vadym.kochan@...ision.eu>,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next 6/7] net: marvell: prestera: align flood setting according to latest firmware version
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@...ision.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(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_hw.c b/drivers/net/ethernet/marvell/prestera/prestera_hw.c
index 8afb45f66862..75034dcb3649 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_hw.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_hw.c
@@ -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,
+ }
}
};
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_hw.h b/drivers/net/ethernet/marvell/prestera/prestera_hw.h
index 68ce41595349..03b52db6f359 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_hw.h
+++ b/drivers/net/ethernet/marvell/prestera/prestera_hw.h
@@ -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 */
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c b/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
index 3750c66a550b..8449539fe944 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
@@ -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;
}
--
2.17.1
Powered by blists - more mailing lists