git: f8001dd9c873 - main - mlx5ib: Add drop flow steering rule support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Sep 2026 14:12:45 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=f8001dd9c873429dece0bbdda376b5cfe55a3873
commit f8001dd9c873429dece0bbdda376b5cfe55a3873
Author: Vag Singh <vag.singh@oneconvergence.com>
AuthorDate: 2025-08-14 05:35:44 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-16 14:12:07 +0000
mlx5ib: Add drop flow steering rule support
[PATCH 07/31] FreeBSD OFED support for DPDK MLX5 PMD
A drop rule is described by an action drop and no destination.
If a user specified IB_FLOW_SPEC_ACTION_DROP then set the action
to MLX5_FLOW_CONTEXT_ACTION_DROP and clear the destination.
Differential revision: https://reviews.freebsd.org/D32181
MFC after: 1 month
---
sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
index 92ccb348427f..462306465a8e 100644
--- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
+++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
@@ -1878,6 +1878,7 @@ static void set_tos(void *outer_c, void *outer_v, u8 mask, u8 val)
#define LAST_IPV4_FIELD tos
#define LAST_IPV6_FIELD traffic_class
#define LAST_TCP_UDP_FIELD src_port
+#define LAST_DROP_FIELD size
/* Field is the last supported field */
#define FIELDS_NOT_SUPPORTED(filter, field)\
@@ -1888,7 +1889,7 @@ static void set_tos(void *outer_c, void *outer_v, u8 mask, u8 val)
sizeof(filter.field))
static int parse_flow_attr(u32 *match_c, u32 *match_v,
- const union ib_flow_spec *ib_spec)
+ const union ib_flow_spec *ib_spec, bool *is_drop)
{
void *outer_headers_c = MLX5_ADDR_OF(fte_match_param, match_c,
outer_headers);
@@ -2061,6 +2062,12 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
MLX5_SET(fte_match_set_lyr_2_4, outer_headers_v, udp_dport,
ntohs(ib_spec->tcp_udp.val.dst_port));
break;
+ case IB_FLOW_SPEC_ACTION_DROP:
+ if (FIELDS_NOT_SUPPORTED(ib_spec->drop,
+ LAST_DROP_FIELD))
+ return -EOPNOTSUPP;
+ *is_drop = true;
+ break;
default:
return -EINVAL;
}
@@ -2246,7 +2253,7 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
const void *ib_flow = (const void *)flow_attr + sizeof(*flow_attr);
unsigned int spec_index;
struct mlx5_flow_act flow_act = {};
-
+ bool is_drop;
u32 action;
int err = 0;
@@ -2267,7 +2274,7 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) {
err = parse_flow_attr(spec->match_criteria,
- spec->match_value, ib_flow);
+ spec->match_value, ib_flow, &is_drop);
if (err < 0)
goto free;
@@ -2275,7 +2282,10 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
}
spec->match_criteria_enable = get_match_criteria_enable(spec->match_criteria);
- action = dst ? MLX5_FLOW_CONTEXT_ACTION_FWD_DEST : 0;
+ if (is_drop)
+ action = MLX5_FLOW_CONTEXT_ACTION_DROP;
+ else
+ action = dst ? MLX5_FLOW_CONTEXT_ACTION_FWD_DEST : 0;
flow_act.action = action;
handler->rule = mlx5_add_flow_rules(ft, spec, &flow_act, dst, 1);