Lines Matching refs:ndev

325 	struct net_device *ndev;  member
391 struct device *emac_dev = &priv->ndev->dev; in emac_dump_regs()
481 static void emac_get_drvinfo(struct net_device *ndev, in emac_get_drvinfo() argument
496 static int emac_get_settings(struct net_device *ndev, in emac_get_settings() argument
499 struct emac_priv *priv = netdev_priv(ndev); in emac_get_settings()
515 static int emac_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd) in emac_set_settings() argument
517 struct emac_priv *priv = netdev_priv(ndev); in emac_set_settings()
533 static int emac_get_coalesce(struct net_device *ndev, in emac_get_coalesce() argument
536 struct emac_priv *priv = netdev_priv(ndev); in emac_get_coalesce()
551 static int emac_set_coalesce(struct net_device *ndev, in emac_set_coalesce() argument
554 struct emac_priv *priv = netdev_priv(ndev); in emac_set_coalesce()
649 struct net_device *ndev = priv->ndev; in emac_update_phystatus() local
688 if (!netif_carrier_ok(ndev)) in emac_update_phystatus()
689 netif_carrier_on(ndev); in emac_update_phystatus()
691 if (netif_running(ndev) && netif_queue_stopped(ndev)) in emac_update_phystatus()
692 netif_wake_queue(ndev); in emac_update_phystatus()
695 if (netif_carrier_ok(ndev)) in emac_update_phystatus()
696 netif_carrier_off(ndev); in emac_update_phystatus()
697 if (!netif_queue_stopped(ndev)) in emac_update_phystatus()
698 netif_stop_queue(ndev); in emac_update_phystatus()
738 struct device *emac_dev = &priv->ndev->dev; in hash_add()
823 struct device *emac_dev = &priv->ndev->dev; in emac_add_mcast()
867 static void emac_dev_mcast_set(struct net_device *ndev) in emac_dev_mcast_set() argument
870 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_mcast_set()
873 if (ndev->flags & IFF_PROMISC) { in emac_dev_mcast_set()
878 if ((ndev->flags & IFF_ALLMULTI) || in emac_dev_mcast_set()
879 netdev_mc_count(ndev) > EMAC_DEF_MAX_MULTICAST_ADDRESSES) { in emac_dev_mcast_set()
882 } else if (!netdev_mc_empty(ndev)) { in emac_dev_mcast_set()
888 netdev_for_each_mc_addr(ha, ndev) { in emac_dev_mcast_set()
984 struct net_device *ndev = (struct net_device *)dev_id; in emac_irq() local
985 struct emac_priv *priv = netdev_priv(ndev); in emac_irq()
988 if (likely(netif_running(priv->ndev))) { in emac_irq()
999 struct sk_buff *skb = netdev_alloc_skb(priv->ndev, priv->rx_buf_size); in emac_rx_alloc()
1009 struct net_device *ndev = skb->dev; in emac_rx_handler() local
1010 struct emac_priv *priv = netdev_priv(ndev); in emac_rx_handler()
1011 struct device *emac_dev = &ndev->dev; in emac_rx_handler()
1015 if (unlikely(!netif_running(ndev))) { in emac_rx_handler()
1022 ndev->stats.rx_errors++; in emac_rx_handler()
1028 skb->protocol = eth_type_trans(skb, ndev); in emac_rx_handler()
1030 ndev->stats.rx_bytes += len; in emac_rx_handler()
1031 ndev->stats.rx_packets++; in emac_rx_handler()
1053 struct net_device *ndev = skb->dev; in emac_tx_handler() local
1058 if (unlikely(netif_queue_stopped(ndev))) in emac_tx_handler()
1059 netif_wake_queue(ndev); in emac_tx_handler()
1060 ndev->stats.tx_packets++; in emac_tx_handler()
1061 ndev->stats.tx_bytes += len; in emac_tx_handler()
1075 static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) in emac_dev_xmit() argument
1077 struct device *emac_dev = &ndev->dev; in emac_dev_xmit()
1079 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_xmit()
1109 netif_stop_queue(ndev); in emac_dev_xmit()
1114 ndev->stats.tx_dropped++; in emac_dev_xmit()
1115 netif_stop_queue(ndev); in emac_dev_xmit()
1129 static void emac_dev_tx_timeout(struct net_device *ndev) in emac_dev_tx_timeout() argument
1131 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_tx_timeout()
1132 struct device *emac_dev = &ndev->dev; in emac_dev_tx_timeout()
1139 ndev->stats.tx_errors++; in emac_dev_tx_timeout()
1233 struct device *emac_dev = &priv->ndev->dev; in emac_setmac()
1259 static int emac_dev_setmac_addr(struct net_device *ndev, void *addr) in emac_dev_setmac_addr() argument
1261 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_setmac_addr()
1262 struct device *emac_dev = &priv->ndev->dev; in emac_dev_setmac_addr()
1269 memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); in emac_dev_setmac_addr()
1270 memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); in emac_dev_setmac_addr()
1273 if (netif_running(ndev)) { in emac_dev_setmac_addr()
1371 struct net_device *ndev = priv->ndev; in emac_poll() local
1372 struct device *emac_dev = &ndev->dev; in emac_poll()
1405 netif_stop_queue(ndev); in emac_poll()
1444 static void emac_poll_controller(struct net_device *ndev) in emac_poll_controller() argument
1446 struct emac_priv *priv = netdev_priv(ndev); in emac_poll_controller()
1449 emac_irq(ndev->irq, ndev); in emac_poll_controller()
1454 static void emac_adjust_link(struct net_device *ndev) in emac_adjust_link() argument
1456 struct emac_priv *priv = netdev_priv(ndev); in emac_adjust_link()
1506 static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) in emac_devioctl() argument
1508 struct emac_priv *priv = netdev_priv(ndev); in emac_devioctl()
1510 if (!(netif_running(ndev))) in emac_devioctl()
1533 static int emac_dev_open(struct net_device *ndev) in emac_dev_open() argument
1535 struct device *emac_dev = &ndev->dev; in emac_dev_open()
1541 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_open()
1551 netif_carrier_off(ndev); in emac_dev_open()
1553 ndev->dev_addr[cnt] = priv->mac_addr[cnt]; in emac_dev_open()
1579 if (request_irq(irq_num, emac_irq, 0, ndev->name, in emac_dev_open()
1580 ndev)) { in emac_dev_open()
1602 emac_set_coalesce(ndev, &coal); in emac_dev_open()
1610 priv->phydev = of_phy_connect(ndev, priv->phy_node, in emac_dev_open()
1631 priv->phydev = phy_connect(ndev, priv->phy_id, in emac_dev_open()
1662 if (!netif_running(ndev)) /* debug only - to avoid compiler warning */ in emac_dev_open()
1666 dev_notice(emac_dev, "DaVinci EMAC: Opened %s\n", ndev->name); in emac_dev_open()
1687 free_irq(m, ndev); in emac_dev_open()
1703 static int emac_dev_stop(struct net_device *ndev) in emac_dev_stop() argument
1708 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_stop()
1709 struct device *emac_dev = &ndev->dev; in emac_dev_stop()
1712 netif_stop_queue(ndev); in emac_dev_stop()
1715 netif_carrier_off(ndev); in emac_dev_stop()
1726 free_irq(irq_num, priv->ndev); in emac_dev_stop()
1731 dev_notice(emac_dev, "DaVinci EMAC: %s stopped\n", ndev->name); in emac_dev_stop()
1745 static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) in emac_dev_getnetstats() argument
1747 struct emac_priv *priv = netdev_priv(ndev); in emac_dev_getnetstats()
1757 return &ndev->stats; in emac_dev_getnetstats()
1769 ndev->stats.multicast += emac_read(EMAC_RXMCASTFRAMES); in emac_dev_getnetstats()
1772 ndev->stats.collisions += (emac_read(EMAC_TXCOLLISION) + in emac_dev_getnetstats()
1779 ndev->stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + in emac_dev_getnetstats()
1786 ndev->stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + in emac_dev_getnetstats()
1791 ndev->stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); in emac_dev_getnetstats()
1794 ndev->stats.tx_carrier_errors += in emac_dev_getnetstats()
1798 ndev->stats.tx_fifo_errors += emac_read(EMAC_TXUNDERRUN); in emac_dev_getnetstats()
1803 return &ndev->stats; in emac_dev_getnetstats()
1910 struct net_device *ndev; in davinci_emac_probe() local
1930 ndev = alloc_etherdev(sizeof(struct emac_priv)); in davinci_emac_probe()
1931 if (!ndev) in davinci_emac_probe()
1934 platform_set_drvdata(pdev, ndev); in davinci_emac_probe()
1935 priv = netdev_priv(ndev); in davinci_emac_probe()
1937 priv->ndev = ndev; in davinci_emac_probe()
1982 ndev->base_addr = (unsigned long)priv->remap_addr; in davinci_emac_probe()
2028 ndev->irq = res->start; in davinci_emac_probe()
2032 ether_addr_copy(ndev->dev_addr, priv->mac_addr); in davinci_emac_probe()
2036 eth_hw_addr_random(ndev); in davinci_emac_probe()
2037 memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len); in davinci_emac_probe()
2042 ndev->netdev_ops = &emac_netdev_ops; in davinci_emac_probe()
2043 ndev->ethtool_ops = &ethtool_ops; in davinci_emac_probe()
2044 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); in davinci_emac_probe()
2056 SET_NETDEV_DEV(ndev, &pdev->dev); in davinci_emac_probe()
2057 rc = register_netdev(ndev); in davinci_emac_probe()
2069 (void *)priv->emac_base_phys, ndev->irq); in davinci_emac_probe()
2082 free_netdev(ndev); in davinci_emac_probe()
2095 struct net_device *ndev = platform_get_drvdata(pdev); in davinci_emac_remove() local
2096 struct emac_priv *priv = netdev_priv(ndev); in davinci_emac_remove()
2098 dev_notice(&ndev->dev, "DaVinci EMAC: davinci_emac_remove()\n"); in davinci_emac_remove()
2106 unregister_netdev(ndev); in davinci_emac_remove()
2107 free_netdev(ndev); in davinci_emac_remove()
2115 struct net_device *ndev = platform_get_drvdata(pdev); in davinci_emac_suspend() local
2117 if (netif_running(ndev)) in davinci_emac_suspend()
2118 emac_dev_stop(ndev); in davinci_emac_suspend()
2126 struct net_device *ndev = platform_get_drvdata(pdev); in davinci_emac_resume() local
2128 if (netif_running(ndev)) in davinci_emac_resume()
2129 emac_dev_open(ndev); in davinci_emac_resume()