rpms/kernel/devel linux-2.6-iwlwifi-fixes.patch, 1.2, 1.3 kernel.spec, 1.201, 1.202 linux-2.6-at76.patch, 1.2, 1.3 linux-2.6-ath5k.patch, 1.3, 1.4 linux-2.6-mac80211-extras.patch, 1.2, 1.3 linux-2.6-wireless-pending.patch, 1.8, 1.9 linux-2.6-zd1211rw-mac80211.patch, 1.3, 1.4

John W. Linville (linville) fedora-extras-commits at redhat.com
Fri Oct 5 15:17:16 UTC 2007


Author: linville

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20348

Modified Files:
	kernel.spec linux-2.6-at76.patch linux-2.6-ath5k.patch 
	linux-2.6-mac80211-extras.patch 
	linux-2.6-wireless-pending.patch 
	linux-2.6-zd1211rw-mac80211.patch 
Added Files:
	linux-2.6-iwlwifi-fixes.patch 
Log Message:
Back-out last round of wireless updates

linux-2.6-iwlwifi-fixes.patch:

Index: linux-2.6-iwlwifi-fixes.patch
===================================================================
RCS file: linux-2.6-iwlwifi-fixes.patch
diff -N linux-2.6-iwlwifi-fixes.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ linux-2.6-iwlwifi-fixes.patch	5 Oct 2007 15:17:09 -0000	1.3
@@ -0,0 +1,794 @@
+diff -up linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965-rs.c.orig linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+--- linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965-rs.c.orig	2007-09-27 19:08:16.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965-rs.c	2007-09-27 19:09:01.000000000 -0400
+@@ -115,24 +115,38 @@ struct iwl_rate_scale_priv {
+ 	u8 is_dup;
+ 	u8 phymode;
+ 	u8 ibss_sta_added;
++	u32 supp_rates;
+ 	u16 active_rate;
+ 	u16 active_siso_rate;
+ 	u16 active_mimo_rate;
+ 	u16 active_rate_basic;
+ 	struct iwl_link_quality_cmd lq;
+ 	struct iwl_scale_tbl_info lq_info[LQ_SIZE];
++#ifdef CONFIG_MAC80211_DEBUGFS
++	struct dentry *rs_sta_dbgfs_scale_table_file;
++	struct dentry *rs_sta_dbgfs_stats_table_file;
++	struct iwl_rate dbg_fixed;
++	struct iwl_priv *drv;
++#endif
+ };
+ 
+ static void rs_rate_scale_perform(struct iwl_priv *priv,
+ 				   struct net_device *dev,
+ 				   struct ieee80211_hdr *hdr,
+ 				   struct sta_info *sta);
+-static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
++static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
+ 			     struct iwl_rate *tx_mcs,
+-			     struct iwl_link_quality_cmd *tbl,
+-			     struct sta_info *sta);
++			     struct iwl_link_quality_cmd *tbl);
+ 
+ 
++#ifdef CONFIG_MAC80211_DEBUGFS
++static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
++				struct iwl_rate *mcs, int index);
++#else
++static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
++				struct iwl_rate *mcs, int index)
++{}
++#endif
+ static s32 expected_tpt_A[IWL_RATE_COUNT] = {
+ 	0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186
+ };
+@@ -539,14 +553,13 @@ static u16 rs_get_adjacent_rate(u8 index
+ 
+ static int rs_get_lower_rate(struct iwl_rate_scale_priv *lq_data,
+ 			     struct iwl_scale_tbl_info *tbl, u8 scale_index,
+-			     u8 ht_possible, struct iwl_rate *mcs_rate,
+-			     struct sta_info *sta)
++			     u8 ht_possible, struct iwl_rate *mcs_rate)
+ {
+-	u8 is_green = lq_data->is_green;
+ 	s32 low;
+ 	u16 rate_mask;
+ 	u16 high_low;
+ 	u8 switch_to_legacy = 0;
++	u8 is_green = lq_data->is_green;
+ 
+ 	/* check if we need to switch from HT to legacy rates.
+ 	 * assumption is that mandatory rates (1Mbps or 6Mbps)
+@@ -573,9 +586,9 @@ static int rs_get_lower_rate(struct iwl_
+ 	if (is_legacy(tbl->lq_type)) {
+ 		if (lq_data->phymode == (u8) MODE_IEEE80211A)
+ 			rate_mask  = (u16)(rate_mask &
+-			   (sta->supp_rates << IWL_FIRST_OFDM_RATE));
++			   (lq_data->supp_rates << IWL_FIRST_OFDM_RATE));
+ 		else
+-			rate_mask = (u16)(rate_mask & sta->supp_rates);
++			rate_mask = (u16)(rate_mask & lq_data->supp_rates);
+ 	}
+ 
+ 	/* if we did switched from HT to legacy check current rate */
+@@ -619,7 +632,7 @@ static void rs_tx_status(void *priv_rate
+ 	u16 fc = le16_to_cpu(hdr->frame_control);
+ 	s32 tpt = 0;
+ 
+-	IWL_DEBUG_RATE("get frame ack response, update rate scale window\n");
++	IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n");
+ 
+ 	if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1))
+ 		return;
+@@ -1388,10 +1401,10 @@ static void rs_rate_scale_perform(struct
+ 	if (is_legacy(tbl->lq_type)) {
+ 		if (lq_data->phymode == (u8) MODE_IEEE80211A)
+ 			rate_scale_index_msk = (u16) (rate_mask &
+-				(sta->supp_rates << IWL_FIRST_OFDM_RATE));
++				(lq_data->supp_rates << IWL_FIRST_OFDM_RATE));
+ 		else
+ 			rate_scale_index_msk = (u16) (rate_mask &
+-						      sta->supp_rates);
++						      lq_data->supp_rates);
+ 
+ 	} else
+ 		rate_scale_index_msk = rate_mask;
+@@ -1431,7 +1444,7 @@ static void rs_rate_scale_perform(struct
+ 		rs_stay_in_table(lq_data);
+ 		if (update_lq) {
+ 			rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green);
+-			rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq, sta);
++			rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq);
+ 			rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC);
+ 		}
+ 		goto out;
+@@ -1555,7 +1568,7 @@ static void rs_rate_scale_perform(struct
+  lq_update:
+ 	if (update_lq) {
+ 		rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green);
+-		rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq, sta);
++		rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq);
+ 		rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC);
+ 	}
+ 	rs_stay_in_table(lq_data);
+@@ -1581,7 +1594,7 @@ static void rs_rate_scale_perform(struct
+ 			IWL_DEBUG_HT("Switch current  mcs: %X index: %d\n",
+ 				     tbl->current_rate.rate_n_flags, index);
+ 			rs_fill_link_cmd(lq_data, &tbl->current_rate,
+-					 &(lq_data->lq), sta);
++					 &lq_data->lq);
+ 			rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC);
+ 		}
+ 		tbl1 = &(lq_data->lq_info[lq_data->active_tbl]);
+@@ -1672,12 +1685,12 @@ static void rs_initialize_lq(struct iwl_
+ 	tbl->antenna_type = ANT_AUX;
+ 	rs_get_tbl_info_from_mcs(&mcs_rate, priv->phymode, tbl, &rate_idx);
+ 	if (!rs_is_ant_connected(priv->valid_antenna, tbl->antenna_type))
+-	    rs_toggle_antenna(&mcs_rate, tbl),
++	    rs_toggle_antenna(&mcs_rate, tbl);
+ 
+ 	rs_mcs_from_tbl(&mcs_rate, tbl, rate_idx, use_green);
+ 	tbl->current_rate.rate_n_flags = mcs_rate.rate_n_flags;
+ 	rs_get_expected_tpt_table(lq, tbl);
+-	rs_fill_link_cmd(lq, &mcs_rate, &(lq->lq), sta);
++	rs_fill_link_cmd(lq, &mcs_rate, &lq->lq);
+ 	rs_send_lq_cmd(priv, &lq->lq, CMD_ASYNC);
+  out:
+ 	return;
+@@ -1714,7 +1727,7 @@ static struct ieee80211_rate *rs_get_rat
+ 	struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
+ 	struct iwl_rate_scale_priv *lq;
+ 
+-	IWL_DEBUG_RATE("rate scale calculate new rate for skb\n");
++	IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
+ 
+ 	memset(extra, 0, sizeof(*extra));
+ 
+@@ -1775,10 +1788,9 @@ static void *rs_alloc_sta(void *priv, gf
+ 
+ 	if (crl == NULL)
+ 		return NULL;
+-
+-	memset(crl, 0, sizeof(struct iwl_rate_scale_priv));
+ 	crl->lq.sta_id = 0xff;
+ 
++
+ 	for (j = 0; j < LQ_SIZE; j++)
+ 		for (i = 0; i < IWL_RATE_COUNT; i++)
+ 			rs_rate_scale_clear_window(&(crl->lq_info[j].win[i]));
+@@ -1795,10 +1807,8 @@ static void rs_rate_init(void *priv_rate
+ 	struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
+ 	struct iwl_rate_scale_priv *crl = priv_sta;
+ 
+-	memset(crl, 0, sizeof(struct iwl_rate_scale_priv));
+-
+-	crl->lq.sta_id = 0xff;
+ 	crl->flush_timer = 0;
++	crl->supp_rates = sta->supp_rates;
+ 	sta->txrate = 3;
+ 	for (j = 0; j < LQ_SIZE; j++)
+ 		for (i = 0; i < IWL_RATE_COUNT; i++)
+@@ -1864,6 +1874,9 @@ static void rs_rate_init(void *priv_rate
+ 	IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate,
+ 		     crl->active_mimo_rate);
+ #endif /*CONFIG_IWLWIFI_HT*/
++#ifdef CONFIG_MAC80211_DEBUGFS
++	crl->drv = priv;
++#endif
+ 
+ 	if (priv->assoc_station_added)
+ 		priv->lq_mngr.lq_ready = 1;
+@@ -1871,28 +1884,28 @@ static void rs_rate_init(void *priv_rate
+ 	rs_initialize_lq(priv, sta);
+ }
+ 
+-static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
++static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
+ 			    struct iwl_rate *tx_mcs,
+-			    struct iwl_link_quality_cmd *lq_cmd,
+-			    struct sta_info *sta)
++			    struct iwl_link_quality_cmd *lq_cmd)
+ {
+ 	int index = 0;
+-	int rc = 0;
+ 	int rate_idx;
++	int repeat_rate = 0;
+ 	u8 ant_toggle_count = 0;
+ 	u8 use_ht_possible = 1;
+-	u8 repeat_cur_rate = 0;
+ 	struct iwl_rate new_rate;
+ 	struct iwl_scale_tbl_info tbl_type = { 0 };
+ 
++	rs_dbgfs_set_mcs(lq_data, tx_mcs, index);
++
+ 	rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode,
+ 				  &tbl_type, &rate_idx);
+ 
+ 	if (is_legacy(tbl_type.lq_type)) {
+ 		ant_toggle_count = 1;
+-		repeat_cur_rate = IWL_NUMBER_TRY;
++		repeat_rate = IWL_NUMBER_TRY;
+ 	} else
+-		repeat_cur_rate = IWL_HT_NUMBER_TRY;
++		repeat_rate = IWL_HT_NUMBER_TRY;
+ 
+ 	lq_cmd->general_params.mimo_delimiter =
+ 			is_mimo(tbl_type.lq_type) ? 1 : 0;
+@@ -1906,10 +1919,10 @@ static int rs_fill_link_cmd(struct iwl_r
+ 		lq_cmd->general_params.single_stream_ant_msk = 2;
+ 
+ 	index++;
+-	repeat_cur_rate--;
++	repeat_rate--;
+ 
+ 	while (index < LINK_QUAL_MAX_RETRY_NUM) {
+-		while (repeat_cur_rate && (index < LINK_QUAL_MAX_RETRY_NUM)) {
++		while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) {
+ 			if (is_legacy(tbl_type.lq_type)) {
+ 				if (ant_toggle_count <
+ 				    NUM_TRY_BEFORE_ANTENNA_TOGGLE)
+@@ -1919,9 +1932,11 @@ static int rs_fill_link_cmd(struct iwl_r
+ 					ant_toggle_count = 1;
+ 				}
+ 			}
++
++			rs_dbgfs_set_mcs(lq_data, &new_rate, index);
+ 			lq_cmd->rs_table[index].rate_n_flags =
+ 					cpu_to_le32(new_rate.rate_n_flags);
+-			repeat_cur_rate--;
++			repeat_rate--;
+ 			index++;
+ 		}
+ 
+@@ -1932,7 +1947,7 @@ static int rs_fill_link_cmd(struct iwl_r
+ 			lq_cmd->general_params.mimo_delimiter = index;
+ 
+ 		rs_get_lower_rate(lq_data, &tbl_type, rate_idx,
+-				  use_ht_possible, &new_rate, sta);
++				  use_ht_possible, &new_rate);
+ 
+ 		if (is_legacy(tbl_type.lq_type)) {
+ 			if (ant_toggle_count < NUM_TRY_BEFORE_ANTENNA_TOGGLE)
+@@ -1941,26 +1956,23 @@ static int rs_fill_link_cmd(struct iwl_r
+ 				rs_toggle_antenna(&new_rate, &tbl_type);
+ 				ant_toggle_count = 1;
+ 			}
+-			repeat_cur_rate = IWL_NUMBER_TRY;
++			repeat_rate = IWL_NUMBER_TRY;
+ 		} else
+-			repeat_cur_rate = IWL_HT_NUMBER_TRY;
++			repeat_rate = IWL_HT_NUMBER_TRY;
+ 
+ 		use_ht_possible = 0;
+ 
++		rs_dbgfs_set_mcs(lq_data, &new_rate, index);
+ 		lq_cmd->rs_table[index].rate_n_flags =
+ 				cpu_to_le32(new_rate.rate_n_flags);
+-		/* lq_cmd->rs_table[index].rate_n_flags = 0x800d; */
+ 
+ 		index++;
+-		repeat_cur_rate--;
++		repeat_rate--;
+ 	}
+ 
+-	/* lq_cmd->rs_table[0].rate_n_flags = 0x800d; */
+-
+ 	lq_cmd->general_params.dual_stream_ant_msk = 3;
+ 	lq_cmd->agg_params.agg_dis_start_th = 3;
+ 	lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000);
+-	return rc;
+ }
+ 
+ static void *rs_alloc(struct ieee80211_local *local)
+@@ -2000,6 +2012,162 @@ static void rs_free_sta(void *priv, void
+ }
+ 
+ 
++#ifdef CONFIG_MAC80211_DEBUGFS
++static int open_file_generic(struct inode *inode, struct file *file)
++{
++	file->private_data = inode->i_private;
++	return 0;
++}
++static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
++				struct iwl_rate *mcs, int index)
++{
++	const u32 cck_rate = 0x820A;
++	if (rs_priv->dbg_fixed.rate_n_flags) {
++		if (index < 12)
++			mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags;
++		else
++			mcs->rate_n_flags = cck_rate;
++		IWL_DEBUG_RATE("Fixed rate ON\n");
++		return;
++	}
++
++	IWL_DEBUG_RATE("Fixed rate OFF\n");
++}
++
++static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
++			const char __user *user_buf, size_t count, loff_t *ppos)
++{
++	struct iwl_rate_scale_priv *rs_priv = file->private_data;
++	char buf[64];
++	int buf_size;
++	u32 parsed_rate;
++
++	memset(buf, 0, sizeof(buf));
++	buf_size = min(count, sizeof(buf) -  1);
++	if (copy_from_user(buf, user_buf, buf_size))
++		return -EFAULT;
++
++	if (sscanf(buf, "%x", &parsed_rate) == 1)
++		rs_priv->dbg_fixed.rate_n_flags = parsed_rate;
++	else
++		rs_priv->dbg_fixed.rate_n_flags = 0;
++
++	rs_priv->active_rate = 0x0FFF;
++	rs_priv->active_siso_rate = 0x1FD0;
++	rs_priv->active_mimo_rate = 0x1FD0;
++
++	IWL_DEBUG_RATE("sta_id %d rate 0x%X\n",
++		rs_priv->lq.sta_id, rs_priv->dbg_fixed.rate_n_flags);
++
++	if (rs_priv->dbg_fixed.rate_n_flags) {
++		rs_fill_link_cmd(rs_priv, &rs_priv->dbg_fixed, &rs_priv->lq);
++		rs_send_lq_cmd(rs_priv->drv, &rs_priv->lq, CMD_ASYNC);
++	}
++
++	return count;
++}
++
++static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
++			char __user *user_buf, size_t count, loff_t *ppos)
++{
++	char buff[1024];
++	int desc = 0;
++	int i = 0;
++
++	struct iwl_rate_scale_priv *rs_priv = file->private_data;
++
++	desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id);
++	desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
++			rs_priv->total_failed, rs_priv->total_success,
++			rs_priv->active_rate);
++	desc += sprintf(buff+desc, "fixed rate 0x%X\n",
++			rs_priv->dbg_fixed.rate_n_flags);
++	desc += sprintf(buff+desc, "general:"
++		"flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n",
++		rs_priv->lq.general_params.flags,
++		rs_priv->lq.general_params.mimo_delimiter,
++		rs_priv->lq.general_params.single_stream_ant_msk,
++		rs_priv->lq.general_params.dual_stream_ant_msk);
++
++	desc += sprintf(buff+desc, "agg:"
++			"time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n",
++			le16_to_cpu(rs_priv->lq.agg_params.agg_time_limit),
++			rs_priv->lq.agg_params.agg_dis_start_th,
++			rs_priv->lq.agg_params.agg_frame_cnt_limit);
++
++	desc += sprintf(buff+desc,
++			"Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n",
++			rs_priv->lq.general_params.start_rate_index[0],
++			rs_priv->lq.general_params.start_rate_index[1],
++			rs_priv->lq.general_params.start_rate_index[2],
++			rs_priv->lq.general_params.start_rate_index[3]);
++
++
++	for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
++		desc += sprintf(buff+desc, " rate[%d] 0x%X\n",
++			i, le32_to_cpu(rs_priv->lq.rs_table[i].rate_n_flags));
++
++	return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
++}
++
++static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
++	.write = rs_sta_dbgfs_scale_table_write,
++	.read = rs_sta_dbgfs_scale_table_read,
++	.open = open_file_generic,
++};
++static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
++			char __user *user_buf, size_t count, loff_t *ppos)
++{
++	char buff[1024];
++	int desc = 0;
++	int i, j;
++
++	struct iwl_rate_scale_priv *rs_priv = file->private_data;
++	for (i = 0; i < LQ_SIZE; i++) {
++		desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
++				"rate=0x%X\n",
++				rs_priv->active_tbl == i?"*":"x",
++				rs_priv->lq_info[i].lq_type,
++				rs_priv->lq_info[i].is_SGI,
++				rs_priv->lq_info[i].is_fat,
++				rs_priv->lq_info[i].is_dup,
++				rs_priv->lq_info[i].current_rate.rate_n_flags);
++		for (j = 0; j < IWL_RATE_COUNT; j++) {
++			desc += sprintf(buff+desc,
++					"counter=%d success=%d %%=%d\n",
++					rs_priv->lq_info[i].win[j].counter,
++					rs_priv->lq_info[i].win[j].success_counter,
++					rs_priv->lq_info[i].win[j].success_ratio);
++		}
++	}
++	return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
++}
++
++static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
++	.read = rs_sta_dbgfs_stats_table_read,
++	.open = open_file_generic,
++};
++
++static void rs_add_debugfs(void *priv, void *priv_sta,
++					struct dentry *dir)
++{
++	struct iwl_rate_scale_priv *rs_priv = priv_sta;
++	rs_priv->rs_sta_dbgfs_scale_table_file =
++		debugfs_create_file("rate_scale_table", 0600, dir,
++				rs_priv, &rs_sta_dbgfs_scale_table_ops);
++	rs_priv->rs_sta_dbgfs_stats_table_file =
++		debugfs_create_file("rate_stats_table", 0600, dir,
++			rs_priv, &rs_sta_dbgfs_stats_table_ops);
++}
++
++static void rs_remove_debugfs(void *priv, void *priv_sta)
++{
++	struct iwl_rate_scale_priv *rs_priv = priv_sta;
++	debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file);
++	debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file);
++}
++#endif
++
+ static struct rate_control_ops rs_ops = {
+ 	.module = NULL,
+ 	.name = RS_NAME,
+@@ -2011,6 +2179,10 @@ static struct rate_control_ops rs_ops = 
+ 	.free = rs_free,
+ 	.alloc_sta = rs_alloc_sta,
+ 	.free_sta = rs_free_sta,
++#ifdef CONFIG_MAC80211_DEBUGFS
++	.add_sta_debugfs = rs_add_debugfs,
++	.remove_sta_debugfs = rs_remove_debugfs,
++#endif
+ };
+ 
+ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
+diff -up linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl4965-base.c.orig linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl4965-base.c
+--- linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl4965-base.c.orig	2007-09-27 19:08:16.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl4965-base.c	2007-09-27 19:09:01.000000000 -0400
+@@ -102,7 +102,7 @@ int iwl_param_queues_num = IWL_MAX_NUM_Q
+ #define VS
+ #endif
+ 
+-#define IWLWIFI_VERSION "0.1.15k" VD VS
++#define IWLWIFI_VERSION "1.1.17k" VD VS
+ #define DRV_COPYRIGHT	"Copyright(c) 2003-2007 Intel Corporation"
+ #define DRV_VERSION     IWLWIFI_VERSION
+ 
+@@ -203,7 +203,7 @@ static void iwl_print_hex_dump(int level
+  * reclaiming packets (on 'tx done IRQ), if free space become > high mark,
+  * Tx queue resumed.
+  *
+- * The IPW operates with six queues, one receive queue in the device's
++ * The IWL operates with six queues, one receive queue in the device's
+  * sram, one transmit queue for sending commands to the device firmware,
+  * and four transmit queues for data.
+  ***************************************************/
+@@ -407,6 +407,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0x
+ 
+ /**************************************************************/
+ 
++#if 0 /* temparary disable till we add real remove station */
+ static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
+ {
+ 	int index = IWL_INVALID_STATION;
+@@ -442,6 +443,7 @@ out:
+ 	spin_unlock_irqrestore(&priv->sta_lock, flags);
+ 	return 0;
+ }
++#endif
+ 
+ static void iwl_clear_stations_table(struct iwl_priv *priv)
+ {
+@@ -851,16 +853,12 @@ int iwl_send_statistics_request(struct i
+ static int iwl_rxon_add_station(struct iwl_priv *priv,
+ 				const u8 *addr, int is_ap)
+ {
+-	u8 rc;
+-
+-	/* Remove this station if it happens to already exist */
+-	iwl_remove_station(priv, addr, is_ap);
+-
+-	rc = iwl_add_station(priv, addr, is_ap, 0);
++	u8 sta_id;
+ 
++	sta_id = iwl_add_station(priv, addr, is_ap, 0);
+ 	iwl4965_add_station(priv, addr, is_ap);
+ 
+-	return rc;
++	return sta_id;
+ }
+ 
+ /**
+@@ -1147,16 +1145,6 @@ static int iwl_commit_rxon(struct iwl_pr
+ 				  "configuration (%d).\n", rc);
+ 			return rc;
+ 		}
+-
+-		/* The RXON bit toggling will have cleared out the
+-		 * station table in the uCode, so blank it in the driver
+-		 * as well */
+-		iwl_clear_stations_table(priv);
+-	} else if (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) {
+-		/* When switching from non-associated to associated, the
+-		 * uCode clears out the station table; so clear it in the
+-		 * driver as well */
+-		iwl_clear_stations_table(priv);
+ 	}
+ 
+ 	IWL_DEBUG_INFO("Sending RXON\n"
+@@ -1176,6 +1164,8 @@ static int iwl_commit_rxon(struct iwl_pr
+ 		return rc;
+ 	}
+ 
++	iwl_clear_stations_table(priv);
++
+ #ifdef CONFIG_IWLWIFI_SENSITIVITY
+ 	if (!priv->error_recovering)
+ 		priv->start_calib = 0;
+@@ -4608,6 +4598,7 @@ static void iwl_rx_handle(struct iwl_pri
+ 		reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
+ 			(pkt->hdr.cmd != REPLY_RX_PHY_CMD) &&
+ 			(pkt->hdr.cmd != REPLY_4965_RX) &&
++			(pkt->hdr.cmd != REPLY_COMPRESSED_BA) &&
+ 			(pkt->hdr.cmd != STATISTICS_NOTIFICATION) &&
+ 			(pkt->hdr.cmd != REPLY_TX);
+ 
+@@ -4893,12 +4884,12 @@ static void iwl_dump_nic_event_log(struc
+ 
+ 	/* bail out if nothing in log */
+ 	if (size == 0) {
+-		IWL_ERROR("Start IPW Event Log Dump: nothing in log\n");
++		IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
+ 		iwl_release_restricted_access(priv);
+ 		return;
+ 	}
+ 
+-	IWL_ERROR("Start IPW Event Log Dump: display count %d, wraps %d\n",
++	IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
+ 		  size, num_wraps);
+ 
+ 	/* if uCode has wrapped back to top of log, start at the oldest entry,
+@@ -7483,9 +7474,8 @@ static void iwl_config_ap(struct iwl_pri
+ 		iwl_activate_qos(priv, 1);
+ #endif
+ 		iwl_rxon_add_station(priv, BROADCAST_ADDR, 0);
+-		iwl_send_beacon_cmd(priv);
+-	} else
+-		iwl_send_beacon_cmd(priv);
++	}
++	iwl_send_beacon_cmd(priv);
+ 
+ 	/* FIXME - we need to add code here to detect a totally new
+ 	 * configuration, reset the AP, unassoc, rxon timing, assoc,
+diff -up linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965.c.orig linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965.c
+--- linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965.c.orig	2007-09-27 19:08:16.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-4965.c	2007-09-27 19:10:39.000000000 -0400
+@@ -183,7 +183,7 @@ u8 iwl_hw_find_station(struct iwl_priv *
+ 			goto out;
+ 		}
+ 
+-	IWL_DEBUG_ASSOC("can not find STA " MAC_FMT " total %d\n",
++	IWL_DEBUG_ASSOC_LIMIT("can not find STA " MAC_FMT " total %d\n",
+ 			MAC_ARG(addr), priv->num_stations);
+ 
+  out:
+diff -up linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-debug.h.orig linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-debug.h
+--- linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-debug.h.orig	2007-09-27 19:08:16.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl-debug.h	2007-09-27 19:09:01.000000000 -0400
+@@ -136,8 +136,11 @@ static inline void IWL_DEBUG_LIMIT(int l
+ #define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a)
+ #define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a)
+ #define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a)
++#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a)
+ #define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a)
+ #define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
++#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \
++	IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
+ #define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a)
+ #define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a)
+ #define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a)
+diff -up linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl3945-base.c.orig linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl3945-base.c
+--- linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl3945-base.c.orig	2007-09-27 19:08:16.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/iwlwifi/iwl3945-base.c	2007-09-27 19:10:13.000000000 -0400
+@@ -103,7 +103,7 @@ int iwl_param_queues_num = IWL_MAX_NUM_Q
+ #define VS
+ #endif
+ 
+-#define IWLWIFI_VERSION "0.1.15k" VD VS
++#define IWLWIFI_VERSION "1.1.17k" VD VS
+ #define DRV_COPYRIGHT	"Copyright(c) 2003-2007 Intel Corporation"
+ #define DRV_VERSION     IWLWIFI_VERSION
+ 
+@@ -204,7 +204,7 @@ static void iwl_print_hex_dump(int level
+  * reclaiming packets (on 'tx done IRQ), if free space become > high mark,
+  * Tx queue resumed.
+  *
+- * The IPW operates with six queues, one receive queue in the device's
++ * The IWL operates with six queues, one receive queue in the device's
+  * sram, one transmit queue for sending commands to the device firmware,
+  * and four transmit queues for data.
+  ***************************************************/
+@@ -407,6 +407,7 @@ const u8 BROADCAST_ADDR[ETH_ALEN] = { 0x
+  */
+ 
+ /**************************************************************/
++#if 0 /* temparary disable till we add real remove station */
+ static u8 iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
+ {
+ 	int index = IWL_INVALID_STATION;
+@@ -442,7 +443,7 @@ out:
+ 	spin_unlock_irqrestore(&priv->sta_lock, flags);
+ 	return 0;
+ }
+-
++#endif
+ static void iwl_clear_stations_table(struct iwl_priv *priv)
+ {
+ 	unsigned long flags;
+@@ -462,6 +463,7 @@ u8 iwl_add_station(struct iwl_priv *priv
+ 	int index = IWL_INVALID_STATION;
+ 	struct iwl_station_entry *station;
+ 	unsigned long flags_spin;
++	u8 rate;
+ 
+ 	spin_lock_irqsave(&priv->sta_lock, flags_spin);
+ 	if (is_ap)
+@@ -505,6 +507,15 @@ u8 iwl_add_station(struct iwl_priv *priv
+ 	station->sta.sta.sta_id = index;
+ 	station->sta.station_flags = 0;
+ 
++	rate = (priv->phymode == MODE_IEEE80211A) ? IWL_RATE_6M_PLCP :
++				IWL_RATE_1M_PLCP | priv->hw_setting.cck_flag;
++
++	/* Turn on both antennas for the station... */
++	station->sta.rate_n_flags =
++			iwl_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK);
++	station->current_rate.rate_n_flags =
++			le16_to_cpu(station->sta.rate_n_flags);
++
+ 	spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
+ 	iwl_send_add_station(priv, &station->sta, flags);
+ 	return index;
+@@ -834,25 +845,6 @@ int iwl_send_statistics_request(struct i
+ }
+ 
+ /**
+- * iwl_rxon_add_station - add station into station table.
+- *
+- * there is only one AP station with id= IWL_AP_ID
+- * NOTE: mutex must be held before calling the this fnction
+-*/
+-static int iwl_rxon_add_station(struct iwl_priv *priv,
+-				const u8 *addr, int is_ap)
+-{
+-	u8 rc;
+-
+-	/* Remove this station if it happens to already exist */
+-	iwl_remove_station(priv, addr, is_ap);
+-
+-	rc = iwl_add_station(priv, addr, is_ap, 0);
+-
+-	return rc;
+-}
+-
+-/**
+  * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON
+  * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz
+  * @channel: Any channel valid for the requested phymode
+@@ -1121,16 +1113,6 @@ static int iwl_commit_rxon(struct iwl_pr
+ 				  "configuration (%d).\n", rc);
+ 			return rc;
+ 		}
+-
+-		/* The RXON bit toggling will have cleared out the
+-		 * station table in the uCode, so blank it in the driver
+-		 * as well */
+-		iwl_clear_stations_table(priv);
+-	} else if (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) {
+-		/* When switching from non-associated to associated, the
+-		 * uCode clears out the station table; so clear it in the
+-		 * driver as well */
+-		iwl_clear_stations_table(priv);
+ 	}
+ 
+ 	IWL_DEBUG_INFO("Sending RXON\n"
+@@ -1152,6 +1134,8 @@ static int iwl_commit_rxon(struct iwl_pr
+ 
+ 	memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
+ 
++	iwl_clear_stations_table(priv);
++
+ 	/* If we issue a new RXON command which required a tune then we must
+ 	 * send a new TXPOWER command or we won't be able to Tx any frames */
+ 	rc = iwl_hw_reg_send_txpower(priv);
+@@ -1161,7 +1145,7 @@ static int iwl_commit_rxon(struct iwl_pr
+ 	}
+ 
+ 	/* Add the broadcast address so we can send broadcast frames */
+-	if (iwl_rxon_add_station(priv, BROADCAST_ADDR, 0) ==
++	if (iwl_add_station(priv, BROADCAST_ADDR, 0, 0) ==
+ 	    IWL_INVALID_STATION) {
+ 		IWL_ERROR("Error adding BROADCAST address for transmit.\n");
+ 		return -EIO;
+@@ -1171,7 +1155,7 @@ static int iwl_commit_rxon(struct iwl_pr
+ 	 * add the IWL_AP_ID to the station rate table */
+ 	if (iwl_is_associated(priv) &&
+ 	    (priv->iw_mode == IEEE80211_IF_TYPE_STA))
+-		if (iwl_rxon_add_station(priv, priv->active_rxon.bssid_addr, 1)
++		if (iwl_add_station(priv, priv->active_rxon.bssid_addr, 1, 0)
+ 		    == IWL_INVALID_STATION) {
+ 			IWL_ERROR("Error adding AP address for transmit.\n");
+ 			return -EIO;
+@@ -4583,12 +4567,12 @@ static void iwl_dump_nic_event_log(struc
+ 
+ 	/* bail out if nothing in log */
+ 	if (size == 0) {
+-		IWL_ERROR("Start IPW Event Log Dump: nothing in log\n");
++		IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
+ 		iwl_release_restricted_access(priv);
+ 		return;
+ 	}
+ 
+-	IWL_ERROR("Start IPW Event Log Dump: display count %d, wraps %d\n",
++	IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
+ 		  size, num_wraps);
+ 
+ 	/* if uCode has wrapped back to top of log, start at the oldest entry,
+@@ -4650,7 +4634,7 @@ static void iwl_error_recovery(struct iw
+ 	priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
+ 	iwl_commit_rxon(priv);
+ 
+-	iwl_rxon_add_station(priv, priv->bssid, 1);
++	iwl_add_station(priv, priv->bssid, 1, 0);
+ 
+ 	spin_lock_irqsave(&priv->lock, flags);
+ 	priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id);
+@@ -6793,8 +6777,8 @@ static void iwl_bg_post_associate(struct
+ 		/* clear out the station table */
+ 		iwl_clear_stations_table(priv);
+ 
+-		iwl_rxon_add_station(priv, BROADCAST_ADDR, 0);
+-		iwl_rxon_add_station(priv, priv->bssid, 0);
++		iwl_add_station(priv, BROADCAST_ADDR, 0, 0);
++		iwl_add_station(priv, priv->bssid, 0, 0);
+ 		iwl3945_sync_sta(priv, IWL_STA_ID,
+ 				 (priv->phymode == MODE_IEEE80211A)?
+ 				 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP,
+@@ -7082,10 +7066,9 @@ static void iwl_config_ap(struct iwl_pri
+ 		/* restore RXON assoc */
+ 		priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
+ 		iwl_commit_rxon(priv);
+-		iwl_rxon_add_station(priv, BROADCAST_ADDR, 0);
+-		iwl_send_beacon_cmd(priv);
+-	} else
+-		iwl_send_beacon_cmd(priv);
++		iwl_add_station(priv, BROADCAST_ADDR, 0, 0);
++	}
++	iwl_send_beacon_cmd(priv);
+ 
+ 	/* FIXME - we need to add code here to detect a totally new
+ 	 * configuration, reset the AP, unassoc, rxon timing, assoc,
+@@ -7168,8 +7151,8 @@ static int iwl_mac_config_interface(stru
+ 						RXON_FILTER_ASSOC_MSK;
+ 			rc = iwl_commit_rxon(priv);
+ 			if ((priv->iw_mode == IEEE80211_IF_TYPE_STA) && rc)
+-				iwl_rxon_add_station(
+-					priv, priv->active_rxon.bssid_addr, 1);
++				iwl_add_station(priv,
++					priv->active_rxon.bssid_addr, 1, 0);
+ 		}
+ 
+ 	} else {


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.201
retrieving revision 1.202
diff -u -r1.201 -r1.202
--- kernel.spec	3 Oct 2007 20:24:46 -0000	1.201
+++ kernel.spec	5 Oct 2007 15:17:09 -0000	1.202
@@ -633,6 +633,7 @@
 Patch670: linux-2.6-ata-quirk.patch
 Patch680: linux-2.6-wireless.patch
 Patch681: linux-2.6-wireless-pending.patch
+Patch682: linux-2.6-iwlwifi-fixes.patch
 Patch690: linux-2.6-at76.patch
 Patch691: linux-2.6-ath5k.patch
 Patch692: linux-2.6-zd1211rw-mac80211.patch
@@ -1143,9 +1144,11 @@
 ApplyPatch linux-2.6-libata-pata-dma-disable-option.patch
 
 # wireless patches headed for 2.6.23
-ApplyPatch linux-2.6-wireless.patch
+#ApplyPatch linux-2.6-wireless.patch
 # wireless patches staged for 2.6.24
 ApplyPatch linux-2.6-wireless-pending.patch
+# late-breaking iwlwifi fixes (will be rolled into wireless-pending patch)
+ApplyPatch linux-2.6-iwlwifi-fixes.patch
 # Add misc wireless bits from upstream wireless tree
 ApplyPatch linux-2.6-at76.patch
 ApplyPatch linux-2.6-ath5k.patch
@@ -1812,6 +1815,9 @@
 
 
 %changelog
+* Fri Oct 05 2007 John W. Linville <linville at redhat.com>
+- Back-out last round of wireless updates
+
 * Wed Oct 03 2007 John W. Linville <linville at redhat.com>
 - Update wireless bits from upstream
 

linux-2.6-at76.patch:

Index: linux-2.6-at76.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-at76.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-at76.patch	3 Oct 2007 20:24:46 -0000	1.2
+++ linux-2.6-at76.patch	5 Oct 2007 15:17:09 -0000	1.3
@@ -1,6 +1,6 @@
 diff -up linux-2.6.22.noarch/MAINTAINERS.orig linux-2.6.22.noarch/MAINTAINERS
---- linux-2.6.22.noarch/MAINTAINERS.orig	2007-10-03 14:21:45.000000000 -0400
-+++ linux-2.6.22.noarch/MAINTAINERS	2007-10-03 14:28:21.000000000 -0400
+--- linux-2.6.22.noarch/MAINTAINERS.orig	2007-09-26 19:57:31.000000000 -0400
++++ linux-2.6.22.noarch/MAINTAINERS	2007-09-26 19:59:33.000000000 -0400
 @@ -685,6 +685,15 @@ W:	http://www.thekelleys.org.uk/atmel
  W:	http://atmelwlandriver.sourceforge.net/
  S:	Maintained
@@ -18,9 +18,9 @@
  P:	David Woodhouse
  M:	dwmw2 at infradead.org
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/at76_usb.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/at76_usb.h	2007-10-03 14:28:21.000000000 -0400
-@@ -0,0 +1,619 @@
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/at76_usb.h	2007-09-26 19:59:33.000000000 -0400
+@@ -0,0 +1,662 @@
 +/*
 + * Copyright (c) 2002,2003 Oliver Kurth
 + *	     (c) 2003,2004 Joerg Albert <joerg.albert at gmx.de>
@@ -45,6 +45,11 @@
 +#ifndef _AT76_USB_H
 +#define _AT76_USB_H
 +
++#include <net/ieee80211.h>
++
++/* current driver version */
++#define DRIVER_VERSION	"0.16"
++
 +/* Board types */
 +enum board_type {
 +	BOARD_503_ISL3861 = 1,
@@ -96,9 +101,9 @@
 +#define CMD_SCAN		0x03
 +#define CMD_JOIN		0x04
 +#define CMD_START_IBSS		0x05
-+#define CMD_RADIO_ON		0x06
-+#define CMD_RADIO_OFF		0x07
++#define CMD_RADIO		0x06
 +#define CMD_STARTUP		0x0B
++#define CMD_GETOPMODE		0x33
 +
 +#define MIB_LOCAL		0x01
 +#define MIB_MAC_ADDR		0x02
@@ -263,11 +268,7 @@
 +	u8 size;
 +	u8 index;
 +	u8 reserved;
-+	union {
-+		u8 byte;
-+		__le16 word;
-+		u8 addr[ETH_ALEN];
-+	} data;
++	u8 data[72];
 +} __attribute__((packed));
 +
 +struct mib_local {
@@ -416,7 +417,8 @@
 +	struct list_head list;
 +
 +	u8 bssid[ETH_ALEN];	/* bssid */
-+	u8 ssid[IW_ESSID_MAX_SIZE];	/* essid */
++	u8 ssid[IW_ESSID_MAX_SIZE + 1];	/* ssid, +1 for trailing \0
++					   to make it printable */
 +	u8 ssid_len;		/* length of ssid above */
 +	u8 channel;
 +	u16 capa;		/* BSS capabilities */
@@ -574,7 +576,7 @@
 +	struct set_mib_buffer mib_buf;	/* global buffer for set_mib calls */
 +
 +	/* beacon counting */
-+	int beacon_period;	/* period of mgmt beacons, Kus */
++	int beacon_period;	/* period of mgmt beacons */
 +	int beacons_received;
 +	unsigned long beacons_last_qual;	/* time we restarted counting
 +						   beacons */
@@ -639,10 +641,51 @@
 +/* the max padding size for tx in bytes (see calc_padding) */
 +#define MAX_PADDING_SIZE	53
 +
++/* at76_debug bits */
++#define DBG_PROGRESS		0x00000001	/* authentication/accociation */
++#define DBG_BSS_TABLE		0x00000002	/* show BSS table after scans */
++#define DBG_IOCTL		0x00000004	/* ioctl calls / settings */
++#define DBG_MAC_STATE		0x00000008	/* MAC state transitions */
++#define DBG_TX_DATA		0x00000010	/* tx header */
++#define DBG_TX_DATA_CONTENT	0x00000020	/* tx content */
++#define DBG_TX_MGMT		0x00000040	/* tx management */
++#define DBG_RX_DATA		0x00000080	/* rx data header */
++#define DBG_RX_DATA_CONTENT	0x00000100	/* rx data content */
++#define DBG_RX_MGMT		0x00000200	/* rx mgmt frame headers */
++#define DBG_RX_BEACON		0x00000400	/* rx beacon */
++#define DBG_RX_CTRL		0x00000800	/* rx control */
++#define DBG_RX_MGMT_CONTENT	0x00001000	/* rx mgmt content */
++#define DBG_RX_FRAGS		0x00002000	/* rx data fragment handling */
++#define DBG_DEVSTART		0x00004000	/* fw download, device start */
++#define DBG_URB			0x00008000	/* rx urb status, ... */
++#define DBG_RX_ATMEL_HDR	0x00010000	/* Atmel-specific Rx headers */
++#define DBG_PROC_ENTRY		0x00020000	/* procedure entries/exits */
++#define DBG_PM			0x00040000	/* power management settings */
++#define DBG_BSS_MATCH		0x00080000	/* BSS match failures */
++#define DBG_PARAMS		0x00100000	/* show configured parameters */
++#define DBG_WAIT_COMPLETE	0x00200000	/* command completion */
++#define DBG_RX_FRAGS_SKB	0x00400000	/* skb header of Rx fragments */
++#define DBG_BSS_TABLE_RM	0x00800000	/* purging bss table entries */
++#define DBG_MONITOR_MODE	0x01000000	/* monitor mode */
++#define DBG_MIB			0x02000000	/* dump all MIBs on startup */
++#define DBG_MGMT_TIMER		0x04000000	/* dump mgmt_timer ops */
++#define DBG_WE_EVENTS		0x08000000	/* dump wireless events */
++#define DBG_FW			0x10000000	/* firmware download */
++#define DBG_DFU			0x20000000	/* device firmware upgrade */
++
++#define DBG_DEFAULTS		0
++
++/* Use our own dbg macro */
++#define at76_dbg(bits, format, arg...) \
++	do { \
++		if (at76_debug & (bits)) \
++		printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
++	} while (0)
++
 +#endif				/* _AT76_USB_H */
 diff -up linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig linux-2.6.22.noarch/drivers/net/wireless/Makefile
---- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-10-03 14:21:45.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-10-03 14:28:21.000000000 -0400
+--- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-09-26 19:57:31.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-09-26 19:59:33.000000000 -0400
 @@ -32,6 +32,8 @@ obj-$(CONFIG_ATMEL)             += atmel
  obj-$(CONFIG_PCI_ATMEL)         += atmel_pci.o 
  obj-$(CONFIG_PCMCIA_ATMEL)      += atmel_cs.o
@@ -653,9 +696,9 @@
  
  obj-$(CONFIG_HOSTAP)		+= hostap/
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/at76_usb.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/at76_usb.c	2007-10-03 14:28:21.000000000 -0400
-@@ -0,0 +1,5556 @@
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/at76_usb.c	2007-09-26 19:59:33.000000000 -0400
+@@ -0,0 +1,5553 @@
 +/*
 + * at76c503/at76c505 USB driver
 + *
@@ -694,56 +737,13 @@
 +#include <net/ieee80211_radiotap.h>
 +#include <linux/firmware.h>
 +#include <linux/leds.h>
-+#include <net/ieee80211.h>
 +
 +#include "at76_usb.h"
 +
 +/* Version information */
 +#define DRIVER_NAME "at76_usb"
-+#define DRIVER_VERSION	"0.17"
 +#define DRIVER_DESC "Atmel at76x USB Wireless LAN Driver"
 +
-+/* at76_debug bits */
-+#define DBG_PROGRESS		0x00000001	/* authentication/accociation */
-+#define DBG_BSS_TABLE		0x00000002	/* show BSS table after scans */
-+#define DBG_IOCTL		0x00000004	/* ioctl calls / settings */
-+#define DBG_MAC_STATE		0x00000008	/* MAC state transitions */
-+#define DBG_TX_DATA		0x00000010	/* tx header */
-+#define DBG_TX_DATA_CONTENT	0x00000020	/* tx content */
-+#define DBG_TX_MGMT		0x00000040	/* tx management */
-+#define DBG_RX_DATA		0x00000080	/* rx data header */
-+#define DBG_RX_DATA_CONTENT	0x00000100	/* rx data content */
-+#define DBG_RX_MGMT		0x00000200	/* rx mgmt frame headers */
-+#define DBG_RX_BEACON		0x00000400	/* rx beacon */
-+#define DBG_RX_CTRL		0x00000800	/* rx control */
-+#define DBG_RX_MGMT_CONTENT	0x00001000	/* rx mgmt content */
-+#define DBG_RX_FRAGS		0x00002000	/* rx data fragment handling */
-+#define DBG_DEVSTART		0x00004000	/* fw download, device start */
-+#define DBG_URB			0x00008000	/* rx urb status, ... */
-+#define DBG_RX_ATMEL_HDR	0x00010000	/* Atmel-specific Rx headers */
-+#define DBG_PROC_ENTRY		0x00020000	/* procedure entries/exits */
-+#define DBG_PM			0x00040000	/* power management settings */
-+#define DBG_BSS_MATCH		0x00080000	/* BSS match failures */
-+#define DBG_PARAMS		0x00100000	/* show configured parameters */
-+#define DBG_WAIT_COMPLETE	0x00200000	/* command completion */
-+#define DBG_RX_FRAGS_SKB	0x00400000	/* skb header of Rx fragments */
-+#define DBG_BSS_TABLE_RM	0x00800000	/* purging bss table entries */
-+#define DBG_MONITOR_MODE	0x01000000	/* monitor mode */
-+#define DBG_MIB			0x02000000	/* dump all MIBs on startup */
-+#define DBG_MGMT_TIMER		0x04000000	/* dump mgmt_timer ops */
-+#define DBG_WE_EVENTS		0x08000000	/* dump wireless events */
-+#define DBG_FW			0x10000000	/* firmware download */
-+#define DBG_DFU			0x20000000	/* device firmware upgrade */
-+
-+#define DBG_DEFAULTS		0
-+
-+/* Use our own dbg macro */
-+#define at76_dbg(bits, format, arg...) \
-+	do { \
-+		if (at76_debug & (bits)) \
-+		printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
-+	} while (0)
-+
 +static int at76_debug = DBG_DEFAULTS;
 +
 +/* Protect against concurrent firmware loading and parsing */
@@ -761,137 +761,127 @@
 +	[BOARD_505AMX] = {"atmel_at76c505amx-rfmd.bin"},
 +};
 +
-+#define USB_DEVICE_DATA(__ops)	.driver_info = (kernel_ulong_t)(__ops)
-+
 +static struct usb_device_id dev_table[] = {
 +	/*
 +	 * at76c503-i3861
 +	 */
 +	/* Generic AT76C503/3861 device */
-+	{USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	{USB_DEVICE(0x03eb, 0x7603), .driver_info = BOARD_503_ISL3861},
 +	/* Linksys WUSB11 v2.1/v2.6 */
-+	{USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* Netgear MA101 rev. A */
-+	{USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* Tekram U300C / Allnet ALL0193 */
-+	{USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* HP HN210W J7801A */
-+	{USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	{USB_DEVICE(0x066b, 0x2211), .driver_info = BOARD_503_ISL3861},
++	/* Netgear MA 101 Rev. A */
++	{USB_DEVICE(0x0864, 0x4100), .driver_info = BOARD_503_ISL3861},
++	/* Tekram U-300C / Allnet ALL0193 */
++	{USB_DEVICE(0x0b3b, 0x1612), .driver_info = BOARD_503_ISL3861},
++	/* HP HN210W PKW-J7801A */
++	{USB_DEVICE(0x03f0, 0x011c), .driver_info = BOARD_503_ISL3861},
 +	/* Sitecom/Z-Com/Zyxel M4Y-750 */
-+	{USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	{USB_DEVICE(0x0cde, 0x0001), .driver_info = BOARD_503_ISL3861},
 +	/* Dynalink/Askey WLL013 (intersil) */
-+	{USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */
-+	{USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* BenQ AWL300 */
-+	{USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* Addtron AWU-120, Compex WLU11 */
-+	{USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* Intel AP310 AnyPoint II USB */
-+	{USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	{USB_DEVICE(0x069a, 0x0320), .driver_info = BOARD_503_ISL3861},
++	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W (v1) */
++	{USB_DEVICE(0x0d5c, 0xa001), .driver_info = BOARD_503_ISL3861},
++	/* AWL-300 */
++	{USB_DEVICE(0x04a5, 0x9000), .driver_info = BOARD_503_ISL3861},
++	/* AWU-120, Compex WLU11 */
++	{USB_DEVICE(0x05dd, 0xff31), .driver_info = BOARD_503_ISL3861},
++	/* AP310 AnyPoint II USB */
++	{USB_DEVICE(0x8086, 0x0200), .driver_info = BOARD_503_ISL3861},
 +	/* Dynalink L11U */
-+	{USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	{USB_DEVICE(0x0d8e, 0x7100), .driver_info = BOARD_503_ISL3861},
 +	/* Arescom WL-210, FCC id 07J-GL2411USB */
-+	{USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/* I-O DATA WN-B11/USB */
-+	{USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	{USB_DEVICE(0x0d8e, 0x7110), .driver_info = BOARD_503_ISL3861},
++	/* IO-DATA WN-B11/USB */
++	{USB_DEVICE(0x04bb, 0x0919), .driver_info = BOARD_503_ISL3861},
 +	/* BT Voyager 1010 */
-+	{USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-+	/*
-+	 * at76c503-i3863
-+	 */
++	{USB_DEVICE(0x069a, 0x0821), .driver_info = BOARD_503_ISL3861},
++	/* at76c503-i3863 */
 +	/* Generic AT76C503/3863 device */
-+	{USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863)},
++	{USB_DEVICE(0x03eb, 0x7604), .driver_info = BOARD_503_ISL3863},
 +	/* Samsung SWL-2100U */
-+	{USB_DEVICE(0x055d, 0xa000), USB_DEVICE_DATA(BOARD_503_ISL3863)},
++	{USB_DEVICE(0x055d, 0xa000), .driver_info = BOARD_503_ISL3863},
 +	/*
 +	 * at76c503-rfmd
 +	 */
 +	/* Generic AT76C503/RFMD device */
-+	{USB_DEVICE(0x03eb, 0x7605), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x03eb, 0x7605), .driver_info = BOARD_503},
 +	/* Dynalink/Askey WLL013 (rfmd) */
-+	{USB_DEVICE(0x069a, 0x0321), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x069a, 0x0321), .driver_info = BOARD_503},
 +	/* Linksys WUSB11 v2.6 */
-+	{USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x077b, 0x2219), .driver_info = BOARD_503},
 +	/* Network Everywhere NWU11B */
-+	{USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503)},
-+	/* Netgear MA101 rev. B */
-+	{USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503)},
-+	/* D-Link DWL-120 rev. E */
-+	{USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x077b, 0x2227), .driver_info = BOARD_503},
++	/* Netgear MA 101 Rev. B */
++	{USB_DEVICE(0x0864, 0x4102), .driver_info = BOARD_503},
++	/* DWL-120 rev. E */
++	{USB_DEVICE(0x2001, 0x3200), .driver_info = BOARD_503},
 +	/* Actiontec 802UAT1, HWU01150-01UK */
-+	{USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x1668, 0x7605), .driver_info = BOARD_503},
 +	/* AirVast W-Buddie WN210 */
-+	{USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503)},
-+	/* Dick Smith Electronics XH1153 802.11b USB adapter */
-+	{USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503)},
-+	/* CNet CNUSB611 */
-+	{USB_DEVICE(0x1371, 0x0001), USB_DEVICE_DATA(BOARD_503)},
-+	/* FiberLine FL-WL200U */
-+	{USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503)},
-+	/* BenQ AWL400 USB stick */
-+	{USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503)},
-+	/* 3Com 3CRSHEW696 */
-+	{USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x03eb, 0x4102), .driver_info = BOARD_503},
++	/* XH1153 802.11b USB adapter */
++	{USB_DEVICE(0x1371, 0x5743), .driver_info = BOARD_503},
++	/* WL-200U */
++	{USB_DEVICE(0x1371, 0x0002), .driver_info = BOARD_503},
++	/* BenQ AWL-400 USB stick */
++	{USB_DEVICE(0x04a5, 0x9001), .driver_info = BOARD_503},
++	/* 3COM 3CRSHEW696 */
++	{USB_DEVICE(0x0506, 0x0a01), .driver_info = BOARD_503},
 +	/* Siemens Santis ADSL WLAN USB adapter WLL 013 */
-+	{USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x0681, 0x001b), .driver_info = BOARD_503},
 +	/* Belkin F5D6050, version 2 */
-+	{USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x050d, 0x0050), .driver_info = BOARD_503},
 +	/* iBlitzz, BWU613 (not *B or *SB) */
-+	{USB_DEVICE(0x07b8, 0xb000), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x07b8, 0xb000), .driver_info = BOARD_503},
 +	/* Gigabyte GN-WLBM101 */
-+	{USB_DEVICE(0x1044, 0x8003), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x1044, 0x8003), .driver_info = BOARD_503},
 +	/* Planex GW-US11S */
-+	{USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x2019, 0x3220), .driver_info = BOARD_503},
 +	/* Internal WLAN adapter in h5[4,5]xx series iPAQs */
-+	{USB_DEVICE(0x049f, 0x0032), USB_DEVICE_DATA(BOARD_503)},
-+	/* Corega Wireless LAN USB-11 mini */
-+	{USB_DEVICE(0x07aa, 0x0011), USB_DEVICE_DATA(BOARD_503)},
-+	/* Corega Wireless LAN USB-11 mini2 */
-+	{USB_DEVICE(0x07aa, 0x0018), USB_DEVICE_DATA(BOARD_503)},
++	{USB_DEVICE(0x049f, 0x0032), .driver_info = BOARD_503},
 +	/*
 +	 * at76c503-rfmd-acc
 +	 */
-+	/* SMC2664W */
-+	{USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC)},
-+	/* Belkin F5D6050, SMC2662W v2, SMC2662W-AR */
-+	{USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC)},
++	/* SMC 2664W */
++	{USB_DEVICE(0x083a, 0x3501), .driver_info = BOARD_503_ACC},
++	/* Belkin F5D6050, SMC 2662W v2, SMC 2662W-AR */
++	{USB_DEVICE(0x0d5c, 0xa002), .driver_info = BOARD_503_ACC},
 +	/*
 +	 * at76c505-rfmd
 +	 */
 +	/* Generic AT76C505/RFMD */
-+	{USB_DEVICE(0x03eb, 0x7606), USB_DEVICE_DATA(BOARD_505)},
++	{USB_DEVICE(0x03eb, 0x7606), .driver_info = BOARD_505},
 +	/*
 +	 * at76c505-rfmd2958
 +	 */
 +	/* Generic AT76C505/RFMD, OvisLink WL-1130USB */
-+	{USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
-+	/* Fiberline FL-WL240U */
-+	{USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958)},
-+	/* CNet CNUSB-611G */
-+	{USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958)},
++	{USB_DEVICE(0x03eb, 0x7613), .driver_info = BOARD_505_2958},
++	/* Fiberline WL-240U */
++	{USB_DEVICE(0x1371, 0x0014), .driver_info = BOARD_505_2958},
++	/* CNet CNUSB 611G */
++	{USB_DEVICE(0x1371, 0x0013), .driver_info = BOARD_505_2958},
 +	/* Linksys WUSB11 v2.8 */
-+	{USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958)},
++	{USB_DEVICE(0x1915, 0x2233), .driver_info = BOARD_505_2958},
 +	/* Xterasys XN-2122B, IBlitzz BWU613B/BWU613SB */
-+	{USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958)},
++	{USB_DEVICE(0x12fd, 0x1001), .driver_info = BOARD_505_2958},
 +	/* Corega WLAN USB Stick 11 */
-+	{USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
++	{USB_DEVICE(0x07aa, 0x7613), .driver_info = BOARD_505_2958},
 +	/* Microstar MSI Box MS6978 */
-+	{USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958)},
++	{USB_DEVICE(0x0db0, 0x1020), .driver_info = BOARD_505_2958},
 +	/*
 +	 * at76c505a-rfmd2958
 +	 */
 +	/* Generic AT76C505A device */
-+	{USB_DEVICE(0x03eb, 0x7614), USB_DEVICE_DATA(BOARD_505A)},
++	{USB_DEVICE(0x03eb, 0x7614), .driver_info = BOARD_505A},
 +	/* Generic AT76C505AS device */
-+	{USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A)},
++	{USB_DEVICE(0x03eb, 0x7617), .driver_info = BOARD_505A},
 +	/* Siemens Gigaset USB WLAN Adapter 11 */
-+	{USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A)},
++	{USB_DEVICE(0x1690, 0x0701), .driver_info = BOARD_505A},
 +	/*
 +	 * at76c505amx-rfmd
 +	 */
 +	/* Generic AT76C505AMX device */
-+	{USB_DEVICE(0x03eb, 0x7615), USB_DEVICE_DATA(BOARD_505AMX)},
++	{USB_DEVICE(0x03eb, 0x7615), .driver_info = BOARD_505AMX},
 +	{}
 +};
 +
@@ -906,8 +896,6 @@
 +	2447, 2452, 2457, 2462, 2467, 2472, 2484
 +};
 +
-+#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
-+
 +static const char *const preambles[] = { "long", "short", "auto" };
 +
 +static const char *const mac_states[] = {
@@ -920,6 +908,8 @@
 +	[MAC_OWN_IBSS] = "OWN_IBSS"
 +};
 +
++#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
++
 +/* Firmware download */
 +/* DFU states */
 +#define STATE_IDLE			0x00
@@ -999,16 +989,16 @@
 +	return ret;
 +}
 +
-+/* Convert timeout from the DFU status to jiffies */
-+static inline unsigned long at76_get_timeout(struct dfu_status *s)
++static inline u32 at76_get_timeout(struct dfu_status *s)
 +{
-+	return msecs_to_jiffies((s->poll_timeout[2] << 16)
-+				| (s->poll_timeout[1] << 8)
-+				| (s->poll_timeout[0]));
++	u32 ret = (s->poll_timeout[2] << 16) | (s->poll_timeout[1] << 8) |
++	    (s->poll_timeout[0]);
++
++	return ret;
 +}
 +
 +/* Load internal firmware from the buffer.  If manifest_sync_timeout > 0, use
-+ * its value in jiffies in the MANIFEST_SYNC state.  */
++ * its value in msec in the MANIFEST_SYNC state.  */
 +static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 +				int manifest_sync_timeout)
 +{
@@ -1026,7 +1016,7 @@
 +		 manifest_sync_timeout);
 +
 +	if (!size) {
-+		dev_printk(KERN_ERR, &udev->dev, "FW buffer length invalid!\n");
++		err("FW Buffer length invalid!");
 +		return -EINVAL;
 +	}
 +
@@ -1038,8 +1028,7 @@
 +		if (need_dfu_state) {
 +			ret = at76_dfu_get_state(udev, &dfu_state);
 +			if (ret < 0) {
-+				dev_printk(KERN_ERR, &udev->dev,
-+					   "cannot get DFU state: %d\n", ret);
++				err("DFU: Failed to get DFU state: %d", ret);
 +				goto exit;
 +			}
 +			need_dfu_state = 0;
@@ -1054,9 +1043,7 @@
 +				dfu_timeout = at76_get_timeout(&dfu_stat_buf);
 +				need_dfu_state = 0;
 +			} else
-+				dev_printk(KERN_ERR, &udev->dev,
-+					   "at76_dfu_get_status returned %d\n",
-+					   ret);
++				err("at76_dfu_get_status failed with %d", ret);
 +			break;
 +
 +		case STATE_DFU_DOWNLOAD_BUSY:
@@ -1064,7 +1051,8 @@
 +			need_dfu_state = 1;
 +
 +			at76_dbg(DBG_DFU, "DFU: Resetting device");
-+			schedule_timeout_interruptible(dfu_timeout);
++			schedule_timeout_interruptible(msecs_to_jiffies
++						       (dfu_timeout));
 +			break;
 +
 +		case STATE_DFU_DOWNLOAD_IDLE:
@@ -1085,9 +1073,7 @@
 +			blockno++;
 +
 +			if (ret != bsize)
-+				dev_printk(KERN_ERR, &udev->dev,
-+					   "at76_load_int_fw_block "
-+					   "returned %d\n", ret);
++				err("dfu_download_block failed with %d", ret);
 +			need_dfu_state = 1;
 +			break;
 +
@@ -1108,7 +1094,8 @@
 +				dfu_timeout = manifest_sync_timeout;
 +
 +			at76_dbg(DBG_DFU, "DFU: Waiting for manifest phase");
-+			schedule_timeout_interruptible(dfu_timeout);
++			schedule_timeout_interruptible(msecs_to_jiffies
++						       (dfu_timeout));
 +			break;
 +
 +		case STATE_DFU_MANIFEST:
@@ -1173,7 +1160,7 @@
 +	union iwreq_data wrqu;
 +	wrqu.data.length = 0;
 +	wrqu.data.flags = 0;
-+	memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
++	memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
 +	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 +	wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
 +	at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", netdev->name,
@@ -1239,7 +1226,7 @@
 +	if (tx_lastactivity != tx_activity) {
 +		tx_lastactivity = tx_activity;
 +		led_trigger_event(ledtrig_tx, LED_FULL);
-+		mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4);
++		mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250));
 +	} else
 +		led_trigger_event(ledtrig_tx, LED_OFF);
 +}
