Skip to content

Commit

Permalink
net/bnxt: fix timesync when PTP is not supported
Browse files Browse the repository at this point in the history
[ upstream commit ab15dd5 ]

Fixed to return error when PTP support is not supported on the port.
Also, removed an unnecessary check inside bnxt_get_rx_ts().

Fixes: b11cceb ("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>
  • Loading branch information
Kalesh AP authored and steevenlee committed May 8, 2021
1 parent 23f07e5 commit 6260a81
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions drivers/net/bnxt/bnxt_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3198,9 +3198,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))
Expand Down Expand Up @@ -3233,7 +3230,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. */
Expand All @@ -3253,7 +3250,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,
Expand All @@ -3275,7 +3272,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;
Expand Down Expand Up @@ -3314,7 +3311,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;
Expand All @@ -3339,7 +3336,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;
Expand All @@ -3362,7 +3359,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,
Expand All @@ -3383,7 +3380,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;
Expand Down

0 comments on commit 6260a81

Please sign in to comment.