mlxsw: spectrum_router: Access rif->dev through a helper
authorPetr Machata <petrm@nvidia.com>
Mon, 12 Jun 2023 15:31:02 +0000 (17:31 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Wed, 14 Jun 2023 11:12:20 +0000 (13:12 +0200)
In order to abstract away deduction of netdevice from the corresponding
RIF, introduce a helper, mlxsw_sp_rif_dev(), and use it throughout. This
will make it possible to change the deduction path easily later on.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 2c3dcbc2f9a602033a1af060aea7704f85ce84b8..e9183c223575e38915f80aa445188580d4322067 100644 (file)
@@ -71,6 +71,11 @@ struct mlxsw_sp_rif {
        bool counter_egress_valid;
 };
 
+static struct net_device *mlxsw_sp_rif_dev(const struct mlxsw_sp_rif *rif)
+{
+       return rif->dev;
+}
+
 struct mlxsw_sp_rif_params {
        struct net_device *dev;
        union {
@@ -1560,6 +1565,7 @@ mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif, u16 ul_vr_id,
                        u16 ul_rif_id, bool enable)
 {
        struct mlxsw_sp_rif_ipip_lb_config lb_cf = lb_rif->lb_config;
+       struct net_device *dev = mlxsw_sp_rif_dev(&lb_rif->common);
        enum mlxsw_reg_ritr_loopback_ipip_options ipip_options;
        struct mlxsw_sp_rif *rif = &lb_rif->common;
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
@@ -1572,7 +1578,7 @@ mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif, u16 ul_vr_id,
        case MLXSW_SP_L3_PROTO_IPV4:
                saddr4 = be32_to_cpu(lb_cf.saddr.addr4);
                mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
-                                   rif->rif_index, rif->vr_id, rif->dev->mtu);
+                                   rif->rif_index, rif->vr_id, dev->mtu);
                mlxsw_reg_ritr_loopback_ipip4_pack(ritr_pl, lb_cf.lb_ipipt,
                                                   ipip_options, ul_vr_id,
                                                   ul_rif_id, saddr4,
@@ -1582,7 +1588,7 @@ mlxsw_sp_rif_ipip_lb_op(struct mlxsw_sp_rif_ipip_lb *lb_rif, u16 ul_vr_id,
        case MLXSW_SP_L3_PROTO_IPV6:
                saddr6 = &lb_cf.saddr.addr6;
                mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_LOOPBACK_IF,
-                                   rif->rif_index, rif->vr_id, rif->dev->mtu);
+                                   rif->rif_index, rif->vr_id, dev->mtu);
                mlxsw_reg_ritr_loopback_ipip6_pack(ritr_pl, lb_cf.lb_ipipt,
                                                   ipip_options, ul_vr_id,
                                                   ul_rif_id, saddr6,
@@ -2332,7 +2338,7 @@ static void mlxsw_sp_router_neigh_ent_ipv4_process(struct mlxsw_sp *mlxsw_sp,
        }
 
        dipn = htonl(dip);
-       dev = mlxsw_sp->router->rifs[rif]->dev;
+       dev = mlxsw_sp_rif_dev(mlxsw_sp->router->rifs[rif]);
        n = neigh_lookup(&arp_tbl, &dipn, dev);
        if (!n)
                return;
@@ -2360,7 +2366,7 @@ static void mlxsw_sp_router_neigh_ent_ipv6_process(struct mlxsw_sp *mlxsw_sp,
                return;
        }
 
-       dev = mlxsw_sp->router->rifs[rif]->dev;
+       dev = mlxsw_sp_rif_dev(mlxsw_sp->router->rifs[rif]);
        n = neigh_lookup(&nd_tbl, &dip, dev);
        if (!n)
                return;
@@ -4368,6 +4374,7 @@ static void mlxsw_sp_nexthop4_event(struct mlxsw_sp *mlxsw_sp,
 static void mlxsw_sp_nexthop_rif_update(struct mlxsw_sp *mlxsw_sp,
                                        struct mlxsw_sp_rif *rif)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct mlxsw_sp_nexthop *nh;
        bool removing;
 
@@ -4377,7 +4384,7 @@ static void mlxsw_sp_nexthop_rif_update(struct mlxsw_sp *mlxsw_sp,
                        removing = false;
                        break;
                case MLXSW_SP_NEXTHOP_TYPE_IPIP:
-                       removing = !mlxsw_sp_ipip_netdev_ul_up(rif->dev);
+                       removing = !mlxsw_sp_ipip_netdev_ul_up(dev);
                        break;
                default:
                        WARN_ON(1);
@@ -7798,7 +7805,7 @@ mlxsw_sp_rif_should_config(struct mlxsw_sp_rif *rif, struct net_device *dev,
                        return true;
 
                if (rif && addr_list_empty &&
-                   !netif_is_l3_slave(rif->dev))
+                   !netif_is_l3_slave(mlxsw_sp_rif_dev(rif)))
                        return true;
                /* It is possible we already removed the RIF ourselves
                 * if it was assigned to a netdev that is now a bridge
@@ -7895,7 +7902,8 @@ u16 mlxsw_sp_ipip_lb_rif_index(const struct mlxsw_sp_rif_ipip_lb *lb_rif)
 
 u16 mlxsw_sp_ipip_lb_ul_vr_id(const struct mlxsw_sp_rif_ipip_lb *lb_rif)
 {
-       u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(lb_rif->common.dev);
+       struct net_device *dev = mlxsw_sp_rif_dev(&lb_rif->common);
+       u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(dev);
        struct mlxsw_sp_vr *ul_vr;
 
        ul_vr = mlxsw_sp_vr_get(lb_rif->common.mlxsw_sp, ul_tb_id, NULL);
@@ -8072,12 +8080,7 @@ mlxsw_sp_router_hwstats_notify_schedule(struct net_device *dev)
 
 int mlxsw_sp_rif_dev_ifindex(const struct mlxsw_sp_rif *rif)
 {
-       return rif->dev->ifindex;
-}
-
-static const struct net_device *mlxsw_sp_rif_dev(const struct mlxsw_sp_rif *rif)
-{
-       return rif->dev;
+       return mlxsw_sp_rif_dev(rif)->ifindex;
 }
 
 bool mlxsw_sp_rif_has_dev(const struct mlxsw_sp_rif *rif)
@@ -8096,7 +8099,7 @@ static void mlxsw_sp_rif_push_l3_stats(struct mlxsw_sp_rif *rif)
        struct rtnl_hw_stats64 stats = {};
 
        if (!mlxsw_sp_router_port_l3_stats_fetch(rif, &stats))
-               netdev_offload_xstats_push_delta(rif->dev,
+               netdev_offload_xstats_push_delta(mlxsw_sp_rif_dev(rif),
                                                 NETDEV_OFFLOAD_XSTATS_TYPE_L3,
                                                 &stats);
 }
@@ -8198,6 +8201,7 @@ err_rif_index_alloc:
 
 static void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        const struct mlxsw_sp_rif_ops *ops = rif->ops;
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        struct mlxsw_sp_fid *fid = rif->fid;
@@ -8210,11 +8214,10 @@ static void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif)
        mlxsw_sp_router_rif_gone_sync(mlxsw_sp, rif);
        vr = &mlxsw_sp->router->vrs[rif->vr_id];
 
-       if (netdev_offload_xstats_enabled(rif->dev,
-                                         NETDEV_OFFLOAD_XSTATS_TYPE_L3)) {
+       if (netdev_offload_xstats_enabled(dev, NETDEV_OFFLOAD_XSTATS_TYPE_L3)) {
                mlxsw_sp_rif_push_l3_stats(rif);
                mlxsw_sp_router_port_l3_stats_disable(rif);
-               mlxsw_sp_router_hwstats_notify_schedule(rif->dev);
+               mlxsw_sp_router_hwstats_notify_schedule(dev);
        } else {
                mlxsw_sp_rif_counters_free(rif);
        }
@@ -8226,7 +8229,7 @@ static void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif)
                /* Loopback RIFs are not associated with a FID. */
                mlxsw_sp_fid_put(fid);
        mlxsw_sp->router->rifs[rif->rif_index] = NULL;
-       dev_put(rif->dev);
+       dev_put(dev);
        kfree(rif);
        mlxsw_sp_rif_index_free(mlxsw_sp, rif_index, rif_entries);
        vr->rif_count--;
@@ -9012,7 +9015,7 @@ mlxsw_sp_router_port_change_event(struct mlxsw_sp *mlxsw_sp,
                                  struct mlxsw_sp_rif *rif,
                                  struct netlink_ext_ack *extack)
 {
-       struct net_device *dev = rif->dev;
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        u8 old_mac_profile;
        u16 fid_index;
        int err;
@@ -9348,15 +9351,16 @@ static int __mlxsw_sp_rif_macvlan_flush(struct net_device *dev,
 
 static int mlxsw_sp_rif_macvlan_flush(struct mlxsw_sp_rif *rif)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct netdev_nested_priv priv = {
                .data = (void *)rif,
        };
 
-       if (!netif_is_macvlan_port(rif->dev))
+       if (!netif_is_macvlan_port(dev))
                return 0;
 
-       netdev_warn(rif->dev, "Router interface is deleted. Upper macvlans will not work\n");
-       return netdev_walk_all_upper_dev_rcu(rif->dev,
+       netdev_warn(dev, "Router interface is deleted. Upper macvlans will not work\n");
+       return netdev_walk_all_upper_dev_rcu(dev,
                                             __mlxsw_sp_rif_macvlan_flush, &priv);
 }
 
@@ -9377,6 +9381,7 @@ static void mlxsw_sp_rif_subport_setup(struct mlxsw_sp_rif *rif,
 
 static int mlxsw_sp_rif_subport_op(struct mlxsw_sp_rif *rif, bool enable)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        struct mlxsw_sp_rif_subport *rif_subport;
        char ritr_pl[MLXSW_REG_RITR_LEN];
@@ -9384,8 +9389,8 @@ static int mlxsw_sp_rif_subport_op(struct mlxsw_sp_rif *rif, bool enable)
 
        rif_subport = mlxsw_sp_rif_subport_rif(rif);
        mlxsw_reg_ritr_pack(ritr_pl, enable, MLXSW_REG_RITR_SP_IF,
-                           rif->rif_index, rif->vr_id, rif->dev->mtu);
-       mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr);
+                           rif->rif_index, rif->vr_id, dev->mtu);
+       mlxsw_reg_ritr_mac_pack(ritr_pl, dev->dev_addr);
        mlxsw_reg_ritr_if_mac_profile_id_set(ritr_pl, rif->mac_profile_id);
        efid = mlxsw_sp_fid_index(rif->fid);
        mlxsw_reg_ritr_sp_if_pack(ritr_pl, rif_subport->lag,
@@ -9398,6 +9403,7 @@ static int mlxsw_sp_rif_subport_op(struct mlxsw_sp_rif *rif, bool enable)
 static int mlxsw_sp_rif_subport_configure(struct mlxsw_sp_rif *rif,
                                          struct netlink_ext_ack *extack)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        u8 mac_profile;
        int err;
 
@@ -9411,7 +9417,7 @@ static int mlxsw_sp_rif_subport_configure(struct mlxsw_sp_rif *rif,
        if (err)
                goto err_rif_subport_op;
 
-       err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                                  mlxsw_sp_fid_index(rif->fid), true);
        if (err)
                goto err_rif_fdb_op;
@@ -9423,7 +9429,7 @@ static int mlxsw_sp_rif_subport_configure(struct mlxsw_sp_rif *rif,
        return 0;
 
 err_fid_rif_set:
-       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                            mlxsw_sp_fid_index(rif->fid), false);
 err_rif_fdb_op:
        mlxsw_sp_rif_subport_op(rif, false);
@@ -9434,10 +9440,11 @@ err_rif_subport_op:
 
 static void mlxsw_sp_rif_subport_deconfigure(struct mlxsw_sp_rif *rif)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct mlxsw_sp_fid *fid = rif->fid;
 
        mlxsw_sp_fid_rif_unset(fid);
-       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                            mlxsw_sp_fid_index(fid), false);
        mlxsw_sp_rif_macvlan_flush(rif);
        mlxsw_sp_rif_subport_op(rif, false);
@@ -9463,12 +9470,13 @@ static const struct mlxsw_sp_rif_ops mlxsw_sp_rif_subport_ops = {
 static int mlxsw_sp_rif_fid_op(struct mlxsw_sp_rif *rif, u16 fid, bool enable)
 {
        enum mlxsw_reg_ritr_if_type type = MLXSW_REG_RITR_FID_IF;
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        char ritr_pl[MLXSW_REG_RITR_LEN];
 
        mlxsw_reg_ritr_pack(ritr_pl, enable, type, rif->rif_index, rif->vr_id,
-                           rif->dev->mtu);
-       mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr);
+                           dev->mtu);
+       mlxsw_reg_ritr_mac_pack(ritr_pl, dev->dev_addr);
        mlxsw_reg_ritr_if_mac_profile_id_set(ritr_pl, rif->mac_profile_id);
        mlxsw_reg_ritr_fid_if_fid_set(ritr_pl, fid);
 
@@ -9483,6 +9491,7 @@ u16 mlxsw_sp_router_port(const struct mlxsw_sp *mlxsw_sp)
 static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif,
                                      struct netlink_ext_ack *extack)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        u16 fid_index = mlxsw_sp_fid_index(rif->fid);
        u8 mac_profile;
@@ -9508,7 +9517,7 @@ static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif,
        if (err)
                goto err_fid_bc_flood_set;
 
-       err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                                  mlxsw_sp_fid_index(rif->fid), true);
        if (err)
                goto err_rif_fdb_op;
@@ -9520,7 +9529,7 @@ static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif,
        return 0;
 
 err_fid_rif_set:
-       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                            mlxsw_sp_fid_index(rif->fid), false);
 err_rif_fdb_op:
        mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC,
@@ -9537,12 +9546,13 @@ err_rif_fid_op:
 
 static void mlxsw_sp_rif_fid_deconfigure(struct mlxsw_sp_rif *rif)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        u16 fid_index = mlxsw_sp_fid_index(rif->fid);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        struct mlxsw_sp_fid *fid = rif->fid;
 
        mlxsw_sp_fid_rif_unset(fid);
-       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                            mlxsw_sp_fid_index(fid), false);
        mlxsw_sp_rif_macvlan_flush(rif);
        mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC,
@@ -9557,7 +9567,9 @@ static struct mlxsw_sp_fid *
 mlxsw_sp_rif_fid_fid_get(struct mlxsw_sp_rif *rif,
                         struct netlink_ext_ack *extack)
 {
-       return mlxsw_sp_fid_8021d_get(rif->mlxsw_sp, rif->dev->ifindex);
+       int rif_ifindex = mlxsw_sp_rif_dev_ifindex(rif);
+
+       return mlxsw_sp_fid_8021d_get(rif->mlxsw_sp, rif_ifindex);
 }
 
 static void mlxsw_sp_rif_fid_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
@@ -9565,7 +9577,7 @@ static void mlxsw_sp_rif_fid_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
        struct switchdev_notifier_fdb_info info = {};
        struct net_device *dev;
 
-       dev = br_fdb_find_port(rif->dev, mac, 0);
+       dev = br_fdb_find_port(mlxsw_sp_rif_dev(rif), mac, 0);
        if (!dev)
                return;
 
@@ -9588,17 +9600,18 @@ static struct mlxsw_sp_fid *
 mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
                          struct netlink_ext_ack *extack)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct net_device *br_dev;
        u16 vid;
        int err;
 
