Re: [Intel-wired-lan] [PATCH iwl-next v1 08/13] igc: field prep conversion

2023-12-05 Thread naamax.meir

On 11/21/2023 23:19, Jesse Brandeburg wrote:

Refactor igc driver to use FIELD_PREP(), which reduces lines of code
and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired in a later patch.

@prep@
constant shift,mask;
expression a;
@@
-((a << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall 
Cc: Sasha Neftin 
Reviewed-by: Marcin Szycik 
Signed-off-by: Jesse Brandeburg 
---
  drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


Tested-by: Naama Meir 
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 0/2] ixgbe: Refactor ixgbe internal status

2023-12-05 Thread Jedrzej Jagielski
A small 2 patches series removing currently used internal status codes in
ixgbe driver and converting them to the regular ones.

1st patch deals specifically with overtemp error code, the 2nd one
refactors the rest of the error codes.

Jedrzej Jagielski (2):
  ixgbe: Refactor overtemp event handling
  ixgbe: Refactor returning internal error codes

 .../net/ethernet/intel/ixgbe/ixgbe_82598.c|  36 ++--
 .../net/ethernet/intel/ixgbe/ixgbe_82599.c|  61 ---
 .../net/ethernet/intel/ixgbe/ixgbe_common.c   | 145 
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  |   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  46 +++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c  |  34 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h  |   1 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c  | 117 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h  |   2 +-
 .../net/ethernet/intel/ixgbe/ixgbe_sriov.c|   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  43 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c |  44 ++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 156 ++
 13 files changed, 333 insertions(+), 356 deletions(-)

-- 
2.31.1

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 1/2] ixgbe: Refactor overtemp event handling

2023-12-05 Thread Jedrzej Jagielski
Currently ixgbe driver is notified of overheating events
via internal IXGBE_ERR_OVERTEMP error code.

Change the approach to use freshly introduced is_overtemp
function parameter which set when such event occurs.
Add new parameter to the check_overtemp() and handle_lasi()
phy ops.

Signed-off-by: Jedrzej Jagielski 
---
v2: change aproach to use additional function parameter to notify when overheat

CC: Przemek Kitszel 
Patch changed a bit so removing Przemek's tag
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c  | 33 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h  |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  4 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 47 ---
 5 files changed, 67 insertions(+), 39 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 1726297f2e0d..57e7e044fb85 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2756,7 +2756,7 @@ static void ixgbe_check_overtemp_subtask(struct 
ixgbe_adapter *adapter)
 {
struct ixgbe_hw *hw = &adapter->hw;
u32 eicr = adapter->interrupt_event;
-   s32 rc;
+   bool overtemp;
 
if (test_bit(__IXGBE_DOWN, &adapter->state))
return;
@@ -2790,14 +2790,15 @@ static void ixgbe_check_overtemp_subtask(struct 
ixgbe_adapter *adapter)
}
 
/* Check if this is not due to overtemp */
-   if (hw->phy.ops.check_overtemp(hw) != IXGBE_ERR_OVERTEMP)
+   hw->phy.ops.check_overtemp(hw, &overtemp);
+   if (!overtemp)
return;
 
break;
case IXGBE_DEV_ID_X550EM_A_1G_T:
case IXGBE_DEV_ID_X550EM_A_1G_T_L:
-   rc = hw->phy.ops.check_overtemp(hw);
-   if (rc != IXGBE_ERR_OVERTEMP)
+   hw->phy.ops.check_overtemp(hw, &overtemp);
+   if (!overtemp)
return;
break;
default:
@@ -2807,6 +2808,7 @@ static void ixgbe_check_overtemp_subtask(struct 
ixgbe_adapter *adapter)
return;
break;
}
+
e_crit(drv, "%s\n", ixgbe_overheat_msg);
 
adapter->interrupt_event = 0;
@@ -7938,7 +7940,7 @@ static void ixgbe_service_timer(struct timer_list *t)
 static void ixgbe_phy_interrupt_subtask(struct ixgbe_adapter *adapter)
 {
struct ixgbe_hw *hw = &adapter->hw;
-   u32 status;
+   bool overtemp;
 
if (!(adapter->flags2 & IXGBE_FLAG2_PHY_INTERRUPT))
return;
@@ -7948,11 +7950,9 @@ static void ixgbe_phy_interrupt_subtask(struct 
ixgbe_adapter *adapter)
if (!hw->phy.ops.handle_lasi)
return;
 
-   status = hw->phy.ops.handle_lasi(&adapter->hw);
-   if (status != IXGBE_ERR_OVERTEMP)
-   return;
-
-   e_crit(drv, "%s\n", ixgbe_overheat_msg);
+   hw->phy.ops.handle_lasi(&adapter->hw, &overtemp);
+   if (overtemp)
+   e_crit(drv, "%s\n", ixgbe_overheat_msg);
 }
 
 static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index 689470c1e8ad..b2c8bc63fbb7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -397,9 +397,10 @@ static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 
phy_id)
  **/
 s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
 {
-   u32 i;
-   u16 ctrl = 0;
s32 status = 0;
+   bool overtemp;
+   u16 ctrl = 0;
+   u32 i;
 
if (hw->phy.type == ixgbe_phy_unknown)
status = ixgbe_identify_phy_generic(hw);
@@ -407,9 +408,12 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
if (status != 0 || hw->phy.type == ixgbe_phy_none)
return status;
 
+   status = hw->phy.ops.check_overtemp(hw, &overtemp);
+   if (status)
+   return status;
+
/* Don't reset PHY if it's shut down due to overtemp. */
-   if (!hw->phy.reset_if_overtemp &&
-   (IXGBE_ERR_OVERTEMP == hw->phy.ops.check_overtemp(hw)))
+   if (!hw->phy.reset_if_overtemp && overtemp)
return 0;
 
/* Blocked by MNG FW so bail */
@@ -2746,24 +2750,33 @@ static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw)
 /**
  *  ixgbe_tn_check_overtemp - Checks if an overtemp occurred.
  *  @hw: pointer to hardware structure
+ *  @is_overtemp: indicate whether an overtemp event encountered
  *
  *  Checks if the LASI temp alarm status was triggered due to overtemp
  **/
-s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw)
+s32 ixgbe_tn_check_overtemp(struct ixgbe_hw *hw, bool *is_overtemp)
 {
u16 phy_data = 0;
+   u32 status;
+
+   if (!hw || !is_overtemp)
+   return -

[Intel-wired-lan] [PATCH iwl-next v2 2/2] ixgbe: Refactor returning internal error codes

2023-12-05 Thread Jedrzej Jagielski
Change returning codes to the kernel ones instead of
the internal ones for the entire ixgbe driver.

Reviewed-by: Jacob Keller 
Reviewed-by: Przemek Kitszel 
Signed-off-by: Jedrzej Jagielski 
---
 .../net/ethernet/intel/ixgbe/ixgbe_82598.c|  36 ++---
 .../net/ethernet/intel/ixgbe/ixgbe_82599.c|  61 
 .../net/ethernet/intel/ixgbe/ixgbe_common.c   | 145 --
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  |   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  26 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.c  |  34 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h  |   1 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c  |  84 +-
 .../net/ethernet/intel/ixgbe/ixgbe_sriov.c|   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  39 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c |  44 +++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 109 ++---
 12 files changed, 266 insertions(+), 317 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
index 100388968e4d..3d56481e16bc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
@@ -123,14 +123,14 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw)
if (ret_val)
return ret_val;
if (hw->phy.sfp_type == ixgbe_sfp_type_unknown)
-   return IXGBE_ERR_SFP_NOT_SUPPORTED;
+   return -EOPNOTSUPP;
 
/* Check to see if SFP+ module is supported */
ret_val = ixgbe_get_sfp_init_sequence_offsets(hw,
&list_offset,
&data_offset);
if (ret_val)
-   return IXGBE_ERR_SFP_NOT_SUPPORTED;
+   return -EOPNOTSUPP;
break;
default:
break;
@@ -213,7 +213,7 @@ static s32 ixgbe_get_link_capabilities_82598(struct 
ixgbe_hw *hw,
break;
 
default:
-   return IXGBE_ERR_LINK_SETUP;
+   return -EIO;
}
 
return 0;
@@ -283,7 +283,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
 
/* Validate the water mark configuration */
if (!hw->fc.pause_time)
-   return IXGBE_ERR_INVALID_LINK_SETTINGS;
+   return -EINVAL;
 
/* Low water mark of zero causes XOFF floods */
for (i = 0; i < MAX_TRAFFIC_CLASS; i++) {
@@ -292,7 +292,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
if (!hw->fc.low_water[i] ||
hw->fc.low_water[i] >= hw->fc.high_water[i]) {
hw_dbg(hw, "Invalid water mark 
configuration\n");
-   return IXGBE_ERR_INVALID_LINK_SETTINGS;
+   return -EINVAL;
}
}
}
@@ -369,7 +369,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw)
break;
default:
hw_dbg(hw, "Flow control param set incorrectly\n");
-   return IXGBE_ERR_CONFIG;
+   return -EIO;
}
 
/* Set 802.3x based flow control settings. */
@@ -438,7 +438,7 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw,
msleep(100);
}
if (!(links_reg & IXGBE_LINKS_KX_AN_COMP)) {
-   status = IXGBE_ERR_AUTONEG_NOT_COMPLETE;
+   status = -EIO;
hw_dbg(hw, "Autonegotiation did not 
complete.\n");
}
}
@@ -478,7 +478,7 @@ static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw)
 
if (timeout == IXGBE_VALIDATE_LINK_READY_TIMEOUT) {
hw_dbg(hw, "Link was indicated but link is down\n");
-   return IXGBE_ERR_LINK_SETUP;
+   return -EIO;
}
 
return 0;
@@ -594,7 +594,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
speed &= link_capabilities;
 
if (speed == IXGBE_LINK_SPEED_UNKNOWN)
-   return IXGBE_ERR_LINK_SETUP;
+   return -EINVAL;
 
/* Set KX4/KX support according to speed requested */
else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
@@ -701,9 +701,9 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
 
/* Init PHY and function pointers, perform SFP setup */
phy_status = hw->phy.ops.init(hw);
-   if (phy_status == IXGBE_ERR_SFP_NOT_SUPPORTED)
+   if (phy_status == -EOPNOTSUPP)
return phy_status;
-   if (phy_status == IXGBE_ERR_SFP_NOT_PRESENT)
+   if (phy_status == -ENOENT)

[Intel-wired-lan] [PATCH iwl-next] ice: Do not get coalesce settings while in reset

2023-12-05 Thread Pawel Chmielewski
From: Ngai-Mint Kwan 

Getting coalesce settings while reset is in progress can cause NULL
pointer deference bug.
If under reset, abort get coalesce for ethtool.

Signed-off-by: Ngai-Mint Kwan 
Reviewed-by: Mateusz Polchlopek 
Signed-off-by: Pawel Chmielewski 
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c 
b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index bde9bc74f928..2d565cc484a0 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3747,6 +3747,9 @@ __ice_get_coalesce(struct net_device *netdev, struct 
ethtool_coalesce *ec,
struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi;
 
+   if (ice_is_reset_in_progress(vsi->back->state))
+   return -EBUSY;
+
if (q_num < 0)
q_num = 0;
 
-- 
2.37.3

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [PATCH iwl-next] ice: Do not get coalesce settings while in reset

2023-12-05 Thread Przemek Kitszel

On 12/5/23 16:26, Pawel Chmielewski wrote:

From: Ngai-Mint Kwan 

Getting coalesce settings while reset is in progress can cause NULL
pointer deference bug.
If under reset, abort get coalesce for ethtool.

Signed-off-by: Ngai-Mint Kwan 
Reviewed-by: Mateusz Polchlopek 
Signed-off-by: Pawel Chmielewski 
---
  drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c 
b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index bde9bc74f928..2d565cc484a0 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3747,6 +3747,9 @@ __ice_get_coalesce(struct net_device *netdev, struct 
ethtool_coalesce *ec,
struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi;
  
+	if (ice_is_reset_in_progress(vsi->back->state))

+   return -EBUSY;
+
if (q_num < 0)
q_num = 0;
  


Sorry for a late review,
This asks for a Fixes: tag, and targeting at iwl-net instead :)
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [PATCH v3 iwl-next] i40e: Use correct buffer size in i40e_dbg_command_read

2023-12-05 Thread Kunwu Chan

Hi Alexander,
Thanks for your reply.

It's my bad, I'll follow your suggestion in v4 patch:
1. keep 'buf' as it defined before.
2. resolve memory leak as your suggestion.
3. make 'bytes_not_copied' as a return value for error path.

Thanks again,
Kunwu
On 2023/12/4 20:51, Alexander Lobakin wrote:

This is unneeded.

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [RFC PATCH] net: ethtool: do runtime PM outside RTNL

2023-12-05 Thread Marc MERLIN
On Mon, Dec 04, 2023 at 01:28:49PM -0800, Marc MERLIN wrote:
> sauron:~# iwconfig wlp9s0
> wlp9s0IEEE 802.11  ESSID:"magicnet"  
>   Mode:Managed  Frequency:5.2 GHz  Access Point: E0:63:DA:28:03:67   
>   Bit Rate=866.7 Mb/s   Tx-Power=22 dBm   
>   Retry short limit:7   RTS thr:off   Fragment thr:off
>   Encryption key:off
>   Power Management:off
>   Link Quality=70/70  Signal level=-40 dBm  
>   Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
>   Tx excessive retries:0  Invalid misc:992   Missed beacon:0
> 
> sauron:~# lspci | grep -i net
> 09:00.0 Network controller: Intel Corporation Wi-Fi 6 AX210/AX211/AX411 
> 160MHz (rev 1a)
> 0b:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-LM 
> (rev 03)

Probably not related and probably ok, but getting these bug workaround
messages:
[ 2448.505576] iwlwifi :09:00.0: Detected RF GF, rfid=0x10d000
[ 2448.578917] iwlwifi :09:00.0: base HW address: f4:4e:e3:fb:7f:93
[ 2448.601421] iwlwifi :09:00.0 wlp9s0: renamed from wlan0
[ 2448.695483] iwlwifi :09:00.0: WRT: Invalid buffer destination
[ 2448.863729] iwlwifi :09:00.0: WFPM_UMAC_PD_NOTIFICATION: 0x20
[ 2448.863785] iwlwifi :09:00.0: WFPM_LMAC2_PD_NOTIFICATION: 0x1f
[ 2448.863812] iwlwifi :09:00.0: WFPM_AUTH_KEY_0: 0x90
[ 2448.863837] iwlwifi :09:00.0: CNVI_SCU_SEQ_DATA_DW9: 0x0
[ 2448.971242] iwlwifi :09:00.0: Registered PHC clock: iwlwifi-PTP, with 
index: 1
[ 2449.063668] iwlwifi :09:00.0: WRT: Invalid buffer destination
[ 2449.232085] iwlwifi :09:00.0: WFPM_UMAC_PD_NOTIFICATION: 0x20
[ 2449.232143] iwlwifi :09:00.0: WFPM_LMAC2_PD_NOTIFICATION: 0x1f
[ 2449.232169] iwlwifi :09:00.0: WFPM_AUTH_KEY_0: 0x90
[ 2449.232188] iwlwifi :09:00.0: CNVI_SCU_SEQ_DATA_DW9: 0x0
[13323.572484] iwlwifi :09:00.0: TB bug workaround: copied 152 bytes from 
0xff68 to 0xfd08
[13328.000825] iwlwifi :09:00.0: TB bug workaround: copied 1272 bytes from 
0xfb08 to 0xff42c000
[13367.278564] iwlwifi :09:00.0: TB bug workaround: copied 1328 bytes from 
0xfad0 to 0xfec41000
[13389.737971] iwlwifi :09:00.0: TB bug workaround: copied 572 bytes from 
0xfdc4 to 0xff091000
[13389.860480] iwlwifi :09:00.0: TB bug workaround: copied 148 bytes from 
0xff6c to 0xfe412000
[13393.435354] iwlwifi :09:00.0: TB bug workaround: copied 360 bytes from 
0xfe98 to 0xfedcd000
[13409.827199] iwlwifi :09:00.0: TB bug workaround: copied 1348 bytes from 
0xfabc to 0xfd057000

The other good news is that it now shuts down ok, which is
understandable with the deadlock fixed.

The only thing I'm still seeing is this, I'm not too sure how avad it
is, or whether it's ok-ish.
I understand it's likely totally unrelated, although there are some
iwlwifi lines below if that's helpful
Otherwise, laptop is still working ok so far.

[ 1879.679720] pcieport :00:07.1: power state changed by ACPI to D0
[ 1879.679727] pcieport :00:07.1: ACPI _REG connect evaluation failed (5)
[ 1879.691616] pcieport :00:07.1: restore config 0x2c: 0x0064 -> 
0x0064
[ 1879.691624] pcieport :00:07.1: restore config 0x28: 0x0064 -> 
0x0064
[ 1879.691627] pcieport :00:07.1: restore config 0x24: 0x4bf13001 -> 
0x4bf13001
[ 1879.691959] pcieport :00:07.1: PME# disabled
[ 1879.691967] pcieport :00:07.1: pciehp: pciehp_check_link_active: 
lnk_status = 1001
[ 1879.803706] pcieport :00:07.0: power state changed by ACPI to D0
[ 1879.803714] pcieport :00:07.0: ACPI _REG connect evaluation failed (5)
[ 1879.815840] pcieport :00:07.1: save config 0x00: 0x9a2d8086
[ 1879.815847] pcieport :00:07.1: save config 0x04: 0x00100407
[ 1879.815849] pcieport :00:07.1: save config 0x08: 0x06040005
[ 1879.815851] pcieport :00:07.1: save config 0x0c: 0x0081
[ 1879.815852] pcieport :00:07.1: save config 0x10: 0x
[ 1879.815854] pcieport :00:07.1: save config 0x14: 0x
[ 1879.815856] pcieport :00:07.1: save config 0x18: 0x00795000
[ 1879.815858] pcieport :00:07.1: save config 0x1c: 0x6060
[ 1879.815859] pcieport :00:07.1: save config 0x20: 0x9e109200
[ 1879.815861] pcieport :00:07.1: save config 0x24: 0x4bf13001
[ 1879.815863] pcieport :00:07.1: save config 0x28: 0x0064
[ 1879.815864] pcieport :00:07.1: save config 0x2c: 0x0064
[ 1879.815866] pcieport :00:07.1: save config 0x30: 0x
[ 1879.815868] pcieport :00:07.1: save config 0x34: 0x0040
[ 1879.815869] pcieport :00:07.1: save config 0x38: 0x
[ 1879.815871] pcieport :00:07.1: save config 0x3c: 0x000202ff
[ 1879.815954] pcieport :00:07.1: PME# enabled
[ 1879.816250] pcieport :00:07.0: restore config 0x2c: 0x0064 -> 
0x0064
[ 1879.816253] pcieport :00:07.0: restore config 0x28: 0x0064 -> 
0x0064
[ 1879.816256] pcieport :00:07.0: restore config 0x24: 0x2bf11001 -> 
0x2bf11001

Re: [Intel-wired-lan] [PATCH iwl-next 2/2] ice: Add switch recipe reusing feature

2023-12-05 Thread Simon Horman
+ Ivan Vecera 

On Fri, Dec 01, 2023 at 02:25:02PM +0800, Steven Zou wrote:
> New E810 firmware supports the corresponding functionality, so the driver
> allows PFs to subscribe the same switch recipes. Then when the PF is done
> with a switch recipes, the PF can ask firmware to free that switch recipe.
> 
> When users configure a rule to PFn into E810 switch component, if there is
> no existing recipe matching this rule's pattern, the driver will request
> firmware to allocate and return a new recipe resource for the rule by
> calling ice_add_sw_recipe() and ice_alloc_recipe(). If there is an existing
> recipe matching this rule's pattern with different key value, or this is a
> same second rule to PFm into switch component, the driver checks out this
> recipe by calling ice_find_recp(), the driver will tell firmware to share
> using this same recipe resource by calling ice_subscribable_recp_shared()
> and ice_subscribe_recipe().
> 
> When firmware detects that all subscribing PFs have freed the switch
> recipe, firmware will free the switch recipe so that it can be reused.
> 
> This feature also fixes a problem where all switch recipes would eventually
> be exhausted because switch recipes could not be freed, as freeing a shared
> recipe could potentially break other PFs that were using it.
> 
> Reviewed-by: Przemek Kitszel 
> Reviewed-by: Andrii Staikov 
> Signed-off-by: Steven Zou 

Hi Ivan,

with my upstream hat on, I'd be most grateful if you could review this.

> ---
>  .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   2 +
>  drivers/net/ethernet/intel/ice/ice_common.c   |   2 +
>  drivers/net/ethernet/intel/ice/ice_switch.c   | 187 --
>  drivers/net/ethernet/intel/ice/ice_switch.h   |   1 +
>  drivers/net/ethernet/intel/ice/ice_type.h |   2 +
>  5 files changed, 177 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h 
> b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> index c2b3ccce3124..2654aaad9a51 100644
> --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
> @@ -264,6 +264,8 @@ struct ice_aqc_set_port_params {
>  #define ICE_AQC_RES_TYPE_FLAG_SHARED BIT(7)
>  #define ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOMBIT(12)
>  #define ICE_AQC_RES_TYPE_FLAG_IGNORE_INDEX   BIT(13)
> +#define ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_SHARED   BIT(14)
> +#define ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_CTL  BIT(15)
>  
>  #define ICE_AQC_RES_TYPE_FLAG_DEDICATED  0x00
>  
> diff --git a/drivers/net/ethernet/intel/ice/ice_common.c 
> b/drivers/net/ethernet/intel/ice/ice_common.c
> index 8df151dd0c90..5bfec6bb759b 100644
> --- a/drivers/net/ethernet/intel/ice/ice_common.c
> +++ b/drivers/net/ethernet/intel/ice/ice_common.c
> @@ -1321,6 +1321,8 @@ int ice_init_hw(struct ice_hw *hw)
>   if (status)
>   goto err_unroll_fltr_mgmt_struct;
>   mutex_init(&hw->tnl_lock);
> + ice_init_chk_recipe_reuse_support(hw);
> +
>   return 0;
>  
>  err_unroll_fltr_mgmt_struct:
> diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c 
> b/drivers/net/ethernet/intel/ice/ice_switch.c
> index 3cee603b187f..b926c045ebec 100644
> --- a/drivers/net/ethernet/intel/ice/ice_switch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_switch.c
> @@ -2074,6 +2074,18 @@ ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 
> profile_id, u64 *r_assoc,
>   return status;
>  }
>  
> +/**
> + * ice_init_chk_recipe_reuse_support - check if recipe reuse is supported
> + * @hw: pointer to the hardware structure
> + */
> +void ice_init_chk_recipe_reuse_support(struct ice_hw *hw)
> +{
> + struct ice_nvm_info *nvm = &hw->flash.nvm;
> +
> + hw->recp_reuse = (nvm->major == 0x4 && nvm->minor >= 0x30) ||
> +  nvm->major > 0x4;
> +}
> +
>  /**
>   * ice_alloc_recipe - add recipe resource
>   * @hw: pointer to the hardware structure
> @@ -2083,12 +2095,16 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
>  {
>   DEFINE_FLEX(struct ice_aqc_alloc_free_res_elem, sw_buf, elem, 1);
>   u16 buf_len = __struct_size(sw_buf);
> + u16 res_type;
>   int status;
>  
>   sw_buf->num_elems = cpu_to_le16(1);
> - sw_buf->res_type = cpu_to_le16((ICE_AQC_RES_TYPE_RECIPE <<
> - ICE_AQC_RES_TYPE_S) |
> - ICE_AQC_RES_TYPE_FLAG_SHARED);
> + res_type = FIELD_PREP(ICE_AQC_RES_TYPE_M, ICE_AQC_RES_TYPE_RECIPE);
> + if (hw->recp_reuse)
> + res_type |= ICE_AQC_RES_TYPE_FLAG_SUBSCRIBE_SHARED;
> + else
> + res_type |= ICE_AQC_RES_TYPE_FLAG_SHARED;
> + sw_buf->res_type = cpu_to_le16(res_type);
>   status = ice_aq_alloc_free_res(hw, sw_buf, buf_len,
>  ice_aqc_opc_alloc_res);
>   if (!status)
> @@ -2097,6 +2113,70 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
>   return sta

Re: [Intel-wired-lan] [PATCH iwl-next 1/2] ice: Refactor FW data type and fix bitmap casting issue

2023-12-05 Thread Simon Horman
On Fri, Dec 01, 2023 at 02:25:01PM +0800, Steven Zou wrote:
> According to the datasheet, the recipe association data is an 8-byte
> little-endian value. It is described as 'Bitmap of the recipe indexes
> associated with this profile', it is from 24 to 31 byte area in FW.
> Therefore, it is defined to '__le64 recipe_assoc' in struct
> ice_aqc_recipe_to_profile. And then fix the bitmap casting issue, as we
> must never ever use castings for bitmap type.
> 
> Reviewed-by: Przemek Kitszel 
> Reviewed-by: Andrii Staikov 
> Reviewed-by: Jan Sokolowski 
> Signed-off-by: Steven Zou 

Reviewed-by: Simon Horman 
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [RFC PATCH] net: ethtool: do runtime PM outside RTNL

2023-12-05 Thread Johannes Berg
On Mon, 2023-12-04 at 18:46 -0800, Marc MERLIN wrote:
> 
> [13323.572484] iwlwifi :09:00.0: TB bug workaround: copied 152 bytes from 
> 0xff68 to 0xfd08
> [13328.000825] iwlwifi :09:00.0: TB bug workaround: copied 1272 bytes 
> from 0xfb08 to 0xff42c000
> [13367.278564] iwlwifi :09:00.0: TB bug workaround: copied 1328 bytes 
> from 0xfad0 to 0xfec41000
> [13389.737971] iwlwifi :09:00.0: TB bug workaround: copied 572 bytes from 
> 0xfdc4 to 0xff091000
> [13389.860480] iwlwifi :09:00.0: TB bug workaround: copied 148 bytes from 
> 0xff6c to 0xfe412000
> [13393.435354] iwlwifi :09:00.0: TB bug workaround: copied 360 bytes from 
> 0xfe98 to 0xfedcd000
> [13409.827199] iwlwifi :09:00.0: TB bug workaround: copied 1348 bytes 
> from 0xfabc to 0xfd057000

That's fine, just working around a HW bug on 2^32 address boundaries.

I had a patch a long time ago to make those messages not appear ... not
sure where it ended up.

johannes
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [RFC PATCH] net: ethtool: do runtime PM outside RTNL

2023-12-05 Thread Johannes Berg
On Tue, 2023-12-05 at 06:19 +0100, Przemek Kitszel wrote:
> On 12/4/23 20:07, Johannes Berg wrote:
> > From: Johannes Berg 
> > 
> > As reported by Marc MERLIN in [1], at least one driver (igc)
> 
> perhaps Reported-by tag? (I know this is RFC as of now)

I guess.

> > wants/needs to acquire the RTNL inside suspend/resume ops,
> > which can be called from here in ethtool if runtime PM is
> > enabled.
> > 
> > [1] https://lore.kernel.org/r/20231202221402.ga11...@merlins.org
> > 
> > Allow this by doing runtime PM transitions without the RTNL
> > held. For the ioctl to have the same operations order, this
> > required reworking the code to separately check validity and
> > do the operation. For the netlink code, this now has to do
> > the runtime_pm_put a bit later.
> > 
> > Signed-off-by: Johannes Berg 
> > ---
> >   net/ethtool/ioctl.c   | 71 ++-
> >   net/ethtool/netlink.c | 32 ---
> >   2 files changed, 56 insertions(+), 47 deletions(-)
> > 
> Thank you for the patch,
> 
> I like the idea of split into validate + do for dev_ethtool(),
> what minimizes unneeded PM touching. Moving pm_runtime_get_sync() out of 
> RTNL is also a great improvement per se. Also from the pure coding 
> perspective I see no obvious flaws in the patch. I think that igc code
> was just accidental to the issue, in a way that it was not deliberate to
> hold RTNL for extended periods.

Well Jakub was arguing igc shouldn't be taking rtnl in suspend/resume,
maybe, but dunno.

> With your patch fixing the bug, there is
> no point with waiting IMO, so
> 
> Reviewed-by: Przemek Kitszel 

Well, according to the checks, the patch really should use
netdev_get_by_name() and netdev_put()? But I don't know how to do that
on short-term stack thing ... maybe it doesn't have to?

johannes
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [PATCH net] ice: fix theoretical out-of-bounds access in ethtool link modes

2023-12-05 Thread Simon Horman
On Fri, Dec 01, 2023 at 08:33:36AM +0100, Przemek Kitszel wrote:
> On 11/30/23 17:58, Michal Schmidt wrote:
> > To map phy types reported by the hardware to ethtool link mode bits,
> > ice uses two lookup tables (phy_type_low_lkup, phy_type_high_lkup).
> > The "low" table has 64 elements to cover every possible bit the hardware
> > may report, but the "high" table has only 13. If the hardware reports a
> > higher bit in phy_types_high, the driver would access memory beyond the
> > lookup table's end.
> > 
> > Instead of iterating through all 64 bits of phy_types_{low,high}, use
> > the sizes of the respective lookup tables.
> > 
> > Fixes: 9136e1f1e5c3 ("ice: refactor PHY type to ethtool link mode")
> > Signed-off-by: Michal Schmidt 
> > ---
> >   drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c 
> > b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> > index a34083567e6f..bde9bc74f928 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> > @@ -1850,14 +1850,14 @@ ice_phy_type_to_ethtool(struct net_device *netdev,
> > linkmode_zero(ks->link_modes.supported);
> > linkmode_zero(ks->link_modes.advertising);
> > -   for (i = 0; i < BITS_PER_TYPE(u64); i++) {
> > +   for (i = 0; i < ARRAY_SIZE(phy_type_low_lkup); i++) {
> > if (phy_types_low & BIT_ULL(i))
> > ice_linkmode_set_bit(&phy_type_low_lkup[i], ks,
> >  req_speeds, advert_phy_type_lo,
> >  i);
> > }
> > -   for (i = 0; i < BITS_PER_TYPE(u64); i++) {
> > +   for (i = 0; i < ARRAY_SIZE(phy_type_high_lkup); i++) {
> > if (phy_types_high & BIT_ULL(i))
> > ice_linkmode_set_bit(&phy_type_high_lkup[i], ks,
> >  req_speeds, advert_phy_type_hi,
> 
> I guess that that "HW reported" number really goes through the FW in
> some way, so one could indeed spoil that in some way,
> what makes sense to target it at -net.
> 
> Reviewed-by: Przemek Kitszel 

Reviewed-by: Simon Horman 

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [PATCH iwl-net] i40e: Fix wrong mask used during DCB config

2023-12-05 Thread Simon Horman
On Thu, Nov 30, 2023 at 08:31:34PM +0100, Ivan Vecera wrote:
> Mask used for clearing PRTDCB_RETSTCC register in function
> i40e_dcb_hw_rx_ets_bw_config() is incorrect as there is used
> define I40E_PRTDCB_RETSTCC_ETSTC_SHIFT instead of define
> I40E_PRTDCB_RETSTCC_ETSTC_MASK.
> 
> The PRTDCB_RETSTCC register is used to configure whether ETS
> or strict priority is used as TSA in Rx for particular TC.
> 
> In practice it means that once the register is set to use ETS
> as TSA then it is not possible to switch back to strict priority
> without CoreR reset.
> 
> Fix the value in the clearing mask.
> 
> Fixes: 90bc8e003be2 ("i40e: Add hardware configuration for software based 
> DCB")
> Signed-off-by: Ivan Vecera 

Reviewed-by: Simon Horman 
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


Re: [Intel-wired-lan] [PATCH iwl-next 1/2] ice: Remove unnecessary argument from ice_fdir_comp_rules()

2023-12-05 Thread Tony Nguyen



On 11/29/2023 9:55 PM, Lukasz Plachno wrote:

Passing v6 argument is unnecessary as flow_type is still
analyzed inside the function.

Reviewed-by: Przemek Kitszel 
Signed-off-by: Lukasz Plachno 


This doesn't build cleanly.

../drivers/net/ethernet/intel/ice/ice_fdir.c: In function 
‘ice_fdir_comp_rules’:
../drivers/net/ethernet/intel/ice/ice_fdir.c:1203:2: warning: 
enumeration value ‘ICE_FLTR_PTYPE_NONF_NONE’ not handled in switch 
[-Wswitch]

  switch (flow_type) {
  ^~
../drivers/net/ethernet/intel/ice/ice_fdir.c:1203:2: warning: 
enumeration value ‘ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP’ not handled 
in switch [-Wswitch]
../drivers/net/ethernet/intel/ice/ice_fdir.c:1203:2: warning: 
enumeration value ‘ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP’ not handled 
in switch [-Wswitch]
../drivers/net/ethernet/intel/ice/ice_fdir.c:1203:2: warning: 
enumeration value ‘ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP’ not handled 
in switch [-Wswitch]
../drivers/net/ethernet/intel/ice/ice_fdir.c:1203:2: warning: 
enumeration value ‘ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER’ not handled 
in switch [-Wswitch]
../drivers/net/ethernet/intel/ice/ice_fdir.c:1203:2: warning: 
enumeration value ‘ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER’ not handled 
in switch [-Wswitch]

...
___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH net-next v7 0/8] Support symmetric-xor RSS hash

2023-12-05 Thread Ahmed Zaki
Patches 1 and 2 modify the get/set_rxh ethtool API to take a pointer to 
struct of parameters instead of individual params. This will allow future
changes to the uAPI-shared struct ethtool_rxfh without changing the
drivers' API.

Patch 3 adds the support at the Kernel level, allowing the user to set a
symmetric-xor RSS hash for a netdevice via:

# ethtool -X eth0 hfunc toeplitz symmetric-xor

and clears the flag via:

# ethtool -X eth0 hfunc toeplitz

The "symmetric-xor" is set in a new "input_xfrm" field in struct
ethtool_rxfh. Support for the new "symmetric-xor" flag will be later sent
to the "ethtool" user-space tool.

Patch 4 fixes a long standing bug with the ice hash function register
values. The bug has been benign for now since only (asymmetric) Toeplitz
hash (Zero) has been used.

Patches 5 and 6 lay some groundwork refactoring. While the first is
mainly cosmetic, the second is needed since there is no more room in the
previous 64-bit RSS profile ID for the symmetric attribute introduced in 
the next patch.

Finally, patches 7 and 8 add the symmetric-xor support for the ice 
(E800 PFs) and the iAVF drivers.

---
v7: - Use new struct ethtool_rxfh_params to pass arguments to set/get_rxfh
- Remove get/set_rxfh_context functions and use a new capability to 
  indicate RSS context support (cap_rss_ctx_supported).
- Move the sanity checks on the rxnfc fields when symmetric-xor is set
  back to core.
- Add a new capability (cap_rss_sym_xor_supported) to indicate
  symmetric-xor support. Core returns -ENOTSUPP if the driver does not
  support symmetric-xor.
- Rename the new struct ethtool_rxfh field to "input_xfrm" and
  update "Documentation/networking/ethtool-netlink.rst" and 
  "Documentation/netlink/specs/ethtool.yaml".
- Add a comment on potential vulnerability of symmetric-xor in
  include/uapi/linux/ethtool.h.

v6: switch user interface to "ethtool -X" (ethtool_rxfh) instead of
"ethtool -N". Patch (1) is added to allow new params in the get/set_rxh
ethtool API. Doc is updated in "Documentation/networking/scaling.rst"
to specify how the "symmetric-xor" manipulates the input fields.

https://lore.kernel.org/netdev/20231120205614.46350-2-ahmed.z...@intel.com/T/

v5: move sanity checks from ethtool/ioctl.c to ice's and iavf's rxfnc
drivers entries (patches 5 and 6).

https://lore.kernel.org/netdev/20231018170635.65409-2-ahmed.z...@intel.com/T/

v4: add a comment to "#define RXH_SYMMETRIC_XOR" (in uapi/linux/ethtool.h)

https://lore.kernel.org/netdev/20231016154937.41224-1-ahmed.z...@intel.com/T/

v3: rename "symmetric" to "symmetric-xor" and drop "Fixes" tag in patch 2.
v2: fixed a "Reviewed by" to "Reviewed-by", also need to cc maintainers.

Ahmed Zaki (6):
  net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops
  net: ethtool: get rid of get/set_rxfh_context functions
  net: ethtool: add support for symmetric-xor RSS hash
  ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values
  ice: refactor the FD and RSS flow ID generation
  iavf: enable symmetric-xor RSS for Toeplitz hash function

Jeff Guo (1):
  ice: enable symmetric-xor RSS for Toeplitz hash function

Qi Zhang (1):
  ice: refactor RSS configuration

 Documentation/netlink/specs/ethtool.yaml  |   4 +
 Documentation/networking/ethtool-netlink.rst  |   6 +-
 Documentation/networking/scaling.rst  |  15 +
 drivers/net/ethernet/amazon/ena/ena_ethtool.c |  28 +-
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c  |  33 +-
 .../ethernet/aquantia/atlantic/aq_ethtool.c   |  31 +-
 .../ethernet/broadcom/bnx2x/bnx2x_ethtool.c   |  25 +-
 .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c |  28 +-
 drivers/net/ethernet/broadcom/tg3.c   |  22 +-
 .../ethernet/cavium/thunder/nicvf_ethtool.c   |  31 +-
 .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c|  24 +-
 .../net/ethernet/cisco/enic/enic_ethtool.c|  25 +-
 .../net/ethernet/emulex/benet/be_ethtool.c|  28 +-
 .../ethernet/freescale/enetc/enetc_ethtool.c  |  31 +-
 .../ethernet/fungible/funeth/funeth_ethtool.c |  40 +-
 .../net/ethernet/hisilicon/hns/hns_ethtool.c  |  17 +-
 .../ethernet/hisilicon/hns3/hns3_ethtool.c|  23 +-
 .../net/ethernet/huawei/hinic/hinic_ethtool.c |  40 +-
 .../net/ethernet/intel/fm10k/fm10k_ethtool.c  |  26 +-
 .../net/ethernet/intel/i40e/i40e_ethtool.c|  38 +-
 drivers/net/ethernet/intel/iavf/iavf.h|   5 +-
 .../net/ethernet/intel/iavf/iavf_adv_rss.c|   8 +-
 .../net/ethernet/intel/iavf/iavf_adv_rss.h|   3 +-
 .../net/ethernet/intel/iavf/iavf_ethtool.c|  74 ++-
 drivers/net/ethernet/intel/iavf/iavf_main.c   |   4 +
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  41 ++
 drivers/net/ethernet/intel/ice/ice.h  |   2 +
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |   8 +-
 drivers/net/ethernet/intel/ice/ice_common.h   |   1 +
 drivers/net/ethernet/intel/ice/ice_ethtool.c  | 102 ++--
 .../net/ethernet/intel/ice/ice_ethtool_fdir.c |  35 +-

[Intel-wired-lan] [PATCH net-next v7 2/8] net: ethtool: get rid of get/set_rxfh_context functions

2023-12-05 Thread Ahmed Zaki
Add the RSS context parameters to struct ethtool_rxfh_param and use the
get/set_rxfh to handle the RSS contexts as well.

This is part 2/2 of the fix suggested in [1]:

 - Add a rss_context member to the argument struct and a capability
   like cap_link_lanes_supported to indicate whether driver supports
   rss contexts, then you can remove *et_rxfh_context functions,
   and instead call *et_rxfh() with a non-zero rss_context.

Link: https://lore.kernel.org/netdev/20231121152906.2dd5f...@kernel.org/ [1]
CC: Jesse Brandeburg 
CC: Tony Nguyen 
CC: Marcin Wojtas 
CC: Russell King 
CC: Sunil Goutham 
CC: Geetha sowjanya 
CC: Subbaraya Sundeep 
CC: hariprasad 
CC: Saeed Mahameed 
CC: Leon Romanovsky 
CC: Edward Cree 
CC: Martin Habets 
Suggested-by: Jakub Kicinski 
Signed-off-by: Ahmed Zaki 
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |  25 ++--
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  63 +++---
 .../marvell/octeontx2/nic/otx2_ethtool.c  |  63 --
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  37 ++
 drivers/net/ethernet/sfc/ef100_ethtool.c  |   3 +-
 drivers/net/ethernet/sfc/ethtool.c|   3 +-
 drivers/net/ethernet/sfc/ethtool_common.c | 115 +-
 drivers/net/ethernet/sfc/ethtool_common.h |   6 -
 drivers/net/ethernet/sfc/siena/ethtool.c  |   3 +-
 .../net/ethernet/sfc/siena/ethtool_common.c   | 115 +-
 .../net/ethernet/sfc/siena/ethtool_common.h   |   6 -
 include/linux/ethtool.h   |  18 +--
 include/uapi/linux/ethtool.h  |   8 ++
 net/ethtool/ioctl.c   |  27 ++--
 net/ethtool/rss.c |   9 +-
 15 files changed, 201 insertions(+), 300 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c 
b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 7f991715a026..3a4edde28c13 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -3198,11 +3198,18 @@ static u32 ice_get_rxfh_indir_size(struct net_device 
*netdev)
return np->vsi->rss_table_size;
 }
 
+/**
+ * ice_get_rxfh - get the Rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @rxfh: pointer to param struct (indir, key, hfunc)
+ *
+ * Reads the indirection table directly from the hardware.
+ */
 static int
-ice_get_rxfh_context(struct net_device *netdev,
-struct ethtool_rxfh_param *rxfh, u32 rss_context)
+ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
 {
struct ice_netdev_priv *np = netdev_priv(netdev);
+   u32 rss_context = rxfh->rss_context;
struct ice_vsi *vsi = np->vsi;
struct ice_pf *pf = vsi->back;
u16 qcount, offset;
@@ -3264,19 +3271,6 @@ ice_get_rxfh_context(struct net_device *netdev,
return err;
 }
 
-/**
- * ice_get_rxfh - get the Rx flow hash indirection table
- * @netdev: network interface device structure
- * @rxfh: pointer to param struct (indir, key, hfunc)
- *
- * Reads the indirection table directly from the hardware.
- */
-static int
-ice_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rxfh)
-{
-   return ice_get_rxfh_context(netdev, rxfh, 0);
-}
-
 /**
  * ice_set_rxfh - set the Rx flow hash indirection table
  * @netdev: network interface device structure
@@ -4251,7 +4245,6 @@ static const struct ethtool_ops ice_ethtool_ops = {
.set_pauseparam = ice_set_pauseparam,
.get_rxfh_key_size  = ice_get_rxfh_key_size,
.get_rxfh_indir_size= ice_get_rxfh_indir_size,
-   .get_rxfh_context   = ice_get_rxfh_context,
.get_rxfh   = ice_get_rxfh,
.set_rxfh   = ice_set_rxfh,
.get_channels   = ice_get_channels,
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c 
b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index ceef48ddd26e..c0101ceb45d6 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5638,47 +5638,7 @@ static int mvpp2_ethtool_get_rxfh(struct net_device *dev,
  struct ethtool_rxfh_param *rxfh)
 {
struct mvpp2_port *port = netdev_priv(dev);
-   int ret = 0;
-
-   if (!mvpp22_rss_is_supported(port))
-   return -EOPNOTSUPP;
-
-   if (rxfh->indir)
-   ret = mvpp22_port_rss_ctx_indir_get(port, 0, rxfh->indir);
-
-   rxfh->hfunc = ETH_RSS_HASH_CRC32;
-
-   return ret;
-}
-
-static int mvpp2_ethtool_set_rxfh(struct net_device *dev,
- struct ethtool_rxfh_param *rxfh,
- struct netlink_ext_ack *extack)
-{
-   struct mvpp2_port *port = netdev_priv(dev);
-   int ret = 0;
-
-   if (!mvpp22_rss_is_supported(port))
-   return -EOPNOTSUPP;
-
-   if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
-   rxfh->hfunc != ETH_

[Intel-wired-lan] [PATCH net-next v7 3/8] net: ethtool: add support for symmetric-xor RSS hash

2023-12-05 Thread Ahmed Zaki
Symmetric RSS hash functions are beneficial in applications that monitor
both Tx and Rx packets of the same flow (IDS, software firewalls, ..etc).
Getting all traffic of the same flow on the same RX queue results in
higher CPU cache efficiency.

A NIC that supports "symmetric-xor" can achieve this RSS hash symmetry
by XORing the source and destination fields and pass the values to the
RSS hash algorithm.

The user may request RSS hash symmetry for a specific algorithm, via:

# ethtool -X eth0 hfunc  symmetric-xor

or turn symmetry off (asymmetric) by:

# ethtool -X eth0 hfunc 

The specific fields for each flow type should then be specified as usual
via:
# ethtool -N|-U eth0 rx-flow-hash  s|d|f|n

Reviewed-by: Wojciech Drewek 
Signed-off-by: Ahmed Zaki 
---
 Documentation/netlink/specs/ethtool.yaml |  4 +++
 Documentation/networking/ethtool-netlink.rst |  6 +++-
 Documentation/networking/scaling.rst | 15 ++
 include/linux/ethtool.h  |  3 ++
 include/uapi/linux/ethtool.h | 16 ++-
 include/uapi/linux/ethtool_netlink.h |  1 +
 net/ethtool/ioctl.c  | 30 +---
 net/ethtool/rss.c|  5 
 8 files changed, 74 insertions(+), 6 deletions(-)

diff --git a/Documentation/netlink/specs/ethtool.yaml 
b/Documentation/netlink/specs/ethtool.yaml
index 5c7a65b009b4..197208f419dc 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -908,6 +908,9 @@ attribute-sets:
   -
 name: hkey
 type: binary
+  -
+name: input_xfrm
+type: u32
   -
 name: plca
 attributes:
@@ -1598,6 +1601,7 @@ operations:
 - hfunc
 - indir
 - hkey
+- input_xfrm
   dump: *rss-get-op
 -
   name: plca-get-cfg
diff --git a/Documentation/networking/ethtool-netlink.rst 
b/Documentation/networking/ethtool-netlink.rst
index 6a49624a9cbf..d583d9abf2f8 100644
--- a/Documentation/networking/ethtool-netlink.rst
+++ b/Documentation/networking/ethtool-netlink.rst
@@ -1774,12 +1774,16 @@ Kernel response contents:
   ``ETHTOOL_A_RSS_HFUNC``  u32 RSS hash func
   ``ETHTOOL_A_RSS_INDIR``  binary  Indir table bytes
   ``ETHTOOL_A_RSS_HKEY``   binary  Hash key bytes
+  ``ETHTOOL_A_RSS_INPUT_XFRM`` u32 RSS input data transformation
 =  ==  ==
 
 ETHTOOL_A_RSS_HFUNC attribute is bitmap indicating the hash function
 being used. Current supported options are toeplitz, xor or crc32.
-ETHTOOL_A_RSS_INDIR attribute returns RSS indrection table where each byte
+ETHTOOL_A_RSS_INDIR attribute returns RSS indirection table where each byte
 indicates queue number.
+ETHTOOL_A_RSS_INPUT_XFRM attribute is a bitmap indicating the type of
+transformation applied to the input protocol fields before given to the RSS
+hfunc. Current supported option is symmetric-xor.
 
 PLCA_GET_CFG
 
diff --git a/Documentation/networking/scaling.rst 
b/Documentation/networking/scaling.rst
index 03ae19a689fc..4eb50bcb9d42 100644
--- a/Documentation/networking/scaling.rst
+++ b/Documentation/networking/scaling.rst
@@ -44,6 +44,21 @@ by masking out the low order seven bits of the computed hash 
for the
 packet (usually a Toeplitz hash), taking this number as a key into the
 indirection table and reading the corresponding value.
 
+Some NICs support symmetric RSS hashing where, if the IP (source address,
+destination address) and TCP/UDP (source port, destination port) tuples
+are swapped, the computed hash is the same. This is beneficial in some
+applications that monitor TCP/IP flows (IDS, firewalls, ...etc) and need
+both directions of the flow to land on the same Rx queue (and CPU). The
+"Symmetric-XOR" is a type of RSS algorithms that achieves this hash
+symmetry by XORing the input source and destination fields of the IP
+and/or L4 protocols. This, however, results in reduced input entropy and
+could potentially be exploited. Specifically, the algorithm XORs the input
+as follows::
+
+# (SRC_IP ^ DST_IP, SRC_IP ^ DST_IP, SRC_PORT ^ DST_PORT, SRC_PORT ^ 
DST_PORT)
+
+The result is then fed to the underlying RSS algorithm.
+
 Some advanced NICs allow steering packets to queues based on
 programmable filters. For example, webserver bound TCP port 80 packets
 can be directed to their own receive queue. Such “n-tuple” filters can
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c33be0d0f8cd..0fd5e35b441a 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -600,6 +600,8 @@ struct ethtool_mm_stats {
  * parameter.
  * @cap_rss_ctx_supported: indicates if the driver supports RSS
  * contexts.
+ * @cap_rss_sym_xor_supported: indicates if the driver supports symmetric-xor
+ * RSS.
  * @supported_coalesce_params: supported types of inte

[Intel-wired-lan] [PATCH net-next v7 4/8] ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values

2023-12-05 Thread Ahmed Zaki
Fix the values of the ICE_AQ_VSI_Q_OPT_RSS_* registers. Shifting is
already done when the values are used, no need to double shift. Bug was
not discovered earlier since only ICE_AQ_VSI_Q_OPT_RSS_TPLZ (Zero) is
currently used.

Also, rename ICE_AQ_VSI_Q_OPT_RSS_XXX to ICE_AQ_VSI_Q_OPT_RSS_HASH_XXX
for consistency.

Co-developed-by: Jesse Brandeburg 
Signed-off-by: Jesse Brandeburg 
Reviewed-by: Wojciech Drewek 
Signed-off-by: Ahmed Zaki 
---
 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h |  8 
 drivers/net/ethernet/intel/ice/ice_lib.c|  4 ++--
 drivers/net/ethernet/intel/ice/ice_virtchnl.c   | 12 +---
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h 
b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index f77a3c70f262..adf7a5c78f85 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -492,10 +492,10 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << 
ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S6
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_M(0x3 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_TPLZ  (0x0 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ  (0x1 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_XOR   (0x2 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_JHASH (0x3 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ 0x0U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ 0x1U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR  0x2U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_JHASH0x3U
u8 q_opt_tc;
 #define ICE_AQ_VSI_Q_OPT_TC_OVR_S  0
 #define ICE_AQ_VSI_Q_OPT_TC_OVR_M  (0x1F << 
ICE_AQ_VSI_Q_OPT_TC_OVR_S)
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c 
b/drivers/net/ethernet/intel/ice/ice_lib.c
index 626577c7d5b2..bb6151e798e4 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1191,12 +1191,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx 
*ctxt, struct ice_vsi *vsi)
case ICE_VSI_PF:
/* PF VSI will inherit RSS instance of PF */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF;
-   hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+   hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
break;
case ICE_VSI_VF:
/* VF VSI will gets a small RSS table which is a VSI LUT type */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
-   hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+   hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
break;
default:
dev_dbg(dev, "Unsupported VSI type %s\n",
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c 
b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
index de11b3186bd7..6915a97fd0ed 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
@@ -823,8 +823,8 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 
*msg, bool add)
int status;
 
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
-   hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_XOR :
-   ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+   hash_type = add ? ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR :
+   ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
 
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx) {
@@ -832,11 +832,9 @@ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 
*msg, bool add)
goto error_param;
}
 
-   ctx->info.q_opt_rss = ((lut_type <<
-   ICE_AQ_VSI_Q_OPT_RSS_LUT_S) &
-  ICE_AQ_VSI_Q_OPT_RSS_LUT_M) |
-  (hash_type &
-   ICE_AQ_VSI_Q_OPT_RSS_HASH_M);
+   ctx->info.q_opt_rss =
+   FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_LUT_M, lut_type) |
+   FIELD_PREP(ICE_AQ_VSI_Q_OPT_RSS_HASH_M, hash_type);
 
/* Preserve existing queueing option setting */
ctx->info.q_opt_rss |= (vsi->info.q_opt_rss &
-- 
2.34.1

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH net-next v7 5/8] ice: refactor RSS configuration

2023-12-05 Thread Ahmed Zaki
From: Qi Zhang 

Refactor the driver to use a communication data structure for RSS
config. To do so we introduce the new ice_rss_hash_cfg struct, and then
pass it as an argument to several functions.

Also introduce enum ice_rss_cfg_hdr_type to specify a more granular and
flexible RSS configuration:

ICE_RSS_OUTER_HEADERS - take outer layer as RSS input set
ICE_RSS_INNER_HEADERS - take inner layer as RSS input set
ICE_RSS_INNER_HEADERS_W_OUTER_IPV4 - take inner layer as RSS input set for
 packet with outer IPV4
ICE_RSS_INNER_HEADERS_W_OUTER_IPV6 - take inner layer as RSS input set for
 packet with outer IPV6
ICE_RSS_ANY_HEADERS - try with outer first then inner (same as the
  behaviour without this change)

Finally, move the virtchnl_rss_algorithm enum to be with the other RSS
related structures in the virtchnl.h file.

There should be no functional change due to this patch.

Reviewed-by: Wojciech Drewek 
Signed-off-by: Qi Zhang 
Co-developed-by: Jesse Brandeburg 
Signed-off-by: Jesse Brandeburg 
Co-developed-by: Ahmed Zaki 
Signed-off-by: Ahmed Zaki 
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |   6 +-
 drivers/net/ethernet/intel/ice/ice_flow.c | 232 +++---
 drivers/net/ethernet/intel/ice/ice_flow.h |  33 ++-
 drivers/net/ethernet/intel/ice/ice_lib.c  | 100 +++-
 drivers/net/ethernet/intel/ice/ice_virtchnl.c |  36 +--
 include/linux/avf/virtchnl.h  |  16 +-
 6 files changed, 246 insertions(+), 177 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c 
b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 3a4edde28c13..06a3a31d8691 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2594,6 +2594,7 @@ static int
 ice_set_rss_hash_opt(struct ice_vsi *vsi, struct ethtool_rxnfc *nfc)
 {
struct ice_pf *pf = vsi->back;
+   struct ice_rss_hash_cfg cfg;
struct device *dev;
u64 hashed_flds;
int status;
@@ -2620,7 +2621,10 @@ ice_set_rss_hash_opt(struct ice_vsi *vsi, struct 
ethtool_rxnfc *nfc)
return -EINVAL;
}
 
