From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 180DFA0679 for ; Tue, 2 Apr 2019 11:29:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 39A9C316B; Tue, 2 Apr 2019 11:29:01 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id F30A25A; Tue, 2 Apr 2019 11:28:58 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 714FD100080; Tue, 2 Apr 2019 09:28:57 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 2 Apr 2019 02:28:55 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 2 Apr 2019 02:28:54 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x329Sr25028250; Tue, 2 Apr 2019 10:28:53 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 96458161612; Tue, 2 Apr 2019 10:28:53 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov , Date: Tue, 2 Apr 2019 10:28:33 +0100 Message-ID: <1554197324-32391-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com> References: <1554197324-32391-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24526.005 X-TM-AS-Result: No-9.187300-4.000000-10 X-TMASE-MatchedRID: /uY/MeRh/pmROBVNmXUDuB3EEAbn+GRbKx5ICGp/WtElC3U/r0iv82+K i4ehSQYqZBGNXe6iO8ksU1BNcY2U9tbms8wOrodvA9lly13c/gHmdC4WbBxTJNx5qKnROjeWq3c ttlDobAzNWMPM/xboAKLNayNmKqXeGbjm5ZdalUGJQ9k+Ypk5CW51jMx4o6ukmyiLZetSf8mfop 0ytGwvXiq2rl3dzGQ15Sd/zBb88tfNVepQibK5INdpm5iFbvpp5sMRmeHaURvPaZKeVLFw8MC+k sT6a9fy X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.187300-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24526.005 X-MDID: 1554197338-W_unjBPPMrsu Subject: [dpdk-dev] [PATCH 01/12] net/sfc: improve TSO header length check in EFX datapath X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190402092833.6lTENpsNzK4wN_J6LV0r_tCtJLa9sympwtqqcteACFU@z> From: Igor Romanov 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 Signed-off-by: Andrew Rybchenko --- 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