Lines Matching refs:netdev
157 struct net_device *netdev; member
257 static void ks8842_update_link_status(struct net_device *netdev, in ks8842_update_link_status() argument
262 netif_carrier_on(netdev); in ks8842_update_link_status()
263 netif_wake_queue(netdev); in ks8842_update_link_status()
265 netif_stop_queue(netdev); in ks8842_update_link_status()
266 netif_carrier_off(netdev); in ks8842_update_link_status()
419 static int ks8842_tx_frame_dma(struct sk_buff *skb, struct net_device *netdev) in ks8842_tx_frame_dma() argument
421 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_tx_frame_dma()
426 netdev_dbg(netdev, "%s: TX ongoing\n", __func__); in ks8842_tx_frame_dma()
454 ctl->adesc->callback_param = netdev; in ks8842_tx_frame_dma()
458 netdev->stats.tx_bytes += skb->len; in ks8842_tx_frame_dma()
465 static int ks8842_tx_frame(struct sk_buff *skb, struct net_device *netdev) in ks8842_tx_frame() argument
467 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_tx_frame()
470 netdev_dbg(netdev, "%s: len %u head %p data %p tail %p end %p\n", in ks8842_tx_frame()
482 netdev->stats.tx_bytes += len; in ks8842_tx_frame()
498 netdev->stats.tx_bytes += len; in ks8842_tx_frame()
516 static void ks8842_update_rx_err_counters(struct net_device *netdev, u32 status) in ks8842_update_rx_err_counters() argument
518 netdev_dbg(netdev, "RX error, status: %x\n", status); in ks8842_update_rx_err_counters()
520 netdev->stats.rx_errors++; in ks8842_update_rx_err_counters()
522 netdev->stats.rx_length_errors++; in ks8842_update_rx_err_counters()
524 netdev->stats.rx_crc_errors++; in ks8842_update_rx_err_counters()
526 netdev->stats.rx_frame_errors++; in ks8842_update_rx_err_counters()
529 static void ks8842_update_rx_counters(struct net_device *netdev, u32 status, in ks8842_update_rx_counters() argument
532 netdev_dbg(netdev, "RX packet, len: %d\n", len); in ks8842_update_rx_counters()
534 netdev->stats.rx_packets++; in ks8842_update_rx_counters()
535 netdev->stats.rx_bytes += len; in ks8842_update_rx_counters()
537 netdev->stats.multicast++; in ks8842_update_rx_counters()
540 static int __ks8842_start_new_rx_dma(struct net_device *netdev) in __ks8842_start_new_rx_dma() argument
542 struct ks8842_adapter *adapter = netdev_priv(netdev); in __ks8842_start_new_rx_dma()
547 ctl->skb = netdev_alloc_skb(netdev, DMA_BUFFER_SIZE); in __ks8842_start_new_rx_dma()
568 ctl->adesc->callback_param = netdev; in __ks8842_start_new_rx_dma()
593 struct net_device *netdev = adapter->netdev; in ks8842_rx_frame_dma_tasklet() local
602 __ks8842_start_new_rx_dma(netdev); in ks8842_rx_frame_dma_tasklet()
609 netdev_dbg(netdev, "%s - rx_data: status: %x\n", in ks8842_rx_frame_dma_tasklet()
616 ks8842_update_rx_counters(netdev, status, len); in ks8842_rx_frame_dma_tasklet()
622 skb->protocol = eth_type_trans(skb, netdev); in ks8842_rx_frame_dma_tasklet()
625 ks8842_update_rx_err_counters(netdev, status); in ks8842_rx_frame_dma_tasklet()
630 static void ks8842_rx_frame(struct net_device *netdev, in ks8842_rx_frame() argument
639 netdev_dbg(netdev, "%s - rx_data: status: %x\n", in ks8842_rx_frame()
645 netdev_dbg(netdev, "%s - rx_data: status: %x\n", in ks8842_rx_frame()
651 struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len + 3); in ks8842_rx_frame()
655 ks8842_update_rx_counters(netdev, status, len); in ks8842_rx_frame()
677 skb->protocol = eth_type_trans(skb, netdev); in ks8842_rx_frame()
680 netdev->stats.rx_dropped++; in ks8842_rx_frame()
682 ks8842_update_rx_err_counters(netdev, status); in ks8842_rx_frame()
694 static void ks8842_handle_rx(struct net_device *netdev, in ks8842_handle_rx() argument
698 netdev_dbg(netdev, "%s Entry - rx_data: %d\n", __func__, rx_data); in ks8842_handle_rx()
700 ks8842_rx_frame(netdev, adapter); in ks8842_handle_rx()
705 static void ks8842_handle_tx(struct net_device *netdev, in ks8842_handle_tx() argument
709 netdev_dbg(netdev, "%s - entry, sr: %x\n", __func__, sr); in ks8842_handle_tx()
710 netdev->stats.tx_packets++; in ks8842_handle_tx()
711 if (netif_queue_stopped(netdev)) in ks8842_handle_tx()
712 netif_wake_queue(netdev); in ks8842_handle_tx()
715 static void ks8842_handle_rx_overrun(struct net_device *netdev, in ks8842_handle_rx_overrun() argument
718 netdev_dbg(netdev, "%s: entry\n", __func__); in ks8842_handle_rx_overrun()
719 netdev->stats.rx_errors++; in ks8842_handle_rx_overrun()
720 netdev->stats.rx_fifo_errors++; in ks8842_handle_rx_overrun()
726 struct net_device *netdev = adapter->netdev; in ks8842_tasklet() local
737 netdev_dbg(netdev, "%s - ISR: 0x%x\n", __func__, isr); in ks8842_tasklet()
752 if (!netif_running(netdev)) in ks8842_tasklet()
756 ks8842_update_link_status(netdev, adapter); in ks8842_tasklet()
760 ks8842_handle_rx(netdev, adapter); in ks8842_tasklet()
764 ks8842_handle_tx(netdev, adapter); in ks8842_tasklet()
767 ks8842_handle_rx_overrun(netdev, adapter); in ks8842_tasklet()
797 struct net_device *netdev = devid; in ks8842_irq() local
798 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_irq()
804 netdev_dbg(netdev, "%s - ISR: 0x%x\n", __func__, isr); in ks8842_irq()
832 struct net_device *netdev = data; in ks8842_dma_rx_cb() local
833 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_dma_rx_cb()
835 netdev_dbg(netdev, "RX DMA finished\n"); in ks8842_dma_rx_cb()
843 struct net_device *netdev = data; in ks8842_dma_tx_cb() local
844 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_dma_tx_cb()
847 netdev_dbg(netdev, "TX DMA finished\n"); in ks8842_dma_tx_cb()
852 netdev->stats.tx_packets++; in ks8842_dma_tx_cb()
855 if (netif_queue_stopped(netdev)) in ks8842_dma_tx_cb()
856 netif_wake_queue(netdev); in ks8842_dma_tx_cb()
912 static int ks8842_alloc_dma_bufs(struct net_device *netdev) in ks8842_alloc_dma_bufs() argument
914 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_alloc_dma_bufs()
966 static int ks8842_open(struct net_device *netdev) in ks8842_open() argument
968 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_open()
971 netdev_dbg(netdev, "%s - entry\n", __func__); in ks8842_open()
974 err = ks8842_alloc_dma_bufs(netdev); in ks8842_open()
978 err = __ks8842_start_new_rx_dma(netdev); in ks8842_open()
995 ks8842_write_mac_addr(adapter, netdev->dev_addr); in ks8842_open()
997 ks8842_update_link_status(netdev, adapter); in ks8842_open()
1000 netdev); in ks8842_open()
1009 static int ks8842_close(struct net_device *netdev) in ks8842_close() argument
1011 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_close()
1013 netdev_dbg(netdev, "%s - entry\n", __func__); in ks8842_close()
1021 free_irq(adapter->irq, netdev); in ks8842_close()
1030 struct net_device *netdev) in ks8842_xmit_frame() argument
1033 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_xmit_frame()
1035 netdev_dbg(netdev, "%s: entry\n", __func__); in ks8842_xmit_frame()
1039 ret = ks8842_tx_frame_dma(skb, netdev); in ks8842_xmit_frame()
1043 netif_stop_queue(netdev); in ks8842_xmit_frame()
1048 ret = ks8842_tx_frame(skb, netdev); in ks8842_xmit_frame()
1050 if (ks8842_tx_fifo_space(adapter) < netdev->mtu + 8) in ks8842_xmit_frame()
1051 netif_stop_queue(netdev); in ks8842_xmit_frame()
1056 static int ks8842_set_mac(struct net_device *netdev, void *p) in ks8842_set_mac() argument
1058 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_set_mac()
1062 netdev_dbg(netdev, "%s: entry\n", __func__); in ks8842_set_mac()
1067 memcpy(netdev->dev_addr, mac, netdev->addr_len); in ks8842_set_mac()
1077 struct net_device *netdev = adapter->netdev; in ks8842_tx_timeout_work() local
1080 netdev_dbg(netdev, "%s: entry\n", __func__); in ks8842_tx_timeout_work()
1091 netif_stop_queue(netdev); in ks8842_tx_timeout_work()
1097 ks8842_write_mac_addr(adapter, netdev->dev_addr); in ks8842_tx_timeout_work()
1099 ks8842_update_link_status(netdev, adapter); in ks8842_tx_timeout_work()
1102 __ks8842_start_new_rx_dma(netdev); in ks8842_tx_timeout_work()
1105 static void ks8842_tx_timeout(struct net_device *netdev, unsigned int txqueue) in ks8842_tx_timeout() argument
1107 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_tx_timeout()
1109 netdev_dbg(netdev, "%s: entry\n", __func__); in ks8842_tx_timeout()
1131 struct net_device *netdev; in ks8842_probe() local
1141 netdev = alloc_etherdev(sizeof(struct ks8842_adapter)); in ks8842_probe()
1142 if (!netdev) in ks8842_probe()
1145 SET_NETDEV_DEV(netdev, &pdev->dev); in ks8842_probe()
1147 adapter = netdev_priv(netdev); in ks8842_probe()
1148 adapter->netdev = netdev; in ks8842_probe()
1178 netdev->netdev_ops = &ks8842_netdev_ops; in ks8842_probe()
1179 netdev->ethtool_ops = &ks8842_ethtool_ops; in ks8842_probe()
1182 i = netdev->addr_len; in ks8842_probe()
1184 for (i = 0; i < netdev->addr_len; i++) in ks8842_probe()
1188 if (i < netdev->addr_len) in ks8842_probe()
1190 memcpy(netdev->dev_addr, pdata->macaddr, in ks8842_probe()
1191 netdev->addr_len); in ks8842_probe()
1194 if (i == netdev->addr_len) { in ks8842_probe()
1195 ks8842_read_mac_addr(adapter, netdev->dev_addr); in ks8842_probe()
1197 if (!is_valid_ether_addr(netdev->dev_addr)) in ks8842_probe()
1198 eth_hw_addr_random(netdev); in ks8842_probe()
1203 strcpy(netdev->name, "eth%d"); in ks8842_probe()
1204 err = register_netdev(netdev); in ks8842_probe()
1208 platform_set_drvdata(pdev, netdev); in ks8842_probe()
1219 free_netdev(netdev); in ks8842_probe()
1228 struct net_device *netdev = platform_get_drvdata(pdev); in ks8842_remove() local
1229 struct ks8842_adapter *adapter = netdev_priv(netdev); in ks8842_remove()
1232 unregister_netdev(netdev); in ks8842_remove()
1235 free_netdev(netdev); in ks8842_remove()