mlxsw: Create dedicated field for Rx metadata in skb control block
authorIdo Schimmel <idosch@nvidia.com>
Sun, 14 Mar 2021 12:19:35 +0000 (14:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 14 Mar 2021 22:00:43 +0000 (15:00 -0700)
Next patch will need to encode more Rx metadata in the skb control
block, so create a dedicated field for it and move the cookie index
there.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.h
drivers/net/ethernet/mellanox/mlxsw/pci.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c

index 8af7d9d..86adc17 100644 (file)
@@ -58,6 +58,10 @@ struct mlxsw_tx_info {
        bool is_emad;
 };
 
+struct mlxsw_rx_md_info {
+       u32 cookie_index;
+};
+
 bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
                                  const struct mlxsw_tx_info *tx_info);
 int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
@@ -515,7 +519,7 @@ enum mlxsw_devlink_param_id {
 struct mlxsw_skb_cb {
        union {
                struct mlxsw_tx_info tx_info;
-               u32 cookie_index; /* Only used during receive */
+               struct mlxsw_rx_md_info rx_md_info;
        };
 };
 
index d005253..8eee8b3 100644 (file)
@@ -581,7 +581,7 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
 
                if (mlxsw_pci->max_cqe_ver >= MLXSW_PCI_CQE_V2)
                        cookie_index = mlxsw_pci_cqe2_user_def_val_orig_pkt_len_get(cqe);
-               mlxsw_skb_cb(skb)->cookie_index = cookie_index;
+               mlxsw_skb_cb(skb)->rx_md_info.cookie_index = cookie_index;
        } else if (rx_info.trap_id >= MLXSW_TRAP_ID_MIRROR_SESSION0 &&
                   rx_info.trap_id <= MLXSW_TRAP_ID_MIRROR_SESSION7 &&
                   mlxsw_pci->max_cqe_ver >= MLXSW_PCI_CQE_V2) {
index e0e6ee5..5d4ae48 100644 (file)
@@ -108,7 +108,7 @@ static void mlxsw_sp_rx_drop_listener(struct sk_buff *skb, u8 local_port,
 static void mlxsw_sp_rx_acl_drop_listener(struct sk_buff *skb, u8 local_port,
                                          void *trap_ctx)
 {
-       u32 cookie_index = mlxsw_skb_cb(skb)->cookie_index;
+       u32 cookie_index = mlxsw_skb_cb(skb)->rx_md_info.cookie_index;
        const struct flow_action_cookie *fa_cookie;
        struct devlink_port *in_devlink_port;
        struct mlxsw_sp_port *mlxsw_sp_port;