DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations
@ 2021-03-18  9:35 Kalesh A P
  2021-03-18  9:35 ` [dpdk-dev] [PATCH 2/2] net/bnxt: fix unsupported handling in PTP Kalesh A P
  2021-03-19  0:16 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations Ajit Khaparde
  0 siblings, 2 replies; 4+ messages in thread
From: Kalesh A P @ 2021-03-18  9:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

VFs does not have the privilege to change link configuration.
But the driver silently returns success to these ethdev callbacks
without actually issuing the HWRM command to bring the link up/down.

Fixes: 5c206086feaa ("net/bnxt: add link state operations")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 1997783..3665f31 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1268,6 +1268,9 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = eth_dev->data->dev_private;
 	int rc = 0;
 
+	if (!BNXT_SINGLE_PF(bp))
+		return -ENOTSUP;
+
 	if (!bp->link_info->link_up)
 		rc = bnxt_set_hwrm_link_config(bp, true);
 	if (!rc)
@@ -1281,6 +1284,9 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 
+	if (!BNXT_SINGLE_PF(bp))
+		return -ENOTSUP;
+
 	eth_dev->data->dev_link.link_status = 0;
 	bnxt_set_hwrm_link_config(bp, false);
 	bp->link_info->link_up = 0;
-- 
2.10.1


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

* [dpdk-dev] [PATCH 2/2] net/bnxt: fix unsupported handling in PTP
  2021-03-18  9:35 [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations Kalesh A P
@ 2021-03-18  9:35 ` Kalesh A P
  2021-03-19  0:16   ` Ajit Khaparde
  2021-03-19  0:16 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations Ajit Khaparde
  1 sibling, 1 reply; 4+ messages in thread
From: Kalesh A P @ 2021-03-18  9:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar 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 3665f31..4fd9653 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3395,9 +3395,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))
@@ -3430,7 +3427,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. */
@@ -3450,7 +3447,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_P5(bp))
 		rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,
@@ -3472,7 +3469,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;
@@ -3513,7 +3510,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;
@@ -3540,7 +3537,7 @@ bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 	uint64_t ns;
 
 	if (!ptp)
-		return 0;
+		return -ENOTSUP;
 
 	if (BNXT_CHIP_P5(bp))
 		rx_tstamp_cycles = ptp->rx_timestamp;
@@ -3563,7 +3560,7 @@ bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 	int rc = 0;
 
 	if (!ptp)
-		return 0;
+		return -ENOTSUP;
 
 	if (BNXT_CHIP_P5(bp))
 		rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_PATH_TX,
@@ -3584,7 +3581,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


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

* Re: [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations
  2021-03-18  9:35 [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations Kalesh A P
  2021-03-18  9:35 ` [dpdk-dev] [PATCH 2/2] net/bnxt: fix unsupported handling in PTP Kalesh A P
@ 2021-03-19  0:16 ` Ajit Khaparde
  1 sibling, 0 replies; 4+ messages in thread
From: Ajit Khaparde @ 2021-03-19  0:16 UTC (permalink / raw)
  To: Kalesh A P; +Cc: dpdk-dev, Ferruh Yigit

[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]

On Thu, Mar 18, 2021 at 2:13 AM Kalesh A P
<kalesh-anakkur.purayil@broadcom.com> wrote:
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> VFs does not have the privilege to change link configuration.
> But the driver silently returns success to these ethdev callbacks
> without actually issuing the HWRM command to bring the link up/down.
>
> Fixes: 5c206086feaa ("net/bnxt: add link state operations")
> Cc: stable@dpdk.org
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
> Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 1997783..3665f31 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -1268,6 +1268,9 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
>         struct bnxt *bp = eth_dev->data->dev_private;
>         int rc = 0;
>
> +       if (!BNXT_SINGLE_PF(bp))
> +               return -ENOTSUP;
> +
>         if (!bp->link_info->link_up)
>                 rc = bnxt_set_hwrm_link_config(bp, true);
>         if (!rc)
> @@ -1281,6 +1284,9 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
>  {
>         struct bnxt *bp = eth_dev->data->dev_private;
>
> +       if (!BNXT_SINGLE_PF(bp))
> +               return -ENOTSUP;
> +
>         eth_dev->data->dev_link.link_status = 0;
>         bnxt_set_hwrm_link_config(bp, false);
>         bp->link_info->link_up = 0;
> --
> 2.10.1
>

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

* Re: [dpdk-dev] [PATCH 2/2] net/bnxt: fix unsupported handling in PTP
  2021-03-18  9:35 ` [dpdk-dev] [PATCH 2/2] net/bnxt: fix unsupported handling in PTP Kalesh A P
@ 2021-03-19  0:16   ` Ajit Khaparde
  0 siblings, 0 replies; 4+ messages in thread
From: Ajit Khaparde @ 2021-03-19  0:16 UTC (permalink / raw)
  To: Kalesh A P; +Cc: dpdk-dev, Ferruh Yigit

[-- Attachment #1: Type: text/plain, Size: 3326 bytes --]

On Thu, Mar 18, 2021 at 2:13 AM Kalesh A P
<kalesh-anakkur.purayil@broadcom.com> wrote:
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  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 3665f31..4fd9653 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -3395,9 +3395,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))
> @@ -3430,7 +3427,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. */
> @@ -3450,7 +3447,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_P5(bp))
>                 rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_CURRENT_TIME,
> @@ -3472,7 +3469,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;
> @@ -3513,7 +3510,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;
> @@ -3540,7 +3537,7 @@ bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
>         uint64_t ns;
>
>         if (!ptp)
> -               return 0;
> +               return -ENOTSUP;
>
>         if (BNXT_CHIP_P5(bp))
>                 rx_tstamp_cycles = ptp->rx_timestamp;
> @@ -3563,7 +3560,7 @@ bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
>         int rc = 0;
>
>         if (!ptp)
> -               return 0;
> +               return -ENOTSUP;
>
>         if (BNXT_CHIP_P5(bp))
>                 rc = bnxt_hwrm_port_ts_query(bp, BNXT_PTP_FLAGS_PATH_TX,
> @@ -3584,7 +3581,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
>

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

end of thread, other threads:[~2021-03-19  0:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  9:35 [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations Kalesh A P
2021-03-18  9:35 ` [dpdk-dev] [PATCH 2/2] net/bnxt: fix unsupported handling in PTP Kalesh A P
2021-03-19  0:16   ` Ajit Khaparde
2021-03-19  0:16 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix link state operations Ajit Khaparde

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).