All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2022-11-08 (ice, iavf)
@ 2022-11-08 23:51 Tony Nguyen
  2022-11-08 23:51 ` [PATCH net 1/3] ice: Fix spurious interrupt during removal of trusted VF Tony Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-11-08 23:51 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet; +Cc: Tony Nguyen, netdev

This series contains updates to ice and iavf drivers.

Norbert stops disabling VF queues that are not enabled for ice driver.

Jake fixes type for looping variables to resolve signedness issue for
ice.

Michal stops accounting of VLAN 0 filter to match expectations of PF
driver for iavf.

The following are changes since commit ce9e57feeed81d17d5e80ed86f516ff0d39c3867:
  drivers: net: xgene: disable napi when register irq failed in xgene_enet_open()
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE

Jacob Keller (1):
  ice: use int for n_per_out loop

Michal Jaron (1):
  iavf: Fix VF driver counting VLAN 0 filters

Norbert Zulinski (1):
  ice: Fix spurious interrupt during removal of trusted VF

 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  2 ++
 drivers/net/ethernet/intel/ice/ice_base.c     |  2 +-
 drivers/net/ethernet/intel/ice/ice_lib.c      | 25 +++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_lib.h      |  1 +
 drivers/net/ethernet/intel/ice/ice_ptp.c      |  4 +--
 drivers/net/ethernet/intel/ice/ice_vf_lib.c   |  5 +++-
 6 files changed, 35 insertions(+), 4 deletions(-)

-- 
2.35.1


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

* [PATCH net 1/3] ice: Fix spurious interrupt during removal of trusted VF
  2022-11-08 23:51 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2022-11-08 (ice, iavf) Tony Nguyen
@ 2022-11-08 23:51 ` Tony Nguyen
  2022-11-08 23:51 ` [PATCH net 2/3] ice: use int for n_per_out loop Tony Nguyen
  2022-11-08 23:51 ` [PATCH net 3/3] iavf: Fix VF driver counting VLAN 0 filters Tony Nguyen
  2 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-11-08 23:51 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Norbert Zulinski, netdev, anthony.l.nguyen, Mateusz Palczewski,
	Konrad Jankowski

From: Norbert Zulinski <norbertx.zulinski@intel.com>

Previously, during removal of trusted VF when VF is down there was
number of spurious interrupt equal to number of queues on VF.

Add check if VF already has inactive queues. If VF is disabled and
has inactive rx queues then do not disable rx queues.
Add check in ice_vsi_stop_tx_ring if it's VF's vsi and if VF is
disabled.

Fixes: efe41860008e ("ice: Fix memory corruption in VF driver")
Signed-off-by: Norbert Zulinski <norbertx.zulinski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_base.c   |  2 +-
 drivers/net/ethernet/intel/ice/ice_lib.c    | 25 +++++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_lib.h    |  1 +
 drivers/net/ethernet/intel/ice/ice_vf_lib.c |  5 ++++-
 4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index 9e36f01dfa4f..e864634d66bc 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -958,7 +958,7 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
 	 * associated to the queue to schedule NAPI handler
 	 */
 	q_vector = ring->q_vector;
-	if (q_vector)
+	if (q_vector && !(vsi->vf && ice_is_vf_disabled(vsi->vf)))
 		ice_trigger_sw_intr(hw, q_vector);
 
 	status = ice_dis_vsi_txq(vsi->port_info, txq_meta->vsi_idx,
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 938ba8c215cb..7276badfa19e 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -2239,6 +2239,31 @@ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi)
 	return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings, vsi->num_xdp_txq);
 }
 
+/**
+ * ice_vsi_is_rx_queue_active
+ * @vsi: the VSI being configured
+ *
+ * Return true if at least one queue is active.
+ */
+bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi)
+{
+	struct ice_pf *pf = vsi->back;
+	struct ice_hw *hw = &pf->hw;
+	int i;
+
+	ice_for_each_rxq(vsi, i) {
+		u32 rx_reg;
+		int pf_q;
+
+		pf_q = vsi->rxq_map[i];
+		rx_reg = rd32(hw, QRX_CTRL(pf_q));
+		if (rx_reg & QRX_CTRL_QENA_STAT_M)
+			return true;
+	}
+
+	return false;
+}
+
 /**
  * ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not
  * @vsi: VSI to check whether or not VLAN pruning is enabled.
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
index ec4bf0c89857..dcdf69a693e9 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_lib.h
@@ -129,4 +129,5 @@ u16 ice_vsi_num_non_zero_vlans(struct ice_vsi *vsi);
 bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f);
 void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f);
 void ice_init_feature_support(struct ice_pf *pf);
+bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi);
 #endif /* !_ICE_LIB_H_ */
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index 0abeed092de1..1c51778db951 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
@@ -576,7 +576,10 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
 			return -EINVAL;
 		}
 		ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);
