From 8c96b88b250762afe423dda14af59138baae1949 Mon Sep 17 00:00:00 2001
From: Eugene Konev <ejka@imfi.kspu.ru>
Date: Mon, 15 Oct 2007 13:48:38 +0000
Subject: fix acx-mac80211

SVN-Revision: 9326
---
 package/acx-mac80211/Makefile                      |   3 +-
 .../acx-mac80211/patches/003-mac80211_fixes.diff   | 178 +++++++++++++++++++++
 2 files changed, 180 insertions(+), 1 deletion(-)
 create mode 100644 package/acx-mac80211/patches/003-mac80211_fixes.diff

diff --git a/package/acx-mac80211/Makefile b/package/acx-mac80211/Makefile
index 65ef0e1e77..8b09b43a45 100644
--- a/package/acx-mac80211/Makefile
+++ b/package/acx-mac80211/Makefile
@@ -50,7 +50,6 @@ $(DL_DIR)/$(PKG_FW_NAME):
 	CONFIG_ACX_MAC80211_PCI=m \
 
   PKG_EXTRA_CFLAGS:= \
-	-I$(STAGING_DIR)/usr/include/mac80211 \
 	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
 	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
 
@@ -61,6 +60,8 @@ $(DL_DIR)/$(PKG_FW_NAME):
 		SUBDIRS="$(PKG_BUILD_DIR)" \
 		$(PKG_EXTRA_KCONFIG) \
 		EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \
+		LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211 -I$(LINUX_DIR)/include \
+			-include linux/autoconf.h" \
 		V="$(V)" \
 		modules
   endef
diff --git a/package/acx-mac80211/patches/003-mac80211_fixes.diff b/package/acx-mac80211/patches/003-mac80211_fixes.diff
new file mode 100644
index 0000000000..2a81a96ac2
--- /dev/null
+++ b/package/acx-mac80211/patches/003-mac80211_fixes.diff
@@ -0,0 +1,178 @@
+Index: acx-mac80211-20071003/common.c
+===================================================================
+--- acx-mac80211-20071003.orig/common.c	2007-10-15 21:33:40.000000000 +0800
++++ acx-mac80211-20071003/common.c	2007-10-15 21:39:55.000000000 +0800
+@@ -1683,7 +1683,9 @@
+ */
+ void
+ acx_i_set_multicast_list(struct ieee80211_hw *hw,
+-                            unsigned short netflags, int mc_count)
++                         unsigned int changed_flags,
++                         unsigned int *total_flags,
++                         int mc_count, struct dev_addr_list *mc_list)
+ {
+         acx_device_t *adev = ieee2adev(hw);
+         unsigned long flags;
+@@ -1692,9 +1694,12 @@
+ 
+         acx_lock(adev, flags);
+ 
++        if ((changed_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)) == 0)
++                return;
+         /* firmwares don't have allmulti capability,
+          * so just use promiscuous mode instead in this case. */
+-        if (netflags & (IFF_PROMISC | IFF_ALLMULTI)) {
++        *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI);
++        if (*total_flags) {
+                 SET_BIT(adev->rx_config_1, RX_CFG1_RCV_PROMISCUOUS);
+                 CLEAR_BIT(adev->rx_config_1, RX_CFG1_FILTER_ALL_MULTI);
+                 SET_BIT(adev->set_mask, SET_RXCONFIG);
+@@ -4523,8 +4528,8 @@
+ */
+ 
+ int acx_net_set_key(struct ieee80211_hw *ieee,
+-		    set_key_cmd cmd,
+-		    u8 * addr, struct ieee80211_key_conf *key, int aid)
++		    enum set_key_cmd cmd, const u8 *local_addr,
++		    const u8 * addr, struct ieee80211_key_conf *key)
+ {
+ //      return 0;
+ 	struct acx_device *adev = ieee2adev(ieee);
+@@ -4536,11 +4541,11 @@
+ //	TODO();
+ 	switch (key->alg) {
+ 	default:
+-	case ALG_NONE:
++/*	case ALG_NONE:
+ 	case ALG_NULL:
+ 		algorithm = ACX_SEC_ALGO_NONE;
+ 		break;
+-	case ALG_WEP:
++*/	case ALG_WEP:
+ 		if (key->keylen == 5)
+ 			algorithm = ACX_SEC_ALGO_WEP;
+ 		else
+@@ -4565,20 +4570,21 @@
+ 		if (err)
+ 			goto out_unlock;
+ 		key->hw_key_idx = index;
+-		CLEAR_BIT(key->flags, IEEE80211_KEY_FORCE_SW_ENCRYPT);
+-		if (CHECK_BIT(key->flags, IEEE80211_KEY_DEFAULT_TX_KEY))
+-			adev->default_key_idx = index;
++/*		CLEAR_BIT(key->flags, IEEE80211_KEY_FORCE_SW_ENCRYPT);*/
++/*		if (CHECK_BIT(key->flags, IEEE80211_KEY_DEFAULT_TX_KEY))
++			adev->default_key_idx = index;*/
++                SET_BIT(key->flags, IEEE80211_KEY_FLAG_GENERATE_IV);
+ 		adev->key[index].enabled = 1;
+ 		break;
+ 	case DISABLE_KEY:
+ 		adev->key[index].enabled = 0;
+ 		err = 0;
+ 		break;
+-	case REMOVE_ALL_KEYS:
++/*	case REMOVE_ALL_KEYS:
+ 		acx_clear_keys(adev);
+ 		err = 0;
+ 		break;
+-     /* case ENABLE_COMPRESSION:
++*/    /* case ENABLE_COMPRESSION:
+ 	case DISABLE_COMPRESSION:
+ 		err = 0;
+ 		break; */
+Index: acx-mac80211-20071003/pci.c
+===================================================================
+--- acx-mac80211-20071003.orig/pci.c	2007-10-15 21:33:40.000000000 +0800
++++ acx-mac80211-20071003/pci.c	2007-10-15 21:34:29.000000000 +0800
+@@ -87,7 +87,7 @@
+ static void disable_acx_irq(acx_device_t * adev);
+ 
+ static int acxpci_e_open(struct ieee80211_hw *hw);
+-static int acxpci_e_close(struct ieee80211_hw *hw);
++static void acxpci_e_close(struct ieee80211_hw *hw);
+ static void acxpci_s_up(struct ieee80211_hw *hw);
+ static void acxpci_s_down(struct ieee80211_hw *hw);
+ 
+@@ -1414,12 +1414,12 @@
+         .conf_tx = acx_net_conf_tx,
+         .add_interface = acx_add_interface,
+         .remove_interface = acx_remove_interface,
+-	.open = acxpci_e_open,
++	.start = acxpci_e_open,
+ 	.stop = acxpci_e_close,
+-        .reset = acx_net_reset,
++/*        .reset = acx_net_reset,*/
+         .config = acx_net_config,
+         .config_interface = acx_config_interface,
+-        .set_multicast_list = acx_i_set_multicast_list,
++        .configure_filter = acx_i_set_multicast_list,
+         .set_key = acx_net_set_key,
+         .get_stats = acx_e_get_stats,
+         .get_tx_stats = acx_net_get_tx_stats,
+@@ -1454,9 +1454,7 @@
+ 		       pci_name(pdev));
+ 		goto fail_alloc_netdev;
+ 	}
+-	ieee->flags &=	 ~IEEE80211_HW_RX_INCLUDES_FCS &
+-			 ~IEEE80211_HW_MONITOR_DURING_OPER |
+-			 IEEE80211_HW_WEP_INCLUDE_IV;
++	ieee->flags &=	 ~IEEE80211_HW_RX_INCLUDES_FCS;
+ 	ieee->queues = 1;
+ 
+ 	/* (NB: memsets to 0 entire area) */
+@@ -2113,7 +2111,7 @@
+ **	>0	f/w reported error
+ **	<0	driver reported error
+ */
+-static int acxpci_e_close(struct ieee80211_hw *hw)
++static void acxpci_e_close(struct ieee80211_hw *hw)
+ {
+ 	acx_device_t *adev = ieee2adev(hw);
+ 	unsigned long flags;
+@@ -2142,7 +2140,6 @@
+ 
+ 	log(L_INIT, "closed device\n");
+ 	FN_EXIT0;
+-	return OK;
+ }
+ 
+ 
+@@ -4145,9 +4142,7 @@
+ 		       vdev->dev.bus_id);
+ 		goto fail_alloc_netdev;
+ 	}
+-	ieee->flags &=	 (~IEEE80211_HW_RX_INCLUDES_FCS &
+-			  ~IEEE80211_HW_MONITOR_DURING_OPER) |
+-			 IEEE80211_HW_WEP_INCLUDE_IV;
++	ieee->flags &=	 ~IEEE80211_HW_RX_INCLUDES_FCS;
+ 	ieee->queues = 1;
+ 
+ 	adev = ieee2adev(ieee);
+Index: acx-mac80211-20071003/acx_func.h
+===================================================================
+--- acx-mac80211-20071003.orig/acx_func.h	2007-10-15 21:33:40.000000000 +0800
++++ acx-mac80211-20071003/acx_func.h	2007-10-15 21:36:01.000000000 +0800
+@@ -610,10 +610,9 @@
+ 		struct ieee80211_if_init_conf *conf);
+ int acx_net_reset(struct ieee80211_hw* ieee);
+ int acx_net_set_key(struct ieee80211_hw *hw, 
+-		set_key_cmd cmd,
+-		u8 *addr,
+-		struct ieee80211_key_conf *key,
+-		int aid);
++		enum set_key_cmd cmd,
++		const u8 *local_addr, const u8 *addr,
++		struct ieee80211_key_conf *key);
+ int acx_config_interface(struct ieee80211_hw* ieee, int if_id, 
+ 		struct ieee80211_if_conf *conf);
+ int acx_net_config(struct ieee80211_hw* ieee, struct ieee80211_conf *conf);
+@@ -625,7 +624,9 @@
+ int acxpci_s_reset_dev(acx_device_t *adev);
+ void acx_e_after_interrupt_task(struct work_struct* work);
+ void acx_i_set_multicast_list(struct ieee80211_hw *hw,
+-                            unsigned short netflags, int mc_count);
++                            unsigned int changed_flags,
++                            unsigned int *total_flags,
++                            int mc_count, struct dev_addr_list *mc_list);
+ 
+ /*** End DeviceScape Functions **/
+ 
-- 
cgit v1.2.3