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 267CCA0547; Mon, 19 Apr 2021 11:02:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A256840683; Mon, 19 Apr 2021 11:02:19 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 6129940040 for ; Mon, 19 Apr 2021 11:02:18 +0200 (CEST) IronPort-SDR: RdznEy6evpnTeiAk7Z+toH+LuHlcWLZu+A0cUd426vmJyCze30B8MrjUDN5OSm7aLZo5rpgXtz 5s61mwXhYQpw== X-IronPort-AV: E=McAfee;i="6200,9189,9958"; a="192104285" X-IronPort-AV: E=Sophos;i="5.82,233,1613462400"; d="scan'208";a="192104285" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 02:02:17 -0700 IronPort-SDR: iLcbo95BuJeUJGaE0JlFMMU6T2wQa5zHe+KCxXmUA2mgBdsyBhdcWkZ18V4fn1jGD1/KZ0b59X Sf0fGiv3Mivw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,233,1613462400"; d="scan'208";a="426431111" Received: from dpdk-lrong-srv-04.sh.intel.com ([10.67.119.221]) by orsmga008.jf.intel.com with ESMTP; 19 Apr 2021 02:02:15 -0700 From: Leyi Rong To: qi.z.zhang@intel.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, Leyi Rong Date: Mon, 19 Apr 2021 16:36:22 +0800 Message-Id: <20210419083622.83717-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 v2] 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 | 42 +++++++++++++++++++++++++++++++++++- drivers/net/i40e/i40e_rxtx.h | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 3c7686c3f4..282eb5924b 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1479,6 +1479,46 @@ 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; + struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue; + + for (i = 0; i < nb_pkts; i++) { + m = tx_pkts[i]; + ol_flags = m->ol_flags; + + if (!(txq->offloads == + (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) && + m->nb_segs == 1)) { + rte_errno = EINVAL; + return i; + } + + if (ol_flags & I40E_TX_OFFLOAD_NOTSUP_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 +3452,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