bnxt_en: Get the RX packet timestamp
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Sun, 27 Jun 2021 17:19:48 +0000 (13:19 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jun 2021 20:41:06 +0000 (13:41 -0700)
commit7f5515d19cd7aa02a866fd86622a022f12e06f0f
treeab499c8638268ee8ebddd107b858dcf6142fb702
parent390862f45c85b8ebbf9c5c09192bf413a8fb72f8
bnxt_en: Get the RX packet timestamp

If the RX packet is timestamped by the hardware, the RX completion
record will contain the lower 32-bit of the timestamp.  This needs
to be combined with the upper 16-bit of the periodic timestamp that
we get from the timer.  The previous snapshot in ptp->old_timer is
used to make sure that the snapshot is not ahead of the RX timestamp
and we adjust for wrap-around if needed.

v2: Make ptp->old_time read access safe on 32-bit CPUs.

Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h