From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6A38A0553; Mon, 17 Feb 2020 17:01:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0CC8A1DA9E; Mon, 17 Feb 2020 17:01:51 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 1874334F3; Mon, 17 Feb 2020 17:01:48 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2020 08:01:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,453,1574150400"; d="scan'208";a="268452761" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga002.fm.intel.com with ESMTP; 17 Feb 2020 08:01:44 -0800 Date: Tue, 18 Feb 2020 00:00:01 +0800 From: Ye Xiaolong To: Xiao Zhang Cc: dev@dpdk.org, wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, stable@dpdk.org Message-ID: <20200217160001.GB85737@intel.com> References: <1581664785-67507-1-git-send-email-xiao.zhang@intel.com> <1581951075-56261-1-git-send-email-xiao.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1581951075-56261-1-git-send-email-xiao.zhang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [v2] net/ixgbe: check illegal packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 02/17, Xiao Zhang wrote: >Some illegal packets will lead to TX hang. This patch checks those >illegal packets and protects TX from hanging. > >Fixes: 7829b8d52be0 ("net/ixgbe: add Tx preparation") >Cc: stable@dpdk.org > >Signed-off-by: Xiao Zhang >--- >v2 change the minimum packet length according to the datasheet. >--- > drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++++++ > drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ > 2 files changed, 8 insertions(+) > >diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c >index 7b398f1..f839bca 100644 >--- a/drivers/net/ixgbe/ixgbe_rxtx.c >+++ b/drivers/net/ixgbe/ixgbe_rxtx.c >@@ -986,6 +986,12 @@ ixgbe_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) > return i; > } > >+ /* check the size of packet */ >+ if (m->pkt_len < IXGBE_TX_MIN_PKT_LEN) { >+ rte_errno = EINVAL; >+ return i; >+ } >+ > #ifdef RTE_LIBRTE_ETHDEV_DEBUG > ret = rte_validate_tx_offload(m); > if (ret != 0) { >diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h >index 000c5b1..20a8b29 100644 >--- a/drivers/net/ixgbe/ixgbe_rxtx.h >+++ b/drivers/net/ixgbe/ixgbe_rxtx.h >@@ -53,6 +53,8 @@ > > #define IXGBE_TX_MAX_SEG 40 > >+#define IXGBE_TX_MIN_PKT_LEN 14 >+ > #define IXGBE_PACKET_TYPE_MASK_82599 0X7F > #define IXGBE_PACKET_TYPE_MASK_X550 0X10FF > #define IXGBE_PACKET_TYPE_MASK_TUNNEL 0XFF >-- >2.7.4 > Acked-by: Xiaolong Ye Applied to dpdk-next-net-intel, Thanks.