Commit e4e08ed2 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/davem/BK/net-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 2b6165ae be9ca388
#ifndef __LINUX_ATALK_H__
#define __LINUX_ATALK_H__
/* /*
* AppleTalk networking structures * AppleTalk networking structures
* *
* The following are directly referenced from the University Of Michigan * The following are directly referenced from the University Of Michigan
* netatalk for compatibility reasons. * netatalk for compatibility reasons.
*/ */
#ifndef __LINUX_ATALK_H__
#define __LINUX_ATALK_H__
#define ATPORT_FIRST 1 #define ATPORT_FIRST 1
#define ATPORT_RESERVED 128 #define ATPORT_RESERVED 128
#define ATPORT_LAST 254 /* 254 is only legal on localtalk */ #define ATPORT_LAST 254 /* 254 is only legal on localtalk */
#define ATADDR_ANYNET (__u16)0 #define ATADDR_ANYNET (__u16)0
#define ATADDR_ANYNODE (__u8)0 #define ATADDR_ANYNODE (__u8)0
#define ATADDR_ANYPORT (__u8)0 #define ATADDR_ANYPORT (__u8)0
#define ATADDR_BCAST (__u8)255 #define ATADDR_BCAST (__u8)255
#define DDP_MAXSZ 587 #define DDP_MAXSZ 587
#define DDP_MAXHOPS 15 /* 4 bits of hop counter */ #define DDP_MAXHOPS 15 /* 4 bits of hop counter */
#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) #define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
struct at_addr struct atalk_addr {
{
__u16 s_net; __u16 s_net;
__u8 s_node; __u8 s_node;
}; };
struct sockaddr_at struct sockaddr_at {
{ sa_family_t sat_family;
sa_family_t sat_family; __u8 sat_port;
__u8 sat_port; struct atalk_addr sat_addr;
struct at_addr sat_addr; char sat_zero[8];
char sat_zero[ 8 ];
}; };
struct netrange struct atalk_netrange {
{
__u8 nr_phase; __u8 nr_phase;
__u16 nr_firstnet; __u16 nr_firstnet;
__u16 nr_lastnet; __u16 nr_lastnet;
}; };
struct atalk_route struct atalk_route {
{ struct net_device *dev;
struct net_device *dev; struct atalk_addr target;
struct at_addr target; struct atalk_addr gateway;
struct at_addr gateway; int flags;
int flags;
struct atalk_route *next; struct atalk_route *next;
}; };
struct atalk_iface /**
{ * struct atalk_iface - AppleTalk Interface
struct net_device *dev; * @dev - Network device associated with this interface
struct at_addr address; /* Our address */ * @address - Our address
int status; /* What are we doing? */ * @status - What are we doing?
* @nets - Associated direct netrange
* @next - next element in the list of interfaces
*/
struct atalk_iface {
struct net_device *dev;
struct atalk_addr address;
int status;
#define ATIF_PROBE 1 /* Probing for an address */ #define ATIF_PROBE 1 /* Probing for an address */
#define ATIF_PROBE_FAIL 2 /* Probe collided */ #define ATIF_PROBE_FAIL 2 /* Probe collided */
struct netrange nets; /* Associated direct netrange */ struct atalk_netrange nets;
struct atalk_iface *next; struct atalk_iface *next;
}; };
struct atalk_sock struct atalk_sock {
{ unsigned short dest_net;
unsigned short dest_net; unsigned short src_net;
unsigned short src_net; unsigned char dest_node;
unsigned char dest_node; unsigned char src_node;
unsigned char src_node; unsigned char dest_port;
unsigned char dest_port; unsigned char src_port;
unsigned char src_port;
}; };
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm/byteorder.h> #include <asm/byteorder.h>
struct ddpehdr struct ddpehdr {
{
#ifdef __LITTLE_ENDIAN_BITFIELD #ifdef __LITTLE_ENDIAN_BITFIELD
__u16 deh_len:10, deh_hops:4, deh_pad:2; __u16 deh_len:10,
deh_hops:4,
deh_pad:2;
#else #else
__u16 deh_pad:2, deh_hops:4, deh_len:10; __u16 deh_pad:2,
deh_hops:4,
deh_len:10;
#endif #endif
__u16 deh_sum; __u16 deh_sum;
__u16 deh_dnet; __u16 deh_dnet;
...@@ -92,30 +95,35 @@ struct ddpehdr ...@@ -92,30 +95,35 @@ struct ddpehdr
/* And netatalk apps expect to stick the type in themselves */ /* And netatalk apps expect to stick the type in themselves */
}; };
static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
{
return (struct ddpehdr *)skb->h.raw;
}
/* /*
* Don't drop the struct into the struct above. You'll get some * Don't drop the struct into the struct above. You'll get some
* surprise padding. * surprise padding.
*/ */
struct ddpebits {
struct ddpebits
{
#ifdef __LITTLE_ENDIAN_BITFIELD #ifdef __LITTLE_ENDIAN_BITFIELD
__u16 deh_len:10, deh_hops:4, deh_pad:2; __u16 deh_len:10,
deh_hops:4,
deh_pad:2;
#else #else
__u16 deh_pad:2, deh_hops:4, deh_len:10; __u16 deh_pad:2,
deh_hops:4,
deh_len:10;
#endif #endif
}; };
/* /* Short form header */
* Short form header struct ddpshdr {
*/
struct ddpshdr
{
#ifdef __LITTLE_ENDIAN_BITFIELD #ifdef __LITTLE_ENDIAN_BITFIELD
__u16 dsh_len:10, dsh_pad:6; __u16 dsh_len:10,
dsh_pad:6;
#else #else
__u16 dsh_pad:6, dsh_len:10; __u16 dsh_pad:6,
dsh_len:10;
#endif #endif
__u8 dsh_dport; __u8 dsh_dport;
__u8 dsh_sport; __u8 dsh_sport;
...@@ -123,9 +131,7 @@ struct ddpshdr ...@@ -123,9 +131,7 @@ struct ddpshdr
}; };
/* AppleTalk AARP headers */ /* AppleTalk AARP headers */
struct elapaarp {
struct elapaarp
{
__u16 hw_type; __u16 hw_type;
#define AARP_HW_TYPE_ETHERNET 1 #define AARP_HW_TYPE_ETHERNET 1
#define AARP_HW_TYPE_TOKENRING 2 #define AARP_HW_TYPE_TOKENRING 2
...@@ -147,30 +153,44 @@ struct elapaarp ...@@ -147,30 +153,44 @@ struct elapaarp
__u8 pa_dst_node __attribute__ ((packed)); __u8 pa_dst_node __attribute__ ((packed));
}; };
#define AARP_EXPIRY_TIME (5*60*HZ) /* Not specified - how long till we drop a resolved entry */ static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
#define AARP_HASH_SIZE 16 /* Size of hash table */ {
#define AARP_TICK_TIME (HZ/5) /* Fast retransmission timer when resolving */ return (struct elapaarp *)skb->h.raw;
#define AARP_RETRANSMIT_LIMIT 10 /* Send 10 requests then give up (2 seconds) */ }
#define AARP_RESOLVE_TIME (10*HZ) /* Some value bigger than total retransmit time + a bit for last reply to appear and to stop continual requests */
/* Not specified - how long till we drop a resolved entry */
#define AARP_EXPIRY_TIME (5 * 60 * HZ)
/* Size of hash table */
#define AARP_HASH_SIZE 16
/* Fast retransmission timer when resolving */
#define AARP_TICK_TIME (HZ / 5)
/* Send 10 requests then give up (2 seconds) */
#define AARP_RETRANSMIT_LIMIT 10
/*
* Some value bigger than total retransmit time + a bit for last reply to
* appear and to stop continual requests
*/
#define AARP_RESOLVE_TIME (10 * HZ)
extern struct datalink_proto *ddp_dl, *aarp_dl; extern struct datalink_proto *ddp_dl, *aarp_dl;
extern void aarp_proto_init(void); extern void aarp_proto_init(void);
/* Inter module exports */
/* /* Inter module exports */
* Give a device find its atif control structure
*/
/* Give a device find its atif control structure */
static inline struct atalk_iface *atalk_find_dev(struct net_device *dev) static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
{ {
return dev->atalk_ptr; return dev->atalk_ptr;
} }
extern struct at_addr *atalk_find_dev_addr(struct net_device *dev); extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
extern struct net_device *atrtr_get_dev(struct at_addr *sa); extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
extern int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, struct at_addr *sa, void *hwaddr); extern int aarp_send_ddp(struct net_device *dev,
extern void aarp_send_probe(struct net_device *dev, struct at_addr *addr); struct sk_buff *skb,
extern void aarp_device_down(struct net_device *dev); struct atalk_addr *sa, void *hwaddr);
extern void aarp_send_probe(struct net_device *dev,
struct atalk_addr *addr);
extern void aarp_device_down(struct net_device *dev);
#ifdef MODULE #ifdef MODULE
extern void aarp_cleanup_module(void); extern void aarp_cleanup_module(void);
......
...@@ -96,6 +96,6 @@ struct ethhdr ...@@ -96,6 +96,6 @@ struct ethhdr
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */
unsigned short h_proto; /* packet type ID field */ unsigned short h_proto; /* packet type ID field */
}; } __attribute__((packed));
#endif /* _LINUX_IF_ETHER_H */ #endif /* _LINUX_IF_ETHER_H */
...@@ -24,15 +24,13 @@ struct sockaddr_ipx ...@@ -24,15 +24,13 @@ struct sockaddr_ipx
#define IPX_DLTITF 0 #define IPX_DLTITF 0
#define IPX_CRTITF 1 #define IPX_CRTITF 1
typedef struct ipx_route_definition struct ipx_route_definition {
{
__u32 ipx_network; __u32 ipx_network;
__u32 ipx_router_network; __u32 ipx_router_network;
unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_router_node[IPX_NODE_LEN];
} ipx_route_definition; };
typedef struct ipx_interface_definition struct ipx_interface_definition {
{
__u32 ipx_network; __u32 ipx_network;
unsigned char ipx_device[16]; unsigned char ipx_device[16];
unsigned char ipx_dlink_type; unsigned char ipx_dlink_type;
...@@ -47,13 +45,12 @@ typedef struct ipx_interface_definition ...@@ -47,13 +45,12 @@ typedef struct ipx_interface_definition
#define IPX_PRIMARY 1 #define IPX_PRIMARY 1
#define IPX_INTERNAL 2 #define IPX_INTERNAL 2
unsigned char ipx_node[IPX_NODE_LEN]; unsigned char ipx_node[IPX_NODE_LEN];
} ipx_interface_definition; };
typedef struct ipx_config_data struct ipx_config_data {
{
unsigned char ipxcfg_auto_select_primary; unsigned char ipxcfg_auto_select_primary;
unsigned char ipxcfg_auto_create_interfaces; unsigned char ipxcfg_auto_create_interfaces;
} ipx_config_data; };
/* /*
* OLD Route Definition for backward compatibility. * OLD Route Definition for backward compatibility.
...@@ -77,13 +74,4 @@ struct ipx_route_def ...@@ -77,13 +74,4 @@ struct ipx_route_def
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3) #define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3)
#ifdef __KERNEL__
#include <linux/skbuff.h>
extern int ipxrtr_route_skb(struct sk_buff *);
extern int ipx_if_offset(unsigned long ipx_net_number);
extern void ipx_remove_socket(struct sock *sk);
#endif /* def __KERNEL__ */
#endif /* def _IPX_H_ */ #endif /* def _IPX_H_ */
...@@ -182,7 +182,6 @@ struct sk_buff { ...@@ -182,7 +182,6 @@ struct sk_buff {
struct icmphdr *icmph; struct icmphdr *icmph;
struct igmphdr *igmph; struct igmphdr *igmph;
struct iphdr *ipiph; struct iphdr *ipiph;
struct spxhdr *spxh;
unsigned char *raw; unsigned char *raw;
} h; } h;
...@@ -190,7 +189,6 @@ struct sk_buff { ...@@ -190,7 +189,6 @@ struct sk_buff {
struct iphdr *iph; struct iphdr *iph;
struct ipv6hdr *ipv6h; struct ipv6hdr *ipv6h;
struct arphdr *arph; struct arphdr *arph;
struct ipxhdr *ipxh;
unsigned char *raw; unsigned char *raw;
} nh; } nh;
......
...@@ -14,12 +14,11 @@ ...@@ -14,12 +14,11 @@
#include <net/datalink.h> #include <net/datalink.h>
#include <linux/ipx.h> #include <linux/ipx.h>
typedef struct struct ipx_address {
{
__u32 net; __u32 net;
__u8 node[IPX_NODE_LEN]; __u8 node[IPX_NODE_LEN];
__u16 sock; __u16 sock;
} ipx_address; };
#define ipx_broadcast_node "\377\377\377\377\377\377" #define ipx_broadcast_node "\377\377\377\377\377\377"
#define ipx_this_node "\0\0\0\0\0\0" #define ipx_this_node "\0\0\0\0\0\0"
...@@ -39,11 +38,16 @@ struct ipxhdr ...@@ -39,11 +38,16 @@ struct ipxhdr
#define IPX_TYPE_SPX 0x05 /* SPX protocol */ #define IPX_TYPE_SPX 0x05 /* SPX protocol */
#define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */ #define IPX_TYPE_NCP 0x11 /* $lots for docs on this (SPIT) */
#define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */ #define IPX_TYPE_PPROP 0x14 /* complicated flood fill brdcast */
ipx_address ipx_dest __attribute__ ((packed)); struct ipx_address ipx_dest __attribute__ ((packed));
ipx_address ipx_source __attribute__ ((packed)); struct ipx_address ipx_source __attribute__ ((packed));
}; };
typedef struct ipx_interface { static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
{
return (struct ipxhdr *)skb->h.raw;
}
struct ipx_interface {
/* IPX address */ /* IPX address */
__u32 if_netnum; __u32 if_netnum;
unsigned char if_node[IPX_NODE_LEN]; unsigned char if_node[IPX_NODE_LEN];
...@@ -65,16 +69,16 @@ typedef struct ipx_interface { ...@@ -65,16 +69,16 @@ typedef struct ipx_interface {
unsigned char if_primary; unsigned char if_primary;
struct ipx_interface *if_next; struct ipx_interface *if_next;
} ipx_interface; };
typedef struct ipx_route { struct ipx_route {
__u32 ir_net; __u32 ir_net;
ipx_interface *ir_intrfc; struct ipx_interface *ir_intrfc;
unsigned char ir_routed; unsigned char ir_routed;
unsigned char ir_router_node[IPX_NODE_LEN]; unsigned char ir_router_node[IPX_NODE_LEN];
struct ipx_route *ir_next; struct ipx_route *ir_next;
atomic_t refcnt; atomic_t refcnt;
} ipx_route; };
#ifdef __KERNEL__ #ifdef __KERNEL__
struct ipx_cb { struct ipx_cb {
...@@ -88,8 +92,8 @@ struct ipx_cb { ...@@ -88,8 +92,8 @@ struct ipx_cb {
}; };
struct ipx_opt { struct ipx_opt {
ipx_address dest_addr; struct ipx_address dest_addr;
ipx_interface *intrfc; struct ipx_interface *intrfc;
unsigned short port; unsigned short port;
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
unsigned char node[IPX_NODE_LEN]; unsigned char node[IPX_NODE_LEN];
...@@ -106,7 +110,4 @@ struct ipx_opt { ...@@ -106,7 +110,4 @@ struct ipx_opt {
#define IPX_MIN_EPHEMERAL_SOCKET 0x4000 #define IPX_MIN_EPHEMERAL_SOCKET 0x4000
#define IPX_MAX_EPHEMERAL_SOCKET 0x7fff #define IPX_MAX_EPHEMERAL_SOCKET 0x7fff
extern int ipx_register_spx(struct proto_ops **, struct net_proto_family *);
extern int ipx_unregister_spx(void);
#endif /* def _NET_INET_IPX_H_ */ #endif /* def _NET_INET_IPX_H_ */
#include <linux/skbuff.h>
#define LLC_MODULE
typedef struct llc_struct llc;
typedef struct llc_struct *llcptr;
/*
* LLC private data area structure.
*/
struct llc_struct
{
char eye[4]; /* To recognize llc area in dump */
int retry_count; /* LLC link state variables */
unsigned char name[9]; /* name of this llc instance */
unsigned char s_flag;
unsigned char p_flag;
unsigned char f_flag;
unsigned char data_flag;
unsigned char cause_flag;
unsigned char vs; /* Send state variable */
unsigned char vr; /* Receive state variable */
unsigned char remote_busy;
unsigned char state; /* Current state of type2 llc procedure */
int n1; /* Maximum number of bytes in I pdu 7.8.2 */
int n2; /* Naximum number of retransmissions 7.8.2 */
unsigned char k; /* Transmit window size 7.8.4, tw in IBM doc*/
unsigned char rw; /* Receive window size */
struct
{
/*
* FRMR_RSP info field structure: 5.4.2.3.5 p55
*/
unsigned char cntl1;
unsigned char cntl2;
unsigned char vs;
unsigned char vr_cr;
unsigned char xxyz;
} frmr_info_fld;
/*
* Timers in 7.8.1 page 78
*/
#define P_TIMER 0
#define REJ_TIMER 1
#define ACK_TIMER 2
#define BUSY_TIMER 3
unsigned long timer_expire_time[4];
unsigned char timer_state[4]; /* The state of each timer */
#define TIMER_IDLE 0
#define TIMER_RUNNING 1
#define TIMER_EXPIRED 2
unsigned long timer_interval[4];
struct timer_list tl[4];
/*
* Client entry point, called by the LLC.
*/
void (*llc_event)(struct llc_struct *);
/*
* Mux and Demux variables
*/
char * client_data; /* Pointer to clients context */
unsigned char local_sap;
unsigned char remote_sap ;
char remote_mac[MAX_ADDR_LEN]; /* MAC address of remote session partner */
struct net_device *dev; /* Device we are attached to */
unsigned char llc_mode; /* See doc 7.1 on p70 */
#define MODE_ADM 1
#define MODE_ABM 2
int llc_callbacks; /* Pending callbacks */
#define LLC_CONN_INDICATION 1 /* We have to ensure the names don't */
#define LLC_CONN_CONFIRM 2 /* mix up with the 802 state table */
#define LLC_DATA_INDIC 4
#define LLC_DISC_INDICATION 8
#define LLC_RESET_INDIC_LOC 16
#define LLC_RESET_INDIC_REM 32
#define LLC_RST_CONFIRM 64
#define LLC_FRMR_RECV 128
#define LLC_FRMR_SENT 256
#define LLC_REMOTE_BUSY 512
#define LLC_REMOTE_NOTBUSY 1024
#define LLC_TEST_INDICATION 2048
#define LLC_XID_INDICATION 4096
#define LLC_UI_DATA 8192
struct sk_buff *inc_skb; /* Saved data buffer for indications */
struct sk_buff_head rtq; /* Retransmit queue */
struct sk_buff_head atq; /* Await transit queue */
unsigned char xid_count;
struct llc_struct *nextllc; /* ptr to next llc struct in proto chain */
};
#define ADD_TO_RTQ(skb) skb_queue_tail(&lp->rtq,skb)
#define ADD_TO_ATQ(skb) skb_queue_tail(&lp->atq,skb)
void llc_cancel_timers(llcptr lp);
int llc_decode_frametype(frameptr fr);
llcptr llc_find(void);
int llc_free_acknowledged_skbs(llcptr lp, unsigned char ack);
void llc_handle_xid_indication( char *chsp, short int ll, char *xid_data);
void llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb, char type);
void llc_add_to_queue(struct sk_buff *skb, struct sk_buff **f, struct sk_buff **b);
void llc_process_otype2_frame(llcptr lp, struct sk_buff *skb, char type);
struct sk_buff *llc_pull_from_atq(llcptr lp);
int llc_resend_ipdu(llcptr lp, unsigned char ack_nr, unsigned char type, char p);
void llc_sendpdu(llcptr lp, char type, char pf, int data_len, char *pdu_data);
void llc_sendipdu(llcptr lp, char type, char pf, struct sk_buff *skb);
void llc_start_timer(llcptr lp, int t);
void llc_stop_timer(llcptr lp, int t);
void llc_timer_expired(llcptr lp, int t);
int llc_validate_seq_nos(llcptr lp, frameptr fr);
int llc_data_request(llcptr lp, struct sk_buff *skb);
void llc_unit_data_request(llcptr lp, int ll, char * data);
void llc_disconnect_request(llcptr lp);
void llc_connect_request(llcptr lp);
void llc_xid_request(llcptr lp, char opt, int data_len, char *pdu_data);
void llc_test_request(llcptr lp, int data_len, char *pdu_data);
int register_cl2llc_client(llcptr llc, const char *device, void (*ops)(llcptr), u8 *rmac, u8 ssap, u8 dsap);
void unregister_cl2llc_client(llcptr lp);
int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb );
...@@ -191,34 +191,34 @@ ...@@ -191,34 +191,34 @@
(info->ind_bits = ( (info->ind_bits & 0xEF) | (((u8) ind) & 0x10))) (info->ind_bits = ( (info->ind_bits & 0xEF) | (((u8) ind) & 0x10)))
/* Sequence-numbered PDU format (4 bytes in length) */ /* Sequence-numbered PDU format (4 bytes in length) */
typedef struct llc_pdu_sn { struct llc_pdu_sn {
u8 dsap; u8 dsap;
u8 ssap; u8 ssap;
u8 ctrl_1; u8 ctrl_1;
u8 ctrl_2; u8 ctrl_2;
} llc_pdu_sn_t; };
/* Un-numbered PDU format (3 bytes in length) */ /* Un-numbered PDU format (3 bytes in length) */
typedef struct llc_pdu_un { struct llc_pdu_un {
u8 dsap; u8 dsap;
u8 ssap; u8 ssap;
u8 ctrl_1; u8 ctrl_1;
} llc_pdu_un_t; };
/* LLC Type 1 XID command/response information fields format */ /* LLC Type 1 XID command/response information fields format */
typedef struct llc_xid_info { struct llc_xid_info {
u8 fmt_id; /* always 0x18 for LLC */ u8 fmt_id; /* always 0x18 for LLC */
u8 type; /* different if NULL/non-NULL LSAP */ u8 type; /* different if NULL/non-NULL LSAP */
u8 rw; /* sender receive window */ u8 rw; /* sender receive window */
} llc_xid_info_t; };
/* LLC Type 2 FRMR response information field format */ /* LLC Type 2 FRMR response information field format */
typedef struct llc_frmr_info { struct llc_frmr_info {
u16 rej_pdu_ctrl; /* bits 1-8 if U-PDU */ u16 rej_pdu_ctrl; /* bits 1-8 if U-PDU */
u8 curr_ssv; /* current send state variable val */ u8 curr_ssv; /* current send state variable val */
u8 curr_rsv; /* current receive state variable */ u8 curr_rsv; /* current receive state variable */
u8 ind_bits; /* indicator bits set with macro */ u8 ind_bits; /* indicator bits set with macro */
} llc_frmr_info_t; };
extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type); extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type);
extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value); extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
...@@ -246,7 +246,8 @@ extern int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported, ...@@ -246,7 +246,8 @@ extern int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
u8 rx_window); u8 rx_window);
extern int llc_pdu_init_as_test_rsp(struct sk_buff *skb, extern int llc_pdu_init_as_test_rsp(struct sk_buff *skb,
struct sk_buff *ev_skb); struct sk_buff *ev_skb);
extern int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, llc_pdu_sn_t *prev_pdu, extern int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb,
struct llc_pdu_sn *prev_pdu,
u8 f_bit, u8 vs, u8 vr, u8 vzyxw); u8 f_bit, u8 vs, u8 vr, u8 vzyxw);
extern int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); extern int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
extern int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); extern int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
......
#ifndef __NET_SPX_H
#define __NET_SPX_H
#include <net/ipx.h>
struct spxhdr
{ __u8 cctl;
__u8 dtype;
#define SPX_DTYPE_ECONN 0xFE /* Finished */
#define SPX_DTYPE_ECACK 0xFF /* Ok */
__u16 sconn; /* Connection ID */
__u16 dconn; /* Connection ID */
__u16 sequence;
__u16 ackseq;
__u16 allocseq;
};
struct ipxspxhdr
{ struct ipxhdr ipx;
struct spxhdr spx;
};
#define SPX_SYS_PKT_LEN (sizeof(struct ipxspxhdr))
#ifdef __KERNEL__
struct spx_opt
{ int state;
int sndbuf;
int retries; /* Number of WD retries */
int retransmits; /* Number of retransmits */
int max_retries;
int wd_interval;
void *owner;
__u16 dest_connid; /* Net order */
__u16 source_connid; /* Net order */
__u16 sequence; /* Host order - our current pkt # */
__u16 alloc; /* Host order - max seq we can rcv now */
__u16 rmt_ack; /* Host order - last pkt ACKd by remote */
__u16 rmt_seq;
__u16 acknowledge;
__u16 rmt_alloc; /* Host order - max seq remote can handle now */
ipx_address dest_addr;
ipx_address source_addr;
struct timer_list watchdog; /* Idle watch */
struct timer_list retransmit; /* Retransmit timer */
struct sk_buff_head rcv_queue;
struct sk_buff_head transmit_queue;
struct sk_buff_head retransmit_queue;
};
#define spx_sk(__sk) ((struct spx_opt *)(((struct sock *)(__sk)) + 1))
/* Packet connectino control defines */
#define CCTL_SPXII_XHD 0x01 /* SPX2 extended header */
#define CCTL_SPX_UNKNOWN 0x02 /* Unknown (unused ??) */
#define CCTL_SPXII_NEG 0x04 /* Negotiate size */
#define CCTL_SPXII 0x08 /* Set for SPX2 */
#define CCTL_EOM 0x10 /* End of message marker */
#define CCTL_URG 0x20 /* Urgent marker in SPP (not used in SPX?) */
#define CCTL_ACK 0x40 /* Send me an ACK */
#define CCTL_CTL 0x80 /* Control message */
#define CCTL_SYS CCTL_CTL /* Spec uses CCTL_SYS */
/* Connection state defines */
#define SPX_CLOSED 7
#define SPX_CONNECTING 8
#define SPX_CONNECTED 9
/* Packet transmit types - Internal */
#define DATA 0 /* Data */
#define ACK 1 /* Data ACK */
#define WDACK 2 /* WD ACK */
#define CONACK 3 /* Connection Request ACK */
#define CONREQ 4 /* Connection Request */
#define WDREQ 5 /* WD Request */
#define DISCON 6 /* Informed Disconnect */
#define DISACK 7 /* Informed Disconnect ACK */
#define RETRAN 8 /* Int. Retransmit of packet */
#define TQUEUE 9 /* Int. Transmit of a queued packet */
/*
* These are good canidates for IOcontrol calls
*/
/* Watchdog defines */
#define VERIFY_TIMEOUT 3 * HZ
#define ABORT_TIMEOUT 30 * HZ
/* Packet retransmit defines */
#define RETRY_COUNT 10
#define RETRY_TIME 1 * HZ
#define MAX_RETRY_DELAY 5 * HZ
#endif /* __KERNEL__ */
#endif /* def __NET_SPX_H */
...@@ -2,15 +2,14 @@ ...@@ -2,15 +2,14 @@
# Makefile for the Linux 802.x protocol layers. # Makefile for the Linux 802.x protocol layers.
# #
export-objs := llc_macinit.o p8022.o psnap.o export-objs := p8022.o psnap.o tr.o
obj-y := p8023.o obj-y := p8023.o
# Check the p8022 selections against net/core/Makefile. # Check the p8022 selections against net/core/Makefile.
obj-$(CONFIG_SYSCTL) += sysctl_net_802.o obj-$(CONFIG_SYSCTL) += sysctl_net_802.o
obj-$(CONFIG_LLC) += p8022.o psnap.o llc_sendpdu.o llc_utility.o \ obj-$(CONFIG_LLC) += p8022.o psnap.o
cl2llc.o llc_macinit.o obj-$(CONFIG_TR) += p8022.o psnap.o tr.o sysctl_net_802.o
obj-$(CONFIG_TR) += p8022.o psnap.o tr.o
obj-$(CONFIG_NET_FC) += fc.o obj-$(CONFIG_NET_FC) += fc.o
obj-$(CONFIG_FDDI) += fddi.o obj-$(CONFIG_FDDI) += fddi.o
obj-$(CONFIG_HIPPI) += hippi.o obj-$(CONFIG_HIPPI) += hippi.o
...@@ -18,25 +17,3 @@ obj-$(CONFIG_IPX) += p8022.o psnap.o ...@@ -18,25 +17,3 @@ obj-$(CONFIG_IPX) += p8022.o psnap.o
obj-$(CONFIG_ATALK) += p8022.o psnap.o obj-$(CONFIG_ATALK) += p8022.o psnap.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
# Dependencies on generated files need to be listed explicitly
$(obj)/cl2llc.o: $(obj)/transit/pdutr.h $(obj)/transit/timertr.h \
$(obj)/pseudo/pseudocode.h
# Generated files
$(obj)/transit/pdutr.h: $(src)/transit/pdutr.pre $(src)/transit/compile.awk
awk -f $(src)/transit/compile.awk $< >$@
$(obj)/transit/timertr.h: $(src)/transit/timertr.pre $(src)/transit/compile.awk
awk -f $(src)/transit/compile.awk $< >$@
$(obj)/pseudo/pseudocode.h: $(src)/pseudo/pseudocode \
$(src)/pseudo/opcd2num.sed \
$(src)/pseudo/compile.awk
sed -f $(src)/pseudo/opcd2num.sed $< | \
awk -f $(src)/pseudo/compile.awk >$@
$(obj)/cl2llc.c: $(src)/cl2llc.pre $(src)/pseudo/opcd2num.sed
sed -f $(src)/pseudo/opcd2num.sed $< >$@
Remaining Problems:
1. Serialization of access to variables in the llc structure
by mac_data_indicate(), timer expired functions, and data_request() .
There is not serialization of any kind right now.
While testing, I have not seen any problems that stem from this lack of
serialization, but it wories me...
2. The code is currently able to handle one connection only,
there is more work in register_cl2llc_client() to make a chain
of llc structures and in mac_data_indicate() to find back
the llc structure addressed by an incoming frame.
According to IEEE, connections are identified by (remote mac + local mac
+ dsap + ssap). dsap and ssap do not seem important: existing applications
always use the same dsap/ssap. Its probably sufficient to index on
the remote mac only.
3. There is no test to see if the transmit window is full in data_request()
as described in the doc p73, "7.5.1 Sending I PDUs" 3th alinea.
The pdus presented to data_request() could probably go on the
awaiting-transmit-queue (atq). The real difficulty is coding a test
to see if the transmit window is used up and to send the queue
when space in the window becomes available.
As I have no network layer that can generate a continous flow of pdus it is
difficult to simulate a remote busy condition and hence to test the code
to handle it.
4. A simple flow control algorithm, steering the size of the transmit
window would be nice to have.
/*
* NET An implementation of the IEEE 802.2 LLC protocol for the
* LINUX operating system. LLC is implemented as a set of
* state machines and callbacks for higher networking layers.
*
* Class 2 llc algorithm.
* Pseudocode interpreter, transition table lookup,
* data_request & indicate primitives...
*
* Code for initialization, termination, registration and
* MAC layer glue.
*
* Copyright Tim Alpaerts,
* <Tim_Alpaerts@toyota-motor-europe.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Changes
* Alan Cox : Chainsawed into Linux format
* Modified to use llc_ names
* Changed callbacks
*
* This file must be processed by sed before it can be compiled.
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/p8022.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <asm/byteorder.h>
#include "pseudo/pseudocode.h"
#include "transit/pdutr.h"
#include "transit/timertr.h"
#include <net/llc_frame.h>
#include <net/llc.h>
/*
* Data_request() is called by the client to present a data unit
* to the llc for transmission.
* In the future this function should also check if the transmit window
* allows the sending of another pdu, and if not put the skb on the atq
* for deferred sending.
*/
int llc_data_request(llcptr lp, struct sk_buff *skb)
{
if (skb_headroom(skb) < (lp->dev->hard_header_len +4)){
printk("cl2llc: data_request() not enough headroom in skb\n");
return -1;
};
skb_push(skb, 4);
if ((lp->state != NORMAL) && (lp->state != BUSY) && (lp->state != REJECT))
{
printk("cl2llc: data_request() while no llc connection\n");
return -1;
}
if (lp->remote_busy)
{ /* if the remote llc is BUSY, */
ADD_TO_ATQ(skb); /* save skb in the await transmit queue */
return 0;
}
else
{
/*
* Else proceed with xmit
*/
switch(lp->state)
{
case NORMAL:
if(lp->p_flag)
llc_interpret_pseudo_code(lp, NORMAL2, skb, NO_FRAME);
else
llc_interpret_pseudo_code(lp, NORMAL1, skb, NO_FRAME);
break;
case BUSY:
if (lp->p_flag)
llc_interpret_pseudo_code(lp, BUSY2, skb, NO_FRAME);
else
llc_interpret_pseudo_code(lp, BUSY1, skb, NO_FRAME);
break;
case REJECT:
if (lp->p_flag)
llc_interpret_pseudo_code(lp, REJECT2, skb, NO_FRAME);
else
llc_interpret_pseudo_code(lp, REJECT1, skb, NO_FRAME);
break;
default:;
}
if(lp->llc_callbacks)
{
lp->llc_event(lp);
lp->llc_callbacks=0;
}
return 0;
}
}
/*
* Disconnect_request() requests that the llc to terminate a connection
*/
void disconnect_request(llcptr lp)
{
if ((lp->state == NORMAL) ||
(lp->state == BUSY) ||
(lp->state == REJECT) ||
(lp->state == AWAIT) ||
(lp->state == AWAIT_BUSY) ||
(lp->state == AWAIT_REJECT))
{
lp->state = D_CONN;
llc_interpret_pseudo_code(lp, SH1, NULL, NO_FRAME);
if(lp->llc_callbacks)
{
lp->llc_event(lp);
lp->llc_callbacks=0;
}
/*
* lp may be invalid after the callback
*/
}
}
/*
* Connect_request() requests that the llc to start a connection
*/
void connect_request(llcptr lp)
{
if (lp->state == ADM)
{
lp->state = SETUP;
llc_interpret_pseudo_code(lp, ADM1, NULL, NO_FRAME);
if(lp->llc_callbacks)
{
lp->llc_event(lp);
lp->llc_callbacks=0;
}
/*
* lp may be invalid after the callback
*/
}
}
/*
* Interpret_pseudo_code() executes the actions in the connection component
* state transition table. Table 4 in document on p88.
*
* If this function is called to handle an incoming pdu, skb will point
* to the buffer with the pdu and type will contain the decoded pdu type.
*
* If called by data_request skb points to an skb that was skb_alloc-ed by
* the llc client to hold the information unit to be transmitted, there is
* no valid type in this case.
*
* If called because a timer expired no skb is passed, and there is no
* type.
*/
void llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb,
char type)
{
short int pc; /* program counter in pseudo code array */
char p_flag_received;
frameptr fr;
int resend_count; /* number of pdus resend by llc_resend_ipdu() */
int ack_count; /* number of pdus acknowledged */
struct sk_buff *skb2;
if (skb != NULL)
{
fr = (frameptr) skb->data;
}
else
fr = NULL;
pc = pseudo_code_idx[pc_label];
while(pseudo_code[pc])
{
switch(pseudo_code[pc])
{
case IF_F=1_CLEAR_REMOTE_BUSY:
if ((type != I_CMD) || (fr->i_hdr.i_pflag == 0))
break;
case CLEAR_REMOTE_BUSY:
lp->remote_busy = 0;
llc_stop_timer(lp, BUSY_TIMER);
if ((lp->state == NORMAL) ||
(lp->state == REJECT) ||
(lp->state == BUSY))
{
skb2 = llc_pull_from_atq(lp);
if (skb2 != NULL)
llc_start_timer(lp, ACK_TIMER);
while (skb2 != NULL)
{
llc_sendipdu( lp, I_CMD, 0, skb2);
skb2 = llc_pull_from_atq(lp);
}
}
break;
case CONNECT_INDICATION:
lp->state = NORMAL; /* needed to eliminate connect_response() */
lp->llc_mode = MODE_ABM;
lp->llc_callbacks|=LLC_CONN_INDICATION;
break;
case CONNECT_CONFIRM:
lp->llc_mode = MODE_ABM;
lp->llc_callbacks|=LLC_CONN_CONFIRM;
break;
case DATA_INDICATION:
skb_pull(skb, 4);
lp->inc_skb=skb;
lp->llc_callbacks|=LLC_DATA_INDIC;
break;
case DISCONNECT_INDICATION:
lp->llc_mode = MODE_ADM;
lp->llc_callbacks|=LLC_DISC_INDICATION;
break;
case RESET_INDICATION(LOCAL):
lp->llc_callbacks|=LLC_RESET_INDIC_LOC;
break;
case RESET_INDICATION(REMOTE):
lp->llc_callbacks|=LLC_RESET_INDIC_REM;
break;
case RESET_CONFIRM:
lp->llc_callbacks|=LLC_RST_CONFIRM;
break;
case REPORT_STATUS(FRMR_RECEIVED):
lp->llc_callbacks|=LLC_FRMR_RECV;
break;
case REPORT_STATUS(FRMR_SENT):
lp->llc_callbacks|=LLC_FRMR_SENT;
break;
case REPORT_STATUS(REMOTE_BUSY):
lp->llc_callbacks|=LLC_REMOTE_BUSY;
break;
case REPORT_STATUS(REMOTE_NOT_BUSY):
lp->llc_callbacks|=LLC_REMOTE_NOTBUSY;
break;
case SEND_DISC_CMD(P=X):
llc_sendpdu(lp, DISC_CMD, lp->f_flag, 0, NULL);
break;
case SEND_DM_RSP(F=X):
llc_sendpdu(lp, DM_RSP, 0, 0, NULL);
break;
case SEND_FRMR_RSP(F=X):
lp->frmr_info_fld.cntl1 = fr->pdu_cntl.byte1;
lp->frmr_info_fld.cntl2 = fr->pdu_cntl.byte2;
lp->frmr_info_fld.vs = lp->vs;
lp->frmr_info_fld.vr_cr = lp->vr;
llc_sendpdu(lp, FRMR_RSP, 0, 5, (char *) &lp->frmr_info_fld);
break;
case RE-SEND_FRMR_RSP(F=0):
llc_sendpdu(lp, FRMR_RSP, 0, 5, (char *) &lp->frmr_info_fld);
break;
case RE-SEND_FRMR_RSP(F=P):
llc_sendpdu(lp, FRMR_RSP, lp->p_flag,
5, (char *) &lp->frmr_info_fld);
break;
case SEND_I_CMD(P=1):
llc_sendipdu(lp, I_CMD, 1, skb);
break;
case RE-SEND_I_CMD(P=1):
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 1);
break;
case RE-SEND_I_CMD(P=1)_OR_SEND_RR:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 1);
if (resend_count == 0)
{
llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
}
break;
case SEND_I_XXX(X=0):
llc_sendipdu(lp, I_CMD, 0, skb);
break;
case RE-SEND_I_XXX(X=0):
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 0);
break;
case RE-SEND_I_XXX(X=0)_OR_SEND_RR:
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 0);
if (resend_count == 0)
{
llc_sendpdu(lp, RR_CMD, 0, 0, NULL);
}
break;
case RE-SEND_I_RSP(F=1):
resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_RSP, 1);
break;
case SEND_REJ_CMD(P=1):
llc_sendpdu(lp, REJ_CMD, 1, 0, NULL);
break;
case SEND_REJ_RSP(F=1):
llc_sendpdu(lp, REJ_RSP, 1, 0, NULL);
break;
case SEND_REJ_XXX(X=0):
if (IS_RSP(fr))
llc_sendpdu(lp, REJ_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, REJ_RSP, 0, 0, NULL);
break;
case SEND_RNR_CMD(F=1):
llc_sendpdu(lp, RNR_CMD, 1, 0, NULL);
break;
case SEND_RNR_RSP(F=1):
llc_sendpdu(lp, RNR_RSP, 1, 0, NULL);
break;
case SEND_RNR_XXX(X=0):
if (IS_RSP(fr))
llc_sendpdu(lp, RNR_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, RNR_RSP, 0, 0, NULL);
break;
case SET_REMOTE_BUSY:
if (lp->remote_busy == 0)
{
lp->remote_busy = 1;
llc_start_timer(lp, BUSY_TIMER);
lp->llc_callbacks|=LLC_REMOTE_BUSY;
}
else if (lp->timer_state[BUSY_TIMER] == TIMER_IDLE)
{
llc_start_timer(lp, BUSY_TIMER);
}
break;
case OPTIONAL_SEND_RNR_XXX(X=0):
if (IS_RSP(fr))
llc_sendpdu(lp, RNR_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, RNR_RSP, 0, 0, NULL);
break;
case SEND_RR_CMD(P=1):
llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
break;
case SEND_ACKNOWLEDGE_CMD(P=1):
llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
break;
case SEND_RR_RSP(F=1):
llc_sendpdu(lp, RR_RSP, 1, 0, NULL);
break;
case SEND_ACKNOWLEDGE_RSP(F=1):
llc_sendpdu(lp, RR_RSP, 1, 0, NULL);
break;
case SEND_RR_XXX(X=0):
llc_sendpdu(lp, RR_RSP, 0, 0, NULL);
break;
case SEND_ACKNOWLEDGE_XXX(X=0):
if (IS_RSP(fr))
llc_sendpdu(lp, RR_CMD, 0, 0, NULL);
else
llc_sendpdu(lp, RR_RSP, 0, 0, NULL);
break;
case SEND_SABME_CMD(P=X):
llc_sendpdu(lp, SABME_CMD, 0, 0, NULL);
lp->f_flag = 0;
break;
case SEND_UA_RSP(F=X):
llc_sendpdu(lp, UA_RSP, lp->f_flag, 0, NULL);
break;
case S_FLAG:=0:
lp->s_flag = 0;
break;
case S_FLAG:=1:
lp->s_flag = 1;
break;
case START_P_TIMER:
if(lp->timer_state[P_TIMER] == TIMER_RUNNING)
llc_stop_timer(lp, P_TIMER);
llc_start_timer(lp, P_TIMER);
if (lp->p_flag == 0)
{
lp->retry_count = 0;
lp->p_flag = 1;
}
break;
case START_ACK_TIMER_IF_NOT_RUNNING:
if (lp->timer_state[ACK_TIMER] == TIMER_IDLE)
llc_start_timer(lp, ACK_TIMER);
break;
case START_ACK_TIMER:
llc_start_timer(lp, ACK_TIMER);
break;
case START_REJ_TIMER:
llc_start_timer(lp, REJ_TIMER);
break;
case STOP_ACK_TIMER:
llc_stop_timer(lp, ACK_TIMER);
break;
case STOP_P_TIMER:
llc_stop_timer(lp, ACK_TIMER);
lp->p_flag = 0;
break;
case IF_DATA_FLAG=2_STOP_REJ_TIMER:
if (lp->data_flag == 2)
llc_stop_timer(lp, REJ_TIMER);
break;
case STOP_REJ_TIMER:
llc_stop_timer(lp, REJ_TIMER);
break;
case STOP_ALL_TIMERS:
llc_stop_timer(lp, ACK_TIMER);
llc_stop_timer(lp, P_TIMER);
llc_stop_timer(lp, REJ_TIMER);
llc_stop_timer(lp, BUSY_TIMER);
break;
case STOP_OTHER_TIMERS:
llc_stop_timer(lp, P_TIMER);
llc_stop_timer(lp, REJ_TIMER);
llc_stop_timer(lp, BUSY_TIMER);
break;
case UPDATE_N(R)_RECEIVED:
ack_count = llc_free_acknowledged_skbs(lp,
(unsigned char) fr->s_hdr.nr);
if (ack_count > 0)
{
lp->retry_count = 0;
llc_stop_timer(lp, ACK_TIMER);
if (skb_peek(&lp->rtq) != NULL)
{
/*
* Re-transmit queue not empty
*/
llc_start_timer(lp, ACK_TIMER);
}
}
break;
case UPDATE_P_FLAG:
if (IS_UFRAME(fr))
p_flag_received = fr->u_hdr.u_pflag;
else
p_flag_received = fr->i_hdr.i_pflag;
if ((fr->pdu_hdr.ssap & 0x01) && (p_flag_received))
{
lp->p_flag = 0;
llc_stop_timer(lp, P_TIMER);
}
break;
case DATA_FLAG:=2:
lp->data_flag = 2;
break;
case DATA_FLAG:=0:
lp->data_flag = 0;
break;
case DATA_FLAG:=1:
lp->data_flag = 1;
break;
case IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1:
if (lp->data_flag == 0)
lp->data_flag = 1;
break;
case P_FLAG:=0:
lp->p_flag = 0;
break;
case P_FLAG:=P:
lp->p_flag = lp->f_flag;
break;
case REMOTE_BUSY:=0:
lp->remote_busy = 0;
break;
case RETRY_COUNT:=0:
lp->retry_count = 0;
break;
case RETRY_COUNT:=RETRY_COUNT+1:
lp->retry_count++;
break;
case V(R):=0:
lp->vr = 0;
break;
case V(R):=V(R)+1:
lp->vr++;
break;
case V(S):=0:
lp->vs = 0;
break;
case V(S):=N(R):
lp->vs = fr->i_hdr.nr;
break;
case F_FLAG:=P:
if (IS_UFRAME(fr))
lp->f_flag = fr->u_hdr.u_pflag;
else
lp->f_flag = fr->i_hdr.i_pflag;
break;
default:;
}
pc++;
}
}
/*
* Process_otype2_frame will handle incoming frames
* for 802.2 Type 2 Procedure.
*/
void llc_process_otype2_frame(llcptr lp, struct sk_buff *skb, char type)
{
int idx; /* index in transition table */
int pc_label; /* action to perform, from tr tbl */
int validation; /* result of validate_seq_nos */
int p_flag_received; /* p_flag in received frame */
frameptr fr;
fr = (frameptr) skb->data;
if (IS_UFRAME(fr))
p_flag_received = fr->u_hdr.u_pflag;
else
p_flag_received = fr->i_hdr.i_pflag;
switch(lp->state)
{
/* Compute index in transition table: */
case ADM:
idx = type;
idx = (idx << 1) + p_flag_received;
break;
case CONN:
case RESET_WAIT:
case RESET_CHECK:
case ERROR:
idx = type;
break;
case SETUP:
case RESET:
case D_CONN:
idx = type;
idx = (idx << 1) + lp->p_flag;
break;
case NORMAL:
case BUSY:
case REJECT:
case AWAIT:
case AWAIT_BUSY:
case AWAIT_REJECT:
validation = llc_validate_seq_nos(lp, fr);
if (validation > 3)
type = BAD_FRAME;
idx = type;
idx = (idx << 1);
if (validation & 1)
idx = idx +1;
idx = (idx << 1) + p_flag_received;
idx = (idx << 1) + lp->p_flag;
default:
printk("llc_proc: bad state\n");
return;
}
idx = (idx << 1) + pdutr_offset[lp->state];
lp->state = pdutr_entry[idx +1];
pc_label = pdutr_entry[idx];
if (pc_label != NOP)
{
llc_interpret_pseudo_code(lp, pc_label, skb, type);
if(lp->llc_callbacks)
{
lp->llc_event(lp);
lp->llc_callbacks=0;
}
/*
* lp may no longer be valid after this point. Be
* careful what is added!
*/
}
}
void llc_timer_expired(llcptr lp, int t)
{
int idx; /* index in transition table */
int pc_label; /* action to perform, from tr tbl */
lp->timer_state[t] = TIMER_EXPIRED;
idx = lp->state; /* Compute index in transition table: */
idx = (idx << 2) + t;
idx = idx << 1;
if (lp->retry_count >= lp->n2)
idx = idx + 1;
idx = (idx << 1) + lp->s_flag;
idx = (idx << 1) + lp->p_flag;
idx = idx << 1; /* 2 bytes per entry: action & newstate */
pc_label = timertr_entry[idx];
if (pc_label != NOP)
{
llc_interpret_pseudo_code(lp, pc_label, NULL, NO_FRAME);
lp->state = timertr_entry[idx +1];
}
lp->timer_state[t] = TIMER_IDLE;
if(lp->llc_callbacks)
{
lp->llc_event(lp);
lp->llc_callbacks=0;
}
/*
* And lp may have vanished in the event callback
*/
}
/*
* NET An implementation of the IEEE 802.2 LLC protocol for the
* LINUX operating system. LLC is implemented as a set of
* state machines and callbacks for higher networking layers.
*
* Code for initialization, termination, registration and
* MAC layer glue.
*
* Written by Tim Alpaerts, Tim_Alpaerts@toyota-motor-europe.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Changes
* Alan Cox : Chainsawed to Linux format
* Added llc_ to names
* Started restructuring handlers
*
* Horst von Brand : Add #include <linux/string.h>
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/netdevice.h>
#include <linux/init.h>
#include <net/p8022.h>
#include <asm/byteorder.h>
#include <net/llc_frame.h>
#include <net/llc.h>
/*
* All incoming frames pass thru mac_data_indicate().
* On entry the llc structure related to the frame is passed as parameter.
* The received sk_buffs with pdus other than I_CMD and I_RSP
* are freed by mac_data_indicate() after processing,
* the I pdu buffers are freed by the cl2llc client when it no longer needs
* the skb.
*/
int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb)
{
int ll; /* logical length == 802.3 length field */
unsigned char p_flag;
unsigned char type;
frameptr fr;
int free=1;
lp->inc_skb=NULL;
/*
* Truncate buffer to true 802.3 length
* [FIXME: move to 802.2 demux]
*/
ll = *(skb->data -2) * 256 + *(skb->data -1);
skb_trim( skb, ll );
fr = (frameptr) skb->data;
type = llc_decode_frametype( fr );
if (type <= FRMR_RSP)
{
/*
* PDU is of the type 2 set
*/
if ((lp->llc_mode == MODE_ABM)||(type == SABME_CMD))
llc_process_otype2_frame(lp, skb, type);
}
else
{
/*
* PDU belongs to type 1 set
*/
p_flag = fr->u_hdr.u_pflag;
switch(type)
{
case TEST_CMD:
llc_sendpdu(lp, TEST_RSP, 0,ll -3,
fr->u_hdr.u_info);
break;
case TEST_RSP:
lp->llc_callbacks|=LLC_TEST_INDICATION;
lp->inc_skb=skb;
free=0;
break;
case XID_CMD:
/*
* Basic format XID is handled by LLC itself
* Doc 5.4.1.1.2 p 48/49
*/
if ((ll == 6)&&(fr->u_hdr.u_info[0] == 0x81))
{
lp->k = fr->u_hdr.u_info[2];
llc_sendpdu(lp, XID_RSP,
fr->u_hdr.u_pflag, ll -3,
fr->u_hdr.u_info);
}
break;
case XID_RSP:
if( ll == 6 && fr->u_hdr.u_info[0] == 0x81 )
{
lp->k = fr->u_hdr.u_info[2];
}
lp->llc_callbacks|=LLC_XID_INDICATION;
lp->inc_skb=skb;
free=0;
break;
case UI_CMD:
lp->llc_callbacks|=LLC_UI_DATA;
skb_pull(skb,3);
lp->inc_skb=skb;
free=0;
break;
default:;
/*
* All other type 1 pdus ignored for now
*/
}
}
if (free&&(!(IS_IFRAME(fr))))
{
/*
* No auto free for I pdus
*/
skb->sk = NULL;
kfree_skb(skb);
}
if(lp->llc_callbacks)
{
if ( lp->llc_event != NULL ) lp->llc_event(lp);
lp->llc_callbacks=0;
}
return 0;
}
/*
* Create an LLC client. As it is the job of the caller to clean up
* LLC's on device down, the device list must be locked before this call.
*/
int register_cl2llc_client(llcptr lp, const char *device, void (*event)(llcptr), u8 *rmac, u8 ssap, u8 dsap)
{
char eye_init[] = "LLC\0";
memset(lp, 0, sizeof(*lp));
lp->dev = __dev_get_by_name(device);
if(lp->dev == NULL)
return -ENODEV;
memcpy(lp->eye, eye_init, sizeof(lp->eye));
lp->rw = 1;
lp->k = 127;
lp->n1 = 1490;
lp->n2 = 10;
lp->timer_interval[P_TIMER] = HZ; /* 1 sec */
lp->timer_interval[REJ_TIMER] = HZ/8;
lp->timer_interval[ACK_TIMER] = HZ/8;
lp->timer_interval[BUSY_TIMER] = HZ*2;
lp->local_sap = ssap;
lp->llc_event = event;
memcpy(lp->remote_mac, rmac, sizeof(lp->remote_mac));
lp->state = 0;
lp->llc_mode = MODE_ADM;
lp->remote_sap = dsap;
skb_queue_head_init(&lp->atq);
skb_queue_head_init(&lp->rtq);
MOD_INC_USE_COUNT;
return 0;
}
void unregister_cl2llc_client(llcptr lp)
{
llc_cancel_timers(lp);
MOD_DEC_USE_COUNT;
kfree(lp);
}
EXPORT_SYMBOL(register_cl2llc_client);
EXPORT_SYMBOL(unregister_cl2llc_client);
EXPORT_SYMBOL(llc_data_request);
EXPORT_SYMBOL(llc_unit_data_request);
EXPORT_SYMBOL(llc_test_request);
EXPORT_SYMBOL(llc_xid_request);
EXPORT_SYMBOL(llc_mac_data_indicate);
EXPORT_SYMBOL(llc_cancel_timers);
#define ALL_TYPES_8022 0
static int __init llc_init(void)
{
printk(KERN_NOTICE "IEEE 802.2 LLC for Linux 2.1 (c) 1996 Tim Alpaerts\n");
return 0;
}
module_init(llc_init);
/*
* NET An implementation of the IEEE 802.2 LLC protocol for the
* LINUX operating system. LLC is implemented as a set of
* state machines and callbacks for higher networking layers.
*
* llc_sendpdu(), llc_sendipdu(), resend() + queue handling code
*
* Written by Tim Alpaerts, Tim_Alpaerts@toyota-motor-europe.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Changes
* Alan Cox : Chainsawed into Linux format, style
* Added llc_ to function names
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/p8022.h>
#include <linux/stat.h>
#include <asm/byteorder.h>
#include <net/llc_frame.h>
#include <net/llc.h>
static unsigned char cntl_byte_encode[] =
{
0x00, /* I_CMD */
0x01, /* RR_CMD */
0x05, /* RNR_CMD */
0x09, /* REJ_CMD */
0x43, /* DISC_CMD */
0x7F, /* SABME_CMD */
0x00, /* I_RSP */
0x01, /* RR_RSP */
0x05, /* RNR_RSP */
0x09, /* REJ_RSP */
0x63, /* UA_RSP */
0x0F, /* DM_RSP */
0x87, /* FRMR_RSP */
0xFF, /* BAD_FRAME */
0x03, /* UI_CMD */
0xBF, /* XID_CMD */
0xE3, /* TEST_CMD */
0xBF, /* XID_RSP */
0xE3 /* TEST_RSP */
};
static unsigned char fr_length_encode[] =
{
0x04, /* I_CMD */
0x04, /* RR_CMD */
0x04, /* RNR_CMD */
0x04, /* REJ_CMD */
0x03, /* DISC_CMD */
0x03, /* SABME_CMD */
0x04, /* I_RSP */
0x04, /* RR_RSP */
0x04, /* RNR_RSP */
0x04, /* REJ_RSP */
0x03, /* UA_RSP */
0x03, /* DM_RSP */
0x03, /* FRMR_RSP */
0x00, /* BAD_FRAME */
0x03, /* UI_CMD */
0x03, /* XID_CMD */
0x03, /* TEST_CMD */
0x03, /* XID_RSP */
0x03 /* TEST_RSP */
};
static unsigned char cr_bit_encode[] = {
0x00, /* I_CMD */
0x00, /* RR_CMD */
0x00, /* RNR_CMD */
0x00, /* REJ_CMD */
0x00, /* DISC_CMD */
0x00, /* SABME_CMD */
0x01, /* I_RSP */
0x01, /* RR_RSP */
0x01, /* RNR_RSP */
0x01, /* REJ_RSP */
0x01, /* UA_RSP */
0x01, /* DM_RSP */
0x01, /* FRMR_RSP */
0x00, /* BAD_FRAME */
0x00, /* UI_CMD */
0x00, /* XID_CMD */
0x00, /* TEST_CMD */
0x01, /* XID_RSP */
0x01 /* TEST_RSP */
};
/*
* Sendpdu() constructs an output frame in a new skb and
* gives it to the MAC layer for transmission.
* This function is not used to send I pdus.
* No queues are updated here, nothing is saved for retransmission.
*
* Parameter pf controls both the poll/final bit and dsap
* fields in the output pdu.
* The dsap trick was needed to implement XID_CMD send with
* zero dsap field as described in doc 6.6 item 1 of enum.
*/
void llc_sendpdu(llcptr lp, char type, char pf, int data_len, char *pdu_data)
{
frameptr fr; /* ptr to output pdu buffer */
unsigned short int fl; /* frame length == 802.3 "length" value */
struct sk_buff *skb;
fl = data_len + fr_length_encode[(int)type];
skb = alloc_skb(16 + fl, GFP_ATOMIC);
if (skb != NULL)
{
skb->dev = lp->dev;
skb_reserve(skb, 16);
fr = (frameptr) skb_put(skb, fl);
memset(fr, 0, fl);
/*
* Construct 802.2 header
*/
if (pf & 0x02)
fr->pdu_hdr.dsap = 0;
else
fr->pdu_hdr.dsap = lp->remote_sap;
fr->pdu_hdr.ssap = lp->local_sap + cr_bit_encode[(int)type];
fr->pdu_cntl.byte1 = cntl_byte_encode[(int)type];
/*
* Fill in pflag and seq nbrs:
*/
if (IS_SFRAME(fr))
{
/* case S-frames */
if (pf & 0x01)
fr->i_hdr.i_pflag = 1;
fr->i_hdr.nr = lp->vr;
}
else
{
/* case U frames */
if (pf & 0x01)
fr->u_hdr.u_pflag = 1;
}
if (data_len > 0)
{ /* append data if any */
if (IS_UFRAME(fr))
{
memcpy(fr->u_hdr.u_info, pdu_data, data_len);
}
else
{
memcpy(fr->i_hdr.is_info, pdu_data, data_len);
}
}
lp->dev->hard_header(skb, lp->dev, ETH_P_802_3,
lp->remote_mac, NULL, fl);
skb->dev=lp->dev;
dev_queue_xmit(skb);
}
else
printk(KERN_DEBUG "cl2llc: skb_alloc() in llc_sendpdu() failed\n");
}
void llc_xid_request(llcptr lp, char opt, int ll, char * data)
{
llc_sendpdu(lp, XID_CMD, opt, ll, data);
}
void llc_test_request(llcptr lp, int ll, char * data)
{
llc_sendpdu(lp, TEST_CMD, 0, ll, data);
}
void llc_unit_data_request(llcptr lp, int ll, char * data)
{
llc_sendpdu(lp, UI_CMD, 0, ll, data);
}
/*
* llc_sendipdu() Completes an I pdu in an existing skb and gives it
* to the MAC layer for transmission.
* Parameter "type" must be either I_CMD or I_RSP.
* The skb is not freed after xmit, it is kept in case a retransmission
* is requested. If needed it can be picked up again from the rtq.
*/
void llc_sendipdu(llcptr lp, char type, char pf, struct sk_buff *skb)
{
frameptr fr; /* ptr to output pdu buffer */
struct sk_buff *tmp;
fr = (frameptr) skb->data;
fr->pdu_hdr.dsap = lp->remote_sap;
fr->pdu_hdr.ssap = lp->local_sap + cr_bit_encode[(int)type];
fr->pdu_cntl.byte1 = cntl_byte_encode[(int)type];
if (pf)
fr->i_hdr.i_pflag = 1; /* p/f and seq numbers */
fr->i_hdr.nr = lp->vr;
fr->i_hdr.ns = lp->vs;
lp->vs++;
if (lp->vs > 127)
lp->vs = 0;
lp->dev->hard_header(skb, lp->dev, ETH_P_802_3,
lp->remote_mac, NULL, skb->len);
ADD_TO_RTQ(skb); /* add skb to the retransmit queue */
tmp=skb_clone(skb, GFP_ATOMIC);
if(tmp!=NULL)
{
tmp->dev=lp->dev;
dev_queue_xmit(tmp);
}
}
/*
* Resend_ipdu() will resend the pdus in the retransmit queue (rtq)
* the return value is the number of pdus resend.
* ack_nr is N(R) of 1st pdu to resent.
* Type is I_CMD or I_RSP for 1st pdu resent.
* p is p/f flag 0 or 1 for 1st pdu resent.
* All subsequent pdus will be sent as I_CMDs with p/f set to 0
*/
int llc_resend_ipdu(llcptr lp, unsigned char ack_nr, unsigned char type, char p)
{
struct sk_buff *skb,*tmp;
int resend_count;
frameptr fr;
unsigned long flags;
resend_count = 0;
save_flags(flags);
cli();
skb = skb_peek(&lp->rtq);
while(skb && skb != (struct sk_buff *)&lp->rtq)
{
fr = (frameptr) (skb->data + lp->dev->hard_header_len);
if (resend_count == 0)
{
/*
* Resending 1st pdu:
*/
if (p)
fr->i_hdr.i_pflag = 1;
else
fr->i_hdr.i_pflag = 0;
if (type == I_CMD)
fr->pdu_hdr.ssap = fr->pdu_hdr.ssap & 0xfe;
else
fr->pdu_hdr.ssap = fr->pdu_hdr.ssap | 0x01;
}
else
{
/*
* Resending pdu 2...n
*/
fr->pdu_hdr.ssap = fr->pdu_hdr.ssap & 0xfe;
fr->i_hdr.i_pflag = 0;
}
fr->i_hdr.nr = lp->vr;
fr->i_hdr.ns = lp->vs;
lp->vs++;
if (lp->vs > 127)
lp->vs = 0;
tmp=skb_clone(skb, GFP_ATOMIC);
if(tmp!=NULL)
{
tmp->dev = lp->dev;
dev_queue_xmit(skb);
}
resend_count++;
skb = skb->next;
}
restore_flags(flags);
return resend_count;
}
/* ************** internal queue management code ****************** */
/*
* Remove one skb from the front of the awaiting transmit queue
* (this is the skb longest on the queue) and return a pointer to
* that skb.
*/
struct sk_buff *llc_pull_from_atq(llcptr lp)
{
return skb_dequeue(&lp->atq);
}
/*
* Free_acknowledged_skbs(), remove from retransmit queue (rtq)
* and free all skbs with an N(S) chronologicaly before 'pdu_ack'.
* The return value is the number of pdus acknowledged.
*/
int llc_free_acknowledged_skbs(llcptr lp, unsigned char pdu_ack)
{
struct sk_buff *pp;
frameptr fr;
int ack_count;
unsigned char ack; /* N(S) of most recently ack'ed pdu */
unsigned char ns_save;
unsigned long flags;
if (pdu_ack > 0)
ack = pdu_ack -1;
else
ack = 127;
ack_count = 0;
save_flags(flags);
cli();
pp = skb_dequeue(&lp->rtq);
while (pp != NULL)
{
/*
* Locate skb with N(S) == ack
*/
/*
* BUG: FIXME - use skb->h.*
*/
fr = (frameptr) (pp->data + lp->dev->hard_header_len);
ns_save = fr->i_hdr.ns;
kfree_skb(pp);
ack_count++;
if (ns_save == ack)
break;
pp = skb_dequeue(&lp->rtq);
}
restore_flags(flags);
return ack_count;
}
/*
* NET An implementation of the IEEE 802.2 LLC protocol for the
* LINUX operating system. LLC is implemented as a set of
* state machines and callbacks for higher networking layers.
*
* Small utilities, Linux timer handling.
*
* Written by Tim Alpaerts, Tim_Alpaerts@toyota-motor-europe.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Changes
* Alan Cox : Chainsawed into Linux form.
* Added llc_ function name prefixes.
* Fixed bug in stop/start timer.
* Added llc_cancel_timers for closing
* down an llc
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <net/llc_frame.h>
#include <net/llc.h>
int llc_decode_frametype(frameptr fr)
{
if (IS_UFRAME(fr))
{ /* unnumbered cmd/rsp */
switch(fr->u_mm.mm & 0x3B)
{
case 0x1B:
return(SABME_CMD);
break;
case 0x10:
return(DISC_CMD);
break;
case 0x18:
return(UA_RSP);
break;
case 0x03:
return(DM_RSP);
break;
case 0x21:
return(FRMR_RSP);
break;
case 0x00:
return(UI_CMD);
break;
case 0x2B:
if (IS_RSP(fr))
return(XID_RSP);
else
return(XID_CMD);
break;
case 0x38:
if (IS_RSP(fr))
return(TEST_RSP);
else
return(TEST_CMD);
break;
default:
return(BAD_FRAME);
}
}
else if (IS_SFRAME(fr))
{ /* supervisory cmd/rsp */
switch(fr->s_hdr.ss)
{
case 0x00:
if (IS_RSP(fr))
return(RR_RSP);
else
return(RR_CMD);
break;
case 0x02:
if (IS_RSP(fr))
return(REJ_RSP);
else
return(REJ_CMD);
break;
case 0x01:
if (IS_RSP(fr))
return(RNR_RSP);
else
return(RNR_CMD);
break;
default:
return(BAD_FRAME);
}
}
else
{ /* information xfer */
if (IS_RSP(fr))
return(I_RSP);
else
return(I_CMD);
}
}
/*
* Validate_seq_nos will check N(S) and N(R) to see if they are
* invalid or unexpected.
* "unexpected" is explained on p44 Send State Variable.
* The return value is:
* 4 * invalid N(R) +
* 2 * invalid N(S) +
* 1 * unexpected N(S)
*/
int llc_validate_seq_nos(llcptr lp, frameptr fr)
{
int res;
/*
* A U-frame is always good
*/
if (IS_UFRAME(fr))
return(0);
/*
* For S- and I-frames check N(R):
*/
if (fr->i_hdr.nr == lp->vs)
{ /* if N(R) = V(S) */
res = 0; /* N(R) is good */
}
else
{ /* lp->k = transmit window size */
if (lp->vs >= lp->k)
{ /* if window not wrapped around 127 */
if ((fr->i_hdr.nr < lp->vs) &&
(fr->i_hdr.nr > (lp->vs - lp->k)))
res = 0;
else
res = 4; /* N(R) invalid */
}
else
{ /* window wraps around 127 */
if ((fr->i_hdr.nr < lp->vs) ||
(fr->i_hdr.nr > (128 + lp->vs - lp->k)))
res = 0;
else
res = 4; /* N(R) invalid */
}
}
/*
* For an I-frame, must check N(S) also:
*/
if (IS_IFRAME(fr))
{
if (fr->i_hdr.ns == lp->vr)
return res; /* N(S) good */
if (lp->vr >= lp->rw)
{
/* if receive window not wrapped */
if ((fr->i_hdr.ns < lp->vr) &&
(fr->i_hdr.ns > (lp->vr - lp->k)))
res = res +1; /* N(S) unexpected */
else
res = res +2; /* N(S) invalid */
}
else
{
/* Window wraps around 127 */
if ((fr->i_hdr.ns < lp->vr) ||
(fr->i_hdr.ns > (128 + lp->vr - lp->k)))
res = res +1; /* N(S) unexpected */
else
res = res +2; /* N(S) invalid */
}
}
return(res);
}
/* **************** timer management routines ********************* */
static void llc_p_timer_expired(unsigned long ulp)
{
llc_timer_expired((llcptr) ulp, P_TIMER);
}
static void llc_rej_timer_expired(unsigned long ulp)
{
llc_timer_expired((llcptr) ulp, REJ_TIMER);
}
static void llc_ack_timer_expired(unsigned long ulp)
{
llc_timer_expired((llcptr) ulp, ACK_TIMER);
}
static void llc_busy_timer_expired(unsigned long ulp)
{
llc_timer_expired((llcptr) ulp, BUSY_TIMER);
}
/* exp_fcn is an array holding the 4 entry points of the
timer expiry routines above.
It is required to keep start_timer() generic.
Thank you cdecl.
*/
static void (* exp_fcn[])(unsigned long) =
{
llc_p_timer_expired,
llc_rej_timer_expired,
llc_ack_timer_expired,
llc_busy_timer_expired
};
void llc_start_timer(llcptr lp, int t)
{
if (lp->timer_state[t] == TIMER_IDLE)
{
lp->tl[t].expires = jiffies + lp->timer_interval[t];
lp->tl[t].data = (unsigned long) lp;
lp->tl[t].function = exp_fcn[t];
add_timer(&lp->tl[t]);
lp->timer_state[t] = TIMER_RUNNING;
}
}
void llc_stop_timer(llcptr lp, int t)
{
if (lp->timer_state[t] == TIMER_RUNNING)
{
del_timer(&lp->tl[t]);
lp->timer_state[t] = TIMER_IDLE;
}
}
void llc_cancel_timers(llcptr lp)
{
llc_stop_timer(lp, P_TIMER);
llc_stop_timer(lp, REJ_TIMER);
llc_stop_timer(lp, ACK_TIMER);
llc_stop_timer(lp, BUSY_TIMER);
}
# usage: awk -f actionnm.awk pseudocode.h
#
BEGIN { "date" | getline
today = $0
printf("\n/* this file generated on %s */\n", today )
printf("\nstatic char *action_names[] = { \n " )
opl = 0
}
/^#define/ {
if ( opl > 3 ) {
printf("\n ")
opl = 0
}
opl = opl +1
t = sprintf("\"%s\"", $2 )
printf("%-15s ,", t )
# printf("%-10s", $2 )
}
END {
if ( opl > 3 ) {
printf("\n ")
}
printf("\t 0\n};\n\n")
}
# usage: cat pseudocode | sed -f act2num | awk -f compile.awk
#
#
BEGIN { "date" | getline
today = $0
printf("\n/* this file generated on %s */\n", today )
printf("\nstatic char pseudo_code [ ] = { \n" )
opl = 0 # op codes on the current line
opc = 0 # opcode counter
fpi = 0 # fill pointer for idx array
}
/^;/ { } # line starting with semicolon is comment
/^[A-Z]/ { # start of a new action
emit( 0 )
idx[ ++fpi ] = opc
name[ fpi ] = $1
emit( $2 )
}
/^[\t ]/ {
emit( $1 )
}
END {
if ( opl > 8 ) {
printf("\n")
}
printf("\t 0\n};\n\n")
printf("static short int pseudo_code_idx [ ] ={\n")
opl = 0
emit( 0 )
for( ii = 1; ii <= fpi; ii++ )
emit( idx[ ii ] )
if ( opl > 8 ) {
printf("\n")
}
printf("\t 0\n};\n\n")
printf("#define %-10s \t %3d \n", "NOP", 0 )
for( ii = 1; ii <= fpi; ii++ )
printf("#define %-10s \t %3d \n", name[ ii ], ii )
printf("\n")
}
function emit( opcode ){ # Niclaus Wirth
if ( opl > 8 ) {
printf("\n")
opl = 0
}
opl = opl +1
printf("\t%4d,", opcode )
opc++
}
s/NOP/0/
s/DUMMY_6/6/
s/DUMMY_8/8/
s/IF_F=1_CLEAR_REMOTE_BUSY/9/
s/CLEAR_REMOTE_BUSY/1/
s/CONNECT_CONFIRM/3/
s/DISCONNECT_INDICATION/5/
s/CONNECT_INDICATION/2/
s/IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1/55/
s/DATA_FLAG:=0/53/
s/DATA_FLAG:=1/54/
s/DATA_FLAG:=2/52/
s/DATA_INDICATION/4/
s/F_FLAG:=P/65/
s/IF_DATA_FLAG=2_STOP_REJ_TIMER/10/
s/OPTIONAL_SEND_RNR_XXX(X=0)/30/
s/P_FLAG:=0/56/
s/P_FLAG:=P/57/
s/RE-SEND_FRMR_RSP(F=0)/14/
s/RE-SEND_FRMR_RSP(F=P)/15/
s/RE-SEND_I_CMD(P=1)_OR_SEND_RR/18/
s/RE-SEND_I_CMD(P=1)/17/
s/RE-SEND_I_RSP(F=1)/22/
s/RE-SEND_I_XXX(X=0)_OR_SEND_RR/21/
s/RE-SEND_I_XXX(X=0)/20/
s/REMOTE_BUSY:=0/58/
s/REPORT_STATUS(FRMR_RECEIVED)/66/
s/REPORT_STATUS(FRMR_SENT)/67/
s/REPORT_STATUS(REMOTE_BUSY)/68/
s/REPORT_STATUS(REMOTE_NOT_BUSY)/69/
s/RESET_CONFIRM/7/
s/RESET_INDICATION(LOCAL)/70/
s/RESET_INDICATION(REMOTE)/71/
s/RETRY_COUNT:=RETRY_COUNT+1/60/
s/RETRY_COUNT:=0/59/
s/SEND_ACKNOWLEDGE_CMD(P=1)/32/
s/SEND_ACKNOWLEDGE_RSP(F=1)/34/
s/SEND_ACKNOWLEDGE_XXX(X=0)/36/
s/SEND_DISC_CMD(P=X)/11/
s/SEND_DM_RSP(F=X)/12/
s/SEND_FRMR_RSP(F=X)/13/
s/SEND_I_CMD(P=1)/16/
s/SEND_I_XXX(X=0)/19/
s/SEND_REJ_CMD(P=1)/23/
s/SEND_REJ_RSP(F=1)/24/
s/SEND_REJ_XXX(X=0)/25/
s/SEND_RNR_CMD(F=1)/26/
s/SEND_RNR_RSP(F=1)/27/
s/SEND_RNR_XXX(X=0)/28/
s/SEND_RR_CMD(P=1)/31/
s/SEND_RR_RSP(F=1)/33/
s/SEND_RR_XXX(X=0)/35/
s/SEND_SABME_CMD(P=X)/37/
s/SEND_UA_RSP(F=X)/38/
s/SET_REMOTE_BUSY/29/
s/START_ACK_TIMER_IF_NOT_RUNNING/44/
s/START_ACK_TIMER/42/
s/START_P_TIMER/41/
s/START_REJ_TIMER/43/
s/STOP_ACK_TIMER/45/
s/STOP_ALL_TIMERS/48/
s/STOP_OTHER_TIMERS/49/
s/STOP_P_TIMER/46/
s/STOP_REJ_TIMER/47/
s/S_FLAG:=0/39/
s/S_FLAG:=1/40/
s/UPDATE_N(R)_RECEIVED/50/
s/UPDATE_P_FLAG/51/
s/V(R):=0/61/
s/V(R):=V(R)+1/62/
s/V(S):=0/63/
s/V(S):=N(R)/64/
0 NOP
1 CLEAR_REMOTE_BUSY
2 CONNECT_INDICATION
3 CONNECT_CONFIRM
4 DATA_INDICATION
5 DISCONNECT_INDICATION
6 DUMMY_6
7 RESET_CONFIRM
8 DUMMY_8
9 IF_F=1_CLEAR_REMOTE_BUSY
10 IF_DATA_FLAG=2_STOP_REJ_TIMER
11 SEND_DISC_CMD(P=X)
12 SEND_DM_RSP(F=X)
13 SEND_FRMR_RSP(F=X)
14 RE-SEND_FRMR_RSP(F=0)
15 RE-SEND_FRMR_RSP(F=P)
16 SEND_I_CMD(P=1)
17 RE-SEND_I_CMD(P=1)
18 RE-SEND_I_CMD(P=1)_OR_SEND_RR
19 SEND_I_XXX(X=0)
20 RE-SEND_I_XXX(X=0)
21 RE-SEND_I_XXX(X=0)_OR_SEND_RR
22 RE-SEND_I_RSP(F=1)
23 SEND_REJ_CMD(P=1)
24 SEND_REJ_RSP(F=1)
25 SEND_REJ_XXX(X=0)
26 SEND_RNR_CMD(F=1)
27 SEND_RNR_RSP(F=1)
28 SEND_RNR_XXX(X=0)
29 SET_REMOTE_BUSY
30 OPTIONAL_SEND_RNR_XXX(X=0)
31 SEND_RR_CMD(P=1)
32 SEND_ACKNOWLEDGE_CMD(P=1)
33 SEND_RR_RSP(F=1)
34 SEND_ACKNOWLEDGE_RSP(F=1)
35 SEND_RR_XXX(X=0)
36 SEND_ACKNOWLEDGE_XXX(X=0)
37 SEND_SABME_CMD(P=X)
38 SEND_UA_RSP(F=X)
39 S_FLAG:=0
40 S_FLAG:=1
41 START_P_TIMER
42 START_ACK_TIMER
43 START_REJ_TIMER
44 START_ACK_TIMER_IF_NOT_RUNNING
45 STOP_ACK_TIMER
46 STOP_P_TIMER
47 STOP_REJ_TIMER
48 STOP_ALL_TIMERS
49 STOP_OTHER_TIMERS
50 UPDATE_N(R)_RECEIVED
51 UPDATE_P_FLAG
52 DATA_FLAG:=2
53 DATA_FLAG:=0
54 DATA_FLAG:=1
55 IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
56 P_FLAG:=0
57 P_FLAG:=P
58 REMOTE_BUSY:=0
59 RETRY_COUNT:=0
60 RETRY_COUNT:=RETRY_COUNT+1
61 V(R):=0
62 V(R):=V(R)+1
63 V(S):=0
64 V(S):=N(R)
65 F_FLAG:=P
66 REPORT_STATUS(FRMR_RECEIVED)
67 REPORT_STATUS(FRMR_SENT)
68 REPORT_STATUS(REMOTE_BUSY)
69 REPORT_STATUS(REMOTE_NOT_BUSY)
70 RESET_INDICATION(LOCAL)
71 RESET_INDICATION(REMOTE)
static char *opcode_names[] = {
"NOP", "CLEAR_REMOTE_BUSY", "CONNECT_INDICATION", "CONNECT_CONFIRM", "DATA_INDICATION",
"DISCONNECT_INDICATION", "DUMMY_6", "RESET_CONFIRM", "DUMMY_8",
"IF_F=1_CLEAR_REMOTE_BUSY", "IF_DATA_FLAG=2_STOP_REJ_TIMER", "SEND_DISC_CMD(P=X)",
"SEND_DM_RSP(F=X)", "SEND_FRMR_RSP(F=X)", "RE-SEND_FRMR_RSP(F=0)",
"RE-SEND_FRMR_RSP(F=P)", "SEND_I_CMD(P=1)", "RE-SEND_I_CMD(P=1)",
"RE-SEND_I_CMD(P=1)_OR_SEND_RR", "SEND_I_XXX(X=0)", "RE-SEND_I_XXX(X=0)",
"RE-SEND_I_XXX(X=0)_OR_SEND_RR", "RE-SEND_I_RSP(F=1)", "SEND_REJ_CMD(P=1)",
"SEND_REJ_RSP(F=1)", "SEND_REJ_XXX(X=0)", "SEND_RNR_CMD(F=1)", "SEND_RNR_RSP(F=1)",
"SEND_RNR_XXX(X=0)", "SET_REMOTE_BUSY", "OPTIONAL_SEND_RNR_XXX(X=0)",
"SEND_RR_CMD(P=1)", "SEND_ACKNOWLEDGE_CMD(P=1)", "SEND_RR_RSP(F=1)",
"SEND_ACKNOWLEDGE_RSP(F=1)", "SEND_RR_XXX(X=0)", "SEND_ACKNOWLEDGE_XXX(X=0)",
"SEND_SABME_CMD(P=X)", "SEND_UA_RSP(F=X)", "S_FLAG:=0", "S_FLAG:=1", "START_P_TIMER",
"START_ACK_TIMER", "START_REJ_TIMER", "START_ACK_TIMER_IF_NOT_RUNNING",
"STOP_ACK_TIMER", "STOP_P_TIMER", "STOP_REJ_TIMER", "STOP_ALL_TIMERS",
"STOP_OTHER_TIMERS", "UPDATE_N(R)_RECEIVED", "UPDATE_P_FLAG", "DATA_FLAG:=2",
"DATA_FLAG:=0", "DATA_FLAG:=1", "IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1", "P_FLAG:=0",
"P_FLAG:=P", "REMOTE_BUSY:=0", "RETRY_COUNT:=0", "RETRY_COUNT:=RETRY_COUNT+1",
"V(R):=0", "V(R):=V(R)+1", "V(S):=0", "V(S):=N(R)", "F_FLAG:=P",
"REPORT_STATUS(FRMR_RECEIVED)", "REPORT_STATUS(FRMR_SENT)",
"REPORT_STATUS(REMOTE_BUSY)", "REPORT_STATUS(REMOTE_NOT_BUSY)",
"RESET_INDICATION(LOCAL)", "RESET_INDICATION(REMOTE)"
};
;============================================================================
;
; translate this with
; cat pseudocode | sed -f act2num | awk -f compile.awk >pseudocode.h
;
; actionname pseudocode
;
;============================================================================
ADM1 SEND_SABME_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
RETRY_COUNT:=0
S_FLAG:=0
;
; instructions in ADM2 have been changed:
; 1. P_FLAG:=P is probably wrong in doc...
; I think it should be F_FLAG:=P the way it is in CONN3
; 2. CONNECT_RESPONSE has been wired in here,
; CONN1 is no longer referenced
;
ADM2 F_FLAG:=P
SEND_UA_RSP(F=X)
V(S):=0
V(R):=0
RETRY_COUNT:=0
P_FLAG:=0
REMOTE_BUSY:=0
CONNECT_INDICATION
ADM3 SEND_DM_RSP(F=X)
ADM4 SEND_DM_RSP(F=X)
ADM5 NOP
;============================================================================
;CONN1 SEND_UA_RSP(F=X)
; V(S):=0
; V(R):=0
; RETRY_COUNT:=0
; P_FLAG:=0
; REMOTE_BUSY:=0
CONN2 SEND_DM_RSP(F=X)
CONN3 F_FLAG:=P
CONN4 DISCONNECT_INDICATION
CONN5 NOP
;============================================================================
RESWAIT1 SEND_SABME_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
RETRY_COUNT:=0
RESWAIT2 SEND_UA_RSP(F=X)
V(S):=0
V(R):=0
RETRY_COUNT:=0
P_FLAG:=0
REMOTE_BUSY:=0
RESET_CONFIRM
RESWAIT3 SEND_DISC_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
RETRY_COUNT:=0
RESWAIT4 SEND_DM_RSP(F=X)
RESWAIT5 DISCONNECT_INDICATION
RESWAIT6 S_FLAG:=1
F_FLAG:=P
RESWAIT7 SEND_DM_RSP(F=X)
DISCONNECT_INDICATION
RESWAIT8 NOP
;============================================================================
RESCHK1 SEND_UA_RSP(F=X)
V(S):=0
V(R):=0
RETRY_COUNT:=0
P_FLAG:=0
REMOTE_BUSY:=0
RESCHK2 SEND_DM_RSP(F=X)
RESCHK3 DISCONNECT_INDICATION
RESCHK4 F_FLAG:=P
RESCHK5 SEND_DM_RSP(F=X)
DISCONNECT_INDICATION
RESCHK6 NOP
;============================================================================
SETUP1 SEND_UA_RSP(F=X)
V(S):=0
V(R):=0
RETRY_COUNT:=0
S_FLAG:=1
SETUP2 STOP_ACK_TIMER
V(S):=0
V(R):=0
RETRY_COUNT:=0
UPDATE_P_FLAG
CONNECT_CONFIRM
REMOTE_BUSY:=0
SETUP3 P_FLAG:=0
CONNECT_CONFIRM
REMOTE_BUSY:=0
SETUP4 SEND_DM_RSP(F=X)
DISCONNECT_INDICATION
STOP_ACK_TIMER
SETUP5 DISCONNECT_INDICATION
STOP_ACK_TIMER
SETUP6 NOP
SETUP7 SEND_SABME_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
RETRY_COUNT:=RETRY_COUNT+1
SETUP8 DISCONNECT_INDICATION
;============================================================================
RESET1 SEND_UA_RSP(F=X)
V(S):=0
V(R):=0
RETRY_COUNT:=0
S_FLAG:=1
RESET2 STOP_ACK_TIMER
V(S):=0
V(R):=0
RETRY_COUNT:=0
UPDATE_P_FLAG
RESET_CONFIRM
REMOTE_BUSY:=0
RESET3 P_FLAG:=0
RESET_CONFIRM
REMOTE_BUSY:=0
RESET4 SEND_DM_RSP(F=X)
DISCONNECT_INDICATION
STOP_ACK_TIMER
RESET5 DISCONNECT_INDICATION
STOP_ACK_TIMER
RESET6 NOP
RESET7 SEND_SABME_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
RETRY_COUNT:=RETRY_COUNT+1
RESET8 DISCONNECT_INDICATION
;============================================================================
D_CONN1 SEND_DM_RSP(F=X)
STOP_ACK_TIMER
D_CONN2 STOP_ACK_TIMER
D_CONN3 SEND_UA_RSP(F=X)
D_CONN4 STOP_ACK_TIMER
D_CONN5 NOP
D_CONN6 SEND_DISC_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
RETRY_COUNT:=RETRY_COUNT+1
D_CONN7 NOP
;============================================================================
ERR1 RESET_INDICATION(REMOTE)
STOP_ACK_TIMER
F_FLAG:=P
ERR2 SEND_UA_RSP(F=X)
DISCONNECT_INDICATION
STOP_ACK_TIMER
ERR3 DISCONNECT_INDICATION
STOP_ACK_TIMER
ERR4 RESET_INDICATION(LOCAL)
STOP_ACK_TIMER
REPORT_STATUS(FRMR_RECEIVED)
S_FLAG:=0
ERR5 RE-SEND_FRMR_RSP(F=P)
START_ACK_TIMER
ERR6 NOP
ERR7 RE-SEND_FRMR_RSP(F=0)
START_ACK_TIMER
RETRY_COUNT:=RETRY_COUNT+1
ERR8 S_FLAG:=0
RESET_INDICATION(LOCAL)
;============================================================================
; the shared actions are common to states NORMAL, BUSY, REJECT,
; AWAIT, AWAIT_BUSY and AWAIT_REJECT.
;============================================================================
SH1 SEND_DISC_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
STOP_OTHER_TIMERS
RETRY_COUNT:=0
SH2 SEND_SABME_CMD(P=X)
P_FLAG:=P
START_ACK_TIMER
STOP_OTHER_TIMERS
RETRY_COUNT:=0
S_FLAG:=0
SH3 RESET_INDICATION(REMOTE)
F_FLAG:=P
STOP_ALL_TIMERS
SH4 SEND_UA_RSP(F=X)
DISCONNECT_INDICATION
STOP_ALL_TIMERS
SH5 STOP_ALL_TIMERS
RESET_INDICATION(LOCAL)
REPORT_STATUS(FRMR_RECEIVED)
S_FLAG:=0
SH6 DISCONNECT_INDICATION
STOP_ALL_TIMERS
SH7 SEND_FRMR_RSP(F=X)
REPORT_STATUS(FRMR_SENT)
START_ACK_TIMER
STOP_OTHER_TIMERS
RETRY_COUNT:=0
SH8 SEND_FRMR_RSP(F=0)
REPORT_STATUS(FRMR_SENT)
START_ACK_TIMER
STOP_OTHER_TIMERS
RETRY_COUNT:=0
SH9 SEND_FRMR_RSP(F=0)
REPORT_STATUS(FRMR_SENT)
START_ACK_TIMER
STOP_OTHER_TIMERS
RETRY_COUNT:=0
SH10 SEND_FRMR_RSP(F=X)
REPORT_STATUS(FRMR_SENT)
START_ACK_TIMER
STOP_OTHER_TIMERS
RETRY_COUNT:=0
SH11 STOP_ALL_TIMERS
RESET_INDICATION(LOCAL)
S_FLAG:=0
;============================================================================
NORMAL1 SEND_I_CMD(P=1)
START_P_TIMER
START_ACK_TIMER_IF_NOT_RUNNING
; SEND_I_XXX(X=0)
; START_ACK_TIMER_IF_NOT_RUNNING
NORMAL2 SEND_I_XXX(X=0)
START_ACK_TIMER_IF_NOT_RUNNING
NORMAL3 SEND_RNR_CMD(F=1)
START_P_TIMER
DATA_FLAG:=0
; SEND_RNR_XXX(X=0)
; DATA_FLAG:=0
NORMAL4 SEND_RNR_XXX(X=0)
DATA_FLAG:=0
NORMAL5 SEND_REJ_XXX(X=0)
UPDATE_N(R)_RECEIVED
UPDATE_P_FLAG
START_REJ_TIMER
IF_F=1_CLEAR_REMOTE_BUSY
; SEND_REJ_CMD(P=1)
; UPDATE_N(R)_RECEIVED
; START_P_TIMER
; START_REJ_TIMER
; IF_F=1_CLEAR_REMOTE_BUSY
NORMAL6 SEND_REJ_XXX(X=0)
UPDATE_N(R)_RECEIVED
START_REJ_TIMER
NORMAL7 SEND_REJ_RSP(F=1)
UPDATE_N(R)_RECEIVED
START_REJ_TIMER
;
; the order of opcodes in NORMAL8 is changed.
; the transition table will execute NORMAL8A for incoming pdus
; with p/f 1, pdus with pf 0 are treated in NORMAL8B.
;
NORMAL8A V(R):=V(R)+1
SEND_ACKNOWLEDGE_CMD(P=1)
START_P_TIMER
UPDATE_N(R)_RECEIVED
IF_F=1_CLEAR_REMOTE_BUSY
DATA_INDICATION
;
NORMAL8B V(R):=V(R)+1
UPDATE_P_FLAG
SEND_ACKNOWLEDGE_XXX(X=0)
UPDATE_N(R)_RECEIVED
IF_F=1_CLEAR_REMOTE_BUSY
DATA_INDICATION
;
; the order of opcodes in NORMAL9 is changed
NORMAL9 V(R):=V(R)+1
SEND_ACKNOWLEDGE_XXX(X=0)
UPDATE_N(R)_RECEIVED
DATA_INDICATION
;
; the order of opcodes in NORMAL10 is changed
NORMAL10 V(R):=V(R)+1
SEND_ACKNOWLEDGE_RSP(F=1)
UPDATE_N(R)_RECEIVED
DATA_INDICATION
NORMAL11 UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
NORMAL12 SEND_ACKNOWLEDGE_RSP(F=1)
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
NORMAL13 UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
NORMAL14 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
NORMAL15 V(S):=N(R)
UPDATE_N(R)_RECEIVED
UPDATE_P_FLAG
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
; V(S):=N(R)
; UPDATE_N(R)_RECEIVED
; START_P_TIMER
; RE-SEND_I_CMD(P=1)
; CLEAR_REMOTE_BUSY
NORMAL16 V(S):=N(R)
UPDATE_N(R)_RECEIVED
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
NORMAL17 V(S):=N(R)
UPDATE_N(R)_RECEIVED
RE-SEND_I_RSP(F=1)
CLEAR_REMOTE_BUSY
NORMAL18 SEND_RR_CMD(P=1)
START_P_TIMER
NORMAL19 P_FLAG:=0
; SEND_RR_CMD(P=1)
; START_P_TIMER
; RETRY_COUNT:=RETRY_COUNT+1
NORMAL20 SEND_RR_CMD(P=1)
START_P_TIMER
RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
BUSY1 SEND_I_CMD(P=1)
START_P_TIMER
START_ACK_TIMER_IF_NOT_RUNNING
; SEND_I_XXX(X=0)
; START_ACK_TIMER_IF_NOT_RUNNING
BUSY2 SEND_I_XXX(X=0)
START_ACK_TIMER_IF_NOT_RUNNING
BUSY3 SEND_REJ_CMD(P=1)
START_REJ_TIMER
START_P_TIMER
; SEND_REJ_XXX(X=0)
; START_REJ_TIMER
BUSY4 SEND_REJ_XXX(X=0)
START_REJ_TIMER
BUSY5 SEND_RR_CMD(P=1)
START_P_TIMER
SEND_RR_XXX(X=0)
BUSY6 SEND_RR_XXX(X=0)
BUSY7 SEND_RR_CMD(P=1)
START_P_TIMER
SEND_RR_XXX(X=0)
BUSY8 SEND_RR_XXX(X=0)
BUSY9 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
IF_F=1_CLEAR_REMOTE_BUSY
; SEND_RNR_CMD(P=1)
; START_P_TIMER
; UPDATE_N(R)_RECEIVED
; IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
; IF_F=1_CLEAR_REMOTE_BUSY
BUSY10 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_N(R)_RECEIVED
IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
BUSY11 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
BUSY12 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
IF_DATA_FLAG=2_STOP_REJ_TIMER
DATA_FLAG:=1
; V(R):=V(R)+1
; DATA_INDICATION
; SEND_RNR_RSP(F=1)
; UPDATE_N(R)_RECEIVED
; IF_DATA_FLAG=2_STOP_REJ_TIMER
; DATA_FLAG:=0
BUSY13 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
IF_DATA_FLAG=2_STOP_REJ_TIMER
DATA_FLAG:=1
IF_F=1_CLEAR_REMOTE_BUSY
; SEND_RNR_CMD(F=1)
; START_P_TIMER
; UPDATE_N(R)_RECEIVED
; IF_DATA_FLAG=2_STOP_REJ_TIMER
; DATA_FLAG:=1
; IF_F=1_CLEAR_REMOTE_BUSY
; V(R):=V(R)+1
; DATA_INDICATION
; SEND_RNR_CMD(F=1)
; START_P_TIMER
; UPDATE_N(R)_RECEIVED
; IF_DATA_FLAG=2_STOP_REJ_TIMER
; DATA_FLAG:=0
; IF_F=1_CLEAR_REMOTE_BUSY
; V(R):=V(R)+1
; DATA_INDICATION
; UPDATE_P_FLAG
; OPTIONAL_SEND_RNR_XXX(X=0)
; UPDATE_N(R)_RECEIVED
; IF_DATA_FLAG=2_STOP_REJ_TIMER
; DATA_FLAG:=0
; IF_F=1_CLEAR_REMOTE_BUSY
BUSY14 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_N(R)_RECEIVED
IF_DATA_FLAG=2_STOP_REJ_TIMER
DATA_FLAG:=1
; V(R):=V(R)+1
; DATA_INDICATION
; OPTIONAL_SEND_RNR_XXX(X=0)
; UPDATE_N(R)_RECEIVED
; IF_DATA_FLAG=2_STOP_REJ_TIMER
; DATA_FLAG:=0
BUSY15 UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
BUSY16 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
BUSY17 UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
BUSY18 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
BUSY19 V(S):=N(R)
UPDATE_N(R)_RECEIVED
UPDATE_P_FLAG
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
; V(S):=N(R)
; UPDATE_N(R)_RECEIVED
; RE-SEND_I_CMD(P=1)
; CLEAR_REMOTE_BUSY
BUSY20 V(S):=N(R)
UPDATE_N(R)_RECEIVED
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
BUSY21 V(S):=N(R)
UPDATE_N(R)_RECEIVED
SEND_RNR_RSP(F=1)
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
BUSY22 SEND_RNR_CMD(F=1)
START_P_TIMER
BUSY23 P_FLAG:=0
; SEND_RNR_CMD(F=1)
; START_P_TIMER
; RETRY_COUNT:=RETRY_COUNT+1
BUSY24 SEND_RNR_CMD(F=1)
START_P_TIMER
RETRY_COUNT:=RETRY_COUNT+1
BUSY25 DATA_FLAG:=1
; SEND_RNR_CMD(F=1)
; START_P_TIMER
; RETRY_COUNT:=RETRY_COUNT+1
; DATA_FLAG:=1
BUSY26 DATA_FLAG:=1
;============================================================================
REJECT1 SEND_I_CMD(P=1)
START_P_TIMER
START_ACK_TIMER_IF_NOT_RUNNING
; SEND_I_XXX(X=0)
; START_ACK_TIMER_IF_NOT_RUNNING
REJECT2 SEND_I_XXX(X=0)
START_ACK_TIMER_IF_NOT_RUNNING
REJECT3 SEND_RNR_CMD(F=1)
START_P_TIMER
DATA_FLAG:=2
; SEND_RNR_XXX(X=0)
; DATA_FLAG:=2
REJECT4 SEND_RNR_XXX(X=0)
DATA_FLAG:=2
REJECT5 UPDATE_N(R)_RECEIVED
UPDATE_P_FLAG
IF_F=1_CLEAR_REMOTE_BUSY
REJECT6 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
;
; order of opcodes in REJECT7 is changed
REJECT7 V(R):=V(R)+1
SEND_ACKNOWLEDGE_CMD(P=1)
START_P_TIMER
UPDATE_N(R)_RECEIVED
IF_F=1_CLEAR_REMOTE_BUSY
STOP_REJ_TIMER
DATA_INDICATION
; V(R):=V(R)+1
; DATA_INDICATION
; UPDATE_P_FLAG
; SEND_ACKNOWLEDGE_XXX(X=0)
; UPDATE_N(R)_RECEIVED
; IF_F=1_CLEAR_REMOTE_BUSY
; STOP_REJ_TIMER
;
; order of opcodes in REJECT8 is changed
REJECT8 V(R):=V(R)+1
SEND_ACKNOWLEDGE_XXX(X=0)
UPDATE_N(R)_RECEIVED
STOP_REJ_TIMER
DATA_INDICATION
;
; order of opcodes in REJECT9 is changed
REJECT9 V(R):=V(R)+1
SEND_ACKNOWLEDGE_RSP(F=1)
UPDATE_N(R)_RECEIVED
STOP_REJ_TIMER
DATA_INDICATION
REJECT10 UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
REJECT11 SEND_ACKNOWLEDGE_RSP(F=1)
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
REJECT12 UPDATE_P_FLAG
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
REJECT13 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
REJECT14 V(S):=N(R)
UPDATE_N(R)_RECEIVED
UPDATE_P_FLAG
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
; V(S):=N(R)
; UPDATE_N(R)_RECEIVED
; RE-SEND_I_CMD(P=1)
; START_P_TIMER
; CLEAR_REMOTE_BUSY
REJECT15 V(S):=N(R)
UPDATE_N(R)_RECEIVED
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
REJECT16 V(S):=N(R)
UPDATE_N(R)_RECEIVED
RE-SEND_I_RSP(F=1)
CLEAR_REMOTE_BUSY
REJECT17 SEND_RR_CMD(P=1)
START_P_TIMER
REJECT18 SEND_REJ_CMD(P=1)
START_P_TIMER
START_REJ_TIMER
RETRY_COUNT:=RETRY_COUNT+1
REJECT19 P_FLAG:=0
; SEND_RR_CMD(P=1)
; START_P_TIMER
; START_REJ_TIMER
; RETRY_COUNT:=RETRY_COUNT+1
REJECT20 SEND_RR_CMD(P=1)
START_P_TIMER
START_REJ_TIMER
RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
AWAIT1 SEND_RNR_XXX(X=0)
DATA_FLAG:=0
AWAIT2 SEND_REJ_XXX(X=0)
UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
RE-SEND_I_XXX(X=0)
START_REJ_TIMER
CLEAR_REMOTE_BUSY
; SEND_REJ_CMD(P=1)
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; RE-SEND_I_XXX(X=0)
; START_P_TIMER
; START_REJ_TIMER
; CLEAR_REMOTE_BUSY
AWAIT3 SEND_REJ_XXX(X=0)
UPDATE_N(R)_RECEIVED
START_REJ_TIMER
AWAIT4 SEND_REJ_RSP(F=1)
UPDATE_N(R)_RECEIVED
START_REJ_TIMER
;
; order of opcode in AWAIT5 changed
AWAIT5 V(R):=V(R)+1
UPDATE_N(R)_RECEIVED
V(S):=N(R)
RE-SEND_I_CMD(P=1)_OR_SEND_RR
START_P_TIMER
CLEAR_REMOTE_BUSY
DATA_INDICATION
; V(R):=V(R)+1
; DATA_INDICATION
; STOP_P_TIMER
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; RE-SEND_I_XXX(X=0)_OR_SEND_RR
; CLEAR_REMOTE_BUSY
;
; order of opcode in AWAIT6 changed
AWAIT6 V(R):=V(R)+1
SEND_RR_XXX(X=0)
UPDATE_N(R)_RECEIVED
DATA_INDICATION
;
; order of opcode in AWAIT7 changed
AWAIT7 V(R):=V(R)+1
SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
DATA_INDICATION
AWAIT8 UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; RE-SEND_I_CMD(P=1)
; START_P_TIMER
; CLEAR_REMOTE_BUSY
AWAIT9 UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
AWAIT10 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
AWAIT11 UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
SET_REMOTE_BUSY
AWAIT12 UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
AWAIT13 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
AWAIT14 SEND_RR_CMD(P=1)
START_P_TIMER
RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
AWAIT_BUSY1 SEND_REJ_XXX(X=0)
START_REJ_TIMER
AWAIT_BUSY2 SEND_RR_XXX(X=0)
AWAIT_BUSY3 SEND_RR_XXX(X=0)
AWAIT_BUSY4 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
DATA_FLAG:=1
CLEAR_REMOTE_BUSY
RE-SEND_I_XXX(X=0)
; SEND_RNR_CMD(F=1)
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; START_P_TIMER
; DATA_FLAG:=1
; CLEAR_REMOTE_BUSY
; RE-SEND_I_XXX(X=0)
AWAIT_BUSY5 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_N(R)_RECEIVED
DATA_FLAG:=1
AWAIT_BUSY6 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
DATA_FLAG:=1
AWAIT_BUSY7 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_N(R)_RECEIVED
V(S):=N(R)
DATA_FLAG:=1
STOP_P_TIMER
CLEAR_REMOTE_BUSY
RE-SEND_I_XXX(X=0)
; SEND_RNR_CMD(F=1)
; V(R):=V(R)+1
; DATA_INDICATION
; START_P_TIMER
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; DATA_FLAG:=0
; CLEAR_REMOTE_BUSY
; RE-SEND_I_XXX(X=0)
; OPTIONAL_SEND_RNR_XXX(X=0)
; V(R):=V(R)+1
; DATA_INDICATION
; STOP_P_TIMER
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; DATA_FLAG:=0
; CLEAR_REMOTE_BUSY
; RE-SEND_I_XXX(X=0)
AWAIT_BUSY8 OPTIONAL_SEND_RNR_XXX(X=0)
UPDATE_N(R)_RECEIVED
DATA_FLAG:=1
; OPTIONAL_SEND_RNR_XXX(X=0)
; V(R):=V(R)+1
; DATA_INDICATION
; UPDATE_N(R)_RECEIVED
; DATA_FLAG:=0
AWAIT_BUSY9 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
DATA_FLAG:=1
; SEND_RNR_RSP(F=1)
; V(R):=V(R)+1
; DATA_INDICATION
; UPDATE_N(R)_RECEIVED
; DATA_FLAG:=0
AWAIT_BUSY10 UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; RE-SEND_I_CMD(P=1)
; START_P_TIMER
; CLEAR_REMOTE_BUSY
AWAIT_BUSY11 UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
AWAIT_BUSY12 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
AWAIT_BUSY13 UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
SET_REMOTE_BUSY
AWAIT_BUSY14 UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
AWAIT_BUSY15 SEND_RNR_RSP(F=1)
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
AWAIT_BUSY16 SEND_RNR_CMD(F=1)
START_P_TIMER
RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
AWAIT_REJECT1 SEND_RNR_XXX(X=0)
DATA_FLAG:=2
AWAIT_REJECT2 UPDATE_N(R)_RECEIVED
AWAIT_REJECT3 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
;
; order of opcodes in AWAIT_REJECT4 changed
AWAIT_REJECT4 V(R):=V(R)+1
UPDATE_N(R)_RECEIVED
V(S):=N(R)
RE-SEND_I_CMD(P=1)_OR_SEND_RR
START_P_TIMER
STOP_REJ_TIMER
CLEAR_REMOTE_BUSY
DATA_INDICATION
; V(R):=V(R)+1
; DATA_INDICATION
; STOP_P_TIMER
; STOP_REJ_TIMER
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; RE-SEND_I_CMD(P=1)_OR_SEND_RR
; CLEAR_REMOTE_BUSY
;
; order of opcodes in AWAIT_REJECT5 changed
AWAIT_REJECT5 V(R):=V(R)+1
SEND_RR_XXX(X=0)
STOP_REJ_TIMER
UPDATE_N(R)_RECEIVED
DATA_INDICATION
;
; order of opcodes in AWAIT_REJECT6 changed
AWAIT_REJECT6 V(R):=V(R)+1
SEND_RR_RSP(F=1)
STOP_REJ_TIMER
UPDATE_N(R)_RECEIVED
DATA_INDICATION
AWAIT_REJECT7 UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
RE-SEND_I_XXX(X=0)
CLEAR_REMOTE_BUSY
; UPDATE_N(R)_RECEIVED
; V(S):=N(R)
; RE-SEND_I_CMD(P=1)
; START_P_TIMER
; CLEAR_REMOTE_BUSY
AWAIT_REJECT8 UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
AWAIT_REJECT9 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
CLEAR_REMOTE_BUSY
AWAIT_REJECT10 UPDATE_N(R)_RECEIVED
V(S):=N(R)
STOP_P_TIMER
SET_REMOTE_BUSY
AWAIT_REJECT11 UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
AWAIT_REJECT12 SEND_RR_RSP(F=1)
UPDATE_N(R)_RECEIVED
SET_REMOTE_BUSY
AWAIT_REJECT13 SEND_REJ_CMD(P=1)
START_P_TIMER
RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
...@@ -14,15 +14,16 @@ ...@@ -14,15 +14,16 @@
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/config.h> #include <linux/config.h>
ctl_table e802_table[] = {
{0}
};
#ifdef CONFIG_TR
extern int sysctl_tr_rif_timeout; extern int sysctl_tr_rif_timeout;
ctl_table tr_table[] = {
{NET_TR_RIF_TIMEOUT, "rif_timeout", &sysctl_tr_rif_timeout, sizeof(int), struct ctl_table tr_table[] = {
0644, NULL, &proc_dointvec}, {
{0} .ctl_name = NET_TR_RIF_TIMEOUT,
.procname = "rif_timeout",
.data = &sysctl_tr_rif_timeout,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec
},
{ 0 },
}; };
#endif
# to run: awk -f transit.awk transit.p0
#
BEGIN { "date" | getline
enable_index = 1
today = $0
printf("\n/* this file was generated on %s */\n", today )
not_firstone = 0 # flag to avoid empty entry in 1st table
fpe = 0 # entry tbl array fill pointer
fpeo = 0 # entry tbl offset list fill pointer
fpdef = 0 # define list fill pointer
}
### /^;/ { } # line starting with a semicolon is comment
/^[A-Z]/ { # table name
if ( $1 == "TABLE" ) {
tbl = $2 # get table name
newtbl( tbl )
}
else if ( $1 == "COMPILE" ) {
array_name = $2
if ( $3 == "NOINDEX" ) { enable_index = 0 }
}
else { # table entry
ec = ec +1
n = split( $0, fld, " " )
action = fld[ n-1 ]
newstate = fld[ n ]
store( action, newstate )
ecct = ecct +1
}
}
END { store( action, newstate )
if ( enable_index ) {
printf( "\n/* index name #defines: */\n\n",
ec, ecct )
for( ii = 1; ii <= fpeo; ii++ ){
printf( "#define %-12s %3d\n", define[ ii ], ii -1 )
}
}
printf( "\n\n/* size of transition table is %d bytes */\n",
fpe )
if ( enable_index ) {
printf( "\nstatic short int %s_offset [ ] ={", array_name )
for( ii = 1; ii <= fpeo; ii++ ){
if ( (ii % 10) == 1 ) printf("\n ")
printf( " %4d", entry_offset[ ii ] )
if ( ii < fpeo ) printf( "," )
}
printf(" };\n")
}
printf( "\nstatic char %s_entry [ ] = {", array_name )
for( ii = 1; ii <= fpe; ii++ ){
if ( (ii % 6) == 1 ) printf("\n ")
printf( " %-14s", entry[ ii ] )
if ( ii < fpe ) printf( "," )
}
printf(" };\n")
}
function store( act, ns ){
# printf( "%s %s\n", act, ns )
entry[ ++fpe ] = act
entry[ ++fpe ] = ns
}
function newtbl( tbl ){
if ( not_firstone ) {
store( action, newstate )
}
not_firstone = 1
entry_offset[ ++fpeo ] = fpe # entry tbl offset list
define[ ++fpdef ] = tbl # state name to define
}
COMPILE pdutr INDEX
;
; Transition tables for incoming pdu events.
; translate this thing into C with
; awk -f ./compile.awk pdu.trans > pdutr.h
;
TABLE ADM
;Transition table for the ADM state:
;
;frame type p bit action newstate
;received in frame
;
I_CMD 0 ADM5 ADM
I_CMD 1 ADM4 ADM
RR_CMD 0 ADM5 ADM
RR_CMD 1 ADM4 ADM
RNR_CMD 0 ADM5 ADM
RNR_CMD 1 ADM4 ADM
REJ_CMD 0 ADM5 ADM
REJ_CMD 1 ADM4 ADM
DISC_CMD 0 ADM3 ADM
DISC_CMD 1 ADM3 ADM
SABME_CMD 0 ADM2 CONN
SABME_CMD 1 ADM2 CONN
I_RSP 0 ADM5 ADM
I_RSP 1 ADM5 ADM
RR_RSP 0 ADM5 ADM
RR_RSP 1 ADM5 ADM
RNR_RSP 0 ADM5 ADM
RNR_RSP 1 ADM5 ADM
REJ_RSP 0 ADM5 ADM
REJ_RSP 1 ADM5 ADM
UA_RSP 0 ADM5 ADM
UA_RSP 1 ADM5 ADM
DM_RSP 0 ADM5 ADM
DM_RSP 1 ADM5 ADM
FRMR_RSP 0 ADM5 ADM
FRMR_RSP 1 ADM5 ADM
;
TABLE CONN
;
;Transition table for the CONN state:
;
;frame type action newstate
;received
;
I_CMD CONN5 CONN
RR_CMD CONN5 CONN
RNR_CMD CONN5 CONN
REJ_CMD CONN5 CONN
DISC_CMD CONN5 CONN
SABME_CMD CONN3 CONN
I_RSP CONN5 CONN
RR_RSP CONN5 CONN
RNR_RSP CONN5 CONN
REJ_RSP CONN5 CONN
UA_RSP CONN5 CONN
DM_RSP CONN4 ADM
FRMR_RSP CONN5 CONN
;
TABLE RESET_WAIT
;Transition table for the RESET_WAIT
;
;frame type action newstate
;received
;
I_CMD RESWAIT8 RESET_WAIT
RR_CMD RESWAIT8 RESET_WAIT
RNR_CMD RESWAIT8 RESET_WAIT
REJ_CMD RESWAIT8 RESET_WAIT
DISC_CMD RESWAIT7 RESET_WAIT
SABME_CMD RESWAIT6 RESET_WAIT
I_RSP RESWAIT8 RESET_WAIT
RR_RSP RESWAIT8 RESET_WAIT
RNR_RSP RESWAIT8 RESET_WAIT
REJ_RSP RESWAIT8 RESET_WAIT
UA_RSP RESWAIT8 RESET_WAIT
DM_RSP RESWAIT5 ADM
FRMR_RSP RESWAIT8 RESET_WAIT
;
;
TABLE RESET_CHECK
;Transition table for the RESET_CHECK state
;
;frame type action newstate
;received
;
I_CMD RESCHK6 RESET_CHECK
RR_CMD RESCHK6 RESET_CHECK
RNR_CMD RESCHK6 RESET_CHECK
REJ_CMD RESCHK6 RESET_CHECK
DISC_CMD RESCHK5 ADM
SABME_CMD RESCHK4 RESET_CHECK
I_RSP RESCHK6 RESET_CHECK
RR_RSP RESCHK6 RESET_CHECK
RNR_RSP RESCHK6 RESET_CHECK
REJ_RSP RESCHK6 RESET_CHECK
UA_RSP RESCHK6 RESET_CHECK
DM_RSP RESCHK3 ADM
FRMR_RSP RESCHK6 RESET_CHECK
;
;
TABLE SETUP
;Transition table for the SETUP state
;
;frame type p flag action newstate
;received = f
;
I_CMD 0 SETUP6 SETUP
I_CMD 1 SETUP6 SETUP
RR_CMD 0 SETUP6 SETUP
RR_CMD 1 SETUP6 SETUP
RNR_CMD 0 SETUP6 SETUP
RNR_CMD 1 SETUP6 SETUP
REJ_CMD 0 SETUP6 SETUP
REJ_CMD 1 SETUP6 SETUP
DISC_CMD 0 SETUP4 ADM
DISC_CMD 1 SETUP4 ADM
SABME_CMD 0 SETUP1 SETUP
SABME_CMD 1 SETUP1 SETUP
I_RSP 0 SETUP6 SETUP
I_RSP 1 SETUP6 SETUP
RR_RSP 0 SETUP6 SETUP
RR_RSP 1 SETUP6 SETUP
RNR_RSP 0 SETUP6 SETUP
RNR_RSP 1 SETUP6 SETUP
REJ_RSP 0 SETUP6 SETUP
REJ_RSP 1 SETUP6 SETUP
UA_RSP 0 SETUP6 SETUP
UA_RSP 1 SETUP2 NORMAL
DM_RSP 0 SETUP5 ADM
DM_RSP 1 SETUP5 ADM
FRMR_RSP 0 SETUP6 SETUP
FRMR_RSP 1 SETUP6 SETUP
;
;
TABLE RESET
;Transition table for the RESET state:
;
;frame type p flag action newstate
;received = f
;
I_CMD 0 RESET6 RESET
I_CMD 1 RESET6 RESET
RR_CMD 0 RESET6 RESET
RR_CMD 1 RESET6 RESET
RNR_CMD 0 RESET6 RESET
RNR_CMD 1 RESET6 RESET
REJ_CMD 0 RESET6 RESET
REJ_CMD 1 RESET6 RESET
DISC_CMD 0 RESET4 ADM
DISC_CMD 1 RESET4 ADM
SABME_CMD 0 RESET1 RESET
SABME_CMD 1 RESET1 RESET
I_RSP 0 RESET6 RESET
I_RSP 1 RESET6 RESET
RR_RSP 0 RESET6 RESET
RR_RSP 1 RESET6 RESET
RNR_RSP 0 RESET6 RESET
RNR_RSP 1 RESET6 RESET
REJ_RSP 0 RESET6 RESET
REJ_RSP 1 RESET6 RESET
UA_RSP 0 RESET6 RESET
UA_RSP 1 RESET2 NORMAL
DM_RSP 0 RESET5 ADM
DM_RSP 1 RESET5 ADM
FRMR_RSP 0 RESET6 RESET
FRMR_RSP 1 RESET6 RESET
;
;
TABLE D_CONN
;Transition table for the D_CONN state:
;
;frame type p bit action newstate
;received in frame
I_CMD 0 D_CONN5 D_CONN
I_CMD 1 D_CONN5 D_CONN
RR_CMD 0 D_CONN5 D_CONN
RR_CMD 1 D_CONN5 D_CONN
RNR_CMD 0 D_CONN5 D_CONN
RNR_CMD 1 D_CONN5 D_CONN
REJ_CMD 0 D_CONN5 D_CONN
REJ_CMD 1 D_CONN5 D_CONN
DISC_CMD 0 D_CONN3 D_CONN
DISC_CMD 1 D_CONN3 D_CONN
SABME_CMD 0 D_CONN1 ADM
SABME_CMD 1 D_CONN1 ADM
I_RSP 0 D_CONN5 D_CONN
I_RSP 1 D_CONN5 D_CONN
RR_RSP 0 D_CONN5 D_CONN
RR_RSP 1 D_CONN5 D_CONN
RNR_RSP 0 D_CONN5 D_CONN
RNR_RSP 1 D_CONN5 D_CONN
REJ_RSP 0 D_CONN5 D_CONN
REJ_RSP 1 D_CONN5 D_CONN
UA_RSP 0 D_CONN5 D_CONN
UA_RSP 1 D_CONN4 ADM
DM_RSP 0 D_CONN4 ADM
DM_RSP 1 D_CONN5 ADM
FRMR_RSP 0 D_CONN5 D_CONN
FRMR_RSP 1 D_CONN5 D_CONN
;
;
TABLE ERROR
;Transition table for the ERROR state:
;
;frame type action newstate
;received
;
I_CMD ERR5 ERROR
RR_CMD ERR5 ERROR
RNR_CMD ERR5 ERROR
REJ_CMD ERR5 ERROR
DISC_CMD ERR2 ADM
SABME_CMD ERR1 RESET_CHECK
I_RSP ERR6 ERROR
RR_RSP ERR6 ERROR
RNR_RSP ERR6 ERROR
REJ_RSP ERR6 ERROR
UA_RSP ERR6 ERROR
DM_RSP ERR3 ADM
FRMR_RSP ERR4 RESET_WAIT
;
TABLE NORMAL
;Transition table for the NORMAL state:
;
;frame type uexpect p bit p_flag
;received N(S) in frame
;
I_CMD 0 0 0 NORMAL8B NORMAL
I_CMD 0 0 1 NORMAL9 NORMAL
I_CMD 0 1 0 NORMAL10 NORMAL
I_CMD 0 1 1 NORMAL10 NORMAL
I_CMD 1 0 0 NORMAL5 REJECT
I_CMD 1 0 1 NORMAL6 REJECT
I_CMD 1 1 0 NORMAL7 REJECT
I_CMD 1 1 1 NORMAL7 REJECT
RR_CMD 0 0 0 NORMAL11 NORMAL
RR_CMD 0 0 1 NORMAL11 NORMAL
RR_CMD 0 1 0 NORMAL12 NORMAL
RR_CMD 0 1 1 NORMAL12 NORMAL
RR_CMD 1 0 0 NORMAL11 NORMAL
RR_CMD 1 0 1 NORMAL11 NORMAL
RR_CMD 1 1 0 NORMAL12 NORMAL
RR_CMD 1 1 1 NORMAL12 NORMAL
RNR_CMD 0 0 0 NORMAL13 NORMAL
RNR_CMD 0 0 1 NORMAL13 NORMAL
RNR_CMD 0 1 0 NORMAL14 NORMAL
RNR_CMD 0 1 1 NORMAL14 NORMAL
RNR_CMD 1 0 0 NORMAL13 NORMAL
RNR_CMD 1 0 1 NORMAL13 NORMAL
RNR_CMD 1 1 0 NORMAL14 NORMAL
RNR_CMD 1 1 1 NORMAL14 NORMAL
REJ_CMD 0 0 0 NORMAL15 NORMAL
REJ_CMD 0 0 1 NORMAL16 NORMAL
REJ_CMD 0 1 0 NORMAL17 NORMAL
REJ_CMD 0 1 1 NORMAL17 NORMAL
REJ_CMD 1 0 0 NORMAL15 NORMAL
REJ_CMD 1 0 1 NORMAL16 NORMAL
REJ_CMD 1 1 0 NORMAL17 NORMAL
REJ_CMD 1 1 1 NORMAL17 NORMAL
DISC_CMD 0 0 0 SH4 ADM
DISC_CMD 0 0 1 SH4 ADM
DISC_CMD 0 1 0 SH4 ADM
DISC_CMD 0 1 1 SH4 ADM
DISC_CMD 1 0 0 SH4 ADM
DISC_CMD 1 0 1 SH4 ADM
DISC_CMD 1 1 0 SH4 ADM
DISC_CMD 1 1 1 SH4 ADM
SABME_CMD 0 0 0 SH3 RESET_CHECK
SABME_CMD 0 0 1 SH3 RESET_CHECK
SABME_CMD 0 1 0 SH3 RESET_CHECK
SABME_CMD 0 1 1 SH3 RESET_CHECK
SABME_CMD 1 0 0 SH3 RESET_CHECK
SABME_CMD 1 0 1 SH3 RESET_CHECK
SABME_CMD 1 1 0 SH3 RESET_CHECK
SABME_CMD 1 1 1 SH3 RESET_CHECK
I_RSP 0 0 0 NORMAL8B NORMAL
I_RSP 0 0 1 NORMAL9 NORMAL
I_RSP 0 1 0 SH10 ERROR
I_RSP 0 1 1 NORMAL8A NORMAL
I_RSP 1 0 0 NORMAL5 REJECT
I_RSP 1 0 1 NORMAL6 REJECT
I_RSP 1 1 0 SH10 ERROR
I_RSP 1 1 1 NORMAL5 REJECT
RR_RSP 0 0 0 NORMAL11 NORMAL
RR_RSP 0 0 1 NORMAL11 NORMAL
RR_RSP 0 1 0 SH10 ERROR
RR_RSP 0 1 1 NORMAL11 NORMAL
RR_RSP 1 0 0 NORMAL11 NORMAL
RR_RSP 1 0 1 NORMAL11 NORMAL
RR_RSP 1 1 0 SH10 ERROR
RR_RSP 1 1 1 NORMAL11 NORMAL
RNR_RSP 0 0 0 NORMAL13 NORMAL
RNR_RSP 0 0 1 NORMAL13 NORMAL
RNR_RSP 0 1 0 SH10 ERROR
RNR_RSP 0 1 1 NORMAL13 NORMAL
RNR_RSP 1 0 0 NORMAL13 NORMAL
RNR_RSP 1 0 1 NORMAL13 NORMAL
RNR_RSP 1 1 0 SH10 ERROR
RNR_RSP 1 1 1 NORMAL13 NORMAL
REJ_RSP 0 0 0 NORMAL15 NORMAL
REJ_RSP 0 0 1 NORMAL16 NORMAL
REJ_RSP 0 1 0 SH10 ERROR
REJ_RSP 0 1 1 NORMAL15 NORMAL
REJ_RSP 1 0 0 NORMAL15 NORMAL
REJ_RSP 1 0 1 NORMAL16 NORMAL
REJ_RSP 1 1 0 SH10 ERROR
REJ_RSP 1 1 1 NORMAL15 NORMAL
UA_RSP 0 0 0 SH9 ERROR
UA_RSP 0 0 1 SH9 ERROR
UA_RSP 0 1 0 SH9 ERROR
UA_RSP 0 1 1 SH9 ERROR
UA_RSP 1 0 0 SH9 ERROR
UA_RSP 1 0 1 SH9 ERROR
UA_RSP 1 1 0 SH9 ERROR
UA_RSP 1 1 1 SH9 ERROR
DM_RSP 0 0 0 SH6 ADM
DM_RSP 0 0 1 SH6 ADM
DM_RSP 0 1 0 SH6 ADM
DM_RSP 0 1 1 SH6 ADM
DM_RSP 1 0 0 SH6 ADM
DM_RSP 1 0 1 SH6 ADM
DM_RSP 1 1 0 SH6 ADM
DM_RSP 1 1 1 SH6 ADM
FRMR_RSP 0 0 0 SH5 RESET_WAIT
FRMR_RSP 0 0 1 SH5 RESET_WAIT
FRMR_RSP 0 1 0 SH5 RESET_WAIT
FRMR_RSP 0 1 1 SH5 RESET_WAIT
FRMR_RSP 1 0 0 SH5 RESET_WAIT
FRMR_RSP 1 0 1 SH5 RESET_WAIT
FRMR_RSP 1 1 0 SH5 RESET_WAIT
FRMR_RSP 1 1 1 SH5 RESET_WAIT
BAD_FRAME 0 0 0 SH7 ERROR
BAD_FRAME 0 0 1 SH7 ERROR
BAD_FRAME 0 1 0 SH7 ERROR
BAD_FRAME 0 1 1 SH7 ERROR
BAD_FRAME 1 0 0 SH7 ERROR
BAD_FRAME 1 0 1 SH7 ERROR
BAD_FRAME 1 1 0 SH7 ERROR
BAD_FRAME 1 1 1 SH7 ERROR
;
;112 entries in table, 8 modified by tredit4 SABME_CMD x x x SH3 RESET_CHECK
;112 entries in table, 8 modified by tredit4 DISC_CMD x x x SH4 ADM
;112 entries in table, 8 modified by tredit4 FRMR_RSP x x x SH5 RESET_WAIT
;112 entries in table, 8 modified by tredit4 DM_RSP x x x SH6 ADM
;112 entries in table, 8 modified by tredit4 BAD_FRAME x x x SH7 ERROR
;112 entries in table, 8 modified by tredit4 UA_RSP x x x SH9 ERROR
;112 entries in table, 8 modified by tredit4 anyrsp x 1 0 SH10 ERROR
;112 entries in table, 1 modified by tredit4 I_CMD 1 0 0 NORMAL5 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP 1 0 0 NORMAL5 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP 1 1 1 NORMAL5 REJECT
;112 entries in table, 1 modified by tredit4 I_CMD 1 0 1 NORMAL6 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP 1 0 1 NORMAL6 REJECT
;112 entries in table, 2 modified by tredit4 I_CMD 1 1 x NORMAL7 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP x 1 1 NORMAL8A NORMAL
;112 entries in table, 1 modified by tredit4 I_RSP x 0 0 NORMAL8B NORMAL
;112 entries in table, 1 modified by tredit4 I_CMD x 0 0 NORMAL8B NORMAL
;112 entries in table, 1 modified by tredit4 I_RSP x 0 1 NORMAL9 NORMAL
;112 entries in table, 1 modified by tredit4 I_CMD x 0 1 NORMAL9 NORMAL
;112 entries in table, 2 modified by tredit4 I_CMD x 1 x NORMAL10 NORMAL
;112 entries in table, 4 modified by tredit4 RR_CMD x 0 x NORMAL11 NORMAL
;112 entries in table, 4 modified by tredit4 RR_RSP x 0 x NORMAL11 NORMAL
;112 entries in table, 2 modified by tredit4 RR_RSP x 1 1 NORMAL11 NORMAL
;112 entries in table, 4 modified by tredit4 RR_CMD x 1 x NORMAL12 NORMAL
;112 entries in table, 4 modified by tredit4 RNR_CMD x 0 x NORMAL13 NORMAL
;112 entries in table, 4 modified by tredit4 RNR_RSP x 0 x NORMAL13 NORMAL
;112 entries in table, 2 modified by tredit4 RNR_RSP x 1 1 NORMAL13 NORMAL
;112 entries in table, 4 modified by tredit4 RNR_CMD x 1 x NORMAL14 NORMAL
;112 entries in table, 2 modified by tredit4 REJ_CMD x 0 0 NORMAL15 NORMAL
;112 entries in table, 2 modified by tredit4 REJ_RSP x 1 1 NORMAL15 NORMAL
;112 entries in table, 2 modified by tredit4 REJ_RSP x 0 0 NORMAL15 NORMAL
;112 entries in table, 2 modified by tredit4 REJ_CMD x 0 1 NORMAL16 NORMAL
;112 entries in table, 2 modified by tredit4 REJ_RSP x 0 1 NORMAL16 NORMAL
;112 entries in table, 4 modified by tredit4 REJ_CMD x 1 x NORMAL17 NORMAL
;
TABLE BUSY
;Transition table for the BUSY state:
;
;frame type uexpect p bit p_flag
;received N(S) in frame
;
I_CMD 0 0 0 BUSY13 BUSY
I_CMD 0 0 1 BUSY14 BUSY
I_CMD 0 1 0 BUSY12 BUSY
I_CMD 0 1 1 BUSY12 BUSY
I_CMD 1 0 0 BUSY9 BUSY
I_CMD 1 0 1 BUSY10 BUSY
I_CMD 1 1 0 BUSY11 BUSY
I_CMD 1 1 1 BUSY11 BUSY
RR_CMD 0 0 0 BUSY15 BUSY
RR_CMD 0 0 1 BUSY15 BUSY
RR_CMD 0 1 0 BUSY16 BUSY
RR_CMD 0 1 1 BUSY16 BUSY
RR_CMD 1 0 0 BUSY15 BUSY
RR_CMD 1 0 1 BUSY15 BUSY
RR_CMD 1 1 0 BUSY16 BUSY
RR_CMD 1 1 1 BUSY16 BUSY
RNR_CMD 0 0 0 BUSY17 BUSY
RNR_CMD 0 0 1 BUSY17 BUSY
RNR_CMD 0 1 0 BUSY18 BUSY
RNR_CMD 0 1 1 BUSY18 BUSY
RNR_CMD 1 0 0 BUSY17 BUSY
RNR_CMD 1 0 1 BUSY17 BUSY
RNR_CMD 1 1 0 BUSY18 BUSY
RNR_CMD 1 1 1 BUSY18 BUSY
REJ_CMD 0 0 0 BUSY19 BUSY
REJ_CMD 0 0 1 BUSY20 BUSY
REJ_CMD 0 1 0 BUSY21 BUSY
REJ_CMD 0 1 1 BUSY21 BUSY
REJ_CMD 1 0 0 BUSY19 BUSY
REJ_CMD 1 0 1 BUSY20 BUSY
REJ_CMD 1 1 0 BUSY21 BUSY
REJ_CMD 1 1 1 BUSY21 BUSY
DISC_CMD 0 0 0 SH4 ADM
DISC_CMD 0 0 1 SH4 ADM
DISC_CMD 0 1 0 SH4 ADM
DISC_CMD 0 1 1 SH4 ADM
DISC_CMD 1 0 0 SH4 ADM
DISC_CMD 1 0 1 SH4 ADM
DISC_CMD 1 1 0 SH4 ADM
DISC_CMD 1 1 1 SH4 ADM
SABME_CMD 0 0 0 SH3 RESET_CHECK
SABME_CMD 0 0 1 SH3 RESET_CHECK
SABME_CMD 0 1 0 SH3 RESET_CHECK
SABME_CMD 0 1 1 SH3 RESET_CHECK
SABME_CMD 1 0 0 SH3 RESET_CHECK
SABME_CMD 1 0 1 SH3 RESET_CHECK
SABME_CMD 1 1 0 SH3 RESET_CHECK
SABME_CMD 1 1 1 SH3 RESET_CHECK
I_RSP 0 0 0 BUSY13 BUSY
I_RSP 0 0 1 BUSY14 BUSY
I_RSP 0 1 0 SH10 ERROR
I_RSP 0 1 1 BUSY13 BUSY
I_RSP 1 0 0 BUSY9 BUSY
I_RSP 1 0 1 BUSY10 BUSY
I_RSP 1 1 0 SH10 ERROR
I_RSP 1 1 1 BUSY9 BUSY
RR_RSP 0 0 0 BUSY15 BUSY
RR_RSP 0 0 1 BUSY15 BUSY
RR_RSP 0 1 0 SH10 ERROR
RR_RSP 0 1 1 BUSY15 BUSY
RR_RSP 1 0 0 BUSY15 BUSY
RR_RSP 1 0 1 BUSY15 BUSY
RR_RSP 1 1 0 SH10 ERROR
RR_RSP 1 1 1 BUSY15 BUSY
RNR_RSP 0 0 0 BUSY17 BUSY
RNR_RSP 0 0 1 BUSY17 BUSY
RNR_RSP 0 1 0 SH10 ERROR
RNR_RSP 0 1 1 BUSY17 BUSY
RNR_RSP 1 0 0 BUSY17 BUSY
RNR_RSP 1 0 1 BUSY17 BUSY
RNR_RSP 1 1 0 SH10 ERROR
RNR_RSP 1 1 1 BUSY17 BUSY
REJ_RSP 0 0 0 BUSY19 BUSY
REJ_RSP 0 0 1 BUSY20 BUSY
REJ_RSP 0 1 0 SH10 ERROR
REJ_RSP 0 1 1 BUSY19 BUSY
REJ_RSP 1 0 0 BUSY19 BUSY
REJ_RSP 1 0 1 BUSY20 BUSY
REJ_RSP 1 1 0 SH10 ERROR
REJ_RSP 1 1 1 BUSY19 BUSY
UA_RSP 0 0 0 SH9 ERROR
UA_RSP 0 0 1 SH9 ERROR
UA_RSP 0 1 0 SH9 ERROR
UA_RSP 0 1 1 SH9 ERROR
UA_RSP 1 0 0 SH9 ERROR
UA_RSP 1 0 1 SH9 ERROR
UA_RSP 1 1 0 SH9 ERROR
UA_RSP 1 1 1 SH9 ERROR
DM_RSP 0 0 0 SH6 ADM
DM_RSP 0 0 1 SH6 ADM
DM_RSP 0 1 0 SH6 ADM
DM_RSP 0 1 1 SH6 ADM
DM_RSP 1 0 0 SH6 ADM
DM_RSP 1 0 1 SH6 ADM
DM_RSP 1 1 0 SH6 ADM
DM_RSP 1 1 1 SH6 ADM
FRMR_RSP 0 0 0 SH5 RESET_WAIT
FRMR_RSP 0 0 1 SH5 RESET_WAIT
FRMR_RSP 0 1 0 SH5 RESET_WAIT
FRMR_RSP 0 1 1 SH5 RESET_WAIT
FRMR_RSP 1 0 0 SH5 RESET_WAIT
FRMR_RSP 1 0 1 SH5 RESET_WAIT
FRMR_RSP 1 1 0 SH5 RESET_WAIT
FRMR_RSP 1 1 1 SH5 RESET_WAIT
BAD_FRAME 0 0 0 SH7 ERROR
BAD_FRAME 0 0 1 SH7 ERROR
BAD_FRAME 0 1 0 SH7 ERROR
BAD_FRAME 0 1 1 SH7 ERROR
BAD_FRAME 1 0 0 SH7 ERROR
BAD_FRAME 1 0 1 SH7 ERROR
BAD_FRAME 1 1 0 SH7 ERROR
BAD_FRAME 1 1 1 SH7 ERROR
;
;112 entries in table, 8 modified by tredit4 SABME_CMD x x x SH3 RESET_CHECK
;112 entries in table, 8 modified by tredit4 DISC_CMD x x x SH4 ADM
;112 entries in table, 8 modified by tredit4 FRMR_RSP x x x SH5 RESET_WAIT
;112 entries in table, 8 modified by tredit4 DM_RSP x x x SH6 ADM
;112 entries in table, 8 modified by tredit4 BAD_FRAME x x x SH7 ERROR
;112 entries in table, 8 modified by tredit4 UA_RSP x x x SH9 ERROR
;112 entries in table, 8 modified by tredit4 anyrsp x 1 0 SH10 ERROR
;112 entries in table, 1 modified by tredit4 I_RSP 1 0 0 BUSY9 BUSY
;112 entries in table, 1 modified by tredit4 I_RSP 1 1 1 BUSY9 BUSY
;112 entries in table, 1 modified by tredit4 I_CMD 1 0 0 BUSY9 BUSY
;112 entries in table, 1 modified by tredit4 I_RSP 1 0 1 BUSY10 BUSY
;112 entries in table, 1 modified by tredit4 I_CMD 1 0 1 BUSY10 BUSY
;112 entries in table, 2 modified by tredit4 I_CMD 1 1 x BUSY11 BUSY
;112 entries in table, 2 modified by tredit4 I_CMD x 1 x BUSY12 BUSY
;112 entries in table, 1 modified by tredit4 I_RSP x 0 0 BUSY13 BUSY
;112 entries in table, 1 modified by tredit4 I_RSP x 1 1 BUSY13 BUSY
;112 entries in table, 1 modified by tredit4 I_CMD x 0 0 BUSY13 BUSY
;112 entries in table, 1 modified by tredit4 I_RSP x 0 1 BUSY14 BUSY
;112 entries in table, 1 modified by tredit4 I_CMD x 0 1 BUSY14 BUSY
;112 entries in table, 4 modified by tredit4 RR_CMD x 0 x BUSY15 BUSY
;112 entries in table, 4 modified by tredit4 RR_RSP x 0 x BUSY15 BUSY
;112 entries in table, 2 modified by tredit4 RR_RSP x 1 1 BUSY15 BUSY
;112 entries in table, 4 modified by tredit4 RR_CMD x 1 x BUSY16 BUSY
;112 entries in table, 4 modified by tredit4 RNR_CMD x 0 x BUSY17 BUSY
;112 entries in table, 4 modified by tredit4 RNR_RSP x 0 x BUSY17 BUSY
;112 entries in table, 2 modified by tredit4 RNR_RSP x 1 1 BUSY17 BUSY
;112 entries in table, 4 modified by tredit4 RNR_CMD x 1 x BUSY18 BUSY
;112 entries in table, 2 modified by tredit4 REJ_CMD x 0 0 BUSY19 BUSY
;112 entries in table, 2 modified by tredit4 REJ_RSP x 0 0 BUSY19 BUSY
;112 entries in table, 2 modified by tredit4 REJ_RSP x 1 1 BUSY19 BUSY
;112 entries in table, 2 modified by tredit4 REJ_CMD x 0 1 BUSY20 BUSY
;112 entries in table, 2 modified by tredit4 REJ_RSP x 0 1 BUSY20 BUSY
;112 entries in table, 4 modified by tredit4 REJ_CMD x 1 x BUSY21 BUSY
;
TABLE REJECT
;Transition table for the REJECT state:
;
;frame type uexpect p bit p_flag
;received N(S) in frame
;
I_CMD 0 0 0 REJECT7 REJECT
I_CMD 0 0 1 REJECT8 REJECT
I_CMD 0 1 0 REJECT9 REJECT
I_CMD 0 1 1 REJECT9 REJECT
I_CMD 1 0 0 REJECT5 REJECT
I_CMD 1 0 1 REJECT5 REJECT
I_CMD 1 1 0 REJECT6 REJECT
I_CMD 1 1 1 REJECT6 REJECT
RR_CMD 0 0 0 REJECT10 REJECT
RR_CMD 0 0 1 REJECT10 REJECT
RR_CMD 0 1 0 REJECT11 REJECT
RR_CMD 0 1 1 REJECT11 REJECT
RR_CMD 1 0 0 REJECT10 REJECT
RR_CMD 1 0 1 REJECT10 REJECT
RR_CMD 1 1 0 REJECT11 REJECT
RR_CMD 1 1 1 REJECT11 REJECT
RNR_CMD 0 0 0 REJECT12 REJECT
RNR_CMD 0 0 1 REJECT12 REJECT
RNR_CMD 0 1 0 REJECT13 REJECT
RNR_CMD 0 1 1 REJECT13 REJECT
RNR_CMD 1 0 0 REJECT12 REJECT
RNR_CMD 1 0 1 REJECT12 REJECT
RNR_CMD 1 1 0 REJECT13 REJECT
RNR_CMD 1 1 1 REJECT13 REJECT
REJ_CMD 0 0 0 REJECT14 REJECT
REJ_CMD 0 0 1 REJECT15 REJECT
REJ_CMD 0 1 0 REJECT16 REJECT
REJ_CMD 0 1 1 REJECT16 REJECT
REJ_CMD 1 0 0 REJECT14 REJECT
REJ_CMD 1 0 1 REJECT15 REJECT
REJ_CMD 1 1 0 REJECT16 REJECT
REJ_CMD 1 1 1 REJECT16 REJECT
DISC_CMD 0 0 0 SH4 ADM
DISC_CMD 0 0 1 SH4 ADM
DISC_CMD 0 1 0 SH4 ADM
DISC_CMD 0 1 1 SH4 ADM
DISC_CMD 1 0 0 SH4 ADM
DISC_CMD 1 0 1 SH4 ADM
DISC_CMD 1 1 0 SH4 ADM
DISC_CMD 1 1 1 SH4 ADM
SABME_CMD 0 0 0 SH3 RESET_CHECK
SABME_CMD 0 0 1 SH3 RESET_CHECK
SABME_CMD 0 1 0 SH3 RESET_CHECK
SABME_CMD 0 1 1 SH3 RESET_CHECK
SABME_CMD 1 0 0 SH3 RESET_CHECK
SABME_CMD 1 0 1 SH3 RESET_CHECK
SABME_CMD 1 1 0 SH3 RESET_CHECK
SABME_CMD 1 1 1 SH3 RESET_CHECK
I_RSP 0 0 0 REJECT7 REJECT
I_RSP 0 0 1 REJECT8 REJECT
I_RSP 0 1 0 SH10 ERROR
I_RSP 0 1 1 REJECT7 REJECT
I_RSP 1 0 0 REJECT5 REJECT
I_RSP 1 0 1 REJECT5 REJECT
I_RSP 1 1 0 SH10 ERROR
I_RSP 1 1 1 REJECT5 REJECT
RR_RSP 0 0 0 REJECT10 REJECT
RR_RSP 0 0 1 REJECT10 REJECT
RR_RSP 0 1 0 SH10 ERROR
RR_RSP 0 1 1 REJECT10 REJECT
RR_RSP 1 0 0 REJECT10 REJECT
RR_RSP 1 0 1 REJECT10 REJECT
RR_RSP 1 1 0 SH10 ERROR
RR_RSP 1 1 1 REJECT10 REJECT
RNR_RSP 0 0 0 REJECT12 REJECT
RNR_RSP 0 0 1 REJECT12 REJECT
RNR_RSP 0 1 0 SH10 ERROR
RNR_RSP 0 1 1 REJECT12 REJECT
RNR_RSP 1 0 0 REJECT12 REJECT
RNR_RSP 1 0 1 REJECT12 REJECT
RNR_RSP 1 1 0 SH10 ERROR
RNR_RSP 1 1 1 REJECT12 REJECT
REJ_RSP 0 0 0 REJECT14 REJECT
REJ_RSP 0 0 1 REJECT15 REJECT
REJ_RSP 0 1 0 SH10 ERROR
REJ_RSP 0 1 1 REJECT14 REJECT
REJ_RSP 1 0 0 REJECT14 REJECT
REJ_RSP 1 0 1 REJECT15 REJECT
REJ_RSP 1 1 0 SH10 ERROR
REJ_RSP 1 1 1 REJECT14 REJECT
UA_RSP 0 0 0 SH9 ERROR
UA_RSP 0 0 1 SH9 ERROR
UA_RSP 0 1 0 SH9 ERROR
UA_RSP 0 1 1 SH9 ERROR
UA_RSP 1 0 0 SH9 ERROR
UA_RSP 1 0 1 SH9 ERROR
UA_RSP 1 1 0 SH9 ERROR
UA_RSP 1 1 1 SH9 ERROR
DM_RSP 0 0 0 SH6 ADM
DM_RSP 0 0 1 SH6 ADM
DM_RSP 0 1 0 SH6 ADM
DM_RSP 0 1 1 SH6 ADM
DM_RSP 1 0 0 SH6 ADM
DM_RSP 1 0 1 SH6 ADM
DM_RSP 1 1 0 SH6 ADM
DM_RSP 1 1 1 SH6 ADM
FRMR_RSP 0 0 0 SH5 RESET_WAIT
FRMR_RSP 0 0 1 SH5 RESET_WAIT
FRMR_RSP 0 1 0 SH5 RESET_WAIT
FRMR_RSP 0 1 1 SH5 RESET_WAIT
FRMR_RSP 1 0 0 SH5 RESET_WAIT
FRMR_RSP 1 0 1 SH5 RESET_WAIT
FRMR_RSP 1 1 0 SH5 RESET_WAIT
FRMR_RSP 1 1 1 SH5 RESET_WAIT
BAD_FRAME 0 0 0 SH7 ERROR
BAD_FRAME 0 0 1 SH7 ERROR
BAD_FRAME 0 1 0 SH7 ERROR
BAD_FRAME 0 1 1 SH7 ERROR
BAD_FRAME 1 0 0 SH7 ERROR
BAD_FRAME 1 0 1 SH7 ERROR
BAD_FRAME 1 1 0 SH7 ERROR
BAD_FRAME 1 1 1 SH7 ERROR
;
;112 entries in table, 8 modified by tredit4 SABME_CMD x x x SH3 RESET_CHECK
;112 entries in table, 8 modified by tredit4 DISC_CMD x x x SH4 ADM
;112 entries in table, 8 modified by tredit4 FRMR_RSP x x x SH5 RESET_WAIT
;112 entries in table, 8 modified by tredit4 DM_RSP x x x SH6 ADM
;112 entries in table, 8 modified by tredit4 BAD_FRAME x x x SH7 ERROR
;112 entries in table, 8 modified by tredit4 UA_RSP x x x SH9 ERROR
;112 entries in table, 8 modified by tredit4 anyrsp x 1 0 SH10 ERROR
;112 entries in table, 2 modified by tredit4 I_CMD 1 0 x REJECT5 REJECT
;112 entries in table, 2 modified by tredit4 I_RSP 1 0 x REJECT5 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP 1 1 1 REJECT5 REJECT
;112 entries in table, 2 modified by tredit4 I_CMD 1 1 x REJECT6 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP x 1 1 REJECT7 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP x 0 0 REJECT7 REJECT
;112 entries in table, 1 modified by tredit4 I_CMD x 0 0 REJECT7 REJECT
;112 entries in table, 1 modified by tredit4 I_RSP x 0 1 REJECT8 REJECT
;112 entries in table, 1 modified by tredit4 I_CMD x 0 1 REJECT8 REJECT
;112 entries in table, 2 modified by tredit4 I_CMD x 1 x REJECT9 REJECT
;112 entries in table, 4 modified by tredit4 RR_CMD x 0 x REJECT10 REJECT
;112 entries in table, 4 modified by tredit4 RR_RSP x 0 x REJECT10 REJECT
;112 entries in table, 2 modified by tredit4 RR_RSP x 1 1 REJECT10 REJECT
;112 entries in table, 4 modified by tredit4 RR_CMD x 1 x REJECT11 REJECT
;112 entries in table, 4 modified by tredit4 RNR_CMD x 0 x REJECT12 REJECT
;112 entries in table, 4 modified by tredit4 RNR_RSP x 0 x REJECT12 REJECT
;112 entries in table, 2 modified by tredit4 RNR_RSP x 1 1 REJECT12 REJECT
;112 entries in table, 4 modified by tredit4 RNR_CMD x 1 x REJECT13 REJECT
;112 entries in table, 2 modified by tredit4 REJ_CMD x 0 0 REJECT14 REJECT
;112 entries in table, 2 modified by tredit4 REJ_RSP x 0 0 REJECT14 REJECT
;112 entries in table, 2 modified by tredit4 REJ_RSP x 1 1 REJECT14 REJECT
;112 entries in table, 2 modified by tredit4 REJ_CMD x 0 1 REJECT15 REJECT
;112 entries in table, 2 modified by tredit4 REJ_RSP x 0 1 REJECT15 REJECT
;112 entries in table, 4 modified by tredit4 REJ_CMD x 1 x REJECT16 REJECT
;
TABLE AWAIT
;Transition table for the AWAIT state:
;
;frame type uexpect p bit p_flag
;received N(S) in frame
;
I_CMD 0 0 0 AWAIT6 AWAIT
I_CMD 0 0 1 AWAIT6 AWAIT
I_CMD 0 1 0 AWAIT7 AWAIT
I_CMD 0 1 1 AWAIT7 AWAIT
I_CMD 1 0 0 AWAIT3 AWAIT_REJECT
I_CMD 1 0 1 AWAIT3 AWAIT_REJECT
I_CMD 1 1 0 AWAIT4 AWAIT_REJECT
I_CMD 1 1 1 AWAIT4 AWAIT_REJECT
RR_CMD 0 0 0 AWAIT9 AWAIT
RR_CMD 0 0 1 AWAIT9 AWAIT
RR_CMD 0 1 0 AWAIT10 AWAIT
RR_CMD 0 1 1 AWAIT10 AWAIT
RR_CMD 1 0 0 AWAIT9 AWAIT
RR_CMD 1 0 1 AWAIT9 AWAIT
RR_CMD 1 1 0 AWAIT10 AWAIT
RR_CMD 1 1 1 AWAIT10 AWAIT
RNR_CMD 0 0 0 AWAIT12 AWAIT
RNR_CMD 0 0 1 AWAIT12 AWAIT
RNR_CMD 0 1 0 AWAIT13 AWAIT
RNR_CMD 0 1 1 AWAIT13 AWAIT
RNR_CMD 1 0 0 AWAIT12 AWAIT
RNR_CMD 1 0 1 AWAIT12 AWAIT
RNR_CMD 1 1 0 AWAIT13 AWAIT
RNR_CMD 1 1 1 AWAIT13 AWAIT
REJ_CMD 0 0 0 AWAIT9 AWAIT
REJ_CMD 0 0 1 AWAIT9 AWAIT
REJ_CMD 0 1 0 AWAIT10 AWAIT
REJ_CMD 0 1 1 AWAIT10 AWAIT
REJ_CMD 1 0 0 AWAIT9 AWAIT
REJ_CMD 1 0 1 AWAIT9 AWAIT
REJ_CMD 1 1 0 AWAIT10 AWAIT
REJ_CMD 1 1 1 AWAIT10 AWAIT
DISC_CMD 0 0 0 SH4 ADM
DISC_CMD 0 0 1 SH4 ADM
DISC_CMD 0 1 0 SH4 ADM
DISC_CMD 0 1 1 SH4 ADM
DISC_CMD 1 0 0 SH4 ADM
DISC_CMD 1 0 1 SH4 ADM
DISC_CMD 1 1 0 SH4 ADM
DISC_CMD 1 1 1 SH4 ADM
SABME_CMD 0 0 0 SH3 RESET_CHECK
SABME_CMD 0 0 1 SH3 RESET_CHECK
SABME_CMD 0 1 0 SH3 RESET_CHECK
SABME_CMD 0 1 1 SH3 RESET_CHECK
SABME_CMD 1 0 0 SH3 RESET_CHECK
SABME_CMD 1 0 1 SH3 RESET_CHECK
SABME_CMD 1 1 0 SH3 RESET_CHECK
SABME_CMD 1 1 1 SH3 RESET_CHECK
I_RSP 0 0 0 AWAIT6 AWAIT
I_RSP 0 0 1 AWAIT6 AWAIT
I_RSP 0 1 0 SH10 ERROR
I_RSP 0 1 1 AWAIT5 NORMAL
I_RSP 1 0 0 AWAIT3 AWAIT_REJECT
I_RSP 1 0 1 AWAIT3 AWAIT_REJECT
I_RSP 1 1 0 SH10 ERROR
I_RSP 1 1 1 AWAIT2 REJECT
RR_RSP 0 0 0 AWAIT9 AWAIT
RR_RSP 0 0 1 AWAIT9 AWAIT
RR_RSP 0 1 0 SH10 ERROR
RR_RSP 0 1 1 AWAIT8 AWAIT
RR_RSP 1 0 0 AWAIT9 AWAIT
RR_RSP 1 0 1 AWAIT9 AWAIT
RR_RSP 1 1 0 SH10 ERROR
RR_RSP 1 1 1 AWAIT8 AWAIT
RNR_RSP 0 0 0 AWAIT12 AWAIT
RNR_RSP 0 0 1 AWAIT12 AWAIT
RNR_RSP 0 1 0 SH10 ERROR
RNR_RSP 0 1 1 AWAIT11 AWAIT
RNR_RSP 1 0 0 AWAIT12 AWAIT
RNR_RSP 1 0 1 AWAIT12 AWAIT
RNR_RSP 1 1 0 SH10 ERROR
RNR_RSP 1 1 1 AWAIT11 AWAIT
REJ_RSP 0 0 0 AWAIT9 AWAIT
REJ_RSP 0 0 1 AWAIT9 AWAIT
REJ_RSP 0 1 0 SH10 ERROR
REJ_RSP 0 1 1 AWAIT8 AWAIT
REJ_RSP 1 0 0 AWAIT9 AWAIT
REJ_RSP 1 0 1 AWAIT9 AWAIT
REJ_RSP 1 1 0 SH10 ERROR
REJ_RSP 1 1 1 AWAIT8 AWAIT
UA_RSP 0 0 0 SH9 ERROR
UA_RSP 0 0 1 SH9 ERROR
UA_RSP 0 1 0 SH9 ERROR
UA_RSP 0 1 1 SH9 ERROR
UA_RSP 1 0 0 SH9 ERROR
UA_RSP 1 0 1 SH9 ERROR
UA_RSP 1 1 0 SH9 ERROR
UA_RSP 1 1 1 SH9 ERROR
DM_RSP 0 0 0 SH6 ADM
DM_RSP 0 0 1 SH6 ADM
DM_RSP 0 1 0 SH6 ADM
DM_RSP 0 1 1 SH6 ADM
DM_RSP 1 0 0 SH6 ADM
DM_RSP 1 0 1 SH6 ADM
DM_RSP 1 1 0 SH6 ADM
DM_RSP 1 1 1 SH6 ADM
FRMR_RSP 0 0 0 SH5 RESET_WAIT
FRMR_RSP 0 0 1 SH5 RESET_WAIT
FRMR_RSP 0 1 0 SH5 RESET_WAIT
FRMR_RSP 0 1 1 SH5 RESET_WAIT
FRMR_RSP 1 0 0 SH5 RESET_WAIT
FRMR_RSP 1 0 1 SH5 RESET_WAIT
FRMR_RSP 1 1 0 SH5 RESET_WAIT
FRMR_RSP 1 1 1 SH5 RESET_WAIT
BAD_FRAME 0 0 0 SH7 ERROR
BAD_FRAME 0 0 1 SH7 ERROR
BAD_FRAME 0 1 0 SH7 ERROR
BAD_FRAME 0 1 1 SH7 ERROR
BAD_FRAME 1 0 0 SH7 ERROR
BAD_FRAME 1 0 1 SH7 ERROR
BAD_FRAME 1 1 0 SH7 ERROR
BAD_FRAME 1 1 1 SH7 ERROR
;
;112 entries in table, 8 modified by tredit4 SABME_CMD x x x SH3 RESET_CHECK
;112 entries in table, 8 modified by tredit4 DISC_CMD x x x SH4 ADM
;112 entries in table, 8 modified by tredit4 FRMR_RSP x x x SH5 RESET_WAIT
;112 entries in table, 8 modified by tredit4 DM_RSP x x x SH6 ADM
;112 entries in table, 8 modified by tredit4 BAD_FRAME x x x SH7 ERROR
;112 entries in table, 8 modified by tredit4 UA_RSP x x x SH9 ERROR
;112 entries in table, 8 modified by tredit4 anyrsp x 1 0 SH10 ERROR
;112 entries in table, 1 modified by tredit4 I_RSP 1 1 x AWAIT2 REJECT
;112 entries in table, 2 modified by tredit4 I_CMD 1 0 x AWAIT3 AWAIT_REJECT
;112 entries in table, 2 modified by tredit4 I_RSP 1 0 x AWAIT3 AWAIT_REJECT
;112 entries in table, 2 modified by tredit4 I_CMD 1 1 x AWAIT4 AWAIT_REJECT
;112 entries in table, 1 modified by tredit4 I_RSP x 1 x AWAIT5 NORMAL
;112 entries in table, 2 modified by tredit4 I_RSP x 0 x AWAIT6 AWAIT
;112 entries in table, 2 modified by tredit4 I_CMD x 0 x AWAIT6 AWAIT
;112 entries in table, 2 modified by tredit4 I_CMD x 1 x AWAIT7 AWAIT
;112 entries in table, 2 modified by tredit4 RR_RSP x 1 x AWAIT8 AWAIT
;112 entries in table, 2 modified by tredit4 REJ_RSP x 1 x AWAIT8 AWAIT
;112 entries in table, 4 modified by tredit4 RR_CMD x 0 x AWAIT9 AWAIT
;112 entries in table, 4 modified by tredit4 RR_RSP x 0 x AWAIT9 AWAIT
;112 entries in table, 4 modified by tredit4 REJ_CMD x 0 x AWAIT9 AWAIT
;112 entries in table, 4 modified by tredit4 REJ_RSP x 0 x AWAIT9 AWAIT
;112 entries in table, 4 modified by tredit4 RR_CMD x 1 x AWAIT10 AWAIT
;112 entries in table, 4 modified by tredit4 REJ_CMD x 1 x AWAIT10 AWAIT
;112 entries in table, 2 modified by tredit4 RNR_RSP x 1 x AWAIT11 AWAIT
;112 entries in table, 4 modified by tredit4 RNR_CMD x 0 x AWAIT12 AWAIT
;112 entries in table, 4 modified by tredit4 RNR_RSP x 0 x AWAIT12 AWAIT
;112 entries in table, 4 modified by tredit4 RNR_CMD x 1 x AWAIT13 AWAIT
;
TABLE AWAIT_BUSY
;Transition table for the AWAIT_BUSY state:
;
;frame type uexpect p bit p_flag
;received N(S) in frame
;
I_CMD 0 0 0 AWAIT_BUSY8 AWAIT_BUSY
I_CMD 0 0 1 AWAIT_BUSY8 AWAIT_BUSY
I_CMD 0 1 0 AWAIT_BUSY9 AWAIT_BUSY
I_CMD 0 1 1 AWAIT_BUSY9 AWAIT_BUSY
I_CMD 1 0 0 AWAIT_BUSY5 AWAIT_BUSY
I_CMD 1 0 1 AWAIT_BUSY5 AWAIT_BUSY
I_CMD 1 1 0 AWAIT_BUSY6 AWAIT_BUSY
I_CMD 1 1 1 AWAIT_BUSY6 AWAIT_BUSY
RR_CMD 0 0 0 AWAIT_BUSY11 AWAIT_BUSY
RR_CMD 0 0 1 AWAIT_BUSY11 AWAIT_BUSY
RR_CMD 0 1 0 AWAIT_BUSY12 AWAIT_BUSY
RR_CMD 0 1 1 AWAIT_BUSY12 AWAIT_BUSY
RR_CMD 1 0 0 AWAIT_BUSY11 AWAIT_BUSY
RR_CMD 1 0 1 AWAIT_BUSY11 AWAIT_BUSY
RR_CMD 1 1 0 AWAIT_BUSY12 AWAIT_BUSY
RR_CMD 1 1 1 AWAIT_BUSY12 AWAIT_BUSY
RNR_CMD 0 0 0 AWAIT_BUSY14 AWAIT_BUSY
RNR_CMD 0 0 1 AWAIT_BUSY14 AWAIT_BUSY
RNR_CMD 0 1 0 AWAIT_BUSY15 AWAIT_BUSY
RNR_CMD 0 1 1 AWAIT_BUSY15 AWAIT_BUSY
RNR_CMD 1 0 0 AWAIT_BUSY14 AWAIT_BUSY
RNR_CMD 1 0 1 AWAIT_BUSY14 AWAIT_BUSY
RNR_CMD 1 1 0 AWAIT_BUSY15 AWAIT_BUSY
RNR_CMD 1 1 1 AWAIT_BUSY15 AWAIT_BUSY
REJ_CMD 0 0 0 AWAIT_BUSY11 AWAIT_BUSY
REJ_CMD 0 0 1 AWAIT_BUSY11 AWAIT_BUSY
REJ_CMD 0 1 0 AWAIT_BUSY12 AWAIT_BUSY
REJ_CMD 0 1 1 AWAIT_BUSY12 AWAIT_BUSY
REJ_CMD 1 0 0 AWAIT_BUSY11 AWAIT_BUSY
REJ_CMD 1 0 1 AWAIT_BUSY11 AWAIT_BUSY
REJ_CMD 1 1 0 AWAIT_BUSY12 AWAIT_BUSY
REJ_CMD 1 1 1 AWAIT_BUSY12 AWAIT_BUSY
DISC_CMD 0 0 0 SH4 ADM
DISC_CMD 0 0 1 SH4 ADM
DISC_CMD 0 1 0 SH4 ADM
DISC_CMD 0 1 1 SH4 ADM
DISC_CMD 1 0 0 SH4 ADM
DISC_CMD 1 0 1 SH4 ADM
DISC_CMD 1 1 0 SH4 ADM
DISC_CMD 1 1 1 SH4 ADM
SABME_CMD 0 0 0 SH3 RESET_CHECK
SABME_CMD 0 0 1 SH3 RESET_CHECK
SABME_CMD 0 1 0 SH3 RESET_CHECK
SABME_CMD 0 1 1 SH3 RESET_CHECK
SABME_CMD 1 0 0 SH3 RESET_CHECK
SABME_CMD 1 0 1 SH3 RESET_CHECK
SABME_CMD 1 1 0 SH3 RESET_CHECK
SABME_CMD 1 1 1 SH3 RESET_CHECK
I_RSP 0 0 0 AWAIT_BUSY8 AWAIT_BUSY
I_RSP 0 0 1 AWAIT_BUSY8 AWAIT_BUSY
I_RSP 0 1 0 SH10 ERROR
I_RSP 0 1 1 AWAIT_BUSY7 BUSY
I_RSP 1 0 0 AWAIT_BUSY5 AWAIT_BUSY
I_RSP 1 0 1 AWAIT_BUSY5 AWAIT_BUSY
I_RSP 1 1 0 SH10 ERROR
I_RSP 1 1 1 AWAIT_BUSY4 BUSY
RR_RSP 0 0 0 AWAIT_BUSY11 AWAIT_BUSY
RR_RSP 0 0 1 AWAIT_BUSY11 AWAIT_BUSY
RR_RSP 0 1 0 SH10 ERROR
RR_RSP 0 1 1 AWAIT_BUSY10 BUSY
RR_RSP 1 0 0 AWAIT_BUSY11 AWAIT_BUSY
RR_RSP 1 0 1 AWAIT_BUSY11 AWAIT_BUSY
RR_RSP 1 1 0 SH10 ERROR
RR_RSP 1 1 1 AWAIT_BUSY10 BUSY
RNR_RSP 0 0 0 AWAIT_BUSY14 AWAIT_BUSY
RNR_RSP 0 0 1 AWAIT_BUSY14 AWAIT_BUSY
RNR_RSP 0 1 0 SH10 ERROR
RNR_RSP 0 1 1 AWAIT_BUSY13 BUSY
RNR_RSP 1 0 0 AWAIT_BUSY14 AWAIT_BUSY
RNR_RSP 1 0 1 AWAIT_BUSY14 AWAIT_BUSY
RNR_RSP 1 1 0 SH10 ERROR
RNR_RSP 1 1 1 AWAIT_BUSY13 BUSY
REJ_RSP 0 0 0 AWAIT_BUSY11 AWAIT_BUSY
REJ_RSP 0 0 1 AWAIT_BUSY11 AWAIT_BUSY
REJ_RSP 0 1 0 SH10 ERROR
REJ_RSP 0 1 1 AWAIT_BUSY10 BUSY
REJ_RSP 1 0 0 AWAIT_BUSY11 AWAIT_BUSY
REJ_RSP 1 0 1 AWAIT_BUSY11 AWAIT_BUSY
REJ_RSP 1 1 0 SH10 ERROR
REJ_RSP 1 1 1 AWAIT_BUSY10 BUSY
UA_RSP 0 0 0 SH9 ERROR
UA_RSP 0 0 1 SH9 ERROR
UA_RSP 0 1 0 SH9 ERROR
UA_RSP 0 1 1 SH9 ERROR
UA_RSP 1 0 0 SH9 ERROR
UA_RSP 1 0 1 SH9 ERROR
UA_RSP 1 1 0 SH9 ERROR
UA_RSP 1 1 1 SH9 ERROR
DM_RSP 0 0 0 SH6 ADM
DM_RSP 0 0 1 SH6 ADM
DM_RSP 0 1 0 SH6 ADM
DM_RSP 0 1 1 SH6 ADM
DM_RSP 1 0 0 SH6 ADM
DM_RSP 1 0 1 SH6 ADM
DM_RSP 1 1 0 SH6 ADM
DM_RSP 1 1 1 SH6 ADM
FRMR_RSP 0 0 0 SH5 RESET_WAIT
FRMR_RSP 0 0 1 SH5 RESET_WAIT
FRMR_RSP 0 1 0 SH5 RESET_WAIT
FRMR_RSP 0 1 1 SH5 RESET_WAIT
FRMR_RSP 1 0 0 SH5 RESET_WAIT
FRMR_RSP 1 0 1 SH5 RESET_WAIT
FRMR_RSP 1 1 0 SH5 RESET_WAIT
FRMR_RSP 1 1 1 SH5 RESET_WAIT
BAD_FRAME 0 0 0 SH7 ERROR
BAD_FRAME 0 0 1 SH7 ERROR
BAD_FRAME 0 1 0 SH7 ERROR
BAD_FRAME 0 1 1 SH7 ERROR
BAD_FRAME 1 0 0 SH7 ERROR
BAD_FRAME 1 0 1 SH7 ERROR
BAD_FRAME 1 1 0 SH7 ERROR
BAD_FRAME 1 1 1 SH7 ERROR
;
;112 entries in table, 8 modified by tredit4 SABME_CMD x x x SH3 RESET_CHECK
;112 entries in table, 8 modified by tredit4 DISC_CMD x x x SH4 ADM
;112 entries in table, 8 modified by tredit4 FRMR_RSP x x x SH5 RESET_WAIT
;112 entries in table, 8 modified by tredit4 DM_RSP x x x SH6 ADM
;112 entries in table, 8 modified by tredit4 BAD_FRAME x x x SH7 ERROR
;112 entries in table, 8 modified by tredit4 UA_RSP x x x SH9 ERROR
;112 entries in table, 8 modified by tredit4 anyrsp x 1 0 SH10 ERROR
;112 entries in table, 1 modified by tredit4 I_RSP 1 1 x AWAIT_BUSY4 BUSY
;112 entries in table, 2 modified by tredit4 I_CMD 1 0 x AWAIT_BUSY5 AWAIT_BUSY
;112 entries in table, 2 modified by tredit4 I_RSP 1 0 x AWAIT_BUSY5 AWAIT_BUSY
;112 entries in table, 2 modified by tredit4 I_CMD 1 1 x AWAIT_BUSY6 AWAIT_BUSY
;112 entries in table, 1 modified by tredit4 I_RSP x 1 x AWAIT_BUSY7 BUSY
;112 entries in table, 2 modified by tredit4 I_RSP x 0 x AWAIT_BUSY8 AWAIT_BUSY
;112 entries in table, 2 modified by tredit4 I_CMD x 0 x AWAIT_BUSY8 AWAIT_BUSY
;112 entries in table, 2 modified by tredit4 I_CMD x 1 x AWAIT_BUSY9 AWAIT_BUSY
;112 entries in table, 2 modified by tredit4 RR_RSP x 1 x AWAIT_BUSY10 BUSY
;112 entries in table, 2 modified by tredit4 REJ_RSP x 1 x AWAIT_BUSY10 BUSY
;112 entries in table, 4 modified by tredit4 RR_CMD x 0 x AWAIT_BUSY11 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 RR_RSP x 0 x AWAIT_BUSY11 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 REJ_CMD x 0 x AWAIT_BUSY11 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 REJ_RSP x 0 x AWAIT_BUSY11 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 RR_CMD x 1 x AWAIT_BUSY12 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 REJ_CMD x 1 x AWAIT_BUSY12 AWAIT_BUSY
;112 entries in table, 2 modified by tredit4 RNR_RSP x 1 x AWAIT_BUSY13 BUSY
;112 entries in table, 4 modified by tredit4 RNR_CMD x 0 x AWAIT_BUSY14 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 RNR_RSP x 0 x AWAIT_BUSY14 AWAIT_BUSY
;112 entries in table, 4 modified by tredit4 RNR_CMD x 1 x AWAIT_BUSY15 AWAIT_BUSY
;
TABLE AWAIT_REJECT
;Transition table for the AWAIT_REJECT state:
;
;frame type uexpect p bit p_flag
;received N(S) in frame
;
I_CMD 0 0 0 AWAIT_REJECT5 AWAIT
I_CMD 0 0 1 AWAIT_REJECT5 AWAIT
I_CMD 0 1 0 AWAIT_REJECT6 AWAIT
I_CMD 0 1 1 AWAIT_REJECT6 AWAIT
I_CMD 1 0 0 AWAIT_REJECT2 AWAIT_REJECT
I_CMD 1 0 1 AWAIT_REJECT2 AWAIT_REJECT
I_CMD 1 1 0 AWAIT_REJECT3 AWAIT_REJECT
I_CMD 1 1 1 AWAIT_REJECT3 AWAIT_REJECT
RR_CMD 0 0 0 AWAIT_REJECT8 AWAIT_REJECT
RR_CMD 0 0 1 AWAIT_REJECT8 AWAIT_REJECT
RR_CMD 0 1 0 AWAIT_REJECT9 AWAIT_REJECT
RR_CMD 0 1 1 AWAIT_REJECT9 AWAIT_REJECT
RR_CMD 1 0 0 AWAIT_REJECT8 AWAIT_REJECT
RR_CMD 1 0 1 AWAIT_REJECT8 AWAIT_REJECT
RR_CMD 1 1 0 AWAIT_REJECT9 AWAIT_REJECT
RR_CMD 1 1 1 AWAIT_REJECT9 AWAIT_REJECT
RNR_CMD 0 0 0 AWAIT_REJECT11 AWAIT_REJECT
RNR_CMD 0 0 1 AWAIT_REJECT11 AWAIT_REJECT
RNR_CMD 0 1 0 AWAIT_REJECT12 AWAIT_REJECT
RNR_CMD 0 1 1 AWAIT_REJECT12 AWAIT_REJECT
RNR_CMD 1 0 0 AWAIT_REJECT11 AWAIT_REJECT
RNR_CMD 1 0 1 AWAIT_REJECT11 AWAIT_REJECT
RNR_CMD 1 1 0 AWAIT_REJECT12 AWAIT_REJECT
RNR_CMD 1 1 1 AWAIT_REJECT12 AWAIT_REJECT
REJ_CMD 0 0 0 AWAIT_REJECT8 AWAIT_REJECT
REJ_CMD 0 0 1 AWAIT_REJECT8 AWAIT_REJECT
REJ_CMD 0 1 0 AWAIT_REJECT9 AWAIT_REJECT
REJ_CMD 0 1 1 AWAIT_REJECT9 AWAIT_REJECT
REJ_CMD 1 0 0 AWAIT_REJECT8 AWAIT_REJECT
REJ_CMD 1 0 1 AWAIT_REJECT8 AWAIT_REJECT
REJ_CMD 1 1 0 AWAIT_REJECT9 AWAIT_REJECT
REJ_CMD 1 1 1 AWAIT_REJECT9 AWAIT_REJECT
DISC_CMD 0 0 0 SH4 ADM
DISC_CMD 0 0 1 SH4 ADM
DISC_CMD 0 1 0 SH4 ADM
DISC_CMD 0 1 1 SH4 ADM
DISC_CMD 1 0 0 SH4 ADM
DISC_CMD 1 0 1 SH4 ADM
DISC_CMD 1 1 0 SH4 ADM
DISC_CMD 1 1 1 SH4 ADM
SABME_CMD 0 0 0 SH3 RESET_CHECK
SABME_CMD 0 0 1 SH3 RESET_CHECK
SABME_CMD 0 1 0 SH3 RESET_CHECK
SABME_CMD 0 1 1 SH3 RESET_CHECK
SABME_CMD 1 0 0 SH3 RESET_CHECK
SABME_CMD 1 0 1 SH3 RESET_CHECK
SABME_CMD 1 1 0 SH3 RESET_CHECK
SABME_CMD 1 1 1 SH3 RESET_CHECK
I_RSP 0 0 0 AWAIT_REJECT5 AWAIT
I_RSP 0 0 1 AWAIT_REJECT5 AWAIT
I_RSP 0 1 0 SH10 ERROR
I_RSP 0 1 1 AWAIT_REJECT4 NORMAL
I_RSP 1 0 0 AWAIT_REJECT2 AWAIT_REJECT
I_RSP 1 0 1 AWAIT_REJECT2 AWAIT_REJECT
I_RSP 1 1 0 SH10 ERROR
I_RSP 1 1 1 AWAIT_REJECT4 NORMAL
RR_RSP 0 0 0 AWAIT_REJECT8 AWAIT_REJECT
RR_RSP 0 0 1 AWAIT_REJECT8 AWAIT_REJECT
RR_RSP 0 1 0 SH10 ERROR
RR_RSP 0 1 1 AWAIT_REJECT7 REJECT
RR_RSP 1 0 0 AWAIT_REJECT8 AWAIT_REJECT
RR_RSP 1 0 1 AWAIT_REJECT8 AWAIT_REJECT
RR_RSP 1 1 0 SH10 ERROR
RR_RSP 1 1 1 AWAIT_REJECT7 REJECT
RNR_RSP 0 0 0 AWAIT_REJECT11 AWAIT_REJECT
RNR_RSP 0 0 1 AWAIT_REJECT11 AWAIT_REJECT
RNR_RSP 0 1 0 SH10 ERROR
RNR_RSP 0 1 1 AWAIT_REJECT10 REJECT
RNR_RSP 1 0 0 AWAIT_REJECT11 AWAIT_REJECT
RNR_RSP 1 0 1 AWAIT_REJECT11 AWAIT_REJECT
RNR_RSP 1 1 0 SH10 ERROR
RNR_RSP 1 1 1 AWAIT_REJECT10 REJECT
REJ_RSP 0 0 0 AWAIT_REJECT8 AWAIT_REJECT
REJ_RSP 0 0 1 AWAIT_REJECT8 AWAIT_REJECT
REJ_RSP 0 1 0 SH10 ERROR
REJ_RSP 0 1 1 AWAIT_REJECT7 REJECT
REJ_RSP 1 0 0 AWAIT_REJECT8 AWAIT_REJECT
REJ_RSP 1 0 1 AWAIT_REJECT8 AWAIT_REJECT
REJ_RSP 1 1 0 SH10 ERROR
REJ_RSP 1 1 1 AWAIT_REJECT7 REJECT
UA_RSP 0 0 0 SH9 ERROR
UA_RSP 0 0 1 SH9 ERROR
UA_RSP 0 1 0 SH9 ERROR
UA_RSP 0 1 1 SH9 ERROR
UA_RSP 1 0 0 SH9 ERROR
UA_RSP 1 0 1 SH9 ERROR
UA_RSP 1 1 0 SH9 ERROR
UA_RSP 1 1 1 SH9 ERROR
DM_RSP 0 0 0 SH6 ADM
DM_RSP 0 0 1 SH6 ADM
DM_RSP 0 1 0 SH6 ADM
DM_RSP 0 1 1 SH6 ADM
DM_RSP 1 0 0 SH6 ADM
DM_RSP 1 0 1 SH6 ADM
DM_RSP 1 1 0 SH6 ADM
DM_RSP 1 1 1 SH6 ADM
FRMR_RSP 0 0 0 SH5 RESET_WAIT
FRMR_RSP 0 0 1 SH5 RESET_WAIT
FRMR_RSP 0 1 0 SH5 RESET_WAIT
FRMR_RSP 0 1 1 SH5 RESET_WAIT
FRMR_RSP 1 0 0 SH5 RESET_WAIT
FRMR_RSP 1 0 1 SH5 RESET_WAIT
FRMR_RSP 1 1 0 SH5 RESET_WAIT
FRMR_RSP 1 1 1 SH5 RESET_WAIT
BAD_FRAME 0 0 0 SH7 ERROR
BAD_FRAME 0 0 1 SH7 ERROR
BAD_FRAME 0 1 0 SH7 ERROR
BAD_FRAME 0 1 1 SH7 ERROR
BAD_FRAME 1 0 0 SH7 ERROR
BAD_FRAME 1 0 1 SH7 ERROR
BAD_FRAME 1 1 0 SH7 ERROR
BAD_FRAME 1 1 1 SH7 ERROR
;
;112 entries in table, 8 modified by tredit4 SABME_CMD x x x SH3 RESET_CHECK
;112 entries in table, 8 modified by tredit4 DISC_CMD x x x SH4 ADM
;112 entries in table, 8 modified by tredit4 FRMR_RSP x x x SH5 RESET_WAIT
;112 entries in table, 8 modified by tredit4 DM_RSP x x x SH6 ADM
;112 entries in table, 8 modified by tredit4 BAD_FRAME x x x SH7 ERROR
;112 entries in table, 8 modified by tredit4 UA_RSP x x x SH9 ERROR
;112 entries in table, 8 modified by tredit4 anyrsp x 1 0 SH10 ERROR
;112 entries in table, 2 modified by tredit4 I_CMD 1 0 x AWAIT_REJECT2 AWAIT_REJECT
;112 entries in table, 2 modified by tredit4 I_RSP 1 0 x AWAIT_REJECT2 AWAIT_REJECT
;112 entries in table, 2 modified by tredit4 I_CMD 1 1 x AWAIT_REJECT3 AWAIT_REJECT
;112 entries in table, 2 modified by tredit4 I_RSP x 1 x AWAIT_REJECT4 NORMAL
;112 entries in table, 2 modified by tredit4 I_RSP x 0 x AWAIT_REJECT5 AWAIT
;112 entries in table, 2 modified by tredit4 I_CMD x 0 x AWAIT_REJECT5 AWAIT
;112 entries in table, 2 modified by tredit4 I_CMD x 1 x AWAIT_REJECT6 AWAIT
;112 entries in table, 2 modified by tredit4 RR_RSP x 1 x AWAIT_REJECT7 REJECT
;112 entries in table, 2 modified by tredit4 REJ_RSP x 1 x AWAIT_REJECT7 REJECT
;112 entries in table, 0 modified by tredit4 I_RSP 1 1 x AWAIT_REJECT7 REJECT
;112 entries in table, 4 modified by tredit4 RR_CMD x 0 x AWAIT_REJECT8 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 RR_RSP x 0 x AWAIT_REJECT8 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 REJ_CMD x 0 x AWAIT_REJECT8 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 REJ_RSP x 0 x AWAIT_REJECT8 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 RR_CMD x 1 x AWAIT_REJECT9 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 REJ_CMD x 1 x AWAIT_REJECT9 AWAIT_REJECT
;112 entries in table, 2 modified by tredit4 RNR_RSP x 1 x AWAIT_REJECT10 REJECT
;112 entries in table, 4 modified by tredit4 RNR_CMD x 0 x AWAIT_REJECT11 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 RNR_RSP x 0 x AWAIT_REJECT11 AWAIT_REJECT
;112 entries in table, 4 modified by tredit4 RNR_CMD x 1 x AWAIT_REJECT12 AWAIT_REJECT
;112 entries in table, 0 modified by tredit4 RNR_CMD x 1 x AWAIT_REJECT15 AWAIT_BUSY
COMPILE timertr NOINDEX
TABLE XXX
;
;Transition table for expiring timers:
;
;llc state timer retry_c s_flag p_flag action newstate
; expired >= N2
;
ADM ACK_TIMER 0 0 0 NOP ADM
ADM ACK_TIMER 0 0 1 NOP ADM
ADM ACK_TIMER 0 1 0 NOP ADM
ADM ACK_TIMER 0 1 1 NOP ADM
ADM ACK_TIMER 1 0 0 NOP ADM
ADM ACK_TIMER 1 0 1 NOP ADM
ADM ACK_TIMER 1 1 0 NOP ADM
ADM ACK_TIMER 1 1 1 NOP ADM
;;
ADM P_TIMER 0 0 0 NOP ADM
ADM P_TIMER 0 0 1 NOP ADM
ADM P_TIMER 0 1 0 NOP ADM
ADM P_TIMER 0 1 1 NOP ADM
ADM P_TIMER 1 0 0 NOP ADM
ADM P_TIMER 1 0 1 NOP ADM
ADM P_TIMER 1 1 0 NOP ADM
ADM P_TIMER 1 1 1 NOP ADM
;;
ADM REJ_TIMER 0 0 0 NOP ADM
ADM REJ_TIMER 0 0 1 NOP ADM
ADM REJ_TIMER 0 1 0 NOP ADM
ADM REJ_TIMER 0 1 1 NOP ADM
ADM REJ_TIMER 1 0 0 NOP ADM
ADM REJ_TIMER 1 0 1 NOP ADM
ADM REJ_TIMER 1 1 0 NOP ADM
ADM REJ_TIMER 1 1 1 NOP ADM
;;
ADM BUSY_TIMER 0 0 0 NOP ADM
ADM BUSY_TIMER 0 0 1 NOP ADM
ADM BUSY_TIMER 0 1 0 NOP ADM
ADM BUSY_TIMER 0 1 1 NOP ADM
ADM BUSY_TIMER 1 0 0 NOP ADM
ADM BUSY_TIMER 1 0 1 NOP ADM
ADM BUSY_TIMER 1 1 0 NOP ADM
ADM BUSY_TIMER 1 1 1 NOP ADM
;;
;;
CONN ACK_TIMER 0 0 0 NOP CONN
CONN ACK_TIMER 0 0 1 NOP CONN
CONN ACK_TIMER 0 1 0 NOP CONN
CONN ACK_TIMER 0 1 1 NOP CONN
CONN ACK_TIMER 1 0 0 NOP CONN
CONN ACK_TIMER 1 0 1 NOP CONN
CONN ACK_TIMER 1 1 0 NOP CONN
CONN ACK_TIMER 1 1 1 NOP CONN
;;
CONN P_TIMER 0 0 0 NOP CONN
CONN P_TIMER 0 0 1 NOP CONN
CONN P_TIMER 0 1 0 NOP CONN
CONN P_TIMER 0 1 1 NOP CONN
CONN P_TIMER 1 0 0 NOP CONN
CONN P_TIMER 1 0 1 NOP CONN
CONN P_TIMER 1 1 0 NOP CONN
CONN P_TIMER 1 1 1 NOP CONN
;;
CONN REJ_TIMER 0 0 0 NOP CONN
CONN REJ_TIMER 0 0 1 NOP CONN
CONN REJ_TIMER 0 1 0 NOP CONN
CONN REJ_TIMER 0 1 1 NOP CONN
CONN REJ_TIMER 1 0 0 NOP CONN
CONN REJ_TIMER 1 0 1 NOP CONN
CONN REJ_TIMER 1 1 0 NOP CONN
CONN REJ_TIMER 1 1 1 NOP CONN
;;
CONN BUSY_TIMER 0 0 0 NOP CONN
CONN BUSY_TIMER 0 0 1 NOP CONN
CONN BUSY_TIMER 0 1 0 NOP CONN
CONN BUSY_TIMER 0 1 1 NOP CONN
CONN BUSY_TIMER 1 0 0 NOP CONN
CONN BUSY_TIMER 1 0 1 NOP CONN
CONN BUSY_TIMER 1 1 0 NOP CONN
CONN BUSY_TIMER 1 1 1 NOP CONN
;;
;;
RESET_WAIT ACK_TIMER 0 0 0 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 0 0 1 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 0 1 0 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 0 1 1 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 1 0 0 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 1 0 1 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 1 1 0 NOP RESET_WAIT
RESET_WAIT ACK_TIMER 1 1 1 NOP RESET_WAIT
;;
RESET_WAIT P_TIMER 0 0 0 NOP RESET_WAIT
RESET_WAIT P_TIMER 0 0 1 NOP RESET_WAIT
RESET_WAIT P_TIMER 0 1 0 NOP RESET_WAIT
RESET_WAIT P_TIMER 0 1 1 NOP RESET_WAIT
RESET_WAIT P_TIMER 1 0 0 NOP RESET_WAIT
RESET_WAIT P_TIMER 1 0 1 NOP RESET_WAIT
RESET_WAIT P_TIMER 1 1 0 NOP RESET_WAIT
RESET_WAIT P_TIMER 1 1 1 NOP RESET_WAIT
;;
RESET_WAIT REJ_TIMER 0 0 0 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 0 0 1 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 0 1 0 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 0 1 1 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 1 0 0 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 1 0 1 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 1 1 0 NOP RESET_WAIT
RESET_WAIT REJ_TIMER 1 1 1 NOP RESET_WAIT
;;
RESET_WAIT BUSY_TIMER 0 0 0 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 0 0 1 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 0 1 0 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 0 1 1 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 1 0 0 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 1 0 1 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 1 1 0 NOP RESET_WAIT
RESET_WAIT BUSY_TIMER 1 1 1 NOP RESET_WAIT
;;
;;
RESET_CHECK ACK_TIMER 0 0 0 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 0 0 1 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 0 1 0 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 0 1 1 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 1 0 0 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 1 0 1 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 1 1 0 NOP RESET_CHECK
RESET_CHECK ACK_TIMER 1 1 1 NOP RESET_CHECK
;;
RESET_CHECK P_TIMER 0 0 0 NOP RESET_CHECK
RESET_CHECK P_TIMER 0 0 1 NOP RESET_CHECK
RESET_CHECK P_TIMER 0 1 0 NOP RESET_CHECK
RESET_CHECK P_TIMER 0 1 1 NOP RESET_CHECK
RESET_CHECK P_TIMER 1 0 0 NOP RESET_CHECK
RESET_CHECK P_TIMER 1 0 1 NOP RESET_CHECK
RESET_CHECK P_TIMER 1 1 0 NOP RESET_CHECK
RESET_CHECK P_TIMER 1 1 1 NOP RESET_CHECK
;;
RESET_CHECK REJ_TIMER 0 0 0 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 0 0 1 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 0 1 0 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 0 1 1 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 1 0 0 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 1 0 1 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 1 1 0 NOP RESET_CHECK
RESET_CHECK REJ_TIMER 1 1 1 NOP RESET_CHECK
;;
RESET_CHECK BUSY_TIMER 0 0 0 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 0 0 1 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 0 1 0 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 0 1 1 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 1 0 0 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 1 0 1 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 1 1 0 NOP RESET_CHECK
RESET_CHECK BUSY_TIMER 1 1 1 NOP RESET_CHECK
;;
;;
;;
SETUP ACK_TIMER 0 0 0 SETUP7 SETUP
SETUP ACK_TIMER 0 0 1 SETUP7 SETUP
SETUP ACK_TIMER 0 1 0 SETUP3 NORMAL
SETUP ACK_TIMER 0 1 1 SETUP3 NORMAL
SETUP ACK_TIMER 1 0 0 SETUP8 ADM
SETUP ACK_TIMER 1 0 1 SETUP8 ADM
SETUP ACK_TIMER 1 1 0 SETUP3 NORMAL
SETUP ACK_TIMER 1 1 1 SETUP3 NORMAL
;;
SETUP P_TIMER 0 0 0 NOP SETUP
SETUP P_TIMER 0 0 1 NOP SETUP
SETUP P_TIMER 0 1 0 NOP SETUP
SETUP P_TIMER 0 1 1 NOP SETUP
SETUP P_TIMER 1 0 0 NOP SETUP
SETUP P_TIMER 1 0 1 NOP SETUP
SETUP P_TIMER 1 1 0 NOP SETUP
SETUP P_TIMER 1 1 1 NOP SETUP
;;
SETUP REJ_TIMER 0 0 0 NOP SETUP
SETUP REJ_TIMER 0 0 1 NOP SETUP
SETUP REJ_TIMER 0 1 0 NOP SETUP
SETUP REJ_TIMER 0 1 1 NOP SETUP
SETUP REJ_TIMER 1 0 0 NOP SETUP
SETUP REJ_TIMER 1 0 1 NOP SETUP
SETUP REJ_TIMER 1 1 0 NOP SETUP
SETUP REJ_TIMER 1 1 1 NOP SETUP
;;
SETUP BUSY_TIMER 0 0 0 NOP SETUP
SETUP BUSY_TIMER 0 0 1 NOP SETUP
SETUP BUSY_TIMER 0 1 0 NOP SETUP
SETUP BUSY_TIMER 0 1 1 NOP SETUP
SETUP BUSY_TIMER 1 0 0 NOP SETUP
SETUP BUSY_TIMER 1 0 1 NOP SETUP
SETUP BUSY_TIMER 1 1 0 NOP SETUP
SETUP BUSY_TIMER 1 1 1 NOP SETUP
;;
;;
;;
RESET ACK_TIMER 0 0 0 RESET7 RESET
RESET ACK_TIMER 0 0 1 RESET7 RESET
RESET ACK_TIMER 0 1 0 RESET3 NORMAL
RESET ACK_TIMER 0 1 1 RESET3 NORMAL
RESET ACK_TIMER 1 0 0 RESET8 ADM
RESET ACK_TIMER 1 0 1 RESET8 ADM
RESET ACK_TIMER 1 1 0 RESET3 NORMAL
RESET ACK_TIMER 1 1 1 RESET3 NORMAL
;;
RESET P_TIMER 0 0 0 NOP RESET
RESET P_TIMER 0 0 1 NOP RESET
RESET P_TIMER 0 1 0 NOP RESET
RESET P_TIMER 0 1 1 NOP RESET
RESET P_TIMER 1 0 0 NOP RESET
RESET P_TIMER 1 0 1 NOP RESET
RESET P_TIMER 1 1 0 NOP RESET
RESET P_TIMER 1 1 1 NOP RESET
;;
RESET REJ_TIMER 0 0 0 NOP RESET
RESET REJ_TIMER 0 0 1 NOP RESET
RESET REJ_TIMER 0 1 0 NOP RESET
RESET REJ_TIMER 0 1 1 NOP RESET
RESET REJ_TIMER 1 0 0 NOP RESET
RESET REJ_TIMER 1 0 1 NOP RESET
RESET REJ_TIMER 1 1 0 NOP RESET
RESET REJ_TIMER 1 1 1 NOP RESET
;;
RESET BUSY_TIMER 0 0 0 NOP RESET
RESET BUSY_TIMER 0 0 1 NOP RESET
RESET BUSY_TIMER 0 1 0 NOP RESET
RESET BUSY_TIMER 0 1 1 NOP RESET
RESET BUSY_TIMER 1 0 0 NOP RESET
RESET BUSY_TIMER 1 0 1 NOP RESET
RESET BUSY_TIMER 1 1 0 NOP RESET
RESET BUSY_TIMER 1 1 1 NOP RESET
;;
;;
D_CONN ACK_TIMER 0 0 0 D_CONN6 D_CONN
D_CONN ACK_TIMER 0 0 1 D_CONN6 D_CONN
D_CONN ACK_TIMER 0 1 0 D_CONN6 D_CONN
D_CONN ACK_TIMER 0 1 1 D_CONN6 D_CONN
D_CONN ACK_TIMER 1 0 0 D_CONN7 ADM
D_CONN ACK_TIMER 1 0 1 D_CONN7 ADM
D_CONN ACK_TIMER 1 1 0 D_CONN7 ADM
D_CONN ACK_TIMER 1 1 1 D_CONN7 ADM
;;
D_CONN P_TIMER 0 0 0 NOP D_CONN
D_CONN P_TIMER 0 0 1 NOP D_CONN
D_CONN P_TIMER 0 1 0 NOP D_CONN
D_CONN P_TIMER 0 1 1 NOP D_CONN
D_CONN P_TIMER 1 0 0 NOP D_CONN
D_CONN P_TIMER 1 0 1 NOP D_CONN
D_CONN P_TIMER 1 1 0 NOP D_CONN
D_CONN P_TIMER 1 1 1 NOP D_CONN
;;
D_CONN REJ_TIMER 0 0 0 NOP D_CONN
D_CONN REJ_TIMER 0 0 1 NOP D_CONN
D_CONN REJ_TIMER 0 1 0 NOP D_CONN
D_CONN REJ_TIMER 0 1 1 NOP D_CONN
D_CONN REJ_TIMER 1 0 0 NOP D_CONN
D_CONN REJ_TIMER 1 0 1 NOP D_CONN
D_CONN REJ_TIMER 1 1 0 NOP D_CONN
D_CONN REJ_TIMER 1 1 1 NOP D_CONN
;;
D_CONN BUSY_TIMER 0 0 0 NOP D_CONN
D_CONN BUSY_TIMER 0 0 1 NOP D_CONN
D_CONN BUSY_TIMER 0 1 0 NOP D_CONN
D_CONN BUSY_TIMER 0 1 1 NOP D_CONN
D_CONN BUSY_TIMER 1 0 0 NOP D_CONN
D_CONN BUSY_TIMER 1 0 1 NOP D_CONN
D_CONN BUSY_TIMER 1 1 0 NOP D_CONN
D_CONN BUSY_TIMER 1 1 1 NOP D_CONN
;;
;;
ERROR ACK_TIMER 0 0 0 ERR7 ERROR
ERROR ACK_TIMER 0 0 1 ERR7 ERROR
ERROR ACK_TIMER 0 1 0 ERR7 ERROR
ERROR ACK_TIMER 0 1 1 ERR7 ERROR
ERROR ACK_TIMER 1 0 0 ERR8 RESET_WAIT
ERROR ACK_TIMER 1 0 1 ERR8 RESET_WAIT
ERROR ACK_TIMER 1 1 0 ERR8 RESET_WAIT
ERROR ACK_TIMER 1 1 1 ERR8 RESET_WAIT
;;
ERROR P_TIMER 0 0 0 NOP ERROR
ERROR P_TIMER 0 0 1 NOP ERROR
ERROR P_TIMER 0 1 0 NOP ERROR
ERROR P_TIMER 0 1 1 NOP ERROR
ERROR P_TIMER 1 0 0 NOP ERROR
ERROR P_TIMER 1 0 1 NOP ERROR
ERROR P_TIMER 1 1 0 NOP ERROR
ERROR P_TIMER 1 1 1 NOP ERROR
;;
ERROR REJ_TIMER 0 0 0 NOP ERROR
ERROR REJ_TIMER 0 0 1 NOP ERROR
ERROR REJ_TIMER 0 1 0 NOP ERROR
ERROR REJ_TIMER 0 1 1 NOP ERROR
ERROR REJ_TIMER 1 0 0 NOP ERROR
ERROR REJ_TIMER 1 0 1 NOP ERROR
ERROR REJ_TIMER 1 1 0 NOP ERROR
ERROR REJ_TIMER 1 1 1 NOP ERROR
;;
ERROR BUSY_TIMER 0 0 0 NOP ERROR
ERROR BUSY_TIMER 0 0 1 NOP ERROR
ERROR BUSY_TIMER 0 1 0 NOP ERROR
ERROR BUSY_TIMER 0 1 1 NOP ERROR
ERROR BUSY_TIMER 1 0 0 NOP ERROR
ERROR BUSY_TIMER 1 0 1 NOP ERROR
ERROR BUSY_TIMER 1 1 0 NOP ERROR
ERROR BUSY_TIMER 1 1 1 NOP ERROR
;;
;;
NORMAL ACK_TIMER 0 0 0 NORMAL20 AWAIT
NORMAL ACK_TIMER 0 0 1 NOP NORMAL
NORMAL ACK_TIMER 0 1 0 NORMAL20 AWAIT
NORMAL ACK_TIMER 0 1 1 NOP NORMAL
NORMAL ACK_TIMER 1 0 0 SH11 RESET_WAIT
NORMAL ACK_TIMER 1 0 1 SH11 RESET_WAIT
NORMAL ACK_TIMER 1 1 0 SH11 RESET_WAIT
NORMAL ACK_TIMER 1 1 1 SH11 RESET_WAIT
;;
NORMAL P_TIMER 0 0 0 NORMAL19 NORMAL
NORMAL P_TIMER 0 0 1 NORMAL19 NORMAL
NORMAL P_TIMER 0 1 0 NORMAL19 NORMAL
NORMAL P_TIMER 0 1 1 NORMAL19 NORMAL
NORMAL P_TIMER 1 0 0 SH11 RESET_WAIT
NORMAL P_TIMER 1 0 1 SH11 RESET_WAIT
NORMAL P_TIMER 1 1 0 SH11 RESET_WAIT
NORMAL P_TIMER 1 1 1 SH11 RESET_WAIT
;;
NORMAL REJ_TIMER 0 0 0 NOP NORMAL
NORMAL REJ_TIMER 0 0 1 NOP NORMAL
NORMAL REJ_TIMER 0 1 0 NOP NORMAL
NORMAL REJ_TIMER 0 1 1 NOP NORMAL
NORMAL REJ_TIMER 1 0 0 SH11 RESET_WAIT
NORMAL REJ_TIMER 1 0 1 SH11 RESET_WAIT
NORMAL REJ_TIMER 1 1 0 SH11 RESET_WAIT
NORMAL REJ_TIMER 1 1 1 SH11 RESET_WAIT
;;
NORMAL BUSY_TIMER 0 0 0 NORMAL20 AWAIT
NORMAL BUSY_TIMER 0 0 1 NOP NORMAL
NORMAL BUSY_TIMER 0 1 0 NORMAL20 AWAIT
NORMAL BUSY_TIMER 0 1 1 NOP NORMAL
NORMAL BUSY_TIMER 1 0 0 SH11 RESET_WAIT
NORMAL BUSY_TIMER 1 0 1 SH11 RESET_WAIT
NORMAL BUSY_TIMER 1 1 0 SH11 RESET_WAIT
NORMAL BUSY_TIMER 1 1 1 SH11 RESET_WAIT
;;
;;
BUSY ACK_TIMER 0 0 0 BUSY24 AWAIT_BUSY
BUSY ACK_TIMER 0 0 1 NOP BUSY
BUSY ACK_TIMER 0 1 0 BUSY24 AWAIT_BUSY
BUSY ACK_TIMER 0 1 1 NOP BUSY
BUSY ACK_TIMER 1 0 0 SH11 RESET_WAIT
BUSY ACK_TIMER 1 0 1 SH11 RESET_WAIT
BUSY ACK_TIMER 1 1 0 SH11 RESET_WAIT
BUSY ACK_TIMER 1 1 1 SH11 RESET_WAIT
;;
BUSY P_TIMER 0 0 0 BUSY23 BUSY
BUSY P_TIMER 0 0 1 BUSY23 BUSY
BUSY P_TIMER 0 1 0 BUSY23 BUSY
BUSY P_TIMER 0 1 1 BUSY23 BUSY
BUSY P_TIMER 1 0 0 SH11 RESET_WAIT
BUSY P_TIMER 1 0 1 SH11 RESET_WAIT
BUSY P_TIMER 1 1 0 SH11 RESET_WAIT
BUSY P_TIMER 1 1 1 SH11 RESET_WAIT
;;
BUSY REJ_TIMER 0 0 0 BUSY25 BUSY
BUSY REJ_TIMER 0 0 1 BUSY26 BUSY
BUSY REJ_TIMER 0 1 0 BUSY25 BUSY
BUSY REJ_TIMER 0 1 1 BUSY26 BUSY
BUSY REJ_TIMER 1 0 0 SH11 RESET_WAIT
BUSY REJ_TIMER 1 0 1 SH11 RESET_WAIT
BUSY REJ_TIMER 1 1 0 SH11 RESET_WAIT
BUSY REJ_TIMER 1 1 1 SH11 RESET_WAIT
;;
BUSY BUSY_TIMER 0 0 0 NOP BUSY
BUSY BUSY_TIMER 0 0 1 NOP BUSY
BUSY BUSY_TIMER 0 1 0 NOP BUSY
BUSY BUSY_TIMER 0 1 1 NOP BUSY
BUSY BUSY_TIMER 1 0 0 SH11 RESET_WAIT
BUSY BUSY_TIMER 1 0 1 SH11 RESET_WAIT
BUSY BUSY_TIMER 1 1 0 SH11 RESET_WAIT
BUSY BUSY_TIMER 1 1 1 SH11 RESET_WAIT
;;
;;
REJECT ACK_TIMER 0 0 0 NOP REJECT
REJECT ACK_TIMER 0 0 1 NOP REJECT
REJECT ACK_TIMER 0 1 0 NOP REJECT
REJECT ACK_TIMER 0 1 1 NOP REJECT
REJECT ACK_TIMER 1 0 0 SH11 RESET_WAIT
REJECT ACK_TIMER 1 0 1 SH11 RESET_WAIT
REJECT ACK_TIMER 1 1 0 SH11 RESET_WAIT
REJECT ACK_TIMER 1 1 1 SH11 RESET_WAIT
;;
REJECT P_TIMER 0 0 0 NOP REJECT
REJECT P_TIMER 0 0 1 NOP REJECT
REJECT P_TIMER 0 1 0 NOP REJECT
REJECT P_TIMER 0 1 1 NOP REJECT
REJECT P_TIMER 1 0 0 SH11 RESET_WAIT
REJECT P_TIMER 1 0 1 SH11 RESET_WAIT
REJECT P_TIMER 1 1 0 SH11 RESET_WAIT
REJECT P_TIMER 1 1 1 SH11 RESET_WAIT
;;
REJECT REJ_TIMER 0 0 0 NOP REJECT
REJECT REJ_TIMER 0 0 1 NOP REJECT
REJECT REJ_TIMER 0 1 0 NOP REJECT
REJECT REJ_TIMER 0 1 1 NOP REJECT
REJECT REJ_TIMER 1 0 0 SH11 RESET_WAIT
REJECT REJ_TIMER 1 0 1 SH11 RESET_WAIT
REJECT REJ_TIMER 1 1 0 SH11 RESET_WAIT
REJECT REJ_TIMER 1 1 1 SH11 RESET_WAIT
;;
REJECT BUSY_TIMER 0 0 0 NOP REJECT
REJECT BUSY_TIMER 0 0 1 NOP REJECT
REJECT BUSY_TIMER 0 1 0 NOP REJECT
REJECT BUSY_TIMER 0 1 1 NOP REJECT
REJECT BUSY_TIMER 1 0 0 SH11 RESET_WAIT
REJECT BUSY_TIMER 1 0 1 SH11 RESET_WAIT
REJECT BUSY_TIMER 1 1 0 SH11 RESET_WAIT
REJECT BUSY_TIMER 1 1 1 SH11 RESET_WAIT
;;
;;
AWAIT ACK_TIMER 0 0 0 NOP AWAIT
AWAIT ACK_TIMER 0 0 1 NOP AWAIT
AWAIT ACK_TIMER 0 1 0 NOP AWAIT
AWAIT ACK_TIMER 0 1 1 NOP AWAIT
AWAIT ACK_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT ACK_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT ACK_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT ACK_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT P_TIMER 0 0 0 NOP AWAIT
AWAIT P_TIMER 0 0 1 NOP AWAIT
AWAIT P_TIMER 0 1 0 NOP AWAIT
AWAIT P_TIMER 0 1 1 NOP AWAIT
AWAIT P_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT P_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT P_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT P_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT REJ_TIMER 0 0 0 NOP AWAIT
AWAIT REJ_TIMER 0 0 1 NOP AWAIT
AWAIT REJ_TIMER 0 1 0 NOP AWAIT
AWAIT REJ_TIMER 0 1 1 NOP AWAIT
AWAIT REJ_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT REJ_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT REJ_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT REJ_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT BUSY_TIMER 0 0 0 NOP AWAIT
AWAIT BUSY_TIMER 0 0 1 NOP AWAIT
AWAIT BUSY_TIMER 0 1 0 NOP AWAIT
AWAIT BUSY_TIMER 0 1 1 NOP AWAIT
AWAIT BUSY_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT BUSY_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT BUSY_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT BUSY_TIMER 1 1 1 SH11 RESET_WAIT
;;
;;
AWAIT_BUSY ACK_TIMER 0 0 0 NOP AWAIT_BUSY
AWAIT_BUSY ACK_TIMER 0 0 1 NOP AWAIT_BUSY
AWAIT_BUSY ACK_TIMER 0 1 0 NOP AWAIT_BUSY
AWAIT_BUSY ACK_TIMER 0 1 1 NOP AWAIT_BUSY
AWAIT_BUSY ACK_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_BUSY ACK_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_BUSY ACK_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_BUSY ACK_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT_BUSY P_TIMER 0 0 0 NOP AWAIT_BUSY
AWAIT_BUSY P_TIMER 0 0 1 NOP AWAIT_BUSY
AWAIT_BUSY P_TIMER 0 1 0 NOP AWAIT_BUSY
AWAIT_BUSY P_TIMER 0 1 1 NOP AWAIT_BUSY
AWAIT_BUSY P_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_BUSY P_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_BUSY P_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_BUSY P_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT_BUSY REJ_TIMER 0 0 0 NOP AWAIT_BUSY
AWAIT_BUSY REJ_TIMER 0 0 1 NOP AWAIT_BUSY
AWAIT_BUSY REJ_TIMER 0 1 0 NOP AWAIT_BUSY
AWAIT_BUSY REJ_TIMER 0 1 1 NOP AWAIT_BUSY
AWAIT_BUSY REJ_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_BUSY REJ_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_BUSY REJ_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_BUSY REJ_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT_BUSY BUSY_TIMER 0 0 0 NOP AWAIT_BUSY
AWAIT_BUSY BUSY_TIMER 0 0 1 NOP AWAIT_BUSY
AWAIT_BUSY BUSY_TIMER 0 1 0 NOP AWAIT_BUSY
AWAIT_BUSY BUSY_TIMER 0 1 1 NOP AWAIT_BUSY
AWAIT_BUSY BUSY_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_BUSY BUSY_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_BUSY BUSY_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_BUSY BUSY_TIMER 1 1 1 SH11 RESET_WAIT
;;
;;
AWAIT_REJECT ACK_TIMER 0 0 0 NOP AWAIT_REJECT
AWAIT_REJECT ACK_TIMER 0 0 1 NOP AWAIT_REJECT
AWAIT_REJECT ACK_TIMER 0 1 0 NOP AWAIT_REJECT
AWAIT_REJECT ACK_TIMER 0 1 1 NOP AWAIT_REJECT
AWAIT_REJECT ACK_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_REJECT ACK_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_REJECT ACK_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_REJECT ACK_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT_REJECT P_TIMER 0 0 0 NOP AWAIT_REJECT
AWAIT_REJECT P_TIMER 0 0 1 NOP AWAIT_REJECT
AWAIT_REJECT P_TIMER 0 1 0 NOP AWAIT_REJECT
AWAIT_REJECT P_TIMER 0 1 1 NOP AWAIT_REJECT
AWAIT_REJECT P_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_REJECT P_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_REJECT P_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_REJECT P_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT_REJECT REJ_TIMER 0 0 0 NOP AWAIT_REJECT
AWAIT_REJECT REJ_TIMER 0 0 1 NOP AWAIT_REJECT
AWAIT_REJECT REJ_TIMER 0 1 0 NOP AWAIT_REJECT
AWAIT_REJECT REJ_TIMER 0 1 1 NOP AWAIT_REJECT
AWAIT_REJECT REJ_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_REJECT REJ_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_REJECT REJ_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_REJECT REJ_TIMER 1 1 1 SH11 RESET_WAIT
;;
AWAIT_REJECT BUSY_TIMER 0 0 0 NOP AWAIT_REJECT
AWAIT_REJECT BUSY_TIMER 0 0 1 NOP AWAIT_REJECT
AWAIT_REJECT BUSY_TIMER 0 1 0 NOP AWAIT_REJECT
AWAIT_REJECT BUSY_TIMER 0 1 1 NOP AWAIT_REJECT
AWAIT_REJECT BUSY_TIMER 1 0 0 SH11 RESET_WAIT
AWAIT_REJECT BUSY_TIMER 1 0 1 SH11 RESET_WAIT
AWAIT_REJECT BUSY_TIMER 1 1 0 SH11 RESET_WAIT
AWAIT_REJECT BUSY_TIMER 1 1 1 SH11 RESET_WAIT
;;
...@@ -91,9 +91,9 @@ static int __init vlan_proto_init(void) ...@@ -91,9 +91,9 @@ static int __init vlan_proto_init(void)
/* proc file system initialization */ /* proc file system initialization */
err = vlan_proc_init(); err = vlan_proc_init();
if (err < 0) { if (err < 0) {
printk(KERN_ERR __FUNCTION__ printk(KERN_ERR
"%s: can't create entry in proc filesystem!\n", "%s %s: can't create entry in proc filesystem!\n",
VLAN_NAME); __FUNCTION__, VLAN_NAME);
return 1; return 1;
} }
...@@ -203,7 +203,7 @@ static int unregister_vlan_dev(struct net_device *real_dev, ...@@ -203,7 +203,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
int i, ret; int i, ret;
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": VID: %i\n", vlan_id); printk(VLAN_DBG "%s: VID: %i\n", __FUNCTION__, vlan_id);
#endif #endif
/* sanity check */ /* sanity check */
...@@ -289,16 +289,16 @@ static int unregister_vlan_device(const char *vlan_IF_name) ...@@ -289,16 +289,16 @@ static int unregister_vlan_device(const char *vlan_IF_name)
if (ret == 1) if (ret == 1)
ret = 0; ret = 0;
} else { } else {
printk(VLAN_ERR __FUNCTION__ printk(VLAN_ERR
": ERROR: Tried to remove a non-vlan device " "%s: ERROR: Tried to remove a non-vlan device "
"with VLAN code, name: %s priv_flags: %hX\n", "with VLAN code, name: %s priv_flags: %hX\n",
dev->name, dev->priv_flags); __FUNCTION__, dev->name, dev->priv_flags);
dev_put(dev); dev_put(dev);
ret = -EPERM; ret = -EPERM;
} }
} else { } else {
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": WARNING: Could not find dev.\n"); printk(VLAN_DBG "%s: WARNING: Could not find dev.\n", __FUNCTION__);
#endif #endif
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -320,8 +320,8 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, ...@@ -320,8 +320,8 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
int r; int r;
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": if_name -:%s:- vid: %i\n", printk(VLAN_DBG "%s: if_name -:%s:- vid: %i\n",
eth_IF_name, VLAN_ID); __FUNCTION__, eth_IF_name, VLAN_ID);
#endif #endif
if (VLAN_ID >= VLAN_VID_MASK) if (VLAN_ID >= VLAN_VID_MASK)
...@@ -333,24 +333,24 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, ...@@ -333,24 +333,24 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
goto out_ret_null; goto out_ret_null;
if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
printk(VLAN_DBG __FUNCTION__ ": VLANs not supported on %s.\n", printk(VLAN_DBG "%s: VLANs not supported on %s.\n",
real_dev->name); __FUNCTION__, real_dev->name);
goto out_put_dev; goto out_put_dev;
} }
if ((real_dev->features & NETIF_F_HW_VLAN_RX) && if ((real_dev->features & NETIF_F_HW_VLAN_RX) &&
(real_dev->vlan_rx_register == NULL || (real_dev->vlan_rx_register == NULL ||
real_dev->vlan_rx_kill_vid == NULL)) { real_dev->vlan_rx_kill_vid == NULL)) {
printk(VLAN_DBG __FUNCTION__ ": Device %s has buggy VLAN hw accel.\n", printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
real_dev->name); __FUNCTION__, real_dev->name);
goto out_put_dev; goto out_put_dev;
} }
if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
(real_dev->vlan_rx_add_vid == NULL || (real_dev->vlan_rx_add_vid == NULL ||
real_dev->vlan_rx_kill_vid == NULL)) { real_dev->vlan_rx_kill_vid == NULL)) {
printk(VLAN_DBG __FUNCTION__ ": Device %s has buggy VLAN hw accel.\n", printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
real_dev->name); __FUNCTION__, real_dev->name);
goto out_put_dev; goto out_put_dev;
} }
...@@ -371,7 +371,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name, ...@@ -371,7 +371,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
if (r) { if (r) {
/* was already registered. */ /* was already registered. */
printk(VLAN_DBG __FUNCTION__ ": ALREADY had VLAN registered\n"); printk(VLAN_DBG "%s: ALREADY had VLAN registered\n", __FUNCTION__);
goto out_unlock; goto out_unlock;
} }
...@@ -665,7 +665,7 @@ int vlan_ioctl_handler(unsigned long arg) ...@@ -665,7 +665,7 @@ int vlan_ioctl_handler(unsigned long arg)
args.u.device2[23] = 0; args.u.device2[23] = 0;
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": args.cmd: %x\n", args.cmd); printk(VLAN_DBG "%s: args.cmd: %x\n", __FUNCTION__, args.cmd);
#endif #endif
switch (args.cmd) { switch (args.cmd) {
...@@ -728,8 +728,8 @@ int vlan_ioctl_handler(unsigned long arg) ...@@ -728,8 +728,8 @@ int vlan_ioctl_handler(unsigned long arg)
default: default:
/* pass on to underlying device instead?? */ /* pass on to underlying device instead?? */
printk(VLAN_DBG __FUNCTION__ ": Unknown VLAN CMD: %x \n", printk(VLAN_DBG "%s: Unknown VLAN CMD: %x \n",
args.cmd); __FUNCTION__, args.cmd);
return -EINVAL; return -EINVAL;
}; };
......
...@@ -125,8 +125,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, ...@@ -125,8 +125,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
vid = (vlan_TCI & VLAN_VID_MASK); vid = (vlan_TCI & VLAN_VID_MASK);
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": skb: %p vlan_id: %hx\n", printk(VLAN_DBG "%s: skb: %p vlan_id: %hx\n",
skb, vid); __FUNCTION__, skb, vid);
#endif #endif
/* Ok, we will find the correct VLAN device, strip the header, /* Ok, we will find the correct VLAN device, strip the header,
...@@ -146,8 +146,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, ...@@ -146,8 +146,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
spin_unlock_bh(&vlan_group_lock); spin_unlock_bh(&vlan_group_lock);
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": ERROR: No net_device for VID: %i on dev: %s [%i]\n", printk(VLAN_DBG "%s: ERROR: No net_device for VID: %i on dev: %s [%i]\n",
(unsigned int)(vid), dev->name, dev->ifindex); __FUNCTION__, (unsigned int)(vid), dev->name, dev->ifindex);
#endif #endif
kfree_skb(skb); kfree_skb(skb);
return -1; return -1;
...@@ -170,8 +170,10 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, ...@@ -170,8 +170,10 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
spin_unlock_bh(&vlan_group_lock); spin_unlock_bh(&vlan_group_lock);
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": dropping skb: %p because came in on wrong device, dev: %s real_dev: %s, skb_dev: %s\n", printk(VLAN_DBG "%s: dropping skb: %p because came in on wrong device, dev: %s real_dev: %s, skb_dev: %s\n",
skb, dev->name, VLAN_DEV_INFO(skb->dev)->real_dev->name, skb->dev->name); __FUNCTION__ skb, dev->name,
VLAN_DEV_INFO(skb->dev)->real_dev->name,
skb->dev->name);
#endif #endif
kfree_skb(skb); kfree_skb(skb);
stats->rx_errors++; stats->rx_errors++;
...@@ -184,8 +186,9 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, ...@@ -184,8 +186,9 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI)); skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI));
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": priority: %lu for TCI: %hu (hbo)\n", printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n",
(unsigned long)(skb->priority), ntohs(vhdr->h_vlan_TCI)); __FUNCTION__, (unsigned long)(skb->priority),
ntohs(vhdr->h_vlan_TCI));
#endif #endif
/* The ethernet driver already did the pkt_type calculations /* The ethernet driver already did the pkt_type calculations
...@@ -331,8 +334,8 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, ...@@ -331,8 +334,8 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
struct net_device *vdev = dev; /* save this for the bottom of the method */ struct net_device *vdev = dev; /* save this for the bottom of the method */
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": skb: %p type: %hx len: %x vlan_id: %hx, daddr: %p\n", printk(VLAN_DBG "%s: skb: %p type: %hx len: %x vlan_id: %hx, daddr: %p\n",
skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr); __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr);
#endif #endif
/* build vlan header only if re_order_header flag is NOT set. This /* build vlan header only if re_order_header flag is NOT set. This
...@@ -402,7 +405,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, ...@@ -402,7 +405,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
} }
VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++; VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++;
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": %s: had to grow skb.\n", vdev->name); printk(VLAN_DBG "%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name);
#endif #endif
} }
...@@ -445,8 +448,8 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -445,8 +448,8 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++; VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++;
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": proto to encap: 0x%hx (hbo)\n", printk(VLAN_DBG "%s: proto to encap: 0x%hx (hbo)\n",
htons(veth->h_vlan_proto)); __FUNCTION__, htons(veth->h_vlan_proto));
#endif #endif
if (skb_headroom(skb) < VLAN_HLEN) { if (skb_headroom(skb) < VLAN_HLEN) {
...@@ -455,14 +458,14 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -455,14 +458,14 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
kfree_skb(sk_tmp); kfree_skb(sk_tmp);
if (skb == NULL) { if (skb == NULL) {
stats->tx_dropped++; stats->tx_dropped++;
return -ENOMEM; return 0;
} }
VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++; VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++;
} else { } else {
if (!(skb = skb_unshare(skb, GFP_ATOMIC))) { if (!(skb = skb_unshare(skb, GFP_ATOMIC))) {
printk(KERN_ERR "vlan: failed to unshare skbuff\n"); printk(KERN_ERR "vlan: failed to unshare skbuff\n");
stats->tx_dropped++; stats->tx_dropped++;
return -ENOMEM; return 0;
} }
} }
veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
...@@ -489,8 +492,8 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -489,8 +492,8 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
skb->dev = VLAN_DEV_INFO(dev)->real_dev; skb->dev = VLAN_DEV_INFO(dev)->real_dev;
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG __FUNCTION__ ": about to send skb: %p to dev: %s\n", printk(VLAN_DBG "%s: about to send skb: %p to dev: %s\n",
skb, skb->dev->name); __FUNCTION__, skb, skb->dev->name);
printk(VLAN_DBG " %2hx.%2hx.%2hx.%2xh.%2hx.%2hx %2hx.%2hx.%2hx.%2hx.%2hx.%2hx %4hx %4hx %4hx\n", printk(VLAN_DBG " %2hx.%2hx.%2hx.%2xh.%2hx.%2hx %2hx.%2hx.%2hx.%2hx.%2hx.%2hx %4hx %4hx %4hx\n",
veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], veth->h_dest[3], veth->h_dest[4], veth->h_dest[5], veth->h_dest[0], veth->h_dest[1], veth->h_dest[2], veth->h_dest[3], veth->h_dest[4], veth->h_dest[5],
veth->h_source[0], veth->h_source[1], veth->h_source[2], veth->h_source[3], veth->h_source[4], veth->h_source[5], veth->h_source[0], veth->h_source[1], veth->h_source[2], veth->h_source[3], veth->h_source[4], veth->h_source[5],
...@@ -609,19 +612,20 @@ int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val) ...@@ -609,19 +612,20 @@ int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val)
dev_put(dev); dev_put(dev);
return 0; return 0;
} else { } else {
printk(KERN_ERR __FUNCTION__ ": flag %i is not valid.\n", printk(KERN_ERR "%s: flag %i is not valid.\n",
(int)(flag)); __FUNCTION__, (int)(flag));
dev_put(dev); dev_put(dev);
return -EINVAL; return -EINVAL;
} }
} else { } else {
printk(KERN_ERR __FUNCTION__ printk(KERN_ERR
": %s is not a vlan device, priv_flags: %hX.\n", "%s: %s is not a vlan device, priv_flags: %hX.\n",
dev->name, dev->priv_flags); __FUNCTION__, dev->name, dev->priv_flags);
dev_put(dev); dev_put(dev);
} }
} else { } else {
printk(KERN_ERR __FUNCTION__ ": Could not find device: %s\n", dev_name); printk(KERN_ERR "%s: Could not find device: %s\n",
__FUNCTION__, dev_name);
} }
return -EINVAL; return -EINVAL;
......
...@@ -187,14 +187,14 @@ int vlan_proc_add_dev (struct net_device *vlandev) ...@@ -187,14 +187,14 @@ int vlan_proc_add_dev (struct net_device *vlandev)
int vlan_proc_rem_dev(struct net_device *vlandev) int vlan_proc_rem_dev(struct net_device *vlandev)
{ {
if (!vlandev) { if (!vlandev) {
printk(VLAN_ERR __FUNCTION__ ": invalid argument: %p\n", printk(VLAN_ERR "%s: invalid argument: %p\n",
vlandev); __FUNCTION__, vlandev);
return -EINVAL; return -EINVAL;
} }
if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) { if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
printk(VLAN_DBG __FUNCTION__ ": invalid argument, device: %s is not a VLAN device, priv_flags: 0x%4hX.\n", printk(VLAN_DBG "%s: invalid argument, device: %s is not a VLAN device, priv_flags: 0x%4hX.\n",
vlandev->name, vlandev->priv_flags); __FUNCTION__, vlandev->name, vlandev->priv_flags);
return -EINVAL; return -EINVAL;
} }
......
...@@ -266,8 +266,13 @@ CONFIG_LAPB ...@@ -266,8 +266,13 @@ CONFIG_LAPB
module will be called lapb.o. If unsure, say N. module will be called lapb.o. If unsure, say N.
CONFIG_LLC CONFIG_LLC
This is a Logical Link Layer protocol used for X.25 connections over This is a Logical Link Layer protocol used for Appletalk, IPX and in
Ethernet, using ordinary Ethernet cards. the future by NetBEUI and by the linux-sna project. It originally
came from Procom Inc. that released the code for 2.0.36 and was
ported to 2.{4,5}. Select this if you want to have support for
those protocols or if you want to have the sockets interface for
LLC.
CONFIG_NET_DIVERT CONFIG_NET_DIVERT
The Frame Diverter allows you to divert packets from the The Frame Diverter allows you to divert packets from the
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE)
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/bitops.h> #include <asm/bitops.h>
...@@ -84,7 +83,7 @@ struct aarp_entry { ...@@ -84,7 +83,7 @@ struct aarp_entry {
struct sk_buff_head packet_queue; struct sk_buff_head packet_queue;
int status; int status;
unsigned long expires_at; unsigned long expires_at;
struct at_addr target_addr; struct atalk_addr target_addr;
struct net_device *dev; struct net_device *dev;
char hwaddr[6]; char hwaddr[6];
unsigned short xmit_count; unsigned short xmit_count;
...@@ -122,14 +121,13 @@ static void __aarp_expire(struct aarp_entry *a) ...@@ -122,14 +121,13 @@ static void __aarp_expire(struct aarp_entry *a)
static void __aarp_send_query(struct aarp_entry *a) static void __aarp_send_query(struct aarp_entry *a)
{ {
static char aarp_eth_multicast[ETH_ALEN] = static unsigned char aarp_eth_multicast[ETH_ALEN] =
{ 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF }; { 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF };
struct net_device *dev = a->dev; struct net_device *dev = a->dev;
int len = dev->hard_header_len + sizeof(struct elapaarp) +
aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
struct at_addr *sat = atalk_find_dev_addr(dev);
struct elapaarp *eah; struct elapaarp *eah;
int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
struct atalk_addr *sat = atalk_find_dev_addr(dev);
if (!skb) if (!skb)
return; return;
...@@ -141,30 +139,29 @@ static void __aarp_send_query(struct aarp_entry *a) ...@@ -141,30 +139,29 @@ static void __aarp_send_query(struct aarp_entry *a)
/* Set up the buffer */ /* Set up the buffer */
skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
eah = (struct elapaarp *)skb_put(skb, skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah));
sizeof(struct elapaarp)); skb->protocol = htons(ETH_P_ATALK);
skb->protocol = htons(ETH_P_ATALK); skb->dev = dev;
skb->nh.raw = skb->h.raw = (void *) eah; eah = aarp_hdr(skb);
skb->dev = dev;
/* Set up the ARP */ /* Set up the ARP */
eah->hw_type = htons(AARP_HW_TYPE_ETHERNET); eah->hw_type = htons(AARP_HW_TYPE_ETHERNET);
eah->pa_type = htons(ETH_P_ATALK); eah->pa_type = htons(ETH_P_ATALK);
eah->hw_len = ETH_ALEN; eah->hw_len = ETH_ALEN;
eah->pa_len = AARP_PA_ALEN; eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_REQUEST); eah->function = htons(AARP_REQUEST);
memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN); memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
eah->pa_src_zero= 0; eah->pa_src_zero = 0;
eah->pa_src_net = sat->s_net; eah->pa_src_net = sat->s_net;
eah->pa_src_node= sat->s_node; eah->pa_src_node = sat->s_node;
memset(eah->hw_dst, '\0', ETH_ALEN); memset(eah->hw_dst, '\0', ETH_ALEN);
eah->pa_dst_zero= 0; eah->pa_dst_zero = 0;
eah->pa_dst_net = a->target_addr.s_net; eah->pa_dst_net = a->target_addr.s_net;
eah->pa_dst_node= a->target_addr.s_node; eah->pa_dst_node = a->target_addr.s_node;
/* Add ELAP headers and set target to the AARP multicast */ /* Add ELAP headers and set target to the AARP multicast */
aarp_dl->datalink_header(aarp_dl, skb, aarp_eth_multicast); aarp_dl->datalink_header(aarp_dl, skb, aarp_eth_multicast);
...@@ -177,46 +174,44 @@ static void __aarp_send_query(struct aarp_entry *a) ...@@ -177,46 +174,44 @@ static void __aarp_send_query(struct aarp_entry *a)
/* This runs under aarp_lock and in softint context, so only atomic memory /* This runs under aarp_lock and in softint context, so only atomic memory
* allocations can be used. */ * allocations can be used. */
static void aarp_send_reply(struct net_device *dev, struct at_addr *us, static void aarp_send_reply(struct net_device *dev, struct atalk_addr *us,
struct at_addr *them, unsigned char *sha) struct atalk_addr *them, unsigned char *sha)
{ {
int len = dev->hard_header_len + sizeof(struct elapaarp) +
aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
struct elapaarp *eah; struct elapaarp *eah;
int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
if (!skb) if (!skb)
return; return;
/* Set up the buffer */ /* Set up the buffer */
skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
eah = (struct elapaarp *)skb_put(skb, skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah));
sizeof(struct elapaarp)); skb->protocol = htons(ETH_P_ATALK);
skb->protocol = htons(ETH_P_ATALK); skb->dev = dev;
skb->nh.raw = skb->h.raw = (void *) eah; eah = aarp_hdr(skb);
skb->dev = dev;
/* Set up the ARP */ /* Set up the ARP */
eah->hw_type = htons(AARP_HW_TYPE_ETHERNET); eah->hw_type = htons(AARP_HW_TYPE_ETHERNET);
eah->pa_type = htons(ETH_P_ATALK); eah->pa_type = htons(ETH_P_ATALK);
eah->hw_len = ETH_ALEN; eah->hw_len = ETH_ALEN;
eah->pa_len = AARP_PA_ALEN; eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_REPLY); eah->function = htons(AARP_REPLY);
memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN); memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
eah->pa_src_zero= 0; eah->pa_src_zero = 0;
eah->pa_src_net = us->s_net; eah->pa_src_net = us->s_net;
eah->pa_src_node= us->s_node; eah->pa_src_node = us->s_node;
if (!sha) if (!sha)
memset(eah->hw_dst, '\0', ETH_ALEN); memset(eah->hw_dst, '\0', ETH_ALEN);
else else
memcpy(eah->hw_dst, sha, ETH_ALEN); memcpy(eah->hw_dst, sha, ETH_ALEN);
eah->pa_dst_zero= 0; eah->pa_dst_zero = 0;
eah->pa_dst_net = them->s_net; eah->pa_dst_net = them->s_net;
eah->pa_dst_node= them->s_node; eah->pa_dst_node = them->s_node;
/* Add ELAP headers and set target to the AARP multicast */ /* Add ELAP headers and set target to the AARP multicast */
aarp_dl->datalink_header(aarp_dl, skb, sha); aarp_dl->datalink_header(aarp_dl, skb, sha);
...@@ -229,44 +224,42 @@ static void aarp_send_reply(struct net_device *dev, struct at_addr *us, ...@@ -229,44 +224,42 @@ static void aarp_send_reply(struct net_device *dev, struct at_addr *us,
* aarp_proxy_probe_network. * aarp_proxy_probe_network.
*/ */
void aarp_send_probe(struct net_device *dev, struct at_addr *us) void aarp_send_probe(struct net_device *dev, struct atalk_addr *us)
{ {
int len = dev->hard_header_len + sizeof(struct elapaarp) +
aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
static char aarp_eth_multicast[ETH_ALEN] =
{ 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF };
struct elapaarp *eah; struct elapaarp *eah;
int len = dev->hard_header_len + sizeof(*eah) + aarp_dl->header_length;
struct sk_buff *skb = alloc_skb(len, GFP_ATOMIC);
static unsigned char aarp_eth_multicast[ETH_ALEN] =
{ 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF };
if (!skb) if (!skb)
return; return;
/* Set up the buffer */ /* Set up the buffer */
skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length); skb_reserve(skb, dev->hard_header_len + aarp_dl->header_length);
eah = (struct elapaarp *)skb_put(skb, skb->nh.raw = skb->h.raw = skb_put(skb, sizeof(*eah));
sizeof(struct elapaarp)); skb->protocol = htons(ETH_P_ATALK);
skb->protocol = htons(ETH_P_ATALK); skb->dev = dev;
skb->nh.raw = skb->h.raw = (void *) eah; eah = aarp_hdr(skb);
skb->dev = dev;
/* Set up the ARP */ /* Set up the ARP */
eah->hw_type = htons(AARP_HW_TYPE_ETHERNET); eah->hw_type = htons(AARP_HW_TYPE_ETHERNET);
eah->pa_type = htons(ETH_P_ATALK); eah->pa_type = htons(ETH_P_ATALK);
eah->hw_len = ETH_ALEN; eah->hw_len = ETH_ALEN;
eah->pa_len = AARP_PA_ALEN; eah->pa_len = AARP_PA_ALEN;
eah->function = htons(AARP_PROBE); eah->function = htons(AARP_PROBE);
memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN); memcpy(eah->hw_src, dev->dev_addr, ETH_ALEN);
eah->pa_src_zero= 0; eah->pa_src_zero = 0;
eah->pa_src_net = us->s_net; eah->pa_src_net = us->s_net;
eah->pa_src_node= us->s_node; eah->pa_src_node = us->s_node;
memset(eah->hw_dst, '\0', ETH_ALEN); memset(eah->hw_dst, '\0', ETH_ALEN);
eah->pa_dst_zero= 0; eah->pa_dst_zero = 0;
eah->pa_dst_net = us->s_net; eah->pa_dst_net = us->s_net;
eah->pa_dst_node= us->s_node; eah->pa_dst_node = us->s_node;
/* Add ELAP headers and set target to the AARP multicast */ /* Add ELAP headers and set target to the AARP multicast */
aarp_dl->datalink_header(aarp_dl, skb, aarp_eth_multicast); aarp_dl->datalink_header(aarp_dl, skb, aarp_eth_multicast);
...@@ -398,7 +391,7 @@ static struct aarp_entry *aarp_alloc(void) ...@@ -398,7 +391,7 @@ static struct aarp_entry *aarp_alloc(void)
*/ */
static struct aarp_entry *__aarp_find_entry(struct aarp_entry *list, static struct aarp_entry *__aarp_find_entry(struct aarp_entry *list,
struct net_device *dev, struct net_device *dev,
struct at_addr *sat) struct atalk_addr *sat)
{ {
while (list) { while (list) {
if (list->target_addr.s_net == sat->s_net && if (list->target_addr.s_net == sat->s_net &&
...@@ -412,7 +405,7 @@ static struct aarp_entry *__aarp_find_entry(struct aarp_entry *list, ...@@ -412,7 +405,7 @@ static struct aarp_entry *__aarp_find_entry(struct aarp_entry *list,
} }
/* Called from the DDP code, and thus must be exported. */ /* Called from the DDP code, and thus must be exported. */
void aarp_proxy_remove(struct net_device *dev, struct at_addr *sa) void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa)
{ {
int hash = sa->s_node % (AARP_HASH_SIZE - 1); int hash = sa->s_node % (AARP_HASH_SIZE - 1);
struct aarp_entry *a; struct aarp_entry *a;
...@@ -427,8 +420,8 @@ void aarp_proxy_remove(struct net_device *dev, struct at_addr *sa) ...@@ -427,8 +420,8 @@ void aarp_proxy_remove(struct net_device *dev, struct at_addr *sa)
} }
/* This must run under aarp_lock. */ /* This must run under aarp_lock. */
static struct at_addr *__aarp_proxy_find(struct net_device *dev, static struct atalk_addr *__aarp_proxy_find(struct net_device *dev,
struct at_addr *sa) struct atalk_addr *sa)
{ {
int hash = sa->s_node % (AARP_HASH_SIZE - 1); int hash = sa->s_node % (AARP_HASH_SIZE - 1);
struct aarp_entry *a = __aarp_find_entry(proxies[hash], dev, sa); struct aarp_entry *a = __aarp_find_entry(proxies[hash], dev, sa);
...@@ -482,7 +475,7 @@ void aarp_probe_network(struct atalk_iface *atif) ...@@ -482,7 +475,7 @@ void aarp_probe_network(struct atalk_iface *atif)
} }
} }
int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa) int aarp_proxy_probe_network(struct atalk_iface *atif, struct atalk_addr *sa)
{ {
int hash, retval = -EPROTONOSUPPORT; int hash, retval = -EPROTONOSUPPORT;
struct aarp_entry *entry; struct aarp_entry *entry;
...@@ -545,7 +538,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa) ...@@ -545,7 +538,7 @@ int aarp_proxy_probe_network(struct atalk_iface *atif, struct at_addr *sa)
/* Send a DDP frame */ /* Send a DDP frame */
int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
struct at_addr *sa, void *hwaddr) struct atalk_addr *sa, void *hwaddr)
{ {
static char ddp_eth_multicast[ETH_ALEN] = static char ddp_eth_multicast[ETH_ALEN] =
{ 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF }; { 0x09, 0x00, 0x07, 0xFF, 0xFF, 0xFF };
...@@ -556,15 +549,15 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -556,15 +549,15 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
/* Check for LocalTalk first */ /* Check for LocalTalk first */
if (dev->type == ARPHRD_LOCALTLK) { if (dev->type == ARPHRD_LOCALTLK) {
struct at_addr *at = atalk_find_dev_addr(dev); struct atalk_addr *at = atalk_find_dev_addr(dev);
struct ddpehdr *ddp = (struct ddpehdr *)skb->data; struct ddpehdr *ddp = (struct ddpehdr *)skb->data;
int ft = 2; int ft = 2;
/* /*
* Compressible ? * Compressible ?
* *
* IFF: src_net==dest_net==device_net * IFF: src_net == dest_net == device_net
* (zero matches anything) * (zero matches anything)
*/ */
if ((!ddp->deh_snet || at->s_net == ddp->deh_snet) && if ((!ddp->deh_snet || at->s_net == ddp->deh_snet) &&
...@@ -580,15 +573,15 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -580,15 +573,15 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
ft = 1; ft = 1;
} }
/* /*
* Nice and easy. No AARP type protocols occur here * Nice and easy. No AARP type protocols occur here so we can
* so we can just shovel it out with a 3 byte LLAP header * just shovel it out with a 3 byte LLAP header
*/ */
skb_push(skb, 3); skb_push(skb, 3);
skb->data[0] = sa->s_node; skb->data[0] = sa->s_node;
skb->data[1] = at->s_node; skb->data[1] = at->s_node;
skb->data[2] = ft; skb->data[2] = ft;
skb->dev = dev; skb->dev = dev;
goto sendit; goto sendit;
} }
...@@ -652,8 +645,8 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, ...@@ -652,8 +645,8 @@ int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb,
__aarp_send_query(a); __aarp_send_query(a);
/* /*
* Switch to fast timer if needed (That is if this is the * Switch to fast timer if needed (That is if this is the first
* first unresolved entry to get added) * unresolved entry to get added)
*/ */
if (unresolved_count == 1) if (unresolved_count == 1)
...@@ -713,11 +706,11 @@ static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a, ...@@ -713,11 +706,11 @@ static void __aarp_resolved(struct aarp_entry **list, struct aarp_entry *a,
static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt) struct packet_type *pt)
{ {
struct elapaarp *ea = (struct elapaarp *)skb->h.raw; struct elapaarp *ea = aarp_hdr(skb);
int hash, ret = 0; int hash, ret = 0;
__u16 function; __u16 function;
struct aarp_entry *a; struct aarp_entry *a;
struct at_addr sa, *ma, da; struct atalk_addr sa, *ma, da;
struct atalk_iface *ifa; struct atalk_iface *ifa;
/* We only do Ethernet SNAP AARP. */ /* We only do Ethernet SNAP AARP. */
...@@ -791,20 +784,21 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -791,20 +784,21 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
case AARP_REQUEST: case AARP_REQUEST:
case AARP_PROBE: case AARP_PROBE:
/* /*
* If it is my address set ma to my address and * If it is my address set ma to my address and reply.
* reply. We can treat probe and request the * We can treat probe and request the same. Probe
* same. Probe simply means we shouldn't cache * simply means we shouldn't cache the querying host,
* the querying host, as in a probe they are * as in a probe they are proposing an address not
* proposing an address not using one. * using one.
* *
* Support for proxy-AARP added. We check if the * Support for proxy-AARP added. We check if the
* address is one of our proxies before we toss * address is one of our proxies before we toss the
* the packet out. * packet out.
*/ */
sa.s_node = ea->pa_dst_node; sa.s_node = ea->pa_dst_node;
sa.s_net = ea->pa_dst_net; sa.s_net = ea->pa_dst_net;
/* See if we have a matching proxy. */ /* See if we have a matching proxy. */
ma = __aarp_proxy_find(dev, &sa); ma = __aarp_proxy_find(dev, &sa);
...@@ -817,16 +811,22 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -817,16 +811,22 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
} }
if (function == AARP_PROBE) { if (function == AARP_PROBE) {
/* A probe implies someone trying to get an /*
* A probe implies someone trying to get an
* address. So as a precaution flush any * address. So as a precaution flush any
* entries we have for this address. */ * entries we have for this address.
*/
struct aarp_entry *a = __aarp_find_entry( struct aarp_entry *a = __aarp_find_entry(
resolved[sa.s_node%(AARP_HASH_SIZE-1)], resolved[sa.s_node %
skb->dev, &sa); (AARP_HASH_SIZE - 1)],
/* Make it expire next tick - that avoids us skb->dev, &sa);
/*
* Make it expire next tick - that avoids us
* getting into a probe/flush/learn/probe/ * getting into a probe/flush/learn/probe/
* flush/learn cycle during probing of a slow * flush/learn cycle during probing of a slow
* to respond host addr. */ * to respond host addr.
*/
if (a) { if (a) {
a->expires_at = jiffies - 1; a->expires_at = jiffies - 1;
mod_timer(&aarp_timer, jiffies + mod_timer(&aarp_timer, jiffies +
...@@ -862,7 +862,7 @@ static struct notifier_block aarp_notifier = { ...@@ -862,7 +862,7 @@ static struct notifier_block aarp_notifier = {
.notifier_call =aarp_device_event, .notifier_call =aarp_device_event,
}; };
static char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 }; static unsigned char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 };
void __init aarp_proto_init(void) void __init aarp_proto_init(void)
{ {
...@@ -1003,5 +1003,4 @@ void aarp_unregister_proc_fs(void) ...@@ -1003,5 +1003,4 @@ void aarp_unregister_proc_fs(void)
proc_net_remove("aarp"); proc_net_remove("aarp");
} }
#endif #endif
#endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE)
#include <linux/module.h> #include <linux/module.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -96,8 +95,8 @@ extern void aarp_cleanup_module(void); ...@@ -96,8 +95,8 @@ extern void aarp_cleanup_module(void);
extern void aarp_probe_network(struct atalk_iface *atif); extern void aarp_probe_network(struct atalk_iface *atif);
extern int aarp_proxy_probe_network(struct atalk_iface *atif, extern int aarp_proxy_probe_network(struct atalk_iface *atif,
struct at_addr *sa); struct atalk_addr *sa);
extern void aarp_proxy_remove(struct net_device *dev, struct at_addr *sa); extern void aarp_proxy_remove(struct net_device *dev, struct atalk_addr *sa);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
extern inline void atalk_register_sysctl(void); extern inline void atalk_register_sysctl(void);
...@@ -332,7 +331,7 @@ static void atif_drop_device(struct net_device *dev) ...@@ -332,7 +331,7 @@ static void atif_drop_device(struct net_device *dev)
} }
static struct atalk_iface *atif_add_device(struct net_device *dev, static struct atalk_iface *atif_add_device(struct net_device *dev,
struct at_addr *sa) struct atalk_addr *sa)
{ {
struct atalk_iface *iface; struct atalk_iface *iface;
...@@ -407,7 +406,7 @@ static int atif_probe_device(struct atalk_iface *atif) ...@@ -407,7 +406,7 @@ static int atif_probe_device(struct atalk_iface *atif)
/* Perform AARP probing for a proxy address */ /* Perform AARP probing for a proxy address */
static int atif_proxy_probe_device(struct atalk_iface *atif, static int atif_proxy_probe_device(struct atalk_iface *atif,
struct at_addr* proxy_addr) struct atalk_addr* proxy_addr)
{ {
int netrange = ntohs(atif->nets.nr_lastnet) - int netrange = ntohs(atif->nets.nr_lastnet) -
ntohs(atif->nets.nr_firstnet) + 1; ntohs(atif->nets.nr_firstnet) + 1;
...@@ -451,16 +450,16 @@ static int atif_proxy_probe_device(struct atalk_iface *atif, ...@@ -451,16 +450,16 @@ static int atif_proxy_probe_device(struct atalk_iface *atif,
} }
struct at_addr *atalk_find_dev_addr(struct net_device *dev) struct atalk_addr *atalk_find_dev_addr(struct net_device *dev)
{ {
struct atalk_iface *iface = dev->atalk_ptr; struct atalk_iface *iface = dev->atalk_ptr;
return iface ? &iface->address : NULL; return iface ? &iface->address : NULL;
} }
static struct at_addr *atalk_find_primary(void) static struct atalk_addr *atalk_find_primary(void)
{ {
struct atalk_iface *fiface = NULL; struct atalk_iface *fiface = NULL;
struct at_addr *retval; struct atalk_addr *retval;
struct atalk_iface *iface; struct atalk_iface *iface;
/* /*
...@@ -497,14 +496,17 @@ static struct atalk_iface *atalk_find_anynet(int node, struct net_device *dev) ...@@ -497,14 +496,17 @@ static struct atalk_iface *atalk_find_anynet(int node, struct net_device *dev)
struct atalk_iface *iface = dev->atalk_ptr; struct atalk_iface *iface = dev->atalk_ptr;
if (!iface || iface->status & ATIF_PROBE) if (!iface || iface->status & ATIF_PROBE)
return NULL; goto out_err;
if (node == ATADDR_BCAST || if (node != ATADDR_BCAST &&
iface->address.s_node == node || iface->address.s_node != node &&
node == ATADDR_ANYNODE) node != ATADDR_ANYNODE)
return iface; goto out_err;
out:
return NULL; return iface;
out_err:
iface = NULL;
goto out;
} }
/* Find a match for a specific network:node pair */ /* Find a match for a specific network:node pair */
...@@ -537,7 +539,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node) ...@@ -537,7 +539,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node)
* the socket (later on...). We know about host routes and the fact * the socket (later on...). We know about host routes and the fact
* that a route must be direct to broadcast. * that a route must be direct to broadcast.
*/ */
static struct atalk_route *atrtr_find(struct at_addr *target) static struct atalk_route *atrtr_find(struct atalk_addr *target)
{ {
/* /*
* we must search through all routes unless we find a * we must search through all routes unless we find a
...@@ -589,7 +591,7 @@ static struct atalk_route *atrtr_find(struct at_addr *target) ...@@ -589,7 +591,7 @@ static struct atalk_route *atrtr_find(struct at_addr *target)
* Given an AppleTalk network, find the device to use. This can be * Given an AppleTalk network, find the device to use. This can be
* a simple lookup. * a simple lookup.
*/ */
struct net_device *atrtr_get_dev(struct at_addr *sa) struct net_device *atrtr_get_dev(struct atalk_addr *sa)
{ {
struct atalk_route *atr = atrtr_find(sa); struct atalk_route *atr = atrtr_find(sa);
return atr ? atr->dev : NULL; return atr ? atr->dev : NULL;
...@@ -598,9 +600,9 @@ struct net_device *atrtr_get_dev(struct at_addr *sa) ...@@ -598,9 +600,9 @@ struct net_device *atrtr_get_dev(struct at_addr *sa)
/* Set up a default router */ /* Set up a default router */
static void atrtr_set_default(struct net_device *dev) static void atrtr_set_default(struct net_device *dev)
{ {
atrtr_default.dev = dev; atrtr_default.dev = dev;
atrtr_default.flags = RTF_UP; atrtr_default.flags = RTF_UP;
atrtr_default.gateway.s_net = htons(0); atrtr_default.gateway.s_net = htons(0);
atrtr_default.gateway.s_node = 0; atrtr_default.gateway.s_node = 0;
} }
...@@ -691,7 +693,7 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint) ...@@ -691,7 +693,7 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint)
} }
/* Delete a route. Find it and discard it */ /* Delete a route. Find it and discard it */
static int atrtr_delete(struct at_addr * addr) static int atrtr_delete(struct atalk_addr * addr)
{ {
struct atalk_route **r = &atalk_router_list; struct atalk_route **r = &atalk_router_list;
int retval = 0; int retval = 0;
...@@ -750,7 +752,7 @@ static inline void atalk_dev_down(struct net_device *dev) ...@@ -750,7 +752,7 @@ static inline void atalk_dev_down(struct net_device *dev)
* delete our use of them (iface and route). * delete our use of them (iface and route).
*/ */
static int ddp_device_event(struct notifier_block *this, unsigned long event, static int ddp_device_event(struct notifier_block *this, unsigned long event,
void *ptr) void *ptr)
{ {
if (event == NETDEV_DOWN) if (event == NETDEV_DOWN)
/* Discard any use of this */ /* Discard any use of this */
...@@ -765,7 +767,7 @@ static int atif_ioctl(int cmd, void *arg) ...@@ -765,7 +767,7 @@ static int atif_ioctl(int cmd, void *arg)
{ {
static char aarp_mcast[6] = { 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF }; static char aarp_mcast[6] = { 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF };
struct ifreq atreq; struct ifreq atreq;
struct netrange *nr; struct atalk_netrange *nr;
struct sockaddr_at *sa; struct sockaddr_at *sa;
struct net_device *dev; struct net_device *dev;
struct atalk_iface *atif; struct atalk_iface *atif;
...@@ -796,7 +798,7 @@ static int atif_ioctl(int cmd, void *arg) ...@@ -796,7 +798,7 @@ static int atif_ioctl(int cmd, void *arg)
dev->type != ARPHRD_PPP) dev->type != ARPHRD_PPP)
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
nr = (struct netrange *)&sa->sat_zero[0]; nr = (struct atalk_netrange *)&sa->sat_zero[0];
add_route = 1; add_route = 1;
/* /*
...@@ -936,7 +938,7 @@ static int atif_ioctl(int cmd, void *arg) ...@@ -936,7 +938,7 @@ static int atif_ioctl(int cmd, void *arg)
if (!atif) if (!atif)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
nr = (struct netrange *)&(atif->nets); nr = (struct atalk_netrange *)&(atif->nets);
/* /*
* Phase 1 is fine on Localtalk but we don't do * Phase 1 is fine on Localtalk but we don't do
* Ethertalk phase 1. Anyone wanting to add it go ahead. * Ethertalk phase 1. Anyone wanting to add it go ahead.
...@@ -982,7 +984,6 @@ static int atif_ioctl(int cmd, void *arg) ...@@ -982,7 +984,6 @@ static int atif_ioctl(int cmd, void *arg)
/* Routing ioctl() calls */ /* Routing ioctl() calls */
static int atrtr_ioctl(unsigned int cmd, void *arg) static int atrtr_ioctl(unsigned int cmd, void *arg)
{ {
struct net_device *dev = NULL;
struct rtentry rt; struct rtentry rt;
if (copy_from_user(&rt, arg, sizeof(rt))) if (copy_from_user(&rt, arg, sizeof(rt)))
...@@ -995,15 +996,19 @@ static int atrtr_ioctl(unsigned int cmd, void *arg) ...@@ -995,15 +996,19 @@ static int atrtr_ioctl(unsigned int cmd, void *arg)
return atrtr_delete(&((struct sockaddr_at *) return atrtr_delete(&((struct sockaddr_at *)
&rt.rt_dst)->sat_addr); &rt.rt_dst)->sat_addr);
case SIOCADDRT: case SIOCADDRT: {
/* FIXME: the name of the device is still in user struct net_device *dev = NULL;
* space, isn't it? */ /*
* FIXME: the name of the device is still in user
* space, isn't it?
*/
if (rt.rt_dev) { if (rt.rt_dev) {
dev = __dev_get_by_name(rt.rt_dev); dev = __dev_get_by_name(rt.rt_dev);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
} }
return atrtr_create(&rt, dev); return atrtr_create(&rt, dev);
}
} }
return -EINVAL; return -EINVAL;
} }
...@@ -1159,14 +1164,13 @@ static int atalk_release(struct socket *sock) ...@@ -1159,14 +1164,13 @@ static int atalk_release(struct socket *sock)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
if (!sk) if (sk) {
goto out; if (!sk->dead)
if (!sk->dead) sk->state_change(sk);
sk->state_change(sk); sk->dead = 1;
sk->dead = 1; sock->sk = NULL;
sock->sk = NULL; atalk_destroy_socket(sk);
atalk_destroy_socket(sk); }
out:
return 0; return 0;
} }
...@@ -1222,7 +1226,7 @@ static int atalk_autobind(struct sock *sk) ...@@ -1222,7 +1226,7 @@ static int atalk_autobind(struct sock *sk)
{ {
struct atalk_sock *at = at_sk(sk); struct atalk_sock *at = at_sk(sk);
struct sockaddr_at sat; struct sockaddr_at sat;
struct at_addr *ap = atalk_find_primary(); struct atalk_addr *ap = atalk_find_primary();
int n = -EADDRNOTAVAIL; int n = -EADDRNOTAVAIL;
if (!ap || ap->s_net == htons(ATADDR_ANYNET)) if (!ap || ap->s_net == htons(ATADDR_ANYNET))
...@@ -1252,7 +1256,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1252,7 +1256,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
if (addr->sat_addr.s_net == htons(ATADDR_ANYNET)) { if (addr->sat_addr.s_net == htons(ATADDR_ANYNET)) {
struct at_addr *ap = atalk_find_primary(); struct atalk_addr *ap = atalk_find_primary();
if (!ap) if (!ap)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
...@@ -1330,7 +1334,6 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -1330,7 +1334,6 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr,
return 0; return 0;
} }
/* /*
* Find the name of an AppleTalk socket. Just copy the right * Find the name of an AppleTalk socket. Just copy the right
* fields into the sockaddr. * fields into the sockaddr.
...@@ -1366,22 +1369,140 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -1366,22 +1369,140 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
return 0; return 0;
} }
#if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE)
static __inline__ int is_ip_over_ddp(struct sk_buff *skb)
{
return skb->data[12] == 22;
}
static int handle_ip_over_ddp(struct sk_buff *skb)
{
struct net_device *dev = __dev_get_by_name("ipddp0");
struct net_device_stats *stats;
/* This needs to be able to handle ipddp"N" devices */
if (!dev)
return -ENODEV;
skb->protocol = htons(ETH_P_IP);
skb_pull(skb, 13);
skb->dev = dev;
skb->h.raw = skb->data;
stats = dev->priv;
stats->rx_packets++;
stats->rx_bytes += skb->len + 13;
netif_rx(skb); /* Send the SKB up to a higher place. */
return 0;
}
#else
/* make it easy for gcc to optimize this test out, i.e. kill the code */
#define is_ip_over_ddp(skb) 0
#define handle_ip_over_ddp(skb) 0
#endif
static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
struct ddpehdr *ddp, struct ddpebits *ddphv,
int origlen)
{
struct atalk_route *rt;
struct atalk_addr ta;
/*
* Don't route multicast, etc., packets, or packets sent to "this
* network"
*/
if (skb->pkt_type != PACKET_HOST || !ddp->deh_dnet) {
/*
* FIXME:
*
* Can it ever happen that a packet is from a PPP iface and
* needs to be broadcast onto the default network?
*/
if (dev->type == ARPHRD_PPP)
printk(KERN_DEBUG "AppleTalk: didn't forward broadcast "
"packet received from PPP iface\n");
goto free_it;
}
ta.s_net = ddp->deh_dnet;
ta.s_node = ddp->deh_dnode;
/* Route the packet */
rt = atrtr_find(&ta);
if (!rt || ddphv->deh_hops == DDP_MAXHOPS)
goto free_it;
/* FIXME: use skb->cb to be able to use shared skbs */
ddphv->deh_hops++;
/*
* Route goes through another gateway, so set the target to the
* gateway instead.
*/
if (rt->flags & RTF_GATEWAY) {
ta.s_net = rt->gateway.s_net;
ta.s_node = rt->gateway.s_node;
}
/* Fix up skb->len field */
skb_trim(skb, min_t(unsigned int, origlen,
(rt->dev->hard_header_len +
ddp_dl->header_length + ddphv->deh_len)));
/* Mend the byte order */
/* FIXME: use skb->cb to be able to use shared skbs */
*((__u16 *)ddp) = ntohs(*((__u16 *)ddphv));
/*
* Send the buffer onwards
*
* Now we must always be careful. If it's come from LocalTalk to
* EtherTalk it might not fit
*
* Order matters here: If a packet has to be copied to make a new
* headroom (rare hopefully) then it won't need unsharing.
*
* Note. ddp-> becomes invalid at the realloc.
*/
if (skb_headroom(skb) < 22) {
/* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */
struct sk_buff *nskb = skb_realloc_headroom(skb, 32);
kfree_skb(skb);
if (!nskb)
goto out;
skb = nskb;
} else
skb = skb_unshare(skb, GFP_ATOMIC);
/*
* If the buffer didn't vanish into the lack of space bitbucket we can
* send it.
*/
if (skb && aarp_send_ddp(rt->dev, skb, &ta, NULL) == -1)
goto free_it;
out:
return;
free_it:
kfree_skb(skb);
}
/** /**
* atalk_rcv - Receive a packet (in skb) from device dev * atalk_rcv - Receive a packet (in skb) from device dev
* @skb - packet received * @skb - packet received
* @dev - network device where the packet comes from * @dev - network device where the packet comes from
* @pt - packet type * @pt - packet type
* *
* Receive a packet (in skb) from device dev. This has come from the SNAP * Receive a packet (in skb) from device dev. This has come from the SNAP
* decoder, and on entry skb->h.raw is the DDP header, skb->len is the DDP * decoder, and on entry skb->h.raw is the DDP header, skb->len is the DDP
* header, skb->len is the DDP length. The physical headers have been * header, skb->len is the DDP length. The physical headers have been
* extracted. PPP should probably pass frames marked as for this layer. * extracted. PPP should probably pass frames marked as for this layer.
* [ie ARPHRD_ETHERTALK] * [ie ARPHRD_ETHERTALK]
*/ */
static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt) struct packet_type *pt)
{ {
struct ddpehdr *ddp = (void *)skb->h.raw; struct ddpehdr *ddp = ddp_hdr(skb);
struct sock *sock; struct sock *sock;
struct atalk_iface *atif; struct atalk_iface *atif;
struct sockaddr_at tosat; struct sockaddr_at tosat;
...@@ -1432,106 +1553,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -1432,106 +1553,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
/* Not ours, so we route the packet via the correct AppleTalk iface */ /* Not ours, so we route the packet via the correct AppleTalk iface */
if (!atif) { if (!atif) {
struct atalk_route *rt; atalk_route_packet(skb, dev, ddp, &ddphv, origlen);
struct at_addr ta;
/*
* Don't route multicast, etc., packets, or packets
* sent to "this network"
*/
if (skb->pkt_type != PACKET_HOST || !ddp->deh_dnet) {
/* FIXME:
* Can it ever happen that a packet is from a PPP
* iface and needs to be broadcast onto the default
* network? */
if (dev->type == ARPHRD_PPP)
printk(KERN_DEBUG "AppleTalk: didn't forward "
"broadcast packet received "
"from PPP iface\n");
goto freeit;
}
ta.s_net = ddp->deh_dnet;
ta.s_node = ddp->deh_dnode;
/* Route the packet */
rt = atrtr_find(&ta);
if (!rt || ddphv.deh_hops == DDP_MAXHOPS)
goto freeit;
/* FIXME: use skb->cb to be able to use shared skbs */
ddphv.deh_hops++;
/*
* Route goes through another gateway, so
* set the target to the gateway instead.
*/
if (rt->flags & RTF_GATEWAY) {
ta.s_net = rt->gateway.s_net;
ta.s_node = rt->gateway.s_node;
}
/* Fix up skb->len field */
skb_trim(skb, min_t(unsigned int, origlen,
(rt->dev->hard_header_len +
ddp_dl->header_length + ddphv.deh_len)));
/* Mend the byte order */
/* FIXME: use skb->cb to be able to use shared skbs */
*((__u16 *)ddp) = ntohs(*((__u16 *)&ddphv));
/*
* Send the buffer onwards
*
* Now we must always be careful. If it's come from
* LocalTalk to EtherTalk it might not fit
*
* Order matters here: If a packet has to be copied
* to make a new headroom (rare hopefully) then it
* won't need unsharing.
*
* Note. ddp-> becomes invalid at the realloc.
*/
if (skb_headroom(skb) < 22) {
/* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */
struct sk_buff *nskb = skb_realloc_headroom(skb, 32);
kfree_skb(skb);
if (!nskb)
goto out;
skb = nskb;
} else
skb = skb_unshare(skb, GFP_ATOMIC);
/*
* If the buffer didn't vanish into the lack of
* space bitbucket we can send it.
*/
if (skb && aarp_send_ddp(rt->dev, skb, &ta, NULL) == -1)
goto freeit;
goto out; goto out;
} }
#if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE) /* if IP over DDP is not selected this code will be optimized out */
/* Check if IP-over-DDP */ if (is_ip_over_ddp(skb))
if (skb->data[12] == 22) { return handle_ip_over_ddp(skb);
struct net_device *dev = __dev_get_by_name("ipddp0");
struct net_device_stats *stats;
/* This needs to be able to handle ipddp"N" devices */
if (!dev)
return -ENODEV;
skb->protocol = htons(ETH_P_IP);
skb_pull(skb, 13);
skb->dev = dev;
skb->h.raw = skb->data;
stats = dev->priv;
stats->rx_packets++;
stats->rx_bytes += skb->len + 13;
netif_rx(skb); /* Send the SKB up to a higher place. */
goto out;
}
#endif
/* /*
* Which socket - atalk_search_socket() looks for a *full match* * Which socket - atalk_search_socket() looks for a *full match*
* of the <net, node, port> tuple. * of the <net, node, port> tuple.
...@@ -1568,7 +1596,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -1568,7 +1596,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
if (skb->mac.raw[2] == 1) { if (skb->mac.raw[2] == 1) {
struct ddpehdr *ddp; struct ddpehdr *ddp;
/* Find our address */ /* Find our address */
struct at_addr *ap = atalk_find_dev_addr(dev); struct atalk_addr *ap = atalk_find_dev_addr(dev);
if (!ap || skb->len < sizeof(struct ddpshdr)) if (!ap || skb->len < sizeof(struct ddpshdr))
goto freeit; goto freeit;
...@@ -1674,7 +1702,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, ...@@ -1674,7 +1702,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len,
dev = rt->dev; dev = rt->dev;
} else { } else {
struct at_addr at_hint; struct atalk_addr at_hint;
at_hint.s_node = 0; at_hint.s_node = 0;
at_hint.s_net = at->src_net; at_hint.s_net = at->src_net;
...@@ -1792,7 +1820,7 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, ...@@ -1792,7 +1820,7 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size,
return err; return err;
/* FIXME: use skb->cb to be able to use shared skbs */ /* FIXME: use skb->cb to be able to use shared skbs */
ddp = (struct ddpehdr *)(skb->h.raw); ddp = ddp_hdr(skb);
*((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp)); *((__u16 *)&ddphv) = ntohs(*((__u16 *)ddp));
if (sk->type == SOCK_RAW) { if (sk->type == SOCK_RAW) {
...@@ -1833,40 +1861,48 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, ...@@ -1833,40 +1861,48 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size,
*/ */
static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
long amount = 0; int rc = -EINVAL;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
switch (cmd) { switch (cmd) {
/* Protocol layer */ /* Protocol layer */
case TIOCOUTQ: case TIOCOUTQ: {
amount = sk->sndbuf - atomic_read(&sk->wmem_alloc); long amount = sk->sndbuf - atomic_read(&sk->wmem_alloc);
if (amount < 0) if (amount < 0)
amount = 0; amount = 0;
rc = put_user(amount, (int *)arg);
break; break;
}
case TIOCINQ: { case TIOCINQ: {
/* /*
* These two are safe on a single CPU system as only * These two are safe on a single CPU system as only
* user tasks fiddle here * user tasks fiddle here
*/ */
struct sk_buff *skb = skb_peek(&sk->receive_queue); struct sk_buff *skb = skb_peek(&sk->receive_queue);
long amount = 0;
if (skb) if (skb)
amount = skb->len - sizeof(struct ddpehdr); amount = skb->len - sizeof(struct ddpehdr);
rc = put_user(amount, (int *)arg);
break; break;
} }
case SIOCGSTAMP: case SIOCGSTAMP:
if (!sk) if (!sk)
return -EINVAL; break;
rc = -ENOENT;
if (!sk->stamp.tv_sec) if (!sk->stamp.tv_sec)
return -ENOENT; break;
return copy_to_user((void *)arg, &sk->stamp, rc = copy_to_user((void *)arg, &sk->stamp,
sizeof(struct timeval)) ? -EFAULT : 0; sizeof(struct timeval)) ? -EFAULT : 0;
break;
/* Routing */ /* Routing */
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
if (!capable(CAP_NET_ADMIN)) rc = -EPERM;
return -EPERM; if (capable(CAP_NET_ADMIN))
return atrtr_ioctl(cmd, (void *)arg); rc = atrtr_ioctl(cmd, (void *)arg);
break;
/* Interface */ /* Interface */
case SIOCGIFADDR: case SIOCGIFADDR:
case SIOCSIFADDR: case SIOCSIFADDR:
...@@ -1874,15 +1910,11 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1874,15 +1910,11 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCATALKDIFADDR: case SIOCATALKDIFADDR:
case SIOCDIFADDR: case SIOCDIFADDR:
case SIOCSARP: /* proxy AARP */ case SIOCSARP: /* proxy AARP */
case SIOCDARP: { /* proxy AARP */ case SIOCDARP: /* proxy AARP */
int ret;
rtnl_lock(); rtnl_lock();
ret = atif_ioctl(cmd, (void *)arg); rc = atif_ioctl(cmd, (void *)arg);
rtnl_unlock(); rtnl_unlock();
break;
return ret;
}
/* Physical layer ioctl calls */ /* Physical layer ioctl calls */
case SIOCSIFLINK: case SIOCSIFLINK:
case SIOCGIFHWADDR: case SIOCGIFHWADDR:
...@@ -1896,21 +1928,11 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1896,21 +1928,11 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCGIFCOUNT: case SIOCGIFCOUNT:
case SIOCGIFINDEX: case SIOCGIFINDEX:
case SIOCGIFNAME: case SIOCGIFNAME:
return dev_ioctl(cmd, (void *)arg); rc = dev_ioctl(cmd, (void *)arg);
case SIOCSIFMETRIC: break;
case SIOCSIFBRDADDR:
case SIOCGIFNETMASK:
case SIOCSIFNETMASK:
case SIOCGIFMEM:
case SIOCSIFMEM:
case SIOCGIFDSTADDR:
case SIOCSIFDSTADDR:
return -EINVAL;
default:
return -EINVAL;
} }
return put_user(amount, (int *)arg); return rc;
} }
static struct net_proto_family atalk_family_ops = { static struct net_proto_family atalk_family_ops = {
...@@ -1955,7 +1977,7 @@ struct packet_type ppptalk_packet_type = { ...@@ -1955,7 +1977,7 @@ struct packet_type ppptalk_packet_type = {
.func = atalk_rcv, .func = atalk_rcv,
}; };
static char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B }; static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B };
/* Export symbols for use by drivers when AppleTalk is a module */ /* Export symbols for use by drivers when AppleTalk is a module */
EXPORT_SYMBOL(aarp_send_ddp); EXPORT_SYMBOL(aarp_send_ddp);
...@@ -2023,4 +2045,3 @@ static void __exit atalk_exit(void) ...@@ -2023,4 +2045,3 @@ static void __exit atalk_exit(void)
} }
module_exit(atalk_exit); module_exit(atalk_exit);
#endif /* MODULE */ #endif /* MODULE */
#endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */
...@@ -523,8 +523,18 @@ static int ip_build_xmit_slow(struct sock *sk, ...@@ -523,8 +523,18 @@ static int ip_build_xmit_slow(struct sock *sk,
/* /*
* Get the memory we require with some space left for alignment. * Get the memory we require with some space left for alignment.
*/ */
if (!(flags & MSG_DONTWAIT) || nfrags == 0) {
skb = sock_alloc_send_skb(sk, fraglen+hh_len+15, flags&MSG_DONTWAIT, &err); skb = sock_alloc_send_skb(sk, fraglen + hh_len + 15,
(flags & MSG_DONTWAIT), &err);
} else {
/* On a non-blocking write, we check for send buffer
* usage on the first fragment only.
*/
skb = sock_wmalloc(sk, fraglen + hh_len + 15, 1,
sk->allocation);
if (!skb)
err = -ENOBUFS;
}
if (skb == NULL) if (skb == NULL)
goto error; goto error;
......
...@@ -742,7 +742,7 @@ check_entry(struct ip6t_entry *e, const char *name, unsigned int size, ...@@ -742,7 +742,7 @@ check_entry(struct ip6t_entry *e, const char *name, unsigned int size,
t = ip6t_get_target(e); t = ip6t_get_target(e);
target = find_target_lock(t->u.user.name, &ret, &ip6t_mutex); target = find_target_lock(t->u.user.name, &ret, &ip6t_mutex);
if (!target) { if (!target) {
// duprintf("check_entry: `%s' not found\n", t->u.name); duprintf("check_entry: `%s' not found\n", t->u.user.name);
goto cleanup_matches; goto cleanup_matches;
} }
if (target->me) if (target->me)
......
...@@ -23,25 +23,3 @@ CONFIG_IPX_INTERN ...@@ -23,25 +23,3 @@ CONFIG_IPX_INTERN
If you don't know what you are doing, say N. If you don't know what you are doing, say N.
CONFIG_SPX
* Orphaned entry retained 20 April 2001 by Petr Vandrovec *
* If you read this note from the configurator, please contact *
* the Configure.help maintainers. *
The Sequenced Packet eXchange protocol is a transport layer protocol
built on top of IPX. It is used in Novell NetWare systems for
client-server applications and is similar to TCP (which runs on top
of IP).
Note that Novell NetWare file sharing does not use SPX; it uses a
protocol called NCP, for which separate Linux support is available
("NCP file system support" below for the client side, and the user
space programs lwared or mars_nwe for the server side).
Say Y here if you have use for SPX; read the IPX-HOWTO at
<http://www.linuxdoc.org/docs.html#howto> for details.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called af_spx.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
...@@ -3,6 +3,3 @@ ...@@ -3,6 +3,3 @@
# #
bool ' IPX: Full internal IPX network' CONFIG_IPX_INTERN bool ' IPX: Full internal IPX network' CONFIG_IPX_INTERN
#if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
# dep_tristate ' IPX: SPX networking (EXPERIMENTAL)' CONFIG_SPX $CONFIG_IPX
#fi
...@@ -8,7 +8,6 @@ obj-$(CONFIG_IPX) += ipx.o ...@@ -8,7 +8,6 @@ obj-$(CONFIG_IPX) += ipx.o
ipx-y := af_ipx.o ipx-y := af_ipx.o
ipx-$(CONFIG_SYSCTL) += sysctl_net_ipx.o ipx-$(CONFIG_SYSCTL) += sysctl_net_ipx.o
ipx-$(CONFIG_SPX) += af_spx.o
ipx-objs := $(ipx-y) ipx-objs := $(ipx-y)
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
* Revision 048: Use sk->protinfo to store the pointer to IPX private * Revision 048: Use sk->protinfo to store the pointer to IPX private
* area, remove af_ipx from sk->protinfo and move ipx_opt * area, remove af_ipx from sk->protinfo and move ipx_opt
* to include/net/ipx.h, use IPX_SK like DecNET, etc * to include/net/ipx.h, use IPX_SK like DecNET, etc
* Revision 049: SPX support dropped, see comment in ipx_create
* *
* Protect the module by a MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT * Protect the module by a MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT
* pair. Also, now usage count is managed this way * pair. Also, now usage count is managed this way
...@@ -144,17 +145,14 @@ static struct datalink_proto *pSNAP_datalink; ...@@ -144,17 +145,14 @@ static struct datalink_proto *pSNAP_datalink;
static struct proto_ops ipx_dgram_ops; static struct proto_ops ipx_dgram_ops;
static struct net_proto_family *spx_family_ops; static struct ipx_route *ipx_routes;
static DECLARE_RWSEM(spx_family_ops_lock);
static ipx_route *ipx_routes;
static rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED; static rwlock_t ipx_routes_lock = RW_LOCK_UNLOCKED;
static ipx_interface *ipx_interfaces; static struct ipx_interface *ipx_interfaces;
static spinlock_t ipx_interfaces_lock = SPIN_LOCK_UNLOCKED; static spinlock_t ipx_interfaces_lock = SPIN_LOCK_UNLOCKED;
static ipx_interface *ipx_primary_net; static struct ipx_interface *ipx_primary_net;
static ipx_interface *ipx_internal_net; static struct ipx_interface *ipx_internal_net;
#undef IPX_REFCNT_DEBUG #undef IPX_REFCNT_DEBUG
#ifdef IPX_REFCNT_DEBUG #ifdef IPX_REFCNT_DEBUG
...@@ -180,9 +178,9 @@ static void ipxcfg_set_auto_select(char val) ...@@ -180,9 +178,9 @@ static void ipxcfg_set_auto_select(char val)
ipx_primary_net = ipx_interfaces; ipx_primary_net = ipx_interfaces;
} }
static int ipxcfg_get_config_data(ipx_config_data *arg) static int ipxcfg_get_config_data(struct ipx_config_data *arg)
{ {
ipx_config_data vals; struct ipx_config_data vals;
vals.ipxcfg_auto_create_interfaces = ipxcfg_auto_create_interfaces; vals.ipxcfg_auto_create_interfaces = ipxcfg_auto_create_interfaces;
vals.ipxcfg_auto_select_primary = ipxcfg_auto_select_primary; vals.ipxcfg_auto_select_primary = ipxcfg_auto_select_primary;
...@@ -192,22 +190,22 @@ static int ipxcfg_get_config_data(ipx_config_data *arg) ...@@ -192,22 +190,22 @@ static int ipxcfg_get_config_data(ipx_config_data *arg)
/* Handlers for the socket list. */ /* Handlers for the socket list. */
static inline void ipxitf_hold(ipx_interface *intrfc) static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
{ {
atomic_inc(&intrfc->refcnt); atomic_inc(&intrfc->refcnt);
} }
static void ipxitf_down(ipx_interface *intrfc); static void ipxitf_down(struct ipx_interface *intrfc);
static inline void ipxitf_put(ipx_interface *intrfc) static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
{ {
if (atomic_dec_and_test(&intrfc->refcnt)) if (atomic_dec_and_test(&intrfc->refcnt))
ipxitf_down(intrfc); ipxitf_down(intrfc);
} }
static void __ipxitf_down(ipx_interface *intrfc); static void __ipxitf_down(struct ipx_interface *intrfc);
static inline void __ipxitf_put(ipx_interface *intrfc) static __inline__ void __ipxitf_put(struct ipx_interface *intrfc)
{ {
if (atomic_dec_and_test(&intrfc->refcnt)) if (atomic_dec_and_test(&intrfc->refcnt))
__ipxitf_down(intrfc); __ipxitf_down(intrfc);
...@@ -218,11 +216,11 @@ static inline void __ipxitf_put(ipx_interface *intrfc) ...@@ -218,11 +216,11 @@ static inline void __ipxitf_put(ipx_interface *intrfc)
* use this facility. * use this facility.
*/ */
void ipx_remove_socket(struct sock *sk) static void ipx_remove_socket(struct sock *sk)
{ {
struct sock *s; struct sock *s;
/* Determine interface with which socket is associated */ /* Determine interface with which socket is associated */
ipx_interface *intrfc = ipx_sk(sk)->intrfc; struct ipx_interface *intrfc = ipx_sk(sk)->intrfc;
if (!intrfc) if (!intrfc)
goto out; goto out;
...@@ -268,7 +266,7 @@ static void ipx_destroy_socket(struct sock *sk) ...@@ -268,7 +266,7 @@ static void ipx_destroy_socket(struct sock *sk)
* The following code is used to support IPX Interfaces (IPXITF). An * The following code is used to support IPX Interfaces (IPXITF). An
* IPX interface is defined by a physical device and a frame type. * IPX interface is defined by a physical device and a frame type.
*/ */
static ipx_route * ipxrtr_lookup(__u32); static struct ipx_route *ipxrtr_lookup(__u32 net);
/* ipxitf_clear_primary_net has to be called with ipx_interfaces_lock held */ /* ipxitf_clear_primary_net has to be called with ipx_interfaces_lock held */
...@@ -277,10 +275,10 @@ static void ipxitf_clear_primary_net(void) ...@@ -277,10 +275,10 @@ static void ipxitf_clear_primary_net(void)
ipx_primary_net = ipxcfg_auto_select_primary ? ipx_interfaces : NULL; ipx_primary_net = ipxcfg_auto_select_primary ? ipx_interfaces : NULL;
} }
static ipx_interface *__ipxitf_find_using_phys(struct net_device *dev, static struct ipx_interface *__ipxitf_find_using_phys(struct net_device *dev,
unsigned short datalink) unsigned short datalink)
{ {
ipx_interface *i = ipx_interfaces; struct ipx_interface *i = ipx_interfaces;
while (i && (i->if_dev != dev || i->if_dlink_type != datalink)) while (i && (i->if_dev != dev || i->if_dlink_type != datalink))
i = i->if_next; i = i->if_next;
...@@ -288,10 +286,10 @@ static ipx_interface *__ipxitf_find_using_phys(struct net_device *dev, ...@@ -288,10 +286,10 @@ static ipx_interface *__ipxitf_find_using_phys(struct net_device *dev,
return i; return i;
} }
static ipx_interface *ipxitf_find_using_phys(struct net_device *dev, static struct ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
unsigned short datalink) unsigned short datalink)
{ {
ipx_interface *i; struct ipx_interface *i;
spin_lock_bh(&ipx_interfaces_lock); spin_lock_bh(&ipx_interfaces_lock);
i = __ipxitf_find_using_phys(dev, datalink); i = __ipxitf_find_using_phys(dev, datalink);
...@@ -301,9 +299,9 @@ static ipx_interface *ipxitf_find_using_phys(struct net_device *dev, ...@@ -301,9 +299,9 @@ static ipx_interface *ipxitf_find_using_phys(struct net_device *dev,
return i; return i;
} }
static ipx_interface *ipxitf_find_using_net(__u32 net) static struct ipx_interface *ipxitf_find_using_net(__u32 net)
{ {
ipx_interface *i; struct ipx_interface *i;
spin_lock_bh(&ipx_interfaces_lock); spin_lock_bh(&ipx_interfaces_lock);
if (net) if (net)
...@@ -320,7 +318,7 @@ static ipx_interface *ipxitf_find_using_net(__u32 net) ...@@ -320,7 +318,7 @@ static ipx_interface *ipxitf_find_using_net(__u32 net)
} }
/* Sockets are bound to a particular IPX interface. */ /* Sockets are bound to a particular IPX interface. */
static void ipxitf_insert_socket(ipx_interface *intrfc, struct sock *sk) static void ipxitf_insert_socket(struct ipx_interface *intrfc, struct sock *sk)
{ {
ipxitf_hold(intrfc); ipxitf_hold(intrfc);
sock_hold(sk); sock_hold(sk);
...@@ -340,7 +338,7 @@ static void ipxitf_insert_socket(ipx_interface *intrfc, struct sock *sk) ...@@ -340,7 +338,7 @@ static void ipxitf_insert_socket(ipx_interface *intrfc, struct sock *sk)
} }
/* caller must hold intrfc->if_sklist_lock */ /* caller must hold intrfc->if_sklist_lock */
static struct sock *__ipxitf_find_socket(ipx_interface *intrfc, static struct sock *__ipxitf_find_socket(struct ipx_interface *intrfc,
unsigned short port) unsigned short port)
{ {
struct sock *s = intrfc->if_sklist; struct sock *s = intrfc->if_sklist;
...@@ -352,7 +350,7 @@ static struct sock *__ipxitf_find_socket(ipx_interface *intrfc, ...@@ -352,7 +350,7 @@ static struct sock *__ipxitf_find_socket(ipx_interface *intrfc,
} }
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static struct sock *ipxitf_find_socket(ipx_interface *intrfc, static struct sock *ipxitf_find_socket(struct ipx_interface *intrfc,
unsigned short port) unsigned short port)
{ {
struct sock *s; struct sock *s;
...@@ -367,8 +365,9 @@ static struct sock *ipxitf_find_socket(ipx_interface *intrfc, ...@@ -367,8 +365,9 @@ static struct sock *ipxitf_find_socket(ipx_interface *intrfc,
} }
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
static struct sock *ipxitf_find_internal_socket(ipx_interface *intrfc, static struct sock *ipxitf_find_internal_socket(struct ipx_interface *intrfc,
unsigned char *node, unsigned short port) unsigned char *node,
unsigned short port)
{ {
struct sock *s; struct sock *s;
...@@ -391,9 +390,9 @@ static struct sock *ipxitf_find_internal_socket(ipx_interface *intrfc, ...@@ -391,9 +390,9 @@ static struct sock *ipxitf_find_internal_socket(ipx_interface *intrfc,
} }
#endif #endif
static void ipxrtr_del_routes(ipx_interface *); static void ipxrtr_del_routes(struct ipx_interface *intrfc);
static void __ipxitf_down(ipx_interface *intrfc) static void __ipxitf_down(struct ipx_interface *intrfc)
{ {
struct sock *s, *t; struct sock *s, *t;
...@@ -421,7 +420,7 @@ static void __ipxitf_down(ipx_interface *intrfc) ...@@ -421,7 +420,7 @@ static void __ipxitf_down(ipx_interface *intrfc)
if (intrfc == ipx_interfaces) if (intrfc == ipx_interfaces)
ipx_interfaces = intrfc->if_next; ipx_interfaces = intrfc->if_next;
else { else {
ipx_interface *i = ipx_interfaces; struct ipx_interface *i = ipx_interfaces;
while (i && i->if_next != intrfc) while (i && i->if_next != intrfc)
i = i->if_next; i = i->if_next;
if (i && i->if_next == intrfc) if (i && i->if_next == intrfc)
...@@ -440,7 +439,7 @@ static void __ipxitf_down(ipx_interface *intrfc) ...@@ -440,7 +439,7 @@ static void __ipxitf_down(ipx_interface *intrfc)
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
} }
static void ipxitf_down(ipx_interface *intrfc) static void ipxitf_down(struct ipx_interface *intrfc)
{ {
spin_lock_bh(&ipx_interfaces_lock); spin_lock_bh(&ipx_interfaces_lock);
__ipxitf_down(intrfc); __ipxitf_down(intrfc);
...@@ -451,7 +450,7 @@ static int ipxitf_device_event(struct notifier_block *notifier, ...@@ -451,7 +450,7 @@ static int ipxitf_device_event(struct notifier_block *notifier,
unsigned long event, void *ptr) unsigned long event, void *ptr)
{ {
struct net_device *dev = ptr; struct net_device *dev = ptr;
ipx_interface *i, *tmp; struct ipx_interface *i, *tmp;
if (event != NETDEV_DOWN && event != NETDEV_UP) if (event != NETDEV_DOWN && event != NETDEV_UP)
goto out; goto out;
...@@ -484,10 +483,10 @@ static void ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb) ...@@ -484,10 +483,10 @@ static void ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb)
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
static int ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, static int ipxitf_demux_socket(struct ipx_interface *intrfc,
int copy) struct sk_buff *skb, int copy)
{ {
struct ipxhdr *ipx = skb->nh.ipxh; struct ipxhdr *ipx = ipx_hdr(skb);
int is_broadcast = !memcmp(ipx->ipx_dest.node, ipx_broadcast_node, int is_broadcast = !memcmp(ipx->ipx_dest.node, ipx_broadcast_node,
IPX_NODE_LEN); IPX_NODE_LEN);
struct sock *s; struct sock *s;
...@@ -532,7 +531,7 @@ out: spin_unlock_bh(&intrfc->if_sklist_lock); ...@@ -532,7 +531,7 @@ out: spin_unlock_bh(&intrfc->if_sklist_lock);
return ret; return ret;
} }
#else #else
static struct sock *ncp_connection_hack(ipx_interface *intrfc, static struct sock *ncp_connection_hack(struct ipx_interface *intrfc,
struct ipxhdr *ipx) struct ipxhdr *ipx)
{ {
/* The packet's target is a NCP connection handler. We want to hand it /* The packet's target is a NCP connection handler. We want to hand it
...@@ -566,10 +565,10 @@ static struct sock *ncp_connection_hack(ipx_interface *intrfc, ...@@ -566,10 +565,10 @@ static struct sock *ncp_connection_hack(ipx_interface *intrfc,
return sk; return sk;
} }
static int ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, static int ipxitf_demux_socket(struct ipx_interface *intrfc,
int copy) struct sk_buff *skb, int copy)
{ {
struct ipxhdr *ipx = skb->nh.ipxh; struct ipxhdr *ipx = ipx_hdr(skb);
struct sock *sock1 = NULL, *sock2 = NULL; struct sock *sock1 = NULL, *sock2 = NULL;
struct sk_buff *skb1 = NULL, *skb2 = NULL; struct sk_buff *skb1 = NULL, *skb2 = NULL;
int ret; int ret;
...@@ -651,11 +650,11 @@ out: if (sock1) ...@@ -651,11 +650,11 @@ out: if (sock1)
} }
#endif /* CONFIG_IPX_INTERN */ #endif /* CONFIG_IPX_INTERN */
static struct sk_buff *ipxitf_adjust_skbuff(ipx_interface *intrfc, static struct sk_buff *ipxitf_adjust_skbuff(struct ipx_interface *intrfc,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct sk_buff *skb2; struct sk_buff *skb2;
int in_offset = skb->h.raw - skb->head; int in_offset = (unsigned char *)ipx_hdr(skb) - skb->head;
int out_offset = intrfc->if_ipx_offset; int out_offset = intrfc->if_ipx_offset;
int len; int len;
...@@ -669,7 +668,7 @@ static struct sk_buff *ipxitf_adjust_skbuff(ipx_interface *intrfc, ...@@ -669,7 +668,7 @@ static struct sk_buff *ipxitf_adjust_skbuff(ipx_interface *intrfc,
if (skb2) { if (skb2) {
skb_reserve(skb2, out_offset); skb_reserve(skb2, out_offset);
skb2->nh.raw = skb2->h.raw = skb_put(skb2, skb->len); skb2->nh.raw = skb2->h.raw = skb_put(skb2, skb->len);
memcpy(skb2->h.raw, skb->h.raw, skb->len); memcpy(ipx_hdr(skb2), ipx_hdr(skb), skb->len);
memcpy(skb2->cb, skb->cb, sizeof(skb->cb)); memcpy(skb2->cb, skb->cb, sizeof(skb->cb));
} }
kfree_skb(skb); kfree_skb(skb);
...@@ -678,9 +677,10 @@ static struct sk_buff *ipxitf_adjust_skbuff(ipx_interface *intrfc, ...@@ -678,9 +677,10 @@ static struct sk_buff *ipxitf_adjust_skbuff(ipx_interface *intrfc,
/* caller must hold a reference to intrfc and the skb has to be unshared */ /* caller must hold a reference to intrfc and the skb has to be unshared */
static int ipxitf_send(ipx_interface *intrfc, struct sk_buff *skb, char *node) static int ipxitf_send(struct ipx_interface *intrfc, struct sk_buff *skb,
char *node)
{ {
struct ipxhdr *ipx = skb->nh.ipxh; struct ipxhdr *ipx = ipx_hdr(skb);
struct net_device *dev = intrfc->if_dev; struct net_device *dev = intrfc->if_dev;
struct datalink_proto *dl = intrfc->if_dlink; struct datalink_proto *dl = intrfc->if_dlink;
char dest_node[IPX_NODE_LEN]; char dest_node[IPX_NODE_LEN];
...@@ -784,21 +784,24 @@ static int ipxitf_send(ipx_interface *intrfc, struct sk_buff *skb, char *node) ...@@ -784,21 +784,24 @@ static int ipxitf_send(ipx_interface *intrfc, struct sk_buff *skb, char *node)
out: return 0; out: return 0;
} }
static int ipxrtr_add_route(__u32, ipx_interface *, unsigned char *); static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
unsigned char *);
static int ipxitf_add_local_route(ipx_interface *intrfc) static int ipxitf_add_local_route(struct ipx_interface *intrfc)
{ {
return ipxrtr_add_route(intrfc->if_netnum, intrfc, NULL); return ipxrtr_add_route(intrfc->if_netnum, intrfc, NULL);
} }
static const char * ipx_frame_name(unsigned short); static const char *ipx_frame_name(unsigned short);
static const char * ipx_device_name(ipx_interface *); static const char *ipx_device_name(struct ipx_interface *);
static void ipxitf_discover_netnum(ipx_interface *intrfc, struct sk_buff *skb); static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
static int ipxitf_pprop(ipx_interface *intrfc, struct sk_buff *skb); struct sk_buff *skb);
static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb);
static int ipxrtr_route_skb(struct sk_buff *skb);
static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb) static int ipxitf_rcv(struct ipx_interface *intrfc, struct sk_buff *skb)
{ {
struct ipxhdr *ipx = skb->nh.ipxh; struct ipxhdr *ipx = ipx_hdr(skb);
int ret = 0; int ret = 0;
ipxitf_hold(intrfc); ipxitf_hold(intrfc);
...@@ -850,13 +853,15 @@ static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb) ...@@ -850,13 +853,15 @@ static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb)
return ret; return ret;
} }
static void ipxitf_discover_netnum(ipx_interface *intrfc, struct sk_buff *skb) static void ipxitf_discover_netnum(struct ipx_interface *intrfc,
struct sk_buff *skb)
{ {
const struct ipx_cb *cb = IPX_SKB_CB(skb); const struct ipx_cb *cb = IPX_SKB_CB(skb);
/* see if this is an intra packet: source_net == dest_net */ /* see if this is an intra packet: source_net == dest_net */
if (cb->ipx_source_net == cb->ipx_dest_net && cb->ipx_source_net) { if (cb->ipx_source_net == cb->ipx_dest_net && cb->ipx_source_net) {
ipx_interface *i = ipxitf_find_using_net(cb->ipx_source_net); struct ipx_interface *i =
ipxitf_find_using_net(cb->ipx_source_net);
/* NB: NetWare servers lie about their hop count so we /* NB: NetWare servers lie about their hop count so we
* dropped the test based on it. This is the best way * dropped the test based on it. This is the best way
* to determine this is a 0 hop count packet. */ * to determine this is a 0 hop count packet. */
...@@ -900,11 +905,11 @@ static void ipxitf_discover_netnum(ipx_interface *intrfc, struct sk_buff *skb) ...@@ -900,11 +905,11 @@ static void ipxitf_discover_netnum(ipx_interface *intrfc, struct sk_buff *skb)
* Returns -EINVAL for invalid packets, so that the calling function drops * Returns -EINVAL for invalid packets, so that the calling function drops
* the packet without local processing. 0 if packet is to be locally processed. * the packet without local processing. 0 if packet is to be locally processed.
*/ */
static int ipxitf_pprop(ipx_interface *intrfc, struct sk_buff *skb) static int ipxitf_pprop(struct ipx_interface *intrfc, struct sk_buff *skb)
{ {
struct ipxhdr *ipx = skb->nh.ipxh; struct ipxhdr *ipx = ipx_hdr(skb);
int i, ret = -EINVAL; int i, ret = -EINVAL;
ipx_interface *ifcs; struct ipx_interface *ifcs;
char *c; char *c;
u32 *l; u32 *l;
...@@ -968,14 +973,14 @@ static int ipxitf_pprop(ipx_interface *intrfc, struct sk_buff *skb) ...@@ -968,14 +973,14 @@ static int ipxitf_pprop(ipx_interface *intrfc, struct sk_buff *skb)
out: return ret; out: return ret;
} }
static void ipxitf_insert(ipx_interface *intrfc) static void ipxitf_insert(struct ipx_interface *intrfc)
{ {
intrfc->if_next = NULL; intrfc->if_next = NULL;
spin_lock_bh(&ipx_interfaces_lock); spin_lock_bh(&ipx_interfaces_lock);
if (!ipx_interfaces) if (!ipx_interfaces)
ipx_interfaces = intrfc; ipx_interfaces = intrfc;
else { else {
ipx_interface *i = ipx_interfaces; struct ipx_interface *i = ipx_interfaces;
while (i->if_next) while (i->if_next)
i = i->if_next; i = i->if_next;
i->if_next = intrfc; i->if_next = intrfc;
...@@ -986,12 +991,13 @@ static void ipxitf_insert(ipx_interface *intrfc) ...@@ -986,12 +991,13 @@ static void ipxitf_insert(ipx_interface *intrfc)
ipx_primary_net = intrfc; ipx_primary_net = intrfc;
} }
static ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum,
unsigned short dlink_type, unsigned short dlink_type,
struct datalink_proto *dlink, struct datalink_proto *dlink,
unsigned char internal, int ipx_offset) unsigned char internal,
int ipx_offset)
{ {
ipx_interface *intrfc = kmalloc(sizeof(*intrfc), GFP_ATOMIC); struct ipx_interface *intrfc = kmalloc(sizeof(*intrfc), GFP_ATOMIC);
if (intrfc) { if (intrfc) {
intrfc->if_dev = dev; intrfc->if_dev = dev;
...@@ -1010,9 +1016,9 @@ static ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, ...@@ -1010,9 +1016,9 @@ static ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum,
return intrfc; return intrfc;
} }
static int ipxitf_create_internal(ipx_interface_definition *idef) static int ipxitf_create_internal(struct ipx_interface_definition *idef)
{ {
ipx_interface *intrfc; struct ipx_interface *intrfc;
int ret = -EEXIST; int ret = -EEXIST;
/* Only one primary network allowed */ /* Only one primary network allowed */
...@@ -1061,12 +1067,12 @@ static int ipx_map_frame_type(unsigned char type) ...@@ -1061,12 +1067,12 @@ static int ipx_map_frame_type(unsigned char type)
return ret; return ret;
} }
static int ipxitf_create(ipx_interface_definition *idef) static int ipxitf_create(struct ipx_interface_definition *idef)
{ {
struct net_device *dev; struct net_device *dev;
unsigned short dlink_type = 0; unsigned short dlink_type = 0;
struct datalink_proto *datalink = NULL; struct datalink_proto *datalink = NULL;
ipx_interface *intrfc; struct ipx_interface *intrfc;
int err; int err;
if (idef->ipx_special == IPX_INTERNAL) { if (idef->ipx_special == IPX_INTERNAL) {
...@@ -1173,11 +1179,11 @@ static int ipxitf_create(ipx_interface_definition *idef) ...@@ -1173,11 +1179,11 @@ static int ipxitf_create(ipx_interface_definition *idef)
out: return err; out: return err;
} }
static int ipxitf_delete(ipx_interface_definition *idef) static int ipxitf_delete(struct ipx_interface_definition *idef)
{ {
struct net_device *dev = NULL; struct net_device *dev = NULL;
unsigned short dlink_type = 0; unsigned short dlink_type = 0;
ipx_interface *intrfc; struct ipx_interface *intrfc;
int ret = 0; int ret = 0;
spin_lock_bh(&ipx_interfaces_lock); spin_lock_bh(&ipx_interfaces_lock);
...@@ -1211,10 +1217,10 @@ out: spin_unlock_bh(&ipx_interfaces_lock); ...@@ -1211,10 +1217,10 @@ out: spin_unlock_bh(&ipx_interfaces_lock);
return ret; return ret;
} }
static ipx_interface *ipxitf_auto_create(struct net_device *dev, static struct ipx_interface *ipxitf_auto_create(struct net_device *dev,
unsigned short dlink_type) unsigned short dlink_type)
{ {
ipx_interface *intrfc = NULL; struct ipx_interface *intrfc = NULL;
struct datalink_proto *datalink; struct datalink_proto *datalink;
if (!dev) if (!dev)
...@@ -1269,7 +1275,7 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg) ...@@ -1269,7 +1275,7 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg)
switch (cmd) { switch (cmd) {
case SIOCSIFADDR: { case SIOCSIFADDR: {
struct sockaddr_ipx *sipx; struct sockaddr_ipx *sipx;
ipx_interface_definition f; struct ipx_interface_definition f;
if (copy_from_user(&ifr, arg, sizeof(ifr))) if (copy_from_user(&ifr, arg, sizeof(ifr)))
return -EFAULT; return -EFAULT;
...@@ -1294,7 +1300,7 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg) ...@@ -1294,7 +1300,7 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg)
case SIOCGIFADDR: { case SIOCGIFADDR: {
int err = 0; int err = 0;
struct sockaddr_ipx *sipx; struct sockaddr_ipx *sipx;
ipx_interface *ipxif; struct ipx_interface *ipxif;
struct net_device *dev; struct net_device *dev;
if (copy_from_user(&ifr, arg, sizeof(ifr))) if (copy_from_user(&ifr, arg, sizeof(ifr)))
...@@ -1341,20 +1347,20 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg) ...@@ -1341,20 +1347,20 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg)
/* Routing tables for the IPX socket layer. */ /* Routing tables for the IPX socket layer. */
static inline void ipxrtr_hold(ipx_route *rt) static __inline__ void ipxrtr_hold(struct ipx_route *rt)
{ {
atomic_inc(&rt->refcnt); atomic_inc(&rt->refcnt);
} }
static inline void ipxrtr_put(ipx_route *rt) static __inline__ void ipxrtr_put(struct ipx_route *rt)
{ {
if (atomic_dec_and_test(&rt->refcnt)) if (atomic_dec_and_test(&rt->refcnt))
kfree(rt); kfree(rt);
} }
static ipx_route *ipxrtr_lookup(__u32 net) static struct ipx_route *ipxrtr_lookup(__u32 net)
{ {
ipx_route *r; struct ipx_route *r;
read_lock_bh(&ipx_routes_lock); read_lock_bh(&ipx_routes_lock);
for (r = ipx_routes; r && r->ir_net != net; r = r->ir_next) for (r = ipx_routes; r && r->ir_net != net; r = r->ir_next)
...@@ -1368,16 +1374,16 @@ static ipx_route *ipxrtr_lookup(__u32 net) ...@@ -1368,16 +1374,16 @@ static ipx_route *ipxrtr_lookup(__u32 net)
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static int ipxrtr_add_route(__u32 network, ipx_interface *intrfc, static int ipxrtr_add_route(__u32 network, struct ipx_interface *intrfc,
unsigned char *node) unsigned char *node)
{ {
ipx_route *rt; struct ipx_route *rt;
int ret; int ret;
/* Get a route structure; either existing or create */ /* Get a route structure; either existing or create */
rt = ipxrtr_lookup(network); rt = ipxrtr_lookup(network);
if (!rt) { if (!rt) {
rt = kmalloc(sizeof(ipx_route), GFP_ATOMIC); rt = kmalloc(sizeof(*rt), GFP_ATOMIC);
ret = -EAGAIN; ret = -EAGAIN;
if (!rt) if (!rt)
goto out; goto out;
...@@ -1410,9 +1416,9 @@ static int ipxrtr_add_route(__u32 network, ipx_interface *intrfc, ...@@ -1410,9 +1416,9 @@ static int ipxrtr_add_route(__u32 network, ipx_interface *intrfc,
out: return ret; out: return ret;
} }
static void ipxrtr_del_routes(ipx_interface *intrfc) static void ipxrtr_del_routes(struct ipx_interface *intrfc)
{ {
ipx_route **r, *tmp; struct ipx_route **r, *tmp;
write_lock_bh(&ipx_routes_lock); write_lock_bh(&ipx_routes_lock);
for (r = &ipx_routes; (tmp = *r) != NULL;) { for (r = &ipx_routes; (tmp = *r) != NULL;) {
...@@ -1425,9 +1431,9 @@ static void ipxrtr_del_routes(ipx_interface *intrfc) ...@@ -1425,9 +1431,9 @@ static void ipxrtr_del_routes(ipx_interface *intrfc)
write_unlock_bh(&ipx_routes_lock); write_unlock_bh(&ipx_routes_lock);
} }
static int ipxrtr_create(ipx_route_definition *rd) static int ipxrtr_create(struct ipx_route_definition *rd)
{ {
ipx_interface *intrfc; struct ipx_interface *intrfc;
int ret = -ENETUNREACH; int ret = -ENETUNREACH;
/* Find the appropriate interface */ /* Find the appropriate interface */
...@@ -1441,8 +1447,8 @@ out: return ret; ...@@ -1441,8 +1447,8 @@ out: return ret;
static int ipxrtr_delete(long net) static int ipxrtr_delete(long net)
{ {
ipx_route **r; struct ipx_route **r;
ipx_route *tmp; struct ipx_route *tmp;
int err; int err;
write_lock_bh(&ipx_routes_lock); write_lock_bh(&ipx_routes_lock);
...@@ -1513,11 +1519,11 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, ...@@ -1513,11 +1519,11 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct ipx_opt *ipxs = ipx_sk(sk); struct ipx_opt *ipxs = ipx_sk(sk);
ipx_interface *intrfc; struct ipx_interface *intrfc;
struct ipxhdr *ipx; struct ipxhdr *ipx;
int size; int size;
int ipx_offset; int ipx_offset;
ipx_route *rt = NULL; struct ipx_route *rt = NULL;
int err; int err;
/* Find the appropriate interface on which to send packet */ /* Find the appropriate interface on which to send packet */
...@@ -1544,11 +1550,11 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, ...@@ -1544,11 +1550,11 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx,
skb->sk = sk; skb->sk = sk;
/* Fill in IPX header */ /* Fill in IPX header */
ipx = (struct ipxhdr *)skb_put(skb, sizeof(struct ipxhdr)); skb->h.raw = skb->nh.raw = skb_put(skb, sizeof(struct ipxhdr));
ipx = ipx_hdr(skb);
ipx->ipx_pktsize = htons(len + sizeof(struct ipxhdr)); ipx->ipx_pktsize = htons(len + sizeof(struct ipxhdr));
IPX_SKB_CB(skb)->ipx_tctrl = 0; IPX_SKB_CB(skb)->ipx_tctrl = 0;
ipx->ipx_type = usipx->sipx_type; ipx->ipx_type = usipx->sipx_type;
skb->h.raw = (void *)skb->nh.ipxh = ipx;
IPX_SKB_CB(skb)->last_hop.index = -1; IPX_SKB_CB(skb)->last_hop.index = -1;
#ifdef CONFIG_IPX_INTERN #ifdef CONFIG_IPX_INTERN
...@@ -1596,8 +1602,8 @@ out: return err; ...@@ -1596,8 +1602,8 @@ out: return err;
* modify the packet */ * modify the packet */
int ipxrtr_route_skb(struct sk_buff *skb) int ipxrtr_route_skb(struct sk_buff *skb)
{ {
struct ipxhdr *ipx = skb->nh.ipxh; struct ipxhdr *ipx = ipx_hdr(skb);
ipx_route *r = ipxrtr_lookup(IPX_SKB_CB(skb)->ipx_dest_net); struct ipx_route *r = ipxrtr_lookup(IPX_SKB_CB(skb)->ipx_dest_net);
if (!r) { /* no known route */ if (!r) { /* no known route */
kfree_skb(skb); kfree_skb(skb);
...@@ -1666,7 +1672,7 @@ static const char *ipx_frame_name(unsigned short frame) ...@@ -1666,7 +1672,7 @@ static const char *ipx_frame_name(unsigned short frame)
return ret; return ret;
} }
static const char *ipx_device_name(ipx_interface *intrfc) static const char *ipx_device_name(struct ipx_interface *intrfc)
{ {
return intrfc->if_internal ? "Internal" : return intrfc->if_internal ? "Internal" :
intrfc->if_dev ? intrfc->if_dev->name : "Unknown"; intrfc->if_dev ? intrfc->if_dev->name : "Unknown";
...@@ -1676,7 +1682,7 @@ static const char *ipx_device_name(ipx_interface *intrfc) ...@@ -1676,7 +1682,7 @@ static const char *ipx_device_name(ipx_interface *intrfc)
static int ipx_interface_get_info(char *buffer, char **start, off_t offset, static int ipx_interface_get_info(char *buffer, char **start, off_t offset,
int length) int length)
{ {
ipx_interface *i; struct ipx_interface *i;
off_t begin = 0, pos = 0; off_t begin = 0, pos = 0;
int len = 0; int len = 0;
...@@ -1728,7 +1734,7 @@ static int ipx_interface_get_info(char *buffer, char **start, off_t offset, ...@@ -1728,7 +1734,7 @@ static int ipx_interface_get_info(char *buffer, char **start, off_t offset,
static int ipx_get_info(char *buffer, char **start, off_t offset, int length) static int ipx_get_info(char *buffer, char **start, off_t offset, int length)
{ {
struct sock *s; struct sock *s;
ipx_interface *i; struct ipx_interface *i;
off_t begin = 0, pos = 0; off_t begin = 0, pos = 0;
int len = 0; int len = 0;
...@@ -1808,7 +1814,7 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1808,7 +1814,7 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, int length)
static int ipx_rt_get_info(char *buffer, char **start, off_t offset, int length) static int ipx_rt_get_info(char *buffer, char **start, off_t offset, int length)
{ {
ipx_route *rt; struct ipx_route *rt;
off_t begin = 0, pos = 0; off_t begin = 0, pos = 0;
int len = 0; int len = 0;
...@@ -1927,17 +1933,11 @@ static int ipx_create(struct socket *sock, int protocol) ...@@ -1927,17 +1933,11 @@ static int ipx_create(struct socket *sock, int protocol)
case SOCK_SEQPACKET: case SOCK_SEQPACKET:
/* /*
* From this point on SPX sockets are handled * SPX support is not anymore in the kernel sources. If
* by af_spx.c and the methods replaced. * you want to ressurrect it, completing it and making
* it understand shared skbs, be fully multithreaded,
* etc, grab the sources in an early 2.5 kernel tree.
*/ */
down_read(&spx_family_ops_lock);
if (spx_family_ops) {
ret = spx_family_ops->create(sock, protocol);
up_read(&spx_family_ops_lock);
goto decmod;
}
up_read(&spx_family_ops_lock);
/* Fall through if SPX is not loaded */
case SOCK_STREAM: /* Allow higher levels to piggyback */ case SOCK_STREAM: /* Allow higher levels to piggyback */
default: default:
goto decmod; goto decmod;
...@@ -1978,7 +1978,7 @@ out: return 0; ...@@ -1978,7 +1978,7 @@ out: return 0;
/* caller must hold a reference to intrfc */ /* caller must hold a reference to intrfc */
static unsigned short ipx_first_free_socketnum(ipx_interface *intrfc) static unsigned short ipx_first_free_socketnum(struct ipx_interface *intrfc)
{ {
unsigned short socketNum = intrfc->if_sknum; unsigned short socketNum = intrfc->if_sknum;
...@@ -2003,7 +2003,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -2003,7 +2003,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct ipx_opt *ipxs = ipx_sk(sk); struct ipx_opt *ipxs = ipx_sk(sk);
ipx_interface *intrfc; struct ipx_interface *intrfc;
struct sockaddr_ipx *addr = (struct sockaddr_ipx *)uaddr; struct sockaddr_ipx *addr = (struct sockaddr_ipx *)uaddr;
int ret = -EINVAL; int ret = -EINVAL;
...@@ -2101,7 +2101,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -2101,7 +2101,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr,
struct ipx_opt *ipxs = ipx_sk(sk); struct ipx_opt *ipxs = ipx_sk(sk);
struct sockaddr_ipx *addr; struct sockaddr_ipx *addr;
int ret = -EINVAL; int ret = -EINVAL;
ipx_route *rt; struct ipx_route *rt;
sk->state = TCP_CLOSE; sk->state = TCP_CLOSE;
sock->state = SS_UNCONNECTED; sock->state = SS_UNCONNECTED;
...@@ -2158,7 +2158,7 @@ out: return ret; ...@@ -2158,7 +2158,7 @@ out: return ret;
static int ipx_getname(struct socket *sock, struct sockaddr *uaddr, static int ipx_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer) int *uaddr_len, int peer)
{ {
ipx_address *addr; struct ipx_address *addr;
struct sockaddr_ipx sipx; struct sockaddr_ipx sipx;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct ipx_opt *ipxs = ipx_sk(sk); struct ipx_opt *ipxs = ipx_sk(sk);
...@@ -2204,7 +2204,7 @@ out: return ret; ...@@ -2204,7 +2204,7 @@ out: return ret;
int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
{ {
/* NULL here for pt means the packet was looped back */ /* NULL here for pt means the packet was looped back */
ipx_interface *intrfc; struct ipx_interface *intrfc;
struct ipxhdr *ipx; struct ipxhdr *ipx;
u16 ipx_pktsize; u16 ipx_pktsize;
int ret = 0; int ret = 0;
...@@ -2216,7 +2216,7 @@ int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) ...@@ -2216,7 +2216,7 @@ int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
goto out; goto out;
ipx = skb->nh.ipxh; ipx = ipx_hdr(skb);
ipx_pktsize = ntohs(ipx->ipx_pktsize); ipx_pktsize = ntohs(ipx->ipx_pktsize);
/* Too small or invalid header? */ /* Too small or invalid header? */
...@@ -2352,7 +2352,7 @@ static int ipx_recvmsg(struct socket *sock, struct msghdr *msg, int size, ...@@ -2352,7 +2352,7 @@ static int ipx_recvmsg(struct socket *sock, struct msghdr *msg, int size,
if (!skb) if (!skb)
goto out; goto out;
ipx = skb->nh.ipxh; ipx = ipx_hdr(skb);
copied = ntohs(ipx->ipx_pktsize) - sizeof(struct ipxhdr); copied = ntohs(ipx->ipx_pktsize) - sizeof(struct ipxhdr);
if (copied > size) { if (copied > size) {
copied = size; copied = size;
...@@ -2461,64 +2461,33 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -2461,64 +2461,33 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
return 0; return 0;
} }
/*
* SPX interface support
*/
int ipx_register_spx(struct proto_ops **p, struct net_proto_family *spx)
{
int err;
err = -EBUSY;
down_write(&spx_family_ops_lock);
if (!spx_family_ops) {
MOD_INC_USE_COUNT;
*p = &ipx_dgram_ops;
spx_family_ops = spx;
}
up_write(&spx_family_ops_lock);
return 0;
}
int ipx_unregister_spx(void)
{
down_write(&spx_family_ops_lock);
if (spx_family_ops) {
spx_family_ops = NULL;
MOD_DEC_USE_COUNT;
}
up_write(&spx_family_ops_lock);
return 0;
}
/* /*
* Socket family declarations * Socket family declarations
*/ */
static struct net_proto_family ipx_family_ops = { static struct net_proto_family ipx_family_ops = {
.family = PF_IPX, .family = PF_IPX,
.create = ipx_create, .create = ipx_create,
}; };
static struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = { static struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
.family = PF_IPX, .family = PF_IPX,
.release = ipx_release,
.release = ipx_release, .bind = ipx_bind,
.bind = ipx_bind, .connect = ipx_connect,
.connect = ipx_connect, .socketpair = sock_no_socketpair,
.socketpair = sock_no_socketpair, .accept = sock_no_accept,
.accept = sock_no_accept, .getname = ipx_getname,
.getname = ipx_getname, .poll = datagram_poll,
.poll = datagram_poll, .ioctl = ipx_ioctl,
.ioctl = ipx_ioctl, .listen = sock_no_listen,
.listen = sock_no_listen, .shutdown = sock_no_shutdown, /* FIXME: support shutdown */
.shutdown = sock_no_shutdown, /* FIXME: have to support shutdown */ .setsockopt = ipx_setsockopt,
.setsockopt = ipx_setsockopt, .getsockopt = ipx_getsockopt,
.getsockopt = ipx_getsockopt, .sendmsg = ipx_sendmsg,
.sendmsg = ipx_sendmsg, .recvmsg = ipx_recvmsg,
.recvmsg = ipx_recvmsg, .mmap = sock_no_mmap,
.mmap = sock_no_mmap, .sendpage = sock_no_sendpage,
.sendpage = sock_no_sendpage,
}; };
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
...@@ -2540,7 +2509,6 @@ static struct notifier_block ipx_dev_notifier = { ...@@ -2540,7 +2509,6 @@ static struct notifier_block ipx_dev_notifier = {
.notifier_call =ipxitf_device_event, .notifier_call =ipxitf_device_event,
}; };
extern struct datalink_proto *make_EII_client(void); extern struct datalink_proto *make_EII_client(void);
extern struct datalink_proto *make_8023_client(void); extern struct datalink_proto *make_8023_client(void);
extern void destroy_EII_client(struct datalink_proto *); extern void destroy_EII_client(struct datalink_proto *);
...@@ -2549,9 +2517,13 @@ extern void destroy_8023_client(struct datalink_proto *); ...@@ -2549,9 +2517,13 @@ extern void destroy_8023_client(struct datalink_proto *);
static unsigned char ipx_8022_type = 0xE0; static unsigned char ipx_8022_type = 0xE0;
static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 }; static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 };
static char ipx_banner[] __initdata = static char ipx_banner[] __initdata =
KERN_INFO "NET4: Linux IPX 0.48 for NET4.0\n" KERN_INFO "NET4: Linux IPX 0.49 for NET4.0\n"
KERN_INFO "IPX Portions Copyright (c) 1995 Caldera, Inc.\n" \ KERN_INFO "IPX Portions Copyright (c) 1995 Caldera, Inc.\n" \
KERN_INFO "IPX Portions Copyright (c) 2000, 2001 Conectiva, Inc.\n"; KERN_INFO "IPX Portions Copyright (c) 2000, 2001 Conectiva, Inc.\n";
static char ipx_EII_err_msg[] __initdata =
KERN_CRIT "IPX: Unable to register with Ethernet II\n";
static char ipx_8023_err_msg[] __initdata =
KERN_CRIT "IPX: Unable to register with 802.3\n";
static char ipx_llc_err_msg[] __initdata = static char ipx_llc_err_msg[] __initdata =
KERN_CRIT "IPX: Unable to register with 802.2\n"; KERN_CRIT "IPX: Unable to register with 802.2\n";
static char ipx_snap_err_msg[] __initdata = static char ipx_snap_err_msg[] __initdata =
...@@ -2562,10 +2534,16 @@ static int __init ipx_init(void) ...@@ -2562,10 +2534,16 @@ static int __init ipx_init(void)
sock_register(&ipx_family_ops); sock_register(&ipx_family_ops);
pEII_datalink = make_EII_client(); pEII_datalink = make_EII_client();
dev_add_pack(&ipx_dix_packet_type); if (pEII_datalink)
dev_add_pack(&ipx_dix_packet_type);
else
printk(ipx_EII_err_msg);
p8023_datalink = make_8023_client(); p8023_datalink = make_8023_client();
dev_add_pack(&ipx_8023_packet_type); if (p8023_datalink)
dev_add_pack(&ipx_8023_packet_type);
else
printk(ipx_8023_err_msg);
p8022_datalink = register_8022_client(ipx_8022_type, ipx_rcv); p8022_datalink = register_8022_client(ipx_8022_type, ipx_rcv);
if (!p8022_datalink) if (!p8022_datalink)
...@@ -2588,26 +2566,6 @@ static int __init ipx_init(void) ...@@ -2588,26 +2566,6 @@ static int __init ipx_init(void)
module_init(ipx_init); module_init(ipx_init);
/* Higher layers need this info to prep tx pkts */
int ipx_if_offset(unsigned long ipx_net_number)
{
ipx_route *rt = ipxrtr_lookup(ipx_net_number);
int ret = -ENETUNREACH;
if (!rt)
goto out;
ret = rt->ir_intrfc->if_ipx_offset;
ipxrtr_put(rt);
out: return ret;
}
/* Export symbols for higher layers */
EXPORT_SYMBOL(ipxrtr_route_skb);
EXPORT_SYMBOL(ipx_if_offset);
EXPORT_SYMBOL(ipx_remove_socket);
EXPORT_SYMBOL(ipx_register_spx);
EXPORT_SYMBOL(ipx_unregister_spx);
/* Note on MOD_{INC,DEC}_USE_COUNT: /* Note on MOD_{INC,DEC}_USE_COUNT:
* *
* Use counts are incremented/decremented when * Use counts are incremented/decremented when
......
/*
* This module implements the (SPP-derived) Sequenced Packet eXchange
* (SPX) protocol for Linux 2.1.X as specified in
* NetWare SPX Services Specification, Semantics and API
* Revision: 1.00
* Revision Date: February 9, 1993
*
* Developers:
* Jay Schulist <jschlst@samba.org>
* Jim Freeman <jfree@caldera.com>
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* Changes:
* Alan Cox : Fixed an skb_unshare check for NULL
* that crashed it under load. Renamed and
* made static the ipx ops. Removed the hack
* ipx methods interface. Dropped AF_SPX - its
* the wrong abstraction.
* Eduardo Trapani : Added a check for the return value of
* ipx_if_offset that crashed sock_alloc_send_skb.
* Added spx_datagram_poll() so that select()
* works now on SPX sockets. Added updating
* of the alloc count to follow rmt_seq.
* Arnaldo C. Melo : Use a private slabcache for the old tp_pinfo
* struct sock member, use spx_sk and ipx_sk
* Arnaldo C. Melo : Big CodingStyle cleanup, fixes some lock leaks,
* removes a leftover of the slabcache patch.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* None of the authors or maintainers or their employers admit
* liability nor provide warranty for any of this software.
* This material is provided "as is" and at no charge.
*/
#include <linux/module.h>
#include <net/ipx.h>
#include <net/spx.h>
#include <net/tcp.h>
#include <net/sock.h>
#include <asm/byteorder.h>
#include <asm/uaccess.h>
#include <linux/uio.h>
#include <linux/unistd.h>
#include <linux/poll.h>
static struct proto_ops *ipx_ops;
static struct proto_ops spx_ops;
static __u16 connids;
/* Functions needed for SPX connection start up */
static int spx_transmit(struct sock *sk,struct sk_buff *skb,int type,int len);
static void spx_retransmit(unsigned long data);
static void spx_watchdog(unsigned long data);
void spx_rcv(struct sock *sk, int bytes);
extern void ipx_remove_socket(struct sock *sk);
/* Datagram poll: the same code as datagram_poll() in net/core
but the right spx buffers are looked at and
there is no question on the type of the socket
*/
static unsigned int spx_datagram_poll(struct file * file, struct socket *sock,
poll_table *wait)
{
struct sock *sk = sock->sk;
struct spx_opt *pdata = spx_sk(sk);
unsigned int mask;
poll_wait(file, sk->sleep, wait);
mask = 0;
/* exceptional events? */
if (sk->err || !skb_queue_empty(&sk->error_queue))
mask |= POLLERR;
if (sk->shutdown & RCV_SHUTDOWN)
mask |= POLLHUP;
/* readable? */
if (!skb_queue_empty(&pdata->rcv_queue))
mask |= POLLIN | POLLRDNORM;
/* Need to check for termination and startup */
if (sk->state==TCP_CLOSE)
mask |= POLLHUP;
/* connection hasn't started yet? */
if (sk->state == TCP_SYN_SENT)
goto out;
/* writable? */
if (sock_writeable(sk))
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
else
set_bit(SOCK_ASYNC_NOSPACE,&sk->socket->flags);
out: return mask;
}
/* Create the SPX specific data */
static int spx_sock_init(struct sock *sk)
{
struct spx_opt *pdata = spx_sk(sk);
pdata->state = SPX_CLOSED;
pdata->sequence = 0;
pdata->acknowledge = 0;
pdata->source_connid = htons(connids);
pdata->rmt_seq = 0;
connids++;
pdata->owner = (void *)sk;
pdata->sndbuf = sk->sndbuf;
pdata->watchdog.function = spx_watchdog;
pdata->watchdog.data = (unsigned long)sk;
pdata->wd_interval = VERIFY_TIMEOUT;
pdata->retransmit.function = spx_retransmit;
pdata->retransmit.data = (unsigned long)sk;
pdata->retransmits = 0;
pdata->retries = 0;
pdata->max_retries = RETRY_COUNT;
skb_queue_head_init(&pdata->rcv_queue);
skb_queue_head_init(&pdata->transmit_queue);
skb_queue_head_init(&pdata->retransmit_queue);
return 0;
}
static int spx_create(struct socket *sock, int protocol)
{
struct sock *sk;
int rc = -ENOMEM;
MOD_INC_USE_COUNT;
/* Called on connection receive so cannot be GFP_KERNEL */
sk = sk_alloc(PF_IPX, GFP_ATOMIC, 1);
if (!sk)
goto decmod;
rc = -ESOCKTNOSUPPORT;
switch (sock->type) {
case SOCK_SEQPACKET:
sock->ops = &spx_ops;
break;
default:
sk_free(sk);
goto out;
}
rc = 0;
sock_init_data(sock, sk);
spx_sock_init(sk);
sk->data_ready = spx_rcv;
sk->destruct = NULL;
sk->no_check = 1;
out: return rc;
decmod: MOD_DEC_USE_COUNT;
goto out;
}
void spx_close_socket(struct sock *sk)
{
struct spx_opt *pdata = spx_sk(sk);
pdata->state = SPX_CLOSED;
sk->state = TCP_CLOSE;
del_timer(&pdata->retransmit);
del_timer(&pdata->watchdog);
}
void spx_destroy_socket(struct sock *sk)
{
struct spx_opt *pdata = spx_sk(sk);
ipx_remove_socket(sk);
skb_queue_purge(&sk->receive_queue);
skb_queue_purge(&pdata->transmit_queue);
skb_queue_purge(&pdata->retransmit_queue);
skb_queue_purge(&pdata->rcv_queue);
sk_free(sk);
MOD_DEC_USE_COUNT;
}
/* Release an SPX socket */
static int spx_release(struct socket *sock)
{
struct sock *sk = sock->sk;
struct spx_opt *pdata = spx_sk(sk);
if (!sk)
goto out;
if (!sk->dead)
sk->state_change(sk);
sk->dead = 1;
if (pdata->state != SPX_CLOSED) {
spx_transmit(sk, NULL, DISCON, 0);
spx_close_socket(sk);
}
sock->sk = NULL;
sk->socket = NULL;
spx_destroy_socket(sk);
out: return 0;
}
/* Move a socket into listening state. */
static int spx_listen(struct socket *sock, int backlog)
{
struct sock *sk = sock->sk;
int rc = -EINVAL;
if (sock->state != SS_UNCONNECTED)
goto out;
rc = -EOPNOTSUPP;
if (sock->type != SOCK_SEQPACKET)
goto out;
rc = -EAGAIN;
if (sk->zapped)
goto out;
rc = 0;
sk->max_ack_backlog = backlog;
if (sk->state != TCP_LISTEN) {
sk->ack_backlog = 0;
sk->state = TCP_LISTEN;
}
sk->socket->flags |= __SO_ACCEPTCON;
out: return rc;
}
/* Accept a pending SPX connection */
static int spx_accept(struct socket *sock, struct socket *newsock, int flags)
{
struct sock *sk = sock->sk;
struct sock *newsk;
struct sk_buff *skb;
int rc = -EINVAL;
if (!sk || sk->state != TCP_LISTEN ||
sock->state != SS_UNCONNECTED || !(sock->flags & __SO_ACCEPTCON))
goto out;
rc = -EOPNOTSUPP;
if (sock->type != SOCK_SEQPACKET)
goto out;
cli();
do {
skb = skb_dequeue(&sk->receive_queue);
if (!skb) {
rc = -EWOULDBLOCK;
if (flags & O_NONBLOCK)
goto out_unlock;
interruptible_sleep_on(sk->sleep);
rc = -ERESTARTSYS;
if (signal_pending(current))
goto out_unlock;
}
} while (!skb);
newsk = skb->sk;
newsk->pair = NULL;
sti();
rc = spx_transmit(newsk, skb, CONACK, 0); /* Connection ACK */
if (rc)
goto out;
/* Now attach up the new socket */
sock->sk = NULL;
sk->ack_backlog--;
newsock->sk = newsk;
newsk->state = TCP_ESTABLISHED;
ipx_sk(newsk)->dest_addr = spx_sk(newsk)->dest_addr;
out: return rc;
out_unlock:
sti();
goto out;
}
/* Build a connection to an SPX socket */
static int spx_connect(struct socket *sock, struct sockaddr *uaddr,
int addr_len, int flags)
{
struct sock *sk = sock->sk;
struct spx_opt *pdata = spx_sk(sk);
struct sockaddr_ipx src;
struct sk_buff *skb;
int size = sizeof(src);
int rc = ipx_ops->getname(sock, (struct sockaddr *)&src, &size, 0);
if (rc)
goto out;
pdata->source_addr.net = src.sipx_network;
memcpy(pdata->source_addr.node, src.sipx_node, IPX_NODE_LEN);
pdata->source_addr.sock = (unsigned short)src.sipx_port;
rc = ipx_ops->connect(sock, uaddr, addr_len, flags);
if (rc)
goto out;
pdata->dest_addr = ipx_sk(sk)->dest_addr;
pdata->state = SPX_CONNECTING;
sock->state = SS_CONNECTING;
sk->state = TCP_SYN_SENT;
/* Send Connection request */
rc = spx_transmit(sk, NULL, CONREQ, 0);
if (rc)
goto out;
cli();
do {
skb = skb_dequeue(&sk->receive_queue);
if (!skb) {
rc = -EWOULDBLOCK;
if (flags & O_NONBLOCK)
goto unlock;
interruptible_sleep_on(sk->sleep);
rc = -ERESTARTSYS;
if (signal_pending(current))
goto unlock;
}
} while (!skb);
rc = -ETIMEDOUT;
if (pdata->state == SPX_CLOSED) {
del_timer(&pdata->watchdog);
goto unlock;
}
rc = 0;
sock->state = SS_CONNECTED;
sk->state = TCP_ESTABLISHED;
kfree_skb(skb);
unlock: sti();
out: return rc;
}
/*
* Calculate the timeout for a packet. Thankfully SPX has a large
* fudge factor (3/4 secs) and does not pay much attention to RTT.
* As we simply have a default retry time of 1*HZ and a max retry
* time of 5*HZ. Between those values we increase the timeout based
* on the number of retransmit tries.
*
* FixMe: This is quite fake, but will work for now. (JS)
*/
static inline unsigned long spx_calc_rtt(int tries)
{
int rc;
if (tries < 1)
rc = RETRY_TIME;
else if (tries > 5)
rc = MAX_RETRY_DELAY;
else
rc = tries * HZ;
return rc;
}
static int spx_route_skb(struct spx_opt *pdata, struct sk_buff *skb, int type)
{
int rc = -ENOBUFS;
skb = skb_unshare(skb, GFP_ATOMIC);
if (!skb)
goto out;
rc = 0;
switch (type) {
case CONREQ:
case DATA:
if (!skb_queue_empty(&pdata->retransmit_queue)) {
skb_queue_tail(&pdata->transmit_queue, skb);
goto out;
}
case TQUEUE: {
struct sk_buff *skb2;
pdata->retransmit.expires = jiffies + spx_calc_rtt(0);
add_timer(&pdata->retransmit);
skb2 = skb_clone(skb, GFP_NOIO);
if (!skb2) {
rc = -ENOBUFS;
goto out;
}
skb_queue_tail(&pdata->retransmit_queue, skb2);
/* Fall thru */
}
case ACK:
case CONACK:
case WDREQ:
case WDACK:
case DISCON:
case DISACK:
case RETRAN:
default: /* Send data */
rc = ipxrtr_route_skb(skb);
if (rc)
kfree_skb(skb);
}
out: return rc;
}
/* SPX packet transmit engine */
static int spx_transmit(struct sock *sk, struct sk_buff *skb, int type, int len)
{
struct spx_opt *pdata = spx_sk(sk);
struct ipxspxhdr *ipxh;
unsigned long flags;
int rc;
if (!skb) {
int offset = ipx_if_offset(pdata->dest_addr.net);
int size = offset + sizeof(struct ipxspxhdr);
rc = -ENETUNREACH;
if (offset < 0)
goto out;
save_flags(flags);
cli();
skb = sock_alloc_send_skb(sk, size, 0, &err);
rc = -ENOMEM;
if (!skb) {
restore_flags(flags);
goto out;
}
skb_reserve(skb, offset);
skb->h.raw = skb->nh.raw =
skb_put(skb, sizeof(struct ipxspxhdr));
restore_flags(flags);
}
/* IPX header */
ipxh = (struct ipxspxhdr *)skb->nh.raw;
ipxh->ipx.ipx_checksum = 0xFFFF;
ipxh->ipx.ipx_pktsize = htons(SPX_SYS_PKT_LEN);
ipxh->ipx.ipx_tctrl = 0;
ipxh->ipx.ipx_type = IPX_TYPE_SPX;
ipxh->ipx.ipx_dest = pdata->dest_addr;
ipxh->ipx.ipx_source = pdata->source_addr;
/* SPX header */
ipxh->spx.dtype = 0;
ipxh->spx.sequence = htons(pdata->sequence);
ipxh->spx.ackseq = htons(pdata->rmt_seq);
ipxh->spx.sconn = pdata->source_connid;
ipxh->spx.dconn = pdata->dest_connid;
ipxh->spx.allocseq = htons(pdata->alloc);
/* Reset/Set WD timer */
mod_timer(&pdata->watchdog, jiffies+VERIFY_TIMEOUT);
switch (type) {
case DATA: /* Data */
ipxh->ipx.ipx_pktsize = htons(SPX_SYS_PKT_LEN + len);
ipxh->spx.cctl = (CCTL_ACK | CCTL_EOM);
pdata->sequence++;
break;
case ACK: /* ACK */
pdata->rmt_seq++;
case WDACK: /* WD ACK */
case CONACK: /* Connection ACK */
ipxh->spx.cctl = CCTL_SYS;
ipxh->spx.ackseq = htons(pdata->rmt_seq);
break;
case CONREQ: /* Connection Request */
del_timer(&pdata->watchdog);
case WDREQ: /* WD Request */
pdata->source_connid = htons(connids++);
pdata->dest_connid = 0xFFFF;
pdata->alloc = 3 + pdata->rmt_seq;
ipxh->spx.cctl = CCTL_ACK | CCTL_SYS;
ipxh->spx.sconn = pdata->source_connid;
ipxh->spx.dconn = pdata->dest_connid;
ipxh->spx.allocseq = htons(pdata->alloc);
break;
case DISCON: /* Informed Disconnect */
ipxh->spx.cctl = CCTL_ACK;
ipxh->spx.dtype = SPX_DTYPE_ECONN;
break;
case DISACK: /* Informed Disconnect ACK */
ipxh->spx.cctl = 0;
ipxh->spx.dtype = SPX_DTYPE_ECACK;
ipxh->spx.sequence = 0;
ipxh->spx.ackseq = htons(pdata->rmt_seq++);
break;
default:
rc = -EOPNOTSUPP;
goto out;
}
/* Send data */
rc = spx_route_skb(pdata, skb, type);
out: return rc;
}
/* Check the state of the connection and send a WD request if needed. */
static void spx_watchdog(unsigned long data)
{
struct sock *sk = (struct sock*)data;
struct spx_opt *pdata = spx_sk(sk);
del_timer(&pdata->watchdog);
if (pdata->state == SPX_CLOSED)
goto out;
if (pdata->retries > pdata->max_retries) {
spx_close_socket(sk); /* Unilateral Abort */
goto out;
}
/* Send WD request */
spx_transmit(sk, NULL, WDREQ, 0);
pdata->retries++;
out:;
}
static void spx_retransmit(unsigned long data)
{
struct sock *sk = (struct sock*)data;
struct spx_opt *pdata = spx_sk(sk);
struct sk_buff *skb;
unsigned long flags;
del_timer(&pdata->retransmit);
if (pdata->state == SPX_CLOSED)
goto out;
if (pdata->retransmits > RETRY_COUNT) {
spx_close_socket(sk); /* Unilateral Abort */
goto out;
}
/* Need to leave skb on the queue, aye the fear */
save_flags(flags);
cli();
skb = skb_peek(&pdata->retransmit_queue);
if (skb_cloned(skb))
skb = skb_copy(skb, GFP_ATOMIC);
else
skb = skb_clone(skb, GFP_ATOMIC);
restore_flags(flags);
pdata->retransmit.expires = jiffies + spx_calc_rtt(pdata->retransmits);
add_timer(&pdata->retransmit);
spx_route_skb(pdata, skb, RETRAN);
pdata->retransmits++;
out:;
}
/* Check packet for retransmission, ConReqAck aware */
static int spx_retransmit_chk(struct spx_opt *pdata, int ackseq, int type)
{
struct ipxspxhdr *ipxh;
int rc = -ENOENT;
struct sk_buff *skb = skb_dequeue(&pdata->retransmit_queue);
if (!skb)
goto out;
rc = 0;
/* Check Data/ACK seq */
switch (type) {
case ACK: /* Check Sequence, Should == 1 */
ipxh = (struct ipxspxhdr *)skb->nh.raw;
if (!(ntohs(ipxh->spx.sequence) - htons(ackseq)))
break;
case CONACK:
del_timer(&pdata->retransmit);
pdata->retransmits = 0;
kfree_skb(skb);
if (skb_queue_empty(&pdata->retransmit_queue)) {
skb = skb_dequeue(&pdata->transmit_queue);
if (skb)
spx_route_skb(pdata, skb, TQUEUE);
}
goto out;
}
skb_queue_head(&pdata->retransmit_queue, skb);
rc = -1;
out: return rc;
}
/* SPX packet receive engine */
void spx_rcv(struct sock *sk, int bytes)
{
struct ipxspxhdr *ipxh;
struct spx_opt *pdata = spx_sk(sk);
struct sk_buff *skb = skb_dequeue(&sk->receive_queue);
if (!skb)
goto out;
ipxh = (struct ipxspxhdr *)skb->nh.raw;
/* Can't receive on a closed connection */
if ((pdata->state == SPX_CLOSED && ipxh->spx.sequence) ||
ntohs(ipxh->ipx.ipx_pktsize) < SPX_SYS_PKT_LEN ||
ipxh->ipx.ipx_type != IPX_TYPE_SPX ||
ntohs(ipxh->spx.ackseq) > pdata->sequence)
goto toss_skb;
/* Reset WD timer on any received packet */
del_timer(&pdata->watchdog);
pdata->retries = 0;
pdata->watchdog.expires = jiffies + ABORT_TIMEOUT;
add_timer(&pdata->watchdog);
switch (ipxh->spx.cctl) {
case (CCTL_SYS | CCTL_ACK):
if (!ipxh->spx.sequence && /* ConReq */
!ipxh->spx.ackseq &&
ipxh->spx.dconn == 0xFFFF) {
pdata->state = SPX_CONNECTED;
pdata->dest_addr = ipxh->ipx.ipx_source;
pdata->source_addr = ipxh->ipx.ipx_dest;
pdata->dest_connid = ipxh->spx.sconn;
pdata->alloc = 3 + ntohs(ipxh->spx.sequence);
skb_queue_tail(&sk->receive_queue, skb);
wake_up_interruptible(sk->sleep);
} else /* WD Request */
spx_transmit(sk, skb, WDACK, 0);
goto out;
case CCTL_SYS: /* ACK */
if (!ipxh->spx.dtype && /* ConReq ACK */
ipxh->spx.sconn != 0xFFFF &&
ipxh->spx.dconn != 0xFFFF &&
!ipxh->spx.sequence &&
!ipxh->spx.ackseq &&
pdata->state != SPX_CONNECTED) {
pdata->state = SPX_CONNECTED;
pdata->dest_connid = ipxh->spx.sconn;
if (spx_retransmit_chk(pdata, 0, CONACK) < 0)
goto toss_skb;
skb_queue_tail(&sk->receive_queue, skb);
wake_up_interruptible(sk->sleep);
goto out;
}
spx_retransmit_chk(pdata, ipxh->spx.ackseq, ACK);
goto toss_skb;
case CCTL_ACK:
/* Informed Disconnect */
if (ipxh->spx.dtype == SPX_DTYPE_ECONN) {
spx_transmit(sk, skb, DISACK, 0);
spx_close_socket(sk);
goto out;
}
/* Fall through */
default:
if (ntohs(ipxh->spx.sequence) == pdata->rmt_seq) {
pdata->rmt_seq = ntohs(ipxh->spx.sequence);
pdata->rmt_ack = ntohs(ipxh->spx.ackseq);
pdata->alloc = pdata->rmt_seq + 3;
if (pdata->rmt_ack > 0 || !pdata->rmt_ack)
spx_retransmit_chk(pdata,
pdata->rmt_ack, ACK);
skb_queue_tail(&pdata->rcv_queue, skb);
wake_up_interruptible(sk->sleep);
if (ipxh->spx.cctl&CCTL_ACK)
spx_transmit(sk, NULL, ACK, 0);
goto out;
}
if (ipxh->spx.dtype == SPX_DTYPE_ECACK) {
if (pdata->state != SPX_CLOSED)
spx_close_socket(sk);
goto toss_skb;
}
}
toss_skb: /* Catch All */
kfree_skb(skb);
out:;
}
/* Get message/packet data from user-land */
static int spx_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
int flags = msg->msg_flags;
struct sk_buff *skb;
int offset, size, rc = -EMSGSIZE;
if (len > 534)
goto out;
rc = -ENOTCONN; /* Socket not bound */
if (sk->zapped)
goto out;
rc = -EINVAL;
if (flags & ~MSG_DONTWAIT)
goto out;
offset = ipx_if_offset(spx_sk(sk)->dest_addr.net);
size = offset + sizeof(struct ipxspxhdr) + len;
cli();
skb = sock_alloc_send_skb(sk, size, flags&MSG_DONTWAIT, &rc);
sti();
if (!skb)
goto out;
skb->sk = sk;
skb_reserve(skb, offset);
skb->h.raw = skb->nh.raw = skb_put(skb, sizeof(struct ipxspxhdr));
rc = -EFAULT;
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
kfree_skb(skb);
goto out;
}
rc = len;
if (!spx_transmit(sk, skb, DATA, len))
rc = -EAGAIN;
out: return rc;
}
/* Send message/packet data to user-land */
static int spx_recvmsg(struct socket *sock, struct msghdr *msg, int size,
int flags, struct scm_cookie *scm)
{
struct sk_buff *skb;
struct ipxspxhdr *ispxh;
struct sock *sk = sock->sk;
struct spx_opt *pdata = spx_sk(sk);
struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)msg->msg_name;
int copied, rc = -ENOTCONN;
if (sk->zapped) /* Socket not bound */
goto out;
lock_sock(sk);
restart:
while (skb_queue_empty(&pdata->rcv_queue)) { /* No data */
/* Socket errors? */
rc = sock_error(sk);
if (rc)
goto out_release_sock;
/* Socket shut down? */
rc = -ESHUTDOWN;
if (sk->shutdown & RCV_SHUTDOWN)
goto out_release_sock;
/* handle signals */
rc = -ERESTARTSYS;
if (signal_pending(current))
goto out_release_sock;
/* User doesn't want to wait */
rc = -EAGAIN;
if (flags & MSG_DONTWAIT)
goto out_release_sock;
release_sock(sk);
save_flags(flags);
cli();
if (!skb_peek(&pdata->rcv_queue))
interruptible_sleep_on(sk->sleep);
restore_flags(flags);
lock_sock(sk);
}
skb = skb_dequeue(&pdata->rcv_queue);
if (!skb)
goto restart;
ispxh = (struct ipxspxhdr *)skb->nh.raw;
copied = ntohs(ispxh->ipx.ipx_pktsize) - SPX_SYS_PKT_LEN;
if (copied > size) {
copied = size;
msg->msg_flags |= MSG_TRUNC;
}
rc = -EFAULT;
if (memcpy_toiovec(msg->msg_iov, skb->nh.raw + SPX_SYS_PKT_LEN, copied))
goto out_kfree_skb;
msg->msg_namelen = sizeof(*sipx);
if (sipx) {
sipx->sipx_family = AF_IPX;
sipx->sipx_port = ispxh->ipx.ipx_source.sock;
memcpy(sipx->sipx_node,ispxh->ipx.ipx_source.node,IPX_NODE_LEN);
sipx->sipx_network = ispxh->ipx.ipx_source.net;
sipx->sipx_type = ispxh->ipx.ipx_type;
}
rc = copied;
out_kfree_skb:
kfree_skb(skb);
out_release_sock:
release_sock(sk);
out: return rc;
}
/*
* Functions which just wrap their IPX cousins
*/
static int spx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
return ipx_ops->bind(sock, uaddr, addr_len);
}
static int spx_getname (struct socket *sock, struct sockaddr *uaddr,
int *usockaddr_len, int peer)
{
return ipx_ops->getname(sock, uaddr, usockaddr_len, peer);
}
static int spx_ioctl (struct socket *sock, unsigned int cmd,
unsigned long arg)
{
return ipx_ops->ioctl(sock, cmd, arg);
}
static int spx_setsockopt(struct socket *sock, int level, int optname,
char *optval, int optlen)
{
return ipx_ops->setsockopt(sock, level, optname, optval, optlen);
}
static int spx_getsockopt(struct socket *sock, int level, int optname,
char *optval, int *optlen)
{
return ipx_ops->getsockopt(sock, level, optname, optval, optlen);
}
static struct proto_ops SOCKOPS_WRAPPED(spx_ops) = {
.family = PF_IPX,
.release = spx_release,
.bind = spx_bind,
.connect = spx_connect,
.socketpair = sock_no_socketpair,
.accept = spx_accept,
.getname = spx_getname,
.poll = spx_datagram_poll,
.ioctl = spx_ioctl,
.listen = spx_listen,
.shutdown = sock_no_shutdown,
.setsockopt = spx_setsockopt,
.getsockopt = spx_getsockopt,
.sendmsg = spx_sendmsg,
.recvmsg = spx_recvmsg,
.mmap = sock_no_mmap,
.sendpage = sock_no_sendpage,
};
#include <linux/smp_lock.h>
SOCKOPS_WRAP(spx, PF_IPX);
static struct net_proto_family spx_family_ops = {
.family = PF_IPX,
.create = spx_create,
};
static char banner[] __initdata =
KERN_INFO "NET4: Sequenced Packet eXchange (SPX) 0.03\n";
static int __init spx_proto_init(void)
{
connids = (__u16)jiffies; /* initalize random */
/* allocate our sock slab cache */
spx_family_ops.sk_cachep = kmem_cache_create("spx_sock",
spx_family_ops.sk_size,
0, SLAB_HWCACHE_ALIGN,
0, 0);
if (!spx_family_ops.sk_cachep)
printk(KERN_CRIT __FUNCTION__
": Cannot create spx_sock SLAB cache!\n");
if (ipx_register_spx(&ipx_ops, &spx_family_ops))
printk(KERN_ERR "SPX: unable to register with IPX.\n");
/* route socket(PF_IPX, SOCK_SEQPACKET) calls through spx_create() */
printk(banner);
return 0;
}
static void __exit spx_proto_finito(void)
{
ipx_unregister_spx();
}
module_init(spx_proto_init);
module_exit(spx_proto_finito);
MODULE_LICENSE("GPL");
...@@ -17,21 +17,36 @@ ...@@ -17,21 +17,36 @@
/* From af_ipx.c */ /* From af_ipx.c */
extern int sysctl_ipx_pprop_broadcasting; extern int sysctl_ipx_pprop_broadcasting;
ctl_table ipx_table[] = { static struct ctl_table ipx_table[] = {
{ NET_IPX_PPROP_BROADCASTING, "ipx_pprop_broadcasting", {
&sysctl_ipx_pprop_broadcasting, sizeof(int), 0644, NULL, .ctl_name = NET_IPX_PPROP_BROADCASTING,
&proc_dointvec }, .procname = "ipx_pprop_broadcasting",
{ 0 } .data = &sysctl_ipx_pprop_broadcasting,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{ 0 },
}; };
static ctl_table ipx_dir_table[] = { static struct ctl_table ipx_dir_table[] = {
{ NET_IPX, "ipx", NULL, 0, 0555, ipx_table }, {
{ 0 } .ctl_name = NET_IPX,
.procname = "ipx",
.mode = 0555,
.child = ipx_table,
},
{ 0 },
}; };
static ctl_table ipx_root_table[] = { static struct ctl_table ipx_root_table[] = {
{ CTL_NET, "net", NULL, 0, 0555, ipx_dir_table }, {
{ 0 } .ctl_name = CTL_NET,
.procname = "net",
.mode = 0555,
.child = ipx_dir_table,
},
{ 0 },
}; };
static struct ctl_table_header *ipx_table_header; static struct ctl_table_header *ipx_table_header;
......
...@@ -46,12 +46,13 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -46,12 +46,13 @@ int llc_conn_ac_clear_remote_busy(struct sock *sk, struct llc_conn_state_ev *ev)
if (llc->remote_busy_flag) { if (llc->remote_busy_flag) {
u8 nr; u8 nr;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu =
(struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
llc->remote_busy_flag = 0; llc->remote_busy_flag = 0;
del_timer(&llc->busy_state_timer.timer); del_timer(&llc->busy_state_timer.timer);
llc->busy_state_timer.running = 0; llc->busy_state_timer.running = 0;
nr = LLC_I_GET_NR(rx_pdu); nr = LLC_I_GET_NR(pdu);
llc_conn_resend_i_pdu_as_cmd(sk, nr, 0); llc_conn_resend_i_pdu_as_cmd(sk, nr, 0);
} }
return 0; return 0;
...@@ -147,16 +148,17 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -147,16 +148,17 @@ int llc_conn_ac_disc_ind(struct sock *sk, struct llc_conn_state_ev *ev)
struct llc_prim_if_block *prim = &llc_ind_prim; struct llc_prim_if_block *prim = &llc_ind_prim;
if (ev->type == LLC_CONN_EV_TYPE_PDU) { if (ev->type == LLC_CONN_EV_TYPE_PDU) {
llc_pdu_un_t *rx_pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu =
(struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_RSP(rx_pdu) && if (!LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(rx_pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(rx_pdu) == LLC_2_PDU_RSP_DM) { LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM) {
reason = LLC_DISC_REASON_RX_DM_RSP_PDU; reason = LLC_DISC_REASON_RX_DM_RSP_PDU;
rc = 0; rc = 0;
} else if (!LLC_PDU_IS_CMD(rx_pdu) && } else if (!LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(rx_pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(rx_pdu) == LLC_2_PDU_CMD_DISC) { LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC) {
reason = LLC_DISC_REASON_RX_DISC_CMD_PDU; reason = LLC_DISC_REASON_RX_DISC_CMD_PDU;
rc = 0; rc = 0;
} }
...@@ -200,21 +202,21 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -200,21 +202,21 @@ int llc_conn_ac_rst_ind(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
u8 reason = 0; u8 reason = 0;
int rc = 1; int rc = 1;
llc_pdu_un_t *rx_pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
union llc_u_prim_data *prim_data = llc_ind_prim.data; union llc_u_prim_data *prim_data = llc_ind_prim.data;
struct llc_prim_if_block *prim = &llc_ind_prim; struct llc_prim_if_block *prim = &llc_ind_prim;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
switch (ev->type) { switch (ev->type) {
case LLC_CONN_EV_TYPE_PDU: case LLC_CONN_EV_TYPE_PDU:
if (!LLC_PDU_IS_RSP(rx_pdu) && if (!LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(rx_pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(rx_pdu) == LLC_2_PDU_RSP_FRMR) { LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR) {
reason = LLC_RESET_REASON_LOCAL; reason = LLC_RESET_REASON_LOCAL;
rc = 0; rc = 0;
} else if (!LLC_PDU_IS_CMD(rx_pdu) && } else if (!LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(rx_pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(rx_pdu) == LLC_U_PDU_CMD(pdu) ==
LLC_2_PDU_CMD_SABME) { LLC_2_PDU_CMD_SABME) {
reason = LLC_RESET_REASON_REMOTE; reason = LLC_RESET_REASON_REMOTE;
rc = 0; rc = 0;
...@@ -270,11 +272,11 @@ int llc_conn_ac_report_status(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -270,11 +272,11 @@ int llc_conn_ac_report_status(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock *sk, int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_RSP(rx_pdu) && if (!LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_I(rx_pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_1(rx_pdu) && llc_sk(sk)->ack_pf) !LLC_I_PF_IS_1(pdu) && llc_sk(sk)->ack_pf)
llc_conn_ac_clear_remote_busy(sk, ev); llc_conn_ac_clear_remote_busy(sk, ev);
return 0; return 0;
} }
...@@ -386,11 +388,11 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, ...@@ -386,11 +388,11 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk,
u8 f_bit; u8 f_bit;
int rc = 1; int rc = 1;
struct sk_buff *skb, *ev_skb = ev->data.pdu.skb; struct sk_buff *skb, *ev_skb = ev->data.pdu.skb;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev_skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev_skb->nh.raw;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
llc->rx_pdu_hdr = (u32)*((u32 *)rx_pdu); llc->rx_pdu_hdr = *((u32 *)pdu);
if (!LLC_PDU_IS_CMD(rx_pdu)) if (!LLC_PDU_IS_CMD(pdu))
llc_pdu_decode_pf_bit(ev_skb, &f_bit); llc_pdu_decode_pf_bit(ev_skb, &f_bit);
else else
f_bit = 0; f_bit = 0;
...@@ -401,7 +403,7 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, ...@@ -401,7 +403,7 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk,
skb->dev = llc->dev; skb->dev = llc->dev;
llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap,
llc->daddr.lsap, LLC_PDU_RSP); llc->daddr.lsap, LLC_PDU_RSP);
llc_pdu_init_as_frmr_rsp(skb, rx_pdu, f_bit, llc->vS, llc_pdu_init_as_frmr_rsp(skb, pdu, f_bit, llc->vS,
llc->vR, INCORRECT); llc->vR, INCORRECT);
lan_hdrs_init(skb, llc->dev->dev_addr, llc->daddr.mac); lan_hdrs_init(skb, llc->dev->dev_addr, llc->daddr.mac);
rc = 0; rc = 0;
...@@ -420,12 +422,12 @@ int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, ...@@ -420,12 +422,12 @@ int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk,
u8 f_bit = 0; u8 f_bit = 0;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
struct llc_sap *sap = llc->sap; struct llc_sap *sap = llc->sap;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)&llc->rx_pdu_hdr; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)&llc->rx_pdu_hdr;
skb->dev = llc->dev; skb->dev = llc->dev;
llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap,
llc->daddr.lsap, LLC_PDU_RSP); llc->daddr.lsap, LLC_PDU_RSP);
llc_pdu_init_as_frmr_rsp(skb, rx_pdu, f_bit, llc->vS, llc_pdu_init_as_frmr_rsp(skb, pdu, f_bit, llc->vS,
llc->vR, INCORRECT); llc->vR, INCORRECT);
lan_hdrs_init(skb, llc->dev->dev_addr, llc->daddr.mac); lan_hdrs_init(skb, llc->dev->dev_addr, llc->daddr.mac);
rc = 0; rc = 0;
...@@ -446,12 +448,13 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, ...@@ -446,12 +448,13 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk,
if (skb) { if (skb) {
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
struct llc_sap *sap = llc->sap; struct llc_sap *sap = llc->sap;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu =
(struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
skb->dev = llc->dev; skb->dev = llc->dev;
llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap,
llc->daddr.lsap, LLC_PDU_RSP); llc->daddr.lsap, LLC_PDU_RSP);
llc_pdu_init_as_frmr_rsp(skb, rx_pdu, f_bit, llc->vS, llc_pdu_init_as_frmr_rsp(skb, pdu, f_bit, llc->vS,
llc->vR, INCORRECT); llc->vR, INCORRECT);
lan_hdrs_init(skb, llc->dev->dev_addr, llc->daddr.mac); lan_hdrs_init(skb, llc->dev->dev_addr, llc->daddr.mac);
rc = 0; rc = 0;
...@@ -497,9 +500,8 @@ int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, ...@@ -497,9 +500,8 @@ int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk,
int llc_conn_ac_resend_i_cmd_p_set_1(struct sock *sk, int llc_conn_ac_resend_i_cmd_p_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 nr = LLC_I_GET_NR(pdu);
u8 nr = LLC_I_GET_NR(rx_pdu);
llc_conn_resend_i_pdu_as_cmd(sk, nr, 1); llc_conn_resend_i_pdu_as_cmd(sk, nr, 1);
return 0; return 0;
...@@ -508,9 +510,8 @@ int llc_conn_ac_resend_i_cmd_p_set_1(struct sock *sk, ...@@ -508,9 +510,8 @@ int llc_conn_ac_resend_i_cmd_p_set_1(struct sock *sk,
int llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr(struct sock *sk, int llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 nr = LLC_I_GET_NR(pdu);
u8 nr = LLC_I_GET_NR(rx_pdu);
int rc = llc_conn_ac_send_rr_cmd_p_set_1(sk, ev); int rc = llc_conn_ac_send_rr_cmd_p_set_1(sk, ev);
if (!rc) if (!rc)
...@@ -538,8 +539,8 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, ...@@ -538,8 +539,8 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk,
int llc_conn_ac_resend_i_xxx_x_set_0(struct sock *sk, int llc_conn_ac_resend_i_xxx_x_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 nr = LLC_I_GET_NR(rx_pdu); u8 nr = LLC_I_GET_NR(pdu);
llc_conn_resend_i_pdu_as_cmd(sk, nr, 0); llc_conn_resend_i_pdu_as_cmd(sk, nr, 0);
return 0; return 0;
...@@ -550,7 +551,7 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk, ...@@ -550,7 +551,7 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
{ {
u8 nr; u8 nr;
u8 f_bit = 0; u8 f_bit = 0;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
int rc = 1; int rc = 1;
struct sk_buff *skb = llc_alloc_frame(); struct sk_buff *skb = llc_alloc_frame();
...@@ -567,7 +568,7 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk, ...@@ -567,7 +568,7 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
llc_conn_send_pdu(sk, skb); llc_conn_send_pdu(sk, skb);
} }
if (rc) { if (rc) {
nr = LLC_I_GET_NR(rx_pdu); nr = LLC_I_GET_NR(pdu);
rc = 0; rc = 0;
llc_conn_resend_i_pdu_as_cmd(sk, nr, f_bit); llc_conn_resend_i_pdu_as_cmd(sk, nr, f_bit);
} }
...@@ -577,8 +578,8 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk, ...@@ -577,8 +578,8 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk, int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 nr = LLC_I_GET_NR(rx_pdu); u8 nr = LLC_I_GET_NR(pdu);
llc_conn_resend_i_pdu_as_rsp(sk, nr, 1); llc_conn_resend_i_pdu_as_rsp(sk, nr, 1);
return 0; return 0;
...@@ -1336,10 +1337,10 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -1336,10 +1337,10 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev)
u16 unacked = 0; u16 unacked = 0;
u8 fbit; u8 fbit;
struct sk_buff *skb = ev->data.pdu.skb; struct sk_buff *skb = ev->data.pdu.skb;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
llc->last_nr = PDU_SUPV_GET_Nr(rx_pdu); llc->last_nr = PDU_SUPV_GET_Nr(pdu);
acked = llc_conn_remove_acked_pdus(sk, llc->last_nr, &unacked); acked = llc_conn_remove_acked_pdus(sk, llc->last_nr, &unacked);
/* On loopback we don't queue I frames in unack_pdu_q queue. */ /* On loopback we don't queue I frames in unack_pdu_q queue. */
if (acked > 0 || (llc->dev->flags & IFF_LOOPBACK)) { if (acked > 0 || (llc->dev->flags & IFF_LOOPBACK)) {
...@@ -1375,10 +1376,10 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -1375,10 +1376,10 @@ int llc_conn_ac_upd_nr_received(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_upd_p_flag(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ac_upd_p_flag(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
struct sk_buff *skb = ev->data.pdu.skb; struct sk_buff *skb = ev->data.pdu.skb;
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
u8 f_bit; u8 f_bit;
if (!LLC_PDU_IS_RSP(rx_pdu) && if (!LLC_PDU_IS_RSP(pdu) &&
!llc_pdu_decode_pf_bit(skb, &f_bit) && f_bit) { !llc_pdu_decode_pf_bit(skb, &f_bit) && f_bit) {
llc_sk(sk)->p_flag = 0; llc_sk(sk)->p_flag = 0;
llc_conn_ac_stop_p_timer(sk, ev); llc_conn_ac_stop_p_timer(sk, ev);
...@@ -1556,8 +1557,8 @@ int llc_conn_ac_rst_vs(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -1556,8 +1557,8 @@ int llc_conn_ac_rst_vs(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ac_upd_vs(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ac_upd_vs(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *rx_pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 nr = PDU_SUPV_GET_Nr(rx_pdu); u8 nr = PDU_SUPV_GET_Nr(pdu);
if (llc_circular_between(llc_sk(sk)->vS, nr, llc_sk(sk)->X)) if (llc_circular_between(llc_sk(sk)->vS, nr, llc_sk(sk)->X))
llc_conn_ac_set_vs_nr(sk, ev); llc_conn_ac_set_vs_nr(sk, ev);
......
...@@ -77,7 +77,7 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr) ...@@ -77,7 +77,7 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr)
{ {
u8 nr1, nr2; u8 nr1, nr2;
struct sk_buff *skb; struct sk_buff *skb;
llc_pdu_sn_t *pdu; struct llc_pdu_sn *pdu;
struct llc_opt *llc = llc_sk(sk); struct llc_opt *llc = llc_sk(sk);
int rc = 0; int rc = 0;
...@@ -87,10 +87,10 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr) ...@@ -87,10 +87,10 @@ static u16 llc_util_nr_inside_tx_window(struct sock *sk, u8 nr)
if (!skb_queue_len(&llc->pdu_unack_q)) if (!skb_queue_len(&llc->pdu_unack_q))
goto out; goto out;
skb = skb_peek(&llc->pdu_unack_q); skb = skb_peek(&llc->pdu_unack_q);
pdu = (llc_pdu_sn_t *)skb->nh.raw; pdu = (struct llc_pdu_sn *)skb->nh.raw;
nr1 = LLC_I_GET_NS(pdu); nr1 = LLC_I_GET_NS(pdu);
skb = skb_peek_tail(&llc->pdu_unack_q); skb = skb_peek_tail(&llc->pdu_unack_q);
pdu = (llc_pdu_sn_t *)skb->nh.raw; pdu = (struct llc_pdu_sn *)skb->nh.raw;
nr2 = LLC_I_GET_NS(pdu); nr2 = LLC_I_GET_NS(pdu);
rc = !llc_circular_between(nr1, nr, (nr2 + 1) % LLC_2_SEQ_NBR_MODULO); rc = !llc_circular_between(nr1, nr, (nr2 + 1) % LLC_2_SEQ_NBR_MODULO);
out: out:
...@@ -155,7 +155,7 @@ int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct llc_conn_state_ev *ev) ...@@ -155,7 +155,7 @@ int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct llc_conn_state_ev *ev)
int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1; LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_DISC ? 0 : 1;
...@@ -164,7 +164,7 @@ int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, ...@@ -164,7 +164,7 @@ int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk,
int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1; LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_DM ? 0 : 1;
...@@ -173,7 +173,7 @@ int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, ...@@ -173,7 +173,7 @@ int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1; LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_FRMR ? 0 : 1;
...@@ -182,7 +182,7 @@ int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, ...@@ -182,7 +182,7 @@ int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_0(pdu) && !LLC_I_PF_IS_0(pdu) &&
...@@ -192,7 +192,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, ...@@ -192,7 +192,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_1(pdu) && !LLC_I_PF_IS_1(pdu) &&
...@@ -202,7 +202,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, ...@@ -202,7 +202,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -214,7 +214,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, ...@@ -214,7 +214,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -226,7 +226,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, ...@@ -226,7 +226,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t * pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn * pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
u16 rc = !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr && u16 rc = !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr &&
...@@ -241,7 +241,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, ...@@ -241,7 +241,7 @@ int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_0(pdu) && !LLC_I_PF_IS_0(pdu) &&
...@@ -251,7 +251,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, ...@@ -251,7 +251,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
!LLC_I_PF_IS_1(pdu) && !LLC_I_PF_IS_1(pdu) &&
...@@ -261,7 +261,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, ...@@ -261,7 +261,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) &&
LLC_I_GET_NS(pdu) == llc_sk(sk)->vR ? 0 : 1; LLC_I_GET_NS(pdu) == llc_sk(sk)->vR ? 0 : 1;
...@@ -270,7 +270,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, ...@@ -270,7 +270,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -282,7 +282,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, ...@@ -282,7 +282,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -294,7 +294,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, ...@@ -294,7 +294,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
...@@ -305,7 +305,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk, ...@@ -305,7 +305,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vr = llc_sk(sk)->vR; u8 vr = llc_sk(sk)->vR;
u8 ns = LLC_I_GET_NS(pdu); u8 ns = LLC_I_GET_NS(pdu);
u16 rc = !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr && u16 rc = !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_I(pdu) && ns != vr &&
...@@ -320,7 +320,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk, ...@@ -320,7 +320,7 @@ int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -330,7 +330,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, ...@@ -330,7 +330,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -340,7 +340,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, ...@@ -340,7 +340,7 @@ int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -350,7 +350,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, ...@@ -350,7 +350,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -360,7 +360,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, ...@@ -360,7 +360,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1; LLC_S_PDU_RSP(pdu) == LLC_2_PDU_RSP_REJ ? 0 : 1;
...@@ -369,7 +369,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, ...@@ -369,7 +369,7 @@ int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -379,7 +379,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, ...@@ -379,7 +379,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -389,7 +389,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, ...@@ -389,7 +389,7 @@ int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -399,7 +399,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, ...@@ -399,7 +399,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -409,7 +409,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, ...@@ -409,7 +409,7 @@ int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -419,7 +419,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, ...@@ -419,7 +419,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -429,7 +429,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, ...@@ -429,7 +429,7 @@ int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk,
int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_0(pdu) && !LLC_S_PF_IS_0(pdu) &&
...@@ -439,7 +439,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, ...@@ -439,7 +439,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk,
int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_S(pdu) &&
!LLC_S_PF_IS_1(pdu) && !LLC_S_PF_IS_1(pdu) &&
...@@ -449,7 +449,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, ...@@ -449,7 +449,7 @@ int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk,
int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_CMD(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1; LLC_U_PDU_CMD(pdu) == LLC_2_PDU_CMD_SABME ? 0 : 1;
...@@ -458,7 +458,7 @@ int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, ...@@ -458,7 +458,7 @@ int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk,
int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) && return !LLC_PDU_IS_RSP(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_UA ? 0 : 1; LLC_U_PDU_RSP(pdu) == LLC_2_PDU_RSP_UA ? 0 : 1;
...@@ -468,7 +468,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, ...@@ -468,7 +468,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_CMD(pdu)) { if (!LLC_PDU_IS_CMD(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) { if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) {
...@@ -484,7 +484,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk, ...@@ -484,7 +484,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_0(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_CMD(pdu)) { if (!LLC_PDU_IS_CMD(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) { if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) {
...@@ -506,7 +506,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, ...@@ -506,7 +506,7 @@ int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_CMD(pdu)) { if (!LLC_PDU_IS_CMD(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu))
...@@ -526,7 +526,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, ...@@ -526,7 +526,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_RSP(pdu)) { if (!LLC_PDU_IS_RSP(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) { if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) {
...@@ -549,7 +549,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, ...@@ -549,7 +549,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_IS_RSP(pdu)) { if (!LLC_PDU_IS_RSP(pdu)) {
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu))
...@@ -570,7 +570,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, ...@@ -570,7 +570,7 @@ int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk,
int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct llc_conn_state_ev *ev) int llc_conn_ev_rx_xxx_yyy(struct sock *sk, struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu)) if (!LLC_PDU_TYPE_IS_I(pdu) || !LLC_PDU_TYPE_IS_S(pdu))
rc = 0; rc = 0;
...@@ -591,7 +591,7 @@ int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk, ...@@ -591,7 +591,7 @@ int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vs = llc_sk(sk)->vS; u8 vs = llc_sk(sk)->vS;
u8 nr = LLC_I_GET_NR(pdu); u8 nr = LLC_I_GET_NR(pdu);
...@@ -613,7 +613,7 @@ int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk, ...@@ -613,7 +613,7 @@ int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
struct llc_conn_state_ev *ev) struct llc_conn_state_ev *ev)
{ {
u16 rc = 1; u16 rc = 1;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
u8 vs = llc_sk(sk)->vS; u8 vs = llc_sk(sk)->vS;
u8 nr = LLC_I_GET_NR(pdu); u8 nr = LLC_I_GET_NR(pdu);
......
...@@ -2808,20 +2808,20 @@ static struct llc_conn_state_trans *llc_reject_state_transitions[] = { ...@@ -2808,20 +2808,20 @@ static struct llc_conn_state_trans *llc_reject_state_transitions[] = {
[36] = &llc_reject_state_trans_8a, [36] = &llc_reject_state_trans_8a,
[37] = &llc_reject_state_trans_8b, [37] = &llc_reject_state_trans_8b,
[38] = &llc_reject_state_trans_9, [38] = &llc_reject_state_trans_9,
[40] = &llc_reject_state_trans_10a, [39] = &llc_reject_state_trans_10a,
[41] = &llc_reject_state_trans_10b, [40] = &llc_reject_state_trans_10b,
[42] = &llc_reject_state_trans_10c, [41] = &llc_reject_state_trans_10c,
[43] = &llc_reject_state_trans_11, [42] = &llc_reject_state_trans_11,
[44] = &llc_reject_state_trans_12a, [43] = &llc_reject_state_trans_12a,
[45] = &llc_reject_state_trans_12b, [44] = &llc_reject_state_trans_12b,
[46] = &llc_reject_state_trans_12c, [45] = &llc_reject_state_trans_12c,
[47] = &llc_reject_state_trans_13, [46] = &llc_reject_state_trans_13,
[48] = &llc_reject_state_trans_14a, [47] = &llc_reject_state_trans_14a,
[49] = &llc_reject_state_trans_14b, [48] = &llc_reject_state_trans_14b,
[50] = &llc_reject_state_trans_15a, [49] = &llc_reject_state_trans_15a,
[51] = &llc_reject_state_trans_15b, [50] = &llc_reject_state_trans_15b,
[52] = &llc_reject_state_trans_16, [51] = &llc_reject_state_trans_16,
[53] = &llc_common_state_trans_n, [52] = &llc_common_state_trans_n,
}; };
/* LLC_CONN_STATE_AWAIT transitions */ /* LLC_CONN_STATE_AWAIT transitions */
......
...@@ -162,7 +162,7 @@ void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb, ...@@ -162,7 +162,7 @@ void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb,
void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit) void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit)
{ {
struct sk_buff *skb; struct sk_buff *skb;
llc_pdu_sn_t *pdu; struct llc_pdu_sn *pdu;
u16 nbr_unack_pdus; u16 nbr_unack_pdus;
u8 howmany_resend = 0; u8 howmany_resend = 0;
...@@ -173,7 +173,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit) ...@@ -173,7 +173,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit)
* appropriate PDUs, fix them up, and put them on mac_pdu_q. * appropriate PDUs, fix them up, and put them on mac_pdu_q.
*/ */
while ((skb = skb_dequeue(&llc_sk(sk)->pdu_unack_q)) != NULL) { while ((skb = skb_dequeue(&llc_sk(sk)->pdu_unack_q)) != NULL) {
pdu = (llc_pdu_sn_t *)skb->nh.raw; pdu = (struct llc_pdu_sn *)skb->nh.raw;
llc_pdu_set_cmd_rsp(skb, LLC_PDU_CMD); llc_pdu_set_cmd_rsp(skb, LLC_PDU_CMD);
llc_pdu_set_pf_bit(skb, first_p_bit); llc_pdu_set_pf_bit(skb, first_p_bit);
skb_queue_tail(&sk->write_queue, skb); skb_queue_tail(&sk->write_queue, skb);
...@@ -201,7 +201,7 @@ out:; ...@@ -201,7 +201,7 @@ out:;
void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit) void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit)
{ {
struct sk_buff *skb; struct sk_buff *skb;
llc_pdu_sn_t *pdu; struct llc_pdu_sn *pdu;
u16 nbr_unack_pdus; u16 nbr_unack_pdus;
u8 howmany_resend = 0; u8 howmany_resend = 0;
...@@ -212,7 +212,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit) ...@@ -212,7 +212,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit)
* appropriate PDUs, fix them up, and put them on mac_pdu_q * appropriate PDUs, fix them up, and put them on mac_pdu_q
*/ */
while ((skb = skb_dequeue(&llc_sk(sk)->pdu_unack_q)) != NULL) { while ((skb = skb_dequeue(&llc_sk(sk)->pdu_unack_q)) != NULL) {
pdu = (llc_pdu_sn_t *)skb->nh.raw; pdu = (struct llc_pdu_sn *)skb->nh.raw;
llc_pdu_set_cmd_rsp(skb, LLC_PDU_RSP); llc_pdu_set_cmd_rsp(skb, LLC_PDU_RSP);
llc_pdu_set_pf_bit(skb, first_f_bit); llc_pdu_set_pf_bit(skb, first_f_bit);
skb_queue_tail(&sk->write_queue, skb); skb_queue_tail(&sk->write_queue, skb);
...@@ -240,14 +240,14 @@ int llc_conn_remove_acked_pdus(struct sock *sk, u8 nr, u16 *how_many_unacked) ...@@ -240,14 +240,14 @@ int llc_conn_remove_acked_pdus(struct sock *sk, u8 nr, u16 *how_many_unacked)
{ {
int pdu_pos, i; int pdu_pos, i;
struct sk_buff *skb; struct sk_buff *skb;
llc_pdu_sn_t *pdu; struct llc_pdu_sn *pdu;
int nbr_acked = 0; int nbr_acked = 0;
int q_len = skb_queue_len(&llc_sk(sk)->pdu_unack_q); int q_len = skb_queue_len(&llc_sk(sk)->pdu_unack_q);
if (!q_len) if (!q_len)
goto out; goto out;
skb = skb_peek(&llc_sk(sk)->pdu_unack_q); skb = skb_peek(&llc_sk(sk)->pdu_unack_q);
pdu = (llc_pdu_sn_t *)skb->nh.raw; pdu = (struct llc_pdu_sn *)skb->nh.raw;
/* finding position of last acked pdu in queue */ /* finding position of last acked pdu in queue */
pdu_pos = ((int)LLC_2_SEQ_NBR_MODULO + (int)nr - pdu_pos = ((int)LLC_2_SEQ_NBR_MODULO + (int)nr -
...@@ -275,7 +275,7 @@ static void llc_conn_send_pdus(struct sock *sk) ...@@ -275,7 +275,7 @@ static void llc_conn_send_pdus(struct sock *sk)
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = skb_dequeue(&sk->write_queue)) != NULL) { while ((skb = skb_dequeue(&sk->write_queue)) != NULL) {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
if (!LLC_PDU_TYPE_IS_I(pdu) && if (!LLC_PDU_TYPE_IS_I(pdu) &&
!(skb->dev->flags & IFF_LOOPBACK)) !(skb->dev->flags & IFF_LOOPBACK))
...@@ -297,7 +297,8 @@ void llc_conn_free_ev(struct llc_conn_state_ev *ev) ...@@ -297,7 +297,8 @@ void llc_conn_free_ev(struct llc_conn_state_ev *ev)
{ {
if (ev->type == LLC_CONN_EV_TYPE_PDU) { if (ev->type == LLC_CONN_EV_TYPE_PDU) {
/* free the frame that binded to this event */ /* free the frame that binded to this event */
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_sn *pdu =
(struct llc_pdu_sn *)ev->data.pdu.skb->nh.raw;
if (LLC_PDU_TYPE_IS_I(pdu) || !ev->flag || !ev->ind_prim) if (LLC_PDU_TYPE_IS_I(pdu) || !ev->flag || !ev->ind_prim)
kfree_skb(ev->data.pdu.skb); kfree_skb(ev->data.pdu.skb);
...@@ -488,7 +489,6 @@ void __init llc_build_offset_table(void) ...@@ -488,7 +489,6 @@ void __init llc_build_offset_table(void)
struct llc_conn_state *curr_state; struct llc_conn_state *curr_state;
int state, ev_type, next_offset; int state, ev_type, next_offset;
memset(llc_offset_table, 0, sizeof(llc_offset_table));
for (state = 0; state < NBR_CONN_STATES; state++) { for (state = 0; state < NBR_CONN_STATES; state++) {
curr_state = &llc_conn_state_table[state]; curr_state = &llc_conn_state_table[state];
next_offset = 0; next_offset = 0;
......
...@@ -56,7 +56,7 @@ int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct llc_station *station, ...@@ -56,7 +56,7 @@ int llc_stat_ev_ack_tmr_exp_eq_retry_cnt_max_retry(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station, int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_CMD(pdu) && /* command PDU */ !LLC_PDU_IS_CMD(pdu) && /* command PDU */
...@@ -68,7 +68,7 @@ int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station, ...@@ -68,7 +68,7 @@ int llc_stat_ev_rx_null_dsap_xid_c(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station, int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_RSP(pdu) && /* response PDU */ !LLC_PDU_IS_RSP(pdu) && /* response PDU */
...@@ -81,7 +81,7 @@ int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station, ...@@ -81,7 +81,7 @@ int llc_stat_ev_rx_null_dsap_0_xid_r_xid_r_cnt_eq(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station, int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_RSP(pdu) && /* response PDU */ !LLC_PDU_IS_RSP(pdu) && /* response PDU */
...@@ -94,7 +94,7 @@ int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station, ...@@ -94,7 +94,7 @@ int llc_stat_ev_rx_null_dsap_1_xid_r_xid_r_cnt_eq(struct llc_station *station,
int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station, int llc_stat_ev_rx_null_dsap_test_c(struct llc_station *station,
struct llc_station_state_ev *ev) struct llc_station_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_STATION_EV_TYPE_PDU && return ev->type == LLC_STATION_EV_TYPE_PDU &&
!LLC_PDU_IS_CMD(pdu) && /* command PDU */ !LLC_PDU_IS_CMD(pdu) && /* command PDU */
......
...@@ -77,8 +77,8 @@ static llc_prim_call_t llc_resp_prim[LLC_NBR_PRIMITIVES] = { ...@@ -77,8 +77,8 @@ static llc_prim_call_t llc_resp_prim[LLC_NBR_PRIMITIVES] = {
* @sap: pointer to allocated SAP (output argument). * @sap: pointer to allocated SAP (output argument).
* *
* Interface function to upper layer. each one who wants to get a SAP * Interface function to upper layer. each one who wants to get a SAP
* (for example NetBEUI) should call this function. Returns 0 for * (for example NetBEUI) should call this function. Returns the opened
* success, 1 for failure. * SAP for success, NULL for failure.
*/ */
struct llc_sap *llc_sap_open(llc_prim_call_t nw_indicate, struct llc_sap *llc_sap_open(llc_prim_call_t nw_indicate,
llc_prim_call_t nw_confirm, u8 lsap) llc_prim_call_t nw_confirm, u8 lsap)
......
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
#include <net/llc_evnt.h> #include <net/llc_evnt.h>
#include <net/llc_c_ev.h> #include <net/llc_c_ev.h>
#include <net/llc_s_ev.h> #include <net/llc_s_ev.h>
#ifdef CONFIG_TR #include <linux/trdevice.h>
extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh,
struct net_device *dev);
#endif
/* function prototypes */ /* function prototypes */
static void fix_up_incoming_skb(struct sk_buff *skb); static void fix_up_incoming_skb(struct sk_buff *skb);
...@@ -78,7 +76,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev, ...@@ -78,7 +76,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt) struct packet_type *pt)
{ {
struct llc_sap *sap; struct llc_sap *sap;
llc_pdu_sn_t *pdu; struct llc_pdu_sn *pdu;
u8 dest; u8 dest;
/* When the interface is in promisc. mode, drop all the crap that it /* When the interface is in promisc. mode, drop all the crap that it
...@@ -92,7 +90,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev, ...@@ -92,7 +90,7 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
if (!skb) if (!skb)
goto out; goto out;
fix_up_incoming_skb(skb); fix_up_incoming_skb(skb);
pdu = (llc_pdu_sn_t *)skb->nh.raw; pdu = (struct llc_pdu_sn *)skb->nh.raw;
if (!pdu->dsap) { /* NULL DSAP, refer to station */ if (!pdu->dsap) { /* NULL DSAP, refer to station */
llc_pdu_router(NULL, NULL, skb, 0); llc_pdu_router(NULL, NULL, skb, 0);
goto out; goto out;
...@@ -165,11 +163,12 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev, ...@@ -165,11 +163,12 @@ int mac_indicate(struct sk_buff *skb, struct net_device *dev,
static void fix_up_incoming_skb(struct sk_buff *skb) static void fix_up_incoming_skb(struct sk_buff *skb)
{ {
u8 llc_len = 2; u8 llc_len = 2;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->data; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->data;
if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) == LLC_PDU_TYPE_U) if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) == LLC_PDU_TYPE_U)
llc_len = 1; llc_len = 1;
llc_len += 2; llc_len += 2;
skb->h.raw += llc_len;
skb_pull(skb, llc_len); skb_pull(skb, llc_len);
if (skb->protocol == htons(ETH_P_802_2)) { if (skb->protocol == htons(ETH_P_802_2)) {
u16 pdulen = ((struct ethhdr *)skb->mac.raw)->h_proto, u16 pdulen = ((struct ethhdr *)skb->mac.raw)->h_proto,
...@@ -197,7 +196,7 @@ static void fix_up_incoming_skb(struct sk_buff *skb) ...@@ -197,7 +196,7 @@ static void fix_up_incoming_skb(struct sk_buff *skb)
int llc_pdu_router(struct llc_sap *sap, struct sock* sk, int llc_pdu_router(struct llc_sap *sap, struct sock* sk,
struct sk_buff *skb, u8 type) struct sk_buff *skb, u8 type)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
int rc = 0; int rc = 0;
if (!pdu->dsap) { if (!pdu->dsap) {
...@@ -246,17 +245,15 @@ int llc_pdu_router(struct llc_sap *sap, struct sock* sk, ...@@ -246,17 +245,15 @@ int llc_pdu_router(struct llc_sap *sap, struct sock* sk,
*/ */
u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da) u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da)
{ {
u8 *saddr;
u8 *daddr;
u16 rc = 0; u16 rc = 0;
switch (skb->dev->type) { switch (skb->dev->type) {
#ifdef CONFIG_TR #ifdef CONFIG_TR
case ARPHRD_IEEE802_TR: { case ARPHRD_IEEE802_TR: {
struct trh_hdr *trh = (struct trh_hdr *) struct trh_hdr *trh;
skb_push(skb, sizeof(*trh));
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
trh = (struct trh_hdr *)skb_push(skb, sizeof(*trh));
trh->ac = AC; trh->ac = AC;
trh->fc = LLC_FRAME; trh->fc = LLC_FRAME;
if (sa) if (sa)
...@@ -274,14 +271,13 @@ u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da) ...@@ -274,14 +271,13 @@ u16 lan_hdrs_init(struct sk_buff *skb, u8 *sa, u8 *da)
case ARPHRD_ETHER: case ARPHRD_ETHER:
case ARPHRD_LOOPBACK: { case ARPHRD_LOOPBACK: {
unsigned short len = skb->len; unsigned short len = skb->len;
struct ethhdr *eth;
skb->mac.raw = skb_push(skb, sizeof(struct ethhdr)); skb->mac.raw = skb_push(skb, sizeof(*eth));
memset(skb->mac.raw, 0, sizeof(struct ethhdr)); eth = (struct ethhdr *)skb->mac.raw;
((struct ethhdr *)skb->mac.raw)->h_proto = htons(len); eth->h_proto = htons(len);
daddr = ((struct ethhdr *)skb->mac.raw)->h_dest; memcpy(eth->h_dest, da, ETH_ALEN);
saddr = ((struct ethhdr *)skb->mac.raw)->h_source; memcpy(eth->h_source, sa, ETH_ALEN);
memcpy(daddr, da, ETH_ALEN);
memcpy(saddr, sa, ETH_ALEN);
break; break;
} }
default: default:
......
...@@ -600,23 +600,23 @@ static int __init llc_init(void) ...@@ -600,23 +600,23 @@ static int __init llc_init(void)
ev = kmalloc(sizeof(*ev), GFP_ATOMIC); ev = kmalloc(sizeof(*ev), GFP_ATOMIC);
if (!ev) if (!ev)
goto err; goto err;
llc_build_offset_table();
memset(ev, 0, sizeof(*ev)); memset(ev, 0, sizeof(*ev));
if(dev_base->next) if(dev_base->next)
memcpy(llc_main_station.mac_sa, dev_base->next->dev_addr, ETH_ALEN); memcpy(llc_main_station.mac_sa, dev_base->next->dev_addr, ETH_ALEN);
else else
memset(llc_main_station.mac_sa, 0, ETH_ALEN); memset(llc_main_station.mac_sa, 0, ETH_ALEN);
llc_main_station.ack_timer.expires = jiffies + 3 * HZ; llc_main_station.ack_timer.expires = jiffies + 3 * HZ;
/* initialize the station component */
llc_register_sap(0, mac_indicate);
llc_main_station.maximum_retry = 1; llc_main_station.maximum_retry = 1;
llc_main_station.state = LLC_STATION_STATE_DOWN; llc_main_station.state = LLC_STATION_STATE_DOWN;
ev->type = LLC_STATION_EV_TYPE_SIMPLE; ev->type = LLC_STATION_EV_TYPE_SIMPLE;
ev->data.a.ev = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK; ev->data.a.ev = LLC_STATION_EV_ENABLE_WITHOUT_DUP_ADDR_CHECK;
rc = llc_station_next_state(&llc_main_station, ev); rc = llc_station_next_state(&llc_main_station, ev);
llc_build_offset_table();
llc_ind_prim.data = &llc_ind_data_prim; llc_ind_prim.data = &llc_ind_data_prim;
llc_cfm_prim.data = &llc_cfm_data_prim; llc_cfm_prim.data = &llc_cfm_data_prim;
proc_net_create("802.2", 0, llc_proc_get_info); proc_net_create("802.2", 0, llc_proc_get_info);
/* initialize the station component */
llc_register_sap(0, mac_indicate);
llc_ui_init(); llc_ui_init();
out: out:
return rc; return rc;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type); static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type);
static int llc_get_llc_hdr_length(u8 pdu_type); static int llc_get_llc_hdr_length(u8 pdu_type);
static u8 llc_pdu_get_pf_bit(llc_pdu_sn_t *pdu); static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu);
/** /**
* llc_pdu_header_init - initializes pdu header * llc_pdu_header_init - initializes pdu header
...@@ -35,18 +35,18 @@ static u8 llc_pdu_get_pf_bit(llc_pdu_sn_t *pdu); ...@@ -35,18 +35,18 @@ static u8 llc_pdu_get_pf_bit(llc_pdu_sn_t *pdu);
void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap, void llc_pdu_header_init(struct sk_buff *skb, u8 pdu_type, u8 ssap,
u8 dsap, u8 cr) u8 dsap, u8 cr)
{ {
llc_pdu_un_t *p; struct llc_pdu_un *pdu;
skb->nh.raw = skb_push(skb, llc_get_llc_hdr_length(pdu_type)); skb->nh.raw = skb_push(skb, llc_get_llc_hdr_length(pdu_type));
p = (llc_pdu_un_t *)skb->nh.raw; pdu = (struct llc_pdu_un *)skb->nh.raw;
p->dsap = dsap; pdu->dsap = dsap;
p->ssap = ssap; pdu->ssap = ssap;
p->ssap |= cr; pdu->ssap |= cr;
} }
void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 pdu_type) void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 pdu_type)
{ {
((llc_pdu_un_t *)skb->nh.raw)->ssap |= pdu_type; ((struct llc_pdu_un *)skb->nh.raw)->ssap |= pdu_type;
} }
/** /**
...@@ -61,20 +61,20 @@ void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 pdu_type) ...@@ -61,20 +61,20 @@ void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 pdu_type)
void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value) void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value)
{ {
u8 pdu_type; u8 pdu_type;
struct llc_pdu_sn *pdu;
if (llc_pdu_decode_pdu_type(skb, &pdu_type)) if (llc_pdu_decode_pdu_type(skb, &pdu_type))
goto out; goto out;
pdu = (struct llc_pdu_sn *)skb->nh.raw;
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
case LLC_PDU_TYPE_S: case LLC_PDU_TYPE_S:
((llc_pdu_sn_t *)skb->nh.raw)->ctrl_2 = pdu->ctrl_2 = (pdu->ctrl_2 & 0xFE) | bit_value;
(((llc_pdu_sn_t *)skb->nh.raw)->ctrl_2 & 0xFE) |
bit_value;
break; break;
case LLC_PDU_TYPE_U: case LLC_PDU_TYPE_U:
((llc_pdu_un_t *)skb->nh.raw)->ctrl_1 |= pdu->ctrl_1 |= (pdu->ctrl_1 & 0xEF) | (bit_value << 4);
(((llc_pdu_un_t *)skb->nh.raw)->ctrl_1 & 0xEF) |
(bit_value << 4);
break; break;
} }
out:; out:;
...@@ -92,19 +92,21 @@ out:; ...@@ -92,19 +92,21 @@ out:;
int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit) int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit)
{ {
u8 pdu_type; u8 pdu_type;
struct llc_pdu_sn *pdu;
int rc = llc_pdu_decode_pdu_type(skb, &pdu_type); int rc = llc_pdu_decode_pdu_type(skb, &pdu_type);
if (rc) if (rc)
goto out; goto out;
pdu = (struct llc_pdu_sn *)skb->nh.raw;
switch (pdu_type) { switch (pdu_type) {
case LLC_PDU_TYPE_I: case LLC_PDU_TYPE_I:
case LLC_PDU_TYPE_S: case LLC_PDU_TYPE_S:
*pf_bit = ((llc_pdu_sn_t *)skb->nh.raw)->ctrl_2 & *pf_bit = pdu->ctrl_2 & LLC_S_PF_BIT_MASK;
LLC_S_PF_BIT_MASK;
break; break;
case LLC_PDU_TYPE_U: case LLC_PDU_TYPE_U:
*pf_bit = (((llc_pdu_un_t *)skb->nh.raw)->ctrl_1 & *pf_bit = (pdu->ctrl_1 & LLC_U_PF_BIT_MASK) >> 4;
LLC_U_PF_BIT_MASK) >> 4;
break; break;
} }
out: out:
...@@ -121,7 +123,8 @@ int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit) ...@@ -121,7 +123,8 @@ int llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit)
*/ */
int llc_pdu_decode_cr_bit(struct sk_buff *skb, u8 *cr_bit) int llc_pdu_decode_cr_bit(struct sk_buff *skb, u8 *cr_bit)
{ {
*cr_bit = ((llc_pdu_un_t *)skb->nh.raw)->ssap & LLC_PDU_CMD_RSP_MASK; *cr_bit = ((struct llc_pdu_un *)skb->nh.raw)->ssap &
LLC_PDU_CMD_RSP_MASK;
return 0; return 0;
} }
...@@ -167,7 +170,7 @@ int llc_pdu_decode_da(struct sk_buff *skb, u8 *da) ...@@ -167,7 +170,7 @@ int llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
*/ */
int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap) int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap)
{ {
*dsap = ((llc_pdu_un_t *)skb->nh.raw)->dsap & 0xFE; *dsap = ((struct llc_pdu_un *)skb->nh.raw)->dsap & 0xFE;
return 0; return 0;
} }
...@@ -181,7 +184,7 @@ int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap) ...@@ -181,7 +184,7 @@ int llc_pdu_decode_dsap(struct sk_buff *skb, u8 *dsap)
*/ */
int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap) int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap)
{ {
*ssap = ((llc_pdu_un_t *)skb->nh.raw)->ssap & 0xFE; *ssap = ((struct llc_pdu_un *)skb->nh.raw)->ssap & 0xFE;
return 0; return 0;
} }
...@@ -193,7 +196,7 @@ int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap) ...@@ -193,7 +196,7 @@ int llc_pdu_decode_ssap(struct sk_buff *skb, u8 *ssap)
*/ */
int llc_pdu_init_as_ui_cmd(struct sk_buff *skb) int llc_pdu_init_as_ui_cmd(struct sk_buff *skb)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_UI; pdu->ctrl_1 |= LLC_1_PDU_CMD_UI;
...@@ -210,13 +213,13 @@ int llc_pdu_init_as_ui_cmd(struct sk_buff *skb) ...@@ -210,13 +213,13 @@ int llc_pdu_init_as_ui_cmd(struct sk_buff *skb)
int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported, int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported,
u8 rx_window) u8 rx_window)
{ {
llc_xid_info_t *xid_info; struct llc_xid_info *xid_info;
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_XID; pdu->ctrl_1 |= LLC_1_PDU_CMD_XID;
pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; pdu->ctrl_1 |= LLC_U_PF_BIT_MASK;
xid_info = (llc_xid_info_t *)(((u8 *)&pdu->ctrl_1) + 1); xid_info = (struct llc_xid_info *)(((u8 *)&pdu->ctrl_1) + 1);
xid_info->fmt_id = LLC_XID_FMT_ID; /* 0x81 */ xid_info->fmt_id = LLC_XID_FMT_ID; /* 0x81 */
xid_info->type = svcs_supported; xid_info->type = svcs_supported;
xid_info->rw = rx_window << 1; /* size of recieve window */ xid_info->rw = rx_window << 1; /* size of recieve window */
...@@ -232,7 +235,7 @@ int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported, ...@@ -232,7 +235,7 @@ int llc_pdu_init_as_xid_cmd(struct sk_buff *skb, u8 svcs_supported,
*/ */
int llc_pdu_init_as_test_cmd(struct sk_buff *skb) int llc_pdu_init_as_test_cmd(struct sk_buff *skb)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST;
...@@ -249,7 +252,7 @@ int llc_pdu_init_as_test_cmd(struct sk_buff *skb) ...@@ -249,7 +252,7 @@ int llc_pdu_init_as_test_cmd(struct sk_buff *skb)
*/ */
int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit) int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_CMD_DISC; pdu->ctrl_1 |= LLC_2_PDU_CMD_DISC;
...@@ -268,7 +271,7 @@ int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit) ...@@ -268,7 +271,7 @@ int llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit)
*/ */
int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr) int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_I; pdu->ctrl_1 = LLC_PDU_TYPE_I;
pdu->ctrl_2 = 0; pdu->ctrl_2 = 0;
...@@ -288,7 +291,7 @@ int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr) ...@@ -288,7 +291,7 @@ int llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr)
*/ */
int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_REJ; pdu->ctrl_1 |= LLC_2_PDU_CMD_REJ;
...@@ -309,7 +312,7 @@ int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) ...@@ -309,7 +312,7 @@ int llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
*/ */
int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_RNR; pdu->ctrl_1 |= LLC_2_PDU_CMD_RNR;
...@@ -330,7 +333,7 @@ int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) ...@@ -330,7 +333,7 @@ int llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
*/ */
int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_RR; pdu->ctrl_1 |= LLC_2_PDU_CMD_RR;
...@@ -349,7 +352,7 @@ int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) ...@@ -349,7 +352,7 @@ int llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr)
*/ */
int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit) int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_CMD_SABME; pdu->ctrl_1 |= LLC_2_PDU_CMD_SABME;
...@@ -366,7 +369,7 @@ int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit) ...@@ -366,7 +369,7 @@ int llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit)
*/ */
int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit) int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_DM; pdu->ctrl_1 |= LLC_2_PDU_RSP_DM;
...@@ -385,14 +388,14 @@ int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit) ...@@ -385,14 +388,14 @@ int llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit)
int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported, int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
u8 rx_window) u8 rx_window)
{ {
llc_xid_info_t *xid_info; struct llc_xid_info *xid_info;
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_XID; pdu->ctrl_1 |= LLC_1_PDU_CMD_XID;
pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; pdu->ctrl_1 |= LLC_U_PF_BIT_MASK;
xid_info = (llc_xid_info_t *)(((u8 *)&pdu->ctrl_1) + 1); xid_info = (struct llc_xid_info *)(((u8 *)&pdu->ctrl_1) + 1);
xid_info->fmt_id = LLC_XID_FMT_ID; xid_info->fmt_id = LLC_XID_FMT_ID;
xid_info->type = svcs_supported; xid_info->type = svcs_supported;
xid_info->rw = rx_window << 1; xid_info->rw = rx_window << 1;
...@@ -410,7 +413,7 @@ int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported, ...@@ -410,7 +413,7 @@ int llc_pdu_init_as_xid_rsp(struct sk_buff *skb, u8 svcs_supported,
int llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct sk_buff *ev_skb) int llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct sk_buff *ev_skb)
{ {
int dsize; int dsize;
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST;
...@@ -435,19 +438,19 @@ int llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct sk_buff *ev_skb) ...@@ -435,19 +438,19 @@ int llc_pdu_init_as_test_rsp(struct sk_buff *skb, struct sk_buff *ev_skb)
* *
* Builds a pdu frame as a FRMR response. * Builds a pdu frame as a FRMR response.
*/ */
int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, llc_pdu_sn_t *prev_pdu, int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
u8 f_bit, u8 vs, u8 vr, u8 vzyxw) u8 f_bit, u8 vs, u8 vr, u8 vzyxw)
{ {
llc_frmr_info_t *frmr_info; struct llc_frmr_info *frmr_info;
u8 prev_pf = 0; u8 prev_pf = 0;
u8 *ctrl; u8 *ctrl;
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_FRMR; pdu->ctrl_1 |= LLC_2_PDU_RSP_FRMR;
pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK; pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK;
frmr_info = (llc_frmr_info_t *)&pdu->ctrl_2; frmr_info = (struct llc_frmr_info *)&pdu->ctrl_2;
ctrl = (u8 *)&prev_pdu->ctrl_1; ctrl = (u8 *)&prev_pdu->ctrl_1;
FRMR_INFO_SET_REJ_CNTRL(frmr_info,ctrl); FRMR_INFO_SET_REJ_CNTRL(frmr_info,ctrl);
FRMR_INFO_SET_Vs(frmr_info, vs); FRMR_INFO_SET_Vs(frmr_info, vs);
...@@ -473,7 +476,7 @@ int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, llc_pdu_sn_t *prev_pdu, ...@@ -473,7 +476,7 @@ int llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, llc_pdu_sn_t *prev_pdu,
*/ */
int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_RR; pdu->ctrl_1 |= LLC_2_PDU_RSP_RR;
...@@ -494,7 +497,7 @@ int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) ...@@ -494,7 +497,7 @@ int llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
*/ */
int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_REJ; pdu->ctrl_1 |= LLC_2_PDU_RSP_REJ;
...@@ -515,7 +518,7 @@ int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) ...@@ -515,7 +518,7 @@ int llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
*/ */
int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
{ {
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_S; pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_RSP_RNR; pdu->ctrl_1 |= LLC_2_PDU_RSP_RNR;
...@@ -535,7 +538,7 @@ int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr) ...@@ -535,7 +538,7 @@ int llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr)
*/ */
int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit) int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
pdu->ctrl_1 = LLC_PDU_TYPE_U; pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_UA; pdu->ctrl_1 |= LLC_2_PDU_RSP_UA;
...@@ -552,7 +555,7 @@ int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit) ...@@ -552,7 +555,7 @@ int llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit)
*/ */
static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type) static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)skb->nh.raw;
if (pdu->ctrl_1 & 1) { if (pdu->ctrl_1 & 1) {
if ((pdu->ctrl_1 & LLC_PDU_TYPE_U) == LLC_PDU_TYPE_U) if ((pdu->ctrl_1 & LLC_PDU_TYPE_U) == LLC_PDU_TYPE_U)
...@@ -574,7 +577,7 @@ static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type) ...@@ -574,7 +577,7 @@ static int llc_pdu_decode_pdu_type(struct sk_buff *skb, u8 *type)
int llc_decode_pdu_type(struct sk_buff *skb, u8 *dest) int llc_decode_pdu_type(struct sk_buff *skb, u8 *dest)
{ {
u8 type = LLC_DEST_CONN; /* I-PDU or S-PDU type */ u8 type = LLC_DEST_CONN; /* I-PDU or S-PDU type */
llc_pdu_sn_t *pdu = (llc_pdu_sn_t *)skb->nh.raw; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U) if ((pdu->ctrl_1 & LLC_PDU_TYPE_MASK) != LLC_PDU_TYPE_U)
goto out; goto out;
...@@ -629,7 +632,7 @@ static int llc_get_llc_hdr_length(u8 pdu_type) ...@@ -629,7 +632,7 @@ static int llc_get_llc_hdr_length(u8 pdu_type)
* This function extracts p/f bit of input PDU. at first examines type of * This function extracts p/f bit of input PDU. at first examines type of
* PDU and then extracts p/f bit. Returns the p/f bit. * PDU and then extracts p/f bit. Returns the p/f bit.
*/ */
static u8 llc_pdu_get_pf_bit(llc_pdu_sn_t *pdu) static u8 llc_pdu_get_pf_bit(struct llc_pdu_sn *pdu)
{ {
u8 pdu_type; u8 pdu_type;
u8 pf_bit = 0; u8 pf_bit = 0;
......
...@@ -28,7 +28,7 @@ int llc_sap_ev_activation_req(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -28,7 +28,7 @@ int llc_sap_ev_activation_req(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_ui(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_ui(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -52,7 +52,7 @@ int llc_sap_ev_xid_req(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -52,7 +52,7 @@ int llc_sap_ev_xid_req(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -61,7 +61,7 @@ int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -61,7 +61,7 @@ int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -77,7 +77,7 @@ int llc_sap_ev_test_req(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -77,7 +77,7 @@ int llc_sap_ev_test_req(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_CMD(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
...@@ -86,7 +86,7 @@ int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -86,7 +86,7 @@ int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct llc_sap_state_ev *ev)
int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct llc_sap_state_ev *ev) int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu = (struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) && return ev->type == LLC_SAP_EV_TYPE_PDU && !LLC_PDU_IS_RSP(pdu) &&
!LLC_PDU_TYPE_IS_U(pdu) && !LLC_PDU_TYPE_IS_U(pdu) &&
......
...@@ -111,7 +111,7 @@ void llc_sap_send_ev(struct llc_sap *sap, struct llc_sap_state_ev *ev) ...@@ -111,7 +111,7 @@ void llc_sap_send_ev(struct llc_sap *sap, struct llc_sap_state_ev *ev)
void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb, void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb,
struct llc_sap_state_ev *ev) struct llc_sap_state_ev *ev)
{ {
llc_pdu_un_t *pdu; struct llc_pdu_un *pdu;
struct llc_prim_if_block *prim = &llc_ind_prim; struct llc_prim_if_block *prim = &llc_ind_prim;
union llc_u_prim_data *prim_data = llc_ind_prim.data; union llc_u_prim_data *prim_data = llc_ind_prim.data;
u8 lfb; u8 lfb;
...@@ -122,7 +122,7 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb, ...@@ -122,7 +122,7 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb,
llc_pdu_decode_ssap(skb, &prim_data->udata.saddr.lsap); llc_pdu_decode_ssap(skb, &prim_data->udata.saddr.lsap);
prim_data->udata.pri = 0; prim_data->udata.pri = 0;
prim_data->udata.skb = skb; prim_data->udata.skb = skb;
pdu = (llc_pdu_un_t *)skb->nh.raw; pdu = (struct llc_pdu_un *)skb->nh.raw;
switch (LLC_U_PDU_RSP(pdu)) { switch (LLC_U_PDU_RSP(pdu)) {
case LLC_1_PDU_CMD_TEST: case LLC_1_PDU_CMD_TEST:
prim->prim = LLC_TEST_PRIM; prim->prim = LLC_TEST_PRIM;
...@@ -170,7 +170,8 @@ void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb) ...@@ -170,7 +170,8 @@ void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb)
static void llc_sap_free_ev(struct llc_sap *sap, struct llc_sap_state_ev *ev) static void llc_sap_free_ev(struct llc_sap *sap, struct llc_sap_state_ev *ev)
{ {
if (ev->type == LLC_SAP_EV_TYPE_PDU) { if (ev->type == LLC_SAP_EV_TYPE_PDU) {
llc_pdu_un_t *pdu = (llc_pdu_un_t *)ev->data.pdu.skb->nh.raw; struct llc_pdu_un *pdu =
(struct llc_pdu_un *)ev->data.pdu.skb->nh.raw;
if (LLC_U_PDU_CMD(pdu) != LLC_1_PDU_CMD_UI) if (LLC_U_PDU_CMD(pdu) != LLC_1_PDU_CMD_UI)
kfree_skb(ev->data.pdu.skb); kfree_skb(ev->data.pdu.skb);
......
...@@ -17,37 +17,61 @@ ...@@ -17,37 +17,61 @@
#include <linux/sysctl.h> #include <linux/sysctl.h>
#ifdef CONFIG_INET #ifdef CONFIG_INET
extern ctl_table ipv4_table[]; extern struct ctl_table ipv4_table[];
#endif #endif
extern ctl_table core_table[]; extern struct ctl_table core_table[];
#ifdef CONFIG_NET #ifdef CONFIG_NET
extern ctl_table ether_table[], e802_table[]; extern struct ctl_table ether_table[];
#endif #endif
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
extern ctl_table ipv6_table[]; extern struct ctl_table ipv6_table[];
#endif #endif
#ifdef CONFIG_TR #ifdef CONFIG_TR
extern ctl_table tr_table[]; extern struct ctl_table tr_table[];
#endif #endif
ctl_table net_table[] = { struct ctl_table net_table[] = {
{NET_CORE, "core", NULL, 0, 0555, core_table}, {
.ctl_name = NET_CORE,
.procname = "core",
.mode = 0555,
.child = core_table,
},
#ifdef CONFIG_NET #ifdef CONFIG_NET
{NET_802, "802", NULL, 0, 0555, e802_table}, {
{NET_ETHER, "ethernet", NULL, 0, 0555, ether_table}, .ctl_name = NET_ETHER,
.procname = "ethernet",
.mode = 0555,
.child = ether_table,
},
#endif #endif
#ifdef CONFIG_INET #ifdef CONFIG_INET
{NET_IPV4, "ipv4", NULL, 0, 0555, ipv4_table}, {
.ctl_name = NET_IPV4,
.procname = "ipv4",
.mode = 0555,
.child = ipv4_table
},
#endif #endif
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
{NET_IPV6, "ipv6", NULL, 0, 0555, ipv6_table}, {
.ctl_name = NET_IPV6,
.procname = "ipv6",
.mode = 0555,
.child = ipv6_table,
},
#endif #endif
#ifdef CONFIG_TR #ifdef CONFIG_TR
{NET_TR, "token-ring", NULL, 0, 0555, tr_table}, {
.ctl_name = NET_TR,
.procname = "token-ring",
.mode = 0555,
.child = tr_table,
},
#endif #endif
{0} { 0 },
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment