Subject: Re: [PATCH net-next 01/13] mlxsw: Configure egress VID for unicast FDB entries

From: Ido Schimmel <[email-masked]>
Date: Fri, 1 Jul 2022 18:23:26 +0300

On Thu, Jun 30, 2022 at 08:17:09PM -0700, Jakub Kicinski wrote:
> On Thu, 30 Jun 2022 11:22:45 +0300 Ido Schimmel wrote:
> > From: Amit Cohen <[email-masked]>
> > 
> > Using unified bridge model, firmware no longer configures the egress VID
> > "under the hood" and moves this responsibility to software.
> > 
> > For layer 2, this means that software needs to determine the egress VID
> > for both unicast (i.e., FDB) and multicast (i.e., MDB and flooding) flows.
> > 
> > Unicast FDB records and unicast LAG FDB records have new fields - "set_vid"
> > and "vid", set them. For records which point to router port, do not set
> > these fields.
> 
> clang seems to have a legitimate complaint:

Yes, thanks. Need something like the below. Will add clang to my build
scripts and see if I can get nipa working with our internal patchwork.

```
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 6fb7fafdd2dc..352998d8e56d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -2931,10 +2931,9 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
 	struct mlxsw_sp_bridge_device *bridge_device;
 	struct mlxsw_sp_bridge_port *bridge_port;
 	struct mlxsw_sp_port *mlxsw_sp_port;
+	u16 local_port, vid, fid, evid = 0;
 	enum switchdev_notifier_type type;
 	char mac[ETH_ALEN];
-	u16 local_port;
-	u16 vid, fid;
 	bool do_notification = true;
 	int err;
 
@@ -2965,10 +2964,11 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
 
 	bridge_device = bridge_port->bridge_device;
 	vid = bridge_device->vlan_enabled ? mlxsw_sp_port_vlan->vid : 0;
+	evid = mlxsw_sp_port_vlan->vid;
 
 do_fdb_op:
-	err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid,
-				      mlxsw_sp_port_vlan->vid, adding, true);
+	err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, evid,
+				      adding, true);
 	if (err) {
 		dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to set FDB entry\n");
 		return;
```