Lines Matching refs:netdev

94 	struct net_device *netdev;  member
126 struct net_device *netdev = priv->netdev; in ftgmac100_reset_mac() local
143 netdev_err(netdev, "Hardware reset failed\n"); in ftgmac100_reset_mac()
164 netdev_err(priv->netdev, "Unknown speed %d !\n", in ftgmac100_reset_and_config_mac()
197 err = of_get_ethdev_address(priv->dev->of_node, priv->netdev); in ftgmac100_initial_mac()
202 priv->netdev->dev_addr); in ftgmac100_initial_mac()
217 eth_hw_addr_set(priv->netdev, mac); in ftgmac100_initial_mac()
220 eth_hw_addr_random(priv->netdev); in ftgmac100_initial_mac()
222 priv->netdev->dev_addr); in ftgmac100_initial_mac()
282 ftgmac100_write_mac_addr(priv, priv->netdev->dev_addr); in ftgmac100_init_hw()
341 if (priv->netdev->flags & IFF_PROMISC) in ftgmac100_start_hw()
343 if (priv->netdev->flags & IFF_ALLMULTI) in ftgmac100_start_hw()
345 else if (netdev_mc_count(priv->netdev)) in ftgmac100_start_hw()
349 if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in ftgmac100_start_hw()
367 netdev_for_each_mc_addr(ha, priv->netdev) { in ftgmac100_calc_mc_hash()
378 static void ftgmac100_set_rx_mode(struct net_device *netdev) in ftgmac100_set_rx_mode() argument
380 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_rx_mode()
386 if (!netif_running(netdev)) in ftgmac100_set_rx_mode()
400 struct net_device *netdev = priv->netdev; in ftgmac100_alloc_rx_buf() local
405 skb = netdev_alloc_skb_ip_align(netdev, RX_BUF_SIZE); in ftgmac100_alloc_rx_buf()
408 netdev_warn(netdev, "failed to allocate rx skb\n"); in ftgmac100_alloc_rx_buf()
416 netdev_err(netdev, "failed to map rx page\n"); in ftgmac100_alloc_rx_buf()
450 struct net_device *netdev = priv->netdev; in ftgmac100_rx_packet_error() local
453 netdev->stats.rx_errors++; in ftgmac100_rx_packet_error()
456 netdev->stats.rx_crc_errors++; in ftgmac100_rx_packet_error()
461 netdev->stats.rx_length_errors++; in ftgmac100_rx_packet_error()
466 struct net_device *netdev = priv->netdev; in ftgmac100_rx_packet() local
525 netdev->stats.multicast++; in ftgmac100_rx_packet()
533 if (netdev->features & NETIF_F_RXCSUM) { in ftgmac100_rx_packet()
548 if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && in ftgmac100_rx_packet()
571 skb->protocol = eth_type_trans(skb, netdev); in ftgmac100_rx_packet()
573 netdev->stats.rx_packets++; in ftgmac100_rx_packet()
574 netdev->stats.rx_bytes += size; in ftgmac100_rx_packet()
589 netdev->stats.rx_dropped++; in ftgmac100_rx_packet()
650 struct net_device *netdev = priv->netdev; in ftgmac100_tx_complete_packet() local
664 netdev->stats.tx_packets++; in ftgmac100_tx_complete_packet()
665 netdev->stats.tx_bytes += skb->len; in ftgmac100_tx_complete_packet()
681 struct net_device *netdev = priv->netdev; in ftgmac100_tx_complete() local
690 if (unlikely(netif_queue_stopped(netdev) && in ftgmac100_tx_complete()
694 txq = netdev_get_tx_queue(netdev, 0); in ftgmac100_tx_complete()
696 if (netif_queue_stopped(netdev) && in ftgmac100_tx_complete()
698 netif_wake_queue(netdev); in ftgmac100_tx_complete()
724 struct net_device *netdev) in ftgmac100_hard_start_xmit() argument
726 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_hard_start_xmit()
734 netdev->stats.tx_dropped++; in ftgmac100_hard_start_xmit()
741 netdev_dbg(netdev, "tx packet too big\n"); in ftgmac100_hard_start_xmit()
769 netdev_err(netdev, "map tx packet head failed\n"); in ftgmac100_hard_start_xmit()
840 netif_stop_queue(netdev); in ftgmac100_hard_start_xmit()
844 netif_wake_queue(netdev); in ftgmac100_hard_start_xmit()
854 netdev_err(netdev, "map tx fragment failed\n"); in ftgmac100_hard_start_xmit()
877 netdev->stats.tx_dropped++; in ftgmac100_hard_start_xmit()
1020 struct net_device *netdev = bus->priv; in ftgmac100_mdiobus_read() local
1021 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mdiobus_read()
1049 netdev_err(netdev, "mdio read timed out\n"); in ftgmac100_mdiobus_read()
1056 struct net_device *netdev = bus->priv; in ftgmac100_mdiobus_write() local
1057 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mdiobus_write()
1085 netdev_err(netdev, "mdio write timed out\n"); in ftgmac100_mdiobus_write()
1089 static void ftgmac100_get_drvinfo(struct net_device *netdev, in ftgmac100_get_drvinfo() argument
1093 strscpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); in ftgmac100_get_drvinfo()
1097 ftgmac100_get_ringparam(struct net_device *netdev, in ftgmac100_get_ringparam() argument
1102 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_get_ringparam()
1112 ftgmac100_set_ringparam(struct net_device *netdev, in ftgmac100_set_ringparam() argument
1117 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_ringparam()
1129 if (netif_running(netdev)) in ftgmac100_set_ringparam()
1135 static void ftgmac100_get_pauseparam(struct net_device *netdev, in ftgmac100_get_pauseparam() argument
1138 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_get_pauseparam()
1145 static int ftgmac100_set_pauseparam(struct net_device *netdev, in ftgmac100_set_pauseparam() argument
1148 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_pauseparam()
1149 struct phy_device *phydev = netdev->phydev; in ftgmac100_set_pauseparam()
1158 if (netif_running(netdev)) { in ftgmac100_set_pauseparam()
1180 struct net_device *netdev = dev_id; in ftgmac100_interrupt() local
1181 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_interrupt()
1191 netdev->stats.rx_over_errors++; in ftgmac100_interrupt()
1195 netdev->stats.rx_fifo_errors++; in ftgmac100_interrupt()
1199 netdev->stats.tx_fifo_errors++; in ftgmac100_interrupt()
1204 netdev_warn(netdev, in ftgmac100_interrupt()
1320 netif_start_queue(priv->netdev); in ftgmac100_init_all()
1330 struct net_device *netdev = priv->netdev; in ftgmac100_reset() local
1333 netdev_dbg(netdev, "Resetting NIC...\n"); in ftgmac100_reset()
1337 if (netdev->phydev) in ftgmac100_reset()
1338 mutex_lock(&netdev->phydev->lock); in ftgmac100_reset()
1344 if (!netif_running(netdev)) in ftgmac100_reset()
1348 netif_trans_update(netdev); in ftgmac100_reset()
1350 netif_tx_disable(netdev); in ftgmac100_reset()
1357 netdev_err(netdev, "attempting to continue...\n"); in ftgmac100_reset()
1366 netdev_dbg(netdev, "Reset done !\n"); in ftgmac100_reset()
1370 if (netdev->phydev) in ftgmac100_reset()
1371 mutex_unlock(&netdev->phydev->lock); in ftgmac100_reset()
1383 static void ftgmac100_adjust_link(struct net_device *netdev) in ftgmac100_adjust_link() argument
1385 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_adjust_link()
1386 struct phy_device *phydev = netdev->phydev; in ftgmac100_adjust_link()
1434 if (netdev->phydev) in ftgmac100_adjust_link()
1435 mutex_unlock(&netdev->phydev->lock); in ftgmac100_adjust_link()
1439 if (netdev->phydev) in ftgmac100_adjust_link()
1440 mutex_lock(&netdev->phydev->lock); in ftgmac100_adjust_link()
1444 static int ftgmac100_mii_probe(struct net_device *netdev) in ftgmac100_mii_probe() argument
1446 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mii_probe()
1473 netdev_warn(netdev, in ftgmac100_mii_probe()
1480 netdev_info(netdev, "%s: no PHY found\n", netdev->name); in ftgmac100_mii_probe()
1484 phydev = phy_connect(netdev, phydev_name(phydev), in ftgmac100_mii_probe()
1488 netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name); in ftgmac100_mii_probe()
1503 static int ftgmac100_open(struct net_device *netdev) in ftgmac100_open() argument
1505 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_open()
1511 netdev_err(netdev, "Failed to allocate descriptors\n"); in ftgmac100_open()
1535 netif_napi_add(netdev, &priv->napi, ftgmac100_poll); in ftgmac100_open()
1538 err = request_irq(netdev->irq, ftgmac100_interrupt, 0, netdev->name, netdev); in ftgmac100_open()
1540 netdev_err(netdev, "failed to request irq %d\n", netdev->irq); in ftgmac100_open()
1547 netdev_err(netdev, "Failed to allocate packet buffers\n"); in ftgmac100_open()
1551 if (netdev->phydev) { in ftgmac100_open()
1553 phy_start(netdev->phydev); in ftgmac100_open()
1557 netif_carrier_on(netdev); in ftgmac100_open()
1568 phy_stop(netdev->phydev); in ftgmac100_open()
1570 netif_stop_queue(netdev); in ftgmac100_open()
1573 free_irq(netdev->irq, netdev); in ftgmac100_open()
1582 static int ftgmac100_stop(struct net_device *netdev) in ftgmac100_stop() argument
1584 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_stop()
1597 netif_stop_queue(netdev); in ftgmac100_stop()
1600 if (netdev->phydev) in ftgmac100_stop()
1601 phy_stop(netdev->phydev); in ftgmac100_stop()
1606 free_irq(netdev->irq, netdev); in ftgmac100_stop()
1613 static void ftgmac100_tx_timeout(struct net_device *netdev, unsigned int txqueue) in ftgmac100_tx_timeout() argument
1615 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_tx_timeout()
1624 static int ftgmac100_set_features(struct net_device *netdev, in ftgmac100_set_features() argument
1627 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_features()
1628 netdev_features_t changed = netdev->features ^ features; in ftgmac100_set_features()
1630 if (!netif_running(netdev)) in ftgmac100_set_features()
1638 if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in ftgmac100_set_features()
1649 static void ftgmac100_poll_controller(struct net_device *netdev) in ftgmac100_poll_controller() argument
1654 ftgmac100_interrupt(netdev->irq, netdev); in ftgmac100_poll_controller()
1676 static int ftgmac100_setup_mdio(struct net_device *netdev) in ftgmac100_setup_mdio() argument
1678 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_setup_mdio()
1706 priv->mii_bus->priv = priv->netdev; in ftgmac100_setup_mdio()
1730 static void ftgmac100_phy_disconnect(struct net_device *netdev) in ftgmac100_phy_disconnect() argument
1732 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_phy_disconnect()
1734 if (!netdev->phydev) in ftgmac100_phy_disconnect()
1737 phy_disconnect(netdev->phydev); in ftgmac100_phy_disconnect()
1742 fixed_phy_unregister(netdev->phydev); in ftgmac100_phy_disconnect()
1745 static void ftgmac100_destroy_mdio(struct net_device *netdev) in ftgmac100_destroy_mdio() argument
1747 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_destroy_mdio()
1819 struct net_device *netdev; in ftgmac100_probe() local
1834 netdev = alloc_etherdev(sizeof(*priv)); in ftgmac100_probe()
1835 if (!netdev) { in ftgmac100_probe()
1840 SET_NETDEV_DEV(netdev, &pdev->dev); in ftgmac100_probe()
1842 netdev->ethtool_ops = &ftgmac100_ethtool_ops; in ftgmac100_probe()
1843 netdev->netdev_ops = &ftgmac100_netdev_ops; in ftgmac100_probe()
1844 netdev->watchdog_timeo = 5 * HZ; in ftgmac100_probe()
1846 platform_set_drvdata(pdev, netdev); in ftgmac100_probe()
1849 priv = netdev_priv(netdev); in ftgmac100_probe()
1850 priv->netdev = netdev; in ftgmac100_probe()
1870 netdev->irq = irq; in ftgmac100_probe()
1903 priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler); in ftgmac100_probe()
1915 err = phy_connect_direct(netdev, phydev, ftgmac100_adjust_link, in ftgmac100_probe()
1930 phy = of_phy_get_and_connect(priv->netdev, np, in ftgmac100_probe()
1950 err = ftgmac100_setup_mdio(netdev); in ftgmac100_probe()
1955 phy = of_phy_get_and_connect(priv->netdev, np, in ftgmac100_probe()
1977 err = ftgmac100_setup_mdio(netdev); in ftgmac100_probe()
1981 err = ftgmac100_mii_probe(netdev); in ftgmac100_probe()
2005 netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM | in ftgmac100_probe()
2010 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; in ftgmac100_probe()
2014 netdev->hw_features &= ~NETIF_F_HW_CSUM; in ftgmac100_probe()
2018 netdev->hw_features &= ~NETIF_F_HW_CSUM; in ftgmac100_probe()
2021 netdev->hw_features &= ~(NETIF_F_HW_CSUM | NETIF_F_RXCSUM); in ftgmac100_probe()
2022 netdev->features |= netdev->hw_features; in ftgmac100_probe()
2025 err = register_netdev(netdev); in ftgmac100_probe()
2031 netdev_info(netdev, "irq %d, mapped at %p\n", netdev->irq, priv->base); in ftgmac100_probe()
2039 ftgmac100_phy_disconnect(netdev); in ftgmac100_probe()
2043 ftgmac100_destroy_mdio(netdev); in ftgmac100_probe()
2049 free_netdev(netdev); in ftgmac100_probe()
2056 struct net_device *netdev; in ftgmac100_remove() local
2059 netdev = platform_get_drvdata(pdev); in ftgmac100_remove()
2060 priv = netdev_priv(netdev); in ftgmac100_remove()
2064 unregister_netdev(netdev); in ftgmac100_remove()
2074 ftgmac100_phy_disconnect(netdev); in ftgmac100_remove()
2075 ftgmac100_destroy_mdio(netdev); in ftgmac100_remove()
2081 free_netdev(netdev); in ftgmac100_remove()