fm10k: Add support for PTP
This change adds support for the Linux PTP Hardware clock and timestamping functionality provided by the hardware. There are actually two cases that this timestamping is meant to support. The first case would be an ordinary clock scenario. In this configuration the host interface does not have access to BAR 4. However all of the host interfaces should be locked into the same boundary clock region and as such they are all on the same clock anyway. With this being the case they can synchronize among themselves and only need to adjust the offset since they are all on the same clock with the same frequency. The second case is a boundary clock scenario. This is a special case and would require both BAR 4 access, and a means of presenting a netdev per boundary region. The current plan is to use DSA at some point in the future to provide these interfaces, but the DSA portion is still under development. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
5f226ddb5b
commit
a211e0136c
7 changed files with 683 additions and 1 deletions
|
@ -399,6 +399,19 @@ static inline void fm10k_rx_hash(struct fm10k_ring *ring,
|
|||
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
|
||||
}
|
||||
|
||||
static void fm10k_rx_hwtstamp(struct fm10k_ring *rx_ring,
|
||||
union fm10k_rx_desc *rx_desc,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct fm10k_intfc *interface = rx_ring->q_vector->interface;
|
||||
|
||||
FM10K_CB(skb)->tstamp = rx_desc->q.timestamp;
|
||||
|
||||
if (unlikely(interface->flags & FM10K_FLAG_RX_TS_ENABLED))
|
||||
fm10k_systime_to_hwtstamp(interface, skb_hwtstamps(skb),
|
||||
le64_to_cpu(rx_desc->q.timestamp));
|
||||
}
|
||||
|
||||
static void fm10k_type_trans(struct fm10k_ring *rx_ring,
|
||||
union fm10k_rx_desc *rx_desc,
|
||||
struct sk_buff *skb)
|
||||
|
@ -448,6 +461,8 @@ static unsigned int fm10k_process_skb_fields(struct fm10k_ring *rx_ring,
|
|||
|
||||
fm10k_rx_checksum(rx_ring, rx_desc, skb);
|
||||
|
||||
fm10k_rx_hwtstamp(rx_ring, rx_desc, skb);
|
||||
|
||||
FM10K_CB(skb)->fi.w.vlan = rx_desc->w.vlan;
|
||||
|
||||
skb_record_rx_queue(skb, rx_ring->queue_index);
|
||||
|
@ -886,6 +901,11 @@ static u8 fm10k_tx_desc_flags(struct sk_buff *skb, u32 tx_flags)
|
|||
/* set type for advanced descriptor with frame checksum insertion */
|
||||
u32 desc_flags = 0;
|
||||
|
||||
/* set timestamping bits */
|
||||
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
|
||||
likely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS))
|
||||
desc_flags |= FM10K_TXD_FLAG_TIME;
|
||||
|
||||
/* set checksum offload bits */
|
||||
desc_flags |= FM10K_SET_FLAG(tx_flags, FM10K_TX_FLAGS_CSUM,
|
||||
FM10K_TXD_FLAG_CSUM);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue