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 err = lpc_mii_probe(pldat->ndev); in lpc_mii_init()
884 static void __lpc_handle_xmit(struct net_device *ndev) in __lpc_handle_xmit() argument
886 struct netdata_local *pldat = netdev_priv(ndev); in __lpc_handle_xmit()
904 ndev->stats.collisions += TXSTATUS_COLLISIONS_GET(txstat); in __lpc_handle_xmit()
910 ndev->stats.tx_fifo_errors++; in __lpc_handle_xmit()
914 ndev->stats.tx_aborted_errors++; in __lpc_handle_xmit()
918 ndev->stats.tx_aborted_errors++; in __lpc_handle_xmit()
922 ndev->stats.tx_aborted_errors++; in __lpc_handle_xmit()
924 ndev->stats.tx_errors++; in __lpc_handle_xmit()
927 ndev->stats.tx_packets++; in __lpc_handle_xmit()
928 ndev->stats.tx_bytes += skblen; in __lpc_handle_xmit()
935 if (netif_queue_stopped(ndev)) in __lpc_handle_xmit()
936 netif_wake_queue(ndev); in __lpc_handle_xmit()
940 static int __lpc_handle_recv(struct net_device *ndev, int budget) in __lpc_handle_recv() argument
942 struct netdata_local *pldat = netdev_priv(ndev); in __lpc_handle_recv()
968 ndev->stats.rx_fifo_errors++; in __lpc_handle_recv()
971 ndev->stats.rx_crc_errors++; in __lpc_handle_recv()
974 ndev->stats.rx_length_errors++; in __lpc_handle_recv()
977 ndev->stats.rx_length_errors++; in __lpc_handle_recv()
979 ndev->stats.rx_errors++; in __lpc_handle_recv()
984 ndev->stats.rx_dropped++; in __lpc_handle_recv()
993 skb->protocol = eth_type_trans(skb, ndev); in __lpc_handle_recv()
995 ndev->stats.rx_packets++; in __lpc_handle_recv()
996 ndev->stats.rx_bytes += len; in __lpc_handle_recv()
1016 struct net_device *ndev = pldat->ndev; in lpc_eth_poll() local
1018 struct netdev_queue *txq = netdev_get_tx_queue(ndev, 0); in lpc_eth_poll()
1021 __lpc_handle_xmit(ndev); in lpc_eth_poll()
1023 rx_done = __lpc_handle_recv(ndev, budget); in lpc_eth_poll()
1035 struct net_device *ndev = dev_id; in __lpc_eth_interrupt() local
1036 struct netdata_local *pldat = netdev_priv(ndev); in __lpc_eth_interrupt()
1054 static int lpc_eth_close(struct net_device *ndev) in lpc_eth_close() argument
1057 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_close()
1060 dev_dbg(&pldat->pdev->dev, "shutting down %s\n", ndev->name); in lpc_eth_close()
1063 netif_stop_queue(ndev); in lpc_eth_close()
1070 netif_carrier_off(ndev); in lpc_eth_close()
1080 static int lpc_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) in lpc_eth_hard_start_xmit() argument
1082 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_hard_start_xmit()
1094 netif_stop_queue(ndev); in lpc_eth_hard_start_xmit()
1125 netif_stop_queue(ndev); in lpc_eth_hard_start_xmit()
1133 static int lpc_set_mac_address(struct net_device *ndev, void *p) in lpc_set_mac_address() argument
1136 struct netdata_local *pldat = netdev_priv(ndev); in lpc_set_mac_address()
1141 memcpy(ndev->dev_addr, addr->sa_data, ETH_ALEN); in lpc_set_mac_address()
1146 __lpc_set_mac(pldat, ndev->dev_addr); in lpc_set_mac_address()
1153 static void lpc_eth_set_multicast_list(struct net_device *ndev) in lpc_eth_set_multicast_list() argument
1155 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_set_multicast_list()
1156 struct netdev_hw_addr_list *mcptr = &ndev->mc; in lpc_eth_set_multicast_list()
1164 __lpc_set_mac(pldat, ndev->dev_addr); in lpc_eth_set_multicast_list()
1168 if (ndev->flags & IFF_PROMISC) in lpc_eth_set_multicast_list()
1171 if (ndev->flags & IFF_ALLMULTI) in lpc_eth_set_multicast_list()
1200 static int lpc_eth_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) in lpc_eth_ioctl() argument
1202 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ioctl()
1205 if (!netif_running(ndev)) in lpc_eth_ioctl()
1214 static int lpc_eth_open(struct net_device *ndev) in lpc_eth_open() argument
1216 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_open()
1219 dev_dbg(&pldat->pdev->dev, "enabling %s\n", ndev->name); in lpc_eth_open()
1232 netif_start_queue(ndev); in lpc_eth_open()
1241 static void lpc_eth_ethtool_getdrvinfo(struct net_device *ndev, in lpc_eth_ethtool_getdrvinfo() argument
1246 strlcpy(info->bus_info, dev_name(ndev->dev.parent), in lpc_eth_ethtool_getdrvinfo()
1250 static u32 lpc_eth_ethtool_getmsglevel(struct net_device *ndev) in lpc_eth_ethtool_getmsglevel() argument
1252 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_getmsglevel()
1257 static void lpc_eth_ethtool_setmsglevel(struct net_device *ndev, u32 level) in lpc_eth_ethtool_setmsglevel() argument
1259 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_setmsglevel()
1264 static int lpc_eth_ethtool_getsettings(struct net_device *ndev, in lpc_eth_ethtool_getsettings() argument
1267 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_getsettings()
1276 static int lpc_eth_ethtool_setsettings(struct net_device *ndev, in lpc_eth_ethtool_setsettings() argument
1279 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_ethtool_setsettings()
1311 struct net_device *ndev; in lpc_eth_drv_probe() local
1337 ndev = alloc_etherdev(sizeof(struct netdata_local)); in lpc_eth_drv_probe()
1338 if (!ndev) { in lpc_eth_drv_probe()
1344 SET_NETDEV_DEV(ndev, &pdev->dev); in lpc_eth_drv_probe()
1346 pldat = netdev_priv(ndev); in lpc_eth_drv_probe()
1348 pldat->ndev = ndev; in lpc_eth_drv_probe()
1353 ndev->irq = irq; in lpc_eth_drv_probe()
1373 ret = request_irq(ndev->irq, __lpc_eth_interrupt, 0, in lpc_eth_drv_probe()
1374 ndev->name, ndev); in lpc_eth_drv_probe()
1381 ndev->netdev_ops = &lpc_netdev_ops; in lpc_eth_drv_probe()
1382 ndev->ethtool_ops = &lpc_eth_ethtool_ops; in lpc_eth_drv_probe()
1383 ndev->watchdog_timeo = msecs_to_jiffies(2500); in lpc_eth_drv_probe()
1396 netdev_err(ndev, in lpc_eth_drv_probe()
1420 netdev_dbg(ndev, "IO address space :%pR\n", res); in lpc_eth_drv_probe()
1421 netdev_dbg(ndev, "IO address size :%zd\n", in lpc_eth_drv_probe()
1423 netdev_dbg(ndev, "IO address (mapped) :0x%p\n", in lpc_eth_drv_probe()
1425 netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq); in lpc_eth_drv_probe()
1426 netdev_dbg(ndev, "DMA buffer size :%zd\n", pldat->dma_buff_size); in lpc_eth_drv_probe()
1427 netdev_dbg(ndev, "DMA buffer P address :%pad\n", in lpc_eth_drv_probe()
1429 netdev_dbg(ndev, "DMA buffer V address :0x%p\n", in lpc_eth_drv_probe()
1433 __lpc_get_mac(pldat, ndev->dev_addr); in lpc_eth_drv_probe()
1435 if (!is_valid_ether_addr(ndev->dev_addr)) { in lpc_eth_drv_probe()
1438 memcpy(ndev->dev_addr, macaddr, ETH_ALEN); in lpc_eth_drv_probe()
1440 if (!is_valid_ether_addr(ndev->dev_addr)) in lpc_eth_drv_probe()
1441 eth_hw_addr_random(ndev); in lpc_eth_drv_probe()
1462 netif_napi_add(ndev, &pldat->napi, lpc_eth_poll, NAPI_WEIGHT); in lpc_eth_drv_probe()
1464 ret = register_netdev(ndev); in lpc_eth_drv_probe()
1469 platform_set_drvdata(pdev, ndev); in lpc_eth_drv_probe()
1475 netdev_info(ndev, "LPC mac at 0x%08lx irq %d\n", in lpc_eth_drv_probe()
1476 (unsigned long)res->start, ndev->irq); in lpc_eth_drv_probe()
1486 unregister_netdev(ndev); in lpc_eth_drv_probe()
1494 free_irq(ndev->irq, ndev); in lpc_eth_drv_probe()
1501 free_netdev(ndev); in lpc_eth_drv_probe()
1509 struct net_device *ndev = platform_get_drvdata(pdev); in lpc_eth_drv_remove() local
1510 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_drv_remove()
1512 unregister_netdev(ndev); in lpc_eth_drv_remove()
1519 free_irq(ndev->irq, ndev); in lpc_eth_drv_remove()
1525 free_netdev(ndev); in lpc_eth_drv_remove()
1534 struct net_device *ndev = platform_get_drvdata(pdev); in lpc_eth_drv_suspend() local
1535 struct netdata_local *pldat = netdev_priv(ndev); in lpc_eth_drv_suspend()
1538 enable_irq_wake(ndev->irq); in lpc_eth_drv_suspend()
1540 if (ndev) { in lpc_eth_drv_suspend()
1541 if (netif_running(ndev)) { in lpc_eth_drv_suspend()
1542 netif_device_detach(ndev); in lpc_eth_drv_suspend()
1559 struct net_device *ndev = platform_get_drvdata(pdev); in lpc_eth_drv_resume() local
1563 disable_irq_wake(ndev->irq); in lpc_eth_drv_resume()
1565 if (ndev) { in lpc_eth_drv_resume()
1566 if (netif_running(ndev)) { in lpc_eth_drv_resume()
1567 pldat = netdev_priv(ndev); in lpc_eth_drv_resume()
1576 netif_device_attach(ndev); in lpc_eth_drv_resume()