From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7BCC5A0547; Tue, 20 Apr 2021 07:55:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CD30415BE; Tue, 20 Apr 2021 07:55:50 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 4E10E4159C for ; Tue, 20 Apr 2021 07:55:48 +0200 (CEST) IronPort-SDR: T6pIqkBI0pUl4ytkfoqodQU3HJR0IH9l+8y0Kzhmbgp6P9eyXUz4PNGgzpl8ZjtI86X2a48IqU cu0Pp5qCBoyA== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="256758953" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="256758953" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 22:55:47 -0700 IronPort-SDR: eZ1BLz2qrdHf7Fr4uE1UYSk6ObaRQRlS2W1kKm89+Rn+iy/qVUYfYMsLx9tg5QDOP8zeNvLl9t KIqeQl5HBZEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="420271464" Received: from dpdk-lrong-srv-04.sh.intel.com ([10.67.119.221]) by fmsmga008.fm.intel.com with ESMTP; 19 Apr 2021 22:55:45 -0700 From: Leyi Rong To: qi.z.zhang@intel.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, Leyi Rong Date: Tue, 20 Apr 2021 13:29:45 +0800 Message-Id: <20210420052945.89472-1-leyi.rong@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210331085345.6290-1-leyi.rong@intel.com> References: <20210331085345.6290-1-leyi.rong@intel.com> Subject: [dpdk-dev] [PATCH v3] net/i40e: add Tx preparation for simple Tx data path 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 Sender: "dev" Introduce i40e_simple_prep_pkts() as the preparation function for simple Tx data path, as it's for sanity check for simple Tx. Suggested-by: Konstantin Ananyev Signed-off-by: Leyi Rong --- drivers/net/i40e/i40e_rxtx.c | 39 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 3c7686c3f4..86a9eae370 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1479,6 +1479,43 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, return nb_tx; } +/********************************************************************* + * + * TX simple prep functions + * + **********************************************************************/ +uint16_t +i40e_simple_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + int i; + uint64_t ol_flags; + struct rte_mbuf *m; + + for (i = 0; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + + if (m->nb_segs != 1) { + rte_errno = EINVAL; + return i; + } + + if (ol_flags & PKT_TX_OFFLOAD_MASK) { + rte_errno = ENOTSUP; + return i; + } + + /* check the size of packet */ + if (m->pkt_len < I40E_TX_MIN_PKT_LEN || + m->pkt_len > I40E_FRAME_SIZE_MAX) { + rte_errno = EINVAL; + return i; + } + } + return i; +} + /********************************************************************* * * TX prep functions @@ -3412,7 +3449,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "Simple tx finally be used."); dev->tx_pkt_burst = i40e_xmit_pkts_simple; } - dev->tx_pkt_prepare = NULL; + dev->tx_pkt_prepare = i40e_simple_prep_pkts; } else { PMD_INIT_LOG(DEBUG, "Xmit tx finally be used."); dev->tx_pkt_burst = i40e_xmit_pkts; diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h index 3447a58c82..5ccf5773e8 100644 --- a/drivers/net/i40e/i40e_rxtx.h +++ b/drivers/net/i40e/i40e_rxtx.h @@ -208,6 +208,8 @@ uint16_t i40e_recv_scattered_pkts(void *rx_queue, uint16_t i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t i40e_simple_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); uint16_t i40e_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); int i40e_tx_queue_init(struct i40e_tx_queue *txq); -- 2.17.1