Re: [Intel-wired-lan] [PATCH iwl-next] ice: use DSN instead of PCI BDF for ice_adapter index

2025-03-07 Thread Jacob Keller



On 3/7/2025 4:40 AM, Jiri Pirko wrote:
> Fri, Mar 07, 2025 at 12:53:05AM +0100, jacob.e.kel...@intel.com wrote:
>>
>>
>> On 3/6/2025 1:11 PM, Przemek Kitszel wrote:
>>> Use Device Serial Number instead of PCI bus/device/function for
>>> index of struct ice_adapter.
>>> Functions on the same physical device should point to the very same
>>> ice_adapter instance.
>>>
>>> This is not only simplification, but also fixes things up when PF
>>> is passed to VM (and thus has a random BDF).
>>>
>>> Suggested-by: Jacob Keller 
>>> Suggested-by: Jakub Kicinski 
>>> Suggested-by: Jiri Pirko 
>>> Reviewed-by: Aleksandr Loktionov 
>>> Signed-off-by: Przemek Kitszel 
>>> ---
>>
>> The only caution I have here is that we might run into issues with
>> pre-production or poorly flashed boards which don't have DSN properly
>> flashed. This shouldn't be an impact outside of early testing or
>> mistakes by devs. I think there is a default ID which is almost all 0s
>> we could check and log a warning to help prevent confusion in such a case?
>>
>> A couple systems I've seen have serial numbers like:
>>
>>  serial_number 00-00-00-00-00-00-00-00
>>  serial_number 00-00-00-00-00-00-00-00
>>
>> or
>>
>>  serial_number 00-01-00-ff-ff-00-00-00
>>  serial_number 00-01-00-ff-ff-00-00-00
>>
>>
>> In practice I'm not sure how big a deal breaker this is. Properly
>> initialized boards should have unique IDs, and if you update via
>> devlink, or any of our standard update tools, it will maintain the ID
>> across flash. However, during early development, boards were often
>> flashed manually which could lead to such non-unique IDs.
> 
> Do we need a workaround for pre-production buggy hw now? Sounds a bit
> weird tbh.
> 

I agree that use of the serial number is preferred over BDF for the
reasons described in this thread.

But I also know that sometimes the DSN is not available, or is not set
properly during pre-production and early testing. This could cause
issues for early development. These issues can likely be worked around
and should not impact what we do for properly functioning boards.

I just want to make it clear on the record, since it is likely that we
would see this if using an old or badly flashed board, or if we use this
same scheme on a future hardware (or even just a spin of the ice
hardware). In those cases, developers might have breaking functionality
like multiple adapters being tied to the same adapter structure.

I *don't* want those to be reported as issues with this code, as they
are really issues with the flash data. Perhaps we could have some sort
of warning message to go "this doesn't look right" when the DSN
capability doesn't exist or when the DSN is 0.

In the end, the places where this is likely to fail are also the places
where hopefully the developers are smart enough to know what is going on.


Re: [Intel-wired-lan] [PATCH iwl-next v5] ixgbe: add support for thermal sensor event reception

2025-03-07 Thread Lokan, JeremiahX J
> -Original Message-
> From: Intel-wired-lan  On Behalf 
> Of Jedrzej Jagielski
> Sent: Tuesday, February 25, 2025 6:34 AM
> To: intel-wired-...@lists.osuosl.org
> Cc: Nguyen, Anthony L ; 
> net...@vger.kernel.org; and...@lunn.ch; pmen...@molgen.mpg.de; 
> ho...@kernel.org; Jagielski, Jedrzej ; 
> Kitszel, Przemyslaw ; Polchlopek, 
> Mateusz 
> Subject: [Intel-wired-lan] [PATCH iwl-next v5] ixgbe: add support for 
> thermal sensor event reception
>
> E610 NICs unlike the previous devices utilising ixgbe driver are 
> notified in the case of overheating by the FW ACI event.
>
> In event of overheat when threshold is exceeded, FW suspends all 
> traffic and sends overtemp event to the driver. Then driver logs 
> appropriate message and disables the adapter instance.
> The card remains in that state until the platform is rebooted.
>
> This approach is a solution to the fact current version of the
> E610 FW doesn't support reading thermal sensor data by the SW. So give 
> to user at least any info that overtemp event has occurred, without 
> interface disappearing from the OS without any note.
>
> Reviewed-by: Przemek Kitszel 
> Reviewed-by: Mateusz Polchlopek 
> Reviewed-by: Simon Horman 
> Signed-off-by: Jedrzej Jagielski 
> ---
> v2,3,4 : commit msg tweaks
> v5: use ixgbe_down()
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  | 4 
>  drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h | 3 +++
>  2 files changed, 7 insertions(+)
Tested-by: Jeremiah Lokan < jeremiahx.j.lo...@intel.com> (A Contingent worker 
at Intel)


[Intel-wired-lan] [PATCH] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions

2025-03-07 Thread Rand Deeb
The current implementation of `ixgbe_write_i2c_combined_generic_int` and
`ixgbe_write_i2c_byte_generic_int` sets `max_retry` to `1`, which makes
the condition `retry < max_retry` always evaluate to `false`. This renders
the retry mechanism ineffective, as the debug message and retry logic are
never executed.

This patch increases `max_retry` to `3` in both functions, aligning them
with the retry logic in `ixgbe_read_i2c_combined_generic_int`. This
ensures that the retry mechanism functions as intended, improving
robustness in case of I2C write failures.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Rand Deeb 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index 0a03a8bb5f88..2d54828bdfbb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -167,7 +167,7 @@ int ixgbe_write_i2c_combined_generic_int(struct ixgbe_hw 
*hw, u8 addr,
 u16 reg, u16 val, bool lock)
 {
u32 swfw_mask = hw->phy.phy_semaphore_mask;
-   int max_retry = 1;
+   int max_retry = 3;
int retry = 0;
u8 reg_high;
u8 csum;
@@ -2285,7 +2285,7 @@ static int ixgbe_write_i2c_byte_generic_int(struct 
ixgbe_hw *hw, u8 byte_offset,
u8 dev_addr, u8 data, bool lock)
 {
u32 swfw_mask = hw->phy.phy_semaphore_mask;
-   u32 max_retry = 1;
+   u32 max_retry = 3;
u32 retry = 0;
int status;
 
-- 
2.34.1



Re: [Intel-wired-lan] [PATCH net-next 04/16] libeth: add XSk helpers

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:20PM +0100, Alexander Lobakin wrote:
> Add the following counterparts of functions from libeth_xdp which need
> special care on XSk path:
> 
> * building &xdp_buff (head and frags);
> * running XDP prog and managing all possible verdicts;
> * xmit (with S/G and metadata support);
> * wakeup via CSD/IPI;
> * FQ init/deinit and refilling.
> 
> Xmit by default unrolls loops by 8 when filling Tx DMA descriptors.
> XDP_REDIRECT verdict is considered default/likely(). Rx frags are
> considered unlikely().
> It is assumed that Tx/completion queues are not mapped to any
> interrupts, thus we clean them only when needed (=> 3/4 of
> descriptors is busy) and keep need_wakeup set.
> IPI for XSk wakeup showed better performance than triggering an SW
> NIC interrupt, though it doesn't respect NIC's interrupt affinity.

Maybe introduce this with xsk support on idpf (i suppose when set after
this one) ?

Otherwise, what is the reason to have this included? I didn't check
in-depth if there are any functions used from this patch on drivers side.

> 
> Suggested-by: Maciej Fijalkowski  # lots of 
> stuff
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/libeth/Kconfig  |   2 +-
>  drivers/net/ethernet/intel/libeth/Makefile |   1 +
>  drivers/net/ethernet/intel/libeth/priv.h   |  11 +
>  include/net/libeth/tx.h|  10 +-
>  include/net/libeth/xdp.h   |  90 ++-
>  include/net/libeth/xsk.h   | 685 +
>  drivers/net/ethernet/intel/libeth/tx.c |   5 +-
>  drivers/net/ethernet/intel/libeth/xdp.c|  26 +-
>  drivers/net/ethernet/intel/libeth/xsk.c| 269 
>  9 files changed, 1067 insertions(+), 32 deletions(-)
>  create mode 100644 include/net/libeth/xsk.h
>  create mode 100644 drivers/net/ethernet/intel/libeth/xsk.c
> 

(...)


Re: [Intel-wired-lan] [PATCH iwl-next v2 4/4] igb: Get rid of spurious interrupts

2025-03-07 Thread Kumari, Sweta


> -Original Message-
> From: Intel-wired-lan  On Behalf Of
> Kurt Kanzenbach
> Sent: Monday, February 17, 2025 5:01 PM
> To: Nguyen, Anthony L ; Kitszel, Przemyslaw
> 
> Cc: Andrew Lunn ; David S. Miller
> ; Eric Dumazet ; Jakub
> Kicinski ; Paolo Abeni ; Sebastian
> Andrzej Siewior ; Damato, Joe
> ; Gerhard Engleder  embedded.com>; intel-wired-...@lists.osuosl.org; net...@vger.kernel.org;
> Kurt Kanzenbach 
> Subject: [Intel-wired-lan] [PATCH iwl-next v2 4/4] igb: Get rid of spurious
> interrupts
> 
> When running the igc with XDP/ZC in busy polling mode with deferral of hard
> interrupts, interrupts still happen from time to time. That is caused by the 
> igb
> task watchdog which triggers Rx interrupts periodically.
> 
> That mechanism has been introduced to overcome skb/memory allocation
> failures [1]. So the Rx clean functions stop processing the Rx ring in case of
> such failure. The task watchdog triggers Rx interrupts periodically in the 
> hope
> that memory became available in the mean time.
> 
> The current behavior is undesirable for real time applications, because the
> driver induced Rx interrupts trigger also the softirq processing. However, all
> real time packets should be processed by the application which uses the busy
> polling method.
> 
> Therefore, only trigger the Rx interrupts in case of real allocation failures.
> Introduce a new flag for signaling that condition.
> 
> Follow the same logic as in commit 8dcf2c212078 ("igc: Get rid of spurious
> interrupts").
> 
> [1] -
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=3b
> e507547e6177e5c808544bd6a2efa2c7f1d436
> 
> Reviewed-by: Joe Damato 
> Signed-off-by: Kurt Kanzenbach 
> ---
>  drivers/net/ethernet/intel/igb/igb.h  |  3 ++-
>  drivers/net/ethernet/intel/igb/igb_main.c | 29
> +  drivers/net/ethernet/intel/igb/igb_xsk.c  |
> 1 +
>  3 files changed, 28 insertions(+), 5 deletions(-)
> 
Tested-by: Sweta Kumari 


Re: [Intel-wired-lan] [PATCH iwl-next v8 08/11] igc: add support to set tx-min-frag-size

2025-03-07 Thread Abdul Rahim, Faizal




On 6/3/2025 8:43 am, Vladimir Oltean wrote:

diff --git a/net/ethtool/mm.c b/net/ethtool/mm.c
index ad9b40034003..4c395cd949ab 100644
--- a/net/ethtool/mm.c
+++ b/net/ethtool/mm.c
@@ -153,7 +153,7 @@ const struct nla_policy 
ethnl_mm_set_policy[ETHTOOL_A_MM_MAX + 1] = {
[ETHTOOL_A_MM_VERIFY_TIME]  = NLA_POLICY_RANGE(NLA_U32, 1, 128),
[ETHTOOL_A_MM_TX_ENABLED]   = NLA_POLICY_MAX(NLA_U8, 1),
[ETHTOOL_A_MM_PMAC_ENABLED] = NLA_POLICY_MAX(NLA_U8, 1),
-   [ETHTOOL_A_MM_TX_MIN_FRAG_SIZE] = NLA_POLICY_RANGE(NLA_U32, 60, 252),
+   [ETHTOOL_A_MM_TX_MIN_FRAG_SIZE] = NLA_POLICY_RANGE(NLA_U32, 60, 256),


Please make this a separate patch with a reasonably convincing
justification for any reader, and also state why it is a change that
will not introduce regressions to the other drivers. It shows that
you've done the due dilligence of checking that they all use
ethtool_mm_frag_size_min_to_add(), which errors out on non-standard
values.

To be clear, extending the policy from 252 to 256 is just to suppress
the netlink warning which states that the driver rounds up the minimum
fragment size, correct? Because even if you pass 252 (the current
netlink maximum), the driver will still use 256.

I originally changed 252 to 256 because our internal validation failed when 
setting 256 via ethtool. The test case was based on our old kernel OOT 
patches code, but this run was done on the upstreamed FPE framework plus 
this series. After thinking about it, it doesn’t seem right to change this 
just to accommodate the i226 quirk in a common layer when the IEEE standard 
and other devices use 252.


So, we’ll update our validation to use 252 instead. The driver already 
rounds up to 256 anyway. I’ll drop this change in the next revision.


Also, noted your point about being cautious with changes that impact other 
drivers.


Thanks.


Re: [Intel-wired-lan] [PATCH net-next 08/16] idpf: make complq cleaning dependent on scheduling mode

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:24PM +0100, Alexander Lobakin wrote:
> From: Michal Kubiak 
> 
> Extend completion queue cleaning function to support queue-based
> scheduling mode needed for XDP queues.
> Add 4-byte descriptor for queue-based scheduling mode and
> perform some refactoring to extract the common code for
> both scheduling modes.
> 
> Signed-off-by: Michal Kubiak 
> Signed-off-by: Alexander Lobakin 
> ---
>  .../net/ethernet/intel/idpf/idpf_lan_txrx.h   |   6 +-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h   |  11 +-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 256 +++---
>  3 files changed, 177 insertions(+), 96 deletions(-)

some comments inline, i didn't trim though.

> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h 
> b/drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h
> index 8c7f8ef8f1a1..7f12c7f2e70e 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h
> @@ -186,13 +186,17 @@ struct idpf_base_tx_desc {
>   __le64 qw1; /* type_cmd_offset_bsz_l2tag1 */
>  }; /* read used with buffer queues */
>  
> -struct idpf_splitq_tx_compl_desc {
> +struct idpf_splitq_4b_tx_compl_desc {
>   /* qid=[10:0] comptype=[13:11] rsvd=[14] gen=[15] */
>   __le16 qid_comptype_gen;
>   union {
>   __le16 q_head; /* Queue head */
>   __le16 compl_tag; /* Completion tag */
>   } q_head_compl_tag;
> +}; /* writeback used with completion queues */
> +
> +struct idpf_splitq_tx_compl_desc {
> + struct idpf_splitq_4b_tx_compl_desc common;
>   u8 ts[3];
>   u8 rsvd; /* Reserved */
>  }; /* writeback used with completion queues */
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h 
> b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> index b029f566e57c..9f938301b2c5 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> @@ -743,7 +743,9 @@ libeth_cacheline_set_assert(struct idpf_buf_queue, 64, 
> 24, 32);
>  
>  /**
>   * struct idpf_compl_queue - software structure representing a completion 
> queue
> - * @comp: completion descriptor array
> + * @comp: 8-byte completion descriptor array
> + * @comp_4b: 4-byte completion descriptor array
> + * @desc_ring: virtual descriptor ring address
>   * @txq_grp: See struct idpf_txq_group
>   * @flags: See enum idpf_queue_flags_t
>   * @desc_count: Number of descriptors
> @@ -763,7 +765,12 @@ libeth_cacheline_set_assert(struct idpf_buf_queue, 64, 
> 24, 32);
>   */
>  struct idpf_compl_queue {
>   __cacheline_group_begin_aligned(read_mostly);
> - struct idpf_splitq_tx_compl_desc *comp;
> + union {
> + struct idpf_splitq_tx_compl_desc *comp;
> + struct idpf_splitq_4b_tx_compl_desc *comp_4b;
> +
> + void *desc_ring;
> + };
>   struct idpf_txq_group *txq_grp;
>  
>   DECLARE_BITMAP(flags, __IDPF_Q_FLAGS_NBITS);
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
> b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index a3f6e8cff7a0..a240ed115e3e 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -156,8 +156,8 @@ static void idpf_compl_desc_rel(struct idpf_compl_queue 
> *complq)
>   return;
>  
>   dma_free_coherent(complq->netdev->dev.parent, complq->size,
> -   complq->comp, complq->dma);
> - complq->comp = NULL;
> +   complq->desc_ring, complq->dma);
> + complq->desc_ring = NULL;
>   complq->next_to_use = 0;
>   complq->next_to_clean = 0;
>  }
> @@ -284,12 +284,16 @@ static int idpf_tx_desc_alloc(const struct idpf_vport 
> *vport,
>  static int idpf_compl_desc_alloc(const struct idpf_vport *vport,
>struct idpf_compl_queue *complq)
>  {
> - complq->size = array_size(complq->desc_count, sizeof(*complq->comp));
> + u32 desc_size;
>  
> - complq->comp = dma_alloc_coherent(complq->netdev->dev.parent,
> -   complq->size, &complq->dma,
> -   GFP_KERNEL);
> - if (!complq->comp)
> + desc_size = idpf_queue_has(FLOW_SCH_EN, complq) ?
> + sizeof(*complq->comp) : sizeof(*complq->comp_4b);
> + complq->size = array_size(complq->desc_count, desc_size);
> +
> + complq->desc_ring = dma_alloc_coherent(complq->netdev->dev.parent,
> +complq->size, &complq->dma,
> +GFP_KERNEL);
> + if (!complq->desc_ring)
>   return -ENOMEM;
>  
>   complq->next_to_use = 0;
> @@ -1921,8 +1925,46 @@ static bool idpf_tx_clean_buf_ring(struct 
> idpf_tx_queue *txq, u16 compl_tag,
>  }
>  
>  /**
> - * idpf_tx_handle_rs_completion - clean a single packet and all of its 
> buffers
> - * whether on the buffer ring or in the hash table
> + * idpf_parse_compl_des

Re: [Intel-wired-lan] [PATCH net-next 07/16] idpf: link NAPIs to queues

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:23PM +0100, Alexander Lobakin wrote:
> Add the missing linking of NAPIs to netdev queues when enabling
> interrupt vectors in order to support NAPI configuration and
> interfaces requiring get_rx_queue()->napi to be set (like XSk
> busy polling).
> 
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c | 30 +
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
> b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 2f221c0abad8..a3f6e8cff7a0 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -3560,8 +3560,11 @@ void idpf_vport_intr_rel(struct idpf_vport *vport)
>  static void idpf_vport_intr_rel_irq(struct idpf_vport *vport)
>  {
>   struct idpf_adapter *adapter = vport->adapter;
> + bool unlock;
>   int vector;
>  
> + unlock = rtnl_trylock();
> +
>   for (vector = 0; vector < vport->num_q_vectors; vector++) {
>   struct idpf_q_vector *q_vector = &vport->q_vectors[vector];
>   int irq_num, vidx;
> @@ -3573,8 +3576,23 @@ static void idpf_vport_intr_rel_irq(struct idpf_vport 
> *vport)
>   vidx = vport->q_vector_idxs[vector];
>   irq_num = adapter->msix_entries[vidx].vector;
>  
> + for (u32 i = 0; i < q_vector->num_rxq; i++)
> + netif_queue_set_napi(vport->netdev,
> +  q_vector->rx[i]->idx,
> +  NETDEV_QUEUE_TYPE_RX,
> +  NULL);
> +
> + for (u32 i = 0; i < q_vector->num_txq; i++)
> + netif_queue_set_napi(vport->netdev,
> +  q_vector->tx[i]->idx,
> +  NETDEV_QUEUE_TYPE_TX,
> +  NULL);
> +

maybe we could have a wrapper for this?

static void idpf_q_set_napi(struct net_device *netdev,
struct idpf_q_vector *q_vector,
enum netdev_queue_type q_type,
struct napi_struct *napi)
{
u32 q_cnt = q_type == NETDEV_QUEUE_TYPE_RX ? q_vector->num_rxq :
 q_vector->num_txq;
struct idpf_rx_queue **qs = q_type == NETDEV_QUEUE_TYPE_RX ?
  q_vector->rx : q_vector->tx;

for (u32 i = 0; i < q_cnt; i++)
netif_queue_set_napi(netdev, qs[i]->idx, q_type, napi);
}

idpf_q_set_napi(vport->netdev, q_vector, NETDEV_QUEUE_TYPE_RX, NULL);
idpf_q_set_napi(vport->netdev, q_vector, NETDEV_QUEUE_TYPE_TX, NULL);
...
idpf_q_set_napi(vport->netdev, q_vector, NETDEV_QUEUE_TYPE_RX, &q_vector->napi);
idpf_q_set_napi(vport->netdev, q_vector, NETDEV_QUEUE_TYPE_TX, &q_vector->napi);


up to you if you take it, less lines in the end but i don't have strong
opinion if this should be considered as an improvement or makes code
harder to follow.

>   kfree(free_irq(irq_num, q_vector));
>   }
> +
> + if (unlock)
> + rtnl_unlock();
>  }
>  
>  /**
> @@ -3760,6 +3778,18 @@ static int idpf_vport_intr_req_irq(struct idpf_vport 
> *vport)
>  "Request_irq failed, error: %d\n", err);
>   goto free_q_irqs;
>   }
> +
> + for (u32 i = 0; i < q_vector->num_rxq; i++)
> + netif_queue_set_napi(vport->netdev,
> +  q_vector->rx[i]->idx,
> +  NETDEV_QUEUE_TYPE_RX,
> +  &q_vector->napi);
> +
> + for (u32 i = 0; i < q_vector->num_txq; i++)
> + netif_queue_set_napi(vport->netdev,
> +  q_vector->tx[i]->idx,
> +  NETDEV_QUEUE_TYPE_TX,
> +  &q_vector->napi);
>   }
>  
>   return 0;
> -- 
> 2.48.1
> 


Re: [Intel-wired-lan] [PATCH iwl-next v3 3/4] ixgbe: apply different rules for setting FC on E610

2025-03-07 Thread R, Bharath
> -Original Message-
> From: Intel-wired-lan  On Behalf Of
> Jedrzej Jagielski
> Sent: Monday, March 3, 2025 5:36 PM
> To: intel-wired-...@lists.osuosl.org
> Cc: Nguyen, Anthony L ;
> net...@vger.kernel.org; and...@lunn.ch; pmen...@molgen.mpg.de;
> Jagielski, Jedrzej ; Loktionov, Aleksandr
> 
> Subject: [Intel-wired-lan] [PATCH iwl-next v3 3/4] ixgbe: apply different 
> rules
> for setting FC on E610
> 
> E610 device doesn't support disabling FC autonegotiation.
> 
> Create dedicated E610 .set_pauseparam() implementation and assign it to
> ixgbe_ethtool_ops_e610.
> 
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jedrzej Jagielski 
> ---
>  .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  | 57 ---
>  1 file changed, 49 insertions(+), 8 deletions(-)
> 

Tested-by: Bharath R 


Re: [Intel-wired-lan] [PATCH iwl-next v3 2/4] ixgbe: add support for ACPI WOL for E610

2025-03-07 Thread R, Bharath
> -Original Message-
> From: Intel-wired-lan  On Behalf Of
> Jedrzej Jagielski
> Sent: Monday, March 3, 2025 5:36 PM
> To: intel-wired-...@lists.osuosl.org
> Cc: Nguyen, Anthony L ;
> net...@vger.kernel.org; and...@lunn.ch; pmen...@molgen.mpg.de;
> Jagielski, Jedrzej ; Michal Swiatkowski
> ; Loktionov, Aleksandr
> 
> Subject: [Intel-wired-lan] [PATCH iwl-next v3 2/4] ixgbe: add support for ACPI
> WOL for E610
> 
> Currently only APM (Advanced Power Management) is supported by the ixgbe
> driver. It works for magic packets only, as for different sources of wake-up
> E610 adapter utilizes different feature.
> 
> Add E610 specific implementation of ixgbe_set_wol() callback. When any of
> broadcast/multicast/unicast wake-up is set, disable APM and configure ACPI
> (Advanced Configuration and Power Interface).
> 
> Reviewed-by: Michal Swiatkowski 
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jedrzej Jagielski 
> ---
>  .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  | 46 ++-
>  1 file changed, 45 insertions(+), 1 deletion(-)
> 

Tested-by: Bharath R 


Re: [Intel-wired-lan] [PATCH net-next 05/16] idpf: fix Rx descriptor ready check barrier in splitq

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:21PM +0100, Alexander Lobakin wrote:
> No idea what the current barrier position was meant for. At that point,
> nothing is read from the descriptor, only the pointer to the actual one
> is fetched.
> The correct barrier usage here is after the generation check, so that
> only the first qword is read if the descriptor is not yet ready and we
> need to stop polling. Debatable on coherent DMA as the Rx descriptor
> size is <= cacheline size, but anyway, the current barrier position
> only makes the codegen worse.

Makes sense:
Reviewed-by: Maciej Fijalkowski 

But you know the process... :P fixes should go to -net.

> 
> Fixes: 3a8845af66ed ("idpf: add RX splitq napi poll support")
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
> b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 6254806c2072..c15833928ea1 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -3232,18 +3232,14 @@ static int idpf_rx_splitq_clean(struct idpf_rx_queue 
> *rxq, int budget)
>   /* get the Rx desc from Rx queue based on 'next_to_clean' */
>   rx_desc = &rxq->rx[ntc].flex_adv_nic_3_wb;
>  
> - /* This memory barrier is needed to keep us from reading
> -  * any other fields out of the rx_desc
> -  */
> - dma_rmb();
> -
>   /* if the descriptor isn't done, no work yet to do */
>   gen_id = le16_get_bits(rx_desc->pktlen_gen_bufq_id,
>  VIRTCHNL2_RX_FLEX_DESC_ADV_GEN_M);
> -
>   if (idpf_queue_has(GEN_CHK, rxq) != gen_id)
>   break;
>  
> + dma_rmb();
> +
>   rxdid = FIELD_GET(VIRTCHNL2_RX_FLEX_DESC_ADV_RXDID_M,
> rx_desc->rxdid_ucast);
>   if (rxdid != VIRTCHNL2_RXDID_2_FLEX_SPLITQ) {
> -- 
> 2.48.1
> 


Re: [Intel-wired-lan] [PATCH iwl-next] ice: use DSN instead of PCI BDF for ice_adapter index

2025-03-07 Thread Jiri Pirko
Fri, Mar 07, 2025 at 12:53:05AM +0100, jacob.e.kel...@intel.com wrote:
>
>
>On 3/6/2025 1:11 PM, Przemek Kitszel wrote:
>> Use Device Serial Number instead of PCI bus/device/function for
>> index of struct ice_adapter.
>> Functions on the same physical device should point to the very same
>> ice_adapter instance.
>> 
>> This is not only simplification, but also fixes things up when PF
>> is passed to VM (and thus has a random BDF).
>> 
>> Suggested-by: Jacob Keller 
>> Suggested-by: Jakub Kicinski 
>> Suggested-by: Jiri Pirko 
>> Reviewed-by: Aleksandr Loktionov 
>> Signed-off-by: Przemek Kitszel 
>> ---
>
>The only caution I have here is that we might run into issues with
>pre-production or poorly flashed boards which don't have DSN properly
>flashed. This shouldn't be an impact outside of early testing or
>mistakes by devs. I think there is a default ID which is almost all 0s
>we could check and log a warning to help prevent confusion in such a case?
>
>A couple systems I've seen have serial numbers like:
>
>  serial_number 00-00-00-00-00-00-00-00
>  serial_number 00-00-00-00-00-00-00-00
>
>or
>
>  serial_number 00-01-00-ff-ff-00-00-00
>  serial_number 00-01-00-ff-ff-00-00-00
>
>
>In practice I'm not sure how big a deal breaker this is. Properly
>initialized boards should have unique IDs, and if you update via
>devlink, or any of our standard update tools, it will maintain the ID
>across flash. However, during early development, boards were often
>flashed manually which could lead to such non-unique IDs.

Do we need a workaround for pre-production buggy hw now? Sounds a bit
weird tbh.


>
>> CC: Karol Kolacinski 
>> CC: Grzegorz Nitka 
>> CC: Michal Schmidt 
>> CC: Sergey Temerkhanov 
>> ---
>>  drivers/net/ethernet/intel/ice/ice_adapter.h |  4 +--
>>  drivers/net/ethernet/intel/ice/ice_adapter.c | 29 +++-
>>  2 files changed, 6 insertions(+), 27 deletions(-)
>> 
>> diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h 
>> b/drivers/net/ethernet/intel/ice/ice_adapter.h
>> index e233225848b3..1935163bd32f 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_adapter.h
>> +++ b/drivers/net/ethernet/intel/ice/ice_adapter.h
>> @@ -42,7 +42,7 @@ struct ice_adapter {
>>  struct ice_port_list ports;
>>  };
>>  
>> -struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev);
>> -void ice_adapter_put(const struct pci_dev *pdev);
>> +struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);
>> +void ice_adapter_put(struct pci_dev *pdev);
>>  
>>  #endif /* _ICE_ADAPTER_H */
>> diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c 
>> b/drivers/net/ethernet/intel/ice/ice_adapter.c
>> index 01a08cfd0090..b668339ed0ef 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_adapter.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_adapter.c
>> @@ -1,7 +1,6 @@
>>  // SPDX-License-Identifier: GPL-2.0-only
>>  // SPDX-FileCopyrightText: Copyright Red Hat
>>  
>> -#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -14,29 +13,9 @@
>>  static DEFINE_XARRAY(ice_adapters);
>>  static DEFINE_MUTEX(ice_adapters_mutex);
>>  
>> -/* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */
>> -#define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13)
>> -#define INDEX_FIELD_DEVGENMASK(31, 16)
>> -#define INDEX_FIELD_BUSGENMASK(12, 5)
>> -#define INDEX_FIELD_SLOT   GENMASK(4, 0)
>> -
>> -static unsigned long ice_adapter_index(const struct pci_dev *pdev)
>> +static unsigned long ice_adapter_index(struct pci_dev *pdev)
>>  {
>> -unsigned int domain = pci_domain_nr(pdev->bus);
>> -
>> -WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN));
>> -
>> -switch (pdev->device) {
>> -case ICE_DEV_ID_E825C_BACKPLANE:
>> -case ICE_DEV_ID_E825C_QSFP:
>> -case ICE_DEV_ID_E825C_SFP:
>> -case ICE_DEV_ID_E825C_SGMII:
>> -return FIELD_PREP(INDEX_FIELD_DEV, pdev->device);
>> -default:
>> -return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
>> -   FIELD_PREP(INDEX_FIELD_BUS,pdev->bus->number) |
>> -   FIELD_PREP(INDEX_FIELD_SLOT,   PCI_SLOT(pdev->devfn));
>> -}
>> +return (unsigned long)pci_get_dsn(pdev);
>
>Much simpler :D
>
>>  }
>>  
>>  static struct ice_adapter *ice_adapter_new(void)
>> @@ -77,7 +56,7 @@ static void ice_adapter_free(struct ice_adapter *adapter)
>>   * Return:  Pointer to ice_adapter on success.
>>   *  ERR_PTR() on error. -ENOMEM is the only possible error.
>>   */
>> -struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev)
>> +struct ice_adapter *ice_adapter_get(struct pci_dev *pdev)
>>  {
>>  unsigned long index = ice_adapter_index(pdev);
>>  struct ice_adapter *adapter;
>> @@ -110,7 +89,7 @@ struct ice_adapter *ice_adapter_get(const struct pci_dev 
>> *pdev)
>>   *
>>   * Context: Process, may sleep.
>>   */
>> -void ice_adapter_put(const struct pci_dev *pdev)
>> +void ice_adapter_put(struct pci_dev *pdev)
>>  {
>
>A bit of a shame that this needs to be non const no

Re: [Intel-wired-lan] [PATCH iwl-next] ice: use DSN instead of PCI BDF for ice_adapter index

2025-03-07 Thread Jiri Pirko
Thu, Mar 06, 2025 at 10:11:46PM +0100, przemyslaw.kits...@intel.com wrote:
>Use Device Serial Number instead of PCI bus/device/function for
>index of struct ice_adapter.
>Functions on the same physical device should point to the very same
>ice_adapter instance.
>
>This is not only simplification, but also fixes things up when PF
>is passed to VM (and thus has a random BDF).
>
>Suggested-by: Jacob Keller 
>Suggested-by: Jakub Kicinski 
>Suggested-by: Jiri Pirko 
>Reviewed-by: Aleksandr Loktionov 
>Signed-off-by: Przemek Kitszel 

>From my perspective, this is a bug fix, makes sense to me to send to
-net tree.


>---
>CC: Karol Kolacinski 
>CC: Grzegorz Nitka 
>CC: Michal Schmidt 
>CC: Sergey Temerkhanov 
>---
> drivers/net/ethernet/intel/ice/ice_adapter.h |  4 +--
> drivers/net/ethernet/intel/ice/ice_adapter.c | 29 +++-
> 2 files changed, 6 insertions(+), 27 deletions(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h 
>b/drivers/net/ethernet/intel/ice/ice_adapter.h
>index e233225848b3..1935163bd32f 100644
>--- a/drivers/net/ethernet/intel/ice/ice_adapter.h
>+++ b/drivers/net/ethernet/intel/ice/ice_adapter.h
>@@ -42,7 +42,7 @@ struct ice_adapter {
>   struct ice_port_list ports;
> };
> 
>-struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev);
>-void ice_adapter_put(const struct pci_dev *pdev);
>+struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);
>+void ice_adapter_put(struct pci_dev *pdev);
> 
> #endif /* _ICE_ADAPTER_H */
>diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c 
>b/drivers/net/ethernet/intel/ice/ice_adapter.c
>index 01a08cfd0090..b668339ed0ef 100644
>--- a/drivers/net/ethernet/intel/ice/ice_adapter.c
>+++ b/drivers/net/ethernet/intel/ice/ice_adapter.c
>@@ -1,7 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0-only
> // SPDX-FileCopyrightText: Copyright Red Hat
> 
>-#include 
> #include 
> #include 
> #include 
>@@ -14,29 +13,9 @@
> static DEFINE_XARRAY(ice_adapters);
> static DEFINE_MUTEX(ice_adapters_mutex);
> 
>-/* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */
>-#define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13)
>-#define INDEX_FIELD_DEVGENMASK(31, 16)
>-#define INDEX_FIELD_BUSGENMASK(12, 5)
>-#define INDEX_FIELD_SLOT   GENMASK(4, 0)
>-
>-static unsigned long ice_adapter_index(const struct pci_dev *pdev)
>+static unsigned long ice_adapter_index(struct pci_dev *pdev)
> {
>-  unsigned int domain = pci_domain_nr(pdev->bus);
>-
>-  WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN));
>-
>-  switch (pdev->device) {
>-  case ICE_DEV_ID_E825C_BACKPLANE:
>-  case ICE_DEV_ID_E825C_QSFP:
>-  case ICE_DEV_ID_E825C_SFP:
>-  case ICE_DEV_ID_E825C_SGMII:
>-  return FIELD_PREP(INDEX_FIELD_DEV, pdev->device);
>-  default:
>-  return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
>- FIELD_PREP(INDEX_FIELD_BUS,pdev->bus->number) |
>- FIELD_PREP(INDEX_FIELD_SLOT,   PCI_SLOT(pdev->devfn));
>-  }
>+  return (unsigned long)pci_get_dsn(pdev);

How do you ensure there is no xarray index collision then you
cut the number like this?


> }
> 
> static struct ice_adapter *ice_adapter_new(void)
>@@ -77,7 +56,7 @@ static void ice_adapter_free(struct ice_adapter *adapter)
>  * Return:  Pointer to ice_adapter on success.
>  *  ERR_PTR() on error. -ENOMEM is the only possible error.
>  */
>-struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev)
>+struct ice_adapter *ice_adapter_get(struct pci_dev *pdev)
> {
>   unsigned long index = ice_adapter_index(pdev);
>   struct ice_adapter *adapter;
>@@ -110,7 +89,7 @@ struct ice_adapter *ice_adapter_get(const struct pci_dev 
>*pdev)
>  *
>  * Context: Process, may sleep.
>  */
>-void ice_adapter_put(const struct pci_dev *pdev)
>+void ice_adapter_put(struct pci_dev *pdev)
> {
>   unsigned long index = ice_adapter_index(pdev);
>   struct ice_adapter *adapter;
>-- 
>2.46.0
>


Re: [Intel-wired-lan] [PATCH iwl-next v3] igc: Change Tx mode for MQPRIO offloading

2025-03-07 Thread Vladimir Oltean
On Mon, Mar 03, 2025 at 10:16:33AM +0100, Kurt Kanzenbach wrote:
> diff --git a/drivers/net/ethernet/intel/igc/igc.h 
> b/drivers/net/ethernet/intel/igc/igc.h
> index 
> cd1d7b6c1782352094f6867a31b6958c929bbbf4..16d85bdf55a7e9c412c47acf727bca6bc7154c61
>  100644
> --- a/drivers/net/ethernet/intel/igc/igc.h
> +++ b/drivers/net/ethernet/intel/igc/igc.h
> @@ -388,11 +388,9 @@ extern char igc_driver_name[];
>  #define IGC_FLAG_RX_LEGACY   BIT(16)
>  #define IGC_FLAG_TSN_QBV_ENABLED BIT(17)
>  #define IGC_FLAG_TSN_QAV_ENABLED BIT(18)
> -#define IGC_FLAG_TSN_LEGACY_ENABLED  BIT(19)
>  
>  #define IGC_FLAG_TSN_ANY_ENABLED \
> - (IGC_FLAG_TSN_QBV_ENABLED | IGC_FLAG_TSN_QAV_ENABLED |  \
> -  IGC_FLAG_TSN_LEGACY_ENABLED)
> + (IGC_FLAG_TSN_QBV_ENABLED | IGC_FLAG_TSN_QAV_ENABLED)

How do you and Faizal plan to serialize your changes on these flags?
You delete IGC_FLAG_TSN_LEGACY_ENABLED and he adds
IGC_FLAG_TSN_PREEMPT_ENABLED.


[Intel-wired-lan] [PATCH iwl-next] ice: use DSN instead of PCI BDF for ice_adapter index

2025-03-07 Thread Przemek Kitszel
Use Device Serial Number instead of PCI bus/device/function for
index of struct ice_adapter.
Functions on the same physical device should point to the very same
ice_adapter instance.

This is not only simplification, but also fixes things up when PF
is passed to VM (and thus has a random BDF).

Suggested-by: Jacob Keller 
Suggested-by: Jakub Kicinski 
Suggested-by: Jiri Pirko 
Reviewed-by: Aleksandr Loktionov 
Signed-off-by: Przemek Kitszel 
---
CC: Karol Kolacinski 
CC: Grzegorz Nitka 
CC: Michal Schmidt 
CC: Sergey Temerkhanov 
---
 drivers/net/ethernet/intel/ice/ice_adapter.h |  4 +--
 drivers/net/ethernet/intel/ice/ice_adapter.c | 29 +++-
 2 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.h 
b/drivers/net/ethernet/intel/ice/ice_adapter.h
index e233225848b3..1935163bd32f 100644
--- a/drivers/net/ethernet/intel/ice/ice_adapter.h
+++ b/drivers/net/ethernet/intel/ice/ice_adapter.h
@@ -42,7 +42,7 @@ struct ice_adapter {
struct ice_port_list ports;
 };
 
-struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev);
-void ice_adapter_put(const struct pci_dev *pdev);
+struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);
+void ice_adapter_put(struct pci_dev *pdev);
 
 #endif /* _ICE_ADAPTER_H */
diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c 
b/drivers/net/ethernet/intel/ice/ice_adapter.c
index 01a08cfd0090..b668339ed0ef 100644
--- a/drivers/net/ethernet/intel/ice/ice_adapter.c
+++ b/drivers/net/ethernet/intel/ice/ice_adapter.c
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-FileCopyrightText: Copyright Red Hat
 
-#include 
 #include 
 #include 
 #include 
@@ -14,29 +13,9 @@
 static DEFINE_XARRAY(ice_adapters);
 static DEFINE_MUTEX(ice_adapters_mutex);
 
-/* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. */
-#define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13)
-#define INDEX_FIELD_DEVGENMASK(31, 16)
-#define INDEX_FIELD_BUSGENMASK(12, 5)
-#define INDEX_FIELD_SLOT   GENMASK(4, 0)
-
-static unsigned long ice_adapter_index(const struct pci_dev *pdev)
+static unsigned long ice_adapter_index(struct pci_dev *pdev)
 {
-   unsigned int domain = pci_domain_nr(pdev->bus);
-
-   WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN));
-
-   switch (pdev->device) {
-   case ICE_DEV_ID_E825C_BACKPLANE:
-   case ICE_DEV_ID_E825C_QSFP:
-   case ICE_DEV_ID_E825C_SFP:
-   case ICE_DEV_ID_E825C_SGMII:
-   return FIELD_PREP(INDEX_FIELD_DEV, pdev->device);
-   default:
-   return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
-  FIELD_PREP(INDEX_FIELD_BUS,pdev->bus->number) |
-  FIELD_PREP(INDEX_FIELD_SLOT,   PCI_SLOT(pdev->devfn));
-   }
+   return (unsigned long)pci_get_dsn(pdev);
 }
 
 static struct ice_adapter *ice_adapter_new(void)
@@ -77,7 +56,7 @@ static void ice_adapter_free(struct ice_adapter *adapter)
  * Return:  Pointer to ice_adapter on success.
  *  ERR_PTR() on error. -ENOMEM is the only possible error.
  */
-struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev)
+struct ice_adapter *ice_adapter_get(struct pci_dev *pdev)
 {
unsigned long index = ice_adapter_index(pdev);
struct ice_adapter *adapter;
@@ -110,7 +89,7 @@ struct ice_adapter *ice_adapter_get(const struct pci_dev 
*pdev)
  *
  * Context: Process, may sleep.
  */
-void ice_adapter_put(const struct pci_dev *pdev)
+void ice_adapter_put(struct pci_dev *pdev)
 {
unsigned long index = ice_adapter_index(pdev);
struct ice_adapter *adapter;
-- 
2.46.0



Re: [Intel-wired-lan] [PATCH net-next 10/16] idpf: add support for nointerrupt queues

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:26PM +0100, Alexander Lobakin wrote:
> Currently, queues are associated 1:1 with interrupt vectors as it's
> assumed queues are always interrupt-driven.
> In order to use a queue without an interrupt, idpf still needs to have
> a vector assigned to it to flush descriptors. This vector can be global
> and only one for the whole vport to handle all its noirq queues.
> Always request one excessive vector and configure it in non-interrupt
> mode right away when creating vport, so that it can be used later by
> queues when needed.

Description sort of miss the purpose of this commit, you don't ever
mention that your design choice for XDP Tx queues is to have them
irq-less.

> 
> Co-developed-by: Michal Kubiak 
> Signed-off-by: Michal Kubiak 
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/idpf/idpf.h|  8 +++
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h   |  4 ++
>  drivers/net/ethernet/intel/idpf/idpf_dev.c| 11 +++-
>  drivers/net/ethernet/intel/idpf/idpf_lib.c|  2 +-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c   |  8 +++
>  drivers/net/ethernet/intel/idpf/idpf_vf_dev.c | 11 +++-
>  .../net/ethernet/intel/idpf/idpf_virtchnl.c   | 53 +--
>  7 files changed, 79 insertions(+), 18 deletions(-)


Re: [Intel-wired-lan] [PATCH net-next 11/16] idpf: prepare structures to support XDP

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:27PM +0100, Alexander Lobakin wrote:
> From: Michal Kubiak 
> 
> Extend basic structures of the driver (e.g. 'idpf_vport', 'idpf_*_queue',
> 'idpf_vport_user_config_data') by adding members necessary to support XDP.
> Add extra XDP Tx queues needed to support XDP_TX and XDP_REDIRECT actions
> without interfering with regular Tx traffic.
> Also add functions dedicated to support XDP initialization for Rx and
> Tx queues and call those functions from the existing algorithms of
> queues configuration.
> 
> Signed-off-by: Michal Kubiak 
> Co-developed-by: Alexander Lobakin 
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/idpf/Kconfig   |   2 +-
>  drivers/net/ethernet/intel/idpf/Makefile  |   2 +
>  drivers/net/ethernet/intel/idpf/idpf.h|  20 ++
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h   |  86 ++--
>  drivers/net/ethernet/intel/idpf/xdp.h |  17 ++
>  .../net/ethernet/intel/idpf/idpf_ethtool.c|   6 +-
>  drivers/net/ethernet/intel/idpf/idpf_lib.c|  21 +-
>  drivers/net/ethernet/intel/idpf/idpf_main.c   |   1 +
>  .../ethernet/intel/idpf/idpf_singleq_txrx.c   |   8 +-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 109 +++---
>  .../net/ethernet/intel/idpf/idpf_virtchnl.c   |  26 +--
>  drivers/net/ethernet/intel/idpf/xdp.c | 189 ++
>  12 files changed, 415 insertions(+), 72 deletions(-)
>  create mode 100644 drivers/net/ethernet/intel/idpf/xdp.h
>  create mode 100644 drivers/net/ethernet/intel/idpf/xdp.c
> 
> diff --git a/drivers/net/ethernet/intel/idpf/Kconfig 
> b/drivers/net/ethernet/intel/idpf/Kconfig
> index 1addd663acad..7207ee4dbae8 100644
> --- a/drivers/net/ethernet/intel/idpf/Kconfig
> +++ b/drivers/net/ethernet/intel/idpf/Kconfig
> @@ -5,7 +5,7 @@ config IDPF
>   tristate "Intel(R) Infrastructure Data Path Function Support"
>   depends on PCI_MSI
>   select DIMLIB
> - select LIBETH
> + select LIBETH_XDP
>   help
> This driver supports Intel(R) Infrastructure Data Path Function
> devices.
> diff --git a/drivers/net/ethernet/intel/idpf/Makefile 
> b/drivers/net/ethernet/intel/idpf/Makefile
> index 2ce01a0b5898..c58abe6f8f5d 100644
> --- a/drivers/net/ethernet/intel/idpf/Makefile
> +++ b/drivers/net/ethernet/intel/idpf/Makefile
> @@ -17,3 +17,5 @@ idpf-y := \
>   idpf_vf_dev.o
>  
>  idpf-$(CONFIG_IDPF_SINGLEQ)  += idpf_singleq_txrx.o
> +
> +idpf-y   += xdp.o
> diff --git a/drivers/net/ethernet/intel/idpf/idpf.h 
> b/drivers/net/ethernet/intel/idpf/idpf.h
> index 50dde09c525b..4847760744ff 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf.h
> @@ -257,6 +257,10 @@ struct idpf_port_stats {
>   * @txq_model: Split queue or single queue queuing model
>   * @txqs: Used only in hotpath to get to the right queue very fast
>   * @crc_enable: Enable CRC insertion offload
> + * @xdpq_share: whether XDPSQ sharing is enabled
> + * @num_xdp_txq: number of XDPSQs
> + * @xdp_txq_offset: index of the first XDPSQ (== number of regular SQs)
> + * @xdp_prog: installed XDP program
>   * @num_rxq: Number of allocated RX queues
>   * @num_bufq: Number of allocated buffer queues
>   * @rxq_desc_count: RX queue descriptor count. *MUST* have enough descriptors
> @@ -303,6 +307,11 @@ struct idpf_vport {
>   struct idpf_tx_queue **txqs;
>   bool crc_enable;
>  
> + bool xdpq_share;
> + u16 num_xdp_txq;
> + u16 xdp_txq_offset;
> + struct bpf_prog *xdp_prog;
> +
>   u16 num_rxq;
>   u16 num_bufq;
>   u32 rxq_desc_count;
> @@ -380,6 +389,7 @@ struct idpf_rss_data {
>   * ethtool
>   * @num_req_rxq_desc: Number of user requested RX queue descriptors through
>   * ethtool
> + * @xdp_prog: requested XDP program to install
>   * @user_flags: User toggled config flags
>   * @mac_filter_list: List of MAC filters
>   *
> @@ -391,6 +401,7 @@ struct idpf_vport_user_config_data {
>   u16 num_req_rx_qs;
>   u32 num_req_txq_desc;
>   u32 num_req_rxq_desc;
> + struct bpf_prog *xdp_prog;
>   DECLARE_BITMAP(user_flags, __IDPF_USER_FLAGS_NBITS);
>   struct list_head mac_filter_list;
>  };
> @@ -604,6 +615,15 @@ static inline int idpf_is_queue_model_split(u16 q_model)
>  q_model == VIRTCHNL2_QUEUE_MODEL_SPLIT;
>  }
>  
> +/**
> + * idpf_xdp_is_prog_ena - check if there is an XDP program on adapter
> + * @vport: vport to check
> + */
> +static inline bool idpf_xdp_is_prog_ena(const struct idpf_vport *vport)
> +{
> + return vport->adapter && vport->xdp_prog;
> +}

(...)

> +
> +#endif /* _IDPF_XDP_H_ */
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c 
> b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> index 59b1a1a09996..1ca322bfe92f 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
> @@ -186,9 +186,11 @@ static void idp

Re: [Intel-wired-lan] [PATCH iwl-next v8 07/11] igc: add support for frame preemption verification

2025-03-07 Thread Abdul Rahim, Faizal




On 6/3/2025 8:28 am, Vladimir Oltean wrote:

On Wed, Mar 05, 2025 at 08:00:22AM -0500, Faizal Rahim wrote:

Co-developed-by: Vinicius Costa Gomes 
Signed-off-by: Vinicius Costa Gomes 
Co-developed-by: Choong Yong Liang 
Signed-off-by: Choong Yong Liang 
Co-developed-by: Chwee-Lin Choong 
Signed-off-by: Chwee-Lin Choong 
Signed-off-by: Faizal Rahim 
---
+
+static inline bool igc_fpe_is_verify_or_response(union igc_adv_rx_desc 
*rx_desc,
+unsigned int size, void 
*pktbuf)
+{
+   u32 status_error = le32_to_cpu(rx_desc->wb.upper.status_error);
+   static const u8 zero_payload[SMD_FRAME_SIZE] = {0};
+   int smd;
+
+   smd = FIELD_GET(IGC_RXDADV_STAT_SMD_TYPE_MASK, status_error);
+
+   return (smd == IGC_RXD_STAT_SMD_TYPE_V || smd == IGC_RXD_STAT_SMD_TYPE_R) 
&&
+   size == SMD_FRAME_SIZE &&
+   !memcmp(pktbuf, zero_payload, SMD_FRAME_SIZE); /* Buffer is all 
zeros */


Using this definition...


+}
+
+static inline void igc_fpe_lp_event_status(union igc_adv_rx_desc *rx_desc,
+  struct ethtool_mmsv *mmsv)
+{
+   u32 status_error = le32_to_cpu(rx_desc->wb.upper.status_error);
+   int smd;
+
+   smd = FIELD_GET(IGC_RXDADV_STAT_SMD_TYPE_MASK, status_error);
+
+   if (smd == IGC_RXD_STAT_SMD_TYPE_V)
+   ethtool_mmsv_event_handle(mmsv, 
ETHTOOL_MMSV_LP_SENT_VERIFY_MPACKET);
+   else if (smd == IGC_RXD_STAT_SMD_TYPE_R)
+   ethtool_mmsv_event_handle(mmsv, 
ETHTOOL_MMSV_LP_SENT_RESPONSE_MPACKET);
+}
@@ -2617,6 +2617,15 @@ static int igc_clean_rx_irq(struct igc_q_vector 
*q_vector, const int budget)
size -= IGC_TS_HDR_LEN;
}
  
+		if (igc_fpe_is_pmac_enabled(adapter) &&

+   igc_fpe_is_verify_or_response(rx_desc, size, pktbuf)) {


... invalid SMD-R and SMD-V frames will skip this code block altogether, and
will be passed up the network stack, and visible at least in tcpdump, correct?
Essentially, if the link partner would craft an ICMP request packet with
an SMD-V or SMD-R, your station would respond to it, which is incorrect.

A bit strange, the behavior in this case seems a bit under-specified in
the standard, and I don't see any counter that should be incremented.


+   igc_fpe_lp_event_status(rx_desc, &adapter->fpe.mmsv);
+   /* Advance the ring next-to-clean */
+   igc_is_non_eop(rx_ring, rx_desc);
+   cleaned_count++;
+   continue;
+   }


To fix this, don't you want to merge the unnaturally split
igc_fpe_is_verify_or_response() and igc_fpe_lp_event_status() into a
single function, which returns true whenever the mPacket should be
consumed by the driver, but decides whether to emit a mmsv event on its
own? Merging the two would also avoid reading rx_desc->wb.upper.status_error
twice.

Something like this:

static inline bool igc_fpe_handle_mpacket(struct igc_adapter *adapter,
  union igc_adv_rx_desc *rx_desc,
  unsigned int size, void *pktbuf)
{
u32 status_error = le32_to_cpu(rx_desc->wb.upper.status_error);
int smd;

smd = FIELD_GET(IGC_RXDADV_STAT_SMD_TYPE_MASK, status_error);
if (smd != IGC_RXD_STAT_SMD_TYPE_V && smd != IGC_RXD_STAT_SMD_TYPE_R)
return false;

if (size == SMD_FRAME_SIZE && mem_is_zero(pktbuf, SMD_FRAME_SIZE)) {
struct ethtool_mmsv *mmsv = &adapter->fpe.mmsv;
enum ethtool_mmsv_event event;

if (smd == IGC_RXD_STAT_SMD_TYPE_V)
event = ETHTOOL_MMSV_LP_SENT_VERIFY_MPACKET;
else
event = ETHTOOL_MMSV_LP_SENT_RESPONSE_MPACKET;

ethtool_mmsv_event_handle(mmsv, event);
}

return true;
}

if (igc_fpe_is_pmac_enabled(adapter) &&
igc_fpe_handle_mpacket(adapter, rx_desc, size, pktbuf)) {
/* Advance the ring next-to-clean */
igc_is_non_eop(rx_ring, rx_desc);
cleaned_count++;
continue;
}

[ also remark the use of mem_is_zero() instead of memcmp() with a buffer
   pre-filled with zeroes. It should be more efficient, for the simple
   reason that it's accessing a single memory buffer and not two. Though
   I'm surprised how widespread the memcmp() pattern is throughout the
   kernel. ]


Thanks for the suggestion—it reads much better and flows smoothly. Got it 
on the driver needing to consume a non-zero packet buffer from SMD-V and SMD-R.


Re: [Intel-wired-lan] [PATCH bpf-next v12 5/5] igc: Add launch time support to XDP ZC

2025-03-07 Thread Bouska, Zdenek
> -Original Message-
> From: Song Yoong Siang 
> 
> Enable Launch Time Control (LTC) support for XDP zero copy via XDP Tx
> metadata framework.
> 
> This patch has been tested with tools/testing/selftests/bpf/xdp_hw_metadata
> on Intel I225-LM Ethernet controller. Below are the test steps and result.
> 
> Test 1: Send a single packet with the launch time set to 1 s in the future.
> 
> Test steps:
> 1. On the DUT, start the xdp_hw_metadata selftest application:
>$ sudo ./xdp_hw_metadata enp2s0 -l 10 -L 1
> 
> 2. On the Link Partner, send a UDP packet with VLAN priority 1 to port 9091
>of the DUT.
> 
> Result:
> When the launch time is set to 1 s in the future, the delta between the
> launch time and the transmit hardware timestamp is 0.016 us, as shown in
> printout of the xdp_hw_metadata application below.
>   0x562ff5dc8880: rx_desc[4]->addr=84110 addr=84110 comp_addr=84110 EoP
>   rx_hash: 0xE343384 with RSS type:0x1
>   HW RX-time:   1734578015467548904 (sec:1734578015.4675)
> delta to User RX-time sec:0.0002 (183.103 usec)
>   XDP RX-time:   1734578015467651698 (sec:1734578015.4677)
>  delta to User RX-time sec:0.0001 (80.309 usec)
>   No rx_vlan_tci or rx_vlan_proto, err=-95
>   0x562ff5dc8880: ping-pong with csum=561c (want c7dd)
>   csum_start=34 csum_offset=6
>   HW RX-time:   1734578015467548904 (sec:1734578015.4675)
> delta to HW Launch-time sec:1. (100.000 usec)
>   0x562ff5dc8880: complete tx idx=4 addr=4018
>   HW Launch-time:   1734578016467548904 (sec:1734578016.4675)
> delta to HW TX-complete-time sec:0. (0.016 usec)
>   HW TX-complete-time:   1734578016467548920 (sec:1734578016.4675)
>  delta to User TX-complete-time sec:0.
>  (32.546 usec)
>   XDP RX-time:   1734578015467651698 (sec:1734578015.4677)
>  delta to User TX-complete-time sec:0.
>  (29.768 usec)
>   HW RX-time:   1734578015467548904 (sec:1734578015.4675)
> delta to HW TX-complete-time sec:1. (100.016 usec)
>   0x562ff5dc8880: complete rx idx=132 addr=84110
> 
> Test 2: Send 1000 packets with a 10 ms interval and the launch time set to
> 500 us in the future.
> 
> Test steps:
> 1. On the DUT, start the xdp_hw_metadata selftest application:
>$ sudo chrt -f 99 ./xdp_hw_metadata enp2s0 -l 50 -L 1 > \
>  /dev/shm/result.log
> 
> 2. On the Link Partner, send 1000 UDP packets with a 10 ms interval and
>VLAN priority 1 to port 9091 of the DUT.
> 
> Result:
> When the launch time is set to 500 us in the future, the average delta
> between the launch time and the transmit hardware timestamp is 0.016 us,
> as shown in the analysis of /dev/shm/result.log below. The XDP launch time
> works correctly in sending 1000 packets continuously.
>   Min delta: 0.005 us
>   Avr delta: 0.016 us
>   Max delta: 0.031 us
>   Total packets forwarded: 1000
> 
> Reviewed-by: Faizal Rahim 
> Reviewed-by: Maciej Fijalkowski 
> Signed-off-by: Song Yoong Siang 
> ---
>  drivers/net/ethernet/intel/igc/igc.h  |  1 +
>  drivers/net/ethernet/intel/igc/igc_main.c | 61 ++-
>  2 files changed, 60 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc.h 
> b/drivers/net/ethernet/intel/igc/igc.h
> index b8111ad9a9a8..cd1d7b6c1782 100644
> --- a/drivers/net/ethernet/intel/igc/igc.h
> +++ b/drivers/net/ethernet/intel/igc/igc.h
> @@ -579,6 +579,7 @@ struct igc_metadata_request {
>   struct xsk_tx_metadata *meta;
>   struct igc_ring *tx_ring;
>   u32 cmd_type;
> + u16 used_desc;
>  };
> 
>  struct igc_q_vector {
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index 1bfa71545e37..3044392e8ded 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -2971,9 +2971,48 @@ static u64 igc_xsk_fill_timestamp(void *_priv)
>   return *(u64 *)_priv;
>  }
> 
> +static void igc_xsk_request_launch_time(u64 launch_time, void *_priv)
> +{
> + struct igc_metadata_request *meta_req = _priv;
> + struct igc_ring *tx_ring = meta_req->tx_ring;
> + __le32 launch_time_offset;
> + bool insert_empty = false;
> + bool first_flag = false;
> + u16 used_desc = 0;
> +
> + if (!tx_ring->launchtime_enable)
> + return;
> +
> + launch_time_offset = igc_tx_launchtime(tx_ring,
> +ns_to_ktime(launch_time),
> +&first_flag, &insert_empty);
> + if (insert_empty) {
> + /* Disregard the launch time request if the required empty frame
> +  * fails to be inserted.
> +  */
> + if (igc_insert_empty_frame(tx_ring))
> + return;
> +
> + meta_req->tx_buffer =
> +  

[Intel-wired-lan] [iwl-next v2] ice: refactor the Tx scheduler feature

2025-03-07 Thread Martyna Szapar-Mudlaw
From: Mateusz Polchlopek 

Simplify the code by eliminating an unnecessary wrapper function.
Previously, ice_devlink_tx_sched_layers_get() acted as a thin wrapper
around ice_get_tx_topo_user_sel(), adding no real value but increasing
code complexity. Since both functions were only used once, the wrapper
was redundant and contributed approximately 20 lines of unnecessary
code. Remove ice_get_tx_topo_user_sel() and moves its instructions
directly into ice_devlink_tx_sched_layers_get(), improving readability
and reducing function jumps, without altering functionality.

Also remove unnecessary comment and make usage of str_enabled_disabled() in
ice_init_tx_topology().

Suggested-by: Marcin Szycik 
Reviewed-by: Michal Swiatkowski 
Reviewed-by: Jedrzej Jagielski 
Reviewed-by: Przemek Kitszel 
Reviewed-by: Aleksandr Loktionov 
Signed-off-by: Mateusz Polchlopek 
Signed-off-by: Martyna Szapar-Mudlaw 
---

v1->v2:
Expanded the commit message with the motivation for the changes, no code 
modifications.

---

 .../net/ethernet/intel/ice/devlink/devlink.c  | 56 +++
 drivers/net/ethernet/intel/ice/ice_ddp.c  |  2 -
 drivers/net/ethernet/intel/ice/ice_main.c |  8 +--
 3 files changed, 23 insertions(+), 43 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c 
b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index fcb199efbea5..2355e21d115c 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -529,41 +529,6 @@ ice_devlink_reload_empr_finish(struct ice_pf *pf,
return 0;
 }
 
-/**
- * ice_get_tx_topo_user_sel - Read user's choice from flash
- * @pf: pointer to pf structure
- * @layers: value read from flash will be saved here
- *
- * Reads user's preference for Tx Scheduler Topology Tree from PFA TLV.
- *
- * Return: zero when read was successful, negative values otherwise.
- */
-static int ice_get_tx_topo_user_sel(struct ice_pf *pf, uint8_t *layers)
-{
-   struct ice_aqc_nvm_tx_topo_user_sel usr_sel = {};
-   struct ice_hw *hw = &pf->hw;
-   int err;
-
-   err = ice_acquire_nvm(hw, ICE_RES_READ);
-   if (err)
-   return err;
-
-   err = ice_aq_read_nvm(hw, ICE_AQC_NVM_TX_TOPO_MOD_ID, 0,
- sizeof(usr_sel), &usr_sel, true, true, NULL);
-   if (err)
-   goto exit_release_res;
-
-   if (usr_sel.data & ICE_AQC_NVM_TX_TOPO_USER_SEL)
-   *layers = ICE_SCHED_5_LAYERS;
-   else
-   *layers = ICE_SCHED_9_LAYERS;
-
-exit_release_res:
-   ice_release_nvm(hw);
-
-   return err;
-}
-
 /**
  * ice_update_tx_topo_user_sel - Save user's preference in flash
  * @pf: pointer to pf structure
@@ -610,19 +575,36 @@ static int ice_update_tx_topo_user_sel(struct ice_pf *pf, 
int layers)
  * @id: the parameter ID to set
  * @ctx: context to store the parameter value
  *
+ * Reads user's preference for Tx Scheduler Topology Tree from PFA TLV.
+ *
  * Return: zero on success and negative value on failure.
  */
 static int ice_devlink_tx_sched_layers_get(struct devlink *devlink, u32 id,
   struct devlink_param_gset_ctx *ctx)
 {
+   struct ice_aqc_nvm_tx_topo_user_sel usr_sel = {};
struct ice_pf *pf = devlink_priv(devlink);
+   struct ice_hw *hw = &pf->hw;
int err;
 
-   err = ice_get_tx_topo_user_sel(pf, &ctx->val.vu8);
+   err = ice_acquire_nvm(hw, ICE_RES_READ);
if (err)
return err;
 
-   return 0;
+   err = ice_aq_read_nvm(hw, ICE_AQC_NVM_TX_TOPO_MOD_ID, 0,
+ sizeof(usr_sel), &usr_sel, true, true, NULL);
+   if (err)
+   goto exit_release_res;
+
+   if (usr_sel.data & ICE_AQC_NVM_TX_TOPO_USER_SEL)
+   ctx->val.vu8 = ICE_SCHED_5_LAYERS;
+   else
+   ctx->val.vu8 = ICE_SCHED_9_LAYERS;
+
+exit_release_res:
+   ice_release_nvm(hw);
+
+   return err;
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c 
b/drivers/net/ethernet/intel/ice/ice_ddp.c
index 69d5b1a28491..a2f738eaf02e 100644
--- a/drivers/net/ethernet/intel/ice/ice_ddp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ddp.c
@@ -2324,8 +2324,6 @@ enum ice_ddp_state ice_copy_and_init_pkg(struct ice_hw 
*hw, const u8 *buf,
  * @flags: pointer to descriptor flags
  * @set: 0-get, 1-set topology
  *
- * The function will get or set Tx topology
- *
  * Return: zero when set was successful, negative values otherwise.
  */
 static int
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c 
b/drivers/net/ethernet/intel/ice/ice_main.c
index a03e1819e6d5..a55ec9be7b1d 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -4550,10 +4550,10 @@ ice_init_tx_topology(struct ice_hw *hw, const struct 
firmware *firmware)
dev = ice_pf_to_dev(pf);
err = ice_cfg_tx_topo(hw, firmware->data, firmware->size);
if (!

Re: [Intel-wired-lan] [PATCH iwl-next v3 1/4] ixgbe: create E610 specific ethtool_ops structure

2025-03-07 Thread R, Bharath
> -Original Message-
> From: Intel-wired-lan  On Behalf Of
> Jedrzej Jagielski
> Sent: Monday, March 3, 2025 5:36 PM
> To: intel-wired-...@lists.osuosl.org
> Cc: Nguyen, Anthony L ;
> net...@vger.kernel.org; and...@lunn.ch; pmen...@molgen.mpg.de;
> Jagielski, Jedrzej ; Loktionov, Aleksandr
> 
> Subject: [Intel-wired-lan] [PATCH iwl-next v3 1/4] ixgbe: create E610 specific
> ethtool_ops structure
> 
> E610's implementation of various ethtool ops is different than the ones
> corresponding to ixgbe legacy products. Therefore create separate E610
> ethtool_ops struct which will be filled out in the forthcoming patches.
> 
> Add adequate ops struct basing on MAC type. This step requires changing a bit
> the flow of probing by placing ixgbe_set_ethtool_ops after hw.mac.type is
> assigned. So move the whole netdev assignment block after hw.mac.type is
> known. This step doesn't have any additional impact on probing sequence.
> 
> Suggested-by: Aleksandr Loktionov 
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Jedrzej Jagielski 
> ---
> v3: correct the commit msg
> ---
>  .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  | 52 ++-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++--
>  2 files changed, 56 insertions(+), 6 deletions(-)
> 

Tested-by: Bharath R 


[Intel-wired-lan] [PATCH iwl-next v6 08/15] ixgbe: add .info_get extension specific for E610 devices

2025-03-07 Thread Jedrzej Jagielski
E610 devices give possibility to show more detailed info than the previous
boards.
Extend reporting NVM info with following pieces:
 fw.mgmt.api -> version number of the API
 fw.mgmt.build -> identifier of the source for the FW
 fw.psid.api -> version defining the format of the flash contents
 fw.netlist -> version of the netlist module
 fw.netlist.build -> first 4 bytes of the netlist hash

Reviewed-by: Mateusz Polchlopek 
Co-developed-by: Slawomir Mrozowicz 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Signed-off-by: Jedrzej Jagielski 
---
 Documentation/networking/devlink/ixgbe.rst|  26 
 .../ethernet/intel/ixgbe/devlink/devlink.c| 132 +-
 2 files changed, 153 insertions(+), 5 deletions(-)

diff --git a/Documentation/networking/devlink/ixgbe.rst 
b/Documentation/networking/devlink/ixgbe.rst
index b63645de37e8..a41073a62776 100644
--- a/Documentation/networking/devlink/ixgbe.rst
+++ b/Documentation/networking/devlink/ixgbe.rst
@@ -38,3 +38,29 @@ The ``ixgbe`` driver reports the following versions
   - 0x8d0d
   - Unique identifier of the firmware image file that was loaded onto
 the device. Also referred to as the EETRACK identifier of the NVM.
+* - ``fw.mgmt.api``
+  - running
+  - 1.5.1
+  - 3-digit version number (major.minor.patch) of the API exported over
+the AdminQ by the management firmware. Used by the driver to
+identify what commands are supported. Historical versions of the
+kernel only displayed a 2-digit version number (major.minor).
+* - ``fw.mgmt.build``
+  - running
+  - 0x305d955f
+  - Unique identifier of the source for the management firmware.
+* - ``fw.psid.api``
+  - running
+  - 0.80
+  - Version defining the format of the flash contents.
+* - ``fw.netlist``
+  - running
+  - 1.1.2000-6.7.0
+  - The version of the netlist module. This module defines the device's
+Ethernet capabilities and default settings, and is used by the
+management firmware as part of managing link and device
+connectivity.
+* - ``fw.netlist.build``
+  - running
+  - 0xee16ced7
+  - The first 4 bytes of the hash of the netlist module contents.
diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index d91252da4a61..365310a6910d 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -19,14 +19,22 @@ static void ixgbe_info_get_dsn(struct ixgbe_adapter 
*adapter,
snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn);
 }
 
-static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter,
-  struct ixgbe_info_ctx *ctx)
+static void ixgbe_info_orom_ver(struct ixgbe_adapter *adapter,
+   struct ixgbe_info_ctx *ctx)
 {
struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_nvm_version nvm_ver;
 
ctx->buf[0] = '\0';
 
+   if (hw->mac.type == ixgbe_mac_e610) {
+   struct ixgbe_orom_info *orom = &adapter->hw.flash.orom;
+
+   snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
+orom->major, orom->build, orom->patch);
+   return;
+   }
+
ixgbe_get_oem_prod_version(hw, &nvm_ver);
if (nvm_ver.oem_valid) {
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x",
@@ -48,6 +56,12 @@ static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_nvm_version nvm_ver;
 
+   if (hw->mac.type == ixgbe_mac_e610) {
+   snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x",
+hw->flash.nvm.eetrack);
+   return;
+   }
+
ixgbe_get_oem_prod_version(hw, &nvm_ver);
 
/* No ETRACK version for OEM */
@@ -60,6 +74,112 @@ static void ixgbe_info_eetrack(struct ixgbe_adapter 
*adapter,
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm_ver.etk_id);
 }
 
+static void ixgbe_info_fw_api(struct ixgbe_adapter *adapter,
+ struct ixgbe_info_ctx *ctx)
+{
+   struct ixgbe_hw *hw = &adapter->hw;
+
+   snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
+hw->api_maj_ver, hw->api_min_ver, hw->api_patch);
+}
+
+static void ixgbe_info_fw_build(struct ixgbe_adapter *adapter,
+   struct ixgbe_info_ctx *ctx)
+{
+   struct ixgbe_hw *hw = &adapter->hw;
+
+   snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build);
+}
+
+static void ixgbe_info_fw_srev(struct ixgbe_adapter *adapter,
+  struct ixgbe_info_ctx *ctx)
+{
+   struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm;
+
+   snprintf(ctx->buf, sizeof(ctx->buf), "%u", nvm->srev);
+}
+
+static void ixgbe_info_orom_srev(struct ixgbe_ad

[Intel-wired-lan] [PATCH iwl-next v6 11/15] ixgbe: add device flash update via devlink

2025-03-07 Thread Jedrzej Jagielski
Use the pldmfw library to implement device flash update for
the Intel ixgbe networking device driver specifically for E610 devices.
This support uses the devlink flash update interface.

Using the pldmfw library, the provided firmware file will be scanned for
the three major components, "fw.undi" for the Option ROM, "fw.mgmt" for
the main NVM module containing the primary device firmware, and
"fw.netlist" containing the netlist module.

The flash is separated into two banks, the active bank containing the
running firmware, and the inactive bank which we use for update. Each
module is updated in a staged process. First, the inactive bank is
erased, preparing the device for update. Second, the contents of the
component are copied to the inactive portion of the flash. After all
components are updated, the driver signals the device to switch the
active bank during the next EMP reset.

With this implementation, basic flash update for the E610 hardware is
supported.

Reviewed-by: Jacob Keller 
Tested-by: Bharath R 
Co-developed-by: Slawomir Mrozowicz 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Co-developed-by: Stefan Wegrzyn 
Signed-off-by: Stefan Wegrzyn 
Signed-off-by: Jedrzej Jagielski 
---
v5: fix caps->nvm_unified_update assignment
---
 Documentation/networking/devlink/ixgbe.rst|  24 +
 drivers/net/ethernet/intel/Kconfig|   1 +
 drivers/net/ethernet/intel/ixgbe/Makefile |   2 +-
 .../ethernet/intel/ixgbe/devlink/devlink.c|   4 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 210 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h |  11 +
 .../ethernet/intel/ixgbe/ixgbe_fw_update.c| 668 ++
 .../ethernet/intel/ixgbe/ixgbe_fw_update.h|  12 +
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  64 ++
 9 files changed, 995 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c
 create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.h

diff --git a/Documentation/networking/devlink/ixgbe.rst 
b/Documentation/networking/devlink/ixgbe.rst
index a41073a62776..41aedf4b8017 100644
--- a/Documentation/networking/devlink/ixgbe.rst
+++ b/Documentation/networking/devlink/ixgbe.rst
@@ -64,3 +64,27 @@ The ``ixgbe`` driver reports the following versions
   - running
   - 0xee16ced7
   - The first 4 bytes of the hash of the netlist module contents.
+
+Flash Update
+
+The ``ixgbe`` driver implements support for flash update using the
+``devlink-flash`` interface. It supports updating the device flash using a
+combined flash image that contains the ``fw.mgmt``, ``fw.undi``, and
+``fw.netlist`` components.
+.. list-table:: List of supported overwrite modes
+   :widths: 5 95
+   * - Bits
+ - Behavior
+   * - ``DEVLINK_FLASH_OVERWRITE_SETTINGS``
+ - Do not preserve settings stored in the flash components being
+   updated. This includes overwriting the port configuration that
+   determines the number of physical functions the device will
+   initialize with.
+   * - ``DEVLINK_FLASH_OVERWRITE_SETTINGS`` and 
``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS``
+ - Do not preserve either settings or identifiers. Overwrite everything
+   in the flash with the contents from the provided image, without
+   performing any preservation. This includes overwriting device
+   identifying fields such as the MAC address, Vital product Data (VPD) 
area,
+   and device serial number. It is expected that this combination be used 
with an
+   image customized for the specific device.
+
diff --git a/drivers/net/ethernet/intel/Kconfig 
b/drivers/net/ethernet/intel/Kconfig
index 3366738c57c8..8fecb8a4e249 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -148,6 +148,7 @@ config IXGBE
depends on PTP_1588_CLOCK_OPTIONAL
select MDIO
select NET_DEVLINK
+   select PLDMFW
select PHYLIB
help
  This driver supports Intel(R) 10GbE PCI Express family of
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile 
b/drivers/net/ethernet/intel/ixgbe/Makefile
index 11f37140c0a3..ce447540d146 100644
--- a/drivers/net/ethernet/intel/ixgbe/Makefile
+++ b/drivers/net/ethernet/intel/ixgbe/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_IXGBE) += ixgbe.o
 ixgbe-y := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \
ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
ixgbe_mbx.o ixgbe_x540.o ixgbe_x550.o ixgbe_lib.o ixgbe_ptp.o \
-   ixgbe_xsk.o ixgbe_e610.o devlink/devlink.o
+   ixgbe_xsk.o ixgbe_e610.o devlink/devlink.o ixgbe_fw_update.o
 
 ixgbe-$(CONFIG_IXGBE_DCB) +=  ixgbe_dcb.o ixgbe_dcb_82598.o \
   ixgbe_dcb_82599.o ixgbe_dcb_nl.o
diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index b8f21b5e3de0..2cc7137f1ac7 100644
--- a/dri

[Intel-wired-lan] [PATCH iwl-next v6 10/15] ixgbe: extend .info_get with stored versions

2025-03-07 Thread Jedrzej Jagielski
Add functions reading inactive versions from the inactive flash
banks.

Print stored NVM, OROM and netlist versions by devlink when there
is an ongoing update for E610 devices.

Reviewed-by: Mateusz Polchlopek 
Reviewed-by: Przemek Kitszel 
Co-developed-by: Slawomir Mrozowicz 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Signed-off-by: Jedrzej Jagielski 
---
v3: use devlink_info_version_*_put() function; squash functions dealing with
running and stored versions into single ones
v5: add else to if/else if statements
---
 .../ethernet/intel/ixgbe/devlink/devlink.c| 214 --
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c |  59 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h |   3 +
 3 files changed, 252 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index 9afa4b34efce..b8f21b5e3de0 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -6,6 +6,15 @@
 
 struct ixgbe_info_ctx {
char buf[128];
+   struct ixgbe_orom_info pending_orom;
+   struct ixgbe_nvm_info pending_nvm;
+   struct ixgbe_netlist_info pending_netlist;
+   struct ixgbe_hw_dev_caps dev_caps;
+};
+
+enum ixgbe_devlink_version_type {
+   IXGBE_DL_VERSION_RUNNING,
+   IXGBE_DL_VERSION_STORED
 };
 
 static void ixgbe_info_get_dsn(struct ixgbe_adapter *adapter,
@@ -20,7 +29,8 @@ static void ixgbe_info_get_dsn(struct ixgbe_adapter *adapter,
 }
 
 static void ixgbe_info_orom_ver(struct ixgbe_adapter *adapter,
-   struct ixgbe_info_ctx *ctx)
+   struct ixgbe_info_ctx *ctx,
+   enum ixgbe_devlink_version_type type)
 {
struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_nvm_version nvm_ver;
@@ -28,7 +38,14 @@ static void ixgbe_info_orom_ver(struct ixgbe_adapter 
*adapter,
ctx->buf[0] = '\0';
 
if (hw->mac.type == ixgbe_mac_e610) {
-   struct ixgbe_orom_info *orom = &adapter->hw.flash.orom;
+   struct ixgbe_orom_info *orom;
+
+   if (type == IXGBE_DL_VERSION_RUNNING)
+   orom = &adapter->hw.flash.orom;
+   else if (type == IXGBE_DL_VERSION_STORED)
+   orom = &ctx->pending_orom;
+   else
+   return;
 
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
 orom->major, orom->build, orom->patch);
@@ -51,14 +68,23 @@ static void ixgbe_info_orom_ver(struct ixgbe_adapter 
*adapter,
 }
 
 static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
-  struct ixgbe_info_ctx *ctx)
+  struct ixgbe_info_ctx *ctx,
+  enum ixgbe_devlink_version_type type)
 {
struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_nvm_version nvm_ver;
 
if (hw->mac.type == ixgbe_mac_e610) {
-   snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x",
-hw->flash.nvm.eetrack);
+   u32 eetrack;
+
+   if (type == IXGBE_DL_VERSION_RUNNING)
+   eetrack = hw->flash.nvm.eetrack;
+   else if (type == IXGBE_DL_VERSION_STORED)
+   eetrack = ctx->pending_nvm.eetrack;
+   else
+   return;
+
+   snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", eetrack);
return;
}
 
@@ -92,33 +118,65 @@ static void ixgbe_info_fw_build(struct ixgbe_adapter 
*adapter,
 }
 
 static void ixgbe_info_fw_srev(struct ixgbe_adapter *adapter,
-  struct ixgbe_info_ctx *ctx)
+  struct ixgbe_info_ctx *ctx,
+  enum ixgbe_devlink_version_type type)
 {
-   struct ixgbe_nvm_info *nvm = &adapter->hw.flash.nvm;
+   struct ixgbe_nvm_info *nvm;
+
+   if (type == IXGBE_DL_VERSION_RUNNING)
+   nvm = &adapter->hw.flash.nvm;
+   else if (type == IXGBE_DL_VERSION_STORED)
+   nvm = &ctx->pending_nvm;
+   else
+   return;
 
snprintf(ctx->buf, sizeof(ctx->buf), "%u", nvm->srev);
 }
 
 static void ixgbe_info_orom_srev(struct ixgbe_adapter *adapter,
-struct ixgbe_info_ctx *ctx)
+struct ixgbe_info_ctx *ctx,
+enum ixgbe_devlink_version_type type)
 {
-   struct ixgbe_orom_info *orom = &adapter->hw.flash.orom;
+   struct ixgbe_orom_info *orom;
+
+   if (type == IXGBE_DL_VERSION_RUNNING)
+   orom = &adapter->hw.flash.orom;
+   else if (type == IXGBE_DL_VERSION_STORED)
+   orom = &ctx->pending_orom;
+   else
+   return;
 
snprintf(ctx->buf, size

[Intel-wired-lan] [PATCH iwl-next v6 06/15] ixgbe: read the OROM version information

2025-03-07 Thread Jedrzej Jagielski
From: Slawomir Mrozowicz 

Add functions reading the OROM version info and use them
as a part of the setting NVM info procedure.

Reviewed-by: Mateusz Polchlopek 
Reviewed-by: Przemek Kitszel 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Signed-off-by: Jedrzej Jagielski 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 172 ++
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  15 ++
 2 files changed, 187 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index 3654b7e32cc8..bad4bc04bb66 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -2582,6 +2582,35 @@ static int ixgbe_read_nvm_module(struct ixgbe_hw *hw,
return err;
 }
 
+/**
+ * ixgbe_read_orom_module - Read from the active Option ROM module
+ * @hw: pointer to the HW structure
+ * @bank: whether to read from active or inactive OROM module
+ * @offset: offset into the OROM module to read, in words
+ * @data: storage for returned word value
+ *
+ * Read the specified word from the active Option ROM module of the flash.
+ * Note that unlike the NVM module, the CSS data is stored at the end of the
+ * module instead of at the beginning.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_read_orom_module(struct ixgbe_hw *hw,
+ enum ixgbe_bank_select bank,
+ u32 offset, u16 *data)
+{
+   __le16 data_local;
+   int err;
+
+   err = ixgbe_read_flash_module(hw, bank, IXGBE_E610_SR_1ST_OROM_BANK_PTR,
+ offset * sizeof(data_local),
+ (u8 *)&data_local, sizeof(data_local));
+   if (!err)
+   *data = le16_to_cpu(data_local);
+
+   return err;
+}
+
 /**
  * ixgbe_get_nvm_css_hdr_len - Read the CSS header length
  * @hw: pointer to the HW struct
@@ -2678,6 +2707,143 @@ static int ixgbe_get_nvm_srev(struct ixgbe_hw *hw,
return 0;
 }
 
+/**
+ * ixgbe_get_orom_civd_data - Get the combo version information from Option ROM
+ * @hw: pointer to the HW struct
+ * @bank: whether to read from the active or inactive flash module
+ * @civd: storage for the Option ROM CIVD data.
+ *
+ * Searches through the Option ROM flash contents to locate the CIVD data for
+ * the image.
+ *
+ * Return: the exit code of the operation.
+ */
+static int
+ixgbe_get_orom_civd_data(struct ixgbe_hw *hw, enum ixgbe_bank_select bank,
+struct ixgbe_orom_civd_info *civd)
+{
+   struct ixgbe_orom_civd_info tmp;
+   u32 offset;
+   int err;
+
+   /* The CIVD section is located in the Option ROM aligned to 512 bytes.
+* The first 4 bytes must contain the ASCII characters "$CIV".
+* A simple modulo 256 sum of all of the bytes of the structure must
+* equal 0.
+*/
+   for (offset = 0; (offset + SZ_512) <= hw->flash.banks.orom_size;
+offset += SZ_512) {
+   u8 sum = 0;
+   u32 i;
+
+   err = ixgbe_read_flash_module(hw, bank,
+ IXGBE_E610_SR_1ST_OROM_BANK_PTR,
+ offset,
+ (u8 *)&tmp, sizeof(tmp));
+   if (err)
+   return err;
+
+   /* Skip forward until we find a matching signature */
+   if (memcmp(IXGBE_OROM_CIV_SIGNATURE, tmp.signature,
+  sizeof(tmp.signature)))
+   continue;
+
+   /* Verify that the simple checksum is zero */
+   for (i = 0; i < sizeof(tmp); i++)
+   sum += ((u8 *)&tmp)[i];
+
+   if (sum)
+   return -EDOM;
+
+   *civd = tmp;
+   return 0;
+   }
+
+   return -ENODATA;
+}
+
+/**
+ * ixgbe_get_orom_srev - Read the security revision from the OROM CSS header
+ * @hw: pointer to the HW struct
+ * @bank: whether to read from active or inactive flash module
+ * @srev: storage for security revision
+ *
+ * Read the security revision out of the CSS header of the active OROM module
+ * bank.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_get_orom_srev(struct ixgbe_hw *hw,
+  enum ixgbe_bank_select bank,
+  u32 *srev)
+{
+   u32 orom_size_word = hw->flash.banks.orom_size / 2;
+   u32 css_start, hdr_len;
+   u16 srev_l, srev_h;
+   int err;
+
+   err = ixgbe_get_nvm_css_hdr_len(hw, bank, &hdr_len);
+   if (err)
+   return err;
+
+   if (orom_size_word < hdr_len)
+   return -EINVAL;
+
+   /* Calculate how far into the Option ROM the CSS header starts. Note
+* that ixgbe_read_orom_module takes 

[Intel-wired-lan] [PATCH iwl-next v6 12/15] ixgbe: add support for devlink reload

2025-03-07 Thread Jedrzej Jagielski
The E610 adapters contain an embedded chip with firmware which can be
updated using devlink flash. The firmware which runs on this chip is
referred to as the Embedded Management Processor firmware (EMP
firmware).

Activating the new firmware image currently requires that the system be
rebooted. This is not ideal as rebooting the system can cause unwanted
downtime.

The EMP firmware itself can be reloaded by issuing a special update
to the device called an Embedded Management Processor reset (EMP
reset). This reset causes the device to reset and reload the EMP
firmware.

Implement support for devlink reload with the "fw_activate" flag. This
allows user space to request the firmware be activated immediately.

Reviewed-by: Mateusz Polchlopek 
Tested-by: Bharath R 
Co-developed-by: Slawomir Mrozowicz 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Co-developed-by: Stefan Wegrzyn 
Signed-off-by: Stefan Wegrzyn 
Signed-off-by: Jedrzej Jagielski 
---
v6: fix doc
---
 Documentation/networking/devlink/ixgbe.rst|  17 +++
 .../ethernet/intel/ixgbe/devlink/devlink.c| 112 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  |   4 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c |  18 +++
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h |   1 +
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  |  12 ++
 .../ethernet/intel/ixgbe/ixgbe_fw_update.c|  37 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   5 +-
 8 files changed, 199 insertions(+), 7 deletions(-)

diff --git a/Documentation/networking/devlink/ixgbe.rst 
b/Documentation/networking/devlink/ixgbe.rst
index 41aedf4b8017..f7cfb9cedf6d 100644
--- a/Documentation/networking/devlink/ixgbe.rst
+++ b/Documentation/networking/devlink/ixgbe.rst
@@ -88,3 +88,20 @@ combined flash image that contains the ``fw.mgmt``, 
``fw.undi``, and
and device serial number. It is expected that this combination be used 
with an
image customized for the specific device.
 
+Reload
+==
+
+The ``ixgbe`` driver supports activating new firmware after a flash update
+using ``DEVLINK_CMD_RELOAD`` with the ``DEVLINK_RELOAD_ACTION_FW_ACTIVATE``
+action.
+
+.. code:: shell
+
+$ devlink dev reload pci/:01:00.0 reload action fw_activate
+
+The new firmware is activated by issuing a device specific Embedded
+Management Processor reset which requests the device to reset and reload the
+EMP firmware image.
+
+The driver does not currently support reloading the driver via
+``DEVLINK_RELOAD_ACTION_DRIVER_REINIT``.
diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index 2cc7137f1ac7..7e049c28ff61 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -352,6 +352,9 @@ static int ixgbe_devlink_info_get(struct devlink *devlink,
if (!ctx)
return -ENOMEM;
 
+   if (hw->mac.type == ixgbe_mac_e610)
+   ixgbe_refresh_fw_version(adapter);
+
ixgbe_info_get_dsn(adapter, ctx);
err = devlink_info_serial_number_put(req, ctx->buf);
if (err)
@@ -390,11 +393,120 @@ static int ixgbe_devlink_info_get(struct devlink 
*devlink,
return err;
 }
 
+/**
+ * ixgbe_devlink_reload_empr_start - Start EMP reset to activate new firmware
+ * @devlink: pointer to the devlink instance to reload
+ * @netns_change: if true, the network namespace is changing
+ * @action: the action to perform. Must be DEVLINK_RELOAD_ACTION_FW_ACTIVATE
+ * @limit: limits on what reload should do, such as not resetting
+ * @extack: netlink extended ACK structure
+ *
+ * Allow user to activate new Embedded Management Processor firmware by
+ * issuing device specific EMP reset. Called in response to
+ * a DEVLINK_CMD_RELOAD with the DEVLINK_RELOAD_ACTION_FW_ACTIVATE.
+ *
+ * Note that teardown and rebuild of the driver state happens automatically as
+ * part of an interrupt and watchdog task. This is because all physical
+ * functions on the device must be able to reset when an EMP reset occurs from
+ * any source.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_devlink_reload_empr_start(struct devlink *devlink,
+  bool netns_change,
+  enum devlink_reload_action action,
+  enum devlink_reload_limit limit,
+  struct netlink_ext_ack *extack)
+{
+   struct ixgbe_adapter *adapter = devlink_priv(devlink);
+   struct ixgbe_hw *hw = &adapter->hw;
+   u8 pending;
+   int err;
+
+   if (hw->mac.type != ixgbe_mac_e610)
+   return -EOPNOTSUPP;
+
+   err = ixgbe_get_pending_updates(adapter, &pending, extack);
+   if (err)
+   return err;
+
+   /* Pending is a bitmask of which flash banks have a pending update,
+* incl

[Intel-wired-lan] [PATCH iwl-next v6 04/15] ixgbe: add handler for devlink .info_get()

2025-03-07 Thread Jedrzej Jagielski
Provide devlink .info_get() callback implementation to allow the
driver to report detailed version information. The following info
is reported:

 "serial_number" -> The PCI DSN of the adapter
 "fw.bundle_id" -> Unique identifier for the combined flash image
 "fw.undi" -> Version of the Option ROM containing the UEFI driver
 "board.id" -> The PBA ID string

Reviewed-by: Mateusz Polchlopek 
Signed-off-by: Jedrzej Jagielski 
---
v2: zero the ctx buff when chance it won't be filled out
v4: use devlink_priv()
v6: fix devlink_*_put() labels
---
 Documentation/networking/devlink/ixgbe.rst|  32 ++
 .../ethernet/intel/ixgbe/devlink/devlink.c| 101 ++
 2 files changed, 133 insertions(+)

diff --git a/Documentation/networking/devlink/ixgbe.rst 
b/Documentation/networking/devlink/ixgbe.rst
index c04ac51c6d85..b63645de37e8 100644
--- a/Documentation/networking/devlink/ixgbe.rst
+++ b/Documentation/networking/devlink/ixgbe.rst
@@ -6,3 +6,35 @@ ixgbe devlink support
 
 This document describes the devlink features implemented by the ``ixgbe``
 device driver.
+
+Info versions
+=
+
+The ``ixgbe`` driver reports the following versions
+
+.. list-table:: devlink info versions implemented
+:widths: 5 5 5 90
+
+* - Name
+  - Type
+  - Example
+  - Description
+* - ``board.id``
+  - fixed
+  - H49289-000
+  - The Product Board Assembly (PBA) identifier of the board.
+* - ``fw.undi``
+  - running
+  - 1.1937.0
+  - Version of the Option ROM containing the UEFI driver. The version is
+reported in ``major.minor.patch`` format. The major version is
+incremented whenever a major breaking change occurs, or when the
+minor version would overflow. The minor version is incremented for
+non-breaking changes and reset to 1 when the major version is
+incremented. The patch version is normally 0 but is incremented when
+a fix is delivered as a patch against an older base Option ROM.
+* - ``fw.bundle_id``
+  - running
+  - 0x8d0d
+  - Unique identifier of the firmware image file that was loaded onto
+the device. Also referred to as the EETRACK identifier of the NVM.
diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index 6c3452cf5d7d..d91252da4a61 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -4,7 +4,108 @@
 #include "ixgbe.h"
 #include "devlink.h"
 
+struct ixgbe_info_ctx {
+   char buf[128];
+};
+
+static void ixgbe_info_get_dsn(struct ixgbe_adapter *adapter,
+  struct ixgbe_info_ctx *ctx)
+{
+   u8 dsn[8];
+
+   /* Copy the DSN into an array in Big Endian format */
+   put_unaligned_be64(pci_get_dsn(adapter->pdev), dsn);
+
+   snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn);
+}
+
+static void ixgbe_info_nvm_ver(struct ixgbe_adapter *adapter,
+  struct ixgbe_info_ctx *ctx)
+{
+   struct ixgbe_hw *hw = &adapter->hw;
+   struct ixgbe_nvm_version nvm_ver;
+
+   ctx->buf[0] = '\0';
+
+   ixgbe_get_oem_prod_version(hw, &nvm_ver);
+   if (nvm_ver.oem_valid) {
+   snprintf(ctx->buf, sizeof(ctx->buf), "%x.%x.%x",
+nvm_ver.oem_major, nvm_ver.oem_minor,
+nvm_ver.oem_release);
+
+   return;
+   }
+
+   ixgbe_get_orom_version(hw, &nvm_ver);
+   if (nvm_ver.or_valid)
+   snprintf(ctx->buf, sizeof(ctx->buf), "%d.%d.%d",
+nvm_ver.or_major, nvm_ver.or_build, nvm_ver.or_patch);
+}
+
+static void ixgbe_info_eetrack(struct ixgbe_adapter *adapter,
+  struct ixgbe_info_ctx *ctx)
+{
+   struct ixgbe_hw *hw = &adapter->hw;
+   struct ixgbe_nvm_version nvm_ver;
+
+   ixgbe_get_oem_prod_version(hw, &nvm_ver);
+
+   /* No ETRACK version for OEM */
+   if (nvm_ver.oem_valid) {
+   ctx->buf[0] = '\0';
+   return;
+   }
+
+   ixgbe_get_etk_id(hw, &nvm_ver);
+   snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", nvm_ver.etk_id);
+}
+
+static int ixgbe_devlink_info_get(struct devlink *devlink,
+ struct devlink_info_req *req,
+ struct netlink_ext_ack *extack)
+{
+   struct ixgbe_adapter *adapter = devlink_priv(devlink);
+   struct ixgbe_hw *hw = &adapter->hw;
+   struct ixgbe_info_ctx *ctx;
+   int err;
+
+   ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+   if (!ctx)
+   return -ENOMEM;
+
+   ixgbe_info_get_dsn(adapter, ctx);
+   err = devlink_info_serial_number_put(req, ctx->buf);
+   if (err)
+   goto free_ctx;
+
+   err = ixgbe_read_pba_string_generic(hw, ctx->buf, sizeof(ctx->buf));
+   if (err)
+   goto free_ctx;
+
+   err = 

[Intel-wired-lan] [PATCH iwl-next v6 09/15] ixgbe: add E610 functions getting PBA and FW ver info

2025-03-07 Thread Jedrzej Jagielski
Introduce 2 E610 specific callbacks implementations:
-ixgbe_start_hw_e610() which expands the regular .start_hw callback with
getting FW version information
-ixgbe_read_pba_string_e610() which gets Product Board Assembly string

Extend EEPROM ops with new .read_pba_string in order to distinguish
generic one and the E610 one.

Reviewed-by: Mateusz Polchlopek 
Tested-by: Bharath R 
Co-developed-by: Stefan Wegrzyn 
Signed-off-by: Stefan Wegrzyn 
Signed-off-by: Jedrzej Jagielski 
---
 .../ethernet/intel/ixgbe/devlink/devlink.c|   5 +-
 .../net/ethernet/intel/ixgbe/ixgbe_82598.c|   1 +
 .../net/ethernet/intel/ixgbe/ixgbe_82599.c|   1 +
 .../net/ethernet/intel/ixgbe/ixgbe_common.c   |   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 183 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |   2 +
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c |   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |   1 +
 10 files changed, 192 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index 365310a6910d..9afa4b34efce 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -198,10 +198,7 @@ static int ixgbe_devlink_info_get(struct devlink *devlink,
if (err)
goto free_ctx;
 
-   err = ixgbe_read_pba_string_generic(hw, ctx->buf, sizeof(ctx->buf));
-   if (err)
-   goto free_ctx;
-
+   hw->eeprom.ops.read_pba_string(hw, ctx->buf, sizeof(ctx->buf));
err = devlink_info_version_fixed_put(req,
DEVLINK_INFO_VERSION_GENERIC_BOARD_ID,
ctx->buf);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
index 4aaaea3b5f8f..444da982593f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
@@ -1169,6 +1169,7 @@ static const struct ixgbe_eeprom_operations 
eeprom_ops_82598 = {
.calc_checksum  = &ixgbe_calc_eeprom_checksum_generic,
.validate_checksum  = &ixgbe_validate_eeprom_checksum_generic,
.update_checksum= &ixgbe_update_eeprom_checksum_generic,
+   .read_pba_string= &ixgbe_read_pba_string_generic,
 };
 
 static const struct ixgbe_phy_operations phy_ops_82598 = {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index 964988b4d58b..d5b1b974b4a3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -2230,6 +2230,7 @@ static const struct ixgbe_eeprom_operations 
eeprom_ops_82599 = {
.calc_checksum  = &ixgbe_calc_eeprom_checksum_generic,
.validate_checksum  = &ixgbe_validate_eeprom_checksum_generic,
.update_checksum= &ixgbe_update_eeprom_checksum_generic,
+   .read_pba_string= &ixgbe_read_pba_string_generic,
 };
 
 static const struct ixgbe_phy_operations phy_ops_82599 = {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index 7beaf6ea57f9..5784d5d1896e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -332,6 +332,7 @@ int ixgbe_start_hw_generic(struct ixgbe_hw *hw)
  * Devices in the second generation:
  * 82599
  * X540
+ * E610
  **/
 int ixgbe_start_hw_gen2(struct ixgbe_hw *hw)
 {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index b34570b244d9..7b3f72fac55f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -343,6 +343,41 @@ void ixgbe_fill_dflt_direct_cmd_desc(struct ixgbe_aci_desc 
*desc, u16 opcode)
desc->flags = cpu_to_le16(IXGBE_ACI_FLAG_SI);
 }
 
+/**
+ * ixgbe_aci_get_fw_ver - Get the firmware version
+ * @hw: pointer to the HW struct
+ *
+ * Get the firmware version using ACI command (0x0001).
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_aci_get_fw_ver(struct ixgbe_hw *hw)
+{
+   struct ixgbe_aci_cmd_get_ver *resp;
+   struct ixgbe_aci_desc desc;
+   int err;
+
+   resp = &desc.params.get_ver;
+
+   ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_get_ver);
+
+   err = ixgbe_aci_send_cmd(hw, &desc, NULL, 0);
+
+   if (!err) {
+   hw->fw_branch = resp->fw_branch;
+   hw->fw_maj_ver = resp->fw_major;
+   hw->fw_min_ver = resp->fw_minor;
+   hw->fw_patch = resp->fw_patch;
+   hw->fw_build = le32_to_cpu(resp->fw_build);
+   hw->api_branch = resp->api_br

[Intel-wired-lan] [PATCH iwl-next v6 13/15] ixgbe: add FW API version check

2025-03-07 Thread Jedrzej Jagielski
Add E610 specific function checking whether the FW API version
is compatible with the driver expectations.

The major API version should be less than or equal to the expected
API version. If not the driver won't be fully operational.

Check the minor version, and if it is more than two versions lesser
or greater than the expected version, print a message indicating
that the NVM or driver should be updated respectively.

Reviewed-by: Mateusz Polchlopek 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Signed-off-by: Jedrzej Jagielski 
---
v5: add get_fw_ver
---
 .../ethernet/intel/ixgbe/devlink/devlink.c|  2 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 34 +++
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  1 +
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  4 +++
 6 files changed, 43 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index 7e049c28ff61..dce09f5bd8df 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -496,6 +496,8 @@ static int ixgbe_devlink_reload_empr_finish(struct devlink 
*devlink,
 
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
 
+   adapter->flags2 &= ~IXGBE_FLAG2_API_MISMATCH;
+
return 0;
 }
 
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h 
b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 83d4d7368cda..2246997bc9fb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -671,6 +671,7 @@ struct ixgbe_adapter {
 #define IXGBE_FLAG2_PHY_FW_LOAD_FAILED BIT(20)
 #define IXGBE_FLAG2_NO_MEDIA   BIT(21)
 #define IXGBE_FLAG2_MOD_POWER_UNSUPPORTED  BIT(22)
+#define IXGBE_FLAG2_API_MISMATCH   BIT(23)
 
/* Tx fast path data */
int num_tx_queues;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index 4c373b4e4440..1d894dc9aa6c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -3877,6 +3877,7 @@ static const struct ixgbe_mac_operations mac_ops_e610 = {
.led_off= ixgbe_led_off_generic,
.init_led_link_act  = ixgbe_init_led_link_act_generic,
.reset_hw   = ixgbe_reset_hw_e610,
+   .get_fw_ver = ixgbe_aci_get_fw_ver,
.get_media_type = ixgbe_get_media_type_e610,
.setup_link = ixgbe_setup_link_e610,
.get_link_capabilities  = ixgbe_get_link_capabilities_e610,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index e52b3cd1ddb9..492e6b194f61 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8361,6 +8361,34 @@ static void ixgbe_reset_subtask(struct ixgbe_adapter 
*adapter)
rtnl_unlock();
 }
 
+static int ixgbe_check_fw_api_mismatch(struct ixgbe_adapter *adapter)
+{
+   struct ixgbe_hw *hw = &adapter->hw;
+
+   if (hw->mac.type != ixgbe_mac_e610)
+   return 0;
+
+   if (hw->mac.ops.get_fw_ver && hw->mac.ops.get_fw_ver(hw))
+   return 0;
+
+   if (hw->api_maj_ver > IXGBE_FW_API_VER_MAJOR) {
+   e_dev_err("The driver for the device stopped because the NVM 
image is newer than expected. You must install the most recent version of the 
network driver.\n");
+
+   adapter->flags2 |= IXGBE_FLAG2_API_MISMATCH;
+   return -EOPNOTSUPP;
+   } else if (hw->api_maj_ver == IXGBE_FW_API_VER_MAJOR &&
+  hw->api_min_ver > IXGBE_FW_API_VER_MINOR + 
IXGBE_FW_API_VER_DIFF_ALLOWED) {
+   e_dev_info("The driver for the device detected a newer version 
of the NVM image than expected. Please install the most recent version of the 
network driver.\n");
+   adapter->flags2 |= IXGBE_FLAG2_API_MISMATCH;
+   } else if (hw->api_maj_ver < IXGBE_FW_API_VER_MAJOR ||
+  hw->api_min_ver < IXGBE_FW_API_VER_MINOR - 
IXGBE_FW_API_VER_DIFF_ALLOWED) {
+   e_dev_info("The driver for the device detected an older version 
of the NVM image than expected. Please update the NVM image.\n");
+   adapter->flags2 |= IXGBE_FLAG2_API_MISMATCH;
+   }
+
+   return 0;
+}
+
 /**
  * ixgbe_check_fw_error - Check firmware for errors
  * @adapter: the adapter private structure
@@ -8371,6 +8399,7 @@ static bool ixgbe_check_fw_error(struct ixgbe_adapter 
*adapter)
 {
struct ixgbe_hw *hw = &adapter->hw;
u32 fwsm;
+   int err;
 
/* read fwsm.ext_err_ind register and log errors */
fwsm = IXGBE_READ

[Intel-wired-lan] [PATCH iwl-next v6 14/15] ixgbe: add E610 implementation of FW recovery mode

2025-03-07 Thread Jedrzej Jagielski
Add E610 implementation of fw_recovery_mode MAC operation.

In case of E610 information about recovery mode is obtained
from FW_MODES field in IXGBE_GL_MNG_FWSM register (0x000B6134).

Introduce recovery specific probing flow and init only
vital features.

User should be able to perform NVM update using devlink
once recovery mode is detected in order to load a healthy img.

Reviewed-by: Mateusz Polchlopek 
Co-developed-by: Stefan Wegrzyn 
Signed-off-by: Stefan Wegrzyn 
Signed-off-by: Jedrzej Jagielski 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 17 
 .../ethernet/intel/ixgbe/ixgbe_fw_update.c| 15 +++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 88 +--
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  3 +
 4 files changed, 113 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index 1d894dc9aa6c..d4a3943faa21 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -1815,6 +1815,22 @@ void ixgbe_disable_rx_e610(struct ixgbe_hw *hw)
}
 }
 
+/**
+ * ixgbe_fw_recovery_mode_e610 - Check FW NVM recovery mode
+ * @hw: pointer to hardware structure
+ *
+ * Check FW NVM recovery mode by reading the value of
+ * the dedicated register.
+ *
+ * Return: true if FW is in recovery mode, otherwise false.
+ */
+static bool ixgbe_fw_recovery_mode_e610(struct ixgbe_hw *hw)
+{
+   u32 fwsm = IXGBE_READ_REG(hw, IXGBE_GL_MNG_FWSM);
+
+   return !!(fwsm & IXGBE_GL_MNG_FWSM_RECOVERY_M);
+}
+
 /**
  * ixgbe_init_phy_ops_e610 - PHY specific init
  * @hw: pointer to hardware structure
@@ -3880,6 +3896,7 @@ static const struct ixgbe_mac_operations mac_ops_e610 = {
.get_fw_ver = ixgbe_aci_get_fw_ver,
.get_media_type = ixgbe_get_media_type_e610,
.setup_link = ixgbe_setup_link_e610,
+   .fw_recovery_mode   = ixgbe_fw_recovery_mode_e610,
.get_link_capabilities  = ixgbe_get_link_capabilities_e610,
.get_bus_info   = ixgbe_get_bus_info_generic,
.acquire_swfw_sync  = ixgbe_acquire_swfw_sync_X540,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c
index 052d5b3fb371..c74f397cebb7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c
@@ -73,6 +73,8 @@ static int ixgbe_check_component_response(struct 
ixgbe_adapter *adapter,
  u8 response, u8 code,
  struct netlink_ext_ack *extack)
 {
+   struct ixgbe_hw *hw = &adapter->hw;
+
switch (response) {
case IXGBE_ACI_NVM_PASS_COMP_CAN_BE_UPDATED:
/* Firmware indicated this update is good to proceed. */
@@ -84,6 +86,11 @@ static int ixgbe_check_component_response(struct 
ixgbe_adapter *adapter,
case IXGBE_ACI_NVM_PASS_COMP_CAN_NOT_BE_UPDATED:
NL_SET_ERR_MSG_MOD(extack, "Firmware has rejected updating.");
break;
+   case IXGBE_ACI_NVM_PASS_COMP_PARTIAL_CHECK:
+   if (hw->mac.ops.fw_recovery_mode &&
+   hw->mac.ops.fw_recovery_mode(hw))
+   return 0;
+   break;
}
 
switch (code) {
@@ -653,7 +660,13 @@ int ixgbe_flash_pldm_image(struct devlink *devlink,
return -EOPNOTSUPP;
}
 
-   if (!hw->dev_caps.common_cap.nvm_unified_update) {
+   /*
+* Cannot get caps in recovery mode, so lack of nvm_unified_update bit
+* cannot lead to error
+*/
+   if (!hw->dev_caps.common_cap.nvm_unified_update &&
+   (hw->mac.ops.fw_recovery_mode &&
+!hw->mac.ops.fw_recovery_mode(hw))) {
NL_SET_ERR_MSG_MOD(extack,
   "Current firmware does not support unified 
update");
return -EOPNOTSUPP;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 492e6b194f61..0667e4e85f10 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8423,6 +8423,18 @@ static bool ixgbe_check_fw_error(struct ixgbe_adapter 
*adapter)
return false;
 }
 
+static void ixgbe_recovery_service_task(struct work_struct *work)
+{
+   struct ixgbe_adapter *adapter = container_of(work,
+struct ixgbe_adapter,
+service_task);
+
+   ixgbe_handle_fw_event(adapter);
+   ixgbe_service_event_complete(adapter);
+
+   mod_timer(&adapter->service_timer, jiffies + msecs_to_jiffies(100));
+}
+
 /**
  * ixgbe_service_task - manages and runs subtasks
  * @work: pointer to work_struct c

[Intel-wired-lan] [PATCH iwl-next v6 01/15] devlink: add value check to devlink_info_version_put()

2025-03-07 Thread Jedrzej Jagielski
Prevent from proceeding if there's nothing to print.

Suggested-by: Przemek Kitszel 
Reviewed-by: Jiri Pirko 
Tested-by: Bharath R 
Signed-off-by: Jedrzej Jagielski 
---
 net/devlink/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/devlink/dev.c b/net/devlink/dev.c
index d6e3db300acb..02602704bdea 100644
--- a/net/devlink/dev.c
+++ b/net/devlink/dev.c
@@ -775,7 +775,7 @@ static int devlink_info_version_put(struct devlink_info_req 
*req, int attr,
req->version_cb(version_name, version_type,
req->version_cb_priv);
 
-   if (!req->msg)
+   if (!req->msg || !*version_value)
return 0;
 
nest = nla_nest_start_noflag(req->msg, attr);
-- 
2.31.1



[Intel-wired-lan] [PATCH iwl-next v6 05/15] ixgbe: add E610 functions for acquiring flash data

2025-03-07 Thread Jedrzej Jagielski
From: Slawomir Mrozowicz 

Read NVM related info from the flash.

Add several helper functions used to access the flash data,
find memory banks, calculate offsets, calculate the flash size.

Reviewed-by: Przemek Kitszel 
Reviewed-by: Mateusz Polchlopek 
Tested-by: Bharath R 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Co-developed-by: Jedrzej Jagielski 
Signed-off-by: Jedrzej Jagielski 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 509 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h |   1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   4 +
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  40 +-
 4 files changed, 552 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index 683c668672d6..3654b7e32cc8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -2264,6 +2264,513 @@ int ixgbe_nvm_validate_checksum(struct ixgbe_hw *hw)
return err;
 }
 
+/**
+ * ixgbe_discover_flash_size - Discover the available flash size
+ * @hw: pointer to the HW struct
+ *
+ * The device flash could be up to 16MB in size. However, it is possible that
+ * the actual size is smaller. Use bisection to determine the accessible size
+ * of flash memory.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_discover_flash_size(struct ixgbe_hw *hw)
+{
+   u32 min_size = 0, max_size = IXGBE_ACI_NVM_MAX_OFFSET + 1;
+   int err;
+
+   err = ixgbe_acquire_nvm(hw, IXGBE_RES_READ);
+   if (err)
+   return err;
+
+   while ((max_size - min_size) > 1) {
+   u32 offset = (max_size + min_size) / 2;
+   u32 len = 1;
+   u8 data;
+
+   err = ixgbe_read_flat_nvm(hw, offset, &len, &data, false);
+   if (err == -EIO &&
+   hw->aci.last_status == IXGBE_ACI_RC_EINVAL) {
+   err = 0;
+   max_size = offset;
+   } else if (!err) {
+   min_size = offset;
+   } else {
+   /* an unexpected error occurred */
+   goto err_read_flat_nvm;
+   }
+   }
+
+   hw->flash.flash_size = max_size;
+
+err_read_flat_nvm:
+   ixgbe_release_nvm(hw);
+
+   return err;
+}
+
+/**
+ * ixgbe_read_sr_base_address - Read the value of a Shadow RAM pointer word
+ * @hw: pointer to the HW structure
+ * @offset: the word offset of the Shadow RAM word to read
+ * @pointer: pointer value read from Shadow RAM
+ *
+ * Read the given Shadow RAM word, and convert it to a pointer value specified
+ * in bytes. This function assumes the specified offset is a valid pointer
+ * word.
+ *
+ * Each pointer word specifies whether it is stored in word size or 4KB
+ * sector size by using the highest bit. The reported pointer value will be in
+ * bytes, intended for flat NVM reads.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_read_sr_base_address(struct ixgbe_hw *hw, u16 offset,
+ u32 *pointer)
+{
+   u16 value;
+   int err;
+
+   err = ixgbe_read_ee_aci_e610(hw, offset, &value);
+   if (err)
+   return err;
+
+   /* Determine if the pointer is in 4KB or word units */
+   if (value & IXGBE_SR_NVM_PTR_4KB_UNITS)
+   *pointer = (value & ~IXGBE_SR_NVM_PTR_4KB_UNITS) * SZ_4K;
+   else
+   *pointer = value * sizeof(u16);
+
+   return 0;
+}
+
+/**
+ * ixgbe_read_sr_area_size - Read an area size from a Shadow RAM word
+ * @hw: pointer to the HW structure
+ * @offset: the word offset of the Shadow RAM to read
+ * @size: size value read from the Shadow RAM
+ *
+ * Read the given Shadow RAM word, and convert it to an area size value
+ * specified in bytes. This function assumes the specified offset is a valid
+ * area size word.
+ *
+ * Each area size word is specified in 4KB sector units. This function reports
+ * the size in bytes, intended for flat NVM reads.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_read_sr_area_size(struct ixgbe_hw *hw, u16 offset, u32 *size)
+{
+   u16 value;
+   int err;
+
+   err = ixgbe_read_ee_aci_e610(hw, offset, &value);
+   if (err)
+   return err;
+
+   /* Area sizes are always specified in 4KB units */
+   *size = value * SZ_4K;
+
+   return 0;
+}
+
+/**
+ * ixgbe_determine_active_flash_banks - Discover active bank for each module
+ * @hw: pointer to the HW struct
+ *
+ * Read the Shadow RAM control word and determine which banks are active for
+ * the NVM, OROM, and Netlist modules. Also read and calculate the associated
+ * pointer and size. These values are then cached into the ixgbe_flash_info
+ * structure for later use in order to calculate the correct offset to read

[Intel-wired-lan] [PATCH iwl-next v6 03/15] ixgbe: add initial devlink support

2025-03-07 Thread Jedrzej Jagielski
Add an initial support for devlink interface to ixgbe driver.

Similarly to i40e driver the implementation doesn't enable
devlink to manage device-wide configuration. Devlink instance
is created for each physical function of PCIe device.

Create separate directory for devlink related ixgbe files
and use naming scheme similar to the one used in the ice driver.

Add a stub for Documentation, to be extended by further patches.

Change struct ixgbe_adapter allocation to be done by devlink (Przemek),
as suggested by Jiri.

Reviewed-by: Mateusz Polchlopek 
Co-developed-by: Przemek Kitszel 
Signed-off-by: Przemek Kitszel 
Tested-by: Bharath R 
Signed-off-by: Jedrzej Jagielski 
---
v2: fix error patch in probe; minor tweaks
v4: alloc ixgbe_adapter by devlink
---
 Documentation/networking/devlink/index.rst|  1 +
 Documentation/networking/devlink/ixgbe.rst|  8 ++
 drivers/net/ethernet/intel/Kconfig|  1 +
 drivers/net/ethernet/intel/ixgbe/Makefile |  3 +-
 .../ethernet/intel/ixgbe/devlink/devlink.c| 77 +++
 .../ethernet/intel/ixgbe/devlink/devlink.h| 10 +++
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  | 12 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 30 +++-
 8 files changed, 138 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/networking/devlink/ixgbe.rst
 create mode 100644 drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
 create mode 100644 drivers/net/ethernet/intel/ixgbe/devlink/devlink.h

diff --git a/Documentation/networking/devlink/index.rst 
b/Documentation/networking/devlink/index.rst
index 948c8c44e233..8319f43b5933 100644
--- a/Documentation/networking/devlink/index.rst
+++ b/Documentation/networking/devlink/index.rst
@@ -84,6 +84,7 @@ parameters, info versions, and other features it supports.
i40e
ionic
ice
+   ixgbe
mlx4
mlx5
mlxsw
diff --git a/Documentation/networking/devlink/ixgbe.rst 
b/Documentation/networking/devlink/ixgbe.rst
new file mode 100644
index ..c04ac51c6d85
--- /dev/null
+++ b/Documentation/networking/devlink/ixgbe.rst
@@ -0,0 +1,8 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=
+ixgbe devlink support
+=
+
+This document describes the devlink features implemented by the ``ixgbe``
+device driver.
diff --git a/drivers/net/ethernet/intel/Kconfig 
b/drivers/net/ethernet/intel/Kconfig
index 5579fb9bfd55..3366738c57c8 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -147,6 +147,7 @@ config IXGBE
depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select MDIO
+   select NET_DEVLINK
select PHYLIB
help
  This driver supports Intel(R) 10GbE PCI Express family of
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile 
b/drivers/net/ethernet/intel/ixgbe/Makefile
index b456d102655a..11f37140c0a3 100644
--- a/drivers/net/ethernet/intel/ixgbe/Makefile
+++ b/drivers/net/ethernet/intel/ixgbe/Makefile
@@ -4,12 +4,13 @@
 # Makefile for the Intel(R) 10GbE PCI Express ethernet driver
 #
 
+subdir-ccflags-y += -I$(src)
 obj-$(CONFIG_IXGBE) += ixgbe.o
 
 ixgbe-y := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \
ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
ixgbe_mbx.o ixgbe_x540.o ixgbe_x550.o ixgbe_lib.o ixgbe_ptp.o \
-   ixgbe_xsk.o ixgbe_e610.o
+   ixgbe_xsk.o ixgbe_e610.o devlink/devlink.o
 
 ixgbe-$(CONFIG_IXGBE_DCB) +=  ixgbe_dcb.o ixgbe_dcb_82598.o \
   ixgbe_dcb_82599.o ixgbe_dcb_nl.o
diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
new file mode 100644
index ..6c3452cf5d7d
--- /dev/null
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2025, Intel Corporation. */
+
+#include "ixgbe.h"
+#include "devlink.h"
+
+static const struct devlink_ops ixgbe_devlink_ops = {
+};
+
+/**
+ * ixgbe_allocate_devlink - Allocate devlink instance
+ * @dev: device to allocate devlink for
+ *
+ * Allocate a devlink instance for this physical function.
+ *
+ * Return: pointer to the device adapter structure on success,
+ * ERR_PTR(-ENOMEM) when allocation failed.
+ */
+struct ixgbe_adapter *ixgbe_allocate_devlink(struct device *dev)
+{
+   struct ixgbe_adapter *adapter;
+   struct devlink *devlink;
+
+   devlink = devlink_alloc(&ixgbe_devlink_ops, sizeof(*adapter), dev);
+   if (!devlink)
+   return ERR_PTR(-ENOMEM);
+
+   adapter = devlink_priv(devlink);
+   adapter->devlink = devlink;
+
+   return adapter;
+}
+
+/**
+ * ixgbe_devlink_set_switch_id - Set unique switch ID based on PCI DSN
+ * @adapter: pointer to the device adapter structure
+ * @ppid: struct with switch id information
+ */
+static void ixgbe_devlink_set_switch_id(struct ixgbe_adapter *adapter,
+   struct netd

[Intel-wired-lan] [PATCH iwl-next v6 02/15] ixgbe: wrap netdev_priv() usage

2025-03-07 Thread Jedrzej Jagielski
From: Przemek Kitszel 

Wrap use of netdev_priv() in order to change the allocator of the device
private structure from alloc_etherdev_mq() to the devlink in next commit.

All but one netdev_priv() calls in the whole driver are replaced, the
remaining one is called on MACVLAN (so not ixgbe) device.

Signed-off-by: Przemek Kitszel 
Signed-off-by: Jedrzej Jagielski 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  |  5 ++
 .../net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c   | 56 +++---
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  | 74 +--
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 12 +--
 .../net/ethernet/intel/ixgbe/ixgbe_ipsec.c| 10 +--
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 74 +--
 .../net/ethernet/intel/ixgbe/ixgbe_sriov.c| 16 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c  |  2 +-
 8 files changed, 127 insertions(+), 122 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h 
b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index e6a380d4929b..0efd6da874a5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -830,6 +830,11 @@ struct ixgbe_adapter {
spinlock_t vfs_lock;
 };
 
+static inline struct ixgbe_adapter *ixgbe_from_netdev(struct net_device 
*netdev)
+{
+   return netdev_priv(netdev);
+}
+
 static inline int ixgbe_determine_xdp_q_idx(int cpu)
 {
if (static_key_enabled(&ixgbe_xdp_locking_key))
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
index 19d6b6fa8fb3..3dd5a16a14df 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
@@ -118,14 +118,14 @@ static int ixgbe_copy_dcb_cfg(struct ixgbe_adapter 
*adapter, int tc_max)
 
 static u8 ixgbe_dcbnl_get_state(struct net_device *netdev)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
return !!(adapter->flags & IXGBE_FLAG_DCB_ENABLED);
 }
 
 static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
/* Fail command if not in CEE mode */
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
@@ -142,7 +142,7 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, 
u8 state)
 static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev,
 u8 *perm_addr)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
int i, j;
 
memset(perm_addr, 0xff, MAX_ADDR_LEN);
@@ -167,7 +167,7 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device 
*netdev, int tc,
 u8 prio, u8 bwg_id, u8 bw_pct,
 u8 up_map)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
if (prio != DCB_ATTR_VALUE_UNDEFINED)
adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type = prio;
@@ -184,7 +184,7 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device 
*netdev, int tc,
 static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int 
bwg_id,
  u8 bw_pct)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct;
 }
