提交 27c4d578 编写于 作者: M Michael Chan 提交者: David S. Miller

bnxt_en: Refactor bnxt_fw_to_ethtool_advertised_spds().

Include the conversion of pause bits and add one extra call layer so
that the same refactored function can be reused to get the link partner
advertisement bits.
Signed-off-by: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f8b33d8e
...@@ -515,9 +515,8 @@ static u32 bnxt_fw_to_ethtool_support_spds(struct bnxt_link_info *link_info) ...@@ -515,9 +515,8 @@ static u32 bnxt_fw_to_ethtool_support_spds(struct bnxt_link_info *link_info)
return speed_mask; return speed_mask;
} }
static u32 bnxt_fw_to_ethtool_advertised_spds(struct bnxt_link_info *link_info) static u32 _bnxt_fw_to_ethtool_adv_spds(u16 fw_speeds, u8 fw_pause)
{ {
u16 fw_speeds = link_info->auto_link_speeds;
u32 speed_mask = 0; u32 speed_mask = 0;
/* TODO: support 25GB, 40GB, 50GB with different cable type */ /* TODO: support 25GB, 40GB, 50GB with different cable type */
...@@ -532,9 +531,28 @@ static u32 bnxt_fw_to_ethtool_advertised_spds(struct bnxt_link_info *link_info) ...@@ -532,9 +531,28 @@ static u32 bnxt_fw_to_ethtool_advertised_spds(struct bnxt_link_info *link_info)
speed_mask |= ADVERTISED_10000baseT_Full; speed_mask |= ADVERTISED_10000baseT_Full;
if (fw_speeds & BNXT_LINK_SPEED_MSK_40GB) if (fw_speeds & BNXT_LINK_SPEED_MSK_40GB)
speed_mask |= ADVERTISED_40000baseCR4_Full; speed_mask |= ADVERTISED_40000baseCR4_Full;
if ((fw_pause & BNXT_LINK_PAUSE_BOTH) == BNXT_LINK_PAUSE_BOTH)
speed_mask |= ADVERTISED_Pause;
else if (fw_pause & BNXT_LINK_PAUSE_TX)
speed_mask |= ADVERTISED_Asym_Pause;
else if (fw_pause & BNXT_LINK_PAUSE_RX)
speed_mask |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
return speed_mask; return speed_mask;
} }
static u32 bnxt_fw_to_ethtool_advertised_spds(struct bnxt_link_info *link_info)
{
u16 fw_speeds = link_info->auto_link_speeds;
u8 fw_pause = 0;
if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
fw_pause = link_info->auto_pause_setting;
return _bnxt_fw_to_ethtool_adv_spds(fw_speeds, fw_pause);
}
u32 bnxt_fw_to_ethtool_speed(u16 fw_link_speed) u32 bnxt_fw_to_ethtool_speed(u16 fw_link_speed)
{ {
switch (fw_link_speed) { switch (fw_link_speed) {
...@@ -580,17 +598,6 @@ static int bnxt_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -580,17 +598,6 @@ static int bnxt_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->autoneg = AUTONEG_DISABLE; cmd->autoneg = AUTONEG_DISABLE;
cmd->advertising = 0; cmd->advertising = 0;
} }
if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL) {
if ((link_info->auto_pause_setting & BNXT_LINK_PAUSE_BOTH) ==
BNXT_LINK_PAUSE_BOTH) {
cmd->advertising |= ADVERTISED_Pause;
} else {
cmd->advertising |= ADVERTISED_Asym_Pause;
if (link_info->auto_pause_setting &
BNXT_LINK_PAUSE_RX)
cmd->advertising |= ADVERTISED_Pause;
}
}
cmd->port = PORT_NONE; cmd->port = PORT_NONE;
if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) { if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册