From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Igor Romanov <igor.romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 04/12] net/sfc: support Tx preparation in EFX datapath
Date: Tue, 2 Apr 2019 10:28:36 +0100 [thread overview]
Message-ID: <1554197324-32391-5-git-send-email-arybchenko@solarflare.com> (raw)
Message-ID: <20190402092836._AJFxmoZB9HSxu444m4nxIr93dyp7da1NDZeV8Znvuc@z> (raw)
In-Reply-To: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com>
From: Igor Romanov <igor.romanov@oktetlabs.ru>
Implement generic checks in Tx prepare function and update Tx burst
function accordingly.
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
doc/guides/rel_notes/release_19_05.rst | 1 +
drivers/net/sfc/sfc_dp_tx.h | 24 ++++++++++++++++++++++++
drivers/net/sfc/sfc_ethdev.c | 4 ++++
drivers/net/sfc/sfc_tso.c | 13 +++++++------
drivers/net/sfc/sfc_tx.c | 20 ++++++++++++++++++++
5 files changed, 56 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst
index bdad1ddbe..173c852c8 100644
--- a/doc/guides/rel_notes/release_19_05.rst
+++ b/doc/guides/rel_notes/release_19_05.rst
@@ -73,6 +73,7 @@ New Features
* Added support for RSS RETA and hash configuration get API in a secondary
process.
* Added support for Rx packet types list in a secondary process.
+ * Added Tx prepare to do Tx offloads checks.
* **Updated Mellanox drivers.**
diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h
index 9cb2198e2..885094b67 100644
--- a/drivers/net/sfc/sfc_dp_tx.h
+++ b/drivers/net/sfc/sfc_dp_tx.h
@@ -13,6 +13,7 @@
#include <rte_ethdev_driver.h>
#include "sfc_dp.h"
+#include "sfc_debug.h"
#ifdef __cplusplus
extern "C" {
@@ -170,6 +171,7 @@ struct sfc_dp_tx {
sfc_dp_tx_qtx_ev_t *qtx_ev;
sfc_dp_tx_qreap_t *qreap;
sfc_dp_tx_qdesc_status_t *qdesc_status;
+ eth_tx_prep_t pkt_prepare;
eth_tx_burst_t pkt_burst;
};
@@ -192,6 +194,28 @@ sfc_dp_find_tx_by_caps(struct sfc_dp_list *head, unsigned int avail_caps)
/** Get Tx datapath ops by the datapath TxQ handle */
const struct sfc_dp_tx *sfc_dp_tx_by_dp_txq(const struct sfc_dp_txq *dp_txq);
+static inline int
+sfc_dp_tx_prepare_pkt(struct rte_mbuf *m)
+{
+#ifdef RTE_LIBRTE_SFC_EFX_DEBUG
+ int ret;
+
+ ret = rte_validate_tx_offload(m);
+ if (ret != 0) {
+ /*
+ * Negative error code is returned by rte_validate_tx_offload(),
+ * but positive are used inside net/sfc PMD.
+ */
+ SFC_ASSERT(ret < 0);
+ return -ret;
+ }
+#else
+ RTE_SET_USED(m);
+#endif
+
+ return 0;
+}
+
extern struct sfc_dp_tx sfc_efx_tx;
extern struct sfc_dp_tx sfc_ef10_tx;
extern struct sfc_dp_tx sfc_ef10_simple_tx;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 2675d4a8c..6c33601e7 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1854,6 +1854,7 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
sa->priv.dp_tx = dp_tx;
dev->rx_pkt_burst = dp_rx->pkt_burst;
+ dev->tx_pkt_prepare = dp_tx->pkt_prepare;
dev->tx_pkt_burst = dp_tx->pkt_burst;
dev->dev_ops = &sfc_eth_dev_ops;
@@ -1881,6 +1882,7 @@ sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
dev->dev_ops = NULL;
+ dev->tx_pkt_prepare = NULL;
dev->rx_pkt_burst = NULL;
dev->tx_pkt_burst = NULL;
@@ -1961,6 +1963,7 @@ sfc_eth_dev_secondary_init(struct rte_eth_dev *dev, uint32_t logtype_main)
dev->process_private = sap;
dev->rx_pkt_burst = dp_rx->pkt_burst;
+ dev->tx_pkt_prepare = dp_tx->pkt_prepare;
dev->tx_pkt_burst = dp_tx->pkt_burst;
dev->dev_ops = &sfc_eth_dev_secondary_ops;
@@ -1982,6 +1985,7 @@ sfc_eth_dev_secondary_clear_ops(struct rte_eth_dev *dev)
free(dev->process_private);
dev->process_private = NULL;
dev->dev_ops = NULL;
+ dev->tx_pkt_prepare = NULL;
dev->tx_pkt_burst = NULL;
dev->rx_pkt_burst = NULL;
}
diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c
index 1ce787f3c..2c03c0837 100644
--- a/drivers/net/sfc/sfc_tso.c
+++ b/drivers/net/sfc/sfc_tso.c
@@ -97,7 +97,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
uint8_t *tsoh;
const struct tcp_hdr *th;
efsys_dma_addr_t header_paddr;
- uint16_t packet_id;
+ uint16_t packet_id = 0;
uint32_t sent_seq;
struct rte_mbuf *m = *in_seg;
size_t nh_off = m->l2_len; /* IP header offset */
@@ -147,17 +147,18 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
tsoh = rte_pktmbuf_mtod(m, uint8_t *);
}
- /* Handle IP header */
+ /*
+ * Handle IP header. Tx prepare has debug-only checks that offload flags
+ * are correctly filled in in TSO mbuf. Use zero IPID if there is no
+ * IPv4 flag. If the packet is still IPv4, HW will simply start from
+ * zero IPID.
+ */
if (m->ol_flags & PKT_TX_IPV4) {
const struct ipv4_hdr *iphe4;
iphe4 = (const struct ipv4_hdr *)(tsoh + nh_off);
rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t));
packet_id = rte_be_to_cpu_16(packet_id);
- } else if (m->ol_flags & PKT_TX_IPV6) {
- packet_id = 0;
- } else {
- return EINVAL;
}
/* Handle TCP header */
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 4b1f94ce8..16fd220bf 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -697,6 +697,25 @@ sfc_efx_tx_maybe_insert_tag(struct sfc_efx_txq *txq, struct rte_mbuf *m,
return 1;
}
+static uint16_t
+sfc_efx_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++) {
+ int ret;
+
+ ret = sfc_dp_tx_prepare_pkt(tx_pkts[i]);
+ if (unlikely(ret != 0)) {
+ rte_errno = ret;
+ break;
+ }
+ }
+
+ return i;
+}
+
static uint16_t
sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
@@ -1122,5 +1141,6 @@ struct sfc_dp_tx sfc_efx_tx = {
.qstop = sfc_efx_tx_qstop,
.qreap = sfc_efx_tx_qreap,
.qdesc_status = sfc_efx_tx_qdesc_status,
+ .pkt_prepare = sfc_efx_prepare_pkts,
.pkt_burst = sfc_efx_xmit_pkts,
};
--
2.17.1
next prev 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 ` Andrew Rybchenko [this message]
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 ` [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 ` [dpdk-dev] [PATCH 06/12] net/sfc: support Tx preparation in EF10 simple datapath Andrew Rybchenko
2019-04-02 9:28 ` 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-5-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).