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()
187 err = of_get_ethdev_address(priv->dev->of_node, priv->netdev); in ftgmac100_initial_mac()
192 priv->netdev->dev_addr); in ftgmac100_initial_mac()
207 eth_hw_addr_set(priv->netdev, mac); in ftgmac100_initial_mac()
210 eth_hw_addr_random(priv->netdev); in ftgmac100_initial_mac()
212 priv->netdev->dev_addr); in ftgmac100_initial_mac()
272 ftgmac100_write_mac_addr(priv, priv->netdev->dev_addr); in ftgmac100_init_hw()
331 if (priv->netdev->flags & IFF_PROMISC) in ftgmac100_start_hw()
333 if (priv->netdev->flags & IFF_ALLMULTI) in ftgmac100_start_hw()
335 else if (netdev_mc_count(priv->netdev)) in ftgmac100_start_hw()
339 if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in ftgmac100_start_hw()
357 netdev_for_each_mc_addr(ha, priv->netdev) { in ftgmac100_calc_mc_hash()
368 static void ftgmac100_set_rx_mode(struct net_device *netdev) in ftgmac100_set_rx_mode() argument
370 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_rx_mode()
376 if (!netif_running(netdev)) in ftgmac100_set_rx_mode()
390 struct net_device *netdev = priv->netdev; in ftgmac100_alloc_rx_buf() local
395 skb = netdev_alloc_skb_ip_align(netdev, RX_BUF_SIZE); in ftgmac100_alloc_rx_buf()
398 netdev_warn(netdev, "failed to allocate rx skb\n"); in ftgmac100_alloc_rx_buf()
406 netdev_err(netdev, "failed to map rx page\n"); in ftgmac100_alloc_rx_buf()
440 struct net_device *netdev = priv->netdev; in ftgmac100_rx_packet_error() local
443 netdev->stats.rx_errors++; in ftgmac100_rx_packet_error()
446 netdev->stats.rx_crc_errors++; in ftgmac100_rx_packet_error()
451 netdev->stats.rx_length_errors++; in ftgmac100_rx_packet_error()
456 struct net_device *netdev = priv->netdev; in ftgmac100_rx_packet() local
515 netdev->stats.multicast++; in ftgmac100_rx_packet()
523 if (netdev->features & NETIF_F_RXCSUM) { in ftgmac100_rx_packet()
538 if ((netdev->features & NETIF_F_HW_VLAN_CTAG_RX) && in ftgmac100_rx_packet()
561 skb->protocol = eth_type_trans(skb, netdev); in ftgmac100_rx_packet()
563 netdev->stats.rx_packets++; in ftgmac100_rx_packet()
564 netdev->stats.rx_bytes += size; in ftgmac100_rx_packet()
579 netdev->stats.rx_dropped++; in ftgmac100_rx_packet()
640 struct net_device *netdev = priv->netdev; in ftgmac100_tx_complete_packet() local
654 netdev->stats.tx_packets++; in ftgmac100_tx_complete_packet()
655 netdev->stats.tx_bytes += skb->len; in ftgmac100_tx_complete_packet()
671 struct net_device *netdev = priv->netdev; in ftgmac100_tx_complete() local
680 if (unlikely(netif_queue_stopped(netdev) && in ftgmac100_tx_complete()
684 txq = netdev_get_tx_queue(netdev, 0); in ftgmac100_tx_complete()
686 if (netif_queue_stopped(netdev) && in ftgmac100_tx_complete()
688 netif_wake_queue(netdev); in ftgmac100_tx_complete()
714 struct net_device *netdev) in ftgmac100_hard_start_xmit() argument
716 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_hard_start_xmit()
724 netdev->stats.tx_dropped++; in ftgmac100_hard_start_xmit()
731 netdev_dbg(netdev, "tx packet too big\n"); in ftgmac100_hard_start_xmit()
759 netdev_err(netdev, "map tx packet head failed\n"); in ftgmac100_hard_start_xmit()
830 netif_stop_queue(netdev); in ftgmac100_hard_start_xmit()
834 netif_wake_queue(netdev); in ftgmac100_hard_start_xmit()
844 netdev_err(netdev, "map tx fragment failed\n"); in ftgmac100_hard_start_xmit()
867 netdev->stats.tx_dropped++; in ftgmac100_hard_start_xmit()
1010 struct net_device *netdev = bus->priv; in ftgmac100_mdiobus_read() local
1011 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mdiobus_read()
1039 netdev_err(netdev, "mdio read timed out\n"); in ftgmac100_mdiobus_read()
1046 struct net_device *netdev = bus->priv; in ftgmac100_mdiobus_write() local
1047 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mdiobus_write()
1075 netdev_err(netdev, "mdio write timed out\n"); in ftgmac100_mdiobus_write()
1079 static void ftgmac100_get_drvinfo(struct net_device *netdev, in ftgmac100_get_drvinfo() argument
1083 strscpy(info->bus_info, dev_name(&netdev->dev), sizeof(info->bus_info)); in ftgmac100_get_drvinfo()
1087 ftgmac100_get_ringparam(struct net_device *netdev, in ftgmac100_get_ringparam() argument
1092 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_get_ringparam()
1102 ftgmac100_set_ringparam(struct net_device *netdev, in ftgmac100_set_ringparam() argument
1107 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_ringparam()
1119 if (netif_running(netdev)) in ftgmac100_set_ringparam()
1125 static void ftgmac100_get_pauseparam(struct net_device *netdev, in ftgmac100_get_pauseparam() argument
1128 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_get_pauseparam()
1135 static int ftgmac100_set_pauseparam(struct net_device *netdev, in ftgmac100_set_pauseparam() argument
1138 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_pauseparam()
1139 struct phy_device *phydev = netdev->phydev; in ftgmac100_set_pauseparam()
1148 if (netif_running(netdev)) { in ftgmac100_set_pauseparam()
1170 struct net_device *netdev = dev_id; in ftgmac100_interrupt() local
1171 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_interrupt()
1181 netdev->stats.rx_over_errors++; in ftgmac100_interrupt()
1185 netdev->stats.rx_fifo_errors++; in ftgmac100_interrupt()
1189 netdev->stats.tx_fifo_errors++; in ftgmac100_interrupt()
1194 netdev_warn(netdev, in ftgmac100_interrupt()
1310 netif_start_queue(priv->netdev); in ftgmac100_init_all()
1320 struct net_device *netdev = priv->netdev; in ftgmac100_reset() local
1323 netdev_dbg(netdev, "Resetting NIC...\n"); in ftgmac100_reset()
1327 if (netdev->phydev) in ftgmac100_reset()
1328 mutex_lock(&netdev->phydev->lock); in ftgmac100_reset()
1334 if (!netif_running(netdev)) in ftgmac100_reset()
1338 netif_trans_update(netdev); in ftgmac100_reset()
1340 netif_tx_disable(netdev); in ftgmac100_reset()
1347 netdev_err(netdev, "attempting to continue...\n"); in ftgmac100_reset()
1356 netdev_dbg(netdev, "Reset done !\n"); in ftgmac100_reset()
1360 if (netdev->phydev) in ftgmac100_reset()
1361 mutex_unlock(&netdev->phydev->lock); in ftgmac100_reset()
1373 static void ftgmac100_adjust_link(struct net_device *netdev) in ftgmac100_adjust_link() argument
1375 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_adjust_link()
1376 struct phy_device *phydev = netdev->phydev; in ftgmac100_adjust_link()
1424 if (netdev->phydev) in ftgmac100_adjust_link()
1425 mutex_unlock(&netdev->phydev->lock); in ftgmac100_adjust_link()
1429 if (netdev->phydev) in ftgmac100_adjust_link()
1430 mutex_lock(&netdev->phydev->lock); in ftgmac100_adjust_link()
1434 static int ftgmac100_mii_probe(struct net_device *netdev) in ftgmac100_mii_probe() argument
1436 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_mii_probe()
1463 netdev_warn(netdev, in ftgmac100_mii_probe()
1470 netdev_info(netdev, "%s: no PHY found\n", netdev->name); in ftgmac100_mii_probe()
1474 phydev = phy_connect(netdev, phydev_name(phydev), in ftgmac100_mii_probe()
1478 netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name); in ftgmac100_mii_probe()
1493 static int ftgmac100_open(struct net_device *netdev) in ftgmac100_open() argument
1495 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_open()
1501 netdev_err(netdev, "Failed to allocate descriptors\n"); in ftgmac100_open()
1525 netif_napi_add(netdev, &priv->napi, ftgmac100_poll); in ftgmac100_open()
1528 err = request_irq(netdev->irq, ftgmac100_interrupt, 0, netdev->name, netdev); in ftgmac100_open()
1530 netdev_err(netdev, "failed to request irq %d\n", netdev->irq); in ftgmac100_open()
1537 netdev_err(netdev, "Failed to allocate packet buffers\n"); in ftgmac100_open()
1541 if (netdev->phydev) { in ftgmac100_open()
1543 phy_start(netdev->phydev); in ftgmac100_open()
1546 netif_carrier_on(netdev); in ftgmac100_open()
1558 netif_stop_queue(netdev); in ftgmac100_open()
1561 free_irq(netdev->irq, netdev); in ftgmac100_open()
1570 static int ftgmac100_stop(struct net_device *netdev) in ftgmac100_stop() argument
1572 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_stop()
1585 netif_stop_queue(netdev); in ftgmac100_stop()
1588 if (netdev->phydev) in ftgmac100_stop()
1589 phy_stop(netdev->phydev); in ftgmac100_stop()
1594 free_irq(netdev->irq, netdev); in ftgmac100_stop()
1601 static void ftgmac100_tx_timeout(struct net_device *netdev, unsigned int txqueue) in ftgmac100_tx_timeout() argument
1603 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_tx_timeout()
1612 static int ftgmac100_set_features(struct net_device *netdev, in ftgmac100_set_features() argument
1615 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_set_features()
1616 netdev_features_t changed = netdev->features ^ features; in ftgmac100_set_features()
1618 if (!netif_running(netdev)) in ftgmac100_set_features()
1626 if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) in ftgmac100_set_features()
1637 static void ftgmac100_poll_controller(struct net_device *netdev) in ftgmac100_poll_controller() argument
1642 ftgmac100_interrupt(netdev->irq, netdev); in ftgmac100_poll_controller()
1664 static int ftgmac100_setup_mdio(struct net_device *netdev) in ftgmac100_setup_mdio() argument
1666 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_setup_mdio()
1694 priv->mii_bus->priv = priv->netdev; in ftgmac100_setup_mdio()
1718 static void ftgmac100_phy_disconnect(struct net_device *netdev) in ftgmac100_phy_disconnect() argument
1720 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_phy_disconnect()
1722 if (!netdev->phydev) in ftgmac100_phy_disconnect()
1725 phy_disconnect(netdev->phydev); in ftgmac100_phy_disconnect()
1730 static void ftgmac100_destroy_mdio(struct net_device *netdev) in ftgmac100_destroy_mdio() argument
1732 struct ftgmac100 *priv = netdev_priv(netdev); in ftgmac100_destroy_mdio()
1804 struct net_device *netdev; in ftgmac100_probe() local
1818 netdev = alloc_etherdev(sizeof(*priv)); in ftgmac100_probe()
1819 if (!netdev) { in ftgmac100_probe()
1824 SET_NETDEV_DEV(netdev, &pdev->dev); in ftgmac100_probe()
1826 netdev->ethtool_ops = &ftgmac100_ethtool_ops; in ftgmac100_probe()
1827 netdev->netdev_ops = &ftgmac100_netdev_ops; in ftgmac100_probe()
1828 netdev->watchdog_timeo = 5 * HZ; in ftgmac100_probe()
1830 platform_set_drvdata(pdev, netdev); in ftgmac100_probe()
1833 priv = netdev_priv(netdev); in ftgmac100_probe()
1834 priv->netdev = netdev; in ftgmac100_probe()
1854 netdev->irq = irq; in ftgmac100_probe()
1887 priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler); in ftgmac100_probe()
1901 phy = of_phy_get_and_connect(priv->netdev, np, in ftgmac100_probe()
1921 err = ftgmac100_setup_mdio(netdev); in ftgmac100_probe()
1926 phy = of_phy_get_and_connect(priv->netdev, np, in ftgmac100_probe()
1948 err = ftgmac100_setup_mdio(netdev); in ftgmac100_probe()
1952 err = ftgmac100_mii_probe(netdev); in ftgmac100_probe()
1976 netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM | in ftgmac100_probe()
1981 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; in ftgmac100_probe()
1985 netdev->hw_features &= ~NETIF_F_HW_CSUM; in ftgmac100_probe()
1989 netdev->hw_features &= ~NETIF_F_HW_CSUM; in ftgmac100_probe()
1992 netdev->hw_features &= ~(NETIF_F_HW_CSUM | NETIF_F_RXCSUM); in ftgmac100_probe()
1993 netdev->features |= netdev->hw_features; in ftgmac100_probe()
1996 err = register_netdev(netdev); in ftgmac100_probe()
1998 dev_err(&pdev->dev, "Failed to register netdev\n"); in ftgmac100_probe()
2002 netdev_info(netdev, "irq %d, mapped at %p\n", netdev->irq, priv->base); in ftgmac100_probe()
2010 ftgmac100_phy_disconnect(netdev); in ftgmac100_probe()
2014 ftgmac100_destroy_mdio(netdev); in ftgmac100_probe()
2020 free_netdev(netdev); in ftgmac100_probe()
2027 struct net_device *netdev; in ftgmac100_remove() local
2030 netdev = platform_get_drvdata(pdev); in ftgmac100_remove()
2031 priv = netdev_priv(netdev); in ftgmac100_remove()
2035 unregister_netdev(netdev); in ftgmac100_remove()
2045 ftgmac100_phy_disconnect(netdev); in ftgmac100_remove()
2046 ftgmac100_destroy_mdio(netdev); in ftgmac100_remove()
2052 free_netdev(netdev); in ftgmac100_remove()