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 10685A0032; Thu, 1 Sep 2022 14:50:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4EBF40C35; Thu, 1 Sep 2022 14:50:09 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) by mails.dpdk.org (Postfix) with ESMTP id 61B4940695 for ; Thu, 1 Sep 2022 14:50:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g+3VWeEUXwW31xByvtpn/DULg6kE1+rr7tLWsWkzHkLeLXlWXTLErXyfkAjgALn5Gnsqq+CuI1qRwVP/ZkcsS9hYakwrc7y/ykcfD5bwBXt+4+rRhFix9bmh0C1s1uVl8fRGNFewXdvGnfRy6tN/KG6x8EQNpqW6JKT5GrbNk5L44kfC5lEH1QrA04Ce4jmcPOktIb5Ap3YTYy7rXlysdQr1anvotLrLGFcvth0KkxZI3aYWO9YoPJqdKL5PyacwUhMHWABnCA/+gtSPv1elnp/I6pn+hsU0HztLw3eQyqO7ytGX6MHT0Ki5M0EqHzssYitefMkL0EGzVJLQe39DjQ== 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=ipVbIf72QKBNMhrsNeswyhzrhGKiseCnyWp2LYTNKQ4=; b=bTQI5AZk4sYT8IZq+gSo6fKbwAcN4+3kvOV0dKb0KHU/3ioCdUdA98HDwuGm0ExRyPXypSkgiYDuMNgwPQfYp6D5GRzjFEspuF73Qwf2dvX0kUWa2EJNtIs8CNCRhsarKBxMb03vsgPSzX6qPkaGexxc+zBJ/vnECbA1btG+IB1+PXnoYMRkoUgjC6irdetsCsuJa4MHaB9TeIfBtttPfR0HBTqophhctNFrYpxs4cQzE+D6ngqjSlrqKUrSHLM4xsf+fKlk9xx4MaZ2YUp2z4eLAVzkOVlzsbdTRNziYKljZpFYncU6j0y+1PTac5wbUQNjMbnaFP4Zia+jFMoRpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ipVbIf72QKBNMhrsNeswyhzrhGKiseCnyWp2LYTNKQ4=; b=d0sIjSyVY9PmVUO0vRFkj1tPRSquT7S1da0GEtLjmcha6KUMIN/QzYIbGkKAWoENrOfgdFkX9p79q6AoDKnolgioljJqR8yLv46pzap97ukRlWhMzLXwotvWhDVs9PC07BU3RAbS3CneCBOn7Ik8F3XcGEOq2pDC8MxZ0TVvPNM= Received: from BN1PR10CA0019.namprd10.prod.outlook.com (2603:10b6:408:e0::24) by CY5PR12MB6035.namprd12.prod.outlook.com (2603:10b6:930:2d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Thu, 1 Sep 2022 12:50:06 +0000 Received: from BN8NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e0:cafe::fd) by BN1PR10CA0019.outlook.office365.com (2603:10b6:408:e0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 12:50:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT062.mail.protection.outlook.com (10.13.177.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 12:50:05 +0000 Received: from cae-Selwin.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 1 Sep 2022 07:50:03 -0500 From: Bhagyada Modali To: , CC: , Bhagyada Modali Subject: [PATCH v2 1/4] net/axgbe: fix scattered Rx Date: Thu, 1 Sep 2022 08:49:45 -0400 Message-ID: <20220901124948.97063-1-bhagyada.modali@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220901053311.92964-1-bhagyada.modali@amd.com> References: <20220901053311.92964-1-bhagyada.modali@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c08f8067-63bc-49b5-71ce-08da8c187eba X-MS-TrafficTypeDiagnostic: CY5PR12MB6035:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GRzqxpgtm4bELcg4EMtj3DuBUfK4Awb49jFg5FTDIy8VZXrDD/cl0S0u/jzXrlerabqbW+cw2NRWHx5vGVdqzvS8Bmz3BwPBgcm5XMfKJLRr7UvKQ7aEh317+GNCT3Ixh5D4gxDqsJ1ZbJyJ6bEISmQpAzGKVcMM78ZrXqbNF9rJovx9aqYrh+qFJGWmwAHSi/swzDOsok9wpU/bKHGfQtCcRZVmPEWhZLaJHlJN0tr+zmrikbHtqt9IdrQM9pm9PHcd39xajdoV0wHe7go58Xi8eW5PasO1gSeyzK+h6P6sGcHayRdOr1hNWb56n83D9+1yDFAb0rkpu1a6ZH/ntyPD4oI10I0NQZqhLA/ance2gtSo1fF6gu5HwaqcGdfr7+Xrs7uzT4NLlWYqngGkQgOKfAUY32JS/Q4rFwp2goL0mGpA83B9g+Zt1+EYI4uIE1dJnGJxigk+iMrfojoVlXbEbL4uajvHEpSzSA63+vrSTjsxvp4x+U6N5XHz/bX/M6ZXzK8S2veYg+3pgdEDpkdnXkd5ueRyp7xK1XoXRkeHg1cAAqvZxXZk93LrSvMFtIow5MFS9vMBlPgpOJgRuA/tLHlsB4L6pZznGtutP2t2NZSEOkw6ukDZadY68b3t+SHO48XOx1l6LSZ3v6OeSkdpKAkvH1v6bmI4OFHZNJS8C7i1H0YSXzoudl4NsgpsHwZ5BFbiJEexECg6opCTe9hh2ZZBqrcOKfBMOkjRVTsBBualvS6vBPJPnngfvkDBuoU4OW0gcEqZV5k0sXxxWR/vgtZMtq3JNCK8ZpXcfWiF5rHNFxE522fJQzI5NfyHJFH2/7c3+8exbH7xPL9+pw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(136003)(346002)(376002)(396003)(39860400002)(40470700004)(36840700001)(46966006)(36860700001)(82740400003)(40460700003)(81166007)(54906003)(86362001)(316002)(6636002)(8936002)(110136005)(2906002)(44832011)(356005)(8676002)(70586007)(426003)(83380400001)(186003)(70206006)(82310400005)(5660300002)(47076005)(1076003)(2616005)(336012)(16526019)(4326008)(7696005)(6666004)(40480700001)(26005)(41300700001)(36756003)(478600001)(83323001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 12:50:05.8973 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c08f8067-63bc-49b5-71ce-08da8c187eba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6035 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 Error check needs to be done only for last segment of Jumbo packet. Freed first_seg and reset eop to 0 in error case Fixes: 965b3127d425 ("net/axgbe: support scattered Rx") Signed-off-by: Bhagyada Modali --- v2: * removed the extra paranthesis * initialised the variables * updated the commit logs --- drivers/net/axgbe/axgbe_rxtx.c | 35 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index f38bb64fab..89ed6fd74a 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -343,8 +343,8 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, uint64_t old_dirty = rxq->dirty; struct rte_mbuf *first_seg = NULL; struct rte_mbuf *mbuf, *tmbuf; - unsigned int err, etlt; - uint32_t error_status; + unsigned int err = 0, etlt; + uint32_t error_status = 0; uint16_t idx, pidx, data_len = 0, pkt_len = 0; uint64_t offloads; @@ -381,19 +381,6 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, } mbuf = rxq->sw_ring[idx]; - /* Check for any errors and free mbuf*/ - err = AXGMAC_GET_BITS_LE(desc->write.desc3, - RX_NORMAL_DESC3, ES); - error_status = 0; - if (unlikely(err)) { - error_status = desc->write.desc3 & AXGBE_ERR_STATUS; - if ((error_status != AXGBE_L3_CSUM_ERR) - && (error_status != AXGBE_L4_CSUM_ERR)) { - rxq->errors++; - rte_pktmbuf_free(mbuf); - goto err_set; - } - } rte_prefetch1(rte_pktmbuf_mtod(mbuf, void *)); if (!AXGMAC_GET_BITS_LE(desc->write.desc3, @@ -406,6 +393,24 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, pkt_len = AXGMAC_GET_BITS_LE(desc->write.desc3, RX_NORMAL_DESC3, PL); data_len = pkt_len - rxq->crc_len; + /* Check for any errors and free mbuf*/ + err = AXGMAC_GET_BITS_LE(desc->write.desc3, + RX_NORMAL_DESC3, ES); + error_status = 0; + if (unlikely(err)) { + error_status = desc->write.desc3 & + AXGBE_ERR_STATUS; + if (error_status != AXGBE_L3_CSUM_ERR && + error_status != AXGBE_L4_CSUM_ERR) { + rxq->errors++; + rte_pktmbuf_free(mbuf); + rte_pktmbuf_free(first_seg); + first_seg = NULL; + eop = 0; + goto err_set; + } + } + } if (first_seg != NULL) { -- 2.25.1