All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] bnxt_en: replace reset with config timestamps
@ 2022-09-21 22:44 Vadim Fedorenko
  2022-09-22  0:38 ` Jakub Kicinski
  2022-09-22  0:39 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2022-09-21 22:44 UTC (permalink / raw)
  To: Michael Chan, Pavan Chebbi, netdev
  Cc: Jakub Kicinski, David S. Miller, Vadim Fedorenko, Richard Cochran

Any change to the hardware timestamps configuration triggers nic restart,
which breaks transmition and reception of network packets for a while.
But there is no need to fully restart the device because while configuring
hardware timestamps. The code for changing configuration runs after all
of the initialisation, when the NIC is actually up and running. This patch
changes the code that ioctl will only update configuration registers and
will not trigger carrier status change, but in case of timestamps for
all rx packetes it fallbacks to close()/open() sequnce because of
synchronization issues in the hardware. Tested on BCM57504.

Fixes: 11862689e8f1 ("bnxt_en: Configure ptp filters during bnxt open")
Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
index 8e316367f6ce..8c8492ee406a 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
@@ -505,9 +505,12 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp)
 	ptp->tstamp_filters = flags;
 
 	if (netif_running(bp->dev)) {
-		rc = bnxt_close_nic(bp, false, false);
-		if (!rc)
-			rc = bnxt_open_nic(bp, false, false);
+		if (ptp->rx_filter == PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE) {
+			rc = bnxt_close_nic(bp, false, false);
+			if (!rc)
+				rc = bnxt_open_nic(bp, false, false);
+		} else
+			bnxt_ptp_cfg_tstamp_filters(bp);
 		if (!rc && !ptp->tstamp_filters)
 			rc = -EIO;
 	}
-- 
2.27.0


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

* Re: [PATCH net v2] bnxt_en: replace reset with config timestamps
  2022-09-21 22:44 [PATCH net v2] bnxt_en: replace reset with config timestamps Vadim Fedorenko
@ 2022-09-22  0:38 ` Jakub Kicinski
  2022-09-22 19:09   ` Vadim Fedorenko
  2022-09-22  0:39 ` Jakub Kicinski
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2022-09-22  0:38 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: Michael Chan, Pavan Chebbi, netdev, David S. Miller, Richard Cochran

On Thu, 22 Sep 2022 01:44:30 +0300 Vadim Fedorenko wrote:
> +		if (ptp->rx_filter == PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE) {

Doesn't ptp->rx_filter hold the uAPI values, i.e. HWTSTAMP_FILTER_* ?

> +			rc = bnxt_close_nic(bp, false, false);
> +			if (!rc)
> +				rc = bnxt_open_nic(bp, false, false);
> +		} else
> +			bnxt_ptp_cfg_tstamp_filters(bp);

nit: missing brackets around the else branch

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

* Re: [PATCH net v2] bnxt_en: replace reset with config timestamps
  2022-09-21 22:44 [PATCH net v2] bnxt_en: replace reset with config timestamps Vadim Fedorenko
  2022-09-22  0:38 ` Jakub Kicinski
@ 2022-09-22  0:39 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-09-22  0:39 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: Michael Chan, Pavan Chebbi, netdev, David S. Miller, Richard Cochran

On Thu, 22 Sep 2022 01:44:30 +0300 Vadim Fedorenko wrote:
> Fixes: 11862689e8f1 ("bnxt_en: Configure ptp filters during bnxt open")

Also, I'd re-target at net-next, unfortunately resetting a NIC 
on random config changes is fairly common, we can't claim it's 
a bug :(

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

* Re: [PATCH net v2] bnxt_en: replace reset with config timestamps
  2022-09-22  0:38 ` Jakub Kicinski
@ 2022-09-22 19:09   ` Vadim Fedorenko
  0 siblings, 0 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2022-09-22 19:09 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Michael Chan, Pavan Chebbi, netdev, David S. Miller, Richard Cochran

On 22.09.2022 01:38, Jakub Kicinski wrote:
> On Thu, 22 Sep 2022 01:44:30 +0300 Vadim Fedorenko wrote:
>> +		if (ptp->rx_filter == PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE) {
> 
> Doesn't ptp->rx_filter hold the uAPI values, i.e. HWTSTAMP_FILTER_* ?
> 

Thanks for catching this, Jakub.
>> +			rc = bnxt_close_nic(bp, false, false);
>> +			if (!rc)
>> +				rc = bnxt_open_nic(bp, false, false);
>> +		} else
>> +			bnxt_ptp_cfg_tstamp_filters(bp);
> 
> nit: missing brackets around the else branch

v3 is on the way, also moving to net-next and without Fixes tag

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

end of thread, other threads:[~2022-09-22 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 22:44 [PATCH net v2] bnxt_en: replace reset with config timestamps Vadim Fedorenko
2022-09-22  0:38 ` Jakub Kicinski
2022-09-22 19:09   ` Vadim Fedorenko
2022-09-22  0:39 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.