Lines Matching refs:dev

353 static void sc92031_disable_interrupts(struct net_device *dev)  in sc92031_disable_interrupts()  argument
355 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_disable_interrupts()
371 static void sc92031_enable_interrupts(struct net_device *dev) in sc92031_enable_interrupts() argument
373 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_enable_interrupts()
384 static void _sc92031_disable_tx_rx(struct net_device *dev) in _sc92031_disable_tx_rx() argument
386 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_disable_tx_rx()
395 static void _sc92031_enable_tx_rx(struct net_device *dev) in _sc92031_enable_tx_rx() argument
397 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_enable_tx_rx()
406 static void _sc92031_tx_clear(struct net_device *dev) in _sc92031_tx_clear() argument
408 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_tx_clear()
412 dev->stats.tx_dropped++; in _sc92031_tx_clear()
417 static void _sc92031_set_mar(struct net_device *dev) in _sc92031_set_mar() argument
419 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_set_mar()
423 if ((dev->flags & IFF_PROMISC) || in _sc92031_set_mar()
424 netdev_mc_count(dev) > multicast_filter_limit || in _sc92031_set_mar()
425 (dev->flags & IFF_ALLMULTI)) in _sc92031_set_mar()
427 else if (dev->flags & IFF_MULTICAST) { in _sc92031_set_mar()
430 netdev_for_each_mc_addr(ha, dev) { in _sc92031_set_mar()
455 static void _sc92031_set_rx_config(struct net_device *dev) in _sc92031_set_rx_config() argument
457 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_set_rx_config()
464 if (dev->flags & IFF_PROMISC) in _sc92031_set_rx_config()
468 if (dev->flags & (IFF_ALLMULTI | IFF_MULTICAST)) in _sc92031_set_rx_config()
471 if (dev->flags & IFF_BROADCAST) in _sc92031_set_rx_config()
478 priv->mc_flags = dev->flags & (IFF_PROMISC | IFF_ALLMULTI in _sc92031_set_rx_config()
481 if (netif_carrier_ok(dev) && priv->mc_flags != old_mc_flags) in _sc92031_set_rx_config()
485 static bool _sc92031_check_media(struct net_device *dev) in _sc92031_check_media() argument
487 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_check_media()
513 _sc92031_set_rx_config(dev); in _sc92031_check_media()
524 _sc92031_set_mar(dev); in _sc92031_check_media()
525 _sc92031_set_rx_config(dev); in _sc92031_check_media()
526 _sc92031_enable_tx_rx(dev); in _sc92031_check_media()
529 netif_carrier_on(dev); in _sc92031_check_media()
533 dev->name, in _sc92031_check_media()
540 netif_carrier_off(dev); in _sc92031_check_media()
542 _sc92031_disable_tx_rx(dev); in _sc92031_check_media()
545 printk(KERN_INFO "%s: link down\n", dev->name); in _sc92031_check_media()
550 static void _sc92031_phy_reset(struct net_device *dev) in _sc92031_phy_reset() argument
552 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_phy_reset()
590 netif_carrier_off(dev); in _sc92031_phy_reset()
591 netif_stop_queue(dev); in _sc92031_phy_reset()
594 static void _sc92031_reset(struct net_device *dev) in _sc92031_reset() argument
596 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_reset()
621 _sc92031_tx_clear(dev); in _sc92031_reset()
634 _sc92031_phy_reset(dev); in _sc92031_reset()
635 _sc92031_check_media(dev); in _sc92031_reset()
647 static void _sc92031_tx_tasklet(struct net_device *dev) in _sc92031_tx_tasklet() argument
649 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_tx_tasklet()
667 dev->stats.tx_bytes += tx_status & 0x1fff; in _sc92031_tx_tasklet()
668 dev->stats.tx_packets++; in _sc92031_tx_tasklet()
670 dev->stats.collisions += (tx_status >> 22) & 0xf; in _sc92031_tx_tasklet()
674 dev->stats.tx_errors++; in _sc92031_tx_tasklet()
677 dev->stats.tx_aborted_errors++; in _sc92031_tx_tasklet()
680 dev->stats.tx_carrier_errors++; in _sc92031_tx_tasklet()
683 dev->stats.tx_window_errors++; in _sc92031_tx_tasklet()
687 dev->stats.tx_fifo_errors++; in _sc92031_tx_tasklet()
691 if (netif_queue_stopped(dev)) in _sc92031_tx_tasklet()
692 netif_wake_queue(dev); in _sc92031_tx_tasklet()
695 static void _sc92031_rx_tasklet_error(struct net_device *dev, in _sc92031_rx_tasklet_error() argument
699 dev->stats.rx_errors++; in _sc92031_rx_tasklet_error()
700 dev->stats.rx_length_errors++; in _sc92031_rx_tasklet_error()
704 dev->stats.rx_errors++; in _sc92031_rx_tasklet_error()
707 dev->stats.rx_length_errors++; in _sc92031_rx_tasklet_error()
710 dev->stats.rx_frame_errors++; in _sc92031_rx_tasklet_error()
713 dev->stats.rx_crc_errors++; in _sc92031_rx_tasklet_error()
715 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_rx_tasklet_error()
720 static void _sc92031_rx_tasklet(struct net_device *dev) in _sc92031_rx_tasklet() argument
722 struct sc92031_priv *priv = netdev_priv(dev); in _sc92031_rx_tasklet()
752 dev->name); in _sc92031_rx_tasklet()
776 _sc92031_rx_tasklet_error(dev, rx_status, rx_size); in _sc92031_rx_tasklet()
782 printk(KERN_ERR "%s: rx_len is too small\n", dev->name); in _sc92031_rx_tasklet()
788 skb = netdev_alloc_skb_ip_align(dev, pkt_size); in _sc92031_rx_tasklet()
792 dev->name, pkt_size); in _sc92031_rx_tasklet()
805 skb->protocol = eth_type_trans(skb, dev); in _sc92031_rx_tasklet()
808 dev->stats.rx_bytes += pkt_size; in _sc92031_rx_tasklet()
809 dev->stats.rx_packets++; in _sc92031_rx_tasklet()
812 dev->stats.multicast++; in _sc92031_rx_tasklet()
823 static void _sc92031_link_tasklet(struct net_device *dev) in _sc92031_link_tasklet() argument
825 if (_sc92031_check_media(dev)) in _sc92031_link_tasklet()
826 netif_wake_queue(dev); in _sc92031_link_tasklet()
828 netif_stop_queue(dev); in _sc92031_link_tasklet()
829 dev->stats.tx_carrier_errors++; in _sc92031_link_tasklet()
836 struct net_device *dev = priv->ndev; in sc92031_tasklet() local
844 if (unlikely(!netif_running(dev))) in sc92031_tasklet()
848 _sc92031_tx_tasklet(dev); in sc92031_tasklet()
851 _sc92031_rx_tasklet(dev); in sc92031_tasklet()
854 dev->stats.rx_errors++; in sc92031_tasklet()
857 dev->stats.rx_errors++; in sc92031_tasklet()
858 dev->stats.rx_length_errors++; in sc92031_tasklet()
862 _sc92031_link_tasklet(dev); in sc92031_tasklet()
875 struct net_device *dev = dev_id; in sc92031_interrupt() local
876 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_interrupt()
906 static struct net_device_stats *sc92031_get_stats(struct net_device *dev) in sc92031_get_stats() argument
908 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_get_stats()
912 if (netif_running(dev)) { in sc92031_get_stats()
922 dev->stats.rx_fifo_errors = priv->rx_value; in sc92031_get_stats()
924 dev->stats.rx_fifo_errors = temp + priv->rx_value; in sc92031_get_stats()
929 return &dev->stats; in sc92031_get_stats()
933 struct net_device *dev) in sc92031_start_xmit() argument
935 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_start_xmit()
942 dev->stats.tx_dropped++; in sc92031_start_xmit()
948 if (unlikely(!netif_carrier_ok(dev))) { in sc92031_start_xmit()
949 dev->stats.tx_dropped++; in sc92031_start_xmit()
980 netif_stop_queue(dev); in sc92031_start_xmit()
991 static int sc92031_open(struct net_device *dev) in sc92031_open() argument
994 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_open()
997 priv->rx_ring = dma_alloc_coherent(&pdev->dev, RX_BUF_LEN, in sc92031_open()
1004 priv->tx_bufs = dma_alloc_coherent(&pdev->dev, TX_BUF_TOT_LEN, in sc92031_open()
1013 IRQF_SHARED, dev->name, dev); in sc92031_open()
1022 _sc92031_reset(dev); in sc92031_open()
1025 sc92031_enable_interrupts(dev); in sc92031_open()
1027 if (netif_carrier_ok(dev)) in sc92031_open()
1028 netif_start_queue(dev); in sc92031_open()
1030 netif_tx_disable(dev); in sc92031_open()
1035 dma_free_coherent(&pdev->dev, TX_BUF_TOT_LEN, priv->tx_bufs, in sc92031_open()
1038 dma_free_coherent(&pdev->dev, RX_BUF_LEN, priv->rx_ring, in sc92031_open()
1044 static int sc92031_stop(struct net_device *dev) in sc92031_stop() argument
1046 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_stop()
1049 netif_tx_disable(dev); in sc92031_stop()
1052 sc92031_disable_interrupts(dev); in sc92031_stop()
1056 _sc92031_disable_tx_rx(dev); in sc92031_stop()
1057 _sc92031_tx_clear(dev); in sc92031_stop()
1061 free_irq(pdev->irq, dev); in sc92031_stop()
1062 dma_free_coherent(&pdev->dev, TX_BUF_TOT_LEN, priv->tx_bufs, in sc92031_stop()
1064 dma_free_coherent(&pdev->dev, RX_BUF_LEN, priv->rx_ring, in sc92031_stop()
1070 static void sc92031_set_multicast_list(struct net_device *dev) in sc92031_set_multicast_list() argument
1072 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_set_multicast_list()
1076 _sc92031_set_mar(dev); in sc92031_set_multicast_list()
1077 _sc92031_set_rx_config(dev); in sc92031_set_multicast_list()
1082 static void sc92031_tx_timeout(struct net_device *dev, unsigned int txqueue) in sc92031_tx_timeout() argument
1084 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_tx_timeout()
1087 sc92031_disable_interrupts(dev); in sc92031_tx_timeout()
1093 _sc92031_reset(dev); in sc92031_tx_timeout()
1098 sc92031_enable_interrupts(dev); in sc92031_tx_timeout()
1100 if (netif_carrier_ok(dev)) in sc92031_tx_timeout()
1101 netif_wake_queue(dev); in sc92031_tx_timeout()
1105 static void sc92031_poll_controller(struct net_device *dev) in sc92031_poll_controller() argument
1107 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_poll_controller()
1111 if (sc92031_interrupt(irq, dev) != IRQ_NONE) in sc92031_poll_controller()
1118 sc92031_ethtool_get_link_ksettings(struct net_device *dev, in sc92031_ethtool_get_link_ksettings() argument
1121 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_ethtool_get_link_ksettings()
1181 sc92031_ethtool_set_link_ksettings(struct net_device *dev, in sc92031_ethtool_set_link_ksettings() argument
1184 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_ethtool_set_link_ksettings()
1254 static void sc92031_ethtool_get_wol(struct net_device *dev, in sc92031_ethtool_get_wol() argument
1257 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_ethtool_get_wol()
1281 static int sc92031_ethtool_set_wol(struct net_device *dev, in sc92031_ethtool_set_wol() argument
1284 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_ethtool_set_wol()
1311 static int sc92031_ethtool_nway_reset(struct net_device *dev) in sc92031_ethtool_nway_reset() argument
1314 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_ethtool_nway_reset()
1341 static void sc92031_ethtool_get_strings(struct net_device *dev, in sc92031_ethtool_get_strings() argument
1349 static int sc92031_ethtool_get_sset_count(struct net_device *dev, int sset) in sc92031_ethtool_get_sset_count() argument
1359 static void sc92031_ethtool_get_ethtool_stats(struct net_device *dev, in sc92031_ethtool_get_ethtool_stats() argument
1362 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_ethtool_get_ethtool_stats()
1401 struct net_device *dev; in sc92031_probe() local
1412 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in sc92031_probe()
1416 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); in sc92031_probe()
1430 dev = alloc_etherdev(sizeof(struct sc92031_priv)); in sc92031_probe()
1431 if (unlikely(!dev)) { in sc92031_probe()
1436 pci_set_drvdata(pdev, dev); in sc92031_probe()
1437 SET_NETDEV_DEV(dev, &pdev->dev); in sc92031_probe()
1440 dev->features = NETIF_F_SG | NETIF_F_HIGHDMA | in sc92031_probe()
1443 dev->netdev_ops = &sc92031_netdev_ops; in sc92031_probe()
1444 dev->watchdog_timeo = TX_TIMEOUT; in sc92031_probe()
1445 dev->ethtool_ops = &sc92031_ethtool_ops; in sc92031_probe()
1447 priv = netdev_priv(dev); in sc92031_probe()
1448 priv->ndev = dev; in sc92031_probe()
1468 eth_hw_addr_set(dev, addr); in sc92031_probe()
1470 err = register_netdev(dev); in sc92031_probe()
1474 printk(KERN_INFO "%s: SC92031 at 0x%lx, %pM, IRQ %d\n", dev->name, in sc92031_probe()
1475 (long)pci_resource_start(pdev, SC92031_USE_PIO), dev->dev_addr, in sc92031_probe()
1481 free_netdev(dev); in sc92031_probe()
1495 struct net_device *dev = pci_get_drvdata(pdev); in sc92031_remove() local
1496 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_remove()
1499 unregister_netdev(dev); in sc92031_remove()
1500 free_netdev(dev); in sc92031_remove()
1508 struct net_device *dev = dev_get_drvdata(dev_d); in sc92031_suspend() local
1509 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_suspend()
1511 if (!netif_running(dev)) in sc92031_suspend()
1514 netif_device_detach(dev); in sc92031_suspend()
1517 sc92031_disable_interrupts(dev); in sc92031_suspend()
1521 _sc92031_disable_tx_rx(dev); in sc92031_suspend()
1522 _sc92031_tx_clear(dev); in sc92031_suspend()
1531 struct net_device *dev = dev_get_drvdata(dev_d); in sc92031_resume() local
1532 struct sc92031_priv *priv = netdev_priv(dev); in sc92031_resume()
1534 if (!netif_running(dev)) in sc92031_resume()
1540 _sc92031_reset(dev); in sc92031_resume()
1543 sc92031_enable_interrupts(dev); in sc92031_resume()
1545 netif_device_attach(dev); in sc92031_resume()
1547 if (netif_carrier_ok(dev)) in sc92031_resume()
1548 netif_wake_queue(dev); in sc92031_resume()
1550 netif_tx_disable(dev); in sc92031_resume()