@@ -1248,7 +1235,7 @@
 +{
 +	tx_activity++;
 +	if (!timer_pending(&ledtrig_tx_timer))
-+		mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4);
++		mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250));
 +}
 +
 +/* Check if the given ssid is hidden */
@@ -1375,8 +1362,7 @@
 +exit:
 +	kfree(hwcfg);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: cannot get HW Config (error %d)\n",
-+		       priv->netdev->name, ret);
++		err("Get HW Config failed (%d)", ret);
 +
 +	return ret;
 +}
@@ -1479,14 +1465,15 @@
 +/* Wait until the command is completed */
 +static int at76_wait_completion(struct at76_priv *priv, int cmd)
 +{
++	struct net_device *netdev = priv->netdev;
 +	int status = 0;
 +	unsigned long timeout = jiffies + CMD_COMPLETION_TIMEOUT;
 +
 +	do {
 +		status = at76_get_cmd_status(priv->udev, cmd);
 +		if (status < 0) {
-+			printk(KERN_ERR "%s: at76_get_cmd_status failed: %d\n",
-+			       priv->netdev->name, status);
++			err("%s: at76_get_cmd_status failed: %d", netdev->name,
++			    status);
 +			break;
 +		}
 +
@@ -1501,9 +1488,8 @@
 +
 +		schedule_timeout_interruptible(HZ / 10);	/* 100 ms */
 +		if (time_after(jiffies, timeout)) {
-+			printk(KERN_ERR
-+			       "%s: completion timeout for command %d\n",
-+			       priv->netdev->name, cmd);
++			err("%s: timeout waiting for cmd %d completion",
++			    netdev->name, cmd);
 +			status = -ETIMEDOUT;
 +			break;
 +		}
@@ -1534,24 +1520,21 @@
 +}
 +
 +/* Return < 0 on error, == 0 if no command sent, == 1 if cmd sent */
-+static int at76_set_radio(struct at76_priv *priv, int enable)
++static int at76_set_radio(struct at76_priv *priv, int on_off)
 +{
 +	int ret;
-+	int cmd;
 +
-+	if (priv->radio_on == enable)
++	if (priv->radio_on == on_off)
 +		return 0;
 +
-+	cmd = enable ? CMD_RADIO_ON : CMD_RADIO_OFF;
-+
-+	ret = at76_set_card_command(priv->udev, cmd, NULL, 0);
++	ret = at76_set_card_command(priv->udev, CMD_RADIO, NULL, 0);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: at76_set_card_command(%d) failed: %d\n",
-+		       priv->netdev->name, cmd, ret);
++		err("%s: at76_set_card_command(CMD_RADIO) failed: %d",
++		    priv->netdev->name, ret);
 +	else
 +		ret = 1;
 +
-+	priv->radio_on = enable;
++	priv->radio_on = on_off;
 +	return ret;
 +}
 +
