Skip to content

Commit c9ee951

Browse files
Michael Chandavem330
authored andcommitted
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: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 11f15ed commit c9ee951

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4557,6 +4557,9 @@ static void
45574557
bnxt_hwrm_set_pause_common(struct bnxt *bp, struct hwrm_port_phy_cfg_input *req)
45584558
{
45594559
if (bp->link_info.autoneg & BNXT_AUTONEG_FLOW_CTRL) {
4560+
if (bp->hwrm_spec_code >= 0x10201)
4561+
req->auto_pause =
4562+
PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE;
45604563
if (bp->link_info.req_flow_ctrl & BNXT_LINK_PAUSE_RX)
45614564
req->auto_pause |= PORT_PHY_CFG_REQ_AUTO_PAUSE_RX;
45624565
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)
45704573
req->force_pause |= PORT_PHY_CFG_REQ_FORCE_PAUSE_TX;
45714574
req->enables |=
45724575
cpu_to_le32(PORT_PHY_CFG_REQ_ENABLES_FORCE_PAUSE);
4576+
if (bp->hwrm_spec_code >= 0x10201) {
4577+
req->auto_pause = req->force_pause;
4578+
req->enables |= cpu_to_le32(
4579+
PORT_PHY_CFG_REQ_ENABLES_AUTO_PAUSE);
4580+
}
45734581
}
45744582
}
45754583

@@ -4656,7 +4664,8 @@ static int bnxt_update_phy_setting(struct bnxt *bp)
46564664
return rc;
46574665
}
46584666
if ((link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) &&
4659-
link_info->auto_pause_setting != link_info->req_flow_ctrl)
4667+
(link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH) !=
4668+
link_info->req_flow_ctrl)
46604669
update_pause = true;
46614670
if (!(link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) &&
46624671
link_info->force_pause_setting != link_info->req_flow_ctrl)
@@ -5825,15 +5834,24 @@ static int bnxt_probe_phy(struct bnxt *bp)
58255834

58265835
/*initialize the ethool setting copy with NVM settings */
58275836
if (BNXT_AUTO_MODE(link_info->auto_mode)) {
5828-
link_info->autoneg = BNXT_AUTONEG_SPEED |
5829-
BNXT_AUTONEG_FLOW_CTRL;
5837+
link_info->autoneg = BNXT_AUTONEG_SPEED;
5838+
if (bp->hwrm_spec_code >= 0x10201) {
5839+
if (link_info->auto_pause_setting &
5840+
PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE)
5841+
link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
5842+
} else {
5843+
link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
5844+
}
58305845
link_info->advertising = link_info->auto_link_speeds;
5831-
link_info->req_flow_ctrl = link_info->auto_pause_setting;
58325846
} else {
58335847
link_info->req_link_speed = link_info->force_link_speed;
58345848
link_info->req_duplex = link_info->duplex_setting;
5835-
link_info->req_flow_ctrl = link_info->force_pause_setting;
58365849
}
5850+
if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
5851+
link_info->req_flow_ctrl =
5852+
link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH;
5853+
else
5854+
link_info->req_flow_ctrl = link_info->force_pause_setting;
58375855
return rc;
58385856
}
58395857

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -874,25 +874,23 @@ static int bnxt_set_pauseparam(struct net_device *dev,
874874
return -EINVAL;
875875

876876
link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
877-
link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_BOTH;
877+
if (bp->hwrm_spec_code >= 0x10201)
878+
link_info->req_flow_ctrl =
879+
PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE;
878880
} else {
879881
/* when transition from auto pause to force pause,
880882
* force a link change
881883
*/
882884
if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
883885
link_info->force_link_chng = true;
884886
link_info->autoneg &= ~BNXT_AUTONEG_FLOW_CTRL;
885-
link_info->req_flow_ctrl &= ~BNXT_LINK_PAUSE_BOTH;
887+
link_info->req_flow_ctrl = 0;
886888
}
887889
if (epause->rx_pause)
888890
link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_RX;
889-
else
890-
link_info->req_flow_ctrl &= ~BNXT_LINK_PAUSE_RX;
891891

892892
if (epause->tx_pause)
893893
link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
894-
else
895-
link_info->req_flow_ctrl &= ~BNXT_LINK_PAUSE_TX;
896894

897895
if (netif_running(dev))
898896
rc = bnxt_hwrm_set_pause(bp);

0 commit comments

Comments
 (0)