Lines Matching refs:ndev

420 	struct net_device	*ndev;  member
460 netdev_dbg(pldat->ndev, "Ethernet MAC address %pM\n", mac); in __lpc_set_mac()
750 static void lpc_handle_link_change(struct net_device *ndev) in lpc_handle_link_change() argument
752 struct netdata_local *pldat = netdev_priv(ndev); in lpc_handle_link_change()
785 static int lpc_mii_probe(struct net_device *ndev) in lpc_mii_probe() argument
787 struct netdata_local *pldat = netdev_priv(ndev); in lpc_mii_probe()
791 netdev_err(ndev, "no PHY found\n"); in lpc_mii_probe()
797 netdev_info(ndev, "using MII interface\n"); in lpc_mii_probe()
799 netdev_info(ndev, "using RMII interface\n"); in lpc_mii_probe()
800 phydev = phy_connect(ndev, dev_name(&phydev->dev), in lpc_mii_probe()
805 netdev_err(ndev, "Could not attach to PHY\n"); in lpc_mii_probe()
819 netdev_info(ndev, in lpc_mii_probe()
868 if (lpc_mii_probe(pldat->ndev) != 0) in lpc_mii_init()
883 static void __lpc_handle_xmit(struct net_device *ndev) in __lpc_handle_xmit() argument
885 struct netdata_local *pldat = netdev_priv(ndev); in __lpc_handle_xmit()
903 ndev->stats.collisions += TXSTATUS_COLLISIONS_GET(txstat); in __lpc_handle_xmit()
909 ndev->stats.tx_fifo_errors++; in __lpc_handle_xmit()
913 ndev->stats.tx_aborted_errors++; in __lpc_handle_xmit()
917 ndev->stats.tx_aborted_errors++; in __lpc_handle_xmit()
921 ndev->stats.tx_aborted_errors++; in __lpc_handle_xmit()
923 ndev->stats.tx_errors++; in __lpc_handle_xmit()
926 ndev->stats.tx_packets++; in __lpc_handle_xmit()
927 ndev->stats.tx_bytes += skblen; in __lpc_handle_xmit()
934 if (netif_queue_stopped(ndev)) in __lpc_handle_xmit()
935 netif_wake_queue(ndev); in __lpc_handle_xmit()
939 static int __lpc_handle_recv(struct net_device *ndev, int budget) in __lpc_handle_recv() argument
941 struct netdata_local *pldat = netdev_priv(ndev); in __lpc_handle_recv()
967 ndev->stats.rx_fifo_errors++; in __lpc_handle_recv()
970 ndev->stats.rx_crc_errors++; in __lpc_handle_recv()
973 ndev->stats.rx_length_errors++; in __lpc_handle_recv()
976 ndev->stats.rx_length_errors++; in __lpc_handle_recv()
978 ndev->stats.rx_errors++; in __lpc_handle_recv()
983 ndev->stats.rx_dropped++; in __lpc_handle_recv()
992 skb->protocol = eth_type_trans(skb, ndev); in __lpc_handle_recv()
994 ndev->stats.rx_packets++; in __lpc_handle_recv()
995 ndev->stats.rx_bytes += len; in __lpc_handle_recv()
1015 struct net_device *ndev = pldat->ndev; in lpc_eth_poll() local
1017 struct netdev_queue *txq = netdev_get_tx_queue(ndev, 0); in lpc_eth_poll()
1020 __lpc_handle_xmit(ndev); in lpc_eth_poll()
1022 rx_done = __lpc_handle_recv(ndev, budget); in lpc_eth_poll()
1034 struct net_device *ndev = dev_id; in __lpc_eth_interrupt() local
1035 struct netdata_local *pldat = netdev_priv(ndev); in __lpc_eth_interrupt()
1053 static int lpc_eth_close(struct net_device *ndev) in lpc_eth_close() argument
1056 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_close()
1059 dev_dbg(&pldat->pdev->dev, "shutting down %s\n", ndev->name); in lpc_eth_close()
1062 netif_stop_queue(ndev); in lpc_eth_close()
1069 netif_carrier_off(ndev); in lpc_eth_close()
1079 static int lpc_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) in lpc_eth_hard_start_xmit() argument
1081 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_hard_start_xmit()
1093 netif_stop_queue(ndev); in lpc_eth_hard_start_xmit()
1124 netif_stop_queue(ndev); in lpc_eth_hard_start_xmit()
1132 static int lpc_set_mac_address(struct net_device *ndev, void *p) in lpc_set_mac_address() argument
1135 struct netdata_local *pldat = netdev_priv(ndev); in lpc_set_mac_address()
1140 memcpy(ndev->dev_addr, addr->sa_data, ETH_ALEN); in lpc_set_mac_address()
1145 __lpc_set_mac(pldat, ndev->dev_addr); in lpc_set_mac_address()
1152 static void lpc_eth_set_multicast_list(struct net_device *ndev) in lpc_eth_set_multicast_list() argument
1154 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_set_multicast_list()
1155 struct netdev_hw_addr_list *mcptr = &ndev->mc; in lpc_eth_set_multicast_list()
1163 __lpc_set_mac(pldat, ndev->dev_addr); in lpc_eth_set_multicast_list()
1167 if (ndev->flags & IFF_PROMISC) in lpc_eth_set_multicast_list()
1170 if (ndev->flags & IFF_ALLMULTI) in lpc_eth_set_multicast_list()
1199 static int lpc_eth_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) in lpc_eth_ioctl() argument
1201 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ioctl()
1204 if (!netif_running(ndev)) in lpc_eth_ioctl()
1213 static int lpc_eth_open(struct net_device *ndev) in lpc_eth_open() argument
1215 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_open()
1218 dev_dbg(&pldat->pdev->dev, "enabling %s\n", ndev->name); in lpc_eth_open()
1231 netif_start_queue(ndev); in lpc_eth_open()
1240 static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev, in lpc_eth_ethtool_getdrvinfo() argument
1245 strlcpy(info->bus_info, dev_name(ndev->dev.parent), in lpc_eth_ethtool_getdrvinfo()
1249 static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev) in lpc_eth_ethtool_getmsglevel() argument
1251 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_getmsglevel()
1256 static void lpc_eth_ethtool_setmsglevel(struct net_device *ndev, u32 level) in lpc_eth_ethtool_setmsglevel() argument
1258 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_setmsglevel()
1263 static int lpc_eth_ethtool_getsettings(struct net_device *ndev, in lpc_eth_ethtool_getsettings() argument
1266 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_getsettings()
1275 static int lpc_eth_ethtool_setsettings(struct net_device *ndev, in lpc_eth_ethtool_setsettings() argument
1278 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_setsettings()
1310 struct net_device *ndev; in lpc_eth_drv_probe() local
1336 ndev = alloc_etherdev(sizeof(struct netdata_local)); in lpc_eth_drv_probe()
1337 if (!ndev) { in lpc_eth_drv_probe()
1343 SET_NETDEV_DEV(ndev, &pdev->dev); in lpc_eth_drv_probe()
1345 pldat = netdev_priv(ndev); in lpc_eth_drv_probe()
1347 pldat->ndev = ndev; in lpc_eth_drv_probe()
1352 ndev->irq = irq; in lpc_eth_drv_probe()
1372 ret = request_irq(ndev->irq, __lpc_eth_interrupt, 0, in lpc_eth_drv_probe()
1373 ndev->name, ndev); in lpc_eth_drv_probe()
1380 ndev->netdev_ops = &lpc_netdev_ops; in lpc_eth_drv_probe()
1381 ndev->ethtool_ops = &lpc_eth_ethtool_ops; in lpc_eth_drv_probe()
1382 ndev->watchdog_timeo = msecs_to_jiffies(2500); in lpc_eth_drv_probe()
1395 netdev_err(ndev, in lpc_eth_drv_probe()
1419 netdev_dbg(ndev, "IO address space :%pR\n", res); in lpc_eth_drv_probe()
1420 netdev_dbg(ndev, "IO address size :%d\n", resource_size(res)); in lpc_eth_drv_probe()
1421 netdev_dbg(ndev, "IO address (mapped) :0x%p\n", in lpc_eth_drv_probe()
1423 netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq); in lpc_eth_drv_probe()
1424 netdev_dbg(ndev, "DMA buffer size :%d\n", pldat->dma_buff_size); in lpc_eth_drv_probe()
1425 netdev_dbg(ndev, "DMA buffer P address :0x%08x\n", in lpc_eth_drv_probe()
1427 netdev_dbg(ndev, "DMA buffer V address :0x%p\n", in lpc_eth_drv_probe()
1431 __lpc_get_mac(pldat, ndev->dev_addr); in lpc_eth_drv_probe()
1433 if (!is_valid_ether_addr(ndev->dev_addr)) { in lpc_eth_drv_probe()
1436 memcpy(ndev->dev_addr, macaddr, ETH_ALEN); in lpc_eth_drv_probe()
1438 if (!is_valid_ether_addr(ndev->dev_addr)) in lpc_eth_drv_probe()
1439 eth_hw_addr_random(ndev); in lpc_eth_drv_probe()
1460 netif_napi_add(ndev, &pldat->napi, lpc_eth_poll, NAPI_WEIGHT); in lpc_eth_drv_probe()
1462 ret = register_netdev(ndev); in lpc_eth_drv_probe()
1467 platform_set_drvdata(pdev, ndev); in lpc_eth_drv_probe()
1473 netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", in lpc_eth_drv_probe()
1474 res->start, ndev->irq); in lpc_eth_drv_probe()
1484 unregister_netdev(ndev); in lpc_eth_drv_probe()
1492 free_irq(ndev->irq, ndev); in lpc_eth_drv_probe()
1499 free_netdev(ndev); in lpc_eth_drv_probe()
1507 struct net_device *ndev = platform_get_drvdata(pdev); in lpc_eth_drv_remove() local
1508 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_drv_remove()
1510 unregister_netdev(ndev); in lpc_eth_drv_remove()
1517 free_irq(ndev->irq, ndev); in lpc_eth_drv_remove()
1523 free_netdev(ndev); in lpc_eth_drv_remove()
1532 struct net_device *ndev = platform_get_drvdata(pdev); in lpc_eth_drv_suspend() local
1533 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_drv_suspend()
1536 enable_irq_wake(ndev->irq); in lpc_eth_drv_suspend()
1538 if (ndev) { in lpc_eth_drv_suspend()
1539 if (netif_running(ndev)) { in lpc_eth_drv_suspend()
1540 netif_device_detach(ndev); in lpc_eth_drv_suspend()
1557 struct net_device *ndev = platform_get_drvdata(pdev); in lpc_eth_drv_resume() local
1561 disable_irq_wake(ndev->irq); in lpc_eth_drv_resume()
1563 if (ndev) { in lpc_eth_drv_resume()
1564 if (netif_running(ndev)) { in lpc_eth_drv_resume()
1565 pldat = netdev_priv(ndev); in lpc_eth_drv_resume()
1574 netif_device_attach(ndev); in lpc_eth_drv_resume()