Skip to content

Commit 9bf688d

Browse files
Pavan Chebbidavem330
authored andcommitted
bnxt_en: Let bnxt_stamp_tx_skb() return error code
Change the function bnxt_stamp_tx_skb() to return 0 for suceess or -EAGAIN if the timestamp is still pending in firmware. The calling PTP aux worker will reschedule based on the return code. Signed-off-by: Pavan Chebbi <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 573f2a4 commit 9bf688d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static u64 bnxt_cc_read(const struct cyclecounter *cc)
683683
return ns;
684684
}
685685

686-
static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb)
686+
static int bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb)
687687
{
688688
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
689689
struct skb_shared_hwtstamps timestamp;
@@ -711,7 +711,7 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb)
711711
} else {
712712
if (!time_after_eq(jiffies, txts_req->abs_txts_tmo)) {
713713
txts_req->txts_pending = true;
714-
return;
714+
return -EAGAIN;
715715
}
716716
ptp->stats.ts_lost++;
717717
netdev_warn_once(bp->dev,
@@ -722,6 +722,8 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb)
722722
txts_req->tx_skb = NULL;
723723
atomic_inc(&ptp->tx_avail);
724724
txts_req->txts_pending = false;
725+
726+
return 0;
725727
}
726728

727729
static long bnxt_ptp_ts_aux_work(struct ptp_clock_info *ptp_info)
@@ -730,12 +732,16 @@ static long bnxt_ptp_ts_aux_work(struct ptp_clock_info *ptp_info)
730732
ptp_info);
731733
unsigned long now = jiffies;
732734
struct bnxt *bp = ptp->bp;
735+
int rc = 0;
733736

734737
if (ptp->txts_req.tx_skb)
735-
bnxt_stamp_tx_skb(bp, ptp->txts_req.tx_skb);
738+
rc = bnxt_stamp_tx_skb(bp, ptp->txts_req.tx_skb);
736739

737-
if (!time_after_eq(now, ptp->next_period))
740+
if (!time_after_eq(now, ptp->next_period)) {
741+
if (rc == -EAGAIN)
742+
return 0;
738743
return ptp->next_period - now;
744+
}
739745

740746
bnxt_ptp_get_current_time(bp);
741747
ptp->next_period = now + HZ;
@@ -745,7 +751,7 @@ static long bnxt_ptp_ts_aux_work(struct ptp_clock_info *ptp_info)
745751
spin_unlock_bh(&ptp->ptp_lock);
746752
ptp->next_overflow_check = now + BNXT_PHC_OVERFLOW_PERIOD;
747753
}
748-
if (ptp->txts_req.txts_pending)
754+
if (rc == -EAGAIN)
749755
return 0;
750756
return HZ;
751757
}

0 commit comments

Comments
 (0)