aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/igb/igb_ptp.c
AgeCommit message (Collapse)AuthorFilesLines
2015-03-31Merge branch 'ptp-2038'David S. Miller1-20/+22
Fixed two warnings in e1000e and igb, when switching to timespec64 some printf formats started to not match. In theses cases actually the new type is __kernel_time_t which is __kernel_long_t which unfortunately can be either "long" or "long long". So to solve this I cases the arguments to "long long". -DaveM Richard Cochran says: ==================== ptp: get ready for 2038 This series converts the core driver methods of the PTP Hardware Clock (PHC) subsystem to use the 64 bit version of the timespec structure, making the core API ready for the year 2038. In addition, I reviewed how each driver and device represents the time value at the hardware register level. Most of the drivers are ready, but a few will need some work before the year 2038, as shown: Patch Driver ------------------------------------------------ 12 drivers/net/ethernet/intel/igb/igb_ptp.c 15 ? drivers/net/ethernet/sfc/ptp.c 16 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c The commit log messages document how each driver is ready or why it is not ready. For patch 15, I could not easily find out the hardware representation of the time value, and so the SFC maintainers will have to review their low level code in order to resolve any remaining issues. * ChangeLog ** V3 - dp83640: use timespec64 throughout per Arnd's suggestion - tilegx: use timespec64 throughout per Chris' suggestion - add Jeff's acked-bys ** V2 - use the new methods in the posix clock code right away (patch #3) ==================== Signed-off-by: David S. Miller <[email protected]>
2015-03-31ptp: igb: convert to the 64 bit get/set time methods.Richard Cochran1-20/+21
For the 82576, the driver's clock is implemented using a timecounter, and so with this patch that device is ready for the year 2038. However, in the case of the i210, the device stores the number of seconds in a 32 bit register. Therefore, more work is needed on this driver before the year 2038 comes around. Compile tested only. Signed-off-by: Richard Cochran <[email protected]> Acked-by: Jeff Kirsher <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-08ethernet: codespell comment spelling fixesJoe Perches1-1/+1
To test a checkpatch spelling patch, I ran codespell against drivers/net/ethernet/. $ git ls-files drivers/net/ethernet/ | \ while read file ; do \ codespell -w $file; \ done I removed a false positive in e1000_hw.h Signed-off-by: Joe Perches <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-03-06igb: Make arrays on stack static const to avoid reallocationAlexander Duyck1-12/+12
While addressing the pin problem I noticed that all of the pin register values where having to be pushed onto the stack each time the function was called. To avoid that I am making them static const so that they should only need to be allocated once and we can avoid all the instructions to get them onto the stack.. size before: text data bss dec hex filename 161477 10512 8 171997 29fdd drivers/net/ethernet/intel/igb/igb.ko size after: text data bss dec hex filename 161205 10512 8 171725 29ecd drivers/net/ethernet/intel/igb/igb.ko Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-03-06igb: Fix warning pin may be used uninitializedAlexander Duyck1-1/+1
When building the kernel using the gcc 4.8.3 compiler included in Fedora 20 I was repeatedly seeing the warning: drivers/net/ethernet/intel/igb/igb_ptp.c: In function ‘igb_ptp_feature_enable_i210’: drivers/net/ethernet/intel/igb/igb_ptp.c:395:21: warning: ‘pin’ may be used uninitialized in this function [-Wmaybe-uninitialized] tssdp &= ~ts_sdp_en[pin]; ^ drivers/net/ethernet/intel/igb/igb_ptp.c:471:6: note: ‘pin’ was declared here int pin; ^ To resolve it I am assigning the pin a value of -1 when it is instantiated. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-01-22igb: enable auxiliary PHC functions for the i210Richard Cochran1-5/+217
The i210 device offers a number of special PTP Hardware Clock features on the Software Defined Pins (SDPs). This patch adds support for two of the possible functions, namely time stamping external events, and periodic output signals. The assignment of PHC functions to the four SDP can be freely chosen by the user. Signed-off-by: Richard Cochran <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-01-22igb: enable internal PPS for the i210Richard Cochran1-2/+30
The i210 device can produce an interrupt on the full second. This patch allows using this interrupt to generate an internal PPS event for adjusting the kernel system time. Signed-off-by: Richard Cochran <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-01-22igb: serialize access to the time sync interrupt registersRichard Cochran1-3/+7
The time sync related interrupt registers may be manipulated from different contexts. This patch protects the registers from being asynchronously changed by the reset function. Also, the patch removes a misleading comment. The reset function is disabling a bunch of functions, not enabling them. Signed-off-by: Richard Cochran <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-01-02igb: convert to CYCLECOUNTER_MASK macro.Richard Cochran1-3/+2
Signed-off-by: Richard Cochran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-12-31igb_ptp: Include clocksource.h to get CLOCKSOURCE_MASK.David S. Miller1-0/+1
Signed-off-by: David S. Miller <[email protected]>
2014-12-30net: igb: convert to timecounter adjtime.Richard Cochran1-6/+1
This patch changes the driver to use the new and improved method for adjusting the offset of a timecounter. Signed-off-by: Richard Cochran <[email protected]> Acked-by: Jeff Kirsher <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-06-11igb: separate hardware setting from the set_ts_config ioctlJacob Keller1-12/+38
This patch separates the hardware logic from the set function, so that we can re-use it during a ptp_reset. This enables the reset to return functionality to the last known timestamp mode, rather than resetting the value. We initialize the mode to off during the ptp_init cycle. Signed-off-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-06-03igb: rename igb_ptp_enable to igb_ptp_feature_enableJacob Keller1-5/+5
The name igb_ptp_enable is not synonymous with the purpose of this function, so rename it to better explain its purpose. Signed-off-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-04-18e1000e/igb/ixgbe/i40e: fix message terminationsJakub Kicinski1-2/+2
Add \n at the end of messages where missing, remove all \r. Reported-by: Joe Perches <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Tested-by: Aaron Brown <[email protected]> Tested-by: Phil Schmitt <[email protected]> Tested-by: Kavindya Deegala <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-04-11igb: fix last_rx_timestamp usageJakub Kicinski1-7/+7
last_rx_timestamp should be updated only when rx time stamp is read. Also it's only used with NICs that have per-interface time stamping resources so it can be moved to adapter structure and set in igb_ptp_rx_rgtstamp(). Signed-off-by: Jakub Kicinski <[email protected]> Acked-by: Matthew Vick <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-03-28igb: fix race conditions on queuing skb for HW time stampJakub Kicinski1-0/+3
igb has a single set of TX time stamping resources per NIC. Use a simple bit lock to avoid race conditions and leaking skbs when multiple TX rings try to claim time stamping. Signed-off-by: Jakub Kicinski <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-03-21igb: implement SIOCGHWTSTAMP ioctlJacob Keller1-14/+32
This patch adds support for the SIOCGHWTSTAMP ioctl which enables user processes to read the current hwtstamp_config settings non-destructively. Previously a process had to be privileged and could only set values, it couldn't return what is currently set without possibly overwriting the value. This patch adds support for this new operation into igb by keeping a shadow copy of the config in the adapter structure, which is returned upon request. Signed-off-by: Jacob Keller <[email protected]> Acked-by: Matthew Vick <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-03-19igb: Add register defines needed for time sync functionsCarolyn Wyborny1-2/+2
This patch adds defines needed for implementing the auxiliary time sync functions and also changes code to call the updated defines instead of the old. Reported-by: Richard Cochran <[email protected]> Signed-off-by: Carolyn Wyborny <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2014-02-26igb: Update license text to remove FSF address and update copyright.Carolyn Wyborny1-3/+2
This patch updates the license text to remove address of Free Software Foundation and refer users to www.gnu.org instead. This patch also updates the copyright dates in appropriate igb driver files. Signed-off-by: Carolyn Wyborny <[email protected]> Signed-off-by: Aaron Brown <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2014-02-26igb: make local functions static and remove dead codeJeff Kirsher1-2/+4
Based on Stephen Hemminger's original patch. Make local functions static, and remove unused functions. Reported-by: Stephen Hemminger <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Aaron Brown <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2013-08-22igb: Read register for latch_on without return valueAkeem G Abodunrin1-4/+4
This patch changes register read to "just-read" without returning a value for hardware to accurately latch the register value. Signed-off-by: Akeem G Abodunrin <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2013-04-18igb: Add support for i354 devicesCarolyn Wyborny1-0/+4
This patch adds base support for new i354 devices. Loopback test is unsupported for this release. Signed-off-by: Carolyn Wyborny <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2013-04-18igb: Fix code comments and whitespaceJeff Kirsher1-39/+18
Aligns the multi-line code comments with the desired style for the networking tree. Also cleaned up whitespace issues found during the cleanup of code comments (i.e. remove unnecessary blank lines, use tabs where possible, properly wrap lines and keep strings on a single line) Signed-off-by: Jeff Kirsher <[email protected]> Tested-by: Aaron Brown <[email protected]>
2013-03-26igb: fix PHC stopping on max freqJiri Benc1-1/+1
For 82576 MAC type, max_adj is reported as 1000000000 ppb. However, if this value is passed to igb_ptp_adjfreq_82576, incvalue overflows out of INCVALUE_82576_MASK, resulting in setting of zero TIMINCA.incvalue, stopping the PHC (instead of going at twice the nominal speed). Fix the advertised max_adj value to the largest value hardware can handle. As there is no min_adj value available (-max_adj is used instead), this will also prevent stopping the clock intentionally. It's probably not a big deal, other igb MAC types don't support stopping the clock, either. Signed-off-by: Jiri Benc <[email protected]> Acked-by: Matthew Vick <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2013-01-18igb: Use in-kernel PTP_EV_PORT #defineMatthew Vick1-3/+3
Rather than use an extra #define for something that already exists, use the kernel #define for the PTP port. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Acked-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2013-01-18igb: Free any held skb that should have been timestamped on removeMatthew Vick1-0/+4
To prevent a race condition where an skb has been saved to return the Tx timestamp later and the driver is removed, add a check to determine if we have an skb stored and, if so, free it. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Acked-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2013-01-18igb: Add mechanism for detecting latched hardware Rx timestampMatthew Vick1-0/+45
Add a check against possible Rx timestamp freezing in the hardware via watchdog mechanism. This situation can occur when an Rx timestamp has been latched, but the packet has been dropped because the Rx ring is full. Whenever a packet comes in that should be timestamped, the Rx timestamp gets latched into the hardware registers and we will store the jiffy value in the rx_ring. The watchdog will keep track of his own jiffy timer whenever there is no valid timestamp in the registers. If the watchdog detects a valid timestamp in the registers, meaning that no Rx packet has consumed it yet, it will check which time is most recent: the last time in the watchdog or any time in the rx_rings. If the most recent "event" was more than 5 seconds ago, it will flush the Rx timestamp and print a warning message to the syslog. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Acked-by: Richard Cochran <[email protected]> Acked-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2013-01-18igb: Add timeout for PTP Tx work itemMatthew Vick1-0/+10
When transmitting a packet that must return a Tx timestamp, a work item gets scheduled to poll for the Tx timestamp being completed in hardware. Add a timeout on this work item of 15 seconds from when the driver gets the skb, after which it will stop polling. Report via stats and system log if this occurs. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Acked-by: Jacob Keller <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-11-22igb: Update PTP Rx filtersMatthew Vick1-27/+20
Update the filters to be more consistent with what the driver wants to do. For example, for devices that timestamp all packets, report that the filter is set for timestamping all packets. Signed-off-by: Matthew Vick <[email protected]> Acked-by: Richard Cochran <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-10-29igb: Fix sparse warning in igb_ptp_rx_pktstampAlexander Duyck1-1/+1
This change fixes a sparse warning triggered by us casting the timestamp in the packet as a u64 instead of as a __le64. This change corrects that in order to resolve the sparse warning. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-10-19igb: Split Rx timestamping into two separate functionsAlexander Duyck1-17/+38
In order to support page based receive we will need to split up the two different types of timestamping into two separate functions. The first one will handle legacy timestamps with the value in the register, and the new one will handle timestamps in the Rx buffer itself. Signed-off-by: Alexander Duyck <[email protected]> Acked-by: Matthew Vick <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-09-22ptp: link the phc device to its parent deviceRichard Cochran1-1/+2
PTP Hardware Clock devices appear as class devices in sysfs. This patch changes the registration API to use the parent device, clarifying the clock's relationship to the underlying device. Signed-off-by: Richard Cochran <[email protected]> Acked-by: Ben Hutchings <[email protected]> Acked-by: Jeff Kirsher <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2012-09-17igb: Add 1588 support to I210/I211.Matthew Vick1-45/+171
Previously I210/I211 followed the same code flow as 82580/I350 for 1588. However, since the register sets have changed, we must update the implementation to accommodate the register changes. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Acked-by: Jacob Keller <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-09-17igb: Prevent dropped Tx timestamps via work items and interrupts.Matthew Vick1-16/+86
In rare circumstances, it's possible a descriptor writeback will occur before a timestamped Tx packet will go out on the wire, leading to the driver believing the hardware failed to timestamp the packet. Schedule a work item for 82576 and use the available time sync interrupt registers on 82580 and above to account for this. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-09-17igb: Store the MAC address in the name in the PTP struct.Matthew Vick1-4/+3
Change the name of the adapter in the PTP struct to enable easier correlation between interface and PTP device. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Acked-by: Jacob Keller <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-09-17igb: Update PTP function names/variables and locations.Matthew Vick1-118/+367
Where possible, move PTP-related functions into igb_ptp.c and update the names of functions and variables to match the established coding style in the files and specify that they are PTP-specific. Cc: Richard Cochran <[email protected]> Signed-off-by: Matthew Vick <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-06-20igb: Add switch case for supported hardware to igb_ptp_remove.Carolyn Wyborny1-1/+11
PTP initialization is only done on supported parts, so remove needs same checks or it will cause crashes on systems with igb devices that don't support PTP. This patch adds those checks to the exit function. Signed-off-by: Carolyn Wyborny <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-05-12igb: Add Support for new i210/i211 devices.Carolyn Wyborny1-0/+4
This patch adds new initialization functions and device support for i210 and i211 devices. Signed-off-by: Carolyn Wyborny <[email protected]> Tested-by: Jeff Pieper <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-04-04igb: offer a PTP Hardware Clock instead of the timecompare methodRichard Cochran1-0/+59
This commit removes the legacy timecompare code from the igb driver and offers a tunable PHC instead. Signed-off-by: Richard Cochran <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2012-04-04igb: add PTP Hardware Clock codeRichard Cochran1-0/+322
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. Every timestamp and clock read operation must consult the overflow counter to form a correct time value. Access to the counter is protected by a spin lock, and the counter is implemented using the standard cyclecounter/timecounter code. Signed-off-by: Richard Cochran <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>