mlxsw: reg: Extend mlxsw_reg_mpat_pack()
authorPetr Machata <petrm@mellanox.com>
Tue, 27 Feb 2018 13:53:40 +0000 (14:53 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Feb 2018 19:46:26 +0000 (14:46 -0500)
To support encapsulated SPAN, extend mlxsw_reg_mpat_pack() with a field
to set the SPAN type.

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_span.c

index 2aaccbac3ed1045d9d467504e72c15ed788a0f93..cb5f77f09f8eb4ebc99c41d688acfba38810e6b6 100644 (file)
@@ -6868,7 +6868,8 @@ MLXSW_ITEM32(reg, mpat, eth_rspan_sip4, 0x5C, 0, 32);
 MLXSW_ITEM_BUF(reg, mpat, eth_rspan_sip6, 0x50, 16);
 
 static inline void mlxsw_reg_mpat_pack(char *payload, u8 pa_id,
-                                      u16 system_port, bool e)
+                                      u16 system_port, bool e,
+                                      enum mlxsw_reg_mpat_span_type span_type)
 {
        MLXSW_REG_ZERO(mpat, payload);
        mlxsw_reg_mpat_pa_id_set(payload, pa_id);
@@ -6876,6 +6877,7 @@ static inline void mlxsw_reg_mpat_pack(char *payload, u8 pa_id,
        mlxsw_reg_mpat_e_set(payload, e);
        mlxsw_reg_mpat_qos_set(payload, 1);
        mlxsw_reg_mpat_be_set(payload, 1);
+       mlxsw_reg_mpat_span_type_set(payload, span_type);
 }
 
 static inline void mlxsw_reg_mpat_eth_rspan_pack(char *payload, u16 vid)
index c3bec37d71ed6dee0c23c274103f8fda602f77c6..1433d4890b88b6d5cc4fe7ed09928607e484064d 100644 (file)
@@ -93,7 +93,8 @@ mlxsw_sp_span_entry_create(struct mlxsw_sp_port *port)
                return NULL;
 
        /* create a new port analayzer entry for local_port */
-       mlxsw_reg_mpat_pack(mpat_pl, index, local_port, true);
+       mlxsw_reg_mpat_pack(mpat_pl, index, local_port, true,
+                           MLXSW_REG_MPAT_SPAN_TYPE_LOCAL_ETH);
        err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl);
        if (err)
                return NULL;
@@ -111,7 +112,8 @@ static void mlxsw_sp_span_entry_destroy(struct mlxsw_sp *mlxsw_sp,
        char mpat_pl[MLXSW_REG_MPAT_LEN];
        int pa_id = span_entry->id;
 
-       mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, false);
+       mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, false,
+                           MLXSW_REG_MPAT_SPAN_TYPE_LOCAL_ETH);
        mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl);
 }