Intel Wired LAN Driver Updates 2020-09-09
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to i40e and igc drivers.
Stefan Assmann changes num_vlans to u16 to fix may be used uninitialized error and propagates error in i40_set_vsi_promisc() for i40e.
Vinicius corrects timestamping latency values for i225 devices and accounts for TX timestamping delay for igc.
The following are changes since commit b87f9fe1ac9441b75656dfd95eba70ef9f0375e0:
hsr: avoid newline end of message in NL_SET_ERR_MSG_MOD
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue 40GbE
Stefan Assmann (2):
i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc
i40e: always propagate error value in i40e_set_vsi_promisc()
Vinicius Costa Gomes (2):
igc: Fix wrong timestamp latency numbers
igc: Fix not considering the TX delay for timestamps
.../ethernet/intel/i40e/i40e_virtchnl_pf.c | 22 ++++++++++++++----- drivers/net/ethernet/intel/igc/igc.h | 20 +++++++---------- drivers/net/ethernet/intel/igc/igc_ptp.c | 19 ++++++++++++++++ 3 files changed, 43 insertions(+), 18 deletions(-)
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH RESEND 1/4 i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc
From: Stefan Assmann <[email protected]>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c: In function ‘i40e_set_vsi_promisc’:drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c:1176:14: error: ‘aq_ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
i40e_status aq_ret;
In case the code inside the if statement and the for loop does not get executed aq_ret will be uninitialized when the variable gets returned at the end of the function.
Avoid this by changing num_vlans from int to u16, so aq_ret always gets set. Making this change in additional places as num_vlans should never be negative.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +5 -5
@@ -1115,7 +1115,7 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf)static int i40e_getnum_vf_vsi_vlan_filters (struct i40e_vsi *vsi) {struct i40e_mac_filter *f; -int num_vlans =0 , bkt; +u16 num_vlans =0 , bkt;hash_for_each (vsi->mac_filter_hash, bkt, f, hlist) {if (f->vlan >=0 && f->vlan <=I40E_MAX_VLANID )
@@ -1134,8 +1134,8 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)* * Called to get number of VLANs and VLAN list present in mac_filter_hash. **/ -static void i40e_get_vlan_list_sync (struct i40e_vsi *vsi,int *num_vlans, -s16 **vlan_list) +static void i40e_get_vlan_list_sync (struct i40e_vsi *vsi,u16 *num_vlans, +s16 **vlan_list) {struct i40e_mac_filter *f;int i =0 ;
@@ -1169,7 +1169,7 @@ static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,**/ static i40e_status i40e_set_vsi_promisc (struct i40e_vf *vf,u16 seid,bool multi_enable, -bool unicast_enable,s16 *vl,int num_vlans) +bool unicast_enable,s16 *vl,u16 num_vlans) {struct i40e_pf *pf = vf->pf;struct i40e_hw *hw = &pf->hw;
@@ -1258,7 +1258,7 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf,i40e_status aq_ret =I40E_SUCCESS ;struct i40e_pf *pf = vf->pf;struct i40e_vsi *vsi; -int num_vlans; +u16 num_vlans;s16 *vl; vsi =i40e_find_vsi_from_id (pf, vsi_id);
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH RESEND 2/4 i40e: always propagate error value in i40e_set_vsi_promisc()
In reply to Tony NguyenFrom: Stefan Assmann <[email protected]>
The for loop in i40e_set_vsi_promisc() reports errors via dev_err() but does not propagate the error up the call chain. Instead it continues the loop and potentially overwrites the reported error value. This results in the error being recorded in the log buffer, but the caller might never know anything went the wrong way.
To avoid this situation i40e_set_vsi_promisc() needs to temporarily store the error after reporting it. This is still not optimal as multiple different errors may occur, so store the first error and hope that's the main issue.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +11 -1
@@ -1171,9 +1171,9 @@ static i40e_status i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, bool unicast_enable, s16 *vl, u16 num_vlans) { + i40e_status aq_ret, aq_tmp = 0;struct i40e_pf *pf = vf->pf;struct i40e_hw *hw = &pf->hw; -i40e_status aq_ret;int i;/* No VLAN to set promisc on, set on VSI */
@@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, vf->vf_id,i40e_stat_str (&pf->hw, aq_ret), i40e_aq_str(&pf->hw, aq_err)); + +if (!aq_tmp) + aq_tmp = aq_ret; } aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,
@@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, vf->vf_id,i40e_stat_str (&pf->hw, aq_ret), i40e_aq_str(&pf->hw, aq_err)); + +if (!aq_tmp) + aq_tmp = aq_ret; } } + +if (aq_tmp) + aq_ret = aq_tmp; +return aq_ret; }
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH RESEND 3/4 igc: Fix wrong timestamp latency numbers
In reply to Tony NguyenFrom: Vinicius Costa Gomes <[email protected]>
The previous timestamping latency numbers were obtained by interpolating the i210 numbers with the i225 crystal clock value. That calculation was wrong.
Use the correct values from real measurements.
--- drivers/net/ethernet/intel/igc/igc.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +8 -12
@@ -299,18 +299,14 @@ extern char igc_driver_name[];#define IGC_RX_HDR_LEN IGC_RXBUFFER_256/* Transmit and receive latency (for PTP timestamps) */ -/* FIXME: These values were estimated using the ones that i225 has as -* basis, they seem to provide good numbers with ptp4l/phc2sys, but we -* need to confirm them. -*/ -#define IGC_I225_TX_LATENCY_10 9542 -#define IGC_I225_TX_LATENCY_100 1024 -#define IGC_I225_TX_LATENCY_1000 178 -#define IGC_I225_TX_LATENCY_2500 64 -#define IGC_I225_RX_LATENCY_10 20662 -#define IGC_I225_RX_LATENCY_100 2213 -#define IGC_I225_RX_LATENCY_1000 448 -#define IGC_I225_RX_LATENCY_2500 160 +#define IGC_I225_TX_LATENCY_10 240 +#define IGC_I225_TX_LATENCY_100 58 +#define IGC_I225_TX_LATENCY_1000 80 +#define IGC_I225_TX_LATENCY_2500 1325 +#define IGC_I225_RX_LATENCY_10 6450 +#define IGC_I225_RX_LATENCY_100 185 +#define IGC_I225_RX_LATENCY_1000 300 +#define IGC_I225_RX_LATENCY_2500 1485/* RX and TX descriptor control thresholds. * PTHRESH - MAC will consider prefetch if it has fewer than this number of
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH RESEND 4/4 igc: Fix not considering the TX delay for timestamps
In reply to Tony NguyenFrom: Vinicius Costa Gomes <[email protected]>
When timestamping a packet there's a delay between the start of the packet and the point where the hardware actually captures the timestamp. This difference needs to be considered if we want accurate timestamps.
This was done on the RX side, but not on the TX side.
--- drivers/net/ethernet/intel/igc/igc_ptp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/ethernet/intel/igc/igc_ptp.c +19 -0
@@ -364,6 +364,7 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)struct sk_buff *skb = adapter->ptp_tx_skb;struct skb_shared_hwtstamps shhwtstamps;struct igc_hw *hw = &adapter->hw; +int adjust =0 ;u64 regval;if (WARN_ON_ONCE (!skb))
@@ -373,6 +374,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter) regval |= (u64 )rd32 (IGC_TXSTMPH ) <<32 ;igc_ptp_systim_to_hwtstamp (adapter, &shhwtstamps, regval); +switch (adapter->link_speed) { +case SPEED_10 : + adjust =IGC_I225_TX_LATENCY_10 ; +break ; +case SPEED_100 : + adjust =IGC_I225_TX_LATENCY_100 ; +break ; +case SPEED_1000 : + adjust =IGC_I225_TX_LATENCY_1000 ; +break ; +case SPEED_2500 : + adjust =IGC_I225_TX_LATENCY_2500 ; +break ; + } + + shhwtstamps.hwtstamp = +ktime_add_ns (shhwtstamps.hwtstamp, adjust); +/* Clear the lock early before calling skb_tstamp_tx so that * applications are not woken up before the lock bit is clear. We use * a copy of the skb pointer to ensure other threads can't change it
Signature · 1 line
2.26.2
David Miller
maintainerFrom: Tony Nguyen <[email protected]>
Date: Fri, 11 Sep 2020 16:22:03 -0700
Quoted 5 lines
This series contains updates to i40e and igc drivers.
Stefan Assmann changes
num_vlansto u16 to fix may be used uninitialized error and propagates error ini40_set_vsi_promisc()for i40e.
Quoted 7 lines
Vinicius corrects timestamping latency values for i225 devices and accounts for TX timestamping delay for igc.
The following are changes since commit
b87f9fe1ac9441b75656dfd95eba70ef9f0375e0:
hsr: avoid newline end of message inNL_SET_ERR_MSG_MOD
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue40GbE
Pulled, thank you.