Skip to content

Commit 78a7dcb

Browse files
jpirkodavem330
authored andcommitted
mlxsw: pci: Extract cookie index for ACL discard trap packets
In case the received packet comes in due to one of ACL discard traps, take the user_def_val_orig_pkt_len field from CQE and store it in skb->cb as ACL cookie index. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6d19d2b commit 78a7dcb

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/core.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,10 @@ enum mlxsw_devlink_param_id {
473473
};
474474

475475
struct mlxsw_skb_cb {
476-
struct mlxsw_tx_info tx_info;
476+
union {
477+
struct mlxsw_tx_info tx_info;
478+
u32 cookie_index; /* Only used during receive */
479+
};
477480
};
478481

479482
static inline struct mlxsw_skb_cb *mlxsw_skb_cb(struct sk_buff *skb)

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,15 @@ static void mlxsw_pci_cqe_rdq_handle(struct mlxsw_pci *mlxsw_pci,
575575

576576
rx_info.trap_id = mlxsw_pci_cqe_trap_id_get(cqe);
577577

578+
if (rx_info.trap_id == MLXSW_TRAP_ID_DISCARD_INGRESS_ACL ||
579+
rx_info.trap_id == MLXSW_TRAP_ID_DISCARD_EGRESS_ACL) {
580+
u32 cookie_index = 0;
581+
582+
if (mlxsw_pci->max_cqe_ver >= MLXSW_PCI_CQE_V2)
583+
cookie_index = mlxsw_pci_cqe2_user_def_val_orig_pkt_len_get(cqe);
584+
mlxsw_skb_cb(skb)->cookie_index = cookie_index;
585+
}
586+
578587
byte_count = mlxsw_pci_cqe_byte_count_get(cqe);
579588
if (mlxsw_pci_cqe_crc_get(cqe_v, cqe))
580589
byte_count -= ETH_FCS_LEN;

drivers/net/ethernet/mellanox/mlxsw/pci_hw.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ MLXSW_ITEM32(pci, cqe0, dqn, 0x0C, 1, 5);
208208
MLXSW_ITEM32(pci, cqe12, dqn, 0x0C, 1, 6);
209209
mlxsw_pci_cqe_item_helpers(dqn, 0, 12, 12);
210210

211+
/* pci_cqe_user_def_val_orig_pkt_len
212+
* When trap_id is an ACL: User defined value from policy engine action.
213+
*/
214+
MLXSW_ITEM32(pci, cqe2, user_def_val_orig_pkt_len, 0x14, 0, 20);
215+
211216
/* pci_cqe_owner
212217
* Ownership bit.
213218
*/

0 commit comments

Comments
 (0)