From patchwork Fri Nov 11 16:12:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingjin Ye X-Patchwork-Id: 119785 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E3FAA0542; Fri, 11 Nov 2022 09:25:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5D4B40F16; Fri, 11 Nov 2022 09:25:47 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 69E4440141; Fri, 11 Nov 2022 09:25:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668155145; x=1699691145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q8i/myDNUtWCUNSwselhYGHG9I+qjV+vr5b3RshO/co=; b=bUcWNL81rybj+LsFz6sQtfG6qLjDZyUNIq+r40Nzdpa5tVmOXVj9jHYC BYdSq0Sey4TJ5txK9QT2DkfwHDNIusrpKmSxvxeSDmAD/l8khB+6kA+Si YtDxTL2yOTb3VpWkkL+YY9Lv0rtF5PwDW/b9gCCVA3d4F5LrFSZTkx7eP LMAMc+zfC5KrX1yN8DzeRBQsFEmAs3AjKkJMCPd3YKLTE4AN+jgqHAE0r pwKzFntSbWxuS8VkG6ge38wTbnH3EI6f+yapPCG9etLpHsJdwH2+lUeVe P+MziqEAloNOxr/EYc+7HykUpiY09YuO8uZ/88reCl8buFgt3o4d6cj3w Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310267887" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="310267887" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 00:25:44 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="701143889" X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="701143889" Received: from unknown (HELO yemj..) ([10.239.252.253]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 00:25:41 -0800 From: Mingjin Ye To: dev@dpdk.org Cc: qiming.yang@intel.com, stable@dpdk.org, yidingx.zhou@intel.com, Mingjin Ye , Qi Zhang , Jingjing Wu , Ferruh Yigit , Wenzhuo Lu , Xiaoyun Li Subject: [PATCH v4 1/2] net/ice: fix scalar Rx path segment Date: Fri, 11 Nov 2022 16:12:40 +0000 Message-Id: <20221111161241.861732-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221111120401.802805-2-mingjinx.ye@intel.com> References: <20221111120401.802805-2-mingjinx.ye@intel.com> MIME-Version: 1.0 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 CRC is stripped by the hardware in the scattered Rx path. The last buffer is invalid if it's packet length is zero. This patch adds a judgment for the last buffer length to fix this issue, it would free the mbuf associated to the last one if the last buffer is empty. Fixes: 6eac0b7fde95 ("net/ice: support advance Rx/Tx") Cc: stable@dpdk.org Signed-off-by: Mingjin Ye Tested-by: Ke Xu --- drivers/net/ice/ice_rxtx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0a2b0376ac..e6ddd2513d 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -2111,6 +2111,10 @@ ice_recv_scattered_pkts(void *rx_queue, } else rxm->data_len = (uint16_t)(rx_packet_len - RTE_ETHER_CRC_LEN); + } else if (rx_packet_len == 0) { + rte_pktmbuf_free_seg(rxm); + first_seg->nb_segs--; + last_seg->next = NULL; } first_seg->port = rxq->port_id;