Lines Matching defs:ndev

364 	struct net_device		*ndev;
382 struct net_device *ndev;
514 (priv->slaves[__slave_no__].ndev)
516 ((priv->slaves[__slave_no__].ndev) ? \
517 netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \
519 #define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \
524 ndev = cpsw_get_slave_ndev(priv, 0); \
525 priv = netdev_priv(ndev); \
526 skb->dev = ndev; \
528 ndev = cpsw_get_slave_ndev(priv, 1); \
529 priv = netdev_priv(ndev); \
530 skb->dev = ndev; \
558 static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
560 struct cpsw_priv *priv = netdev_priv(ndev);
572 if (priv->slaves[i].ndev->flags & IFF_PROMISC)
577 dev_err(&ndev->dev, "promiscuity not disabled as the other interface is still in promiscuity mode\n");
584 dev_dbg(&ndev->dev, "promiscuity enabled\n");
588 dev_dbg(&ndev->dev, "promiscuity disabled\n");
617 dev_dbg(&ndev->dev, "promiscuity enabled\n");
629 dev_dbg(&ndev->dev, "promiscuity disabled\n");
634 static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
636 struct cpsw_priv *priv = netdev_priv(ndev);
638 if (ndev->flags & IFF_PROMISC) {
640 cpsw_set_promiscious(ndev, true);
645 cpsw_set_promiscious(ndev, false);
649 cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI);
654 if (!netdev_mc_empty(ndev)) {
658 netdev_for_each_mc_addr(ha, ndev) {
685 struct net_device *ndev = skb->dev;
686 struct cpsw_priv *priv = netdev_priv(ndev);
691 if (unlikely(netif_queue_stopped(ndev)))
692 netif_wake_queue(ndev);
694 ndev->stats.tx_packets++;
695 ndev->stats.tx_bytes += len;
703 struct net_device *ndev = skb->dev;
704 struct cpsw_priv *priv = netdev_priv(ndev);
707 cpsw_dual_emac_src_port_detect(status, priv, ndev, skb);
709 if (unlikely(status < 0) || unlikely(!netif_running(ndev))) {
717 if (netif_running(slave->ndev))
737 new_skb = netdev_alloc_skb_ip_align(ndev, priv->rx_packet_max);
741 skb->protocol = eth_type_trans(skb, ndev);
743 ndev->stats.rx_bytes += len;
744 ndev->stats.rx_packets++;
746 ndev->stats.rx_dropped++;
767 if (netif_running(priv->ndev)) {
776 if (netif_running(priv->ndev)) {
888 static void cpsw_adjust_link(struct net_device *ndev)
890 struct cpsw_priv *priv = netdev_priv(ndev);
896 netif_carrier_on(ndev);
897 if (netif_running(ndev))
898 netif_wake_queue(ndev);
900 netif_carrier_off(ndev);
901 netif_stop_queue(ndev);
905 static int cpsw_get_coalesce(struct net_device *ndev,
908 struct cpsw_priv *priv = netdev_priv(ndev);
914 static int cpsw_set_coalesce(struct net_device *ndev,
917 struct cpsw_priv *priv = netdev_priv(ndev);
970 priv = netdev_priv(priv->slaves[i].ndev);
980 static int cpsw_get_sset_count(struct net_device *ndev, int sset)
990 static void cpsw_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
1006 static void cpsw_get_ethtool_stats(struct net_device *ndev,
1009 struct cpsw_priv *priv = netdev_priv(ndev);
1058 static inline int cpsw_tx_packet_submit(struct net_device *ndev,
1065 if (ndev == cpsw_get_slave_ndev(priv, 0))
1085 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1130 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1133 slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
1166 if (priv->ndev->flags & IFF_ALLMULTI)
1206 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1226 static int cpsw_ndo_open(struct net_device *ndev)
1228 struct cpsw_priv *priv = netdev_priv(ndev);
1235 netif_carrier_off(ndev);
1279 skb = __netdev_alloc_skb_ip_align(priv->ndev,
1307 cpsw_set_coalesce(ndev, &coal);
1318 if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) {
1332 netif_carrier_off(priv->ndev);
1336 static int cpsw_ndo_stop(struct net_device *ndev)
1338 struct cpsw_priv *priv = netdev_priv(ndev);
1341 netif_stop_queue(priv->ndev);
1343 netif_carrier_off(priv->ndev);
1360 struct net_device *ndev)
1362 struct cpsw_priv *priv = netdev_priv(ndev);
1365 ndev->trans_start = jiffies;
1369 ndev->stats.tx_dropped++;
1379 ret = cpsw_tx_packet_submit(ndev, priv, skb);
1389 netif_stop_queue(ndev);
1393 ndev->stats.tx_dropped++;
1394 netif_stop_queue(ndev);
1569 static void cpsw_ndo_tx_timeout(struct net_device *ndev)
1571 struct cpsw_priv *priv = netdev_priv(ndev);
1574 ndev->stats.tx_errors++;
1586 static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
1588 struct cpsw_priv *priv = netdev_priv(ndev);
1607 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN);
1614 static void cpsw_ndo_poll_controller(struct net_device *ndev)
1616 struct cpsw_priv *priv = netdev_priv(ndev);
1620 cpsw_interrupt(ndev->irq, priv);
1635 if (priv->ndev->flags & IFF_ALLMULTI)
1652 ret = cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1667 static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
1670 struct cpsw_priv *priv = netdev_priv(ndev);
1679 static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
1682 struct cpsw_priv *priv = netdev_priv(ndev);
1698 return cpsw_ale_del_mcast(priv->ale, priv->ndev->broadcast,
1719 static int cpsw_get_regs_len(struct net_device *ndev)
1721 struct cpsw_priv *priv = netdev_priv(ndev);
1726 static void cpsw_get_regs(struct net_device *ndev,
1729 struct cpsw_priv *priv = netdev_priv(ndev);
1738 static void cpsw_get_drvinfo(struct net_device *ndev,
1741 struct cpsw_priv *priv = netdev_priv(ndev);
1746 info->regdump_len = cpsw_get_regs_len(ndev);
1749 static u32 cpsw_get_msglevel(struct net_device *ndev)
1751 struct cpsw_priv *priv = netdev_priv(ndev);
1755 static void cpsw_set_msglevel(struct net_device *ndev, u32 value)
1757 struct cpsw_priv *priv = netdev_priv(ndev);
1761 static int cpsw_get_ts_info(struct net_device *ndev,
1765 struct cpsw_priv *priv = netdev_priv(ndev);
1793 static int cpsw_get_settings(struct net_device *ndev,
1796 struct cpsw_priv *priv = netdev_priv(ndev);
1805 static int cpsw_set_settings(struct net_device *ndev, struct ethtool_cmd *ecmd)
1807 struct cpsw_priv *priv = netdev_priv(ndev);
1816 static void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
1818 struct cpsw_priv *priv = netdev_priv(ndev);
1828 static int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
1830 struct cpsw_priv *priv = netdev_priv(ndev);
1839 static void cpsw_get_pauseparam(struct net_device *ndev,
1842 struct cpsw_priv *priv = netdev_priv(ndev);
1849 static int cpsw_set_pauseparam(struct net_device *ndev,
1852 struct cpsw_priv *priv = netdev_priv(ndev);
2081 struct net_device *ndev;
2085 ndev = alloc_etherdev(sizeof(struct cpsw_priv));
2086 if (!ndev) {
2091 priv_sl2 = netdev_priv(ndev);
2095 priv_sl2->ndev = ndev;
2096 priv_sl2->dev = &ndev->dev;
2108 memcpy(ndev->dev_addr, priv_sl2->mac_addr, ETH_ALEN);
2126 priv->slaves[1].ndev = ndev;
2134 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
2136 ndev->netdev_ops = &cpsw_netdev_ops;
2137 ndev->ethtool_ops = &cpsw_ethtool_ops;
2138 netif_napi_add(ndev, &priv_sl2->napi, cpsw_poll, CPSW_POLL_WEIGHT);
2141 SET_NETDEV_DEV(ndev, &pdev->dev);
2142 ret = register_netdev(ndev);
2145 free_netdev(ndev);
2155 struct net_device *ndev;
2164 ndev = alloc_etherdev(sizeof(struct cpsw_priv));
2165 if (!ndev) {
2170 platform_set_drvdata(pdev, ndev);
2171 priv = netdev_priv(ndev);
2174 priv->ndev = ndev;
2175 priv->dev = &ndev->dev;
2209 memcpy(ndev->dev_addr, priv->mac_addr, ETH_ALEN);
2221 priv->slaves[0].ndev = ndev;
2332 ale_params.dev = &ndev->dev;
2344 ndev->irq = platform_get_irq(pdev, 0);
2345 if (ndev->irq < 0) {
2370 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
2372 ndev->netdev_ops = &cpsw_netdev_ops;
2373 ndev->ethtool_ops = &cpsw_ethtool_ops;
2374 netif_napi_add(ndev, &priv->napi, cpsw_poll, CPSW_POLL_WEIGHT);
2377 SET_NETDEV_DEV(ndev, &pdev->dev);
2378 ret = register_netdev(ndev);
2386 &ss_res->start, ndev->irq);
2407 free_netdev(priv->ndev);
2422 struct net_device *ndev = platform_get_drvdata(pdev);
2423 struct cpsw_priv *priv = netdev_priv(ndev);
2427 unregister_netdev(ndev);
2437 free_netdev(ndev);
2444 struct net_device *ndev = platform_get_drvdata(pdev);
2445 struct cpsw_priv *priv = netdev_priv(ndev);
2451 if (netif_running(priv->slaves[i].ndev))
2452 cpsw_ndo_stop(priv->slaves[i].ndev);
2456 if (netif_running(ndev))
2457 cpsw_ndo_stop(ndev);
2472 struct net_device *ndev = platform_get_drvdata(pdev);
2473 struct cpsw_priv *priv = netdev_priv(ndev);
2484 if (netif_running(priv->slaves[i].ndev))
2485 cpsw_ndo_open(priv->slaves[i].ndev);
2488 if (netif_running(ndev))
2489 cpsw_ndo_open(ndev);