@@ -1560,15 +1543,17 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, power_mgmt_mode);
-+	priv->mib_buf.data.byte = priv->pm_mode;
++
++	priv->mib_buf.data[0] = priv->pm_mode;
 +
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (pm_mode) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (pm_mode) failed: %d", priv->netdev->name,
++		    ret);
 +
 +	return ret;
 +}
@@ -1578,15 +1563,17 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, station_id);
-+	priv->mib_buf.data.word = cpu_to_le16(id);
++
++	*(__le16 *)priv->mib_buf.data = cpu_to_le16(id);
 +
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (associd) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (associd) failed: %d", priv->netdev->name,
++		    ret);
 +
 +	return ret;
 +}
@@ -1596,16 +1583,17 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac, listen_interval);
-+	priv->mib_buf.data.word = cpu_to_le16(interval);
++
++	*(__le16 *)priv->mib_buf.data = cpu_to_le16(interval);
 +
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR
-+		       "%s: set_mib (listen_interval) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (listen_interval) failed: %d",
++		    priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1614,15 +1602,15 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_LOCAL;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_local, preamble_type);
-+	priv->mib_buf.data.byte = type;
-+
++	priv->mib_buf.data[0] = type;
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (preamble) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (preamble) failed: %d", priv->netdev->name,
++		    ret);
 +
 +	return ret;
 +}
@@ -1631,15 +1619,15 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac, frag_threshold);
-+	priv->mib_buf.data.word = cpu_to_le16(size);
-+
++	*(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (frag threshold) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (frag threshold) failed: %d",
++		    priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1648,15 +1636,14 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac, rts_threshold);
-+	priv->mib_buf.data.word = cpu_to_le16(size);
-+
++	*(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (rts) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (rts) failed: %d", priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1665,35 +1652,83 @@
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_LOCAL;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_local, txautorate_fallback);
-+	priv->mib_buf.data.byte = onoff;
-+
++	priv->mib_buf.data[0] = onoff;
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (autorate fallback) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (autorate fallback) failed: %d",
++		    priv->netdev->name, ret);
 +
 +	return ret;
 +}
 +
++/* Set network device type for the current mode */
++static void at76_set_monitor_mode(struct at76_priv *priv)
++{
++	if (priv->iw_mode == IW_MODE_MONITOR) {
++		at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE ON",
++			 priv->netdev->name);
++		priv->netdev->type = ARPHRD_IEEE80211_RADIOTAP;
++	} else {
++		at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE OFF",
++			 priv->netdev->name);
++		priv->netdev->type = ARPHRD_ETHER;
++	}
++}
++
 +static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 +{
 +	int ret = 0;
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_ADDR;
 +	priv->mib_buf.size = ETH_ALEN;
 +	priv->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr);
-+	memcpy(priv->mib_buf.data.addr, addr, ETH_ALEN);
++	memcpy(priv->mib_buf.data, addr, ETH_ALEN);
++	ret = at76_set_mib(priv, &priv->mib_buf);
++	if (ret < 0)
++		err("%s: set_mib (MAC_ADDR, mac_addr) failed: %d",
++		    priv->netdev->name, ret);
++
++	return ret;
++}
 +
++#if 0
++/* Implemented to get promisc. mode working, but does not help.
++   May still be useful for multicast eventually. */
++static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
++{
++	int ret = 0;
++
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
++	priv->mib_buf.type = MIB_MAC_ADDR;
++	priv->mib_buf.size = ETH_ALEN;
++	priv->mib_buf.index =
++	    offsetof(struct mib_mac_addr, group_addr) + n * ETH_ALEN;
++	memcpy(priv->mib_buf.data, addr, ETH_ALEN);
++	ret = at76_set_mib(priv, &priv->mib_buf);
++	if (ret < 0)
++		err("%s: set_mib (MIB_MAC_ADDR, group_addr) failed: %d",
++		    priv->netdev->name, ret);
++
++	/* I do not know anything about the group_addr_status field... (oku) */
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
++	priv->mib_buf.type = MIB_MAC_ADDR;
++	priv->mib_buf.size = 1;
++	priv->mib_buf.index =
++	    offsetof(struct mib_mac_addr, group_addr_status) + n;
++	priv->mib_buf.data[0] = 1;
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (MAC_ADDR, mac_addr) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (MIB_MAC_ADDR, group_addr_status) failed: %d",
++		    priv->netdev->name, ret);
 +
 +	return ret;
 +}
++#endif
 +
 +static void at76_dump_mib_mac_addr(struct at76_priv *priv)
 +{
@@ -1708,8 +1743,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m,
 +			   sizeof(struct mib_mac_addr));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (MAC_ADDR) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (MAC_ADDR) failed: %d",
