DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shiri Kuzin <shirik@nvidia.com>
To: dev@dpdk.org
Cc: viacheslavo@nvidia.com, adrien.mazarguil@6wind.com, rasland@nvidia.com
Subject: [dpdk-dev] [RFC 5/6] net/mlx5: add GTP PSC item translation
Date: Wed, 16 Dec 2020 16:25:10 +0200
Message-ID: <20201216142511.13660-6-shirik@nvidia.com> (raw)
In-Reply-To: <20201216142511.13660-1-shirik@nvidia.com>

This patch adds the translation function which
sets the qfi, PDU type.

The next extension header which indicates the following
extension header type is set to 0x85 - a PDU session
container.

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 85 +++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4f7a756214..897f70c22c 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7903,6 +7903,81 @@ flow_dv_translate_item_gtp(void *matcher, void *key,
 		 rte_be_to_cpu_32(gtp_v->teid & gtp_m->teid));
 }
 
+/**
+ * Add GTP PSC item to matcher.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ */
+static int
+flow_dv_translate_item_gtp_psc(void *matcher, void *key,
+			       const struct rte_flow_item *item)
+{
+	const struct rte_flow_item_gtp_psc *gtp_psc_m = item->mask;
+	const struct rte_flow_item_gtp_psc *gtp_psc_v = item->spec;
+	void *misc3_m = MLX5_ADDR_OF(fte_match_param, matcher,
+			misc_parameters_3);
+	void *misc3_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters_3);
+	union {
+		uint32_t w32;
+		struct {
+			uint16_t seq_num;
+			uint8_t npdu_num;
+			uint8_t next_ext_header_type;
+		};
+	} dw_2;
+	uint8_t gtp_flags;
+
+	/* Always set E-flag match on one, regardless of GTP item settings. */
+	gtp_flags = MLX5_GET(fte_match_set_misc3, misc3_m, gtpu_msg_flags);
+	gtp_flags |= MLX5_GTP_EXT_HEADER_FLAG;
+	MLX5_SET(fte_match_set_misc3, misc3_m, gtpu_msg_flags, gtp_flags);
+	gtp_flags = MLX5_GET(fte_match_set_misc3, misc3_v, gtpu_msg_flags);
+	gtp_flags |= MLX5_GTP_EXT_HEADER_FLAG;
+	MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_msg_flags, gtp_flags);
+	/*Set next extension header type. */
+	dw_2.seq_num = 0;
+	dw_2.npdu_num = 0;
+	dw_2.next_ext_header_type = 0xff;
+	MLX5_SET(fte_match_set_misc3, misc3_m, gtpu_dw_2,
+		 rte_cpu_to_be_32(dw_2.w32));
+	dw_2.seq_num = 0;
+	dw_2.npdu_num = 0;
+	dw_2.next_ext_header_type = 0x85;
+	MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_dw_2,
+		 rte_cpu_to_be_32(dw_2.w32));
+	if (gtp_psc_v) {
+		union {
+			uint32_t w32;
+			struct {
+				uint8_t len;
+				uint8_t pdu_type;
+				uint8_t qfi;
+				uint8_t reserved;
+			};
+		} dw_0;
+
+		/*Set extension header PDU type and Qos. */
+		if (!gtp_psc_m)
+			gtp_psc_m = &rte_flow_item_gtp_psc_mask;
+		dw_0.w32 = 0;
+		dw_0.pdu_type = gtp_psc_m->pdu_type;
+		dw_0.qfi = gtp_psc_m->qfi;
+		MLX5_SET(fte_match_set_misc3, misc3_m, gtpu_first_ext_dw_0,
+			 rte_cpu_to_be_32(dw_0.w32));
+		dw_0.w32 = 0;
+		dw_0.pdu_type = gtp_psc_v->pdu_type &  gtp_psc_m->pdu_type;
+		dw_0.qfi = gtp_psc_v->qfi & gtp_psc_m->qfi;
+		MLX5_SET(fte_match_set_misc3, misc3_v, gtpu_first_ext_dw_0,
+			 rte_cpu_to_be_32(dw_0.w32));
+	}
+	return 0;
+}
+
 /**
  * Add eCPRI item to matcher and to the value.
  *
@@ -10585,6 +10660,16 @@ flow_dv_translate(struct rte_eth_dev *dev,
 			matcher.priority = MLX5_TUNNEL_PRIO_GET(rss_desc);
 			last_item = MLX5_FLOW_LAYER_GTP;
 			break;
+		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+			ret = flow_dv_translate_item_gtp_psc(match_mask,
+							  match_value,
+							  items);
+			if (ret)
+				return rte_flow_error_set(error, -ret,
+					RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+					"cannot create GTP PSC item");
+			last_item = MLX5_FLOW_LAYER_GTP_PSC;
+			break;
 		case RTE_FLOW_ITEM_TYPE_ECPRI:
 			if (!mlx5_flex_parser_ecpri_exist(dev)) {
 				/* Create it only the first time to be used. */
-- 
2.21.0


  parent reply	other threads:[~2020-12-16 14:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  7:39 [dpdk-dev] [RFC v2] ethdev: introduce GENEVE header extension item Shiri Kuzin
2020-10-01 16:25 ` Ferruh Yigit
2020-10-05 12:44   ` Shiri Kuzin
2020-10-05 13:10     ` Ferruh Yigit
2020-12-16 13:02 ` [dpdk-dev] [RFC v3 0/8] ethdev: introduce GENEVE header TLV option item Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 1/8] lib/librte_ethdev: " Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 2/8] app/testpmd: add GENEVE option item support Shiri Kuzin
2021-01-14 20:08     ` Ajit Khaparde
2021-01-17  8:31       ` Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 3/8] common/mlx5: check GENEVE TLV support in HCA attributes Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 4/8] common/mlx5: create GENEVE TLV option object with DevX Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 5/8] net/mlx5: create GENEVE TLV option management Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 6/8] net/mlx5: add GENEVE TLV option flow validation Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 7/8] net/mlx5: add GENEVE TLV option flow translation Shiri Kuzin
2020-12-16 13:02   ` [dpdk-dev] [RFC v3 8/8] doc: update GENEVE TLV option support Shiri Kuzin
2020-12-16 14:25 ` [dpdk-dev] [RFC 0/6] add GTP PSC extension header support Shiri Kuzin
2020-12-16 14:25   ` [dpdk-dev] [RFC 1/6] ethdev: update GTP headers Shiri Kuzin
2020-12-16 14:25   ` [dpdk-dev] [RFC 2/6] app/testpmd: add GTP PSC option support in raw sets Shiri Kuzin
2020-12-16 14:25   ` [dpdk-dev] [RFC 3/6] common/mlx5: add matcher fields for GTP extensions Shiri Kuzin
2020-12-16 14:25   ` [dpdk-dev] [RFC 4/6] net/mlx5: add GTP PSC flow validation Shiri Kuzin
2020-12-16 14:25   ` Shiri Kuzin [this message]
2020-12-16 14:25   ` [dpdk-dev] [RFC 6/6] doc: update GTP extension header support Shiri Kuzin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201216142511.13660-6-shirik@nvidia.com \
    --to=shirik@nvidia.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=rasland@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git