[v2,004/148] net/ice/base: update phy config during link restart

Message ID f6807df00769433724d34f947d95b8f6c789dc26.1718204528.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Bruce Richardson
Headers
Series Update net/ice base driver to latest upstream snapshot |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Burakov, Anatoly June 12, 2024, 2:59 p.m. UTC
From: Ian Stokes <ian.stokes@intel.com>

Update en_link in curr_user_phy_cfg.caps on successful execution of
set_link_restart_an operation.

Signed-off-by: Siddaraju DH <siddaraju.dh@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_common.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson June 19, 2024, 2:42 p.m. UTC | #1
On Wed, Jun 12, 2024 at 03:59:58PM +0100, Anatoly Burakov wrote:
> From: Ian Stokes <ian.stokes@intel.com>
> 
> Update en_link in curr_user_phy_cfg.caps on successful execution of
> set_link_restart_an operation.
> 
> Signed-off-by: Siddaraju DH <siddaraju.dh@intel.com>
> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> ---
>  drivers/net/ice/base/ice_common.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
> index 2eb3084dac..1d666b7708 100644
> --- a/drivers/net/ice/base/ice_common.c
> +++ b/drivers/net/ice/base/ice_common.c
> @@ -3966,6 +3966,7 @@ int
>  ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
>  			   struct ice_sq_cd *cd)
>  {
> +	enum ice_status status = ICE_ERR_AQ_ERROR;

Here is the first re-introduction of ice_status, AFAIK. Is it feasible to avoid
re-introducing and then later re-doing the conversion of it to int?

>  	struct ice_aqc_restart_an *cmd;
>  	struct ice_aq_desc desc;
>  
> @@ -3980,7 +3981,16 @@ ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
>  	else
>  		cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE;
>  
> -	return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
> +	status = ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
> +	if (status)
> +		return status;
> +
> +	if (ena_link)
> +		pi->phy.curr_user_phy_cfg.caps |= ICE_AQC_PHY_EN_LINK;
> +	else
> +		pi->phy.curr_user_phy_cfg.caps &= ~ICE_AQC_PHY_EN_LINK;
> +
> +	return ICE_SUCCESS;
>  }
>  
>  /**
> -- 
> 2.43.0
>
  

Patch

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 2eb3084dac..1d666b7708 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -3966,6 +3966,7 @@  int
 ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 			   struct ice_sq_cd *cd)
 {
+	enum ice_status status = ICE_ERR_AQ_ERROR;
 	struct ice_aqc_restart_an *cmd;
 	struct ice_aq_desc desc;
 
@@ -3980,7 +3981,16 @@  ice_aq_set_link_restart_an(struct ice_port_info *pi, bool ena_link,
 	else
 		cmd->cmd_flags &= ~ICE_AQC_RESTART_AN_LINK_ENABLE;
 
-	return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
+	status = ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd);
+	if (status)
+		return status;
+
+	if (ena_link)
+		pi->phy.curr_user_phy_cfg.caps |= ICE_AQC_PHY_EN_LINK;
+	else
+		pi->phy.curr_user_phy_cfg.caps &= ~ICE_AQC_PHY_EN_LINK;
+
+	return ICE_SUCCESS;
 }
 
 /**