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 CD4BEA0545 for ; Fri, 2 Sep 2022 10:48:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE695410F9; Fri, 2 Sep 2022 10:48:19 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2046.outbound.protection.outlook.com [40.107.94.46]) by mails.dpdk.org (Postfix) with ESMTP id 3363E40684; Fri, 2 Sep 2022 10:48:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/sJO5N0BueMgMuUO8bRjQazPwiQ2pH/XJXfmzDIRPDSsdyic88Zj1YVfffoGQV1F3oYTkh4z0FREmq1RCbk98ze95UeVCy0xGN/M6DnldSGSSFGmYo8O/14WwZ+UtnhnvnKLNd2w+9l27fASv8n/KwEilyrDYjXeuwm+x+HvDOQ3pvQkQX/hgMQQL++dxcF8rGayqKkZldZnmpERSS/MRD558u+q1iGkOG8y5kl/vJaHmpIrk/qIAgyTP2Uls8MkoX+sRqZpUAJZrEywD56ys1aw7DyT/l/IztIIvzjDXVoT0bwDdl5F5IR1HSqyJZ3FkbEjl/8hND7c6Q6449BOQ== 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=vdqth9mq0BpTl36BYGJIUTqjUW0Ze1VnepKUqGwrIyw=; b=lqwrz9w+rNG94srYPfrVaDwDfGyD/Cqcw8c9PdyOq8KJmT2Rur780zlAHwRli5S+nWjYPtS4IW3on7dcBy/1vYCZwXKp+WagsnfcSmQb9WrJQoSKALKYD9I64reCgFhGVDddRF1axXBoYC237aB7ZJfjU2b1V0us7iecmi6Cwx8ugJz7JYcPF6h7U/GUJdGmcNS0+jA/JPNmG/Ip4NWVGrnwQJQf1ee6y/pCB0JhHGGf1vPJPZQxKXiIMwzQixcirz675jtl167zf8dYPLyjQ2ciIVqzteOhnMDCSBTizHhiJQaeUKhG5jGvYufBDzRj8pn5+LtExGrqN0hjVprLfg== 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=vdqth9mq0BpTl36BYGJIUTqjUW0Ze1VnepKUqGwrIyw=; b=4punHJlN0scupkFmwnz4zAPWQFoU8qsZzrMxdDmfC57VjpY4lesToFync6yMMSFk14wL3qpNpnTCNO7q5KmfhBmv8NR82NHEqsxObmyVarKGQLR98LUSPD+khficgX5ubNTQMjmZQ518DwPldKQlQg7VQu7OTm8/MELez9H10X0= Received: from CY5PR19CA0043.namprd19.prod.outlook.com (2603:10b6:930:1a::33) by DS0PR12MB6557.namprd12.prod.outlook.com (2603:10b6:8:d3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Fri, 2 Sep 2022 08:48:16 +0000 Received: from CY4PEPF0000B8EB.namprd05.prod.outlook.com (2603:10b6:930:1a:cafe::c5) by CY5PR19CA0043.outlook.office365.com (2603:10b6:930:1a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.15 via Frontend Transport; Fri, 2 Sep 2022 08:48:16 +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 CY4PEPF0000B8EB.mail.protection.outlook.com (10.167.241.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.7 via Frontend Transport; Fri, 2 Sep 2022 08:48:15 +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; Fri, 2 Sep 2022 03:48:13 -0500 From: Bhagyada Modali To: , CC: , , Bhagyada Modali Subject: [PATCH v3 1/4] net/axgbe: fix scattered Rx Date: Fri, 2 Sep 2022 04:47:51 -0400 Message-ID: <20220902084754.99884-1-bhagyada.modali@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220901124948.97063-1-bhagyada.modali@amd.com> References: <20220901124948.97063-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8245c1e3-a3b0-415d-2f59-08da8cbfe07d X-MS-TrafficTypeDiagnostic: DS0PR12MB6557:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /W79XRhpV4358R7jGN5akq7x3cBmha8njJ+82AYrZgaxoHVRQFd4c3R/EqUuJQdzv+t+1nKAmtEv6QlA4Kjra8wOmPIq95iTAB2TJS83+UrfMqhdzw3av2TcqGRfbuLMkv2clGNnOulDERenciBjZgUf5cc+1YGFxMXogDoc86wxyi1C3QhDoo3zuoBLc/RZ03Zf3Epegjqs2TO14AB1tkT1xWBts5n/yFqaGUOgQP8qN5Tp3l2RVglyvHtJNaoxcAlokVzrqZdErvPk1PJ8CTiXgmSC84jmjhjiFM4lNSTnW+43RptD6xZCk25dEuRYv8PM+kxRgUA/UY+zEV0P7h09Sp9in26Vsh+L8vBqaii5oeUy1OWo+L5R/M4tzds1JGI8rv7qjEBbYN+XFIRnSZIz80PLCR3OB2aMR21goNpWZzJL3rlLJ9StxCHyDSPLxI7oLj+lBs9tbZzRd7JtNnYQ8hK46Mr2G35oyNsOopPSdrMGZzghEARzXYAt5MbjpLPlBA1fEHemhg3n68CCwUa9oYC+Ndk3ouyzkqOOpa5Gj8F4fyAXfPEJaY6gl+EhOSirSlO+x8Oae1dRhfscUgUx9RkhscrrVXMvOqsALU9G/cR3K3WJjW5DMgrVm0+vACnhoRGIcssivdaSTFCpbgJdLAVOGmfIOoXq5PydsKxFr7b5tKhwm2qGsccuq+sz5xo0Nn5UmaGTwtW1kDtYZstPuDBZ4dSkwiEcnngigYAJcUBve8lnW+U0Rz/VZVwAaqzPIo+mNIuCe8sgqlBWYO+H00+oU2dzXVdWLJamTDSmMwN5aE9c+GbIaNF90KB8kMgZ7MhC8sCi0WerhPME8A== 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)(376002)(39860400002)(346002)(396003)(40470700004)(36840700001)(46966006)(83380400001)(81166007)(356005)(82740400003)(40460700003)(36860700001)(40480700001)(70206006)(70586007)(450100002)(8676002)(4326008)(316002)(6636002)(54906003)(110136005)(82310400005)(2906002)(8936002)(5660300002)(44832011)(7696005)(6666004)(47076005)(16526019)(2616005)(1076003)(426003)(336012)(186003)(26005)(478600001)(41300700001)(36756003)(86362001)(83323001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2022 08:48:15.7726 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8245c1e3-a3b0-415d-2f59-08da8cbfe07d 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: CY4PEPF0000B8EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6557 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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") Cc: stable@dpdk.org 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