Commit 3a66abe9 authored by Andre Guedes's avatar Andre Guedes Committed by Jeff Kirsher

igc: Clean up Rx timestamping logic

Differently from I210, I225 doesn't report Rx timestamps via the TS bit
Rx descriptor + RXSTMPL/RXSTMPH registers mechanism. Rx timestamps are
reported in the packet buffer only, which is implemented by igc_ptp_rx_
pktstamp(). So this patch removes igc_ptp_rx_rgtstamp() and all code
related to it, copied from igb driver.
Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 707abf06
...@@ -210,8 +210,6 @@ struct igc_adapter { ...@@ -210,8 +210,6 @@ struct igc_adapter {
struct sk_buff *ptp_tx_skb; struct sk_buff *ptp_tx_skb;
struct hwtstamp_config tstamp_config; struct hwtstamp_config tstamp_config;
unsigned long ptp_tx_start; unsigned long ptp_tx_start;
unsigned long last_rx_ptp_check;
unsigned long last_rx_timestamp;
unsigned int ptp_flags; unsigned int ptp_flags;
/* System time value lock */ /* System time value lock */
spinlock_t tmreg_lock; spinlock_t tmreg_lock;
...@@ -549,7 +547,6 @@ void igc_ptp_init(struct igc_adapter *adapter); ...@@ -549,7 +547,6 @@ void igc_ptp_init(struct igc_adapter *adapter);
void igc_ptp_reset(struct igc_adapter *adapter); void igc_ptp_reset(struct igc_adapter *adapter);
void igc_ptp_suspend(struct igc_adapter *adapter); void igc_ptp_suspend(struct igc_adapter *adapter);
void igc_ptp_stop(struct igc_adapter *adapter); void igc_ptp_stop(struct igc_adapter *adapter);
void igc_ptp_rx_rgtstamp(struct igc_q_vector *q_vector, struct sk_buff *skb);
void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va, void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va,
struct sk_buff *skb); struct sk_buff *skb);
int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr); int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
......
...@@ -323,7 +323,6 @@ ...@@ -323,7 +323,6 @@
/* Advanced Receive Descriptor bit definitions */ /* Advanced Receive Descriptor bit definitions */
#define IGC_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ #define IGC_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */
#define IGC_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */
#define IGC_RXDEXT_STATERR_CE 0x01000000 #define IGC_RXDEXT_STATERR_CE 0x01000000
#define IGC_RXDEXT_STATERR_SE 0x02000000 #define IGC_RXDEXT_STATERR_SE 0x02000000
...@@ -384,7 +383,6 @@ ...@@ -384,7 +383,6 @@
#define IGC_FTQF_MASK_PROTO_BP 0x10000000 #define IGC_FTQF_MASK_PROTO_BP 0x10000000
/* Time Sync Receive Control bit definitions */ /* Time Sync Receive Control bit definitions */
#define IGC_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */
#define IGC_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ #define IGC_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */
#define IGC_TSYNCRXCTL_TYPE_L2_V2 0x00 #define IGC_TSYNCRXCTL_TYPE_L2_V2 0x00
#define IGC_TSYNCRXCTL_TYPE_L4_V1 0x02 #define IGC_TSYNCRXCTL_TYPE_L4_V1 0x02
......
...@@ -1479,9 +1479,9 @@ static inline void igc_rx_hash(struct igc_ring *ring, ...@@ -1479,9 +1479,9 @@ static inline void igc_rx_hash(struct igc_ring *ring,
* @rx_desc: pointer to the EOP Rx descriptor * @rx_desc: pointer to the EOP Rx descriptor
* @skb: pointer to current skb being populated * @skb: pointer to current skb being populated
* *
* This function checks the ring, descriptor, and packet information in * This function checks the ring, descriptor, and packet information in order
* order to populate the hash, checksum, VLAN, timestamp, protocol, and * to populate the hash, checksum, VLAN, protocol, and other fields within the
* other fields within the skb. * skb.
*/ */
static void igc_process_skb_fields(struct igc_ring *rx_ring, static void igc_process_skb_fields(struct igc_ring *rx_ring,
union igc_adv_rx_desc *rx_desc, union igc_adv_rx_desc *rx_desc,
...@@ -1491,10 +1491,6 @@ static void igc_process_skb_fields(struct igc_ring *rx_ring, ...@@ -1491,10 +1491,6 @@ static void igc_process_skb_fields(struct igc_ring *rx_ring,
igc_rx_checksum(rx_ring, rx_desc, skb); igc_rx_checksum(rx_ring, rx_desc, skb);
if (igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TS) &&
!igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP))
igc_ptp_rx_rgtstamp(rx_ring->q_vector, skb);
skb_record_rx_queue(skb, rx_ring->queue_index); skb_record_rx_queue(skb, rx_ring->queue_index);
skb->protocol = eth_type_trans(skb, rx_ring->netdev); skb->protocol = eth_type_trans(skb, rx_ring->netdev);
...@@ -1975,7 +1971,7 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) ...@@ -1975,7 +1971,7 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)
/* probably a little skewed due to removing CRC */ /* probably a little skewed due to removing CRC */
total_bytes += skb->len; total_bytes += skb->len;
/* populate checksum, timestamp, VLAN, and protocol */ /* populate checksum, VLAN, and protocol */
igc_process_skb_fields(rx_ring, rx_desc, skb); igc_process_skb_fields(rx_ring, rx_desc, skb);
napi_gro_receive(&q_vector->napi, skb); napi_gro_receive(&q_vector->napi, skb);
......
...@@ -205,46 +205,6 @@ void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va, ...@@ -205,46 +205,6 @@ void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va,
ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust); ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust);
} }
/**
* igc_ptp_rx_rgtstamp - retrieve Rx timestamp stored in register
* @q_vector: Pointer to interrupt specific structure
* @skb: Buffer containing timestamp and packet
*
* This function is meant to retrieve a timestamp from the internal registers
* of the adapter and store it in the skb.
*/
void igc_ptp_rx_rgtstamp(struct igc_q_vector *q_vector,
struct sk_buff *skb)
{
struct igc_adapter *adapter = q_vector->adapter;
struct igc_hw *hw = &adapter->hw;
u64 regval;
/* If this bit is set, then the RX registers contain the time
* stamp. No other packet will be time stamped until we read
* these registers, so read the registers to make them
* available again. Because only one packet can be time
* stamped at a time, we know that the register values must
* belong to this one here and therefore we don't need to
* compare any of the additional attributes stored for it.
*
* If nothing went wrong, then it should have a shared
* tx_flags that we can turn into a skb_shared_hwtstamps.
*/
if (!(rd32(IGC_TSYNCRXCTL) & IGC_TSYNCRXCTL_VALID))
return;
regval = rd32(IGC_RXSTMPL);
regval |= (u64)rd32(IGC_RXSTMPH) << 32;
igc_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
/* Update the last_rx_timestamp timer in order to enable watchdog check
* for error case of latched timestamp on a dropped packet.
*/
adapter->last_rx_timestamp = jiffies;
}
/** /**
* igc_ptp_enable_tstamp_rxqueue - Enable RX timestamp for a queue * igc_ptp_enable_tstamp_rxqueue - Enable RX timestamp for a queue
* @rx_ring: Pointer to RX queue * @rx_ring: Pointer to RX queue
...@@ -419,11 +379,9 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter, ...@@ -419,11 +379,9 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter,
} }
wrfl(); wrfl();
/* clear TX/RX time stamp registers, just to be sure */ /* clear TX time stamp registers, just to be sure */
regval = rd32(IGC_TXSTMPL); regval = rd32(IGC_TXSTMPL);
regval = rd32(IGC_TXSTMPH); regval = rd32(IGC_TXSTMPH);
regval = rd32(IGC_RXSTMPL);
regval = rd32(IGC_RXSTMPH);
return 0; return 0;
} }
......
...@@ -228,8 +228,6 @@ ...@@ -228,8 +228,6 @@
#define IGC_SYSTIMR 0x0B6F8 /* System time register Residue */ #define IGC_SYSTIMR 0x0B6F8 /* System time register Residue */
#define IGC_TIMINCA 0x0B608 /* Increment attributes register - RW */ #define IGC_TIMINCA 0x0B608 /* Increment attributes register - RW */
#define IGC_RXSTMPL 0x0B624 /* Rx timestamp Low - RO */
#define IGC_RXSTMPH 0x0B628 /* Rx timestamp High - RO */
#define IGC_TXSTMPL 0x0B618 /* Tx timestamp value Low - RO */ #define IGC_TXSTMPL 0x0B618 /* Tx timestamp value Low - RO */
#define IGC_TXSTMPH 0x0B61C /* Tx timestamp value High - RO */ #define IGC_TXSTMPH 0x0B61C /* Tx timestamp value High - RO */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment