DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/nfp: implement the burst mode get operation
@ 2024-12-18  6:30 Chaoyong He
  2024-12-18 16:39 ` Stephen Hemminger
  2024-12-19  1:49 ` [PATCH v2] " Chaoyong He
  0 siblings, 2 replies; 4+ messages in thread
From: Chaoyong He @ 2024-12-18  6:30 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Peng Zhang

Implement the burst mode get operation functions for both Rx and Tx.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c    |  2 ++
 drivers/net/nfp/nfp_ethdev_vf.c |  2 ++
 drivers/net/nfp/nfp_rxtx.c      | 46 +++++++++++++++++++++++++++++++++
 drivers/net/nfp/nfp_rxtx.h      |  4 +++
 4 files changed, 54 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f54483822f..df5482f74a 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -985,6 +985,8 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = {
 	.get_module_eeprom      = nfp_net_get_module_eeprom,
 	.dev_led_on             = nfp_net_led_on,
 	.dev_led_off            = nfp_net_led_off,
+	.rx_burst_mode_get      = nfp_net_rx_burst_mode_get,
+	.tx_burst_mode_get      = nfp_net_tx_burst_mode_get,
 };
 
 static inline void
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 36b98dc0c2..23fa5b82ad 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -232,6 +232,8 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = {
 	.tx_queue_release       = nfp_net_tx_queue_release,
 	.rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
 	.rx_queue_intr_disable  = nfp_rx_queue_intr_disable,
+	.rx_burst_mode_get      = nfp_net_rx_burst_mode_get,
+	.tx_burst_mode_get      = nfp_net_tx_burst_mode_get,
 };
 
 static inline void
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 35fb637b21..3435371aaa 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -12,6 +12,7 @@
 
 #include "nfd3/nfp_nfd3.h"
 #include "nfdk/nfp_nfdk.h"
+#include "nfdk/nfp_nfdk_vec.h"
 #include "flower/nfp_flower.h"
 
 #include "nfp_ipsec.h"
@@ -893,3 +894,48 @@ nfp_net_recv_pkts_set(struct rte_eth_dev *eth_dev)
 	else
 		eth_dev->rx_pkt_burst = nfp_net_recv_pkts;
 }
+
+int
+nfp_net_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		uint16_t queue_id __rte_unused,
+		struct rte_eth_burst_mode *mode)
+{
+	eth_rx_burst_t pkt_burst;
+
+	pkt_burst = eth_dev->rx_pkt_burst;
+	if (pkt_burst == nfp_net_recv_pkts) {
+		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
+				"Scalar");
+	} else if (pkt_burst == nfp_net_vec_avx2_recv_pkts) {
+		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
+				"Vector AVX2");
+	} else {
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+int
+nfp_net_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		uint16_t queue_id __rte_unused,
+		struct rte_eth_burst_mode *mode)
+{
+	eth_tx_burst_t pkt_burst;
+
+	pkt_burst = eth_dev->tx_pkt_burst;
+	if (pkt_burst == nfp_net_nfd3_xmit_pkts) {
+		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
+				"NFD3 Scalar");
+	} else if (pkt_burst == nfp_net_nfdk_xmit_pkts) {
+		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
+				"NFDk Scalar");
+	} else if (pkt_burst == nfp_net_nfdk_vec_avx2_xmit_pkts) {
+		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
+				"NFDk Vector AVX2");
+	} else {
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index c717d97003..48cbd83787 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -245,6 +245,10 @@ void nfp_net_tx_queue_info_get(struct rte_eth_dev *dev,
 		uint16_t queue_id,
 		struct rte_eth_txq_info *qinfo);
 void nfp_net_recv_pkts_set(struct rte_eth_dev *eth_dev);
+int nfp_net_rx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+		struct rte_eth_burst_mode *mode);
+int nfp_net_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+		struct rte_eth_burst_mode *mode);
 void nfp_net_parse_ptype(struct nfp_net_rxq *rxq,
 		struct nfp_net_rx_desc *rxds,
 		struct rte_mbuf *mb);
-- 
2.43.5


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

* Re: [PATCH] net/nfp: implement the burst mode get operation
  2024-12-18  6:30 [PATCH] net/nfp: implement the burst mode get operation Chaoyong He
@ 2024-12-18 16:39 ` Stephen Hemminger
  2024-12-19  1:25   ` Chaoyong He
  2024-12-19  1:49 ` [PATCH v2] " Chaoyong He
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2024-12-18 16:39 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, Peng Zhang

On Wed, 18 Dec 2024 14:30:36 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> +int
> +nfp_net_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
> +		uint16_t queue_id __rte_unused,
> +		struct rte_eth_burst_mode *mode)
> +{
> +	eth_rx_burst_t pkt_burst;
> +
> +	pkt_burst = eth_dev->rx_pkt_burst;
> +	if (pkt_burst == nfp_net_recv_pkts) {
> +		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
> +				"Scalar");
> +	} else if (pkt_burst == nfp_net_vec_avx2_recv_pkts) {
> +		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE, "%s",
> +				"Vector AVX2");
> +	} else {
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +

The coccinelle script want to replace that snprintf with strlcpy

Also don't need {} for one line statement but its ok as is.

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

* RE: [PATCH] net/nfp: implement the burst mode get operation
  2024-12-18 16:39 ` Stephen Hemminger
