diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-16 01:02:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 01:02:40 -0400 |
commit | c727e7f0071cae66c029f667d48b154c6b64227b (patch) | |
tree | 197c2760fcae529d04d56f56e9cd55f51d6d9273 /net | |
parent | 91df42bedccb919902c7cf7eb876c982ae7f1b1d (diff) | |
parent | ee446fd5e6dafee4a16fd1bd345d2571dcfd6f5d (diff) |
Merge branch 'delete-tokenring' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
Diffstat (limited to 'net')
-rw-r--r-- | net/802/Makefile | 1 | ||||
-rw-r--r-- | net/802/p8022.c | 3 | ||||
-rw-r--r-- | net/802/tr.c | 670 | ||||
-rw-r--r-- | net/atm/lec.c | 138 | ||||
-rw-r--r-- | net/atm/lec.h | 1 | ||||
-rw-r--r-- | net/core/dev.c | 14 | ||||
-rw-r--r-- | net/ipv4/Kconfig | 4 | ||||
-rw-r--r-- | net/ipv4/arp.c | 13 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 2 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 2 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 17 | ||||
-rw-r--r-- | net/ipx/af_ipx.c | 10 | ||||
-rw-r--r-- | net/llc/af_llc.c | 3 | ||||
-rw-r--r-- | net/llc/llc_output.c | 3 | ||||
-rw-r--r-- | net/llc/llc_sap.c | 4 | ||||
-rw-r--r-- | net/sysctl_net.c | 4 |
16 files changed, 20 insertions, 869 deletions
diff --git a/net/802/Makefile b/net/802/Makefile index 7893d679910c..a30d6e385aed 100644 --- a/net/802/Makefile +++ b/net/802/Makefile | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | # Check the p8022 selections against net/core/Makefile. | 5 | # Check the p8022 selections against net/core/Makefile. |
6 | obj-$(CONFIG_LLC) += p8022.o psnap.o | 6 | obj-$(CONFIG_LLC) += p8022.o psnap.o |
7 | obj-$(CONFIG_TR) += p8022.o psnap.o tr.o | ||
8 | obj-$(CONFIG_NET_FC) += fc.o | 7 | obj-$(CONFIG_NET_FC) += fc.o |
9 | obj-$(CONFIG_FDDI) += fddi.o | 8 | obj-$(CONFIG_FDDI) += fddi.o |
10 | obj-$(CONFIG_HIPPI) += hippi.o | 9 | obj-$(CONFIG_HIPPI) += hippi.o |
diff --git a/net/802/p8022.c b/net/802/p8022.c index 7f353c4f437a..0bda8de7df51 100644 --- a/net/802/p8022.c +++ b/net/802/p8022.c | |||
@@ -1,6 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * NET3: Support for 802.2 demultiplexing off Ethernet (Token ring | 2 | * NET3: Support for 802.2 demultiplexing off Ethernet |
3 | * is kept separate see p8022tr.c) | ||
4 | * This program is free software; you can redistribute it and/or | 3 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License | 4 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; either version | 5 | * as published by the Free Software Foundation; either version |
diff --git a/net/802/tr.c b/net/802/tr.c deleted file mode 100644 index 30a352ed09b1..000000000000 --- a/net/802/tr.c +++ /dev/null | |||
@@ -1,670 +0,0 @@ | |||
1 | /* | ||
2 | * NET3: Token ring device handling subroutines | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * Fixes: 3 Feb 97 Paul Norton <pnorton@cts.com> Minor routing fixes. | ||
10 | * Added rif table to /proc/net/tr_rif and rif timeout to | ||
11 | * /proc/sys/net/token-ring/rif_timeout. | ||
12 | * 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged | ||
13 | * tr_header and tr_type_trans to handle passing IPX SNAP and | ||
14 | * 802.2 through the correct layers. Eliminated tr_reformat. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <asm/uaccess.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/jiffies.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/mm.h> | ||
25 | #include <linux/socket.h> | ||
26 | #include <linux/in.h> | ||
27 | #include <linux/inet.h> | ||
28 | #include <linux/netdevice.h> | ||
29 | #include <linux/trdevice.h> | ||
30 | #include <linux/skbuff.h> | ||
31 | #include <linux/errno.h> | ||
32 | #include <linux/timer.h> | ||
33 | #include <linux/net.h> | ||
34 | #include <linux/proc_fs.h> | ||
35 | #include <linux/seq_file.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/sysctl.h> | ||
38 | #include <linux/slab.h> | ||
39 | #include <net/arp.h> | ||
40 | #include <net/net_namespace.h> | ||
41 | |||
42 | static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev); | ||
43 | static void rif_check_expire(unsigned long dummy); | ||
44 | |||
45 | #define TR_SR_DEBUG 0 | ||
46 | |||
47 | /* | ||
48 | * Each RIF entry we learn is kept this way | ||
49 | */ | ||
50 | |||
51 | struct rif_cache { | ||
52 | unsigned char addr[TR_ALEN]; | ||
53 | int iface; | ||
54 | __be16 rcf; | ||
55 | __be16 rseg[8]; | ||
56 | struct rif_cache *next; | ||
57 | unsigned long last_used; | ||
58 | unsigned char local_ring; | ||
59 | }; | ||
60 | |||
61 | #define RIF_TABLE_SIZE 32 | ||
62 | |||
63 | /* | ||
64 | * We hash the RIF cache 32 ways. We do after all have to look it | ||
65 | * up a lot. | ||
66 | */ | ||
67 | |||
68 | static struct rif_cache *rif_table[RIF_TABLE_SIZE]; | ||
69 | |||
70 | static DEFINE_SPINLOCK(rif_lock); | ||
71 | |||
72 | |||
73 | /* | ||
74 | * Garbage disposal timer. | ||
75 | */ | ||
76 | |||
77 | static struct timer_list rif_timer; | ||
78 | |||
79 | static int sysctl_tr_rif_timeout = 60*10*HZ; | ||
80 | |||
81 | static inline unsigned long rif_hash(const unsigned char *addr) | ||
82 | { | ||
83 | unsigned long x; | ||
84 | |||
85 | x = addr[0]; | ||
86 | x = (x << 2) ^ addr[1]; | ||
87 | x = (x << 2) ^ addr[2]; | ||
88 | x = (x << 2) ^ addr[3]; | ||
89 | x = (x << 2) ^ addr[4]; | ||
90 | x = (x << 2) ^ addr[5]; | ||
91 | |||
92 | x ^= x >> 8; | ||
93 | |||
94 | return x & (RIF_TABLE_SIZE - 1); | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Put the headers on a token ring packet. Token ring source routing | ||
99 | * makes this a little more exciting than on ethernet. | ||
100 | */ | ||
101 | |||
102 | static int tr_header(struct sk_buff *skb, struct net_device *dev, | ||
103 | unsigned short type, | ||
104 | const void *daddr, const void *saddr, unsigned int len) | ||
105 | { | ||
106 | struct trh_hdr *trh; | ||
107 | int hdr_len; | ||
108 | |||
109 | /* | ||
110 | * Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls | ||
111 | * dev->hard_header directly. | ||
112 | */ | ||
113 | if (type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP) | ||
114 | { | ||
115 | struct trllc *trllc; | ||
116 | |||
117 | hdr_len = sizeof(struct trh_hdr) + sizeof(struct trllc); | ||
118 | trh = (struct trh_hdr *)skb_push(skb, hdr_len); | ||
119 | trllc = (struct trllc *)(trh+1); | ||
120 | trllc->dsap = trllc->ssap = EXTENDED_SAP; | ||
121 | trllc->llc = UI_CMD; | ||
122 | trllc->protid[0] = trllc->protid[1] = trllc->protid[2] = 0x00; | ||
123 | trllc->ethertype = htons(type); | ||
124 | } | ||
125 | else | ||
126 | { | ||
127 | hdr_len = sizeof(struct trh_hdr); | ||
128 | trh = (struct trh_hdr *)skb_push(skb, hdr_len); | ||
129 | } | ||
130 | |||
131 | trh->ac=AC; | ||
132 | trh->fc=LLC_FRAME; | ||
133 | |||
134 | if(saddr) | ||
135 | memcpy(trh->saddr,saddr,dev->addr_len); | ||
136 | else | ||
137 | memcpy(trh->saddr,dev->dev_addr,dev->addr_len); | ||
138 | |||
139 | /* | ||
140 | * Build the destination and then source route the frame | ||
141 | */ | ||
142 | |||
143 | if(daddr) | ||
144 | { | ||
145 | memcpy(trh->daddr,daddr,dev->addr_len); | ||
146 | tr_source_route(skb, trh, dev); | ||
147 | return hdr_len; | ||
148 | } | ||
149 | |||
150 | return -hdr_len; | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | * A neighbour discovery of some species (eg arp) has completed. We | ||
155 | * can now send the packet. | ||
156 | */ | ||
157 | |||
158 | static int tr_rebuild_header(struct sk_buff *skb) | ||
159 | { | ||
160 | struct trh_hdr *trh=(struct trh_hdr *)skb->data; | ||
161 | struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr)); | ||
162 | struct net_device *dev = skb->dev; | ||
163 | |||
164 | /* | ||
165 | * FIXME: We don't yet support IPv6 over token rings | ||
166 | */ | ||
167 | |||
168 | if(trllc->ethertype != htons(ETH_P_IP)) { | ||
169 | printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype)); | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | #ifdef CONFIG_INET | ||
174 | if(arp_find(trh->daddr, skb)) { | ||
175 | return 1; | ||
176 | } | ||
177 | else | ||
178 | #endif | ||
179 | { | ||
180 | tr_source_route(skb,trh,dev); | ||
181 | return 0; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * Some of this is a bit hackish. We intercept RIF information | ||
187 | * used for source routing. We also grab IP directly and don't feed | ||
188 | * it via SNAP. | ||
189 | */ | ||
190 | |||
191 | __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) | ||
192 | { | ||
193 | |||
194 | struct trh_hdr *trh; | ||
195 | struct trllc *trllc; | ||
196 | unsigned int riflen=0; | ||
197 | |||
198 | skb->dev = dev; | ||
199 | skb_reset_mac_header(skb); | ||
200 | trh = tr_hdr(skb); | ||
201 | |||
202 | if(trh->saddr[0] & TR_RII) | ||
203 | riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8; | ||
204 | |||
205 | trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); | ||
206 | |||
207 | skb_pull(skb,sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); | ||
208 | |||
209 | if(*trh->daddr & 0x80) | ||
210 | { | ||
211 | if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN)) | ||
212 | skb->pkt_type=PACKET_BROADCAST; | ||
213 | else | ||
214 | skb->pkt_type=PACKET_MULTICAST; | ||
215 | } | ||
216 | else if ( (trh->daddr[0] & 0x01) && (trh->daddr[1] & 0x00) && (trh->daddr[2] & 0x5E)) | ||
217 | { | ||
218 | skb->pkt_type=PACKET_MULTICAST; | ||
219 | } | ||
220 | else if(dev->flags & IFF_PROMISC) | ||
221 | { | ||
222 | if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN)) | ||
223 | skb->pkt_type=PACKET_OTHERHOST; | ||
224 | } | ||
225 | |||
226 | if ((skb->pkt_type != PACKET_BROADCAST) && | ||
227 | (skb->pkt_type != PACKET_MULTICAST)) | ||
228 | tr_add_rif_info(trh,dev) ; | ||
229 | |||
230 | /* | ||
231 | * Strip the SNAP header from ARP packets since we don't | ||
232 | * pass them through to the 802.2/SNAP layers. | ||
233 | */ | ||
234 | |||
235 | if (trllc->dsap == EXTENDED_SAP && | ||
236 | (trllc->ethertype == htons(ETH_P_IP) || | ||
237 | trllc->ethertype == htons(ETH_P_IPV6) || | ||
238 | trllc->ethertype == htons(ETH_P_ARP))) | ||
239 | { | ||
240 | skb_pull(skb, sizeof(struct trllc)); | ||
241 | return trllc->ethertype; | ||
242 | } | ||
243 | |||
244 | return htons(ETH_P_TR_802_2); | ||
245 | } | ||
246 | |||
247 | /* | ||
248 | * We try to do source routing... | ||
249 | */ | ||
250 | |||
251 | void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh, | ||
252 | struct net_device *dev) | ||
253 | { | ||
254 | int slack; | ||
255 | unsigned int hash; | ||
256 | struct rif_cache *entry; | ||
257 | unsigned char *olddata; | ||
258 | unsigned long flags; | ||
259 | static const unsigned char mcast_func_addr[] | ||
260 | = {0xC0,0x00,0x00,0x04,0x00,0x00}; | ||
261 | |||
262 | spin_lock_irqsave(&rif_lock, flags); | ||
263 | |||
264 | /* | ||
265 | * Broadcasts are single route as stated in RFC 1042 | ||
266 | */ | ||
267 | if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) || | ||
268 | (!memcmp(&(trh->daddr[0]),&(mcast_func_addr[0]), TR_ALEN)) ) | ||
269 | { | ||
270 | trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) | ||
271 | | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); | ||
272 | trh->saddr[0]|=TR_RII; | ||
273 | } | ||
274 | else | ||
275 | { | ||
276 | hash = rif_hash(trh->daddr); | ||
277 | /* | ||
278 | * Walk the hash table and look for an entry | ||
279 | */ | ||
280 | for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->daddr[0]),TR_ALEN);entry=entry->next); | ||
281 | |||
282 | /* | ||
283 | * If we found an entry we can route the frame. | ||
284 | */ | ||
285 | if(entry) | ||
286 | { | ||
287 | #if TR_SR_DEBUG | ||
288 | printk("source routing for %pM\n", trh->daddr); | ||
289 | #endif | ||
290 | if(!entry->local_ring && (ntohs(entry->rcf) & TR_RCF_LEN_MASK) >> 8) | ||
291 | { | ||
292 | trh->rcf=entry->rcf; | ||
293 | memcpy(&trh->rseg[0],&entry->rseg[0],8*sizeof(unsigned short)); | ||
294 | trh->rcf^=htons(TR_RCF_DIR_BIT); | ||
295 | trh->rcf&=htons(0x1fff); /* Issam Chehab <ichehab@madge1.demon.co.uk> */ | ||
296 | |||
297 | trh->saddr[0]|=TR_RII; | ||
298 | #if TR_SR_DEBUG | ||
299 | printk("entry found with rcf %04x\n", entry->rcf); | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | printk("entry found but without rcf length, local=%02x\n", entry->local_ring); | ||
304 | #endif | ||
305 | } | ||
306 | entry->last_used=jiffies; | ||
307 | } | ||
308 | else | ||
309 | { | ||
310 | /* | ||
311 | * Without the information we simply have to shout | ||
312 | * on the wire. The replies should rapidly clean this | ||
313 | * situation up. | ||
314 | */ | ||
315 | trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK) | ||
316 | | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST); | ||
317 | trh->saddr[0]|=TR_RII; | ||
318 | #if TR_SR_DEBUG | ||
319 | printk("no entry in rif table found - broadcasting frame\n"); | ||
320 | #endif | ||
321 | } | ||
322 | } | ||
323 | |||
324 | /* Compress the RIF here so we don't have to do it in the driver(s) */ | ||
325 | if (!(trh->saddr[0] & 0x80)) | ||
326 | slack = 18; | ||
327 | else | ||
328 | slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8); | ||
329 | olddata = skb->data; | ||
330 | spin_unlock_irqrestore(&rif_lock, flags); | ||
331 | |||
332 | skb_pull(skb, slack); | ||
333 | memmove(skb->data, olddata, sizeof(struct trh_hdr) - slack); | ||
334 | } | ||
335 | |||
336 | /* | ||
337 | * We have learned some new RIF information for our source | ||
338 | * routing. | ||
339 | */ | ||
340 | |||
341 | static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) | ||
342 | { | ||
343 | unsigned int hash, rii_p = 0; | ||
344 | unsigned long flags; | ||
345 | struct rif_cache *entry; | ||
346 | unsigned char saddr0; | ||
347 | |||
348 | spin_lock_irqsave(&rif_lock, flags); | ||
349 | saddr0 = trh->saddr[0]; | ||
350 | |||
351 | /* | ||
352 | * Firstly see if the entry exists | ||
353 | */ | ||
354 | |||
355 | if(trh->saddr[0] & TR_RII) | ||
356 | { | ||
357 | trh->saddr[0]&=0x7f; | ||
358 | if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2) | ||
359 | { | ||
360 | rii_p = 1; | ||
361 | } | ||
362 | } | ||
363 | |||
364 | hash = rif_hash(trh->saddr); | ||
365 | for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN);entry=entry->next); | ||
366 | |||
367 | if(entry==NULL) | ||
368 | { | ||
369 | #if TR_SR_DEBUG | ||
370 | printk("adding rif_entry: addr:%pM rcf:%04X\n", | ||
371 | trh->saddr, ntohs(trh->rcf)); | ||
372 | #endif | ||
373 | /* | ||
374 | * Allocate our new entry. A failure to allocate loses | ||
375 | * use the information. This is harmless. | ||
376 | * | ||
377 | * FIXME: We ought to keep some kind of cache size | ||
378 | * limiting and adjust the timers to suit. | ||
379 | */ | ||
380 | entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC); | ||
381 | |||
382 | if(!entry) | ||
383 | { | ||
384 | printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n"); | ||
385 | spin_unlock_irqrestore(&rif_lock, flags); | ||
386 | return; | ||
387 | } | ||
388 | |||
389 | memcpy(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN); | ||
390 | entry->iface = dev->ifindex; | ||
391 | entry->next=rif_table[hash]; | ||
392 | entry->last_used=jiffies; | ||
393 | rif_table[hash]=entry; | ||
394 | |||
395 | if (rii_p) | ||
396 | { | ||
397 | entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK); | ||
398 | memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); | ||
399 | entry->local_ring = 0; | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | entry->local_ring = 1; | ||
404 | } | ||
405 | } | ||
406 | else /* Y. Tahara added */ | ||
407 | { | ||
408 | /* | ||
409 | * Update existing entries | ||
410 | */ | ||
411 | if (!entry->local_ring) | ||
412 | if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) && | ||
413 | !(trh->rcf & htons(TR_RCF_BROADCAST_MASK))) | ||
414 | { | ||
415 | #if TR_SR_DEBUG | ||
416 | printk("updating rif_entry: addr:%pM rcf:%04X\n", | ||
417 | trh->saddr, ntohs(trh->rcf)); | ||
418 | #endif | ||
419 | entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK); | ||
420 | memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); | ||
421 | } | ||
422 | entry->last_used=jiffies; | ||
423 | } | ||
424 | trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */ | ||
425 | spin_unlock_irqrestore(&rif_lock, flags); | ||
426 | } | ||
427 | |||
428 | /* | ||
429 | * Scan the cache with a timer and see what we need to throw out. | ||
430 | */ | ||
431 | |||
432 | static void rif_check_expire(unsigned long dummy) | ||
433 | { | ||
434 | int i; | ||
435 | unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2; | ||
436 | |||
437 | spin_lock_irqsave(&rif_lock, flags); | ||
438 | |||
439 | for(i =0; i < RIF_TABLE_SIZE; i++) { | ||
440 | struct rif_cache *entry, **pentry; | ||
441 | |||
442 | pentry = rif_table+i; | ||
443 | while((entry=*pentry) != NULL) { | ||
444 | unsigned long expires | ||
445 | = entry->last_used + sysctl_tr_rif_timeout; | ||
446 | |||
447 | if (time_before_eq(expires, jiffies)) { | ||
448 | *pentry = entry->next; | ||
449 | kfree(entry); | ||
450 | } else { | ||
451 | pentry = &entry->next; | ||
452 | |||
453 | if (time_before(expires, next_interval)) | ||
454 | next_interval = expires; | ||
455 | } | ||
456 | } | ||
457 | } | ||
458 | |||
459 | spin_unlock_irqrestore(&rif_lock, flags); | ||
460 | |||
461 | mod_timer(&rif_timer, next_interval); | ||
462 | |||
463 | } | ||
464 | |||
465 | /* | ||
466 | * Generate the /proc/net information for the token ring RIF | ||
467 | * routing. | ||
468 | */ | ||
469 | |||
470 | #ifdef CONFIG_PROC_FS | ||
471 | |||
472 | static struct rif_cache *rif_get_idx(loff_t pos) | ||
473 | { | ||
474 | int i; | ||
475 | struct rif_cache *entry; | ||
476 | loff_t off = 0; | ||
477 | |||
478 | for(i = 0; i < RIF_TABLE_SIZE; i++) | ||
479 | for(entry = rif_table[i]; entry; entry = entry->next) { | ||
480 | if (off == pos) | ||
481 | return entry; | ||
482 | ++off; | ||
483 | } | ||
484 | |||
485 | return NULL; | ||
486 | } | ||
487 | |||
488 | static void *rif_seq_start(struct seq_file *seq, loff_t *pos) | ||
489 | __acquires(&rif_lock) | ||
490 | { | ||
491 | spin_lock_irq(&rif_lock); | ||
492 | |||
493 | return *pos ? rif_get_idx(*pos - 1) : SEQ_START_TOKEN; | ||
494 | } | ||
495 | |||
496 | static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos) | ||
497 | { | ||
498 | int i; | ||
499 | struct rif_cache *ent = v; | ||
500 | |||
501 | ++*pos; | ||
502 | |||
503 | if (v == SEQ_START_TOKEN) { | ||
504 | i = -1; | ||
505 | goto scan; | ||
506 | } | ||
507 | |||
508 | if (ent->next) | ||
509 | return ent->next; | ||
510 | |||
511 | i = rif_hash(ent->addr); | ||
512 | scan: | ||
513 | while (++i < RIF_TABLE_SIZE) { | ||
514 | if ((ent = rif_table[i]) != NULL) | ||
515 | return ent; | ||
516 | } | ||
517 | return NULL; | ||
518 | } | ||
519 | |||
520 | static void rif_seq_stop(struct seq_file *seq, void *v) | ||
521 | __releases(&rif_lock) | ||
522 | { | ||
523 | spin_unlock_irq(&rif_lock); | ||
524 | } | ||
525 | |||
526 | static int rif_seq_show(struct seq_file *seq, void *v) | ||
527 | { | ||
528 | int j, rcf_len, segment, brdgnmb; | ||
529 | struct rif_cache *entry = v; | ||
530 | |||
531 | if (v == SEQ_START_TOKEN) | ||
532 | seq_puts(seq, | ||
533 | "if TR address TTL rcf routing segments\n"); | ||
534 | else { | ||
535 | struct net_device *dev = dev_get_by_index(&init_net, entry->iface); | ||
536 | long ttl = (long) (entry->last_used + sysctl_tr_rif_timeout) | ||
537 | - (long) jiffies; | ||
538 | |||
539 | seq_printf(seq, "%s %pM %7li ", | ||
540 | dev?dev->name:"?", | ||
541 | entry->addr, | ||
542 | ttl/HZ); | ||
543 | |||
544 | if (entry->local_ring) | ||
545 | seq_puts(seq, "local\n"); | ||
546 | else { | ||
547 | |||
548 | seq_printf(seq, "%04X", ntohs(entry->rcf)); | ||
549 | rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2; | ||
550 | if (rcf_len) | ||
551 | rcf_len >>= 1; | ||
552 | for(j = 1; j < rcf_len; j++) { | ||
553 | if(j==1) { | ||
554 | segment=ntohs(entry->rseg[j-1])>>4; | ||
555 | seq_printf(seq," %03X",segment); | ||
556 | } | ||
557 | |||
558 | segment=ntohs(entry->rseg[j])>>4; | ||
559 | brdgnmb=ntohs(entry->rseg[j-1])&0x00f; | ||
560 | seq_printf(seq,"-%01X-%03X",brdgnmb,segment); | ||
561 | } | ||
562 | seq_putc(seq, '\n'); | ||
563 | } | ||
564 | |||
565 | if (dev) | ||
566 | dev_put(dev); | ||
567 | } | ||
568 | return 0; | ||
569 | } | ||
570 | |||
571 | |||
572 | static const struct seq_operations rif_seq_ops = { | ||
573 | .start = rif_seq_start, | ||
574 | .next = rif_seq_next, | ||
575 | .stop = rif_seq_stop, | ||
576 | .show = rif_seq_show, | ||
577 | }; | ||
578 | |||
579 | static int rif_seq_open(struct inode *inode, struct file *file) | ||
580 | { | ||
581 | return seq_open(file, &rif_seq_ops); | ||
582 | } | ||
583 | |||
584 | static const struct file_operations rif_seq_fops = { | ||
585 | .owner = THIS_MODULE, | ||
586 | .open = rif_seq_open, | ||
587 | .read = seq_read, | ||
588 | .llseek = seq_lseek, | ||
589 | .release = seq_release, | ||
590 | }; | ||
591 | |||
592 | #endif | ||
593 | |||
594 | static const struct header_ops tr_header_ops = { | ||
595 | .create = tr_header, | ||
596 | .rebuild= tr_rebuild_header, | ||
597 | }; | ||
598 | |||
599 | static void tr_setup(struct net_device *dev) | ||
600 | { | ||
601 | /* | ||
602 | * Configure and register | ||
603 | */ | ||
604 | |||
605 | dev->header_ops = &tr_header_ops; | ||
606 | |||
607 | dev->type = ARPHRD_IEEE802_TR; | ||
608 | dev->hard_header_len = TR_HLEN; | ||
609 | dev->mtu = 2000; | ||
610 | dev->addr_len = TR_ALEN; | ||
611 | dev->tx_queue_len = 100; /* Long queues on tr */ | ||
612 | |||
613 | memset(dev->broadcast,0xFF, TR_ALEN); | ||
614 | |||
615 | /* New-style flags. */ | ||
616 | dev->flags = IFF_BROADCAST | IFF_MULTICAST ; | ||
617 | } | ||
618 | |||
619 | /** | ||
620 | * alloc_trdev - Register token ring device | ||
621 | * @sizeof_priv: Size of additional driver-private structure to be allocated | ||
622 | * for this token ring device | ||
623 | * | ||
624 | * Fill in the fields of the device structure with token ring-generic values. | ||
625 | * | ||
626 | * Constructs a new net device, complete with a private data area of | ||
627 | * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for | ||
628 | * this private data area. | ||
629 | */ | ||
630 | struct net_device *alloc_trdev(int sizeof_priv) | ||
631 | { | ||
632 | return alloc_netdev(sizeof_priv, "tr%d", tr_setup); | ||
633 | } | ||
634 | |||
635 | #ifdef CONFIG_SYSCTL | ||
636 | static struct ctl_table tr_table[] = { | ||
637 | { | ||
638 | .procname = "rif_timeout", | ||
639 | .data = &sysctl_tr_rif_timeout, | ||
640 | .maxlen = sizeof(int), | ||
641 | .mode = 0644, | ||
642 | .proc_handler = proc_dointvec | ||
643 | }, | ||
644 | { }, | ||
645 | }; | ||
646 | #endif | ||
647 | |||
648 | /* | ||
649 | * Called during bootup. We don't actually have to initialise | ||
650 | * too much for this. | ||
651 | */ | ||
652 | |||
653 | static int __init rif_init(void) | ||
654 | { | ||
655 | rif_timer.expires = jiffies + sysctl_tr_rif_timeout; | ||
656 | setup_timer(&rif_timer, rif_check_expire, 0); | ||
657 | add_timer(&rif_timer); | ||
658 | #ifdef CONFIG_SYSCTL | ||
659 | register_net_sysctl(&init_net, "net/token-ring", tr_table); | ||
660 | #endif | ||
661 | proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops); | ||
662 | return 0; | ||
663 | } | ||
664 | |||
665 | module_init(rif_init); | ||
666 | |||
667 | EXPORT_SYMBOL(tr_type_trans); | ||
668 | EXPORT_SYMBOL(alloc_trdev); | ||
669 | |||
670 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/atm/lec.c b/net/atm/lec.c index bb35cb76b3af..a7d172105c99 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -26,11 +26,6 @@ | |||
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | 28 | ||
29 | /* TokenRing if needed */ | ||
30 | #ifdef CONFIG_TR | ||
31 | #include <linux/trdevice.h> | ||
32 | #endif | ||
33 | |||
34 | /* And atm device */ | 29 | /* And atm device */ |
35 | #include <linux/atmdev.h> | 30 | #include <linux/atmdev.h> |
36 | #include <linux/atmlec.h> | 31 | #include <linux/atmlec.h> |
@@ -163,50 +158,6 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev) | |||
163 | #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */ | 158 | #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */ |
164 | 159 | ||
165 | /* | 160 | /* |
166 | * Modelled after tr_type_trans | ||
167 | * All multicast and ARE or STE frames go to BUS. | ||
168 | * Non source routed frames go by destination address. | ||
169 | * Last hop source routed frames go by destination address. | ||
170 | * Not last hop source routed frames go by _next_ route descriptor. | ||
171 | * Returns pointer to destination MAC address or fills in rdesc | ||
172 | * and returns NULL. | ||
173 | */ | ||
174 | #ifdef CONFIG_TR | ||
175 | static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc) | ||
176 | { | ||
177 | struct trh_hdr *trh; | ||
178 | unsigned int riflen, num_rdsc; | ||
179 | |||
180 | trh = (struct trh_hdr *)packet; | ||
181 | if (trh->daddr[0] & (uint8_t) 0x80) | ||
182 | return bus_mac; /* multicast */ | ||
183 | |||
184 | if (trh->saddr[0] & TR_RII) { | ||
185 | riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8; | ||
186 | if ((ntohs(trh->rcf) >> 13) != 0) | ||
187 | return bus_mac; /* ARE or STE */ | ||
188 | } else | ||
189 | return trh->daddr; /* not source routed */ | ||
190 | |||
191 | if (riflen < 6) | ||
192 | return trh->daddr; /* last hop, source routed */ | ||
193 | |||
194 | /* riflen is 6 or more, packet has more than one route descriptor */ | ||
195 | num_rdsc = (riflen / 2) - 1; | ||
196 | memset(rdesc, 0, ETH_ALEN); | ||
197 | /* offset 4 comes from LAN destination field in LE control frames */ | ||
198 | if (trh->rcf & htons((uint16_t) TR_RCF_DIR_BIT)) | ||
199 | memcpy(&rdesc[4], &trh->rseg[num_rdsc - 2], sizeof(__be16)); | ||
200 | else { | ||
201 | memcpy(&rdesc[4], &trh->rseg[1], sizeof(__be16)); | ||
202 | rdesc[5] = ((ntohs(trh->rseg[0]) & 0x000f) | (rdesc[5] & 0xf0)); | ||
203 | } | ||
204 | |||
205 | return NULL; | ||
206 | } | ||
207 | #endif /* CONFIG_TR */ | ||
208 | |||
209 | /* | ||
210 | * Open/initialize the netdevice. This is called (in the current kernel) | 161 | * Open/initialize the netdevice. This is called (in the current kernel) |
211 | * sometime after booting when the 'ifconfig' program is run. | 162 | * sometime after booting when the 'ifconfig' program is run. |
212 | * | 163 | * |
@@ -257,9 +208,6 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb, | |||
257 | struct lec_arp_table *entry; | 208 | struct lec_arp_table *entry; |
258 | unsigned char *dst; | 209 | unsigned char *dst; |
259 | int min_frame_size; | 210 | int min_frame_size; |
260 | #ifdef CONFIG_TR | ||
261 | unsigned char rdesc[ETH_ALEN]; /* Token Ring route descriptor */ | ||
262 | #endif | ||
263 | int is_rdesc; | 211 | int is_rdesc; |
264 | 212 | ||
265 | pr_debug("called\n"); | 213 | pr_debug("called\n"); |
@@ -290,24 +238,10 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb, | |||
290 | } | 238 | } |
291 | skb_push(skb, 2); | 239 | skb_push(skb, 2); |
292 | 240 | ||
293 | /* Put le header to place, works for TokenRing too */ | 241 | /* Put le header to place */ |
294 | lec_h = (struct lecdatahdr_8023 *)skb->data; | 242 | lec_h = (struct lecdatahdr_8023 *)skb->data; |
295 | lec_h->le_header = htons(priv->lecid); | 243 | lec_h->le_header = htons(priv->lecid); |
296 | 244 | ||
297 | #ifdef CONFIG_TR | ||
298 | /* | ||
299 | * Ugly. Use this to realign Token Ring packets for | ||
300 | * e.g. PCA-200E driver. | ||
301 | */ | ||
302 | if (priv->is_trdev) { | ||
303 | skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN); | ||
304 | kfree_skb(skb); | ||
305 | if (skb2 == NULL) | ||
306 | return NETDEV_TX_OK; | ||
307 | skb = skb2; | ||
308 | } | ||
309 | #endif | ||
310 | |||
311 | #if DUMP_PACKETS >= 2 | 245 | #if DUMP_PACKETS >= 2 |
312 | #define MAX_DUMP_SKB 99 | 246 | #define MAX_DUMP_SKB 99 |
313 | #elif DUMP_PACKETS >= 1 | 247 | #elif DUMP_PACKETS >= 1 |
@@ -321,12 +255,7 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb, | |||
321 | #endif /* DUMP_PACKETS >= 1 */ | 255 | #endif /* DUMP_PACKETS >= 1 */ |
322 | 256 | ||
323 | /* Minimum ethernet-frame size */ | 257 | /* Minimum ethernet-frame size */ |
324 | #ifdef CONFIG_TR | 258 | min_frame_size = LEC_MINIMUM_8023_SIZE; |
325 | if (priv->is_trdev) | ||
326 | min_frame_size = LEC_MINIMUM_8025_SIZE; | ||
327 | else | ||
328 | #endif | ||
329 | min_frame_size = LEC_MINIMUM_8023_SIZE; | ||
330 | if (skb->len < min_frame_size) { | 259 | if (skb->len < min_frame_size) { |
331 | if ((skb->len + skb_tailroom(skb)) < min_frame_size) { | 260 | if ((skb->len + skb_tailroom(skb)) < min_frame_size) { |
332 | skb2 = skb_copy_expand(skb, 0, | 261 | skb2 = skb_copy_expand(skb, 0, |
@@ -345,15 +274,6 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb, | |||
345 | /* Send to right vcc */ | 274 | /* Send to right vcc */ |
346 | is_rdesc = 0; | 275 | is_rdesc = 0; |
347 | dst = lec_h->h_dest; | 276 | dst = lec_h->h_dest; |
348 | #ifdef CONFIG_TR | ||
349 | if (priv->is_trdev) { | ||
350 | dst = get_tr_dst(skb->data + 2, rdesc); | ||
351 | if (dst == NULL) { | ||
352 | dst = rdesc; | ||
353 | is_rdesc = 1; | ||
354 | } | ||
355 | } | ||
356 | #endif | ||
357 | entry = NULL; | 277 | entry = NULL; |
358 | vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry); | 278 | vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry); |
359 | pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n", | 279 | pr_debug("%s:vcc:%p vcc_flags:%lx, entry:%p\n", |
@@ -710,12 +630,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
710 | dev_kfree_skb(skb); | 630 | dev_kfree_skb(skb); |
711 | return; | 631 | return; |
712 | } | 632 | } |
713 | #ifdef CONFIG_TR | 633 | dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest; |
714 | if (priv->is_trdev) | ||
715 | dst = ((struct lecdatahdr_8025 *)skb->data)->h_dest; | ||
716 | else | ||
717 | #endif | ||
718 | dst = ((struct lecdatahdr_8023 *)skb->data)->h_dest; | ||
719 | 634 | ||
720 | /* | 635 | /* |
721 | * If this is a Data Direct VCC, and the VCC does not match | 636 | * If this is a Data Direct VCC, and the VCC does not match |
@@ -723,16 +638,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
723 | */ | 638 | */ |
724 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 639 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
725 | if (lec_is_data_direct(vcc)) { | 640 | if (lec_is_data_direct(vcc)) { |
726 | #ifdef CONFIG_TR | 641 | src = ((struct lecdatahdr_8023 *)skb->data)->h_source; |
727 | if (priv->is_trdev) | ||
728 | src = | ||
729 | ((struct lecdatahdr_8025 *)skb->data)-> | ||
730 | h_source; | ||
731 | else | ||
732 | #endif | ||
733 | src = | ||
734 | ((struct lecdatahdr_8023 *)skb->data)-> | ||
735 | h_source; | ||
736 | entry = lec_arp_find(priv, src); | 642 | entry = lec_arp_find(priv, src); |
737 | if (entry && entry->vcc != vcc) { | 643 | if (entry && entry->vcc != vcc) { |
738 | lec_arp_remove(priv, entry); | 644 | lec_arp_remove(priv, entry); |
@@ -750,12 +656,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
750 | if (!hlist_empty(&priv->lec_arp_empty_ones)) | 656 | if (!hlist_empty(&priv->lec_arp_empty_ones)) |
751 | lec_arp_check_empties(priv, vcc, skb); | 657 | lec_arp_check_empties(priv, vcc, skb); |
752 | skb_pull(skb, 2); /* skip lec_id */ | 658 | skb_pull(skb, 2); /* skip lec_id */ |
753 | #ifdef CONFIG_TR | 659 | skb->protocol = eth_type_trans(skb, dev); |
754 | if (priv->is_trdev) | ||
755 | skb->protocol = tr_type_trans(skb, dev); | ||
756 | else | ||
757 | #endif | ||
758 | skb->protocol = eth_type_trans(skb, dev); | ||
759 | dev->stats.rx_packets++; | 660 | dev->stats.rx_packets++; |
760 | dev->stats.rx_bytes += skb->len; | 661 | dev->stats.rx_bytes += skb->len; |
761 | memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); | 662 | memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); |
@@ -827,27 +728,13 @@ static int lecd_attach(struct atm_vcc *vcc, int arg) | |||
827 | i = 0; | 728 | i = 0; |
828 | else | 729 | else |
829 | i = arg; | 730 | i = arg; |
830 | #ifdef CONFIG_TR | ||
831 | if (arg >= MAX_LEC_ITF) | 731 | if (arg >= MAX_LEC_ITF) |
832 | return -EINVAL; | 732 | return -EINVAL; |
833 | #else /* Reserve the top NUM_TR_DEVS for TR */ | ||
834 | if (arg >= (MAX_LEC_ITF - NUM_TR_DEVS)) | ||
835 | return -EINVAL; | ||
836 | #endif | ||
837 | if (!dev_lec[i]) { | 733 | if (!dev_lec[i]) { |
838 | int is_trdev, size; | 734 | int size; |
839 | |||
840 | is_trdev = 0; | ||
841 | if (i >= (MAX_LEC_ITF - NUM_TR_DEVS)) | ||
842 | is_trdev = 1; | ||
843 | 735 | ||
844 | size = sizeof(struct lec_priv); | 736 | size = sizeof(struct lec_priv); |
845 | #ifdef CONFIG_TR | 737 | dev_lec[i] = alloc_etherdev(size); |
846 | if (is_trdev) | ||
847 | dev_lec[i] = alloc_trdev(size); | ||
848 | else | ||
849 | #endif | ||
850 | dev_lec[i] = alloc_etherdev(size); | ||
851 | if (!dev_lec[i]) | 738 | if (!dev_lec[i]) |
852 | return -ENOMEM; | 739 | return -ENOMEM; |
853 | dev_lec[i]->netdev_ops = &lec_netdev_ops; | 740 | dev_lec[i]->netdev_ops = &lec_netdev_ops; |
@@ -858,7 +745,6 @@ static int lecd_attach(struct atm_vcc *vcc, int arg) | |||
858 | } | 745 | } |
859 | 746 | ||
860 | priv = netdev_priv(dev_lec[i]); | 747 | priv = netdev_priv(dev_lec[i]); |
861 | priv->is_trdev = is_trdev; | ||
862 | } else { | 748 | } else { |
863 | priv = netdev_priv(dev_lec[i]); | 749 | priv = netdev_priv(dev_lec[i]); |
864 | if (priv->lecd) | 750 | if (priv->lecd) |
@@ -2372,15 +2258,7 @@ lec_arp_check_empties(struct lec_priv *priv, | |||
2372 | struct hlist_node *node, *next; | 2258 | struct hlist_node *node, *next; |
2373 | struct lec_arp_table *entry, *tmp; | 2259 | struct lec_arp_table *entry, *tmp; |
2374 | struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data; | 2260 | struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data; |
2375 | unsigned char *src; | 2261 | unsigned char *src = hdr->h_source; |
2376 | #ifdef CONFIG_TR | ||
2377 | struct lecdatahdr_8025 *tr_hdr = (struct lecdatahdr_8025 *)skb->data; | ||
2378 | |||
2379 | if (priv->is_trdev) | ||
2380 | src = tr_hdr->h_source; | ||
2381 | else | ||
2382 | #endif | ||
2383 | src = hdr->h_source; | ||
2384 | 2262 | ||
2385 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 2263 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
2386 | hlist_for_each_entry_safe(entry, node, next, | 2264 | hlist_for_each_entry_safe(entry, node, next, |
diff --git a/net/atm/lec.h b/net/atm/lec.h index dfc071966463..c730e57de199 100644 --- a/net/atm/lec.h +++ b/net/atm/lec.h | |||
@@ -142,7 +142,6 @@ struct lec_priv { | |||
142 | int itfnum; /* e.g. 2 for lec2, 5 for lec5 */ | 142 | int itfnum; /* e.g. 2 for lec2, 5 for lec5 */ |
143 | struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */ | 143 | struct lane2_ops *lane2_ops; /* can be NULL for LANE v1 */ |
144 | int is_proxy; /* bridge between ATM and Ethernet */ | 144 | int is_proxy; /* bridge between ATM and Ethernet */ |
145 | int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */ | ||
146 | }; | 145 | }; |
147 | 146 | ||
148 | struct lec_vcc_priv { | 147 | struct lec_vcc_priv { |
diff --git a/net/core/dev.c b/net/core/dev.c index 3dd853998d38..66cae6e975d9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -300,10 +300,9 @@ static const unsigned short netdev_lock_type[] = | |||
300 | ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE, | 300 | ARPHRD_BIF, ARPHRD_SIT, ARPHRD_IPDDP, ARPHRD_IPGRE, |
301 | ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET, | 301 | ARPHRD_PIMREG, ARPHRD_HIPPI, ARPHRD_ASH, ARPHRD_ECONET, |
302 | ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL, | 302 | ARPHRD_IRDA, ARPHRD_FCPP, ARPHRD_FCAL, ARPHRD_FCPL, |
303 | ARPHRD_FCFABRIC, ARPHRD_IEEE802_TR, ARPHRD_IEEE80211, | 303 | ARPHRD_FCFABRIC, ARPHRD_IEEE80211, ARPHRD_IEEE80211_PRISM, |
304 | ARPHRD_IEEE80211_PRISM, ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, | 304 | ARPHRD_IEEE80211_RADIOTAP, ARPHRD_PHONET, ARPHRD_PHONET_PIPE, |
305 | ARPHRD_PHONET_PIPE, ARPHRD_IEEE802154, | 305 | ARPHRD_IEEE802154, ARPHRD_VOID, ARPHRD_NONE}; |
306 | ARPHRD_VOID, ARPHRD_NONE}; | ||
307 | 306 | ||
308 | static const char *const netdev_lock_name[] = | 307 | static const char *const netdev_lock_name[] = |
309 | {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25", | 308 | {"_xmit_NETROM", "_xmit_ETHER", "_xmit_EETHER", "_xmit_AX25", |
@@ -318,10 +317,9 @@ static const char *const netdev_lock_name[] = | |||
318 | "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE", | 317 | "_xmit_BIF", "_xmit_SIT", "_xmit_IPDDP", "_xmit_IPGRE", |
319 | "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET", | 318 | "_xmit_PIMREG", "_xmit_HIPPI", "_xmit_ASH", "_xmit_ECONET", |
320 | "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL", | 319 | "_xmit_IRDA", "_xmit_FCPP", "_xmit_FCAL", "_xmit_FCPL", |
321 | "_xmit_FCFABRIC", "_xmit_IEEE802_TR", "_xmit_IEEE80211", | 320 | "_xmit_FCFABRIC", "_xmit_IEEE80211", "_xmit_IEEE80211_PRISM", |
322 | "_xmit_IEEE80211_PRISM", "_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", | 321 | "_xmit_IEEE80211_RADIOTAP", "_xmit_PHONET", "_xmit_PHONET_PIPE", |
323 | "_xmit_PHONET_PIPE", "_xmit_IEEE802154", | 322 | "_xmit_IEEE802154", "_xmit_VOID", "_xmit_NONE"}; |
324 | "_xmit_VOID", "_xmit_NONE"}; | ||
325 | 323 | ||
326 | static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; | 324 | static struct lock_class_key netdev_xmit_lock_key[ARRAY_SIZE(netdev_lock_type)]; |
327 | static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)]; | 325 | static struct lock_class_key netdev_addr_lock_key[ARRAY_SIZE(netdev_lock_type)]; |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 2c8febd3ebda..20f1cb5c8aba 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -262,8 +262,8 @@ config ARPD | |||
262 | bool "IP: ARP daemon support" | 262 | bool "IP: ARP daemon support" |
263 | ---help--- | 263 | ---help--- |
264 | The kernel maintains an internal cache which maps IP addresses to | 264 | The kernel maintains an internal cache which maps IP addresses to |
265 | hardware addresses on the local network, so that Ethernet/Token Ring/ | 265 | hardware addresses on the local network, so that Ethernet |
266 | etc. frames are sent to the proper address on the physical networking | 266 | frames are sent to the proper address on the physical networking |
267 | layer. Normally, kernel uses the ARP protocol to resolve these | 267 | layer. Normally, kernel uses the ARP protocol to resolve these |
268 | mappings. | 268 | mappings. |
269 | 269 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 3e2bf3dedce5..cda37be02f8d 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -91,7 +91,6 @@ | |||
91 | #include <linux/etherdevice.h> | 91 | #include <linux/etherdevice.h> |
92 | #include <linux/fddidevice.h> | 92 | #include <linux/fddidevice.h> |
93 | #include <linux/if_arp.h> | 93 | #include <linux/if_arp.h> |
94 | #include <linux/trdevice.h> | ||
95 | #include <linux/skbuff.h> | 94 | #include <linux/skbuff.h> |
96 | #include <linux/proc_fs.h> | 95 | #include <linux/proc_fs.h> |
97 | #include <linux/seq_file.h> | 96 | #include <linux/seq_file.h> |
@@ -195,9 +194,6 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir) | |||
195 | case ARPHRD_IEEE802: | 194 | case ARPHRD_IEEE802: |
196 | ip_eth_mc_map(addr, haddr); | 195 | ip_eth_mc_map(addr, haddr); |
197 | return 0; | 196 | return 0; |
198 | case ARPHRD_IEEE802_TR: | ||
199 | ip_tr_mc_map(addr, haddr); | ||
200 | return 0; | ||
201 | case ARPHRD_INFINIBAND: | 197 | case ARPHRD_INFINIBAND: |
202 | ip_ib_mc_map(addr, dev->broadcast, haddr); | 198 | ip_ib_mc_map(addr, dev->broadcast, haddr); |
203 | return 0; | 199 | return 0; |
@@ -649,12 +645,6 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, | |||
649 | arp->ar_pro = htons(ETH_P_IP); | 645 | arp->ar_pro = htons(ETH_P_IP); |
650 | break; | 646 | break; |
651 | #endif | 647 | #endif |
652 | #if IS_ENABLED(CONFIG_TR) | ||
653 | case ARPHRD_IEEE802_TR: | ||
654 | arp->ar_hrd = htons(ARPHRD_IEEE802); | ||
655 | arp->ar_pro = htons(ETH_P_IP); | ||
656 | break; | ||
657 | #endif | ||
658 | } | 648 | } |
659 | 649 | ||
660 | arp->ar_hln = dev->addr_len; | 650 | arp->ar_hln = dev->addr_len; |
@@ -752,11 +742,10 @@ static int arp_process(struct sk_buff *skb) | |||
752 | goto out; | 742 | goto out; |
753 | break; | 743 | break; |
754 | case ARPHRD_ETHER: | 744 | case ARPHRD_ETHER: |
755 | case ARPHRD_IEEE802_TR: | ||
756 | case ARPHRD_FDDI: | 745 | case ARPHRD_FDDI: |
757 | case ARPHRD_IEEE802: | 746 | case ARPHRD_IEEE802: |
758 | /* | 747 | /* |
759 | * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802 | 748 | * ETHERNET, and Fibre Channel (which are IEEE 802 |
760 | * devices, according to RFC 2625) devices will accept ARP | 749 | * devices, according to RFC 2625) devices will accept ARP |
761 | * hardware types of either 1 (Ethernet) or 6 (IEEE 802.2). | 750 | * hardware types of either 1 (Ethernet) or 6 (IEEE 802.2). |
762 | * This is the case also of FDDI, where the RFC 1390 says that | 751 | * This is the case also of FDDI, where the RFC 1390 says that |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 24a3df9890e1..430015010e57 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -808,8 +808,6 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d | |||
808 | b->op = BOOTP_REQUEST; | 808 | b->op = BOOTP_REQUEST; |
809 | if (dev->type < 256) /* check for false types */ | 809 | if (dev->type < 256) /* check for false types */ |
810 | b->htype = dev->type; | 810 | b->htype = dev->type; |
811 | else if (dev->type == ARPHRD_IEEE802_TR) /* fix for token ring */ | ||
812 | b->htype = ARPHRD_IEEE802; | ||
813 | else if (dev->type == ARPHRD_FDDI) | 811 | else if (dev->type == ARPHRD_FDDI) |
814 | b->htype = ARPHRD_ETHER; | 812 | b->htype = ARPHRD_ETHER; |
815 | else { | 813 | else { |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 8ec009c0b2bc..8f6411c97189 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1573,7 +1573,6 @@ static int ipv6_generate_eui64(u8 *eui, struct net_device *dev) | |||
1573 | switch (dev->type) { | 1573 | switch (dev->type) { |
1574 | case ARPHRD_ETHER: | 1574 | case ARPHRD_ETHER: |
1575 | case ARPHRD_FDDI: | 1575 | case ARPHRD_FDDI: |
1576 | case ARPHRD_IEEE802_TR: | ||
1577 | return addrconf_ifid_eui48(eui, dev); | 1576 | return addrconf_ifid_eui48(eui, dev); |
1578 | case ARPHRD_ARCNET: | 1577 | case ARPHRD_ARCNET: |
1579 | return addrconf_ifid_arcnet(eui, dev); | 1578 | return addrconf_ifid_arcnet(eui, dev); |
@@ -2441,7 +2440,6 @@ static void addrconf_dev_config(struct net_device *dev) | |||
2441 | 2440 | ||
2442 | if ((dev->type != ARPHRD_ETHER) && | 2441 | if ((dev->type != ARPHRD_ETHER) && |
2443 | (dev->type != ARPHRD_FDDI) && | 2442 | (dev->type != ARPHRD_FDDI) && |
2444 | (dev->type != ARPHRD_IEEE802_TR) && | ||
2445 | (dev->type != ARPHRD_ARCNET) && | 2443 | (dev->type != ARPHRD_ARCNET) && |
2446 | (dev->type != ARPHRD_INFINIBAND) && | 2444 | (dev->type != ARPHRD_INFINIBAND) && |
2447 | (dev->type != ARPHRD_IEEE802154)) { | 2445 | (dev->type != ARPHRD_IEEE802154)) { |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 511e5b4bb610..cbb863d66481 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -327,9 +327,6 @@ int ndisc_mc_map(const struct in6_addr *addr, char *buf, struct net_device *dev, | |||
327 | case ARPHRD_FDDI: | 327 | case ARPHRD_FDDI: |
328 | ipv6_eth_mc_map(addr, buf); | 328 | ipv6_eth_mc_map(addr, buf); |
329 | return 0; | 329 | return 0; |
330 | case ARPHRD_IEEE802_TR: | ||
331 | ipv6_tr_mc_map(addr,buf); | ||
332 | return 0; | ||
333 | case ARPHRD_ARCNET: | 330 | case ARPHRD_ARCNET: |
334 | ipv6_arcnet_mc_map(addr, buf); | 331 | ipv6_arcnet_mc_map(addr, buf); |
335 | return 0; | 332 | return 0; |
@@ -795,20 +792,6 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
795 | 792 | ||
796 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { | 793 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { |
797 | if (dad) { | 794 | if (dad) { |
798 | if (dev->type == ARPHRD_IEEE802_TR) { | ||
799 | const unsigned char *sadr; | ||
800 | sadr = skb_mac_header(skb); | ||
801 | if (((sadr[8] ^ dev->dev_addr[0]) & 0x7f) == 0 && | ||
802 | sadr[9] == dev->dev_addr[1] && | ||
803 | sadr[10] == dev->dev_addr[2] && | ||
804 | sadr[11] == dev->dev_addr[3] && | ||
805 | sadr[12] == dev->dev_addr[4] && | ||
806 | sadr[13] == dev->dev_addr[5]) { | ||
807 | /* looped-back to us */ | ||
808 | goto out; | ||
809 | } | ||
810 | } | ||
811 | |||
812 | /* | 795 | /* |
813 | * We are colliding with another node | 796 | * We are colliding with another node |
814 | * who is doing DAD | 797 | * who is doing DAD |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 9680226640ef..824d4a3338ae 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -983,10 +983,6 @@ static int ipxitf_create(struct ipx_interface_definition *idef) | |||
983 | goto out; | 983 | goto out; |
984 | 984 | ||
985 | switch (idef->ipx_dlink_type) { | 985 | switch (idef->ipx_dlink_type) { |
986 | case IPX_FRAME_TR_8022: | ||
987 | printk(KERN_WARNING "IPX frame type 802.2TR is " | ||
988 | "obsolete Use 802.2 instead.\n"); | ||
989 | /* fall through */ | ||
990 | case IPX_FRAME_8022: | 986 | case IPX_FRAME_8022: |
991 | dlink_type = htons(ETH_P_802_2); | 987 | dlink_type = htons(ETH_P_802_2); |
992 | datalink = p8022_datalink; | 988 | datalink = p8022_datalink; |
@@ -996,10 +992,7 @@ static int ipxitf_create(struct ipx_interface_definition *idef) | |||
996 | dlink_type = htons(ETH_P_IPX); | 992 | dlink_type = htons(ETH_P_IPX); |
997 | datalink = pEII_datalink; | 993 | datalink = pEII_datalink; |
998 | break; | 994 | break; |
999 | } else | 995 | } |
1000 | printk(KERN_WARNING "IPX frame type EtherII over " | ||
1001 | "token-ring is obsolete. Use SNAP " | ||
1002 | "instead.\n"); | ||
1003 | /* fall through */ | 996 | /* fall through */ |
1004 | case IPX_FRAME_SNAP: | 997 | case IPX_FRAME_SNAP: |
1005 | dlink_type = htons(ETH_P_SNAP); | 998 | dlink_type = htons(ETH_P_SNAP); |
@@ -1275,7 +1268,6 @@ const char *ipx_frame_name(__be16 frame) | |||
1275 | case ETH_P_802_2: rc = "802.2"; break; | 1268 | case ETH_P_802_2: rc = "802.2"; break; |
1276 | case ETH_P_SNAP: rc = "SNAP"; break; | 1269 | case ETH_P_SNAP: rc = "SNAP"; break; |
1277 | case ETH_P_802_3: rc = "802.3"; break; | 1270 | case ETH_P_802_3: rc = "802.3"; break; |
1278 | case ETH_P_TR_802_2: rc = "802.2TR"; break; | ||
1279 | } | 1271 | } |
1280 | 1272 | ||
1281 | return rc; | 1273 | return rc; |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 78424f41cf36..e9440753e16b 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -71,8 +71,7 @@ static inline u16 llc_ui_next_link_no(int sap) | |||
71 | */ | 71 | */ |
72 | static inline __be16 llc_proto_type(u16 arphrd) | 72 | static inline __be16 llc_proto_type(u16 arphrd) |
73 | { | 73 | { |
74 | return arphrd == ARPHRD_IEEE802_TR ? | 74 | return htons(ETH_P_802_2); |
75 | htons(ETH_P_TR_802_2) : htons(ETH_P_802_2); | ||
76 | } | 75 | } |
77 | 76 | ||
78 | /** | 77 | /** |
diff --git a/net/llc/llc_output.c b/net/llc/llc_output.c index b658cba89fdd..2dae8a5df23f 100644 --- a/net/llc/llc_output.c +++ b/net/llc/llc_output.c | |||
@@ -14,9 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/if_arp.h> | 16 | #include <linux/if_arp.h> |
17 | #include <linux/if_tr.h> | ||
18 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
19 | #include <linux/trdevice.h> | ||
20 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
21 | #include <linux/export.h> | 19 | #include <linux/export.h> |
22 | #include <net/llc.h> | 20 | #include <net/llc.h> |
@@ -37,7 +35,6 @@ int llc_mac_hdr_init(struct sk_buff *skb, | |||
37 | int rc = -EINVAL; | 35 | int rc = -EINVAL; |
38 | 36 | ||
39 | switch (skb->dev->type) { | 37 | switch (skb->dev->type) { |
40 | case ARPHRD_IEEE802_TR: | ||
41 | case ARPHRD_ETHER: | 38 | case ARPHRD_ETHER: |
42 | case ARPHRD_LOOPBACK: | 39 | case ARPHRD_LOOPBACK: |
43 | rc = dev_hard_header(skb, skb->dev, ETH_P_802_2, da, sa, | 40 | rc = dev_hard_header(skb, skb->dev, ETH_P_802_2, da, sa, |
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 94e7fca75b85..7c5073badc73 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c | |||
@@ -31,10 +31,6 @@ static int llc_mac_header_len(unsigned short devtype) | |||
31 | case ARPHRD_ETHER: | 31 | case ARPHRD_ETHER: |
32 | case ARPHRD_LOOPBACK: | 32 | case ARPHRD_LOOPBACK: |
33 | return sizeof(struct ethhdr); | 33 | return sizeof(struct ethhdr); |
34 | #if defined(CONFIG_TR) || defined(CONFIG_TR_MODULE) | ||
35 | case ARPHRD_IEEE802_TR: | ||
36 | return sizeof(struct trh_hdr); | ||
37 | #endif | ||
38 | } | 34 | } |
39 | return 0; | 35 | return 0; |
40 | } | 36 | } |
diff --git a/net/sysctl_net.c b/net/sysctl_net.c index f3e813a8d107..e3a6e37cd1c5 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c | |||
@@ -26,10 +26,6 @@ | |||
26 | #include <linux/if_ether.h> | 26 | #include <linux/if_ether.h> |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #ifdef CONFIG_TR | ||
30 | #include <linux/if_tr.h> | ||
31 | #endif | ||
32 | |||
33 | static struct ctl_table_set * | 29 | static struct ctl_table_set * |
34 | net_ctl_header_lookup(struct ctl_table_root *root, struct nsproxy *namespaces) | 30 | net_ctl_header_lookup(struct ctl_table_root *root, struct nsproxy *namespaces) |
35 | { | 31 | { |