From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 1FC8737A2 for ; Thu, 3 May 2018 08:03:11 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2018 23:03:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,356,1520924400"; d="scan'208";a="38305887" Received: from dpdk51.sh.intel.com ([10.67.110.184]) by orsmga008.jf.intel.com with ESMTP; 02 May 2018 23:03:09 -0700 From: Qi Zhang To: ferruh.yigit@intel.com, konstantin.ananyev@intel.com Cc: dev@dpdk.org, Qi Zhang Date: Thu, 3 May 2018 14:03:25 +0800 Message-Id: <20180503060325.153722-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] ethdev: convert Tx offloads to Tx queue config 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: Thu, 03 May 2018 06:03:12 -0000 Tx offload will be converted to txq_flags automatically during rte_eth_dev_info_get and rte_eth_tx_queue_info_get. So PMD can clean the code to get rid of txq_flags at all while keep old APP not be impacted. Signed-off-by: Qi Zhang --- lib/librte_ethdev/rte_ethdev.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index e5605242d..a357ee09f 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1516,6 +1516,30 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, } /** + * Convert from tx offloads to txq_flags. + */ +static void +rte_eth_convert_tx_offload(const uint64_t tx_offloads, uint32_t *txq_flags) +{ + uint32_t flags = 0; + + if (!(tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)) + flags |= ETH_TXQ_FLAGS_NOMULTSEGS; + if (!(tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT)) + flags |= ETH_TXQ_FLAGS_NOVLANOFFL; + if (!(tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM)) + flags |= ETH_TXQ_FLAGS_NOXSUMSCTP; + if (!(tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM)) + flags |= ETH_TXQ_FLAGS_NOXSUMUDP; + if (!(tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM)) + flags |= ETH_TXQ_FLAGS_NOXSUMTCP; + if (tx_offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + flags |= ETH_TXQ_FLAGS_NOREFCOUNT | ETH_TXQ_FLAGS_NOMULTMEMP; + + *txq_flags = flags; +} + +/** * A conversion function from txq_flags API. */ static void @@ -2359,6 +2383,7 @@ void rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) { struct rte_eth_dev *dev; + struct rte_eth_txconf *txconf; const struct rte_eth_desc_lim lim = { .nb_max = UINT16_MAX, .nb_min = 0, @@ -2380,6 +2405,9 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->nb_tx_queues = dev->data->nb_tx_queues; dev_info->dev_flags = &dev->data->dev_flags; + txconf = &dev_info->default_txconf; + /* convert offload to txq_flags to support legacy app */ + rte_eth_convert_tx_offload(txconf->offloads, &txconf->txq_flags); } int @@ -3799,6 +3827,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo) { struct rte_eth_dev *dev; + struct rte_eth_txconf *txconf = &qinfo->conf; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); @@ -3815,6 +3844,9 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, memset(qinfo, 0, sizeof(*qinfo)); dev->dev_ops->txq_info_get(dev, queue_id, qinfo); + /* convert offload to txq_flags to support legacy app */ + rte_eth_convert_tx_offload(txconf->offloads, &txconf->txq_flags); + return 0; } -- 2.13.6