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 421F7A04FD; Mon, 20 Jun 2022 01:09:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDB8240223; Mon, 20 Jun 2022 01:09:32 +0200 (CEST) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) by mails.dpdk.org (Postfix) with ESMTP id 0E95340150 for ; Mon, 20 Jun 2022 01:09:32 +0200 (CEST) Received: by mail-io1-f44.google.com with SMTP id d123so9529851iof.10 for ; Sun, 19 Jun 2022 16:09:31 -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=m1n+/cvJIoVOj+qwOvsQC6Z+/9pS0o+NWVZeVjPrwMo=; b=SB0G4W1LrxWz9AJSAN4ZCZ619ygcUwhus1KFRM07cal3mKzprTARIsicJWGlw4Jc6I WDH8CCRoB2x43r4wLc3KaFBIzNI9cM6yMZ8jmgBewN85BIKyar6kok3wgA265Ct/A8RD LhSyoQ64V7tpx5JzklxqMSWfa6vDXh6KXMhsk= 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=m1n+/cvJIoVOj+qwOvsQC6Z+/9pS0o+NWVZeVjPrwMo=; b=F+HiJdQJYk7ZV0FVqiPrln3kYOJ9vgsl/NaMIBv6ww23iebfU5WFTpMFs0Bb3P2Y5V s/87Mo7e2vgrkWdLB3txtvlZWomhUliO+fs6CEmpM+Evc8mdDj1wDn6Ntntvk7N6P19W HM4YFQa9n35soKg+2RxFkt43lNPOakX5M8HM0kmd/kd2I2GDF0qqIKb3r0SbIsO53XBE GG22HacQcGKtS8+CmNIPML2I1b2qHxy66MgF8QjqQz+H35ZBwNh5MiU8yvmlA0Fh8NG8 8zAyokiCuZG4W+hkVHJrzD2KZRtVHEqyE+X9/mjgQrgwLhPAK9fhWYrsjGYHwvhcuCCv 3cDg== X-Gm-Message-State: AJIora8tnR2IUDLZnhpPB1hOPUo1jtDIfN0hgOANC3iyEGT/HpQACEG4 xGNAr98DLsKxDe7PG26j+ELuPg8Z+VAyt5PGc3MCBg== X-Google-Smtp-Source: AGRyM1ttXf77Px2hQzyuJQyGtJ0K0lGjYNY9m8nb4qC3zuFWHeg6xgfCDf0ub5z/VeG3oMbNGbSodu6wHSQRgJnYvJg= X-Received: by 2002:a05:6638:3729:b0:332:1c7e:91f7 with SMTP id k41-20020a056638372900b003321c7e91f7mr11291203jav.84.1655680171109; Sun, 19 Jun 2022 16:09:31 -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: <9bb5c847-cde8-ff20-8468-3c69e7b2af3b@xilinx.com> From: Ajit Khaparde Date: Sun, 19 Jun 2022 16:09:15 -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 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000007ba93805e1d51472" 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 --0000000000007ba93805e1d51472 Content-Type: text/plain; charset="UTF-8" On Thu, Jun 16, 2022 at 10:03 AM Ferruh Yigit wrote: > > On 6/15/2022 3:56 PM, Kalesh A P wrote: > > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. > > > > > > 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? Thanks > --0000000000007ba93805e1d51472 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/EiXfYnK7zeop26ry1RpKtogB7/O115zultAz64ydQYLe+a1e/czkALg3sgTcOOcFZTXk38e aqsXsipoX1vsNurqPtnC27TWsA7pk4uKXscFjkeUE8JZu9BDKaswZygxBOPBQBwrA5+20Wxlk6k1 e6EKaaNaNZUy30q3ArEf30ZDpXyfCtiXnupjSK8WU2cK4qsEtj09JS4+mhi0CTCrCnXAzum3tgcH cHRg0prcSzzEUDQWoFxyuqwiwhHu3sPQNmFOMwIDAQABo4IB2jCCAdYwDgYDVR0PAQH/BAQDAgGG MGAGA1Ud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