@@ -193,7 +193,7 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device 
*netdev, int tc,
 u8 prio, u8 bwg_id, u8 bw_pct,
 u8 up_map)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
if (prio != DCB_ATTR_VALUE_UNDEFINED)
adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type = prio;
@@ -210,7 +210,7 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device 
*netdev, int tc,
 static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int 
bwg_id,
  u8 bw_pct)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct;
 }
@@ -219,7 +219,7 @@ static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device 
*netdev, int tc,
 u8 *prio, u8 *bwg_id, u8 *bw_pct,
 u8 *up_map)
 {
-   struct ixgbe_adapter *adapter = netdev_priv(netdev);
+   struct ixgbe_adapter *adapter = ixgbe_from_netdev(netdev);
 
*prio =

[Intel-wired-lan] [PATCH iwl-next v6 07/15] ixgbe: read the netlist version information

2025-03-07 Thread Jedrzej Jagielski
From: Slawomir Mrozowicz 

Add functions reading the netlist version info and use them
as a part of the setting NVM info procedure.

Reviewed-by: Mateusz Polchlopek 
Tested-by: Bharath R 
Signed-off-by: Slawomir Mrozowicz 
Co-developed-by: Piotr Kwapulinski 
Signed-off-by: Piotr Kwapulinski 
Signed-off-by: Jedrzej Jagielski 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 112 ++
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  33 ++
 2 files changed, 145 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index bad4bc04bb66..b34570b244d9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -2582,6 +2582,33 @@ static int ixgbe_read_nvm_module(struct ixgbe_hw *hw,
return err;
 }
 
+/**
+ * ixgbe_read_netlist_module - Read data from the netlist module area
+ * @hw: pointer to the HW structure
+ * @bank: whether to read from the active or inactive module
+ * @offset: offset into the netlist to read from
+ * @data: storage for returned word value
+ *
+ * Read a word from the specified netlist bank.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_read_netlist_module(struct ixgbe_hw *hw,
+enum ixgbe_bank_select bank,
+u32 offset, u16 *data)
+{
+   __le16 data_local;
+   int err;
+
+   err = ixgbe_read_flash_module(hw, bank, IXGBE_E610_SR_NETLIST_BANK_PTR,
+ offset * sizeof(data_local),
+ (u8 *)&data_local, sizeof(data_local));
+   if (!err)
+   *data = le16_to_cpu(data_local);
+
+   return err;
+}
+
 /**
  * ixgbe_read_orom_module - Read from the active Option ROM module
  * @hw: pointer to the HW structure
@@ -2887,6 +2914,86 @@ static int ixgbe_get_nvm_ver_info(struct ixgbe_hw *hw,
return 0;
 }
 
+/**
+ * ixgbe_get_netlist_info - Read the netlist version information
+ * @hw: pointer to the HW struct
+ * @bank: whether to read from the active or inactive flash bank
+ * @netlist: pointer to netlist version info structure
+ *
+ * Get the netlist version information from the requested bank. Reads the Link
+ * Topology section to find the Netlist ID block and extract the relevant
+ * information into the netlist version structure.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_get_netlist_info(struct ixgbe_hw *hw,
+ enum ixgbe_bank_select bank,
+ struct ixgbe_netlist_info *netlist)
+{
+   u16 module_id, length, node_count, i;
+   u16 *id_blk;
+   int err;
+
+   err = ixgbe_read_netlist_module(hw, bank, IXGBE_NETLIST_TYPE_OFFSET,
+   &module_id);
+   if (err)
+   return err;
+
+   if (module_id != IXGBE_NETLIST_LINK_TOPO_MOD_ID)
+   return -EIO;
+
+   err = ixgbe_read_netlist_module(hw, bank, IXGBE_LINK_TOPO_MODULE_LEN,
+   &length);
+   if (err)
+   return err;
+
+   /* Sanity check that we have at least enough words to store the
+* netlist ID block.
+*/
+   if (length < IXGBE_NETLIST_ID_BLK_SIZE)
+   return -EIO;
+
+   err = ixgbe_read_netlist_module(hw, bank, IXGBE_LINK_TOPO_NODE_COUNT,
+   &node_count);
+   if (err)
+   return err;
+
+   node_count &= IXGBE_LINK_TOPO_NODE_COUNT_M;
+
+   id_blk = kcalloc(IXGBE_NETLIST_ID_BLK_SIZE, sizeof(*id_blk), 
GFP_KERNEL);
+   if (!id_blk)
+   return -ENOMEM;
+
+   /* Read out the entire Netlist ID Block at once. */
+   err = ixgbe_read_flash_module(hw, bank, IXGBE_E610_SR_NETLIST_BANK_PTR,
+ IXGBE_NETLIST_ID_BLK_OFFSET(node_count) *
+ sizeof(*id_blk), (u8 *)id_blk,
+ IXGBE_NETLIST_ID_BLK_SIZE *
+ sizeof(*id_blk));
+   if (err)
+   goto free_id_blk;
+
+   for (i = 0; i < IXGBE_NETLIST_ID_BLK_SIZE; i++)
+   id_blk[i] = le16_to_cpu(((__le16 *)id_blk)[i]);
+
+   netlist->major = id_blk[IXGBE_NETLIST_ID_BLK_MAJOR_VER_HIGH] << 16 |
+id_blk[IXGBE_NETLIST_ID_BLK_MAJOR_VER_LOW];
+   netlist->minor = id_blk[IXGBE_NETLIST_ID_BLK_MINOR_VER_HIGH] << 16 |
+id_blk[IXGBE_NETLIST_ID_BLK_MINOR_VER_LOW];
+   netlist->type = id_blk[IXGBE_NETLIST_ID_BLK_TYPE_HIGH] << 16 |
+   id_blk[IXGBE_NETLIST_ID_BLK_TYPE_LOW];
+   netlist->rev = id_blk[IXGBE_NETLIST_ID_BLK_REV_HIGH] << 16 |
+  id_blk[IXGBE_NETLIST_ID_BLK_REV_LOW];
+   netlist->cust_ver = id_blk[IXGBE_NETLIST_ID_BLK_CUST_VER];
+   /* Read the left m

[Intel-wired-lan] [PATCH iwl-next v6 15/15] ixgbe: add support for FW rollback mode

2025-03-07 Thread Jedrzej Jagielski
From: Andrii Staikov 

The driver should detect whether the device entered FW rollback
mode and then notify user with the dedicated message including
FW and NVM versions.

Even if the driver detected rollback mode, this should not result
in an probe error and the normal flow proceeds.

FW tries to rollback to “old” operational FW located in the
inactive NVM bank in cases when newly loaded FW exhibits faulty
behavior. If something goes wrong during boot the FW may switch
into rollback mode in an attempt to avoid recovery mode and stay
operational. After rollback is successful, the banks are swapped,
and the “rollback” bank becomes the active bank for the next reset.

Reviewed-by: Mateusz Polchlopek 
Signed-off-by: Andrii Staikov 
Signed-off-by: Jedrzej Jagielski 
---
 .../ethernet/intel/ixgbe/devlink/devlink.c|  3 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 33 +++
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 +++
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  2 ++
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  1 +
 6 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c 
b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
index dce09f5bd8df..6efa094e6a29 100644
--- a/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
@@ -496,7 +496,8 @@ static int ixgbe_devlink_reload_empr_finish(struct devlink 
*devlink,
 
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
 
-   adapter->flags2 &= ~IXGBE_FLAG2_API_MISMATCH;
+   adapter->flags2 &= ~(IXGBE_FLAG2_API_MISMATCH |
+IXGBE_FLAG2_FW_ROLLBACK);
 
return 0;
 }
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h 
b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 2246997bc9fb..23c2e2c2649c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -672,6 +672,7 @@ struct ixgbe_adapter {
 #define IXGBE_FLAG2_NO_MEDIA   BIT(21)
 #define IXGBE_FLAG2_MOD_POWER_UNSUPPORTED  BIT(22)
 #define IXGBE_FLAG2_API_MISMATCH   BIT(23)
+#define IXGBE_FLAG2_FW_ROLLBACKBIT(24)
 
/* Tx fast path data */
int num_tx_queues;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
index d4a3943faa21..5154ce861f2a 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c
@@ -1831,6 +1831,22 @@ static bool ixgbe_fw_recovery_mode_e610(struct ixgbe_hw 
*hw)
return !!(fwsm & IXGBE_GL_MNG_FWSM_RECOVERY_M);
 }
 
