Commit 026cea3c authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Tony Nguyen
Browse files

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: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 43a11306
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -231,6 +231,7 @@ config I40E
	depends on PCI
	select AUXILIARY_BUS
	select LIBIE
	select LIBIE_ADMINQ
	select NET_DEVLINK
	help
	  This driver supports Intel(R) Ethernet Controller XL710 Family of
+2 −5
Original line number Diff line number Diff line
@@ -682,9 +682,7 @@ static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,
	if (err) {
		dev_info(&pf->pdev->dev,
			 "couldn't get PF vsi config, err %pe aq_err %s\n",
			 ERR_PTR(err),
			 i40e_aq_str(&pf->hw,
				     pf->hw.aq.asq_last_status));
			 ERR_PTR(err), libie_aq_str(pf->hw.aq.asq_last_status));
		return -ENOENT;
	}

@@ -711,8 +709,7 @@ static int i40e_client_update_vsi_ctxt(struct i40e_info *ldev,
			dev_info(&pf->pdev->dev,
				 "update VSI ctxt for PE failed, err %pe aq_err %s\n",
				 ERR_PTR(err),
				 i40e_aq_str(&pf->hw,
					     pf->hw.aq.asq_last_status));
				 libie_aq_str(pf->hw.aq.asq_last_status));
		}
	}
	return err;
+0 −52
Original line number Diff line number Diff line
@@ -68,58 +68,6 @@ int i40e_set_mac_type(struct i40e_hw *hw)
	return status;
}

/**
 * i40e_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 *i40e_aq_str(struct i40e_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;
}

/**
 * i40e_debug_aq
 * @hw: debug mask related to admin queue
+4 −4
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static int i40e_dcbnl_ieee_setets(struct net_device *netdev,
		dev_info(&pf->pdev->dev,
			 "Failed setting DCB ETS configuration err %pe aq_err %s\n",
			 ERR_PTR(ret),
			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
			 libie_aq_str(pf->hw.aq.asq_last_status));
		return -EINVAL;
	}

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

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

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

+10 −12
Original line number Diff line number Diff line
@@ -1462,7 +1462,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,
			netdev_info(netdev,
				    "Set phy config failed, err %pe aq_err %s\n",
				    ERR_PTR(status),
				    i40e_aq_str(hw, hw->aq.asq_last_status));
				    libie_aq_str(hw->aq.asq_last_status));
			err = -EAGAIN;
			goto done;
		}
@@ -1472,7 +1472,7 @@ static int i40e_set_link_ksettings(struct net_device *netdev,
			netdev_dbg(netdev,
				   "Updating link info failed with err %pe aq_err %s\n",
				   ERR_PTR(status),
				   i40e_aq_str(hw, hw->aq.asq_last_status));
				   libie_aq_str(hw->aq.asq_last_status));

	} else {
		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)
			netdev_info(netdev,
				    "Set phy config failed, err %pe aq_err %s\n",
				    ERR_PTR(status),
				    i40e_aq_str(hw, hw->aq.asq_last_status));
				    libie_aq_str(hw->aq.asq_last_status));
			err = -EAGAIN;
			goto done;
		}
@@ -1534,7 +1534,7 @@ static int i40e_set_fec_cfg(struct net_device *netdev, u8 fec_cfg)
			netdev_dbg(netdev,
				   "Updating link info failed with err %pe aq_err %s\n",
				   ERR_PTR(status),
				   i40e_aq_str(hw, hw->aq.asq_last_status));
				   libie_aq_str(hw->aq.asq_last_status));
	}

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

@@ -1758,19 +1758,19 @@ static int i40e_set_pauseparam(struct net_device *netdev,
	if (aq_failures & I40E_SET_FC_AQ_FAIL_GET) {
		netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %pe aq_err %s\n",
			    ERR_PTR(status),
			    i40e_aq_str(hw, hw->aq.asq_last_status));
			    libie_aq_str(hw->aq.asq_last_status));
		err = -EAGAIN;
	}
	if (aq_failures & I40E_SET_FC_AQ_FAIL_SET) {
		netdev_info(netdev, "Set fc failed on the set_phy_config call with err %pe aq_err %s\n",
			    ERR_PTR(status),
			    i40e_aq_str(hw, hw->aq.asq_last_status));
			    libie_aq_str(hw->aq.asq_last_status));
		err = -EAGAIN;
	}
	if (aq_failures & I40E_SET_FC_AQ_FAIL_UPDATE) {
		netdev_info(netdev, "Set fc failed on the get_link_info call with err %pe aq_err %s\n",
			    ERR_PTR(status),
			    i40e_aq_str(hw, hw->aq.asq_last_status));
			    libie_aq_str(hw->aq.asq_last_status));
		err = -EAGAIN;
	}

@@ -5375,8 +5375,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
			dev_info(&pf->pdev->dev,
				 "couldn't set switch config bits, err %pe aq_err %s\n",
				 ERR_PTR(ret),
				 i40e_aq_str(&pf->hw,
					     pf->hw.aq.asq_last_status));
				 libie_aq_str(pf->hw.aq.asq_last_status));
			/* not a fatal problem, just keep going */
		}
	}
@@ -5455,8 +5454,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
					dev_warn(&pf->pdev->dev,
						 "Starting FW LLDP agent failed: error: %pe, %s\n",
						 ERR_PTR(status),
						 i40e_aq_str(&pf->hw,
							     adq_err));
						 libie_aq_str(adq_err));
					return -EINVAL;
				}
			}
Loading