> -----Original Message-----
> From: Michal Swiatkowski <[email protected]>
> Sent: Thursday, April 10, 2025 12:01 PM
> To: [email protected]
> Cc: [email protected]; Lobakin, Aleksander
> <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; Kwapulinski, Piotr
> <[email protected]>; Loktionov, Aleksandr
> <[email protected]>; Jagielski, Jedrzej
> <[email protected]>; Zaremba, Larysa <[email protected]>;
> Nguyen, Anthony L <[email protected]>
> Subject: [iwl-next v2 7/8] iavf: use libie_aq_str
> 
> There is no need to store the err string in hw->err_str. Simplify it and use
> common helper. hw->err_str is still used for other purpouse.
> 
> It should be marked that previously for unknown error the numeric value was
> passed as a string. Now the "LIBIE_AQ_RC_UNKNOWN" is used for such cases.
> 
> Add libie_aminq module in iavf Kconfig.
> 
> Reviewed-by: Przemek Kitszel <[email protected]>
> Reviewed-by: Larysa Zaremba <[email protected]>
> Signed-off-by: Michal Swiatkowski <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>

> ---
>  drivers/net/ethernet/intel/Kconfig            |  1 +
>  .../net/ethernet/intel/iavf/iavf_prototype.h  |  1 -
> drivers/net/ethernet/intel/iavf/iavf_common.c | 52 -------------------
>  drivers/net/ethernet/intel/iavf/iavf_main.c   |  5 +-
>  .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  2 +-
>  5 files changed, 5 insertions(+), 56 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/Kconfig
> b/drivers/net/ethernet/intel/Kconfig
> index d5de9bc8b1b6..29c03a9ce145 100644
> --- a/drivers/net/ethernet/intel/Kconfig
> +++ b/drivers/net/ethernet/intel/Kconfig
> @@ -260,6 +260,7 @@ config I40E_DCB
>  config IAVF
>       tristate
>       select LIBIE
> +     select LIBIE_ADMINQ
>       select NET_SHAPER
> 
>  config I40EVF
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_prototype.h
> b/drivers/net/ethernet/intel/iavf/iavf_prototype.h
> index 34b5ed87a9aa..7f9f9dbf959a 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_prototype.h
> +++ b/drivers/net/ethernet/intel/iavf/iavf_prototype.h
> @@ -34,7 +34,6 @@ void iavf_debug_aq(struct iavf_hw *hw, enum
> iavf_debug_mask mask,
> 
>  bool iavf_check_asq_alive(struct iavf_hw *hw);  enum iavf_status
> iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading); -const char
> *iavf_aq_str(struct iavf_hw *hw, enum libie_aq_err aq_err);  const char
> *iavf_stat_str(struct iavf_hw *hw, enum iavf_status stat_err);
> 
>  enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid, diff --git
> a/drivers/net/ethernet/intel/iavf/iavf_common.c
> b/drivers/net/ethernet/intel/iavf/iavf_common.c
> index cc71e48b5689..614a886bca99 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_common.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_common.c
> @@ -7,58 +7,6 @@
>  #include "iavf_adminq.h"
>  #include "iavf_prototype.h"
> 
> -/**
> - * iavf_aq_str - convert AQ err code to a string
> - * @hw: pointer to the HW structure
> - * @aq_err: the AQ error code to convert
> - **/
> -const char *iavf_aq_str(struct iavf_hw *hw, enum libie_aq_err aq_err) -{
> -     switch (aq_err) {
> -     case LIBIE_AQ_RC_OK:
> -             return "OK";
> -     case LIBIE_AQ_RC_EPERM:
> -             return "LIBIE_AQ_RC_EPERM";
> -     case LIBIE_AQ_RC_ENOENT:
> -             return "LIBIE_AQ_RC_ENOENT";
> -     case LIBIE_AQ_RC_ESRCH:
> -             return "LIBIE_AQ_RC_ESRCH";
> -     case LIBIE_AQ_RC_EIO:
> -             return "LIBIE_AQ_RC_EIO";
> -     case LIBIE_AQ_RC_EAGAIN:
> -             return "LIBIE_AQ_RC_EAGAIN";
> -     case LIBIE_AQ_RC_ENOMEM:
> -             return "LIBIE_AQ_RC_ENOMEM";
> -     case LIBIE_AQ_RC_EACCES:
> -             return "LIBIE_AQ_RC_EACCES";
> -     case LIBIE_AQ_RC_EBUSY:
> -             return "LIBIE_AQ_RC_EBUSY";
> -     case LIBIE_AQ_RC_EEXIST:
> -             return "LIBIE_AQ_RC_EEXIST";
> -     case LIBIE_AQ_RC_EINVAL:
> -             return "LIBIE_AQ_RC_EINVAL";
> -     case LIBIE_AQ_RC_ENOSPC:
> -             return "LIBIE_AQ_RC_ENOSPC";
> -     case LIBIE_AQ_RC_ENOSYS:
> -             return "LIBIE_AQ_RC_ENOSYS";
> -     case LIBIE_AQ_RC_EMODE:
> -             return "LIBIE_AQ_RC_EMODE";
> -     case LIBIE_AQ_RC_ENOSEC:
> -             return "LIBIE_AQ_RC_ENOSEC";
> -     case LIBIE_AQ_RC_EBADSIG:
> -             return "LIBIE_AQ_RC_EBADSIG";
> -     case LIBIE_AQ_RC_ESVN:
> -             return "LIBIE_AQ_RC_ESVN";
> -     case LIBIE_AQ_RC_EBADMAN:
> -             return "LIBIE_AQ_RC_EBADMAN";
> -     case LIBIE_AQ_RC_EBADBUF:
> -             return "LIBIE_AQ_RC_EBADBUF";
> -     }
> -
> -     snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err);
> -     return hw->err_str;
> -}
> -
>  /**
>   * iavf_stat_str - convert status err code to a string
>   * @hw: pointer to the HW structure
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c
> b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index 2c0bb41809a4..1b4a9a921d6c 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
> @@ -50,6 +50,7 @@ MODULE_ALIAS("i40evf");
>  MODULE_DESCRIPTION("Intel(R) Ethernet Adaptive Virtual Function Network
> Driver");  MODULE_IMPORT_NS("LIBETH");  MODULE_IMPORT_NS("LIBIE");
> +MODULE_IMPORT_NS("LIBIE_ADMINQ");
>  MODULE_LICENSE("GPL v2");
> 
>  static const struct net_device_ops iavf_netdev_ops; @@ -1734,7 +1735,7
> @@ static int iavf_config_rss_aq(struct iavf_adapter *adapter)
>       if (status) {
>               dev_err(&adapter->pdev->dev, "Cannot set RSS key, err %s
> aq_err %s\n",
>                       iavf_stat_str(hw, status),
> -                     iavf_aq_str(hw, hw->aq.asq_last_status));
> +                     libie_aq_str(hw->aq.asq_last_status));
>               return iavf_status_to_errno(status);
> 
>       }
> @@ -1744,7 +1745,7 @@ static int iavf_config_rss_aq(struct iavf_adapter
> *adapter)
>       if (status) {
>               dev_err(&adapter->pdev->dev, "Cannot set RSS lut, err %s
> aq_err %s\n",
>                       iavf_stat_str(hw, status),
> -                     iavf_aq_str(hw, hw->aq.asq_last_status));
> +                     libie_aq_str(hw->aq.asq_last_status));
>               return iavf_status_to_errno(status);
>       }
> 
> diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> index a6f0e5990be2..65340ba0b152 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
> @@ -29,7 +29,7 @@ static int iavf_send_pf_msg(struct iavf_adapter
> *adapter,
>       if (status)
>               dev_dbg(&adapter->pdev->dev, "Unable to send opcode %d
> to PF, status %s, aq_err %s\n",
>                       op, iavf_stat_str(hw, status),
> -                     iavf_aq_str(hw, hw->aq.asq_last_status));
> +                     libie_aq_str(hw->aq.asq_last_status));
>       return iavf_status_to_errno(status);
>  }
> 
> --
> 2.42.0

Reply via email to