> +     if (status.link) {
> +             /* Always full duplex */
> +             status.duplex = DUPLEX_FULL;
> +
> +             /* Speed */
> +             speed = bgx_port_get_qlm_speed(priv, priv->qlm);
> +             data = oct_csr_read(BGX_CMR_CONFIG(priv->node, priv->bgx,
> +                                                priv->index));
> +             switch ((data >> 8) & 7) {
> +             default:
> +             case 1:
> +                     speed = (speed * 8 + 5) / 10;
> +                     lanes = 4;
> +                     break;

Hi Steven

Here you add 5, which you did not in the other function dealing with
speed...

> +             priv->phydev = of_phy_connect(netdev, priv->phy_np,
> +                                           bgx_port_adjust_link, 0,
> +                                           PHY_INTERFACE_MODE_SGMII);
> +             if (!priv->phydev)
> +                     return -ENODEV;
> +
> +             netif_carrier_off(netdev);
> +
> +             if (priv->phydev)
> +                     phy_start_aneg(priv->phydev);
> +     }

If you are using phylib, you should not need to make calls to
netif_carrier_*(). The phylib will do it for you.

Why hard code passing PHY_INTERFACE_MODE_SGMII? You also support
RGMII? It would be better to use of_get_phy_mode().

> +int bgx_port_change_mtu(struct net_device *netdev, int new_mtu)
> +{
> +     struct bgx_port_priv *priv = bgx_port_netdev2priv(netdev);
> +     int max_frame;
> +
> +     if (new_mtu < 60 || new_mtu > 65392) {
> +             netdev_warn(netdev, "Maximum MTU supported is 65392\n");
> +             return -EINVAL;
> +     }

The core can check this for you, if you tell it the MAX and Min.

    Andrew

Reply via email to