++		    priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1737,8 +1772,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m,
 +			   sizeof(struct mib_mac_wep));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (MAC_WEP) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (MAC_WEP) failed: %d", priv->netdev->name,
++		    ret);
 +		goto exit;
 +	}
 +
@@ -1767,6 +1802,7 @@
 +	int ret;
 +	struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt),
 +					 GFP_KERNEL);
++	char country_string[4];
 +
 +	if (!m)
 +		return;
@@ -1774,18 +1810,21 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m,
 +			   sizeof(struct mib_mac_mgmt));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (MAC_MGMT) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (MAC_MGMT) failed: %d",
++		    priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
++	memcpy(&country_string, m->country_string, 3);
++	country_string[3] = '\0';
++
 +	at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration "
 +		 "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d "
 +		 "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d "
 +		 "current_bssid %s current_essid %s current_bss_type %d "
 +		 "pm_mode %d ibss_change %d res %d "
 +		 "multi_domain_capability_implemented %d "
-+		 "international_roaming %d country_string %.3s",
++		 "international_roaming %d country_string %s",
 +		 priv->netdev->name, le16_to_cpu(m->beacon_period),
 +		 le16_to_cpu(m->CFP_max_duration),
 +		 le16_to_cpu(m->medium_occupancy_limit),
@@ -1795,7 +1834,7 @@
 +		 hex2str(m->current_essid, IW_ESSID_MAX_SIZE),
 +		 m->current_bss_type, m->power_mgmt_mode, m->ibss_change,
 +		 m->res, m->multi_domain_capability_implemented,
-+		 m->multi_domain_capability_enabled, m->country_string);
++		 m->multi_domain_capability_enabled, country_string);
 +exit:
 +	kfree(m);
 +}
@@ -1810,8 +1849,8 @@
 +
 +	ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (MAC) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (MAC) failed: %d", priv->netdev->name,
++		    ret);
 +		goto exit;
 +	}
 +
@@ -1846,8 +1885,8 @@
 +
 +	ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (PHY) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (PHY) failed: %d", priv->netdev->name,
++		    ret);
 +		goto exit;
 +	}
 +
@@ -1879,8 +1918,8 @@
 +
 +	ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (LOCAL) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (LOCAL) failed: %d", priv->netdev->name,
++		    ret);
 +		goto exit;
 +	}
 +
@@ -1904,8 +1943,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m,
 +			   sizeof(struct mib_mdomain));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib (MDOMAIN) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib (MDOMAIN) failed: %d", priv->netdev->name,
++		    ret);
 +		goto exit;
 +	}
 +
@@ -1934,8 +1973,7 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, mac_mgmt,
 +			   sizeof(struct mib_mac_mgmt));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
 +		goto error;
 +	}
 +	memcpy(priv->bssid, mac_mgmt->current_bssid, ETH_ALEN);
@@ -1958,8 +1996,8 @@
 +	}
 +	ret = at76_get_mib(priv->udev, MIB_PHY, phy, sizeof(struct mib_phy));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib(MIB_PHY) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib(MIB_PHY) failed: %d", priv->netdev->name,
++		    ret);
 +		goto error;
 +	}
 +	priv->channel = phy->channel_id;
@@ -2056,15 +2094,14 @@
 +	ret = at76_set_card_command(priv->udev, CMD_START_IBSS, &bss,
 +				    sizeof(struct at76_req_ibss));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: start_ibss failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: start_ibss failed: %d", priv->netdev->name, ret);
 +		return ret;
 +	}
 +
 +	ret = at76_wait_completion(priv, CMD_START_IBSS);
 +	if (ret != CMD_STATUS_COMPLETE) {
-+		printk(KERN_ERR "%s: start_ibss failed to complete, %d\n",
-+		       priv->netdev->name, ret);
++		err("%s start_ibss failed to complete, %d",
++		    priv->netdev->name, ret);
 +		return ret;
 +	}
 +
@@ -2077,15 +2114,14 @@
 +		return ret;
 +
 +	/* not sure what this is good for ??? */
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
-+	priv->mib_buf.data.byte = 0;
-+
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: set_mib (ibss change ok) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (ibss change ok) failed: %d",
++		    priv->netdev->name, ret);
 +		return ret;
 +	}
 +
@@ -2195,8 +2231,8 @@
 +			  AT76_TX_HDRLEN, at76_tx_callback, priv);
 +	ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
 +	if (ret)
-+		printk(KERN_ERR "%s: error in tx submit urb: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: %s error in tx submit urb: %d",
++		    priv->netdev->name, __func__, ret);
 +
 +	kfree(mgmt_buf);
 +}
@@ -2226,19 +2262,18 @@
 +		/* a data/mgmt tx is already pending in the URB -
 +		   if this is no error in some situations we must
 +		   implement a queue or silently modify the old msg */
-+		printk(KERN_ERR "%s: removed pending mgmt buffer %s\n",
-+		       priv->netdev->name, hex2str(oldbuf, 64));
++		err("%s: %s removed pending mgmt buffer %s", priv->netdev->name,
++		    __func__, hex2str(oldbuf, 64));
 +		kfree(oldbuf);
 +		return 0;
 +	}
 +
-+	txbuf->tx_rate = TX_RATE_1MBIT;
++	txbuf->tx_rate = 0;
 +	txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
-+	memset(txbuf->reserved, 0, sizeof(txbuf->reserved));
 +
 +	if (priv->next_mgmt_bulk)
-+		printk(KERN_ERR "%s: URB status %d, but mgmt is pending\n",
-+		       priv->netdev->name, urb_status);
++		err("%s: %s URB status %d, but mgmt is pending",
++		    priv->netdev->name, __func__, urb_status);
 +
 +	at76_dbg(DBG_TX_MGMT,
 +		 "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
@@ -2255,8 +2290,8 @@
 +			  AT76_TX_HDRLEN, at76_tx_callback, priv);
 +	ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
 +	if (ret)
-+		printk(KERN_ERR "%s: error in tx submit urb: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: %s error in tx submit urb: %d",
++		    priv->netdev->name, __func__, ret);
 +
 +	kfree(txbuf);
 +
@@ -2329,9 +2364,9 @@
 +	struct at76_tx_buffer *tx_buffer;
 +	struct ieee80211_hdr_3addr *mgmt;
 +	struct ieee80211_assoc_request *req;
-+	struct ieee80211_info_element *ie;
-+	char *essid;
-+	int essid_len;
++	struct ieee80211_info_element *tlv;
++	char essid[IW_ESSID_MAX_SIZE + 1];
++	int len;
 +	u16 capa;
 +
 +	BUG_ON(!bss);
@@ -2342,7 +2377,7 @@
 +
 +	req = (struct ieee80211_assoc_request *)tx_buffer->packet;
 +	mgmt = &req->header;
-+	ie = req->info_element;
++	tlv = req->info_element;
 +
 +	/* make wireless header */
 +	mgmt->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
@@ -2369,29 +2404,29 @@
 +
 +	/* write TLV data elements */
 +
-+	ie->id = MFIE_TYPE_SSID;
-+	ie->len = bss->ssid_len;
-+	memcpy(ie->data, bss->ssid, bss->ssid_len);
-+	next_ie(&ie);
-+
-+	ie->id = MFIE_TYPE_RATES;
-+	ie->len = sizeof(hw_rates);
-+	memcpy(ie->data, hw_rates, sizeof(hw_rates));
-+	next_ie(&ie);		/* ie points behind the supp_rates field */
++	tlv->id = MFIE_TYPE_SSID;
++	tlv->len = bss->ssid_len;
++	memcpy(tlv->data, bss->ssid, bss->ssid_len);
++	next_ie(&tlv);
++
++	tlv->id = MFIE_TYPE_RATES;
++	tlv->len = sizeof(hw_rates);
++	memcpy(tlv->data, hw_rates, sizeof(hw_rates));
++	next_ie(&tlv);		/* tlv points behind the supp_rates field */
 +
 +	/* init. at76_priv tx header */
-+	tx_buffer->wlength = cpu_to_le16((u8 *)ie - (u8 *)mgmt);
++	tx_buffer->wlength = cpu_to_le16((u8 *)tlv - (u8 *)mgmt);
 +
-+	ie = req->info_element;
-+	essid = ie->data;
-+	essid_len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
-+
-+	next_ie(&ie);		/* points to IE of rates now */
++	tlv = req->info_element;
++	len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
++	memcpy(essid, tlv->data, len);
++	essid[len] = '\0';
++	next_ie(&tlv);		/* points to IE of rates now */
 +	at76_dbg(DBG_TX_MGMT,
-+		 "%s: AssocReq bssid %s capa 0x%04x ssid %.*s rates %s",
++		 "%s: AssocReq bssid %s capa 0x%04x ssid %s rates %s",
 +		 priv->netdev->name, mac2str(mgmt->addr3),
-+		 le16_to_cpu(req->capability), essid_len, essid,
-+		 hex2str(ie->data, ie->len));
++		 le16_to_cpu(req->capability), essid,
++		 hex2str(tlv->data, tlv->len));
 +
 +	/* either send immediately (if no data tx is pending
 +	   or put it in pending list */
@@ -2448,12 +2483,13 @@
 +
 +	list_for_each(lptr, &priv->bss_list) {
 +		ptr = list_entry(lptr, struct bss_info, list);
-+		at76_dbg(DBG_BSS_TABLE, "0x%p: bssid %s channel %d ssid %.*s "
-+			 "(%s) capa 0x%04x rates %s rssi %d link %d noise %d",
-+			 ptr, mac2str(ptr->bssid), ptr->channel, ptr->ssid_len,
-+			 ptr->ssid, hex2str(ptr->ssid, ptr->ssid_len),
-+			 ptr->capa, hex2str(ptr->rates, ptr->rates_len),
-+			 ptr->rssi, ptr->link_qual, ptr->noise_level);
++		at76_dbg(DBG_BSS_TABLE,
++			 "0x%p: bssid %s channel %d ssid %s (%s)"
++			 " capa 0x%04x rates %s rssi %d link %d noise %d", ptr,
++			 mac2str(ptr->bssid), ptr->channel, ptr->ssid,
++			 hex2str(ptr->ssid, ptr->ssid_len), ptr->capa,
++			 hex2str(ptr->rates, ptr->rates_len), ptr->rssi,
++			 ptr->link_qual, ptr->noise_level);
 +	}
 +	spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
 +}
@@ -3112,6 +3148,8 @@
 +		data->flags = 1;
 +		data->length = priv->essid_size;
 +		memcpy(extra, priv->essid, data->length);
++		extra[data->length] = '\0';
++		data->length += 1;
 +	} else {
 +		/* the ANY ssid was specified */
 +		if (priv->mac_state == MAC_CONNECTED && priv->curr_bss) {
@@ -3119,6 +3157,8 @@
 +			data->flags = 1;
 +			data->length = priv->curr_bss->ssid_len;
 +			memcpy(extra, priv->curr_bss->ssid, data->length);
++			extra[priv->curr_bss->ssid_len] = '\0';
++			data->length += 1;
 +		} else {
 +			/* report ANY back */
 +			data->flags = 0;
@@ -3126,8 +3166,7 @@
 +		}
 +	}
 +
-+	at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %.*s", netdev->name,
-+		 data->length, extra);
++	at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %s", netdev->name, extra);
 +
 +	return 0;
 +}
@@ -3769,24 +3808,24 @@
 +	struct ethhdr *eh = (struct ethhdr *)skb->data;
 +
 +	if (netif_queue_stopped(netdev)) {
-+		printk(KERN_ERR "%s: %s called while netdev is stopped\n",
-+		       netdev->name, __func__);
++		err("%s: %s called while netdev is stopped", netdev->name,
++		    __func__);
 +		/* skip this packet */
 +		dev_kfree_skb(skb);
 +		return 0;
 +	}
 +
 +	if (priv->tx_urb->status == -EINPROGRESS) {
-+		printk(KERN_ERR "%s: %s called while tx urb is pending\n",
-+		       netdev->name, __func__);
++		err("%s: %s called while priv->tx_urb is pending for tx",
++		    netdev->name, __func__);
 +		/* skip this packet */
 +		dev_kfree_skb(skb);
 +		return 0;
 +	}
 +
 +	if (skb->len < ETH_HLEN) {
-+		printk(KERN_ERR "%s: %s: skb too short (%d)\n",
-+		       netdev->name, __func__, skb->len);
++		err("%s: %s: skb too short (%d)", priv->netdev->name,
++		    __func__, skb->len);
 +		dev_kfree_skb(skb);
 +		return 0;
 +	}
@@ -3806,11 +3845,11 @@
 +			       skb->len - ETH_HLEN);
 +			wlen = IEEE80211_3ADDR_LEN + skb->len - ETH_HLEN;
 +		} else {
-+			printk(KERN_ERR "%s: dropping non-SNAP 802.2 packet "
-+			       "(DSAP 0x%02x SSAP 0x%02x cntrl 0x%02x)\n",
-+			       priv->netdev->name, skb->data[ETH_HLEN],
-+			       skb->data[ETH_HLEN + 1],
-+			       skb->data[ETH_HLEN + 2]);
++			err("%s: %s: no support for non-SNAP 802.2 packets "
++			    "(DSAP 0x%02x SSAP 0x%02x cntrl 0x%02x)",
++			    priv->netdev->name, __func__,
++			    skb->data[ETH_HLEN], skb->data[ETH_HLEN + 1],
++			    skb->data[ETH_HLEN + 2]);
 +			dev_kfree_skb(skb);
 +			return 0;
 +		}
@@ -3850,7 +3889,7 @@
 +	   seems to choose the highest rate set with CMD_STARTUP in
 +	   basic_rate_set replacing this value */
 +
-+	memset(tx_buffer->reserved, 0, sizeof(tx_buffer->reserved));
++	memset(tx_buffer->reserved, 0, 4);
 +
 +	tx_buffer->padding = at76_calc_padding(wlen);
 +	submit_len = wlen + AT76_TX_HDRLEN + tx_buffer->padding;
@@ -3874,13 +3913,11 @@
 +	ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
 +	if (ret) {
 +		stats->tx_errors++;
-+		printk(KERN_ERR "%s: error in tx submit urb: %d\n",
-+		       netdev->name, ret);
++		err("%s: error in tx submit urb: %d", netdev->name, ret);
 +		if (ret == -EINVAL)
-+			printk(KERN_ERR
-+			       "%s: -EINVAL: tx urb %p hcpriv %p complete %p\n",
-+			       priv->netdev->name, priv->tx_urb,
-+			       priv->tx_urb->hcpriv, priv->tx_urb->complete);
++			err("-EINVAL: urb %p urb->hcpriv %p urb->complete %p",
++			    priv->tx_urb, priv->tx_urb->hcpriv,
++			    priv->tx_urb->complete);
 +	} else {
 +		stats->tx_bytes += skb->len;
 +		dev_kfree_skb(skb);
@@ -3908,16 +3945,15 @@
 +	struct sk_buff *skb = priv->rx_skb;
 +
 +	if (!priv->rx_urb) {
-+		printk(KERN_ERR "%s: %s: priv->rx_urb is NULL\n",
-+		       priv->netdev->name, __func__);
++		err("%s: priv->rx_urb is NULL", __func__);
 +		return -EFAULT;
 +	}
 +
 +	if (!skb) {
 +		skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
 +		if (!skb) {
-+			printk(KERN_ERR "%s: cannot allocate rx skbuff\n",
-+			       priv->netdev->name);
++			err("%s: unable to allocate rx skbuff.",
++			    priv->netdev->name);
 +			ret = -ENOMEM;
 +			goto exit;
 +		}
@@ -3936,8 +3972,8 @@
 +			at76_dbg(DBG_DEVSTART,
 +				 "usb_submit_urb returned -ENODEV");
 +		else
-+			printk(KERN_ERR "%s: rx, usb_submit_urb failed: %d\n",
-+			       priv->netdev->name, ret);
++			err("%s: rx, usb_submit_urb failed: %d",
++			    priv->netdev->name, ret);
 +	}
 +
 +exit:
@@ -3972,8 +4008,7 @@
 +
 +	ret = at76_submit_rx_urb(priv);
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: open: submit_rx_urb failed: %d\n",
-+		       netdev->name, ret);
++		err("%s: open: submit_rx_urb failed: %d", netdev->name, ret);
 +		goto error;
 +	}
 +
@@ -4020,12 +4055,14 @@
 +{
 +	struct at76_priv *priv = netdev_priv(netdev);
 +
-+	strncpy(info->driver, DRIVER_NAME, sizeof(info->driver));
++	strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
++
 +	strncpy(info->version, DRIVER_VERSION, sizeof(info->version));
++	info->version[sizeof(info->version) - 1] = '\0';
 +
 +	usb_make_path(priv->udev, info->bus_info, sizeof(info->bus_info));
 +
-+	snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d-%d",
++	snprintf(info->fw_version, sizeof(info->fw_version) - 1, "%d.%d.%d-%d",
 +		 priv->fw_version.major, priv->fw_version.minor,
 +		 priv->fw_version.patch, priv->fw_version.build);
 +}
@@ -4059,8 +4096,7 @@
 +	at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
 +
 +	if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
-+		dev_printk(KERN_ERR, &udev->dev, "unexpected opmode %d\n",
-+			   op_mode);
++		err("unexpected opmode %d", op_mode);
 +		return -EINVAL;
 +	}
 +
@@ -4079,9 +4115,8 @@
 +			 size, bsize, blockno);
 +		ret = at76_load_ext_fw_block(udev, blockno, block, bsize);
 +		if (ret != bsize) {
-+			dev_printk(KERN_ERR, &udev->dev,
-+				   "loading %dth firmware block failed: %d\n",
-+				   blockno, ret);
++			err("loading %dth firmware block failed: %d", blockno,
++			    ret);
 +			goto exit;
 +		}
 +		buf += bsize;
@@ -4097,8 +4132,7 @@
 +exit:
 +	kfree(block);
 +	if (ret < 0)
-+		dev_printk(KERN_ERR, &udev->dev,
-+			   "downloading external firmware failed: %d\n", ret);
++		err("Downloading external firmware failed: %d", ret);
 +	return ret;
 +}
 +
@@ -4109,11 +4143,10 @@
 +	int need_remap = !at76_is_505a(fwe->board_type);
 +
 +	ret = at76_usbdfu_download(udev, fwe->intfw, fwe->intfw_size,
-+				   need_remap ? 0 : 2 * HZ);
++				   need_remap ? 0 : 2000);
 +
 +	if (ret < 0) {
-+		dev_printk(KERN_ERR, &udev->dev,
-+			   "downloading internal fw failed with %d\n", ret);
++		err("downloading internal fw failed with %d", ret);
 +		goto exit;
 +	}
 +
@@ -4123,8 +4156,7 @@
 +	if (need_remap) {
 +		ret = at76_remap(udev);
 +		if (ret < 0) {
-+			dev_printk(KERN_ERR, &udev->dev,
-+				   "sending REMAP failed with %d\n", ret);
++			err("sending REMAP failed with %d", ret);
 +			goto exit;
 +		}
 +	}
