Libertas: cfg80211 support
Holger Schurig's patch (https://patchwork.kernel.org/patch/64286/) is rebased to latest wireless-testing tree. (Includes patches from me originally posted as "libertas: fix build error due to undefined symbol" and "libertas: unmangle capability value". -- JWL) Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Tested-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
f90754c15f
commit
e86dc1ca46
|
@ -1,4 +1,3 @@
|
|||
libertas-y += assoc.o
|
||||
libertas-y += cfg.o
|
||||
libertas-y += cmd.o
|
||||
libertas-y += cmdresp.o
|
||||
|
@ -6,9 +5,7 @@ libertas-y += debugfs.o
|
|||
libertas-y += ethtool.o
|
||||
libertas-y += main.o
|
||||
libertas-y += rx.o
|
||||
libertas-y += scan.o
|
||||
libertas-y += tx.o
|
||||
libertas-y += wext.o
|
||||
libertas-$(CONFIG_LIBERTAS_MESH) += mesh.o
|
||||
|
||||
usb8xxx-objs += if_usb.o
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,155 +0,0 @@
|
|||
/* Copyright (C) 2006, Red Hat, Inc. */
|
||||
|
||||
#ifndef _LBS_ASSOC_H_
|
||||
#define _LBS_ASSOC_H_
|
||||
|
||||
|
||||
#include "defs.h"
|
||||
#include "host.h"
|
||||
|
||||
|
||||
struct lbs_private;
|
||||
|
||||
/*
|
||||
* In theory, the IE is limited to the IE length, 255,
|
||||
* but in practice 64 bytes are enough.
|
||||
*/
|
||||
#define MAX_WPA_IE_LEN 64
|
||||
|
||||
|
||||
|
||||
struct lbs_802_11_security {
|
||||
u8 WPAenabled;
|
||||
u8 WPA2enabled;
|
||||
u8 wep_enabled;
|
||||
u8 auth_mode;
|
||||
u32 key_mgmt;
|
||||
};
|
||||
|
||||
/** Current Basic Service Set State Structure */
|
||||
struct current_bss_params {
|
||||
/** bssid */
|
||||
u8 bssid[ETH_ALEN];
|
||||
/** ssid */
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
|
||||
u8 ssid_len;
|
||||
|
||||
/** band */
|
||||
u8 band;
|
||||
/** channel is directly in priv->channel */
|
||||
/** zero-terminated array of supported data rates */
|
||||
u8 rates[MAX_RATES + 1];
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure used to store information for each beacon/probe response
|
||||
*/
|
||||
struct bss_descriptor {
|
||||
u8 bssid[ETH_ALEN];
|
||||
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
|
||||
u8 ssid_len;
|
||||
|
||||
u16 capability;
|
||||
u32 rssi;
|
||||
u32 channel;
|
||||
u16 beaconperiod;
|
||||
__le16 atimwindow;
|
||||
|
||||
/* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
|
||||
u8 mode;
|
||||
|
||||
/* zero-terminated array of supported data rates */
|
||||
u8 rates[MAX_RATES + 1];
|
||||
|
||||
unsigned long last_scanned;
|
||||
|
||||
union ieee_phy_param_set phy;
|
||||
union ieee_ss_param_set ss;
|
||||
|
||||
u8 wpa_ie[MAX_WPA_IE_LEN];
|
||||
size_t wpa_ie_len;
|
||||
u8 rsn_ie[MAX_WPA_IE_LEN];
|
||||
size_t rsn_ie_len;
|
||||
|
||||
u8 mesh;
|
||||
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
/** Association request
|
||||
*
|
||||
* Encapsulates all the options that describe a specific assocation request
|
||||
* or configuration of the wireless card's radio, mode, and security settings.
|
||||
*/
|
||||
struct assoc_request {
|
||||
#define ASSOC_FLAG_SSID 1
|
||||
#define ASSOC_FLAG_CHANNEL 2
|
||||
#define ASSOC_FLAG_BAND 3
|
||||
#define ASSOC_FLAG_MODE 4
|
||||
#define ASSOC_FLAG_BSSID 5
|
||||
#define ASSOC_FLAG_WEP_KEYS 6
|
||||
#define ASSOC_FLAG_WEP_TX_KEYIDX 7
|
||||
#define ASSOC_FLAG_WPA_MCAST_KEY 8
|
||||
#define ASSOC_FLAG_WPA_UCAST_KEY 9
|
||||
#define ASSOC_FLAG_SECINFO 10
|
||||
#define ASSOC_FLAG_WPA_IE 11
|
||||
unsigned long flags;
|
||||
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
|
||||
u8 ssid_len;
|
||||
u8 channel;
|
||||
u8 band;
|
||||
u8 mode;
|
||||
u8 bssid[ETH_ALEN] __attribute__ ((aligned (2)));
|
||||
|
||||
/** WEP keys */
|
||||
struct enc_key wep_keys[4];
|
||||
u16 wep_tx_keyidx;
|
||||
|
||||
/** WPA keys */
|
||||
struct enc_key wpa_mcast_key;
|
||||
struct enc_key wpa_unicast_key;
|
||||
|
||||
struct lbs_802_11_security secinfo;
|
||||
|
||||
/** WPA Information Elements*/
|
||||
u8 wpa_ie[MAX_WPA_IE_LEN];
|
||||
u8 wpa_ie_len;
|
||||
|
||||
/* BSS to associate with for infrastructure of Ad-Hoc join */
|
||||
struct bss_descriptor bss;
|
||||
};
|
||||
|
||||
|
||||
extern u8 lbs_bg_rates[MAX_RATES];
|
||||
|
||||
void lbs_association_worker(struct work_struct *work);
|
||||
struct assoc_request *lbs_get_association_request(struct lbs_private *priv);
|
||||
|
||||
int lbs_adhoc_stop(struct lbs_private *priv);
|
||||
|
||||
int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
|
||||
u8 bssid[ETH_ALEN], u16 reason);
|
||||
|
||||
int lbs_cmd_802_11_rssi(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd);
|
||||
int lbs_ret_802_11_rssi(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
|
||||
int lbs_cmd_bcn_ctrl(struct lbs_private *priv,
|
||||
struct cmd_ds_command *cmd,
|
||||
u16 cmd_action);
|
||||
int lbs_ret_802_11_bcn_ctrl(struct lbs_private *priv,
|
||||
struct cmd_ds_command *resp);
|
||||
|
||||
int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
|
||||
struct assoc_request *assoc);
|
||||
|
||||
int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
|
||||
uint16_t *enable);
|
||||
|
||||
int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
|
||||
struct assoc_request *assoc);
|
||||
|
||||
#endif /* _LBS_ASSOC_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +1,22 @@
|
|||
#ifndef __LBS_CFG80211_H__
|
||||
#define __LBS_CFG80211_H__
|
||||
|
||||
#include "dev.h"
|
||||
struct device;
|
||||
struct lbs_private;
|
||||
|
||||
struct wireless_dev *lbs_cfg_alloc(struct device *dev);
|
||||
int lbs_cfg_register(struct lbs_private *priv);
|
||||
void lbs_cfg_free(struct lbs_private *priv);
|
||||
|
||||
int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
|
||||
u8 ssid_len);
|
||||
int lbs_scan_networks(struct lbs_private *priv, int full_scan);
|
||||
void lbs_cfg_scan_worker(struct work_struct *work);
|
||||
/* All of those are TODOs: */
|
||||
#define lbs_cmd_802_11_rssi(priv, cmdptr) (0)
|
||||
#define lbs_ret_802_11_rssi(priv, resp) (0)
|
||||
#define lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action) (0)
|
||||
#define lbs_ret_802_11_bcn_ctrl(priv, resp) (0)
|
||||
|
||||
void lbs_send_disconnect_notification(struct lbs_private *priv);
|
||||
void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event);
|
||||
|
||||
void lbs_scan_deinit(struct lbs_private *priv);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,13 +7,8 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "decl.h"
|
||||
#include "defs.h"
|
||||
#include "dev.h"
|
||||
#include "assoc.h"
|
||||
#include "wext.h"
|
||||
#include "scan.h"
|
||||
#include "cfg.h"
|
||||
#include "cmd.h"
|
||||
|
||||
|
||||
|
@ -177,11 +172,6 @@ int lbs_update_hw_spec(struct lbs_private *priv)
|
|||
if (priv->mesh_dev)
|
||||
memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN);
|
||||
|
||||
if (lbs_set_regiontable(priv, priv->regioncode, 0)) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
lbs_deb_leave(LBS_DEB_CMD);
|
||||
return ret;
|
||||
|
@ -1325,6 +1315,15 @@ int lbs_execute_next_command(struct lbs_private *priv)
|
|||
* check if in power save mode, if yes, put the device back
|
||||
* to PS mode
|
||||
*/
|
||||
#ifdef TODO
|
||||
/*
|
||||
* This was the old code for libertas+wext. Someone that
|
||||
* understands this beast should re-code it in a sane way.
|
||||
*
|
||||
* I actually don't understand why this is related to WPA
|
||||
* and to connection status, shouldn't powering should be
|
||||
* independ of such things?
|
||||
*/
|
||||
if ((priv->psmode != LBS802_11POWERMODECAM) &&
|
||||
(priv->psstate == PS_STATE_FULL_POWER) &&
|
||||
((priv->connect_status == LBS_CONNECTED) ||
|
||||
|
@ -1346,6 +1345,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
|
|||
lbs_ps_sleep(priv, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
|
|
@ -5,18 +5,10 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "decl.h"
|
||||
#include "cmd.h"
|
||||
#include "defs.h"
|
||||
#include "dev.h"
|
||||
#include "assoc.h"
|
||||
#include "wext.h"
|
||||
#include "cfg.h"
|
||||
#include "cmd.h"
|
||||
|
||||
/**
|
||||
|
@ -50,23 +42,8 @@ void lbs_mac_event_disconnected(struct lbs_private *priv)
|
|||
priv->currenttxskb = NULL;
|
||||
priv->tx_pending_len = 0;
|
||||
|
||||
/* reset SNR/NF/RSSI values */
|
||||
memset(priv->SNR, 0x00, sizeof(priv->SNR));
|
||||
memset(priv->NF, 0x00, sizeof(priv->NF));
|
||||
memset(priv->RSSI, 0x00, sizeof(priv->RSSI));
|
||||
memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR));
|
||||
memset(priv->rawNF, 0x00, sizeof(priv->rawNF));
|
||||
priv->nextSNRNF = 0;
|
||||
priv->numSNRNF = 0;
|
||||
priv->connect_status = LBS_DISCONNECTED;
|
||||
|
||||
/* Clear out associated SSID and BSSID since connection is
|
||||
* no longer valid.
|
||||
*/
|
||||
memset(&priv->curbssparams.bssid, 0, ETH_ALEN);
|
||||
memset(&priv->curbssparams.ssid, 0, IEEE80211_MAX_SSID_LEN);
|
||||
priv->curbssparams.ssid_len = 0;
|
||||
|
||||
if (priv->psstate != PS_STATE_FULL_POWER) {
|
||||
/* make firmware to exit PS mode */
|
||||
lbs_deb_cmd("disconnected, so exit PS mode\n");
|
||||
|
@ -262,7 +239,7 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
|
|||
* ad-hoc mode. It takes place in
|
||||
* lbs_execute_next_command().
|
||||
*/
|
||||
if (priv->mode == IW_MODE_ADHOC &&
|
||||
if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR &&
|
||||
action == CMD_SUBCMD_ENTER_PS)
|
||||
priv->psmode = LBS802_11POWERMODECAM;
|
||||
} else if (action == CMD_SUBCMD_ENTER_PS) {
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/slab.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <net/lib80211.h>
|
||||
|
||||
#include "dev.h"
|
||||
#include "decl.h"
|
||||
#include "host.h"
|
||||
#include "debugfs.h"
|
||||
#include "cmd.h"
|
||||
#include "debugfs.h"
|
||||
|
||||
static struct dentry *lbs_dir;
|
||||
static char *szStates[] = {
|
||||
|
@ -60,51 +55,6 @@ static ssize_t lbs_dev_info(struct file *file, char __user *userbuf,
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct lbs_private *priv = file->private_data;
|
||||
size_t pos = 0;
|
||||
int numscansdone = 0, res;
|
||||
unsigned long addr = get_zeroed_page(GFP_KERNEL);
|
||||
char *buf = (char *)addr;
|
||||
DECLARE_SSID_BUF(ssid);
|
||||
struct bss_descriptor * iter_bss;
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
pos += snprintf(buf+pos, len-pos,
|
||||
"# | ch | rssi | bssid | cap | Qual | SSID\n");
|
||||
|
||||
mutex_lock(&priv->lock);
|
||||
list_for_each_entry (iter_bss, &priv->network_list, list) {
|
||||
u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS);
|
||||
u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY);
|
||||
u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
|
||||
|
||||
pos += snprintf(buf+pos, len-pos, "%02u| %03d | %04d | %pM |",
|
||||
numscansdone, iter_bss->channel, iter_bss->rssi,
|
||||
iter_bss->bssid);
|
||||
pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability);
|
||||
pos += snprintf(buf+pos, len-pos, "%c%c%c |",
|
||||
ibss ? 'A' : 'I', privacy ? 'P' : ' ',
|
||||
spectrum_mgmt ? 'S' : ' ');
|
||||
pos += snprintf(buf+pos, len-pos, " %04d |", SCAN_RSSI(iter_bss->rssi));
|
||||
pos += snprintf(buf+pos, len-pos, " %s\n",
|
||||
print_ssid(ssid, iter_bss->ssid,
|
||||
iter_bss->ssid_len));
|
||||
|
||||
numscansdone++;
|
||||
}
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
|
||||
|
||||
free_page(addr);
|
||||
return res;
|
||||
}
|
||||
|
||||
static ssize_t lbs_sleepparams_write(struct file *file,
|
||||
const char __user *user_buf, size_t count,
|
||||
loff_t *ppos)
|
||||
|
@ -723,8 +673,6 @@ struct lbs_debugfs_files {
|
|||
|
||||
static const struct lbs_debugfs_files debugfs_files[] = {
|
||||
{ "info", 0444, FOPS(lbs_dev_info, write_file_dummy), },
|
||||
{ "getscantable", 0444, FOPS(lbs_getscantable,
|
||||
write_file_dummy), },
|
||||
{ "sleepparams", 0644, FOPS(lbs_sleepparams_read,
|
||||
lbs_sleepparams_write), },
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* This file contains declaration referring to
|
||||
* functions defined in other source files
|
||||
|
@ -34,6 +35,8 @@ int lbs_start_card(struct lbs_private *priv);
|
|||
void lbs_stop_card(struct lbs_private *priv);
|
||||
void lbs_host_to_card_done(struct lbs_private *priv);
|
||||
|
||||
int lbs_rtap_supported(struct lbs_private *priv);
|
||||
|
||||
int lbs_set_mac_address(struct net_device *dev, void *addr);
|
||||
void lbs_set_multicast_list(struct net_device *dev);
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#define _LBS_DEV_H_
|
||||
|
||||
#include "mesh.h"
|
||||
#include "scan.h"
|
||||
#include "assoc.h"
|
||||
#include "defs.h"
|
||||
#include "host.h"
|
||||
|
||||
#include <linux/kfifo.h>
|
||||
|
||||
|
@ -29,7 +29,6 @@ struct lbs_private {
|
|||
/* Basic networking */
|
||||
struct net_device *dev;
|
||||
u32 connect_status;
|
||||
int infra_open;
|
||||
struct work_struct mcast_work;
|
||||
u32 nr_of_multicastmacaddr;
|
||||
u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
|
||||
|
@ -37,6 +36,9 @@ struct lbs_private {
|
|||
/* CFG80211 */
|
||||
struct wireless_dev *wdev;
|
||||
bool wiphy_registered;
|
||||
struct cfg80211_scan_request *scan_req;
|
||||
u8 assoc_bss[ETH_ALEN];
|
||||
u8 disassoc_reason;
|
||||
|
||||
/* Mesh */
|
||||
struct net_device *mesh_dev; /* Virtual device */
|
||||
|
@ -49,10 +51,6 @@ struct lbs_private {
|
|||
u8 mesh_ssid_len;
|
||||
#endif
|
||||
|
||||
/* Monitor mode */
|
||||
struct net_device *rtap_net_dev;
|
||||
u32 monitormode;
|
||||
|
||||
/* Debugfs */
|
||||
struct dentry *debugfs_dir;
|
||||
struct dentry *debugfs_debug;
|
||||
|
@ -133,14 +131,10 @@ struct lbs_private {
|
|||
struct workqueue_struct *work_thread;
|
||||
|
||||
/** Encryption stuff */
|
||||
struct lbs_802_11_security secinfo;
|
||||
struct enc_key wpa_mcast_key;
|
||||
struct enc_key wpa_unicast_key;
|
||||
u8 wpa_ie[MAX_WPA_IE_LEN];
|
||||
u8 wpa_ie_len;
|
||||
u16 wep_tx_keyidx;
|
||||
struct enc_key wep_keys[4];
|
||||
u8 authtype_auto;
|
||||
u8 wep_tx_key;
|
||||
u8 wep_key[4][WLAN_KEY_LEN_WEP104];
|
||||
u8 wep_key_len[4];
|
||||
|
||||
/* Wake On LAN */
|
||||
uint32_t wol_criteria;
|
||||
|
@ -161,6 +155,7 @@ struct lbs_private {
|
|||
/* NIC/link operation characteristics */
|
||||
u16 mac_control;
|
||||
u8 radio_on;
|
||||
u8 cur_rate;
|
||||
u8 channel;
|
||||
s16 txpower_cur;
|
||||
s16 txpower_min;
|
||||
|
@ -169,42 +164,6 @@ struct lbs_private {
|
|||
/** Scanning */
|
||||
struct delayed_work scan_work;
|
||||
int scan_channel;
|
||||
/* remember which channel was scanned last, != 0 if currently scanning */
|
||||
u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1];
|
||||
u8 scan_ssid_len;
|
||||
|
||||
/* Associating */
|
||||
struct delayed_work assoc_work;
|
||||
struct current_bss_params curbssparams;
|
||||
u8 mode;
|
||||
struct list_head network_list;
|
||||
struct list_head network_free_list;
|
||||
struct bss_descriptor *networks;
|
||||
struct assoc_request * pending_assoc_req;
|
||||
struct assoc_request * in_progress_assoc_req;
|
||||
uint16_t enablehwauto;
|
||||
|
||||
/* ADHOC */
|
||||
u16 beacon_period;
|
||||
u8 beacon_enable;
|
||||
u8 adhoccreate;
|
||||
|
||||
/* WEXT */
|
||||
char name[DEV_NAME_LEN];
|
||||
u8 nodename[16];
|
||||
struct iw_statistics wstats;
|
||||
u8 cur_rate;
|
||||
#define MAX_REGION_CHANNEL_NUM 2
|
||||
struct region_channel region_channel[MAX_REGION_CHANNEL_NUM];
|
||||
|
||||
/** Requested Signal Strength*/
|
||||
u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG];
|
||||
u16 NF[MAX_TYPE_B][MAX_TYPE_AVG];
|
||||
u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG];
|
||||
u8 rawSNR[DEFAULT_DATA_AVG_FACTOR];
|
||||
u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
|
||||
u16 nextSNRNF;
|
||||
u16 numSNRNF;
|
||||
};
|
||||
|
||||
extern struct cmd_confirm_sleep confirm_sleep;
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
#include <linux/ethtool.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "decl.h"
|
||||
#include "defs.h"
|
||||
#include "dev.h"
|
||||
#include "wext.h"
|
||||
#include "cmd.h"
|
||||
#include "mesh.h"
|
||||
|
||||
|
||||
static void lbs_ethtool_get_drvinfo(struct net_device *dev,
|
||||
|
|
|
@ -11,20 +11,14 @@
|
|||
#include <linux/if_arp.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/kfifo.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/ieee80211.h>
|
||||
#include <linux/slab.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "decl.h"
|
||||
#include "dev.h"
|
||||
#include "wext.h"
|
||||
#include "cfg.h"
|
||||
#include "debugfs.h"
|
||||
#include "scan.h"
|
||||
#include "assoc.h"
|
||||
#include "cmd.h"
|
||||
|
||||
#define DRIVER_RELEASE_VERSION "323.p0"
|
||||
|
@ -96,72 +90,6 @@ u8 lbs_data_rate_to_fw_index(u32 rate)
|
|||
}
|
||||
|
||||
|
||||
static int lbs_add_rtap(struct lbs_private *priv);
|
||||
static void lbs_remove_rtap(struct lbs_private *priv);
|
||||
|
||||
|
||||
/**
|
||||
* Get function for sysfs attribute rtap
|
||||
*/
|
||||
static ssize_t lbs_rtap_get(struct device *dev,
|
||||
struct device_attribute *attr, char * buf)
|
||||
{
|
||||
struct lbs_private *priv = to_net_dev(dev)->ml_priv;
|
||||
return snprintf(buf, 5, "0x%X\n", priv->monitormode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set function for sysfs attribute rtap
|
||||
*/
|
||||
static ssize_t lbs_rtap_set(struct device *dev,
|
||||
struct device_attribute *attr, const char * buf, size_t count)
|
||||
{
|
||||
int monitor_mode;
|
||||
struct lbs_private *priv = to_net_dev(dev)->ml_priv;
|
||||
|
||||
sscanf(buf, "%x", &monitor_mode);
|
||||
if (monitor_mode) {
|
||||
if (priv->monitormode == monitor_mode)
|
||||
return strlen(buf);
|
||||
if (!priv->monitormode) {
|
||||
if (priv->infra_open || lbs_mesh_open(priv))
|
||||
return -EBUSY;
|
||||
if (priv->mode == IW_MODE_INFRA)
|
||||
lbs_cmd_80211_deauthenticate(priv,
|
||||
priv->curbssparams.bssid,
|
||||
WLAN_REASON_DEAUTH_LEAVING);
|
||||
else if (priv->mode == IW_MODE_ADHOC)
|
||||
lbs_adhoc_stop(priv);
|
||||
lbs_add_rtap(priv);
|
||||
}
|
||||
priv->monitormode = monitor_mode;
|
||||
} else {
|
||||
if (!priv->monitormode)
|
||||
return strlen(buf);
|
||||
priv->monitormode = 0;
|
||||
lbs_remove_rtap(priv);
|
||||
|
||||
if (priv->currenttxskb) {
|
||||
dev_kfree_skb_any(priv->currenttxskb);
|
||||
priv->currenttxskb = NULL;
|
||||
}
|
||||
|
||||
/* Wake queues, command thread, etc. */
|
||||
lbs_host_to_card_done(priv);
|
||||
}
|
||||
|
||||
lbs_prepare_and_send_command(priv,
|
||||
CMD_802_11_MONITOR_MODE, CMD_ACT_SET,
|
||||
CMD_OPTION_WAITFORRSP, 0, &priv->monitormode);
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* lbs_rtap attribute to be exported per ethX interface
|
||||
* through sysfs (/sys/class/net/ethX/lbs_rtap)
|
||||
*/
|
||||
static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, lbs_rtap_set );
|
||||
|
||||
/**
|
||||
* @brief This function opens the ethX interface
|
||||
*
|
||||
|
@ -177,13 +105,6 @@ static int lbs_dev_open(struct net_device *dev)
|
|||
|
||||
spin_lock_irq(&priv->driver_lock);
|
||||
|
||||
if (priv->monitormode) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
priv->infra_open = 1;
|
||||
|
||||
if (priv->connect_status == LBS_CONNECTED)
|
||||
netif_carrier_on(dev);
|
||||
else
|
||||
|
@ -191,7 +112,6 @@ static int lbs_dev_open(struct net_device *dev)
|
|||
|
||||
if (!priv->tx_pending_len)
|
||||
netif_wake_queue(dev);
|
||||
out:
|
||||
|
||||
spin_unlock_irq(&priv->driver_lock);
|
||||
lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
|
||||
|
@ -211,7 +131,6 @@ static int lbs_eth_stop(struct net_device *dev)
|
|||
lbs_deb_enter(LBS_DEB_NET);
|
||||
|
||||
spin_lock_irq(&priv->driver_lock);
|
||||
priv->infra_open = 0;
|
||||
netif_stop_queue(dev);
|
||||
spin_unlock_irq(&priv->driver_lock);
|
||||
|
||||
|
@ -822,37 +741,16 @@ int lbs_exit_auto_deep_sleep(struct lbs_private *priv)
|
|||
|
||||
static int lbs_init_adapter(struct lbs_private *priv)
|
||||
{
|
||||
size_t bufsize;
|
||||
int i, ret = 0;
|
||||
int ret;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_MAIN);
|
||||
|
||||
/* Allocate buffer to store the BSSID list */
|
||||
bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
|
||||
priv->networks = kzalloc(bufsize, GFP_KERNEL);
|
||||
if (!priv->networks) {
|
||||
lbs_pr_err("Out of memory allocating beacons\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Initialize scan result lists */
|
||||
INIT_LIST_HEAD(&priv->network_free_list);
|
||||
INIT_LIST_HEAD(&priv->network_list);
|
||||
for (i = 0; i < MAX_NETWORK_COUNT; i++) {
|
||||
list_add_tail(&priv->networks[i].list,
|
||||
&priv->network_free_list);
|
||||
}
|
||||
|
||||
memset(priv->current_addr, 0xff, ETH_ALEN);
|
||||
|
||||
priv->connect_status = LBS_DISCONNECTED;
|
||||
priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
|
||||
priv->mode = IW_MODE_INFRA;
|
||||
priv->channel = DEFAULT_AD_HOC_CHANNEL;
|
||||
priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
|
||||
priv->radio_on = 1;
|
||||
priv->enablehwauto = 1;
|
||||
priv->psmode = LBS802_11POWERMODECAM;
|
||||
priv->psstate = PS_STATE_FULL_POWER;
|
||||
priv->is_deep_sleep = 0;
|
||||
|
@ -907,8 +805,6 @@ static void lbs_free_adapter(struct lbs_private *priv)
|
|||
kfifo_free(&priv->event_fifo);
|
||||
del_timer(&priv->command_timer);
|
||||
del_timer(&priv->auto_deepsleep_timer);
|
||||
kfree(priv->networks);
|
||||
priv->networks = NULL;
|
||||
|
||||
lbs_deb_leave(LBS_DEB_MAIN);
|
||||
}
|
||||
|
@ -945,7 +841,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
|
|||
lbs_pr_err("cfg80211 init failed\n");
|
||||
goto done;
|
||||
}
|
||||
/* TODO? */
|
||||
|
||||
wdev->iftype = NL80211_IFTYPE_STATION;
|
||||
priv = wdev_priv(wdev);
|
||||
priv->wdev = wdev;
|
||||
|
@ -955,7 +851,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
|
|||
goto err_wdev;
|
||||
}
|
||||
|
||||
//TODO? dev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES);
|
||||
dev = alloc_netdev(0, "wlan%d", ether_setup);
|
||||
if (!dev) {
|
||||
dev_err(dmdev, "no memory for network device instance\n");
|
||||
|
@ -971,20 +866,10 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
|
|||
dev->netdev_ops = &lbs_netdev_ops;
|
||||
dev->watchdog_timeo = 5 * HZ;
|
||||
dev->ethtool_ops = &lbs_ethtool_ops;
|
||||
#ifdef WIRELESS_EXT
|
||||
dev->wireless_handlers = &lbs_handler_def;
|
||||
#endif
|
||||
dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
|
||||
|
||||
|
||||
// TODO: kzalloc + iwm_init_default_profile(iwm, iwm->umac_profile); ??
|
||||
|
||||
|
||||
priv->card = card;
|
||||
priv->infra_open = 0;
|
||||
|
||||
|
||||
priv->rtap_net_dev = NULL;
|
||||
strcpy(dev->name, "wlan%d");
|
||||
|
||||
lbs_deb_thread("Starting main thread...\n");
|
||||
|
@ -996,8 +881,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
|
|||
}
|
||||
|
||||
priv->work_thread = create_singlethread_workqueue("lbs_worker");
|
||||
INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker);
|
||||
INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker);
|
||||
INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker);
|
||||
|
||||
priv->wol_criteria = 0xffffffff;
|
||||
|
@ -1031,12 +914,10 @@ void lbs_remove_card(struct lbs_private *priv)
|
|||
lbs_deb_enter(LBS_DEB_MAIN);
|
||||
|
||||
lbs_remove_mesh(priv);
|
||||
lbs_remove_rtap(priv);
|
||||
lbs_scan_deinit(priv);
|
||||
|
||||
dev = priv->dev;
|
||||
|
||||
cancel_delayed_work_sync(&priv->scan_work);
|
||||
cancel_delayed_work_sync(&priv->assoc_work);
|
||||
cancel_work_sync(&priv->mcast_work);
|
||||
|
||||
/* worker thread destruction blocks on the in-flight command which
|
||||
|
@ -1077,7 +958,7 @@ void lbs_remove_card(struct lbs_private *priv)
|
|||
EXPORT_SYMBOL_GPL(lbs_remove_card);
|
||||
|
||||
|
||||
static int lbs_rtap_supported(struct lbs_private *priv)
|
||||
int lbs_rtap_supported(struct lbs_private *priv)
|
||||
{
|
||||
if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5)
|
||||
return 1;
|
||||
|
@ -1109,16 +990,6 @@ int lbs_start_card(struct lbs_private *priv)
|
|||
|
||||
lbs_init_mesh(priv);
|
||||
|
||||
/*
|
||||
* While rtap isn't related to mesh, only mesh-enabled
|
||||
* firmware implements the rtap functionality via
|
||||
* CMD_802_11_MONITOR_MODE.
|
||||
*/
|
||||
if (lbs_rtap_supported(priv)) {
|
||||
if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
|
||||
lbs_pr_err("cannot register lbs_rtap attribute\n");
|
||||
}
|
||||
|
||||
lbs_debugfs_init_one(priv, dev);
|
||||
|
||||
lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
|
||||
|
@ -1150,9 +1021,6 @@ void lbs_stop_card(struct lbs_private *priv)
|
|||
lbs_debugfs_remove_one(priv);
|
||||
lbs_deinit_mesh(priv);
|
||||
|
||||
if (lbs_rtap_supported(priv))
|
||||
device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
|
||||
|
||||
/* Delete the timeout of the currently processing command */
|
||||
del_timer_sync(&priv->command_timer);
|
||||
del_timer_sync(&priv->auto_deepsleep_timer);
|
||||
|
@ -1239,87 +1107,6 @@ static void __exit lbs_exit_module(void)
|
|||
lbs_deb_leave(LBS_DEB_MAIN);
|
||||
}
|
||||
|
||||
/*
|
||||
* rtap interface support fuctions
|
||||
*/
|
||||
|
||||
static int lbs_rtap_open(struct net_device *dev)
|
||||
{
|
||||
/* Yes, _stop_ the queue. Because we don't support injection */
|
||||
lbs_deb_enter(LBS_DEB_MAIN);
|
||||
netif_carrier_off(dev);
|
||||
netif_stop_queue(dev);
|
||||
lbs_deb_leave(LBS_DEB_LEAVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lbs_rtap_stop(struct net_device *dev)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_MAIN);
|
||||
lbs_deb_leave(LBS_DEB_MAIN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static netdev_tx_t lbs_rtap_hard_start_xmit(struct sk_buff *skb,
|
||||
struct net_device *dev)
|
||||
{
|
||||
netif_stop_queue(dev);
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
static void lbs_remove_rtap(struct lbs_private *priv)
|
||||
{
|
||||
lbs_deb_enter(LBS_DEB_MAIN);
|
||||
if (priv->rtap_net_dev == NULL)
|
||||
goto out;
|
||||
unregister_netdev(priv->rtap_net_dev);
|
||||
free_netdev(priv->rtap_net_dev);
|
||||
priv->rtap_net_dev = NULL;
|
||||
out:
|
||||
lbs_deb_leave(LBS_DEB_MAIN);
|
||||
}
|
||||
|
||||
static const struct net_device_ops rtap_netdev_ops = {
|
||||
.ndo_open = lbs_rtap_open,
|
||||
.ndo_stop = lbs_rtap_stop,
|
||||
.ndo_start_xmit = lbs_rtap_hard_start_xmit,
|
||||
};
|
||||
|
||||
static int lbs_add_rtap(struct lbs_private *priv)
|
||||
{
|
||||
int ret = 0;
|
||||
struct net_device *rtap_dev;
|
||||
|
||||
lbs_deb_enter(LBS_DEB_MAIN);
|
||||
if (priv->rtap_net_dev) {
|
||||
ret = -EPERM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rtap_dev = alloc_netdev(0, "rtap%d", ether_setup);
|
||||
if (rtap_dev == NULL) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN);
|
||||
rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP;
|
||||
rtap_dev->netdev_ops = &rtap_netdev_ops;
|
||||
rtap_dev->ml_priv = priv;
|
||||
SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent);
|
||||
|
||||
ret = register_netdev(rtap_dev);
|
||||
if (ret) {
|
||||
free_netdev(rtap_dev);
|
||||
goto out;
|
||||
}
|
||||
priv->rtap_net_dev = rtap_dev;
|
||||
|
||||
out:
|
||||
lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
module_init(lbs_init_module);
|
||||
module_exit(lbs_exit_module);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <linux/if_arp.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/kfifo.h>
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
#include "mesh.h"
|
||||
#include "decl.h"
|
||||
|
@ -314,7 +315,7 @@ static int lbs_mesh_dev_open(struct net_device *dev)
|
|||
|
||||
spin_lock_irq(&priv->driver_lock);
|
||||
|
||||
if (priv->monitormode) {
|
||||
if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
@ -369,9 +370,6 @@ int lbs_add_mesh(struct lbs_private *priv)
|
|||
|
||||
SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent);
|
||||
|
||||
#ifdef WIRELESS_EXT
|
||||
mesh_dev->wireless_handlers = &mesh_handler_def;
|
||||
#endif
|
||||
mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
|
||||
/* Register virtual mesh interface */
|
||||
ret = register_netdev(mesh_dev);
|
||||
|
|
|
@ -70,11 +70,6 @@ void lbs_persist_config_init(struct net_device *net);
|
|||
void lbs_persist_config_remove(struct net_device *net);
|
||||
|
||||
|
||||
/* WEXT handler */
|
||||
|
||||
extern struct iw_handler_def mesh_handler_def;
|
||||
|
||||
|
||||
/* Ethtool statistics */
|
||||
|
||||
struct ethtool_stats;
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
#include <linux/etherdevice.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
#include "defs.h"
|
||||
#include "host.h"
|
||||
#include "radiotap.h"
|
||||
#include "decl.h"
|
||||
#include "dev.h"
|
||||
#include "wext.h"
|
||||
|
||||
struct eth803hdr {
|
||||
u8 dest_addr[6];
|
||||
|
@ -38,98 +39,6 @@ struct rx80211packethdr {
|
|||
static int process_rxed_802_11_packet(struct lbs_private *priv,
|
||||
struct sk_buff *skb);
|
||||
|
||||
/**
|
||||
* @brief This function computes the avgSNR .
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @return avgSNR
|
||||
*/
|
||||
static u8 lbs_getavgsnr(struct lbs_private *priv)
|
||||
{
|
||||
u8 i;
|
||||
u16 temp = 0;
|
||||
if (priv->numSNRNF == 0)
|
||||
return 0;
|
||||
for (i = 0; i < priv->numSNRNF; i++)
|
||||
temp += priv->rawSNR[i];
|
||||
return (u8) (temp / priv->numSNRNF);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function computes the AvgNF
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @return AvgNF
|
||||
*/
|
||||
static u8 lbs_getavgnf(struct lbs_private *priv)
|
||||
{
|
||||
u8 i;
|
||||
u16 temp = 0;
|
||||
if (priv->numSNRNF == 0)
|
||||
return 0;
|
||||
for (i = 0; i < priv->numSNRNF; i++)
|
||||
temp += priv->rawNF[i];
|
||||
return (u8) (temp / priv->numSNRNF);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function save the raw SNR/NF to our internel buffer
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @param prxpd A pointer to rxpd structure of received packet
|
||||
* @return n/a
|
||||
*/
|
||||
static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
|
||||
{
|
||||
if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR)
|
||||
priv->numSNRNF++;
|
||||
priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr;
|
||||
priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf;
|
||||
priv->nextSNRNF++;
|
||||
if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR)
|
||||
priv->nextSNRNF = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function computes the RSSI in received packet.
|
||||
*
|
||||
* @param priv A pointer to struct lbs_private structure
|
||||
* @param prxpd A pointer to rxpd structure of received packet
|
||||
* @return n/a
|
||||
*/
|
||||
static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd)
|
||||
{
|
||||
|
||||
lbs_deb_enter(LBS_DEB_RX);
|
||||
|
||||
lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
|
||||
lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
|
||||
priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
||||
priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
||||
|
||||
priv->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr;
|
||||
priv->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf;
|
||||
lbs_save_rawSNRNF(priv, p_rx_pd);
|
||||
|
||||
priv->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE;
|
||||
priv->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE;
|
||||
lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
|
||||
priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
||||
priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
||||
|
||||
priv->RSSI[TYPE_RXPD][TYPE_NOAVG] =
|
||||
CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_NOAVG],
|
||||
priv->NF[TYPE_RXPD][TYPE_NOAVG]);
|
||||
|
||||
priv->RSSI[TYPE_RXPD][TYPE_AVG] =
|
||||
CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
|
||||
priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
|
||||
|
||||
lbs_deb_leave(LBS_DEB_RX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function processes received packet and forwards it
|
||||
* to kernel/upper layer
|
||||
|
@ -154,7 +63,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
|
|||
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
|
||||
if (priv->monitormode)
|
||||
if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
|
||||
return process_rxed_802_11_packet(priv, skb);
|
||||
|
||||
p_rx_pd = (struct rxpd *) skb->data;
|
||||
|
@ -225,13 +134,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
|
|||
*/
|
||||
skb_pull(skb, hdrchop);
|
||||
|
||||
/* Take the data rate from the rxpd structure
|
||||
* only if the rate is auto
|
||||
*/
|
||||
if (priv->enablehwauto)
|
||||
priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
|
||||
|
||||
lbs_compute_rssi(priv, p_rx_pd);
|
||||
priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
|
||||
|
||||
lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
|
||||
dev->stats.rx_bytes += skb->len;
|
||||
|
@ -352,20 +255,18 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
|
|||
pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr));
|
||||
memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct rx_radiotap_hdr));
|
||||
|
||||
/* Take the data rate from the rxpd structure
|
||||
* only if the rate is auto
|
||||
*/
|
||||
if (priv->enablehwauto)
|
||||
priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
|
||||
|
||||
lbs_compute_rssi(priv, prxpd);
|
||||
priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
|
||||
|
||||
lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
|
||||
dev->stats.rx_bytes += skb->len;
|
||||
dev->stats.rx_packets++;
|
||||
|
||||
skb->protocol = eth_type_trans(skb, priv->rtap_net_dev);
|
||||
netif_rx(skb);
|
||||
skb->protocol = eth_type_trans(skb, priv->dev);
|
||||
|
||||
if (in_interrupt())
|
||||
netif_rx(skb);
|
||||
else
|
||||
netif_rx_ni(skb);
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +0,0 @@
|
|||
/**
|
||||
* Interface for the wlan network scan routines
|
||||
*
|
||||
* Driver interface functions and type declarations for the scan module
|
||||
* implemented in scan.c.
|
||||
*/
|
||||
#ifndef _LBS_SCAN_H
|
||||
#define _LBS_SCAN_H
|
||||
|
||||
#include <net/iw_handler.h>
|
||||
|
||||
struct lbs_private;
|
||||
|
||||
#define MAX_NETWORK_COUNT 128
|
||||
|
||||
/** Chan-freq-TxPower mapping table*/
|
||||
struct chan_freq_power {
|
||||
/** channel Number */
|
||||
u16 channel;
|
||||
/** frequency of this channel */
|
||||
u32 freq;
|
||||
/** Max allowed Tx power level */
|
||||
u16 maxtxpower;
|
||||
/** TRUE:channel unsupported; FLASE:supported*/
|
||||
u8 unsupported;
|
||||
};
|
||||
|
||||
/** region-band mapping table*/
|
||||
struct region_channel {
|
||||
/** TRUE if this entry is valid */
|
||||
u8 valid;
|
||||
/** region code for US, Japan ... */
|
||||
u8 region;
|
||||
/** band B/G/A, used for BAND_CONFIG cmd */
|
||||
u8 band;
|
||||
/** Actual No. of elements in the array below */
|
||||
u8 nrcfp;
|
||||
/** chan-freq-txpower mapping table*/
|
||||
struct chan_freq_power *CFP;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Maximum number of channels that can be sent in a setuserscan ioctl
|
||||
*/
|
||||
#define LBS_IOCTL_USER_SCAN_CHAN_MAX 50
|
||||
|
||||
int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
|
||||
|
||||
int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
|
||||
|
||||
int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
|
||||
u8 ssid_len);
|
||||
|
||||
int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
|
||||
struct iw_point *dwrq, char *extra);
|
||||
int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
|
||||
union iwreq_data *wrqu, char *extra);
|
||||
|
||||
int lbs_scan_networks(struct lbs_private *priv, int full_scan);
|
||||
|
||||
void lbs_scan_worker(struct work_struct *work);
|
||||
|
||||
#endif
|
|
@ -4,13 +4,13 @@
|
|||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/sched.h>
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "radiotap.h"
|
||||
#include "decl.h"
|
||||
#include "defs.h"
|
||||
#include "dev.h"
|
||||
#include "wext.h"
|
||||
|
||||
/**
|
||||
* @brief This function converts Tx/Rx rates from IEEE80211_RADIOTAP_RATE
|
||||
|
@ -111,7 +111,7 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
p802x_hdr = skb->data;
|
||||
pkt_len = skb->len;
|
||||
|
||||
if (dev == priv->rtap_net_dev) {
|
||||
if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) {
|
||||
struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data;
|
||||
|
||||
/* set txpd fields from the radiotap header */
|
||||
|
@ -147,7 +147,7 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
dev->stats.tx_packets++;
|
||||
dev->stats.tx_bytes += skb->len;
|
||||
|
||||
if (priv->monitormode) {
|
||||
if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) {
|
||||
/* Keep the skb to echo it back once Tx feedback is
|
||||
received from FW */
|
||||
skb_orphan(skb);
|
||||
|
@ -158,6 +158,7 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
free:
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
|
||||
unlock:
|
||||
spin_unlock_irqrestore(&priv->driver_lock, flags);
|
||||
wake_up(&priv->waitq);
|
||||
|
@ -179,7 +180,8 @@ void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count)
|
|||
{
|
||||
struct tx_radiotap_hdr *radiotap_hdr;
|
||||
|
||||
if (!priv->monitormode || priv->currenttxskb == NULL)
|
||||
if (!priv->wdev->iftype == NL80211_IFTYPE_MONITOR ||
|
||||
priv->currenttxskb == NULL)
|
||||
return;
|
||||
|
||||
radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data;
|
||||
|
@ -188,7 +190,7 @@ void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count)
|
|||
(1 + priv->txretrycount - try_count) : 0;
|
||||
|
||||
priv->currenttxskb->protocol = eth_type_trans(priv->currenttxskb,
|
||||
priv->rtap_net_dev);
|
||||
priv->dev);
|
||||
netif_rx(priv->currenttxskb);
|
||||
|
||||
priv->currenttxskb = NULL;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* This file contains definition for IOCTL call.
|
||||
*/
|
||||
#ifndef _LBS_WEXT_H_
|
||||
#define _LBS_WEXT_H_
|
||||
|
||||
void lbs_send_disconnect_notification(struct lbs_private *priv);
|
||||
void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event);
|
||||
|
||||
struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
|
||||
struct lbs_private *priv,
|
||||
u8 band,
|
||||
u16 channel);
|
||||
|
||||
extern struct iw_handler_def lbs_handler_def;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue