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 argumen

[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 ear

[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

[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_G

[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. Th

[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_bi

[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

[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

[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

[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)

[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 th

[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@ cons

[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_

[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_

[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

[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 inclu

[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 patc

[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 pr

[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

[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.

[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 cache

[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

[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 f

[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 su

[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

[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 se

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_c

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_RETST

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 e

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 RT

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

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

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 re

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

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:

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 Chmiel

[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/ic

[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

[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: J

[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 handlin

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;