-   status = ice_add_rss_cfg(&pf->hw, vsi->idx, hashed_flds, hdrs);
+   cfg.hash_flds = hashed_flds;
+   cfg.addl_hdrs = hdrs;
+   cfg.hdr_type = ICE_RSS_ANY_HEADERS;
+   status = ice_add_rss_cfg(&pf->hw, vsi->idx, &cfg);
if (status) {
dev_dbg(dev, "ice_add_rss_cfg failed, vsi num = %d, error = 
%d\n",
vsi->vsi_num, status);
diff --git a/drivers/net/ethernet/intel/ice/ice_flow.c 
b/drivers/net/ethernet/intel/ice/ice_flow.c
index fb8b925aaf8b..c34be72f99b3 100644
--- a/drivers/net/ethernet/intel/ice/ice_flow.c
+++ b/drivers/net/ethernet/intel/ice/ice_flow.c
@@ -1855,37 +1855,49 @@ int ice_flow_rem_vsi_prof(struct ice_hw *hw, u16 
vsi_handle, u64 prof_id)
 /**
  * ice_flow_set_rss_seg_info - setup packet segments for RSS
  * @segs: pointer to the flow field segment(s)
- * @hash_fields: fields to be hashed on for the segment(s)
- * @flow_hdr: protocol header fields within a packet segment
+ * @seg_cnt: segment count
+ * @cfg: configure parameters
  *
  * Helper function to extract fields from hash bitmap and use flow
  * header value to set flow field segment for further use in flow
  * profile entry or removal.
  */
 static int
-ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u64 hash_fields,
- u32 flow_hdr)
+ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u8 seg_cnt,
+ const struct ice_rss_hash_cfg *cfg)
 {
+   struct ice_flow_seg_info *seg;
u64 val;
-   u8 i;
+   u16 i;
+
+   /* set inner most segment */
+   seg = &segs[seg_cnt - 1];
 
-   for_each_set_bit(i, (unsigned long *)&hash_fields,
-ICE_FLOW_FIELD_IDX_MAX)
-   ice_flow_set_fld(segs, (enum ice_flow_field)i,
+   for_each_set_bit(i, (const unsigned long *)&cfg->hash_flds,
+(u16)ICE_FLOW_FIELD_IDX_MAX)
+   ice_flow_set_fld(seg, (enum ice_flow_field)i,
 ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL,
 ICE_FLOW_FLD_OFF_INVAL, false);
 
-   ICE_FLOW_SET_HDRS(segs, flow_hdr);
+   ICE_FLOW_SET_HDRS(seg, cfg->addl_hdrs);
 
-   if (segs->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS &
+   /* set outer most header */
+   if (cfg->hdr_type == ICE_RSS_INNER_HEADERS_W_OUTER_IPV4)
+   segs[ICE_RSS_OUTER_HEADERS].hdrs |= ICE_FLOW_SEG_HDR_IPV4 |
+   ICE_FLOW_SEG_HDR_IPV_OTHER;
+   else if (cfg->hdr_type == ICE_RSS_INNER_HEADERS_W_OUTER_IPV6)
+   segs[ICE_RSS_OUTER_HEADERS].hdrs |= ICE_FLOW_SEG_HDR_IPV6 |
+   ICE_FLOW_SEG_HDR_IPV_OTHER;
+
+   if (seg-

[Intel-wired-lan] [PATCH net-next v7 6/8] ice: refactor the FD and RSS flow ID generation

2023-12-05 Thread Ahmed Zaki
The flow director and RSS blocks use separate methods to generate a
unique 64 bit ID for the flow. This is not extendable, especially for
the RSS that already uses all 64 bit space.

Refactor the flow generation API so that the ID is generated within
ice_flow_add_prof(). The FD and RSS blocks caches the generated ID for
later use.

Suggested-by: Dan Nowlin 
Reviewed-by: Wojciech Drewek 
Signed-off-by: Ahmed Zaki 
---
 .../net/ethernet/intel/ice/ice_ethtool_fdir.c | 31 +---
 .../net/ethernet/intel/ice/ice_flex_pipe.c| 11 +
 .../net/ethernet/intel/ice/ice_flex_type.h|  6 +++
 drivers/net/ethernet/intel/ice/ice_flow.c | 47 +--
 drivers/net/ethernet/intel/ice/ice_flow.h |  2 +-
 drivers/net/ethernet/intel/ice/ice_main.c |  5 +-
 drivers/net/ethernet/intel/ice/ice_type.h |  1 +
 .../ethernet/intel/ice/ice_virtchnl_fdir.c| 33 -
 8 files changed, 55 insertions(+), 81 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c 
b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
index 3cc9d703428e..015484a227f4 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
@@ -302,9 +302,7 @@ void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx)
continue;
 
for (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++) {
-   u64 prof_id;
-
-   prof_id = flow + tun * ICE_FLTR_PTYPE_MAX;
+   u64 prof_id = prof->prof_id[tun];
 
for (i = 0; i < prof->cnt; i++) {
if (prof->vsi_h[i] != vsi_idx)
@@ -362,10 +360,9 @@ ice_fdir_erase_flow_from_hw(struct ice_hw *hw, enum 
ice_block blk, int flow)
return;
 
for (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++) {
-   u64 prof_id;
+   u64 prof_id = prof->prof_id[tun];
int j;
 
-   prof_id = flow + tun * ICE_FLTR_PTYPE_MAX;
for (j = 0; j < prof->cnt; j++) {
u16 vsi_num;
 
@@ -439,12 +436,10 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
for (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++) {
struct ice_flow_prof *hw_prof;
struct ice_fd_hw_prof *prof;
-   u64 prof_id;
int j;
 
prof = hw->fdir_prof[flow];
-   prof_id = flow + tun * ICE_FLTR_PTYPE_MAX;
-   ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id,
+   ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX,
  prof->fdir_seg[tun], TNL_SEG_CNT(tun),
  &hw_prof);
for (j = 0; j < prof->cnt; j++) {
@@ -454,7 +449,7 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
 
prio = ICE_FLOW_PRIO_NORMAL;
err = ice_flow_add_entry(hw, ICE_BLK_FD,
-prof_id,
+hw_prof->id,
 prof->vsi_h[0],
 prof->vsi_h[j],
 prio, prof->fdir_seg,
@@ -464,6 +459,7 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
flow);
continue;
}
+   prof->prof_id[tun] = hw_prof->id;
prof->entry_h[j][tun] = entry_h;
}
}
@@ -638,7 +634,6 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct 
ice_flow_seg_info *seg,
u64 entry1_h = 0;
u64 entry2_h = 0;
bool del_last;
-   u64 prof_id;
int err;
int idx;
 
@@ -686,23 +681,23 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct 
ice_flow_seg_info *seg,
 * That is the final parameters are 1 header (segment), no
 * actions (NULL) and zero actions 0.
 */
-   prof_id = flow + tun * ICE_FLTR_PTYPE_MAX;
-   err = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, prof_id, seg,
+   err = ice_flow_add_prof(hw, ICE_BLK_FD, ICE_FLOW_RX, seg,
TNL_SEG_CNT(tun), &prof);
if (err)
return err;
-   err = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
+   err = ice_flow_add_entry(hw, ICE_BLK_FD, prof->id, main_vsi->idx,
 main_vsi->idx, ICE_FLOW_PRIO_NORMAL,
 seg, &entry1_h);
if (err)
goto err_prof;
-   err = ice_flow_add_entry(hw, ICE_BLK_FD, prof_id, main_vsi->idx,
+   err = ice_flow_add

[Intel-wired-lan] [PATCH net-next v7 7/8] ice: enable symmetric-xor RSS for Toeplitz hash function

2023-12-05 Thread Ahmed Zaki
From: Jeff Guo 

Allow the user to set the symmetric Toeplitz hash function via:

# ethtool -X eth0 hfunc toeplitz symmetric-xor

All existing RSS configurations will be converted to symmetric unless they
have a non-symmetric field (other than IP src/dst and L4 src/dst ports)
used for hashing. The driver will reject a new RSS configuration if such
a field is requested.

The hash function in the E800 NICs is set per-VSI and a specific AQ
command is needed to modify the hash function. Use the AQ command to
enable setting the symmetric Toeplitz RSS hash function for any VSI
in the new ice_set_rss_hfunc().

When the Symmetric Toeplitz hash function is used, the hardware sets the
input set of the RSS (Toeplitz) algorithm to be the XOR of the fields
index by HSYMM and the fields index by the INSET registers. We use this
to create a symmetric hash by setting the HSYMM registers to point to
their counterparts in the INSET registers:

 HSYMM [src_fv] = dst_fv;
 HSYMM [dst_fv] = src_fv;

where src_fv and dst_fv are the indexes of the protocol's src and dst
fields.

Reviewed-by: Wojciech Drewek 
Signed-off-by: Jeff Guo 
Signed-off-by: Jesse Brandeburg 
Co-developed-by: Ahmed Zaki 
Signed-off-by: Ahmed Zaki 
---
 drivers/net/ethernet/intel/ice/ice.h  |   2 +
 drivers/net/ethernet/intel/ice/ice_common.h   |   1 +
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |  39 +--
 .../net/ethernet/intel/ice/ice_ethtool_fdir.c |   4 +-
 .../net/ethernet/intel/ice/ice_flex_pipe.c|  33 ++-
 .../net/ethernet/intel/ice/ice_flex_pipe.h|   4 +-
 .../net/ethernet/intel/ice/ice_flex_type.h|   1 +
 drivers/net/ethernet/intel/ice/ice_flow.c | 265 --
 drivers/net/ethernet/intel/ice/ice_flow.h |  27 +-
 .../net/ethernet/intel/ice/ice_hw_autogen.h   |   4 +
 drivers/net/ethernet/intel/ice/ice_lib.c  |  40 +--
 drivers/net/ethernet/intel/ice/ice_main.c |  53 
 drivers/net/ethernet/intel/ice/ice_virtchnl.c |   9 +-
 .../ethernet/intel/ice/ice_virtchnl_fdir.c|   2 +-
 14 files changed, 402 insertions(+), 82 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h 
b/drivers/net/ethernet/intel/ice/ice.h
index 3ea33947b878..2b3aa37df4f3 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -360,6 +360,7 @@ struct ice_vsi {
/* RSS config */
u16 rss_table_size; /* HW RSS table size */
u16 rss_size;   /* Allocated RSS queues */
+   u8 rss_hfunc;   /* User configured hash type */
u8 *rss_hkey_user;  /* User configured hash keys */
u8 *rss_lut_user;   /* User configured lookup table entries */
u8 rss_lut_type;/* used to configure Get/Set RSS LUT AQ call */
@@ -920,6 +921,7 @@ int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 
lut_size);
 int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size);
 int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed);
 int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed);
+int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc);
 void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
 int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);
 void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
diff --git a/drivers/net/ethernet/intel/ice/ice_common.h 
b/drivers/net/ethernet/intel/ice/ice_common.h
index 5f7aa293d4ae..77b4c68cf696 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.h
+++ b/drivers/net/ethernet/intel/ice/ice_common.h
@@ -6,6 +6,7 @@
 
 #include 
 
+#include "ice.h"
 #include "ice_type.h"
 #include "ice_nvm.h"
 #include "ice_flex_pipe.h"
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c 
b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 06a3a31d8691..e3683c89eb5b 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2505,27 +2505,15 @@ static u32 ice_parse_hdrs(struct ethtool_rxnfc *nfc)
return hdrs;
 }
 
-#define ICE_FLOW_HASH_FLD_IPV4_SA  BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA)
-#define ICE_FLOW_HASH_FLD_IPV6_SA  BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_SA)
-#define ICE_FLOW_HASH_FLD_IPV4_DA  BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA)
-#define ICE_FLOW_HASH_FLD_IPV6_DA  BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_DA)
-#define ICE_FLOW_HASH_FLD_TCP_SRC_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT)
-#define ICE_FLOW_HASH_FLD_TCP_DST_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT)
-#define ICE_FLOW_HASH_FLD_UDP_SRC_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT)
-#define ICE_FLOW_HASH_FLD_UDP_DST_PORT BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT)
-#define ICE_FLOW_HASH_FLD_SCTP_SRC_PORT\
-   BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT)
-#define ICE_FLOW_HASH_FLD_SCTP_DST_PORT\
-   BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT)
-
 /**
  * ice_parse_hash_flds - parses hash fields from RSS hash input
  * @nfc: ethtool rxnfc command
+ * @symm: true if Symmetric Topelitz is set
  *
  * This function parses the rxnfc co

[Intel-wired-lan] [PATCH net-next v7 8/8] iavf: enable symmetric-xor RSS for Toeplitz hash function

2023-12-05 Thread Ahmed Zaki
Allow the user to set the symmetric Toeplitz hash function via:

# ethtool -X eth0 hfunc toeplitz symmetric-xor

The driver will reject any new RSS configuration if a field other than
(IP src/dst and L4 src/dst ports) is requested for hashing.

The symmetric RSS will not be supported on PFs not advertising the ADV RSS
Offload flag (ADV_RSS_SUPPORT()), for example the E700 series (i40e).

Reviewed-by: Madhu Chittim 
Signed-off-by: Ahmed Zaki 
---
 drivers/net/ethernet/intel/iavf/iavf.h|  5 +-
 .../net/ethernet/intel/iavf/iavf_adv_rss.c|  8 ++-
 .../net/ethernet/intel/iavf/iavf_adv_rss.h|  3 +-
 .../net/ethernet/intel/iavf/iavf_ethtool.c| 32 ++--
 drivers/net/ethernet/intel/iavf/iavf_main.c   |  4 ++
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 41 +++
 drivers/net/ethernet/intel/ice/ice_virtchnl.c | 50 +++
 drivers/net/ethernet/intel/ice/ice_virtchnl.h |  1 +
 .../intel/ice/ice_virtchnl_allowlist.c|  1 +
 include/linux/avf/virtchnl.h  | 19 +++
 10 files changed, 156 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf.h 
b/drivers/net/ethernet/intel/iavf/iavf.h
index e7ab89dc883a..f83fbcc72075 100644
--- a/drivers/net/ethernet/intel/iavf/iavf.h
+++ b/drivers/net/ethernet/intel/iavf/iavf.h
@@ -312,7 +312,8 @@ struct iavf_adapter {
 #define IAVF_FLAG_AQ_SET_HENA  BIT_ULL(12)
 #define IAVF_FLAG_AQ_SET_RSS_KEY   BIT_ULL(13)
 #define IAVF_FLAG_AQ_SET_RSS_LUT   BIT_ULL(14)
-#define IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODEBIT_ULL(15)
+#define IAVF_FLAG_AQ_SET_RSS_HFUNC BIT_ULL(15)
+#define IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODEBIT_ULL(16)
 #define IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING BIT_ULL(19)
 #define IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPINGBIT_ULL(20)
 #define IAVF_FLAG_AQ_ENABLE_CHANNELS   BIT_ULL(21)
@@ -414,6 +415,7 @@ struct iavf_adapter {
struct iavf_vsi vsi;
u32 aq_wait_count;
/* RSS stuff */
+   enum virtchnl_rss_algorithm hfunc;
u64 hena;
u16 rss_key_size;
u16 rss_lut_size;
@@ -539,6 +541,7 @@ void iavf_get_hena(struct iavf_adapter *adapter);
 void iavf_set_hena(struct iavf_adapter *adapter);
 void iavf_set_rss_key(struct iavf_adapter *adapter);
 void iavf_set_rss_lut(struct iavf_adapter *adapter);
+void iavf_set_rss_hfunc(struct iavf_adapter *adapter);
 void iavf_enable_vlan_stripping(struct iavf_adapter *adapter);
 void iavf_disable_vlan_stripping(struct iavf_adapter *adapter);
 void iavf_virtchnl_completion(struct iavf_adapter *adapter,
diff --git a/drivers/net/ethernet/intel/iavf/iavf_adv_rss.c 
b/drivers/net/ethernet/intel/iavf/iavf_adv_rss.c
index 6edbf134b73f..a9e1da35e248 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_adv_rss.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_adv_rss.c
@@ -95,17 +95,21 @@ iavf_fill_adv_rss_sctp_hdr(struct virtchnl_proto_hdr *hdr, 
u64 hash_flds)
  * @rss_cfg: the virtchnl message to be filled with RSS configuration setting
  * @packet_hdrs: the RSS configuration protocol header types
  * @hash_flds: the RSS configuration protocol hash fields
+ * @symm: if true, symmetric hash is required
  *
  * Returns 0 if the RSS configuration virtchnl message is filled successfully
  */
 int
 iavf_fill_adv_rss_cfg_msg(struct virtchnl_rss_cfg *rss_cfg,
- u32 packet_hdrs, u64 hash_flds)
+ u32 packet_hdrs, u64 hash_flds, bool symm)
 {
struct virtchnl_proto_hdrs *proto_hdrs = &rss_cfg->proto_hdrs;
struct virtchnl_proto_hdr *hdr;
 
-   rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+   if (symm)
+   rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
+   else
+   rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
 
proto_hdrs->tunnel_level = 0;   /* always outer layer */
 
diff --git a/drivers/net/ethernet/intel/iavf/iavf_adv_rss.h 
b/drivers/net/ethernet/intel/iavf/iavf_adv_rss.h
index 4d3be11af7aa..e31eb2afebea 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_adv_rss.h
+++ b/drivers/net/ethernet/intel/iavf/iavf_adv_rss.h
@@ -80,13 +80,14 @@ struct iavf_adv_rss {
 
u32 packet_hdrs;
u64 hash_flds;
+   bool symm;
 
struct virtchnl_rss_cfg cfg_msg;
 };
 
 int
 iavf_fill_adv_rss_cfg_msg(struct virtchnl_rss_cfg *rss_cfg,
- u32 packet_hdrs, u64 hash_flds);
+ u32 packet_hdrs, u64 hash_flds, bool symm);
 struct iavf_adv_rss *
 iavf_find_adv_rss_cfg_by_hdrs(struct iavf_adapter *adapter, u32 packet_hdrs);
 void
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c 
b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 5b25c68f3209..5d00fe8999ec 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -1538,11 +1538,12 @@ static u32 iavf_adv_rss_parse_hdrs(struct ethtool_rxnfc 
*c

[Intel-wired-lan] [PATCH net-next v7 1/8] net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops

2023-12-05 Thread Ahmed Zaki
The get/set_rxfh ethtool ops currently takes the rxfh (RSS) parameters
as direct function arguments. This will force us to change the API (and
all drivers' functions) every time some new parameters are added.

This is part 1/2 of the fix, as suggested in [1]:

- First simplify the code by always providing a pointer to all params
   (indir, key and func); the fact that some of them may be NULL seems
   like a weird historic thing or a premature optimization.
   It will simplify the drivers if all pointers are always present.

 - Then make the functions take a dev pointer, and a pointer to a
   single struct wrapping all arguments. The set_* should also take
   an extack.

Link: https://lore.kernel.org/netdev/20231121152906.2dd5f...@kernel.org/ [1]
Suggested-by: Jakub Kicinski 
Suggested-by: Jacob Keller 
Signed-off-by: Ahmed Zaki 
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c |  28 +--
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c  |  33 ++--
 .../ethernet/aquantia/atlantic/aq_ethtool.c   |  31 ++--
 .../ethernet/broadcom/bnx2x/bnx2x_ethtool.c   |  25 +--
 .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c |  28 +--
 drivers/net/ethernet/broadcom/tg3.c   |  22 +--
 .../ethernet/cavium/thunder/nicvf_ethtool.c   |  31 ++--
 .../ethernet/chelsio/cxgb4/cxgb4_ethtool.c|  24 +--
 .../net/ethernet/cisco/enic/enic_ethtool.c|  25 +--
 .../net/ethernet/emulex/benet/be_ethtool.c|  28 +--
 .../ethernet/freescale/enetc/enetc_ethtool.c  |  31 ++--
 .../ethernet/fungible/funeth/funeth_ethtool.c |  40 ++--
 .../net/ethernet/hisilicon/hns/hns_ethtool.c  |  17 +-
 .../ethernet/hisilicon/hns3/hns3_ethtool.c|  23 ++-
 .../net/ethernet/huawei/hinic/hinic_ethtool.c |  40 ++--
 .../net/ethernet/intel/fm10k/fm10k_ethtool.c  |  26 +--
 .../net/ethernet/intel/i40e/i40e_ethtool.c|  38 ++--
 .../net/ethernet/intel/iavf/iavf_ethtool.c|  42 ++---
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |  44 +++--
 .../net/ethernet/intel/idpf/idpf_ethtool.c|  40 ++--
 drivers/net/ethernet/intel/igb/igb_ethtool.c  |  27 +--
 drivers/net/ethernet/intel/igc/igc_ethtool.c  |  27 +--
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  |  35 ++--
 drivers/net/ethernet/intel/ixgbevf/ethtool.c  |  27 +--
 drivers/net/ethernet/marvell/mvneta.c |  25 +--
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   |  50 ++---
 .../marvell/octeontx2/nic/otx2_ethtool.c  |  41 +++--
 .../net/ethernet/mellanox/mlx4/en_ethtool.c   |  40 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |   6 +-
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  28 +--
 .../net/ethernet/microchip/lan743x_ethtool.c  |  34 ++--
 .../ethernet/microsoft/mana/mana_ethtool.c|  33 ++--
 .../ethernet/netronome/nfp/nfp_net_ethtool.c  |  38 ++--
 .../ethernet/pensando/ionic/ionic_ethtool.c   |  26 +--
 .../net/ethernet/qlogic/qede/qede_ethtool.c   |  32 ++--
 drivers/net/ethernet/sfc/ethtool_common.c |  53 +++---
 drivers/net/ethernet/sfc/ethtool_common.h |  17 +-
 drivers/net/ethernet/sfc/falcon/ethtool.c |  26 +--
 .../net/ethernet/sfc/siena/ethtool_common.c   |  53 +++---
 .../net/ethernet/sfc/siena/ethtool_common.h   |  17 +-
 .../ethernet/stmicro/stmmac/stmmac_ethtool.c  |  31 ++--
 drivers/net/hyperv/netvsc_drv.c   |  32 ++--
 drivers/net/virtio_net.c  |  29 +--
 drivers/net/vmxnet3/vmxnet3_ethtool.c |  22 +--
 include/linux/ethtool.h   |  16 +-
 include/uapi/linux/ethtool.h  |  21 +++
 net/ethtool/common.c  |  12 +-
 net/ethtool/ioctl.c   | 173 ++
 net/ethtool/rss.c |  45 +++--
 49 files changed, 874 insertions(+), 758 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c 
b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index d671df4b76bc..0b33a30a8f23 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -802,15 +802,15 @@ static int ena_indirection_table_get(struct ena_adapter 
*adapter, u32 *indir)
return rc;
 }
 
-static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
-   u8 *hfunc)
+static int ena_get_rxfh(struct net_device *netdev,
+   struct ethtool_rxfh_param *rxfh)
 {
struct ena_adapter *adapter = netdev_priv(netdev);
enum ena_admin_hash_functions ena_func;
u8 func;
int rc;
 
-   rc = ena_indirection_table_get(adapter, indir);
+   rc = ena_indirection_table_get(adapter, rxfh->indir);
if (rc)
return rc;
 
@@ -825,7 +825,7 @@ static int ena_get_rxfh(struct net_device *netdev, u32 
*indir, u8 *key,
return rc;
}
 
-   rc = ena_com_get_hash_key(adapter->ena_dev, key);
+   rc = ena_com_get_hash_key(adapter->ena_dev, rxfh->key);
if (rc)
return rc;
 
@@ -842,27 +842,27 @@ static int ena_get_rxfh(struct net_devic

[Intel-wired-lan] [PATCH iwl-next v2 01/15] e1000e: make lost bits explicit

2023-12-05 Thread Jesse Brandeburg
For more than 15 years this code has passed in a request for a page and
masked off that page when read/writing. This code has been here forever,
but FIELD_PREP finds the bug when converted to use it. Change the code
to do exactly the same thing but allow the conversion to FIELD_PREP in a
later patch. To make it clear what we lost when making this change I
left a comment, but there is no point to change the code to generate a
correct sequence at this point.

This is not a Fixes tagged patch on purpose because it doesn't change
the binary output.

Reviewed-by: Marcin Szycik 
Signed-off-by: Jesse Brandeburg 
---
 drivers/net/ethernet/intel/e1000e/80003es2lan.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c 
b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index be9c695dde12..74671201208e 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -1035,17 +1035,18 @@ static s32 e1000_setup_copper_link_80003es2lan(struct 
e1000_hw *hw)
 * iteration and increase the max iterations when
 * polling the phy; this fixes erroneous timeouts at 10Mbps.
 */
-   ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4),
-  0x);
+   /* these next three accesses were always meant to use page 0x34 using
+* GG82563_REG(0x34, N) but never did, so we've just corrected the call
+* to not drop bits
+*/
+   ret_val = e1000_write_kmrn_reg_80003es2lan(hw, 4, 0x);
if (ret_val)
return ret_val;
-   ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
- ®_data);
+   ret_val = e1000_read_kmrn_reg_80003es2lan(hw, 9, ®_data);
if (ret_val)
return ret_val;
reg_data |= 0x3F;
-   ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
-  reg_data);
+   ret_val = e1000_write_kmrn_reg_80003es2lan(hw, 9, reg_data);
if (ret_val)
return ret_val;
ret_val =
-- 
2.39.3

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 02/15] intel: add bit macro includes where needed