-		ice_vsi_stop_all_rx_rings(vsi);
+
+		if (ice_vsi_is_rx_queue_active(vsi))
+			ice_vsi_stop_all_rx_rings(vsi);
+
 		dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
 			vf->vf_id);
 		return 0;
-- 
2.35.1


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

* [PATCH net 2/3] ice: use int for n_per_out loop
  2022-11-08 23:51 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2022-11-08 (ice, iavf) Tony Nguyen
  2022-11-08 23:51 ` [PATCH net 1/3] ice: Fix spurious interrupt during removal of trusted VF Tony Nguyen
@ 2022-11-08 23:51 ` Tony Nguyen
  2022-11-09 16:37   ` Alexander Lobakin
  2022-11-08 23:51 ` [PATCH net 3/3] iavf: Fix VF driver counting VLAN 0 filters Tony Nguyen
  2 siblings, 1 reply; 6+ messages in thread
From: Tony Nguyen @ 2022-11-08 23:51 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Jacob Keller, netdev, anthony.l.nguyen, richardcochran, Gurucharan G

From: Jacob Keller <jacob.e.keller@intel.com>

In ice_ptp_enable_all_clkout and ice_ptp_disable_all_clkout we use a uint
for a for loop iterating over the n_per_out value from the struct
ptp_clock_info. The struct member is a signed int, and the use of uint
generates a -Wsign-compare warning:

  drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_ptp_enable_all_clkout’:
  drivers/net/ethernet/intel/ice/ice_ptp.c:1710:23: error: comparison of integer expressions of different signedness: ‘uint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   1710 |         for (i = 0; i < pf->ptp.info.n_per_out; i++)
        |                       ^
  cc1: all warnings being treated as errors

While we don't generally compile with -Wsign-compare, its still a good idea
not to mix types. Fix the two functions to use a plain signed integer.

Fixes: 9ee313433c48 ("ice: restart periodic outputs around time changes")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 011b727ab190..be147fb641ae 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -1688,7 +1688,7 @@ static int ice_ptp_cfg_clkout(struct ice_pf *pf, unsigned int chan,
  */
 static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
 {
-	uint i;
+	int i;
 
 	for (i = 0; i < pf->ptp.info.n_per_out; i++)
 		if (pf->ptp.perout_channels[i].ena)
@@ -1705,7 +1705,7 @@ static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
  */
 static void ice_ptp_enable_all_clkout(struct ice_pf *pf)
 {
-	uint i;
+	int i;
 
 	for (i = 0; i < pf->ptp.info.n_per_out; i++)
 		if (pf->ptp.perout_channels[i].ena)
-- 
2.35.1


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

* [PATCH net 3/3] iavf: Fix VF driver counting VLAN 0 filters
  2022-11-08 23:51 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2022-11-08 (ice, iavf) Tony Nguyen
  2022-11-08 23:51 ` [PATCH net 1/3] ice: Fix spurious interrupt during removal of trusted VF Tony Nguyen
  2022-11-08 23:51 ` [PATCH net 2/3] ice: use int for n_per_out loop Tony Nguyen
@ 2022-11-08 23:51 ` Tony Nguyen
  2 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2022-11-08 23:51 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Michal Jaron, netdev, anthony.l.nguyen, Przemyslaw Patynowski,
	Kamil Maziarz, Konrad Jankowski

From: Michal Jaron <michalx.jaron@intel.com>

VF driver mistakenly counts VLAN 0 filters, when no PF driver
counts them.
Do not count VLAN 0 filters, when VLAN_V2 is engaged.
Counting those filters in, will affect filters size by -1, when
sending batched VLAN addition message.

Fixes: 968996c070ef ("iavf: Fix VLAN_V2 addition/rejection")
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
Signed-off-by: Kamil Maziarz <kamil.maziarz@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
index 5a9e6563923e..24a701fd140e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
@@ -2438,6 +2438,8 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
 		list_for_each_entry(f, &adapter->vlan_filter_list, list) {
 			if (f->is_new_vlan) {
 				f->is_new_vlan = false;
+				if (!f->vlan.vid)
+					continue;
 				if (f->vlan.tpid == ETH_P_8021Q)
 					set_bit(f->vlan.vid,
 						adapter->vsi.active_cvlans);
-- 
2.35.1


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

* Re: [PATCH net 2/3] ice: use int for n_per_out loop
  2022-11-08 23:51 ` [PATCH net 2/3] ice: use int for n_per_out loop Tony Nguyen
@ 2022-11-09 16:37   ` Alexander Lobakin
  2022-11-09 20:19     ` Jacob Keller
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Lobakin @ 2022-11-09 16:37 UTC (permalink / raw)
  To: Jacob Keller
  Cc: Alexander Lobakin, davem, kuba, pabeni, edumazet, Tony Nguyen,
	netdev, richardcochran, Gurucharan G

From: Tony Nguyen <anthony.l.nguyen@intel.com>
Date: Tue,  8 Nov 2022 15:51:15 -0800

> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> In ice_ptp_enable_all_clkout and ice_ptp_disable_all_clkout we use a uint
> for a for loop iterating over the n_per_out value from the struct
> ptp_clock_info. The struct member is a signed int, and the use of uint
> generates a -Wsign-compare warning:
> 
>   drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_ptp_enable_all_clkout’:
>   drivers/net/ethernet/intel/ice/ice_ptp.c:1710:23: error: comparison of integer expressions of different signedness: ‘uint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
>    1710 |         for (i = 0; i < pf->ptp.info.n_per_out; i++)
>         |                       ^
>   cc1: all warnings being treated as errors
> 
> While we don't generally compile with -Wsign-compare, its still a good idea

-Wsign-compare is disabled even on W=2.

> not to mix types. Fix the two functions to use a plain signed integer.

It's still a good idea to not use ints when values below zero are
not used. Here both @i's are used as iterators from zero and above.
The change is just pointless. I would even understand if you casted
::n_per_out to `u32` in the loop condition and -Wsign-compare was
enabled on W=1 or 2, but not this.

> 
> Fixes: 9ee313433c48 ("ice: restart periodic outputs around time changes")

...even more pointless to send it to net, not net-next, it doesn't
fix anything. If you manually enable the warning via KCFLAGS, you'll
see thousands of them.

> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index 011b727ab190..be147fb641ae 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -1688,7 +1688,7 @@ static int ice_ptp_cfg_clkout(struct ice_pf *pf, unsigned int chan,
>   */
>  static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
>  {
> -	uint i;
> +	int i;
>  
>  	for (i = 0; i < pf->ptp.info.n_per_out; i++)
>  		if (pf->ptp.perout_channels[i].ena)
> @@ -1705,7 +1705,7 @@ static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
>   */
>  static void ice_ptp_enable_all_clkout(struct ice_pf *pf)
>  {
> -	uint i;
> +	int i;
>  
>  	for (i = 0; i < pf->ptp.info.n_per_out; i++)
>  		if (pf->ptp.perout_channels[i].ena)
> -- 
> 2.35.1

Thanks,
Olek

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

* Re: [PATCH net 2/3] ice: use int for n_per_out loop
  2022-11-09 16:37   ` Alexander Lobakin
@ 2022-11-09 20:19     ` Jacob Keller
  0 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2022-11-09 20:19 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: davem, kuba, pabeni, edumazet, Tony Nguyen, netdev,
	richardcochran, Gurucharan G



On 11/9/2022 8:37 AM, Alexander Lobakin wrote:
> From: Tony Nguyen <anthony.l.nguyen@intel.com>
> Date: Tue,  8 Nov 2022 15:51:15 -0800
> 
>> From: Jacob Keller <jacob.e.keller@intel.com>
>>
>> In ice_ptp_enable_all_clkout and ice_ptp_disable_all_clkout we use a uint
>> for a for loop iterating over the n_per_out value from the struct
>> ptp_clock_info. The struct member is a signed int, and the use of uint
>> generates a -Wsign-compare warning:
>>
>>    drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_ptp_enable_all_clkout’:
>>    drivers/net/ethernet/intel/ice/ice_ptp.c:1710:23: error: comparison of integer expressions of different signedness: ‘uint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
>>     1710 |         for (i = 0; i < pf->ptp.info.n_per_out; i++)
>>          |                       ^
>>    cc1: all warnings being treated as errors
>>
>> While we don't generally compile with -Wsign-compare, its still a good idea
> 
> -Wsign-compare is disabled even on W=2.
> 
>> not to mix types. Fix the two functions to use a plain signed integer.
> 
> It's still a good idea to not use ints when values below zero are
> not used. Here both @i's are used as iterators from zero and above.
> The change is just pointless. I would even understand if you casted
> ::n_per_out to `u32` in the loop condition and -Wsign-compare was
> enabled on W=1 or 2, but not this.
> 

Fair. I wonder if the struct ptp_clock_info structure can be switched to 
use uints? It doesn't make sense to have a negative number for these n_* 
fields...

Either way, we can drop this patch. I am investigating where I saw the 
report for this and am going to change that build to not use -Wsign-compare.

Thanks,
Jake

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

end of thread, other threads:[~2022-11-09 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 23:51 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2022-11-08 (ice, iavf) Tony Nguyen
2022-11-08 23:51 ` [PATCH net 1/3] ice: Fix spurious interrupt during removal of trusted VF Tony Nguyen
2022-11-08 23:51 ` [PATCH net 2/3] ice: use int for n_per_out loop Tony Nguyen
2022-11-09 16:37   ` Alexander Lobakin
2022-11-09 20:19     ` Jacob Keller
2022-11-08 23:51 ` [PATCH net 3/3] iavf: Fix VF driver counting VLAN 0 filters Tony Nguyen

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.