+/**
+ * ixgbe_fw_rollback_mode_e610 - Check FW NVM rollback mode
+ * @hw: pointer to hardware structure
+ *
+ * Check FW NVM rollback mode by reading the value of
+ * the dedicated register.
+ *
+ * Return: true if FW is in rollback mode, otherwise false.
+ */
+static bool ixgbe_fw_rollback_mode_e610(struct ixgbe_hw *hw)
+{
+   u32 fwsm = IXGBE_READ_REG(hw, IXGBE_GL_MNG_FWSM);
+
+   return !!(fwsm & IXGBE_GL_MNG_FWSM_ROLLBACK_M);
+}
+
 /**
  * ixgbe_init_phy_ops_e610 - PHY specific init
  * @hw: pointer to hardware structure
@@ -3163,6 +3179,21 @@ int ixgbe_get_inactive_nvm_ver(struct ixgbe_hw *hw, 
struct ixgbe_nvm_info *nvm)
return ixgbe_get_nvm_ver_info(hw, IXGBE_INACTIVE_FLASH_BANK, nvm);
 }
 
+/**
+ * ixgbe_get_active_nvm_ver - Read Option ROM version from the active bank
+ * @hw: pointer to the HW structure
+ * @nvm: storage for Option ROM version information
+ *
+ * Reads the NVM EETRACK ID, Map version, and security revision of the
+ * active NVM bank.
+ *
+ * Return: the exit code of the operation.
+ */
+static int ixgbe_get_active_nvm_ver(struct ixgbe_hw *hw, struct ixgbe_nvm_info 
*nvm)
+{
+   return ixgbe_get_nvm_ver_info(hw, IXGBE_ACTIVE_FLASH_BANK, nvm);
+}
+
 /**
  * ixgbe_get_netlist_info - Read the netlist version information
  * @hw: pointer to the HW struct
@@ -3897,6 +3928,8 @@ static const struct ixgbe_mac_operations mac_ops_e610 = {
.get_media_type = ixgbe_get_media_type_e610,
.setup_link = ixgbe_setup_link_e610,
.fw_recovery_mode   = ixgbe_fw_recovery_mode_e610,
+   .fw_rollback_mode   = ixgbe_fw_rollback_mode_e610,
+   .get_nvm_ver= ixgbe_get_active_nvm_ver,
.get_link_capabilities  = ixgbe_get_link_capabilities_e610,
.get_bus_info   = ixgbe_get_bus_info_generic,
.acquire_swfw_sync  = ixgbe_acquire_swfw_sync_X540,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 0667e4e85f10..3013ca7ae7e3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8420,6 +

[Intel-wired-lan] [PATCH iwl-next v6 00/15] ixgbe: Add basic devlink support

2025-03-07 Thread Jedrzej Jagielski
Create devlink specific directory for more convenient future feature
development.

Flashing and reloading are supported only by E610 devices.

Introduce basic FW/NVM validation since devlink reload introduces
possibility of runtime NVM update. Check FW API version, FW recovery mode
and FW rollback mode. Introduce minimal recovery probe to let user to
reload the faulty FW when recovery mode is detected.

This series is based on the series introducing initial E610 device
support:
https://lore.kernel.org/intel-wired-lan/20241205084450.4651-1-piotr.kwapulin...@intel.com/
---
v3: introduce to the series additional patch touching devlink/dev.c
v4: introduce to the series additional patch changing netdev allocation
---
Andrii Staikov (1):
  ixgbe: add support for FW rollback mode

Jedrzej Jagielski (10):
  devlink: add value check to devlink_info_version_put()
  ixgbe: add initial devlink support
  ixgbe: add handler for devlink .info_get()
  ixgbe: add .info_get extension specific for E610 devices
  ixgbe: add E610 functions getting PBA and FW ver info
  ixgbe: extend .info_get with stored versions
  ixgbe: add device flash update via devlink
  ixgbe: add support for devlink reload
  ixgbe: add FW API version check
  ixgbe: add E610 implementation of FW recovery mode

Przemek Kitszel (1):
  ixgbe: wrap netdev_priv() usage

Slawomir Mrozowicz (3):
  ixgbe: add E610 functions for acquiring flash data
  ixgbe: read the OROM version information
  ixgbe: read the netlist version information

 Documentation/networking/devlink/index.rst|1 +
 Documentation/networking/devlink/ixgbe.rst|  107 ++
 drivers/net/ethernet/intel/Kconfig|2 +
 drivers/net/ethernet/intel/ixgbe/Makefile |3 +-
 .../ethernet/intel/ixgbe/devlink/devlink.c|  582 +++
 .../ethernet/intel/ixgbe/devlink/devlink.h|   10 +
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  |   21 +
 .../net/ethernet/intel/ixgbe/ixgbe_82598.c|1 +
 .../net/ethernet/intel/ixgbe/ixgbe_82599.c|1 +
 .../net/ethernet/intel/ixgbe/ixgbe_common.c   |1 +
 .../net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c   |   56 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c | 1514 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_e610.h |   16 +
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  |   86 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c |   12 +-
 .../ethernet/intel/ixgbe/ixgbe_fw_update.c|  708 
 .../ethernet/intel/ixgbe/ixgbe_fw_update.h|   12 +
 .../net/ethernet/intel/ixgbe/ixgbe_ipsec.c|   10 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  261 ++-
 .../net/ethernet/intel/ixgbe/ixgbe_sriov.c|   16 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |5 +
 .../ethernet/intel/ixgbe/ixgbe_type_e610.h|  161 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c |1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c |1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c  |2 +-
 net/devlink/dev.c |2 +-
 26 files changed, 3352 insertions(+), 240 deletions(-)
 create mode 100644 Documentation/networking/devlink/ixgbe.rst
 create mode 100644 drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
 create mode 100644 drivers/net/ethernet/intel/ixgbe/devlink/devlink.h
 create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c
 create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.h


base-commit: 0a5f2afff8673e66160725b8ec8310f47c74f8b9
-- 
2.31.1



Re: [Intel-wired-lan] [PATCH iwl-next] ice: use DSN instead of PCI BDF for ice_adapter index

2025-03-07 Thread Temerkhanov, Sergey
Comments inline

-Original Message-
From: Jiri Pirko  
Sent: Friday, March 7, 2025 1:39 PM
To: Kitszel, Przemyslaw 
Cc: intel-wired-...@lists.osuosl.org; Nguyen, Anthony L 
; net...@vger.kernel.org; Keller, Jacob E 
; Jakub Kicinski ; Loktionov, 
Aleksandr ; Kolacinski, Karol 
; Nitka, Grzegorz ; 
Schmidt, Michal ; Temerkhanov, Sergey 

Subject: Re: [PATCH iwl-next] ice: use DSN instead of PCI BDF for ice_adapter 
index

Thu, Mar 06, 2025 at 10:11:46PM +0100, przemyslaw.kits...@intel.com wrote:
>Use Device Serial Number instead of PCI bus/device/function for index 
>of struct ice_adapter.
>Functions on the same physical device should point to the very same 
>ice_adapter instance.
>
>This is not only simplification, but also fixes things up when PF is 
>passed to VM (and thus has a random BDF).

It might be worth checking behavior of different hypervisors/VMMs with 
multifunction PCI devices passthrough.
QEMU, for example, has options to set the BDFs explicitly.

>
>Suggested-by: Jacob Keller 
>Suggested-by: Jakub Kicinski 
>Suggested-by: Jiri Pirko 
>Reviewed-by: Aleksandr Loktionov 
>Signed-off-by: Przemek Kitszel 

>-struct ice_adapter *ice_adapter_get(const struct pci_dev *pdev); -void 
>ice_adapter_put(const struct pci_dev *pdev);
>+struct ice_adapter *ice_adapter_get(struct pci_dev *pdev); void 
>+ice_adapter_put(struct pci_dev *pdev);
> 
> #endif /* _ICE_ADAPTER_H */
>diff --git a/drivers/net/ethernet/intel/ice/ice_adapter.c 
>b/drivers/net/ethernet/intel/ice/ice_adapter.c
>index 01a08cfd0090..b668339ed0ef 100644
>--- a/drivers/net/ethernet/intel/ice/ice_adapter.c
>+++ b/drivers/net/ethernet/intel/ice/ice_adapter.c
>@@ -1,7 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0-only  // SPDX-FileCopyrightText: 
>Copyright Red Hat
> 
>-#include 
> #include 
> #include 
> #include 
>@@ -14,29 +13,9 @@
> static DEFINE_XARRAY(ice_adapters);
> static DEFINE_MUTEX(ice_adapters_mutex);
> 
>-/* PCI bus number is 8 bits. Slot is 5 bits. Domain can have the rest. 
>*/ -#define INDEX_FIELD_DOMAIN GENMASK(BITS_PER_LONG - 1, 13)
>-#define INDEX_FIELD_DEVGENMASK(31, 16)
>-#define INDEX_FIELD_BUSGENMASK(12, 5)
>-#define INDEX_FIELD_SLOT   GENMASK(4, 0)
>-
>-static unsigned long ice_adapter_index(const struct pci_dev *pdev)
>+static unsigned long ice_adapter_index(struct pci_dev *pdev)
> {
>-  unsigned int domain = pci_domain_nr(pdev->bus);
>-
>-  WARN_ON(domain > FIELD_MAX(INDEX_FIELD_DOMAIN));
>-
>-  switch (pdev->device) {
>-  case ICE_DEV_ID_E825C_BACKPLANE:
>-  case ICE_DEV_ID_E825C_QSFP:
>-  case ICE_DEV_ID_E825C_SFP:
>-  case ICE_DEV_ID_E825C_SGMII:
>-  return FIELD_PREP(INDEX_FIELD_DEV, pdev->device);
>-  default:
>-  return FIELD_PREP(INDEX_FIELD_DOMAIN, domain) |
>- FIELD_PREP(INDEX_FIELD_BUS,pdev->bus->number) |
>- FIELD_PREP(INDEX_FIELD_SLOT,   PCI_SLOT(pdev->devfn));
>-  }
>+  return (unsigned long)pci_get_dsn(pdev);

>How do you ensure there is no xarray index collision then you cut the number 
>like this?

It is also probably necessary to check if all devices supported by the driver 
have DSN capability enabled.

Regards,
Sergey


Re: [Intel-wired-lan] [PATCH net-next 09/16] idpf: remove SW marker handling from NAPI

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:25PM +0100, Alexander Lobakin wrote:
> From: Michal Kubiak 
> 
> SW marker descriptors on completion queues are used only when a queue
> is about to be destroyed. It's far from hotpath and handling it in the
> hotpath NAPI poll makes no sense.
> Instead, run a simple poller after a virtchnl message for destroying
> the queue is sent and wait for the replies. If replies for all of the
> queues are received, this means the synchronization is done correctly
> and we can go forth with stopping the link.
> 
> Signed-off-by: Michal Kubiak 
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/idpf/idpf.h|   7 +-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h   |   4 +-
>  drivers/net/ethernet/intel/idpf/idpf_lib.c|   2 -
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 108 +++---
>  .../net/ethernet/intel/idpf/idpf_virtchnl.c   |  34 ++
>  5 files changed, 80 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf.h 
> b/drivers/net/ethernet/intel/idpf/idpf.h
> index 66544faab710..6b51a5dcc1e0 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf.h
> @@ -36,6 +36,7 @@ struct idpf_vport_max_q;
>  #define IDPF_NUM_CHUNKS_PER_MSG(struct_sz, chunk_sz) \
>   ((IDPF_CTLQ_MAX_BUF_LEN - (struct_sz)) / (chunk_sz))
>  
> +#define IDPF_WAIT_FOR_MARKER_TIMEO   500
>  #define IDPF_MAX_WAIT500
>  
>  /* available message levels */
> @@ -224,13 +225,10 @@ enum idpf_vport_reset_cause {
>  /**
>   * enum idpf_vport_flags - Vport flags
>   * @IDPF_VPORT_DEL_QUEUES: To send delete queues message
> - * @IDPF_VPORT_SW_MARKER: Indicate TX pipe drain software marker packets
> - * processing is done
>   * @IDPF_VPORT_FLAGS_NBITS: Must be last
>   */
>  enum idpf_vport_flags {
>   IDPF_VPORT_DEL_QUEUES,
> - IDPF_VPORT_SW_MARKER,
>   IDPF_VPORT_FLAGS_NBITS,
>  };
>  
> @@ -289,7 +287,6 @@ struct idpf_port_stats {
>   * @tx_itr_profile: TX profiles for Dynamic Interrupt Moderation
>   * @port_stats: per port csum, header split, and other offload stats
>   * @link_up: True if link is up
> - * @sw_marker_wq: workqueue for marker packets
>   */
>  struct idpf_vport {
>   u16 num_txq;
> @@ -332,8 +329,6 @@ struct idpf_vport {
>   struct idpf_port_stats port_stats;
>  
>   bool link_up;
> -
> - wait_queue_head_t sw_marker_wq;
>  };
>  
>  /**
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h 
> b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> index 9f938301b2c5..dd6cc3b5cdab 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> @@ -286,7 +286,6 @@ struct idpf_ptype_state {
>   * bit and Q_RFL_GEN is the SW bit.
>   * @__IDPF_Q_FLOW_SCH_EN: Enable flow scheduling
>   * @__IDPF_Q_SW_MARKER: Used to indicate TX queue marker completions
> - * @__IDPF_Q_POLL_MODE: Enable poll mode
>   * @__IDPF_Q_CRC_EN: enable CRC offload in singleq mode
>   * @__IDPF_Q_HSPLIT_EN: enable header split on Rx (splitq)
>   * @__IDPF_Q_FLAGS_NBITS: Must be last
> @@ -296,7 +295,6 @@ enum idpf_queue_flags_t {
>   __IDPF_Q_RFL_GEN_CHK,
>   __IDPF_Q_FLOW_SCH_EN,
>   __IDPF_Q_SW_MARKER,
> - __IDPF_Q_POLL_MODE,
>   __IDPF_Q_CRC_EN,
>   __IDPF_Q_HSPLIT_EN,
>  
> @@ -1044,6 +1042,8 @@ bool idpf_rx_singleq_buf_hw_alloc_all(struct 
> idpf_rx_queue *rxq,
> u16 cleaned_count);
>  int idpf_tso(struct sk_buff *skb, struct idpf_tx_offload_params *off);
>  
> +void idpf_wait_for_sw_marker_completion(struct idpf_tx_queue *txq);
> +
>  static inline bool idpf_tx_maybe_stop_common(struct idpf_tx_queue *tx_q,
>u32 needed)
>  {
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c 
> b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index f3aea7bcdaa3..e17582d15e27 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> @@ -1501,8 +1501,6 @@ void idpf_init_task(struct work_struct *work)
>   index = vport->idx;
>   vport_config = adapter->vport_config[index];
>  
> - init_waitqueue_head(&vport->sw_marker_wq);
> -
>   spin_lock_init(&vport_config->mac_filter_list_lock);
>  
>   INIT_LIST_HEAD(&vport_config->user_config.mac_filter_list);
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
> b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index a240ed115e3e..4e3de6031422 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -1626,32 +1626,6 @@ int idpf_vport_queues_alloc(struct idpf_vport *vport)
>   return err;
>  }
>  
> -/**
> - * idpf_tx_handle_sw_marker - Handle queue marker packet
> - * @tx_q: tx queue to handle software marker
> - */
> -static void idpf_tx_handle_sw_marker(struct idpf_tx_queue *tx_q)
> -{
> - struct idpf_n

Re: [Intel-wired-lan] [PATCH net-next 12/16] idpf: implement XDP_SETUP_PROG in ndo_bpf for splitq

2025-03-07 Thread Maciej Fijalkowski
On Wed, Mar 05, 2025 at 05:21:28PM +0100, Alexander Lobakin wrote:
> From: Michal Kubiak 
> 
> Implement loading/removing XDP program using .ndo_bpf callback
> in the split queue mode. Reconfigure and restart the queues if needed
> (!!old_prog != !!new_prog), otherwise, just update the pointers.
> 
> Signed-off-by: Michal Kubiak 
> Signed-off-by: Alexander Lobakin 
> ---
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h |   4 +-
>  drivers/net/ethernet/intel/idpf/xdp.h   |   7 ++
>  drivers/net/ethernet/intel/idpf/idpf_lib.c  |   1 +
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c |   4 +
>  drivers/net/ethernet/intel/idpf/xdp.c   | 114 
>  5 files changed, 129 insertions(+), 1 deletion(-)
> 

(...)

> +
> +/**
> + * idpf_xdp_setup_prog - handle XDP program install/remove requests
> + * @vport: vport to configure
> + * @xdp: request data (program, extack)
> + *
> + * Return: 0 on success, -errno on failure.
> + */
> +static int
> +idpf_xdp_setup_prog(struct idpf_vport *vport, const struct netdev_bpf *xdp)
> +{
> + const struct idpf_netdev_priv *np = netdev_priv(vport->netdev);
> + struct bpf_prog *old, *prog = xdp->prog;
> + struct idpf_vport_config *cfg;
> + int ret;
> +
> + cfg = vport->adapter->vport_config[vport->idx];
> + if (!vport->num_xdp_txq && vport->num_txq == cfg->max_q.max_txq) {
> + NL_SET_ERR_MSG_MOD(xdp->extack,
> +"No Tx queues available for XDP, please 
> decrease the number of regular SQs");
> + return -ENOSPC;
> + }
> +
> + if (test_bit(IDPF_REMOVE_IN_PROG, vport->adapter->flags) ||

IN_PROG is a bit unfortunate here as it mixes with 'prog' :P

> + !!vport->xdp_prog == !!prog) {
> + if (np->state == __IDPF_VPORT_UP)
> + idpf_copy_xdp_prog_to_qs(vport, prog);
> +
> + old = xchg(&vport->xdp_prog, prog);
> + if (old)
> + bpf_prog_put(old);
> +
> + cfg->user_config.xdp_prog = prog;
> +
> + return 0;
> + }
> +
> + old = cfg->user_config.xdp_prog;
> + cfg->user_config.xdp_prog = prog;
> +
> + ret = idpf_initiate_soft_reset(vport, IDPF_SR_Q_CHANGE);
> + if (ret) {
> + NL_SET_ERR_MSG_MOD(xdp->extack,
> +"Could not reopen the vport after XDP 
> setup");
> +
> + if (prog)
> + bpf_prog_put(prog);

aren't you missing this for prog->NULL conversion? you have this for
hot-swap case (prog->prog).

> +
> + cfg->user_config.xdp_prog = old;
> + }
> +
> + return ret;
> +}
> +
> +/**
> + * idpf_xdp - handle XDP-related requests
> + * @dev: network device to configure
> + * @xdp: request data (program, extack)
> + *
> + * Return: 0 on success, -errno on failure.
> + */
> +int idpf_xdp(struct net_device *dev, struct netdev_bpf *xdp)
> +{
> + struct idpf_vport *vport;
> + int ret;
> +
> + idpf_vport_ctrl_lock(dev);
> + vport = idpf_netdev_to_vport(dev);
> +
> + if (!idpf_is_queue_model_split(vport->txq_model))
> + goto notsupp;
> +
> + switch (xdp->command) {
> + case XDP_SETUP_PROG:
> + ret = idpf_xdp_setup_prog(vport, xdp);
> + break;
> + default:
> +notsupp:
> + ret = -EOPNOTSUPP;
> + break;
> + }
> +
> + idpf_vport_ctrl_unlock(dev);
> +
> + return ret;
> +}
> -- 
> 2.48.1
> 


Re: [Intel-wired-lan] [PATCH bpf-next v12 5/5] igc: Add launch time support to XDP ZC

2025-03-07 Thread Song, Yoong Siang
On Friday, March 7, 2025 9:25 PM, Bouska, Zdenek  
wrote:

[...]

>> @@ -2996,7 +3035,13 @@ static void igc_xdp_xmit_zc(struct igc_ring *ring)
>>  ntu = ring->next_to_use;
>>  budget = igc_desc_unused(ring);
>>
>> -while (xsk_tx_peek_desc(pool, &xdp_desc) && budget--) {
>> +/* Packets with launch time require one data descriptor and one context
>> + * descriptor. When the launch time falls into the next Qbv cycle, we
>> + * may need to insert an empty packet, which requires two more
>> + * descriptors. Therefore, to be safe, we always ensure we have at least
>> + * 4 descriptors available.
>> + */
>> +while (xsk_tx_peek_desc(pool, &xdp_desc) && budget >= 4) {
>
>I think that here is a bug: some frames could be missed if budget < 4.
>I was able to reproduce it by sending 10x 60 B frames with minimal IPG
>(672 ns between starts of frames) on 1Gbit/s. Always 1026 frames were not sent
>and were missing a AF_XDP competition. Interesting was that then even when I
>sent more
>frames for hours it still was 1026 frames not sent and missing competition.
>
>Bug seems to be fixed when I change this line to:
>
>   while (budget >= 4 && xsk_tx_peek_desc(pool, &xdp_desc)) {
>
>Do you think this is a good fix?
>
>I think this bug is also in original code base, but I was only able to 
>reproduce
>it with launch time.
>

Thank you for pointing out this issue and for providing a detailed
explanation of your findings. I personally agree with your proposed fix
that make sure there is enough budget in the driver, before go peek the xsk
descriptor. Do you plan to submit bug fix patch to iwl-net?

Best regards,
Siang


Re: [Intel-wired-lan] [PATCH net-next v11 0/4] fix the DMA API misuse problem for page_pool

2025-03-07 Thread Toke Høiland-Jørgensen
Yunsheng Lin  writes:

> This patchset fix the dma API misuse problem as below:
> Networking driver with page_pool support may hand over page
> still with dma mapping to network stack and try to reuse that
> page after network stack is done with it and passes it back
> to page_pool to avoid the penalty of dma mapping/unmapping.
> With all the caching in the network stack, some pages may be
> held in the network stack without returning to the page_pool
> soon enough, and with VF disable causing the driver unbound,
> the page_pool does not stop the driver from doing it's
> unbounding work, instead page_pool uses workqueue to check
> if there is some pages coming back from the network stack
> periodically, if there is any, it will do the dma unmmapping
> related cleanup work.
>
> As mentioned in [1], attempting DMA unmaps after the driver
> has already unbound may leak resources or at worst corrupt
> memory. Fundamentally, the page pool code cannot allow DMA
> mappings to outlive the driver they belong to.
>
> By using the 'struct page_pool_item' referenced by page->pp_item,
> page_pool is not only able to keep track of the inflight page to
> do dma unmmaping if some pages are still handled in networking
> stack when page_pool_destroy() is called, and networking stack is
> also able to find the page_pool owning the page when returning
> pages back into page_pool:
> 1. When a page is added to the page_pool, an item is deleted from
>pool->hold_items and set the 'pp_netmem' pointing to that page
>and set item->state and item->pp_netmem accordingly in order to
>keep track of that page, refill from pool->release_items when
>pool->hold_items is empty or use the item from pool->slow_items
>when fast items run out.
> 2. When a page is released from the page_pool, it is able to tell
>which page_pool this page belongs to by masking off the lower
>bits of the pointer to page_pool_item *item, as the 'struct
>page_pool_item_block' is stored in the top of a struct page.
>And after clearing the pp_item->state', the item for the
>released page is added back to pool->release_items so that it
>can be reused for new pages or just free it when it is from the
>pool->slow_items.
> 3. When page_pool_destroy() is called, item->state is used to tell
>if a specific item is being used/dma mapped or not by scanning
>all the item blocks in pool->item_blocks, then item->netmem can
>be used to do the dma unmmaping if the corresponding inflight
>page is dma mapped.

You are making this incredibly complicated. You've basically implemented
a whole new slab allocator for those page_pool_item objects, and you're
tracking every page handed out by the page pool instead of just the ones
that are DMA-mapped. None of this is needed.

I took a stab at implementing the xarray-based tracking first suggested
by Mina[0]:

https://git.kernel.org/toke/c/e87e0edf9520

And, well, it's 50 lines of extra code, none of which are in the fast
path.

Jesper has kindly helped with testing that it works for normal packet
processing, but I haven't yet verified that it resolves the original
crash. Will post the patch to the list once I have verified this (help
welcome!).

-Toke

[0] 
https://lore.kernel.org/all/cahs8izpg7b5dwkfsuzz-ioop_yrbk3sd6y4rx7kbg9dcvjc...@mail.gmail.com/



[Intel-wired-lan] [PATCH net-next v11 1/4] page_pool: introduce page_pool_get_pp() API

2025-03-07 Thread Yunsheng Lin
Introduce page_pool_get_pp() API to avoid caller accessing
page->pp directly, in order to make the following patch more
reviewable as the following patch will change page->pp to
page->pp_item to fix the DMA API misuse problem.

Signed-off-by: Yunsheng Lin 
---
 drivers/net/ethernet/freescale/fec_main.c  |  8 +---
 .../net/ethernet/google/gve/gve_buffer_mgmt_dqo.c  |  2 +-
 drivers/net/ethernet/intel/iavf/iavf_txrx.c|  6 --
 drivers/net/ethernet/intel/idpf/idpf_txrx.c| 14 +-
 drivers/net/ethernet/intel/libeth/rx.c |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c   |  3 ++-
 drivers/net/netdevsim/netdev.c |  6 --
 drivers/net/wireless/mediatek/mt76/mt76.h  |  2 +-
 include/net/libeth/rx.h|  3 ++-
 include/net/page_pool/helpers.h|  5 +
 10 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index a86cfebedaa8..4ade1553557a 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1038,7 +1038,8 @@ static void fec_enet_bd_init(struct net_device *dev)
struct page *page = txq->tx_buf[i].buf_p;
 
if (page)
-   page_pool_put_page(page->pp, page, 0, 
false);
+   
page_pool_put_page(page_pool_get_pp(page),
+  page, 0, false);
}
 
txq->tx_buf[i].buf_p = NULL;
@@ -1576,7 +1577,7 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id, 
int budget)
xdp_return_frame_rx_napi(xdpf);
} else { /* recycle pages of XDP_TX frames */
/* The dma_sync_size = 0 as XDP_TX has already synced 
DMA for_device */
-   page_pool_put_page(page->pp, page, 0, true);
+   page_pool_put_page(page_pool_get_pp(page), page, 0, 
true);
}
 
txq->tx_buf[index].buf_p = NULL;
@@ -3343,7 +3344,8 @@ static void fec_enet_free_buffers(struct net_device *ndev)
} else {
struct page *page = txq->tx_buf[i].buf_p;
 
-   page_pool_put_page(page->pp, page, 0, false);
+   page_pool_put_page(page_pool_get_pp(page),
+  page, 0, false);
}
 
txq->tx_buf[i].buf_p = NULL;
diff --git a/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c 
b/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c
index 403f0f335ba6..87422b8828ff 100644
--- a/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c
+++ b/drivers/net/ethernet/google/gve/gve_buffer_mgmt_dqo.c
@@ -210,7 +210,7 @@ void gve_free_to_page_pool(struct gve_rx_ring *rx,
if (!page)
return;
 
-   page_pool_put_full_page(page->pp, page, allow_direct);
+   page_pool_put_full_page(page_pool_get_pp(page), page, allow_direct);
buf_state->page_info.page = NULL;
 }
 
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c 
b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index 422312b8b54a..72f17eaac277 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -1197,7 +1197,8 @@ static void iavf_add_rx_frag(struct sk_buff *skb,
 const struct libeth_fqe *rx_buffer,
 unsigned int size)
 {
-   u32 hr = rx_buffer->page->pp->p.offset;
+   struct page_pool *pool = page_pool_get_pp(rx_buffer->page);
+   u32 hr = pool->p.offset;
 
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_buffer->page,
rx_buffer->offset + hr, size, rx_buffer->truesize);
@@ -1214,7 +1215,8 @@ static void iavf_add_rx_frag(struct sk_buff *skb,
 static struct sk_buff *iavf_build_skb(const struct libeth_fqe *rx_buffer,
  unsigned int size)
 {
-   u32 hr = rx_buffer->page->pp->p.offset;
+   struct page_pool *pool = page_pool_get_pp(rx_buffer->page);
+   u32 hr = pool->p.offset;
struct sk_buff *skb;
void *va;
 
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c 
b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index bdf52cef3891..0ce77a5559aa 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -385,7 +385,8 @@ static void idpf_rx_page_rel(struct libeth_fqe *rx_buf)
if (unlikely(!rx_buf->page))
return;
 
-   page_pool_put_full_page(rx_buf->page->pp, rx_buf->page, false);
+   page_pool_put_full_page(page_pool_get_pp(rx_buf->page), rx_buf->page,
+ 

[Intel-wired-lan] [PATCH net-next v11 0/4] fix the DMA API misuse problem for page_pool

2025-03-07 Thread Yunsheng Lin
This patchset fix the dma API misuse problem as below:
Networking driver with page_pool support may hand over page
still with dma mapping to network stack and try to reuse that
page after network stack is done with it and passes it back
to page_pool to avoid the penalty of dma mapping/unmapping.
With all the caching in the network stack, some pages may be
held in the network stack without returning to the page_pool
soon enough, and with VF disable causing the driver unbound,
the page_pool does not stop the driver from doing it's
unbounding work, instead page_pool uses workqueue to check
if there is some pages coming back from the network stack
periodically, if there is any, it will do the dma unmmapping
related cleanup work.

As mentioned in [1], attempting DMA unmaps after the driver
has already unbound may leak resources or at worst corrupt
memory. Fundamentally, the page pool code cannot allow DMA
mappings to outlive the driver they belong to.

By using the 'struct page_pool_item' referenced by page->pp_item,
page_pool is not only able to keep track of the inflight page to
do dma unmmaping if some pages are still handled in networking
stack when page_pool_destroy() is called, and networking stack is
also able to find the page_pool owning the page when returning
pages back into page_pool:
1. When a page is added to the page_pool, an item is deleted from
   pool->hold_items and set the 'pp_netmem' pointing to that page
   and set item->state and item->pp_netmem accordingly in order to
   keep track of that page, refill from pool->release_items when
   pool->hold_items is empty or use the item from pool->slow_items
   when fast items run out.
2. When a page is released from the page_pool, it is able to tell
   which page_pool this page belongs to by masking off the lower
   bits of the pointer to page_pool_item *item, as the 'struct
   page_pool_item_block' is stored in the top of a struct page.
   And after clearing the pp_item->state', the item for the
   released page is added back to pool->release_items so that it
   can be reused for new pages or just free it when it is from the
   pool->slow_items.
3. When page_pool_destroy() is called, item->state is used to tell
   if a specific item is being used/dma mapped or not by scanning
   all the item blocks in pool->item_blocks, then item->netmem can
   be used to do the dma unmmaping if the corresponding inflight
   page is dma mapped.

>From the below performance data, the overhead is not so obvious
due to performance variations in arm64 server and less than 1
ns in x86 server for time_bench_page_pool01_fast_path() and
time_bench_page_pool02_ptr_ring, and there is about 10~20ns
overhead for time_bench_page_pool03_slow(), see more detail in
[2].

arm64 server:
Before this patchset:
  fast_path  ptr_ringslow
1. 31.171 ns   60.980 ns  164.917 ns
2. 28.824 ns   60.891 ns  170.241 ns
3. 14.236 ns   60.583 ns  164.355 ns

With patchset:
6. 26.163 ns   53.781 ns  189.450 ns
7. 26.189 ns   53.798 ns  189.466 ns

X86 server:
| Test name  |Cycles |   1-5 || Nanosec |1-5 ||  % |
| (tasklet_*)|Before | After |diff|  Before |  After |   diff | change |
|+---+---++-+++|
| fast_path  |19 |19 |   0|   5.399 |  5.492 |  0.093 |1.7 |
| ptr_ring   |54 |57 |   3|  15.090 | 15.849 |  0.759 |5.0 |
| slow   |   238 |   284 |  46|  66.134 | 78.909 | 12.775 |   19.3 |

And about 16 bytes of memory is also needed for each page_pool owned
page to fix the dma API misuse problem

1. 
https://lore.kernel.org/lkml/8067f204-1380-4d37-8ffd-007fc6f26...@kernel.org/T/
2. https://lore.kernel.org/all/f558df7a-d983-4fc5-8358-faf251994...@kernel.org/

CC: Alexander Lobakin 
CC: Robin Murphy 
CC: Alexander Duyck 
CC: Andrew Morton 
CC: Gaurav Batra 
CC: Matthew Rosato 
CC: IOMMU 
CC: MM 

Change log:
V11:
  1. Rebase on the latest net-next.
  2. Fix two compiler errors reported by Jakub and Simon.
  3. Change to use __acquire() and __release() to avoid 'context
 imbalance' warning.

V10:
  1. Add nl API to dump item memory usage.
  2. Use __acquires() and __releases() to avoid 'context imbalance'
 warning.

V9.
  1. Drop the fix of a possible time window problem for NPAI recycling.
  2. Add design description for the fix in patch 2.

V8:
  1. Drop last 3 patch as it causes observable performance degradation
 for x86 system.
  2. Remove rcu read lock in page_pool_napi_local().
  3. Renaming item function more consistently.

V7:
  1. Fix a used-after-free bug reported by KASAN as mentioned by Jakub.
  2. Fix the 'netmem' variable not setting up correctly bug as mentioned
 by Simon.

V6:
  1. Repost based on latest net-next.
  2. Rename page_pool_to_pp() to page_pool_get_pp().

V5:
  1. Support unlimit inf

Re: [Intel-wired-lan] [PATCH iwl-net] igc: Fix XSK queue NAPI ID mapping

2025-03-07 Thread Tony Nguyen




On 3/6/2025 10:31 AM, Tony Nguyen wrote:

On 3/6/2025 8:45 AM, Joe Damato wrote:

On Thu, Mar 06, 2025 at 05:27:38PM +0100, flor...@bezdeka.de wrote:


...


Btw: I got this patch via stable. It doesn't make sense to send it
to stable where this patch does not apply.


Maybe I made a mistake, but as far as I can tell the commit under
fixes is in 6.14-rc*:

$ git tag --contains b65969856d4f
v6.14-rc1
v6.14-rc2
v6.14-rc3
v6.14-rc4

So, I think this change is:
   - Correct
   - Definitely a "fixes" and should go to iwl-net
   - But maybe does not need to CC stable ?

If the Intel folks would like me to resend with some change please
let me know.


Seems like the only change needed is the omission of stable. If so, no 
changes need. I can take care of that when sending on to netdev.


I missed this comment [1] when I responded; I can make this change though.

Thanks,
Tony

[1] 
https://lore.kernel.org/intel-wired-lan/9ddf6293-6cb0-47ea-a0e7-cad7d33c2...@intel.com/T/#m47dd425fb4de4c1738839c2f8253ec51718d299e




Re: [Intel-wired-lan] [PATCH iwl-next v2 2/4] igb: Link queues to NAPI instances

2025-03-07 Thread Tony Nguyen

On 2/17/2025 3:31 AM, Kurt Kanzenbach wrote:

...


diff --git a/drivers/net/ethernet/intel/igb/igb_xsk.c 
b/drivers/net/ethernet/intel/igb/igb_xsk.c
index 
157d43787fa0b55a74714f69e9e7903b695fcf0a..a5ad090dfe94b6afc8194fe39d28cdd51c7067b0
 100644
--- a/drivers/net/ethernet/intel/igb/igb_xsk.c
+++ b/drivers/net/ethernet/intel/igb/igb_xsk.c
@@ -45,6 +45,7 @@ static void igb_txrx_ring_disable(struct igb_adapter 
*adapter, u16 qid)
synchronize_net();
  
  	/* Rx/Tx share the same napi context. */

+   igb_set_queue_napi(adapter, qid, NULL);
napi_disable(&rx_ring->q_vector->napi);
  
  	igb_clean_tx_ring(tx_ring);

@@ -78,6 +79,7 @@ static void igb_txrx_ring_enable(struct igb_adapter *adapter, 
u16 qid)
  
  	/* Rx/Tx share the same napi context. */

napi_enable(&rx_ring->q_vector->napi);
+   igb_set_queue_napi(adapter, qid, &rx_ring->q_vector->napi);
  }
  
  struct xsk_buff_pool *igb_xsk_pool(struct igb_adapter *adapter,


I believe Joe's fix/changes [1] need to be done here as well?

Thanks,
Tony

[1] 
https://lore.kernel.org/intel-wired-lan/9ddf6293-6cb0-47ea-a0e7-cad7d33c2...@intel.com/T/#m863614df1fb3d1980ad09016b1c9ef4e2f0b074e