]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iavf: use libie_aq_str
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Fri, 25 Apr 2025 06:08:08 +0000 (08:08 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 24 Jul 2025 16:43:40 +0000 (09:43 -0700)
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 <przemyslaw.kitszel@intel.com>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/Kconfig
drivers/net/ethernet/intel/iavf/iavf_common.c
drivers/net/ethernet/intel/iavf/iavf_main.c
drivers/net/ethernet/intel/iavf/iavf_prototype.h
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

index d5de9bc8b1b696229c57d1c0b73622104863660c..29c03a9ce145bc6949ea75d714c06f483295124c 100644 (file)
@@ -260,6 +260,7 @@ config I40E_DCB
 config IAVF
        tristate
        select LIBIE
+       select LIBIE_ADMINQ
        select NET_SHAPER
 
 config I40EVF
index cc71e48b5689569ba185db6daa78fd0a6f864251..614a886bca99bb924a1c654f97433d8e1a0d5892 100644 (file)
@@ -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
index c859a096de9f8e5f28ab8f1ce33f10bd0ad9c908..69054af4689a3075d76d9d5fb0de2f78ba9165ec 100644 (file)
@@ -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;
@@ -1694,7 +1695,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);
 
        }
@@ -1704,7 +1705,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);
        }
 
index 34b5ed87a9aa5627b48d3382e93436a89c0e0076..7f9f9dbf959ac466f23e79dffa4938a0992e4346 100644 (file)
@@ -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,
index 31a4289fc0ee1e183428d9726bfb255b3bcc02b5..34a422a4a29c1b9487e7debc1ad0ba8fe91be43e 100644 (file)
@@ -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);
 }