]> git.hungrycats.org Git - linux/commitdiff
o LLC: create a register interface for llc_station_rcv
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>
Thu, 18 Sep 2003 16:34:00 +0000 (13:34 -0300)
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>
Thu, 18 Sep 2003 16:34:00 +0000 (13:34 -0300)
include/net/llc_mac.h
net/llc/llc_mac.c
net/llc/llc_main.c
net/llc/llc_s_ac.c

index 6064d6b909b1dd301597c6aa6f1374f82e85bf79..574caad30ece1084278dcce4b153937986315b38 100644 (file)
@@ -25,4 +25,6 @@ struct sk_buff;
 extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
                                                   struct sk_buff *skb));
 extern void llc_remove_pack(int type);
+
+extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
 #endif /* LLC_MAC_H */
index 0330488e7bf28f1953742c5051c74da3ae517108..d7a453b64ba6951120493d4bdb31b2b00569bdbb 100644 (file)
  * See the GNU General Public License for more details.
  */
 #include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/if_tr.h>
-#include <linux/rtnetlink.h>
 #include <net/llc_mac.h>
 #include <net/llc_pdu.h>
 #include <net/llc_sap.h>
 #include <net/llc_main.h>
-#include <net/llc_evnt.h>
-#include <linux/trdevice.h>
 
 #if 0
 #define dprintk(args...) printk(KERN_DEBUG args)
 #define dprintk(args...)
 #endif
 
-static void llc_station_rcv(struct sk_buff *skb);
+/*
+ * Packet handler for the station, registerable because in the minimal
+ * LLC core that is taking shape only the very minimal subset of LLC that
+ * is needed for things like IPX, Appletalk, etc will stay, with all the
+ * rest in the llc1 and llc2 modules.
+ */
+static void (*llc_station_handler)(struct sk_buff *skb);
 
 /*
  * Packet handlers for LLC_DEST_SAP and LLC_DEST_CONN.
  */
 static void (*llc_type_handlers[2])(struct llc_sap *sap,
-                                struct sk_buff *skb);
+                                   struct sk_buff *skb);
 
 void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
                                            struct sk_buff *skb))
@@ -49,6 +50,11 @@ void llc_remove_pack(int type)
                llc_type_handlers[type] = NULL;
 }
 
+void llc_set_station_handler(void (*handler)(struct sk_buff *skb))
+{
+       llc_station_handler = handler;
+}
+
 /**
  *     llc_pdu_type - returns which LLC component must handle for PDU
  *     @skb: input skb
@@ -147,11 +153,8 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
        if (unlikely(!llc_fixup_skb(skb)))
                goto drop;
        pdu = llc_pdu_sn_hdr(skb);
-       if (unlikely(!pdu->dsap)) { /* NULL DSAP, refer to station */
-               dprintk("%s: calling llc_station_rcv!\n", __FUNCTION__);
-               llc_station_rcv(skb);
-               goto out;
-       }
+       if (unlikely(!pdu->dsap)) /* NULL DSAP, refer to station */
+              goto handle_station;
        sap = llc_sap_find(pdu->dsap);
        if (unlikely(!sap)) {/* unknown SAP */
                dprintk("%s: llc_sap_find(%02X) failed!\n", __FUNCTION__,
@@ -175,22 +178,13 @@ out:
 drop:
        kfree_skb(skb);
        goto out;
-}
-
-/*
- *     llc_station_rcv - send received pdu to the station state machine
- *     @skb: received frame.
- *
- *     Sends data unit to station state machine.
- */
-static void llc_station_rcv(struct sk_buff *skb)
-{
-       struct llc_station_state_ev *ev = llc_station_ev(skb);
-
-       ev->type   = LLC_STATION_EV_TYPE_PDU;
-       ev->reason = 0;
-       llc_station_state_process(&llc_main_station, skb);
+handle_station:
+       if (!llc_station_handler)
+               goto drop;
+       llc_station_handler(skb);
+       goto out;
 }
 
 EXPORT_SYMBOL(llc_add_pack);
 EXPORT_SYMBOL(llc_remove_pack);
+EXPORT_SYMBOL(llc_set_station_handler);
index e81cecb144280957e333ab3db0525ab282d50354..19869712797551b5c3a3661a36b7fc49f09e40a3 100644 (file)
@@ -250,6 +250,21 @@ static u16 llc_exec_station_trans_actions(struct llc_station *station,
        return rc;
 }
 
+/*
+ *     llc_station_rcv - send received pdu to the station state machine
+ *     @skb: received frame.
+ *
+ *     Sends data unit to station state machine.
+ */
+static void llc_station_rcv(struct sk_buff *skb)
+{
+       struct llc_station_state_ev *ev = llc_station_ev(skb);
+
+       ev->type   = LLC_STATION_EV_TYPE_PDU;
+       ev->reason = 0;
+       llc_station_state_process(&llc_main_station, skb);
+}
+
 /**
  *     llc_alloc_frame - allocates sk_buff for frame
  *
@@ -303,6 +318,7 @@ static int __init llc_init(void)
        skb = alloc_skb(0, GFP_ATOMIC);
        if (!skb)
                goto err;
+       llc_set_station_handler(llc_station_rcv);
        ev = llc_station_ev(skb);
        memset(ev, 0, sizeof(*ev));
        if (dev_base->next)
@@ -330,6 +346,7 @@ static void __exit llc_exit(void)
 {
        dev_remove_pack(&llc_packet_type);
        dev_remove_pack(&llc_tr_packet_type);
+       llc_set_station_handler(NULL);
 }
 
 module_init(llc_init);
index ffc6634f2b6191fb69392ae2625742b58594e2f3..c63e76e45850f4faad7b3aad1416d98f2258425a 100644 (file)
@@ -24,6 +24,7 @@
 #include <net/llc_s_ev.h>
 #include <net/llc_pdu.h>
 #include <net/llc_mac.h>
+#include "llc_output.h"
 
 /**
  *     llc_sap_action_unit_data_ind - forward UI PDU to network layer