openap-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[openap-cvs] : prism2/modules prism2.c,1.1.1.1,1.2 prism2_ap.c,1.1.1.1,1


From: David C Wang <address@hidden>
Subject: [openap-cvs] : prism2/modules prism2.c,1.1.1.1,1.2 prism2_ap.c,1.1.1.1,1.2 prism2_ap.h,1.1.1.1,1.2 prism2_wlan.h,1.1.1.1,1.2
Date: Wed, 08 May 2002 03:03:07 -0400

Update of /cvsroot/openap/prism2/modules
In directory subversions:/tmp/cvs-serv31992/modules

Modified Files:
        prism2.c prism2_ap.c prism2_ap.h prism2_wlan.h 
Log Message:
updated prism2 pristine sources to openap release 1.1


Index: prism2.c
===================================================================
RCS file: /cvsroot/openap/prism2/modules/prism2.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- prism2.c    8 May 2002 06:43:52 -0000       1.1.1.1
+++ prism2.c    8 May 2002 07:03:04 -0000       1.2
@@ -3,6 +3,9 @@
  * Copyright (c) 2001, SSH Communications Security Corp
  * Jouni Malinen <address@hidden>
  *
+ * AP-AP mesh Copyright (c) 2002 Instant802 Networks Inc.
+ * Simon Barber <address@hidden>
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation. See README and COPYING for
@@ -21,7 +24,7 @@
 
[...1646 lines suppressed...]
                        if (link->open) {
-                               prism2_hw_shutdown(dev);
                                prism2_hw_config(dev, 0);
                                netif_device_attach(dev);
                                netif_start_queue(dev);
+                               for(i = 0; i < APAP_LINKS; i++) {
+                                       apdev = &local->ap_links[i].dev;
+                                       netif_device_attach(apdev);
+                                       netif_start_queue(apdev);
+                               }
                        }
                }
                break;
 
        default:
-               PDEBUG(DEBUG_EXTRA, "%s: prism2_event() - unknown event %d\n",
+               PDEBUG(DEBUG_PCMCIA, "%s: prism2_event() - unknown event %d\n",
                       dev_info, event);
                break;
        }

Index: prism2_ap.c
===================================================================
RCS file: /cvsroot/openap/prism2/modules/prism2_ap.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- prism2_ap.c 8 May 2002 06:43:55 -0000       1.1.1.1
+++ prism2_ap.c 8 May 2002 07:03:04 -0000       1.2
@@ -3,6 +3,9 @@
  * Copyright 2001, SSH Communications Security Corp
  * Jouni Malinen <address@hidden>
  *
+ * AP-AP mesh Copyright (c) 2002 Instant802 Networks Inc.
+ * Simon Barber <address@hidden>
+ *
  * This file is to be included into prism2.c when S/W AP functionality is
  * compiled.
  *
@@ -104,6 +107,7 @@
        struct ap_data *ap = local->ap;
        struct list_head *ptr;
        unsigned long flags;
+       int i;
 
        spin_lock_irqsave(&ap->sta_table_lock, flags);
 
@@ -116,17 +120,39 @@
                               MAC2STR(sta->addr), atomic_read(&sta->users));
                        continue;
                }
-               last = sta->last_rxtx;
+               last = sta->last_rx;
                if (sta->last_assoc > last)
                        last = sta->last_assoc;
                if (sta->last_auth > last)
                        last = sta->last_auth;
