From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD3DAA0545; Mon, 20 Jun 2022 19:04:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C5D34069C; Mon, 20 Jun 2022 19:04:03 +0200 (CEST) Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) by mails.dpdk.org (Postfix) with ESMTP id 1628640151 for ; Mon, 20 Jun 2022 19:04:02 +0200 (CEST) Received: by mail-il1-f171.google.com with SMTP id 9so4397103ill.5 for ; Mon, 20 Jun 2022 10:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=e/j/GINXv8wwPYWze4odkGq7flQQFuhyolE9IP8BJP8=; b=GTpjQD0OLomgM4ebvgmm+VxSqLsPtl8OjzpQLpJH1ZJRg48HcM9BYnZv1ur3WfGUK/ GKJykXWTZ/5MT796I+VLypVH9uVpLaAxGsiaCseFLAyx+mlkbjjVRZFQZOyFwqQP4rKt W42uiyS0l3ILNzPNczcEGN+bEp4v97t+agiHI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=e/j/GINXv8wwPYWze4odkGq7flQQFuhyolE9IP8BJP8=; b=zAikv0gneRs/PAzl5IVBW8YZhheOIX6orGpOogzNTiVhQ4LxDCPr8vLoik5HHfmy73 xWkHBEnIq5H6q3zwvWRO6DjH9pz/DmJ64KPgYaczR8YPmRx9hJfLt5kHLBk6gOs283iX rwZIEMWEJGwZZyLf1ITdL4Pj+lg/k61HPO6aU6JMyRtbDeegwTJ/2DIuqAdreHspDOyA 0oTQ4uCNfeBAZ8DcWkR16hQleULZuaDD23Uopg+6Czl+21evXfagsD7uDvWIYyi1zmW2 un/gkE/2Ls+c7Tfw3cGsD5IZGVhrxpYo7hdE+1FLAAg1bVwAI5kDD5ytFGxuwstZhT1s BVtg== X-Gm-Message-State: AJIora8OJwHZ8iT+MyCxcfZ0CPe/3L2oynJAcGxqe5rLAMK1DRQdVP/6 zZ21FvMBeasNtFgfuhauUdqbZsoiKWRHj7TGWw5IBg== X-Google-Smtp-Source: AGRyM1vOIeITLBn1vp1VN9ttwTV8kmJMDWgG1bOriZOo/z1c3zidD7Cdn3kgdocPJDzbuXpMkO3FT/DSqOW3ABUpdyw= X-Received: by 2002:a05:6e02:1d8f:b0:2d9:2081:ff23 with SMTP id h15-20020a056e021d8f00b002d92081ff23mr1325530ila.80.1655744641404; Mon, 20 Jun 2022 10:04:01 -0700 (PDT) MIME-Version: 1.0 References: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com> <20220615145703.6613-2-kalesh-anakkur.purayil@broadcom.com> <9bb5c847-cde8-ff20-8468-3c69e7b2af3b@xilinx.com> In-Reply-To: From: Ajit Khaparde Date: Mon, 20 Jun 2022 10:03:45 -0700 Message-ID: Subject: Re: [dpdk-dev] [PATCH 1/8] net/bnxt: remove assert for zero data len in Tx path To: Ferruh Yigit Cc: Kalesh A P , dpdk-dev , Andrew Rybchenko , Thomas Monjalon Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000003408fb05e1e417c5" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --0000000000003408fb05e1e417c5 Content-Type: text/plain; charset="UTF-8" On Mon, Jun 20, 2022 at 3:55 AM Ferruh Yigit wrote: > > On 6/20/2022 12:09 AM, Ajit Khaparde wrote: > > On Thu, Jun 16, 2022 at 10:03 AM Ferruh Yigit wrote: > >> > >> On 6/15/2022 3:56 PM, Kalesh A P wrote: > >>> > >>> From: Somnath Kotur > >>> > >>> Currently the PMD tries to detect a potential 0 byte DMA by > >>> using RTE_VERIFY. > >>> But since RTE_VERIFY internally calls rte_panic() it is fatal to > >>> the application and some applications want to avoid that. > >>> So return an error from the bnxt xmit handler if such a bad pkt is > >>> encountered by logging an error message, dumping the pkt header and > >>> dump the current stack as well > >>> > >>> Signed-off-by: Somnath Kotur > >>> Reviewed-by: Ajit Khaparde > >>> --- > >>> drivers/net/bnxt/bnxt_txr.c | 29 ++++++++++++++++++++++++++--- > >>> 1 file changed, 26 insertions(+), 3 deletions(-) > >>> > >>> diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c > >>> index 7a7196a..67e0167 100644 > >>> --- a/drivers/net/bnxt/bnxt_txr.c > >>> +++ b/drivers/net/bnxt/bnxt_txr.c > >>> @@ -123,6 +123,26 @@ bnxt_xmit_need_long_bd(struct rte_mbuf *tx_pkt, struct bnxt_tx_queue *txq) > >>> return false; > >>> } > >>> > >>> +static bool > >>> +bnxt_zero_data_len_tso_segsz(struct rte_mbuf *tx_pkt, uint8_t data_len_chk) > >>> +{ > >>> + const char *type_str = "Data len"; > >>> + uint16_t len_to_check = tx_pkt->data_len; > >>> + > >>> + if (data_len_chk == 0) { > >>> + type_str = "TSO Seg size"; > >>> + len_to_check = tx_pkt->tso_segsz; > >>> + } > >>> + > >>> + if (len_to_check == 0) { > >>> + PMD_DRV_LOG(ERR, "Error! Tx pkt %s == 0\n", type_str); > >>> + rte_pktmbuf_dump(stdout, tx_pkt, 64); > >>> + rte_dump_stack(); > >>> + return true; > >>> + } > >>> + return false; > >>> +} > >>> + > >>> static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, > >>> struct bnxt_tx_queue *txq, > >>> uint16_t *coal_pkts, > >>> @@ -179,7 +199,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, > >>> } > >>> > >>> /* Check non zero data_len */ > >>> - RTE_VERIFY(tx_pkt->data_len); > >>> + if (unlikely(bnxt_zero_data_len_tso_segsz(tx_pkt, 1))) > >>> + return -EIO; > >>> > >> > >> Some PMDs does the similar verification in the 'rte_eth_tx_prepare()' > >> API (tx_pkt_prepare() dev_ops), this helps to separate the checks and Tx > >> data path code, do you want to do the same? > > > > > > When we originally added these checks, we were not sure how prevalent > > is the usage of tx_pkt_prepare() dev_op by various applications. > > > > We will stick with this patch for now and implement that > > rte_eth_tx_prepare() in the next release? > > > > 'rte_eth_tx_prepare()' is not mandatory, so yes there may be > applications that are not calling this API. > > If we have a consensus to have checks in the prepare function, I think > it helps both to PMDs and applications. I agree. Once the changes for tx_pkt_prepare() are ready, we will remove the checks from the Tx burst handler. BNXT PMD will carry the current checks till then. --0000000000003408fb05e1e417c5 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQdgYJKoZIhvcNAQcCoIIQZzCCEGMCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3NMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iYWxTaWduIEdDQyBS MyBQZXJzb25hbFNpZ24gMiBDQSAyMDIwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA vbCmXCcsbZ/a0fRIQMBxp4gJnnyeneFYpEtNydrZZ+GeKSMdHiDgXD1UnRSIudKo+moQ6YlCOu4t rVWO/EiXfYnK7zeop26ry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