This source file includes following definitions.
- loopback_xmit
- loopback_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 #include <linux/config.h>
53 #include <linux/kernel.h>
54 #include <linux/sched.h>
55 #include <linux/fs.h>
56 #include <linux/tty.h>
57 #include <linux/types.h>
58 #include <linux/ptrace.h>
59 #include <linux/string.h>
60 #include <asm/system.h>
61 #include <asm/segment.h>
62 #include <asm/io.h>
63 #include <errno.h>
64 #include <linux/fcntl.h>
65 #include <netinet/in.h>
66
67 #include "dev.h"
68 #include "eth.h"
69 #include "timer.h"
70 #include "ip.h"
71 #include "tcp.h"
72 #include "sock.h"
73 #include "arp.h"
74
75 #ifdef PRINTK
76 #undef PRINTK
77 #endif
78
79 #ifdef LOOPBACK_DEBUG
80 #define PRINTK(x) printk x
81 #else
82 #define PRINTK(x)
83 #endif
84
85 static int
86 loopback_xmit(struct sk_buff *skb, struct device *dev)
87 {
88 int done;
89 PRINTK (("loopback_xmit (dev = %X)\n", dev));
90 cli();
91 if (dev->tbusy != 0)
92 {
93 sti();
94 return (1);
95 }
96 dev->tbusy = 1;
97 sti();
98
99 done = dev_rint ((unsigned char *)(skb+1), skb->len, 0, dev);
100
101 if (skb->free)
102 kfree_skb (skb, FREE_WRITE);
103
104 while (done != 1)
105 {
106 done = dev_rint (NULL, 0, 0, dev);
107 }
108
109 dev->tbusy = 0;
110
111 return (0);
112 }
113
114 int
115 loopback_init(struct device *dev)
116 {
117 printk ("Loopback device init\n");
118
119 dev->mtu = 2000;
120 dev->tbusy = 0;
121 dev->hard_start_xmit = loopback_xmit;
122 dev->open = NULL;
123 dev->hard_header = eth_hard_header;
124 dev->add_arp = NULL;
125 dev->hard_header_len = sizeof (struct enet_header);
126 dev->addr_len = ETHER_ADDR_LEN;
127 dev->type = ETHER_TYPE;
128 dev->queue_xmit = dev_queue_xmit;
129 dev->rebuild_header = eth_rebuild_header;
130 dev->type_trans = eth_type_trans;
131 dev->loopback = 1;
132 return (0);
133 }