-               if (last > jiffies || last + AP_MAX_INACTIVITY < jiffies) {
-                       PDEBUG(DEBUG_AP, "STA " MACSTR " inactivity timeout "
+                       
+               if (last > jiffies || 
+                     ( sta->ap ? last + APAP_MAX_INACTIVITY < jiffies : 
+                                 last + AP_MAX_INACTIVITY < jiffies )
+                       ) {
+                       PDEBUG(DEBUG_AP, "STA/AP " MACSTR " inactivity timeout "
                               "(last=%ld, jiffies=%ld)\n",
                               MAC2STR(sta->addr), last, jiffies);
                        if (sta->aid > 0 && sta->tx_buf_head != NULL)
                                prism2_set_tim(local->dev, sta->aid, 0);
+                       
+                       /* i would really like to move all of the following to
+                          ap_free_sta, but within the ap_free_sta function
+                          there is no pointer to local->ap_links. */
+
+                       /* do this before the ap_link is cleared */
+                       if (sta->ap) {
+                               ap->num_ap--;
+                               for (i = 0; i < APAP_LINKS; i++) {
+                                       if ( memcmp(local->ap_links[i].address, 
sta->addr, 6) == 0 ) {
+                                               
memset(local->ap_links[i].address, 0, 6);       
+                                               break;
+                                       }
+                               }
+                       }
+                       else {
+                               ap->num_sta--;
+                       }
                        ap_free_sta(ap, sta);
                }
        }
@@ -225,6 +251,7 @@
 {
        local_info_t *local = (local_info_t *) dev->priv;
        int res, idx;
+       unsigned long flags;
 
        txdesc->status = 0;
        txdesc->reserved1 = 0;
@@ -260,13 +287,13 @@
        if (local->frame_dump & PRISM2_DUMP_TX_HDR)
                prism2_dump_tx_header(dev->name, txdesc);
 
-       spin_lock_bh(&local->baplock[BAP0]);
+       spin_lock_irqsave(&local->baplock[BAP0], flags);
        res = hfa384x_setup_bap(dev, BAP0, local->txfid[idx], 0);
        if (!res)
                res = hfa384x_to_bap(dev, BAP0, txdesc, sizeof(*txdesc));
        if (!res && body != NULL)
                res = hfa384x_to_bap(dev, BAP0, body, body_len);
-       spin_unlock_bh(&local->baplock[BAP0]);
+       spin_unlock_irqrestore(&local->baplock[BAP0], flags);
        if (!res)
                res = prism2_transmit(dev, idx);
 
@@ -274,7 +301,7 @@
                local->intransmitfid[idx] = PRISM2_TXFID_EMPTY;
                printk("%s: prism2_send_mgmt - to BAP0 failed\n", dev->name);
                if (res == -ETIMEDOUT)
-                       prism2_hw_reset(dev);
+                       prism2_schedule_reset(dev);
        }
 }
 
@@ -295,26 +322,33 @@
                return 0;
        }
 
-       p += sprintf(p, "STA=" MACSTR "\nusers=%d\naid=%d\nflags=0x%04x\n"
+       p += sprintf(p, "%s=" MACSTR "\nusers=%d\naid=%d\nflags=%s %s %s\n"
                     "capability=0x%02x\nlisten_interval=%d\nsupported_rates=",
-                    MAC2STR(sta->addr), atomic_read(&sta->users), sta->aid,
-                    sta->flags, sta->capability, sta->listen_interval);
+                    sta->ap?"AP":"STA",MAC2STR(sta->addr), 
atomic_read(&sta->users), sta->aid,
+                    sta->flags&WLAN_STA_AUTH?"AUTH":"",
+                    sta->flags&WLAN_STA_ASSOC?"ASSOC":"",
+                    sta->flags&WLAN_STA_PS?"PS":"",
+                    sta->capability, sta->listen_interval);
        for (i = 0; i < sizeof(sta->supported_rates); i++)
                if (sta->supported_rates[i] != 0)
-                       p += sprintf(p, "<%02x>", sta->supported_rates[i]);
+                       p += sprintf(p, "%d.%dMbps ",
+                                    sta->supported_rates[i]/10,
+                                    sta->supported_rates[i]%10);
        p += sprintf(p, "\njiffies=%ld\nlast_auth=%ld\nlast_assoc=%ld\n"
-                    "last_rxtx=%ld\nrx_packets=%ld\ntx_packets=%ld\n"
+                    
"last_rx=%ld\nlast_tx=%ld\nrx_packets=%ld\ntx_packets=%ld\n"
                     "rx_bytes=%ld\ntx_bytes=%ld\nbuffer_count=%d\n"
                     "last_rx: silence=%d signal=%d rate=%d flow=%d\n"
                     "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n"
-                    "tx[11M]=%d\n",
-                    jiffies, sta->last_auth, sta->last_assoc, sta->last_rxtx,
+                    "tx[11M]=%d\n"
+                    "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n",
+                    jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, 
sta->last_tx,
                     sta->rx_packets, sta->tx_packets, sta->rx_bytes,
                     sta->tx_bytes, sta->buffer_count, sta->last_rx_silence,
                     sta->last_rx_signal, sta->last_rx_rate,
                     sta->last_rx_flow,
                     sta->tx_rate, sta->tx_count[0], sta->tx_count[1],
-                    sta->tx_count[2], sta->tx_count[3]);
+                    sta->tx_count[2], sta->tx_count[3],  sta->rx_count[0],
+                    sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]);
 
        return (p - page);
 }
@@ -375,7 +409,8 @@
                        /* FIX: might try to remove some old STAs first? */
                        spin_unlock_irqrestore(&local->ap->sta_table_lock,
                                               flags);
-                       printk("AP: no more room for new STAs\n");
+                       printk("AP: no more room for new STAs (%d/%d)\n",
+                              local->ap->num_sta, MAX_STA_COUNT);
                        resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
                        goto fail;
                }
@@ -476,6 +511,143 @@
        }
 }
 
