DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/octeontx2: fix PTP enable via Rx ofload flags
@ 2019-07-25 15:30 Harman Kalra
  2019-07-27 13:56 ` [dpdk-dev] [PATCH v2] " Harman Kalra
  0 siblings, 1 reply; 3+ messages in thread
From: Harman Kalra @ 2019-07-25 15:30 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, Nithin Kumar Dabilpuram,
	Kiran Kumar Kokkilagadda
  Cc: dev, Harman Kalra

Earlier implementation for enabling ptp via RX offload flag was
causing segmentation fault as it was getting executed in the
device configuration stage where RX and TX queues were not
configured. As in the ptp enable process rx queues are used for
mbuf setup while tx queues are used for send descriptor setup.
Moving the logic in dev start as all the resources will be
configured.

Fixes: b5dc3140448ee ("net/octeontx2: support base PTP")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/net/octeontx2/otx2_ethdev.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 725fb2431..f6774d01d 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1333,16 +1333,6 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto q_irq_fini;
 	}
 
-	/* Enable PTP if it was requested by the app or if it is already
-	 * enabled in PF owning this VF
-	 */
-	memset(&dev->tstamp, 0, sizeof(struct otx2_timesync_info));
-	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) ||
-	    otx2_ethdev_is_ptp_en(dev))
-		otx2_nix_timesync_enable(eth_dev);
-	else
-		otx2_nix_timesync_disable(eth_dev);
-
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
@@ -1569,6 +1559,16 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)
 	otx2_eth_set_tx_function(eth_dev);
 	otx2_eth_set_rx_function(eth_dev);
 
+	/* Enable PTP if it was requested by the app or if it is already
+	 * enabled in PF owning this VF
+	 */
+	memset(&dev->tstamp, 0, sizeof(struct otx2_timesync_info));
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) ||
+	    otx2_ethdev_is_ptp_en(dev))
+		otx2_nix_timesync_enable(eth_dev);
+	else
+		otx2_nix_timesync_disable(eth_dev);
+
 	return 0;
 
 rx_disable:
-- 
2.18.0


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

* [dpdk-dev] [PATCH v2] net/octeontx2: fix PTP enable via Rx ofload flags
  2019-07-25 15:30 [dpdk-dev] [PATCH] net/octeontx2: fix PTP enable via Rx ofload flags Harman Kalra
@ 2019-07-27 13:56 ` Harman Kalra
  2019-07-28 16:24   ` Jerin Jacob Kollanukkaran
  0 siblings, 1 reply; 3+ messages in thread
From: Harman Kalra @ 2019-07-27 13:56 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, Nithin Kumar Dabilpuram,
	Kiran Kumar Kokkilagadda
  Cc: dev, Harman Kalra

Earlier implementation for enabling ptp via RX offload flag was
causing segmentation fault as it was getting executed in the
device configuration stage where RX and TX queues were not
configured. As in the ptp enable process rx queues are used for
mbuf setup while tx queues are used for send descriptor setup.
Moving the logic in dev start as all the resources will be
configured.

Fixes: b5dc3140448ee ("net/octeontx2: support base PTP")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/net/octeontx2/otx2_ethdev.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 725fb2431..b018b25b7 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -625,6 +625,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (conf & DEV_TX_OFFLOAD_MULTI_SEGS)
 		flags |= NIX_TX_MULTI_SEG_F;
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
 	return flags;
 }
 
@@ -1333,16 +1336,6 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
 		goto q_irq_fini;
 	}
 
-	/* Enable PTP if it was requested by the app or if it is already
-	 * enabled in PF owning this VF
-	 */
-	memset(&dev->tstamp, 0, sizeof(struct otx2_timesync_info));
-	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) ||
-	    otx2_ethdev_is_ptp_en(dev))
-		otx2_nix_timesync_enable(eth_dev);
-	else
-		otx2_nix_timesync_disable(eth_dev);
-
 	/*
 	 * Restore queue config when reconfigure followed by
 	 * reconfigure and no queue configure invoked from application case.
@@ -1551,6 +1544,16 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev)
 		return rc;
 	}
 
+	/* Enable PTP if it was requested by the app or if it is already
+	 * enabled in PF owning this VF
+	 */
+	memset(&dev->tstamp, 0, sizeof(struct otx2_timesync_info));
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) ||
+	    otx2_ethdev_is_ptp_en(dev))
+		otx2_nix_timesync_enable(eth_dev);
+	else
+		otx2_nix_timesync_disable(eth_dev);
+
 	rc = npc_rx_enable(dev);
 	if (rc) {
 		otx2_err("Failed to enable NPC rx %d", rc);
-- 
2.18.0


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

* Re: [dpdk-dev] [PATCH v2] net/octeontx2: fix PTP enable via Rx ofload flags
  2019-07-27 13:56 ` [dpdk-dev] [PATCH v2] " Harman Kalra
@ 2019-07-28 16:24   ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-07-28 16:24 UTC (permalink / raw)
  To: Harman Kalra, Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda
  Cc: dev, Ferruh Yigit

> -----Original Message-----
> From: Harman Kalra <hkalra@marvell.com>
> Sent: Saturday, July 27, 2019 7:26 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Nithin Kumar
> Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>
> Cc: dev@dpdk.org; Harman Kalra <hkalra@marvell.com>
> Subject: [PATCH v2] net/octeontx2: fix PTP enable via Rx ofload flags
> 
> Earlier implementation for enabling ptp via RX offload flag was causing
> segmentation fault as it was getting executed in the device configuration
> stage where RX and TX queues were not configured. As in the ptp enable
> process rx queues are used for mbuf setup while tx queues are used for
> send descriptor setup.
> Moving the logic in dev start as all the resources will be configured.
> 
> Fixes: b5dc3140448ee ("net/octeontx2: support base PTP")
> 
> Signed-off-by: Harman Kalra <hkalra@marvell.com>

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

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

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

end of thread, other threads:[~2019-07-28 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 15:30 [dpdk-dev] [PATCH] net/octeontx2: fix PTP enable via Rx ofload flags Harman Kalra
2019-07-27 13:56 ` [dpdk-dev] [PATCH v2] " Harman Kalra
2019-07-28 16:24   ` Jerin Jacob Kollanukkaran

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