patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] net/bnxt: fix to return count in xstats get op in all cases
       [not found] <20210312052109.9847-1-somnath.kotur@broadcom.com>
@ 2021-03-12  5:21 ` Somnath Kotur
  2021-03-12  5:21 ` [dpdk-stable] [PATCH 2/2] net/bnxt: fix Rx and Tx timestamp assignment Somnath Kotur
  1 sibling, 0 replies; 2+ messages in thread
From: Somnath Kotur @ 2021-03-12  5:21 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Somnath Kotur, stable, Kalesh Anakkur Purayil,
	Lance Richardson

Driver was returning 0 if the 'xstats' parameter being passed to
xstats_get_op was NULL. This won't work on some applications that
rely on a valid count being passed even in this case so that it can
allocate memory accordingly followed by a reissue of the xstats_get_op
to get the actual stats populated by the driver.

Fixes: 063e59ddd28 ("net/bnxt: fix crash in xstats get")
Cc: stable@dpdk.org

Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_stats.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 01d90dee8d..bb4b2eee19 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -594,10 +594,15 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (xstats == NULL)
-		return 0;
+	stat_count = RTE_DIM(bnxt_rx_stats_strings) +
+		RTE_DIM(bnxt_tx_stats_strings) +
+		RTE_DIM(bnxt_func_stats_strings) +
+		RTE_DIM(bnxt_rx_ext_stats_strings) +
+		RTE_DIM(bnxt_tx_ext_stats_strings) +
+		bnxt_flow_stats_cnt(bp);
 
-	memset(xstats, 0, sizeof(*xstats));
+	if (n < stat_count || xstats == NULL)
+		return stat_count;
 
 	bnxt_hwrm_func_qstats(bp, 0xffff, NULL, &func_qstats);
 	bnxt_hwrm_port_qstats(bp);
@@ -609,17 +614,7 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 					(bp->fw_tx_port_stats_ext_size /
 					 stat_size));
 
-	count = RTE_DIM(bnxt_rx_stats_strings) +
-		RTE_DIM(bnxt_tx_stats_strings) +
-		RTE_DIM(bnxt_func_stats_strings) +
-		RTE_DIM(bnxt_rx_ext_stats_strings) +
-		RTE_DIM(bnxt_tx_ext_stats_strings) +
-		bnxt_flow_stats_cnt(bp);
-
-	stat_count = count;
-
-	if (n < count)
-		return count;
+	memset(xstats, 0, sizeof(*xstats));
 
 	count = 0;
 	for (i = 0; i < RTE_DIM(bnxt_rx_stats_strings); i++) {
-- 
2.28.0.497.g54e85e7


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

* [dpdk-stable] [PATCH 2/2] net/bnxt: fix Rx and Tx timestamp assignment
       [not found] <20210312052109.9847-1-somnath.kotur@broadcom.com>
  2021-03-12  5:21 ` [dpdk-stable] [PATCH 1/2] net/bnxt: fix to return count in xstats get op in all cases Somnath Kotur
@ 2021-03-12  5:21 ` Somnath Kotur
  1 sibling, 0 replies; 2+ messages in thread
From: Somnath Kotur @ 2021-03-12  5:21 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Somnath Kotur, stable, Lance Richardson,
	Ajit Kumar Khaparde

timesync adjust and write_time APIs needed to account for the Rx and Tx
timestamp counters as well. Fix it since it was not done earlier.

Fixes: b11cceb83a3 ("net/bnxt: support timesync")
Cc: stable@dpdk.org

Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3f28e0ea45..6d0719f2d8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3427,6 +3427,8 @@ bnxt_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
 	ns = rte_timespec_to_ns(ts);
 	/* Set the timecounters to a new value. */
 	ptp->tc.nsec = ns;
+	ptp->tx_tstamp_tc.nsec = ns;
+	ptp->rx_tstamp_tc.nsec = ns;
 
 	return 0;
 }
@@ -3577,6 +3579,8 @@ bnxt_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
 		return 0;
 
 	ptp->tc.nsec += delta;
+	ptp->tx_tstamp_tc.nsec += delta;
+	ptp->rx_tstamp_tc.nsec += delta;
 
 	return 0;
 }
-- 
2.28.0.497.g54e85e7


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

end of thread, other threads:[~2021-03-12  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210312052109.9847-1-somnath.kotur@broadcom.com>
2021-03-12  5:21 ` [dpdk-stable] [PATCH 1/2] net/bnxt: fix to return count in xstats get op in all cases Somnath Kotur
2021-03-12  5:21 ` [dpdk-stable] [PATCH 2/2] net/bnxt: fix Rx and Tx timestamp assignment Somnath Kotur

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git