From 9d5a56dc7912147fb7c6545ee7bdc3434a274a91 Mon Sep 17 00:00:00 2001 From: XazZ Date: Sat, 19 Apr 2008 20:11:30 +0200 Subject: [PATCH] add 2.6.25 support I've not tested this on 2.6.25 but at least it compiles (without any warnings) parts of this code already existed before - I modified it a bit + I fixed a possible lockup bug in the .25 code --- acx_func.h | 13 +++++------ acx_mac80211.h | 2 ++ acx_struct.h | 7 +++--- common.c | 69 +++++++++++++++++++++++++++------------------------------- 4 files changed, 42 insertions(+), 49 deletions(-) diff --git a/acx_func.h b/acx_func.h index 0141c3b..fd4744e 100644 --- a/acx_func.h +++ b/acx_func.h @@ -621,19 +621,16 @@ int acx_net_set_key(struct ieee80211_hw *hw, const u8 *local_addr, const u8 *addr, struct ieee80211_key_conf *key); #endif -/* for 2.6.25 or later */ -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -int acx_config_interface(struct ieee80211_hw* ieee, int if_id, - struct ieee80211_if_conf *conf); -#else + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) extern int acx_config_interface(struct ieee80211_hw* ieee, struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); -#endif -*/ +#else int acx_config_interface(struct ieee80211_hw* ieee, int if_id, struct ieee80211_if_conf *conf); +#endif + int acx_net_config(struct ieee80211_hw* ieee, struct ieee80211_conf *conf); int acx_net_get_tx_stats(struct ieee80211_hw* ieee, struct ieee80211_tx_queue_stats *stats); int acx_net_conf_tx(struct ieee80211_hw* ieee, int queue, diff --git a/acx_mac80211.h b/acx_mac80211.h index f9870bb..940d7fa 100644 --- a/acx_mac80211.h +++ b/acx_mac80211.h @@ -14,7 +14,9 @@ struct acx_interface { * interface) from the ieee80211 subsystem. * Do not modify. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) int if_id; +#endif /* MAC address. */ u8 *mac_addr; /* Current BSSID (if any). */ diff --git a/acx_struct.h b/acx_struct.h index 631c3a5..18bfcfb 100644 --- a/acx_struct.h +++ b/acx_struct.h @@ -1197,12 +1197,11 @@ struct acx_device { struct ieee80211_hw *ieee; struct ieee80211_hw_mode modes[2]; struct ieee80211_rx_status rx_status; -/* for 2.6.25 or later */ -/* -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) struct ieee80211_vif *vif; #endif -*/ + /*** Power managment ***/ struct pm_dev *pm; /* PM crap */ diff --git a/common.c b/common.c index 13cf2ea..eb522fd 100644 --- a/common.c +++ b/common.c @@ -4299,15 +4299,13 @@ int acx_add_interface(struct ieee80211_hw *ieee, if (adev->interface.operating) goto out_unlock; adev->interface.operating = 1; -/* for 2.6.25 or later */ -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - adev->interface.if_id = conf->if_id; -#else + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) adev->vif = conf->vif; -#endif -*/ +#else adev->interface.if_id = conf->if_id; +#endif + adev->interface.mac_addr = conf->mac_addr; adev->interface.type = conf->type; } @@ -4322,16 +4320,15 @@ int acx_add_interface(struct ieee80211_hw *ieee, acx_lock(adev, flags); printk(KERN_INFO "Virtual interface added " -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - "(type: 0x%08X, ID: %d, MAC: " - MAC_FMT ")\n", +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) + "(type: 0x%08X), ID: %pd, MAC: %s\n", conf->type, - conf->if_id, - MAC_ARG(conf->mac_addr)); + conf->vif, + print_mac(mac, conf->mac_addr)); #else - "(type: 0x%08X), ID: %d, MAC: %s\n", + "(type: 0x%08X, ID: %d, MAC: %s)\n", conf->type, - conf->if_id, /* use conf->vif, and %pd here on 2.6.25 or later */ + conf->if_id, print_mac(mac, conf->mac_addr)); #endif @@ -4373,15 +4370,15 @@ void acx_remove_interface(struct ieee80211_hw *hw, flush_scheduled_work(); printk(KERN_INFO "Virtual interface removed " -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - "(type: 0x%08X, ID: %d, MAC: " - MAC_FMT ")\n", - conf->type, conf->if_id, MAC_ARG(conf->mac_addr)); -#else - "(type: 0x%08X, ID: %d, MAC: %s)\n", +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) + "(type: 0x%08X, ID: %pd, MAC: %s)\n", conf->type, - conf->if_id, /* use conf->vif, and %pd here on 2.6.25 or later */ + conf->vif, print_mac(mac, conf->mac_addr)); + +#else + "(type: 0x%08X, ID: %d, MAC: %s)\n", + conf->type, conf->if_id, print_mac(mac, conf->mac_addr)); #endif FN_EXIT0; } @@ -4505,9 +4502,10 @@ int acx_net_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) ** */ -//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) (see below) -int acx_config_interface(struct ieee80211_hw* ieee, int if_id, - struct ieee80211_if_conf *conf) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) +extern int acx_config_interface(struct ieee80211_hw* ieee, + struct ieee80211_vif *vif, + struct ieee80211_if_conf *conf) { acx_device_t *adev = ieee2adev(ieee); unsigned long flags; @@ -4515,14 +4513,13 @@ int acx_config_interface(struct ieee80211_hw* ieee, int if_id, FN_ENTER; if (!adev->interface.operating) goto err_out; + acx_lock(adev, flags); if (adev->initialized) acx_select_opmode(adev); - acx_lock(adev, flags); - if ((conf->type != IEEE80211_IF_TYPE_MNTR) - && (adev->interface.if_id == if_id)) { + && (adev->vif == vif)) { if (conf->bssid) { adev->interface.bssid = conf->bssid; @@ -4530,13 +4527,10 @@ int acx_config_interface(struct ieee80211_hw* ieee, int if_id, } } if ((conf->type == IEEE80211_IF_TYPE_AP) - && (adev->interface.if_id == if_id)) { -/* for 2.6.25 or later */ -/* + && (adev->vif == vif)) { #else -extern int acx_config_interface(struct ieee80211_hw* ieee, - struct ieee80211_vif *vif, - struct ieee80211_if_conf *conf) +int acx_config_interface(struct ieee80211_hw* ieee, int if_id, + struct ieee80211_if_conf *conf) { acx_device_t *adev = ieee2adev(ieee); unsigned long flags; @@ -4544,13 +4538,14 @@ extern int acx_config_interface(struct ieee80211_hw* ieee, FN_ENTER; if (!adev->interface.operating) goto err_out; - acx_lock(adev, flags); if (adev->initialized) acx_select_opmode(adev); + acx_lock(adev, flags); + if ((conf->type != IEEE80211_IF_TYPE_MNTR) - && (adev->vif == vif)) { + && (adev->interface.if_id == if_id)) { if (conf->bssid) { adev->interface.bssid = conf->bssid; @@ -4558,9 +4553,9 @@ extern int acx_config_interface(struct ieee80211_hw* ieee, } } if ((conf->type == IEEE80211_IF_TYPE_AP) - && (adev->vif == vif)) { + && (adev->interface.if_id == if_id)) { #endif -*/ + if ((conf->ssid_len > 0) && conf->ssid) { adev->essid_len = conf->ssid_len; -- 2.11.4.GIT