]> git.neil.brown.name Git - history.git/commitdiff
o LLC: remove unused mac_dev_peer
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>
Mon, 30 Sep 2002 08:28:36 +0000 (05:28 -0300)
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>
Mon, 30 Sep 2002 08:28:36 +0000 (05:28 -0300)
Also move code around in llc_sap.c so that we don't need the prototypes
on the top, makes cflags actually work when finding those functions,
not going to the prototypes instead of the actual functions.

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

index e87850701db634e0f9a78ce5cb7d99d31b19b7eb..ded7c830b8a8a8c1231270b613a6da77485d29a0 100644 (file)
@@ -13,8 +13,6 @@
  */
 extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
                   struct packet_type *pt);
-extern struct net_device *mac_dev_peer(struct net_device *current_dev,
-                                      int type, u8 *mac);
 extern u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da);
 extern int llc_conn_rcv(struct sock *sk, struct sk_buff *skb);
 
index ee1f20a51958eafda2351b5c1edc63658fc33c70..1f1d241732a635e94587ee2a8c2a1f408626fccf 100644 (file)
@@ -26,7 +26,6 @@
 #include <net/llc_c_ac.h>
 #include <net/llc_c_st.h>
 #include <net/llc_main.h>
-#include <net/llc_mac.h>
 
 /**
  *     llc_sap_open - open interface to the upper layers.
index 7015d55ce74832bfc49aa4fc475c3bbd834f85ff..ae97f73a607b47bd6b7833febce864b8b82f5ad0 100644 (file)
@@ -294,27 +294,3 @@ u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da)
        }
        return rc;
 }
-
-/**
- *     mac_dev_peer - search the appropriate dev to send packets to peer
- *     @current_dev - Current device suggested by upper layer
- *     @type - hardware type
- *     @mac - mac address
- *
- *     Check if the we should use loopback to send packets, i.e., if the
- *     dmac belongs to one of the local interfaces, returning the pointer
- *     to the loopback &net_device struct or the current_dev if it is not
- *     local.
- */
-struct net_device *mac_dev_peer(struct net_device *current_dev, int type,
-                               u8 *mac)
-{
-       struct net_device *dev;
-
-        rtnl_lock();
-        dev = dev_getbyhwaddr(type, mac);
-        if (dev)
-                dev = __dev_get_by_name("lo");
-        rtnl_unlock();
-       return dev ? : current_dev;
-}
index 069ec96c93123c75b1bd7da1260b8aff7c41a4ba..b5d047e9154fb18c5a3fc096db74e9a400c09335 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/if_tr.h>
 #include <net/llc_pdu.h>
 #include <net/llc_if.h>
-#include <net/llc_mac.h>
 #include <net/llc_main.h>
 
 static void llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type);
index 28ae6a659658f5fde043f90008cd9a018c815a51..7cd6bb115a8b907fa687f681451b8f6a8524d98e 100644 (file)
 #include <net/sock.h>
 #include <linux/tcp.h>
 #include <net/llc_main.h>
-#include <net/llc_mac.h>
 #include <net/llc_pdu.h>
 #include <linux/if_tr.h>
 
-static int llc_sap_next_state(struct llc_sap *sap, struct sk_buff *skb);
-static int llc_exec_sap_trans_actions(struct llc_sap *sap,
-                                     struct llc_sap_state_trans *trans,
-                                     struct sk_buff *skb);
-static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
-                                                     struct sk_buff *skb);
-
 /**
  *     llc_sap_assign_sock - adds a connection to a SAP
  *     @sap: pointer to SAP.
@@ -75,41 +67,6 @@ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk)
        write_unlock_bh(&sap->sk_list.lock);
 }
 
-/**
- *     llc_sap_state_process - sends event to SAP state machine
- *     @sap: sap to use
- *     @skb: pointer to occurred event
- *
- *     After executing actions of the event, upper layer will be indicated
- *     if needed(on receiving an UI frame). sk can be null for the
- *     datalink_proto case.
- */
-void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb)
-{
-       struct llc_sap_state_ev *ev = llc_sap_ev(skb);
-
-       /*
-        * We have to hold the skb, because llc_sap_next_state
-        * will kfree it in the sending path and we need to
-        * look at the skb->cb, where we encode llc_sap_state_ev.
-        */
-       skb_get(skb);
-       ev->ind_cfm_flag = 0;
-       llc_sap_next_state(sap, skb);
-       if (ev->ind_cfm_flag == LLC_IND) {
-               if (skb->sk->state == TCP_LISTEN)
-                       kfree_skb(skb);
-               else {
-                       llc_save_primitive(skb, ev->prim);
-
-                       /* queue skb to the user. */
-                       if (sock_queue_rcv_skb(skb->sk, skb))
-                               kfree_skb(skb);
-               }
-       } 
-       kfree_skb(skb);
-}
-
 /**
  *     llc_sap_rtn_pdu - Informs upper layer on rx of an UI, XID or TEST pdu.
  *     @sap: pointer to SAP
@@ -117,10 +74,9 @@ void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb)
  */
 void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb)
 {
-       struct llc_pdu_un *pdu;
        struct llc_sap_state_ev *ev = llc_sap_ev(skb);
+       struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
 
-       pdu = llc_pdu_un_hdr(skb);
        switch (LLC_U_PDU_RSP(pdu)) {
        case LLC_1_PDU_CMD_TEST:
                ev->prim = LLC_TEST_PRIM;       break;
@@ -132,38 +88,6 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb)
        ev->ind_cfm_flag = LLC_IND;
 }
 
