Commit 41165428 authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller

cxgb4: Restore L1 cfg, if FW rejects new L1 cfg settings

In the ethtool set_settings() routine we need to remember our old L1
Configuration in case the firmware rejects the request and then restore
that.
Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9bfdad5e
...@@ -612,6 +612,8 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -612,6 +612,8 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
struct port_info *p = netdev_priv(dev); struct port_info *p = netdev_priv(dev);
struct link_config *lc = &p->link_cfg; struct link_config *lc = &p->link_cfg;
u32 speed = ethtool_cmd_speed(cmd); u32 speed = ethtool_cmd_speed(cmd);
struct link_config old_lc;
int ret;
if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */ if (cmd->duplex != DUPLEX_FULL) /* only full-duplex supported */
return -EINVAL; return -EINVAL;
...@@ -626,6 +628,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -626,6 +628,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return -EINVAL; return -EINVAL;
} }
old_lc = *lc;
if (cmd->autoneg == AUTONEG_DISABLE) { if (cmd->autoneg == AUTONEG_DISABLE) {
cap = speed_to_caps(speed); cap = speed_to_caps(speed);
...@@ -642,10 +645,14 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -642,10 +645,14 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
} }
lc->autoneg = cmd->autoneg; lc->autoneg = cmd->autoneg;
if (netif_running(dev)) /* If the firmware rejects the Link Configuration request, back out
return t4_link_l1cfg(p->adapter, p->adapter->pf, p->tx_chan, * the changes and report the error.
lc); */
return 0; ret = t4_link_l1cfg(p->adapter, p->adapter->mbox, p->tx_chan, lc);
if (ret)
*lc = old_lc;
return ret;
} }
static void get_pauseparam(struct net_device *dev, static void get_pauseparam(struct net_device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment