Lines Matching refs:ndev

362 	struct net_device		*ndev;  member
380 struct net_device *ndev; member
512 (priv->slaves[__slave_no__].ndev)
514 ((priv->slaves[__slave_no__].ndev) ? \
515 netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \
517 #define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \ argument
522 ndev = cpsw_get_slave_ndev(priv, 0); \
523 priv = netdev_priv(ndev); \
524 skb->dev = ndev; \
526 ndev = cpsw_get_slave_ndev(priv, 1); \
527 priv = netdev_priv(ndev); \
528 skb->dev = ndev; \
556 static void cpsw_set_promiscious(struct net_device *ndev, bool enable) in cpsw_set_promiscious() argument
558 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_promiscious()
570 if (priv->slaves[i].ndev->flags & IFF_PROMISC) in cpsw_set_promiscious()
575 …dev_err(&ndev->dev, "promiscuity not disabled as the other interface is still in promiscuity mode\… in cpsw_set_promiscious()
582 dev_dbg(&ndev->dev, "promiscuity enabled\n"); in cpsw_set_promiscious()
586 dev_dbg(&ndev->dev, "promiscuity disabled\n"); in cpsw_set_promiscious()
615 dev_dbg(&ndev->dev, "promiscuity enabled\n"); in cpsw_set_promiscious()
627 dev_dbg(&ndev->dev, "promiscuity disabled\n"); in cpsw_set_promiscious()
632 static void cpsw_ndo_set_rx_mode(struct net_device *ndev) in cpsw_ndo_set_rx_mode() argument
634 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_set_rx_mode()
642 if (ndev->flags & IFF_PROMISC) { in cpsw_ndo_set_rx_mode()
644 cpsw_set_promiscious(ndev, true); in cpsw_ndo_set_rx_mode()
649 cpsw_set_promiscious(ndev, false); in cpsw_ndo_set_rx_mode()
653 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); in cpsw_ndo_set_rx_mode()
659 if (!netdev_mc_empty(ndev)) { in cpsw_ndo_set_rx_mode()
663 netdev_for_each_mc_addr(ha, ndev) { in cpsw_ndo_set_rx_mode()
690 struct net_device *ndev = skb->dev; in cpsw_tx_handler() local
691 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_tx_handler()
696 if (unlikely(netif_queue_stopped(ndev))) in cpsw_tx_handler()
697 netif_wake_queue(ndev); in cpsw_tx_handler()
699 ndev->stats.tx_packets++; in cpsw_tx_handler()
700 ndev->stats.tx_bytes += len; in cpsw_tx_handler()
708 struct net_device *ndev = skb->dev; in cpsw_rx_handler() local
709 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_rx_handler()
712 cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); in cpsw_rx_handler()
714 if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { in cpsw_rx_handler()
722 if (netif_running(slave->ndev)) in cpsw_rx_handler()
742 new_skb = netdev_alloc_skb_ip_align(ndev, priv->rx_packet_max); in cpsw_rx_handler()
746 skb->protocol = eth_type_trans(skb, ndev); in cpsw_rx_handler()
748 ndev->stats.rx_bytes += len; in cpsw_rx_handler()
749 ndev->stats.rx_packets++; in cpsw_rx_handler()
751 ndev->stats.rx_dropped++; in cpsw_rx_handler()
788 if (netif_running(priv->ndev)) { in cpsw_rx_interrupt()
797 if (netif_running(priv->ndev)) { in cpsw_rx_interrupt()
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()
1151 slave->phy = phy_connect(priv->ndev, slave->data->phy_id, in cpsw_slave_open()
1184 if (priv->ndev->flags & IFF_ALLMULTI) in cpsw_add_default_vlan()
1224 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, in cpsw_init_host_port()
1244 static int cpsw_ndo_open(struct net_device *ndev) in cpsw_ndo_open() argument
1246 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_open()
1253 netif_carrier_off(ndev); in cpsw_ndo_open()
1297 skb = __netdev_alloc_skb_ip_align(priv->ndev, in cpsw_ndo_open()
1325 cpsw_set_coalesce(ndev, &coal); in cpsw_ndo_open()
1334 if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) { in cpsw_ndo_open()
1348 netif_carrier_off(priv->ndev); in cpsw_ndo_open()
1352 static int cpsw_ndo_stop(struct net_device *ndev) in cpsw_ndo_stop() argument
1354 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_stop()
1357 netif_stop_queue(priv->ndev); in cpsw_ndo_stop()
1359 netif_carrier_off(priv->ndev); in cpsw_ndo_stop()
1376 struct net_device *ndev) in cpsw_ndo_start_xmit() argument
1378 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_start_xmit()
1381 ndev->trans_start = jiffies; in cpsw_ndo_start_xmit()
1385 ndev->stats.tx_dropped++; in cpsw_ndo_start_xmit()
1395 ret = cpsw_tx_packet_submit(ndev, priv, skb); in cpsw_ndo_start_xmit()
1405 netif_stop_queue(ndev); in cpsw_ndo_start_xmit()
1409 ndev->stats.tx_dropped++; in cpsw_ndo_start_xmit()
1410 netif_stop_queue(ndev); in cpsw_ndo_start_xmit()
1585 static void cpsw_ndo_tx_timeout(struct net_device *ndev) in cpsw_ndo_tx_timeout() argument
1587 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_tx_timeout()
1590 ndev->stats.tx_errors++; in cpsw_ndo_tx_timeout()
1599 static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) in cpsw_ndo_set_mac_address() argument
1601 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_set_mac_address()
1620 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); in cpsw_ndo_set_mac_address()
1627 static void cpsw_ndo_poll_controller(struct net_device *ndev) in cpsw_ndo_poll_controller() argument
1629 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_poll_controller()
1650 if (priv->ndev->flags & IFF_ALLMULTI) in cpsw_add_vlan_ale_entry()
1655 if (priv->ndev->flags & IFF_ALLMULTI) in cpsw_add_vlan_ale_entry()
1671 ret = cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, in cpsw_add_vlan_ale_entry()
1685 static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, in cpsw_ndo_vlan_rx_add_vid() argument
1688 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_vlan_rx_add_vid()
1710 static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, in cpsw_ndo_vlan_rx_kill_vid() argument
1713 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_ndo_vlan_rx_kill_vid()
1738 return cpsw_ale_del_mcast(priv->ale, priv->ndev->broadcast, in cpsw_ndo_vlan_rx_kill_vid()
1759 static int cpsw_get_regs_len(struct net_device *ndev) in cpsw_get_regs_len() argument
1761 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_regs_len()
1766 static void cpsw_get_regs(struct net_device *ndev, in cpsw_get_regs() argument
1769 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_regs()
1778 static void cpsw_get_drvinfo(struct net_device *ndev, in cpsw_get_drvinfo() argument
1781 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_drvinfo()
1786 info->regdump_len = cpsw_get_regs_len(ndev); in cpsw_get_drvinfo()
1789 static u32 cpsw_get_msglevel(struct net_device *ndev) in cpsw_get_msglevel() argument
1791 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_msglevel()
1795 static void cpsw_set_msglevel(struct net_device *ndev, u32 value) in cpsw_set_msglevel() argument
1797 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_msglevel()
1801 static int cpsw_get_ts_info(struct net_device *ndev, in cpsw_get_ts_info() argument
1805 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_ts_info()
1833 static int cpsw_get_settings(struct net_device *ndev, in cpsw_get_settings() argument
1836 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_settings()
1845 static int cpsw_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd) in cpsw_set_settings() argument
1847 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_settings()
1856 static void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) in cpsw_get_wol() argument
1858 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_wol()
1868 static int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol) in cpsw_set_wol() argument
1870 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_wol()
1879 static void cpsw_get_pauseparam(struct net_device *ndev, in cpsw_get_pauseparam() argument
1882 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_get_pauseparam()
1889 static int cpsw_set_pauseparam(struct net_device *ndev, in cpsw_set_pauseparam() argument
1892 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_set_pauseparam()
2092 struct net_device *ndev; in cpsw_probe_dual_emac() local
2096 ndev = alloc_etherdev(sizeof(struct cpsw_priv)); in cpsw_probe_dual_emac()
2097 if (!ndev) { in cpsw_probe_dual_emac()
2102 priv_sl2 = netdev_priv(ndev); in cpsw_probe_dual_emac()
2106 priv_sl2->ndev = ndev; in cpsw_probe_dual_emac()
2107 priv_sl2->dev = &ndev->dev; in cpsw_probe_dual_emac()
2119 memcpy(ndev->dev_addr, priv_sl2->mac_addr, ETH_ALEN); in cpsw_probe_dual_emac()
2137 priv->slaves[1].ndev = ndev; in cpsw_probe_dual_emac()
2145 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in cpsw_probe_dual_emac()
2147 ndev->netdev_ops = &cpsw_netdev_ops; in cpsw_probe_dual_emac()
2148 ndev->ethtool_ops = &cpsw_ethtool_ops; in cpsw_probe_dual_emac()
2149 netif_napi_add(ndev, &priv_sl2->napi, cpsw_poll, CPSW_POLL_WEIGHT); in cpsw_probe_dual_emac()
2152 SET_NETDEV_DEV(ndev, &pdev->dev); in cpsw_probe_dual_emac()
2153 ret = register_netdev(ndev); in cpsw_probe_dual_emac()
2156 free_netdev(ndev); in cpsw_probe_dual_emac()
2166 struct net_device *ndev; in cpsw_probe() local
2176 ndev = alloc_etherdev(sizeof(struct cpsw_priv)); in cpsw_probe()
2177 if (!ndev) { in cpsw_probe()
2182 platform_set_drvdata(pdev, ndev); in cpsw_probe()
2183 priv = netdev_priv(ndev); in cpsw_probe()
2186 priv->ndev = ndev; in cpsw_probe()
2187 priv->dev = &ndev->dev; in cpsw_probe()
2221 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN); in cpsw_probe()
2233 priv->slaves[0].ndev = ndev; in cpsw_probe()
2344 ale_params.dev = &ndev->dev; in cpsw_probe()
2356 ndev->irq = platform_get_irq(pdev, 1); in cpsw_probe()
2357 if (ndev->irq < 0) { in cpsw_probe()
2398 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in cpsw_probe()
2400 ndev->netdev_ops = &cpsw_netdev_ops; in cpsw_probe()
2401 ndev->ethtool_ops = &cpsw_ethtool_ops; in cpsw_probe()
2402 netif_napi_add(ndev, &priv->napi, cpsw_poll, CPSW_POLL_WEIGHT); in cpsw_probe()
2405 SET_NETDEV_DEV(ndev, &pdev->dev); in cpsw_probe()
2406 ret = register_netdev(ndev); in cpsw_probe()
2414 &ss_res->start, ndev->irq); in cpsw_probe()
2435 free_netdev(priv->ndev); in cpsw_probe()
2450 struct net_device *ndev = platform_get_drvdata(pdev); in cpsw_remove() local
2451 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_remove()
2455 unregister_netdev(ndev); in cpsw_remove()
2465 free_netdev(ndev); in cpsw_remove()
2473 struct net_device *ndev = platform_get_drvdata(pdev); in cpsw_suspend() local
2474 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_suspend()
2480 if (netif_running(priv->slaves[i].ndev)) in cpsw_suspend()
2481 cpsw_ndo_stop(priv->slaves[i].ndev); in cpsw_suspend()
2485 if (netif_running(ndev)) in cpsw_suspend()
2486 cpsw_ndo_stop(ndev); in cpsw_suspend()
2501 struct net_device *ndev = platform_get_drvdata(pdev); in cpsw_resume() local
2502 struct cpsw_priv *priv = netdev_priv(ndev); in cpsw_resume()
2513 if (netif_running(priv->slaves[i].ndev)) in cpsw_resume()
2514 cpsw_ndo_open(priv->slaves[i].ndev); in cpsw_resume()
2517 if (netif_running(ndev)) in cpsw_resume()
2518 cpsw_ndo_open(ndev); in cpsw_resume()