@@ -4297,18 +4329,18 @@
 +
 +	ret = at76_join_bss(priv, priv->curr_bss);
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: join_bss failed with %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: join_bss failed with %d", priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
 +	ret = at76_wait_completion(priv, CMD_JOIN);
 +	if (ret != CMD_STATUS_COMPLETE) {
 +		if (ret != CMD_STATUS_TIME_OUT)
-+			printk(KERN_ERR "%s: join_bss completed with %d\n",
-+			       priv->netdev->name, ret);
++			err("%s join_bss completed with %d",
++			    priv->netdev->name, ret);
 +		else
-+			printk(KERN_INFO "%s: join_bss ssid %s timed out\n",
++			printk(KERN_INFO
++			       "%s: join_bss ssid %s timed out\n",
 +			       priv->netdev->name,
 +			       mac2str(priv->curr_bss->bssid));
 +
@@ -4362,8 +4394,8 @@
 +
 +	status = at76_get_cmd_status(priv->udev, CMD_SCAN);
 +	if (status < 0) {
-+		printk(KERN_ERR "%s: %s: at76_get_cmd_status failed with %d\n",
-+		       priv->netdev->name, __func__, status);
++		err("%s: %s: at76_get_cmd_status failed with %d",
++		    priv->netdev->name, __func__, status);
 +		status = CMD_STATUS_IN_PROGRESS;
 +		/* INFO: Hope it was a one off error - if not, scanning
 +		   further down the line and stop this cycle */
@@ -4376,9 +4408,9 @@
 +	if (status != CMD_STATUS_COMPLETE) {
 +		if ((status != CMD_STATUS_IN_PROGRESS) &&
 +		    (status != CMD_STATUS_IDLE))
-+			printk(KERN_ERR "%s: %s: Bad scan status: %s\n",
-+			       priv->netdev->name, __func__,
-+			       at76_get_cmd_status_string(status));
++			err("%s: %s: Bad scan status: %s",
++			    priv->netdev->name, __func__,
++			    at76_get_cmd_status_string(status));
 +
 +		/* the first cmd status after scan start is always a IDLE ->
 +		   start the timer to poll again until COMPLETED */
@@ -4396,12 +4428,11 @@
 +	if (priv->scan_need_any) {
 +		ret = at76_start_scan(priv, 0);
 +		if (ret < 0)
-+			printk(KERN_ERR
-+			       "%s: %s: start_scan (ANY) failed with %d\n",
-+			       priv->netdev->name, __func__, ret);
++			err("%s: %s: start_scan (ANY) failed with %d",
++			    priv->netdev->name, __func__, ret);
 +		at76_dbg(DBG_MGMT_TIMER,
-+			 "%s:%d: starting mgmt_timer for %d ticks", __func__,
-+			 __LINE__, SCAN_POLL_INTERVAL);
++			 "%s:%d: starting mgmt_timer for %d ticks",
++			 __func__, __LINE__, SCAN_POLL_INTERVAL);
 +		schedule_delayed_work(&priv->dwork_get_scan,
 +				      SCAN_POLL_INTERVAL);
 +		priv->scan_need_any = 0;
@@ -4505,6 +4536,7 @@
 +	struct at76_priv *priv = container_of(work, struct at76_priv,
 +					      work_new_bss);
 +	int ret;
++	struct net_device *netdev = priv->netdev;
 +	struct mib_mac_mgmt mac_mgmt;
 +
 +	mutex_lock(&priv->mtx);
@@ -4512,8 +4544,7 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, &mac_mgmt,
 +			   sizeof(struct mib_mac_mgmt));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_get_mib failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_get_mib failed: %d", netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -4523,15 +4554,14 @@
 +
 +	at76_iwevent_bss_connect(priv->netdev, priv->bssid);
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
-+	priv->mib_buf.data.byte = 0;
-+
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (ibss change ok) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (ibss change ok) failed: %d", netdev->name,
++		    ret);
 +
 +exit:
 +	mutex_unlock(&priv->mtx);
@@ -4541,10 +4571,16 @@
 +{
 +	struct at76_card_config *ccfg = &priv->card_config;
 +	int ret;
++	char ossid[IW_ESSID_MAX_SIZE + 1];
++
++	/* make priv->essid printable */
++	BUG_ON(priv->essid_size > IW_ESSID_MAX_SIZE);
++	memcpy(ossid, priv->essid, priv->essid_size);
++	ossid[priv->essid_size] = '\0';
 +
 +	at76_dbg(DBG_PARAMS,
-+		 "%s param: ssid %.*s (%s) mode %s ch %d wep %s key %d "
-+		 "keylen %d", priv->netdev->name, priv->essid_size, priv->essid,
++		 "%s param: ssid %s (%s) mode %s ch %d wep %s key %d "
++		 "keylen %d", priv->netdev->name, ossid,
 +		 hex2str(priv->essid, IW_ESSID_MAX_SIZE),
 +		 priv->iw_mode == IW_MODE_ADHOC ? "adhoc" : "infra",
 +		 priv->channel, priv->wep_enabled ? "enabled" : "disabled",
@@ -4604,8 +4640,8 @@
 +	ret = at76_set_card_command(priv->udev, CMD_STARTUP, &priv->card_config,
 +				    sizeof(struct at76_card_config));
 +	if (ret < 0) {
-+		printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: at76_set_card_command failed: %d", priv->netdev->name,
++		    ret);
 +		return ret;
 +	}
 +
@@ -4615,7 +4651,7 @@
 +	memset(priv->bssid, 0, ETH_ALEN);
 +
 +	if (at76_set_radio(priv, 1) == 1)
-+		at76_wait_completion(priv, CMD_RADIO_ON);
++		at76_wait_completion(priv, CMD_RADIO);
 +
 +	ret = at76_set_preamble(priv, priv->preamble_type);
 +	if (ret < 0)
@@ -4638,6 +4674,8 @@
 +	if (ret < 0)
 +		return ret;
 +
++	at76_set_monitor_mode(priv);
++
 +	if (at76_debug & DBG_MIB) {
 +		at76_dump_mib_mac(priv);
 +		at76_dump_mib_mac_addr(priv);
@@ -4659,19 +4697,15 @@
 +
 +	mutex_lock(&priv->mtx);
 +
++	at76_startup_device(priv);
 +	netif_carrier_off(priv->netdev);	/* stop netdev watchdog */
 +	netif_stop_queue(priv->netdev);	/* stop tx data packets */
 +
-+	at76_startup_device(priv);
-+
 +	if (priv->iw_mode != IW_MODE_MONITOR) {
-+		priv->netdev->type = ARPHRD_ETHER;
 +		at76_set_mac_state(priv, MAC_SCANNING);
 +		schedule_work(&priv->work_start_scan);
-+	} else {
-+		priv->netdev->type = ARPHRD_IEEE80211_RADIOTAP;
++	} else
 +		at76_start_monitor(priv);
-+	}
 +
 +	mutex_unlock(&priv->mtx);
 +}
@@ -4700,8 +4734,8 @@
 +	ret = at76_start_scan(priv, 1);
 +
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: %s: start_scan failed with %d\n",
-+		       priv->netdev->name, __func__, ret);
++		err("%s: %s: start_scan failed with %d",
++		    priv->netdev->name, __func__, ret);
 +	else {
 +		at76_dbg(DBG_MGMT_TIMER,
 +			 "%s:%d: starting mgmt_timer for %d ticks",
@@ -4723,15 +4757,15 @@
 +
 +	mutex_lock(&priv->mtx);
 +
++	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_LOCAL;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_local, promiscuous_mode);
-+	priv->mib_buf.data.byte = priv->promisc ? 1 : 0;
-+
++	priv->mib_buf.data[0] = priv->promisc ? 1 : 0;
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		printk(KERN_ERR "%s: set_mib (promiscuous_mode) failed: %d\n",
-+		       priv->netdev->name, ret);
++		err("%s: set_mib (promiscuous_mode) failed: %d",
++		    priv->netdev->name, ret);
 +
 +	mutex_unlock(&priv->mtx);
 +}
@@ -4753,14 +4787,15 @@
 +{
 +	struct ieee80211_assoc_response *resp =
 +	    (struct ieee80211_assoc_response *)buf->packet;
++	struct ieee80211_hdr_3addr *mgmt = &resp->header;
 +	u16 assoc_id = le16_to_cpu(resp->aid);
 +	u16 status = le16_to_cpu(resp->status);
-+
-+	at76_dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa 0x%04x status "
-+		 "0x%04x assoc_id 0x%04x rates %s", priv->netdev->name,
-+		 mac2str(resp->header.addr3), le16_to_cpu(resp->capability),
-+		 status, assoc_id, hex2str(resp->info_element->data,
-+					   resp->info_element->len));
++	u16 capa = le16_to_cpu(resp->capability);
++	at76_dbg(DBG_RX_MGMT,
++		 "%s: rx AssocResp bssid %s capa 0x%04x status 0x%04x "
++		 "assoc_id 0x%04x rates %s", priv->netdev->name,
++		 mac2str(mgmt->addr3), capa, status, assoc_id,
++		 hex2str(resp->info_element->data, resp->info_element->len));
 +
 +	if (priv->mac_state != MAC_ASSOC) {
 +		printk(KERN_INFO "%s: AssocResp in state %s ignored\n",
@@ -4947,7 +4982,7 @@
 +	struct bss_info *match;	/* entry matching addr3 with its bssid */
 +	int new_entry = 0;
 +	int len;
-+	struct ieee80211_info_element *ie;
++	struct ieee80211_info_element *tlv;
 +	int have_ssid = 0;
 +	int have_rates = 0;
 +	int have_channel = 0;
@@ -4989,13 +5024,14 @@
 +
 +	if (!match) {
 +		/* BSS not in the list - append it */
-+		match = kzalloc(sizeof(struct bss_info), GFP_ATOMIC);
++		match = kmalloc(sizeof(struct bss_info), GFP_ATOMIC);
 +		if (!match) {
 +			at76_dbg(DBG_BSS_TABLE,
 +				 "%s: cannot kmalloc new bss info (%zd byte)",
 +				 priv->netdev->name, sizeof(struct bss_info));
 +			goto exit;
 +		}
++		memset(match, 0, sizeof(*match));
 +		new_entry = 1;
 +		list_add_tail(&match->list, &priv->bss_list);
 +	}
@@ -5009,7 +5045,7 @@
 +	at76_dbg(DBG_RX_BEACON, "%s: bssid %s", priv->netdev->name,
 +		 mac2str(match->bssid));
 +
-+	ie = bdata->info_element;
++	tlv = bdata->info_element;
 +
 +	/* length of var length beacon parameters */
 +	varpar_len = min_t(int, le16_to_cpu(buf->wlength) -
@@ -5031,31 +5067,34 @@
 +	 * bytes are useful, hence the have_ssid etc optimizations. */
 +
 +	while (keep_going &&
-+	       ((&ie->data[ie->len] - (u8 *)bdata->info_element) <=
++	       ((&tlv->data[tlv->len] - (u8 *)bdata->info_element) <=
 +		varpar_len)) {
 +
-+		switch (ie->id) {
++		switch (tlv->id) {
 +
 +		case MFIE_TYPE_SSID:
 +			if (have_ssid)
 +				break;
 +
-+			len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
++			len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
 +
 +			/* we copy only if this is a new entry,
 +			   or the incoming SSID is not a hidden SSID. This
 +			   will protect us from overwriting a real SSID read
 +			   in a ProbeResponse with a hidden one from a
 +			   following beacon. */
-+			if (!new_entry && at76_is_hidden_ssid(ie->data, len)) {
++			if (!new_entry && at76_is_hidden_ssid(tlv->data, len)) {
 +				have_ssid = 1;
 +				break;
 +			}
 +
 +			match->ssid_len = len;
-+			memcpy(match->ssid, ie->data, len);
-+			at76_dbg(DBG_RX_BEACON, "%s: SSID - %.*s",
-+				 priv->netdev->name, len, match->ssid);
++			memcpy(match->ssid, tlv->data, len);
++			match->ssid[len] = '\0';	/* terminate the
++							   string for
++							   printing */
++			at76_dbg(DBG_RX_BEACON, "%s: SSID - %s",
++				 priv->netdev->name, match->ssid);
 +			have_ssid = 1;
 +			break;
 +
@@ -5064,19 +5103,19 @@
 +				break;
 +
 +			match->rates_len =
-+			    min_t(int, sizeof(match->rates), ie->len);
-+			memcpy(match->rates, ie->data, match->rates_len);
++			    min_t(int, sizeof(match->rates), tlv->len);
++			memcpy(match->rates, tlv->data, match->rates_len);
 +			have_rates = 1;
 +			at76_dbg(DBG_RX_BEACON, "%s: SUPPORTED RATES %s",
 +				 priv->netdev->name,
-+				 hex2str(ie->data, ie->len));
++				 hex2str(tlv->data, tlv->len));
 +			break;
 +
 +		case MFIE_TYPE_DS_SET:
 +			if (have_channel)
 +				break;
 +
-+			match->channel = ie->data[0];
++			match->channel = tlv->data[0];
 +			have_channel = 1;
 +			at76_dbg(DBG_RX_BEACON, "%s: CHANNEL - %d",
 +				 priv->netdev->name, match->channel);
@@ -5087,13 +5126,13 @@
 +		case MFIE_TYPE_IBSS_SET:
 +		default:
 +			at76_dbg(DBG_RX_BEACON, "%s: beacon IE id %d len %d %s",
-+				 priv->netdev->name, ie->id, ie->len,
-+				 hex2str(ie->data, ie->len));
++				 priv->netdev->name, tlv->id, tlv->len,
++				 hex2str(tlv->data, tlv->len));
 +			break;
 +		}
 +
 +		/* advance to the next informational element */
-+		next_ie(&ie);
++		next_ie(&tlv);
 +
 +		/* Optimization: after all, the bdata->data array is
 +		 * varpar_len bytes long, whereas we get all of the useful
@@ -5133,17 +5172,17 @@
 +	if (at76_is_intersil(priv->board_type))
 +		qual->qual = buf->link_quality;
 +	else {
-+		unsigned long elapsed;
++		unsigned long msec;
 +
 +		/* Update qual at most once a second */
-+		elapsed = jiffies - priv->beacons_last_qual;
-+		if (elapsed < 1 * HZ)
++		msec = jiffies_to_msecs(jiffies) - priv->beacons_last_qual;
++		if (msec < 1000)
 +			return;
 +
 +		qual->qual = qual->level * priv->beacons_received *
-+		    msecs_to_jiffies(priv->beacon_period) / elapsed;
++		    priv->beacon_period / msec;
 +
-+		priv->beacons_last_qual = jiffies;
++		priv->beacons_last_qual = jiffies_to_msecs(jiffies);
 +		priv->beacons_received = 0;
 +	}
 +	qual->qual = (qual->qual > 100) ? 100 : qual->qual;
@@ -5569,8 +5608,8 @@
 +
 +	skb = dev_alloc_skb(skblen);
 +	if (!skb) {
-+		printk(KERN_ERR "%s: MONITOR MODE: dev_alloc_skb for radiotap "
-+		       "header returned NULL\n", priv->netdev->name);
++		err("%s: MONITOR MODE: dev_alloc_skb for radiotap header "
++		    "returned NULL", priv->netdev->name);
 +		return;
 +	}
 +
@@ -5597,7 +5636,7 @@
 +	skb->ip_summed = CHECKSUM_NONE;
 +	skb_reset_mac_header(skb);
 +	skb->pkt_type = PACKET_OTHERHOST;
-+	skb->protocol = htons(ETH_P_802_2);
++	skb->protocol = htons(ETH_P_80211_RAW);
 +
 +	netdev->last_rx = jiffies;
 +	netif_rx(skb);
@@ -5722,11 +5761,9 @@
 +	at76_dbg(DBG_FW, "downloading firmware %s", fwe->fwname);
 +	ret = request_firmware(&fwe->fw, fwe->fwname, &udev->dev);
 +	if (ret < 0) {
-+		dev_printk(KERN_ERR, &udev->dev, "firmware %s not found!\n",
-+			   fwe->fwname);
-+		dev_printk(KERN_ERR, &udev->dev,
-+			   "you may need to download the firmware from "
-+			   "http://developer.berlios.de/projects/at76c503a/");
++		err("firmware %s not found.", fwe->fwname);
++		err("You may need to download the firmware from "
++		    "http://developer.berlios.de/projects/at76c503a/");
 +		goto exit;
 +	}
 +
@@ -5734,17 +5771,15 @@
 +	fwh = (struct at76_fw_header *)(fwe->fw->data);
 +
 +	if (fwe->fw->size <= sizeof(*fwh)) {
-+		dev_printk(KERN_ERR, &udev->dev,
-+			   "firmware is too short (0x%zx)\n", fwe->fw->size);
++		err("firmware is too short (0x%zx)", fwe->fw->size);
 +		goto exit;
 +	}
 +
 +	/* CRC currently not checked */
 +	fwe->board_type = le32_to_cpu(fwh->board_type);
 +	if (fwe->board_type != board_type) {
-+		dev_printk(KERN_ERR, &udev->dev,
-+			   "board type mismatch, requested %u, got %u\n",
-+			   board_type, fwe->board_type);
++		err("board type mismatch, requested %u, got %u", board_type,
++		    fwe->board_type);
 +		goto exit;
 +	}
 +
@@ -5761,11 +5796,9 @@
 +
 +	fwe->loaded = 1;
 +
-+	dev_printk(KERN_DEBUG, &udev->dev,
-+		   "using firmware %s (version %d.%d.%d-%d)\n",
-+		   fwe->fwname, fwh->major, fwh->minor, fwh->patch, fwh->build);
-+
-+	at76_dbg(DBG_DEVSTART, "board %u, int %d:%d, ext %d:%d", board_type,
++	at76_dbg(DBG_DEVSTART, "firmware board %u version %u.%u.%u-%u "
++		 "(int %d:%d, ext %d:%d)", board_type,
++		 fwh->major, fwh->minor, fwh->patch, fwh->build,
 +		 le32_to_cpu(fwh->int_fw_offset), le32_to_cpu(fwh->int_fw_len),
 +		 le32_to_cpu(fwh->ext_fw_offset), le32_to_cpu(fwh->ext_fw_len));
 +	at76_dbg(DBG_DEVSTART, "firmware id %s", str);
@@ -5789,11 +5822,12 @@
 +	/* allocate memory for our device state and initialize it */
 +	netdev = alloc_etherdev(sizeof(struct at76_priv));
 +	if (!netdev) {
-+		dev_printk(KERN_ERR, &udev->dev, "out of memory\n");
++		err("out of memory");
 +		return NULL;
 +	}
 +
 +	priv = netdev_priv(netdev);
++	memset(priv, 0, sizeof(*priv));
 +
 +	priv->udev = udev;
 +	priv->netdev = netdev;
@@ -5870,8 +5904,7 @@
 +	}
 +
 +	if (!ep_in || !ep_out) {
-+		dev_printk(KERN_ERR, &interface->dev,
-+			   "bulk endpoints missing\n");
++		printk(KERN_ERR DRIVER_NAME ": bulk endpoints missing\n");
 +		return -ENXIO;
 +	}
 +
@@ -5881,15 +5914,15 @@
 +	priv->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
 +	priv->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
 +	if (!priv->rx_urb || !priv->tx_urb) {
-+		dev_printk(KERN_ERR, &interface->dev, "cannot allocate URB\n");
++		printk(KERN_ERR DRIVER_NAME ": cannot allocate URB\n");
 +		return -ENOMEM;
 +	}
 +
 +	buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE;
 +	priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
 +	if (!priv->bulk_out_buffer) {
-+		dev_printk(KERN_ERR, &interface->dev,
-+			   "cannot allocate output buffer\n");
++		printk(KERN_ERR DRIVER_NAME
++		       ": cannot allocate output buffer\n");
 +		return -ENOMEM;
 +	}
 +
@@ -5918,8 +5951,7 @@
 +	/* MAC address */
 +	ret = at76_get_hw_config(priv);
 +	if (ret < 0) {
-+		dev_printk(KERN_ERR, &interface->dev,
-+			   "cannot get MAC address\n");
++		err("could not get MAC address");
 +		goto exit;
 +	}
 +
@@ -5929,13 +5961,14 @@
 +
 +	priv->channel = DEF_CHANNEL;
 +	priv->iw_mode = IW_MODE_INFRA;
++	memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
 +	priv->rts_threshold = DEF_RTS_THRESHOLD;
 +	priv->frag_threshold = DEF_FRAG_THRESHOLD;
 +	priv->short_retry_limit = DEF_SHORT_RETRY_LIMIT;
 +	priv->txrate = TX_RATE_AUTO;
 +	priv->preamble_type = PREAMBLE_TYPE_LONG;
 +	priv->beacon_period = 100;
-+	priv->beacons_last_qual = jiffies;
++	priv->beacons_last_qual = jiffies_to_msecs(jiffies);
 +	priv->auth_mode = WLAN_AUTH_OPEN;
 +	priv->scan_min_time = DEF_SCAN_MIN_TIME;
 +	priv->scan_max_time = DEF_SCAN_MAX_TIME;
@@ -5957,18 +5990,18 @@
 +	netdev->wireless_handlers = &at76_handler_def;
 +	netdev->set_multicast_list = at76_set_multicast;
 +	netdev->set_mac_address = at76_set_mac_address;
-+	dev_alloc_name(netdev, "wlan%d");
 +
 +	ret = register_netdev(priv->netdev);
 +	if (ret) {
-+		dev_printk(KERN_ERR, &interface->dev,
-+			   "cannot register netdevice (status %d)!\n", ret);
++		err("unable to register netdevice %s (status %d)!",
++		    priv->netdev->name, ret);
 +		goto exit;
 +	}
 +	priv->netdev_registered = 1;
 +
-+	printk(KERN_INFO "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
-+	       netdev->name, interface->dev.bus_id, mac2str(priv->mac_addr),
++	printk(KERN_INFO "%s: MAC address %s\n", netdev->name,
++	       mac2str(priv->mac_addr));
++	printk(KERN_INFO "%s: firmware version %d.%d.%d-%d\n", netdev->name,
 +	       priv->fw_version.major, priv->fw_version.minor,
 +	       priv->fw_version.patch, priv->fw_version.build);
 +	printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n", netdev->name,
@@ -6064,8 +6097,8 @@
 +	   we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
 +
 +	if (op_mode == OPMODE_HW_CONFIG_MODE) {
-+		dev_printk(KERN_ERR, &interface->dev,
-+			   "cannot handle a device in HW_CONFIG_MODE\n");
++		err("cannot handle a device in HW_CONFIG_MODE (opmode %d)",
++		    op_mode);
 +		ret = -EBUSY;
 +		goto error;
 +	}
@@ -6073,13 +6106,10 @@
 +	if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH
 +	    && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
 +		/* download internal firmware part */
-+		dev_printk(KERN_DEBUG, &interface->dev,
-+			   "downloading internal firmware\n");
++		at76_dbg(DBG_DEVSTART, "downloading internal firmware");
 +		ret = at76_load_internal_fw(udev, fwe);
 +		if (ret < 0) {
-+			dev_printk(KERN_ERR, &interface->dev,
-+				   "error %d downloading internal firmware\n",
-+				   ret);
++			err("error %d downloading internal firmware", ret);
 +			goto error;
 +		}
 +		usb_put_dev(udev);
@@ -6104,8 +6134,7 @@
 +		need_ext_fw = 1;
 +
 +	if (need_ext_fw) {
-+		dev_printk(KERN_DEBUG, &interface->dev,
-+			   "downloading external firmware\n");
++		at76_dbg(DBG_DEVSTART, "downloading external firmware");
 +
 +		ret = at76_load_external_fw(udev, fwe);
 +		if (ret)
@@ -6114,8 +6143,20 @@
 +		/* Re-check firmware version */
 +		ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
 +		if (ret < 0) {
-+			dev_printk(KERN_ERR, &interface->dev,
-+				   "error %d getting firmware version\n", ret);
++			err("error %d getting firmware version", ret);
++			goto error;
++		}
++
++		/* Major and minor version must match */
++		if (fwv.major != fwe->fw_version.major
++		    || fwv.minor != fwe->fw_version.minor) {
++			printk(KERN_ERR DRIVER_NAME
++			       ": wrong firmware version, loaded %d.%d.%d-%d, "
++			       "read back %d.%d.%d-%d\n",
++			       fwe->fw_version.major, fwe->fw_version.minor,
++			       fwe->fw_version.patch, fwe->fw_version.build,
++			       fwv.major, fwv.minor, fwv.patch, fwv.build);
++			ret = -EBUSY;
 +			goto error;
 +		}
 +	}
@@ -6156,7 +6197,7 @@
 +
 +	printk(KERN_INFO "%s: disconnecting\n", priv->netdev->name);
 +	at76_delete_device(priv);
-+	dev_printk(KERN_INFO, &interface->dev, "disconnected\n");
++	printk(KERN_INFO DRIVER_NAME ": disconnected\n");
 +}
 +
 +/* Structure for registering this driver with the USB subsystem */
@@ -6178,8 +6219,7 @@
 +	/* register this driver with the USB subsystem */
 +	result = usb_register(&at76_driver);
 +	if (result < 0)
-+		printk(KERN_ERR DRIVER_NAME
-+		       ": usb_register failed (status %d)\n", result);
++		err("usb_register failed (status %d)", result);
 +
 +	led_trigger_register_simple("at76_usb-tx", &ledtrig_tx);
 +	return result;
@@ -6213,8 +6253,8 @@
 +MODULE_DESCRIPTION(DRIVER_DESC);
 +MODULE_LICENSE("GPL");
 diff -up linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.22.noarch/drivers/net/wireless/Kconfig
---- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-10-03 14:21:45.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-10-03 14:28:21.000000000 -0400
+--- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-09-26 19:57:31.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-09-26 19:59:33.000000000 -0400
 @@ -381,6 +381,14 @@ config PCI_HERMES
  	  common.  Some of the built-in wireless adaptors in laptops are of
  	  this variety.

linux-2.6-ath5k.patch:

Index: linux-2.6-ath5k.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-ath5k.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-ath5k.patch	3 Oct 2007 20:24:46 -0000	1.3
+++ linux-2.6-ath5k.patch	5 Oct 2007 15:17:09 -0000	1.4
@@ -1,6 +1,6 @@
 diff -up linux-2.6.22.noarch/MAINTAINERS.orig linux-2.6.22.noarch/MAINTAINERS
---- linux-2.6.22.noarch/MAINTAINERS.orig	2007-10-03 15:07:15.000000000 -0400
-+++ linux-2.6.22.noarch/MAINTAINERS	2007-10-03 15:08:01.000000000 -0400
+--- linux-2.6.22.noarch/MAINTAINERS.orig	2007-09-27 19:25:02.000000000 -0400
++++ linux-2.6.22.noarch/MAINTAINERS	2007-09-27 19:26:44.000000000 -0400
 @@ -642,6 +642,14 @@ M:	ecashin at coraid.com
  W:	http://www.coraid.com/support/linux
  S:	Supported
@@ -17,8 +17,8 @@
  P:	Jay Cliburn
  M:	jcliburn at gmail.com
 diff -up linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig linux-2.6.22.noarch/drivers/net/wireless/Makefile
---- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-10-03 15:07:15.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-10-03 15:08:27.000000000 -0400
+--- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-09-27 19:25:02.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-09-27 19:27:03.000000000 -0400
 @@ -61,3 +61,5 @@ obj-$(CONFIG_RT2X00)		+= rt2x00/
  obj-$(CONFIG_P54_COMMON)	+= p54common.o
  obj-$(CONFIG_P54_USB)		+= p54usb.o
@@ -26,8 +26,8 @@
 +
 +obj-$(CONFIG_ATH5K)	+= ath5k/
 diff -up linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.22.noarch/drivers/net/wireless/Kconfig
---- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-10-03 15:07:15.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-10-03 15:08:01.000000000 -0400
+--- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-09-27 19:25:02.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-09-27 19:26:44.000000000 -0400
 @@ -598,6 +598,19 @@ config P54_PCI
  	tristate "Prism54 PCI support"
  	depends on P54_COMMON && PCI
@@ -49,28 +49,46 @@
  source "drivers/net/wireless/bcm43xx/Kconfig"
  source "drivers/net/wireless/b43/Kconfig"
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/phy.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/phy.c	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,1686 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/phy.c	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,1704 @@
 +/*
 + * PHY functions
 + *
-+ * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
-+ * Copyright (c) 2006, 2007 Nick Kossifidis <mickflemm at gmail.com>
-+ * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
-+ *
-+ * Permission to use, copy, modify, and distribute this software for any
-+ * purpose with or without fee is hereby granted, provided that the above
-+ * copyright notice and this permission notice appear in all copies.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
 + *
++ *  This file is free software: you can copy, redistribute and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 2 of the License, or (at
++ *  your option) any later version.
++ *
++ *  This file is distributed in the hope that it will be useful, but
++ *  WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *  General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ *
++ * This file incorporates work covered by the following copyright and
++ * permission notice:
++ *
++ *     Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
++ *     Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
++ *
++ *     Permission to use, copy, modify, and distribute this software for
++ *     any purpose with or without fee is hereby granted, provided that
++ *     the above copyright notice and this permission notice appear in all
++ *     copies.
++ *
++ *     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
++ *     WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
++ *     WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
++ *     AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
++ *     CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
++ *     OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
++ *     NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ *     CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + */
 +
 +#include <linux/delay.h>
@@ -1739,8 +1757,8 @@
 +	return ath5k_hw_txpower(hal, channel, power);
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/ath5k.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/ath5k.h	2007-10-03 15:08:01.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/ath5k.h	2007-09-27 19:26:44.000000000 -0400
 @@ -0,0 +1,1086 @@
 +/*
 + * Copyright (c) 2004-2007 Reyk Floeter <reyk at openbsd.org>
@@ -2829,19 +2847,18 @@
 +
 +#endif
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/Makefile
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/Makefile	2007-10-03 15:08:01.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/Makefile	2007-09-27 19:26:44.000000000 -0400
 @@ -0,0 +1,2 @@
 +ath5k-objs		= base.o hw.o regdom.o initvals.o phy.o
 +obj-$(CONFIG_ATH5K)	+= ath5k.o
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/reg.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/reg.h	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,1978 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/reg.h	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,1977 @@
 +/*
 + * Copyright (c) 2007 Nick Kossifidis <mickflemm at gmail.com>
 + * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
-+ * Copyright (c) 2007 Michael Taylor <mike.taylor at apprion.com>
 + *
 + * Permission to use, copy, modify, and distribute this software for any
 + * purpose with or without fee is hereby granted, provided that the above
@@ -4817,8 +4834,8 @@
 +#define	AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S	18
 +#define	AR5K_PHY_GAIN_2GHZ_INI_5111	0x6480416c
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.h	2007-10-03 15:08:01.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.h	2007-09-27 19:26:44.000000000 -0400
 @@ -0,0 +1,500 @@
 +/*
 + * Copyright (c) 2004, 2005 Reyk Floeter <reyk at openbsd.org>
@@ -5321,15 +5338,12 @@
 +
 +#endif
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.c	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,4322 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.c	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,4319 @@
 + /*
 + * Copyright (c) 2004-2007 Reyk Floeter <reyk at openbsd.org>
 + * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
-+ * Copyright (c) 2007 Matthew W. S. Bell  <mentor at madwifi.org>
-+ * Copyright (c) 2007 Luis Rodriguez <mcgrof at winlab.rutgers.edu>
-+ * Copyright (c) 2007 Pavel Roskin <proski at gnu.org>
 + * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
 + *
 + * Permission to use, copy, modify, and distribute this software for any
@@ -9647,14 +9661,12 @@
 +	return -EIO;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.h	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,588 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.h	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,586 @@
 +/*
 + * Copyright (c) 2004-2007 Reyk Floeter <reyk at openbsd.org>
 + * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
-+ * Copyright (c) 2007 Matthew W. S. Bell  <mentor at madwifi.org>
-+ * Copyright (c) 2007 Luis Rodriguez <mcgrof at winlab.rutgers.edu>
 + *
 + * Permission to use, copy, modify, and distribute this software for any
 + * purpose with or without fee is hereby granted, provided that the above
@@ -10239,27 +10251,46 @@
 +	return retval;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/initvals.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/initvals.c	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,1102 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/initvals.c	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,1121 @@
 +/*
 + * Initial register settings functions
 + *
-+ * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
-+ * Copyright (c) 2006, 2007 Nick Kossifidis <mickflemm at gmail.com>
-+ * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
-+ *
-+ * Permission to use, copy, modify, and distribute this software for any
-+ * purpose with or without fee is hereby granted, provided that the above
-+ * copyright notice and this permission notice appear in all copies.
++ * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
 + *
-+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *  This file is free software: you can copy, redistribute and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation, either version 2 of the License, or (at
++ *  your option) any later version.
++ *
++ *  This file is distributed in the hope that it will be useful, but
++ *  WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *  General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
++ *
++ * This file incorporates work covered by the following copyright and
++ * permission notice:
++ *
++ *     Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
++ *     Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
++ *
++ *     Permission to use, copy, modify, and distribute this software for
++ *     any purpose with or without fee is hereby granted, provided that
++ *     the above copyright notice and this permission notice appear in all
++ *     copies.
++ *
++ *     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
++ *     WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
++ *     WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
++ *     AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
++ *     CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
++ *     OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
++ *     NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ *     CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + *
 + */
 +
@@ -11345,15 +11376,14 @@
 +	return 0;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.c	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,2579 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.c	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,2543 @@
 +/*-
 + * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
 + * Copyright (c) 2004-2005 Atheros Communications, Inc.
 + * Copyright (c) 2006 Devicescape Software, Inc.
 + * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
-+ * Copyright (c) 2007 Luis R. Rodriguez <mcgrof at winlab.rutgers.edu>
 + *
 + * All rights reserved.
 + *
@@ -11375,19 +11405,6 @@
 + * GNU General Public License ("GPL") version 2 as published by the Free
 + * Software Foundation.
 + *
-+ * NO WARRANTY
-+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
-+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
-+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-+ * THE POSSIBILITY OF SUCH DAMAGES.
-+ *
 + */
 +#define	ATH_PCI_VERSION	"0.9.5.0-BSD"
 +
@@ -12070,13 +12087,61 @@
 +#undef TSF_TO_TU
 +}
 +
++/*
++ * Calculate the receive filter according to the
++ * operating mode and state:
++ *
++ * o always accept unicast, broadcast, and multicast traffic
++ * o maintain current state of phy error reception (the hal
++ *   may enable phy error frames for noise immunity work)
++ * o probe request frames are accepted only when operating in
++ *   hostap, adhoc, or monitor modes
++ * o enable promiscuous mode according to the interface state
++ * o accept beacons:
++ *   - when operating in adhoc mode so the 802.11 layer creates
++ *     node table entries for peers,
++ *   - when operating in station mode for collecting rssi data when
++ *     the station is otherwise quiet, or
++ *   - when scanning
++ * o accept any additional packets specified by sc_rxfilter
++ */
++static u32 ath_calcrxfilter(struct ath_softc *sc)
++{
++	struct ath_hw *ah = sc->ah;
++	unsigned int opmode = sc->opmode;
++	u32 rfilt;
++
++	rfilt = (ath5k_hw_get_rx_filter(ah) & AR5K_RX_FILTER_PHYERR) |
++		AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST |
++		AR5K_RX_FILTER_MCAST | AR5K_RX_FILTER_RADARERR;
++
++	if (opmode == IEEE80211_IF_TYPE_MNTR)
++		rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON |
++			AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM;
++	if (opmode != IEEE80211_IF_TYPE_STA)
++		rfilt |= AR5K_RX_FILTER_PROBEREQ;
++	if (opmode != IEEE80211_IF_TYPE_AP && test_bit(ATH_STAT_PROMISC,
++				sc->status))
++		rfilt |= AR5K_RX_FILTER_PROM;
++	if (opmode == IEEE80211_IF_TYPE_STA || opmode == IEEE80211_IF_TYPE_IBSS) {
++		rfilt |= AR5K_RX_FILTER_BEACON;
++		/* Note: AR5212 requires AR5K_RX_FILTER_PROM to receive broadcasts,
++		 * perhaps the flags are off, for now to be safe we'll enable it for
++		 * STA and ADHOC until we have this properly mapped */
++		if (ah->ah_version == AR5K_AR5212)
++			rfilt |= AR5K_RX_FILTER_PROM;
++	}
++
++	return rfilt;
++}
++
 +static void ath_mode_init(struct ath_softc *sc)
 +{
 +	struct ath_hw *ah = sc->ah;
 +	u32 rfilt;
 +
 +	/* configure rx filter */
-+	rfilt = sc->filter_flags;
++	rfilt = ath_calcrxfilter(sc);
 +	ath5k_hw_set_rx_filter(ah, rfilt);
 +
 +	if (ath5k_hw_hasbssidmask(ah))
@@ -12650,14 +12715,14 @@
 +	return ret;
 +}
 +
-+static int ath_start(struct ieee80211_hw *hw)
++static int ath_open(struct ieee80211_hw *hw)
 +{
 +	return ath_init(hw->priv);
 +}
 +
-+void ath_stop(struct ieee80211_hw *hw)
++static int ath_stop(struct ieee80211_hw *hw)
 +{
-+	ath_stop_hw(hw->priv);
++	return ath_stop_hw(hw->priv);
 +}
 +
 +static int ath_add_interface(struct ieee80211_hw *hw,
@@ -12720,9 +12785,6 @@
 +	struct ath_softc *sc = hw->priv;
 +	int ret;
 +
-+	/* Set to a reasonable value. Note that this will
-+	 * be set to mac80211's value at ath_config(). */
-+	sc->bintval = 1000 * 1000 / 1024;
 +	mutex_lock(&sc->lock);
 +	if (sc->iface_id != if_id) {
 +		ret = -EIO;
@@ -12738,93 +12800,24 @@
 +	return ret;
 +}
 +
-+#define SUPPORTED_FIF_FLAGS \
-+	FIF_PROMISC_IN_BSS |  FIF_ALLMULTI | FIF_FCSFAIL | \
-+	FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \
-+	FIF_BCN_PRBRESP_PROMISC
-+/*
-+ * o always accept unicast, broadcast, and multicast traffic
-+ * o maintain current state of phy error reception (the hal
-+ *   may enable phy error frames for noise immunity work)
-+ * o probe request frames are accepted only when operating in
-+ *   hostap, adhoc, or monitor modes
-+ * o enable promiscuous mode according to the interface state
-+ * o accept beacons:
-+ *   - when operating in adhoc mode so the 802.11 layer creates
-+ *     node table entries for peers,
-+ *   - when operating in station mode for collecting rssi data when
-+ *     the station is otherwise quiet, or
-+ *   - when scanning
-+ */
-+static void ath_configure_filter(struct ieee80211_hw *hw,
-+               unsigned int changed_flags,
-+               unsigned int *new_flags,
-+               int mc_count, struct dev_mc_list *mclist)
++static void ath_set_multicast_list(struct ieee80211_hw *hw,
++		unsigned short flags, int mc_count)
 +{
 +	struct ath_softc *sc = hw->priv;
-+	struct ath_hw *ah = sc->ah;
++	unsigned int prom = !!(flags & IFF_PROMISC);
 +	u32 rfilt;
 +
-+	/* Only deal with supported flags */
-+	changed_flags &= SUPPORTED_FIF_FLAGS;
-+	*new_flags &= SUPPORTED_FIF_FLAGS;
-+
-+	/* XXX: Start by enabling broadcasts and Unicast, move this later
-+	 * to mac802111 and add a flag for these */
-+	rfilt = AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST;
-+
-+	if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
-+		if (*new_flags & FIF_PROMISC_IN_BSS) {
-+			rfilt |= AR5K_RX_FILTER_PROM;
++	if (test_bit(ATH_STAT_PROMISC, sc->status) != prom) {
++		if (prom)
 +			__set_bit(ATH_STAT_PROMISC, sc->status);
-+		}
 +		else
 +			__clear_bit(ATH_STAT_PROMISC, sc->status);
++		rfilt = ath_calcrxfilter(sc);
++		ath5k_hw_set_rx_filter(sc->ah, rfilt);
 +	}
-+
-+	if (*new_flags & FIF_ALLMULTI)
-+		rfilt |= AR5K_RX_FILTER_MCAST;
-+	/* This is the best we can do */
-+	if (*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL))
-+		rfilt |= AR5K_RX_FILTER_PHYERR;
-+	/* FIF_BCN_PRBRESP_PROMISC really means to enable beacons
-+	* and probes for any BSSID, this needs testing */
-+	if (*new_flags & FIF_BCN_PRBRESP_PROMISC)
-+		rfilt |= AR5K_RX_FILTER_BEACON | AR5K_RX_FILTER_PROBEREQ;
-+	/* FIF_CONTROL doc says that FIF_PROMISC_IN_BSS is not set we should
-+	* only pass on control frames for this station. This needs testing.
-+	* I believe right now this enables *all* control frames */
-+	if (*new_flags & FIF_CONTROL)
-+		rfilt |= AR5K_RX_FILTER_CONTROL;
-+
-+	/* Additional settings per mode -- this is per ath5k */
-+
-+	/* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
-+
-+	if (sc->opmode == IEEE80211_IF_TYPE_MNTR)
-+		rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON |
-+			AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM;
-+	if (sc->opmode != IEEE80211_IF_TYPE_STA)
-+		rfilt |= AR5K_RX_FILTER_PROBEREQ;
-+	if (sc->opmode != IEEE80211_IF_TYPE_AP &&
-+		test_bit(ATH_STAT_PROMISC, sc->status))
-+		rfilt |= AR5K_RX_FILTER_PROM;
-+	if (sc->opmode == IEEE80211_IF_TYPE_STA ||
-+		sc->opmode == IEEE80211_IF_TYPE_IBSS) {
-+		rfilt |= AR5K_RX_FILTER_BEACON;
-+		/* Note: AR5212 requires AR5K_RX_FILTER_PROM to receive broadcasts,
-+		 * perhaps the flags are off, for now to be safe we'll enable it for
-+		 * STA and ADHOC until we have this properly mapped */
-+		if (ah->ah_version == AR5K_AR5212)
-+			rfilt |= AR5K_RX_FILTER_PROM;
-+	}
-+
-+	/* Set the cached hw filter flags, this will alter actually
-+	 * be set in HW */
-+	sc->filter_flags = rfilt;
 +}
 +
-+static int ath_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
++static int ath_set_key(struct ieee80211_hw *hw, set_key_cmd cmd,
 +		const u8 *local_addr, const u8 *addr,
 +		struct ieee80211_key_conf *key)
 +{
@@ -12837,6 +12830,8 @@
 +	case ALG_TKIP:
 +	case ALG_CCMP:
 +		return -EOPNOTSUPP;
++	case ALG_NONE:
++		break;
 +	default:
 +		WARN_ON(1);
 +		return -EINVAL;
@@ -12930,13 +12925,13 @@
 +
 +static struct ieee80211_ops ath_hw_ops = {
 +	.tx = ath_tx,
-+	.start = ath_start,
++	.open = ath_open,
 +	.stop = ath_stop,
 +	.add_interface = ath_add_interface,
 +	.remove_interface = ath_remove_interface,
 +	.config = ath_config,
 +	.config_interface = ath_config_interface,
-+	.configure_filter = ath_configure_filter,
++	.set_multicast_list = ath_set_multicast_list,
 +	.set_key = ath_set_key,
 +	.get_stats = ath_get_stats,
 +	.conf_tx = NULL,
@@ -13928,9 +13923,9 @@
 +MODULE_LICENSE("Dual BSD/GPL");
 +MODULE_VERSION(ATH_PCI_VERSION " (EXPERIMENTAL)");
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.h	2007-10-03 15:08:01.000000000 -0400
-@@ -0,0 +1,207 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.h	2007-09-27 19:26:44.000000000 -0400
+@@ -0,0 +1,204 @@
 +/*-
 + * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
 + * All rights reserved.
@@ -13966,6 +13961,7 @@
 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 + * THE POSSIBILITY OF SUCH DAMAGES.
 + *
++ * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.20 2005/01/24 20:31:24 sam Exp $
 + */
 +
 +/*
@@ -14049,9 +14045,6 @@
 +#define ATH_CHAN_MAX	(14+14+14+252+20)	/* XXX what's the max? */
 +#endif
 +
-+
-+/* Software Carrier, keeps track of the driver state
-+ * associated with an instance of a device */
 +struct ath_softc {
 +	struct pci_dev		*pdev;		/* for dma mapping */
 +	void __iomem		*iobase;	/* address of the device */
@@ -14081,7 +14074,6 @@
 +#define ATH_STAT_LEDENDBLINK	4		/* finish LED blink operation */
 +#define ATH_STAT_LEDSOFT	5		/* enable LED gpio status */
 +
-+	unsigned int		filter_flags;	/* HW flags, AR5K_RX_FILTER_* */
 +	unsigned int		curmode;	/* current phy mode */
 +	struct ieee80211_channel *curchan;	/* current h/w channel */
 +
@@ -14139,8 +14131,8 @@
 +
 +#endif
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.c	2007-10-03 15:08:01.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.c	2007-09-27 19:26:44.000000000 -0400
 @@ -0,0 +1,121 @@
 +/*
 + * Copyright (c) 2004, 2005 Reyk Floeter <reyk at vantronix.net>

linux-2.6-mac80211-extras.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.3 linux-2.6-mac80211-extras.patch
Index: linux-2.6-mac80211-extras.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-mac80211-extras.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- linux-2.6-mac80211-extras.patch	3 Oct 2007 20:24:46 -0000	1.2
+++ linux-2.6-mac80211-extras.patch	5 Oct 2007 15:17:09 -0000	1.3
@@ -1,7 +1,7 @@
 diff -up linux-2.6.22.noarch/include/linux/ieee80211.h.orig linux-2.6.22.noarch/include/linux/ieee80211.h
---- linux-2.6.22.noarch/include/linux/ieee80211.h.orig	2007-10-03 15:50:57.000000000 -0400
-+++ linux-2.6.22.noarch/include/linux/ieee80211.h	2007-10-03 15:52:49.000000000 -0400
-@@ -107,6 +107,75 @@ struct ieee80211_hdr {
+--- linux-2.6.22.noarch/include/linux/ieee80211.h.orig	2007-09-26 20:24:17.000000000 -0400
++++ linux-2.6.22.noarch/include/linux/ieee80211.h	2007-09-26 20:24:22.000000000 -0400
+@@ -106,6 +106,75 @@ struct ieee80211_hdr {
  } __attribute__ ((packed));
  
  
@@ -77,7 +77,7 @@
  struct ieee80211_mgmt {
  	__le16 frame_control;
  	__le16 duration;
-@@ -174,9 +243,51 @@ struct ieee80211_mgmt {
+@@ -173,9 +242,51 @@ struct ieee80211_mgmt {
  				struct {
  					u8 action_code;
  					u8 dialog_token;
@@ -129,7 +129,7 @@
  				struct{
  					u8 action_code;
  					u8 element_id;
-@@ -185,6 +296,25 @@ struct ieee80211_mgmt {
+@@ -184,6 +295,25 @@ struct ieee80211_mgmt {
  					u8 new_chan;
  					u8 switch_count;
  				} __attribute__((packed)) chan_switch;
@@ -155,7 +155,7 @@
  			} u;
  		} __attribute__ ((packed)) action;
  	} u;
-@@ -271,6 +401,18 @@ enum ieee80211_statuscode {
+@@ -270,6 +400,18 @@ enum ieee80211_statuscode {
  	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
  	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
  	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
@@ -174,7 +174,7 @@
  };
  
  
-@@ -301,9 +443,50 @@ enum ieee80211_reasoncode {
+@@ -300,9 +442,50 @@ enum ieee80211_reasoncode {
  	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
  	WLAN_REASON_IEEE8021X_FAILED = 23,
  	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
@@ -225,7 +225,7 @@
  /* Information Element IDs */
  enum ieee80211_eid {
  	WLAN_EID_SSID = 0,
-@@ -319,6 +502,15 @@ enum ieee80211_eid {
+@@ -318,6 +501,15 @@ enum ieee80211_eid {
  	WLAN_EID_HP_PARAMS = 8,
  	WLAN_EID_HP_TABLE = 9,
  	WLAN_EID_REQUEST = 10,
@@ -241,7 +241,7 @@
  	/* 802.11h */
  	WLAN_EID_PWR_CONSTRAINT = 32,
  	WLAN_EID_PWR_CAPABILITY = 33,
-@@ -333,6 +525,9 @@ enum ieee80211_eid {
+@@ -332,6 +524,9 @@ enum ieee80211_eid {
  	/* 802.11g */
  	WLAN_EID_ERP_INFO = 42,
  	WLAN_EID_EXT_SUPP_RATES = 50,
@@ -251,7 +251,7 @@
  	/* 802.11i */
  	WLAN_EID_RSN = 48,
  	WLAN_EID_WPA = 221,
-@@ -341,6 +536,9 @@ enum ieee80211_eid {
+@@ -340,6 +535,9 @@ enum ieee80211_eid {
  	WLAN_EID_QOS_PARAMETER = 222
  };
  
@@ -261,9 +261,9 @@
  /* cipher suite selectors */
  #define WLAN_CIPHER_SUITE_USE_GROUP	0x000FAC00
  #define WLAN_CIPHER_SUITE_WEP40		0x000FAC01
-@@ -411,4 +609,37 @@ static inline int ieee80211_get_morefrag
- 		IEEE80211_FCTL_MOREFRAGS) != 0;
- }
+@@ -350,4 +548,37 @@ enum ieee80211_eid {
+ 
+ #define WLAN_MAX_KEY_LEN		32
  
 +enum ieee80211_tsinfo_direction {
 +	WLAN_TSINFO_UPLINK = 0,
@@ -300,111 +300,67 @@
 +
  #endif /* IEEE80211_H */
 diff -up linux-2.6.22.noarch/include/net/mac80211.h.orig linux-2.6.22.noarch/include/net/mac80211.h
---- linux-2.6.22.noarch/include/net/mac80211.h.orig	2007-10-03 15:50:57.000000000 -0400
-+++ linux-2.6.22.noarch/include/net/mac80211.h	2007-10-03 15:52:49.000000000 -0400
-@@ -472,6 +472,7 @@ struct ieee80211_conf {
- enum ieee80211_if_types {
- 	IEEE80211_IF_TYPE_INVALID,
- 	IEEE80211_IF_TYPE_AP,
-+	IEEE80211_IF_TYPE_MGMT,
- 	IEEE80211_IF_TYPE_STA,
- 	IEEE80211_IF_TYPE_IBSS,
- 	IEEE80211_IF_TYPE_MNTR,
-@@ -521,6 +522,11 @@ struct ieee80211_if_init_conf {
-  *	config_interface() call, so copy the value somewhere if you need
-  *	it.
-  * @ssid_len: length of the @ssid field.
-+ * @generic_elem: used (together with @generic_elem_len) by drivers for
-+ *	hardware that generate beacons independently. The pointer is valid
-+ *	only during the config_interface() call, so copy the value somewhere
-+ *	if you need it.
-+ * @generic_elem_len: length of the generic element.
-  * @beacon: beacon template. Valid only if @host_gen_beacon_template in
-  *	&struct ieee80211_hw is set. The driver is responsible of freeing
-  *	the sk_buff.
-@@ -535,6 +541,8 @@ struct ieee80211_if_conf {
- 	u8 *bssid;
- 	u8 *ssid;
- 	size_t ssid_len;
-+	u8 *generic_elem;
-+	size_t generic_elem_len;
- 	struct sk_buff *beacon;
- 	struct ieee80211_tx_control *beacon_control;
- };
-@@ -662,12 +670,16 @@ enum sta_notify_cmd {
-  * @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED:
-  *	Channels are already configured to the default regulatory domain
-  *	specified in the device's EEPROM
-+ *
-+ * @IEEE80211_HW_SUPPORT_HT_MODE
-+ *	The device capable of supporting 802.11n.
-  */
- enum ieee80211_hw_flags {
- 	IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE		= 1<<0,
- 	IEEE80211_HW_RX_INCLUDES_FCS			= 1<<1,
- 	IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING	= 1<<2,
- 	IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED	= 1<<3,
-+	IEEE80211_HW_SUPPORT_HT_MODE			= 1<<4,
- };
- 
- /**
-@@ -994,6 +1006,12 @@ enum ieee80211_erp_change_flags {
-  *	function is optional if the firmware/hardware takes full care of
-  *	TSF synchronization.
-  *
-+ * @handle_ba_action: Call low level driver with 11n Block Ack action.
-+ *
-+ * @conf_ht: Configure ht parameters.
-+ *
-+ * @get_ht_capab: Get ht capabilities from the device.
-+ *
-  * @beacon_update: Setup beacon data for IBSS beacons. Unlike access point,
-  *	IBSS uses a fixed beacon frame which is configured using this
-  *	function.
-@@ -1054,6 +1072,15 @@ struct ieee80211_ops {
+--- linux-2.6.22.noarch/include/net/mac80211.h.orig	2007-09-26 20:24:17.000000000 -0400
++++ linux-2.6.22.noarch/include/net/mac80211.h	2007-09-26 20:24:22.000000000 -0400
+@@ -665,6 +665,9 @@ struct ieee80211_hw {
+ 	 * specified in the device's EEPROM */
+ #define IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED (1<<11)
+ 
++	/* The device capable of supporting 11n */
++#define IEEE80211_HW_SUPPORT_HT_MODE (1<<15)
++
+ 	u32 flags;			/* hardware flags defined above */
+ 
+ 	/* Set to the size of a needed device specific skb headroom for TX skbs. */
+@@ -810,8 +813,7 @@ struct ieee80211_ops {
+ 	 * used if the wlan hardware or low-level driver implements PAE.
+ 	 * 80211.o module will anyway filter frames based on authorization
+ 	 * state, so this function pointer can be NULL if low-level driver does
+-	 * not require event notification about port state changes.
+-	 * Currently unused. */
++	 * not require event notification about port state changes. */
+ 	int (*set_port_auth)(struct ieee80211_hw *hw, u8 *addr,
+ 			     int authorized);
+ 
+@@ -871,8 +873,9 @@ struct ieee80211_ops {
+ 	/* Get statistics of the current TX queue status. This is used to get
+ 	 * number of currently queued packets (queue length), maximum queue
+ 	 * size (limit), and total number of packets sent using each TX queue
+-	 * (count).
+-	 * Currently unused. */
++	 * (count). This information is used for WMM to find out which TX
++	 * queues have room for more packets and by hostapd to provide
++	 * statistics about the current queueing state to external programs. */
+ 	int (*get_tx_stats)(struct ieee80211_hw *hw,
  			    struct ieee80211_tx_queue_stats *stats);
- 	u64 (*get_tsf)(struct ieee80211_hw *hw);
+ 
+@@ -888,6 +891,22 @@ struct ieee80211_ops {
+ 	 * TSF synchronization. */
  	void (*reset_tsf)(struct ieee80211_hw *hw);
+ 
[...1718 lines suppressed...]
- }
- 
- static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
--			struct ieee80211_tx_control *control)
-+			struct ieee80211_tx_control *control, int mgmt)
- {
- 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
- 	struct sta_info *sta;
-@@ -1107,6 +1109,7 @@ static int ieee80211_tx(struct net_devic
- 	rcu_read_lock();
- 
- 	sta = tx.sta;
-+	tx.u.tx.mgmt_interface = mgmt;
- 	tx.u.tx.mode = local->hw.conf.mode;
- 
- 	for (handler = local->tx_handlers; *handler != NULL;
-@@ -1253,7 +1256,8 @@ int ieee80211_master_start_xmit(struct s
- 		control.flags |= IEEE80211_TXCTL_REQUEUE;
- 	control.queue = pkt_data->queue;
- 
--	ret = ieee80211_tx(odev, skb, &control);
-+	ret = ieee80211_tx(odev, skb, &control,
-+			   control.type == IEEE80211_IF_TYPE_MGMT);
- 	dev_put(odev);
- 
- 	return ret;
-@@ -1381,11 +1385,18 @@ int ieee80211_subif_start_xmit(struct sk
+--- linux-2.6.22.noarch/net/mac80211/tx.c.orig	2007-09-26 20:24:17.000000000 -0400
++++ linux-2.6.22.noarch/net/mac80211/tx.c	2007-09-26 20:24:22.000000000 -0400
+@@ -1402,11 +1402,18 @@ int ieee80211_subif_start_xmit(struct sk
  		hdrlen = 30;
  		break;
  	case IEEE80211_IF_TYPE_STA:
@@ -4347,27 +3422,9 @@
  		hdrlen = 24;
  		break;
  	case IEEE80211_IF_TYPE_IBSS:
-@@ -1498,6 +1509,8 @@ int ieee80211_subif_start_xmit(struct sk
- 	pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
- 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
- 	pkt_data->ifindex = dev->ifindex;
-+	if (sdata->type == IEEE80211_IF_TYPE_MGMT)
-+		pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
- 
- 	skb->dev = local->mdev;
- 	dev->stats.tx_packets++;
-@@ -1555,6 +1568,8 @@ int ieee80211_mgmt_start_xmit(struct sk_
- 	pkt_data = (struct ieee80211_tx_packet_data *) skb->cb;
- 	memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data));
- 	pkt_data->ifindex = sdata->dev->ifindex;
-+	if (sdata->type == IEEE80211_IF_TYPE_MGMT)
-+		pkt_data->flags |= IEEE80211_TXPD_MGMT_IFACE;
- 
- 	skb->priority = 20; /* use hardcoded priority for mgmt TX queue */
- 	skb->dev = sdata->local->mdev;
 diff -up linux-2.6.22.noarch/net/mac80211/sta_info.c.orig linux-2.6.22.noarch/net/mac80211/sta_info.c
---- linux-2.6.22.noarch/net/mac80211/sta_info.c.orig	2007-10-03 15:50:57.000000000 -0400
-+++ linux-2.6.22.noarch/net/mac80211/sta_info.c	2007-10-03 15:52:52.000000000 -0400
+--- linux-2.6.22.noarch/net/mac80211/sta_info.c.orig	2007-09-26 20:24:17.000000000 -0400
++++ linux-2.6.22.noarch/net/mac80211/sta_info.c	2007-09-26 20:24:22.000000000 -0400
 @@ -32,7 +32,7 @@ static void sta_info_hash_add(struct iee
  
  /* Caller must hold local->sta_lock */
@@ -4434,9 +3491,9 @@
  
  	list_del(&sta->list);
 diff -up linux-2.6.22.noarch/net/mac80211/debugfs_netdev.c.orig linux-2.6.22.noarch/net/mac80211/debugfs_netdev.c
---- linux-2.6.22.noarch/net/mac80211/debugfs_netdev.c.orig	2007-10-03 15:50:57.000000000 -0400
-+++ linux-2.6.22.noarch/net/mac80211/debugfs_netdev.c	2007-10-03 15:52:52.000000000 -0400
-@@ -87,6 +87,268 @@ static const struct file_operations name
+--- linux-2.6.22.noarch/net/mac80211/debugfs_netdev.c.orig	2007-09-26 20:24:17.000000000 -0400
++++ linux-2.6.22.noarch/net/mac80211/debugfs_netdev.c	2007-09-26 20:24:22.000000000 -0400
+@@ -87,6 +87,267 @@ static const struct file_operations name
  		IEEE80211_IF_FMT_##format(name, field)			\
  		__IEEE80211_IF_FILE(name)
  
@@ -4475,9 +3532,8 @@
 +static ssize_t qos_if_dls_mac(const struct ieee80211_sub_if_data *sdata,
 +			      char *buf, int buflen)
 +{
-+	DECLARE_MAC_BUF(mac);
-+	return scnprintf(buf, buflen, "%s\n",
-+			 print_mac(mac, sdata->u.sta.dls_mac));
++	return scnprintf(buf, buflen, MAC_FMT "\n",
++			 MAC_ARG(sdata->u.sta.dls_mac));
 +}
 +
 +static ssize_t qos_dls_mac_read(struct file *file,
@@ -4705,7 +3761,7 @@
  /* common attributes */
  IEEE80211_IF_FILE(channel_use, channel_use, DEC);
  IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
-@@ -167,6 +429,10 @@ IEEE80211_IF_FILE(peer, u.wds.remote_add
+@@ -184,6 +445,10 @@ __IEEE80211_IF_FILE(mode);
  
  static void add_sta_files(struct ieee80211_sub_if_data *sdata)
  {
@@ -4716,7 +3772,7 @@
  	DEBUGFS_ADD(channel_use, sta);
  	DEBUGFS_ADD(drop_unencrypted, sta);
  	DEBUGFS_ADD(eapol, sta);
-@@ -185,6 +451,42 @@ static void add_sta_files(struct ieee802
+@@ -202,6 +467,42 @@ static void add_sta_files(struct ieee802
  	DEBUGFS_ADD(auth_alg, sta);
  	DEBUGFS_ADD(auth_transaction, sta);
  	DEBUGFS_ADD(flags, sta);
@@ -4759,7 +3815,7 @@
  }
  
  static void add_ap_files(struct ieee80211_sub_if_data *sdata)
-@@ -278,6 +580,40 @@ static void del_sta_files(struct ieee802
+@@ -297,6 +598,40 @@ static void del_sta_files(struct ieee802
  	DEBUGFS_DEL(auth_alg, sta);
  	DEBUGFS_DEL(auth_transaction, sta);
  	DEBUGFS_DEL(flags, sta);
@@ -4801,8 +3857,8 @@
  
  static void del_ap_files(struct ieee80211_sub_if_data *sdata)
 diff -up linux-2.6.22.noarch/net/mac80211/wpa.c.orig linux-2.6.22.noarch/net/mac80211/wpa.c
---- linux-2.6.22.noarch/net/mac80211/wpa.c.orig	2007-10-03 15:50:57.000000000 -0400
-+++ linux-2.6.22.noarch/net/mac80211/wpa.c	2007-10-03 15:56:26.000000000 -0400
+--- linux-2.6.22.noarch/net/mac80211/wpa.c.orig	2007-09-26 20:24:17.000000000 -0400
++++ linux-2.6.22.noarch/net/mac80211/wpa.c	2007-09-26 20:24:22.000000000 -0400
 @@ -18,6 +18,10 @@
  #include "tkip.h"
  #include "aes_ccm.h"
@@ -4907,7 +3963,7 @@
  
  		mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx,
  						(void *) skb->data);
-@@ -212,12 +275,30 @@ static int tkip_encrypt_skb(struct ieee8
+@@ -208,12 +271,30 @@ static int tkip_encrypt_skb(struct ieee8
  	memmove(pos, pos + TKIP_IV_LEN, hdrlen);
  	pos += hdrlen;
  
@@ -4939,7 +3995,7 @@
  		hdr = (struct ieee80211_hdr *)skb->data;
  
  		/* hwaccel - with preallocated room for IV */
-@@ -258,6 +339,37 @@ ieee80211_crypto_tkip_encrypt(struct iee
+@@ -255,6 +336,37 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8
  	tx->u.tx.control->iv_len = TKIP_IV_LEN;
  	ieee80211_tx_set_iswep(tx);
  
@@ -4977,7 +4033,7 @@
  	if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
  	    !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  	    !wpa_test) {
-@@ -271,6 +383,10 @@ ieee80211_crypto_tkip_encrypt(struct iee
+@@ -268,6 +380,10 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8
  
  	if (tx->u.tx.extra_frag) {
  		int i;
@@ -4988,7 +4044,7 @@
  		for (i = 0; i < tx->u.tx.num_extra_frag; i++) {
  			if (tkip_encrypt_skb(tx, tx->u.tx.extra_frag[i], test)
  			    < 0)
-@@ -278,6 +394,23 @@ ieee80211_crypto_tkip_encrypt(struct iee
+@@ -275,6 +391,23 @@ ieee80211_tx_h_tkip_encrypt(struct ieee8
  		}
  	}
  
@@ -5012,7 +4068,7 @@
  	return TXRX_CONTINUE;
  }
  
-@@ -300,6 +433,17 @@ ieee80211_crypto_tkip_decrypt(struct iee
+@@ -299,6 +432,17 @@ ieee80211_rx_h_tkip_decrypt(struct ieee8
  	if (!rx->sta || skb->len - hdrlen < 12)
  		return TXRX_DROP;
  
@@ -5030,7 +4086,7 @@
  	if (rx->u.rx.status->flag & RX_FLAG_DECRYPTED) {
  		if (rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) {
  			/*
-@@ -470,12 +614,26 @@ static int ccmp_encrypt_skb(struct ieee8
+@@ -467,12 +611,26 @@ static int ccmp_encrypt_skb(struct ieee8
  	/* PN = PN + 1 */
  	pn = key->u.ccmp.tx_pn;
  
@@ -5057,8 +4113,8 @@
  	ccmp_pn2hdr(pos, pn, key->conf.keyidx);
  
  	if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
-@@ -506,6 +664,27 @@ ieee80211_crypto_ccmp_encrypt(struct iee
- 	if (!WLAN_FC_DATA_PRESENT(fc))
+@@ -504,6 +662,27 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8
+ 	if (!key || key->conf.alg != ALG_CCMP || !WLAN_FC_DATA_PRESENT(fc))
  		return TXRX_CONTINUE;
  
 +#ifdef CONFIG_HOSTAPD_WPA_TESTING
@@ -5085,7 +4141,7 @@
  	tx->u.tx.control->icv_len = CCMP_MIC_LEN;
  	tx->u.tx.control->iv_len = CCMP_HDR_LEN;
  	ieee80211_tx_set_iswep(tx);
-@@ -523,6 +702,10 @@ ieee80211_crypto_ccmp_encrypt(struct iee
+@@ -521,6 +700,10 @@ ieee80211_tx_h_ccmp_encrypt(struct ieee8
  
  	if (tx->u.tx.extra_frag) {
  		int i;

linux-2.6-wireless-pending.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.8 -r 1.9 linux-2.6-wireless-pending.patch
Index: linux-2.6-wireless-pending.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-wireless-pending.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-wireless-pending.patch	3 Oct 2007 20:24:46 -0000	1.8
+++ linux-2.6-wireless-pending.patch	5 Oct 2007 15:17:09 -0000	1.9
@@ -1,6 +1,6 @@
 diff -up linux-2.6.22.noarch/CREDITS.orig linux-2.6.22.noarch/CREDITS
---- linux-2.6.22.noarch/CREDITS.orig	2007-10-03 15:46:40.000000000 -0400
-+++ linux-2.6.22.noarch/CREDITS	2007-10-03 15:46:59.000000000 -0400
+--- linux-2.6.22.noarch/CREDITS.orig	2007-09-26 19:41:26.000000000 -0400
++++ linux-2.6.22.noarch/CREDITS	2007-09-26 19:49:37.000000000 -0400
 @@ -665,6 +665,11 @@ D: Minor updates to SCSI types, added /p
  S: (ask for current address)
  S: USA
@@ -68,8 +68,8 @@
  E: liw at iki.fi
  D: Linux System Administrator's Guide, author, former maintainer
 diff -up linux-2.6.22.noarch/include/linux/nl80211.h.orig linux-2.6.22.noarch/include/linux/nl80211.h
---- linux-2.6.22.noarch/include/linux/nl80211.h.orig	2007-10-03 15:46:40.000000000 -0400
-+++ linux-2.6.22.noarch/include/linux/nl80211.h	2007-10-03 15:46:59.000000000 -0400
+--- linux-2.6.22.noarch/include/linux/nl80211.h.orig	2007-07-08 19:32:17.000000000 -0400
++++ linux-2.6.22.noarch/include/linux/nl80211.h	2007-09-26 19:49:38.000000000 -0400
 @@ -7,7 +7,97 @@
   */
  
@@ -192,8 +192,8 @@
  
  #endif /* __LINUX_NL80211_H */
 diff -up linux-2.6.22.noarch/include/linux/mod_devicetable.h.orig linux-2.6.22.noarch/include/linux/mod_devicetable.h
---- linux-2.6.22.noarch/include/linux/mod_devicetable.h.orig	2007-10-03 15:46:40.000000000 -0400
-+++ linux-2.6.22.noarch/include/linux/mod_devicetable.h	2007-10-03 15:46:59.000000000 -0400
+--- linux-2.6.22.noarch/include/linux/mod_devicetable.h.orig	2007-09-26 19:41:35.000000000 -0400
++++ linux-2.6.22.noarch/include/linux/mod_devicetable.h	2007-09-26 19:49:38.000000000 -0400
 @@ -340,4 +340,19 @@ struct parisc_device_id {
  #define PA_HVERSION_ANY_ID	0xffff
  #define PA_SVERSION_ANY_ID	0xffffffff
@@ -214,159 +214,9 @@
 +#define SSB_ANY_REV		0xFF
 +
  #endif /* LINUX_MOD_DEVICETABLE_H */
-diff -up linux-2.6.22.noarch/include/linux/ieee80211.h.orig linux-2.6.22.noarch/include/linux/ieee80211.h
---- linux-2.6.22.noarch/include/linux/ieee80211.h.orig	2007-10-03 15:46:40.000000000 -0400
-+++ linux-2.6.22.noarch/include/linux/ieee80211.h	2007-10-03 15:46:59.000000000 -0400
-@@ -16,6 +16,7 @@
- #define IEEE80211_H
- 
- #include <linux/types.h>
-+#include <asm/byteorder.h>
- 
- #define FCS_LEN 4
- 
-@@ -350,4 +351,64 @@ enum ieee80211_eid {
- 
- #define WLAN_MAX_KEY_LEN		32
- 
-+/**
-+ * ieee80211_get_SA - get pointer to SA
-+ *
-+ * Given an 802.11 frame, this function returns the offset
-+ * to the source address (SA). It does not verify that the
-+ * header is long enough to contain the address, and the
-+ * header must be long enough to contain the frame control
-+ * field.
-+ *
-+ * @hdr: the frame
-+ */
-+static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
-+{
-+	u8 *raw = (u8 *) hdr;
-+	u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */
-+
-+	switch (tofrom) {
-+		case 2:
-+			return hdr->addr3;
-+		case 3:
-+			return hdr->addr4;
-+	}
-+	return hdr->addr2;
-+}
-+
-+/**
-+ * ieee80211_get_DA - get pointer to DA
-+ *
-+ * Given an 802.11 frame, this function returns the offset
-+ * to the destination address (DA). It does not verify that
-+ * the header is long enough to contain the address, and the
-+ * header must be long enough to contain the frame control
-+ * field.
-+ *
-+ * @hdr: the frame
-+ */
-+static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
-+{
-+	u8 *raw = (u8 *) hdr;
-+	u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */
-+
-+	if (to_ds)
-+		return hdr->addr3;
-+	return hdr->addr1;
-+}
-+
-+/**
-+ * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
-+ *
-+ * This function determines whether the "more fragments" bit is set
-+ * in the frame.
-+ *
-+ * @hdr: the frame
-+ */
-+static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
-+{
-+	return (le16_to_cpu(hdr->frame_control) &
-+		IEEE80211_FCTL_MOREFRAGS) != 0;
-+}
-+
- #endif /* IEEE80211_H */
-diff -up linux-2.6.22.noarch/include/linux/rfkill.h.orig linux-2.6.22.noarch/include/linux/rfkill.h
---- linux-2.6.22.noarch/include/linux/rfkill.h.orig	2007-10-03 15:46:40.000000000 -0400
-+++ linux-2.6.22.noarch/include/linux/rfkill.h	2007-10-03 15:46:59.000000000 -0400
-@@ -26,12 +26,13 @@
- #include <linux/list.h>
- #include <linux/mutex.h>
- #include <linux/device.h>
-+#include <linux/leds.h>
- 
- /**
-  * enum rfkill_type - type of rfkill switch.
-- * RFKILL_TYPE_WLAN: switch is no a Wireless network devices.
-- * RFKILL_TYPE_BlUETOOTH: switch is on a bluetooth device.
-- * RFKILL_TYPE_IRDA: switch is on an infrared devices.
-+ * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
-+ * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
-+ * RFKILL_TYPE_IRDA: switch is on an infrared device.
-  */
- enum rfkill_type {
- 	RFKILL_TYPE_WLAN = 0,
-@@ -51,11 +52,14 @@ enum rfkill_state {
-  * @type: Radio type which the button controls, the value stored
-  *	here should be a value from enum rfkill_type.
-  * @state: State of the switch (on/off).
-+ * @user_claim_unsupported: Whether the hardware supports exclusive
-+ *	RF-kill control by userspace. Set this before registering.
-  * @user_claim: Set when the switch is controlled exlusively by userspace.
-  * @mutex: Guards switch state transitions
-  * @data: Pointer to the RF button drivers private data which will be
-  *	passed along when toggling radio state.
-  * @toggle_radio(): Mandatory handler to control state of the radio.
-+ * @led_trigger: A LED trigger for this button's LED.
-  * @dev: Device structure integrating the switch into device tree.
-  * @node: Used to place switch into list of all switches known to the
-  *	the system.
-@@ -67,6 +71,7 @@ struct rfkill {
- 	enum rfkill_type type;
- 
- 	enum rfkill_state state;
-+	bool user_claim_unsupported;
- 	bool user_claim;
- 
- 	struct mutex mutex;
-@@ -74,6 +79,10 @@ struct rfkill {
- 	void *data;
- 	int (*toggle_radio)(void *data, enum rfkill_state state);
- 
-+#ifdef CONFIG_RFKILL_LEDS
-+	struct led_trigger led_trigger;
-+#endif
-+
- 	struct device dev;
- 	struct list_head node;
- };
-@@ -86,4 +95,19 @@ void rfkill_unregister(struct rfkill *rf
- 
- void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state);
- 
-+/**
-+ * rfkill_get_led_name - Get the LED trigger name for the button's LED.
-+ * This function might return a NULL pointer if registering of the
-+ * LED trigger failed.
-+ * Use this as "default_trigger" for the LED.
-+ */
-+static inline char *rfkill_get_led_name(struct rfkill *rfkill)
-+{
-+#ifdef CONFIG_RFKILL_LEDS
-+	return (char *)(rfkill->led_trigger.name);
-+#else
-+	return NULL;
-+#endif
-+}
-+
- #endif /* RFKILL_H */
 diff -up /dev/null linux-2.6.22.noarch/include/linux/ssb/ssb_driver_chipcommon.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/include/linux/ssb/ssb_driver_chipcommon.h	2007-10-03 15:46:59.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/include/linux/ssb/ssb_driver_chipcommon.h	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,396 @@
 +#ifndef LINUX_SSB_CHIPCO_H_
[...17232 lines suppressed...]
---- linux-2.6.22.noarch/drivers/net/wireless/hostap/hostap.h.orig	2007-10-03 15:46:41.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/hostap/hostap.h	2007-10-03 15:47:00.000000000 -0400
-@@ -35,7 +35,7 @@ int hostap_80211_prism_header_parse(stru
- int hostap_80211_get_hdrlen(u16 fc);
- struct net_device_stats *hostap_get_stats(struct net_device *dev);
- void hostap_setup_dev(struct net_device *dev, local_info_t *local,
--		      int main_dev);
-+		      int type);
- void hostap_set_multicast_list_queue(struct work_struct *work);
- int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked);
- int hostap_set_hostapd_sta(local_info_t *local, int val, int rtnl_locked);
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/b43_pci_bridge.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/b43_pci_bridge.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/b43_pci_bridge.c	2007-09-26 19:49:59.000000000 -0400
 @@ -0,0 +1,48 @@
 +/*
 + * Broadcom 43xx PCI-SSB bridge module
@@ -129215,8 +126095,8 @@
 +	ssb_pcihost_unregister(&b43_pci_bridge_driver);
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/Makefile
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/Makefile	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/Makefile	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,18 @@
 +# core
 +ssb-y					+= main.o scan.o
@@ -129237,8 +126117,8 @@
 +
 +obj-$(CONFIG_SSB)			+= ssb.o
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/pcmcia.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/pcmcia.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/pcmcia.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,271 @@
 +/*
 + * Sonics Silicon Backplane
@@ -129512,8 +126392,8 @@
 +	return -ENODEV;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/main.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/main.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/main.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,1162 @@
 +/*
 + * Sonics Silicon Backplane
@@ -130678,8 +127558,8 @@
 +}
 +module_exit(ssb_modexit)
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/pcihost_wrapper.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/pcihost_wrapper.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/pcihost_wrapper.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,104 @@
 +/*
 + * Sonics Silicon Backplane
@@ -130786,8 +127666,8 @@
 +}
 +EXPORT_SYMBOL(ssb_pcihost_register);
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/driver_mipscore.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/driver_mipscore.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/driver_mipscore.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,223 @@
 +/*
 + * Sonics Silicon Backplane
@@ -131013,8 +127893,8 @@
 +	ssb_mips_flash_detect(mcore);
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/ssb_private.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/ssb_private.h	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/ssb_private.h	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,136 @@
 +#ifndef LINUX_SSB_PRIVATE_H_
 +#define LINUX_SSB_PRIVATE_H_
@@ -131153,8 +128033,8 @@
 +
 +#endif /* LINUX_SSB_PRIVATE_H_ */
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/pci.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/pci.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/pci.c	2007-09-26 19:49:59.000000000 -0400
 @@ -0,0 +1,740 @@
 +/*
 + * Sonics Silicon Backplane PCI-Hostbus related functions.
@@ -131897,8 +128777,8 @@
 +	return err;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/driver_chipcommon.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/driver_chipcommon.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/driver_chipcommon.c	2007-09-26 19:49:59.000000000 -0400
 @@ -0,0 +1,445 @@
 +/*
 + * Sonics Silicon Backplane
@@ -132346,8 +129226,8 @@
 +}
 +#endif /* CONFIG_SSB_SERIAL */
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/Kconfig
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/Kconfig	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/Kconfig	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,117 @@
 +menu "Sonics Silicon Backplane"
 +
@@ -132467,8 +129347,8 @@
 +
 +endmenu
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/scan.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/scan.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/scan.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,413 @@
 +/*
 + * Sonics Silicon Backplane
@@ -132884,8 +129764,8 @@
 +	goto out;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/driver_extif.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/driver_extif.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/driver_extif.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,129 @@
 +/*
 + * Sonics Silicon Backplane
@@ -133017,8 +129897,8 @@
 +}
 +
 diff -up /dev/null linux-2.6.22.noarch/drivers/ssb/driver_pcicore.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/ssb/driver_pcicore.c	2007-10-03 15:47:00.000000000 -0400
+--- /dev/null	2007-09-25 08:26:55.562976333 -0400
++++ linux-2.6.22.noarch/drivers/ssb/driver_pcicore.c	2007-09-26 19:49:38.000000000 -0400
 @@ -0,0 +1,576 @@
 +/*
 + * Sonics Silicon Backplane
@@ -133596,48 +130476,3 @@
 +	return err;
 +}
 +EXPORT_SYMBOL(ssb_pcicore_dev_irqvecs_enable);
-diff -up linux-2.6.22.noarch/Documentation/networking/mac80211-injection.txt.orig linux-2.6.22.noarch/Documentation/networking/mac80211-injection.txt
---- linux-2.6.22.noarch/Documentation/networking/mac80211-injection.txt.orig	2007-10-03 15:46:41.000000000 -0400
-+++ linux-2.6.22.noarch/Documentation/networking/mac80211-injection.txt	2007-10-03 15:47:00.000000000 -0400
-@@ -13,15 +13,35 @@ The radiotap format is discussed in
- ./Documentation/networking/radiotap-headers.txt.
- 
- Despite 13 radiotap argument types are currently defined, most only make sense
--to appear on received packets.  Currently three kinds of argument are used by
--the injection code, although it knows to skip any other arguments that are
--present (facilitating replay of captured radiotap headers directly):
-+to appear on received packets.  The following information is parsed from the
-+radiotap headers and used to control injection:
- 
-- - IEEE80211_RADIOTAP_RATE - u8 arg in 500kbps units (0x02 --> 1Mbps)
-+ * IEEE80211_RADIOTAP_RATE
- 
-- - IEEE80211_RADIOTAP_ANTENNA - u8 arg, 0x00 = ant1, 0x01 = ant2
-+   rate in 500kbps units, automatic if invalid or not present
- 
-- - IEEE80211_RADIOTAP_DBM_TX_POWER - u8 arg, dBm
-+
-+ * IEEE80211_RADIOTAP_ANTENNA
-+
-+   antenna to use, automatic if not present
-+
-+
-+ * IEEE80211_RADIOTAP_DBM_TX_POWER
-+
-+   transmit power in dBm, automatic if not present
-+
-+
-+ * IEEE80211_RADIOTAP_FLAGS
-+
-+   IEEE80211_RADIOTAP_F_FCS: FCS will be removed and recalculated
-+   IEEE80211_RADIOTAP_F_WEP: frame will be encrypted if key available
-+   IEEE80211_RADIOTAP_F_FRAG: frame will be fragmented if longer than the
-+			      current fragmentation threshold. Note that
-+			      this flag is only reliable when software
-+			      fragmentation is enabled)
-+
-+The injection code can also skip all other currently defined radiotap fields
-+facilitating replay of captured radiotap headers directly.
- 
- Here is an example valid radiotap header defining these three parameters
- 

linux-2.6-zd1211rw-mac80211.patch:

Index: linux-2.6-zd1211rw-mac80211.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-zd1211rw-mac80211.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-zd1211rw-mac80211.patch	3 Oct 2007 20:24:46 -0000	1.3
+++ linux-2.6-zd1211rw-mac80211.patch	5 Oct 2007 15:17:09 -0000	1.4
@@ -1,11 +1,11 @@
 diff -up linux-2.6.22.noarch/MAINTAINERS.orig linux-2.6.22.noarch/MAINTAINERS
---- linux-2.6.22.noarch/MAINTAINERS.orig	2007-10-03 15:13:29.000000000 -0400
-+++ linux-2.6.22.noarch/MAINTAINERS	2007-10-03 15:14:47.000000000 -0400
+--- linux-2.6.22.noarch/MAINTAINERS.orig	2007-09-27 09:59:49.000000000 -0400
++++ linux-2.6.22.noarch/MAINTAINERS	2007-09-27 09:59:55.000000000 -0400
 @@ -4287,6 +4287,16 @@ W:	http://www.qsl.net/dl1bke/
  L:	linux-hams at vger.kernel.org
  S:	Maintained
  
-+ZD1211-MAC80211 WIRELESS DRIVER
++ZD1211RW-MAC80211 WIRELESS DRIVER
 +P:	Daniel Drake
 +M:	dsd at gentoo.org
 +P:	Ulrich Kunitz
@@ -19,8 +19,8 @@
  P:	Daniel Drake
  M:	dsd at gentoo.org
 diff -up linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig linux-2.6.22.noarch/drivers/net/wireless/Makefile
---- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-10-03 15:13:29.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-10-03 15:14:47.000000000 -0400
+--- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-09-27 09:59:49.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-09-27 09:59:55.000000000 -0400
 @@ -41,6 +41,7 @@ obj-$(CONFIG_BCM43XX)		+= bcm43xx/
  obj-$(CONFIG_B43)		+= b43/
  obj-$(CONFIG_B43LEGACY)		+= b43legacy/
@@ -30,9 +30,9 @@
  # 16-bit wireless PCMCIA client drivers
  obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c	2007-10-03 15:19:03.000000000 -0400
-@@ -0,0 +1,1618 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c	2007-09-27 10:00:45.000000000 -0400
+@@ -0,0 +1,1619 @@
 +/* zd_chip.c
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -63,6 +63,7 @@
 +#include "zd_ieee80211.h"
 +#include "zd_mac.h"
 +#include "zd_rf.h"
++#include "zd_util.h"
 +
 +void zd_chip_init(struct zd_chip *chip,
 +	         struct ieee80211_hw *hw,
@@ -1652,22 +1653,22 @@
 +	return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs));
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,10 @@
 +obj-$(CONFIG_ZD1211RW_MAC80211) += zd1211rw-mac80211.o
 +
 +zd1211rw-mac80211-objs := zd_chip.o zd_mac.o \
 +		zd_rf_al2230.o zd_rf_rf2959.o \
 +		zd_rf_al7230b.o zd_rf_uw2453.o \
-+		zd_ieee80211.o zd_rf.o zd_usb.o
++		zd_ieee80211.o zd_rf.o zd_usb.o zd_util.o
 +
 +ifeq ($(CONFIG_ZD1211RW_MAC80211_DEBUG),y)
 +EXTRA_CFLAGS += -DDEBUG
 +endif
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,57 @@
 +/* zd_def.h
 + *
@@ -1727,8 +1728,8 @@
 +
 +#endif /* _ZD_DEF_H */
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,108 @@
 +/* zd_rf.h
 + *
@@ -1839,8 +1840,8 @@
 +
 +#endif /* _ZD_RF_H */
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,921 @@
 +/* zd_chip.h
 + *
@@ -2764,8 +2765,8 @@
 +
 +#endif /* _ZD_CHIP_H */
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,439 @@
 +/* zd_rf_al2230.c: Functions for the AL2230 RF controller
 + *
@@ -3206,9 +3207,128 @@
 +	rf->patch_cck_gain = 1;
 +	return 0;
 +}
+diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.h
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.h	2007-09-27 09:59:55.000000000 -0400
+@@ -0,0 +1,29 @@
++/* zd_util.h
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++
++#ifndef _ZD_UTIL_H
++#define _ZD_UTIL_H
++
++void *zd_tail(const void *buffer, size_t buffer_size, size_t tail_size);
++
++#ifdef DEBUG
++void zd_hexdump(const void *bytes, size_t size);
++#else
++#define zd_hexdump(bytes, size)
++#endif /* DEBUG */
++
++#endif /* _ZD_UTIL_H */
+diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.c
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.c	2007-09-27 09:59:55.000000000 -0400
+@@ -0,0 +1,82 @@
++/* zd_util.c
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Utility program
++ */
++
++#include "zd_def.h"
++#include "zd_util.h"
++
++#ifdef DEBUG
++static char hex(u8 v)
++{
++	v &= 0xf;
++	return (v < 10 ? '0' : 'a' - 10) + v;
++}
++
++static char hex_print(u8 c)
++{
++	return (0x20 <= c && c < 0x7f) ? c : '.';
++}
++
++static void dump_line(const u8 *bytes, size_t size)
++{
++	char c;
++	size_t i;
++
++	size = size <= 8 ? size : 8;
++	printk(KERN_DEBUG "zd1211 %p ", bytes);
++	for (i = 0; i < 8; i++) {
++		switch (i) {
++		case 1:
++		case 5:
++			c = '.';
++			break;
++		case 3:
++			c = ':';
++			break;
++		default:
++			c = ' ';
++		}
++		if (i < size) {
++			printk("%c%c%c", hex(bytes[i] >> 4), hex(bytes[i]), c);
++		} else {
++			printk("  %c", c);
++		}
++	}
++
++	for (i = 0; i < size; i++)
++		printk("%c", hex_print(bytes[i]));
++	printk("\n");
++}
++
++void zd_hexdump(const void *bytes, size_t size)
++{
++	size_t i = 0;
++
++	do {
++		dump_line((u8 *)bytes + i, size-i);
++		i += 8;
++	} while (i < size);
++}
++#endif /* DEBUG */
++
++void *zd_tail(const void *buffer, size_t buffer_size, size_t tail_size)
++{
++	if (buffer_size < tail_size)
++		return NULL;
++	return (u8 *)buffer + (buffer_size - tail_size);
++}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,279 @@
 +/* zd_rf_rfmd.c: Functions for the RFMD RF controller
 + *
@@ -3490,8 +3610,8 @@
 +	return 0;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,75 @@
 +#ifndef _ZD_IEEE80211_H
 +#define _ZD_IEEE80211_H
@@ -3569,8 +3689,8 @@
 +
 +#endif /* _ZD_IEEE80211_H */
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,18 @@
 +config ZD1211RW_MAC80211
 +	tristate "ZyDAS ZD1211/ZD1211B USB support (mac80211 stack)"
@@ -3591,8 +3711,8 @@
 +	  ZD1211 debugging messages. Choosing Y will result in additional debug
 +	  messages being saved to your kernel logs, which may help debug any
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,100 @@
 +/* zd_ieee80211.c
 + *
@@ -3695,8 +3815,8 @@
 +}
 +
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,263 @@
 +/* zd_usb.h: Header for USB interface implemented by ZD1211 chip
 + *
@@ -3962,8 +4082,8 @@
 +
 +#endif /* _ZD_USB_H */
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,178 @@
 +/* zd_rf.c
 + *
@@ -4144,8 +4264,8 @@
 +}
 +
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,534 @@
 +/* zd_rf_uw2453.c: Functions for the UW2453 RF controller
 + *
@@ -4682,8 +4802,8 @@
 +}
 +
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,227 @@
 +/* zd_mac.h
 + *
@@ -4913,8 +5033,8 @@
 +
 +#endif /* _ZD_MAC_H */
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c	2007-10-03 15:14:47.000000000 -0400
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c	2007-09-27 09:59:55.000000000 -0400
 @@ -0,0 +1,492 @@
 +/* zd_rf_al7230b.c: Functions for the AL7230B RF controller
 + *
@@ -5409,9 +5529,9 @@
 +	return 0;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c	2007-10-03 15:14:47.000000000 -0400
-@@ -0,0 +1,1527 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c	2007-09-27 09:59:55.000000000 -0400
+@@ -0,0 +1,1528 @@
 +/* zd_usb.c
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -5443,6 +5563,7 @@
 +#include "zd_def.h"
 +#include "zd_mac.h"
 +#include "zd_usb.h"
++#include "zd_util.h"
 +
 +static struct usb_device_id usb_ids[] = {
 +	/* ZD1211 */
@@ -6940,13 +7061,11 @@
 +	return r;
 +}
 diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c
---- /dev/null	2007-10-03 08:48:58.519160117 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c	2007-10-03 15:19:35.000000000 -0400
-@@ -0,0 +1,965 @@
+--- /dev/null	2007-09-27 08:31:24.563724082 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c	2007-09-27 10:01:28.000000000 -0400
+@@ -0,0 +1,950 @@
 +/* zd_mac.c
 + *
-+ * Copyright (c) 2007 Luis R. Rodriguez <mcgrof at winlab.rutgers.edu>
-+ *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
@@ -6973,6 +7092,7 @@
 +#include "zd_mac.h"
 +#include "zd_ieee80211.h"
 +#include "zd_rf.h"
++#include "zd_util.h"
 +
 +/* This table contains the hardware specific values for the modulation rates. */
 +static const struct ieee80211_rate zd_rates[] = {
@@ -7152,7 +7272,7 @@
 +	return zd_chip_set_multicast_hash(&mac->chip, &hash);
 +}
 +
-+static int zd_op_start(struct ieee80211_hw *hw)
++static int zd_op_open(struct ieee80211_hw *hw)
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	struct zd_chip *chip = &mac->chip;
@@ -7236,7 +7356,7 @@
 +	dev_kfree_skb_any(skb);
 +}
 +
-+static void zd_op_stop(struct ieee80211_hw *hw)
++static int zd_op_stop(struct ieee80211_hw *hw)
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	struct zd_chip *chip = &mac->chip;
@@ -7259,6 +7379,8 @@
 +
 +	while ((skb = skb_dequeue(ack_wait_queue)))
 +		kfree_tx_skb(skb);
++
++	return 0;
 +}
 +
 +/**
@@ -7553,11 +7675,11 @@
 +{
 +	const struct rx_status *status;
 +
-+	/* Caller has to ensure that length >= sizeof(struct rx_status). */
-+	*pstatus = status = (struct rx_status *)
-+		(buffer + (length - sizeof(struct rx_status)));
-+	if (status->frame_status & ZD_RX_ERROR)
-+		return -EINVAL; /* FIXME: stats update */
++	*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
++	if (status->frame_status & ZD_RX_ERROR) {
++		/* FIXME: update? */
++		return -EINVAL;
++	}
 +	memset(stats, 0, sizeof(*stats));
 +
 +	stats->channel = _zd_chip_get_channel(&mac->chip);
@@ -7654,9 +7776,9 @@
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +
-+	/* using IEEE80211_IF_TYPE_INVALID to indicate no mode selected */
-+	if (mac->type != IEEE80211_IF_TYPE_INVALID)
-+		return -EOPNOTSUPP;
++	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
++	if (mac->type != IEEE80211_IF_TYPE_MGMT)
++		return -1;
 +
 +	switch (conf->type) {
 +	case IEEE80211_IF_TYPE_MNTR:
@@ -7676,7 +7798,7 @@
 +				    struct ieee80211_if_init_conf *conf)
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
-+	mac->type = IEEE80211_IF_TYPE_INVALID;
++	mac->type = IEEE80211_IF_TYPE_MGMT;
 +}
 +
 +static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
@@ -7690,9 +7812,7 @@
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +
-+	spin_lock_irq(&mac->lock);
 +	mac->associated = is_valid_ether_addr(conf->bssid);
-+	spin_unlock_irq(&mac->lock);
 +
 +	/* TODO: do hardware bssid filtering */
 +	return 0;
@@ -7711,40 +7831,26 @@
 +	zd_chip_set_multicast_hash(&mac->chip, &hash);
 +}
 +
-+#define SUPPORTED_FIF_FLAGS \
-+	FIF_PROMISC_IN_BSS | FIF_ALLMULTI
-+static void zd_op_configure_filter(struct ieee80211_hw *hw,
-+			unsigned int changed_flags,
-+			unsigned int *new_flags,
-+			int mc_count, struct dev_mc_list *mclist)
++static void zd_op_set_multicast_list(struct ieee80211_hw *hw,
++				      unsigned short dev_flags, int mc_count)
 +{
 +	struct zd_mc_hash hash;
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	unsigned long flags;
-+	int i;
-+
-+	/* Only deal with supported flags */
-+	changed_flags &= SUPPORTED_FIF_FLAGS;
-+	*new_flags &= SUPPORTED_FIF_FLAGS;
-+
-+	/* changed_flags is always populated but this driver
-+	 * doesn't support all FIF flags so its possible we don't
-+	 * need to do anything */
-+	if (!changed_flags)
-+		return;
 +
-+	if ((*new_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)) ||
-+	     has_monitor_interfaces(mac)) {
++	if ((dev_flags & (IFF_PROMISC|IFF_ALLMULTI)) ||
++	     has_monitor_interfaces(mac))
++	{
 +		zd_mc_add_all(&hash);
 +	} else {
++		struct dev_mc_list *mc = NULL;
++		void *tmp = NULL;
++
 +		zd_mc_clear(&hash);
-+		for (i = 0; i < mc_count; i++) {
-+			if (!mclist)
-+				break;
++		while ((mc = ieee80211_get_mc_list_item(hw, mc, &tmp))) {
 +			dev_dbg_f(zd_mac_dev(mac), "mc addr " MAC_FMT "\n",
-+				  MAC_ARG(mclist->dmi_addr));
-+			zd_mc_add_addr(&hash, mclist->dmi_addr);
-+			mclist = mclist->next;
++				  MAC_ARG(mc->dmi_addr));
++			zd_mc_add_addr(&hash, mc->dmi_addr);
 +		}
 +	}
 +
@@ -7795,13 +7901,13 @@
 +
 +static const struct ieee80211_ops zd_ops = {
 +	.tx			= zd_op_tx,
-+	.start			= zd_op_start,
++	.open			= zd_op_open,
 +	.stop			= zd_op_stop,
 +	.add_interface		= zd_op_add_interface,
 +	.remove_interface	= zd_op_remove_interface,
 +	.config			= zd_op_config,
 +	.config_interface	= zd_op_config_interface,
-+	.configure_filter	= zd_op_configure_filter,
++	.set_multicast_list	= zd_op_set_multicast_list,
 +	.erp_ie_changed		= zd_op_erp_ie_changed,
 +};
 +
@@ -7823,7 +7929,7 @@
 +	spin_lock_init(&mac->lock);
 +	mac->hw = hw;
 +
-+	mac->type = IEEE80211_IF_TYPE_INVALID;
++	mac->type = IEEE80211_IF_TYPE_MGMT;
 +	mac->hwaddr = hw->wiphy->perm_addr;
 +
 +	memcpy(mac->channels, zd_channels, sizeof(zd_channels));
@@ -7883,7 +7989,7 @@
 +	r = zd_chip_control_leds(chip,
 +		                 is_associated ? LED_ASSOCIATED : LED_SCANNING);
 +	if (r)
-+		dev_dbg_f(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r);
++		dev_err(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r);
 +
 +	queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work,
 +		           LINK_LED_WORK_DELAY);
@@ -7909,12 +8015,13 @@
 +	zd_chip_control_leds(&mac->chip, LED_OFF);
 +}
 diff -up linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.22.noarch/drivers/net/wireless/Kconfig
---- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-10-03 15:13:29.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-10-03 15:15:05.000000000 -0400
-@@ -618,5 +618,6 @@ source "drivers/net/wireless/b43legacy/K
+--- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-09-27 09:59:49.000000000 -0400
++++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-09-27 09:59:55.000000000 -0400
+@@ -616,6 +616,7 @@ source "drivers/net/wireless/bcm43xx/Kco
+ source "drivers/net/wireless/b43/Kconfig"
+ source "drivers/net/wireless/b43legacy/Kconfig"
  source "drivers/net/wireless/zd1211rw/Kconfig"
++source "drivers/net/wireless/zd1211rw-mac80211/Kconfig"
  source "drivers/net/wireless/rt2x00/Kconfig"
  source "drivers/net/wireless/iwlwifi/Kconfig"
-+source "drivers/net/wireless/zd1211rw-mac80211/Kconfig"
  
- endmenu




More information about the fedora-extras-commits mailing list