patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 01/12] net/sfc: improve TSO header length check in EFX datapath
       [not found] <1554197324-32391-1-git-send-email-arybchenko@solarflare.com>
@ 2019-04-02  9:28 ` Andrew Rybchenko
  2019-04-02  9:28 ` [dpdk-stable] [PATCH 02/12] net/sfc: improve TSO header length check in EF10 datapath Andrew Rybchenko
  1 sibling, 0 replies; 2+ messages in thread
From: Andrew Rybchenko @ 2019-04-02  9:28 UTC (permalink / raw)
  To: dev; +Cc: Igor Romanov, stable

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

Move the check inside xmit function to the branch in which
the check is mandatory. It makes case when TSO header is not
fragmented a bit more faster.

Fixes: fec33d5bb3eb ("net/sfc: support firmware-assisted TSO")
Cc: stable@dpdk.org

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_tso.c | 11 +++++++----
 drivers/net/sfc/sfc_tx.c  |  3 ++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c
index 076a25d44..a28af0e78 100644
--- a/drivers/net/sfc/sfc_tso.c
+++ b/drivers/net/sfc/sfc_tso.c
@@ -107,10 +107,6 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
 
 	idx += SFC_TSO_OPT_DESCS_NUM;
 
-	/* Packets which have too big headers should be discarded */
-	if (unlikely(header_len > SFC_TSOH_STD_LEN))
-		return EMSGSIZE;
-
 	/*
 	 * The TCP header must start at most 208 bytes into the frame.
 	 * If it starts later than this then the NIC won't realise
@@ -129,6 +125,13 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
 	 * limitations on address boundaries crossing by DMA descriptor data.
 	 */
 	if (m->data_len < header_len) {
+		/*
+		 * Discard a packet if header linearization is needed but
+		 * the header is too big.
+		 */
+		if (unlikely(header_len > SFC_TSOH_STD_LEN))
+			return EMSGSIZE;
+
 		tsoh = txq->sw_ring[idx & txq->ptr_mask].tsoh;
 		sfc_tso_prepare_header(tsoh, header_len, in_seg, in_off);
 
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index c3e0936cc..4b1f94ce8 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -760,7 +760,8 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 				/* We may have reached this place for
 				 * one of the following reasons:
 				 *
-				 * 1) Packet header length is greater
+				 * 1) Packet header linearization is needed
+				 *    and the header length is greater
 				 *    than SFC_TSOH_STD_LEN
 				 * 2) TCP header starts at more then
 				 *    208 bytes into the frame
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-stable] [PATCH 02/12] net/sfc: improve TSO header length check in EF10 datapath
       [not found] <1554197324-32391-1-git-send-email-arybchenko@solarflare.com>
  2019-04-02  9:28 ` [dpdk-stable] [PATCH 01/12] net/sfc: improve TSO header length check in EFX datapath Andrew Rybchenko
@ 2019-04-02  9:28 ` Andrew Rybchenko
  1 sibling, 0 replies; 2+ messages in thread
From: Andrew Rybchenko @ 2019-04-02  9:28 UTC (permalink / raw)
  To: dev; +Cc: Igor Romanov, stable

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

Move the check inside xmit function to the branch in which
the check is mandatory. It makes case when TSO header is not
fragmented a bit more faster.

Fixes: 6bc985e41155 ("net/sfc: support TSO in EF10 Tx datapath")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c
index 0711c1136..97b1b6252 100644
--- a/drivers/net/sfc/sfc_ef10_tx.c
+++ b/drivers/net/sfc/sfc_ef10_tx.c
@@ -340,9 +340,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
 	struct rte_mbuf *m_seg_to_free_up_to = first_m_seg;
 	bool eop;
 
-	/* Both checks may be done, so use bit OR to have only one branching */
-	if (unlikely((header_len > SFC_TSOH_STD_LEN) |
-		     (tcph_off > txq->tso_tcp_header_offset_limit)))
+	if (unlikely(tcph_off > txq->tso_tcp_header_offset_limit))
 		return EMSGSIZE;
 
 	/*
@@ -407,6 +405,13 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg,
 		unsigned int hdr_addr_off = (*added & txq->ptr_mask) *
 				SFC_TSOH_STD_LEN;
 
+		/*
+		 * Discard a packet if header linearization is needed but
+		 * the header is too big.
+		 */
+		if (unlikely(header_len > SFC_TSOH_STD_LEN))
+			return EMSGSIZE;
+
 		hdr_addr = txq->tsoh + hdr_addr_off;
 		hdr_iova = txq->tsoh_iova + hdr_addr_off;
 		copied_segs = sfc_tso_prepare_header(hdr_addr, header_len,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-02  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1554197324-32391-1-git-send-email-arybchenko@solarflare.com>
2019-04-02  9:28 ` [dpdk-stable] [PATCH 01/12] net/sfc: improve TSO header length check in EFX datapath Andrew Rybchenko
2019-04-02  9:28 ` [dpdk-stable] [PATCH 02/12] net/sfc: improve TSO header length check in EF10 datapath Andrew Rybchenko

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).