-/**
- *     llc_sap_next_state - finds transition, execs actions & change SAP state
- *     @sap: pointer to SAP
- *     @skb: happened event
- *
- *     This function finds transition that matches with happened event, then
- *     executes related actions and finally changes state of SAP. It returns
- *     0 on success and 1 for failure.
- */
-static int llc_sap_next_state(struct llc_sap *sap, struct sk_buff *skb)
-{
-       int rc = 1;
-       struct llc_sap_state_trans *trans;
-
-       if (sap->state <= LLC_NR_SAP_STATES) {
-               trans = llc_find_sap_trans(sap, skb);
-               if (trans) {
-                       /* got the state to which we next transition; perform
-                        * the actions associated with this transition before
-                        * actually transitioning to the next state
-                        */
-                       rc = llc_exec_sap_trans_actions(sap, trans, skb);
-                       if (!rc)
-                               /* transition SAP to next state if all actions
-                                * execute successfully
-                                */
-                               sap->state = trans->next_state;
-               }
-       }
-       return rc;
-}
-
 /**
  *     llc_find_sap_trans - finds transition for event
  *     @sap: pointer to SAP
@@ -180,13 +104,13 @@ static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
        struct llc_sap_state_trans *rc = NULL;
        struct llc_sap_state_trans **next_trans;
        struct llc_sap_state *curr_state = &llc_sap_state_table[sap->state - 1];
-       /* search thru events for this state until list exhausted or until
+       /*
+        * Search thru events for this state until list exhausted or until
         * its obvious the event is not valid for the current state
         */
        for (next_trans = curr_state->transitions; next_trans[i]->ev; i++)
                if (!next_trans[i]->ev(sap, skb)) {
-                       /* got event match; return it */
-                       rc = next_trans[i];
+                       rc = next_trans[i]; /* got event match; return it */
                        break;
                }
        return rc;
@@ -213,3 +137,73 @@ static int llc_exec_sap_trans_actions(struct llc_sap *sap,
                        rc = 1;
        return rc;
 }
+
+/**
+ *     llc_sap_next_state - finds transition, execs actions & change SAP state
+ *     @sap: pointer to SAP
+ *     @skb: happened event
+ *
+ *     This function finds transition that matches with happened event, then
+ *     executes related actions and finally changes state of SAP. It returns
+ *     0 on success and 1 for failure.
+ */
+static int llc_sap_next_state(struct llc_sap *sap, struct sk_buff *skb)
+{
+       int rc = 1;
+       struct llc_sap_state_trans *trans;
+
+       if (sap->state > LLC_NR_SAP_STATES)
+               goto out;
+       trans = llc_find_sap_trans(sap, skb);
+       if (!trans)
+               goto out;
+       /*
+        * Got the state to which we next transition; perform the actions
+        * associated with this transition before actually transitioning to the
+        * next state
+        */
+       rc = llc_exec_sap_trans_actions(sap, trans, skb);
+       if (rc)
+               goto out;
+       /*
+        * Transition SAP to next state if all actions execute successfully
+        */
+       sap->state = trans->next_state;
+out:
+       return rc;
+}
+
+/**
+ *     llc_sap_state_process - sends event to SAP state machine
+ *     @sap: sap to use
+ *     @skb: pointer to occurred event
+ *
+ *     After executing actions of the event, upper layer will be indicated
+ *     if needed(on receiving an UI frame). sk can be null for the
+ *     datalink_proto case.
+ */
+void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb)
+{
+       struct llc_sap_state_ev *ev = llc_sap_ev(skb);
+
+       /*
+        * We have to hold the skb, because llc_sap_next_state
+        * will kfree it in the sending path and we need to
+        * look at the skb->cb, where we encode llc_sap_state_ev.
+        */
+       skb_get(skb);
+       ev->ind_cfm_flag = 0;
+       llc_sap_next_state(sap, skb);
+       if (ev->ind_cfm_flag == LLC_IND) {
+               if (skb->sk->state == TCP_LISTEN)
+                       kfree_skb(skb);
+               else {
+                       llc_save_primitive(skb, ev->prim);
+
+                       /* queue skb to the user. */
+                       if (sock_queue_rcv_skb(skb->sk, skb))
+                               kfree_skb(skb);
+               }
+       } 
+       kfree_skb(skb);
+}