2023-12-05 Thread Jesse Brandeburg
This series is introducing the use of FIELD_GET and FIELD_PREP which
requires bitfield.h to be included. Fix all the includes in this one
change, and rearrange includes into alphabetical order to ease
readability and future maintenance.

virtchnl.h and it's usage was modified to have it's own includes as it
should. This required including bits.h for virtchnl.h.

Reviewed-by: Marcin Szycik 
Signed-off-by: Jesse Brandeburg 
---
 drivers/net/ethernet/intel/e1000/e1000_hw.c   |  1 +
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c   |  1 +
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c   |  1 +
 drivers/net/ethernet/intel/i40e/i40e_common.c |  1 +
 drivers/net/ethernet/intel/i40e/i40e_dcb.c|  2 ++
 drivers/net/ethernet/intel/i40e/i40e_nvm.c|  1 +
 drivers/net/ethernet/intel/iavf/iavf_common.c |  3 +-
 .../net/ethernet/intel/iavf/iavf_ethtool.c|  5 ++--
 drivers/net/ethernet/intel/iavf/iavf_fdir.c   |  1 +
 drivers/net/ethernet/intel/iavf/iavf_txrx.c   |  1 +
 drivers/net/ethernet/intel/igb/e1000_i210.c   |  4 +--
 drivers/net/ethernet/intel/igb/e1000_nvm.c|  4 +--
 drivers/net/ethernet/intel/igb/e1000_phy.c|  4 +--
 drivers/net/ethernet/intel/igbvf/netdev.c | 28 +--
 drivers/net/ethernet/intel/igc/igc_i225.c |  1 +
 drivers/net/ethernet/intel/igc/igc_phy.c  |  1 +
 include/linux/avf/virtchnl.h  |  1 +
 17 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c 
b/drivers/net/ethernet/intel/e1000/e1000_hw.c
index 4542e2bc28e8..4576511c99f5 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c
@@ -5,6 +5,7 @@
  * Shared functions for accessing and configuring the MAC
  */
 
+#include 
 #include "e1000.h"
 
 static s32 e1000_check_downshift(struct e1000_hw *hw);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index af1b0cde3670..ae700a1807c6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2019 Intel Corporation. */
 
+#include 
 #include "fm10k_pf.h"
 #include "fm10k_vf.h"
 
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
index dc8ccd378ec9..c50928ec14ff 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2019 Intel Corporation. */
 
+#include 
 #include "fm10k_vf.h"
 
 /**
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c 
b/drivers/net/ethernet/intel/i40e/i40e_common.c
index bd52b73cf61f..522cf2e5f365 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -2,6 +2,7 @@
 /* Copyright(c) 2013 - 2021 Intel Corporation. */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb.c 
b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
index 498728e16a37..0d334036ab8b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_dcb.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_dcb.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2021 Intel Corporation. */
 
+#include 
+#include "i40e_adminq.h"
 #include "i40e_alloc.h"
 #include "i40e_dcb.h"
 #include "i40e_prototype.h"
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c 
b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index bebf9d4e9068..70215ae92b0c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
+#include 
 #include 
 #include "i40e_alloc.h"
 #include "i40e_prototype.h"
diff --git a/drivers/net/ethernet/intel/iavf/iavf_common.c 
b/drivers/net/ethernet/intel/iavf/iavf_common.c
index 89d2bce529ae..af5cc69f26e3 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_common.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_common.c
@@ -1,10 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
+#include 
+#include 
 #include "iavf_type.h"
 #include "iavf_adminq.h"
 #include "iavf_prototype.h"
-#include 
 
 /**
  * iavf_aq_str - convert AQ err code to a string
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c 
b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 7e58a578f3d4..11150bdc63d0 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -1,11 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
+#include 
+#include 
+
 /* ethtool support for iavf */
 #include "iavf.h"
 
-#include 
-
 /* ethtool statistics helpers */
 
 /**
diff --git a/drivers/net/ethernet/intel/iavf/iavf_fdir.c 
b/drivers/net

[Intel-wired-lan] [PATCH iwl-next v2 00/15] intel: use bitfield operations

2023-12-05 Thread Jesse Brandeburg
After repeatedly getting review comments on new patches, and sporadic
patches to fix parts of our drivers, we should just convert the Intel code
to use FIELD_PREP() and FIELD_GET().  It's then "common" in the code and
hopefully future change-sets will see the context and do-the-right-thing.

In v2 there were a few conversions to use leXX_{get,set,encode}_bits() where
possible.

This conversion was done with a coccinelle script which is mentioned in the
commit messages. Generally there were only a couple conversions that were
"undone" after the automatic changes because they tried to convert a
non-contiguous mask.

Patch 1 is required at the beginning of this series to fix a "forever"
issue in the e1000e driver that fails the compilation test after conversion
because the shift / mask was out of range.

The second patch just adds all the new #includes in one go.

The patch titled: "ice: fix pre-shifted bit usage" is needed to allow the
use of the FIELD_* macros and fix up the unexpected "shifts included"
defines found while creating this series.

The rest are the conversion to use FIELD_PREP()/FIELD_GET(), and the
occasional leXX_{get,set,encode}_bits() call, as suggested by Alex.

CC: Alexander Lobakin 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: add some conversions to the ice patch, add the idpf patch, respond to
comments from reviewers, resulting in more le*_bits usage (Olek), add more
reviewed-bys, see each individual patch for details. changed title of
0/0
v1: original

Jesse Brandeburg (15):
  e1000e: make lost bits explicit
  intel: add bit macro includes where needed
  intel: legacy: field prep conversion
  i40e: field prep conversion
  iavf: field prep conversion
  ice: field prep conversion
  ice: fix pre-shifted bit usage
  igc: field prep conversion
  intel: legacy: field get conversion
  igc: field get conversion
  i40e: field get conversion
  iavf: field get conversion
  ice: field get conversion
  ice: cleanup inconsistent code
  idpf: refactor some missing field get/prep conversions

 drivers/net/ethernet/intel/e1000/e1000_hw.c   |  46 ++-
 .../net/ethernet/intel/e1000e/80003es2lan.c   |  23 +-
 drivers/net/ethernet/intel/e1000e/82571.c |   3 +-
 drivers/net/ethernet/intel/e1000e/ethtool.c   |   7 +-
 drivers/net/ethernet/intel/e1000e/ich8lan.c   |  18 +-
 drivers/net/ethernet/intel/e1000e/mac.c   |   8 +-
 drivers/net/ethernet/intel/e1000e/netdev.c|  11 +-
 drivers/net/ethernet/intel/e1000e/phy.c   |  24 +-
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c   |   7 +-
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c   |  10 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c | 140 -
 drivers/net/ethernet/intel/i40e/i40e_dcb.c| 276 +++---
 drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_ddp.c|   4 +-
 .../net/ethernet/intel/i40e/i40e_ethtool.c|   7 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c   |  85 +++---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c|  14 +-
 drivers/net/ethernet/intel/i40e/i40e_ptp.c|   4 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   |  70 ++---
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c|  29 +-
 drivers/net/ethernet/intel/i40e/i40e_xsk.c|   3 +-
 drivers/net/ethernet/intel/iavf/iavf_common.c |  34 +--
 .../net/ethernet/intel/iavf/iavf_ethtool.c|   8 +-
 drivers/net/ethernet/intel/iavf/iavf_fdir.c   |   3 +-
 drivers/net/ethernet/intel/iavf/iavf_txrx.c   |  21 +-
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |  18 +-
 drivers/net/ethernet/intel/ice/ice_base.c |  32 +-
 drivers/net/ethernet/intel/ice/ice_common.c   |  60 ++--
 drivers/net/ethernet/intel/ice/ice_dcb.c  |  79 ++---
 drivers/net/ethernet/intel/ice/ice_dcb_lib.c  |   2 +-
 drivers/net/ethernet/intel/ice/ice_dcb_nl.c   |   2 +-
 drivers/net/ethernet/intel/ice/ice_eswitch.c  |   4 +-
 .../net/ethernet/intel/ice/ice_ethtool_fdir.c |   3 +-
 drivers/net/ethernet/intel/ice/ice_fdir.c |  69 ++---
 .../net/ethernet/intel/ice/ice_flex_pipe.c|   8 +-
 drivers/net/ethernet/intel/ice/ice_flow.c |   2 +-
 drivers/net/ethernet/intel/ice/ice_lag.c  |   7 +-
 drivers/net/ethernet/intel/ice/ice_lib.c  |  64 ++--
 drivers/net/ethernet/intel/ice/ice_main.c |  48 ++-
 drivers/net/ethernet/intel/ice/ice_nvm.c  |  15 +-
 drivers/net/ethernet/intel/ice/ice_ptp.c  |  13 +-
 drivers/net/ethernet/intel/ice/ice_sched.c|   3 +-
 drivers/net/ethernet/intel/ice/ice_sriov.c|  41 +--
 drivers/net/ethernet/intel/ice/ice_switch.c   |  75 +++--
 drivers/net/ethernet/intel/ice/ice_txrx.c |   6 +-
 drivers/net/ethernet/intel/ice/ice_virtchnl.c |  14 +-
 .../ethernet/intel/ice/ice_virtchnl_fdir.c|  15 +-
 .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c |  41 +--
 .../ethernet/intel/idpf/idpf_singleq_txrx.c   |   7 +-
 drivers/net/ethernet/intel/idpf/idpf_txrx.c   |  58 ++--
 drivers/net/ethernet/intel/igb/e1000_82575.c  |  29 +-
 driver

[Intel-wired-lan] [PATCH iwl-next v2 08/15] igc: field prep conversion

2023-12-05 Thread Jesse Brandeburg
Refactor igc driver to use FIELD_PREP(), which reduces lines of code
and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired in a later patch.

@prep2@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) << shift) & mask)
+FIELD_PREP(mask, a)

@prep@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall 
Cc: Sasha Neftin 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: no change
---
 drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c 
b/drivers/net/ethernet/intel/igc/igc_main.c
index 61db1d3bfa0b..d949289a3ddb 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -3452,8 +3452,8 @@ static int igc_write_flex_filter_ll(struct igc_adapter 
*adapter,
 
/* Configure filter */
queuing = input->length & IGC_FHFT_LENGTH_MASK;
-   queuing |= (input->rx_queue << IGC_FHFT_QUEUE_SHIFT) & 
IGC_FHFT_QUEUE_MASK;
-   queuing |= (input->prio << IGC_FHFT_PRIO_SHIFT) & IGC_FHFT_PRIO_MASK;
+   queuing |= FIELD_PREP(IGC_FHFT_QUEUE_MASK, input->rx_queue);
+   queuing |= FIELD_PREP(IGC_FHFT_PRIO_MASK, input->prio);
 
if (input->immediate_irq)
queuing |= IGC_FHFT_IMM_INT;
-- 
2.39.3

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 03/15] intel: legacy: field prep conversion

2023-12-05 Thread Jesse Brandeburg
Refactor several older Intel drivers to use FIELD_PREP(), which reduces
lines of code and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

@prep2@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) << shift) & mask)
+FIELD_PREP(mask, a)

@prep@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: updated commit message with new script
---
 drivers/net/ethernet/intel/e1000e/80003es2lan.c | 7 +++
 drivers/net/ethernet/intel/e1000e/phy.c | 7 +++
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 3 +--
 drivers/net/ethernet/intel/igb/e1000_phy.c  | 4 ++--
 drivers/net/ethernet/intel/igb/igb_ethtool.c| 3 +--
 drivers/net/ethernet/intel/igb/igb_main.c   | 9 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c  | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c   | 4 ++--
 8 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c 
b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
index 74671201208e..31fce3e4e8af 100644
--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
@@ -1210,8 +1210,8 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct 
e1000_hw *hw, u32 offset,
if (ret_val)
return ret_val;
 
-   kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
-  E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
+   kmrnctrlsta = FIELD_PREP(E1000_KMRNCTRLSTA_OFFSET, offset) |
+ E1000_KMRNCTRLSTA_REN;
ew32(KMRNCTRLSTA, kmrnctrlsta);
e1e_flush();
 
@@ -1245,8 +1245,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct 
e1000_hw *hw, u32 offset,
if (ret_val)
return ret_val;
 
-   kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
-  E1000_KMRNCTRLSTA_OFFSET) | data;
+   kmrnctrlsta = FIELD_PREP(E1000_KMRNCTRLSTA_OFFSET, offset) | data;
ew32(KMRNCTRLSTA, kmrnctrlsta);
e1e_flush();
 
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c 
b/drivers/net/ethernet/intel/e1000e/phy.c
index 08c3d477dd6f..2498f021eb02 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -463,8 +463,8 @@ static s32 __e1000_read_kmrn_reg(struct e1000_hw *hw, u32 
offset, u16 *data,
return ret_val;
}
 
-   kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
-  E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
+   kmrnctrlsta = FIELD_PREP(E1000_KMRNCTRLSTA_OFFSET, offset) |
+ E1000_KMRNCTRLSTA_REN;
ew32(KMRNCTRLSTA, kmrnctrlsta);
e1e_flush();
 
@@ -536,8 +536,7 @@ static s32 __e1000_write_kmrn_reg(struct e1000_hw *hw, u32 
offset, u16 data,
return ret_val;
}
 
-   kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
-  E1000_KMRNCTRLSTA_OFFSET) | data;
+   kmrnctrlsta = FIELD_PREP(E1000_KMRNCTRLSTA_OFFSET, offset) | data;
ew32(KMRNCTRLSTA, kmrnctrlsta);
e1e_flush();
 
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index ae700a1807c6..1eea0ec5dbcf 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -866,8 +866,7 @@ static s32 fm10k_iov_assign_default_mac_vlan_pf(struct 
fm10k_hw *hw,
 * register is RO from the VF, so the PF must do this even in the
 * case of notifying the VF of a new VID via the mailbox.
 */
-   txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
-FM10K_TXQCTL_VID_MASK;
+   txqctl = FIELD_PREP(FM10K_TXQCTL_VID_MASK, vf_vid);
txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
  FM10K_TXQCTL_VF | vf_idx;
 
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c 
b/drivers/net/ethernet/intel/igb/e1000_phy.c
index 3c1b562a3271..c84e7356cdb1 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -255,7 +255,7 @@ s32 igb_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, 
u16 *data)
}
 
/* Need to byte-swap the 16-bit value. */
-   *data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00);
+   *data = ((i2ccmd >> 8) & 0x00FF) | FIELD_PREP(0xFF00, i2ccmd);
 
return 0;
 }
@@ -282,7 +282,7 @@ s32 igb_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, 
u16 data)
}
 
