aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_ethtool.c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-15 00:50:50 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-15 18:50:41 -0400
commit8b3afe95e363dbd32bd9ddc6c2d562944f5350c5 (patch)
tree6264c0376004f4dec5ed41ed54eff00806fb837a /drivers/net/gianfar_ethtool.c
parentc8c64cff2c88b17fdd7402dd06288d7415896430 (diff)
net: gianfar: convert to hw_features
Note: I bet that gfar_set_features() don't really need a full reset. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar_ethtool.c')
-rw-r--r--drivers/net/gianfar_ethtool.c58
1 files changed, 5 insertions, 53 deletions
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 0840590958dd..493d743839d9 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -517,15 +517,15 @@ static int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rva
517 return err; 517 return err;
518} 518}
519 519
520static int gfar_set_rx_csum(struct net_device *dev, uint32_t data) 520int gfar_set_features(struct net_device *dev, u32 features)
521{ 521{
522 struct gfar_private *priv = netdev_priv(dev); 522 struct gfar_private *priv = netdev_priv(dev);
523 unsigned long flags; 523 unsigned long flags;
524 int err = 0, i = 0; 524 int err = 0, i = 0;
525 u32 changed = dev->features ^ features;
525 526
526 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM)) 527 if (!(changed & NETIF_F_RXCSUM))
527 return -EOPNOTSUPP; 528 return 0;
528
529 529
530 if (dev->flags & IFF_UP) { 530 if (dev->flags & IFF_UP) {
531 /* Halt TX and RX, and process the frames which 531 /* 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)
546 546
547 /* Now we take down the rings to rebuild them */ 547 /* Now we take down the rings to rebuild them */
548 stop_gfar(dev); 548 stop_gfar(dev);
549 }
550 549
551 spin_lock_irqsave(&priv->bflock, flags); 550 dev->features = features;
552 priv->rx_csum_enable = data;
553 spin_unlock_irqrestore(&priv->bflock, flags);
554 551
555 if (dev->flags & IFF_UP) {
556 err = startup_gfar(dev); 552 err = startup_gfar(dev);
557 netif_tx_wake_all_queues(dev); 553 netif_tx_wake_all_queues(dev);
558 } 554 }
559 return err; 555 return err;
560} 556}
561 557
562static uint32_t gfar_get_rx_csum(struct net_device *dev)
563{
564 struct gfar_private *priv = netdev_priv(dev);
565
566 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
567 return 0;
568
569 return priv->rx_csum_enable;
570}
571
572static int gfar_set_tx_csum(struct net_device *dev, uint32_t data)
573{
574 struct gfar_private *priv = netdev_priv(dev);
575
576 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
577 return -EOPNOTSUPP;
578
579 netif_tx_lock_bh(dev);
580
581 if (data)
582 dev->features |= NETIF_F_IP_CSUM;
583 else
584 dev->features &= ~NETIF_F_IP_CSUM;
585
586 netif_tx_unlock_bh(dev);
587
588 return 0;
589}
590
591static uint32_t gfar_get_tx_csum(struct net_device *dev)
592{
593 struct gfar_private *priv = netdev_priv(dev);
594
595 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_CSUM))
596 return 0;
597
598 return (dev->features & NETIF_F_IP_CSUM) != 0;
599}
600
601static uint32_t gfar_get_msglevel(struct net_device *dev) 558static uint32_t gfar_get_msglevel(struct net_device *dev)
602{ 559{
603 struct gfar_private *priv = netdev_priv(dev); 560 struct gfar_private *priv = netdev_priv(dev);
@@ -844,11 +801,6 @@ const struct ethtool_ops gfar_ethtool_ops = {
844 .get_strings = gfar_gstrings, 801 .get_strings = gfar_gstrings,
845 .get_sset_count = gfar_sset_count, 802 .get_sset_count = gfar_sset_count,
846 .get_ethtool_stats = gfar_fill_stats, 803 .get_ethtool_stats = gfar_fill_stats,
847 .get_rx_csum = gfar_get_rx_csum,
848 .get_tx_csum = gfar_get_tx_csum,
849 .set_rx_csum = gfar_set_rx_csum,
850 .set_tx_csum = gfar_set_tx_csum,
851 .set_sg = ethtool_op_set_sg,
852 .get_msglevel = gfar_get_msglevel, 804 .get_msglevel = gfar_get_msglevel,
853 .set_msglevel = gfar_set_msglevel, 805 .set_msglevel = gfar_set_msglevel,
854#ifdef CONFIG_PM 806#ifdef CONFIG_PM