From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF74DA0A0A for ; Thu, 20 May 2021 11:55:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA320410F9; Thu, 20 May 2021 11:55:30 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvacalvio01.broadcom.com [192.19.229.182]) by mails.dpdk.org (Postfix) with ESMTP id 5246240041 for ; Thu, 20 May 2021 11:55:29 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 0D00F7A20 for ; Thu, 20 May 2021 02:55:27 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 0D00F7A20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1621504528; bh=Yg9PxgmyNZ2VbpNw86uEo9HxSYY7fl0mpZPJqF6dX2s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jEASl91peEYjPIMh44IWLO2NIPgXuAs0MALWEqdcVQfkTNQWwBxFnvF8Qq8rsxjWb 4BvUdQjzs6GOQpctKpdnta6cpHm0UCUcaf4wRw8Vag6f8KsqwCsg+tlu3PmGvlFBt1 CRqBu1LLO6WH8q4gWgbBoD4wnvzqEPGnU3PuK77k= From: Kalesh A P To: stable@dpdk.org Date: Thu, 20 May 2021 15:46:51 +0530 Message-Id: <20210520101654.3214-7-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20210520101654.3214-1-kalesh-anakkur.purayil@broadcom.com> References: <20210520101654.3214-1-kalesh-anakkur.purayil@broadcom.com> Subject: [dpdk-stable] [PATCH 19.11 6/9] net/bnxt: fix timesync when PTP is not supported X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Kalesh AP [ 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 Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- 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