Hi, > -----Original Message----- > From: Dekel Peled <dek...@mellanox.com> > Sent: Wednesday, May 6, 2020 8:14 PM > To: Matan Azrad <ma...@mellanox.com>; Slava Ovsiienko > <viachesl...@mellanox.com>; Raslan Darawsheh <rasl...@mellanox.com> > Cc: dev@dpdk.org > Subject: [PATCH] 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 <dek...@mellanox.com> > Acked-by: Matan Azrad <ma...@mellanox.com> > --- > doc/guides/nics/mlx5.rst | 1 + > doc/guides/rel_notes/release_20_05.rst | 1 + > drivers/net/mlx5/mlx5_flow_dv.c | 23 +++++++++++++++++++++++ > 3 files changed, 25 insertions(+) > > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst > index c4bc77c..f561683 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -162,6 +162,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 2f60e67..8bab5a3 100644 > --- a/doc/guides/rel_notes/release_20_05.rst > +++ b/doc/guides/rel_notes/release_20_05.rst > @@ -144,6 +144,7 @@ New Features > * Removed flow rules caching for memory saving and compliance with > ethdev API. > * Optimized the memory consumption of flow. > * Added support for flow aging based on hardware counter. > + * Updated support for matching on GTP header, added match on GTP > flags. > > * **Updated the AESNI MB crypto PMD.** > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index aa5c353..e5e656f 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1639,6 +1639,18 @@ struct field_modify_info modify_tcp[] = { > 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 GTP item. > * > @@ -1661,8 +1673,10 @@ struct field_modify_info modify_tcp[] = { > 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), > }; > @@ -1682,6 +1696,11 @@ struct field_modify_info modify_tcp[] = { > "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, > @@ -7047,6 +7066,10 @@ struct field_modify_info modify_tcp[] = { > 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); > -- > 1.8.3.1
Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh