DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Apeksha Gupta <apeksha.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 4/9] net/dpaa2: add Tx/Rx burst mode info
Date: Fri, 10 Jul 2020 21:51:32 +0530	[thread overview]
Message-ID: <20200710162137.22973-4-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20200710162137.22973-1-hemant.agrawal@nxp.com>

From: Apeksha Gupta <apeksha.gupta@nxp.com>

Retrieve burst mode information according to the selected Tx/Rx mode and
offloads.

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
---
 doc/guides/nics/features/dpaa2.ini |  2 +
 drivers/net/dpaa2/dpaa2_ethdev.c   | 73 ++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)

diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini
index 831883d21..878f03d40 100644
--- a/doc/guides/nics/features/dpaa2.ini
+++ b/doc/guides/nics/features/dpaa2.ini
@@ -7,8 +7,10 @@
 Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
+Burst mode info      = Y
 Queue start/stop     = Y
 Jumbo frame          = Y
+Scattered Rx         = Y
 MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3e5502de5..a7195f6c1 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -286,6 +286,77 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+dpaa2_dev_rx_burst_mode_get(struct rte_eth_dev *dev,
+			__rte_unused uint16_t queue_id,
+			struct rte_eth_burst_mode *mode)
+{
+	struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
+	int ret = -EINVAL;
+	unsigned int i;
+	const struct burst_info {
+		uint64_t flags;
+		const char *output;
+	} rx_offload_map[] = {
+			{DEV_RX_OFFLOAD_CHECKSUM, " Checksum,"},
+			{DEV_RX_OFFLOAD_SCTP_CKSUM, " SCTP csum,"},
+			{DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM, " Outer IPV4 csum,"},
+			{DEV_RX_OFFLOAD_OUTER_UDP_CKSUM, " Outer UDP csum,"},
+			{DEV_RX_OFFLOAD_VLAN_STRIP, " VLAN strip,"},
+			{DEV_RX_OFFLOAD_VLAN_FILTER, " VLAN filter,"},
+			{DEV_RX_OFFLOAD_JUMBO_FRAME, " Jumbo frame,"},
+			{DEV_RX_OFFLOAD_TIMESTAMP, " Timestamp,"},
+			{DEV_RX_OFFLOAD_RSS_HASH, " RSS,"},
+			{DEV_RX_OFFLOAD_SCATTER, " Scattered,"}
+	};
+
+	/* Update Rx offload info */
+	for (i = 0; i < RTE_DIM(rx_offload_map); i++) {
+		if (eth_conf->rxmode.offloads & rx_offload_map[i].flags) {
+			snprintf(mode->info, sizeof(mode->info), "%s",
+				rx_offload_map[i].output);
+			ret = 0;
+			break;
+		}
+	}
+	return ret;
+}
+
+static int
+dpaa2_dev_tx_burst_mode_get(struct rte_eth_dev *dev,
+			__rte_unused uint16_t queue_id,
+			struct rte_eth_burst_mode *mode)
+{
+	struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
+	int ret = -EINVAL;
+	unsigned int i;
+	const struct burst_info {
+		uint64_t flags;
+		const char *output;
+	} tx_offload_map[] = {
+			{DEV_TX_OFFLOAD_VLAN_INSERT, " VLAN Insert,"},
+			{DEV_TX_OFFLOAD_IPV4_CKSUM, " IPV4 csum,"},
+			{DEV_TX_OFFLOAD_UDP_CKSUM, " UDP csum,"},
+			{DEV_TX_OFFLOAD_TCP_CKSUM, " TCP csum,"},
+			{DEV_TX_OFFLOAD_SCTP_CKSUM, " SCTP csum,"},
+			{DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, " Outer IPV4 csum,"},
+			{DEV_TX_OFFLOAD_MT_LOCKFREE, " MT lockfree,"},
+			{DEV_TX_OFFLOAD_MBUF_FAST_FREE, " MBUF free disable,"},
+			{DEV_TX_OFFLOAD_MULTI_SEGS, " Scattered,"}
+	};
+
+	/* Update Tx offload info */
+	for (i = 0; i < RTE_DIM(tx_offload_map); i++) {
+		if (eth_conf->txmode.offloads & tx_offload_map[i].flags) {
+			snprintf(mode->info, sizeof(mode->info), "%s",
+				tx_offload_map[i].output);
+			ret = 0;
+			break;
+		}
+	}
+	return ret;
+}
+
 static int
 dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
 {
@@ -2206,6 +2277,8 @@ static struct eth_dev_ops dpaa2_ethdev_ops = {
 	.rx_queue_release  = dpaa2_dev_rx_queue_release,
 	.tx_queue_setup    = dpaa2_dev_tx_queue_setup,
 	.tx_queue_release  = dpaa2_dev_tx_queue_release,
+	.rx_burst_mode_get = dpaa2_dev_rx_burst_mode_get,
+	.tx_burst_mode_get = dpaa2_dev_tx_burst_mode_get,
 	.rx_queue_count       = dpaa2_dev_rx_queue_count,
 	.flow_ctrl_get	      = dpaa2_flow_ctrl_get,
 	.flow_ctrl_set	      = dpaa2_flow_ctrl_set,
-- 
2.17.1


  parent reply	other threads:[~2020-07-10 16:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 16:21 [dpdk-dev] [PATCH 1/9] net/dpaa2: remove Rx timestamp enable PMD API Hemant Agrawal
2020-07-10 16:21 ` [dpdk-dev] [PATCH 2/9] net/dpaa2: support per port Rx mbuf timestamp Hemant Agrawal
2020-07-10 16:21 ` [dpdk-dev] [PATCH 3/9] net/dpaa: add Tx/Rx burst mode info Hemant Agrawal
2020-07-10 16:21 ` Hemant Agrawal [this message]
2020-07-10 16:21 ` [dpdk-dev] [PATCH 5/9] net/dpaa: report error on using deferred start Hemant Agrawal
2020-07-10 16:21 ` [dpdk-dev] [PATCH 6/9] net/dpaa2: report error on queue " Hemant Agrawal
2020-07-10 16:21 ` [dpdk-dev] [PATCH 7/9] net/dpaa2: add support to use Tx Queue desc size Hemant Agrawal
2020-07-10 16:21 ` [dpdk-dev] [PATCH 8/9] net/dpaa2: support Rxq and Txq info routines Hemant Agrawal
2020-07-10 16:21 ` [dpdk-dev] [PATCH 9/9] net/dpaa: " Hemant Agrawal
2020-07-21  1:32 ` [dpdk-dev] [PATCH 1/9] net/dpaa2: remove Rx timestamp enable PMD API Ferruh Yigit
2020-07-21  3:26   ` Hemant Agrawal
2020-07-21  8:56 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710162137.22973-4-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=apeksha.gupta@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).