]> git.hungrycats.org Git - linux/commitdiff
o LLC: move llc_decode_pdu_type to llc_mac
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>
Mon, 15 Sep 2003 22:18:03 +0000 (19:18 -0300)
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>
Mon, 15 Sep 2003 22:18:03 +0000 (19:18 -0300)
And also rename it to llc_pdu_type and make it return the type,
this is to make llc_mac more and more autonomous of the rest of
the llc code, to the point where it will be a separate loadable
module.

include/net/llc_pdu.h
net/llc/llc_mac.c
net/llc/llc_pdu.c

index 235e6c0bc17ef281453634f26bb5dc9bf24831c5..159878eabbfb8447edcc0d1b08a107f5a6f89ee3 100644 (file)
@@ -243,7 +243,6 @@ extern void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa);
 extern void llc_pdu_decode_da(struct sk_buff *skb, u8 *ds);
 extern void llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap);
 extern void llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap);
-extern void llc_decode_pdu_type(struct sk_buff *skb, u8 *destination);
 extern void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap,
                                u8 dsap, u8 cr);
 extern void llc_pdu_init_as_ui_cmd(struct sk_buff *skb);
index 8180687c64ebbc1eb5812c79d8fb6193041583be..3f5b4c6972a917fb328a54a7b3175b12ec5212b1 100644 (file)
@@ -52,6 +52,39 @@ static void (*llc_type_handlers[2])(struct llc_sap *sap,
        [LLC_DEST_CONN - 1] = llc_conn_handler,
 };
 
+/**
+ *     llc_pdu_type - returns which LLC component must handle for PDU
+ *     @skb: input skb
+ *
+ *     This function returns which LLC component must handle this PDU.
+ */
+static __inline__ int llc_pdu_type(struct sk_buff *skb)
+{
+       int type = LLC_DEST_CONN; /* I-PDU or S-PDU type */
+       struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
+
+       if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U)
+               goto out;
+       switch (LLC_U_PDU_CMD(pdu)) {
+       case LLC_1_PDU_CMD_XID:
+       case LLC_1_PDU_CMD_UI:
+       case LLC_1_PDU_CMD_TEST:
+               type = LLC_DEST_SAP;
+               break;
+       case LLC_2_PDU_CMD_SABME:
+       case LLC_2_PDU_CMD_DISC:
+       case LLC_2_PDU_RSP_UA:
+       case LLC_2_PDU_RSP_DM:
+       case LLC_2_PDU_RSP_FRMR:
+               break;
+       default:
+               type = LLC_DEST_INVALID;
+               break;
+       }
+out:
+       return type;
+}
+
 /**
  *     llc_rcv - 802.2 entry point from net lower layers
  *     @skb: received pdu
@@ -69,7 +102,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
 {
        struct llc_sap *sap;
        struct llc_pdu_sn *pdu;
-       u8 dest;
+       int dest;
 
        /*
         * When the interface is in promisc. mode, drop all the crap that it
@@ -104,7 +137,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
                sap->rcv_func(skb, dev, pt);
                goto out;
        }
-       llc_decode_pdu_type(skb, &dest);
+       dest = llc_pdu_type(skb);
        if (unlikely(!dest || !llc_type_handlers[dest - 1]))
                goto drop;
        llc_type_handlers[dest - 1](sap, skb);
index c99273a5d21b34681c39bd488a89bf8517a4407c..f5119b63b583502db8b94d675d665c03a1322bb9 100644 (file)
@@ -532,40 +532,6 @@ static void llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type)
                *type = LLC_PDU_TYPE_I;
 }
 
-/**
- *     llc_decode_pdu_type - designates component LLC must handle for PDU
- *     @skb: input skb
- *     @dest: destination component
- *
- *     This function designates which component of LLC must handle this PDU.
- */
-void llc_decode_pdu_type(struct sk_buff *skb, u8 *dest)
-{
-       u8 type = LLC_DEST_CONN; /* I-PDU or S-PDU type */
-       struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
-
-       if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U)
-               goto out;
-       switch (LLC_U_PDU_CMD(pdu)) {
-       case LLC_1_PDU_CMD_XID:
-       case LLC_1_PDU_CMD_UI:
-       case LLC_1_PDU_CMD_TEST:
-               type = LLC_DEST_SAP;
-               break;
-       case LLC_2_PDU_CMD_SABME:
-       case LLC_2_PDU_CMD_DISC:
-       case LLC_2_PDU_RSP_UA:
-       case LLC_2_PDU_RSP_DM:
-       case LLC_2_PDU_RSP_FRMR:
-               break;
-       default:
-               type = LLC_DEST_INVALID;
-               break;
-       }
-out:
-       *dest = type;
-}
-
 /**
  *     llc_get_hdr_len - designates LLC header length
  *     @type: type of PDU.