Lines Matching refs:ndev
351 struct net_device *ndev; member
369 struct net_device *ndev; member
506 priv->slaves[__slave_no__].ndev : NULL)
509 (priv->slaves[__slave_no__].ndev)) ? \
510 netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \
512 #define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \ argument
517 ndev = cpsw_get_slave_ndev(priv, 0); \
518 priv = netdev_priv(ndev); \
519 skb->dev = ndev; \
521 ndev = cpsw_get_slave_ndev(priv, 1); \
522 priv = netdev_priv(ndev); \
523 skb->dev = ndev; \
551 static void cpsw_set_promiscious(struct net_device *ndev, bool enable) in cpsw_set_promiscious() argument
553 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_promiscious()
565 if (priv->slaves[i].ndev->flags & IFF_PROMISC) in cpsw_set_promiscious()
570 …dev_err(&ndev->dev, "promiscuity not disabled as the other interface is still in promiscuity mode\… in cpsw_set_promiscious()
577 dev_dbg(&ndev->dev, "promiscuity enabled\n"); in cpsw_set_promiscious()
581 dev_dbg(&ndev->dev, "promiscuity disabled\n"); in cpsw_set_promiscious()
610 dev_dbg(&ndev->dev, "promiscuity enabled\n"); in cpsw_set_promiscious()
622 dev_dbg(&ndev->dev, "promiscuity disabled\n"); in cpsw_set_promiscious()
627 static void cpsw_ndo_set_rx_mode(struct net_device *ndev) in cpsw_ndo_set_rx_mode() argument
629 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_set_rx_mode()
637 if (ndev->flags & IFF_PROMISC) { in cpsw_ndo_set_rx_mode()
639 cpsw_set_promiscious(ndev, true); in cpsw_ndo_set_rx_mode()
644 cpsw_set_promiscious(ndev, false); in cpsw_ndo_set_rx_mode()
648 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); in cpsw_ndo_set_rx_mode()
654 if (!netdev_mc_empty(ndev)) { in cpsw_ndo_set_rx_mode()
658 netdev_for_each_mc_addr(ha, ndev) { in cpsw_ndo_set_rx_mode()
685 struct net_device *ndev = skb->dev; in cpsw_tx_handler() local
686 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_tx_handler()
691 if (unlikely(netif_queue_stopped(ndev))) in cpsw_tx_handler()
692 netif_wake_queue(ndev); in cpsw_tx_handler()
694 ndev->stats.tx_packets++; in cpsw_tx_handler()
695 ndev->stats.tx_bytes += len; in cpsw_tx_handler()
703 struct net_device *ndev = skb->dev; in cpsw_rx_handler() local
704 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_rx_handler()
707 cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); in cpsw_rx_handler()
709 if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { in cpsw_rx_handler()
717 if (netif_running(slave->ndev)) in cpsw_rx_handler()
737 new_skb = netdev_alloc_skb_ip_align(ndev, priv->rx_packet_max); in cpsw_rx_handler()
741 skb->protocol = eth_type_trans(skb, ndev); in cpsw_rx_handler()
743 ndev->stats.rx_bytes += len; in cpsw_rx_handler()
744 ndev->stats.rx_packets++; in cpsw_rx_handler()
746 ndev->stats.rx_dropped++; in cpsw_rx_handler()
906 static void cpsw_adjust_link(struct net_device *ndev) in cpsw_adjust_link() argument
908 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_adjust_link()
914 netif_carrier_on(ndev); in cpsw_adjust_link()
915 if (netif_running(ndev)) in cpsw_adjust_link()
916 netif_wake_queue(ndev); in cpsw_adjust_link()
918 netif_carrier_off(ndev); in cpsw_adjust_link()
919 netif_stop_queue(ndev); in cpsw_adjust_link()
923 static int cpsw_get_coalesce(struct net_device *ndev, in cpsw_get_coalesce() argument
926 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_coalesce()
932 static int cpsw_set_coalesce(struct net_device *ndev, in cpsw_set_coalesce() argument
935 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_coalesce()
988 priv = netdev_priv(priv->slaves[i].ndev); in cpsw_set_coalesce()
998 static int cpsw_get_sset_count(struct net_device *ndev, int sset) in cpsw_get_sset_count() argument
1008 static void cpsw_get_strings(struct net_device *ndev, u32 stringset, u8 *data) in cpsw_get_strings() argument
1024 static void cpsw_get_ethtool_stats(struct net_device *ndev, in cpsw_get_ethtool_stats() argument
1027 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_ethtool_stats()
1076 static inline int cpsw_tx_packet_submit(struct net_device *ndev, in cpsw_tx_packet_submit() argument
1083 if (ndev == cpsw_get_slave_ndev(priv, 0)) in cpsw_tx_packet_submit()
1103 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, in cpsw_add_dual_emac_def_ale_entries()
1148 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, in cpsw_slave_open()
1152 slave->phy = of_phy_connect(priv->ndev, priv->phy_node, in cpsw_slave_open()
1155 slave->phy = phy_connect(priv->ndev, slave->data->phy_id, in cpsw_slave_open()
1188 if (priv->ndev->flags & IFF_ALLMULTI) in cpsw_add_default_vlan()
1228 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, in cpsw_init_host_port()
1248 static int cpsw_ndo_open(struct net_device *ndev) in cpsw_ndo_open() argument
1250 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_open()
1256 netif_carrier_off(ndev); in cpsw_ndo_open()
1315 skb = __netdev_alloc_skb_ip_align(priv->ndev, in cpsw_ndo_open()
1343 cpsw_set_coalesce(ndev, &coal); in cpsw_ndo_open()
1357 netif_carrier_off(priv->ndev); in cpsw_ndo_open()
1361 static int cpsw_ndo_stop(struct net_device *ndev) in cpsw_ndo_stop() argument
1363 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_stop()
1366 netif_stop_queue(priv->ndev); in cpsw_ndo_stop()
1367 netif_carrier_off(priv->ndev); in cpsw_ndo_stop()
1387 struct net_device *ndev) in cpsw_ndo_start_xmit() argument
1389 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_start_xmit()
1392 ndev->trans_start = jiffies; in cpsw_ndo_start_xmit()
1396 ndev->stats.tx_dropped++; in cpsw_ndo_start_xmit()
1406 ret = cpsw_tx_packet_submit(ndev, priv, skb); in cpsw_ndo_start_xmit()
1416 netif_stop_queue(ndev); in cpsw_ndo_start_xmit()
1420 ndev->stats.tx_dropped++; in cpsw_ndo_start_xmit()
1421 netif_stop_queue(ndev); in cpsw_ndo_start_xmit()
1596 static void cpsw_ndo_tx_timeout(struct net_device *ndev) in cpsw_ndo_tx_timeout() argument
1598 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_tx_timeout()
1601 ndev->stats.tx_errors++; in cpsw_ndo_tx_timeout()
1608 static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) in cpsw_ndo_set_mac_address() argument
1610 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_set_mac_address()
1629 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); in cpsw_ndo_set_mac_address()
1636 static void cpsw_ndo_poll_controller(struct net_device *ndev) in cpsw_ndo_poll_controller() argument
1638 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_poll_controller()
1657 if (priv->ndev->flags & IFF_ALLMULTI) in cpsw_add_vlan_ale_entry()
1662 if (priv->ndev->flags & IFF_ALLMULTI) in cpsw_add_vlan_ale_entry()
1678 ret = cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, in cpsw_add_vlan_ale_entry()
1692 static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, in cpsw_ndo_vlan_rx_add_vid() argument
1695 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_vlan_rx_add_vid()
1717 static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, in cpsw_ndo_vlan_rx_kill_vid() argument
1720 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_vlan_rx_kill_vid()
1745 return cpsw_ale_del_mcast(priv->ale, priv->ndev->broadcast, in cpsw_ndo_vlan_rx_kill_vid()
1766 static int cpsw_get_regs_len(struct net_device *ndev) in cpsw_get_regs_len() argument
1768 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_regs_len()
1773 static void cpsw_get_regs(struct net_device *ndev, in cpsw_get_regs() argument
1776 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_regs()
1785 static void cpsw_get_drvinfo(struct net_device *ndev, in cpsw_get_drvinfo() argument
1788 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_drvinfo()
1795 static u32 cpsw_get_msglevel(struct net_device *ndev) in cpsw_get_msglevel() argument
1797 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_msglevel()
1801 static void cpsw_set_msglevel(struct net_device *ndev, u32 value) in cpsw_set_msglevel() argument
1803 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_msglevel()
1807 static int cpsw_get_ts_info(struct net_device *ndev, in cpsw_get_ts_info() argument
1811 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_ts_info()
1839 static int cpsw_get_settings(struct net_device *ndev, in cpsw_get_settings() argument
1842 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_settings()
1851 static int cpsw_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd) in cpsw_set_settings() argument
1853 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_settings()
1862 static void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) in cpsw_get_wol() argument
1864 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_wol()
1874 static int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) in cpsw_set_wol() argument
1876 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_wol()
1885 static void cpsw_get_pauseparam(struct net_device *ndev, in cpsw_get_pauseparam() argument
1888 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_pauseparam()
1895 static int cpsw_set_pauseparam(struct net_device *ndev, in cpsw_set_pauseparam() argument
1898 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_pauseparam()
2118 struct net_device *ndev; in cpsw_probe_dual_emac() local
2122 ndev = alloc_etherdev(sizeof(struct cpsw_priv)); in cpsw_probe_dual_emac()
2123 if (!ndev) { in cpsw_probe_dual_emac()
2128 priv_sl2 = netdev_priv(ndev); in cpsw_probe_dual_emac()
2132 priv_sl2->ndev = ndev; in cpsw_probe_dual_emac()
2133 priv_sl2->dev = &ndev->dev; in cpsw_probe_dual_emac()
2145 memcpy(ndev->dev_addr, priv_sl2->mac_addr, ETH_ALEN); in cpsw_probe_dual_emac()
2163 priv->slaves[1].ndev = ndev; in cpsw_probe_dual_emac()
2171 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in cpsw_probe_dual_emac()
2173 ndev->netdev_ops = &cpsw_netdev_ops; in cpsw_probe_dual_emac()
2174 ndev->ethtool_ops = &cpsw_ethtool_ops; in cpsw_probe_dual_emac()
2177 SET_NETDEV_DEV(ndev, &pdev->dev); in cpsw_probe_dual_emac()
2178 ret = register_netdev(ndev); in cpsw_probe_dual_emac()
2181 free_netdev(ndev); in cpsw_probe_dual_emac()
2229 struct net_device *ndev; in cpsw_probe() local
2241 ndev = alloc_etherdev(sizeof(struct cpsw_priv)); in cpsw_probe()
2242 if (!ndev) { in cpsw_probe()
2247 platform_set_drvdata(pdev, ndev); in cpsw_probe()
2248 priv = netdev_priv(ndev); in cpsw_probe()
2251 priv->ndev = ndev; in cpsw_probe()
2252 priv->dev = &ndev->dev; in cpsw_probe()
2292 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); in cpsw_probe()
2304 priv->slaves[0].ndev = ndev; in cpsw_probe()
2415 ale_params.dev = &ndev->dev; in cpsw_probe()
2427 ndev->irq = platform_get_irq(pdev, 1); in cpsw_probe()
2428 if (ndev->irq < 0) { in cpsw_probe()
2430 ret = ndev->irq; in cpsw_probe()
2480 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in cpsw_probe()
2482 ndev->netdev_ops = &cpsw_netdev_ops; in cpsw_probe()
2483 ndev->ethtool_ops = &cpsw_ethtool_ops; in cpsw_probe()
2484 netif_napi_add(ndev, &priv->napi_rx, cpsw_rx_poll, CPSW_POLL_WEIGHT); in cpsw_probe()
2485 netif_napi_add(ndev, &priv->napi_tx, cpsw_tx_poll, CPSW_POLL_WEIGHT); in cpsw_probe()
2488 SET_NETDEV_DEV(ndev, &pdev->dev); in cpsw_probe()
2489 ret = register_netdev(ndev); in cpsw_probe()
2497 &ss_res->start, ndev->irq); in cpsw_probe()
2518 free_netdev(priv->ndev); in cpsw_probe()
2533 struct net_device *ndev = platform_get_drvdata(pdev); in cpsw_remove() local
2534 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_remove()
2538 unregister_netdev(ndev); in cpsw_remove()
2548 free_netdev(ndev); in cpsw_remove()
2556 struct net_device *ndev = platform_get_drvdata(pdev); in cpsw_suspend() local
2557 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_suspend()
2563 if (netif_running(priv->slaves[i].ndev)) in cpsw_suspend()
2564 cpsw_ndo_stop(priv->slaves[i].ndev); in cpsw_suspend()
2568 if (netif_running(ndev)) in cpsw_suspend()
2569 cpsw_ndo_stop(ndev); in cpsw_suspend()
2584 struct net_device *ndev = platform_get_drvdata(pdev); in cpsw_resume() local
2585 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_resume()
2596 if (netif_running(priv->slaves[i].ndev)) in cpsw_resume()
2597 cpsw_ndo_open(priv->slaves[i].ndev); in cpsw_resume()
2600 if (netif_running(ndev)) in cpsw_resume()
2601 cpsw_ndo_open(ndev); in cpsw_resume()