+/* assumptions - when entering hostapapa_rx_beacon, the following are
+known: "station type"=ap, TYPE=management, STYPE=beacon */
+void handle_beacon(local_info_t *local, struct hfa384x_rx_frame *rxdesc) {
+       struct net_device *dev = local->dev;
+       struct sta_info *sta  = NULL;
+       struct sta_info *sta2 = NULL;
+       apap_link_t *aplink     = NULL;
+       char *buf             = NULL;
+        int len               = 0;
+       char *essid           = NULL;
+       int essid_len         = 0;
+       int field_id          = 0;
+       int i                 = 0;
+
+       /* notes: sta_info's hold information for station removal from
+          the hash.  a station is removed if it has not been heard from
+          recently (last_rx) && if a station is not in use as noted
+          by the the &sta-users counter */
+
+       /* check if we have seen the ap before, and update the statistics */
+       spin_lock(&local->ap->sta_table_lock);
+       sta = ap_get_sta(local->ap, rxdesc->addr2);
+       if (sta) {
+               sta->last_rx = jiffies;
+               sta->flags |= (WLAN_STA_ASSOC | WLAN_STA_AUTH);
+       }       
+       spin_unlock(&local->ap->sta_table_lock);
+       if (sta)
+               return;
+
+       /*  check the ESSID to see if the frame comes from an ap within */
+       /*  our own network.  if so, then add into the sta_list_hash or */
+       /*  whatever.  read the packet into a buffer where we access */
+       /*  the essid */
+
+       buf = ((char *)rxdesc)+sizeof(struct hfa384x_rx_frame);
+       len = __le16_to_cpu(rxdesc->data_len);
+       if (len < 14) return;
+
+       /*  1 - timestamp       = 8 octets fixed field */
+       /*  2 - beacon interval = 2 octets fixed field */
+       /*  3 - capability info = 2 octets fixed field */
+       /*                      + - */
+       /*                       12 octets */
+       /*  4 - ssid (ESSID, BSSID) = variable field (1 octet id, 1 octet 
length, data) */
+
+       field_id  = (unsigned char) buf[12];
+       essid_len = (unsigned char) buf[13];
+       essid = buf+14;
+
+       /*  sanity checks */
+       if (field_id != 0) {
+               printk("%s: packet with incorrect essid field id %d\n", 
+                      dev->name, field_id);
+               return;
+       }
+       if (essid_len+14 > len) {
+               printk("%s: packet invalid: essid_len %d beyone end of 
packet\n", 
+                       dev->name, essid_len);
+               return;
+       }
+
+       /*  compare the essid with our own */
+       if( strlen(local->essid) != essid_len || memcmp(essid, local->essid, 
essid_len) != 0)
+               return;
+
+       /*  find an unused ap->ap link */
+       for (i = 0; i < APAP_LINKS; i++)
+               if ( memcmp(local->ap_links[i].address, "\0\0\0\0\0", 6) == 0 ) 
{
+                       aplink = &local->ap_links[i];
+                       break;
+               }
+       if (!aplink)
+               return;
+
+       /*  now, the essid matches our own.  if the foriegn ap is */
+       /*  not in our list of stations, time to add it. */
+       if (local->ap->num_ap  >= MAX_AP_COUNT) {
+               printk("cannot add ap " MACSTR
+                      ": too many associated aps (%d/%d)\n",
+                      MAC2STR(rxdesc->addr2),
+                      local->ap->num_ap, MAX_AP_COUNT);
+               return;
+       }
+               
+       if ( (sta2 = (struct sta_info *)kmalloc(sizeof(struct sta_info), 
GFP_ATOMIC)) == NULL) {
+               printk("kmalloc for new AP failed\n");
+               return;
+       }
+               
+       memset(sta2, 0, sizeof(struct sta_info));
+       list_add(&sta2->list, &local->ap->sta_list);
+       local->ap->num_ap++;
+               
+       /*  initialize STA info data */
+       memcpy(&sta2->addr, &rxdesc->addr2, 6);
+               
+       sta2->flags = WLAN_STA_ASSOC;
+       sta2->rx_packets++;
+       sta2->rx_bytes += len;
+       sta2->last_rx = jiffies;
+       sta2->ap = aplink;
+       sta2->tx_supp_rates = WLAN_RATE_1M | WLAN_RATE_2M | WLAN_RATE_5M5 | 
WLAN_RATE_11M;
+       sta2->tx_rate = 110;
+       sta2->tx_max_rate = sta2->tx_rate_idx = 3;
+       memcpy(aplink->address, &rxdesc->addr2, 6);
+
+       /*  add to station/ap hash */
+       spin_lock(&local->ap->sta_table_lock);
+       ap_sta_hash_add(local->ap, sta2);
+       
+       /*  create proc entry */
+       if (local->ap->proc != NULL) {
+               char name[20];
+               sprintf(name, MACSTR, MAC2STR(sta2->addr));
+               sta2->proc = create_proc_read_entry(name, 0,
+                                                   local->ap->proc,
+                                                   prism2_sta_proc_read, sta2);
+       }
+       spin_unlock(&local->ap->sta_table_lock);
+
+       printk("added AP " MACSTR " as %s to list of APs\n",
+              MAC2STR(rxdesc->addr2), sta2->ap->dev.name);
+
+       /*  note/possible bug: ap->num_sta is never decremented */
+       /*  by the free function, and is never reclaimed.  we */
+       /*  won't worry about either for now. */
+       return;
+}
+
+
+
+
+
+
+
+
 /* Called only from software IRQ */
 static void handle_assoc(local_info_t *local, struct hfa384x_rx_frame *rxdesc,
                         int reassoc)
@@ -498,15 +670,15 @@
                return;
        }
 
