12 #define DRV_VERSION "0.3"
13 #define DRV_RELDATE "10/12/2005"
15 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/netdevice.h>
20 #include <linux/module.h>
22 #include <asm/virtconvert.h>
44 " S.Opichal, M.Jurik, P.Stehlik\n"
56 static long nfEtherID;
57 static int nfEtherIRQ;
74 netif_start_queue(dev);
84 netif_stop_queue(dev);
103 netdev_dbg(dev,
"%s: %u\n", __func__, pktlen);
106 netdev_dbg(dev,
"%s: pktlen == 0\n", __func__);
107 dev->
stats.rx_errors++;
111 skb = dev_alloc_skb(pktlen + 2);
113 netdev_dbg(dev,
"%s: out of mem (buf_alloc failed)\n",
115 dev->
stats.rx_dropped++;
128 dev->
stats.rx_packets++;
140 for (i = 0, m = 1; i <
MAX_UNIT; m <<= 1, i++) {
141 if (mask & m && nfeth_dev[i]) {
142 recv_packet(nfeth_dev[i]);
159 memcpy(shortpkt, data, len);
164 netdev_dbg(dev,
"%s: send %u bytes\n", __func__, len);
168 dev->
stats.tx_packets++;
169 dev->
stats.tx_bytes += len;
175 static void nfeth_tx_timeout(
struct net_device *dev)
177 dev->
stats.tx_errors++;
178 netif_wake_queue(dev);
182 .ndo_open = nfeth_open,
183 .ndo_stop = nfeth_stop,
184 .ndo_start_xmit = nfeth_xmit,
185 .ndo_tx_timeout = nfeth_tx_timeout,
205 dev->
irq = nfEtherIRQ;
210 priv = netdev_priv(dev);
220 host_ip,
sizeof(host_ip));
222 local_ip,
sizeof(local_ip));
224 netdev_info(dev, KBUILD_MODNAME
" addr:%s (%s) HWaddr:%pM\n", host_ip,
230 static int __init nfeth_init(
void)
244 "eth emu", nfeth_interrupt);
246 pr_err(
"request for irq %d failed %d", nfEtherIRQ, error);
251 nfeth_dev[i] = nfeth_probe(i);
256 static void __exit nfeth_cleanup(
void)
266 free_irq(nfEtherIRQ, nfeth_interrupt);