From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Igor Romanov <igor.romanov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 08/12] net/sfc: introduce descriptor space check in Tx prepare
Date: Tue, 2 Apr 2019 10:28:40 +0100 [thread overview]
Message-ID: <1554197324-32391-9-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>
Add descriptor space check to Tx prepare function to inform a caller
that a packet that needs more than maximum Tx descriptors of a queue
can not be sent.
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/sfc_dp_tx.h | 31 ++++++++++++++++++++++++++++++-
drivers/net/sfc/sfc_ef10_tx.c | 4 +++-
drivers/net/sfc/sfc_tx.c | 9 ++++++++-
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sfc/sfc_dp_tx.h b/drivers/net/sfc/sfc_dp_tx.h
index c42d0d01f..ebc941857 100644
--- a/drivers/net/sfc/sfc_dp_tx.h
+++ b/drivers/net/sfc/sfc_dp_tx.h
@@ -196,8 +196,13 @@ 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,
- uint32_t tso_tcp_header_offset_limit)
+ uint32_t tso_tcp_header_offset_limit,
+ unsigned int max_fill_level,
+ unsigned int nb_tso_descs,
+ unsigned int nb_vlan_descs)
{
+ unsigned int descs_required = m->nb_segs;
+
#ifdef RTE_LIBRTE_SFC_EFX_DEBUG
int ret;
@@ -214,11 +219,35 @@ sfc_dp_tx_prepare_pkt(struct rte_mbuf *m,
if (m->ol_flags & PKT_TX_TCP_SEG) {
unsigned int tcph_off = m->l2_len + m->l3_len;
+ unsigned int header_len = tcph_off + m->l4_len;
if (unlikely(tcph_off > tso_tcp_header_offset_limit))
return EINVAL;
+
+ descs_required += nb_tso_descs;
+
+ /*
+ * Extra descriptor that is required when a packet header
+ * is separated from remaining content of the first segment.
+ */
+ if (rte_pktmbuf_data_len(m) > header_len)
+ descs_required++;
}
+ /*
+ * The number of VLAN descriptors is added regardless of requested
+ * VLAN offload since VLAN is sticky and sending packet without VLAN
+ * insertion may require VLAN descriptor to reset the sticky to 0.
+ */
+ descs_required += nb_vlan_descs;
+
+ /*
+ * Max fill level must be sufficient to hold all required descriptors
+ * to send the packet entirely.
+ */
+ if (descs_required > max_fill_level)
+ return ENOBUFS;
+
return 0;
}
diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index 3d6ba4292..e7ab993dd 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -349,7 +349,9 @@ sfc_ef10_prepare_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
}
#endif
ret = sfc_dp_tx_prepare_pkt(m,
- txq->tso_tcp_header_offset_limit);
+ txq->tso_tcp_header_offset_limit,
+ txq->max_fill_level,
+ SFC_EF10_TSO_OPT_DESCS_NUM, 0);
if (unlikely(ret != 0)) {
rte_errno = ret;
break;
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index e128bff90..4037802e6 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -709,8 +709,15 @@ sfc_efx_prepare_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
for (i = 0; i < nb_pkts; i++) {
int ret;
+ /*
+ * EFX Tx datapath may require extra VLAN descriptor if VLAN
+ * insertion offload is requested regardless the offload
+ * requested/supported.
+ */
ret = sfc_dp_tx_prepare_pkt(tx_pkts[i],
- encp->enc_tx_tso_tcp_header_offset_limit);
+ encp->enc_tx_tso_tcp_header_offset_limit,
+ txq->max_fill_level, EFX_TX_FATSOV2_OPT_NDESCS,
+ 1);
if (unlikely(ret != 0)) {
rte_errno = ret;
break;
--
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 ` [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 ` Andrew Rybchenko [this message]
2019-04-02 9:28 ` [dpdk-dev] [PATCH 08/12] net/sfc: introduce descriptor space check in " 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-9-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).