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 440DDA0553; Mon, 17 Feb 2020 15:58:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 21C641DAB3; Mon, 17 Feb 2020 15:58:42 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 259081DAA0; Mon, 17 Feb 2020 15:58:39 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2020 06:58:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,453,1574150400"; d="scan'208";a="268434473" Received: from npg-dpdk-zhangxiao.sh.intel.com ([10.67.110.218]) by fmsmga002.fm.intel.com with ESMTP; 17 Feb 2020 06:58:38 -0800 From: Xiao Zhang To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, Xiao Zhang , stable@dpdk.org Date: Mon, 17 Feb 2020 22:51:15 +0800 Message-Id: <1581951075-56261-1-git-send-email-xiao.zhang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581664785-67507-1-git-send-email-xiao.zhang@intel.com> References: <1581664785-67507-1-git-send-email-xiao.zhang@intel.com> Subject: [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" 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