DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Igor Romanov <igor.romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 06/12] net/sfc: support Tx preparation in EF10 simple datapath
Date: Tue, 2 Apr 2019 10:28:38 +0100	[thread overview]
Message-ID: <1554197324-32391-7-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com>

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

Implement tx_prepare callback. The implementation checks for anything
only in RTE debug mode. No checks are done otherwise because EF10
simple datapath ignores Tx offloads.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_ef10_tx.c | 59 +++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index 05f30cb2e..b317997ca 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -750,6 +750,62 @@ sfc_ef10_simple_tx_reap(struct sfc_ef10_txq *txq)
 			   txq->evq_read_ptr);
 }
 
+#ifdef RTE_LIBRTE_SFC_EFX_DEBUG
+static uint16_t
+sfc_ef10_simple_prepare_pkts(__rte_unused void *tx_queue,
+			     struct rte_mbuf **tx_pkts,
+			     uint16_t nb_pkts)
+{
+	uint16_t i;
+
+	for (i = 0; i < nb_pkts; i++) {
+		struct rte_mbuf *m = tx_pkts[i];
+		int ret;
+
+		ret = rte_validate_tx_offload(m);
+		if (unlikely(ret != 0)) {
+			/*
+			 * Negative error code is returned by
+			 * rte_validate_tx_offload(), but positive are used
+			 * inside net/sfc PMD.
+			 */
+			SFC_ASSERT(ret < 0);
+			rte_errno = -ret;
+			break;
+		}
+
+		/* ef10_simple does not support TSO and VLAN insertion */
+		if (unlikely(m->ol_flags &
+			     (PKT_TX_TCP_SEG | PKT_TX_VLAN_PKT))) {
+			rte_errno = ENOTSUP;
+			break;
+		}
+
+		/* ef10_simple does not support scattered packets */
+		if (unlikely(m->nb_segs != 1)) {
+			rte_errno = ENOTSUP;
+			break;
+		}
+
+		/*
+		 * ef10_simple requires fast-free which ignores reference
+		 * counters
+		 */
+		if (unlikely(rte_mbuf_refcnt_read(m) != 1)) {
+			rte_errno = ENOTSUP;
+			break;
+		}
+
+		/* ef10_simple requires single pool for all packets */
+		if (unlikely(m->pool != tx_pkts[0]->pool)) {
+			rte_errno = ENOTSUP;
+			break;
+		}
+	}
+
+	return i;
+}
+#endif
 
 static uint16_t
 sfc_ef10_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
@@ -1068,5 +1124,8 @@ struct sfc_dp_tx sfc_ef10_simple_tx = {
 	.qstop			= sfc_ef10_tx_qstop,
 	.qreap			= sfc_ef10_tx_qreap,
 	.qdesc_status		= sfc_ef10_tx_qdesc_status,
+#ifdef RTE_LIBRTE_SFC_EFX_DEBUG
+	.pkt_prepare		= sfc_ef10_simple_prepare_pkts,
+#endif
 	.pkt_burst		= sfc_ef10_simple_xmit_pkts,
 };
-- 
2.17.1

  parent reply	other threads:[~2019-04-02  9:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02  9:28 [dpdk-dev] [PATCH 00/12] net/sfc: add Tx prepare and encapsulated TSO Andrew Rybchenko
2019-04-02  9:28 ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 01/12] net/sfc: improve TSO header length check in EFX datapath Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 02/12] net/sfc: improve TSO header length check in EF10 datapath Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 03/12] net/sfc: make TSO descriptor numbers EF10-specific Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 04/12] net/sfc: support Tx preparation in EFX datapath Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 05/12] net/sfc: support Tx preparation in EF10 datapath Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` Andrew Rybchenko [this message]
2019-04-02  9:28   ` [dpdk-dev] [PATCH 06/12] net/sfc: support Tx preparation in EF10 simple datapath Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 07/12] net/sfc: move TSO header checks from Tx burst to Tx prepare Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 08/12] net/sfc: introduce descriptor space check in " Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 09/12] net/sfc: add TSO header length check to " Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 10/12] net/sfc: factor out function to get IPv4 packet ID for TSO Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 11/12] net/sfc: improve log message about missing HW TSO support Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-dev] [PATCH 12/12] net/sfc: support tunnel TSO on EF10 native Tx datapath Andrew Rybchenko
2019-04-02  9:28   ` Andrew Rybchenko
2019-04-03 18:03 ` [dpdk-dev] [PATCH 00/12] net/sfc: add Tx prepare and encapsulated TSO Ferruh Yigit
2019-04-03 18:03   ` 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=1554197324-32391-7-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=igor.romanov@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).