-       PDEBUG(DEBUG_AP, "%s: %sassociation request: " MACSTR " len=%d\n",
-              dev->name, reassoc ? "re" : "", MAC2STR(rxdesc->addr2), len);
+       PDEBUG(DEBUG_AP, "%s: %sassociation request: from " MACSTR " to " 
MACSTR " len=%d\n",
+              dev->name, reassoc ? "re" : "", MAC2STR(rxdesc->addr2), 
MAC2STR(rxdesc->addr1), len);
 
        spin_lock_irqsave(&local->ap->sta_table_lock, flags);
        sta = ap_get_sta(local->ap, rxdesc->addr2);
        if (sta == NULL || (sta->flags & WLAN_STA_AUTH) == 0) {
                spin_unlock_irqrestore(&local->ap->sta_table_lock, flags);
                printk("AP: STA " MACSTR " trying to associate before "
-                      "authentication\n", MAC2STR(rxdesc->addr1));
+                      "authentication\n", MAC2STR(rxdesc->addr2));
                if (sta) {
                        PDEBUG(DEBUG_AP, "sta: addr=" MACSTR
                               " aid=%d flags=0x%04x\n",
@@ -923,7 +1095,7 @@
                if (local->frame_dump & PRISM2_DUMP_TX_HDR)
                        prism2_dump_tx_header(dev->name, &fbuf->txdesc);
 
-               spin_lock_bh(&local->baplock[BAP0]);
+               spin_lock_irqsave(&local->baplock[BAP0], flags);
                res = hfa384x_setup_bap(dev, BAP0, local->txfid[idx], 0);
                if (!res)
                        res = hfa384x_to_bap(dev, BAP0, &fbuf->txdesc,
@@ -934,7 +1106,7 @@
                if (!res)
                        res = hfa384x_to_bap(dev, BAP0, fbuf->skb->data + 12,
                                             fbuf->skb->len - 12);
-               spin_unlock_bh(&local->baplock[BAP0]);
+               spin_unlock_irqrestore(&local->baplock[BAP0], flags);
                if (!res)
                        res = prism2_transmit(dev, idx);
 
@@ -943,7 +1115,7 @@
                        printk("%s: handle_pspoll - to BAP0 failed\n",
                               dev->name);
                        if (res == -ETIMEDOUT)
-                               prism2_hw_reset(dev);
+                               prism2_schedule_reset(dev);
                        goto fail;
                }
 
@@ -951,7 +1123,7 @@
 
                sta->tx_packets++;
                sta->tx_bytes += len;
-               sta->last_rxtx = jiffies;
+               sta->last_rx = jiffies;
 
        fail:
                dev_kfree_skb(fbuf->skb);
@@ -1023,18 +1195,23 @@
                goto done;
        }
 
+       if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) {
+               handle_beacon(local, rxdesc);
+               goto done;
+       }
+
        if (memcmp(rxdesc->addr1, dev->dev_addr, 6)) {
                PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=" MACSTR
                       " not own MAC\n", MAC2STR(rxdesc->addr1));
                goto done;
        }
-
+       
        if (memcmp(rxdesc->addr3, dev->dev_addr, 6)) {
                PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=" MACSTR
                       " not own MAC\n", MAC2STR(rxdesc->addr3));
                goto done;
        }
-
+       
        switch (stype) {
        case WLAN_FC_STYPE_ASSOC_REQ:
                handle_assoc(local, rxdesc, 0);
@@ -1095,6 +1272,9 @@
                                        local->ap->ap_queued_items[i];
                                type = local->ap->ap_queued_type[i];
                                local->ap->ap_queued_items[i] = NULL;
+                               /*  we really need to replace this hack of a */
+                               /*  queue with a real queue */
+                               break;
                        }
                }
                spin_unlock_irq(&local->ap->ap_queue_lock);
@@ -1107,7 +1287,13 @@
                else
                        printk("handle_ap_queue: unknown type %d\n", type);
        }
-
+       
+       if (local->hw_resetting) {
+               printk("RESETTING FOR REAL\n");
+               local->hw_resetting = 0;
+               prism2_reset_card(local->dev);
+        }
+       
        MOD_DEC_USE_COUNT;
 }
 
@@ -1127,10 +1313,43 @@
        type = WLAN_FC_GET_TYPE(fc);
        stype = WLAN_FC_GET_STYPE(fc);
 
