• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/net/

Lines Matching refs:ndev

199 static void temac_dma_bd_release(struct net_device *ndev)
201 struct temac_local *lp = netdev_priv(ndev);
208 dma_unmap_single(ndev->dev.parent, lp->rx_bd_v[i].phys,
214 dma_free_coherent(ndev->dev.parent,
218 dma_free_coherent(ndev->dev.parent,
228 static int temac_dma_bd_init(struct net_device *ndev)
230 struct temac_local *lp = netdev_priv(ndev);
236 dev_err(&ndev->dev,
242 lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
246 dev_err(&ndev->dev,
250 lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
254 dev_err(&ndev->dev,
270 skb = netdev_alloc_skb_ip_align(ndev,
274 dev_err(&ndev->dev, "alloc_skb error %d\n", i);
279 lp->rx_bd_v[i].phys = dma_map_single(ndev->dev.parent,
308 temac_dma_bd_release(ndev);
316 static int temac_set_mac_address(struct net_device *ndev, void *address)
318 struct temac_local *lp = netdev_priv(ndev);
321 memcpy(ndev->dev_addr, address, ETH_ALEN);
323 if (!is_valid_ether_addr(ndev->dev_addr))
324 random_ether_addr(ndev->dev_addr);
329 (ndev->dev_addr[0]) |
330 (ndev->dev_addr[1] << 8) |
331 (ndev->dev_addr[2] << 16) |
332 (ndev->dev_addr[3] << 24));
336 (ndev->dev_addr[4] & 0x000000ff) |
337 (ndev->dev_addr[5] << 8));
343 static int netdev_set_mac_address(struct net_device *ndev, void *p)
347 return temac_set_mac_address(ndev, addr->sa_data);
350 static void temac_set_multicast_list(struct net_device *ndev)
352 struct temac_local *lp = netdev_priv(ndev);
357 if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC) ||
358 netdev_mc_count(ndev) > MULTICAST_CAM_TABLE_NUM) {
365 ndev->flags |= IFF_PROMISC;
367 dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
368 } else if (!netdev_mc_empty(ndev)) {
372 netdev_for_each_mc_addr(ha, ndev) {
393 dev_info(&ndev->dev, "Promiscuous mode disabled.\n");
481 static u32 temac_setoptions(struct net_device *ndev, u32 options)
483 struct temac_local *lp = netdev_priv(ndev);
502 static void temac_device_reset(struct net_device *ndev)
504 struct temac_local *lp = netdev_priv(ndev);
513 dev_dbg(&ndev->dev, "%s()\n", __func__);
522 dev_err(&ndev->dev,
534 dev_err(&ndev->dev,
550 dev_err(&ndev->dev,
557 if (temac_dma_bd_init(ndev)) {
558 dev_err(&ndev->dev,
571 temac_setoptions(ndev,
574 temac_set_mac_address(ndev, NULL);
577 temac_set_multicast_list(ndev);
578 if (temac_setoptions(ndev, lp->options))
579 dev_err(&ndev->dev, "Error setting TEMAC options\n");
582 ndev->trans_start = jiffies; /* prevent tx timeout */
585 void temac_adjust_link(struct net_device *ndev)
587 struct temac_local *lp = netdev_priv(ndev);
614 static void temac_start_xmit_done(struct net_device *ndev)
616 struct temac_local *lp = netdev_priv(ndev);
624 dma_unmap_single(ndev->dev.parent, cur_p->phys, cur_p->len,
634 ndev->stats.tx_packets++;
635 ndev->stats.tx_bytes += cur_p->len;
645 netif_wake_queue(ndev);
671 static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
673 struct temac_local *lp = netdev_priv(ndev);
686 if (!netif_queue_stopped(ndev)) {
687 netif_stop_queue(ndev);
705 cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len,
715 cur_p->phys = dma_map_single(ndev->dev.parent,
737 static void ll_temac_recv(struct net_device *ndev)
739 struct temac_local *lp = netdev_priv(ndev);
758 dma_unmap_single(ndev->dev.parent, cur_p->phys, length,
762 skb->dev = ndev;
763 skb->protocol = eth_type_trans(skb, ndev);
777 ndev->stats.rx_packets++;
778 ndev->stats.rx_bytes += length;
780 new_skb = netdev_alloc_skb_ip_align(ndev,
784 dev_err(&ndev->dev, "no memory for new sk_buff\n");
790 cur_p->phys = dma_map_single(ndev->dev.parent, new_skb->data,
810 struct net_device *ndev = _ndev;
811 struct temac_local *lp = netdev_priv(ndev);
818 temac_start_xmit_done(lp->ndev);
820 dev_err(&ndev->dev, "DMA error 0x%x\n", status);
827 struct net_device *ndev = _ndev;
828 struct temac_local *lp = netdev_priv(ndev);
836 ll_temac_recv(lp->ndev);
841 static int temac_open(struct net_device *ndev)
843 struct temac_local *lp = netdev_priv(ndev);
846 dev_dbg(&ndev->dev, "temac_open()\n");
849 lp->phy_dev = of_phy_connect(lp->ndev, lp->phy_node,
859 rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev);
862 rc = request_irq(lp->rx_irq, ll_temac_rx_irq, 0, ndev->name, ndev);
866 temac_device_reset(ndev);
870 free_irq(lp->tx_irq, ndev);
879 static int temac_stop(struct net_device *ndev)
881 struct temac_local *lp = netdev_priv(ndev);
883 dev_dbg(&ndev->dev, "temac_close()\n");
885 free_irq(lp->tx_irq, ndev);
886 free_irq(lp->rx_irq, ndev);
892 temac_dma_bd_release(ndev);
899 temac_poll_controller(struct net_device *ndev)
901 struct temac_local *lp = netdev_priv(ndev);
906 ll_temac_rx_irq(lp->tx_irq, ndev);
907 ll_temac_tx_irq(lp->rx_irq, ndev);
932 struct net_device *ndev = dev_get_drvdata(dev);
933 struct temac_local *lp = netdev_priv(ndev);
960 struct net_device *ndev;
966 ndev = alloc_etherdev(sizeof(*lp));
967 if (!ndev) {
971 ether_setup(ndev);
972 dev_set_drvdata(&op->dev, ndev);
973 SET_NETDEV_DEV(ndev, &op->dev);
974 ndev->flags &= ~IFF_MULTICAST; /* clear multicast */
975 ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST;
976 ndev->netdev_ops = &temac_netdev_ops;
979 lp = netdev_priv(ndev);
980 lp->ndev = ndev;
999 ndev->features |= NETIF_F_IP_CSUM;
1047 temac_set_mac_address(ndev, (void *)addr);
1064 rc = register_netdev(lp->ndev);
1080 free_netdev(ndev);
1081 ndev = NULL;
1087 struct net_device *ndev = dev_get_drvdata(&op->dev);
1088 struct temac_local *lp = netdev_priv(ndev);
1091 unregister_netdev(ndev);
1100 free_netdev(ndev);