Merge branch 'timers-ptp-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / net / gianfar_ethtool.c
index 0840590..493d743 100644 (file)
@@ -517,15 +517,15 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
        return err;
 }
 
-static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
+int gfar_set_features(struct net_device *dev, u32 features)
 {
        struct gfar_private *priv = netdev_priv(dev);
        unsigned long flags;
        int err = 0, i = 0;
+       u32 changed = dev->features ^ features;
 
-       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
-               return -EOPNOTSUPP;
-
+       if (!(changed & NETIF_F_RXCSUM))
+               return 0;
 
        if (dev->flags & IFF_UP) {
                /* Halt TX and RX, and process the frames which
@@ -546,58 +546,15 @@ static int gfar_set_rx_csum(struct net_device *dev, uint32_t data)
 
                /* Now we take down the rings to rebuild them */
                stop_gfar(dev);
-       }
 
-       spin_lock_irqsave(&priv->bflock, flags);
-       priv->rx_csum_enable = data;
-       spin_unlock_irqrestore(&priv->bflock, flags);
+               dev->features = features;
 
-       if (dev->flags & IFF_UP) {
                err = startup_gfar(dev);
                netif_tx_wake_all_queues(dev);
        }
        return err;
 }
 
-static uint32_t gfar_get_rx_csum(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
-               return 0;
-
-       return priv->rx_csum_enable;
-}
-
-static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
-               return -EOPNOTSUPP;
-
-       netif_tx_lock_bh(dev);
-
-       if (data)
-               dev->features |= NETIF_F_IP_CSUM;
-       else
-               dev->features &= ~NETIF_F_IP_CSUM;
-
-       netif_tx_unlock_bh(dev);
-
-       return 0;
-}
-
-static uint32_t gfar_get_tx_csum(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
-               return 0;
-
-       return (dev->features & NETIF_F_IP_CSUM) != 0;
-}
-
 static uint32_t gfar_get_msglevel(struct net_device *dev)
 {
        struct gfar_private *priv = netdev_priv(dev);
@@ -844,11 +801,6 @@ const struct ethtool_ops gfar_ethtool_ops = {
        .get_strings = gfar_gstrings,
        .get_sset_count = gfar_sset_count,
        .get_ethtool_stats = gfar_fill_stats,
-       .get_rx_csum = gfar_get_rx_csum,
-       .get_tx_csum = gfar_get_tx_csum,
-       .set_rx_csum = gfar_set_rx_csum,
-       .set_tx_csum = gfar_set_tx_csum,
-       .set_sg = ethtool_op_set_sg,
        .get_msglevel = gfar_get_msglevel,
        .set_msglevel = gfar_set_msglevel,
 #ifdef CONFIG_PM