RE: [PATCH 5/6] d80211: add IEEE 802.11e Direct Link Setup (DLS) support

2006-12-18 Thread Zhu Yi
On Thu, 2006-12-14 at 21:48 -0800, Simon Barber wrote:
 Again - this DLS management frame processing code should not be in the
 kernel - it should be in wpa_supplicant.
 
 Only the frame processing code should be in the kernel.

OK. The DLS management process code needs the decision making from the
user. I agree to move them to userspace. But the frame sending code and
DLS data structure should be in the kernel.

Thanks,
-yi
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 5/6] d80211: add IEEE 802.11e Direct Link Setup (DLS) support

2006-12-14 Thread Simon Barber
Again - this DLS management frame processing code should not be in the
kernel - it should be in wpa_supplicant.

Only the frame processing code should be in the kernel.

Simon
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Zhu Yi
Sent: Wednesday, December 13, 2006 8:03 PM
To: netdev@vger.kernel.org
Subject: [PATCH 5/6] d80211: add IEEE 802.11e Direct Link Setup (DLS)
support

Struct dls_info is declared to store the peer's MAC address, timeout
value, supported rates, etc information for the DLS link. The stack also
maintains a hash table to store the dls_info for all the DLS peers for
local interface. The peer's MAC address is used as the hash table key.
The DLS MLMEs handling functions for DLS Setup Request, DLS Response and
DLS teardown are added.

During packet TX, the stack compares the destination MAC address against
the dls_info hash table and see whether a Direct Link should be used for
the packet transmission. If so, it modifiess the IEEE 802.11 MAC header
DA, SA and BSS fields to reflect the direct link setup.

Signed-off-by: Zhu Yi [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c |   19 +-
 net/d80211/ieee80211_i.h   |   17 ++
 net/d80211/ieee80211_sta.c |  450

 3 files changed, 481 insertions(+), 5 deletions(-)

077c391798f72f356c0a5cb50f307b50143a5dcc
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c index
4eba18f..b25d00e 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1472,11 +1472,18 @@ static int ieee80211_subif_start_xmit(st
 memcpy(hdr.addr4, skb-data + ETH_ALEN, ETH_ALEN);
 hdrlen = 30;
 } else if (sdata-type == IEEE80211_IF_TYPE_STA) {
-   fc |= IEEE80211_FCTL_TODS;
-   /* BSSID SA DA */
-   memcpy(hdr.addr1, sdata-u.sta.bssid, ETH_ALEN);
-   memcpy(hdr.addr2, skb-data + ETH_ALEN, ETH_ALEN);
-   memcpy(hdr.addr3, skb-data, ETH_ALEN);
+   if (dls_link_status(local, hdr.addr1) == DLS_STATUS_OK)
{
+   /* DA SA BSSID */
+   memcpy(hdr.addr1, skb-data, ETH_ALEN);
+   memcpy(hdr.addr2, skb-data + ETH_ALEN,
ETH_ALEN);
+   memcpy(hdr.addr3, sdata-u.sta.bssid, ETH_ALEN);
+   } else {
+   fc |= IEEE80211_FCTL_TODS;
+   /* BSSID SA DA */
+   memcpy(hdr.addr1, sdata-u.sta.bssid, ETH_ALEN);
+   memcpy(hdr.addr2, skb-data + ETH_ALEN,
ETH_ALEN);
+   memcpy(hdr.addr3, skb-data, ETH_ALEN);
+   }
hdrlen = 24;
} else if (sdata-type == IEEE80211_IF_TYPE_IBSS) {
/* DA SA BSSID */
@@ -4602,6 +4609,7 @@ int ieee80211_register_hw(struct ieee802
/* Initialize QoS Params */
local-dot11EDCAAveragingPeriod = 5;
local-MPDUExchangeTime = 0;
+   spin_lock_init(local-dls_lock);
 
/* TODO: add rtnl locking around device creation and qdisc
install */
ieee80211_install_qdisc(local-mdev);
@@ -4702,6 +4710,7 @@ void ieee80211_unregister_hw(struct ieee
 
ieee80211_rx_bss_list_deinit(local-mdev);
ieee80211_clear_tx_pending(local);
+   dls_info_stop(local);
sta_info_stop(local);
rate_control_deinitialize(local);
ieee80211_dev_sysfs_del(local);
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h index
e8929d3..d09f65e 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -346,6 +346,18 @@ struct sta_ts_data {
u32 used_time_usec;
 };
 
+#define DLS_STATUS_OK  0
+#define DLS_STATUS_NOLINK  1
+#define DLS_STATUS_SETUP   2
+struct dls_info {
+   atomic_t refcnt;
+   int status;
+   u8 addr[ETH_ALEN];
+   struct dls_info *hnext; /* next entry in hash table list */
+   u32 timeout;
+   u32 supp_rates;
+};
+
 struct ieee80211_local {
/* embed the driver visible part.
 * don't cast (use the static inlines below), but we keep @@
-558,6 +570,9 @@ struct ieee80211_local {
 #define STA_TSDIR_NUM  2
/* HCCA: 0~7, EDCA: 8~15 */
struct sta_ts_data ts_data[STA_TSID_NUM][STA_TSDIR_NUM];
+
+   struct dls_info *dls_hash[STA_HASH_SIZE];
+   spinlock_t dls_lock;
 };
 
 enum sta_link_direction {
@@ -687,6 +702,8 @@ struct sta_info * ieee80211_ibss_add_sta
 u8 *addr);
 int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
+void dls_info_stop(struct ieee80211_local *local); int 
+dls_link_status(struct ieee80211_local *local, u8 *addr);
 
 /* ieee80211_dev.c */
 int ieee80211_dev_alloc_index(struct ieee80211_local *local); diff
--git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c index
81b2ded..393a294 100644
--- a/net/d80211/ieee80211_sta.c