net/octeontx2: fix PTP enable via Rx ofload flags

Message ID 1564068596-1231-1-git-send-email-hkalra@marvell.com (mailing list archive)
State Superseded, archived
Headers
Series net/octeontx2: fix PTP enable via Rx ofload flags |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Harman Kalra July 25, 2019, 3:30 p.m. UTC
  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(-)
  

Patch

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: