From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AC40EA034E; Wed, 6 May 2020 19:13:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E9C551DA4C; Wed, 6 May 2020 19:13:43 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 100D11DA47 for ; Wed, 6 May 2020 19:13:41 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 May 2020 20:13:41 +0300 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.228.134.250]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 046HDeXA017697; Wed, 6 May 2020 20:13:40 +0300 From: Dekel Peled To: matan@mellanox.com, viacheslavo@mellanox.com, rasland@mellanox.com Cc: dev@dpdk.org Date: Wed, 6 May 2020 20:13:38 +0300 Message-Id: <172bff51c15e003369174831b3777575e358097a.1588785170.git.dekelp@mellanox.com> X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] net/mlx5: support match on GTP flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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