mirror of https://gitee.com/openkylin/linux.git
bnx2x: Fix ethtool advertisement
Enable changing advertisement settings via ethtool. Signed-off-by: Yaniv Rosner <yanivr@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ab505dec96
commit
8d66163740
|
@ -363,13 +363,50 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
|||
}
|
||||
|
||||
/* advertise the requested speed and duplex if supported */
|
||||
cmd->advertising &= bp->port.supported[cfg_idx];
|
||||
if (cmd->advertising & ~(bp->port.supported[cfg_idx])) {
|
||||
DP(NETIF_MSG_LINK, "Advertisement parameters "
|
||||
"are not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bp->link_params.req_line_speed[cfg_idx] = SPEED_AUTO_NEG;
|
||||
bp->link_params.req_duplex[cfg_idx] = DUPLEX_FULL;
|
||||
bp->port.advertising[cfg_idx] |= (ADVERTISED_Autoneg |
|
||||
bp->link_params.req_duplex[cfg_idx] = cmd->duplex;
|
||||
bp->port.advertising[cfg_idx] = (ADVERTISED_Autoneg |
|
||||
cmd->advertising);
|
||||
if (cmd->advertising) {
|
||||
|
||||
bp->link_params.speed_cap_mask[cfg_idx] = 0;
|
||||
if (cmd->advertising & ADVERTISED_10baseT_Half) {
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF;
|
||||
}
|
||||
if (cmd->advertising & ADVERTISED_10baseT_Full)
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL;
|
||||
|
||||
if (cmd->advertising & ADVERTISED_100baseT_Full)
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL;
|
||||
|
||||
if (cmd->advertising & ADVERTISED_100baseT_Half) {
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF;
|
||||
}
|
||||
if (cmd->advertising & ADVERTISED_1000baseT_Half) {
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_1G;
|
||||
}
|
||||
if (cmd->advertising & (ADVERTISED_1000baseT_Full |
|
||||
ADVERTISED_1000baseKX_Full))
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_1G;
|
||||
|
||||
if (cmd->advertising & (ADVERTISED_10000baseT_Full |
|
||||
ADVERTISED_10000baseKX4_Full |
|
||||
ADVERTISED_10000baseKR_Full))
|
||||
bp->link_params.speed_cap_mask[cfg_idx] |=
|
||||
PORT_HW_CFG_SPEED_CAPABILITY_D0_10G;
|
||||
}
|
||||
} else { /* forced speed */
|
||||
/* advertise the requested speed and duplex if supported */
|
||||
switch (speed) {
|
||||
|
|
Loading…
Reference in New Issue