From: Chenna Arnoori <[email protected]>

When the adapter is configured to timestamp all incoming packets,
timestamps were silently missing for non-PTP traffic (such as IPv6
packets). A previous update incorrectly restricted the timestamp
processing to only recognised PTP packets by changing an OR condition
to an AND condition. This is corrected so that timestamps are properly
extracted for all received packets when promiscuous timestamping is
enabled.

A comment is added to clarify the two conditions under which the
hardware timestamp is extracted from the completion record:
1. The packet is explicitly classified as a PTP packet (with or
   without timestamp).
2. Promiscuous timestamping is enabled (ptp_all_rx_tstamp), which
   instructs the hardware to timestamp all packets, including
   non-PTP traffic (e.g., IPv6).

Cc: [email protected]
Fixes: 925cd0705836 ("net/bnxt: update PTP support on Thor")

Signed-off-by: Chenna Arnoori <[email protected]>
Signed-off-by: Mohammad Shuab Siddique <[email protected]>
---
 drivers/net/bnxt/bnxt_rxr.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 046276f931..ee49d85d43 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -1203,13 +1203,21 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
        mbuf->data_len = mbuf->pkt_len;
        mbuf->port = rxq->port_id;
 
-       if (unlikely((((rte_le_to_cpu_16(rxcmp->flags_type) &
+       /* Extract the hardware timestamp from the completion record if:
+        * 1. The packet is explicitly classified as a PTP packet (with or
+        *    without timestamp), OR
+        * 2. Promiscuous timestamping is enabled (ptp_all_rx_tstamp), which
+        *    instructs the hardware to timestamp all packets, including
+        *    non-PTP traffic (e.g., IPv6).
+        */
+       if (unlikely(((rte_le_to_cpu_16(rxcmp->flags_type) &
                        RX_PKT_CMPL_FLAGS_MASK) ==
                        RX_PKT_CMPL_FLAGS_ITYPE_PTP_W_TIMESTAMP) ||
                        ((rte_le_to_cpu_16(rxcmp->flags_type) &
                        RX_PKT_CMPL_FLAGS_MASK) ==
-                       RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP)) &&
-                       bp->ptp_all_rx_tstamp) && bp->ieee_1588 &&
+                       RX_PKT_CMPL_FLAGS_ITYPE_PTP_WO_TIMESTAMP) ||
+                       bp->ptp_all_rx_tstamp) &&
+                       bp->ieee_1588 &&
                        bp->ptp_cfg) {
                mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP |
                                  RTE_MBUF_F_RX_IEEE1588_TMST;
-- 
2.47.3

Reply via email to