DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: dev@dpdk.org
Cc: Igor Romanov <igor.romanov@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>,
	Ivan Malov <ivan.malov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 06/38] net/sfc: support EF100 Tx override prefix
Date: Fri, 27 Aug 2021 09:56:45 +0300	[thread overview]
Message-ID: <20210827065717.1838258-7-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>

From: Igor Romanov <igor.romanov@oktetlabs.ru>

Add internal mbuf dynamic flag and field to request EF100 native
Tx datapath to use Tx prefix descriptor to override egress m-port.
Overriding egress m-port is necessary on representor Tx burst
so that the packet will reach corresponding VF.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
 drivers/net/sfc/sfc_dp.c       | 46 ++++++++++++++++++++++++++++++++++
 drivers/net/sfc/sfc_dp.h       | 25 ++++++++++++++++++
 drivers/net/sfc/sfc_ef100_tx.c | 25 ++++++++++++++++++
 drivers/net/sfc/sfc_ethdev.c   |  4 +++
 4 files changed, 100 insertions(+)

diff --git a/drivers/net/sfc/sfc_dp.c b/drivers/net/sfc/sfc_dp.c
index 24ed0898c8..66a84c99c8 100644
--- a/drivers/net/sfc/sfc_dp.c
+++ b/drivers/net/sfc/sfc_dp.c
@@ -12,6 +12,9 @@
 #include <errno.h>
 
 #include <rte_log.h>
+#include <rte_mbuf_dyn.h>
+
+#include "efx.h"
 
 #include "sfc_dp.h"
 #include "sfc_log.h"
@@ -77,3 +80,46 @@ sfc_dp_register(struct sfc_dp_list *head, struct sfc_dp *entry)
 
 	return 0;
 }
+
+uint64_t sfc_dp_mport_override;
+int sfc_dp_mport_offset = -1;
+
+int
+sfc_dp_mport_register(void)
+{
+	static const struct rte_mbuf_dynfield mport = {
+		.name = "rte_net_sfc_dynfield_mport",
+		.size = sizeof(efx_mport_id_t),
+		.align = __alignof__(efx_mport_id_t),
+	};
+	static const struct rte_mbuf_dynflag mport_override = {
+		.name = "rte_net_sfc_dynflag_mport_override",
+	};
+
+	int field_offset;
+	int flag;
+
+	if (sfc_dp_mport_override != 0) {
+		SFC_GENERIC_LOG(INFO, "%s() already registered", __func__);
+		return 0;
+	}
+
+	field_offset = rte_mbuf_dynfield_register(&mport);
+	if (field_offset < 0) {
+		SFC_GENERIC_LOG(ERR, "%s() failed to register mport dynfield",
+				__func__);
+		return -1;
+	}
+
+	flag = rte_mbuf_dynflag_register(&mport_override);
+	if (flag < 0) {
+		SFC_GENERIC_LOG(ERR, "%s() failed to register mport dynflag",
+				__func__);
+		return -1;
+	}
+
+	sfc_dp_mport_offset = field_offset;
+	sfc_dp_mport_override = UINT64_C(1) << flag;
+
+	return 0;
+}
diff --git a/drivers/net/sfc/sfc_dp.h b/drivers/net/sfc/sfc_dp.h
index 7fd8f34b0f..f3c6892426 100644
--- a/drivers/net/sfc/sfc_dp.h
+++ b/drivers/net/sfc/sfc_dp.h
@@ -126,6 +126,31 @@ struct sfc_dp *sfc_dp_find_by_caps(struct sfc_dp_list *head,
 				   unsigned int avail_caps);
 int sfc_dp_register(struct sfc_dp_list *head, struct sfc_dp *entry);
 
+/**
+ * Dynamically registered mbuf flag "mport_override" (as a bitmask).
+ *
+ * If this flag is set in an mbuf then the dynamically registered
+ * mbuf field "mport" holds a valid value. This is used to direct
+ * port representor transmit traffic to the correct target port.
+ */
+extern uint64_t sfc_dp_mport_override;
+
+/**
+ * Dynamically registered mbuf field "mport" (mbuf byte offset).
+ *
+ * If the dynamically registered "mport_override" flag is set in
+ * an mbuf then the mbuf "mport" field holds a valid value. This
+ * is used to direct port representor transmit traffic to the
+ * correct target port.
+ */
+extern int sfc_dp_mport_offset;
+
+/**
+ * Register dynamic mbuf flag and field which can be used to require Tx override
+ * prefix descriptor with egress mport set.
+ */
+int sfc_dp_mport_register(void);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/net/sfc/sfc_ef100_tx.c b/drivers/net/sfc/sfc_ef100_tx.c
index 522e9a0d34..51eecbe832 100644
--- a/drivers/net/sfc/sfc_ef100_tx.c
+++ b/drivers/net/sfc/sfc_ef100_tx.c
@@ -10,6 +10,7 @@
 #include <stdbool.h>
 
 #include <rte_mbuf.h>
