@@ -75,6 +75,35 @@ static void mlxsw_sp_rx_drop_listener(struct sk_buff *skb, u8 local_port,
75
75
consume_skb (skb );
76
76
}
77
77
78
+ static void mlxsw_sp_rx_acl_drop_listener (struct sk_buff * skb , u8 local_port ,
79
+ void * trap_ctx )
80
+ {
81
+ u32 cookie_index = mlxsw_skb_cb (skb )-> cookie_index ;
82
+ const struct flow_action_cookie * fa_cookie ;
83
+ struct devlink_port * in_devlink_port ;
84
+ struct mlxsw_sp_port * mlxsw_sp_port ;
85
+ struct mlxsw_sp * mlxsw_sp ;
86
+ struct devlink * devlink ;
87
+ int err ;
88
+
89
+ mlxsw_sp = devlink_trap_ctx_priv (trap_ctx );
90
+ mlxsw_sp_port = mlxsw_sp -> ports [local_port ];
91
+
92
+ err = mlxsw_sp_rx_listener (mlxsw_sp , skb , local_port , mlxsw_sp_port );
93
+ if (err )
94
+ return ;
95
+
96
+ devlink = priv_to_devlink (mlxsw_sp -> core );
97
+ in_devlink_port = mlxsw_core_port_devlink_port_get (mlxsw_sp -> core ,
98
+ local_port );
99
+ skb_push (skb , ETH_HLEN );
100
+ rcu_read_lock ();
101
+ fa_cookie = mlxsw_sp_acl_act_cookie_lookup (mlxsw_sp , cookie_index );
102
+ devlink_trap_report (devlink , skb , trap_ctx , in_devlink_port , fa_cookie );
103
+ rcu_read_unlock ();
104
+ consume_skb (skb );
105
+ }
106
+
78
107
static void mlxsw_sp_rx_exception_listener (struct sk_buff * skb , u8 local_port ,
79
108
void * trap_ctx )
80
109
{
@@ -106,6 +135,11 @@ static void mlxsw_sp_rx_exception_listener(struct sk_buff *skb, u8 local_port,
106
135
DEVLINK_TRAP_GROUP_GENERIC(_group_id), \
107
136
MLXSW_SP_TRAP_METADATA)
108
137
138
+ #define MLXSW_SP_TRAP_DROP_EXT (_id , _group_id , _metadata ) \
139
+ DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \
140
+ DEVLINK_TRAP_GROUP_GENERIC(_group_id), \
141
+ MLXSW_SP_TRAP_METADATA | (_metadata))
142
+
109
143
#define MLXSW_SP_TRAP_DRIVER_DROP (_id , _group_id ) \
110
144
DEVLINK_TRAP_DRIVER(DROP, DROP, DEVLINK_MLXSW_TRAP_ID_##_id, \
111
145
DEVLINK_MLXSW_TRAP_NAME_##_id, \
@@ -123,7 +157,7 @@ static void mlxsw_sp_rx_exception_listener(struct sk_buff *skb, u8 local_port,
123
157
SET_FW_DEFAULT, SP_##_group_id)
124
158
125
159
#define MLXSW_SP_RXL_ACL_DISCARD (_id , _en_group_id , _dis_group_id ) \
126
- MLXSW_RXL_DIS(mlxsw_sp_rx_drop_listener , DISCARD_##_id, \
160
+ MLXSW_RXL_DIS(mlxsw_sp_rx_acl_drop_listener , DISCARD_##_id, \
127
161
TRAP_EXCEPTION_TO_CPU, false, SP_##_en_group_id, \
128
162
SET_FW_DEFAULT, SP_##_dis_group_id)
129
163
@@ -160,8 +194,10 @@ static const struct devlink_trap mlxsw_sp_traps_arr[] = {
160
194
MLXSW_SP_TRAP_DROP (NON_ROUTABLE , L3_DROPS ),
161
195
MLXSW_SP_TRAP_EXCEPTION (DECAP_ERROR , TUNNEL_DROPS ),
162
196
MLXSW_SP_TRAP_DROP (OVERLAY_SMAC_MC , TUNNEL_DROPS ),
163
- MLXSW_SP_TRAP_DROP (INGRESS_FLOW_ACTION_DROP , ACL_DROPS ),
164
- MLXSW_SP_TRAP_DROP (EGRESS_FLOW_ACTION_DROP , ACL_DROPS ),
197
+ MLXSW_SP_TRAP_DROP_EXT (INGRESS_FLOW_ACTION_DROP , ACL_DROPS ,
198
+ DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE ),
199
+ MLXSW_SP_TRAP_DROP_EXT (EGRESS_FLOW_ACTION_DROP , ACL_DROPS ,
200
+ DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE ),
165
201
};
166
202
167
203
static const struct mlxsw_listener mlxsw_sp_listeners_arr [] = {
0 commit comments