From 71d24cc6cccf45edd7e95619d429f9270a6a0d2f Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 23 Sep 2002 21:04:25 -0300 Subject: [LLC] kill sap->{ind,conf}, finally! With this one the sap->ind and ->conf callbacks are gone, now the core is tightly integrated with the socket layer (PF_LLC) and the datalink_protos are mostly working like when the old LLC stack was in the kernel, i.e. without special receiving routines for IPX in 802.2 mode, now I have to work on the UI sending routines to kill more stupid structs. --- include/net/llc_c_ev.h | 5 ++--- include/net/llc_conn.h | 3 +++ include/net/llc_if.h | 38 ++++++++++++++++++-------------------- include/net/llc_main.h | 1 + include/net/llc_s_ev.h | 1 + include/net/llc_sap.h | 11 ++++++----- include/net/p8022.h | 9 +++++---- 7 files changed, 36 insertions(+), 32 deletions(-) (limited to 'include') diff --git a/include/net/llc_c_ev.h b/include/net/llc_c_ev.h index 2a8a0be9040b..6d729ed755f1 100644 --- a/include/net/llc_c_ev.h +++ b/include/net/llc_c_ev.h @@ -138,9 +138,8 @@ struct llc_conn_state_ev { u8 type; u8 reason; u8 status; - u8 flag; - struct llc_prim_if_block *ind_prim; - struct llc_prim_if_block *cfm_prim; + u8 ind_prim; + u8 cfm_prim; union llc_conn_ev_if data; }; diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index ac0a2bb7aa22..a272c8dd8d36 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h @@ -100,6 +100,9 @@ extern struct sock *llc_lookup_established(struct llc_sap *sap, struct llc_addr *laddr); extern struct sock *llc_lookup_listener(struct llc_sap *sap, struct llc_addr *laddr); +extern struct sock *llc_lookup_dgram(struct llc_sap *sap, + struct llc_addr *laddr); +extern void llc_save_primitive(struct sk_buff* skb, u8 prim); extern u8 llc_data_accept_state(u8 state); extern void llc_build_offset_table(void); #endif /* LLC_CONN_H */ diff --git a/include/net/llc_if.h b/include/net/llc_if.h index 5ae7edc13649..fcf4f2541f7a 100644 --- a/include/net/llc_if.h +++ b/include/net/llc_if.h @@ -17,17 +17,17 @@ #include #include -#define LLC_DATAUNIT_PRIM 0 -#define LLC_CONN_PRIM 1 -#define LLC_DATA_PRIM 2 -#define LLC_DISC_PRIM 3 -#define LLC_RESET_PRIM 4 -#define LLC_FLOWCONTROL_PRIM 5 /* Not supported at this time */ -#define LLC_DISABLE_PRIM 6 -#define LLC_XID_PRIM 7 -#define LLC_TEST_PRIM 8 -#define LLC_SAP_ACTIVATION 9 -#define LLC_SAP_DEACTIVATION 10 +#define LLC_DATAUNIT_PRIM 1 +#define LLC_CONN_PRIM 2 +#define LLC_DATA_PRIM 3 +#define LLC_DISC_PRIM 4 +#define LLC_RESET_PRIM 5 +#define LLC_FLOWCONTROL_PRIM 6 /* Not supported at this time */ +#define LLC_DISABLE_PRIM 7 +#define LLC_XID_PRIM 8 +#define LLC_TEST_PRIM 9 +#define LLC_SAP_ACTIVATION 10 +#define LLC_SAP_DEACTIVATION 11 #define LLC_NBR_PRIMITIVES 11 @@ -110,23 +110,21 @@ struct llc_prim_if_block { u8 prim; union llc_u_prim_data *data; }; -typedef int (*llc_prim_call_t)(struct llc_prim_if_block *prim_if); -extern struct llc_sap *llc_sap_open(llc_prim_call_t network_indicate, - llc_prim_call_t network_confirm, u8 lsap); +extern struct llc_sap *llc_sap_open(u8 lsap, + int (*func)(struct sk_buff *skb, + struct net_device *dev, + struct packet_type *pt)); extern void llc_sap_close(struct llc_sap *sap); extern int llc_establish_connection(struct sock *sk, u8 *lmac, u8 *dmac, u8 dsap); extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb); -extern void llc_build_and_send_ui_pkt(struct llc_sap *sap, - struct sk_buff *skb, +extern void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap); -extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, - struct sk_buff *skb, +extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap); -extern void llc_build_and_send_test_pkt(struct llc_sap *sap, - struct sk_buff *skb, +extern void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap); extern int llc_send_disc(struct sock *sk); #endif /* LLC_IF_H */ diff --git a/include/net/llc_main.h b/include/net/llc_main.h index 25d486278da4..61b679128163 100644 --- a/include/net/llc_main.h +++ b/include/net/llc_main.h @@ -64,4 +64,5 @@ extern void llc_station_state_process(struct llc_station *station, extern void llc_station_send_pdu(struct llc_station *station, struct sk_buff *skb); extern struct sk_buff *llc_alloc_frame(void); +extern struct packet_type llc_packet_type; #endif /* LLC_MAIN_H */ diff --git a/include/net/llc_s_ev.h b/include/net/llc_s_ev.h index 530042ae2be4..7014414e318c 100644 --- a/include/net/llc_s_ev.h +++ b/include/net/llc_s_ev.h @@ -60,6 +60,7 @@ union llc_sap_ev_if { struct llc_prim_if_block; struct llc_sap_state_ev { + u8 primitive; u8 type; u8 reason; u8 ind_cfm_flag; diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h index 412798ab6c0e..5d9dc00a5b36 100644 --- a/include/net/llc_sap.h +++ b/include/net/llc_sap.h @@ -12,6 +12,7 @@ * See the GNU General Public License for more details. */ #include +#include /** * struct llc_sap - Defines the SAP component * @@ -29,10 +30,9 @@ struct llc_sap { u8 state; u8 p_bit; u8 f_bit; - llc_prim_call_t ind; - llc_prim_call_t conf; - struct llc_prim_if_block llc_ind_prim, llc_cfm_prim; - union llc_u_prim_data llc_ind_data_prim, llc_cfm_data_prim; + int (*rcv_func)(struct sk_buff *skb, + struct net_device *dev, + struct packet_type *pt); struct llc_addr laddr; struct list_head node; struct { @@ -45,7 +45,8 @@ struct llc_sap_state_ev; extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk); extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk); -extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb); +extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, + struct packet_type *pt); extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); extern void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb); #endif /* LLC_SAP_H */ diff --git a/include/net/p8022.h b/include/net/p8022.h index 443932810d46..3c99a86c3581 100644 --- a/include/net/p8022.h +++ b/include/net/p8022.h @@ -1,9 +1,10 @@ #ifndef _NET_P8022_H #define _NET_P8022_H -#include - -extern struct datalink_proto *register_8022_client(unsigned char type, - int (*indicate)(struct llc_prim_if_block *prim)); +extern struct datalink_proto * + register_8022_client(unsigned char type, + int (*func)(struct sk_buff *skb, + struct net_device *dev, + struct packet_type *pt)); extern void unregister_8022_client(struct datalink_proto *proto); #endif -- cgit v1.2.3 From 9950c8fea9d3fed4a4a97d12b5988d97ee12c6b0 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 23 Sep 2002 23:19:47 -0300 Subject: [LLC] clean up the ui sending routines and core OK, now I managed to kill the last remnants of bloated structs from LLC, I feel better now :) Also deleted include/net/llc_{frame,name,state}.h, remnants of the old LLC stack still in the tree. --- include/net/llc_c_ev.h | 37 ++++------------- include/net/llc_conn.h | 6 --- include/net/llc_evnt.h | 24 +++-------- include/net/llc_frame.h | 98 --------------------------------------------- include/net/llc_if.h | 42 -------------------- include/net/llc_name.h | 7 ---- include/net/llc_s_ev.h | 38 ++++-------------- include/net/llc_state.h | 4 -- net/llc/llc_c_ev.c | 30 +++++++------- net/llc/llc_conn.c | 2 +- net/llc/llc_evnt.c | 8 ++-- net/llc/llc_if.c | 103 +++++++++++++++++------------------------------- net/llc/llc_main.c | 2 +- net/llc/llc_s_ac.c | 24 +++++------ net/llc/llc_s_ev.c | 16 ++++---- net/llc/llc_sap.c | 9 ++--- 16 files changed, 98 insertions(+), 352 deletions(-) delete mode 100644 include/net/llc_frame.h delete mode 100644 include/net/llc_name.h delete mode 100644 include/net/llc_state.h (limited to 'include') diff --git a/include/net/llc_c_ev.h b/include/net/llc_c_ev.h index 6d729ed755f1..20fbfeec34c4 100644 --- a/include/net/llc_c_ev.h +++ b/include/net/llc_c_ev.h @@ -110,37 +110,14 @@ #define LLC_CONN_EV_QFY_S_FLAG_EQ_0 11 #define LLC_CONN_EV_QFY_INIT_P_F_CYCLE 12 -/* Event data interface; what is sent in an event package */ -/* Event LLC_CONN_EV_TYPE_SIMPLE interface */ -struct llc_conn_ev_simple_if { - u8 ev; -}; - -/* Event LLC_CONN_EV_TYPE_PRIM interface */ -struct llc_conn_ev_prim_if { - u8 prim; /* connect, disconnect, reset, ... */ - u8 type; /* request, indicate, response, conf */ - struct llc_prim_if_block *data; -}; - -/* Event LLC_CONN_EV_TYPE_PDU interface */ -struct llc_conn_ev_pdu_if { - u8 ev; -}; - -union llc_conn_ev_if { - struct llc_conn_ev_simple_if a; /* 'a' for simple, easy ... */ - struct llc_conn_ev_prim_if prim; - struct llc_conn_ev_pdu_if pdu; -}; - struct llc_conn_state_ev { - u8 type; - u8 reason; - u8 status; - u8 ind_prim; - u8 cfm_prim; - union llc_conn_ev_if data; + u8 type; + u8 prim; + u8 prim_type; + u8 reason; + u8 status; + u8 ind_prim; + u8 cfm_prim; }; static __inline__ struct llc_conn_state_ev *llc_conn_ev(struct sk_buff *skb) diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index a272c8dd8d36..ec993d032078 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h @@ -66,12 +66,6 @@ struct llc_opt { u32 rx_pdu_hdr; /* used for saving header of last pdu received and caused sending FRMR. Used for resending FRMR */ -#ifdef DEBUG_LLC_CONN_ALLOC - char *f_alloc, /* function that allocated this connection */ - *f_free; /* function that freed this connection */ - int l_alloc, /* line that allocated this connection */ - l_free; /* line that freed this connection */ -#endif }; #define llc_sk(__sk) ((struct llc_opt *)(__sk)->protinfo) diff --git a/include/net/llc_evnt.h b/include/net/llc_evnt.h index 82bca6d937d6..429adcb480e3 100644 --- a/include/net/llc_evnt.h +++ b/include/net/llc_evnt.h @@ -31,26 +31,12 @@ #define LLC_STATION_EV_RX_NULL_DSAP_TEST_C 8 #define LLC_STATION_EV_DISABLE_REQ 9 -/* Interfaces for various types of supported events */ -struct llc_stat_ev_simple_if { - u8 ev; -}; - -struct llc_stat_ev_prim_if { - u8 prim; /* connect, disconnect, reset, ... */ - u8 type; /* request, indicate, response, confirm */ -}; - -union llc_stat_ev_if { - struct llc_stat_ev_simple_if a; /* 'a' for simple, easy ... */ - struct llc_stat_ev_prim_if prim; -}; - struct llc_station_state_ev { - u8 type; - u8 reason; - union llc_stat_ev_if data; - struct list_head node; /* node in station->ev_q.list */ + u8 type; + u8 prim; + u8 prim_type; + u8 reason; + struct list_head node; /* node in station->ev_q.list */ }; static __inline__ struct llc_station_state_ev * diff --git a/include/net/llc_frame.h b/include/net/llc_frame.h deleted file mode 100644 index e8fb198d19a8..000000000000 --- a/include/net/llc_frame.h +++ /dev/null @@ -1,98 +0,0 @@ -/* if_ether.h needed for definition of ETH_DATA_LEN and ETH_ALEN - */ -#include "linux/if_ether.h" - -/* frame layout based on par3.2 "LLC PDU format" - */ -typedef union { /* pdu layout from pages 40 & 44 */ - struct { /* general header, all pdu types */ - unsigned dsap : 8; /* dest service access point */ - unsigned ssap : 8; /* source service access point */ - unsigned f1 : 1; /* I- U- or S- format id bits */ - unsigned f2 : 1; - unsigned : 6; - unsigned : 8; - } pdu_hdr; - struct { - char dummy1[2]; /* dsap + ssap */ - char byte1; - char byte2; - } pdu_cntl; /* unformatted control bytes */ - struct { /* header of an Information pdu */ - unsigned char dummy2[2]; - unsigned : 1; - unsigned ns : 7; - unsigned i_pflag : 1; /* poll/final bit */ - unsigned nr : 7; /* N(R) */ - unsigned char is_info[ ETH_DATA_LEN ]; - } i_hdr; - struct { /* header of a Supervisory pdu */ - unsigned char dummy3[2]; - unsigned : 2; - unsigned ss : 2; /* supervisory function bits */ - unsigned : 4; - unsigned s_pflag : 1; /* poll/final bit */ - unsigned nr : 7; /* N(R) */ - } s_hdr; - -/* when accessing the P/F bit or the N(R) field there's no need to distinguish - I pdus from S pdus i_pflag and s_pflag / i_nr and s_nr map to the same - physical location. - */ - struct { /* header of an Unnumbered pdu */ - unsigned char dummy4[2]; - unsigned : 2; - unsigned mm1 : 2; /* modifier function part1 */ - unsigned u_pflag : 1; /* P/F for U- pdus */ - unsigned mm2 : 3; /* modifier function part2 */ - unsigned char u_info[ ETH_DATA_LEN-1]; - } u_hdr; - struct { /* mm field in an Unnumbered pdu */ - unsigned char dummy5[2]; - unsigned : 2; - unsigned mm : 6; /* must be masked to get ridd of P/F ! */ - } u_mm; - -} frame_type, *frameptr; - -/* frame format test macros: */ - -#define IS_UFRAME( fr ) ( ( (fr)->pdu_hdr.f1) & ( (fr)->pdu_hdr.f2) ) - -#define IS_IFRAME( fr ) ( !( (fr)->pdu_hdr.f1) ) - -#define IS_SFRAME( fr ) ( ( (fr)->pdu_hdr.f1) & !( (fr)->pdu_hdr.f2) ) - -#define IS_RSP( fr ) ( fr->pdu_hdr.ssap & 0x01 ) - - -/* The transition table, the _encode tables and some tests in the - source code depend on the numeric order of these values. - Think twice before changing. - */ - -/* frame names for TYPE 2 operation: */ -#define I_CMD 0 -#define RR_CMD 1 -#define RNR_CMD 2 -#define REJ_CMD 3 -#define DISC_CMD 4 -#define SABME_CMD 5 -#define I_RSP 6 -#define RR_RSP 7 -#define RNR_RSP 8 -#define REJ_RSP 9 -#define UA_RSP 10 -#define DM_RSP 11 -#define FRMR_RSP 12 - -/* junk frame name: */ -#define BAD_FRAME 13 -#define NO_FRAME 13 - -/* frame names for TYPE 1 operation: */ -#define UI_CMD 14 -#define XID_CMD 15 -#define TEST_CMD 16 -#define XID_RSP 17 -#define TEST_RSP 18 diff --git a/include/net/llc_if.h b/include/net/llc_if.h index fcf4f2541f7a..a72591707e20 100644 --- a/include/net/llc_if.h +++ b/include/net/llc_if.h @@ -67,50 +67,8 @@ struct llc_addr { u8 mac[IFHWADDRLEN]; }; -struct llc_prim_reset { - struct sock *sk; - u16 link; -}; - - /* Sending data in conection-less mode */ -struct llc_prim_unit_data { - struct llc_addr saddr; - struct llc_addr daddr; - u8 pri; - struct sk_buff *skb; /* pointer to frame */ - u8 lfb; /* largest frame bit (TR) */ -}; - -struct llc_prim_xid { - struct llc_addr saddr; - struct llc_addr daddr; - u8 pri; - struct sk_buff *skb; -}; - -struct llc_prim_test { - struct llc_addr saddr; - struct llc_addr daddr; - u8 pri; - struct sk_buff *skb; /* pointer to frame */ -}; - -union llc_u_prim_data { - struct llc_prim_reset res; - struct llc_prim_unit_data udata; /* unit data */ - struct llc_prim_xid xid; - struct llc_prim_test test; -}; - struct llc_sap; -/* Information block passed with all called primitives */ -struct llc_prim_if_block { - struct llc_sap *sap; - u8 prim; - union llc_u_prim_data *data; -}; - extern struct llc_sap *llc_sap_open(u8 lsap, int (*func)(struct sk_buff *skb, struct net_device *dev, diff --git a/include/net/llc_name.h b/include/net/llc_name.h deleted file mode 100644 index 72128719f7cc..000000000000 --- a/include/net/llc_name.h +++ /dev/null @@ -1,7 +0,0 @@ -char *frame_names[] = - {"I_CMD","RR_CMD","RNR_CMD","REJ_CMD","DISC_CMD", - "SABME_CMD","I_RSP","RR_RSP","RNR_RSP","REJ_RSP", - "UA_RSP","DM_RSP","FRMR_RSP","BAD_FRAME","UI_CMD", - "XID_CMD","TEST_CMD","XID_RSP","TEST_RSP" -}; - diff --git a/include/net/llc_s_ev.h b/include/net/llc_s_ev.h index 7014414e318c..e3acb9329e4a 100644 --- a/include/net/llc_s_ev.h +++ b/include/net/llc_s_ev.h @@ -34,38 +34,14 @@ #define LLC_SAP_EV_RX_TEST_R 9 #define LLC_SAP_EV_DEACTIVATION_REQ 10 -/* Interfaces for various types of supported events */ -struct llc_sap_ev_simple_if { - u8 ev; -}; - -struct llc_prim_if_block; - -struct llc_sap_ev_prim_if { - u8 prim; /* connect, disconnect, reset, ... */ - u8 type; /* request, indicate, response, conf */ - struct llc_prim_if_block *data; -}; - -struct llc_sap_ev_pdu_if { - u8 ev; -}; - -union llc_sap_ev_if { - struct llc_sap_ev_simple_if a; /* 'a' for simple, easy ... */ - struct llc_sap_ev_prim_if prim; - struct llc_sap_ev_pdu_if pdu; -}; - -struct llc_prim_if_block; - struct llc_sap_state_ev { - u8 primitive; - u8 type; - u8 reason; - u8 ind_cfm_flag; - struct llc_prim_if_block *prim; - union llc_sap_ev_if data; + u8 prim; + u8 prim_type; + u8 type; + u8 reason; + u8 ind_cfm_flag; + struct llc_addr saddr; + struct llc_addr daddr; }; static __inline__ struct llc_sap_state_ev *llc_sap_ev(struct sk_buff *skb) diff --git a/include/net/llc_state.h b/include/net/llc_state.h deleted file mode 100644 index bb18e9bd1ac8..000000000000 --- a/include/net/llc_state.h +++ /dev/null @@ -1,4 +0,0 @@ -char *state_names[] = { - "ADM","CONN","RESET_WAIT","RESET_CHECK","SETUP", - "RESET","D_CONN","ERROR","NORMAL" -}; diff --git a/net/llc/llc_c_ev.c b/net/llc/llc_c_ev.c index 9c699fb6b815..85c1489b0a66 100644 --- a/net/llc/llc_c_ev.c +++ b/net/llc/llc_c_ev.c @@ -101,48 +101,48 @@ int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - return ev->data.prim.prim == LLC_CONN_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + return ev->prim == LLC_CONN_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } int llc_conn_ev_conn_resp(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - return ev->data.prim.prim == LLC_CONN_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_RESP ? 0 : 1; + return ev->prim == LLC_CONN_PRIM && + ev->prim_type == LLC_PRIM_TYPE_RESP ? 0 : 1; } int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - return ev->data.prim.prim == LLC_DATA_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + return ev->prim == LLC_DATA_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - return ev->data.prim.prim == LLC_DISC_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + return ev->prim == LLC_DISC_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - return ev->data.prim.prim == LLC_RESET_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + return ev->prim == LLC_RESET_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } int llc_conn_ev_rst_resp(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - return ev->data.prim.prim == LLC_RESET_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_RESP ? 0 : 1; + return ev->prim == LLC_RESET_PRIM && + ev->prim_type == LLC_PRIM_TYPE_RESP ? 0 : 1; } int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb) @@ -150,7 +150,7 @@ int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb) struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type == LLC_CONN_EV_TYPE_SIMPLE && - ev->data.a.ev == LLC_CONN_EV_LOCAL_BUSY_DETECTED ? 0 : 1; + ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_DETECTED ? 0 : 1; } int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb) @@ -158,7 +158,7 @@ int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb) struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type == LLC_CONN_EV_TYPE_SIMPLE && - ev->data.a.ev == LLC_CONN_EV_LOCAL_BUSY_CLEARED ? 0 : 1; + ev->prim_type == LLC_CONN_EV_LOCAL_BUSY_CLEARED ? 0 : 1; } int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb) @@ -666,7 +666,7 @@ int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb) struct llc_conn_state_ev *ev = llc_conn_ev(skb); return ev->type == LLC_CONN_EV_TYPE_SIMPLE && - ev->data.a.ev == LLC_CONN_EV_TX_BUFF_FULL ? 0 : 1; + ev->prim_type == LLC_CONN_EV_TX_BUFF_FULL ? 0 : 1; } /* Event qualifier functions diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index 1c7af4795c16..1dafb9e3c965 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c @@ -366,7 +366,7 @@ void llc_conn_free_ev(struct sk_buff *skb) if (LLC_PDU_TYPE_IS_I(pdu) || !ev->ind_prim) kfree_skb(skb); } else if (ev->type == LLC_CONN_EV_TYPE_PRIM && - ev->data.prim.prim != LLC_DATA_PRIM) + ev->prim != LLC_DATA_PRIM) kfree_skb(skb); else if (ev->type == LLC_CONN_EV_TYPE_P_TMR || ev->type == LLC_CONN_EV_TYPE_BUSY_TMR || diff --git a/net/llc/llc_evnt.c b/net/llc/llc_evnt.c index 181cfb29b44f..6cc65d502c44 100644 --- a/net/llc/llc_evnt.c +++ b/net/llc/llc_evnt.c @@ -29,7 +29,7 @@ int llc_stat_ev_enable_with_dup_addr_check(struct llc_station *station, struct llc_station_state_ev *ev = llc_station_ev(skb); return ev->type == LLC_STATION_EV_TYPE_SIMPLE && - ev->data.a.ev == + ev->prim_type == LLC_STATION_EV_ENABLE_WITH_DUP_ADDR_CHECK ? 0 : 1; } @@ -39,7 +39,7 @@ int llc_stat_ev_enable_without_dup_addr_check(struct llc_station *station, struct llc_station_state_ev *ev = llc_station_ev(skb); return ev->type == LLC_STATION_EV_TYPE_SIMPLE && - ev->data.a.ev == + ev->prim_type == LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK ? 0 : 1; } @@ -120,6 +120,6 @@ int llc_stat_ev_disable_req(struct llc_station *station, struct sk_buff *skb) struct llc_station_state_ev *ev = llc_station_ev(skb); return ev->type == LLC_STATION_EV_TYPE_PRIM && - ev->data.prim.prim == LLC_DISABLE_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + ev->prim == LLC_DISABLE_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c index 3ad1a5779602..3c6ea87a9837 100644 --- a/net/llc/llc_if.c +++ b/net/llc/llc_if.c @@ -97,24 +97,16 @@ void llc_sap_close(struct llc_sap *sap) void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap) { - union llc_u_prim_data prim_data; - struct llc_prim_if_block prim; struct llc_sap_state_ev *ev = llc_sap_ev(skb); - prim.data = &prim_data; - prim.sap = sap; - prim.prim = LLC_DATAUNIT_PRIM; + ev->saddr.lsap = sap->laddr.lsap; + ev->daddr.lsap = dsap; + memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); + memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); - prim_data.udata.skb = skb; - prim_data.udata.saddr.lsap = sap->laddr.lsap; - prim_data.udata.daddr.lsap = dsap; - memcpy(prim_data.udata.saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); - memcpy(prim_data.udata.daddr.mac, dmac, IFHWADDRLEN); - - ev->type = LLC_SAP_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_DATAUNIT_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = &prim; + ev->type = LLC_SAP_EV_TYPE_PRIM; + ev->prim = LLC_DATAUNIT_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; llc_sap_state_process(sap, skb, &llc_packet_type); } @@ -131,24 +123,16 @@ void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap) { - union llc_u_prim_data prim_data; - struct llc_prim_if_block prim; struct llc_sap_state_ev *ev = llc_sap_ev(skb); - prim.data = &prim_data; - prim.sap = sap; - prim.prim = LLC_TEST_PRIM; - - prim_data.test.skb = skb; - prim_data.test.saddr.lsap = sap->laddr.lsap; - prim_data.test.daddr.lsap = dsap; - memcpy(prim_data.test.saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); - memcpy(prim_data.test.daddr.mac, dmac, IFHWADDRLEN); + ev->saddr.lsap = sap->laddr.lsap; + ev->daddr.lsap = dsap; + memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); + memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); - ev->type = LLC_SAP_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_TEST_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = &prim; + ev->type = LLC_SAP_EV_TYPE_PRIM; + ev->prim = LLC_TEST_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; llc_sap_state_process(sap, skb, &llc_packet_type); } @@ -165,24 +149,16 @@ void llc_build_and_send_test_pkt(struct llc_sap *sap, void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb, u8 *dmac, u8 dsap) { - union llc_u_prim_data prim_data; - struct llc_prim_if_block prim; struct llc_sap_state_ev *ev = llc_sap_ev(skb); - prim.data = &prim_data; - prim.sap = sap; - prim.prim = LLC_XID_PRIM; - - prim_data.xid.skb = skb; - prim_data.xid.saddr.lsap = sap->laddr.lsap; - prim_data.xid.daddr.lsap = dsap; - memcpy(prim_data.xid.saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); - memcpy(prim_data.xid.daddr.mac, dmac, IFHWADDRLEN); + ev->saddr.lsap = sap->laddr.lsap; + ev->daddr.lsap = dsap; + memcpy(ev->saddr.mac, skb->dev->dev_addr, IFHWADDRLEN); + memcpy(ev->daddr.mac, dmac, IFHWADDRLEN); - ev->type = LLC_SAP_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_XID_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = &prim; + ev->type = LLC_SAP_EV_TYPE_PRIM; + ev->prim = LLC_XID_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; llc_sap_state_process(sap, skb, &llc_packet_type); } @@ -217,11 +193,10 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) goto out; } ev = llc_conn_ev(skb); - ev->type = LLC_CONN_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_DATA_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = NULL; - skb->dev = llc->dev; + ev->type = LLC_CONN_EV_TYPE_PRIM; + ev->prim = LLC_DATA_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; + skb->dev = llc->dev; rc = llc_conn_state_process(sk, skb); out: return rc; @@ -266,10 +241,9 @@ int llc_establish_connection(struct sock *sk, u8 *lmac, u8 *dmac, u8 dsap) if (skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - ev->type = LLC_CONN_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_CONN_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = NULL; + ev->type = LLC_CONN_EV_TYPE_PRIM; + ev->prim = LLC_CONN_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; rc = llc_conn_state_process(sk, skb); } out_put: @@ -304,12 +278,11 @@ int llc_send_disc(struct sock *sk) skb = alloc_skb(0, GFP_ATOMIC); if (!skb) goto out; - sk->state = TCP_CLOSING; - ev = llc_conn_ev(skb); - ev->type = LLC_CONN_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_DISC_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = NULL; + sk->state = TCP_CLOSING; + ev = llc_conn_ev(skb); + ev->type = LLC_CONN_EV_TYPE_PRIM; + ev->prim = LLC_DISC_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; rc = llc_conn_state_process(sk, skb); out: sock_put(sk); @@ -325,8 +298,7 @@ out: * it to connection component state machine. Returns 0 for success, 1 * otherwise. */ -int llc_build_and_send_reset_pkt(struct sock *sk, - struct llc_prim_if_block *prim) +int llc_build_and_send_reset_pkt(struct sock *sk) { int rc = 1; struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC); @@ -334,10 +306,9 @@ int llc_build_and_send_reset_pkt(struct sock *sk, if (skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); - ev->type = LLC_CONN_EV_TYPE_PRIM; - ev->data.prim.prim = LLC_RESET_PRIM; - ev->data.prim.type = LLC_PRIM_TYPE_REQ; - ev->data.prim.data = prim; + ev->type = LLC_CONN_EV_TYPE_PRIM; + ev->prim = LLC_RESET_PRIM; + ev->prim_type = LLC_PRIM_TYPE_REQ; rc = llc_conn_state_process(sk, skb); } return rc; diff --git a/net/llc/llc_main.c b/net/llc/llc_main.c index f84a5e26ab1c..43e231dc6dec 100644 --- a/net/llc/llc_main.c +++ b/net/llc/llc_main.c @@ -667,7 +667,7 @@ static int __init llc_init(void) llc_main_station.maximum_retry = 1; llc_main_station.state = LLC_STATION_STATE_DOWN; ev->type = LLC_STATION_EV_TYPE_SIMPLE; - ev->data.a.ev = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK; + ev->prim_type = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK; rc = llc_station_next_state(&llc_main_station, skb); proc_net_create("802.2", 0, llc_proc_get_info); llc_ui_init(); diff --git a/net/llc/llc_s_ac.c b/net/llc/llc_s_ac.c index e3f8ff640a82..d56556925db1 100644 --- a/net/llc/llc_s_ac.c +++ b/net/llc/llc_s_ac.c @@ -51,14 +51,12 @@ int llc_sap_action_unitdata_ind(struct llc_sap *sap, struct sk_buff *skb) int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); - struct llc_prim_if_block *prim = ev->data.prim.data; - struct llc_prim_unit_data *prim_data = &prim->data->udata; int rc; - llc_pdu_header_init(skb, LLC_PDU_TYPE_U, prim_data->saddr.lsap, - prim_data->daddr.lsap, LLC_PDU_CMD); + llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, + ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_ui_cmd(skb); - rc = lan_hdrs_init(skb, prim_data->saddr.mac, prim_data->daddr.mac); + rc = lan_hdrs_init(skb, ev->saddr.mac, ev->daddr.mac); if (!rc) llc_sap_send_pdu(sap, skb); return rc; @@ -76,14 +74,12 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); - struct llc_prim_if_block *prim = ev->data.prim.data; - struct llc_prim_xid *prim_data = &prim->data->xid; int rc; - llc_pdu_header_init(skb, LLC_PDU_TYPE_U, prim_data->saddr.lsap, - prim_data->daddr.lsap, LLC_PDU_CMD); + llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, + ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); - rc = lan_hdrs_init(skb, prim_data->saddr.mac, prim_data->daddr.mac); + rc = lan_hdrs_init(skb, ev->saddr.mac, ev->daddr.mac); if (!rc) llc_sap_send_pdu(sap, skb); return rc; @@ -132,14 +128,12 @@ out: int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); - struct llc_prim_if_block *prim = ev->data.prim.data; - struct llc_prim_test *prim_data = &prim->data->test; int rc; - llc_pdu_header_init(skb, LLC_PDU_TYPE_U, prim_data->saddr.lsap, - prim_data->daddr.lsap, LLC_PDU_CMD); + llc_pdu_header_init(skb, LLC_PDU_TYPE_U, ev->saddr.lsap, + ev->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_test_cmd(skb); - rc = lan_hdrs_init(skb, prim_data->saddr.mac, prim_data->daddr.mac); + rc = lan_hdrs_init(skb, ev->saddr.mac, ev->daddr.mac); if (!rc) llc_sap_send_pdu(sap, skb); return rc; diff --git a/net/llc/llc_s_ev.c b/net/llc/llc_s_ev.c index 6d172d0eee3a..3b1e02f88dcd 100644 --- a/net/llc/llc_s_ev.c +++ b/net/llc/llc_s_ev.c @@ -25,7 +25,7 @@ int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb) struct llc_sap_state_ev *ev = llc_sap_ev(skb); return ev->type == LLC_SAP_EV_TYPE_SIMPLE && - ev->data.a.ev == LLC_SAP_EV_ACTIVATION_REQ ? 0 : 1; + ev->prim_type == LLC_SAP_EV_ACTIVATION_REQ ? 0 : 1; } int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb) @@ -43,8 +43,8 @@ int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb) struct llc_sap_state_ev *ev = llc_sap_ev(skb); return ev->type == LLC_SAP_EV_TYPE_PRIM && - ev->data.prim.prim == LLC_DATAUNIT_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + ev->prim == LLC_DATAUNIT_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } @@ -53,8 +53,8 @@ int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb) struct llc_sap_state_ev *ev = llc_sap_ev(skb); return ev->type == LLC_SAP_EV_TYPE_PRIM && - ev->data.prim.prim == LLC_XID_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + ev->prim == LLC_XID_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb) @@ -82,8 +82,8 @@ int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb) struct llc_sap_state_ev *ev = llc_sap_ev(skb); return ev->type == LLC_SAP_EV_TYPE_PRIM && - ev->data.prim.prim == LLC_TEST_PRIM && - ev->data.prim.type == LLC_PRIM_TYPE_REQ ? 0 : 1; + ev->prim == LLC_TEST_PRIM && + ev->prim_type == LLC_PRIM_TYPE_REQ ? 0 : 1; } int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb) @@ -111,5 +111,5 @@ int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb) struct llc_sap_state_ev *ev = llc_sap_ev(skb); return ev->type == LLC_SAP_EV_TYPE_SIMPLE && - ev->data.a.ev == LLC_SAP_EV_DEACTIVATION_REQ ? 0 : 1; + ev->prim_type == LLC_SAP_EV_DEACTIVATION_REQ ? 0 : 1; } diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index d84c9e67fd15..9dddee811b18 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c @@ -93,7 +93,7 @@ void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, if (skb->sk->state == TCP_LISTEN) goto drop; - llc_save_primitive(skb, ev->primitive); + llc_save_primitive(skb, ev->prim); /* queue skb to the user. */ if (sock_queue_rcv_skb(skb->sk, skb)) @@ -118,14 +118,13 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb) pdu = llc_pdu_un_hdr(skb); switch (LLC_U_PDU_RSP(pdu)) { case LLC_1_PDU_CMD_TEST: - ev->primitive = LLC_TEST_PRIM; break; + ev->prim = LLC_TEST_PRIM; break; case LLC_1_PDU_CMD_XID: - ev->primitive = LLC_XID_PRIM; break; + ev->prim = LLC_XID_PRIM; break; case LLC_1_PDU_CMD_UI: - ev->primitive = LLC_DATAUNIT_PRIM; break; + ev->prim = LLC_DATAUNIT_PRIM; break; } ev->ind_cfm_flag = LLC_IND; - ev->prim = NULL; } /** -- cgit v1.2.3 From 97ef8f8c0456c53f1a8ad513fee1198fed10f9c5 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 24 Sep 2002 19:23:13 -0300 Subject: [LLC] use struct sock list members Now that we don't have anymore the double sock (PF_LLC + core) we can use struct sock list members. Also use use rw locks instead of spinlocks in some places. --- include/net/llc_main.h | 2 +- include/net/llc_sap.h | 28 +++++++++++----------- net/llc/llc_conn.c | 63 ++++++++++++++++++-------------------------------- net/llc/llc_if.c | 4 ++-- net/llc/llc_main.c | 61 ++++++++++++++++++++++-------------------------- net/llc/llc_sap.c | 27 ++++++++++++++++------ net/llc/llc_sock.c | 32 ++++++++++++------------- 7 files changed, 103 insertions(+), 114 deletions(-) (limited to 'include') diff --git a/include/net/llc_main.h b/include/net/llc_main.h index 61b679128163..9e23ad0ae3e9 100644 --- a/include/net/llc_main.h +++ b/include/net/llc_main.h @@ -43,7 +43,7 @@ struct llc_station { u8 maximum_retry; u8 mac_sa[6]; struct { - spinlock_t lock; + rwlock_t lock; struct list_head list; } sap_list; struct { diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h index 5d9dc00a5b36..d8e278794217 100644 --- a/include/net/llc_sap.h +++ b/include/net/llc_sap.h @@ -16,30 +16,30 @@ /** * struct llc_sap - Defines the SAP component * + * @station - station this sap belongs to + * @state - sap state * @p_bit - only lowest-order bit used * @f_bit - only lowest-order bit used - * @ind - provided by network layer - * @conf - provided by network layer * @laddr - SAP value in this 'lsap' * @node - entry in station sap_list * @sk_list - LLC sockets this one manages * @mac_pdu_q - PDUs ready to send to MAC */ struct llc_sap { - struct llc_station *parent_station; - u8 state; - u8 p_bit; - u8 f_bit; - int (*rcv_func)(struct sk_buff *skb, - struct net_device *dev, - struct packet_type *pt); - struct llc_addr laddr; - struct list_head node; + struct llc_station *station; + u8 state; + u8 p_bit; + u8 f_bit; + int (*rcv_func)(struct sk_buff *skb, + struct net_device *dev, + struct packet_type *pt); + struct llc_addr laddr; + struct list_head node; struct { - spinlock_t lock; - struct list_head list; + rwlock_t lock; + struct sock *list; } sk_list; - struct sk_buff_head mac_pdu_q; + struct sk_buff_head mac_pdu_q; }; struct llc_sap_state_ev; diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index 1dafb9e3c965..043b1bfaae5f 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c @@ -493,27 +493,21 @@ static int llc_exec_conn_trans_actions(struct sock *sk, struct sock *llc_lookup_established(struct llc_sap *sap, struct llc_addr *daddr, struct llc_addr *laddr) { - struct sock *rc = NULL; - struct list_head *entry; + struct sock *rc; - spin_lock_bh(&sap->sk_list.lock); - if (list_empty(&sap->sk_list.list)) - goto out; - list_for_each(entry, &sap->sk_list.list) { - struct llc_opt *llc = list_entry(entry, struct llc_opt, node); + read_lock_bh(&sap->sk_list.lock); + for (rc = sap->sk_list.list; rc; rc = rc->next) { + struct llc_opt *llc = llc_sk(rc); if (llc->laddr.lsap == laddr->lsap && llc->daddr.lsap == daddr->lsap && llc_mac_match(llc->laddr.mac, laddr->mac) && - llc_mac_match(llc->daddr.mac, daddr->mac)) { - rc = llc->sk; + llc_mac_match(llc->daddr.mac, daddr->mac)) break; - } } if (rc) sock_hold(rc); -out: - spin_unlock_bh(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); return rc; } @@ -528,25 +522,20 @@ out: */ struct sock *llc_lookup_listener(struct llc_sap *sap, struct llc_addr *laddr) { - struct sock *rc = NULL; - struct list_head *entry; + struct sock *rc; - spin_lock_bh(&sap->sk_list.lock); - if (list_empty(&sap->sk_list.list)) - goto out; - list_for_each(entry, &sap->sk_list.list) { - struct llc_opt *llc = list_entry(entry, struct llc_opt, node); - - if (llc->sk->type != SOCK_STREAM || llc->sk->state != TCP_LISTEN || - llc->laddr.lsap != laddr->lsap || - !llc_mac_match(llc->laddr.mac, laddr->mac)) - continue; - rc = llc->sk; + read_lock_bh(&sap->sk_list.lock); + for (rc = sap->sk_list.list; rc; rc = rc->next) { + struct llc_opt *llc = llc_sk(rc); + + if (rc->type == SOCK_STREAM && rc->state == TCP_LISTEN && + llc->laddr.lsap == laddr->lsap && + llc_mac_match(llc->laddr.mac, laddr->mac)) + break; } if (rc) sock_hold(rc); -out: - spin_unlock_bh(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); return rc; } @@ -560,26 +549,20 @@ out: */ struct sock *llc_lookup_dgram(struct llc_sap *sap, struct llc_addr *laddr) { - struct sock *rc = NULL; - struct list_head *entry; + struct sock *rc; - spin_lock_bh(&sap->sk_list.lock); - if (list_empty(&sap->sk_list.list)) - goto out; - list_for_each(entry, &sap->sk_list.list) { - struct llc_opt *llc = list_entry(entry, struct llc_opt, node); + read_lock_bh(&sap->sk_list.lock); + for (rc = sap->sk_list.list; rc; rc = rc->next) { + struct llc_opt *llc = llc_sk(rc); - if (llc->sk->type == SOCK_DGRAM && + if (rc->type == SOCK_DGRAM && llc->laddr.lsap == laddr->lsap && - llc_mac_match(llc->laddr.mac, laddr->mac)) { - rc = llc->sk; + llc_mac_match(llc->laddr.mac, laddr->mac)) break; - } } if (rc) sock_hold(rc); -out: - spin_unlock_bh(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); return rc; } /** diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c index 3c6ea87a9837..3c94e950381d 100644 --- a/net/llc/llc_if.c +++ b/net/llc/llc_if.c @@ -56,8 +56,8 @@ struct llc_sap *llc_sap_open(u8 lsap, int (*func)(struct sk_buff *skb, goto err; /* allocated a SAP; initialize it and clear out its memory pool */ sap->laddr.lsap = lsap; - sap->rcv_func = func; - sap->parent_station = llc_station_get(); + sap->rcv_func = func; + sap->station = llc_station_get(); /* initialized SAP; add it to list of SAPs this station manages */ llc_sap_save(sap); out: diff --git a/net/llc/llc_main.c b/net/llc/llc_main.c index 43e231dc6dec..6beaa050757a 100644 --- a/net/llc/llc_main.c +++ b/net/llc/llc_main.c @@ -71,7 +71,6 @@ struct llc_sap *llc_sap_alloc(void) sap->state = LLC_SAP_STATE_ACTIVE; memcpy(sap->laddr.mac, llc_main_station.mac_sa, ETH_ALEN); spin_lock_init(&sap->sk_list.lock); - INIT_LIST_HEAD(&sap->sk_list.list); skb_queue_head_init(&sap->mac_pdu_q); } return sap; @@ -86,12 +85,10 @@ struct llc_sap *llc_sap_alloc(void) */ void llc_free_sap(struct llc_sap *sap) { - struct llc_station *station = sap->parent_station; - llc_rtn_all_conns(sap); - spin_lock_bh(&station->sap_list.lock); + write_lock_bh(&sap->station->sap_list.lock); list_del(&sap->node); - spin_unlock_bh(&station->sap_list.lock); + write_unlock_bh(&sap->station->sap_list.lock); kfree(sap); } @@ -103,9 +100,9 @@ void llc_free_sap(struct llc_sap *sap) */ void llc_sap_save(struct llc_sap *sap) { - spin_lock_bh(&llc_main_station.sap_list.lock); + write_lock_bh(&llc_main_station.sap_list.lock); list_add_tail(&sap->node, &llc_main_station.sap_list.list); - spin_unlock_bh(&llc_main_station.sap_list.lock); + write_unlock_bh(&llc_main_station.sap_list.lock); } /** @@ -120,7 +117,7 @@ struct llc_sap *llc_sap_find(u8 sap_value) struct llc_sap* sap = NULL; struct list_head *entry; - spin_lock_bh(&llc_main_station.sap_list.lock); + read_lock_bh(&llc_main_station.sap_list.lock); list_for_each(entry, &llc_main_station.sap_list.list) { sap = list_entry(entry, struct llc_sap, node); if (sap->laddr.lsap == sap_value) @@ -128,7 +125,7 @@ struct llc_sap *llc_sap_find(u8 sap_value) } if (entry == &llc_main_station.sap_list.list) /* not found */ sap = NULL; - spin_unlock_bh(&llc_main_station.sap_list.lock); + read_unlock_bh(&llc_main_station.sap_list.lock); return sap; } @@ -326,20 +323,18 @@ void llc_sk_reset(struct sock *sk) static int llc_rtn_all_conns(struct llc_sap *sap) { int rc = 0; - struct list_head *entry, *tmp; + struct sock *sk; - spin_lock_bh(&sap->sk_list.lock); - if (list_empty(&sap->sk_list.list)) - goto out; - list_for_each_safe(entry, tmp, &sap->sk_list.list) { - struct llc_opt *llc = list_entry(entry, struct llc_opt, node); + write_lock_bh(&sap->sk_list.lock); + + for (sk = sap->sk_list.list; sk; sk = sk->next) { + llc_sk(sk)->state = LLC_CONN_STATE_TEMP; - llc->state = LLC_CONN_STATE_TEMP; - if (llc_send_disc(llc->sk)) + if (llc_send_disc(sk)) rc = 1; } -out: - spin_unlock_bh(&sap->sk_list.lock); + + write_unlock_bh(&sap->sk_list.lock); return rc; } @@ -562,19 +557,19 @@ static char *llc_conn_state_names[] = { static int llc_proc_get_info(char *bf, char **start, off_t offset, int length) { - struct llc_opt *llc; - struct list_head *sap_entry, *llc_entry; + struct list_head *sap_entry; + struct sock *sk; off_t begin = 0, pos = 0; int len = 0; - spin_lock_bh(&llc_main_station.sap_list.lock); + read_lock_bh(&llc_main_station.sap_list.lock); list_for_each(sap_entry, &llc_main_station.sap_list.list) { struct llc_sap *sap = list_entry(sap_entry, struct llc_sap, node); len += sprintf(bf + len, "lsap=%02X\n", sap->laddr.lsap); - spin_lock_bh(&sap->sk_list.lock); - if (list_empty(&sap->sk_list.list)) { + read_lock_bh(&sap->sk_list.lock); + if (!sap->sk_list.list) { len += sprintf(bf + len, "no connections\n"); goto unlock; } @@ -582,8 +577,9 @@ static int llc_proc_get_info(char *bf, char **start, off_t offset, int length) "dsap state retr txw rxw " "pf ff sf df rs cs " "tack tpfc trs tbs blog busr\n"); - list_for_each(llc_entry, &sap->sk_list.list) { - llc = list_entry(llc_entry, struct llc_opt, node); + for (sk = sap->sk_list.list; sk; sk = sk->next) { + struct llc_opt *llc = llc_sk(sk); + len += sprintf(bf + len, " %02X %-10s %3d %3d %3d " "%2d %2d %2d " "%2d %2d %2d " @@ -598,11 +594,10 @@ static int llc_proc_get_info(char *bf, char **start, off_t offset, int length) timer_pending(&llc->pf_cycle_timer.timer), timer_pending(&llc->rej_sent_timer.timer), timer_pending(&llc->busy_state_timer.timer), - !!llc->sk->backlog.tail, - llc->sk->lock.users); + !!sk->backlog.tail, sk->lock.users); } unlock: - spin_unlock_bh(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); pos = begin + len; if (pos < offset) { len = 0; /* Keep dumping into the buffer start */ @@ -611,7 +606,7 @@ unlock: if (pos > offset + length) /* We have dumped enough */ break; } - spin_unlock_bh(&llc_main_station.sap_list.lock); + read_unlock_bh(&llc_main_station.sap_list.lock); /* The data in question runs from begin to begin + len */ *start = bf + (offset - begin); /* Start of wanted data */ @@ -632,8 +627,8 @@ static struct packet_type llc_tr_packet_type = { }; static char llc_banner[] __initdata = - KERN_INFO "LLC 2.0 by Procom, 1997, Arnaldo C. Melo, 2001\n" - KERN_INFO "NET4.0 IEEE 802.2 extended support\n"; + KERN_INFO "LLC 2.0 by Procom, 1997, Arnaldo C. Melo, 2001, 2002\n" + KERN_INFO "NET 4.0 IEEE 802.2 extended support\n"; static char llc_error_msg[] __initdata = KERN_ERR "LLC install NOT successful.\n"; @@ -693,5 +688,5 @@ module_init(llc_init); module_exit(llc_exit); MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Procom, 1997, Arnaldo C. Melo, Jay Schullist, 2001"); +MODULE_AUTHOR("Procom, 1997, Arnaldo C. Melo, Jay Schullist, 2001, 2002"); MODULE_DESCRIPTION("LLC 2.0, NET4.0 IEEE 802.2 extended support"); diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 9dddee811b18..5b8ac6251145 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c @@ -40,11 +40,15 @@ static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap, */ void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk) { - spin_lock_bh(&sap->sk_list.lock); + write_lock_bh(&sap->sk_list.lock); llc_sk(sk)->sap = sap; - list_add_tail(&llc_sk(sk)->node, &sap->sk_list.list); + sk->next = sap->sk_list.list; + if (sk->next) + sap->sk_list.list->pprev = &sk->next; + sap->sk_list.list = sk; + sk->pprev = &sap->sk_list.list; sock_hold(sk); - spin_unlock_bh(&sap->sk_list.lock); + write_unlock_bh(&sap->sk_list.lock); } /** @@ -56,10 +60,19 @@ void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk) */ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk) { - spin_lock_bh(&sap->sk_list.lock); - list_del(&llc_sk(sk)->node); - sock_put(sk); - spin_unlock_bh(&sap->sk_list.lock); + write_lock_bh(&sap->sk_list.lock); + if (sk->pprev) { + if (sk->next) + sk->next->pprev = sk->pprev; + *sk->pprev = sk->next; + sk->pprev = NULL; + /* + * This only makes sense if the socket was inserted on the + * list, if sk->pprev is NULL it wasn't + */ + sock_put(sk); + } + write_unlock_bh(&sap->sk_list.lock); } /** diff --git a/net/llc/llc_sock.c b/net/llc/llc_sock.c index 3376f48d1227..454e2cff2894 100644 --- a/net/llc/llc_sock.c +++ b/net/llc/llc_sock.c @@ -198,7 +198,7 @@ static int llc_ui_release(struct socket *sock) if (!sk->zapped) llc_sap_unassign_sock(llc->sap, sk); release_sock(sk); - if (llc->sap && list_empty(&llc->sap->sk_list.list)) + if (llc->sap && !llc->sap->sk_list.list) llc_sap_close(llc->sap); sock_put(sk); llc_sk_free(sk); @@ -1042,25 +1042,24 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length) { off_t pos = 0; off_t begin = 0; - struct llc_opt *llc; struct llc_sap *sap; - struct list_head *sap_entry, *llc_entry; + struct sock *sk; + struct list_head *sap_entry; struct llc_station *station = llc_station_get(); int len = sprintf(buffer, "SKt Mc local_mac_sap " "remote_mac_sap tx_queue rx_queue st uid " "link\n"); /* Output the LLC socket data for the /proc filesystem */ - spin_lock_bh(&station->sap_list.lock); + read_lock_bh(&station->sap_list.lock); list_for_each(sap_entry, &station->sap_list.list) { sap = list_entry(sap_entry, struct llc_sap, node); - spin_lock_bh(&sap->sk_list.lock); - list_for_each(llc_entry, &sap->sk_list.list) { - llc = list_entry(llc_entry, struct llc_opt, node); + read_lock_bh(&sap->sk_list.lock); + for (sk = sap->sk_list.list; sk; sk = sk->next) { + struct llc_opt *llc = llc_sk(sk); - len += sprintf(buffer + len, "%2X %2X ", - llc->sk->type, + len += sprintf(buffer + len, "%2X %2X ", sk->type, !llc_mac_null(llc->addr.sllc_mmac)); if (llc->dev && llc_mac_null(llc->addr.sllc_mmac)) llc_ui_format_mac(buffer + len, @@ -1080,12 +1079,11 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length) len += sprintf(buffer + len, "@%02X %8d %8d %2d %3d ", llc->addr.sllc_dsap, - atomic_read(&llc->sk->wmem_alloc), - atomic_read(&llc->sk->rmem_alloc), - llc->sk->state, - llc->sk->socket ? - SOCK_INODE(llc->sk->socket)->i_uid : - -1); + atomic_read(&sk->wmem_alloc), + atomic_read(&sk->rmem_alloc), + sk->state, + sk->socket ? + SOCK_INODE(sk->socket)->i_uid : -1); len += sprintf(buffer + len, "%4d\n", llc->link); /* Are we still dumping unwanted data then discard the record */ pos = begin + len; @@ -1097,9 +1095,9 @@ static int llc_ui_get_info(char *buffer, char **start, off_t offset, int length) if (pos > offset + length) /* We have dumped enough */ break; } - spin_unlock_bh(&sap->sk_list.lock); + read_unlock_bh(&sap->sk_list.lock); } - spin_unlock_bh(&station->sap_list.lock); + read_unlock_bh(&station->sap_list.lock); /* The data in question runs from begin to begin + len */ *start = buffer + offset - begin; /* Start of wanted data */ -- cgit v1.2.3 From c2af9bbd555cbf3d54bf80768ab126e81d429cea Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 24 Sep 2002 21:53:43 -0300 Subject: [LLC] remove sap->mac_pdu_q, not used at all Also remove some unneeded struct forward declarations. --- include/net/llc_conn.h | 2 -- include/net/llc_main.h | 1 - include/net/llc_sap.h | 3 --- net/llc/llc_main.c | 1 - 4 files changed, 7 deletions(-) (limited to 'include') diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index ec993d032078..140684e7d882 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h @@ -70,8 +70,6 @@ struct llc_opt { #define llc_sk(__sk) ((struct llc_opt *)(__sk)->protinfo) -struct llc_conn_state_ev; - extern struct sock *llc_sk_alloc(int family, int priority); extern void llc_sk_free(struct sock *sk); diff --git a/include/net/llc_main.h b/include/net/llc_main.h index 9e23ad0ae3e9..343f3144fbe1 100644 --- a/include/net/llc_main.h +++ b/include/net/llc_main.h @@ -52,7 +52,6 @@ struct llc_station { } ev_q; struct sk_buff_head mac_pdu_q; }; -struct llc_station_state_ev; extern struct llc_sap *llc_sap_alloc(void); extern void llc_sap_save(struct llc_sap *sap); diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h index d8e278794217..ac49be6fcbee 100644 --- a/include/net/llc_sap.h +++ b/include/net/llc_sap.h @@ -23,7 +23,6 @@ * @laddr - SAP value in this 'lsap' * @node - entry in station sap_list * @sk_list - LLC sockets this one manages - * @mac_pdu_q - PDUs ready to send to MAC */ struct llc_sap { struct llc_station *station; @@ -39,9 +38,7 @@ struct llc_sap { rwlock_t lock; struct sock *list; } sk_list; - struct sk_buff_head mac_pdu_q; }; -struct llc_sap_state_ev; extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk); extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk); diff --git a/net/llc/llc_main.c b/net/llc/llc_main.c index 6beaa050757a..3939fa061db0 100644 --- a/net/llc/llc_main.c +++ b/net/llc/llc_main.c @@ -71,7 +71,6 @@ struct llc_sap *llc_sap_alloc(void) sap->state = LLC_SAP_STATE_ACTIVE; memcpy(sap->laddr.mac, llc_main_station.mac_sa, ETH_ALEN); spin_lock_init(&sap->sk_list.lock); - skb_queue_head_init(&sap->mac_pdu_q); } return sap; } -- cgit v1.2.3 From c84af5795c7663d7a8ef51615c90f6eb1ccf7b81 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 25 Sep 2002 17:34:03 -0300 Subject: [LLC] move sap->rcv_func call to llc_rcv --- include/net/llc_main.h | 1 - include/net/llc_sap.h | 3 +-- net/llc/llc_if.c | 6 +++--- net/llc/llc_mac.c | 29 ++++++++++++++++------------- net/llc/llc_main.c | 2 +- net/llc/llc_sap.c | 20 +++++++------------- 6 files changed, 28 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/net/llc_main.h b/include/net/llc_main.h index 343f3144fbe1..434e86044dec 100644 --- a/include/net/llc_main.h +++ b/include/net/llc_main.h @@ -63,5 +63,4 @@ extern void llc_station_state_process(struct llc_station *station, extern void llc_station_send_pdu(struct llc_station *station, struct sk_buff *skb); extern struct sk_buff *llc_alloc_frame(void); -extern struct packet_type llc_packet_type; #endif /* LLC_MAIN_H */ diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h index ac49be6fcbee..645e52759b36 100644 --- a/include/net/llc_sap.h +++ b/include/net/llc_sap.h @@ -42,8 +42,7 @@ struct llc_sap { extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk); extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk); -extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, - struct packet_type *pt); +extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb); extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); extern void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb); #endif /* LLC_SAP_H */ diff --git a/net/llc/llc_if.c b/net/llc/llc_if.c index 3c94e950381d..ee1f20a51958 100644 --- a/net/llc/llc_if.c +++ b/net/llc/llc_if.c @@ -107,7 +107,7 @@ void llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, ev->type = LLC_SAP_EV_TYPE_PRIM; ev->prim = LLC_DATAUNIT_PRIM; ev->prim_type = LLC_PRIM_TYPE_REQ; - llc_sap_state_process(sap, skb, &llc_packet_type); + llc_sap_state_process(sap, skb); } /** @@ -133,7 +133,7 @@ void llc_build_and_send_test_pkt(struct llc_sap *sap, ev->type = LLC_SAP_EV_TYPE_PRIM; ev->prim = LLC_TEST_PRIM; ev->prim_type = LLC_PRIM_TYPE_REQ; - llc_sap_state_process(sap, skb, &llc_packet_type); + llc_sap_state_process(sap, skb); } /** @@ -159,7 +159,7 @@ void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb, ev->type = LLC_SAP_EV_TYPE_PRIM; ev->prim = LLC_XID_PRIM; ev->prim_type = LLC_PRIM_TYPE_REQ; - llc_sap_state_process(sap, skb, &llc_packet_type); + llc_sap_state_process(sap, skb); } /** diff --git a/net/llc/llc_mac.c b/net/llc/llc_mac.c index 820d49540376..58b6f72e1d95 100644 --- a/net/llc/llc_mac.c +++ b/net/llc/llc_mac.c @@ -37,8 +37,7 @@ u8 llc_mac_null_var[IFHWADDRLEN]; static void fix_up_incoming_skb(struct sk_buff *skb); static void llc_station_rcv(struct sk_buff *skb); -static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, - struct packet_type *pt); +static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb); /** * mac_send_pdu - Sends PDU to specific device. @@ -114,16 +113,22 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, } llc_decode_pdu_type(skb, &dest); if (dest == LLC_DEST_SAP) { /* type 1 services */ - struct llc_addr laddr; - struct sock *sk; + if (sap->rcv_func) + sap->rcv_func(skb, dev, pt); + else { + struct llc_addr laddr; + struct sock *sk; - llc_pdu_decode_da(skb, laddr.mac); - llc_pdu_decode_dsap(skb, &laddr.lsap); + llc_pdu_decode_da(skb, laddr.mac); + llc_pdu_decode_dsap(skb, &laddr.lsap); - skb->sk = sk = llc_lookup_dgram(sap, &laddr); - llc_sap_rcv(sap, skb, pt); - if (sk) + sk = llc_lookup_dgram(sap, &laddr); + if (!sk) + goto drop; + skb->sk = sk; + llc_sap_rcv(sap, skb); sock_put(sk); + } } else if (dest == LLC_DEST_CONN) { struct llc_addr saddr, daddr; struct sock *sk; @@ -254,18 +259,16 @@ int llc_conn_rcv(struct sock* sk, struct sk_buff *skb) * llc_sap_rcv - sends received pdus to the sap state machine * @sap: current sap component structure. * @skb: received frame. - * @pt: packet type * * Sends received pdus to the sap state machine. */ -static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, - struct packet_type *pt) +static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); ev->type = LLC_SAP_EV_TYPE_PDU; ev->reason = 0; - llc_sap_state_process(sap, skb, pt); + llc_sap_state_process(sap, skb); } /** diff --git a/net/llc/llc_main.c b/net/llc/llc_main.c index 3939fa061db0..4250dc3abb87 100644 --- a/net/llc/llc_main.c +++ b/net/llc/llc_main.c @@ -613,7 +613,7 @@ unlock: return len; } -struct packet_type llc_packet_type = { +static struct packet_type llc_packet_type = { .type = __constant_htons(ETH_P_802_2), .func = llc_rcv, .data = (void *)1, diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c index 206b22873ed8..031b14b6b3ea 100644 --- a/net/llc/llc_sap.c +++ b/net/llc/llc_sap.c @@ -79,14 +79,12 @@ void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk) * llc_sap_state_process - sends event to SAP state machine * @sap: sap to use * @skb: pointer to occurred event - * @pt: packet type, for datalink protos * * 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 packet_type *pt) +void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); @@ -99,18 +97,14 @@ void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb, ev->ind_cfm_flag = 0; llc_sap_next_state(sap, skb); if (ev->ind_cfm_flag == LLC_IND) { - if (sap->rcv_func) - sap->rcv_func(skb, skb->dev, pt); + if (skb->sk->state == TCP_LISTEN) + kfree_skb(skb); else { - if (skb->sk->state == TCP_LISTEN) - kfree_skb(skb); - else { - llc_save_primitive(skb, ev->prim); + llc_save_primitive(skb, ev->prim); - /* queue skb to the user. */ - if (sock_queue_rcv_skb(skb->sk, skb)) - kfree_skb(skb); - } + /* queue skb to the user. */ + if (sock_queue_rcv_skb(skb->sk, skb)) + kfree_skb(skb); } } kfree_skb(skb); -- cgit v1.2.3