@ 2024-12-19  1:25   ` Chaoyong He
  0 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-12-19  1:25 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, oss-drivers, Nole Zhang

> On Wed, 18 Dec 2024 14:30:36 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > +int
> > +nfp_net_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
> > +		uint16_t queue_id __rte_unused,
> > +		struct rte_eth_burst_mode *mode)
> > +{
> > +	eth_rx_burst_t pkt_burst;
> > +
> > +	pkt_burst = eth_dev->rx_pkt_burst;
> > +	if (pkt_burst == nfp_net_recv_pkts) {
> > +		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE,
> "%s",
> > +				"Scalar");
> > +	} else if (pkt_burst == nfp_net_vec_avx2_recv_pkts) {
> > +		snprintf(mode->info, RTE_ETH_BURST_MODE_INFO_SIZE,
> "%s",
> > +				"Vector AVX2");
> > +	} else {
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> 
> The coccinelle script want to replace that snprintf with strlcpy
> 
> Also don't need {} for one line statement but its ok as is.

Okay, I will send a new version patch.

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

* [PATCH v2] net/nfp: implement the burst mode get operation
  2024-12-18  6:30 [PATCH] net/nfp: implement the burst mode get operation Chaoyong He
  2024-12-18 16:39 ` Stephen Hemminger
@ 2024-12-19  1:49 ` Chaoyong He
  1 sibling, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-12-19  1:49 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Peng Zhang

Implement the burst mode get operation functions for both Rx and Tx.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
v2:
* Replace 'snprintf()' with 'strlcpy()'.
---
 drivers/net/nfp/nfp_ethdev.c    |  2 ++
 drivers/net/nfp/nfp_ethdev_vf.c |  2 ++
 drivers/net/nfp/nfp_rxtx.c      | 46 +++++++++++++++++++++++++++++++++
 drivers/net/nfp/nfp_rxtx.h      |  4 +++
 4 files changed, 54 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f54483822f..df5482f74a 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -985,6 +985,8 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = {
 	.get_module_eeprom      = nfp_net_get_module_eeprom,
 	.dev_led_on             = nfp_net_led_on,
 	.dev_led_off            = nfp_net_led_off,
+	.rx_burst_mode_get      = nfp_net_rx_burst_mode_get,
+	.tx_burst_mode_get      = nfp_net_tx_burst_mode_get,
 };
 
 static inline void
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 36b98dc0c2..23fa5b82ad 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -232,6 +232,8 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = {
 	.tx_queue_release       = nfp_net_tx_queue_release,
 	.rx_queue_intr_enable   = nfp_rx_queue_intr_enable,
 	.rx_queue_intr_disable  = nfp_rx_queue_intr_disable,
+	.rx_burst_mode_get      = nfp_net_rx_burst_mode_get,
+	.tx_burst_mode_get      = nfp_net_tx_burst_mode_get,
 };
 
 static inline void
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 35fb637b21..57c0b7351b 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -12,6 +12,7 @@
 
 #include "nfd3/nfp_nfd3.h"
 #include "nfdk/nfp_nfdk.h"
+#include "nfdk/nfp_nfdk_vec.h"
 #include "flower/nfp_flower.h"
 
 #include "nfp_ipsec.h"
@@ -893,3 +894,48 @@ nfp_net_recv_pkts_set(struct rte_eth_dev *eth_dev)
 	else
 		eth_dev->rx_pkt_burst = nfp_net_recv_pkts;
 }
+
+int
+nfp_net_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		uint16_t queue_id __rte_unused,
+		struct rte_eth_burst_mode *mode)
+{
+	eth_rx_burst_t pkt_burst;
+
+	pkt_burst = eth_dev->rx_pkt_burst;
+	if (pkt_burst == nfp_net_recv_pkts) {
+		strlcpy(mode->info, "Scalar",
+				RTE_ETH_BURST_MODE_INFO_SIZE);
+	} else if (pkt_burst == nfp_net_vec_avx2_recv_pkts) {
+		strlcpy(mode->info, "Vector AVX2",
+				RTE_ETH_BURST_MODE_INFO_SIZE);
+	} else {
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+int
+nfp_net_tx_burst_mode_get(struct rte_eth_dev *eth_dev,
+		uint16_t queue_id __rte_unused,
+		struct rte_eth_burst_mode *mode)
+{
+	eth_tx_burst_t pkt_burst;
+
+	pkt_burst = eth_dev->tx_pkt_burst;
+	if (pkt_burst == nfp_net_nfd3_xmit_pkts) {
+		strlcpy(mode->info, "NFD3 Scalar",
+				RTE_ETH_BURST_MODE_INFO_SIZE);
+	} else if (pkt_burst == nfp_net_nfdk_xmit_pkts) {
+		strlcpy(mode->info, "NFDk Scalar",
+				RTE_ETH_BURST_MODE_INFO_SIZE);
+	} else if (pkt_burst == nfp_net_nfdk_vec_avx2_xmit_pkts) {
+		strlcpy(mode->info, "NFDk Vector AVX2",
+				RTE_ETH_BURST_MODE_INFO_SIZE);
+	} else {
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index c717d97003..48cbd83787 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -245,6 +245,10 @@ void nfp_net_tx_queue_info_get(struct rte_eth_dev *dev,
 		uint16_t queue_id,
 		struct rte_eth_txq_info *qinfo);
 void nfp_net_recv_pkts_set(struct rte_eth_dev *eth_dev);
+int nfp_net_rx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+		struct rte_eth_burst_mode *mode);
+int nfp_net_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+		struct rte_eth_burst_mode *mode);
 void nfp_net_parse_ptype(struct nfp_net_rxq *rxq,
 		struct nfp_net_rx_desc *rxds,
 		struct rte_mbuf *mb);
-- 
2.43.5


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

end of thread, other threads:[~2024-12-19  1:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-18  6:30 [PATCH] net/nfp: implement the burst mode get operation Chaoyong He
2024-12-18 16:39 ` Stephen Hemminger
2024-12-19  1:25   ` Chaoyong He
2024-12-19  1:49 ` [PATCH v2] " Chaoyong He

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