forked from Minki/linux
bnxt_en: Update firmware call to retrieve TX PTP timestamp
New firmware interface requires the PTP sequence ID header offset to
be passed to the firmware to properly find the matching timestamp
for all protocols.
Fixes: 83bb623c96
("bnxt_en: Transmit and retrieve packet timestamps")
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fbfee25796
commit
9e26680733
@ -426,7 +426,10 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
if (ptp && ptp->tx_tstamp_en && !skb_is_gso(skb) &&
|
||||
atomic_dec_if_positive(&ptp->tx_avail) >= 0) {
|
||||
if (!bnxt_ptp_parse(skb, &ptp->tx_seqid)) {
|
||||
if (!bnxt_ptp_parse(skb, &ptp->tx_seqid,
|
||||
&ptp->tx_hdr_off)) {
|
||||
if (vlan_tag_flags)
|
||||
ptp->tx_hdr_off += VLAN_HLEN;
|
||||
lflags |= cpu_to_le32(TX_BD_FLAGS_STAMP);
|
||||
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
|
||||
} else {
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "bnxt.h"
|
||||
#include "bnxt_ptp.h"
|
||||
|
||||
int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id)
|
||||
int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id, u16 *hdr_off)
|
||||
{
|
||||
unsigned int ptp_class;
|
||||
struct ptp_header *hdr;
|
||||
@ -34,6 +34,7 @@ int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id)
|
||||
if (!hdr)
|
||||
return -EINVAL;
|
||||
|
||||
*hdr_off = (u8 *)hdr - skb->data;
|
||||
*seq_id = ntohs(hdr->sequence_id);
|
||||
return 0;
|
||||
default:
|
||||
@ -91,6 +92,7 @@ static int bnxt_hwrm_port_ts_query(struct bnxt *bp, u32 flags, u64 *ts)
|
||||
PORT_TS_QUERY_REQ_FLAGS_PATH_TX) {
|
||||
req.enables = cpu_to_le16(BNXT_PTP_QTS_TX_ENABLES);
|
||||
req.ptp_seq_id = cpu_to_le32(bp->ptp_cfg->tx_seqid);
|
||||
req.ptp_hdr_offset = cpu_to_le16(bp->ptp_cfg->tx_hdr_off);
|
||||
req.ts_req_timeout = cpu_to_le16(BNXT_PTP_QTS_TIMEOUT);
|
||||
}
|
||||
mutex_lock(&bp->hwrm_cmd_lock);
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
#define BNXT_PTP_QTS_TIMEOUT 1000
|
||||
#define BNXT_PTP_QTS_TX_ENABLES (PORT_TS_QUERY_REQ_ENABLES_PTP_SEQ_ID | \
|
||||
PORT_TS_QUERY_REQ_ENABLES_TS_REQ_TIMEOUT)
|
||||
PORT_TS_QUERY_REQ_ENABLES_TS_REQ_TIMEOUT | \
|
||||
PORT_TS_QUERY_REQ_ENABLES_PTP_HDR_OFFSET)
|
||||
|
||||
struct bnxt_ptp_cfg {
|
||||
struct ptp_clock_info ptp_info;
|
||||
@ -37,6 +38,7 @@ struct bnxt_ptp_cfg {
|
||||
#define BNXT_PHC_OVERFLOW_PERIOD (19 * 3600 * HZ)
|
||||
|
||||
u16 tx_seqid;
|
||||
u16 tx_hdr_off;
|
||||
struct bnxt *bp;
|
||||
atomic_t tx_avail;
|
||||
#define BNXT_MAX_TX_TS 1
|
||||
@ -74,7 +76,7 @@ do { \
|
||||
((dst) = READ_ONCE(src))
|
||||
#endif
|
||||
|
||||
int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id);
|
||||
int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id, u16 *hdr_off);
|
||||
int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr);
|
||||
int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr);
|
||||
int bnxt_get_tx_ts_p5(struct bnxt *bp, struct sk_buff *skb);
|
||||
|
Loading…
Reference in New Issue
Block a user