diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2003-09-21 04:11:45 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-09-21 04:11:45 -0700 |
| commit | a0aaef1ce508023d916d21b67269197d53366efa (patch) | |
| tree | decc31bfd421366a455e7a30b3d25da9cb960716 /include/net | |
| parent | 91d4dbf21ce1e1e9deee44fc4f1e93616f143681 (diff) | |
| parent | 874d7485a12b0eff4eb32f4794fda1d343278a0c (diff) | |
Merge bk://kernel.bkbits.net/acme/llc-2.6
into nuts.ninka.net:/disk1/davem/BK/net-2.5
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/llc.h | 91 | ||||
| -rw-r--r-- | include/net/llc_actn.h | 49 | ||||
| -rw-r--r-- | include/net/llc_conn.h | 8 | ||||
| -rw-r--r-- | include/net/llc_evnt.h | 70 | ||||
| -rw-r--r-- | include/net/llc_if.h | 8 | ||||
| -rw-r--r-- | include/net/llc_mac.h | 29 | ||||
| -rw-r--r-- | include/net/llc_main.h | 64 | ||||
| -rw-r--r-- | include/net/llc_s_st.h | 3 | ||||
| -rw-r--r-- | include/net/llc_sap.h | 54 | ||||
| -rw-r--r-- | include/net/llc_stat.h | 35 |
10 files changed, 112 insertions, 299 deletions
diff --git a/include/net/llc.h b/include/net/llc.h new file mode 100644 index 000000000000..bf3882be3529 --- /dev/null +++ b/include/net/llc.h @@ -0,0 +1,91 @@ +#ifndef LLC_H +#define LLC_H +/* + * Copyright (c) 1997 by Procom Technology, Inc. + * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> + * + * This program can be redistributed or modified under the terms of the + * GNU General Public License as published by the Free Software Foundation. + * This program is distributed without any warranty or implied warranty + * of merchantability or fitness for a particular purpose. + * + * See the GNU General Public License for more details. + */ + +#include <linux/if.h> +#include <linux/if_ether.h> +#include <linux/list.h> +#include <linux/spinlock.h> + +struct net_device; +struct packet_type; +struct sk_buff; + +struct llc_addr { + unsigned char lsap; + unsigned char mac[IFHWADDRLEN]; +}; + +#define LLC_SAP_STATE_INACTIVE 1 +#define LLC_SAP_STATE_ACTIVE 2 + +/** + * 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 + * @laddr - SAP value in this 'lsap' + * @node - entry in station sap_list + * @sk_list - LLC sockets this one manages + */ +struct llc_sap { + unsigned char state; + unsigned char p_bit; + unsigned char 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 { + rwlock_t lock; + struct hlist_head list; + } sk_list; +}; + +#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ +#define LLC_DEST_SAP 1 /* Type 1 goes here */ +#define LLC_DEST_CONN 2 /* Type 2 goes here */ + +extern struct list_head llc_sap_list; +extern rwlock_t llc_sap_list_lock; +extern unsigned char llc_station_mac_sa[ETH_ALEN]; + +extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, + struct packet_type *pt); + +extern int llc_mac_hdr_init(struct sk_buff *skb, + unsigned char *sa, unsigned char *da); + +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)); + +extern struct llc_sap *llc_sap_open(unsigned char lsap, + int (*rcv)(struct sk_buff *skb, + struct net_device *dev, + struct packet_type *pt)); +extern void llc_sap_close(struct llc_sap *sap); + +extern struct llc_sap *llc_sap_find(unsigned char sap_value); + +extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, + unsigned char *dmac, unsigned char dsap); + +extern int llc_station_init(void); +extern void llc_station_exit(void); +#endif /* LLC_H */ diff --git a/include/net/llc_actn.h b/include/net/llc_actn.h deleted file mode 100644 index 3619601c4c81..000000000000 --- a/include/net/llc_actn.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef LLC_ACTN_H -#define LLC_ACTN_H -/* - * Copyright (c) 1997 by Procom Technology,Inc. - * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> - * - * This program can be redistributed or modified under the terms of the - * GNU General Public License as published by the Free Software Foundation. - * This program is distributed without any warranty or implied warranty - * of merchantability or fitness for a particular purpose. - * - * See the GNU General Public License for more details. - */ -/* Station component state transition actions */ -#define LLC_STATION_AC_START_ACK_TMR 1 -#define LLC_STATION_AC_SET_RETRY_CNT_0 2 -#define LLC_STATION_AC_INC_RETRY_CNT_BY_1 3 -#define LLC_STATION_AC_SET_XID_R_CNT_0 4 -#define LLC_STATION_AC_INC_XID_R_CNT_BY_1 5 -#define LLC_STATION_AC_SEND_NULL_DSAP_XID_C 6 -#define LLC_STATION_AC_SEND_XID_R 7 -#define LLC_STATION_AC_SEND_TEST_R 8 -#define LLC_STATION_AC_REPORT_STATUS 9 - -/* All station state event action functions look like this */ -typedef int (*llc_station_action_t)(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_start_ack_timer(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_set_retry_cnt_0(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_inc_retry_cnt_by_1(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_set_xid_r_cnt_0(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_inc_xid_r_cnt_by_1(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_send_null_dsap_xid_c(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_send_xid_r(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_send_test_r(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_report_status(struct llc_station *station, - struct sk_buff *skb); -extern int llc_station_ac_report_status(struct llc_station *station, - struct sk_buff *skb); -extern void llc_station_ack_tmr_cb(unsigned long timeout_data); -#endif /* LLC_ACTN_H */ diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index e1adbb921546..06fb01bccdbf 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h @@ -15,6 +15,14 @@ #include <net/llc_if.h> #include <linux/llc.h> +#define LLC_EVENT 1 +#define LLC_PACKET 2 + +#define LLC_P_TIME 2 +#define LLC_ACK_TIME 1 +#define LLC_REJ_TIME 3 +#define LLC_BUSY_TIME 3 + struct llc_timer { struct timer_list timer; u16 expire; /* timer expire time */ diff --git a/include/net/llc_evnt.h b/include/net/llc_evnt.h deleted file mode 100644 index 429adcb480e3..000000000000 --- a/include/net/llc_evnt.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef LLC_EVNT_H -#define LLC_EVNT_H -/* - * Copyright (c) 1997 by Procom Technology,Inc. - * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> - * - * This program can be redistributed or modified under the terms of the - * GNU General Public License as published by the Free Software Foundation. - * This program is distributed without any warranty or implied warranty - * of merchantability or fitness for a particular purpose. - * - * See the GNU General Public License for more details. - */ -/* Station component state transition events */ -/* Types of events (possible values in 'ev->type') */ -#define LLC_STATION_EV_TYPE_SIMPLE 1 -#define LLC_STATION_EV_TYPE_CONDITION 2 -#define LLC_STATION_EV_TYPE_PRIM 3 -#define LLC_STATION_EV_TYPE_PDU 4 /* command/response PDU */ -#define LLC_STATION_EV_TYPE_ACK_TMR 5 -#define LLC_STATION_EV_TYPE_RPT_STATUS 6 - -/* Events */ -#define LLC_STATION_EV_ENABLE_WITH_DUP_ADDR_CHECK 1 -#define LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK 2 -#define LLC_STATION_EV_ACK_TMR_EXP_LT_RETRY_CNT_MAX_RETRY 3 -#define LLC_STATION_EV_ACK_TMR_EXP_EQ_RETRY_CNT_MAX_RETRY 4 -#define LLC_STATION_EV_RX_NULL_DSAP_XID_C 5 -#define LLC_STATION_EV_RX_NULL_DSAP_0_XID_R_XID_R_CNT_EQ 6 -#define LLC_STATION_EV_RX_NULL_DSAP_1_XID_R_XID_R_CNT_EQ 7 -#define LLC_STATION_EV_RX_NULL_DSAP_TEST_C 8 -#define LLC_STATION_EV_DISABLE_REQ 9 - -struct llc_station_state_ev { - 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 * - llc_station_ev(struct sk_buff *skb) -{ - return (struct llc_station_state_ev *)skb->cb; -} - -typedef int (*llc_station_ev_t)(struct llc_station *station, - struct sk_buff *skb); - -extern int llc_stat_ev_enable_with_dup_addr_check(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_enable_without_dup_addr_check(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_ack_tmr_exp_lt_retry_cnt_max_retry(struct llc_station * - station, - struct sk_buff *skb); -extern int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station, - struct sk_buff *skb); -extern int llc_stat_ev_disable_req(struct llc_station *station, - struct sk_buff *skb); -#endif /* LLC_EVNT_H */ diff --git a/include/net/llc_if.h b/include/net/llc_if.h index 615fc3c671b0..090eaa0d71f9 100644 --- a/include/net/llc_if.h +++ b/include/net/llc_if.h @@ -16,6 +16,7 @@ #include <linux/if.h> #include <linux/if_arp.h> #include <linux/llc.h> +#include <net/llc.h> #define LLC_DATAUNIT_PRIM 1 #define LLC_CONN_PRIM 2 @@ -60,13 +61,6 @@ #define LLC_STATUS_CONFLICT 7 /* disconnect conn */ #define LLC_STATUS_RESET_DONE 8 /* */ -/* Structures and types */ -/* SAP/MAC Address pair */ -struct llc_addr { - u8 lsap; - u8 mac[IFHWADDRLEN]; -}; - extern u8 llc_mac_null_var[IFHWADDRLEN]; /** diff --git a/include/net/llc_mac.h b/include/net/llc_mac.h deleted file mode 100644 index 8281a66c0b64..000000000000 --- a/include/net/llc_mac.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef LLC_MAC_H -#define LLC_MAC_H -/* - * Copyright (c) 1997 by Procom Technology, Inc. - * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> - * - * This program can be redistributed or modified under the terms of the - * GNU General Public License as published by the Free Software Foundation. - * This program is distributed without any warranty or implied warranty - * of merchantability or fitness for a particular purpose. - * - * See the GNU General Public License for more details. - */ - -#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ -#define LLC_DEST_SAP 1 /* Type 1 goes here */ -#define LLC_DEST_CONN 2 /* Type 2 goes here */ - -extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, - struct packet_type *pt); -extern u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da); - -struct llc_sap; -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); -#endif /* LLC_MAC_H */ diff --git a/include/net/llc_main.h b/include/net/llc_main.h deleted file mode 100644 index ced2a74ab0a2..000000000000 --- a/include/net/llc_main.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef LLC_MAIN_H -#define LLC_MAIN_H -/* - * Copyright (c) 1997 by Procom Technology, Inc. - * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> - * - * This program can be redistributed or modified under the terms of the - * GNU General Public License as published by the Free Software Foundation. - * This program is distributed without any warranty or implied warranty - * of merchantability or fitness for a particular purpose. - * - * See the GNU General Public License for more details. - */ -#define LLC_EVENT 1 -#define LLC_PACKET 2 -#define LLC_TYPE_1 1 -#define LLC_TYPE_2 2 -#define LLC_P_TIME 2 -#define LLC_ACK_TIME 1 -#define LLC_REJ_TIME 3 -#define LLC_BUSY_TIME 3 - -/** - * struct llc_station - LLC station component - * - * SAP and connection resource manager, one per adapter. - * - * @state - state of station - * @xid_r_count - XID response PDU counter - * @mac_sa - MAC source address - * @sap_list - list of related SAPs - * @ev_q - events entering state mach. - * @mac_pdu_q - PDUs ready to send to MAC - */ -struct llc_station { - u8 state; - u8 xid_r_count; - struct timer_list ack_timer; - u8 retry_count; - u8 maximum_retry; - u8 mac_sa[6]; - struct { - rwlock_t lock; - struct list_head list; - } sap_list; - struct { - struct sk_buff_head list; - spinlock_t lock; - } ev_q; - struct sk_buff_head mac_pdu_q; -}; - -extern struct llc_sap *llc_sap_alloc(void); -extern void llc_sap_save(struct llc_sap *sap); -extern void llc_free_sap(struct llc_sap *sap); -extern struct llc_sap *llc_sap_find(u8 lsap); -extern void llc_station_state_process(struct llc_station *station, - struct sk_buff *skb); -extern void llc_station_send_pdu(struct llc_station *station, - struct sk_buff *skb); -extern struct sk_buff *llc_alloc_frame(void); - -extern struct llc_station llc_main_station; -#endif /* LLC_MAIN_H */ diff --git a/include/net/llc_s_st.h b/include/net/llc_s_st.h index 525415ebae92..567c681f1f3e 100644 --- a/include/net/llc_s_st.h +++ b/include/net/llc_s_st.h @@ -11,10 +11,7 @@ * * See the GNU General Public License for more details. */ -/* Defines SAP component states */ -#define LLC_SAP_STATE_INACTIVE 1 -#define LLC_SAP_STATE_ACTIVE 2 #define LLC_NR_SAP_STATES 2 /* size of state table */ /* structures and types */ diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h index 376ec36288e9..dc60acce8e55 100644 --- a/include/net/llc_sap.h +++ b/include/net/llc_sap.h @@ -2,7 +2,7 @@ #define LLC_SAP_H /* * Copyright (c) 1997 by Procom Technology,Inc. - * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> + * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * * This program can be redistributed or modified under the terms of the * GNU General Public License as published by the Free Software Foundation. @@ -11,50 +11,20 @@ * * See the GNU General Public License for more details. */ -#include <linux/skbuff.h> -#include <net/llc_if.h> -/** - * 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 - * @laddr - SAP value in this 'lsap' - * @node - entry in station sap_list - * @sk_list - LLC sockets this one manages - */ -struct llc_sap { - 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 { - rwlock_t lock; - struct hlist_head list; - } sk_list; -}; +struct llc_sap; +struct sk_buff; 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_save_primitive(struct sk_buff* skb, u8 prim); +extern void llc_save_primitive(struct sk_buff* skb, unsigned char prim); +extern struct sk_buff *llc_alloc_frame(void); -extern struct llc_sap *llc_sap_open(u8 lsap, - int (*rcv)(struct sk_buff *skb, - struct net_device *dev, - struct packet_type *pt)); -extern void llc_sap_close(struct llc_sap *sap); - -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, - u8 *dmac, u8 dsap); extern void llc_build_and_send_test_pkt(struct llc_sap *sap, - struct sk_buff *skb, u8 *dmac, u8 dsap); - + struct sk_buff *skb, + unsigned char *dmac, + unsigned char dsap); +extern void llc_build_and_send_xid_pkt(struct llc_sap *sap, + struct sk_buff *skb, + unsigned char *dmac, + unsigned char dsap); #endif /* LLC_SAP_H */ diff --git a/include/net/llc_stat.h b/include/net/llc_stat.h deleted file mode 100644 index f8d0bb0a9c75..000000000000 --- a/include/net/llc_stat.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef LLC_STAT_H -#define LLC_STAT_H -/* - * Copyright (c) 1997 by Procom Technology,Inc. - * 2001 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> - * - * This program can be redistributed or modified under the terms of the - * GNU General Public License as published by the Free Software Foundation. - * This program is distributed without any warranty or implied warranty - * of merchantability or fitness for a particular purpose. - * - * See the GNU General Public License for more details. - */ -/* Station component state table */ -/* Station component states */ -#define LLC_STATION_STATE_DOWN 1 /* initial state */ -#define LLC_STATION_STATE_DUP_ADDR_CHK 2 -#define LLC_STATION_STATE_UP 3 - -#define LLC_NBR_STATION_STATES 3 /* size of state table */ - -/* Station component state table structure */ -struct llc_station_state_trans { - llc_station_ev_t ev; - u8 next_state; - llc_station_action_t *ev_actions; -}; - -struct llc_station_state { - u8 curr_state; - struct llc_station_state_trans **transitions; -}; - -extern struct llc_station_state llc_station_state_table[LLC_NBR_STATION_STATES]; -#endif /* LLC_STAT_H */ |
