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

From: Jakub Kicinski <[email-masked]>
Date: Thu, 30 Jun 2022 20:17:09 -0700

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:

drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2928:6: warning: variable 'mlxsw_sp_port_vlan' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (mlxsw_sp_fid_is_dummy(mlxsw_sp, fid))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2948:11: note: uninitialized use occurs here
                                      mlxsw_sp_port_vlan->vid, adding, true);
                                      ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2928:2: note: remove the 'if' if its condition is always false
        if (mlxsw_sp_fid_is_dummy(mlxsw_sp, fid))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2923:6: warning: variable 'mlxsw_sp_port_vlan' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (!mlxsw_sp_port) {
            ^~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2948:11: note: uninitialized use occurs here
                                      mlxsw_sp_port_vlan->vid, adding, true);
                                      ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2923:2: note: remove the 'if' if its condition is always false
        if (!mlxsw_sp_port) {
        ^~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2907:47: note: initialize the variable 'mlxsw_sp_port_vlan' to silence this warning
        struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
                                                     ^
                                                      = NULL