Lines Matching full:ndev

24 static void nps_enet_clean_rx_fifo(struct net_device *ndev, u32 frame_len)  in nps_enet_clean_rx_fifo()  argument
26 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_clean_rx_fifo()
34 static void nps_enet_read_rx_fifo(struct net_device *ndev, in nps_enet_read_rx_fifo() argument
37 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_read_rx_fifo()
62 static u32 nps_enet_rx_handler(struct net_device *ndev) in nps_enet_rx_handler() argument
66 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_rx_handler()
84 ndev->stats.rx_errors++; in nps_enet_rx_handler()
90 ndev->stats.rx_crc_errors++; in nps_enet_rx_handler()
91 ndev->stats.rx_dropped++; in nps_enet_rx_handler()
97 ndev->stats.rx_length_errors++; in nps_enet_rx_handler()
98 ndev->stats.rx_dropped++; in nps_enet_rx_handler()
106 skb = netdev_alloc_skb_ip_align(ndev, frame_len); in nps_enet_rx_handler()
108 ndev->stats.rx_errors++; in nps_enet_rx_handler()
109 ndev->stats.rx_dropped++; in nps_enet_rx_handler()
114 nps_enet_read_rx_fifo(ndev, skb->data, frame_len); in nps_enet_rx_handler()
117 skb->protocol = eth_type_trans(skb, ndev); in nps_enet_rx_handler()
120 ndev->stats.rx_packets++; in nps_enet_rx_handler()
121 ndev->stats.rx_bytes += frame_len; in nps_enet_rx_handler()
128 nps_enet_clean_rx_fifo(ndev, frame_len); in nps_enet_rx_handler()
137 static void nps_enet_tx_handler(struct net_device *ndev) in nps_enet_tx_handler() argument
139 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_tx_handler()
153 ndev->stats.tx_errors++; in nps_enet_tx_handler()
155 ndev->stats.tx_packets++; in nps_enet_tx_handler()
156 ndev->stats.tx_bytes += tx_ctrl_nt; in nps_enet_tx_handler()
162 if (netif_queue_stopped(ndev)) in nps_enet_tx_handler()
163 netif_wake_queue(ndev); in nps_enet_tx_handler()
175 struct net_device *ndev = napi->dev; in nps_enet_poll() local
176 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_poll()
179 nps_enet_tx_handler(ndev); in nps_enet_poll()
180 work_done = nps_enet_rx_handler(ndev); in nps_enet_poll()
221 struct net_device *ndev = dev_instance; in nps_enet_irq_handler() local
222 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_irq_handler()
235 static void nps_enet_set_hw_mac_address(struct net_device *ndev) in nps_enet_set_hw_mac_address() argument
237 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_set_hw_mac_address()
242 ge_mac_cfg_1_value |= ndev->dev_addr[0] << CFG_1_OCTET_0_SHIFT; in nps_enet_set_hw_mac_address()
243 ge_mac_cfg_1_value |= ndev->dev_addr[1] << CFG_1_OCTET_1_SHIFT; in nps_enet_set_hw_mac_address()
244 ge_mac_cfg_1_value |= ndev->dev_addr[2] << CFG_1_OCTET_2_SHIFT; in nps_enet_set_hw_mac_address()
245 ge_mac_cfg_1_value |= ndev->dev_addr[3] << CFG_1_OCTET_3_SHIFT; in nps_enet_set_hw_mac_address()
247 | ndev->dev_addr[4] << CFG_2_OCTET_4_SHIFT; in nps_enet_set_hw_mac_address()
249 | ndev->dev_addr[5] << CFG_2_OCTET_5_SHIFT; in nps_enet_set_hw_mac_address()
260 * @ndev: Pointer to the network device.
268 static void nps_enet_hw_reset(struct net_device *ndev) in nps_enet_hw_reset() argument
270 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_hw_reset()
291 static void nps_enet_hw_enable_control(struct net_device *ndev) in nps_enet_hw_enable_control() argument
293 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_hw_enable_control()
315 max_frame_length = ETH_HLEN + ndev->mtu + ETH_FCS_LEN; in nps_enet_hw_enable_control()
329 nps_enet_set_hw_mac_address(ndev); in nps_enet_hw_enable_control()
365 static void nps_enet_hw_disable_control(struct net_device *ndev) in nps_enet_hw_disable_control() argument
367 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_hw_disable_control()
376 static void nps_enet_send_frame(struct net_device *ndev, in nps_enet_send_frame() argument
379 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_send_frame()
404 * @ndev: Pointer to net_device structure.
413 static s32 nps_enet_set_mac_address(struct net_device *ndev, void *p) in nps_enet_set_mac_address() argument
418 if (netif_running(ndev)) in nps_enet_set_mac_address()
421 res = eth_mac_addr(ndev, p); in nps_enet_set_mac_address()
423 eth_hw_addr_set(ndev, addr->sa_data); in nps_enet_set_mac_address()
424 nps_enet_set_hw_mac_address(ndev); in nps_enet_set_mac_address()
432 * @ndev: Pointer to the network device.
436 static void nps_enet_set_rx_mode(struct net_device *ndev) in nps_enet_set_rx_mode() argument
438 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_set_rx_mode()
441 if (ndev->flags & IFF_PROMISC) { in nps_enet_set_rx_mode()
459 * @ndev: Pointer to the network device.
466 static s32 nps_enet_open(struct net_device *ndev) in nps_enet_open() argument
468 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_open()
484 nps_enet_hw_disable_control(ndev); in nps_enet_open()
488 0, "enet-rx-tx", ndev); in nps_enet_open()
495 nps_enet_hw_reset(ndev); in nps_enet_open()
496 nps_enet_hw_enable_control(ndev); in nps_enet_open()
498 netif_start_queue(ndev); in nps_enet_open()
505 * @ndev: Pointer to the network device.
509 static s32 nps_enet_stop(struct net_device *ndev) in nps_enet_stop() argument
511 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_stop()
514 netif_stop_queue(ndev); in nps_enet_stop()
515 nps_enet_hw_disable_control(ndev); in nps_enet_stop()
516 free_irq(priv->irq, ndev); in nps_enet_stop()
524 * @ndev: Pointer to net_device structure.
532 struct net_device *ndev) in nps_enet_start_xmit() argument
534 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_start_xmit()
537 netif_stop_queue(ndev); in nps_enet_start_xmit()
546 nps_enet_send_frame(ndev, skb); in nps_enet_start_xmit()
552 static void nps_enet_poll_controller(struct net_device *ndev) in nps_enet_poll_controller() argument
554 disable_irq(ndev->irq); in nps_enet_poll_controller()
555 nps_enet_irq_handler(ndev->irq, ndev); in nps_enet_poll_controller()
556 enable_irq(ndev->irq); in nps_enet_poll_controller()
574 struct net_device *ndev; in nps_enet_probe() local
581 ndev = alloc_etherdev(sizeof(struct nps_enet_priv)); in nps_enet_probe()
582 if (!ndev) in nps_enet_probe()
585 platform_set_drvdata(pdev, ndev); in nps_enet_probe()
586 SET_NETDEV_DEV(ndev, dev); in nps_enet_probe()
587 priv = netdev_priv(ndev); in nps_enet_probe()
590 ndev->netdev_ops = &nps_netdev_ops; in nps_enet_probe()
591 ndev->watchdog_timeo = (400 * HZ / 1000); in nps_enet_probe()
593 ndev->flags &= ~IFF_MULTICAST; in nps_enet_probe()
603 err = of_get_ethdev_address(dev->of_node, ndev); in nps_enet_probe()
605 eth_hw_addr_random(ndev); in nps_enet_probe()
614 netif_napi_add_weight(ndev, &priv->napi, nps_enet_poll, in nps_enet_probe()
618 err = register_netdev(ndev); in nps_enet_probe()
620 dev_err(dev, "Failed to register ndev for %s, err = 0x%08x\n", in nps_enet_probe()
621 ndev->name, (s32)err); in nps_enet_probe()
631 free_netdev(ndev); in nps_enet_probe()
638 struct net_device *ndev = platform_get_drvdata(pdev); in nps_enet_remove() local
639 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_remove()
641 unregister_netdev(ndev); in nps_enet_remove()
643 free_netdev(ndev); in nps_enet_remove()