Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/acme/llc-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
David S. Miller committed Sep 26, 2005
2 parents 188bab3 + 8420e1b commit 56e9b26
Show file tree
Hide file tree
Showing 22 changed files with 875 additions and 614 deletions.
26 changes: 25 additions & 1 deletion include/linux/sysctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ enum
NET_TR=14,
NET_DECNET=15,
NET_ECONET=16,
NET_SCTP=17,
NET_SCTP=17,
NET_LLC=18,
};

/* /proc/sys/kernel/random */
Expand Down Expand Up @@ -522,6 +523,29 @@ enum {
NET_IPX_FORWARDING=2
};

/* /proc/sys/net/llc */
enum {
NET_LLC2=1,
NET_LLC_STATION=2,
};

/* /proc/sys/net/llc/llc2 */
enum {
NET_LLC2_TIMEOUT=1,
};

/* /proc/sys/net/llc/station */
enum {
NET_LLC_STATION_ACK_TIMEOUT=1,
};

/* /proc/sys/net/llc/llc2/timeout */
enum {
NET_LLC2_ACK_TIMEOUT=1,
NET_LLC2_P_TIMEOUT=2,
NET_LLC2_REJ_TIMEOUT=3,
NET_LLC2_BUSY_TIMEOUT=4,
};

/* /proc/sys/net/appletalk */
enum {
Expand Down
30 changes: 30 additions & 0 deletions include/net/llc.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <linux/list.h>
#include <linux/spinlock.h>

#include <asm/atomic.h>

struct net_device;
struct packet_type;
struct sk_buff;
Expand Down Expand Up @@ -44,6 +46,7 @@ struct llc_sap {
unsigned char state;
unsigned char p_bit;
unsigned char f_bit;
atomic_t refcnt;
int (*rcv_func)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt,
Expand Down Expand Up @@ -81,13 +84,27 @@ extern struct llc_sap *llc_sap_open(unsigned char lsap,
struct net_device *dev,
struct packet_type *pt,
struct net_device *orig_dev));
static inline void llc_sap_hold(struct llc_sap *sap)
{
atomic_inc(&sap->refcnt);
}

extern void llc_sap_close(struct llc_sap *sap);

static inline void llc_sap_put(struct llc_sap *sap)
{
if (atomic_dec_and_test(&sap->refcnt))
llc_sap_close(sap);
}

extern struct llc_sap *llc_sap_find(unsigned char sap_value);

extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
unsigned char *dmac, unsigned char dsap);

extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);

extern int llc_station_init(void);
extern void llc_station_exit(void);

Expand All @@ -98,4 +115,17 @@ extern void llc_proc_exit(void);
#define llc_proc_init() (0)
#define llc_proc_exit() do { } while(0)
#endif /* CONFIG_PROC_FS */
#ifdef CONFIG_SYSCTL
extern int llc_sysctl_init(void);
extern void llc_sysctl_exit(void);

extern int sysctl_llc2_ack_timeout;
extern int sysctl_llc2_busy_timeout;
extern int sysctl_llc2_p_timeout;
extern int sysctl_llc2_rej_timeout;
extern int sysctl_llc_station_ack_timeout;
#else
#define llc_sysctl_init() (0)
#define llc_sysctl_exit() do { } while(0)
#endif /* CONFIG_SYSCTL */
#endif /* LLC_H */
15 changes: 8 additions & 7 deletions include/net/llc_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
#define LLC_EVENT 1
#define LLC_PACKET 2

#define LLC_P_TIME 2
#define LLC_ACK_TIME 1
#define LLC_REJ_TIME 3
#define LLC_BUSY_TIME 3
#define LLC2_P_TIME 2
#define LLC2_ACK_TIME 1
#define LLC2_REJ_TIME 3
#define LLC2_BUSY_TIME 3

struct llc_timer {
struct timer_list timer;
u16 expire; /* timer expire time */
unsigned long expire; /* timer expire time */
};

struct llc_sock {
Expand All @@ -38,6 +38,7 @@ struct llc_sock {
struct llc_addr laddr; /* lsap/mac pair */
struct llc_addr daddr; /* dsap/mac pair */
struct net_device *dev; /* device to send to remote */
u32 copied_seq; /* head of yet unread data */
u8 retry_count; /* number of retries */
u8 ack_must_be_send;
u8 first_pdu_Ns;
Expand Down Expand Up @@ -92,7 +93,8 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
return skb->cb[sizeof(skb->cb) - 1];
}

extern struct sock *llc_sk_alloc(int family, int priority, struct proto *prot);
extern struct sock *llc_sk_alloc(int family, unsigned int __nocast priority,
struct proto *prot);
extern void llc_sk_free(struct sock *sk);

extern void llc_sk_reset(struct sock *sk);
Expand All @@ -115,5 +117,4 @@ extern void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);

extern u8 llc_data_accept_state(u8 state);
extern void llc_build_offset_table(void);
extern int llc_release_sockets(struct llc_sap *sap);
#endif /* LLC_CONN_H */
8 changes: 6 additions & 2 deletions include/net/llc_sap.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
* See the GNU General Public License for more details.
*/
struct llc_sap;
struct net_device;
struct sk_buff;
struct sock;

extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_save_primitive(struct sk_buff* skb, unsigned char prim);
extern struct sk_buff *llc_alloc_frame(void);
extern void llc_save_primitive(struct sock *sk, struct sk_buff* skb,
unsigned char prim);
extern struct sk_buff *llc_alloc_frame(struct sock *sk,
struct net_device *dev);

extern void llc_build_and_send_test_pkt(struct llc_sap *sap,
struct sk_buff *skb,
Expand Down
2 changes: 1 addition & 1 deletion net/802/p8022.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct datalink_proto *register_8022_client(unsigned char type,

void unregister_8022_client(struct datalink_proto *proto)
{
llc_sap_close(proto->sap);
llc_sap_put(proto->sap);
kfree(proto);
}

Expand Down
2 changes: 1 addition & 1 deletion net/802/psnap.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module_init(snap_init);

static void __exit snap_exit(void)
{
llc_sap_close(snap_sap);
llc_sap_put(snap_sap);
}

module_exit(snap_exit);
Expand Down
2 changes: 1 addition & 1 deletion net/802/tr.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev)
return trllc->ethertype;
}

return ntohs(ETH_P_802_2);
return ntohs(ETH_P_TR_802_2);
}

/*
Expand Down
2 changes: 2 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ struct net_device *dev_getbyhwaddr(unsigned short type, char *ha)
return dev;
}

EXPORT_SYMBOL(dev_getbyhwaddr);

struct net_device *dev_getfirstbyhwtype(unsigned short type)
{
struct net_device *dev;
Expand Down
1 change: 1 addition & 0 deletions net/llc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ llc2-y := llc_if.o llc_c_ev.o llc_c_ac.o llc_conn.o llc_c_st.o llc_pdu.o \
llc_sap.o llc_s_ac.o llc_s_ev.o llc_s_st.o af_llc.o llc_station.o

llc2-$(CONFIG_PROC_FS) += llc_proc.o
llc2-$(CONFIG_SYSCTL) += sysctl_net_llc.o
Loading

0 comments on commit 56e9b26

Please sign in to comment.