[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180605005509.GB18073@lunn.ch>
Date: Tue, 5 Jun 2018 02:55:09 +0200
From: Andrew Lunn <andrew@...n.ch>
To: "Steven J. Hill" <steven.hill@...ium.com>
Cc: netdev@...r.kernel.org, Carlos Munoz <cmunoz@...ium.com>
Subject: Re: [PATCH net-next v11 04/10] netdev: cavium: octeon: Add Octeon
III BGX Ports
> + 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
Powered by blists - more mailing lists