Lines Matching full:ndev

17 	struct net_device *ndev;  in xge_get_resources()  local
24 ndev = pdata->ndev; in xge_get_resources()
39 if (device_get_ethdev_address(dev, ndev)) in xge_get_resources()
40 eth_hw_addr_random(ndev); in xge_get_resources()
42 memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); in xge_get_resources()
64 static int xge_refill_buffers(struct net_device *ndev, u32 nbuf) in xge_refill_buffers() argument
66 struct xge_pdata *pdata = netdev_priv(ndev); in xge_refill_buffers()
82 skb = netdev_alloc_skb(ndev, len); in xge_refill_buffers()
88 netdev_err(ndev, "DMA mapping error\n"); in xge_refill_buffers()
114 static int xge_init_hw(struct net_device *ndev) in xge_init_hw() argument
116 struct xge_pdata *pdata = netdev_priv(ndev); in xge_init_hw()
119 ret = xge_port_reset(ndev); in xge_init_hw()
123 xge_port_init(ndev); in xge_init_hw()
141 static int xge_request_irq(struct net_device *ndev) in xge_request_irq() argument
143 struct xge_pdata *pdata = netdev_priv(ndev); in xge_request_irq()
146 snprintf(pdata->irq_name, IRQ_ID_SIZE, "%s", ndev->name); in xge_request_irq()
151 netdev_err(ndev, "Failed to request irq %s\n", pdata->irq_name); in xge_request_irq()
156 static void xge_free_irq(struct net_device *ndev) in xge_free_irq() argument
158 struct xge_pdata *pdata = netdev_priv(ndev); in xge_free_irq()
172 static netdev_tx_t xge_start_xmit(struct sk_buff *skb, struct net_device *ndev) in xge_start_xmit() argument
174 struct xge_pdata *pdata = netdev_priv(ndev); in xge_start_xmit()
190 netif_stop_queue(ndev); in xge_start_xmit()
236 static void xge_txc_poll(struct net_device *ndev) in xge_txc_poll() argument
238 struct xge_pdata *pdata = netdev_priv(ndev); in xge_txc_poll()
279 if (netif_queue_stopped(ndev)) in xge_txc_poll()
280 netif_wake_queue(ndev); in xge_txc_poll()
285 static int xge_rx_poll(struct net_device *ndev, unsigned int budget) in xge_rx_poll() argument
287 struct xge_pdata *pdata = netdev_priv(ndev); in xge_rx_poll()
329 skb->protocol = eth_type_trans(skb, ndev); in xge_rx_poll()
335 ret = xge_refill_buffers(ndev, 1); in xge_rx_poll()
351 static void xge_delete_desc_ring(struct net_device *ndev, in xge_delete_desc_ring() argument
354 struct xge_pdata *pdata = netdev_priv(ndev); in xge_delete_desc_ring()
369 static void xge_free_buffers(struct net_device *ndev) in xge_free_buffers() argument
371 struct xge_pdata *pdata = netdev_priv(ndev); in xge_free_buffers()
391 static void xge_delete_desc_rings(struct net_device *ndev) in xge_delete_desc_rings() argument
393 struct xge_pdata *pdata = netdev_priv(ndev); in xge_delete_desc_rings()
395 xge_txc_poll(ndev); in xge_delete_desc_rings()
396 xge_delete_desc_ring(ndev, pdata->tx_ring); in xge_delete_desc_rings()
398 xge_rx_poll(ndev, 64); in xge_delete_desc_rings()
399 xge_free_buffers(ndev); in xge_delete_desc_rings()
400 xge_delete_desc_ring(ndev, pdata->rx_ring); in xge_delete_desc_rings()
403 static struct xge_desc_ring *xge_create_desc_ring(struct net_device *ndev) in xge_create_desc_ring() argument
405 struct xge_pdata *pdata = netdev_priv(ndev); in xge_create_desc_ring()
414 ring->ndev = ndev; in xge_create_desc_ring()
432 xge_delete_desc_ring(ndev, ring); in xge_create_desc_ring()
437 static int xge_create_desc_rings(struct net_device *ndev) in xge_create_desc_rings() argument
439 struct xge_pdata *pdata = netdev_priv(ndev); in xge_create_desc_rings()
444 ring = xge_create_desc_ring(ndev); in xge_create_desc_rings()
452 ring = xge_create_desc_ring(ndev); in xge_create_desc_rings()
459 ret = xge_refill_buffers(ndev, XGENE_ENET_NUM_DESC); in xge_create_desc_rings()
465 xge_delete_desc_rings(ndev); in xge_create_desc_rings()
470 static int xge_open(struct net_device *ndev) in xge_open() argument
472 struct xge_pdata *pdata = netdev_priv(ndev); in xge_open()
475 ret = xge_create_desc_rings(ndev); in xge_open()
480 ret = xge_request_irq(ndev); in xge_open()
487 phy_start(ndev->phydev); in xge_open()
489 netif_start_queue(ndev); in xge_open()
494 static int xge_close(struct net_device *ndev) in xge_close() argument
496 struct xge_pdata *pdata = netdev_priv(ndev); in xge_close()
498 netif_stop_queue(ndev); in xge_close()
500 phy_stop(ndev->phydev); in xge_close()
503 xge_free_irq(ndev); in xge_close()
505 xge_delete_desc_rings(ndev); in xge_close()
512 struct net_device *ndev = napi->dev; in xge_napi() local
516 pdata = netdev_priv(ndev); in xge_napi()
518 xge_txc_poll(ndev); in xge_napi()
519 processed = xge_rx_poll(ndev, budget); in xge_napi()
529 static int xge_set_mac_addr(struct net_device *ndev, void *addr) in xge_set_mac_addr() argument
531 struct xge_pdata *pdata = netdev_priv(ndev); in xge_set_mac_addr()
534 ret = eth_mac_addr(ndev, addr); in xge_set_mac_addr()
551 static void xge_free_pending_skb(struct net_device *ndev) in xge_free_pending_skb() argument
553 struct xge_pdata *pdata = netdev_priv(ndev); in xge_free_pending_skb()
578 static void xge_timeout(struct net_device *ndev, unsigned int txqueue) in xge_timeout() argument
580 struct xge_pdata *pdata = netdev_priv(ndev); in xge_timeout()
584 if (!netif_running(ndev)) in xge_timeout()
587 netif_stop_queue(ndev); in xge_timeout()
592 xge_txc_poll(ndev); in xge_timeout()
593 xge_free_pending_skb(ndev); in xge_timeout()
603 netif_start_queue(ndev); in xge_timeout()
609 static void xge_get_stats64(struct net_device *ndev, in xge_get_stats64() argument
612 struct xge_pdata *pdata = netdev_priv(ndev); in xge_get_stats64()
635 struct net_device *ndev; in xge_probe() local
639 ndev = alloc_etherdev(sizeof(*pdata)); in xge_probe()
640 if (!ndev) in xge_probe()
643 pdata = netdev_priv(ndev); in xge_probe()
646 pdata->ndev = ndev; in xge_probe()
647 SET_NETDEV_DEV(ndev, dev); in xge_probe()
649 ndev->netdev_ops = &xgene_ndev_ops; in xge_probe()
651 ndev->features |= NETIF_F_GSO | in xge_probe()
658 ndev->hw_features = ndev->features; in xge_probe()
659 xge_set_ethtool_ops(ndev); in xge_probe()
663 netdev_err(ndev, "No usable DMA configuration\n"); in xge_probe()
667 ret = xge_init_hw(ndev); in xge_probe()
671 ret = xge_mdio_config(ndev); in xge_probe()
675 netif_napi_add(ndev, &pdata->napi, xge_napi); in xge_probe()
677 ret = register_netdev(ndev); in xge_probe()
679 netdev_err(ndev, "Failed to register netdev\n"); in xge_probe()
686 xge_mdio_remove(ndev); in xge_probe()
688 free_netdev(ndev); in xge_probe()
696 struct net_device *ndev; in xge_remove() local
699 ndev = pdata->ndev; in xge_remove()
702 if (netif_running(ndev)) in xge_remove()
703 dev_close(ndev); in xge_remove()
706 xge_mdio_remove(ndev); in xge_remove()
707 unregister_netdev(ndev); in xge_remove()
708 free_netdev(ndev); in xge_remove()
719 if (!pdata->ndev) in xge_shutdown()