]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
bnx2x: Correct speed from baseT into KR.
[mirror_ubuntu-eoan-kernel.git] / drivers / net / ethernet / broadcom / bnx2x / bnx2x_ethtool.c
index 48ed005ba73fd3a9d9aa550871b647fdd0b59350..733b0fc59cd7f02179eba35e26253caf75096fa6 100644 (file)
@@ -257,14 +257,15 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct bnx2x *bp = netdev_priv(dev);
        int cfg_idx = bnx2x_get_link_cfg_idx(bp);
+       u32 media_type;
 
        /* Dual Media boards present all available port types */
        cmd->supported = bp->port.supported[cfg_idx] |
                (bp->port.supported[cfg_idx ^ 1] &
                 (SUPPORTED_TP | SUPPORTED_FIBRE));
        cmd->advertising = bp->port.advertising[cfg_idx];
-       if (bp->link_params.phy[bnx2x_get_cur_phy_idx(bp)].media_type ==
-           ETH_PHY_SFP_1G_FIBER) {
+       media_type = bp->link_params.phy[bnx2x_get_cur_phy_idx(bp)].media_type;
+       if (media_type == ETH_PHY_SFP_1G_FIBER) {
                cmd->supported &= ~(SUPPORTED_10000baseT_Full);
                cmd->advertising &= ~(ADVERTISED_10000baseT_Full);
        }
@@ -312,12 +313,26 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                        cmd->lp_advertising |= ADVERTISED_100baseT_Full;
                if (status & LINK_STATUS_LINK_PARTNER_1000THD_CAPABLE)
                        cmd->lp_advertising |= ADVERTISED_1000baseT_Half;
-               if (status & LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE)
-                       cmd->lp_advertising |= ADVERTISED_1000baseT_Full;
+               if (status & LINK_STATUS_LINK_PARTNER_1000TFD_CAPABLE) {
+                       if (media_type == ETH_PHY_KR) {
+                               cmd->lp_advertising |=
+                                       ADVERTISED_1000baseKX_Full;
+                       } else {
+                               cmd->lp_advertising |=
+                                       ADVERTISED_1000baseT_Full;
+                       }
+               }
                if (status & LINK_STATUS_LINK_PARTNER_2500XFD_CAPABLE)
                        cmd->lp_advertising |= ADVERTISED_2500baseX_Full;
-               if (status & LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE)
-                       cmd->lp_advertising |= ADVERTISED_10000baseT_Full;
+               if (status & LINK_STATUS_LINK_PARTNER_10GXFD_CAPABLE) {
+                       if (media_type == ETH_PHY_KR) {
+                               cmd->lp_advertising |=
+                                       ADVERTISED_10000baseKR_Full;
+                       } else {
+                               cmd->lp_advertising |=
+                                       ADVERTISED_10000baseT_Full;
+                       }
+               }
                if (status & LINK_STATUS_LINK_PARTNER_20GXFD_CAPABLE)
                        cmd->lp_advertising |= ADVERTISED_20000baseKR2_Full;
        }
@@ -564,15 +579,20 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                                return -EINVAL;
                        }
 
-                       if (!(bp->port.supported[cfg_idx] &
-                             SUPPORTED_1000baseT_Full)) {
+                       if (bp->port.supported[cfg_idx] &
+                            SUPPORTED_1000baseT_Full) {
+                               advertising = (ADVERTISED_1000baseT_Full |
+                                              ADVERTISED_TP);
+
+                       } else if (bp->port.supported[cfg_idx] &
+                                  SUPPORTED_1000baseKX_Full) {
+                               advertising = ADVERTISED_1000baseKX_Full;
+                       } else {
                                DP(BNX2X_MSG_ETHTOOL,
                                   "1G full not supported\n");
                                return -EINVAL;
                        }
 
-                       advertising = (ADVERTISED_1000baseT_Full |
-                                      ADVERTISED_TP);
                        break;
 
                case SPEED_2500:
@@ -600,17 +620,22 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                                return -EINVAL;
                        }
                        phy_idx = bnx2x_get_cur_phy_idx(bp);
-                       if (!(bp->port.supported[cfg_idx]
-                             & SUPPORTED_10000baseT_Full) ||
-                           (bp->link_params.phy[phy_idx].media_type ==
+                       if ((bp->port.supported[cfg_idx] &
+                            SUPPORTED_10000baseT_Full) &&
+                           (bp->link_params.phy[phy_idx].media_type !=
                             ETH_PHY_SFP_1G_FIBER)) {
+                               advertising = (ADVERTISED_10000baseT_Full |
+                                              ADVERTISED_FIBRE);
+                       } else if (bp->port.supported[cfg_idx] &
+                              SUPPORTED_10000baseKR_Full) {
+                               advertising = (ADVERTISED_10000baseKR_Full |
+                                              ADVERTISED_FIBRE);
+                       } else {
                                DP(BNX2X_MSG_ETHTOOL,
                                   "10G full not supported\n");
                                return -EINVAL;
                        }
 
-                       advertising = (ADVERTISED_10000baseT_Full |
-                                      ADVERTISED_FIBRE);
                        break;
 
                default: