Skip to content

Commit 43a1130

Browse files
Michal Swiatkowskianguy11
authored andcommitted
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 <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>
1 parent e99c161 commit 43a1130

5 files changed

Lines changed: 5 additions & 56 deletions

File tree

drivers/net/ethernet/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ config I40E_DCB
260260
config IAVF
261261
tristate
262262
select LIBIE
263+
select LIBIE_ADMINQ
263264
select NET_SHAPER
264265

265266
config I40EVF

drivers/net/ethernet/intel/iavf/iavf_common.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,6 @@
77
#include "iavf_adminq.h"
88
#include "iavf_prototype.h"
99

10-
/**
11-
* iavf_aq_str - convert AQ err code to a string
12-
* @hw: pointer to the HW structure
13-
* @aq_err: the AQ error code to convert
14-
**/
15-
const char *iavf_aq_str(struct iavf_hw *hw, enum libie_aq_err aq_err)
16-
{
17-
switch (aq_err) {
18-
case LIBIE_AQ_RC_OK:
19-
return "OK";
20-
case LIBIE_AQ_RC_EPERM:
21-
return "LIBIE_AQ_RC_EPERM";
22-
case LIBIE_AQ_RC_ENOENT:
23-
return "LIBIE_AQ_RC_ENOENT";
24-
case LIBIE_AQ_RC_ESRCH:
25-
return "LIBIE_AQ_RC_ESRCH";
26-
case LIBIE_AQ_RC_EIO:
27-
return "LIBIE_AQ_RC_EIO";
28-
case LIBIE_AQ_RC_EAGAIN:
29-
return "LIBIE_AQ_RC_EAGAIN";
30-
case LIBIE_AQ_RC_ENOMEM:
31-
return "LIBIE_AQ_RC_ENOMEM";
32-
case LIBIE_AQ_RC_EACCES:
33-
return "LIBIE_AQ_RC_EACCES";
34-
case LIBIE_AQ_RC_EBUSY:
35-
return "LIBIE_AQ_RC_EBUSY";
36-
case LIBIE_AQ_RC_EEXIST:
37-
return "LIBIE_AQ_RC_EEXIST";
38-
case LIBIE_AQ_RC_EINVAL:
39-
return "LIBIE_AQ_RC_EINVAL";
40-
case LIBIE_AQ_RC_ENOSPC:
41-
return "LIBIE_AQ_RC_ENOSPC";
42-
case LIBIE_AQ_RC_ENOSYS:
43-
return "LIBIE_AQ_RC_ENOSYS";
44-
case LIBIE_AQ_RC_EMODE:
45-
return "LIBIE_AQ_RC_EMODE";
46-
case LIBIE_AQ_RC_ENOSEC:
47-
return "LIBIE_AQ_RC_ENOSEC";
48-
case LIBIE_AQ_RC_EBADSIG:
49-
return "LIBIE_AQ_RC_EBADSIG";
50-
case LIBIE_AQ_RC_ESVN:
51-
return "LIBIE_AQ_RC_ESVN";
52-
case LIBIE_AQ_RC_EBADMAN:
53-
return "LIBIE_AQ_RC_EBADMAN";
54-
case LIBIE_AQ_RC_EBADBUF:
55-
return "LIBIE_AQ_RC_EBADBUF";
56-
}
57-
58-
snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err);
59-
return hw->err_str;
60-
}
61-
6210
/**
6311
* iavf_stat_str - convert status err code to a string
6412
* @hw: pointer to the HW structure

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ MODULE_ALIAS("i40evf");
5050
MODULE_DESCRIPTION("Intel(R) Ethernet Adaptive Virtual Function Network Driver");
5151
MODULE_IMPORT_NS("LIBETH");
5252
MODULE_IMPORT_NS("LIBIE");
53+
MODULE_IMPORT_NS("LIBIE_ADMINQ");
5354
MODULE_LICENSE("GPL v2");
5455

5556
static const struct net_device_ops iavf_netdev_ops;
@@ -1694,7 +1695,7 @@ static int iavf_config_rss_aq(struct iavf_adapter *adapter)
16941695
if (status) {
16951696
dev_err(&adapter->pdev->dev, "Cannot set RSS key, err %s aq_err %s\n",
16961697
iavf_stat_str(hw, status),
1697-
iavf_aq_str(hw, hw->aq.asq_last_status));
1698+
libie_aq_str(hw->aq.asq_last_status));
16981699
return iavf_status_to_errno(status);
16991700

17001701
}
@@ -1704,7 +1705,7 @@ static int iavf_config_rss_aq(struct iavf_adapter *adapter)
17041705
if (status) {
17051706
dev_err(&adapter->pdev->dev, "Cannot set RSS lut, err %s aq_err %s\n",
17061707
iavf_stat_str(hw, status),
1707-
iavf_aq_str(hw, hw->aq.asq_last_status));
1708+
libie_aq_str(hw->aq.asq_last_status));
17081709
return iavf_status_to_errno(status);
17091710
}
17101711

drivers/net/ethernet/intel/iavf/iavf_prototype.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ void iavf_debug_aq(struct iavf_hw *hw, enum iavf_debug_mask mask,
3434

3535
bool iavf_check_asq_alive(struct iavf_hw *hw);
3636
enum iavf_status iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
37-
const char *iavf_aq_str(struct iavf_hw *hw, enum libie_aq_err aq_err);
3837
const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status stat_err);
3938

4039
enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static int iavf_send_pf_msg(struct iavf_adapter *adapter,
2929
if (status)
3030
dev_dbg(&adapter->pdev->dev, "Unable to send opcode %d to PF, status %s, aq_err %s\n",
3131
op, iavf_stat_str(hw, status),
32-
iavf_aq_str(hw, hw->aq.asq_last_status));
32+
libie_aq_str(hw->aq.asq_last_status));
3333
return iavf_status_to_errno(status);
3434
}
3535

0 commit comments

Comments
 (0)