Skip to content

Commit 026cea3

Browse files
Michal Swiatkowskianguy11
authored andcommitted
i40e: 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 i40e 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: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 43a1130 commit 026cea3

9 files changed

Lines changed: 105 additions & 224 deletions

File tree

drivers/net/ethernet/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ config I40E
231231
depends on PCI
232232
select AUXILIARY_BUS
233233
select LIBIE
234+
select LIBIE_ADMINQ
234235
select NET_DEVLINK
235236
help
236237
This driver supports Intel(R) Ethernet Controller XL710 Family of

drivers/net/ethernet/intel/i40e/i40e_client.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,7 @@ static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,
682682
if (err) {
683683
dev_info(&pf->pdev->dev,
684684
"couldn't get PF vsi config, err %pe aq_err %s\n",
685-
ERR_PTR(err),
686-
i40e_aq_str(&pf->hw,
687-
pf->hw.aq.asq_last_status));
685+
ERR_PTR(err), libie_aq_str(pf->hw.aq.asq_last_status));
688686
return -ENOENT;
689687
}
690688

@@ -711,8 +709,7 @@ static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,
711709
dev_info(&pf->pdev->dev,
712710
"update VSI ctxt for PE failed, err %pe aq_err %s\n",
713711
ERR_PTR(err),
714-
i40e_aq_str(&pf->hw,
715-
pf->hw.aq.asq_last_status));
712+
libie_aq_str(pf->hw.aq.asq_last_status));
716713
}
717714
}
718715
return err;

drivers/net/ethernet/intel/i40e/i40e_common.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -68,58 +68,6 @@ int i40e_set_mac_type(struct i40e_hw *hw)
6868
return status;
6969
}
7070

71-
/**
72-
* i40e_aq_str - convert AQ err code to a string
73-
* @hw: pointer to the HW structure
74-
* @aq_err: the AQ error code to convert
75-
**/
76-
const char *i40e_aq_str(struct i40e_hw *hw, enum libie_aq_err aq_err)
77-
{
78-
switch (aq_err) {
79-
case LIBIE_AQ_RC_OK:
80-
return "OK";
81-
case LIBIE_AQ_RC_EPERM:
82-
return "LIBIE_AQ_RC_EPERM";
83-
case LIBIE_AQ_RC_ENOENT:
84-
return "LIBIE_AQ_RC_ENOENT";
85-
case LIBIE_AQ_RC_ESRCH:
86-
return "LIBIE_AQ_RC_ESRCH";
87-
case LIBIE_AQ_RC_EIO:
88-
return "LIBIE_AQ_RC_EIO";
89-
case LIBIE_AQ_RC_EAGAIN:
90-
return "LIBIE_AQ_RC_EAGAIN";
91-
case LIBIE_AQ_RC_ENOMEM:
92-
return "LIBIE_AQ_RC_ENOMEM";
93-
case LIBIE_AQ_RC_EACCES:
94-
return "LIBIE_AQ_RC_EACCES";
95-
case LIBIE_AQ_RC_EBUSY:
96-
return "LIBIE_AQ_RC_EBUSY";
97-
case LIBIE_AQ_RC_EEXIST:
98-
return "LIBIE_AQ_RC_EEXIST";
99-
case LIBIE_AQ_RC_EINVAL:
100-
return "LIBIE_AQ_RC_EINVAL";
101-
case LIBIE_AQ_RC_ENOSPC:
102-
return "LIBIE_AQ_RC_ENOSPC";
103-
case LIBIE_AQ_RC_ENOSYS:
104-
return "LIBIE_AQ_RC_ENOSYS";
105-
case LIBIE_AQ_RC_EMODE:
106-
return "LIBIE_AQ_RC_EMODE";
107-
case LIBIE_AQ_RC_ENOSEC:
108-
return "LIBIE_AQ_RC_ENOSEC";
109-
case LIBIE_AQ_RC_EBADSIG:
110-
return "LIBIE_AQ_RC_EBADSIG";
111-
case LIBIE_AQ_RC_ESVN:
112-
return "LIBIE_AQ_RC_ESVN";
113-
case LIBIE_AQ_RC_EBADMAN:
114-
return "LIBIE_AQ_RC_EBADMAN";
115-
case LIBIE_AQ_RC_EBADBUF:
116-
return "LIBIE_AQ_RC_EBADBUF";
117-
}
118-
119-
snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err);
120-
return hw->err_str;
121-
}
122-
12371
/**
12472
* i40e_debug_aq
12573
* @hw: debug mask related to admin queue

drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static int i40e_dcbnl_ieee_setets(struct net_device *netdev,
136136
dev_info(&pf->pdev->dev,
137137
"Failed setting DCB ETS configuration err %pe aq_err %s\n",
138138
ERR_PTR(ret),
139-
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
139+
libie_aq_str(pf->hw.aq.asq_last_status));
140140
return -EINVAL;
141141
}
142142

@@ -175,7 +175,7 @@ static int i40e_dcbnl_ieee_setpfc(struct net_device *netdev,
175175
dev_info(&pf->pdev->dev,
176176
"Failed setting DCB PFC configuration err %pe aq_err %s\n",
177177
ERR_PTR(ret),
178-
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
178+
libie_aq_str(pf->hw.aq.asq_last_status));
179179
return -EINVAL;
180180
}
181181

@@ -226,7 +226,7 @@ static int i40e_dcbnl_ieee_setapp(struct net_device *netdev,
226226
dev_info(&pf->pdev->dev,
227227
"Failed setting DCB configuration err %pe aq_err %s\n",
228228
ERR_PTR(ret),
229-
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
229+
libie_aq_str(pf->hw.aq.asq_last_status));
230230
return -EINVAL;
231231
}
232232

@@ -291,7 +291,7 @@ static int i40e_dcbnl_ieee_delapp(struct net_device *netdev,
291291
dev_info(&pf->pdev->dev,
292292
"Failed setting DCB configuration err %pe aq_err %s\n",
293293
ERR_PTR(ret),
294-
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
294+
libie_aq_str(pf->hw.aq.asq_last_status));
295295
return -EINVAL;
296296
}
297297

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,
14621462
netdev_info(netdev,
14631463
"Set phy config failed, err %pe aq_err %s\n",
14641464
ERR_PTR(status),
1465-
i40e_aq_str(hw, hw->aq.asq_last_status));
1465+
libie_aq_str(hw->aq.asq_last_status));
14661466
err = -EAGAIN;
14671467
goto done;
14681468
}
@@ -1472,7 +1472,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,
14721472
netdev_dbg(netdev,
14731473
"Updating link info failed with err %pe aq_err %s\n",
14741474
ERR_PTR(status),
1475-
i40e_aq_str(hw, hw->aq.asq_last_status));
1475+
libie_aq_str(hw->aq.asq_last_status));
14761476

14771477
} else {
14781478
netdev_info(netdev, "Nothing changed, exiting without setting anything.\n");
@@ -1520,7 +1520,7 @@ static int i40e_set_fec_cfg(struct net_device *netdev, u8 fec_cfg)
15201520
netdev_info(netdev,
15211521
"Set phy config failed, err %pe aq_err %s\n",
15221522
ERR_PTR(status),
1523-
i40e_aq_str(hw, hw->aq.asq_last_status));
1523+
libie_aq_str(hw->aq.asq_last_status));
15241524
err = -EAGAIN;
15251525
goto done;
15261526
}
@@ -1534,7 +1534,7 @@ static int i40e_set_fec_cfg(struct net_device *netdev, u8 fec_cfg)
15341534
netdev_dbg(netdev,
15351535
"Updating link info failed with err %pe aq_err %s\n",
15361536
ERR_PTR(status),
1537-
i40e_aq_str(hw, hw->aq.asq_last_status));
1537+
libie_aq_str(hw->aq.asq_last_status));
15381538
}
15391539

15401540
done:
@@ -1641,7 +1641,7 @@ static int i40e_nway_reset(struct net_device *netdev)
16411641
if (ret) {
16421642
netdev_info(netdev, "link restart failed, err %pe aq_err %s\n",
16431643
ERR_PTR(ret),
1644-
i40e_aq_str(hw, hw->aq.asq_last_status));
1644+
libie_aq_str(hw->aq.asq_last_status));
16451645
return -EIO;
16461646
}
16471647

@@ -1758,19 +1758,19 @@ static int i40e_set_pauseparam(struct net_device *netdev,
17581758
if (aq_failures & I40E_SET_FC_AQ_FAIL_GET) {
17591759
netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %pe aq_err %s\n",
17601760
ERR_PTR(status),
1761-
i40e_aq_str(hw, hw->aq.asq_last_status));
1761+
libie_aq_str(hw->aq.asq_last_status));
17621762
err = -EAGAIN;
17631763
}
17641764
if (aq_failures & I40E_SET_FC_AQ_FAIL_SET) {
17651765
netdev_info(netdev, "Set fc failed on the set_phy_config call with err %pe aq_err %s\n",
17661766
ERR_PTR(status),
1767-
i40e_aq_str(hw, hw->aq.asq_last_status));
1767+
libie_aq_str(hw->aq.asq_last_status));
17681768
err = -EAGAIN;
17691769
}
17701770
if (aq_failures & I40E_SET_FC_AQ_FAIL_UPDATE) {
17711771
netdev_info(netdev, "Set fc failed on the get_link_info call with err %pe aq_err %s\n",
17721772
ERR_PTR(status),
1773-
i40e_aq_str(hw, hw->aq.asq_last_status));
1773+
libie_aq_str(hw->aq.asq_last_status));
17741774
err = -EAGAIN;
17751775
}
17761776

@@ -5375,8 +5375,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
53755375
dev_info(&pf->pdev->dev,
53765376
"couldn't set switch config bits, err %pe aq_err %s\n",
53775377
ERR_PTR(ret),
5378-
i40e_aq_str(&pf->hw,
5379-
pf->hw.aq.asq_last_status));
5378+
libie_aq_str(pf->hw.aq.asq_last_status));
53805379
/* not a fatal problem, just keep going */
53815380
}
53825381
}
@@ -5455,8 +5454,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
54555454
dev_warn(&pf->pdev->dev,
54565455
"Starting FW LLDP agent failed: error: %pe, %s\n",
54575456
ERR_PTR(status),
5458-
i40e_aq_str(&pf->hw,
5459-
adq_err));
5457+
libie_aq_str(adq_err));
54605458
return -EINVAL;
54615459
}
54625460
}

0 commit comments

Comments
 (0)