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 9E2FDA0679 for ; Tue, 2 Apr 2019 11:29:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 02D454C8D; Tue, 2 Apr 2019 11:29:05 +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 0369D316B; 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 953A9100080; 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 x329Srab028253; 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 A2629161619; Tue, 2 Apr 2019 10:28:53 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov , Date: Tue, 2 Apr 2019 10:28:34 +0100 Message-ID: <1554197324-32391-3-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-3.461400-4.000000-10 X-TMASE-MatchedRID: HvGoI+Dr3CWROBVNmXUDuB3EEAbn+GRbKx5ICGp/WtElC3U/r0iv82+K i4ehSQYqZBGNXe6iO8mUTQ2JYQzY22+sGcdbpdKct1AhvyEKdj4hdi6zxllm1rlmMfLNiukanv7 3b7w9qN7GlYQBKvLMHK7TkNCy3FigSSOWVJeuO1AURSScn+QSXt0H8LFZNFG7CKFCmhdu5cWO73 dR1O8lRLxdUErJMCFMOEDKwAn5w/D3Sbqt8s5k0D28MEIfM4rFUAp4RH6P3aUvgPVD3ElY4LLIZ ooHOwyi/jJmiBZg3dYPXLxHfxLeXVRHOSKs7RDUXmH0pBaurgG+4xOvsJAknp6oP1a0mRIj X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.461400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24526.005 X-MDID: 1554197338-2yDDbVPhUL6I Subject: [dpdk-dev] [PATCH 02/12] net/sfc: improve TSO header length check in EF10 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: <20190402092834.dYYbJXLdJR9bal-BTCzdOuyQJefLA41UKQBm6trAovA@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: 6bc985e41155 ("net/sfc: support TSO in EF10 Tx datapath") Cc: stable@dpdk.org Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- 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