Re: [Intel-wired-lan] [iwl-next v3 4/8] iavf: use libie adminq descriptors

2025-07-24 Thread Romanowski, Rafal
> -Original Message-
> From: Intel-wired-lan  On Behalf Of Michal
> Swiatkowski
> Sent: Friday, April 25, 2025 8:08 AM
> To: [email protected]
> Cc: [email protected]; Lobakin, Aleksander
> ; Kitszel, Przemyslaw
> ; Kwapulinski, Piotr
> ; Loktionov, Aleksandr
> ; Jagielski, Jedrzej 
> ;
> Zaremba, Larysa ; Nguyen, Anthony L
> 
> Subject: [Intel-wired-lan] [iwl-next v3 4/8] iavf: use libie adminq 
> descriptors
> 
> Use libie_aq_desc instead of iavf_aq_desc. Do needed changes to allow clean
> build
> 
> Use libie_aq_raw() wherever it can be used.
> 
> Reviewed-by: Przemek Kitszel 
> Reviewed-by: Aleksandr Loktionov 
> Signed-off-by: Michal Swiatkowski 
> ---
>  drivers/net/ethernet/intel/iavf/iavf_adminq.h |  12 +-
> .../net/ethernet/intel/iavf/iavf_adminq_cmd.h |  83 +--
>  .../net/ethernet/intel/iavf/iavf_prototype.h  |   4 +-
>  drivers/net/ethernet/intel/iavf/iavf_type.h   |   2 +-
>  drivers/net/ethernet/intel/iavf/iavf_adminq.c |  62 
> drivers/net/ethernet/intel/iavf/iavf_common.c | 134 +-
>  6 files changed, 106 insertions(+), 191 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq.h
> b/drivers/net/ethernet/intel/iavf/iavf_adminq.h
> index 406506f64bdd..bbf5c4b3a2ae 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_adminq.h
> +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.h
> @@ -9,7 +9,7 @@
>  #include "iavf_adminq_cmd.h"
> 
>  #define IAVF_ADMINQ_DESC(R, i)   \
> - (&(((struct iavf_aq_desc *)((R).desc_buf.va))[i]))
> + (&(((struct libie_aq_desc *)((R).desc_buf.va))[i]))
> 
>  #define IAVF_ADMINQ_DESC_ALIGNMENT 4096
> 
> @@ -39,7 +39,7 @@ struct iavf_asq_cmd_details {
>   u16 flags_dis;
>   bool async;
>   bool postpone;
> - struct iavf_aq_desc *wb_desc;
> + struct libie_aq_desc *wb_desc;
>  };
> 
>  #define IAVF_ADMINQ_DETAILS(R, i)   \
> @@ -47,7 +47,7 @@ struct iavf_asq_cmd_details {
> 
>  /* ARQ event information */
>  struct iavf_arq_event_info {
> - struct iavf_aq_desc desc;
> + struct libie_aq_desc desc;
>   u16 msg_len;
>   u16 buf_len;
>   u8 *msg_buf;
> @@ -72,8 +72,8 @@ struct iavf_adminq_info {
>   struct mutex arq_mutex; /* Receive queue lock */
> 
>   /* last status values on send and receive queues */
> - enum iavf_admin_queue_err asq_last_status;
> - enum iavf_admin_queue_err arq_last_status;
> + enum libie_aq_err asq_last_status;
> + enum libie_aq_err arq_last_status;
>  };
> 
>  /**
> @@ -123,6 +123,6 @@ static inline int iavf_aq_rc_to_posix(int aq_ret, int 
> aq_rc)
>  #define IAVF_AQ_LARGE_BUF512
>  #define IAVF_ASQ_CMD_TIMEOUT 25  /* usecs */
> 
> -void iavf_fill_default_direct_cmd_desc(struct iavf_aq_desc *desc, u16 
> opcode);
> +void iavf_fill_default_direct_cmd_desc(struct libie_aq_desc *desc, u16
> +opcode);
> 
>  #endif /* _IAVF_ADMINQ_H_ */
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
> b/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
> index bc512308557b..0482c9ce9b9c 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
> +++ b/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
> @@ -4,6 +4,8 @@
>  #ifndef _IAVF_ADMINQ_CMD_H_
>  #define _IAVF_ADMINQ_CMD_H_
> 
> +#include 
> +
>  /* This header file defines the iavf Admin Queue commands and is shared
> between
>   * iavf Firmware and Software.
>   *
> @@ -21,87 +23,6 @@
>  /* API version 1.7 implements additional link and PHY-specific APIs  */  
> #define
> IAVF_MINOR_VER_GET_LINK_INFO_XL710 0x0007
> 
> -struct iavf_aq_desc {
> - __le16 flags;
> - __le16 opcode;
> - __le16 datalen;
> - __le16 retval;
> - __le32 cookie_high;
> - __le32 cookie_low;
> - union {
> - struct {
> - __le32 param0;
> - __le32 param1;
> - __le32 param2;
> - __le32 param3;
> - } internal;
> - struct {
> - __le32 param0;
> - __le32 param1;
> - __le32 addr_high;
> - __le32 addr_low;
> - } external;
> - u8 raw[16];
> - } params;
> -};
> -
> -/* Flags sub-structure
> - * |0  |1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |11 |12 |13 |14 |15 |
> - * |DD |CMP|ERR|VFE| * *  RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
> - */
> -
> -/* command flags and offsets*/
> -#define IAVF_AQ_FLAG_DD_SHIFT0
> -#define IAVF_AQ_FLAG_CMP_SHIFT   1
> -#define IAVF_AQ_FLAG_ERR_SHIFT   

[Intel-wired-lan] [iwl-next v3 4/8] iavf: use libie adminq descriptors

2025-04-24 Thread Michal Swiatkowski
Use libie_aq_desc instead of iavf_aq_desc. Do needed changes to allow
clean build

Use libie_aq_raw() wherever it can be used.

Reviewed-by: Przemek Kitszel 
Reviewed-by: Aleksandr Loktionov 
Signed-off-by: Michal Swiatkowski 
---
 drivers/net/ethernet/intel/iavf/iavf_adminq.h |  12 +-
 .../net/ethernet/intel/iavf/iavf_adminq_cmd.h |  83 +--
 .../net/ethernet/intel/iavf/iavf_prototype.h  |   4 +-
 drivers/net/ethernet/intel/iavf/iavf_type.h   |   2 +-
 drivers/net/ethernet/intel/iavf/iavf_adminq.c |  62 
 drivers/net/ethernet/intel/iavf/iavf_common.c | 134 +-
 6 files changed, 106 insertions(+), 191 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq.h 
b/drivers/net/ethernet/intel/iavf/iavf_adminq.h
index 406506f64bdd..bbf5c4b3a2ae 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_adminq.h
+++ b/drivers/net/ethernet/intel/iavf/iavf_adminq.h
@@ -9,7 +9,7 @@
 #include "iavf_adminq_cmd.h"
 
 #define IAVF_ADMINQ_DESC(R, i)   \
-   (&(((struct iavf_aq_desc *)((R).desc_buf.va))[i]))
+   (&(((struct libie_aq_desc *)((R).desc_buf.va))[i]))
 
 #define IAVF_ADMINQ_DESC_ALIGNMENT 4096
 
@@ -39,7 +39,7 @@ struct iavf_asq_cmd_details {
u16 flags_dis;
bool async;
bool postpone;
-   struct iavf_aq_desc *wb_desc;
+   struct libie_aq_desc *wb_desc;
 };
 
 #define IAVF_ADMINQ_DETAILS(R, i)   \
@@ -47,7 +47,7 @@ struct iavf_asq_cmd_details {
 
 /* ARQ event information */
 struct iavf_arq_event_info {
-   struct iavf_aq_desc desc;
+   struct libie_aq_desc desc;
u16 msg_len;
u16 buf_len;
u8 *msg_buf;
@@ -72,8 +72,8 @@ struct iavf_adminq_info {
struct mutex arq_mutex; /* Receive queue lock */
 
/* last status values on send and receive queues */
-   enum iavf_admin_queue_err asq_last_status;
-   enum iavf_admin_queue_err arq_last_status;
+   enum libie_aq_err asq_last_status;
+   enum libie_aq_err arq_last_status;
 };
 
 /**
@@ -123,6 +123,6 @@ static inline int iavf_aq_rc_to_posix(int aq_ret, int aq_rc)
 #define IAVF_AQ_LARGE_BUF  512
 #define IAVF_ASQ_CMD_TIMEOUT   25  /* usecs */
 
-void iavf_fill_default_direct_cmd_desc(struct iavf_aq_desc *desc, u16 opcode);
+void iavf_fill_default_direct_cmd_desc(struct libie_aq_desc *desc, u16 opcode);
 
 #endif /* _IAVF_ADMINQ_H_ */
diff --git a/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h 
b/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
index bc512308557b..0482c9ce9b9c 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/iavf/iavf_adminq_cmd.h
@@ -4,6 +4,8 @@
 #ifndef _IAVF_ADMINQ_CMD_H_
 #define _IAVF_ADMINQ_CMD_H_
 
+#include 
+
 /* This header file defines the iavf Admin Queue commands and is shared between
  * iavf Firmware and Software.
  *
@@ -21,87 +23,6 @@
 /* API version 1.7 implements additional link and PHY-specific APIs  */
 #define IAVF_MINOR_VER_GET_LINK_INFO_XL710 0x0007
 
-struct iavf_aq_desc {
-   __le16 flags;
-   __le16 opcode;
-   __le16 datalen;
-   __le16 retval;
-   __le32 cookie_high;
-   __le32 cookie_low;
-   union {
-   struct {
-   __le32 param0;
-   __le32 param1;
-   __le32 param2;
-   __le32 param3;
-   } internal;
-   struct {
-   __le32 param0;
-   __le32 param1;
-   __le32 addr_high;
-   __le32 addr_low;
-   } external;
-   u8 raw[16];
-   } params;
-};
-
-/* Flags sub-structure
- * |0  |1  |2  |3  |4  |5  |6  |7  |8  |9  |10 |11 |12 |13 |14 |15 |
- * |DD |CMP|ERR|VFE| * *  RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
- */
-
-/* command flags and offsets*/
-#define IAVF_AQ_FLAG_DD_SHIFT  0
-#define IAVF_AQ_FLAG_CMP_SHIFT 1
-#define IAVF_AQ_FLAG_ERR_SHIFT 2
-#define IAVF_AQ_FLAG_VFE_SHIFT 3
-#define IAVF_AQ_FLAG_LB_SHIFT  9
-#define IAVF_AQ_FLAG_RD_SHIFT  10
-#define IAVF_AQ_FLAG_VFC_SHIFT 11
-#define IAVF_AQ_FLAG_BUF_SHIFT 12
-#define IAVF_AQ_FLAG_SI_SHIFT  13
-#define IAVF_AQ_FLAG_EI_SHIFT  14
-#define IAVF_AQ_FLAG_FE_SHIFT  15
-
-#define IAVF_AQ_FLAG_DDBIT(IAVF_AQ_FLAG_DD_SHIFT)  /* 0x1*/
-#define IAVF_AQ_FLAG_CMP   BIT(IAVF_AQ_FLAG_CMP_SHIFT) /* 0x2*/
-#define IAVF_AQ_FLAG_ERR   BIT(IAVF_AQ_FLAG_ERR_SHIFT) /* 0x4*/
-#define IAVF_AQ_FLAG_VFE   BIT(IAVF_AQ_FLAG_VFE_SHIFT) /* 0x8*/
-#define IAVF_AQ_FLAG_LBBIT(IAVF_AQ_FLAG_LB_SHIFT)  /* 0x200  */
-#define IAVF_AQ_FLAG_RDBIT(IAVF_AQ_FLAG_RD_SHIFT)  /* 0x400  */
-#define IAVF_AQ_FLAG_VFC   BIT(IAVF_AQ_FLAG_VFC_SHIFT) /* 0x800  */
-#define IAVF_AQ_FLAG_BUF   BIT(IAVF_AQ_FLAG_BUF_SHIFT) /* 0x1000 */
-#define IAVF_AQ_FLAG_SIBIT(IAVF_AQ_FLAG_SI_SHIFT)  /* 0x2000 */
-#define IAVF_AQ_FLAG_EIBIT(IAVF_AQ_FLAG_EI_SHIFT)  /* 0x4000 */
-#define