From patchwork Fri Jun 29 09:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 41925 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D4DEF1B4B9; Fri, 29 Jun 2018 11:34:56 +0200 (CEST) Received: from rcdn-iport-1.cisco.com (rcdn-iport-1.cisco.com [173.37.86.72]) by dpdk.org (Postfix) with ESMTP id A3E811B4B7 for ; Fri, 29 Jun 2018 11:34:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=966; q=dns/txt; s=iport; t=1530264895; x=1531474495; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dfUISO493J5eaymq4Drw0MBFdMxaZk9SL30WXWDExfs=; b=S/czW26HTmakAXquoac318uJkdDsZ7MvsXLTfu7KUF2aQ2KqJ15g9uYU lit7l0dpZ/gG1cTC2kqfwq0CjYzVCfD49MbxPJBhxhaQjoN0EB9pjorY1 GUqX8YXEQpmiQ90nCSKStKSX8cxVDlNyeKFfWqAdlfbs107hyJpeYViDG o=; X-IronPort-AV: E=Sophos;i="5.51,285,1526342400"; d="scan'208";a="416957367" Received: from alln-core-5.cisco.com ([173.36.13.138]) by rcdn-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jun 2018 09:34:55 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id w5T9YsqC007885; Fri, 29 Jun 2018 09:34:54 GMT Received: by cisco.com (Postfix, from userid 392789) id A741520F2001; Fri, 29 Jun 2018 02:34:54 -0700 (PDT) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Fri, 29 Jun 2018 02:29:41 -0700 Message-Id: <20180629092944.15576-13-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180629092944.15576-1-johndale@cisco.com> References: <20180628031940.17397-1-johndale@cisco.com> <20180629092944.15576-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH v2 12/15] net/enic: check maximum packet size 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hyong Youb Kim The default tx handler checks the maximum packet size. Check it in the prepare handler too. WQ stops working if the app/driver tries to send oversized packets, so these checks are unavoidable. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_rxtx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 7dec486fe..04a77fcb4 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -563,6 +563,10 @@ 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 & wq->tx_offload_notsup_mask) { rte_errno = ENOTSUP;