From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 19.11 6/9] net/bnxt: fix timesync when PTP is not supported
Date: Thu, 20 May 2021 15:46:51 +0530 [thread overview]
Message-ID: <20210520101654.3214-7-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210520101654.3214-1-kalesh-anakkur.purayil@broadcom.com>
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
[ upstream commit ab15dd5a1c4d563e80b10e42e39c4d2f010fa389 ]
Fixed to return error when PTP support is not supported on the port.
Also, removed an unnecessary check inside bnxt_get_rx_ts().
Fixes: b11cceb83a34 ("net/bnxt: support timesync")
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ed02cf0..08f56a3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3505,9 +3505,6 @@ static int bnxt_get_rx_ts(struct bnxt *bp, uint64_t *ts)
uint16_t port_id;
uint32_t fifo;
- if (!ptp)
- return -ENODEV;
-
fifo = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
ptp->rx_mapped_regs[BNXT_PTP_RX_FIFO]));
if (!(fifo & BNXT_PTP_RX_FIFO_PENDING))
@@ -3538,7 +3535,7 @@ bnxt_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
if (!ptp)
- return 0;
+ return -ENOTSUP;
ns = rte_timespec_to_ns(ts);
/* Set the timecounters to a new value. */
@@ -3558,7 +3555,7 @@ bnxt_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
int rc = 0;
if (!ptp)
- return 0;
+ return -ENOTSUP;
if (BNXT_CHIP_THOR(bp))
rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,
@@ -3580,7 +3577,7 @@ bnxt_timesync_enable(struct rte_eth_dev *dev)
int rc;
if (!ptp)
- return 0;
+ return -ENOTSUP;
ptp->rx_filter = 1;
ptp->tx_tstamp_en = 1;
@@ -3619,7 +3616,7 @@ bnxt_timesync_disable(struct rte_eth_dev *dev)
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
if (!ptp)
- return 0;
+ return -ENOTSUP;
ptp->rx_filter = 0;
ptp->tx_tstamp_en = 0;
@@ -3644,7 +3641,7 @@ bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
uint64_t ns;
if (!ptp)
- return 0;
+ return -ENOTSUP;
if (BNXT_CHIP_THOR(bp))
rx_tstamp_cycles = ptp->rx_timestamp;
@@ -3667,7 +3664,7 @@ bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
int rc = 0;
if (!ptp)
- return 0;
+ return -ENOTSUP;
if (BNXT_CHIP_THOR(bp))
rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_PATH_TX,
@@ -3688,7 +3685,7 @@ bnxt_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
if (!ptp)
- return 0;
+ return -ENOTSUP;
ptp->tc.nsec += delta;
ptp->tx_tstamp_tc.nsec += delta;
--
2.10.1
next prev parent reply other threads:[~2021-05-20 9:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-20 10:16 [dpdk-stable] [PATCH 19.11 0/9] backports for 19.11.9 Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 1/9] net/bnxt: fix build failures after merging patches Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 2/9] net/bnxt: drop unused attribute Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 3/9] net/bnxt: fix double free in port start failure Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 4/9] net/bnxt: fix firmware fatal error handling Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 5/9] net/bnxt: fix memory allocation for command response Kalesh A P
2021-05-20 10:16 ` Kalesh A P [this message]
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 7/9] net/bnxt: fix VF info allocation Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 8/9] net/bnxt: fix PTP support for Thor Kalesh A P
2021-05-20 10:16 ` [dpdk-stable] [PATCH 19.11 9/9] net/bnxt: fix xstats get Kalesh A P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210520101654.3214-7-kalesh-anakkur.purayil@broadcom.com \
--to=kalesh-anakkur.purayil@broadcom.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).