-       if (is_vlan_dev(rif->dev)) {
-               vid = vlan_dev_vlan_id(rif->dev);
-               br_dev = vlan_dev_real_dev(rif->dev);
+       if (is_vlan_dev(dev)) {
+               vid = vlan_dev_vlan_id(dev);
+               br_dev = vlan_dev_real_dev(dev);
                if (WARN_ON(!netif_is_bridge_master(br_dev)))
                        return ERR_PTR(-EINVAL);
        } else {
-               err = br_vlan_get_pvid(rif->dev, &vid);
+               err = br_vlan_get_pvid(dev, &vid);
                if (err < 0 || !vid) {
                        NL_SET_ERR_MSG_MOD(extack, "Couldn't determine bridge PVID");
                        return ERR_PTR(-EINVAL);
@@ -9610,12 +9623,13 @@ mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif,
 
 static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
 {
+       struct net_device *rif_dev = mlxsw_sp_rif_dev(rif);
        struct switchdev_notifier_fdb_info info = {};
        u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid);
        struct net_device *br_dev;
        struct net_device *dev;
 
-       br_dev = is_vlan_dev(rif->dev) ? vlan_dev_real_dev(rif->dev) : rif->dev;
+       br_dev = is_vlan_dev(rif_dev) ? vlan_dev_real_dev(rif_dev) : rif_dev;
        dev = br_fdb_find_port(br_dev, mac, vid);
        if (!dev)
                return;
@@ -9629,11 +9643,12 @@ static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac)
 static int mlxsw_sp_rif_vlan_op(struct mlxsw_sp_rif *rif, u16 vid, u16 efid,
                                bool enable)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        char ritr_pl[MLXSW_REG_RITR_LEN];
 
        mlxsw_reg_ritr_vlan_if_pack(ritr_pl, enable, rif->rif_index, rif->vr_id,
-                                   rif->dev->mtu, rif->dev->dev_addr,
+                                   dev->mtu, dev->dev_addr,
                                    rif->mac_profile_id, vid, efid);
 
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);
@@ -9642,6 +9657,7 @@ static int mlxsw_sp_rif_vlan_op(struct mlxsw_sp_rif *rif, u16 vid, u16 efid,
 static int mlxsw_sp_rif_vlan_configure(struct mlxsw_sp_rif *rif, u16 efid,
                                       struct netlink_ext_ack *extack)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        u8 mac_profile;
@@ -9667,7 +9683,7 @@ static int mlxsw_sp_rif_vlan_configure(struct mlxsw_sp_rif *rif, u16 efid,
        if (err)
                goto err_fid_bc_flood_set;
 
-       err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                                  mlxsw_sp_fid_index(rif->fid), true);
        if (err)
                goto err_rif_fdb_op;
@@ -9679,7 +9695,7 @@ static int mlxsw_sp_rif_vlan_configure(struct mlxsw_sp_rif *rif, u16 efid,
        return 0;
 
 err_fid_rif_set:
-       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                            mlxsw_sp_fid_index(rif->fid), false);
 err_rif_fdb_op:
        mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC,
@@ -9696,11 +9712,12 @@ err_rif_vlan_fid_op:
 
 static void mlxsw_sp_rif_vlan_deconfigure(struct mlxsw_sp_rif *rif)
 {
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
        u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
 
        mlxsw_sp_fid_rif_unset(rif->fid);
-       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr,
+       mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr,
                            mlxsw_sp_fid_index(rif->fid), false);
        mlxsw_sp_rif_macvlan_flush(rif);
        mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC,
@@ -9767,7 +9784,8 @@ mlxsw_sp1_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif,
                                struct netlink_ext_ack *extack)
 {
        struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif);
-       u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(rif->dev);
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
+       u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(dev);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        struct mlxsw_sp_vr *ul_vr;
        int err;
@@ -9966,7 +9984,8 @@ mlxsw_sp2_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif,
                                struct netlink_ext_ack *extack)
 {
        struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif);
-       u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(rif->dev);
+       struct net_device *dev = mlxsw_sp_rif_dev(rif);
+       u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(dev);
        struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
        struct mlxsw_sp_rif *ul_rif;
        int err;