10GbE Intel Wired LAN Driver Updates 2019-06-05
Subsystems (5)
This series contains updates to mainly ixgbe, with a few updates to i40e, net, ice and hns2 driver.
Jan adds support for tracking each queue pair for whether or not AF_XDP zero copy is enabled. Also updated the ixgbe driver to use the netdev-provided umems so that we do not need to contain these structures in our own adapter structure.
William Tu provides two fixes for AF_XDP statistics which were causing incorrect counts.
Jake reduces the PTP transmit timestamp timeout from 15 seconds to 1 second, which is still well after the maximum expected delay. Also fixes an issues with the PTP SDP pin setup which was not properly aligning on a full second, so updated the code to account for the cyclecounter multiplier and simplify the code to make the intent of the calculations more clear. Updated the function header comments to help with the code documentation. Added support for SDP/PPS output for x550 devices, which is slightly different than x540 devices that currently have this support.
Anirudh adds a new define for Link Layer Discovery Protocol to the networking core, so that drivers do not have to create and use their own definitions. In addition, update all the drivers currently defining their own LLDP define to use the new networking core define.
The following are changes since commit 11694b03616b2a03cd7e3f0897d4d086c7fbc4b5:
net: fec_ptp: Use dev_err() instead of pr_err()
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 10GbE
Anirudh Venkataramanan (4):
net: Add a define for LLDP ethertype
i40e: Use LLDP ethertype define ETH_P_LLDP
ixgbe: Use LLDP ethertype define ETH_P_LLDP
net: hns3: Use LLDP ethertype define ETH_P_LLDP
Jacob Keller (5):
ixgbe: reduce PTP Tx timestamp timeout to 1 second
ixgbe: fix PTP SDP pin setup on X540 hardware
ixgbe: use 'cc' instead of 'hw_cc' for local variable
ixgbe: add a kernel documentation comment for ixgbe_ptp_get_ts_config
ixgbe: implement support for SDP/PPS output on X550 hardware
Jan Sokolowski (2):
ixgbe: add tracking of AF_XDP zero-copy state for each queue pair
ixgbe: remove umem from adapter
Jeff Kirsher (1):
ice: Use LLDP ethertype define ETH_P_LLDP
Kangjie Lu (1):
net: ixgbevf: fix a missing check of ixgbevf_write_msg_read_ack
William Tu (2):
ixgbe: fix AF_XDP tx byte count
ixgbe: fix AF_XDP tx packet count
.../hisilicon/hns3/hns3pf/hclge_cmd.h | 1 - .../hisilicon/hns3/hns3pf/hclge_main.c | 2 +- drivers/net/ethernet/intel/i40e/i40e.h | 2 - .../net/ethernet/intel/i40e/i40e_debugfs.c | 4 +- drivers/net/ethernet/intel/ice/ice_lib.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 14 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 + drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 187 ++++++++++++++---- .../net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 14 +- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 82 ++------ drivers/net/ethernet/intel/ixgbevf/vf.c | 5 +- include/uapi/linux/if_ether.h | 1 + 13 files changed, 200 insertions(+), 124 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/15 ixgbe: add tracking of AF_XDP zero-copy state for each queue pair
From: Jan Sokolowski <[email protected]>
Here, we add a bitmap to the ixgbe_adapter that tracks if a certain queue pair has been "zero-copy enabled" via the ndo_bpf. The bitmap is used in ixgbe_xsk_umem, and enables zero-copy if and only if XDP is enabled, the corresponding qid in the bitmap is set, and the umem is non-NULL;
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 1 + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 ++++++ drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1 -0
@@ -635,6 +635,7 @@ struct ixgbe_adapter {/* XDP */ int num_xdp_queues;struct ixgbe_ring *xdp_ring[MAX_XDP_QUEUES ]; +unsigned long *af_xdp_zc_qps;/* tracks AF_XDP ZC enabled rings */ /* TX */ struct ixgbe_ring *tx_ring[MAX_TX_QUEUES ]____cacheline_aligned_in_smp ;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -0
@@ -6288,6 +6288,10 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,if (ixgbe_init_rss_key (adapter))return -ENOMEM ; + adapter->af_xdp_zc_qps =bitmap_zalloc (MAX_XDP_QUEUES ,GFP_KERNEL ); +if (!adapter->af_xdp_zc_qps) +return -ENOMEM ; +/* Set MAC specific capability flags and exceptions */ switch (hw->mac.type) {case ixgbe_mac_82598EB:
@@ -11161,6 +11165,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)kfree (adapter->jump_tables[0 ]);kfree (adapter->mac_table);kfree (adapter->rss_key); +bitmap_free (adapter->af_xdp_zc_qps); err_ioremap: disable_dev = !test_and_set_bit (__IXGBE_DISABLED, &adapter->state);free_netdev (netdev);
@@ -11249,6 +11254,7 @@ static void ixgbe_remove(struct pci_dev *pdev)kfree (adapter->mac_table);kfree (adapter->rss_key); +bitmap_free (adapter->af_xdp_zc_qps); disable_dev = !test_and_set_bit (__IXGBE_DISABLED, &adapter->state);free_netdev (netdev);
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +4 -1
@@ -15,7 +15,8 @@ struct xdp_umem *ixgbe_xsk_umem(struct ixgbe_adapter *adapter,int qid = ring->ring_idx;if (!adapter->xsk_umems || !adapter->xsk_umems[qid] || - qid >= adapter->num_xsk_umems || !xdp_on) + qid >= adapter->num_xsk_umems || !xdp_on || + !test_bit (qid, adapter->af_xdp_zc_qps))return NULL ;return adapter->xsk_umems[qid];
@@ -143,6 +144,7 @@ static int ixgbe_xsk_umem_enable(struct ixgbe_adapter *adapter,if (if_running)ixgbe_txrx_ring_disable (adapter, qid); +set_bit (qid, adapter->af_xdp_zc_qps); err =ixgbe_add_xsk_umem (adapter, umem, qid);if (err)return err;
@@ -173,6 +175,7 @@ static int ixgbe_xsk_umem_disable(struct ixgbe_adapter *adapter, u16 qid)if (if_running)ixgbe_txrx_ring_disable (adapter, qid); +clear_bit (qid, adapter->af_xdp_zc_qps);ixgbe_xsk_umem_dma_unmap (adapter, adapter->xsk_umems[qid]);ixgbe_remove_xsk_umem (adapter, qid);
Signature · 1 line
2.21.0
PATCH 2/15 ixgbe: remove umem from adapter
In reply to Jeff KirsherFrom: Jan Sokolowski <[email protected]>
As current implementation of netdev already contains and provides umems for us, we no longer have the need to contain these structures in ixgbe_adapter.
Refactor the code to operate on netdev-provided umems.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 11 +-- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 79 ++++---------------- 2 files changed, 19 insertions(+), 71 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +6 -5
@@ -775,11 +775,6 @@ struct ixgbe_adapter {#ifdef CONFIG_IXGBE_IPSEC struct ixgbe_ipsec *ipsec;#endif /* CONFIG_IXGBE_IPSEC */ - -/* AF_XDP zero-copy */ -struct xdp_umem **xsk_umems; -u16 num_xsk_umems_used; -u16 num_xsk_umems; };static inline u8 ixgbe_max_rss_indices (struct ixgbe_adapter *adapter)
@@ -1040,4 +1035,10 @@ static inline int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter,static inline int ixgbe_ipsec_vf_del_sa (struct ixgbe_adapter *adapter,u32 *mbuf,u32 vf) {return -EACCES ; }#endif /* CONFIG_IXGBE_IPSEC */ + +static inline bool ixgbe_enabled_xdp_adapter (struct ixgbe_adapter *adapter) +{ +return !!adapter->xdp_prog; +} +#endif /* _IXGBE_H_ */
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +13 -66
132 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 3/15 ixgbe: fix AF_XDP tx byte count
In reply to Jeff KirsherFrom: William Tu <[email protected]>
The tx bytecount is done twice. When running './xdpsock -t -N -i eth3' and 'ip -s link show dev eth3' The avg packet size is 120 instead of 60. So remove the extra one.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +0 -1
@@ -654,7 +654,6 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector, xsk_frames++; tx_bi->xdpf =NULL ; - total_bytes += tx_bi->bytecount; tx_bi++; tx_desc++;
Signature · 1 line
2.21.0
PATCH 4/15 ixgbe: fix AF_XDP tx packet count
In reply to Jeff KirsherFrom: William Tu <[email protected]>
The total_packets count at ixgbe_clean_xdp_tx_irq is always zero when testing with xdpsock -t -N. Set the gso_segs to 1 to make the tx packet count correct.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +1 -0
@@ -590,6 +590,7 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget) tx_bi = &xdp_ring->tx_buffer_info[xdp_ring->next_to_use]; tx_bi->bytecount = len; tx_bi->xdpf =NULL ; + tx_bi->gso_segs =1 ; tx_desc =IXGBE_TX_DESC (xdp_ring, xdp_ring->next_to_use); tx_desc->read.buffer_addr =cpu_to_le64 (dma);
Signature · 1 line
2.21.0
PATCH 5/15 ixgbe: reduce PTP Tx timestamp timeout to 1 second
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
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.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +1 -1
@@ -72,7 +72,7 @@#define IXGBE_INCPER_SHIFT_82599 24#define IXGBE_OVERFLOW_PERIOD (HZ * 30) -#define IXGBE_PTP_TX_TIMEOUT (HZ * 15) +#define IXGBE_PTP_TX_TIMEOUT (HZ)/* half of a one second clock period, for use with PPS signal. We have to use * this instead of something pre-defined like IXGBE_PTP_PPS_HALF_SECOND, in
Signature · 1 line
2.21.0
PATCH 6/15 ixgbe: fix PTP SDP pin setup on X540 hardware
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
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.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 71 ++++++++++++-------- 1 file changed, 42 insertions(+), 29 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +42 -29
@@ -74,11 +74,11 @@#define IXGBE_OVERFLOW_PERIOD (HZ * 30)#define IXGBE_PTP_TX_TIMEOUT (HZ) -/* half of a one second clock period, for use with PPS signal. We have to use -* this instead of something pre-defined like IXGBE_PTP_PPS_HALF_SECOND, in -* order to force at least 64bits of precision for shifting +/* We use our own definitions instead of NSEC_PER_SEC because we want to mark +* the value as a ULL to force precision when bit shifting. */ -#define IXGBE_PTP_PPS_HALF_SECOND 500000000ULL +#define NS_PER_SEC 1000000000ULL +#define NS_PER_HALF_SEC 500000000ULL/* In contrast, the X550 controller has two registers, SYSTIMEH and SYSTIMEL * which contain measurements of seconds and nanoseconds respectively. This
@@ -141,23 +141,26 @@#define MAX_TIMADJ 0x7FFFFFFF/** -* ixgbe_ptp_setup_sdp_x540 +* ixgbe_ptp_setup_sdp_X540 * @adapter: private adapter structure * * this function enables or disables the clock out feature on SDP0 for -* the X540 device. It will create a 1second periodic output that can +* the X540 device. It will create a 1 second periodic output that can * be used as the PPS (via an interrupt). * -* It calculates when the systime will be on an exact second, and then -* aligns the start of the PPS signal to that value. The shift is -* necessary because it can change based on the link speed. +* It calculates when the system time will be on an exact second, and then +* aligns the start of the PPS signal to that value. +* +* This works by using the cycle counter shift and mult values in reverse, and +* assumes that the values we're shifting will not overflow. */ -static void ixgbe_ptp_setup_sdp_x540 (struct ixgbe_adapter *adapter) +static void ixgbe_ptp_setup_sdp_X540 (struct ixgbe_adapter *adapter) { +struct cyclecounter *cc = &adapter->hw_cc;struct ixgbe_hw *hw = &adapter->hw; -int shift = adapter->hw_cc.shift;u32 esdp, tsauxc, clktiml, clktimh, trgttiml, trgttimh, rem; -u64 ns =0 , clock_edge =0 ; +u64 ns =0 , clock_edge =0 , clock_period; +unsigned long flags;/* disable the pin first */ IXGBE_WRITE_REG (hw,IXGBE_TSAUXC ,0x0 );
@@ -177,26 +180,36 @@ static void ixgbe_ptp_setup_sdp_x540(struct ixgbe_adapter *adapter)/* enable the Clock Out feature on SDP0, and allow * interrupts to occur when the pin changes */ - tsauxc =IXGBE_TSAUXC_EN_CLK | -IXGBE_TSAUXC_SYNCLK | -IXGBE_TSAUXC_SDP0_INT ; - -/* clock period (or pulse length) */ - clktiml = (u32)(IXGBE_PTP_PPS_HALF_SECOND << shift); - clktimh = (u32)((IXGBE_PTP_PPS_HALF_SECOND << shift) >>32 ); + tsauxc = (IXGBE_TSAUXC_EN_CLK | +IXGBE_TSAUXC_SYNCLK | +IXGBE_TSAUXC_SDP0_INT ); -/* Account for the cyclecounter wrap-around value by -* using the converted ns value of the current time to -* check for when the next aligned second would occur. +/* Determine the clock time period to use. This assumes that the +* cycle counter shift is small enough to avoid overflow. */ - clock_edge |= (u64 )IXGBE_READ_REG (hw,IXGBE_SYSTIML ); - clock_edge |= (u64 )IXGBE_READ_REG (hw,IXGBE_SYSTIMH ) <<32 ; - ns =timecounter_cyc2time (&adapter->hw_tc, clock_edge); + clock_period =div_u64 ((NS_PER_HALF_SEC << cc->shift), cc->mult); + clktiml = (u32)(clock_period); + clktimh = (u32)(clock_period >>32 ); -div_u64_rem (ns,IXGBE_PTP_PPS_HALF_SECOND , &rem); - clock_edge += ((IXGBE_PTP_PPS_HALF_SECOND - (u64 )rem) << shift); +/* Read the current clock time, and save the cycle counter value */ +spin_lock_irqsave (&adapter->tmreg_lock, flags); + ns =timecounter_read (&adapter->hw_tc); + clock_edge = adapter->hw_tc.cycle_last; +spin_unlock_irqrestore (&adapter->tmreg_lock, flags); -/* specify the initial clock start time */ +/* Figure out how many seconds to add in order to round up */ +div_u64_rem (ns,NS_PER_SEC , &rem); + +/* Figure out how many nanoseconds to add to round the clock edge up +* to the next full second +*/ + rem = (NS_PER_SEC - rem); + +/* Adjust the clock edge to align with the next full second. This +* assumes that the cycle counter shift is small enough to avoid +* overflowing when shifting the remainder. +*/ + clock_edge +=div_u64 ((rem << cc->shift), cc->mult); trgttiml = (u32 )clock_edge; trgttimh = (u32)(clock_edge >>32 );
@@ -1253,7 +1266,7 @@ static long ixgbe_ptp_create_clock(struct ixgbe_adapter *adapter) adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; adapter->ptp_caps.settime64 = ixgbe_ptp_settime; adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; - adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_x540; + adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_X540;break ;case ixgbe_mac_82599EB: snprintf(adapter->ptp_caps.name,
Signature · 1 line
2.21.0
Re: [net-next 06/15] ixgbe: fix PTP SDP pin setup on X540 hardware
Quoted 5 lines · Jeff Kirsher
+ * It calculates when the system time will be on an exact second, and then
+ * aligns the start of the PPS signal to that value.
+ *
+ * This works by using the cycle counter shift and mult values in reverse, and
+ * assumes that the values we're shifting will not overflow.
So I guess that this device can't adjust the frequency in hardware, and that is why the driver uses a timecounter.
BUT your PPS will not be correct. You use the 'mult' to calculate the future counter time of the PPS, but as soon as the PTP stack adjusts the frequency (and changes 'mult') the PPS will occur at the wrong time.
Sorry to say it,
Richard
RE: [net-next 06/15] ixgbe: fix PTP SDP pin setup on X540 hardware
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Cochran
Sent: Wednesday, June 05, 2019 8:21 PM
To: Kirsher, Jeffrey T <[email protected]>
Cc: [email protected]; Keller, Jacob E <[email protected]>; [email protected]; [email protected]; [email protected]; Bowers, AndrewX <[email protected]>
Subject: Re: [net-next 06/15] ixgbe: fix PTP SDP pin setup on X540 hardwareOn Wed, Jun 05, 2019 at 01:23:49PM -0700, Jeff Kirsher wrote:
Quoted 9 lines
Quoted 5 lines
+ * It calculates when the system time will be on an exact second, and then
+ * aligns the start of the PPS signal to that value.
+ *
+ * This works by using the cycle counter shift and mult values in reverse, and
+ * assumes that the values we're shifting will not overflow.So I guess that this device can't adjust the frequency in hardware, and that is why the driver uses a timecounter.
No. We use the timecounter to track the time offset, not the frequency. That is, our hardware can't represent 64bits of time, but it can adjust frequency. The time counter is used to track the adjustments from adjtime and set time, but not adjfreq.
The timecounter is used to provide two features: (a) storing a full 64bits of time for passing back to the PTP stack and (b) atomic adjustments in adjtime. When programming the SDP we need to reverse the calculations done so that they're in terms of the SYSTIME values. But the frequency changes are all done directly to the SYSTIME increment values, and should be reflected properly in the pin output.
Quoted 4 lines
BUT your PPS will not be correct. You use the 'mult' to calculate the future counter time of the PPS, but as soon as the PTP stack adjusts the frequency (and changes 'mult') the PPS will occur at the wrong time.
Every path which changes mult (which is only link speed changes as far as I remember offhand) re-programs the PPS. We also re-program the pin at adjtime and settime.
There should be no caller outside of our driver who adjusts the multiplier.
Thanks,
Jake
Quoted 3 lines
Sorry to say it,
Richard
Re: [net-next 06/15] ixgbe: fix PTP SDP pin setup on X540 hardware
Quoted 4 lines · Jacob E
No. We use the timecounter to track the time offset, not the frequency. That is, our hardware can't represent 64bits of time, but it can adjust frequency. The time counter is used to track the adjustments from adjtime and set time, but not adjfreq.
Ah, okay. Never mind then... carry on!
Thanks,
Richard
RE: [net-next 06/15] ixgbe: fix PTP SDP pin setup on X540 hardware
Quoted 16 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Cochran
Sent: Thursday, June 06, 2019 8:35 PM
To: Keller, Jacob E <[email protected]>
Cc: Kirsher, Jeffrey T <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Bowers, AndrewX <[email protected]>
Subject: Re: [net-next 06/15] ixgbe: fix PTP SDP pin setup on X540 hardwareQuoted 4 lines · Jacob E
No. We use the timecounter to track the time offset, not the frequency. That is, our hardware can't represent 64bits of time, but it can adjust frequency. The time counter is used to track the adjustments from adjtime and set time, but not adjfreq.
Quoted 4 lines
Ah, okay. Never mind then... carry on!
Thanks,
Richard
Thanks for the review!
Regards,
Jake
PATCH 7/15 ixgbe: use 'cc' instead of 'hw_cc' for local variable
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
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.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +3 -3
@@ -226,7 +226,7 @@ static void ixgbe_ptp_setup_sdp_X540(struct ixgbe_adapter *adapter)/** * ixgbe_ptp_read_X550 - read cycle counter value -* @hw_cc: cyclecounter structure +* @cc: cyclecounter structure * * This function reads SYSTIME registers. It is called by the cyclecounter * structure to convert from internal representation into nanoseconds. We need
@@ -234,10 +234,10 @@ static void ixgbe_ptp_setup_sdp_X540(struct ixgbe_adapter *adapter)* result of SYSTIME is 32bits of "billions of cycles" and 32 bits of * "cycles", rather than seconds and nanoseconds. */ -static u64 ixgbe_ptp_read_X550 (const struct cyclecounter *hw_cc) +static u64 ixgbe_ptp_read_X550 (const struct cyclecounter *cc) {struct ixgbe_adapter *adapter = - container_of(hw_cc, struct ixgbe_adapter, hw_cc); + container_of(cc, struct ixgbe_adapter, hw_cc);struct ixgbe_hw *hw = &adapter->hw;struct timespec64 ts;
Signature · 1 line
2.21.0
PATCH 8/15 ixgbe: add a kernel documentation comment for ixgbe_ptp_get_ts_config
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
This function was missing a documentation comment. Add one now.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +9 -0
@@ -851,6 +851,15 @@ void ixgbe_ptp_rx_rgtstamp(struct ixgbe_q_vector *q_vector,ixgbe_ptp_convert_to_hwtstamp (adapter,skb_hwtstamps (skb), regval); } +/** +* ixgbe_ptp_get_ts_config - get current hardware timestamping configuration +* @adapter: pointer to adapter structure +* @ifr: ioctl data +* +* This function returns the current timestamping settings. Rather than +* attempt to deconstruct registers to fill in the values, simply keep a copy +* of the old settings around, and return a copy when requested. +*/ int ixgbe_ptp_get_ts_config (struct ixgbe_adapter *adapter,struct ifreq *ifr) {struct hwtstamp_config *config = &adapter->tstamp_config;
Signature · 1 line
2.21.0
PATCH 9/15 net: Add a define for LLDP ethertype
In reply to Jeff KirsherFrom: Anirudh Venkataramanan <[email protected]>
Add a new define ETH_P_LLDP for Link Layer Discovery Protocol (LLDP) ethertype.
--- include/uapi/linux/if_ether.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/if_ether.h +1 -0
@@ -91,6 +91,7 @@#define ETH_P_802_EX1 0x88B5/* 802.1 Local Experimental 1. */ #define ETH_P_PREAUTH 0x88C7/* 802.11 Preauthentication */ #define ETH_P_TIPC 0x88CA/* TIPC */ +#define ETH_P_LLDP 0x88CC/* Link Layer Discovery Protocol */ #define ETH_P_MACSEC 0x88E5/* 802.1ae MACsec */ #define ETH_P_8021AH 0x88E7/* 802.1ah Backbone Service Tag */ #define ETH_P_MVRP 0x88F5/* 802.1Q MVRP */
Signature · 1 line
2.21.0
PATCH 10/15 i40e: Use LLDP ethertype define ETH_P_LLDP
In reply to Jeff KirsherFrom: Anirudh Venkataramanan <[email protected]>
Remove references to I40E_ETH_P_LLDP and use ETH_P_LLDP instead.
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 -- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -2
@@ -295,8 +295,6 @@ struct i40e_cloud_filter {u8 tunnel_type; }; -#define I40E_ETH_P_LLDP 0x88cc -#define I40E_DCB_PRIO_TYPE_STRICT 0#define I40E_DCB_PRIO_TYPE_ETS 1#define I40E_DCB_STRICT_PRIO_CREDITS 127
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +2 -2
@@ -1330,7 +1330,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, } ret =i40e_aq_add_rem_control_packet_filter (&pf->hw, pf->hw.mac.addr, -I40E_ETH_P_LLDP ,0 , +ETH_P_LLDP ,0 , pf->vsi[pf->lan_vsi]->seid,0 , true,NULL ,NULL );if (ret) {
@@ -1348,7 +1348,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ret =i40e_aq_add_rem_control_packet_filter (&pf->hw, pf->hw.mac.addr, -I40E_ETH_P_LLDP ,0 , +ETH_P_LLDP ,0 , pf->vsi[pf->lan_vsi]->seid,0 , false,NULL ,NULL );if (ret) {
Signature · 1 line
2.21.0
PATCH 11/15 ixgbe: Use LLDP ethertype define ETH_P_LLDP
In reply to Jeff KirsherFrom: Anirudh Venkataramanan <[email protected]>
Remove references to IXGBE_ETH_P_LLD and use ETH_P_LLDP instead.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 -- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -2
@@ -50,8 +50,6 @@#define IXGBE_MAX_RXD 4096#define IXGBE_MIN_RXD 64 -#define IXGBE_ETH_P_LLDP 0x88CC -/* flow control */ #define IXGBE_MIN_FCRTL 0x40#define IXGBE_MAX_FCRTL 0x7FF80
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +1 -1
@@ -1645,7 +1645,7 @@ int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)IXGBE_WRITE_REG (hw,IXGBE_ETQF (IXGBE_ETQF_FILTER_LLDP ), (IXGBE_ETQF_FILTER_EN |IXGBE_ETQF_TX_ANTISPOOF | -IXGBE_ETH_P_LLDP )); +ETH_P_LLDP )); IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_FC), (IXGBE_ETQF_FILTER_EN |
Signature · 1 line
2.21.0
PATCH 12/15 ice: Use LLDP ethertype define ETH_P_LLDP
In reply to Jeff KirsherInstead of using a local define for the LLDP ethertype, use the kernel define ETH_P_LLDP.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +1 -3
@@ -2345,8 +2345,6 @@ ice_vsi_add_rem_eth_mac(struct ice_vsi *vsi, bool add_rule)ice_free_fltr_list (&pf->pdev->dev, &tmp_add_list); } -#define ICE_ETH_P_LLDP 0x88CC -/** * ice_cfg_sw_lldp - Config switch rules for LLDP packet handling * @vsi: the VSI being configured
@@ -2366,7 +2364,7 @@ void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create) list->fltr_info.lkup_type =ICE_SW_LKUP_ETHERTYPE ; list->fltr_info.vsi_handle = vsi->idx; - list->fltr_info.l_data.ethertype_mac.ethertype =ICE_ETH_P_LLDP ; + list->fltr_info.l_data.ethertype_mac.ethertype =ETH_P_LLDP ;if (tx) { list->fltr_info.fltr_act =ICE_DROP_PACKET ;
Signature · 1 line
2.21.0
PATCH 13/15 net: hns3: Use LLDP ethertype define ETH_P_LLDP
In reply to Jeff KirsherFrom: Anirudh Venkataramanan <[email protected]>
Remove references to HCLGE_MAC_ETHERTYPE_LLDP and use ETH_P_LLDP instead.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 1 - drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +0 -1
@@ -677,7 +677,6 @@ struct hclge_umv_spc_alc_cmd {#define HCLGE_MAC_MGR_MASK_VLAN_B BIT(0)#define HCLGE_MAC_MGR_MASK_MAC_B BIT(1)#define HCLGE_MAC_MGR_MASK_ETHERTYPE_B BIT(2) -#define HCLGE_MAC_ETHERTYPE_LLDP 0x88ccstruct hclge_mac_mgr_tbl_entry_cmd {u8 flags;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -1
@@ -292,7 +292,7 @@ static const struct hclge_comm_stats_str g_mac_stats_string[] = {static const struct hclge_mac_mgr_tbl_entry_cmd hclge_mgr_table[] = { { .flags =HCLGE_MAC_MGR_MASK_VLAN_B , - .ethter_type =cpu_to_le16 (HCLGE_MAC_ETHERTYPE_LLDP ), + .ethter_type =cpu_to_le16 (ETH_P_LLDP ), .mac_addr_hi32 =cpu_to_le32 (htonl (0x0180C200 )), .mac_addr_lo16 =cpu_to_le16 (htons (0x000E )), .i_port_bitmap =0x1 ,
Signature · 1 line
2.21.0
PATCH 14/15 ixgbe: implement support for SDP/PPS output on X550 hardware
In reply to Jeff KirsherFrom: Jacob Keller <[email protected]>
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.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 99 ++++++++++++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 14 ++- 2 files changed, 108 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +97 -2
@@ -224,6 +224,101 @@ static void ixgbe_ptp_setup_sdp_X540(struct ixgbe_adapter *adapter)IXGBE_WRITE_FLUSH (hw); } +/** +* ixgbe_ptp_setup_sdp_X550 +* @adapter: private adapter structure +* +* Enable or disable a clock output signal on SDP 0 for X550 hardware. +* +* Use the target time feature to align the output signal on the next full +* second. +* +* This works by using the cycle counter shift and mult values in reverse, and +* assumes that the values we're shifting will not overflow. +*/ +static void ixgbe_ptp_setup_sdp_X550 (struct ixgbe_adapter *adapter) +{ +u32 esdp, tsauxc, freqout, trgttiml, trgttimh, rem, tssdp; +struct cyclecounter *cc = &adapter->hw_cc; +struct ixgbe_hw *hw = &adapter->hw; +u64 ns =0 , clock_edge =0 ; +struct timespec64 ts; +unsigned long flags; + +/* disable the pin first */ +IXGBE_WRITE_REG (hw,IXGBE_TSAUXC ,0x0 ); +IXGBE_WRITE_FLUSH (hw); + +if (!(adapter->flags2 &IXGBE_FLAG2_PTP_PPS_ENABLED )) +return ; + + esdp =IXGBE_READ_REG (hw,IXGBE_ESDP ); + +/* enable the SDP0 pin as output, and connected to the +* native function for Timesync (ClockOut) +*/ + esdp |=IXGBE_ESDP_SDP0_DIR | +IXGBE_ESDP_SDP0_NATIVE ; + +/* enable the Clock Out feature on SDP0, and use Target Time 0 to +* enable generation of interrupts on the clock change. +*/ +#define IXGBE_TSAUXC_DIS_TS_CLEAR 0x40000000 + tsauxc = (IXGBE_TSAUXC_EN_CLK |IXGBE_TSAUXC_ST0 | +IXGBE_TSAUXC_EN_TT0 |IXGBE_TSAUXC_SDP0_INT | +IXGBE_TSAUXC_DIS_TS_CLEAR ); + + tssdp = (IXGBE_TSSDP_TS_SDP0_EN | +IXGBE_TSSDP_TS_SDP0_CLK0 ); + +/* Determine the clock time period to use. This assumes that the +* cycle counter shift is small enough to avoid overflowing a 32bit +* value. +*/ + freqout =div_u64 (NS_PER_HALF_SEC << cc->shift, cc->mult); + +/* Read the current clock time, and save the cycle counter value */ +spin_lock_irqsave (&adapter->tmreg_lock, flags); + ns =timecounter_read (&adapter->hw_tc); + clock_edge = adapter->hw_tc.cycle_last; +spin_unlock_irqrestore (&adapter->tmreg_lock, flags); + +/* Figure out how far past the next second we are */ +div_u64_rem (ns,NS_PER_SEC , &rem); + +/* Figure out how many nanoseconds to add to round the clock edge up +* to the next full second +*/ + rem = (NS_PER_SEC - rem); + +/* Adjust the clock edge to align with the next full second. This +* assumes that the cycle counter shift is small enough to avoid +* overflowing when shifting the remainder. +*/ + clock_edge +=div_u64 ((rem << cc->shift), cc->mult); + +/* X550 hardware stores the time in 32bits of 'billions of cycles' and +* 32bits of 'cycles'. There's no guarantee that cycles represents +* nanoseconds. However, we can use the math from a timespec64 to +* convert into the hardware representation. +* +* See ixgbe_ptp_read_X550() for more details. +*/ + ts =ns_to_timespec64 (clock_edge); + trgttiml = (u32 )ts.tv_nsec; + trgttimh = (u32 )ts.tv_sec; + +IXGBE_WRITE_REG (hw,IXGBE_FREQOUT0 , freqout); +IXGBE_WRITE_REG (hw,IXGBE_TRGTTIML0 , trgttiml); +IXGBE_WRITE_REG (hw,IXGBE_TRGTTIMH0 , trgttimh); + +IXGBE_WRITE_REG (hw,IXGBE_ESDP , esdp); +IXGBE_WRITE_REG (hw,IXGBE_TSSDP , tssdp); +IXGBE_WRITE_REG (hw,IXGBE_TSAUXC , tsauxc); + +IXGBE_WRITE_FLUSH (hw); +} +/** * ixgbe_ptp_read_X550 - read cycle counter value * @cc: cyclecounter structure
@@ -1302,13 +1397,13 @@ static long ixgbe_ptp_create_clock(struct ixgbe_adapter *adapter) adapter->ptp_caps.n_alarm =0 ; adapter->ptp_caps.n_ext_ts =0 ; adapter->ptp_caps.n_per_out =0 ; - adapter->ptp_caps.pps =0 ; + adapter->ptp_caps.pps =1 ; adapter->ptp_caps.adjfreq = ixgbe_ptp_adjfreq_X550; adapter->ptp_caps.adjtime = ixgbe_ptp_adjtime; adapter->ptp_caps.gettimex64 = ixgbe_ptp_gettimex; adapter->ptp_caps.settime64 = ixgbe_ptp_settime; adapter->ptp_caps.enable = ixgbe_ptp_feature_enable; - adapter->ptp_setup_sdp =NULL ; + adapter->ptp_setup_sdp = ixgbe_ptp_setup_sdp_X550;break ;default : adapter->ptp_clock =NULL ;
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +11 -3
@@ -1067,6 +1067,7 @@ struct ixgbe_nvm_version {#define IXGBE_AUXSTMPL1 0x08C44/* Auxiliary Time Stamp 1 register Low - RO */ #define IXGBE_AUXSTMPH1 0x08C48/* Auxiliary Time Stamp 1 register High - RO */ #define IXGBE_TSIM 0x08C68/* TimeSync Interrupt Mask Register - RW */ +#define IXGBE_TSSDP 0x0003C/* TimeSync SDP Configuration Register - RW */ /* Diagnostic Registers */ #define IXGBE_RDSTATCTL 0x02C20
@@ -2240,11 +2241,18 @@ enum {#define IXGBE_RXDCTL_RLPML_EN 0x00008000#define IXGBE_RXDCTL_VME 0x40000000/* VLAN mode enable */ -#define IXGBE_TSAUXC_EN_CLK 0x00000004 -#define IXGBE_TSAUXC_SYNCLK 0x00000008 -#define IXGBE_TSAUXC_SDP0_INT 0x00000040 +#define IXGBE_TSAUXC_EN_CLK 0x00000004 +#define IXGBE_TSAUXC_SYNCLK 0x00000008 +#define IXGBE_TSAUXC_SDP0_INT 0x00000040 +#define IXGBE_TSAUXC_EN_TT0 0x00000001 +#define IXGBE_TSAUXC_EN_TT1 0x00000002 +#define IXGBE_TSAUXC_ST0 0x00000010#define IXGBE_TSAUXC_DISABLE_SYSTIME 0x80000000 +#define IXGBE_TSSDP_TS_SDP0_SEL_MASK 0x000000C0 +#define IXGBE_TSSDP_TS_SDP0_CLK0 0x00000080 +#define IXGBE_TSSDP_TS_SDP0_EN 0x00000100 +#define IXGBE_TSYNCTXCTL_VALID 0x00000001/* Tx timestamp valid */ #define IXGBE_TSYNCTXCTL_ENABLED 0x00000010/* Tx timestamping enabled */
Signature · 1 line
2.21.0
PATCH 15/15 net: ixgbevf: fix a missing check of ixgbevf_write_msg_read_ack
In reply to Jeff KirsherFrom: Kangjie Lu <[email protected]>
If ixgbevf_write_msg_read_ack fails, return its error code upstream
--- drivers/net/ethernet/intel/ixgbevf/vf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbevf/vf.c +2 -3
@@ -508,9 +508,8 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, vector_list[i++] =ixgbevf_mta_vector (hw, ha->addr); } -ixgbevf_write_msg_read_ack (hw, msgbuf, msgbuf,IXGBE_VFMAILBOX_SIZE ); - -return 0 ; +return ixgbevf_write_msg_read_ack (hw, msgbuf, msgbuf, +IXGBE_VFMAILBOX_SIZE ); }/**
Signature · 1 line
2.21.0
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Wed, 5 Jun 2019 13:23:43 -0700
Quoted 2 lines
This series contains updates to mainly ixgbe, with a few updates to i40e, net, ice and hns2 driver.
Pulled, thanks for the ETH_P_LLDP consolidation.