From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Igor Romanov <Igor.Romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 05/12] net/sfc: support Tx preparation in EF10 datapath
Date: Tue, 2 Apr 2019 10:28:37 +0100 [thread overview]
Message-ID: <1554197324-32391-6-git-send-email-arybchenko@solarflare.com> (raw)
Message-ID: <20190402092837.x-PT1pmwp88pTijQG9yNZTDawSh1nOWGFBTjfpStN68@z> (raw)
In-Reply-To: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com>
From: Igor Romanov <Igor.Romanov@oktetlabs.ru>
Implement tx_prepare callback and update Tx burst function accordingly.
Signed-off-by: Igor Romanov <Igor.Romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/sfc_ef10_tx.c | 56 ++++++++++++++++++++++++++++-------
1 file changed, 46 insertions(+), 10 deletions(-)
diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index 999dabd12..05f30cb2e 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -319,6 +319,44 @@ sfc_ef10_try_reap(struct sfc_ef10_txq * const txq, unsigned int added,
return (needed_desc <= *dma_desc_space);
}
+static uint16_t
+sfc_ef10_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;
+
+#ifdef RTE_LIBRTE_SFC_EFX_DEBUG
+ /*
+ * In non-TSO case, check that a packet segments do not exceed
+ * the size limit. Perform the check in debug mode since MTU
+ * more than 9k is not supported, but the limit here is 16k-1.
+ */
+ if (!(m->ol_flags & PKT_TX_TCP_SEG)) {
+ struct rte_mbuf *m_seg;
+
+ for (m_seg = m; m_seg != NULL; m_seg = m_seg->next) {
+ if (m_seg->data_len >
+ SFC_EF10_TX_DMA_DESC_LEN_MAX) {
+ rte_errno = EINVAL;
+ break;
+ }
+ }
+ }
+#endif
+ ret = sfc_dp_tx_prepare_pkt(m);
+ if (unlikely(ret != 0)) {
+ rte_errno = ret;
+ break;
+ }
+ }
+
+ return i;
+}
+
static int
sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
unsigned int *added, unsigned int *dma_desc_space,
@@ -330,7 +368,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
/* Offset of the payload in the last segment that contains the header */
size_t in_off = 0;
const struct tcp_hdr *th;
- uint16_t packet_id;
+ uint16_t packet_id = 0;
uint32_t sent_seq;
uint8_t *hdr_addr;
rte_iova_t hdr_iova;
@@ -433,20 +471,17 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
needed_desc--;
}
- switch (first_m_seg->ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)) {
- case PKT_TX_IPV4: {
+ /*
+ * 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 (first_m_seg->ol_flags & PKT_TX_IPV4) {
const struct ipv4_hdr *iphe4;
iphe4 = (const struct ipv4_hdr *)(hdr_addr + iph_off);
rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t));
packet_id = rte_be_to_cpu_16(packet_id);
- break;
- }
- case PKT_TX_IPV6:
- packet_id = 0;
- break;
- default:
- return EINVAL;
}
th = (const struct tcp_hdr *)(hdr_addr + tcph_off);
@@ -1014,6 +1049,7 @@ struct sfc_dp_tx sfc_ef10_tx = {
.qstop = sfc_ef10_tx_qstop,
.qreap = sfc_ef10_tx_qreap,
.qdesc_status = sfc_ef10_tx_qdesc_status,
+ .pkt_prepare = sfc_ef10_prepare_pkts,
.pkt_burst = sfc_ef10_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 ` [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 ` Andrew Rybchenko [this message]
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 ` [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-6-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=Igor.Romanov@oktetlabs.ru \
--cc=dev@dpdk.org \
/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).