All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09
@ 2020-09-11 23:22 Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 1/4] i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc Tony Nguyen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tony Nguyen @ 2020-09-11 23:22 UTC (permalink / raw)
  To: davem; +Cc: Tony Nguyen, netdev, nhorman, sassmann, jeffrey.t.kirsher

This 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(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RESEND net 1/4] i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc
  2020-09-11 23:22 [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 Tony Nguyen
@ 2020-09-11 23:22 ` Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 2/4] i40e: always propagate error value in i40e_set_vsi_promisc() Tony Nguyen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2020-09-11 23:22 UTC (permalink / raw)
  To: davem
  Cc: Stefan Assmann, netdev, nhorman, sassmann, jeffrey.t.kirsher,
	anthony.l.nguyen, Jakub Kicinski, Aaron Brown

From: Stefan Assmann <sassmann@kpanic.de>

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.

Fixes: 37d318d7805f ("i40e: Remove scheduling while atomic possibility")
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 8e133d6545bd..5defcb777e92 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND net 2/4] i40e: always propagate error value in i40e_set_vsi_promisc()
  2020-09-11 23:22 [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 1/4] i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc Tony Nguyen
@ 2020-09-11 23:22 ` Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 3/4] igc: Fix wrong timestamp latency numbers Tony Nguyen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2020-09-11 23:22 UTC (permalink / raw)
  To: davem
  Cc: Stefan Assmann, netdev, nhorman, sassmann, jeffrey.t.kirsher,
	anthony.l.nguyen, Michal Schmidt, Aaron Brown

From: Stefan Assmann <sassmann@kpanic.de>

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.

Fixes: 37d318d7805f (i40e: Remove scheduling while atomic possibility)
Reported-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 5defcb777e92..47bfb2e95e2d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -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;
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND net 3/4] igc: Fix wrong timestamp latency numbers
  2020-09-11 23:22 [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 1/4] i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 2/4] i40e: always propagate error value in i40e_set_vsi_promisc() Tony Nguyen
@ 2020-09-11 23:22 ` Tony Nguyen
  2020-09-11 23:22 ` [RESEND net 4/4] igc: Fix not considering the TX delay for timestamps Tony Nguyen
  2020-09-12  0:19 ` [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2020-09-11 23:22 UTC (permalink / raw)
  To: davem
  Cc: Vinicius Costa Gomes, netdev, nhorman, sassmann,
	jeffrey.t.kirsher, anthony.l.nguyen, Aaron Brown

From: Vinicius Costa Gomes <vinicius.gomes@intel.com>

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.

Fixes: 81b055205e8b ("igc: Add support for RX timestamping")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igc/igc.h | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index 3070dfdb7eb4..2d566f3c827b 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND net 4/4] igc: Fix not considering the TX delay for timestamps
  2020-09-11 23:22 [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 Tony Nguyen
                   ` (2 preceding siblings ...)
  2020-09-11 23:22 ` [RESEND net 3/4] igc: Fix wrong timestamp latency numbers Tony Nguyen
@ 2020-09-11 23:22 ` Tony Nguyen
  2020-09-12  0:19 ` [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2020-09-11 23:22 UTC (permalink / raw)
  To: davem
  Cc: Vinicius Costa Gomes, netdev, nhorman, sassmann,
	jeffrey.t.kirsher, anthony.l.nguyen, Aaron Brown

From: Vinicius Costa Gomes <vinicius.gomes@intel.com>

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.

Fixes: 2c344ae24501 ("igc: Add support for TX timestamping")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_ptp.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c
index 36c999250fcc..6a9b5102aa55 100644
--- a/drivers/net/ethernet/intel/igc/igc_ptp.c
+++ b/drivers/net/ethernet/intel/igc/igc_ptp.c
@@ -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
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09
  2020-09-11 23:22 [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 Tony Nguyen
                   ` (3 preceding siblings ...)
  2020-09-11 23:22 ` [RESEND net 4/4] igc: Fix not considering the TX delay for timestamps Tony Nguyen
@ 2020-09-12  0:19 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-09-12  0:19 UTC (permalink / raw)
  To: anthony.l.nguyen; +Cc: netdev, nhorman, sassmann, jeffrey.t.kirsher

From: Tony Nguyen <anthony.l.nguyen@intel.com>
Date: Fri, 11 Sep 2020 16:22:03 -0700

> This 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

Pulled, thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-12  0:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 23:22 [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 Tony Nguyen
2020-09-11 23:22 ` [RESEND net 1/4] i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc Tony Nguyen
2020-09-11 23:22 ` [RESEND net 2/4] i40e: always propagate error value in i40e_set_vsi_promisc() Tony Nguyen
2020-09-11 23:22 ` [RESEND net 3/4] igc: Fix wrong timestamp latency numbers Tony Nguyen
2020-09-11 23:22 ` [RESEND net 4/4] igc: Fix not considering the TX delay for timestamps Tony Nguyen
2020-09-12  0:19 ` [RESEND net 0/4][pull request] Intel Wired LAN Driver Updates 2020-09-09 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.