Lines Matching refs:ndev
25 static void nps_enet_clean_rx_fifo(struct net_device *ndev, u32 frame_len) in nps_enet_clean_rx_fifo() argument
27 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_clean_rx_fifo()
35 static void nps_enet_read_rx_fifo(struct net_device *ndev, in nps_enet_read_rx_fifo() argument
38 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_read_rx_fifo()
63 static u32 nps_enet_rx_handler(struct net_device *ndev) in nps_enet_rx_handler() argument
67 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_rx_handler()
85 ndev->stats.rx_errors++; in nps_enet_rx_handler()
91 ndev->stats.rx_crc_errors++; in nps_enet_rx_handler()
92 ndev->stats.rx_dropped++; in nps_enet_rx_handler()
98 ndev->stats.rx_length_errors++; in nps_enet_rx_handler()
99 ndev->stats.rx_dropped++; in nps_enet_rx_handler()
107 skb = netdev_alloc_skb_ip_align(ndev, frame_len); in nps_enet_rx_handler()
109 ndev->stats.rx_errors++; in nps_enet_rx_handler()
110 ndev->stats.rx_dropped++; in nps_enet_rx_handler()
115 nps_enet_read_rx_fifo(ndev, skb->data, frame_len); in nps_enet_rx_handler()
118 skb->protocol = eth_type_trans(skb, ndev); in nps_enet_rx_handler()
121 ndev->stats.rx_packets++; in nps_enet_rx_handler()
122 ndev->stats.rx_bytes += frame_len; in nps_enet_rx_handler()
129 nps_enet_clean_rx_fifo(ndev, frame_len); in nps_enet_rx_handler()
138 static void nps_enet_tx_handler(struct net_device *ndev) in nps_enet_tx_handler() argument
140 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_tx_handler()
154 ndev->stats.tx_errors++; in nps_enet_tx_handler()
156 ndev->stats.tx_packets++; in nps_enet_tx_handler()
157 ndev->stats.tx_bytes += tx_ctrl_nt; in nps_enet_tx_handler()
163 if (netif_queue_stopped(ndev)) in nps_enet_tx_handler()
164 netif_wake_queue(ndev); in nps_enet_tx_handler()
176 struct net_device *ndev = napi->dev; in nps_enet_poll() local
177 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_poll()
180 nps_enet_tx_handler(ndev); in nps_enet_poll()
181 work_done = nps_enet_rx_handler(ndev); in nps_enet_poll()
222 struct net_device *ndev = dev_instance; in nps_enet_irq_handler() local
223 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_irq_handler()
236 static void nps_enet_set_hw_mac_address(struct net_device *ndev) in nps_enet_set_hw_mac_address() argument
238 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_set_hw_mac_address()
243 ge_mac_cfg_1_value |= ndev->dev_addr[0] << CFG_1_OCTET_0_SHIFT; in nps_enet_set_hw_mac_address()
244 ge_mac_cfg_1_value |= ndev->dev_addr[1] << CFG_1_OCTET_1_SHIFT; in nps_enet_set_hw_mac_address()
245 ge_mac_cfg_1_value |= ndev->dev_addr[2] << CFG_1_OCTET_2_SHIFT; in nps_enet_set_hw_mac_address()
246 ge_mac_cfg_1_value |= ndev->dev_addr[3] << CFG_1_OCTET_3_SHIFT; in nps_enet_set_hw_mac_address()
248 | ndev->dev_addr[4] << CFG_2_OCTET_4_SHIFT; in nps_enet_set_hw_mac_address()
250 | ndev->dev_addr[5] << CFG_2_OCTET_5_SHIFT; in nps_enet_set_hw_mac_address()
269 static void nps_enet_hw_reset(struct net_device *ndev) in nps_enet_hw_reset() argument
271 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_hw_reset()
292 static void nps_enet_hw_enable_control(struct net_device *ndev) in nps_enet_hw_enable_control() argument
294 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_hw_enable_control()
316 max_frame_length = ETH_HLEN + ndev->mtu + ETH_FCS_LEN; in nps_enet_hw_enable_control()
330 nps_enet_set_hw_mac_address(ndev); in nps_enet_hw_enable_control()
366 static void nps_enet_hw_disable_control(struct net_device *ndev) in nps_enet_hw_disable_control() argument
368 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_hw_disable_control()
377 static void nps_enet_send_frame(struct net_device *ndev, in nps_enet_send_frame() argument
380 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_send_frame()
414 static s32 nps_enet_set_mac_address(struct net_device *ndev, void *p) in nps_enet_set_mac_address() argument
419 if (netif_running(ndev)) in nps_enet_set_mac_address()
422 res = eth_mac_addr(ndev, p); in nps_enet_set_mac_address()
424 ether_addr_copy(ndev->dev_addr, addr->sa_data); in nps_enet_set_mac_address()
425 nps_enet_set_hw_mac_address(ndev); in nps_enet_set_mac_address()
437 static void nps_enet_set_rx_mode(struct net_device *ndev) in nps_enet_set_rx_mode() argument
439 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_set_rx_mode()
442 if (ndev->flags & IFF_PROMISC) { in nps_enet_set_rx_mode()
467 static s32 nps_enet_open(struct net_device *ndev) in nps_enet_open() argument
469 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_open()
485 nps_enet_hw_disable_control(ndev); in nps_enet_open()
489 0, "enet-rx-tx", ndev); in nps_enet_open()
496 nps_enet_hw_reset(ndev); in nps_enet_open()
497 nps_enet_hw_enable_control(ndev); in nps_enet_open()
499 netif_start_queue(ndev); in nps_enet_open()
510 static s32 nps_enet_stop(struct net_device *ndev) in nps_enet_stop() argument
512 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_stop()
515 netif_stop_queue(ndev); in nps_enet_stop()
516 nps_enet_hw_disable_control(ndev); in nps_enet_stop()
517 free_irq(priv->irq, ndev); in nps_enet_stop()
533 struct net_device *ndev) in nps_enet_start_xmit() argument
535 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_start_xmit()
538 netif_stop_queue(ndev); in nps_enet_start_xmit()
547 nps_enet_send_frame(ndev, skb); in nps_enet_start_xmit()
553 static void nps_enet_poll_controller(struct net_device *ndev) in nps_enet_poll_controller() argument
555 disable_irq(ndev->irq); in nps_enet_poll_controller()
556 nps_enet_irq_handler(ndev->irq, ndev); in nps_enet_poll_controller()
557 enable_irq(ndev->irq); in nps_enet_poll_controller()
575 struct net_device *ndev; in nps_enet_probe() local
583 ndev = alloc_etherdev(sizeof(struct nps_enet_priv)); in nps_enet_probe()
584 if (!ndev) in nps_enet_probe()
587 platform_set_drvdata(pdev, ndev); in nps_enet_probe()
588 SET_NETDEV_DEV(ndev, dev); in nps_enet_probe()
589 priv = netdev_priv(ndev); in nps_enet_probe()
592 ndev->netdev_ops = &nps_netdev_ops; in nps_enet_probe()
593 ndev->watchdog_timeo = (400 * HZ / 1000); in nps_enet_probe()
595 ndev->flags &= ~IFF_MULTICAST; in nps_enet_probe()
607 ether_addr_copy(ndev->dev_addr, mac_addr); in nps_enet_probe()
609 eth_hw_addr_random(ndev); in nps_enet_probe()
619 netif_napi_add(ndev, &priv->napi, nps_enet_poll, in nps_enet_probe()
623 err = register_netdev(ndev); in nps_enet_probe()
626 ndev->name, (s32)err); in nps_enet_probe()
637 free_netdev(ndev); in nps_enet_probe()
644 struct net_device *ndev = platform_get_drvdata(pdev); in nps_enet_remove() local
645 struct nps_enet_priv *priv = netdev_priv(ndev); in nps_enet_remove()
647 unregister_netdev(ndev); in nps_enet_remove()
649 free_netdev(ndev); in nps_enet_remove()