From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-8.cisco.com (rcdn-iport-8.cisco.com [173.37.86.79]) by dpdk.org (Postfix) with ESMTP id 7F3302D13; Tue, 13 Nov 2018 16:38:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1393; q=dns/txt; s=iport; t=1542123504; x=1543333104; h=from:to:cc:subject:date:message-id; bh=hBTIv90YzqMVyDZz/J5gS1lBXUobAuPFycEPHN7K/Z0=; b=hGNVcQjfmJX+tp2A7insa9erDCn91dFBkSSedZetYshYC28jffl0Btyt +DRl3KAtv5Lch6XGrtNi9f1QwN+QXgJLjy5gaPbPhmwORiFKfh7i+TpKz 19+Rx1SyTdcJatPNtt0nwGu/NHaHyjtvB1Jc/liIYKTZtBx6fVFOABneB g=; X-IronPort-AV: E=Sophos;i="5.54,499,1534809600"; d="scan'208";a="478896856" Received: from rcdn-core-7.cisco.com ([173.37.93.143]) by rcdn-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 15:38:23 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-7.cisco.com (8.15.2/8.15.2) with ESMTP id wADFcMsT010963; Tue, 13 Nov 2018 15:38:22 GMT Received: by cisco.com (Postfix, from userid 508933) id 136DC20F2001; Tue, 13 Nov 2018 07:38:22 -0800 (PST) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, John Daley , Hyong Youb Kim , stable@dpdk.org Date: Tue, 13 Nov 2018 07:38:10 -0800 Message-Id: <20181113153810.29409-1-hyonkim@cisco.com> X-Mailer: git-send-email 2.16.2 X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-core-7.cisco.com Subject: [dpdk-dev] [PATCH] net/enic: fix the size check in Tx prepare handler 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: , X-List-Received-Date: Tue, 13 Nov 2018 15:38:25 -0000 The current code wrongly assumes that packets are non-TSO and ends up rejecting large TSO packets. Check non-TSO and TSO max packet sizes separately. Fixes: 5a12c387405a ("net/enic: check maximum packet size in Tx prepare handler") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_rxtx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 5189ee635..0aadd3426 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -393,11 +393,22 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, for (i = 0; i != nb_pkts; i++) { m = tx_pkts[i]; - if (unlikely(m->pkt_len > ENIC_TX_MAX_PKT_SIZE)) { - rte_errno = EINVAL; - return i; - } ol_flags = m->ol_flags; + if (!(ol_flags & PKT_TX_TCP_SEG)) { + if (unlikely(m->pkt_len > ENIC_TX_MAX_PKT_SIZE)) { + rte_errno = EINVAL; + return i; + } + } else { + uint16_t header_len; + + header_len = m->l2_len + m->l3_len + m->l4_len; + if (m->tso_segsz + header_len > ENIC_TX_MAX_PKT_SIZE) { + rte_errno = EINVAL; + return i; + } + } + if (ol_flags & wq->tx_offload_notsup_mask) { rte_errno = ENOTSUP; return i; -- 2.16.2