Lines Matching refs:ndev
76 struct net_device *ndev; member
88 struct net_device *ndev = data; in ntb_netdev_event_handler() local
89 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_event_handler()
91 netdev_dbg(ndev, "Event %x, Link %x\n", link_is_up, in ntb_netdev_event_handler()
96 netif_carrier_on(ndev); in ntb_netdev_event_handler()
98 netif_carrier_off(ndev); in ntb_netdev_event_handler()
105 struct net_device *ndev = qp_data; in ntb_netdev_rx_handler() local
113 netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len); in ntb_netdev_rx_handler()
116 ndev->stats.rx_errors++; in ntb_netdev_rx_handler()
117 ndev->stats.rx_length_errors++; in ntb_netdev_rx_handler()
122 skb->protocol = eth_type_trans(skb, ndev); in ntb_netdev_rx_handler()
126 ndev->stats.rx_errors++; in ntb_netdev_rx_handler()
127 ndev->stats.rx_dropped++; in ntb_netdev_rx_handler()
129 ndev->stats.rx_packets++; in ntb_netdev_rx_handler()
130 ndev->stats.rx_bytes += len; in ntb_netdev_rx_handler()
133 skb = netdev_alloc_skb(ndev, ndev->mtu + ETH_HLEN); in ntb_netdev_rx_handler()
135 ndev->stats.rx_errors++; in ntb_netdev_rx_handler()
136 ndev->stats.rx_frame_errors++; in ntb_netdev_rx_handler()
141 rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN); in ntb_netdev_rx_handler()
144 ndev->stats.rx_errors++; in ntb_netdev_rx_handler()
145 ndev->stats.rx_fifo_errors++; in ntb_netdev_rx_handler()
169 static int ntb_netdev_maybe_stop_tx(struct net_device *ndev, in ntb_netdev_maybe_stop_tx() argument
172 if (netif_queue_stopped(ndev) || in ntb_netdev_maybe_stop_tx()
176 return __ntb_netdev_maybe_stop_tx(ndev, qp, size); in ntb_netdev_maybe_stop_tx()
182 struct net_device *ndev = qp_data; in ntb_netdev_tx_handler() local
184 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_tx_handler()
187 if (!skb || !ndev) in ntb_netdev_tx_handler()
191 ndev->stats.tx_packets++; in ntb_netdev_tx_handler()
192 ndev->stats.tx_bytes += skb->len; in ntb_netdev_tx_handler()
194 ndev->stats.tx_errors++; in ntb_netdev_tx_handler()
195 ndev->stats.tx_aborted_errors++; in ntb_netdev_tx_handler()
205 if (netif_queue_stopped(ndev)) in ntb_netdev_tx_handler()
206 netif_wake_queue(ndev); in ntb_netdev_tx_handler()
211 struct net_device *ndev) in ntb_netdev_start_xmit() argument
213 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_start_xmit()
216 ntb_netdev_maybe_stop_tx(ndev, dev->qp, tx_stop); in ntb_netdev_start_xmit()
223 ntb_netdev_maybe_stop_tx(ndev, dev->qp, tx_stop); in ntb_netdev_start_xmit()
228 ndev->stats.tx_dropped++; in ntb_netdev_start_xmit()
229 ndev->stats.tx_errors++; in ntb_netdev_start_xmit()
235 struct net_device *ndev = (struct net_device *)data; in ntb_netdev_tx_timer() local
236 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_tx_timer()
245 if (netif_queue_stopped(ndev)) in ntb_netdev_tx_timer()
246 netif_wake_queue(ndev); in ntb_netdev_tx_timer()
250 static int ntb_netdev_open(struct net_device *ndev) in ntb_netdev_open() argument
252 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_open()
258 skb = netdev_alloc_skb(ndev, ndev->mtu + ETH_HLEN); in ntb_netdev_open()
265 ndev->mtu + ETH_HLEN); in ntb_netdev_open()
272 setup_timer(&dev->tx_timer, ntb_netdev_tx_timer, (unsigned long)ndev); in ntb_netdev_open()
274 netif_carrier_off(ndev); in ntb_netdev_open()
276 netif_start_queue(ndev); in ntb_netdev_open()
286 static int ntb_netdev_close(struct net_device *ndev) in ntb_netdev_close() argument
288 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_close()
302 static int ntb_netdev_change_mtu(struct net_device *ndev, int new_mtu) in ntb_netdev_change_mtu() argument
304 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_netdev_change_mtu()
311 if (!netif_running(ndev)) { in ntb_netdev_change_mtu()
312 ndev->mtu = new_mtu; in ntb_netdev_change_mtu()
319 if (ndev->mtu < new_mtu) { in ntb_netdev_change_mtu()
326 skb = netdev_alloc_skb(ndev, new_mtu + ETH_HLEN); in ntb_netdev_change_mtu()
341 ndev->mtu = new_mtu; in ntb_netdev_change_mtu()
353 netdev_err(ndev, "Error changing MTU, device inoperable\n"); in ntb_netdev_change_mtu()
365 static void ntb_get_drvinfo(struct net_device *ndev, in ntb_get_drvinfo() argument
368 struct ntb_netdev *dev = netdev_priv(ndev); in ntb_get_drvinfo()
406 struct net_device *ndev; in ntb_netdev_probe() local
416 ndev = alloc_etherdev(sizeof(*dev)); in ntb_netdev_probe()
417 if (!ndev) in ntb_netdev_probe()
420 dev = netdev_priv(ndev); in ntb_netdev_probe()
421 dev->ndev = ndev; in ntb_netdev_probe()
423 ndev->features = NETIF_F_HIGHDMA; in ntb_netdev_probe()
425 ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; in ntb_netdev_probe()
427 ndev->hw_features = ndev->features; in ntb_netdev_probe()
428 ndev->watchdog_timeo = msecs_to_jiffies(NTB_TX_TIMEOUT_MS); in ntb_netdev_probe()
430 random_ether_addr(ndev->perm_addr); in ntb_netdev_probe()
431 memcpy(ndev->dev_addr, ndev->perm_addr, ndev->addr_len); in ntb_netdev_probe()
433 ndev->netdev_ops = &ntb_netdev_ops; in ntb_netdev_probe()
434 ndev->ethtool_ops = &ntb_ethtool_ops; in ntb_netdev_probe()
436 dev->qp = ntb_transport_create_queue(ndev, client_dev, in ntb_netdev_probe()
443 ndev->mtu = ntb_transport_max_size(dev->qp) - ETH_HLEN; in ntb_netdev_probe()
445 rc = register_netdev(ndev); in ntb_netdev_probe()
450 dev_info(&pdev->dev, "%s created\n", ndev->name); in ntb_netdev_probe()
456 free_netdev(ndev); in ntb_netdev_probe()
463 struct net_device *ndev; in ntb_netdev_remove() local
482 ndev = dev->ndev; in ntb_netdev_remove()
484 unregister_netdev(ndev); in ntb_netdev_remove()
486 free_netdev(ndev); in ntb_netdev_remove()