From: Dekel Peled Date: Wed, 6 May 2020 17:13:38 +0000 (+0300) Subject: net/mlx5: support match on GTP flags X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=563ac307a46b;p=dpdk.git net/mlx5: support match on GTP flags This patch adds to MLX5 PMD the support of matching on GTP header item v_pt_rsv_flags. This item is contained in 1 byte of the format: ------------------------------------------- | bit | 0 - 2 | 3 | 4 | 5 | 6 | 7 | |-----------------------------------------| | value | Version | PT | Res | E | S | PN | ------------------------------------------- Matching is supported only for GTP flags E, S, PN. Therefore values 0 to 7 are supported. Mask must be set accordingly: ... gtp v_pt_rsv_flags is 1 v_pt_rsv_flags mask 0x07 ... Signed-off-by: Dekel Peled Acked-by: Matan Azrad --- diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 07f5a3bccd..d29ce85ed0 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -180,6 +180,7 @@ Limitations - Match on GTP tunnel header item supports the following fields only: + - v_pt_rsv_flags: E flag, S flag, PN flag - msg_type - teid diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 281feb0ead..0e9199cdff 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -147,6 +147,7 @@ New Features * Optimized the memory consumption of flow. * Added support for flow aging based on hardware counter. * Added support for flow pattern with wildcard VLAN item (without VID value). + * Updated support for matching on GTP header, added match on GTP flags. * **Added Chacha20-Poly1305 algorithm to Cryptodev API.** diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 5a0bb9d789..4ebb7ce3e5 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1639,6 +1639,18 @@ flow_dv_validate_item_port_id(struct rte_eth_dev *dev, return 0; } +/* + * GTP flags are contained in 1 byte of the format: + * ------------------------------------------- + * | bit | 0 - 2 | 3 | 4 | 5 | 6 | 7 | + * |-----------------------------------------| + * | value | Version | PT | Res | E | S | PN | + * ------------------------------------------- + * + * Matching is supported only for GTP flags E, S, PN. + */ +#define MLX5_GTP_FLAGS_MASK 0x07 + /** * Validate VLAN item. * @@ -1734,8 +1746,10 @@ flow_dv_validate_item_gtp(struct rte_eth_dev *dev, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; + const struct rte_flow_item_gtp *spec = item->spec; const struct rte_flow_item_gtp *mask = item->mask; const struct rte_flow_item_gtp nic_mask = { + .v_pt_rsv_flags = MLX5_GTP_FLAGS_MASK, .msg_type = 0xff, .teid = RTE_BE32(0xffffffff), }; @@ -1755,6 +1769,11 @@ flow_dv_validate_item_gtp(struct rte_eth_dev *dev, "no outer UDP layer found"); if (!mask) mask = &rte_flow_item_gtp_mask; + if (spec && spec->v_pt_rsv_flags & ~MLX5_GTP_FLAGS_MASK) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, item, + "Match is supported for GTP" + " flags only"); return mlx5_flow_item_acceptable (item, (const uint8_t *)mask, (const uint8_t *)&nic_mask, @@ -7125,6 +7144,10 @@ flow_dv_translate_item_gtp(void *matcher, void *key, return; if (!gtp_m) gtp_m = &rte_flow_item_gtp_mask; + MLX5_SET(fte_match_set_misc3, misc3_m, gtpu_msg_flags, + gtp_m->v_pt_rsv_flags); + MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_msg_flags, + gtp_v->v_pt_rsv_flags & gtp_m->v_pt_rsv_flags); MLX5_SET(fte_match_set_misc3, misc3_m, gtpu_msg_type, gtp_m->msg_type); MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_msg_type, gtp_v->msg_type & gtp_m->msg_type);