DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
@ 2019-11-06 11:26 Sunil Kumar Kori
  2019-11-08 17:28 ` Jerin Jacob
  2019-11-11  8:16 ` [dpdk-dev] [PATCH v4 " Sunil Kumar Kori
  0 siblings, 2 replies; 7+ messages in thread
From: Sunil Kumar Kori @ 2019-11-06 11:26 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic
  Cc: dev, Sunil Kumar Kori

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

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v3:
 - Rebased the patch over patches.dpdk.org/patch/62368/
v2:
 - Rebased the patch on latest commit.
 - Update feature matrix for the support.

 doc/guides/nics/features/octeontx2.ini  |  1 +
 drivers/net/octeontx2/otx2_ethdev.c     |  2 +
 drivers/net/octeontx2/otx2_ethdev.h     |  4 ++
 drivers/net/octeontx2/otx2_ethdev_ops.c | 87 +++++++++++++++++++++++++
 4 files changed, 94 insertions(+)

diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini
index 7c59b4383..c2a3f47b0 100644
--- a/doc/guides/nics/features/octeontx2.ini
+++ b/doc/guides/nics/features/octeontx2.ini
@@ -13,6 +13,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 62291c698..37b674bcb 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1978,6 +1978,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_burst_mode_get        = otx2_rx_burst_mode_get,
+	.tx_burst_mode_get        = otx2_tx_burst_mode_get,
 	.rx_queue_count           = otx2_nix_rx_queue_count,
 	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
 	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 4d9ed4870..fd43789fe 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -388,6 +388,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index fc0fbd9f2..1534c955e 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_ethdev.h>
 #include <rte_mbuf_pool_ops.h>
 
 #include "otx2_ethdev.h"
@@ -221,6 +222,92 @@ otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 	qinfo->conf.tx_deferred_start = 0;
 }
 
+int
+otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+#define STRING_SIZE	1024
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	char info[STRING_SIZE] = {'\0'};
+	ssize_t bytes = 0;
+
+	if (dev->scalar_ena)
+		bytes += rte_strscpy(info, "Scalar", 7);
+	else
+		bytes += rte_strscpy(info, "Vector Neon", 12);
+
+	bytes += rte_strscpy(info + bytes, ", Rx Offloads:", 15);
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_RSS_F)
+		bytes += rte_strscpy(info + bytes, " RSS,", 6);
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)
+		bytes += rte_strscpy(info + bytes, " Ptype,", 8);
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)
+		bytes += rte_strscpy(info + bytes, " Checksum,", 11);
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)
+		bytes += rte_strscpy(info + bytes, " VLAN Strip,", 13);
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)
+		bytes += rte_strscpy(info + bytes, " Mark Update,", 14);
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)
+		bytes += rte_strscpy(info + bytes, " Timestamp,", 12);
+
+	if (dev->rx_offload_flags & NIX_RX_MULTI_SEG_F)
+		bytes += rte_strscpy(info + bytes, " Scattered,", 12);
+
+	/* Copy required string into output buffer */
+	rte_strscpy(mode->info, info, bytes + 1);
+	return 0;
+}
+
+int
+otx2_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+#define STRING_SIZE	1024
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	char info[STRING_SIZE] = {'\0'};
+	ssize_t bytes = 0;
+
+	if (dev->scalar_ena)
+		bytes += rte_strscpy(info, "Scalar", 7);
+	else
+		bytes += rte_strscpy(info, "Vector Neon", 12);
+
+	bytes += rte_strscpy(info + bytes, ", Tx Offloads:", 15);
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F)
+		bytes += rte_strscpy(info + bytes, " Inner L3/L4 csum,", 19);
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)
+		bytes += rte_strscpy(info + bytes, " Outer L3/L4 csum,", 19);
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F)
+		bytes += rte_strscpy(info + bytes, " VLAN Insertion,", 16);
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)
+		bytes += rte_strscpy(info + bytes, " MBUF free disable,", 20);
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)
+		bytes += rte_strscpy(info + bytes, " Timestamp,", 12);
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)
+		bytes += rte_strscpy(info + bytes, " TSO,", 6);
+
+	if (dev->tx_offload_flags & NIX_RX_MULTI_SEG_F)
+		bytes += rte_strscpy(info + bytes, " Scattered,", 12);
+
+	/* Copy required string into output buffer */
+	rte_strscpy(mode->info, info, bytes + 1);
+	return 0;
+}
+
 static void
 nix_rx_head_tail_get(struct otx2_eth_dev *dev,
 		     uint32_t *head, uint32_t *tail, uint16_t queue_idx)
