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 B0CA9A00C2; Thu, 16 Jun 2022 19:03:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3E0B4014F; Thu, 16 Jun 2022 19:03:46 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) by mails.dpdk.org (Postfix) with ESMTP id 4D3CD40141 for ; Thu, 16 Jun 2022 19:03:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fGKMm+BBPmyBNWAyjFp0TcmZkW3y9QRsp6vkeBhRJ95b64obsWLUPeShcvD1GD+LuPFsfkDvJLmk8dJwLTOLliGda4ptcxGoEuWpCBZWAg8xRAwoHwjZtuVEw/TTBK/+8X/0ZCiqI6+fzBn/6BNExxb/zA1h+yHg1zsP4/c3c+FVLuGhBk6T5Y3H1L58QteXP8ZSBE6yj1qu+igSYS5TtOtQyrpz2Neo4xkvlUJJyXfOPZ26xoQ9LrR+yozV+0HCRMnBUMQ1SCpL25UQDletW+cFul90BXr+6rIFhEbfUDZqmxJl6tEINHq5qDDRLbtZ4KKBI4whUWdkDVWIEsxlsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VMv5CNReLOPHBB28RPTTtJ/Bxh3wkle7cugt5hejtjI=; b=UUT4Svw6Mol1VitE2KNDYt+kh2l3oGODo2Qd0eCZp/my8l1DDLr4S5mgckRLIkYb1B9+OZ3ZsQvL6qv4eheM3dzeJB92l8dU0z3GJ92+9eLqDrsRswt7SR8DZUNRotOuA+gygnhqcVHJEuFTKLrT2HU66FnOlqPvq/X1NGhslS6uOZ+mlunKqWH2D696SoJIxrcSqZ8MlUCe4QqUEX2yL45hksM8L8W/6Ldfj3niXL0Wn7JeEh2dVVkbC2MDuyN0ltrl94b5pzj1Yyicze64RjIRCxoSKZUw1LOHxqH+88Gi9Z0hReSEm6qy32su72Etc+ard0HOnN121j3jCMa1KQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=broadcom.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VMv5CNReLOPHBB28RPTTtJ/Bxh3wkle7cugt5hejtjI=; b=ZhHKQ+YbuTBzLUau8OtlNacnScLKEjt99LYPmqh+lVdgGygncG5uRELA1xYsyKOvLKuyQtRpoQwaK9g5teExVXbf1QiiceLDd06e5Xv3BqEidbA9lJep96427gqpQ8IBA3qC/Bphna+J8dUYHzvndmtHoNkBAPjfxRzsda+wWAg= Received: from DM6PR08CA0012.namprd08.prod.outlook.com (2603:10b6:5:80::25) by SN6PR02MB5408.namprd02.prod.outlook.com (2603:10b6:805:e7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 17:03:41 +0000 Received: from DM3NAM02FT019.eop-nam02.prod.protection.outlook.com (2603:10b6:5:80:cafe::de) by DM6PR08CA0012.outlook.office365.com (2603:10b6:5:80::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.22 via Frontend Transport; Thu, 16 Jun 2022 17:03:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by DM3NAM02FT019.mail.protection.outlook.com (10.13.4.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5353.14 via Frontend Transport; Thu, 16 Jun 2022 17:03:40 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 16 Jun 2022 18:03:39 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 16 Jun 2022 18:03:39 +0100 Envelope-to: kalesh-anakkur.purayil@broadcom.com, ajit.khaparde@broadcom.com, dev@dpdk.org Received: from [172.21.34.28] (port=64440) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o1suA-0006TZ-Ty; Thu, 16 Jun 2022 18:03:39 +0100 Message-ID: <9bb5c847-cde8-ff20-8468-3c69e7b2af3b@xilinx.com> Date: Thu, 16 Jun 2022 18:03:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [dpdk-dev] [PATCH 1/8] net/bnxt: remove assert for zero data len in Tx path Content-Language: en-US To: Kalesh A P CC: , References: <20220615145703.6613-1-kalesh-anakkur.purayil@broadcom.com> <20220615145703.6613-2-kalesh-anakkur.purayil@broadcom.com> From: Ferruh Yigit In-Reply-To: <20220615145703.6613-2-kalesh-anakkur.purayil@broadcom.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92e65707-c313-4653-17f7-08da4fba29d7 X-MS-TrafficTypeDiagnostic: SN6PR02MB5408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HXR02mag9opHoKHG/X8SDVC+LNK1xOBqD+KXbQ/WBPtBkcNGzD0zrs+g5YTnvXIAU9G01AIcD7BPdiUDMtlrglcrLxQcRt/cJWKRi+A5Tau5ME9+/1F/Xn/dkJa2tg0Zf1ncTir8E2O+Ne7TlMEWT6gTvkDEBxKnUeEgMh9BiyihgvR5bPbbEopJMIRT6BjVr9A6zlenrMgR+tzCwzpKRtKU4B/y/vVl9mv2Mdm0WqowWvzyoGWByVfp9kln4AkyYvdpXjoi/IW4xisieAoccbzjlJ5Pw3JBbLp9dAGjwKrUS+kkWs91zjLXzPuscz06D0/a4UUkGzNQbcBMkN6Qdu/SKtvZ7P4tqoWaVz8+BA7YA8tiMoAFQC+ilPVJema8jtTlkBdTdZDOKM0J5QF3kDwh2BCgUF//IBGZ8jKp6CMdmFODw5dp0lkj68vrJh8ssmxyPlw48PrjqLEl059+hnf3Vo+ekwp0UYJ4KNWozHl4CnDKaGI2rKtCsmWQbdmxST1n7M1y2oy1hPt5oDaUflXyqwCGWm8GZtog/t9zEF6O2UhhM4ZwtskNdUTaqET+y78JCrSUqN8QcDMTAnncK4E6umbghFQewzXyA3QWpwUJFFMyrX4ZI6B3+8apWJMzOCBT5mVXezLggG/9M8aDBHj2UgVN5vu6wQPZBW1TwGY0/aY1/Cil9DbC4EkoT2yVs/qdlJCuOUzAsVP2uthrOR/tg8XZTRPJaRDctJjUk+Y= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(40470700004)(36840700001)(46966006)(2616005)(70586007)(36860700001)(44832011)(82310400005)(8676002)(4326008)(40460700003)(508600001)(70206006)(186003)(31696002)(47076005)(336012)(83380400001)(26005)(356005)(9786002)(31686004)(53546011)(426003)(8936002)(6916009)(36756003)(54906003)(316002)(5660300002)(7636003)(2906002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 17:03:40.8632 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92e65707-c313-4653-17f7-08da4fba29d7 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT019.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5408 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 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?