Commit c9ee9516 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Improve flow control autoneg with Firmware 1.2.1 interface.

Make use of the new AUTONEG_PAUSE bit in the new interface to better
control autoneg flow control settings, independent of RX and TX
advertisement settings.
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 11f15ed3
...@@ -4557,6 +4557,9 @@ static void ...@@ -4557,6 +4557,9 @@ static void
bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req) bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req)
{ {
if (bp->link_info.autoneg & BNXT_AUTONEG_FLOW_CTRL) { if (bp->link_info.autoneg & BNXT_AUTONEG_FLOW_CTRL) {
if (bp->hwrm_spec_code >= 0x10201)
req->auto_pause =
PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE;
if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_RX) if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_RX)
req->auto_pause |= PORT_PHY_CFG_REQ_AUTO_PAUSE_RX; req->auto_pause |= PORT_PHY_CFG_REQ_AUTO_PAUSE_RX;
if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_TX) if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_TX)
...@@ -4570,6 +4573,11 @@ bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req) ...@@ -4570,6 +4573,11 @@ bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req)
req->force_pause |= PORT_PHY_CFG_REQ_FORCE_PAUSE_TX; req->force_pause |= PORT_PHY_CFG_REQ_FORCE_PAUSE_TX;
req->enables |= req->enables |=
cpu_to_le32(PORT_PHY_CFG_REQ_ENABLES_FORCE_PAUSE); cpu_to_le32(PORT_PHY_CFG_REQ_ENABLES_FORCE_PAUSE);
if (bp->hwrm_spec_code >= 0x10201) {
req->auto_pause = req->force_pause;
req->enables |= cpu_to_le32(
PORT_PHY_CFG_REQ_ENABLES_AUTO_PAUSE);
}
} }
} }
...@@ -4656,7 +4664,8 @@ static int bnxt_update_phy_setting(struct bnxt *bp) ...@@ -4656,7 +4664,8 @@ static int bnxt_update_phy_setting(struct bnxt *bp)
return rc; return rc;
} }
if ((link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) && if ((link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) &&
link_info->auto_pause_setting != link_info->req_flow_ctrl) (link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH) !=
link_info->req_flow_ctrl)
update_pause = true; update_pause = true;
if (!(link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) && if (!(link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) &&
link_info->force_pause_setting != link_info->req_flow_ctrl) link_info->force_pause_setting != link_info->req_flow_ctrl)
...@@ -5825,15 +5834,24 @@ static int bnxt_probe_phy(struct bnxt *bp) ...@@ -5825,15 +5834,24 @@ static int bnxt_probe_phy(struct bnxt *bp)
/*initialize the ethool setting copy with NVM settings */ /*initialize the ethool setting copy with NVM settings */
if (BNXT_AUTO_MODE(link_info->auto_mode)) { if (BNXT_AUTO_MODE(link_info->auto_mode)) {
link_info->autoneg = BNXT_AUTONEG_SPEED | link_info->autoneg = BNXT_AUTONEG_SPEED;
BNXT_AUTONEG_FLOW_CTRL; if (bp->hwrm_spec_code >= 0x10201) {
if (link_info->auto_pause_setting &
PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE)
link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
} else {
link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
}
link_info->advertising = link_info->auto_link_speeds; link_info->advertising = link_info->auto_link_speeds;
link_info->req_flow_ctrl = link_info->auto_pause_setting;
} else { } else {
link_info->req_link_speed = link_info->force_link_speed; link_info->req_link_speed = link_info->force_link_speed;
link_info->req_duplex = link_info->duplex_setting; link_info->req_duplex = link_info->duplex_setting;
link_info->req_flow_ctrl = link_info->force_pause_setting;
} }
if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
link_info->req_flow_ctrl =
link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH;
else
link_info->req_flow_ctrl = link_info->force_pause_setting;
return rc; return rc;
} }
......
...@@ -874,7 +874,9 @@ static int bnxt_set_pauseparam(struct net_device *dev, ...@@ -874,7 +874,9 @@ static int bnxt_set_pauseparam(struct net_device *dev,
return -EINVAL; return -EINVAL;
link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL; link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_BOTH; if (bp->hwrm_spec_code >= 0x10201)
link_info->req_flow_ctrl =
PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE;
} else { } else {
/* when transition from auto pause to force pause, /* when transition from auto pause to force pause,
* force a link change * force a link change
...@@ -882,17 +884,13 @@ static int bnxt_set_pauseparam(struct net_device *dev, ...@@ -882,17 +884,13 @@ static int bnxt_set_pauseparam(struct net_device *dev,
if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
link_info->force_link_chng = true; link_info->force_link_chng = true;
link_info->autoneg &= ~BNXT_AUTONEG_FLOW_CTRL; link_info->autoneg &= ~BNXT_AUTONEG_FLOW_CTRL;
link_info->req_flow_ctrl &= ~BNXT_LINK_PAUSE_BOTH; link_info->req_flow_ctrl = 0;
} }
if (epause->rx_pause) if (epause->rx_pause)
link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_RX; link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_RX;
else
link_info->req_flow_ctrl &= ~BNXT_LINK_PAUSE_RX;
if (epause->tx_pause) if (epause->tx_pause)
link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX; link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
else
link_info->req_flow_ctrl &= ~BNXT_LINK_PAUSE_TX;
if (netif_running(dev)) if (netif_running(dev))
rc = bnxt_hwrm_set_pause(bp); rc = bnxt_hwrm_set_pause(bp);
......
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