+
+       if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON) {
+               struct sta_info *sta = NULL;
+               spin_lock(&local->ap->sta_table_lock);
+               if ( (sta = ap_get_sta(local->ap, rxdesc->addr2)) ) {
+                       /*  if we've already added the ap into our list */
+                       /*  of sta's don't process it again, just */
+                       /*  update the last rx_tx of the ap */
+                       sta->last_rx = jiffies;
+                       sta->flags |= (WLAN_STA_ASSOC | WLAN_STA_AUTH);
+                       spin_unlock(&local->ap->sta_table_lock);
+                       return;
+               }
+
+               if (((jiffies - 
+                     local->ap->ap_beacon_time[ap_hash_func(&rxdesc->addr2)])
+                    / HZ)
+                   < BEACON_TIME) {
+       /* 
+          the ap is not within our list of associated aps.  in order
+          to prevent the processing of each and every beacon packet,
+          we track recently seen aps, and only handle an ap's beacon
+          every BEACON_TIME seconds.  this prevents filling up the
+          apqueue with tons of useless beacons.
+       */
+                       spin_unlock(&local->ap->sta_table_lock);
+                       return;
+                       
+               }
+               local->ap->ap_beacon_time[ap_hash_func(&rxdesc->addr2)] = 
jiffies;
+               spin_unlock(&local->ap->sta_table_lock);
+       }
+
+
        /* skip control, data, and mgmt::beacon frames */
        if (!force &&
-           ((type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) ||
-            (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_BEACON))) {
+           ((type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL)) ) {
                spin_unlock(&local->baplock[BAP1]);
 #ifndef final_version
                if (type != WLAN_FC_TYPE_MGMT)
@@ -1138,6 +1357,7 @@
                               " (type=0x%02x, subtype=0x%02x)\n", dev->name,
                               type, stype);
 #endif
+
                /* FIX: might collect mgmt::beacon statistics and a list of
                 * other APs that are heard in the neighborhood */
                return;

Index: prism2_ap.h
===================================================================
RCS file: /cvsroot/openap/prism2/modules/prism2_ap.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- prism2_ap.h 8 May 2002 06:43:55 -0000       1.1.1.1
+++ prism2_ap.h 8 May 2002 07:03:04 -0000       1.2
@@ -29,6 +29,8 @@
 /* Try to increase TX rate after # successfully sent packets */
 #define WLAN_RATE_UPDATE_COUNT 50
 
+enum { STA_TYPE_STA = 0, STA_TYPE_AP = 1};
+
 struct sta_info {
        struct list_head list;
        struct sta_info *hnext; /* next entry in hash table list */
@@ -44,7 +46,8 @@
 
        unsigned long last_auth;
        unsigned long last_assoc;
-       unsigned long last_rxtx;
+       unsigned long last_rx;
+       unsigned long last_tx;
        unsigned long rx_packets, tx_packets;
        unsigned long rx_bytes, tx_bytes;
        struct sta_buffer_frame *tx_buf_head, *tx_buf_tail;
@@ -63,11 +66,16 @@
        u8 tx_rate_idx; /* current TX rate (WLAN_RATE_*) */
        u8 tx_max_rate; /* max TX rate (WLAN_RATE_*) */
        u32 tx_count[WLAN_RATE_COUNT]; /* number of frames sent (per rate) */
+       u32 rx_count[WLAN_RATE_COUNT]; /* number of frames received (per rate)
+                                       */
        u32 tx_since_last_failure;
+
+       apap_link_t *ap; /* pointer to the ap's netdevice */
 };
 
 
 #define MAX_STA_COUNT 1024
+#define MAX_AP_COUNT 16
 
 /* Maximum number of AIDs to use for STAs; must be 2007 or lower
  * (8802.11 limitation) */
@@ -84,6 +92,10 @@
  * maybe add separate timeout for auth, but not assoc STAs */
 #define AP_MAX_INACTIVITY (30 * 60 * HZ)
 
+/* Use a smaller timeout for apap timeouts so we can react more quickly
+ * to changes in the topology. */
+#define APAP_MAX_INACTIVITY (5 * HZ)
+
 #define AP_QUEUE_LEN 10
 enum { AP_QUEUED_RXDESC, AP_QUEUED_SKB };
 
@@ -102,6 +114,7 @@
 
        spinlock_t sta_table_lock;
        int num_sta; /* number of entries in sta_list */
+       int num_ap;
        struct list_head sta_list; /* STA info list head */
        struct sta_info *sta_hash[STA_HASH_SIZE];
 
@@ -112,7 +125,25 @@
        struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];
        struct timer_list timer;
        struct proc_dir_entry *proc;