+#include <rte_mbuf_dyn.h>
 #include <rte_io.h>
 #include <rte_net.h>
 
@@ -309,6 +310,19 @@ sfc_ef100_tx_reap(struct sfc_ef100_txq *txq)
 	sfc_ef100_tx_reap_num_descs(txq, sfc_ef100_tx_process_events(txq));
 }
 
+static void
+sfc_ef100_tx_qdesc_prefix_create(const struct rte_mbuf *m, efx_oword_t *tx_desc)
+{
+	efx_mport_id_t *mport_id =
+		RTE_MBUF_DYNFIELD(m, sfc_dp_mport_offset, efx_mport_id_t *);
+
+	EFX_POPULATE_OWORD_3(*tx_desc,
+			ESF_GZ_TX_PREFIX_EGRESS_MPORT,
+			mport_id->id,
+			ESF_GZ_TX_PREFIX_EGRESS_MPORT_EN, 1,
+			ESF_GZ_TX_DESC_TYPE, ESE_GZ_TX_DESC_TYPE_PREFIX);
+}
+
 static uint8_t
 sfc_ef100_tx_qdesc_cso_inner_l3(uint64_t tx_tunnel)
 {
@@ -525,6 +539,11 @@ sfc_ef100_tx_pkt_descs_max(const struct rte_mbuf *m)
 				 SFC_MBUF_SEG_LEN_MAX));
 	}
 
