aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-08-24ixgbe: stop resetting SYSTIME in ixgbe_ptp_start_cyclecounterJacob Keller1-13/+46
The ixgbe_ptp_start_cyclecounter is intended to be called whenever the cyclecounter parameters need to be changed. Since commit a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices"), this function has cleared the SYSTIME registers and reset the TSAUXC DISABLE_SYSTIME bit. While these need to be cleared during ixgbe_ptp_reset, it is wrong to clear them during ixgbe_ptp_start_cyclecounter. This function may be called during both reset and link status change. When link changes, the SYSTIME counter is still operating normally, but the cyclecounter should be updated to account for the possibly changed parameters. Clearing SYSTIME when link changes causes the timecounter to jump because the cycle counter now reads zero. Extract the SYSTIME initialization out to a new function and call this during ixgbe_ptp_reset. This prevents the timecounter adjustment and avoids an unnecessary reset of the current time. This also restores the original SYSTIME clearing that occurred during ixgbe_ptp_reset before the commit above. Reported-by: Steve Payne <spayne@aurora.tech> Reported-by: Ilya Evenbach <ievenbach@aurora.tech> Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices") Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2022-07-28ixgbe: convert .adjfreq to .adjfineJacob Keller1-33/+40
Convert the ixgbe PTP frequency adjustment implementations from .adjfreq to .adjfine. This allows using the scaled parts per million adjustment from the PTP core and results in a more precise adjustment for small corrections. To avoid overflow, use mul_u64_u64_div_u64 to perform the calculation. On X86 platforms, this will use instructions that perform the operations with 128bit intermediate values. For other architectures, the implementation will limit the loss of precision as much as possible. This change slightly improves the precision of frequency adjustments for all ixgbe based devices, and gets us one driver closer to being able to remove the older .adjfreq implementation from the kernel. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2022-06-30intel: remove unused macrosJesse Brandeburg1-1/+0
As found by the compile option -Wunused-macros, remove these macros that are never used by the code. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2021-12-14net_tstamp: add new flag HWTSTAMP_FLAG_BONDED_PHC_INDEXHangbin Liu1-4/+0
Since commit 94dd016ae538 ("bond: pass get_ts_info and SIOC[SG]HWTSTAMP ioctl to active device") the user could get bond active interface's PHC index directly. But when there is a failover, the bond active interface will change, thus the PHC index is also changed. This may break the user's program if they did not update the PHC timely. This patch adds a new hwtstamp_config flag HWTSTAMP_FLAG_BONDED_PHC_INDEX. When the user wants to get the bond active interface's PHC, they need to add this flag and be aware the PHC index may be changed. With the new flag. All flag checks in current drivers are removed. Only the checking in net_hwtstamp_validate() is kept. Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2021-03-23ixgbe: Fix fall-through warnings for ClangGustavo A. R. Silva1-0/+1
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple warnings by explicitly adding multiple break statements instead of just letting the code fall through to the next case. Link: https://github.com/KSPP/linux/issues/115 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-01ethernet/intel: Convert fallthrough code commentsJeff Kirsher1-2/+2
Convert all the remaining 'fall through" code comments to the newer 'fallthrough;' keyword. Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2019-06-28ixgbe: fix potential u32 overflow on shiftColin Ian King1-10/+4
The u32 variable rem is being shifted using u32 arithmetic however it is being passed to div_u64 that expects the expression to be a u64. The 32 bit shift may potentially overflow, so cast rem to a u64 before shifting to avoid this. Also remove comment about overflow. Addresses-Coverity: ("Unintentional integer overflow") Fixes: cd4583206990 ("ixgbe: implement support for SDP/PPS output on X550 hardware") Fixes: 68d9676fc04e ("ixgbe: fix PTP SDP pin setup on X540 hardware") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-06-05ixgbe: implement support for SDP/PPS output on X550 hardwareJacob Keller1-2/+97
Similar to the X540 hardware, enable support for generating a 1pps output signal on SDP0. This support is slightly different to the X540 hardware, because of the register layout changes. First, the system time register is now represented in 'cycles' and 'billions of cycles'. Second, we need to also program the TSSDP register, as well as the ESDP register. Third, the clock output uses only FREQOUT, instead of a full 64bit value for the output clock period. Finally, we have to use the ST0 bit instead of the SYNCLK bit in the TSAUXC register. This support should work even for the hardware with a higher frequency clock, as it carefully takes into account the multiply and shift of the cycle counter used. We also set the pps configuration to 1, since we now support generating a pulse per second output. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-06-05ixgbe: add a kernel documentation comment for ixgbe_ptp_get_ts_configJacob Keller1-0/+9
This function was missing a documentation comment. Add one now. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-06-05ixgbe: use 'cc' instead of 'hw_cc' for local variableJacob Keller1-3/+3
The ixgbe_ptp.c file sometimes uses hw_cc as the local variable for the cycle counter in ixgbe_ptp_read_X550. However, we use just 'cc' as a local variable for this by convention else where in the file. Convert this lone usage of 'hw_cc' into just the shorter 'cc' name to match the other read functions in the file. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-06-05ixgbe: fix PTP SDP pin setup on X540 hardwareJacob Keller1-29/+42
The function ixgbe_ptp_setup_sdp_X540 attempts to program a software defined pin, in order to generate a pulse-per-second output on SDP 0. It does work to generate the output, but does not align the output on the full second. Additionally, it does not take into account the cyclecounter multiplier. This leads to somewhat confusing code which is likely to be incorrect if blindly copied to another hardware type. Update this code to account for the cyclecounter multiplier, and to directly use timecounter_read. This change ensures that the SDP output will align properly on a full second, and makes the intent of the calculations a bit more clear. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-06-05ixgbe: reduce PTP Tx timestamp timeout to 1 secondJacob Keller1-1/+1
Previously we waited for a whole 15 seconds before we cleared the Tx timestamp state. This is astronomically long compared to the worst case timings expected by our devices. In addition, this is longer than the wait in ptp4l when it detects a fault (caused by missing Tx timestamps). Thus, reduce the timer to only 1 second, which is well after the maximum expected delay. This should reduce user frustration when a timestamp does get dropped for some reason. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-11-09ixgbe: extend PTP gettime function to read system clockMiroslav Lichvar1-10/+44
This adds support for the PTP_SYS_OFFSET_EXTENDED ioctl. Cc: Richard Cochran <richardcochran@gmail.com> Cc: Jacob Keller <jacob.e.keller@intel.com> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-04-27net: intel: Cleanup the copyright/license headersJeff Kirsher1-26/+2
After many years of having a ~30 line copyright and license header to our source files, we are finally able to reduce that to one line with the advent of the SPDX identifier. Also caught a few files missing the SPDX license identifier, so fixed them up. Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Acked-by: Shannon Nelson <shannon.nelson@oracle.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-01-12ixgbe: Fix kernel-doc format warningsTony Nguyen1-4/+4
Recent checks added for formatting kernel-doc comments are causing warnings if W= is run with a non-zero value. This patch fixes function comments to resolve warnings when W=1 is used. Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2017-10-25locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()Mark Rutland1-2/+2
Please do not apply this to mainline directly, instead please re-run the coccinelle script shown below and apply its output. For several reasons, it is desirable to use {READ,WRITE}_ONCE() in preference to ACCESS_ONCE(), and new code is expected to use one of the former. So far, there's been no reason to change most existing uses of ACCESS_ONCE(), as these aren't harmful, and changing them results in churn. However, for some features, the read/write distinction is critical to correct operation. To distinguish these cases, separate read/write accessors must be used. This patch migrates (most) remaining ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following coccinelle script: ---- // Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and // WRITE_ONCE() // $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch virtual patch @ depends on patch @ expression E1, E2; @@ - ACCESS_ONCE(E1) = E2 + WRITE_ONCE(E1, E2) @ depends on patch @ expression E; @@ - ACCESS_ONCE(E) + READ_ONCE(E) ---- Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: davem@davemloft.net Cc: linux-arch@vger.kernel.org Cc: mpe@ellerman.id.au Cc: shuah@kernel.org Cc: snitzer@redhat.com Cc: thor.thayer@linux.intel.com Cc: tj@kernel.org Cc: viro@zeniv.linux.org.uk Cc: will.deacon@arm.com Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-06-13ixgbe: check for Tx timestamp timeouts during watchdogJacob Keller1-0/+27
The ixgbe driver has logic to handle only one Tx timestamp at a time, using a state bit lock to avoid multiple requests at once. It may be possible, if incredibly unlikely, that a Tx timestamp event is requested but never completes. Since we use an interrupt scheme to determine when the Tx timestamp occurred we would never clear the state bit in this case. Add an ixgbe_ptp_tx_hang() function similar to the already existing ixgbe_ptp_rx_hang() function. This function runs in the watchdog routine and makes sure we eventually recover from this case instead of permanently disabling Tx timestamps. Note: there is no currently known way to cause this without hacking the driver code to force it. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2017-06-13ixgbe: fix race condition with PTP_TX_IN_PROGRESS bitsJacob Keller1-3/+12
Hardware related to the ixgbe driver is limited to handling a single Tx timestamp request at a time. Thus, the driver ignores requests for Tx timestamp while waiting for the current request to finish. It uses a state bit lock which enforces that only one timestamp request is honored at a time. Unfortunately this suffers from a simple race condition. The bit lock is not cleared until after skb_tstamp_tx() is called notifying applications of a new Tx timestamp. Even a well behaved application sending only one packet at a time and waiting for a response can wake up and send a new packet before the bit lock is cleared. This results in needlessly dropping some Tx timestamp requests. We can fix this by unlocking the state bit as soon as we read the Timestamp register, as this is the first point at which it is safe to unlock. To avoid issues with the skb pointer, we'll use a copy of the pointer and set the global variable in the driver structure to NULL first. This ensures that the next timestamp request does not modify our local copy of the skb pointer. This ensures that well behaved applications do not accidentally race with the unlock bit. Obviously an application which sends multiple Tx timestamp requests at once will still only timestamp one packet at a time. Unfortunately there is nothing we can do about this. Reported-by: David Mirabito <davidm@metamako.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2017-05-21net: ethernet: update drivers to handle HWTSTAMP_FILTER_NTP_ALLMiroslav Lichvar1-0/+1
Include HWTSTAMP_FILTER_NTP_ALL in net_hwtstamp_validate() as a valid filter and update drivers which can timestamp all packets, or which explicitly list unsupported filters instead of using a default case, to handle the filter. CC: Richard Cochran <richardcochran@gmail.com> CC: Willem de Bruijn <willemb@google.com> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-01-03ixgbe: Fix incorrect bitwise operations of PTP Rx timestamp flagsYusuke Suzuki1-6/+6
Rx timestamp does not work on 82599 and X540 because bitwise operation of RX_HWTSTAMP flags is incorrect and ixgbe_ptp_rx_hwtstamp() is never called. This patch fixes it to enable Rx timestamp on 82599 and X540. Without this fix: ptp4l[278.730]: selected /dev/ptp8 as PTP clock ptp4l[278.733]: port 1: INITIALIZING to LISTENING on INITIALIZE ptp4l[278.733]: port 0: INITIALIZING to LISTENING on INITIALIZE ptp4l[278.834]: port 1: received SYNC without timestamp ptp4l[278.835]: port 1: new foreign master 1c3947.fffe.60f9cc-1 ptp4l[279.834]: port 1: received SYNC without timestamp ptp4l[280.834]: port 1: received SYNC without timestamp ptp4l[281.834]: port 1: received SYNC without timestamp ptp4l[282.834]: port 1: received SYNC without timestamp ptp4l[282.835]: selected best master clock 1c3947.fffe.60f9cc ptp4l[282.835]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE ptp4l[283.834]: port 1: received SYNC without timestamp With this fix: ptp4l[239.154]: selected /dev/ptp8 as PTP clock ptp4l[239.157]: port 1: INITIALIZING to LISTENING on INITIALIZE ptp4l[239.157]: port 0: INITIALIZING to LISTENING on INITIALIZE ptp4l[240.989]: port 1: new foreign master 1c3947.fffe.60f9cc-1 ptp4l[244.989]: selected best master clock 1c3947.fffe.60f9cc ptp4l[244.989]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE ptp4l[246.977]: master offset -899583339542096 s0 freq +0 path delay 16222 ptp4l[247.977]: master offset -899583339617265 s1 freq -75169 path delay 16177 ptp4l[248.977]: master offset -130 s2 freq -75299 path delay 16177 ptp4l[248.977]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED ptp4l[249.977]: master offset -9 s2 freq -75217 path delay 16177 ptp4l[250.977]: master offset 88 s2 freq -75123 path delay 16132 Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices") Signed-off-by: Yusuke Suzuki <yus-suzuki@uf.jp.nec.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2016-12-25clocksource: Use a plain u64 instead of cycle_tThomas Gleixner1-2/+2
There is no point in having an extra type for extra confusion. u64 is unambiguous. Conversion was done with the following coccinelle script: @rem@ @@ -typedef u64 cycle_t; @fix@ typedef cycle_t; @@ -cycle_t +u64 Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: John Stultz <john.stultz@linaro.org>
2016-09-22ptp_clock: future-proofing drivers against PTP subsystem becoming optionalNicolas Pitre1-1/+1
Drivers must be ready to accept NULL from ptp_clock_register() if the PTP clock subsystem is configured out. This patch documents that and ensures that all drivers cope well with a NULL return. Signed-off-by: Nicolas Pitre <nico@linaro.org> Reviewed-by: Eugenia Emantayev <eugenia@mellanox.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-04-25ixgbe: use BIT() macroJacob Keller1-2/+2
Several areas of ixgbe were written before widespread usage of the BIT(n) macro. With the impending release of GCC 6 and its associated new warnings, some usages such as (1 << 31) have been noted within the ixgbe driver source. Fix these wholesale and prevent future issues by simply using BIT macro instead of hand coded bit shifts. Also fix a few shifts that are shifting values into place by using the 'u' prefix to indicate unsigned. It doesn't strictly matter in these cases because we're not shifting by too large a value, but these are all unsigned values and should be indicated as such. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2016-04-07ixgbe: Add support for x550em_a 10G MAC typeMark Rustad1-1/+5
Add support for x550em_a 10G MAC type to the ixgbe driver. The new MAC includes new firmware commands that need to be used to control PHY and IOSF access, so that support is also added. The interface supported is a native SFP+ interface. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-12-03ixgbe: Update PTP to support X550EM_x devicesMark Rustad1-189/+531
The X550EM_x devices handle clocking differently, so update the PTP implementation to accommodate them. This involves significant changes to ixgbe's PTP code to accommodate the new range of behaviors including things like non-power-of-2 clock wrapping. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Tested-by: Darin Miller <darin.j.miller@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2015-03-31ptp: ixgbe: use helpers for converting ns to timespec.Richard Cochran1-5/+2
This patch changes the driver to use ns_to_timespec64() and timespec64_to_ns() instead of open coding the same logic. Compile tested only. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-03-31ptp: ixgbe: convert to the 64 bit get/set time methods.Richard Cochran1-7/+7
This driver's clock is implemented using a timecounter, and so with this patch the driver is ready for the year 2038. Compile tested only. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
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 <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-02ixgbe: convert to CYCLECOUNTER_MASK macro.Richard Cochran1-1/+1
Signed-off-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-12-30net: ixgbe: convert to timecounter adjtime.Richard Cochran1-10/+1
This patch changes the driver to use the new and improved method for adjusting the offset of a timecounter. Compile tested only. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-01ixgbe: change PTP NSECS_PER_SEC to IXGBE_PTP_PPS_HALF_SECONDJacob Keller1-7/+9
The PPS signal is not correct, as it generates a one half HZ clock signal, as it only generates one level change per second. To generate a full clock, we need two level changes per second. Also, change the name of the #define, in order to prevent confusion between it and NSEC_PER_SEC which is not guaranteed to be a 64bit value. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-06-03ixgbe: remove linux/export.h header from ixgbe_ptp.cJacob Keller1-1/+0
We don't need this header file, so we shouldn't be including it. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-05-26ixgbe: separate the PTP suspend and stop actionsJacob Keller1-7/+24
Since we are adding proper support for suspend of PTP, extract out of ixgbe_ptp_stop those things relevant to suspend. Then, have ixgbe_ptp_stop call ixgbe_ptp_suspend. The next patch in the series will have ixgbe_ptp_suspend called from the ixgbe_suspend path. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-05-26ixgbe: extract PTP clock device from ptp_initJacob Keller1-9/+47
In order to properly handle a suspend/resume cycle, we cannot destroy the PTP clock device. As part of this, we should only re-create the device on first initialization. After a resume, when ixgbe_ptp_init is called, we won't create a new clock, and we will use the old clock device. To that end, this patch extracts the clock creation out of ptp_init, and only calls it if we don't already have a ptp_clock pointer. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-05-26ixgbe: allow ixgbe_ptp_reset to maintain current hwtstamp configJacob Keller1-5/+11
Rather than clearing the hwtstamp configuration, we should use the known configuration requested by the user and call the function which has now been separated from the ioctl. This means that after a reset, the timestamp mode will be maintained rather than lost. We still can't maintain the clock value, however. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-05-26ixgbe: extract the hardware setup from the ixgbe_ptp_set_ts_configJacob Keller1-14/+36
Currently all of the hardware setup logic for the PTP hardware bits is buried inside of the ioctl which sets the timestamp configuration. This makes it hard to use this logic in other places (primarily reset), and this means we can't restore current timestamp mode upon a MAC reset. Extracting this logic into a separate function will enable future work for the ixgbe_ptp_reset function. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-05-26ixgbe: rename ixgbe_ptp_enable to ixgbe_ptp_feature_enableJacob Keller1-5/+5
Since the name ixgbe_ptp_enable could be misconstrued as a function which enables the whole PTP core, rename this function so that it is clear the function is for enabling of the extra features such as PPS signal. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
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 <joe@perches.com> Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-04-18ixgbe: clean up Rx time stamping codeJakub Kicinski1-25/+11
Time stamping resources are per-interface so there is no need to keep separate last_rx_timestamp for each Rx ring, move last_rx_timestamp to the adapter structure. With last_rx_timestamp inside adapter, ixgbe_ptp_rx_hwtstamp() inline function is reduced to a single if statement so it is no longer necessary. If statement is placed directly in ixgbe_process_skb_fields() fixing likely/unlikely marking. Checks for q_vector or adapter to be NULL are superfluous. Comment about taking I/O hit is a leftover from previous design. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-03-31ixgbe: fix race conditions on queuing skb for HW time stampJakub Kicinski1-0/+3
ixgbe 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 <kubakici@wp.pl> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-03-31ixgbe: remove redundant if clause from PTP workJakub Kicinski1-4/+0
ptp_tx_skb is always set before work is scheduled, work is cancelled before ptp_tx_skb is set to NULL. PTP work cannot ever see ptp_tx_skb set to NULL. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-03-12ixgbe: add Linux NICS mailing list to contact infoJacob Keller1-0/+1
This patch updates the contact information on the ixgbe driver files so that every file includes the Linux NICS address, as it is still used, but only a few of the files mentioned it. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2014-03-02ixgbe: implement SIOCGHWTSTAMP ioctlJacob Keller1-5/+18
This patch adds support for the new SIOCGHWTSTAMP ioctl, which enables a process to determine the current timestamp configuration. In order to implement this, store a copy of the timestamp configuration. In addition, we can remove the 'int cmd' parameter as the new set_ts_config function doesn't use it. I also fixed a typo in the function description. -v2 * Only save the settings after validating them Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-02-26ixgbe: don't use magic size number to assign ptp_caps.nameJacob Keller1-2/+6
Rather than using a magic size number, just use sizeof since that will work and is more robust to future changes. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-07-31ixgbe: fix lockdep annotation issue for ptp's work itemJacob Keller1-5/+7
This patch fixes a lockdep issue created due to ixgbe_ptp_stop always running cancel_work_sync even if the work item had not been created properly with INIT_WORK. This is caused because ixgbe_ptp_stop did not check to actually ensure PTP was running first. The new implementation introduces a state in the &adapter->state field which is used to indicate that PTP is running. (This replaces the IXGBE_FLAG2_PTP_ENABLED field). This state will use the atomic set_bit, test_bit, and test_and_clear_bit functions. ixgbe_ptp_stop will check to ensure that PTP was enabled, (and if not, it will not attempt to do any cleanup work from ixgbe_ptp_init). This resolves the lockdep annotation warning found by Stephen Hemminger Reported-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Acked-by: Don Skidmore <donald.c.skidmore@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-02-05ixgbe: update date to 2013Don Skidmore1-1/+1
Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-23ixgbe: Inline Rx PTP descriptor handlingAlexander Duyck1-16/+5
This change is meant to inline the Rx PTP descriptor handling. The main motivation is to avoid unnecessary jumps into function calls that we then immediately exit because we are not performing timestamps. The net result of this change is that ixgbe_ptp_rx_tstamp drops from .5% CPU utilization in my performance runs to 0%, and the only value tested is the Rx descriptor which should already be warm in the cache if not stored in a register. Cc: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Acked-by: Jacob Keller <Jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-23ixgbe: Fix overwriting of rx_mtrl in ixgbe_ptp_hwtstamp_ioctlJacob Keller1-2/+2
This patch corrects a bug introduced by commit f3444d8b. The rxmtrl value for the UDP port to timestamp on was moved above the switch statement, but was overwritten to 0 if the ioctl selected one of the V1 filters. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-23ixgbe: Add ptp work item to poll for the Tx timestampJacob Keller1-26/+52
This patch copies the igb implementation of Tx timestamps, which uses a work item to poll for the Tx timestamp. In addition it adds a timeout value of 15 seconds, after which it will stop polling. This is necessary due to an issue with the descriptor being marked done before the Tx timestamp event has occurred. These two events don't correlate, so using the done bit on the descriptor as indication that the timestamp must already have been taken leads to potentially dropped Tx timestamps (especially under heavy packet load) Reported-by: Matthew Vick <matthew.vick@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2013-01-23ixgbe: Use watchdog check in favor of BPF for detecting latched timestampJacob Keller1-84/+42
This patch removes ixgbe_ptp_match, and the corresponding packet filtering from ixgbe driver. This code was previously causing some issues within the hotpath of the driver. However the code also provided a check against possible frozen Rx timestamp due to dropped packets when the Rx ring is full. This patch provides a replacement solution based on the watchdog. To this end, whenever a packet consumes the Rx timestamp it stores the jiffy value in the rx_ring structure. Watchdog updates its own jiffy timer whenever there is no valid timestamp in the registers. If 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 5seconds ago, it will flush the Rx timestamp and print a warning message to the syslog. Reported-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>