/* Swap the data bytes for the I2C interface */
-   phy_data_swapped = ((data >> 8) & 0x00FF) | ((data << 8) & 0xFF00);
+   phy_data_swapped = ((data >> 8) & 0x00FF) | FIELD_PREP(0xFF00, data);
 
/* Set up Op-code,

[Intel-wired-lan] [PATCH iwl-next v2 04/15] i40e: field prep conversion

2023-12-05 Thread Jesse Brandeburg
Refactor i40e driver to use FIELD_PREP(), which reduces lines of code
and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

Refactor one function with multiple if's to return quickly to make lines
fit in 80 columns.

@prep2@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) << shift) & mask)
+FIELD_PREP(mask, a)

@prep@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: updated commit message
---
 drivers/net/ethernet/intel/i40e/i40e_common.c |  83 ++---
 drivers/net/ethernet/intel/i40e/i40e_dcb.c| 116 --
 drivers/net/ethernet/intel/i40e/i40e_main.c   |  12 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   |  41 +++
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c|   8 +-
 5 files changed, 109 insertions(+), 151 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c 
b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 522cf2e5f365..4ec4ab2c7d48 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -249,6 +249,7 @@ static int i40e_aq_get_set_rss_lut(struct i40e_hw *hw,
struct i40e_aqc_get_set_rss_lut *cmd_resp =
   (struct i40e_aqc_get_set_rss_lut *)&desc.params.raw;
int status;
+   u16 flags;
 
if (set)
i40e_fill_default_direct_cmd_desc(&desc,
@@ -261,23 +262,18 @@ static int i40e_aq_get_set_rss_lut(struct i40e_hw *hw,
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_BUF);
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_RD);
 
-   cmd_resp->vsi_id =
-   cpu_to_le16((u16)((vsi_id <<
- I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT) &
- I40E_AQC_SET_RSS_LUT_VSI_ID_MASK));
-   cmd_resp->vsi_id |= cpu_to_le16((u16)I40E_AQC_SET_RSS_LUT_VSI_VALID);
+   vsi_id = FIELD_PREP(I40E_AQC_SET_RSS_LUT_VSI_ID_MASK, vsi_id) |
+FIELD_PREP(I40E_AQC_SET_RSS_LUT_VSI_VALID, 1);
+   cmd_resp->vsi_id = cpu_to_le16(vsi_id);
 
if (pf_lut)
-   cmd_resp->flags |= cpu_to_le16((u16)
-   ((I40E_AQC_SET_RSS_LUT_TABLE_TYPE_PF <<
-   I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) &
-   I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK));
+   flags = FIELD_PREP(I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK,
+  I40E_AQC_SET_RSS_LUT_TABLE_TYPE_PF);
else
-   cmd_resp->flags |= cpu_to_le16((u16)
-   ((I40E_AQC_SET_RSS_LUT_TABLE_TYPE_VSI <<
-   I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) &
-   I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK));
+   flags = FIELD_PREP(I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK,
+  I40E_AQC_SET_RSS_LUT_TABLE_TYPE_VSI);
 
+   cmd_resp->flags = cpu_to_le16(flags);
status = i40e_asq_send_command(hw, &desc, lut, lut_size, NULL);
 
return status;
@@ -347,11 +343,9 @@ static int i40e_aq_get_set_rss_key(struct i40e_hw *hw,
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_BUF);
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_RD);
 
-   cmd_resp->vsi_id =
-   cpu_to_le16((u16)((vsi_id <<
- I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT) &
- I40E_AQC_SET_RSS_KEY_VSI_ID_MASK));
-   cmd_resp->vsi_id |= cpu_to_le16((u16)I40E_AQC_SET_RSS_KEY_VSI_VALID);
+   vsi_id = FIELD_PREP(I40E_AQC_SET_RSS_KEY_VSI_ID_MASK, vsi_id) |
+FIELD_PREP(I40E_AQC_SET_RSS_KEY_VSI_VALID, 1);
+   cmd_resp->vsi_id = cpu_to_le16(vsi_id);
 
status = i40e_asq_send_command(hw, &desc, key, key_size, NULL);
 
@@ -1289,14 +1283,14 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool 
blink)
pin_func = I40E_PIN_FUNC_LED;
 
gpio_val &= ~I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK;
-   gpio_val |= ((pin_func <<
-I40E_GLGEN_GPIO_CTL_PIN_FUNC_SHIFT) &
-I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK);
+   gpio_val |=
+   FIELD_PREP(I40E_GLGEN_GPIO_CTL_PIN_FUNC_MASK,
+  pin_func);
}
gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK;
/* this & is a bit of paranoia, but serves as a range check */
-   gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) &
-I40E_GLGEN_GPIO_CTL_LED_MODE_MASK);
+   gpio_

[Intel-wired-lan] [PATCH iwl-next v2 07/15] ice: fix pre-shifted bit usage

2023-12-05 Thread Jesse Brandeburg
While converting to FIELD_PREP() and FIELD_GET(), it was noticed that
some of the RSS defines had *included* the shift in their definitions.
This is completely outside of normal, such that a developer could easily
make a mistake and shift at the usage site (like when using
FIELD_PREP()).

Rename the defines and set them to the "pre-shifted values" so they
match the template the driver normally uses for masks and the member
bits of the mask, which also allows the driver to use FIELD_PREP
correctly with these values. Use GENMASK() for this changed MASK value.

Do the same for the VLAN EMODE defines as well.

Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: no change
---
 .../net/ethernet/intel/ice/ice_adminq_cmd.h| 18 +-
 drivers/net/ethernet/intel/ice/ice_lib.c   |  7 ---
 drivers/net/ethernet/intel/ice/ice_virtchnl.c  | 10 +-
 .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c  | 16 +++-
 4 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h 
b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index f77a3c70f262..51c241ab6b8e 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -422,10 +422,10 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_INNER_VLAN_INSERT_PVID  BIT(2)
 #define ICE_AQ_VSI_INNER_VLAN_EMODE_S  3
 #define ICE_AQ_VSI_INNER_VLAN_EMODE_M  (0x3 << 
ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH   (0x0 << 
ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP (0x1 << 
ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR(0x2 << 
ICE_AQ_VSI_INNER_VLAN_EMODE_S)
-#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING(0x3 << 
ICE_AQ_VSI_INNER_VLAN_EMODE_S)
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH   0x0U
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR_UP 0x1U
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_STR0x2U
+#define ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING0x3U
u8 inner_vlan_reserved2[3];
/* ingress egress up sections */
__le32 ingress_table; /* bitmap, 3 bits per up */
@@ -491,11 +491,11 @@ struct ice_aqc_vsi_props {
 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S 2
 #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << 
ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
 #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S6
-#define ICE_AQ_VSI_Q_OPT_RSS_HASH_M(0x3 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_TPLZ  (0x0 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ  (0x1 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_XOR   (0x2 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
-#define ICE_AQ_VSI_Q_OPT_RSS_JHASH (0x3 << 
ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_MGENMASK(7, 6)
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ 0x0U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_SYM_TPLZ 0x1U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_XOR  0x2U
+#define ICE_AQ_VSI_Q_OPT_RSS_HASH_JHASH0x3U
u8 q_opt_tc;
 #define ICE_AQ_VSI_Q_OPT_TC_OVR_S  0
 #define ICE_AQ_VSI_Q_OPT_TC_OVR_M  (0x1F << 
ICE_AQ_VSI_Q_OPT_TC_OVR_S)
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c 
b/drivers/net/ethernet/intel/ice/ice_lib.c
index 394f915290f6..453eba59abb2 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -984,7 +984,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct 
ice_vsi_ctx *ctxt)
 */
if (ice_is_dvm_ena(hw)) {
ctxt->info.inner_vlan_flags |=
-   ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
+   FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
+  ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
ctxt->info.outer_vlan_flags =
FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M,
   ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL);
@@ -1183,12 +1184,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx 
*ctxt, struct ice_vsi *vsi)
case ICE_VSI_PF:
/* PF VSI will inherit RSS instance of PF */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF;
-   hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+   hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
break;
case ICE_VSI_VF:
/* VF VSI will gets a small RSS table which is a VSI LUT type */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI;
-   hash_type = ICE_AQ_VSI_Q_OPT_RSS_TPLZ;
+   hash_type = ICE_AQ_VSI_Q_OPT_RSS_HASH_TPLZ;
break;
default:
dev_dbg(dev, "Unsupported VSI type %s\n",
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c 
b/d

[Intel-wired-lan] [PATCH iwl-next v2 10/15] igc: field get conversion

2023-12-05 Thread Jesse Brandeburg
Refactor the igc driver to use FIELD_GET() for mask and shift reads,
which reduces lines of code and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired in a later patch.

@get@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) & mask) >> shift)
+FIELD_GET(mask, a)

and applied via:
spatch --sp-file field_prep.cocci --in-place --dir \
 drivers/net/ethernet/intel/

Cc: Julia Lawall 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
 drivers/net/ethernet/intel/igc/igc_base.c | 6 ++
 drivers/net/ethernet/intel/igc/igc_i225.c | 5 ++---
 drivers/net/ethernet/intel/igc/igc_main.c | 6 ++
 drivers/net/ethernet/intel/igc/igc_phy.c  | 4 ++--
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_base.c 
b/drivers/net/ethernet/intel/igc/igc_base.c
index a1d815af507d..9fae8bdec2a7 100644
--- a/drivers/net/ethernet/intel/igc/igc_base.c
+++ b/drivers/net/ethernet/intel/igc/igc_base.c
@@ -68,8 +68,7 @@ static s32 igc_init_nvm_params_base(struct igc_hw *hw)
u32 eecd = rd32(IGC_EECD);
u16 size;
 
-   size = (u16)((eecd & IGC_EECD_SIZE_EX_MASK) >>
-IGC_EECD_SIZE_EX_SHIFT);
+   size = FIELD_GET(IGC_EECD_SIZE_EX_MASK, eecd);
 
/* Added to a constant, "size" becomes the left-shift value
 * for setting word_size.
@@ -162,8 +161,7 @@ static s32 igc_init_phy_params_base(struct igc_hw *hw)
phy->reset_delay_us = 100;
 
/* set lan id */
-   hw->bus.func = (rd32(IGC_STATUS) & IGC_STATUS_FUNC_MASK) >>
-   IGC_STATUS_FUNC_SHIFT;
+   hw->bus.func = FIELD_GET(IGC_STATUS_FUNC_MASK, rd32(IGC_STATUS));
 
/* Make sure the PHY is in a good state. Several people have reported
 * firmware leaving the PHY's page select register set to something
diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c 
b/drivers/net/ethernet/intel/igc/igc_i225.c
index d2562c8e8015..0dd61719f1ed 100644
--- a/drivers/net/ethernet/intel/igc/igc_i225.c
+++ b/drivers/net/ethernet/intel/igc/igc_i225.c
@@ -579,9 +579,8 @@ s32 igc_set_ltr_i225(struct igc_hw *hw, bool link)
 
/* Calculate tw_system (nsec). */
if (speed == SPEED_100) {
-   tw_system = ((rd32(IGC_EEE_SU) &
-IGC_TW_SYSTEM_100_MASK) >>
-IGC_TW_SYSTEM_100_SHIFT) * 500;
+   tw_system = FIELD_GET(IGC_TW_SYSTEM_100_MASK,
+ rd32(IGC_EEE_SU)) * 500;
} else {
tw_system = (rd32(IGC_EEE_SU) &
 IGC_TW_SYSTEM_1000_MASK) * 500;
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c 
b/drivers/net/ethernet/intel/igc/igc_main.c
index d949289a3ddb..ba8d3fe186ae 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -3712,8 +3712,7 @@ static int igc_enable_nfc_rule(struct igc_adapter 
*adapter,
}
 
if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
-   int prio = (rule->filter.vlan_tci & VLAN_PRIO_MASK) >>
-  VLAN_PRIO_SHIFT;
+   int prio = FIELD_GET(VLAN_PRIO_MASK, rule->filter.vlan_tci);
 
err = igc_add_vlan_prio_filter(adapter, prio, rule->action);
if (err)
@@ -3735,8 +3734,7 @@ static void igc_disable_nfc_rule(struct igc_adapter 
*adapter,
igc_del_etype_filter(adapter, rule->filter.etype);
 
if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
-   int prio = (rule->filter.vlan_tci & VLAN_PRIO_MASK) >>
-  VLAN_PRIO_SHIFT;
+   int prio = FIELD_GET(VLAN_PRIO_MASK, rule->filter.vlan_tci);
 
igc_del_vlan_prio_filter(adapter, prio);
}
diff --git a/drivers/net/ethernet/intel/igc/igc_phy.c 
b/drivers/net/ethernet/intel/igc/igc_phy.c
index d0d9e7170154..7cd8716d2ffa 100644
--- a/drivers/net/ethernet/intel/igc/igc_phy.c
+++ b/drivers/net/ethernet/intel/igc/igc_phy.c
@@ -727,7 +727,7 @@ static s32 igc_write_xmdio_reg(struct igc_hw *hw, u16 addr,
  */
 s32 igc_write_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 data)
 {
-   u8 dev_addr = (offset & GPY_MMD_MASK) >> GPY_MMD_SHIFT;
+   u8 dev_addr = FIELD_GET(GPY_MMD_MASK, offset);
s32 ret_val;
 
offset = offset & GPY_REG_MASK;
@@ -758,7 +758,7 @@ s32 igc_write_phy_reg_gpy(struct igc_hw *hw, u32 offset, 
u16 data)
  */
 s32 igc_read_phy_reg_gpy(struct igc_hw *hw, u32 offset, u16 *data)
 {
-   u8 dev_addr = (offset & GPY_MMD_MASK) >> GPY_MMD_SHIFT;
+   u8 dev_addr = FIELD_GET(GPY_MMD_MASK, offset);
s32 ret_val;
 
offset = offset & GPY_REG_MASK;
-- 
2.39.3

_

[Intel-wired-lan] [PATCH iwl-next v2 05/15] iavf: field prep conversion

2023-12-05 Thread Jesse Brandeburg
Refactor iavf driver to use FIELD_PREP(), which reduces lines of code
and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

Clean up a couple spots in the code that had repetitive
y = cpu_to_*((blah << blah_blah) & blat)
y |= cpu_to_*((blahs << blahs_blahs) & blats)
to
x = FIELD_PREP(blat blah)
x |= FIELD_PREP(blats, blahs)
y = cpu_to_*(x);

@prep2@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) << shift) & mask)
+FIELD_PREP(mask, a)

@prep@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall 
Cc: Ahmed Zaki 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: updated commit message
---
 drivers/net/ethernet/intel/iavf/iavf_common.c | 31 ---
 drivers/net/ethernet/intel/iavf/iavf_fdir.c   |  2 +-
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_common.c 
b/drivers/net/ethernet/intel/iavf/iavf_common.c
index af5cc69f26e3..5a25233a89d5 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_common.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_common.c
@@ -331,6 +331,7 @@ static enum iavf_status iavf_aq_get_set_rss_lut(struct 
iavf_hw *hw,
struct iavf_aq_desc desc;
struct iavf_aqc_get_set_rss_lut *cmd_resp =
   (struct iavf_aqc_get_set_rss_lut *)&desc.params.raw;
+   u16 flags;
 
if (set)
iavf_fill_default_direct_cmd_desc(&desc,
@@ -343,22 +344,18 @@ static enum iavf_status iavf_aq_get_set_rss_lut(struct 
iavf_hw *hw,
desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_BUF);
desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_RD);
 
-   cmd_resp->vsi_id =
-   cpu_to_le16((u16)((vsi_id <<
- IAVF_AQC_SET_RSS_LUT_VSI_ID_SHIFT) &
- IAVF_AQC_SET_RSS_LUT_VSI_ID_MASK));
-   cmd_resp->vsi_id |= cpu_to_le16((u16)IAVF_AQC_SET_RSS_LUT_VSI_VALID);
+   vsi_id = FIELD_PREP(IAVF_AQC_SET_RSS_LUT_VSI_ID_MASK, vsi_id) |
+FIELD_PREP(IAVF_AQC_SET_RSS_LUT_VSI_VALID, 1);
+   cmd_resp->vsi_id = cpu_to_le16(vsi_id);
 
if (pf_lut)
-   cmd_resp->flags |= cpu_to_le16((u16)
-   ((IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_PF <<
-   IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) &
-   IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_MASK));
+   flags = FIELD_PREP(IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_MASK,
+  IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_PF);
else
-   cmd_resp->flags |= cpu_to_le16((u16)
-   ((IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_VSI <<
-   IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) &
-   IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_MASK));
+   flags = FIELD_PREP(IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_MASK,
+  IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_VSI);
+
+   cmd_resp->flags = cpu_to_le16(flags);
 
status = iavf_asq_send_command(hw, &desc, lut, lut_size, NULL);
 
@@ -412,11 +409,9 @@ iavf_status iavf_aq_get_set_rss_key(struct iavf_hw *hw, 
u16 vsi_id,
desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_BUF);
desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_RD);
 
-   cmd_resp->vsi_id =
-   cpu_to_le16((u16)((vsi_id <<
- IAVF_AQC_SET_RSS_KEY_VSI_ID_SHIFT) &
- IAVF_AQC_SET_RSS_KEY_VSI_ID_MASK));
-   cmd_resp->vsi_id |= cpu_to_le16((u16)IAVF_AQC_SET_RSS_KEY_VSI_VALID);
+   vsi_id = FIELD_PREP(IAVF_AQC_SET_RSS_KEY_VSI_ID_MASK, vsi_id) |
+FIELD_PREP(IAVF_AQC_SET_RSS_KEY_VSI_VALID, 1);
+   cmd_resp->vsi_id = cpu_to_le16(vsi_id);
 
status = iavf_asq_send_command(hw, &desc, key, key_size, NULL);
 
diff --git a/drivers/net/ethernet/intel/iavf/iavf_fdir.c 
b/drivers/net/ethernet/intel/iavf/iavf_fdir.c
index 65ddcd81c993..2d47b0b4640e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_fdir.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_fdir.c
@@ -358,7 +358,7 @@ iavf_fill_fdir_ip6_hdr(struct iavf_fdir_fltr *fltr,
 
if (fltr->ip_mask.tclass == U8_MAX) {
iph->priority = (fltr->ip_data.tclass >> 4) & 0xF;
-   iph->flow_lbl[0] = (fltr->ip_data.tclass << 4) & 0xF0;
+   iph->flow_lbl[0] = FIELD_PREP(0xF0, fltr->ip_data.tclass);
VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV6, TC);
}
 
-- 
2.39.3

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 13/15] ice: field get conversion

2023-12-05 Thread Jesse Brandeburg
Refactor the ice driver to use FIELD_GET() for mask and shift reads,
which reduces lines of code and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

@get@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) & mask) >> shift)
+FIELD_GET(mask, a)

and applied via:
spatch --sp-file field_prep.cocci --in-place --dir \
 drivers/net/ethernet/intel/

