Lines Matching full:netdev
84 struct net_device *netdev; member
116 struct net_device *netdev = priv->netdev; in ftgmac100_reset_mac() local
133 netdev_err(netdev, "Hardware reset failed\n"); in ftgmac100_reset_mac()
154 netdev_err(priv->netdev, "Unknown speed %d !\n", in ftgmac100_reset_and_config_mac()
186 if (!device_get_ethdev_address(priv->dev, priv->netdev)) { in ftgmac100_initial_mac()
188 priv->netdev->dev_addr); in ftgmac100_initial_mac()
203 eth_hw_addr_set(priv->netdev, mac); in ftgmac100_initial_mac()
206 eth_hw_addr_random(priv->netdev); in ftgmac100_initial_mac()
208 priv->netdev->dev_addr); in ftgmac100_initial_mac()
266 ftgmac100_write_mac_addr(priv, priv->netdev->dev_addr); in ftgmac100_init_hw()
325 if (priv->netdev->flags & IFF_PROMISC) in ftgmac100_start_hw()
327 if (priv->netdev->flags & IFF_ALLMULTI) in ftgmac100_start_hw()
329 else if (netdev_mc_count(priv->netdev)) in ftgmac100_start_hw()
333 if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in ftgmac100_start_hw()
351 netdev_for_each_mc_addr(ha, priv->netdev) { in ftgmac100_calc_mc_hash()
362 static void ftgmac100_set_rx_mode(struct net_device *netdev) in ftgmac100_set_rx_mode() argument
364 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_rx_mode()
370 if (!netif_running(netdev)) in ftgmac100_set_rx_mode()
384 struct net_device *netdev = priv->netdev; in ftgmac100_alloc_rx_buf() local
389 skb = netdev_alloc_skb_ip_align(netdev, RX_BUF_SIZE); in ftgmac100_alloc_rx_buf()
392 netdev_warn(netdev, "failed to allocate rx skb\n"); in ftgmac100_alloc_rx_buf()
400 netdev_err(netdev, "failed to map rx page\n"); in ftgmac100_alloc_rx_buf()
434 struct net_device *netdev = priv->netdev; in ftgmac100_rx_packet_error() local
437 netdev->stats.rx_errors++; in ftgmac100_rx_packet_error()
440 netdev->stats.rx_crc_errors++; in ftgmac100_rx_packet_error()
445 netdev->stats.rx_length_errors++; in ftgmac100_rx_packet_error()
450 struct net_device *netdev = priv->netdev; in ftgmac100_rx_packet() local
509 netdev->stats.multicast++; in ftgmac100_rx_packet()
517 if (netdev->features & NETIF_F_RXCSUM) { in ftgmac100_rx_packet()
532 if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && in ftgmac100_rx_packet()
555 skb->protocol = eth_type_trans(skb, netdev); in ftgmac100_rx_packet()
557 netdev->stats.rx_packets++; in ftgmac100_rx_packet()
558 netdev->stats.rx_bytes += size; in ftgmac100_rx_packet()
573 netdev->stats.rx_dropped++; in ftgmac100_rx_packet()
634 struct net_device *netdev = priv->netdev; in ftgmac100_tx_complete_packet() local
648 netdev->stats.tx_packets++; in ftgmac100_tx_complete_packet()
649 netdev->stats.tx_bytes += skb->len; in ftgmac100_tx_complete_packet()
660 struct net_device *netdev = priv->netdev; in ftgmac100_tx_complete() local
669 if (unlikely(netif_queue_stopped(netdev) && in ftgmac100_tx_complete()
673 txq = netdev_get_tx_queue(netdev, 0); in ftgmac100_tx_complete()
675 if (netif_queue_stopped(netdev) && in ftgmac100_tx_complete()
677 netif_wake_queue(netdev); in ftgmac100_tx_complete()
703 struct net_device *netdev) in ftgmac100_hard_start_xmit() argument
705 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_hard_start_xmit()
713 netdev->stats.tx_dropped++; in ftgmac100_hard_start_xmit()
720 netdev_dbg(netdev, "tx packet too big\n"); in ftgmac100_hard_start_xmit()
748 netdev_err(netdev, "map tx packet head failed\n"); in ftgmac100_hard_start_xmit()
814 netif_stop_queue(netdev); in ftgmac100_hard_start_xmit()
818 netif_wake_queue(netdev); in ftgmac100_hard_start_xmit()
828 netdev_err(netdev, "map tx fragment failed\n"); in ftgmac100_hard_start_xmit()
851 netdev->stats.tx_dropped++; in ftgmac100_hard_start_xmit()
994 struct net_device *netdev = bus->priv; in ftgmac100_mdiobus_read() local
995 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mdiobus_read()
1023 netdev_err(netdev, "mdio read timed out\n"); in ftgmac100_mdiobus_read()
1030 struct net_device *netdev = bus->priv; in ftgmac100_mdiobus_write() local
1031 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mdiobus_write()
1059 netdev_err(netdev, "mdio write timed out\n"); in ftgmac100_mdiobus_write()
1063 static void ftgmac100_get_drvinfo(struct net_device *netdev, in ftgmac100_get_drvinfo() argument
1067 strscpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); in ftgmac100_get_drvinfo()
1071 ftgmac100_get_ringparam(struct net_device *netdev, in ftgmac100_get_ringparam() argument
1076 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_get_ringparam()
1086 ftgmac100_set_ringparam(struct net_device *netdev, in ftgmac100_set_ringparam() argument
1091 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_ringparam()
1103 if (netif_running(netdev)) in ftgmac100_set_ringparam()
1109 static void ftgmac100_get_pauseparam(struct net_device *netdev, in ftgmac100_get_pauseparam() argument
1112 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_get_pauseparam()
1119 static int ftgmac100_set_pauseparam(struct net_device *netdev, in ftgmac100_set_pauseparam() argument
1122 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_pauseparam()
1123 struct phy_device *phydev = netdev->phydev; in ftgmac100_set_pauseparam()
1132 if (netif_running(netdev)) { in ftgmac100_set_pauseparam()
1154 struct net_device *netdev = dev_id; in ftgmac100_interrupt() local
1155 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_interrupt()
1165 netdev->stats.rx_over_errors++; in ftgmac100_interrupt()
1169 netdev->stats.rx_fifo_errors++; in ftgmac100_interrupt()
1173 netdev->stats.tx_fifo_errors++; in ftgmac100_interrupt()
1178 netdev_warn(netdev, in ftgmac100_interrupt()
1294 netif_start_queue(priv->netdev); in ftgmac100_init_all()
1304 struct net_device *netdev = priv->netdev; in ftgmac100_reset() local
1307 netdev_dbg(netdev, "Resetting NIC...\n"); in ftgmac100_reset()
1311 if (netdev->phydev) in ftgmac100_reset()
1312 mutex_lock(&netdev->phydev->lock); in ftgmac100_reset()
1318 if (!netif_running(netdev)) in ftgmac100_reset()
1322 netif_trans_update(netdev); in ftgmac100_reset()
1324 netif_tx_disable(netdev); in ftgmac100_reset()
1331 netdev_err(netdev, "attempting to continue...\n"); in ftgmac100_reset()
1340 netdev_dbg(netdev, "Reset done !\n"); in ftgmac100_reset()
1344 if (netdev->phydev) in ftgmac100_reset()
1345 mutex_unlock(&netdev->phydev->lock); in ftgmac100_reset()
1357 static void ftgmac100_adjust_link(struct net_device *netdev) in ftgmac100_adjust_link() argument
1359 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_adjust_link()
1360 struct phy_device *phydev = netdev->phydev; in ftgmac100_adjust_link()
1408 if (netdev->phydev) in ftgmac100_adjust_link()
1409 mutex_unlock(&netdev->phydev->lock); in ftgmac100_adjust_link()
1413 if (netdev->phydev) in ftgmac100_adjust_link()
1414 mutex_lock(&netdev->phydev->lock); in ftgmac100_adjust_link()
1418 static int ftgmac100_mii_probe(struct net_device *netdev) in ftgmac100_mii_probe() argument
1420 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mii_probe()
1447 netdev_warn(netdev, in ftgmac100_mii_probe()
1454 netdev_info(netdev, "%s: no PHY found\n", netdev->name); in ftgmac100_mii_probe()
1458 phydev = phy_connect(netdev, phydev_name(phydev), in ftgmac100_mii_probe()
1462 netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name); in ftgmac100_mii_probe()
1477 static int ftgmac100_open(struct net_device *netdev) in ftgmac100_open() argument
1479 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_open()
1485 netdev_err(netdev, "Failed to allocate descriptors\n"); in ftgmac100_open()
1509 netif_napi_add(netdev, &priv->napi, ftgmac100_poll); in ftgmac100_open()
1512 err = request_irq(netdev->irq, ftgmac100_interrupt, 0, netdev->name, netdev); in ftgmac100_open()
1514 netdev_err(netdev, "failed to request irq %d\n", netdev->irq); in ftgmac100_open()
1521 netdev_err(netdev, "Failed to allocate packet buffers\n"); in ftgmac100_open()
1525 if (netdev->phydev) { in ftgmac100_open()
1527 phy_start(netdev->phydev); in ftgmac100_open()
1530 netif_carrier_on(netdev); in ftgmac100_open()
1542 netif_stop_queue(netdev); in ftgmac100_open()
1545 free_irq(netdev->irq, netdev); in ftgmac100_open()
1554 static int ftgmac100_stop(struct net_device *netdev) in ftgmac100_stop() argument
1556 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_stop()
1569 netif_stop_queue(netdev); in ftgmac100_stop()
1572 if (netdev->phydev) in ftgmac100_stop()
1573 phy_stop(netdev->phydev); in ftgmac100_stop()
1578 free_irq(netdev->irq, netdev); in ftgmac100_stop()
1585 static void ftgmac100_tx_timeout(struct net_device *netdev, unsigned int txqueue) in ftgmac100_tx_timeout() argument
1587 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_tx_timeout()
1596 static int ftgmac100_set_features(struct net_device *netdev, in ftgmac100_set_features() argument
1599 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_features()
1600 netdev_features_t changed = netdev->features ^ features; in ftgmac100_set_features()
1602 if (!netif_running(netdev)) in ftgmac100_set_features()
1610 if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in ftgmac100_set_features()
1621 static void ftgmac100_poll_controller(struct net_device *netdev) in ftgmac100_poll_controller() argument
1626 ftgmac100_interrupt(netdev->irq, netdev); in ftgmac100_poll_controller()
1648 static int ftgmac100_setup_mdio(struct net_device *netdev) in ftgmac100_setup_mdio() argument
1650 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_setup_mdio()
1678 priv->mii_bus->priv = priv->netdev; in ftgmac100_setup_mdio()
1702 static void ftgmac100_phy_disconnect(struct net_device *netdev) in ftgmac100_phy_disconnect() argument
1704 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_phy_disconnect()
1706 if (!netdev->phydev) in ftgmac100_phy_disconnect()
1709 phy_disconnect(netdev->phydev); in ftgmac100_phy_disconnect()
1714 static void ftgmac100_destroy_mdio(struct net_device *netdev) in ftgmac100_destroy_mdio() argument
1716 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_destroy_mdio()
1788 struct net_device *netdev; in ftgmac100_probe() local
1802 netdev = alloc_etherdev(sizeof(*priv)); in ftgmac100_probe()
1803 if (!netdev) { in ftgmac100_probe()
1808 SET_NETDEV_DEV(netdev, &pdev->dev); in ftgmac100_probe()
1810 netdev->ethtool_ops = &ftgmac100_ethtool_ops; in ftgmac100_probe()
1811 netdev->netdev_ops = &ftgmac100_netdev_ops; in ftgmac100_probe()
1812 netdev->watchdog_timeo = 5 * HZ; in ftgmac100_probe()
1814 platform_set_drvdata(pdev, netdev); in ftgmac100_probe()
1817 priv = netdev_priv(netdev); in ftgmac100_probe()
1818 priv->netdev = netdev; in ftgmac100_probe()
1838 netdev->irq = irq; in ftgmac100_probe()
1869 priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler); in ftgmac100_probe()
1883 phy = of_phy_get_and_connect(priv->netdev, np, in ftgmac100_probe()
1903 err = ftgmac100_setup_mdio(netdev); in ftgmac100_probe()
1908 phy = of_phy_get_and_connect(priv->netdev, np, in ftgmac100_probe()
1930 err = ftgmac100_setup_mdio(netdev); in ftgmac100_probe()
1934 err = ftgmac100_mii_probe(netdev); in ftgmac100_probe()
1958 netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM | in ftgmac100_probe()
1963 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; in ftgmac100_probe()
1967 netdev->hw_features &= ~NETIF_F_HW_CSUM; in ftgmac100_probe()
1971 netdev->hw_features &= ~NETIF_F_HW_CSUM; in ftgmac100_probe()
1974 netdev->hw_features &= ~(NETIF_F_HW_CSUM | NETIF_F_RXCSUM); in ftgmac100_probe()
1975 netdev->features |= netdev->hw_features; in ftgmac100_probe()
1978 err = register_netdev(netdev); in ftgmac100_probe()
1980 dev_err(&pdev->dev, "Failed to register netdev\n"); in ftgmac100_probe()
1984 netdev_info(netdev, "irq %d, mapped at %p\n", netdev->irq, priv->base); in ftgmac100_probe()
1992 ftgmac100_phy_disconnect(netdev); in ftgmac100_probe()
1996 ftgmac100_destroy_mdio(netdev); in ftgmac100_probe()
2002 free_netdev(netdev); in ftgmac100_probe()
2009 struct net_device *netdev; in ftgmac100_remove() local
2012 netdev = platform_get_drvdata(pdev); in ftgmac100_remove()
2013 priv = netdev_priv(netdev); in ftgmac100_remove()
2017 unregister_netdev(netdev); in ftgmac100_remove()
2027 ftgmac100_phy_disconnect(netdev); in ftgmac100_remove()
2028 ftgmac100_destroy_mdio(netdev); in ftgmac100_remove()
2034 free_netdev(netdev); in ftgmac100_remove()