Patch : IrNET v6
Hi,
This is the next revision of IrNET.
The main big difference compared to the previous version is
"connection retries". Basically, instead of trying the IrDA connection only once, we retry the full IrDA connection for as long as PPP is trying to set up LCP. The IrDA connection may fail for various reasons (device not aligned, packet loss, IrLAP not yet disconnected...). This way, the user doesn't have to kill and restart the PPP instance by himself.
There are other minor fixes to support multiple IrDA dongle
properly from the IrNET control channel, plus a few cleanups.
I did some heavy testing of the new code, and it basically
works and do what it's supposed to do. I've reported the few IrDA pecularities to Dag, as usual...
Alan : would you mind adding that to your tree ?
Linus : maybe you want to wait until the result of testing in
Alan's tree.
Have fun... Jean
net/irda/irnet/irnet.h renamed from net/irda/irnet-v5/irnet.h +33 -12
@@ -168,6 +168,23 @@* (but PPP doesn't read the MTU value :-() * o Declare hashbin HB_NOLOCK instead of HB_LOCAL to avoid * disabling and enabling irq twice +* +* v6 - 31/05/01 - Jean II +* o Print source address in Found, Discovery, Expiry & Request events +* o Print requested source address in /proc/net/irnet +* o Change control channel input. Allow multiple commands in one line. +* o Add saddr command to change ap->rsaddr (and use that in IrDA) +* --- +* o Make the IrDA connection procedure totally asynchronous. +* Heavy rewrite of the IAS query code and the whole connection +* procedure. Now, irnet_connect() no longer need to be called from +* a process context... +* o Enable IrDA connect retries in ppp_irnet_send(). The good thing +* is that IrDA connect retries are directly driven by PPP LCP +* retries (we retry for each LCP packet), so that everything +* is transparently controlled from pppd lcp-max-configure. +* o Add ttp_connect flag to prevent rentry on the connect procedure +* o Test and fixups to eliminate side effects of retries */ /***************************** INCLUDES *****************************/
@@ -181,6 +198,8 @@#include <linux/devfs_fs_kernel.h> #include <linux/netdevice.h> #include <linux/poll.h> +#include <linux/config.h> +#include <linux/ctype.h> /* isspace() */ #include <asm/uaccess.h> #include <linux/ppp_defs.h>
@@ -214,7 +233,7 @@/* PPP side of the business */ #define BLOCK_WHEN_CONNECT /* Block packets when connecting */ -#undef CONNECT_IN_SEND/* Will crash hard your box... */ +#define CONNECT_IN_SEND /* Retry IrDA connection procedure */ #undef FLUSH_TO_PPP/* Not sure about this one, let's play safe */ #undef SECURE_DEVIRNET/* Bah... */
@@ -249,9 +268,11 @@#define DEBUG_IRDA_SERV_INFO 0/* various info */ #define DEBUG_IRDA_SERV_ERROR 1/* problems */ #define DEBUG_IRDA_TCB_TRACE 0/* IRDA IrTTP callbacks */ -#define DEBUG_IRDA_OCB_TRACE 0/* IRDA other callbacks */ #define DEBUG_IRDA_CB_INFO 0/* various info */ #define DEBUG_IRDA_CB_ERROR 1/* problems */ +#define DEBUG_IRDA_OCB_TRACE 0/* IRDA other callbacks */ +#define DEBUG_IRDA_OCB_INFO 0/* various info */ +#define DEBUG_IRDA_OCB_ERROR 1/* problems */ #define DEBUG_ASSERT 0/* Verify all assertions */
@@ -351,13 +372,15 @@ typedef struct irnet_socket/* ------------------------ IrTTP part ------------------------ */ /* We create a pseudo "socket" over the IrDA tranport */ int ttp_open;/* Set when IrTTP is ready */ +int ttp_connect;/* Set when IrTTP is connecting */ struct tsap_cb * tsap;/* IrTTP instance (the connection) */ char rname[NICKNAME_MAX_LEN +1 ];/* IrDA nickname of destination */ -__u32 raddr;/* Requested peer IrDA address */ -__u32 saddr;/* my local IrDA address */ +__u32 rdaddr;/* Requested peer IrDA address */ +__u32 rsaddr;/* Requested local IrDA address */ __u32 daddr;/* actual peer IrDA address */ +__u32 saddr;/* my local IrDA address */ __u8 dtsap_sel;/* Remote TSAP selector */ __u8 stsap_sel;/* Local TSAP selector */
@@ -374,17 +397,14 @@ typedef struct irnet_socketint nslots;/* Number of slots for discovery */ struct iriap_cb * iriap;/* Used to query remote IAS */ -wait_queue_head_t query_wait;/* Wait for the answer to a query */ -struct ias_value * ias_result;/* Result of remote IAS query */ int errno;/* status of the IAS query */ -/* ---------------------- Optional parts ---------------------- */ -#ifdef INITIAL_DISCOVERY -/* Stuff used to dump discovery log */ +/* -------------------- Discovery log part -------------------- */ +/* Used by initial discovery on the control channel +* and by irnet_discover_daddr_and_lsap_sel() */ struct irda_device_info *discoveries;/* Copy of the discovery log */ int disco_index;/* Last read in the discovery log */ int disco_number;/* Size of the discovery log */ -#endif /* INITIAL_DISCOVERY */ } irnet_socket;
@@ -411,8 +431,9 @@ typedef struct irnet_log {irnet_event event;int unit; -__u32 addr; -char name[NICKNAME_MAX_LEN +1 ]; +__u32 saddr; +__u32 daddr; +char name[NICKNAME_MAX_LEN +1 ];/* 21 + 1 */ } irnet_log;/*
net/irda/irnet/irnet_irda.c renamed from net/irda/irnet-v5/irnet_irda.c +432 -175
881 lines not on this page · raw message
net/irda/irnet/irnet_irda.h renamed from net/irda/irnet-v5/irnet_irda.h +15 -2
@@ -13,7 +13,6 @@#define IRNET_IRDA_H /***************************** INCLUDES *****************************/ -#include <linux/config.h> /* Please add other headers in irnet.h */ #include "irnet.h" /* Module global include */
@@ -69,13 +68,22 @@ static void irnet_post_event(irnet_socket *, irnet_event, __u32, + __u32, char *);/* ----------------------- IRDA SUBROUTINES ----------------------- */ static inline int irnet_open_tsap (irnet_socket *); -static int +static inline __u8 +irnet_ias_to_tsap (irnet_socket *, +int , +struct ias_value *); +static inline int irnet_find_lsap_sel (irnet_socket *);static inline int +irnet_connect_tsap (irnet_socket *); +static inline int +irnet_discover_next_daddr (irnet_socket *); +static inline int irnet_discover_daddr_and_lsap_sel (irnet_socket *);static inline int irnet_dname_to_daddr (irnet_socket *);
@@ -135,6 +143,11 @@ static void __u16, struct ias_value *, void *); +static void +irnet_discovervalue_confirm (int , +__u16 , +struct ias_value *, +void *);#ifdef DISCOVERY_EVENTS static void irnet_discovery_indication(discovery_t *,
net/irda/irnet/irnet_ppp.c renamed from net/irda/irnet-v5/irnet_ppp.c +124 -68
268 lines not on this page · raw message
net/irda/irnet/irnet_ppp.h renamed from net/irda/irnet-v5/irnet_ppp.h +2 -7
@@ -22,13 +22,8 @@#define IRNET_MAJOR 10/* Misc range */ #define IRNET_MINOR 187/* Official allocation */ -#ifdef LINKNAME_IOCTL -/* Compatibility with old ppp drivers -* Should be defined in <linux/if_ppp.h> */ -#ifndef PPPIOCSLINKNAME -#define PPPIOCSLINKNAME _IOW('t', 74, struct ppp_option_data) -#endif /* PPPIOCSLINKNAME */ -#endif /* LINKNAME_IOCTL */ +/* IrNET control channel stuff */ +#define IRNET_MAX_COMMAND 256/* Max length of a command line */ /* PPP hardcore stuff */