CC: Alexander Lobakin 
Cc: Julia Lawall 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: added a couple more get conversions
---
 drivers/net/ethernet/intel/ice/ice_base.c | 12 +--
 drivers/net/ethernet/intel/ice/ice_common.c   | 25 +++
 drivers/net/ethernet/intel/ice/ice_dcb.c  | 74 ---
 drivers/net/ethernet/intel/ice/ice_dcb_nl.c   |  2 +-
 .../net/ethernet/intel/ice/ice_ethtool_fdir.c |  3 +-
 drivers/net/ethernet/intel/ice/ice_lib.c  |  5 +-
 drivers/net/ethernet/intel/ice/ice_main.c | 48 +---
 drivers/net/ethernet/intel/ice/ice_nvm.c  | 15 ++--
 drivers/net/ethernet/intel/ice/ice_ptp.c  |  4 +-
 drivers/net/ethernet/intel/ice/ice_sched.c|  3 +-
 drivers/net/ethernet/intel/ice/ice_sriov.c|  3 +-
 drivers/net/ethernet/intel/ice/ice_virtchnl.c |  2 +-
 .../ethernet/intel/ice/ice_virtchnl_fdir.c| 13 ++--
 13 files changed, 85 insertions(+), 124 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c 
b/drivers/net/ethernet/intel/ice/ice_base.c
index 3fd6e99dba23..26648b193ac9 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -224,14 +224,10 @@ static void ice_cfg_itr_gran(struct ice_hw *hw)
 
/* no need to update global register if ITR gran is already set */
if (!(regval & GLINT_CTL_DIS_AUTOMASK_M) &&
-   (((regval & GLINT_CTL_ITR_GRAN_200_M) >>
-GLINT_CTL_ITR_GRAN_200_S) == ICE_ITR_GRAN_US) &&
-   (((regval & GLINT_CTL_ITR_GRAN_100_M) >>
-GLINT_CTL_ITR_GRAN_100_S) == ICE_ITR_GRAN_US) &&
-   (((regval & GLINT_CTL_ITR_GRAN_50_M) >>
-GLINT_CTL_ITR_GRAN_50_S) == ICE_ITR_GRAN_US) &&
-   (((regval & GLINT_CTL_ITR_GRAN_25_M) >>
- GLINT_CTL_ITR_GRAN_25_S) == ICE_ITR_GRAN_US))
+   (FIELD_GET(GLINT_CTL_ITR_GRAN_200_M, regval) == ICE_ITR_GRAN_US) &&
+   (FIELD_GET(GLINT_CTL_ITR_GRAN_100_M, regval) == ICE_ITR_GRAN_US) &&
+   (FIELD_GET(GLINT_CTL_ITR_GRAN_50_M, regval) == ICE_ITR_GRAN_US) &&
+   (FIELD_GET(GLINT_CTL_ITR_GRAN_25_M, regval) == ICE_ITR_GRAN_US))
return;
 
regval = FIELD_PREP(GLINT_CTL_ITR_GRAN_200_M, ICE_ITR_GRAN_US) |
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c 
b/drivers/net/ethernet/intel/ice/ice_common.c
index eb5c00b83112..bb3fc82bd51f 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -960,8 +960,8 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw)
u16 v, m, flgs;
 
v = le16_to_cpu(config[i]);
-   m = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S;
-   flgs = (v & ICE_AQC_FW_LOG_EN_M) >> ICE_AQC_FW_LOG_EN_S;
+   m = FIELD_GET(ICE_AQC_FW_LOG_ID_M, v);
+   flgs = FIELD_GET(ICE_AQC_FW_LOG_EN_M, v);
 
if (m < ICE_AQC_FW_LOG_ID_MAX)
hw->fw_log.evnts[m].cur = flgs;
@@ -1116,7 +1116,7 @@ static int ice_cfg_fw_log(struct ice_hw *hw, bool enable)
}
 
v = le16_to_cpu(data[i]);
-   m = (v & ICE_AQC_FW_LOG_ID_M) >> ICE_AQC_FW_LOG_ID_S;
+   m = FIELD_GET(ICE_AQC_FW_LOG_ID_M, v);
hw->fw_log.evnts[m].cur = hw->fw_log.evnts[m].cfg;
}
}
@@ -1152,9 +1152,8 @@ void ice_output_fw_log(struct ice_hw *hw, struct 
ice_aq_desc *desc, void *buf)
  */
 static void ice_get_itr_intrl_gran(struct ice_hw *hw)
 {
-   u8 max_agg_bw = (rd32(hw, GL_PWR_MODE_CTL) &
-GL_PWR_MODE_CTL_CAR_MAX_BW_M) >>
-   GL_PWR_MODE_CTL_CAR_MAX_BW_S;
+   u8 max_agg_bw = FIELD_GET(GL_PWR_MODE_CTL_CAR_MAX_BW_M,
+ rd32(hw, GL_PWR_MODE_CTL));
 
switch (max_agg_bw) {
case ICE_MAX_AGG_BW_200G:
@@ -1186,9 +1185,7 @@ int ice_init_hw(struct ice_hw *hw)
if (status)
return status;
 
-   hw->pf_id = (u8)(rd32(hw, PF_FUNC_RID) &
-PF_FUNC_RID_FUNC_NUM_M) >>
-   PF_FUNC_RID_FUNC_NUM_S;
+   hw->pf_id = FIELD_GET(PF_FUNC_RID_FUNC_NUM_M, rd32(hw, PF_FUNC_RID));
 
status = ice_reset(hw, ICE_RESET_PFR);
if (status)
@@ -1374,8 +1371,8 @@ int ice_check_reset(struct ice_hw *hw)
 * or EMPR has occurred. The grst delay value is in 100ms units.
 * Add 1

[Intel-wired-lan] [PATCH iwl-next v2 12/15] iavf: field get conversion

2023-12-05 Thread Jesse Brandeburg
Refactor the iavf driver to use FIELD_GET() for mask and shift reads,
which reduces lines of code and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired in a later patch.

@get@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) & mask) >> shift)
+FIELD_GET(mask, a)

and applied via:
spatch --sp-file field_prep.cocci --in-place --dir \
 drivers/net/ethernet/intel/

Cc: Julia Lawall 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
 .../net/ethernet/intel/iavf/iavf_ethtool.c|  3 +--
 drivers/net/ethernet/intel/iavf/iavf_txrx.c   | 20 +++
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c 
b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 11150bdc63d0..90d8f1fcc3aa 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -1020,8 +1020,7 @@ iavf_parse_rx_flow_user_data(struct ethtool_rx_flow_spec 
*fsp,
 #define IAVF_USERDEF_FLEX_MAX_OFFS_VAL 504
flex = &fltr->flex_words[cnt++];
flex->word = value & IAVF_USERDEF_FLEX_WORD_M;
-   flex->offset = (value & IAVF_USERDEF_FLEX_OFFS_M) >>
-IAVF_USERDEF_FLEX_OFFS_S;
+   flex->offset = FIELD_GET(IAVF_USERDEF_FLEX_OFFS_M, value);
if (flex->offset > IAVF_USERDEF_FLEX_MAX_OFFS_VAL)
return -EINVAL;
}
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c 
b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index fb7edba9c2f8..b71484c87a84 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -989,11 +989,9 @@ static void iavf_rx_checksum(struct iavf_vsi *vsi,
u64 qword;
 
qword = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
-   ptype = (qword & IAVF_RXD_QW1_PTYPE_MASK) >> IAVF_RXD_QW1_PTYPE_SHIFT;
-   rx_error = (qword & IAVF_RXD_QW1_ERROR_MASK) >>
-  IAVF_RXD_QW1_ERROR_SHIFT;
-   rx_status = (qword & IAVF_RXD_QW1_STATUS_MASK) >>
-   IAVF_RXD_QW1_STATUS_SHIFT;
+   ptype = FIELD_GET(IAVF_RXD_QW1_PTYPE_MASK, qword);
+   rx_error = FIELD_GET(IAVF_RXD_QW1_ERROR_MASK, qword);
+   rx_status = FIELD_GET(IAVF_RXD_QW1_STATUS_MASK, qword);
decoded = decode_rx_desc_ptype(ptype);
 
skb->ip_summed = CHECKSUM_NONE;
@@ -1534,8 +1532,7 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, 
int budget)
if (!iavf_test_staterr(rx_desc, IAVF_RXD_DD))
break;
 
-   size = (qword & IAVF_RXD_QW1_LENGTH_PBUF_MASK) >>
-  IAVF_RXD_QW1_LENGTH_PBUF_SHIFT;
+   size = FIELD_GET(IAVF_RXD_QW1_LENGTH_PBUF_MASK, qword);
 
iavf_trace(clean_rx_irq, rx_ring, rx_desc, skb);
rx_buffer = iavf_get_rx_buffer(rx_ring, size);
@@ -1582,8 +1579,7 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, 
int budget)
total_rx_bytes += skb->len;
 
qword = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
-   rx_ptype = (qword & IAVF_RXD_QW1_PTYPE_MASK) >>
-  IAVF_RXD_QW1_PTYPE_SHIFT;
+   rx_ptype = FIELD_GET(IAVF_RXD_QW1_PTYPE_MASK, qword);
 
/* populate checksum, VLAN, and protocol */
iavf_process_skb_fields(rx_ring, rx_desc, skb, rx_ptype);
@@ -2291,8 +2287,7 @@ static void iavf_tx_map(struct iavf_ring *tx_ring, struct 
sk_buff *skb,
 
if (tx_flags & IAVF_TX_FLAGS_HW_VLAN) {
td_cmd |= IAVF_TX_DESC_CMD_IL2TAG1;
-   td_tag = (tx_flags & IAVF_TX_FLAGS_VLAN_MASK) >>
-IAVF_TX_FLAGS_VLAN_SHIFT;
+   td_tag = FIELD_GET(IAVF_TX_FLAGS_VLAN_MASK, tx_flags);
}
 
first->tx_flags = tx_flags;
@@ -2468,8 +2463,7 @@ static netdev_tx_t iavf_xmit_frame_ring(struct sk_buff 
*skb,
if (tx_flags & IAVF_TX_FLAGS_HW_OUTER_SINGLE_VLAN) {
cd_type_cmd_tso_mss |= IAVF_TX_CTX_DESC_IL2TAG2 <<
IAVF_TXD_CTX_QW1_CMD_SHIFT;
-   cd_l2tag2 = (tx_flags & IAVF_TX_FLAGS_VLAN_MASK) >>
-   IAVF_TX_FLAGS_VLAN_SHIFT;
+   cd_l2tag2 = FIELD_GET(IAVF_TX_FLAGS_VLAN_MASK, tx_flags);
}
 
/* obtain protocol of skb */
-- 
2.39.3

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 15/15] idpf: refactor some missing field get/prep conversions

2023-12-05 Thread Jesse Brandeburg
Most of idpf correctly uses FIELD_GET and FIELD_PREP, but a couple spots
were missed so fix those.

Automated conversion with coccinelle script and manually fixed up,
including audits for opportunities to convert to {get,encode,replace}
bits functions.

Add conversions to le16_get/encode/replace_bits where appropriate. And
in one place fix up a cast from a u16 to a u16.

@prep2@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) << shift) & mask)
+FIELD_PREP(mask, a)

@prep@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) << shift) & mask)
+FIELD_PREP(mask, a)

@get@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) & mask) >> shift)
+FIELD_GET(mask, a)

and applied via:
spatch --sp-file field_prep.cocci --in-place --dir \
 drivers/net/ethernet/intel/

CC: Alexander Lobakin 
Reviewed-by: Przemek Kitszel 
Signed-off-by: Jesse Brandeburg 
---
v2: merged this patch into larger series, modified after Olek's comments
to include bits encoding where changing lines for prep or get.
---
 .../ethernet/intel/idpf/idpf_singleq_txrx.c   |  7 +--
 drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 58 +--
 2 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c 
