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 <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
Dekel Peled 2020-05-06 20:13:38 +03:00 committed by Ferruh Yigit
parent 776aec28fc
commit 563ac307a4
3 changed files with 25 additions and 0 deletions
doc/guides
drivers/net/mlx5

@ -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

@ -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.**

@ -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);