igb: ptp hardware clock
Subsystems (3)
PATCH 2/2 igb: offer a PTP Hardware Clock instead of the timecompare method
In reply to Richard CochranThis commit removes the legacy timecompare code from the igb driver and offers a tunable PHC instead.
--- drivers/net/ethernet/intel/igb/Makefile | 2 +- drivers/net/ethernet/intel/igb/igb.h | 13 ++- drivers/net/ethernet/intel/igb/igb_main.c | 167 +---------------------------- drivers/net/ethernet/intel/igb/igb_ptp.c | 42 +++++++ 4 files changed, 53 insertions(+), 171 deletions(-)
drivers/net/ethernet/intel/igb/Makefile +1 -1
@@ -32,6 +32,6 @@ obj-$(CONFIG_IGB) += igb.o -igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \ +igb-objs := igb_main.o igb_ethtool.o igb_ptp.o e1000_82575.o \ e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o
drivers/net/ethernet/intel/igb/igb.h +7 -6
@@ -34,8 +34,6 @@#include "e1000_mac.h" #include "e1000_82575.h" -#include <linux/clocksource.h> -#include <linux/timecompare.h> #include <linux/net_tstamp.h> #include <linux/ptp_clock_kernel.h> #include <linux/bitops.h>
@@ -329,9 +327,6 @@ struct igb_adapter {/* OS defined structs */ struct pci_dev *pdev; -struct cyclecounter cycles; -struct timecounter clock; -struct timecompare compare;struct hwtstamp_config hwtstamp_config;spinlock_t stats64_lock;
@@ -386,7 +381,6 @@ struct igb_adapter {#define IGB_DMCTLX_DCFLUSH_DIS 0x80000000/* Disable DMA Coal Flush */ #define IGB_82576_TSYNC_SHIFT 19 -#define IGB_82580_TSYNC_SHIFT 24#define IGB_TS_HDR_LEN 16enum e1000_state_t { __IGB_TESTING,
@@ -423,6 +417,13 @@ extern bool igb_has_link(struct igb_adapter *adapter);extern void igb_set_ethtool_ops (struct net_device *);extern void igb_power_up_link (struct igb_adapter *); +extern void igb_ptp_init (struct igb_adapter *adapter); +extern void igb_ptp_remove (struct igb_adapter *adapter); + +extern void igb_systim_to_hwtstamp (struct igb_adapter *adapter, +struct skb_shared_hwtstamps *hwtstamps, +u64 systim); +static inline s32 igb_reset_phy (struct e1000_hw *hw) {if (hw->phy.ops.reset)
drivers/net/ethernet/intel/igb/igb_main.c +3 -164
203 lines not on this page · raw message
drivers/net/ethernet/intel/igb/igb_ptp.c +42 -0
45 lines not on this page · raw message
Signature · 13 lines
1.7.2.5 ------------------------------------------------------------------------------ Systems Optimization Self Assessment Improve efficiency and utilization of IT resources. Drive out cost and improve service delivery. Take 5 minutes to use this Systems Optimization Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/ _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
cover igb: ptp hardware clock
This patch series implements a PHC driver for the Intel 82576 and 82580 devices, as part of the igb driver.
The first patch adds the PHC driver code as a new source module but does not link it into the main igb driver. Because the system time counter is not so very wide, the code implements an overflow counter in software. Every read operation maintains the overflow counter, as does a "delayed work" watchdog. Only the base clock operations are implemented. The hardware does have some ancillary features, but these can be easily added later.
The second patch removes the timecompare code and links in the new functions.
I have tested the 82580 with good results. However, I don't have the 82576 and so would appreciate testing and feedback.
Thanks,
Richard
Richard Cochran (2):
igb: add PTP Hardware Clock code
igb: offer a PTP Hardware Clock instead of the timecompare method
drivers/net/ethernet/intel/igb/Makefile | 2 +- drivers/net/ethernet/intel/igb/igb.h | 21 +- drivers/net/ethernet/intel/igb/igb_main.c | 167 +----------- drivers/net/ethernet/intel/igb/igb_ptp.c | 450 +++++++++++++++++++++++++++++ 4 files changed, 469 insertions(+), 171 deletions(-) create mode 100644 drivers/net/ethernet/intel/igb/igb_ptp.c
Signature · 1 line
1.7.2.5
PATCH 1/2 igb: add PTP Hardware Clock code
This patch adds a source file implementing a PHC. Only the basic clock operations have been implemented, although the hardware would offer some ancillary functions. The code is fairly self contained and is not yet used in the main igb driver.
--- drivers/net/ethernet/intel/igb/igb.h | 8 + drivers/net/ethernet/intel/igb/igb_ptp.c | 408 ++++++++++++++++++++++++++++++ 2 files changed, 416 insertions(+), 0 deletions(-) create mode 100644 drivers/net/ethernet/intel/igb/igb_ptp.c
drivers/net/ethernet/intel/igb/igb.h +8 -0
@@ -37,6 +37,7 @@#include <linux/clocksource.h> #include <linux/timecompare.h> #include <linux/net_tstamp.h> +#include <linux/ptp_clock_kernel.h> #include <linux/bitops.h> #include <linux/if_vlan.h>
@@ -364,6 +365,13 @@ struct igb_adapter {u32 wvbr;int node;u32 *shadow_vfta; + +struct ptp_clock *ptp_clock; +struct ptp_clock_info caps; +struct delayed_work overflow_work; +spinlock_t tmreg_lock; +u32 overflow_counter; +int last_msb; };#define IGB_FLAG_HAS_MSI (1 << 0)
drivers/net/ethernet/intel/igb/igb_ptp.c new file +408 -0
408 lines not on this page · raw message
Signature · 1 line
1.7.2.5
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
In reply to Richard CochranQuoted 28 lines · Richard Cochran
This commit removes the legacy timecompare code from the igb driver and offers a tunable PHC instead.
Signed-off-by Richard Cochran <[email protected]>---
drivers/net/ethernet/intel/igb/igb_ptp.c +22
-0+void igb_systim_to_hwtstamp (struct igb_adapter *adapter, +struct skb_shared_hwtstamps *hwtstamps, +u64 systim) +{ +u64 ns; +unsigned long flags; +unsigned int shift; +int msb_set; + +switch (adapter->hw.mac.type) { +case e1000_i350: +case e1000_82580: + shift =OFL_SHIFT_82580 ; + msb_set = (systim >>32 ) &SYSTIMH_MSB_82580 ; +break ; +case e1000_82576: + shift =OFL_SHIFT_82576 ; + msb_set = (systim >>32 ) &SYSTIMH_MSB_82576 ; +break ; +default : +return ; + }
drivers/net/ethernet/intel/igb/igb_ptp.c void igb_ptp_remove(struct igb_adapter *adapter) · line 450
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +10
-0+ +spin_lock_irqsave (&adapter->tmreg_lock, flags); + + ns =igb_overflow_get (adapter, systim, msb_set, shift); + +spin_unlock_irqrestore (&adapter->tmreg_lock, flags); + +memset (hwtstamps,0 ,sizeof (*hwtstamps)); + hwtstamps->hwtstamp =ns_to_ktime (ns); +}
Adding a (shared) spinlock on a multiqueue device is source of extra delay (because of extra cache line trafic), I guess.
It seems current code doesnt need a spinlock, maybe it was a bug ?
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
Quoted 5 lines · Eric Dumazet
Adding a (shared) spinlock on a multiqueue device is source of extra delay (because of extra cache line trafic), I guess.
It seems current code doesnt need a spinlock, maybe it was a bug ?
(I didn't think about the old code. I only deleted it. ;)
The spinlock is needed because reading the 64 bit time value involves reading two 32 registers. The first read latches the value. Ditto for writing.
In addition, here we have to watch the most significant bit for one-to-zero transistion, in order to keep count of the overflow.
It is too bad that we have to take the spinlock for every time stamped packet, but it is the hardware's fault for not providing a 64 bit wide nanosecond time register.
Richard
------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and improve service delivery. Take 5 minutes to use this Systems Optimization Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
Quoted 13 lines · Richard Cochran
Quoted 5 lines · Eric Dumazet
Adding a (shared) spinlock on a multiqueue device is source of extra delay (because of extra cache line trafic), I guess.
It seems current code doesnt need a spinlock, maybe it was a bug ?
(I didn't think about the old code. I only deleted it. ;)
The spinlock is needed because reading the 64 bit time value involves reading two 32 registers. The first read latches the value. Ditto for writing.
Quoted 7 lines
In addition, here we have to watch the most significant bit for one-to-zero transistion, in order to keep count of the overflow.
It is too bad that we have to take the spinlock for every time stamped packet, but it is the hardware's fault for not providing a 64 bit wide nanosecond time register.
Yes, probably. Are you sure a workaround is not possible, using a seqlock for synchronization of threads, and two hardware reads ?
Or maybe it doesnt matter at all :)
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
Quoted 7 lines · Eric Dumazet
Quoted 4 lines
It is too bad that we have to take the spinlock for every time stamped packet, but it is the hardware's fault for not providing a 64 bit wide nanosecond time register.
Yes, probably. Are you sure a workaround is not possible, using a seqlock for synchronization of threads, and two hardware reads ?
Many things are possible...
Quoted 1 line
Or maybe it doesnt matter at all :)
Yes, I think it not worth the effort. In general, the whole time stamping thing is at odds with network throughput.
Richard
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
In reply to Richard CochranQuoted 4 lines · Richard Cochran
This commit removes the legacy timecompare code from the igb driver and offers a tunable PHC instead.
Signed-off-by Richard Cochran <[email protected]>
Richard, first, thanks for this work, I have some feedback and request you make a V2.
drivers/net/ethernet/intel/igb/igb_main.c exit: · line 568
Quoted 5 lines
drivers/net/ethernet/intel/igb/igb_main.c +0
-5-/* -* The timestamp latches on lowest register read. For the 82580 -* the lowest register is SYSTIMR instead of SYSTIML. However we never -* adjusted TIMINCA so SYSTIMR will just read as all 0s so ignore it. -*/
Please keep this comment in your new igb_82580_systim_read, it explains a bit of *why* we are doing something. There were a lot of explanatory comments that you removed, please audit the "-" lines of your patch and add back the comments that are appropriate in your new code.
Quoted 185 lines
drivers/net/ethernet/intel/igb/igb_main.c +3
-146-if (hw->mac.type >= e1000_82580) { - stamp =rd32 (E1000_SYSTIMR ) >>8 ; - shift =IGB_82580_TSYNC_SHIFT ; - } - - stamp |= (u64 )rd32 (E1000_SYSTIML ) << shift; - stamp |= (u64 )rd32 (E1000_SYSTIMH ) << (shift +32 ); -return stamp; -} -/** * igb_get_hw_dev - return device * used by hardware layer to print debugging information @@ -2080,7 +2052,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,#endif /* do hw tstamp init after resetting */ -igb_init_hw_timer (adapter); +igb_ptp_init (adapter);dev_info (&pdev->dev,"Intel(R) Gigabit Ethernet Network Connection\n" );/* print bus type/speed/width info */ @@ -2150,6 +2122,8 @@ static void __devexit igb_remove(struct pci_dev *pdev)struct igb_adapter *adapter =netdev_priv (netdev);struct e1000_hw *hw = &adapter->hw; +igb_ptp_remove (adapter); +/* * The watchdog timer may be rescheduled, so explicitly * disable watchdog from being rescheduled. @@ -2269,112 +2243,6 @@ out: }/** -* igb_init_hw_timer - Initialize hardware timer used with IEEE 1588 timestamp -* @adapter: board private structure to initialize -* -* igb_init_hw_timer initializes the function pointer and values for the hw -* timer found in hardware. -**/ -static void igb_init_hw_timer (struct igb_adapter *adapter) -{ -struct e1000_hw *hw = &adapter->hw; - -switch (hw->mac.type) { -case e1000_i350: -case e1000_82580: -memset (&adapter->cycles,0 ,sizeof (adapter->cycles)); - adapter->cycles.read = igb_read_clock; - adapter->cycles.mask =CLOCKSOURCE_MASK (64 ); - adapter->cycles.mult =1 ; -/* -* The 82580 timesync updates the system timer every 8ns by 8ns -* and the value cannot be shifted. Instead we need to shift -* the registers to generate a 64bit timer value. As a result -* SYSTIMR/L/H, TXSTMPL/H, RXSTMPL/H all have to be shifted by -* 24 in order to generate a larger value for synchronization. -*/ - adapter->cycles.shift =IGB_82580_TSYNC_SHIFT ; -/* disable system timer temporarily by setting bit 31 */ -wr32 (E1000_TSAUXC ,0x80000000 ); -wrfl (); - -/* Set registers so that rollover occurs soon to test this. */ -wr32 (E1000_SYSTIMR ,0x00000000 ); -wr32 (E1000_SYSTIML ,0x80000000 ); -wr32 (E1000_SYSTIMH ,0x000000FF ); -wrfl (); - -/* enable system timer by clearing bit 31 */ -wr32 (E1000_TSAUXC ,0x0 ); -wrfl (); - -timecounter_init (&adapter->clock, - &adapter->cycles, -ktime_to_ns (ktime_get_real ())); -/* -* Synchronize our NIC clock against system wall clock. NIC -* time stamp reading requires ~3us per sample, each sample -* was pretty stable even under load => only require 10 -* samples for each offset comparison. -*/ -memset (&adapter->compare,0 ,sizeof (adapter->compare)); - adapter->compare.source = &adapter->clock; - adapter->compare.target = ktime_get_real; - adapter->compare.num_samples =10 ; -timecompare_update (&adapter->compare,0 ); -break ; -case e1000_82576: -/* -* Initialize hardware timer: we keep it running just in case -* that some program needs it later on. -*/ -memset (&adapter->cycles,0 ,sizeof (adapter->cycles)); - adapter->cycles.read = igb_read_clock; - adapter->cycles.mask =CLOCKSOURCE_MASK (64 ); - adapter->cycles.mult =1 ; -/** -* Scale the NIC clock cycle by a large factor so that -* relatively small clock corrections can be added or -* subtracted at each clock tick. The drawbacks of a large -* factor are a) that the clock register overflows more quickly -* (not such a big deal) and b) that the increment per tick has -* to fit into 24 bits. As a result we need to use a shift of -* 19 so we can fit a value of 16 into the TIMINCA register. -*/ - adapter->cycles.shift =IGB_82576_TSYNC_SHIFT ; -wr32 (E1000_TIMINCA , - (1 <<E1000_TIMINCA_16NS_SHIFT ) | - (16 <<IGB_82576_TSYNC_SHIFT )); - -/* Set registers so that rollover occurs soon to test this. */ -wr32 (E1000_SYSTIML ,0x00000000 ); -wr32 (E1000_SYSTIMH ,0xFF800000 ); -wrfl (); - -timecounter_init (&adapter->clock, - &adapter->cycles, -ktime_to_ns (ktime_get_real ())); -/* -* Synchronize our NIC clock against system wall clock. NIC -* time stamp reading requires ~3us per sample, each sample -* was pretty stable even under load => only require 10 -* samples for each offset comparison. -*/ -memset (&adapter->compare,0 ,sizeof (adapter->compare)); - adapter->compare.source = &adapter->clock; - adapter->compare.target = ktime_get_real; - adapter->compare.num_samples =10 ; -timecompare_update (&adapter->compare,0 ); -break ; -case e1000_82575: -/* 82575 does not support timesync */ -default : -break ; - } - -} - -/** * igb_sw_init - Initialize general software structures (struct igb_adapter) * @adapter: board private structure to initialize * @@ -5628,35 +5496,6 @@ static int igb_poll(struct napi_struct *napi, int budget) }/** -* igb_systim_to_hwtstamp - convert system time value to hw timestamp -* @adapter: board private structure -* @shhwtstamps: timestamp structure to update -* @regval: unsigned 64bit system time value. -* -* We need to convert the system time value stored in the RX/TXSTMP registers -* into a hwtstamp which can be used by the upper level timestamping functions -*/ -static void igb_systim_to_hwtstamp (struct igb_adapter *adapter, -struct skb_shared_hwtstamps *shhwtstamps, -u64 regval) -{ -u64 ns; - -/* -* The 82580 starts with 1ns at bit 0 in RX/TXSTMPL, shift this up to -* 24 to match clock shift we setup earlier. -*/ -if (adapter->hw.mac.type >= e1000_82580) - regval <<=IGB_82580_TSYNC_SHIFT ; - - ns =timecounter_cyc2time (&adapter->clock, regval); -timecompare_update (&adapter->compare, ns); -memset (shhwtstamps,0 ,sizeof (struct skb_shared_hwtstamps )); - shhwtstamps->hwtstamp =ns_to_ktime (ns); - shhwtstamps->syststamp =timecompare_transform (&adapter->compare, ns); -} - -/** * igb_tx_hwtstamp - utility function which checks for TX time stamp * @q_vector: pointer to q_vector containing needed info * @buffer: pointer to igb_tx_buffer structure drivers/net/ethernet/intel/igb/igb_ptp.c +0
-0
drivers/net/ethernet/intel/igb/igb_ptp.c void igb_ptp_remove(struct igb_adapter *adapter) · line 413
Quoted 8 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +5
-0@@ -406,3 +406,45 @@ void igb_ptp_remove(struct igb_adapter *adapter) adapter->netdev->name); } } + +/** +* igb_systim_to_hwtstamp - convert system time value to hw timestamp +* @adapter: board private structure +* @shhwtstamps: timestamp structure to update
cut and paste typo? should match the arguments below.
Quoted 19 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +19
-0+* @systim: unsigned 64bit system time value. +* +* We need to convert the system time value stored in the RX/TXSTMP registers +* into a hwtstamp which can be used by the upper level timestamping functions +*/ +void igb_systim_to_hwtstamp (struct igb_adapter *adapter, +struct skb_shared_hwtstamps *hwtstamps, +u64 systim) +{ +u64 ns; +unsigned long flags; +unsigned int shift; +int msb_set; + +switch (adapter->hw.mac.type) { +case e1000_i350: +case e1000_82580: + shift =OFL_SHIFT_82580 ; + msb_set = (systim >>32 ) &SYSTIMH_MSB_82580 ;
drivers/net/ethernet/intel/igb/igb_ptp.c void igb_ptp_remove(struct igb_adapter *adapter) · line 442
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +10
-0+break ; +case e1000_82576: + shift =OFL_SHIFT_82576 ; + msb_set = (systim >>32 ) &SYSTIMH_MSB_82576 ; +break ; +default : +return ; + } + +spin_lock_irqsave (&adapter->tmreg_lock, flags);
based on the discussion on the list with eric dumazet it should have a comment here why the spinlock is needed and about how it is expected to impact performance.
Quoted 8 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +8
-0+ + ns =igb_overflow_get (adapter, systim, msb_set, shift); + +spin_unlock_irqrestore (&adapter->tmreg_lock, flags); + +memset (hwtstamps,0 ,sizeof (*hwtstamps)); + hwtstamps->hwtstamp =ns_to_ktime (ns); +}
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
Quoted 8 lines · Jesse Brandeburg
Quoted 4 lines · Richard Cochran
This commit removes the legacy timecompare code from the igb driver and offers a tunable PHC instead.
Signed-off-by Richard Cochran <[email protected]>Richard, first, thanks for this work, I have some feedback and request you make a V2.
Thanks for your feedback, I'll will work your comments in.
Any chance of getting the driver tested on a 82576?
Thanks,
Richard
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
Quoted 23 lines
-----Original Message-----
From: Richard Cochran [mailto:[email protected]]
Sent: Thursday, December 15, 2011 8:13 AM
To: Brandeburg, Jesse
Cc: [email protected]; [email protected]; Keller, Jacob E; Kirsher, Jeffrey T; Ronciak, John; John Stultz; Thomas Gleixner; Wyborny, Carolyn
Subject: Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare methodQuoted 2 lines · Jesse Brandeburg
Quoted 1 line · Richard Cochran
This commit removes the legacy timecompare code from the igb driver
and
Quoted 6 lines
Quoted 3 lines
offers a tunable PHC instead.
Signed-off-by Richard Cochran <[email protected]>Richard, first, thanks for this work, I have some feedback and request you make a V2.
Quoted 7 lines
Thanks for your feedback, I'll will work your comments in.
Any chance of getting the driver tested on a 82576?
Thanks,
Richard
I will request this testing and let you know.
Thanks,
Carolyn
Carolyn Wyborny
Linux Development
LAN Access Division
Intel Corporation
------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.
But none more important than the need to reduce IT complexity
while improving strategic productivity. Learn More!
http://www.accelacomm.com/jaw/sdnl/114/51507609/
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
Quoted 2 lines · Carolyn
Quoted 2 lines
-----Original Message-----
From: Richard Cochran [mailto:[email protected]]
...
Quoted 7 lines
Quoted 5 lines
Any chance of getting the driver tested on a 82576?
Thanks,
Richard
I will request this testing and let you know.
Never mind about testing this patch. I have already found a bug in the code path for the 82576. I will post a new, corrected patch later on this week.
Thanks, and Merry Christmas to All,
Richard
Re: [PATCH net-next 1/2] igb: add PTP Hardware Clock code
In reply to Richard CochranJust for the record, reviewing my own patch and pointing out the mistakes WRT the 82576.
drivers/net/ethernet/intel/igb/igb_ptp.c line 126
Quoted 7 lines · Richard Cochran
drivers/net/ethernet/intel/igb/igb_ptp.c new file +7
-0+static void igb_82576_systim_write (struct igb_adapter *igb,u64 ns) +{ +u32 hi, lo; +struct e1000_hw *hw = &igb->hw; + + hi = (ns >>8 ) &0xffffffff ; + lo = (ns &0xff ) <<NS_SHIFT_82576 ;
Should have been:
hi = (ns >> 13) & 0xffffffff; lo = (ns & 0x1fff) << NS_SHIFT_82576;
drivers/net/ethernet/intel/igb/igb_ptp.c line 132
Quoted 6 lines
drivers/net/ethernet/intel/igb/igb_ptp.c new file +6
-0+ +wr32 (E1000_SYSTIML , lo); +wr32 (E1000_SYSTIMH , hi); + +igb_overflow_set (igb, ns, hi &SYSTIMH_MSB_82576 ,OFL_SHIFT_82576 ); +}
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Re: [PATCH net-next 2/2] igb: offer a PTP Hardware Clock instead of the timecompare method
In reply to Richard CochranQuoted 8 lines · Richard Cochran
drivers/net/ethernet/intel/igb/igb_ptp.c +8
-0+void igb_systim_to_hwtstamp (struct igb_adapter *adapter, +struct skb_shared_hwtstamps *hwtstamps, +u64 systim) +{ +u64 ns; +unsigned long flags; +unsigned int shift; +int msb_set;
drivers/net/ethernet/intel/igb/igb_ptp.c void igb_ptp_remove(struct igb_adapter *adapter) · line 436
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +10
-0+ +switch (adapter->hw.mac.type) { +case e1000_i350: +case e1000_82580: + shift =OFL_SHIFT_82580 ; + msb_set = (systim >>32 ) &SYSTIMH_MSB_82580 ; +break ; +case e1000_82576: + shift =OFL_SHIFT_82576 ; + msb_set = (systim >>32 ) &SYSTIMH_MSB_82576 ;
Should have converted systim to nanoseconds here.
Quoted 17 lines
drivers/net/ethernet/intel/igb/igb_ptp.c +14
-0+break ; +default : +return ; + } + +spin_lock_irqsave (&adapter->tmreg_lock, flags); + + ns =igb_overflow_get (adapter, systim, msb_set, shift); + +spin_unlock_irqrestore (&adapter->tmreg_lock, flags); + +memset (hwtstamps,0 ,sizeof (*hwtstamps)); + hwtstamps->hwtstamp =ns_to_ktime (ns); +}Signature · 1 line
1.7.2.5