aboutsummaryrefslogtreecommitdiffstats
path: root/net/802/p8022.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/802/p8022.c
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'net/802/p8022.c')
-rw-r--r--net/802/p8022.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/net/802/p8022.c b/net/802/p8022.c
new file mode 100644
index 00000000000..5ae63416df6
--- /dev/null
+++ b/net/802/p8022.c
@@ -0,0 +1,65 @@
1/*
2 * NET3: Support for 802.2 demultiplexing off Ethernet (Token ring
3 * is kept separate see p8022tr.c)
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 * Demultiplex 802.2 encoded protocols. We match the entry by the
10 * SSAP/DSAP pair and then deliver to the registered datalink that
11 * matches. The control byte is ignored and handling of such items
12 * is up to the routine passed the frame.
13 *
14 * Unlike the 802.3 datalink we have a list of 802.2 entries as
15 * there are multiple protocols to demux. The list is currently
16 * short (3 or 4 entries at most). The current demux assumes this.
17 */
18#include <linux/module.h>
19#include <linux/netdevice.h>
20#include <linux/skbuff.h>
21#include <net/datalink.h>
22#include <linux/mm.h>
23#include <linux/in.h>
24#include <linux/init.h>
25#include <net/llc.h>
26#include <net/p8022.h>
27
28static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
29 unsigned char *dest)
30{
31 llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap);
32 return 0;
33}
34
35struct datalink_proto *register_8022_client(unsigned char type,
36 int (*func)(struct sk_buff *skb,
37 struct net_device *dev,
38 struct packet_type *pt))
39{
40 struct datalink_proto *proto;
41
42 proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
43 if (proto) {
44 proto->type[0] = type;
45 proto->header_length = 3;
46 proto->request = p8022_request;
47 proto->sap = llc_sap_open(type, func);
48 if (!proto->sap) {
49 kfree(proto);
50 proto = NULL;
51 }
52 }
53 return proto;
54}
55
56void unregister_8022_client(struct datalink_proto *proto)
57{
58 llc_sap_close(proto->sap);
59 kfree(proto);
60}
61
62EXPORT_SYMBOL(register_8022_client);
63EXPORT_SYMBOL(unregister_8022_client);
64
65MODULE_LICENSE("GPL");