summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorJean Tourrilhes <jt@hpl.hp.com>2002-09-18 10:54:45 -0400
committerJeff Garzik <jgarzik@mandrakesoft.com>2002-09-18 10:54:45 -0400
commit6701334ca0c128b17ce0858ca0604a7a7b6a91de (patch)
tree923bbffd39215a493ec97e2204e58bbeae0869e3 /include/net
parent3ff00907826485a2a9484d489fb04de4cee258d9 (diff)
irda update 3/6:
o [FEATURE] New hashbin locking scheme for irqueue o [FEATURE] Get rid of old broken hashbin locking schemes o [FEATURE] Lock hasbins while enumerating it in various places o [CORRECT] Remove all remaining "save_flags(flags);cli();" o [CORRECT] Fix two "return with spinlock" found by Stanford checker
Diffstat (limited to 'include/net')
-rw-r--r--include/net/irda/irlmp.h5
-rw-r--r--include/net/irda/irqueue.h29
2 files changed, 13 insertions, 21 deletions
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index fd9c6462d48e..e7a2fb3938fe 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -183,7 +183,6 @@ struct irlmp_cb {
hashbin_t *services;
hashbin_t *cachelog; /* Current discovery log */
- spinlock_t log_lock; /* discovery log spinlock */
int running;
@@ -221,7 +220,7 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
struct sk_buff *userdata);
int irlmp_disconnect_request(struct lsap_cb *, struct sk_buff *userdata);
-void irlmp_discovery_confirm(hashbin_t *discovery_log, DISCOVERY_MODE);
+void irlmp_discovery_confirm(hashbin_t *discovery_log, DISCOVERY_MODE mode);
void irlmp_discovery_request(int nslots);
struct irda_device_info *irlmp_get_discoveries(int *pn, __u16 mask, int nslots);
void irlmp_do_expiry(void);
@@ -258,8 +257,6 @@ extern int sysctl_discovery;
extern int sysctl_lap_keepalive_time; /* in ms, default is LM_IDLE_TIMEOUT */
extern struct irlmp_cb *irlmp;
-static inline hashbin_t *irlmp_get_cachelog(void) { return irlmp->cachelog; }
-
/* Check if LAP queue is full.
* Used by IrTTP for low control, see comments in irlap.h - Jean II */
static inline int irlmp_lap_tx_queue_full(struct lsap_cb *self)
diff --git a/include/net/irda/irqueue.h b/include/net/irda/irqueue.h
index 4b9f8bd2b180..066b5377fc8f 100644
--- a/include/net/irda/irqueue.h
+++ b/include/net/irda/irqueue.h
@@ -36,12 +36,12 @@
#define NAME_SIZE 32
/*
- * Hash types
+ * Hash types (some flags can be xored)
+ * See comments in irqueue.c for which one to use...
*/
-#define HB_NOLOCK 0
-#define HB_GLOBAL 1
-#define HB_LOCAL 2
-#define HB_SORTED 4
+#define HB_NOLOCK 0 /* No concurent access prevention */
+#define HB_LOCK 1 /* Prevent concurent write with global lock */
+#define HB_SORTED 4 /* Not yet supported */
/*
* Hash defines
@@ -57,11 +57,6 @@
typedef void (*FREE_FUNC)(void *arg);
-/*
- * Hashbin
- */
-#define GET_HASHBIN(x) ( x & HASHBIN_MASK )
-
struct irda_queue {
struct irda_queue *q_next;
struct irda_queue *q_prev;
@@ -75,8 +70,9 @@ typedef struct hashbin_t {
__u32 magic;
int hb_type;
int hb_size;
- spinlock_t hb_mutex[HASHBIN_SIZE] IRDA_ALIGN;
- irda_queue_t *hb_queue[HASHBIN_SIZE] IRDA_ALIGN;
+ spinlock_t hb_spinlock; /* HB_LOCK - Can be used by the user */
+
+ irda_queue_t* hb_queue[HASHBIN_SIZE] IRDA_ALIGN;
irda_queue_t* hb_current;
} hashbin_t;
@@ -86,17 +82,16 @@ int hashbin_delete(hashbin_t* hashbin, FREE_FUNC func);
int hashbin_clear(hashbin_t* hashbin, FREE_FUNC free_func);
void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
char* name);
-void* hashbin_find(hashbin_t* hashbin, long hashv, char* name);
void* hashbin_remove(hashbin_t* hashbin, long hashv, char* name);
void* hashbin_remove_first(hashbin_t *hashbin);
void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry);
+void* hashbin_find(hashbin_t* hashbin, long hashv, char* name);
+void* hashbin_lock_find(hashbin_t* hashbin, long hashv, char* name);
+void* hashbin_find_next(hashbin_t* hashbin, long hashv, char* name,
+ void ** pnext);
irda_queue_t *hashbin_get_first(hashbin_t *hashbin);
irda_queue_t *hashbin_get_next(hashbin_t *hashbin);
-void enqueue_last(irda_queue_t **queue, irda_queue_t* element);
-void enqueue_first(irda_queue_t **queue, irda_queue_t* element);
-irda_queue_t *dequeue_first(irda_queue_t **queue);
-
#define HASHBIN_GET_SIZE(hashbin) hashbin->hb_size
#endif