+
+       /*  process beacon every BEACON_TIME seconds from an ap that */
+       /*  we've seen before.  hash based on ap_hash_func */
+       unsigned long ap_beacon_time[256];
+
+       /*  process dissoc every DISSOC_TIME seconds from an ap that */
+       /*  we've seen before.  hash based on ap_hash_func */
+       unsigned long ap_dissoc_time[256];
 };
+
+#define BEACON_TIME 10 /*  in seconds */
+#define DISSOC_TIME 5  /*  in seconds */
+#define ap_hash_func(mac) \
+        ( ((unsigned char *)mac)[0] ^ \
+          ((unsigned char *)mac)[1] ^ \
+          ((unsigned char *)mac)[2] ^ \
+          ((unsigned char *)mac)[3] ^ \
+          ((unsigned char *)mac)[4] ^ \
+          ((unsigned char *)mac)[5] )
 
 
 void hostap_rx(struct net_device *dev, struct hfa384x_rx_frame *rxdesc,

Index: prism2_wlan.h
===================================================================
RCS file: /cvsroot/openap/prism2/modules/prism2_wlan.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- prism2_wlan.h       8 May 2002 06:43:45 -0000       1.1.1.1
+++ prism2_wlan.h       8 May 2002 07:03:04 -0000       1.2
@@ -1,7 +1,6 @@
 #ifndef PRISM2_WLAN_H
 #define PRISM2_WLAN_H
 
-
 #define BIT(x) (1 << (x))
 
 /* netlink groups */
@@ -513,7 +512,7 @@
 
 #ifdef __KERNEL__
 
-#define PRISM2_TXFID_COUNT 16
+#define PRISM2_TXFID_COUNT 5
 #define PRISM2_DATA_MAXLEN 2304
 #define PRISM2_TXFID_LEN (PRISM2_DATA_MAXLEN + sizeof(struct hfa384x_tx_frame))
 #define PRISM2_TXFID_EMPTY 0xffff
@@ -524,9 +523,20 @@
 #define PRISM2_DUMP_RX_HDR 1
 #define PRISM2_DUMP_TX_HDR 2
 
+/*  max number of ap->ap connections */
+#define APAP_LINKS 5
+
+/*  data for ap->ap link */
+typedef struct apap_link {
+       struct net_device dev;   /*  net device for this ap->ap link */
+       char address[ETH_ALEN];  /*  address of foreign ap */
+
+} apap_link_t;
+
 typedef struct local_info {
        dev_node_t node;
-       struct net_device *dev;
+       struct net_device *dev; /*  main ap device (frames to/from stations) */
+       apap_link_t ap_links[APAP_LINKS]; /*  links to other APs */
        dev_link_t *link;
        spinlock_t cmdlock, baplock[2];
        u16 infofid; /* MAC buffer id for info frame */
@@ -557,7 +567,7 @@
        char bssid[ETH_ALEN];
        int frame_dump; /* dump RX/TX frame headers, PRISM2_DUMP_ flags */
        int fw_tx_rate_control;
-       int hw_resetting;
+       volatile int hw_resetting;
 #ifdef WIRELESS_EXT
        struct iw_statistics wstats;
 #endif
@@ -589,10 +599,12 @@
 #define DEBUG_HW 16
 #define DEBUG_EXTRA 32
 #define DEBUG_EXTRA2 64
-#define DEBUG_MASK (DEBUG_PS | DEBUG_FLOW | DEBUG_AP | DEBUG_HW | \
-       DEBUG_EXTRA)
+#define DEBUG_PCMCIA 128
+#define DEBUG_MASK 0 /*  (DEBUG_PCMCIA | DEBUG_HW) */
+
+       
 #define PDEBUG(n, args...) \
-do { if ((n) & DEBUG_MASK) printk(KERN_DEBUG args); } while (0)
+do { if ((n) & DEBUG_MASK) printk(/*KERN_DEBUG*/ args); } while (0)
 #define PDEBUG2(n, args...) \
 do { if ((n) & DEBUG_MASK) printk(args); } while (0)
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]