mlxsw: reg: Extract mlxsw_reg_ritr_mac_pack()
authorPetr Machata <petrm@mellanox.com>
Sat, 2 Sep 2017 21:49:14 +0000 (23:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Sep 2017 03:23:25 +0000 (20:23 -0700)
Unlike other interface types, loopback RIFs do not have MAC address. So
drop the corresponding argument from mlxsw_reg_ritr_pack() and move it
to a new function. Call that from callers of mlxsw_reg_ritr_pack.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/reg.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index a6eb96fe0db379be357ef11156bfaa58a9a2d345..d80cf9b29f65d3a6bdb12ece997f159c93ae08b2 100644 (file)
@@ -4263,8 +4263,7 @@ static inline void mlxsw_reg_ritr_sp_if_pack(char *payload, bool lag,
 
 static inline void mlxsw_reg_ritr_pack(char *payload, bool enable,
                                       enum mlxsw_reg_ritr_if_type type,
-                                      u16 rif, u16 vr_id, u16 mtu,
-                                      const char *mac)
+                                      u16 rif, u16 vr_id, u16 mtu)
 {
        bool op = enable ? MLXSW_REG_RITR_RIF_CREATE : MLXSW_REG_RITR_RIF_DEL;
 
@@ -4280,6 +4279,10 @@ static inline void mlxsw_reg_ritr_pack(char *payload, bool enable,
        mlxsw_reg_ritr_lb_en_set(payload, 1);
        mlxsw_reg_ritr_virtual_router_set(payload, vr_id);
        mlxsw_reg_ritr_mtu_set(payload, mtu);
+}
+
+static inline void mlxsw_reg_ritr_mac_pack(char *payload, const char *mac)
+{
        mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac);
 }
 
index de15eac50866ee2dcf02678827a25a8dd07beea2..3ddfbe3d0dbe22d6abc2a16ecb1e2d7508422951 100644 (file)
@@ -4955,8 +4955,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,
-                           rif->dev->dev_addr);
+                           rif->rif_index, rif->vr_id, rif->dev->mtu);
+       mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr);
        mlxsw_reg_ritr_sp_if_pack(ritr_pl, rif_subport->lag,
                                  rif_subport->lag ? rif_subport->lag_id :
                                                     rif_subport->system_port,
@@ -4998,7 +4998,8 @@ static int mlxsw_sp_rif_vlan_fid_op(struct mlxsw_sp_rif *rif,
        char ritr_pl[MLXSW_REG_RITR_LEN];
 
        mlxsw_reg_ritr_pack(ritr_pl, enable, type, rif->rif_index, rif->vr_id,
-                           rif->dev->mtu, rif->dev->dev_addr);
+                           rif->dev->mtu);
+       mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr);
        mlxsw_reg_ritr_fid_set(ritr_pl, type, vid_fid);
 
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl);