DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/octeontx2: fix dynamic registration for timestamp
@ 2020-11-03 15:20 Harman Kalra
  2020-11-03 15:41 ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Harman Kalra @ 2020-11-03 15:20 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K
  Cc: thomas, david.marchand, olivier.matz, dev, Harman Kalra

Registration of timestamp field should be done once and
only when ptp kernel changes are successful.

Fixes: 67b8f3220393 ("net/octeontx2: switch Rx timestamp to dynamic mbuf field")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/net/octeontx2/otx2_ethdev.c | 10 ----------
 drivers/net/octeontx2/otx2_ptp.c    | 17 +++++++++--------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 6cebbe677..cfb733a4b 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -2225,16 +2225,6 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)
 	if (otx2_ethdev_is_ptp_en(dev) && otx2_dev_is_vf(dev))
 		otx2_nix_ptp_enable_vf(eth_dev);
 
-	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F) {
-		rc = rte_mbuf_dyn_rx_timestamp_register(
-				&dev->tstamp.tstamp_dynfield_offset,
-				&dev->tstamp.rx_tstamp_dynflag);
-		if (rc != 0) {
-			otx2_err("Failed to register Rx timestamp field/flag");
-			return -rte_errno;
-		}
-	}
-
 	rc = npc_rx_enable(dev);
 	if (rc) {
 		otx2_err("Failed to enable NPC rx %d", rc);
diff --git a/drivers/net/octeontx2/otx2_ptp.c b/drivers/net/octeontx2/otx2_ptp.c
index b8ef4c181..4aa68f578 100644
--- a/drivers/net/octeontx2/otx2_ptp.c
+++ b/drivers/net/octeontx2/otx2_ptp.c
@@ -239,14 +239,6 @@ otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev)
 	dev->tstamp.tx_tstamp_iova = ts->iova;
 	dev->tstamp.tx_tstamp = ts->addr;
 
-	rc = rte_mbuf_dyn_rx_timestamp_register(
-			&dev->tstamp.tstamp_dynfield_offset,
-			&dev->tstamp.rx_tstamp_dynflag);
-	if (rc != 0) {
-		otx2_err("Failed to register Rx timestamp field/flag");
-		return -rte_errno;
-	}
-
 	/* System time should be already on by default */
 	nix_start_timecounters(eth_dev);
 
@@ -264,6 +256,15 @@ otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev)
 		/* Setting up the function pointers as per new offload flags */
 		otx2_eth_set_rx_function(eth_dev);
 		otx2_eth_set_tx_function(eth_dev);
+
+		/* Registering dynamic mbuf timestamp field and flag */
+		rc = rte_mbuf_dyn_rx_timestamp_register(
+				&dev->tstamp.tstamp_dynfield_offset,
+				&dev->tstamp.rx_tstamp_dynflag);
+		if (rc != 0) {
+			otx2_err("Failed to register Rx timestamp field/flag");
+			return -rte_errno;
+		}
 	}
 
 	rc = otx2_nix_recalc_mtu(eth_dev);
-- 
2.18.0


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

* Re: [dpdk-dev] [PATCH] net/octeontx2: fix dynamic registration for timestamp
  2020-11-03 15:20 [dpdk-dev] [PATCH] net/octeontx2: fix dynamic registration for timestamp Harman Kalra
@ 2020-11-03 15:41 ` Thomas Monjalon
  2020-11-03 15:50   ` [dpdk-dev] [EXT] " Harman Kalra
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2020-11-03 15:41 UTC (permalink / raw)
  To: Harman Kalra
  Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, david.marchand,
	olivier.matz, dev

03/11/2020 16:20, Harman Kalra:
> Registration of timestamp field should be done once and

Why?
Next registrations does nothing, it is not a problem.

> only when ptp kernel changes are successful.

Rx timestamp can be useful without PTP.

> --- a/drivers/net/octeontx2/otx2_ethdev.c
> +++ b/drivers/net/octeontx2/otx2_ethdev.c
> @@ -2225,16 +2225,6 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)
>  	if (otx2_ethdev_is_ptp_en(dev) && otx2_dev_is_vf(dev))
>  		otx2_nix_ptp_enable_vf(eth_dev);

NIX_RX_OFFLOAD_TSTAMP_F is set in above function.
Is it useless? Or should we register timestamp below?

> -	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F) {
> -		rc = rte_mbuf_dyn_rx_timestamp_register(
> -				&dev->tstamp.tstamp_dynfield_offset,
> -				&dev->tstamp.rx_tstamp_dynflag);
> -		if (rc != 0) {
> -			otx2_err("Failed to register Rx timestamp field/flag");
> -			return -rte_errno;
> -		}
> -	}




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

* Re: [dpdk-dev] [EXT] Re: [PATCH] net/octeontx2: fix dynamic registration for timestamp
  2020-11-03 15:41 ` Thomas Monjalon
@ 2020-11-03 15:50   ` Harman Kalra
  0 siblings, 0 replies; 3+ messages in thread
From: Harman Kalra @ 2020-11-03 15:50 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, david.marchand,
	olivier.matz, dev

On Tue, Nov 03, 2020 at 04:41:14PM +0100, Thomas Monjalon wrote:
> External Email
> 
> ----------------------------------------------------------------------
> 03/11/2020 16:20, Harman Kalra:
> > Registration of timestamp field should be done once and
> 
> Why?
> Next registrations does nothing, it is not a problem.
> 
> > only when ptp kernel changes are successful.
> 
> Rx timestamp can be useful without PTP.
Ack, you are correct, VF change is also required.

> 
> > --- a/drivers/net/octeontx2/otx2_ethdev.c
> > +++ b/drivers/net/octeontx2/otx2_ethdev.c
> > @@ -2225,16 +2225,6 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)
> >  	if (otx2_ethdev_is_ptp_en(dev) && otx2_dev_is_vf(dev))
> >  		otx2_nix_ptp_enable_vf(eth_dev);
> 
> NIX_RX_OFFLOAD_TSTAMP_F is set in above function.
> Is it useless? Or should we register timestamp below?
> 
> > -	if (dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F) {
> > -		rc = rte_mbuf_dyn_rx_timestamp_register(
> > -				&dev->tstamp.tstamp_dynfield_offset,
> > -				&dev->tstamp.rx_tstamp_dynflag);
> > -		if (rc != 0) {
> > -			otx2_err("Failed to register Rx timestamp field/flag");
> > -			return -rte_errno;
> > -		}
> > -	}
> 
> 
> 

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

end of thread, other threads:[~2020-11-03 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 15:20 [dpdk-dev] [PATCH] net/octeontx2: fix dynamic registration for timestamp Harman Kalra
2020-11-03 15:41 ` Thomas Monjalon
2020-11-03 15:50   ` [dpdk-dev] [EXT] " Harman Kalra

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