-- 
2.17.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
  2019-11-06 11:26 [dpdk-dev] [PATCH v3 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks Sunil Kumar Kori
@ 2019-11-08 17:28 ` Jerin Jacob
  2019-11-11  8:16 ` [dpdk-dev] [PATCH v4 " Sunil Kumar Kori
  1 sibling, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2019-11-08 17:28 UTC (permalink / raw)
  To: Sunil Kumar Kori
  Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic, dpdk-dev

On Wed, Nov 6, 2019 at 4:57 PM Sunil Kumar Kori <skori@marvell.com> wrote:
>
> Retrieve burst mode information according to the selected Rx/Tx mode and
> offloads.
>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> ---
> v3:
>  - Rebased the patch over patches.dpdk.org/patch/62368/
> v2:
>  - Rebased the patch on latest commit.
>  - Update feature matrix for the support.
>
>  doc/guides/nics/features/octeontx2.ini  |  1 +
>  drivers/net/octeontx2/otx2_ethdev.c     |  2 +
>  drivers/net/octeontx2/otx2_ethdev.h     |  4 ++
>  drivers/net/octeontx2/otx2_ethdev_ops.c | 87 +++++++++++++++++++++++++
>  4 files changed, 94 insertions(+)
>

>
> +int
> +otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
> +                      __rte_unused uint16_t queue_id,
> +                      struct rte_eth_burst_mode *mode)
> +{
> +#define STRING_SIZE    1024

Use RTE_ETH_BURST_MODE_INFO_SIZE instead of hardcoded 1024

> +       struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
> +       char info[STRING_SIZE] = {'\0'};

No  need for intermediate "info", use rte_eth_burst_mode::info

> +       ssize_t bytes = 0;
> +
> +       if (dev->scalar_ena)
> +               bytes += rte_strscpy(info, "Scalar", 7);

Please avoid hardcoding of '7'.

        ssize_t sz = 0, rc;

        rc = rte_strscpy(mode->info + sz, "Scalar", STRING_SIZE - sz);
        if (rc < 0)
                goto done;
        sz += rc;

       rc = rte_strscpy(mode->info + sz, "Vector Neon", STRING_SIZE  - sz);
        if (rc < 0)
                goto done;
        sz += rc;


> +       else
> +               bytes += rte_strscpy(info, "Vector Neon", 12);
> +
> +       bytes += rte_strscpy(info + bytes, ", Rx Offloads:", 15);
> +
> +       if (dev->rx_offload_flags & NIX_RX_OFFLOAD_RSS_F)
> +               bytes += rte_strscpy(info + bytes, " RSS,", 6);
> +
> +       if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)
> +               bytes += rte_strscpy(info + bytes, " Ptype,", 8);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v4 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
  2019-11-06 11:26 [dpdk-dev] [PATCH v3 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks Sunil Kumar Kori
  2019-11-08 17:28 ` Jerin Jacob
@ 2019-11-11  8:16 ` Sunil Kumar Kori
  2019-11-11 12:05   ` [dpdk-dev] [PATCH v5 " Sunil Kumar Kori
  2019-11-11 12:16   ` Sunil Kumar Kori
  1 sibling, 2 replies; 7+ messages in thread
From: Sunil Kumar Kori @ 2019-11-11  8:16 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic
  Cc: dev, Sunil Kumar Kori

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

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v4:
 - Review comments incorporated.
v3:
 - Rebased the patch over patches.dpdk.org/patch/62368/
v2:
 - Rebased the patch on latest commit.
 - Update feature matrix for the support.

 doc/guides/nics/features/octeontx2.ini  |   1 +
 drivers/net/octeontx2/otx2_ethdev.c     |   2 +
 drivers/net/octeontx2/otx2_ethdev.h     |   4 +
 drivers/net/octeontx2/otx2_ethdev_ops.c | 195 ++++++++++++++++++++++++
 4 files changed, 202 insertions(+)

diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini
index 7c59b4383..c2a3f47b0 100644
--- a/doc/guides/nics/features/octeontx2.ini
+++ b/doc/guides/nics/features/octeontx2.ini
@@ -13,6 +13,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 62291c698..37b674bcb 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1978,6 +1978,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_burst_mode_get        = otx2_rx_burst_mode_get,
+	.tx_burst_mode_get        = otx2_tx_burst_mode_get,
 	.rx_queue_count           = otx2_nix_rx_queue_count,
 	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
 	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 4d9ed4870..fd43789fe 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -388,6 +388,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index fc0fbd9f2..5db7a21b1 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_ethdev.h>
 #include <rte_mbuf_pool_ops.h>
 
 #include "otx2_ethdev.h"
@@ -221,6 +222,200 @@ otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 	qinfo->conf.tx_deferred_start = 0;
 }
 
+int
+otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+
+	if (dev->scalar_ena) {
+		rc = rte_strscpy(mode->info, "Scalar", str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	} else {
+		rc = rte_strscpy(mode->info, "Vector Neon", str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	rc = rte_strscpy(mode->info + bytes, ", Rx Offloads:",
+			 str_size - bytes);
+	if (rc < 0)
+		goto error;
+
+	bytes += rc;
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_RSS_F) {
+		rc = rte_strscpy(mode->info + bytes, " RSS,", str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F) {
+		rc = rte_strscpy(mode->info + bytes, " Ptype,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F) {
+		rc = rte_strscpy(mode->info + bytes, " Checksum,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F) {
+		rc = rte_strscpy(mode->info + bytes, " VLAN Strip,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F) {
+		rc = rte_strscpy(mode->info + bytes, " Mark Update,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F) {
+		rc = rte_strscpy(mode->info + bytes, " Timestamp,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->rx_offload_flags & NIX_RX_MULTI_SEG_F) {
+		rc = rte_strscpy(mode->info + bytes, " Scattered,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	return 0;
+
+error:
+	return rc;
+}
+
+int
+otx2_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+
+	if (dev->scalar_ena) {
+		rc = rte_strscpy(mode->info, "Scalar", str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	} else {
+		rc = rte_strscpy(mode->info, "Vector Neon", str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	rc = rte_strscpy(mode->info + bytes, ", Tx Offloads:",
+			 str_size - bytes);
+	if (rc < 0)
+		goto error;
+
+	bytes += rc;
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) {
+		rc = rte_strscpy(mode->info + bytes, " Inner L3/L4 csum,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F) {
+		rc = rte_strscpy(mode->info + bytes, " Outer L3/L4 csum,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F) {
+		rc = rte_strscpy(mode->info + bytes, " VLAN Insertion,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
+		rc = rte_strscpy(mode->info + bytes, " MBUF free disable,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
+		rc = rte_strscpy(mode->info + bytes, " Timestamp,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F) {
+		rc = rte_strscpy(mode->info + bytes, " TSO,", str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	if (dev->tx_offload_flags & NIX_RX_MULTI_SEG_F) {
+		rc = rte_strscpy(mode->info + bytes, " Scattered,",
+				 str_size - bytes);
+		if (rc < 0)
+			goto error;
+
+		bytes += rc;
+	}
+
+	return 0;
+
+error:
+	return rc;
+}
+
 static void
 nix_rx_head_tail_get(struct otx2_eth_dev *dev,
 		     uint32_t *head, uint32_t *tail, uint16_t queue_idx)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v5 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
  2019-11-11  8:16 ` [dpdk-dev] [PATCH v4 " Sunil Kumar Kori
@ 2019-11-11 12:05   ` Sunil Kumar Kori
  2019-11-11 12:16   ` Sunil Kumar Kori
  1 sibling, 0 replies; 7+ messages in thread
From: Sunil Kumar Kori @ 2019-11-11 12:05 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic
  Cc: dev, Sunil Kumar Kori

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

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v5:
 - Removed redundent code using flag to string mapping.
v4:
 - Review comments incorporated.
v3:
 - Rebased the patch over patches.dpdk.org/patch/62368/
v2:
 - Rebased the patch on latest commit.
 - Update feature matrix for the support.

 doc/guides/nics/features/octeontx2.ini  |   1 +
 drivers/net/octeontx2/otx2_ethdev.c     |   2 +
 drivers/net/octeontx2/otx2_ethdev.h     |   4 +
 drivers/net/octeontx2/otx2_ethdev_ops.c | 111 ++++++++++++++++++++++++
 4 files changed, 118 insertions(+)

diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini
index 7c59b4383..c2a3f47b0 100644
--- a/doc/guides/nics/features/octeontx2.ini
+++ b/doc/guides/nics/features/octeontx2.ini
@@ -13,6 +13,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 62291c698..37b674bcb 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1978,6 +1978,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_burst_mode_get        = otx2_rx_burst_mode_get,
+	.tx_burst_mode_get        = otx2_tx_burst_mode_get,
 	.rx_queue_count           = otx2_nix_rx_queue_count,
 	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
 	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 4d9ed4870..fd43789fe 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -388,6 +388,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index fc0fbd9f2..a63a416ef 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_ethdev.h>
 #include <rte_mbuf_pool_ops.h>
 
 #include "otx2_ethdev.h"
@@ -221,6 +222,116 @@ otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 	qinfo->conf.tx_deferred_start = 0;
 }
 
+int
+otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+#define STRING_SIZE 64
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	const struct burst_info {
+		uint16_t flags;
+		char output[STRING_SIZE];
+	} rx_offload_map[] = {
+			{NIX_RX_OFFLOAD_RSS_F, "RSS,"},
+			{NIX_RX_OFFLOAD_PTYPE_F, " Ptype,"},
+			{NIX_RX_OFFLOAD_CHECKSUM_F, " Checksum,"},
+			{NIX_RX_OFFLOAD_VLAN_STRIP_F, " VLAN Strip,"},
+			{NIX_RX_OFFLOAD_MARK_UPDATE_F, " Mark Update,"},
+			{NIX_RX_OFFLOAD_TSTAMP_F, " Timestamp,"},
+			{NIX_RX_MULTI_SEG_F, " Scattered,"}
+	};
+	const char *burst_mode[] = {"Vector Neon", "Scalar"};
+	uint32_t i;
+
+	/* Update burst mode info */
+	rc = rte_strscpy(mode->info + bytes, burst_mode[dev->scalar_ena],
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	rc = rte_strscpy(mode->info + bytes, ", Rx Offloads:",
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	/* Update Rx offload info */
+	for (i = 0; i < RTE_DIM(rx_offload_map); i++) {
+		if (dev->rx_offload_flags & rx_offload_map[i].flags) {
+			rc = rte_strscpy(mode->info + bytes,
+					 rx_offload_map[i].output,
+					 str_size - bytes);
+			if (rc < 0)
+				goto done;
+
+			bytes += rc;
+		}
+	}
+
+done:
+	return 0;
+}
+
+int
+otx2_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+#define STRING_SIZE 64
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	const struct burst_info {
+		uint16_t flags;
+		char output[STRING_SIZE];
+	} tx_offload_map[] = {
+			{NIX_TX_OFFLOAD_L3_L4_CSUM_F, " Inner L3/L4 csum,"},
+			{NIX_TX_OFFLOAD_OL3_OL4_CSUM_F, " Outer L3/L4 csum,"},
+			{NIX_TX_OFFLOAD_VLAN_QINQ_F, " VLAN Insertion,"},
+			{NIX_TX_OFFLOAD_MBUF_NOFF_F, " MBUF free disable,"},
+			{NIX_TX_OFFLOAD_TSTAMP_F, " Timestamp,"},
+			{NIX_TX_OFFLOAD_TSO_F, " TSO,"},
+			{NIX_TX_MULTI_SEG_F, " Scattered,"}
+	};
+	const char *burst_mode[] = {"Vector Neon", "Scalar"};
+	uint32_t i;
+
+	/* Update burst mode info */
+	rc = rte_strscpy(mode->info + bytes, burst_mode[dev->scalar_ena],
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	rc = rte_strscpy(mode->info + bytes, ", Tx Offloads:",
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	/* Update Tx offload info */
+	for (i = 0; i < RTE_DIM(tx_offload_map); i++) {
+		if (dev->tx_offload_flags & tx_offload_map[i].flags) {
+			rc = rte_strscpy(mode->info + bytes,
+					 tx_offload_map[i].output,
+					 str_size - bytes);
+			if (rc < 0)
+				goto done;
+
+			bytes += rc;
+		}
+	}
+
+done:
+	return 0;
+}
+
 static void
 nix_rx_head_tail_get(struct otx2_eth_dev *dev,
 		     uint32_t *head, uint32_t *tail, uint16_t queue_idx)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v5 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
  2019-11-11  8:16 ` [dpdk-dev] [PATCH v4 " Sunil Kumar Kori
  2019-11-11 12:05   ` [dpdk-dev] [PATCH v5 " Sunil Kumar Kori
@ 2019-11-11 12:16   ` Sunil Kumar Kori
  2019-11-12  9:02     ` [dpdk-dev] [PATCH v6 " Sunil Kumar Kori
  1 sibling, 1 reply; 7+ messages in thread
From: Sunil Kumar Kori @ 2019-11-11 12:16 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic
  Cc: dev, Sunil Kumar Kori

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

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v5:
 - Removed redundent code using flag to string mapping.
v4:
 - Review comments incorporated.
v3:
 - Rebased the patch over patches.dpdk.org/patch/62368/
v2:
 - Rebased the patch on latest commit.
 - Update feature matrix for the support.

 doc/guides/nics/features/octeontx2.ini  |   1 +
 drivers/net/octeontx2/otx2_ethdev.c     |   2 +
 drivers/net/octeontx2/otx2_ethdev.h     |   4 +
 drivers/net/octeontx2/otx2_ethdev_ops.c | 111 ++++++++++++++++++++++++
 4 files changed, 118 insertions(+)

diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini
index 7c59b4383..c2a3f47b0 100644
--- a/doc/guides/nics/features/octeontx2.ini
+++ b/doc/guides/nics/features/octeontx2.ini
@@ -13,6 +13,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 62291c698..37b674bcb 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1978,6 +1978,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_burst_mode_get        = otx2_rx_burst_mode_get,
+	.tx_burst_mode_get        = otx2_tx_burst_mode_get,
 	.rx_queue_count           = otx2_nix_rx_queue_count,
 	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
 	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 4d9ed4870..fd43789fe 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -388,6 +388,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index fc0fbd9f2..114239338 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_ethdev.h>
 #include <rte_mbuf_pool_ops.h>
 
 #include "otx2_ethdev.h"
@@ -221,6 +222,116 @@ otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 	qinfo->conf.tx_deferred_start = 0;
 }
 
+int
+otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+#define STRING_SIZE 64
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	const struct burst_info {
+		uint16_t flags;
+		char output[STRING_SIZE];
+	} rx_offload_map[] = {
+			{NIX_RX_OFFLOAD_RSS_F, "RSS,"},
+			{NIX_RX_OFFLOAD_PTYPE_F, " Ptype,"},
+			{NIX_RX_OFFLOAD_CHECKSUM_F, " Checksum,"},
+			{NIX_RX_OFFLOAD_VLAN_STRIP_F, " VLAN Strip,"},
+			{NIX_RX_OFFLOAD_MARK_UPDATE_F, " Mark Update,"},
+			{NIX_RX_OFFLOAD_TSTAMP_F, " Timestamp,"},
+			{NIX_RX_MULTI_SEG_F, " Scattered,"}
+	};
+	static const char *const burst_mode[] = {"Vector Neon", "Scalar"};
+	uint32_t i;
+
+	/* Update burst mode info */
+	rc = rte_strscpy(mode->info + bytes, burst_mode[dev->scalar_ena],
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	rc = rte_strscpy(mode->info + bytes, ", Rx Offloads:",
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	/* Update Rx offload info */
+	for (i = 0; i < RTE_DIM(rx_offload_map); i++) {
+		if (dev->rx_offload_flags & rx_offload_map[i].flags) {
+			rc = rte_strscpy(mode->info + bytes,
+					 rx_offload_map[i].output,
+					 str_size - bytes);
+			if (rc < 0)
+				goto done;
+
+			bytes += rc;
+		}
+	}
+
+done:
+	return 0;
+}
+
+int
+otx2_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+#define STRING_SIZE 64
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	const struct burst_info {
+		uint16_t flags;
+		char output[STRING_SIZE];
+	} tx_offload_map[] = {
+			{NIX_TX_OFFLOAD_L3_L4_CSUM_F, " Inner L3/L4 csum,"},
+			{NIX_TX_OFFLOAD_OL3_OL4_CSUM_F, " Outer L3/L4 csum,"},
+			{NIX_TX_OFFLOAD_VLAN_QINQ_F, " VLAN Insertion,"},
+			{NIX_TX_OFFLOAD_MBUF_NOFF_F, " MBUF free disable,"},
+			{NIX_TX_OFFLOAD_TSTAMP_F, " Timestamp,"},
+			{NIX_TX_OFFLOAD_TSO_F, " TSO,"},
+			{NIX_TX_MULTI_SEG_F, " Scattered,"}
+	};
+	static const char *const burst_mode[] = {"Vector Neon", "Scalar"};
+	uint32_t i;
+
+	/* Update burst mode info */
+	rc = rte_strscpy(mode->info + bytes, burst_mode[dev->scalar_ena],
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	rc = rte_strscpy(mode->info + bytes, ", Tx Offloads:",
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	/* Update Tx offload info */
+	for (i = 0; i < RTE_DIM(tx_offload_map); i++) {
+		if (dev->tx_offload_flags & tx_offload_map[i].flags) {
+			rc = rte_strscpy(mode->info + bytes,
+					 tx_offload_map[i].output,
+					 str_size - bytes);
+			if (rc < 0)
+				goto done;
+
+			bytes += rc;
+		}
+	}
+
+done:
+	return 0;
+}
+
 static void
 nix_rx_head_tail_get(struct otx2_eth_dev *dev,
 		     uint32_t *head, uint32_t *tail, uint16_t queue_idx)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v6 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
  2019-11-11 12:16   ` Sunil Kumar Kori
@ 2019-11-12  9:02     ` Sunil Kumar Kori
  2019-11-15  7:00       ` Jerin Jacob
  0 siblings, 1 reply; 7+ messages in thread
From: Sunil Kumar Kori @ 2019-11-12  9:02 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic
  Cc: dev, Sunil Kumar Kori

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

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v6:
 - Remove unnecessary macro 
v5:
 - Removed redundent code using flag to string mapping.
v4:
 - Review comments incorporated.
v3:
 - Rebased the patch over patches.dpdk.org/patch/62368/
v2:
 - Rebased the patch on latest commit.
 - Update feature matrix for the support.

 doc/guides/nics/features/octeontx2.ini  |  1 +
 drivers/net/octeontx2/otx2_ethdev.c     |  2 +
 drivers/net/octeontx2/otx2_ethdev.h     |  4 +
 drivers/net/octeontx2/otx2_ethdev_ops.c | 99 +++++++++++++++++++++++++
 4 files changed, 106 insertions(+)

diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini
index 7c59b4383..c2a3f47b0 100644
--- a/doc/guides/nics/features/octeontx2.ini
+++ b/doc/guides/nics/features/octeontx2.ini
@@ -13,6 +13,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 62291c698..37b674bcb 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1978,6 +1978,8 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
 	.xstats_get_names_by_id   = otx2_nix_xstats_get_names_by_id,
 	.rxq_info_get             = otx2_nix_rxq_info_get,
 	.txq_info_get             = otx2_nix_txq_info_get,
+	.rx_burst_mode_get        = otx2_rx_burst_mode_get,
+	.tx_burst_mode_get        = otx2_tx_burst_mode_get,
 	.rx_queue_count           = otx2_nix_rx_queue_count,
 	.rx_descriptor_done       = otx2_nix_rx_descriptor_done,
 	.rx_descriptor_status     = otx2_nix_rx_descriptor_status,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 4d9ed4870..fd43789fe 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -388,6 +388,10 @@ void otx2_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_rxq_info *qinfo);
 void otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			   struct rte_eth_txq_info *qinfo);
+int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
+int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			   struct rte_eth_burst_mode *mode);
 uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
 int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index fc0fbd9f2..cc8b56335 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2019 Marvell International Ltd.
  */
 
+#include <rte_ethdev.h>
 #include <rte_mbuf_pool_ops.h>
 
 #include "otx2_ethdev.h"
@@ -221,6 +222,104 @@ otx2_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 	qinfo->conf.tx_deferred_start = 0;
 }
 
+int
+otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	const struct burst_info {
+		uint16_t flags;
+		const char *output;
+	} rx_offload_map[] = {
+			{NIX_RX_OFFLOAD_RSS_F, "RSS,"},
+			{NIX_RX_OFFLOAD_PTYPE_F, " Ptype,"},
+			{NIX_RX_OFFLOAD_CHECKSUM_F, " Checksum,"},
+			{NIX_RX_OFFLOAD_VLAN_STRIP_F, " VLAN Strip,"},
+			{NIX_RX_OFFLOAD_MARK_UPDATE_F, " Mark Update,"},
+			{NIX_RX_OFFLOAD_TSTAMP_F, " Timestamp,"},
+			{NIX_RX_MULTI_SEG_F, " Scattered,"}
+	};
+	static const char *const burst_mode[] = {"Vector Neon, Rx Offloads:",
+						 "Scalar, Rx Offloads:"
+	};
+	uint32_t i;
+
+	/* Update burst mode info */
+	rc = rte_strscpy(mode->info + bytes, burst_mode[dev->scalar_ena],
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	/* Update Rx offload info */
+	for (i = 0; i < RTE_DIM(rx_offload_map); i++) {
+		if (dev->rx_offload_flags & rx_offload_map[i].flags) {
+			rc = rte_strscpy(mode->info + bytes,
+					 rx_offload_map[i].output,
+					 str_size - bytes);
+			if (rc < 0)
+				goto done;
+
+			bytes += rc;
+		}
+	}
+
+done:
+	return 0;
+}
+
+int
+otx2_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		       __rte_unused uint16_t queue_id,
+		       struct rte_eth_burst_mode *mode)
+{
+	ssize_t bytes = 0, str_size = RTE_ETH_BURST_MODE_INFO_SIZE, rc;
+	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	const struct burst_info {
+		uint16_t flags;
+		const char *output;
+	} tx_offload_map[] = {
+			{NIX_TX_OFFLOAD_L3_L4_CSUM_F, " Inner L3/L4 csum,"},
+			{NIX_TX_OFFLOAD_OL3_OL4_CSUM_F, " Outer L3/L4 csum,"},
+			{NIX_TX_OFFLOAD_VLAN_QINQ_F, " VLAN Insertion,"},
+			{NIX_TX_OFFLOAD_MBUF_NOFF_F, " MBUF free disable,"},
+			{NIX_TX_OFFLOAD_TSTAMP_F, " Timestamp,"},
+			{NIX_TX_OFFLOAD_TSO_F, " TSO,"},
+			{NIX_TX_MULTI_SEG_F, " Scattered,"}
+	};
+	static const char *const burst_mode[] = {"Vector Neon, Tx Offloads:",
+						 "Scalar, Tx Offloads:"
+	};
+	uint32_t i;
+
+	/* Update burst mode info */
+	rc = rte_strscpy(mode->info + bytes, burst_mode[dev->scalar_ena],
+			 str_size - bytes);
+	if (rc < 0)
+		goto done;
+
+	bytes += rc;
+
+	/* Update Tx offload info */
+	for (i = 0; i < RTE_DIM(tx_offload_map); i++) {
+		if (dev->tx_offload_flags & tx_offload_map[i].flags) {
+			rc = rte_strscpy(mode->info + bytes,
+					 tx_offload_map[i].output,
+					 str_size - bytes);
+			if (rc < 0)
+				goto done;
+
+			bytes += rc;
+		}
+	}
+
+done:
+	return 0;
+}
+
 static void
 nix_rx_head_tail_get(struct otx2_eth_dev *dev,
 		     uint32_t *head, uint32_t *tail, uint16_t queue_idx)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks
  2019-11-12  9:02     ` [dpdk-dev] [PATCH v6 " Sunil Kumar Kori
@ 2019-11-15  7:00       ` Jerin Jacob
  0 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2019-11-15  7:00 UTC (permalink / raw)
  To: Sunil Kumar Kori, Ferruh Yigit
  Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, John McNamara,
	Marko Kovacevic, dpdk-dev

On Tue, Nov 12, 2019 at 2:32 PM Sunil Kumar Kori <skori@marvell.com> wrote:
>
> Retrieve burst mode information according to the selected Rx/Tx mode and
> offloads.
>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>

# Updated missing doc/guides/nics/features/octeontx2_vec.ini and
doc/guides/nics/features/octeontx2_vf.ini doc update

Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-net-mrvl/master. Thanks


> ---
> v6:
>  - Remove unnecessary macro
> v5:
>  - Removed redundent code using flag to string mapping.
> v4:
>  - Review comments incorporated.
> v3:
>  - Rebased the patch over patches.dpdk.org/patch/62368/
> v2:
>  - Rebased the patch on latest commit.
>  - Update feature matrix for the support.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-11-15  7:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 11:26 [dpdk-dev] [PATCH v3 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks Sunil Kumar Kori
2019-11-08 17:28 ` Jerin Jacob
2019-11-11  8:16 ` [dpdk-dev] [PATCH v4 " Sunil Kumar Kori
2019-11-11 12:05   ` [dpdk-dev] [PATCH v5 " Sunil Kumar Kori
2019-11-11 12:16   ` Sunil Kumar Kori
2019-11-12  9:02     ` [dpdk-dev] [PATCH v6 " Sunil Kumar Kori
2019-11-15  7:00       ` Jerin Jacob

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).