diff options
Diffstat (limited to 'drivers/net/ethernet/marvell/mvpp2.c')
| -rw-r--r-- | drivers/net/ethernet/marvell/mvpp2.c | 39 | 
1 files changed, 11 insertions, 28 deletions
| diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index 60227a3452a4..dabc5418efcc 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -3293,7 +3293,7 @@ static void mvpp2_cls_init(struct mvpp2 *priv)  	mvpp2_write(priv, MVPP2_CLS_MODE_REG, MVPP2_CLS_MODE_ACTIVE_MASK);  	/* Clear classifier flow table */ -	memset(&fe.data, 0, MVPP2_CLS_FLOWS_TBL_DATA_WORDS); +	memset(&fe.data, 0, sizeof(fe.data));  	for (index = 0; index < MVPP2_CLS_FLOWS_TBL_SIZE; index++) {  		fe.index = index;  		mvpp2_cls_flow_write(priv, &fe); @@ -5453,29 +5453,6 @@ static void mvpp2_stop_dev(struct mvpp2_port *port)  	phy_stop(ndev->phydev);  } -/* Return positive if MTU is valid */ -static inline int mvpp2_check_mtu_valid(struct net_device *dev, int mtu) -{ -	if (mtu < 68) { -		netdev_err(dev, "cannot change mtu to less than 68\n"); -		return -EINVAL; -	} - -	/* 9676 == 9700 - 20 and rounding to 8 */ -	if (mtu > 9676) { -		netdev_info(dev, "illegal MTU value %d, round to 9676\n", mtu); -		mtu = 9676; -	} - -	if (!IS_ALIGNED(MVPP2_RX_PKT_SIZE(mtu), 8)) { -		netdev_info(dev, "illegal MTU value %d, round to %d\n", mtu, -			    ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8)); -		mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8); -	} - -	return mtu; -} -  static int mvpp2_check_ringparam_valid(struct net_device *dev,  				       struct ethtool_ringparam *ring)  { @@ -5717,10 +5694,10 @@ static int mvpp2_change_mtu(struct net_device *dev, int mtu)  	struct mvpp2_port *port = netdev_priv(dev);  	int err; -	mtu = mvpp2_check_mtu_valid(dev, mtu); -	if (mtu < 0) { -		err = mtu; -		goto error; +	if (!IS_ALIGNED(MVPP2_RX_PKT_SIZE(mtu), 8)) { +		netdev_info(dev, "illegal MTU value %d, round to %d\n", mtu, +			    ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8)); +		mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8);  	}  	if (!netif_running(dev)) { @@ -5946,6 +5923,7 @@ static const struct net_device_ops mvpp2_netdev_ops = {  };  static const struct ethtool_ops mvpp2_eth_tool_ops = { +	.nway_reset	= phy_ethtool_nway_reset,  	.get_link	= ethtool_op_get_link,  	.set_coalesce	= mvpp2_ethtool_set_coalesce,  	.get_coalesce	= mvpp2_ethtool_get_coalesce, @@ -6212,6 +6190,11 @@ static int mvpp2_port_probe(struct platform_device *pdev,  	dev->hw_features |= features | NETIF_F_RXCSUM | NETIF_F_GRO;  	dev->vlan_features |= features; +	/* MTU range: 68 - 9676 */ +	dev->min_mtu = ETH_MIN_MTU; +	/* 9676 == 9700 - 20 and rounding to 8 */ +	dev->max_mtu = 9676; +  	err = register_netdev(dev);  	if (err < 0) {  		dev_err(&pdev->dev, "failed to register netdev\n"); |