b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
index 81288a17da2a..447753495c53 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
@@ -328,10 +328,9 @@ static void idpf_tx_singleq_build_ctx_desc(struct 
idpf_queue *txq,
 
if (offload->tso_segs) {
qw1 |= IDPF_TX_CTX_DESC_TSO << IDPF_TXD_CTX_QW1_CMD_S;
-   qw1 |= ((u64)offload->tso_len << IDPF_TXD_CTX_QW1_TSO_LEN_S) &
-   IDPF_TXD_CTX_QW1_TSO_LEN_M;
-   qw1 |= ((u64)offload->mss << IDPF_TXD_CTX_QW1_MSS_S) &
-   IDPF_TXD_CTX_QW1_MSS_M;
+   qw1 |= FIELD_PREP(IDPF_TXD_CTX_QW1_TSO_LEN_M,
+ offload->tso_len);
+   qw1 |= FIELD_PREP(IDPF_TXD_CTX_QW1_MSS_M, offload->mss);
 
u64_stats_update_begin(&txq->stats_sync);
u64_stats_inc(&txq->q_stats.tx.lso_pkts);
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index 1f728a9004d9..725f2477f979 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -505,9 +505,9 @@ static void idpf_rx_post_buf_refill(struct idpf_sw_queue 
*refillq, u16 buf_id)
 
/* store the buffer ID and the SW maintained GEN bit to the refillq */
refillq->ring[nta] =
-   ((buf_id << IDPF_RX_BI_BUFID_S) & IDPF_RX_BI_BUFID_M) |
-   (!!(test_bit(__IDPF_Q_GEN_CHK, refillq->flags)) <<
-IDPF_RX_BI_GEN_S);
+   FIELD_PREP(IDPF_RX_BI_BUFID_M, buf_id) |
+   FIELD_PREP(IDPF_RX_BI_GEN_M,
+  test_bit(__IDPF_Q_GEN_CHK, refillq->flags));
 
if (unlikely(++nta == refillq->desc_count)) {
nta = 0;
@@ -1825,14 +1825,14 @@ static bool idpf_tx_clean_complq(struct idpf_queue 
*complq, int budget,
u16 gen;
 
/* if the descriptor isn't done, no work yet to do */
-   gen = (le16_to_cpu(tx_desc->qid_comptype_gen) &
- IDPF_TXD_COMPLQ_GEN_M) >> IDPF_TXD_COMPLQ_GEN_S;
+   gen = le16_get_bits(tx_desc->qid_comptype_gen,
+   IDPF_TXD_COMPLQ_GEN_M);
if (test_bit(__IDPF_Q_GEN_CHK, complq->flags) != gen)
break;
 
/* Find necessary info of TX queue to clean buffers */
-   rel_tx_qid = (le16_to_cpu(tx_desc->qid_comptype_gen) &
-IDPF_TXD_COMPLQ_QID_M) >> IDPF_TXD_COMPLQ_QID_S;
+   rel_tx_qid = le16_get_bits(tx_desc->qid_comptype_gen,
+  IDPF_TXD_COMPLQ_QID_M);
if (rel_tx_qid >= complq->txq_grp->num_txq ||
!complq->txq_grp->txqs[rel_tx_qid]) {
dev_err(&complq->vport->adapter->pdev->dev,
@@ -1842,9 +1842,8 @@ static bool idpf_tx_clean_complq(struct idpf_queue 
*complq, int budget,
tx_q = complq->txq_grp->txqs[rel_tx_qid];
 
/* Determine completion type */
-   ctype = (le16_to_cpu(tx_desc->qid_comptype_gen) &
-   IDPF_TXD_COMPLQ_COMPL_TYPE_M) >>
-   IDPF_TXD_COMPLQ_COMPL_TYPE_S;
+   ctype = le16_get_bits(tx_desc->qid_comptype_gen,
+ IDPF_TXD_COMPLQ_COMPL_TYPE_M);
switch (ctype) {
case IDPF_TXD_COMPLT_RE:
hw_head = le16_to_cpu(tx_desc->q_head_compl_tag.q_head);
@@ -1945,11 +1944,10 @@ void idpf_tx_splitq_build_ctb(union idpf_tx_flex_desc 
*desc,
  u16 td_cmd, u1

[Intel-wired-lan] [PATCH iwl-next v2 14/15] ice: cleanup inconsistent code

2023-12-05 Thread Jesse Brandeburg
It was found while doing further testing of the previous commit
fbf32a9bab91 ("ice: field get conversion") that one of the FIELD_GET
conversions should really be a FIELD_PREP. The previous code was styled
as a match to the FIELD_GET conversion, which always worked because the
shift value was 0.  The code makes way more sense as a FIELD_PREP and
was in fact the only FIELD_GET with two constant arguments in this
series.

Didn't squash this patch to make it easier to call out the
(non-impactful) bug.

Signed-off-by: Jesse Brandeburg 
---
 drivers/net/ethernet/intel/ice/ice_dcb.c | 2 +-
 drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_dcb.c 
b/drivers/net/ethernet/intel/ice/ice_dcb.c
index 7f3e00c187b4..74418c445cc4 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb.c
@@ -967,7 +967,7 @@ void ice_get_dcb_cfg_from_mib_change(struct ice_port_info 
*pi,
 
mib = (struct ice_aqc_lldp_get_mib *)&event->desc.params.raw;
 
-   change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M,  mib->type);
+   change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type);
if (change_type == ICE_AQ_LLDP_MIB_REMOTE)
dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c 
b/drivers/net/ethernet/intel/ice/ice_lib.c
index 8cdd53412748..d1c1e53fe15c 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -974,8 +974,8 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct 
ice_vsi_ctx *ctxt)
/* Traffic from VSI can be sent to LAN */
ctxt->info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
/* allow all untagged/tagged packets by default on Tx */
-   ctxt->info.inner_vlan_flags = FIELD_GET(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
-   
ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
+   ctxt->info.inner_vlan_flags = 
FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
+
ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL);
/* SVM - by default bits 3 and 4 in inner_vlan_flags are 0's which
 * results in legacy behavior (show VLAN, DEI, and UP) in descriptor.
 *
-- 
2.39.3

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan


[Intel-wired-lan] [PATCH iwl-next v2 09/15] intel: legacy: field get conversion

2023-12-05 Thread Jesse Brandeburg
Refactor several older Intel drivers to use FIELD_GET(), which reduces
lines of code and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

@get@
constant shift,mask;
type T;
expression a;
@@
(
-((T)((a) & mask) >> shift)
+FIELD_GET(mask, a)

and applied via:
spatch --sp-file field_prep.cocci --in-place --dir \
 drivers/net/ethernet/intel/

Cc: Julia Lawall 
CC: Alexander Lobakin 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: update to le16_encode_bits in one spot
---
 drivers/net/ethernet/intel/e1000/e1000_hw.c   | 45 ---
 .../net/ethernet/intel/e1000e/80003es2lan.c   |  3 +-
 drivers/net/ethernet/intel/e1000e/82571.c |  3 +-
 drivers/net/ethernet/intel/e1000e/ethtool.c   |  7 ++-
 drivers/net/ethernet/intel/e1000e/ich8lan.c   | 18 +++-
 drivers/net/ethernet/intel/e1000e/mac.c   |  8 ++--
 drivers/net/ethernet/intel/e1000e/netdev.c| 11 ++---
 drivers/net/ethernet/intel/e1000e/phy.c   | 17 +++
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c   |  3 +-
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c   |  9 ++--
 drivers/net/ethernet/intel/igb/e1000_82575.c  | 29 +---
 drivers/net/ethernet/intel/igb/e1000_i210.c   | 15 ---
 drivers/net/ethernet/intel/igb/e1000_mac.c|  7 ++-
 drivers/net/ethernet/intel/igb/e1000_nvm.c| 14 +++---
 drivers/net/ethernet/intel/igb/e1000_phy.c|  9 ++--
 drivers/net/ethernet/intel/igb/igb_ethtool.c  |  8 ++--
 drivers/net/ethernet/intel/igb/igb_main.c |  4 +-
 drivers/net/ethernet/intel/igbvf/mbx.c|  1 +
 drivers/net/ethernet/intel/igbvf/netdev.c |  5 +--
 .../net/ethernet/intel/ixgbe/ixgbe_common.c   | 30 ++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c  |  8 ++--
 .../net/ethernet/intel/ixgbe/ixgbe_sriov.c|  8 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c |  8 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 19 
 25 files changed, 123 insertions(+), 168 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c 
b/drivers/net/ethernet/intel/e1000/e1000_hw.c
index 4576511c99f5..f9328f2e669f 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c
@@ -3261,8 +3261,7 @@ static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
return ret_val;
 
phy_info->mdix_mode =
-   (e1000_auto_x_mode) ((phy_data & IGP01E1000_PSSR_MDIX) >>
-IGP01E1000_PSSR_MDIX_SHIFT);
+   (e1000_auto_x_mode)FIELD_GET(IGP01E1000_PSSR_MDIX, phy_data);
 
if ((phy_data & IGP01E1000_PSSR_SPEED_MASK) ==
IGP01E1000_PSSR_SPEED_1000MBPS) {
@@ -3273,11 +3272,11 @@ static s32 e1000_phy_igp_get_info(struct e1000_hw *hw,
if (ret_val)
return ret_val;
 
-   phy_info->local_rx = ((phy_data & SR_1000T_LOCAL_RX_STATUS) >>
- SR_1000T_LOCAL_RX_STATUS_SHIFT) ?
+   phy_info->local_rx = FIELD_GET(SR_1000T_LOCAL_RX_STATUS,
+  phy_data) ?
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
-   phy_info->remote_rx = ((phy_data & SR_1000T_REMOTE_RX_STATUS) >>
-  SR_1000T_REMOTE_RX_STATUS_SHIFT) ?
+   phy_info->remote_rx = FIELD_GET(SR_1000T_REMOTE_RX_STATUS,
+   phy_data) ?
e1000_1000t_rx_status_ok : e1000_1000t_rx_status_not_ok;
 
/* Get cable length */
@@ -3327,14 +3326,12 @@ static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
return ret_val;
 
phy_info->extended_10bt_distance =
-   ((phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE) >>
-M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT) ?
+   FIELD_GET(M88E1000_PSCR_10BT_EXT_DIST_ENABLE, phy_data) ?
e1000_10bt_ext_dist_enable_lower :
e1000_10bt_ext_dist_enable_normal;
 
phy_info->polarity_correction =
-   ((phy_data & M88E1000_PSCR_POLARITY_REVERSAL) >>
-M88E1000_PSCR_POLARITY_REVERSAL_SHIFT) ?
+   FIELD_GET(M88E1000_PSCR_POLARITY_REVERSAL, phy_data) ?
e1000_polarity_reversal_disabled : e1000_polarity_reversal_enabled;
 
/* Check polarity status */
@@ -3348,27 +3345,25 @@ static s32 e1000_phy_m88_get_info(struct e1000_hw *hw,
return ret_val;
 
phy_info->mdix_mode =
-   (e1000_auto_x_mode) ((phy_data & M88E1000_PSSR_MDIX) >>
-M88E1000_PSSR_MDIX_SHIFT);
+   (e1000_auto_x_mode)FIELD_GET(M88E1000_PSSR_MDIX, phy_data);
 
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
/* Cable Length Estimation and Local/Remote Receiver Information

[Intel-wired-lan] [PATCH iwl-next v2 11/15] i40e: field get conversion

2023-12-05 Thread Jesse Brandeburg
Refactor the i40e driver to use FIELD_GET() for mask and shift reads,
which reduces lines of code and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

While making one of the conversions, an if() check was inverted to
return early and avoid un-necessary indentation of the remainder of the
function. In some other cases a stack variable was moved inside the
block where it was used while doing cleanups/review.

A couple places were changed to use le16_get_bits() instead of FIELD_GET
with a le16_to_cpu combination.

@get@
constant shift,mask;
metavariable type T;
expression a;
@@
-(((T)(a) & mask) >> shift)
+FIELD_GET(mask, a)

and applied via:
spatch --sp-file field_prep.cocci --in-place --dir \
 drivers/net/ethernet/intel/

Cc: Julia Lawall 
Reviewed-by: Aleksandr Loktionov 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: add a couple get_bits
---
 drivers/net/ethernet/intel/i40e/i40e_common.c |  56 +++
 drivers/net/ethernet/intel/i40e/i40e_dcb.c| 158 +++---
 drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_ddp.c|   4 +-
 .../net/ethernet/intel/i40e/i40e_ethtool.c|   7 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c   |  73 
 drivers/net/ethernet/intel/i40e/i40e_nvm.c|  13 +-
 drivers/net/ethernet/intel/i40e/i40e_ptp.c|   4 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   |  29 ++--
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c|  21 ++-
 drivers/net/ethernet/intel/i40e/i40e_xsk.c|   3 +-
 11 files changed, 145 insertions(+), 226 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c 
b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 4ec4ab2c7d48..de6ca6295742 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -664,11 +664,11 @@ int i40e_init_shared_code(struct i40e_hw *hw)
hw->phy.get_link_info = true;
 
/* Determine port number and PF number*/
-   port = (rd32(hw, I40E_PFGEN_PORTNUM) & I40E_PFGEN_PORTNUM_PORT_NUM_MASK)
-  >> I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT;
+   port = FIELD_GET(I40E_PFGEN_PORTNUM_PORT_NUM_MASK,
+rd32(hw, I40E_PFGEN_PORTNUM));
hw->port = (u8)port;
-   ari = (rd32(hw, I40E_GLPCI_CAPSUP) & I40E_GLPCI_CAPSUP_ARI_EN_MASK) >>
-I40E_GLPCI_CAPSUP_ARI_EN_SHIFT;
+   ari = FIELD_GET(I40E_GLPCI_CAPSUP_ARI_EN_MASK,
+   rd32(hw, I40E_GLPCI_CAPSUP));
func_rid = rd32(hw, I40E_PF_FUNC_RID);
if (ari)
hw->pf_id = (u8)(func_rid & 0xff);
@@ -986,9 +986,8 @@ int i40e_pf_reset(struct i40e_hw *hw)
 * The grst delay value is in 100ms units, and we'll wait a
 * couple counts longer to be sure we don't just miss the end.
 */
-   grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) &
-   I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >>
-   I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT;
+   grst_del = FIELD_GET(I40E_GLGEN_RSTCTL_GRSTDEL_MASK,
+rd32(hw, I40E_GLGEN_RSTCTL));
 
/* It can take upto 15 secs for GRST steady state.
 * Bump it to 16 secs max to be safe.
@@ -1080,26 +1079,20 @@ void i40e_clear_hw(struct i40e_hw *hw)
 
/* get number of interrupts, queues, and VFs */
val = rd32(hw, I40E_GLPCI_CNF2);
-   num_pf_int = (val & I40E_GLPCI_CNF2_MSI_X_PF_N_MASK) >>
-I40E_GLPCI_CNF2_MSI_X_PF_N_SHIFT;
-   num_vf_int = (val & I40E_GLPCI_CNF2_MSI_X_VF_N_MASK) >>
-I40E_GLPCI_CNF2_MSI_X_VF_N_SHIFT;
+   num_pf_int = FIELD_GET(I40E_GLPCI_CNF2_MSI_X_PF_N_MASK, val);
+   num_vf_int = FIELD_GET(I40E_GLPCI_CNF2_MSI_X_VF_N_MASK, val);
 
val = rd32(hw, I40E_PFLAN_QALLOC);
-   base_queue = (val & I40E_PFLAN_QALLOC_FIRSTQ_MASK) >>
-I40E_PFLAN_QALLOC_FIRSTQ_SHIFT;
-   j = (val & I40E_PFLAN_QALLOC_LASTQ_MASK) >>
-   I40E_PFLAN_QALLOC_LASTQ_SHIFT;
+   base_queue = FIELD_GET(I40E_PFLAN_QALLOC_FIRSTQ_MASK, val);
+   j = FIELD_GET(I40E_PFLAN_QALLOC_LASTQ_MASK, val);
if (val & I40E_PFLAN_QALLOC_VALID_MASK && j >= base_queue)
num_queues = (j - base_queue) + 1;
else
num_queues = 0;
 
val = rd32(hw, I40E_PF_VT_PFALLOC);
-   i = (val & I40E_PF_VT_PFALLOC_FIRSTVF_MASK) >>
-   I40E_PF_VT_PFALLOC_FIRSTVF_SHIFT;
-   j = (val & I40E_PF_VT_PFALLOC_LASTVF_MASK) >>
-   I40E_PF_VT_PFALLOC_LASTVF_SHIFT;
+   i = FIELD_GET(I40E_PF_VT_PFALLOC_FIRSTVF_MASK, val);
+   j = FIELD_GET(I40E_PF_VT_PFALLOC_LASTVF_MASK, val);
if (val & I40E_PF_VT_PFALLOC_VALID_MASK && j >= i)
num_vfs = (j - i) + 1;
else
@@ -1194,8 +1187,7 @@ static u32 i40e_led_is_mine(struct i40e_hw 

[Intel-wired-lan] [PATCH iwl-next v2 06/15] ice: field prep conversion

2023-12-05 Thread Jesse Brandeburg
Refactor ice driver to use FIELD_PREP(), which reduces lines of code
and adds clarity of intent.

This code was generated by the following coccinelle/spatch script and
then manually repaired.

Several places I changed to OR into a single variable with |= instead of
using a multi-line statement with trailing OR operators, as it
(subjectively) makes the code clearer.

A local variable vmvf_and_timeout was created and used to avoid multiple
logical ORs being __le16 converted, which shortened some lines and makes
the code cleaner.

Also clean up a couple of places where conversions were made to have the
code read more clearly/consistently.

@prep2@
constant shift,mask;
type T;
expression a;
@@
-(((T)(a) << shift) & mask)
+FIELD_PREP(mask, a)

@prep@
constant shift,mask;
type T;
expression a;
@@
-((T)((a) << shift) & mask)
+FIELD_PREP(mask, a)

Cc: Julia Lawall 
CC: Alexander Lobakin 
Reviewed-by: Marcin Szycik 
Reviewed-by: Simon Horman 
Signed-off-by: Jesse Brandeburg 
---
v2: added a couple more preps, some code cleanups found when looking for
le32_set/encode opportunities.
---
 drivers/net/ethernet/intel/ice/ice_base.c | 20 ++---
 drivers/net/ethernet/intel/ice/ice_common.c   | 35 -
 drivers/net/ethernet/intel/ice/ice_dcb.c  |  3 +-
 drivers/net/ethernet/intel/ice/ice_dcb_lib.c  |  2 +-
 drivers/net/ethernet/intel/ice/ice_eswitch.c  |  4 +-
 drivers/net/ethernet/intel/ice/ice_fdir.c | 69 ++---
 .../net/ethernet/intel/ice/ice_flex_pipe.c|  8 +-
 drivers/net/ethernet/intel/ice/ice_flow.c |  2 +-
 drivers/net/ethernet/intel/ice/ice_lag.c  |  7 +-
 drivers/net/ethernet/intel/ice/ice_lib.c  | 52 +
 drivers/net/ethernet/intel/ice/ice_ptp.c  |  9 +--
 drivers/net/ethernet/intel/ice/ice_sriov.c| 38 --
 drivers/net/ethernet/intel/ice/ice_switch.c   | 75 +--
 drivers/net/ethernet/intel/ice/ice_txrx.c |  6 +-
 drivers/net/ethernet/intel/ice/ice_virtchnl.c |  8 +-
 .../ethernet/intel/ice/ice_virtchnl_fdir.c|  2 +-
 .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 25 +++
 17 files changed, 147 insertions(+), 218 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c 
b/drivers/net/ethernet/intel/ice/ice_base.c
index 7fa43827a3f0..3fd6e99dba23 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -234,14 +234,10 @@ static void ice_cfg_itr_gran(struct ice_hw *hw)
  GLINT_CTL_ITR_GRAN_25_S) == ICE_ITR_GRAN_US))
return;
 
-   regval = ((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_200_S) &
- GLINT_CTL_ITR_GRAN_200_M) |
-((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_100_S) &
- GLINT_CTL_ITR_GRAN_100_M) |
-((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_50_S) &
- GLINT_CTL_ITR_GRAN_50_M) |
-((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_25_S) &
- GLINT_CTL_ITR_GRAN_25_M);
+   regval = FIELD_PREP(GLINT_CTL_ITR_GRAN_200_M, ICE_ITR_GRAN_US) |
+FIELD_PREP(GLINT_CTL_ITR_GRAN_100_M, ICE_ITR_GRAN_US) |
+FIELD_PREP(GLINT_CTL_ITR_GRAN_50_M, ICE_ITR_GRAN_US) |
+FIELD_PREP(GLINT_CTL_ITR_GRAN_25_M, ICE_ITR_GRAN_US);
wr32(hw, GLINT_CTL, regval);
 }
 
@@ -913,10 +909,10 @@ ice_cfg_txq_interrupt(struct ice_vsi *vsi, u16 txq, u16 
msix_idx, u16 itr_idx)
struct ice_hw *hw = &pf->hw;
u32 val;
 
-   itr_idx = (itr_idx << QINT_TQCTL_ITR_INDX_S) & QINT_TQCTL_ITR_INDX_M;
+   itr_idx = FIELD_PREP(QINT_TQCTL_ITR_INDX_M, itr_idx);
 
val = QINT_TQCTL_CAUSE_ENA_M | itr_idx |
- ((msix_idx << QINT_TQCTL_MSIX_INDX_S) & QINT_TQCTL_MSIX_INDX_M);
+ FIELD_PREP(QINT_TQCTL_MSIX_INDX_M, msix_idx);
 
wr32(hw, QINT_TQCTL(vsi->txq_map[txq]), val);
if (ice_is_xdp_ena_vsi(vsi)) {
@@ -945,10 +941,10 @@ ice_cfg_rxq_interrupt(struct ice_vsi *vsi, u16 rxq, u16 
msix_idx, u16 itr_idx)
struct ice_hw *hw = &pf->hw;
u32 val;
 
-   itr_idx = (itr_idx << QINT_RQCTL_ITR_INDX_S) & QINT_RQCTL_ITR_INDX_M;
+   itr_idx = FIELD_PREP(QINT_RQCTL_ITR_INDX_M, itr_idx);
 
val = QINT_RQCTL_CAUSE_ENA_M | itr_idx |
- ((msix_idx << QINT_RQCTL_MSIX_INDX_S) & QINT_RQCTL_MSIX_INDX_M);
+ FIELD_PREP(QINT_RQCTL_MSIX_INDX_M, msix_idx);
 
wr32(hw, QINT_RQCTL(vsi->rxq_map[rxq]), val);
 
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c 
b/drivers/net/ethernet/intel/ice/ice_common.c
index 8d97434e1413..eb5c00b83112 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -4095,6 +4095,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 
bus_addr,
 {
struct ice_aqc_sff_eeprom *cmd;
struct ice_aq_desc desc;
+   u16 i2c_bus_addr;
int status;
 
if (!data || (mem_addr & 0xff00))
@@ -4105,15 +4106,13 @@ ice_aq_sff_eeprom(struct ice_hw *hw

Re: [Intel-wired-lan] [PATCH iwl-next v1] idpf: refactor some missing field get/prep conversions

2023-12-05 Thread Jesse Brandeburg
On 12/4/2023 2:26 AM, Alexander Lobakin wrote:
yping.
> 
> What is "not a constant"?
> 
>   ring[nta] = FIELD_PREP(IDPF_RX_BI_GEN_M,
>  test_bit(__IDPF_Q_GEN_CHK, flags));
> 
> Is there a problem with this ^ code?
> 
> "The scripts ignored that" is not a good argument I'd say :>

Fixed in v2


>> Generally I'd prefer that the kind of check above returned a bool with a
>> constant conversion of the mask (compile time) to an LE16 mask, and then
>> use that, which is why all of our other drivers do that instead.
> 
> Ah, good point. Smth like
> 
>   gen = !!(tx_desc->qid_comptype_gen &
>IDPF_TXQ_COMPLQ_GEN_M_LE);

Yeah, it would be nice but I didn't add that to this series. But you
have the idea.

> 
> OTOH x86 is always LE and BE is seen more and more rarely nowadays. It
> might just not worth having a LE-version of each such mask for the sake
> of a bit more optimized code on architectures where our drivers are
> barely used.

Our drivers should work on BE, IMO. sparse annotations takes care of
making sure we have the conversions right, they cost nothing on x86.

> 
>>
>>>
>>> Moreover, you could use le*_{get,encode,replace}_bits() to get/set LE
>>> values right away without 2-step operation (from/to CPU + masks), but
>>> you didn't do that here (see below for an example).

Done in v2.

>>
>> Those aren't widely used yet in our drivers so I wasn't picking them up
>> yet. But thank you for pointing that out.
>>
>> 
>>
>>
>>> In general, I would say those two issues are very common in IDPF and
>>> also the whole your series converting the Intel drivers. The scripts
>>> won't check whether the mask has only 1 bit or whether the value gets
>>> converted from/to LE, so they won't help here.
>>
>> I had been hoping to do some more followup work. it's possible that with
>> some tweaking the coccinelle script could learn how to detect non-pow2
>> constants, and therefore possibly one bit constants as well. Maybe
>> @Julia can help us refine the script and possibly get it into the
>> scripts/coccinelle directory to help other drivers as well.
> 
> Every automated change needs polishing by human.
> 
> Don't FIELD_*() macros already check whether the passed mask is actually
> a contiguous mask?

Yes

> 
>>
>>> Could you maybe manually recheck all the places where bitfield masks are
>>> used at least in IDPF (better in ice, iavf, i40e, ..., as well) and
>>> posted a series that would address them? At the end, manual work is more
>>> valuable than automated conversions :p
>>
>> I think a followup series would work better for this, do you agree?
> 
> Nope :D If you want to convert all of our drivers to use bitfield API,
> I'd like to see a complete mature series instead of incremental series
> of series where followups will refactor the code introduced in the
> earlier ones.

v2 of the previous series sent with audit of all *cpu* conversions and
fixing up leXX_*_bits() opportunities.

Appreciate the reviews!

___
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan