Skip to content

Commit 84793a4

Browse files
Pavan Chebbikuba-moo
authored andcommitted
bnxt_en: Skip nic close/open when configuring tstamp filters
We don't have to close and open the nic to make sure we have valid rx timestamps. Once we have the timestamp filter applied to the HW and the timestamp_fld_format bit is cleared in the rx completion and the timestamp is non-zero, we can be sure that rx timestamp is valid data. Skip close/open when we set any timestamp filter. Reviewed-by: Andy Gospodarek <[email protected]> Signed-off-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent feeef68 commit 84793a4

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,17 @@ static int bnxt_ptp_cfg_event(struct bnxt *bp, u8 event)
319319
return hwrm_req_send(bp, req);
320320
}
321321

322-
void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp)
322+
int bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp)
323323
{
324324
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
325325
struct hwrm_port_mac_cfg_input *req;
326+
int rc;
326327

327328
if (!ptp || !ptp->tstamp_filters)
328-
return;
329+
return -EIO;
329330

330-
if (hwrm_req_init(bp, req, HWRM_PORT_MAC_CFG))
331+
rc = hwrm_req_init(bp, req, HWRM_PORT_MAC_CFG);
332+
if (rc)
331333
goto out;
332334

333335
if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters &
@@ -342,15 +344,17 @@ void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp)
342344
req->enables = cpu_to_le32(PORT_MAC_CFG_REQ_ENABLES_RX_TS_CAPTURE_PTP_MSG_TYPE);
343345
req->rx_ts_capture_ptp_msg_type = cpu_to_le16(ptp->rxctl);
344346

345-
if (!hwrm_req_send(bp, req)) {
347+
rc = hwrm_req_send(bp, req);
348+
if (!rc) {
346349
bp->ptp_all_rx_tstamp = !!(ptp->tstamp_filters &
347350
PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE);
348-
return;
351+
return 0;
349352
}
350353
ptp->tstamp_filters = 0;
351354
out:
352355
bp->ptp_all_rx_tstamp = 0;
353356
netdev_warn(bp->dev, "Failed to configure HW packet timestamp filters\n");
357+
return rc;
354358
}
355359

356360
void bnxt_ptp_reapply_pps(struct bnxt *bp)
@@ -494,7 +498,6 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp)
494498
{
495499
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
496500
u32 flags = 0;
497-
int rc = 0;
498501

499502
switch (ptp->rx_filter) {
500503
case HWTSTAMP_FILTER_ALL:
@@ -519,19 +522,7 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp)
519522

520523
ptp->tstamp_filters = flags;
521524

522-
if (netif_running(bp->dev)) {
523-
if (ptp->rx_filter == HWTSTAMP_FILTER_ALL) {
524-
rc = bnxt_close_nic(bp, false, false);
525-
if (!rc)
526-
rc = bnxt_open_nic(bp, false, false);
527-
} else {
528-
bnxt_ptp_cfg_tstamp_filters(bp);
529-
}
530-
if (!rc && !ptp->tstamp_filters)
531-
rc = -EIO;
532-
}
533-
534-
return rc;
525+
return bnxt_ptp_cfg_tstamp_filters(bp);
535526
}
536527

537528
int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ do { \
137137
int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id, u16 *hdr_off);
138138
void bnxt_ptp_update_current_time(struct bnxt *bp);
139139
void bnxt_ptp_pps_event(struct bnxt *bp, u32 data1, u32 data2);
140-
void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp);
140+
int bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp);
141141
void bnxt_ptp_reapply_pps(struct bnxt *bp);
142142
int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr);
143143
int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr);

0 commit comments

Comments
 (0)