+	if (m->ol_flags & sfc_dp_mport_override) {
+		/* Tx override prefix descriptor will be used */
+		extra_descs++;
+	}
+
 	/*
 	 * Any segment of scattered packet cannot be bigger than maximum
 	 * segment length. Make sure that subsequent segments do not need
@@ -671,6 +690,12 @@ sfc_ef100_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				break;
 		}
 
+		if (m_seg->ol_flags & sfc_dp_mport_override) {
+			id = added++ & txq->ptr_mask;
+			sfc_ef100_tx_qdesc_prefix_create(m_seg,
+							 &txq->txq_hw_ring[id]);
+		}
+
 		if (m_seg->ol_flags & PKT_TX_TCP_SEG) {
 			m_seg = sfc_ef100_xmit_tso_pkt(txq, m_seg, &added);
 		} else {
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 41add341a0..8e17189875 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -2245,6 +2245,10 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
 		return 1;
 	}
 
+	rc = sfc_dp_mport_register();
+	if (rc != 0)
+		return rc;
+
 	sfc_register_dp();
 
 	logtype_main = sfc_register_logtype(&pci_dev->addr,
-- 
2.30.2


  parent reply	other threads:[~2021-08-27  6:58 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  6:56 [dpdk-dev] [PATCH 00/38] net/sfc: support port representors Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 01/38] common/sfc_efx/base: update MCDI headers Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 02/38] common/sfc_efx/base: update EF100 registers definitions Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 03/38] net/sfc: add switch mode device argument Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 04/38] net/sfc: insert switchdev mode MAE rules Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 05/38] common/sfc_efx/base: add an API to get mport ID by selector Andrew Rybchenko
2021-08-27  6:56 ` Andrew Rybchenko [this message]
2021-08-27  6:56 ` [dpdk-dev] [PATCH 07/38] net/sfc: add representors proxy infrastructure Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 08/38] net/sfc: reserve TxQ and RxQ for port representors Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 09/38] net/sfc: move adapter state enum to separate header Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 10/38] common/sfc_efx/base: allow creating invalid mport selectors Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 11/38] net/sfc: add port representors infrastructure Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 12/38] common/sfc_efx/base: add filter ingress mport matching field Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 13/38] common/sfc_efx/base: add API to get mport selector by ID Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 14/38] common/sfc_efx/base: add mport alias MCDI wrappers Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 15/38] net/sfc: add representor proxy port API Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 16/38] net/sfc: implement representor queue setup and release Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 17/38] net/sfc: implement representor RxQ start/stop Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 18/38] net/sfc: implement representor TxQ start/stop Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 19/38] net/sfc: implement port representor start and stop Andrew Rybchenko
2021-08-27  6:56 ` [dpdk-dev] [PATCH 20/38] net/sfc: implement port representor link update Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 21/38] net/sfc: support multiple device probe Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 22/38] net/sfc: implement representor Tx routine Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 23/38] net/sfc: use xword type for EF100 Rx prefix Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 24/38] net/sfc: handle ingress m-port in " Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 25/38] net/sfc: implement representor Rx routine Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 26/38] net/sfc: add simple port representor statistics Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 27/38] net/sfc: free MAE lock once switch domain is assigned Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 28/38] common/sfc_efx/base: add multi-host function M-port selector Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 29/38] common/sfc_efx/base: retrieve function interfaces for VNICs Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 30/38] common/sfc_efx/base: add a means to read MAE mport journal Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 31/38] common/sfc_efx/base: allow getting VNIC MCDI client handles Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 32/38] net/sfc: maintain controller to EFX interface mapping Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 33/38] net/sfc: store PCI address for represented entities Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 34/38] net/sfc: include controller and port in representor name Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 35/38] net/sfc: support new representor parameter syntax Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 36/38] net/sfc: use switch port ID as representor ID Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 37/38] net/sfc: implement the representor info API Andrew Rybchenko
2021-08-27  6:57 ` [dpdk-dev] [PATCH 38/38] net/sfc: update comment about representor support Andrew Rybchenko
2021-10-11 14:48 ` [dpdk-dev] [PATCH v2 00/38] net/sfc: support port representors Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 01/38] common/sfc_efx/base: update MCDI headers Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 02/38] common/sfc_efx/base: update EF100 registers definitions Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 03/38] net/sfc: add switch mode device argument Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 04/38] net/sfc: insert switchdev mode MAE rules Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 05/38] common/sfc_efx/base: add an API to get mport ID by selector Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 06/38] net/sfc: support EF100 Tx override prefix Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 07/38] net/sfc: add representors proxy infrastructure Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 08/38] net/sfc: reserve TxQ and RxQ for port representors Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 09/38] net/sfc: move adapter state enum to separate header Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 10/38] common/sfc_efx/base: allow creating invalid mport selectors Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 11/38] net/sfc: add port representors infrastructure Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 12/38] common/sfc_efx/base: add filter ingress mport matching field Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 13/38] common/sfc_efx/base: add API to get mport selector by ID Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 14/38] common/sfc_efx/base: add mport alias MCDI wrappers Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 15/38] net/sfc: add representor proxy port API Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 16/38] net/sfc: implement representor queue setup and release Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 17/38] net/sfc: implement representor RxQ start/stop Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 18/38] net/sfc: implement representor TxQ start/stop Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 19/38] net/sfc: implement port representor start and stop Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 20/38] net/sfc: implement port representor link update Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 21/38] net/sfc: support multiple device probe Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 22/38] net/sfc: implement representor Tx routine Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 23/38] net/sfc: use xword type for EF100 Rx prefix Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 24/38] net/sfc: handle ingress m-port in " Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 25/38] net/sfc: implement representor Rx routine Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 26/38] net/sfc: add simple port representor statistics Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 27/38] net/sfc: free MAE lock once switch domain is assigned Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 28/38] common/sfc_efx/base: add multi-host function M-port selector Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 29/38] common/sfc_efx/base: retrieve function interfaces for VNICs Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 30/38] common/sfc_efx/base: add a means to read MAE mport journal Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 31/38] common/sfc_efx/base: allow getting VNIC MCDI client handles Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 32/38] net/sfc: maintain controller to EFX interface mapping Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 33/38] net/sfc: store PCI address for represented entities Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 34/38] net/sfc: include controller and port in representor name Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 35/38] net/sfc: support new representor parameter syntax Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 36/38] net/sfc: use switch port ID as representor ID Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 37/38] net/sfc: implement the representor info API Andrew Rybchenko
2021-10-11 14:48   ` [dpdk-dev] [PATCH v2 38/38] net/sfc: update comment about representor support Andrew Rybchenko
2021-10-12 16:45   ` [dpdk-dev] [PATCH v2 00/38] net/sfc: support port representors Ferruh Yigit

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=20210827065717.1838258-7-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=amoreton@xilinx.com \
    --cc=dev@dpdk.org \
    --cc=igor.romanov@oktetlabs.ru \
    --cc=ivan.malov@oktetlabs.ru \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).