提交 0edd5b44 编写于 作者: J Jeff Garzik

[wireless ieee80211,ipw2200] Lindent source code

No code changes, just Lindent + manual fixups.

This prepares us for updating to the latest Intel driver code, plus
gives the source code a nice facelift.
上级 bbeec90b
此差异已折叠。
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
/* Authentication and Association States */ /* Authentication and Association States */
enum connection_manager_assoc_states enum connection_manager_assoc_states {
{
CMAS_INIT = 0, CMAS_INIT = 0,
CMAS_TX_AUTH_SEQ_1, CMAS_TX_AUTH_SEQ_1,
CMAS_RX_AUTH_SEQ_2, CMAS_RX_AUTH_SEQ_2,
...@@ -74,7 +73,6 @@ enum connection_manager_assoc_states ...@@ -74,7 +73,6 @@ enum connection_manager_assoc_states
CMAS_LAST CMAS_LAST
}; };
#define IPW_WAIT (1<<0) #define IPW_WAIT (1<<0)
#define IPW_QUIET (1<<1) #define IPW_QUIET (1<<1)
#define IPW_ROAMING (1<<2) #define IPW_ROAMING (1<<2)
...@@ -190,7 +188,6 @@ enum connection_manager_assoc_states ...@@ -190,7 +188,6 @@ enum connection_manager_assoc_states
#define DCT_FLAG_EXT_MODE_CCK 0x01 #define DCT_FLAG_EXT_MODE_CCK 0x01
#define DCT_FLAG_EXT_MODE_OFDM 0x00 #define DCT_FLAG_EXT_MODE_OFDM 0x00
#define TX_RX_TYPE_MASK 0xFF #define TX_RX_TYPE_MASK 0xFF
#define TX_FRAME_TYPE 0x00 #define TX_FRAME_TYPE 0x00
#define TX_HOST_COMMAND_TYPE 0x01 #define TX_HOST_COMMAND_TYPE 0x01
...@@ -252,92 +249,82 @@ struct clx2_queue { ...@@ -252,92 +249,82 @@ struct clx2_queue {
int high_mark; /**< high watermark, stop queue if free space less than this */ int high_mark; /**< high watermark, stop queue if free space less than this */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct machdr32 struct machdr32 {
{
u16 frame_ctl; u16 frame_ctl;
u16 duration; // watch out for endians! u16 duration; // watch out for endians!
u8 addr1[ MACADRR_BYTE_LEN ]; u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[ MACADRR_BYTE_LEN ]; u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[ MACADRR_BYTE_LEN ]; u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians! u16 seq_ctrl; // more endians!
u8 addr4[ MACADRR_BYTE_LEN ]; u8 addr4[MACADRR_BYTE_LEN];
u16 qos_ctrl; u16 qos_ctrl;
} __attribute__ ((packed)) ; } __attribute__ ((packed));
struct machdr30 struct machdr30 {
{
u16 frame_ctl; u16 frame_ctl;
u16 duration; // watch out for endians! u16 duration; // watch out for endians!
u8 addr1[ MACADRR_BYTE_LEN ]; u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[ MACADRR_BYTE_LEN ]; u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[ MACADRR_BYTE_LEN ]; u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians! u16 seq_ctrl; // more endians!
u8 addr4[ MACADRR_BYTE_LEN ]; u8 addr4[MACADRR_BYTE_LEN];
} __attribute__ ((packed)) ; } __attribute__ ((packed));
struct machdr26 struct machdr26 {
{
u16 frame_ctl; u16 frame_ctl;
u16 duration; // watch out for endians! u16 duration; // watch out for endians!
u8 addr1[ MACADRR_BYTE_LEN ]; u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[ MACADRR_BYTE_LEN ]; u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[ MACADRR_BYTE_LEN ]; u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians! u16 seq_ctrl; // more endians!
u16 qos_ctrl; u16 qos_ctrl;
} __attribute__ ((packed)) ; } __attribute__ ((packed));
struct machdr24 struct machdr24 {
{
u16 frame_ctl; u16 frame_ctl;
u16 duration; // watch out for endians! u16 duration; // watch out for endians!
u8 addr1[ MACADRR_BYTE_LEN ]; u8 addr1[MACADRR_BYTE_LEN];
u8 addr2[ MACADRR_BYTE_LEN ]; u8 addr2[MACADRR_BYTE_LEN];
u8 addr3[ MACADRR_BYTE_LEN ]; u8 addr3[MACADRR_BYTE_LEN];
u16 seq_ctrl; // more endians! u16 seq_ctrl; // more endians!
} __attribute__ ((packed)) ; } __attribute__ ((packed));
// TX TFD with 32 byte MAC Header // TX TFD with 32 byte MAC Header
struct tx_tfd_32 struct tx_tfd_32 {
{
struct machdr32 mchdr; // 32 struct machdr32 mchdr; // 32
u32 uivplaceholder[2]; // 8 u32 uivplaceholder[2]; // 8
} __attribute__ ((packed)) ; } __attribute__ ((packed));
// TX TFD with 30 byte MAC Header // TX TFD with 30 byte MAC Header
struct tx_tfd_30 struct tx_tfd_30 {
{
struct machdr30 mchdr; // 30 struct machdr30 mchdr; // 30
u8 reserved[2]; // 2 u8 reserved[2]; // 2
u32 uivplaceholder[2]; // 8 u32 uivplaceholder[2]; // 8
} __attribute__ ((packed)) ; } __attribute__ ((packed));
// tx tfd with 26 byte mac header // tx tfd with 26 byte mac header
struct tx_tfd_26 struct tx_tfd_26 {
{
struct machdr26 mchdr; // 26 struct machdr26 mchdr; // 26
u8 reserved1[2]; // 2 u8 reserved1[2]; // 2
u32 uivplaceholder[2]; // 8 u32 uivplaceholder[2]; // 8
u8 reserved2[4]; // 4 u8 reserved2[4]; // 4
} __attribute__ ((packed)) ; } __attribute__ ((packed));
// tx tfd with 24 byte mac header // tx tfd with 24 byte mac header
struct tx_tfd_24 struct tx_tfd_24 {
{
struct machdr24 mchdr; // 24 struct machdr24 mchdr; // 24
u32 uivplaceholder[2]; // 8 u32 uivplaceholder[2]; // 8
u8 reserved[8]; // 8 u8 reserved[8]; // 8
} __attribute__ ((packed)) ; } __attribute__ ((packed));
#define DCT_WEP_KEY_FIELD_LENGTH 16 #define DCT_WEP_KEY_FIELD_LENGTH 16
struct tfd_command struct tfd_command {
{
u8 index; u8 index;
u8 length; u8 length;
u16 reserved; u16 reserved;
u8 payload[0]; u8 payload[0];
} __attribute__ ((packed)) ; } __attribute__ ((packed));
struct tfd_data { struct tfd_data {
/* Header */ /* Header */
...@@ -365,8 +352,7 @@ struct tfd_data { ...@@ -365,8 +352,7 @@ struct tfd_data {
u8 reserved3; u8 reserved3;
/* 802.11 MAC Header */ /* 802.11 MAC Header */
union union {
{
struct tx_tfd_24 tfd_24; struct tx_tfd_24 tfd_24;
struct tx_tfd_26 tfd_26; struct tx_tfd_26 tfd_26;
struct tx_tfd_30 tfd_30; struct tx_tfd_30 tfd_30;
...@@ -379,8 +365,7 @@ struct tfd_data { ...@@ -379,8 +365,7 @@ struct tfd_data {
u16 chunk_len[NUM_TFD_CHUNKS]; u16 chunk_len[NUM_TFD_CHUNKS];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct txrx_control_flags struct txrx_control_flags {
{
u8 message_type; u8 message_type;
u8 rx_seq_num; u8 rx_seq_num;
u8 control_bits; u8 control_bits;
...@@ -390,17 +375,16 @@ struct txrx_control_flags ...@@ -390,17 +375,16 @@ struct txrx_control_flags
#define TFD_SIZE 128 #define TFD_SIZE 128
#define TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH (TFD_SIZE - sizeof(struct txrx_control_flags)) #define TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH (TFD_SIZE - sizeof(struct txrx_control_flags))
struct tfd_frame struct tfd_frame {
{
struct txrx_control_flags control_flags; struct txrx_control_flags control_flags;
union { union {
struct tfd_data data; struct tfd_data data;
struct tfd_command cmd; struct tfd_command cmd;
u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH];
} u; } u;
} __attribute__ ((packed)) ; } __attribute__ ((packed));
typedef void destructor_func(const void*); typedef void destructor_func(const void *);
/** /**
* Tx Queue for DMA. Queue consists of circular buffer of * Tx Queue for DMA. Queue consists of circular buffer of
...@@ -408,7 +392,7 @@ typedef void destructor_func(const void*); ...@@ -408,7 +392,7 @@ typedef void destructor_func(const void*);
*/ */
struct clx2_tx_queue { struct clx2_tx_queue {
struct clx2_queue q; struct clx2_queue q;
struct tfd_frame* bd; struct tfd_frame *bd;
struct ieee80211_txb **txb; struct ieee80211_txb **txb;
}; };
...@@ -423,8 +407,7 @@ struct clx2_tx_queue { ...@@ -423,8 +407,7 @@ struct clx2_tx_queue {
#define SUP_RATE_11G_MAX_NUM_CHANNELS (12) #define SUP_RATE_11G_MAX_NUM_CHANNELS (12)
// Used for passing to driver number of successes and failures per rate // Used for passing to driver number of successes and failures per rate
struct rate_histogram struct rate_histogram {
{
union { union {
u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
...@@ -571,8 +554,7 @@ struct ipw_rx_header { ...@@ -571,8 +554,7 @@ struct ipw_rx_header {
u8 reserved; u8 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_rx_packet struct ipw_rx_packet {
{
struct ipw_rx_header header; struct ipw_rx_header header;
union { union {
struct ipw_rx_frame frame; struct ipw_rx_frame frame;
...@@ -597,14 +579,13 @@ struct ipw_rx_queue { ...@@ -597,14 +579,13 @@ struct ipw_rx_queue {
u32 processed; /* Internal index to last handled Rx packet */ u32 processed; /* Internal index to last handled Rx packet */
u32 read; /* Shared index to newest available Rx buffer */ u32 read; /* Shared index to newest available Rx buffer */
u32 write; /* Shared index to oldest written Rx packet */ u32 write; /* Shared index to oldest written Rx packet */
u32 free_count;/* Number of pre-allocated buffers in rx_free */ u32 free_count; /* Number of pre-allocated buffers in rx_free */
/* Each of these lists is used as a FIFO for ipw_rx_mem_buffers */ /* Each of these lists is used as a FIFO for ipw_rx_mem_buffers */
struct list_head rx_free; /* Own an SKBs */ struct list_head rx_free; /* Own an SKBs */
struct list_head rx_used; /* No SKB allocated */ struct list_head rx_used; /* No SKB allocated */
spinlock_t lock; spinlock_t lock;
}; /* Not transferred over network, so not __attribute__ ((packed)) */ }; /* Not transferred over network, so not __attribute__ ((packed)) */
struct alive_command_responce { struct alive_command_responce {
u8 alive_command; u8 alive_command;
u8 sequence_number; u8 sequence_number;
...@@ -627,8 +608,7 @@ struct ipw_rates { ...@@ -627,8 +608,7 @@ struct ipw_rates {
u8 rates[IPW_MAX_RATES]; u8 rates[IPW_MAX_RATES];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct command_block struct command_block {
{
unsigned int control; unsigned int control;
u32 source_addr; u32 source_addr;
u32 dest_addr; u32 dest_addr;
...@@ -636,18 +616,16 @@ struct command_block ...@@ -636,18 +616,16 @@ struct command_block
} __attribute__ ((packed)); } __attribute__ ((packed));
#define CB_NUMBER_OF_ELEMENTS_SMALL 64 #define CB_NUMBER_OF_ELEMENTS_SMALL 64
struct fw_image_desc struct fw_image_desc {
{
unsigned long last_cb_index; unsigned long last_cb_index;
unsigned long current_cb_index; unsigned long current_cb_index;
struct command_block cb_list[CB_NUMBER_OF_ELEMENTS_SMALL]; struct command_block cb_list[CB_NUMBER_OF_ELEMENTS_SMALL];
void * v_addr; void *v_addr;
unsigned long p_addr; unsigned long p_addr;
unsigned long len; unsigned long len;
}; };
struct ipw_sys_config struct ipw_sys_config {
{
u8 bt_coexistence; u8 bt_coexistence;
u8 reserved1; u8 reserved1;
u8 answer_broadcast_ssid_probe; u8 answer_broadcast_ssid_probe;
...@@ -670,8 +648,7 @@ struct ipw_sys_config ...@@ -670,8 +648,7 @@ struct ipw_sys_config
u8 reserved3; u8 reserved3;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_multicast_addr struct ipw_multicast_addr {
{
u8 num_of_multicast_addresses; u8 num_of_multicast_addresses;
u8 reserved[3]; u8 reserved[3];
u8 mac1[6]; u8 mac1[6];
...@@ -680,8 +657,7 @@ struct ipw_multicast_addr ...@@ -680,8 +657,7 @@ struct ipw_multicast_addr
u8 mac4[6]; u8 mac4[6];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_wep_key struct ipw_wep_key {
{
u8 cmd_id; u8 cmd_id;
u8 seq_num; u8 seq_num;
u8 key_index; u8 key_index;
...@@ -689,8 +665,7 @@ struct ipw_wep_key ...@@ -689,8 +665,7 @@ struct ipw_wep_key
u8 key[16]; u8 key[16];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_tgi_tx_key struct ipw_tgi_tx_key {
{
u8 key_id; u8 key_id;
u8 security_type; u8 security_type;
u8 station_index; u8 station_index;
...@@ -701,8 +676,7 @@ struct ipw_tgi_tx_key ...@@ -701,8 +676,7 @@ struct ipw_tgi_tx_key
#define IPW_SCAN_CHANNELS 54 #define IPW_SCAN_CHANNELS 54
struct ipw_scan_request struct ipw_scan_request {
{
u8 scan_type; u8 scan_type;
u16 dwell_time; u16 dwell_time;
u8 channels_list[IPW_SCAN_CHANNELS]; u8 channels_list[IPW_SCAN_CHANNELS];
...@@ -718,8 +692,7 @@ enum { ...@@ -718,8 +692,7 @@ enum {
IPW_SCAN_TYPES IPW_SCAN_TYPES
}; };
struct ipw_scan_request_ext struct ipw_scan_request_ext {
{
u32 full_scan_index; u32 full_scan_index;
u8 channels_list[IPW_SCAN_CHANNELS]; u8 channels_list[IPW_SCAN_CHANNELS];
u8 scan_type[IPW_SCAN_CHANNELS / 2]; u8 scan_type[IPW_SCAN_CHANNELS / 2];
...@@ -740,19 +713,16 @@ extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, ...@@ -740,19 +713,16 @@ extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan,
{ {
if (index % 2) if (index % 2)
scan->scan_type[index / 2] = scan->scan_type[index / 2] =
(scan->scan_type[index / 2] & 0xF0) | (scan->scan_type[index / 2] & 0xF0) | (scan_type & 0x0F);
(scan_type & 0x0F);
else else
scan->scan_type[index / 2] = scan->scan_type[index / 2] =
(scan->scan_type[index / 2] & 0x0F) | (scan->scan_type[index / 2] & 0x0F) |
((scan_type & 0x0F) << 4); ((scan_type & 0x0F) << 4);
} }
struct ipw_associate struct ipw_associate {
{
u8 channel; u8 channel;
u8 auth_type:4, u8 auth_type:4, auth_key:4;
auth_key:4;
u8 assoc_type; u8 assoc_type;
u8 reserved; u8 reserved;
u16 policy_support; u16 policy_support;
...@@ -771,8 +741,7 @@ struct ipw_associate ...@@ -771,8 +741,7 @@ struct ipw_associate
u16 reserved2; u16 reserved2;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_supported_rates struct ipw_supported_rates {
{
u8 ieee_mode; u8 ieee_mode;
u8 num_rates; u8 num_rates;
u8 purpose; u8 purpose;
...@@ -780,42 +749,36 @@ struct ipw_supported_rates ...@@ -780,42 +749,36 @@ struct ipw_supported_rates
u8 supported_rates[IPW_MAX_RATES]; u8 supported_rates[IPW_MAX_RATES];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_rts_threshold struct ipw_rts_threshold {
{
u16 rts_threshold; u16 rts_threshold;
u16 reserved; u16 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_frag_threshold struct ipw_frag_threshold {
{
u16 frag_threshold; u16 frag_threshold;
u16 reserved; u16 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_retry_limit struct ipw_retry_limit {
{
u8 short_retry_limit; u8 short_retry_limit;
u8 long_retry_limit; u8 long_retry_limit;
u16 reserved; u16 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_dino_config struct ipw_dino_config {
{
u32 dino_config_addr; u32 dino_config_addr;
u16 dino_config_size; u16 dino_config_size;
u8 dino_response; u8 dino_response;
u8 reserved; u8 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_aironet_info struct ipw_aironet_info {
{
u8 id; u8 id;
u8 length; u8 length;
u16 reserved; u16 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_rx_key struct ipw_rx_key {
{
u8 station_index; u8 station_index;
u8 key_type; u8 key_type;
u8 key_id; u8 key_id;
...@@ -826,23 +789,20 @@ struct ipw_rx_key ...@@ -826,23 +789,20 @@ struct ipw_rx_key
u8 reserved; u8 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_country_channel_info struct ipw_country_channel_info {
{
u8 first_channel; u8 first_channel;
u8 no_channels; u8 no_channels;
s8 max_tx_power; s8 max_tx_power;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_country_info struct ipw_country_info {
{
u8 id; u8 id;
u8 length; u8 length;
u8 country_str[3]; u8 country_str[3];
struct ipw_country_channel_info groups[7]; struct ipw_country_channel_info groups[7];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_channel_tx_power struct ipw_channel_tx_power {
{
u8 channel_number; u8 channel_number;
s8 tx_power; s8 tx_power;
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -852,15 +812,13 @@ struct ipw_channel_tx_power ...@@ -852,15 +812,13 @@ struct ipw_channel_tx_power
#define MAX_A_CHANNELS 37 #define MAX_A_CHANNELS 37
#define MAX_B_CHANNELS 14 #define MAX_B_CHANNELS 14
struct ipw_tx_power struct ipw_tx_power {
{
u8 num_channels; u8 num_channels;
u8 ieee_mode; u8 ieee_mode;
struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_qos_parameters struct ipw_qos_parameters {
{
u16 cw_min[4]; u16 cw_min[4];
u16 cw_max[4]; u16 cw_max[4];
u8 aifs[4]; u8 aifs[4];
...@@ -868,15 +826,13 @@ struct ipw_qos_parameters ...@@ -868,15 +826,13 @@ struct ipw_qos_parameters
u16 tx_op_limit[4]; u16 tx_op_limit[4];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_rsn_capabilities struct ipw_rsn_capabilities {
{
u8 id; u8 id;
u8 length; u8 length;
u16 version; u16 version;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ipw_sensitivity_calib struct ipw_sensitivity_calib {
{
u16 beacon_rssi_raw; u16 beacon_rssi_raw;
u16 reserved; u16 reserved;
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -896,8 +852,9 @@ struct ipw_sensitivity_calib ...@@ -896,8 +852,9 @@ struct ipw_sensitivity_calib
*/ */
struct ipw_cmd { struct ipw_cmd {
u32 cmd; /**< Host command */ u32 cmd; /**< Host command */
u32 status; /**< Status */ u32 status;/**< Status */
u32 status_len; /**< How many 32 bit parameters in the status */ u32 status_len;
/**< How many 32 bit parameters in the status */
u32 len; /**< incoming parameters length, bytes */ u32 len; /**< incoming parameters length, bytes */
/** /**
* command parameters. * command parameters.
...@@ -1022,7 +979,7 @@ struct ipw_priv { ...@@ -1022,7 +979,7 @@ struct ipw_priv {
struct ipw_rates extended; /**< use for corresp. IE, AP only */ struct ipw_rates extended; /**< use for corresp. IE, AP only */
struct notif_link_deterioration last_link_deterioration; /** for statistics */ struct notif_link_deterioration last_link_deterioration; /** for statistics */
struct ipw_cmd* hcmd; /**< host command currently executed */ struct ipw_cmd *hcmd; /**< host command currently executed */
wait_queue_head_t hcmd_wq; /**< host command waits for execution */ wait_queue_head_t hcmd_wq; /**< host command waits for execution */
u32 tsf_bcn[2]; /**< TSF from latest beacon */ u32 tsf_bcn[2]; /**< TSF from latest beacon */
...@@ -1091,7 +1048,6 @@ struct ipw_priv { ...@@ -1091,7 +1048,6 @@ struct ipw_priv {
struct tasklet_struct irq_tasklet; struct tasklet_struct irq_tasklet;
#define IPW_2200BG 1 #define IPW_2200BG 1
#define IPW_2915ABG 2 #define IPW_2915ABG 2
u8 adapter; u8 adapter;
...@@ -1114,7 +1070,6 @@ struct ipw_priv { ...@@ -1114,7 +1070,6 @@ struct ipw_priv {
u32 indirect_byte; u32 indirect_byte;
}; /*ipw_priv */ }; /*ipw_priv */
/* debug macros */ /* debug macros */
#ifdef CONFIG_IPW_DEBUG #ifdef CONFIG_IPW_DEBUG
...@@ -1170,7 +1125,6 @@ do { if (ipw_debug_level & (level)) \ ...@@ -1170,7 +1125,6 @@ do { if (ipw_debug_level & (level)) \
#define IPW_DL_RF_KILL (1<<17) #define IPW_DL_RF_KILL (1<<17)
#define IPW_DL_FW_ERRORS (1<<18) #define IPW_DL_FW_ERRORS (1<<18)
#define IPW_DL_ORD (1<<20) #define IPW_DL_ORD (1<<20)
#define IPW_DL_FRAG (1<<21) #define IPW_DL_FRAG (1<<21)
...@@ -1184,7 +1138,6 @@ do { if (ipw_debug_level & (level)) \ ...@@ -1184,7 +1138,6 @@ do { if (ipw_debug_level & (level)) \
#define IPW_DL_STATS (1<<29) #define IPW_DL_STATS (1<<29)
#define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) #define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
#define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) #define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
#define IPW_DEBUG_INFO(f, a...) IPW_DEBUG(IPW_DL_INFO, f, ## a) #define IPW_DEBUG_INFO(f, a...) IPW_DEBUG(IPW_DL_INFO, f, ## a)
...@@ -1289,14 +1242,12 @@ do { if (ipw_debug_level & (level)) \ ...@@ -1289,14 +1242,12 @@ do { if (ipw_debug_level & (level)) \
#define CB_SRC_SIZE_LONG 0x00200000 #define CB_SRC_SIZE_LONG 0x00200000
#define CB_DEST_SIZE_LONG 0x00020000 #define CB_DEST_SIZE_LONG 0x00020000
/* DMA DEFINES */ /* DMA DEFINES */
#define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000 #define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000
#define DMA_CB_STOP_AND_ABORT 0x00000C00 #define DMA_CB_STOP_AND_ABORT 0x00000C00
#define DMA_CB_START 0x00000100 #define DMA_CB_START 0x00000100
#define CX2_SHARED_SRAM_SIZE 0x00030000 #define CX2_SHARED_SRAM_SIZE 0x00030000
#define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000 #define CX2_SHARED_SRAM_DMA_CONTROL 0x00027000
#define CB_MAX_LENGTH 0x1FFF #define CB_MAX_LENGTH 0x1FFF
...@@ -1304,7 +1255,6 @@ do { if (ipw_debug_level & (level)) \ ...@@ -1304,7 +1255,6 @@ do { if (ipw_debug_level & (level)) \
#define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 #define CX2_HOST_EEPROM_DATA_SRAM_SIZE 0xA18
#define CX2_EEPROM_IMAGE_SIZE 0x100 #define CX2_EEPROM_IMAGE_SIZE 0x100
/* DMA defs */ /* DMA defs */
#define CX2_DMA_I_CURRENT_CB 0x003000D0 #define CX2_DMA_I_CURRENT_CB 0x003000D0
#define CX2_DMA_O_CURRENT_CB 0x003000D4 #define CX2_DMA_O_CURRENT_CB 0x003000D4
...@@ -1356,7 +1306,6 @@ do { if (ipw_debug_level & (level)) \ ...@@ -1356,7 +1306,6 @@ do { if (ipw_debug_level & (level)) \
#define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14) #define IPW_WHO_IS_AWAKE (CX2_SHARED_LOWER_BOUND + 0xB14)
#define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18) #define IPW_DURING_ATIM_WINDOW (CX2_SHARED_LOWER_BOUND + 0xB18)
#define MSB 1 #define MSB 1
#define LSB 0 #define LSB 0
#define WORD_TO_BYTE(_word) ((_word) * sizeof(u16)) #define WORD_TO_BYTE(_word) ((_word) * sizeof(u16))
...@@ -1479,7 +1428,6 @@ enum { ...@@ -1479,7 +1428,6 @@ enum {
#define IPW_RATE_CAPABILITIES 1 #define IPW_RATE_CAPABILITIES 1
#define IPW_RATE_CONNECT 0 #define IPW_RATE_CONNECT 0
/* /*
* Rate values and masks * Rate values and masks
*/ */
...@@ -1524,12 +1472,6 @@ enum { ...@@ -1524,12 +1472,6 @@ enum {
IPW_ORD_STAT_TX_DIR_DATA_B_11, IPW_ORD_STAT_TX_DIR_DATA_B_11,
/* Hole */ /* Hole */
IPW_ORD_STAT_TX_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 19, IPW_ORD_STAT_TX_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 19,
IPW_ORD_STAT_TX_DIR_DATA_G_2, IPW_ORD_STAT_TX_DIR_DATA_G_2,
IPW_ORD_STAT_TX_DIR_DATA_G_5_5, IPW_ORD_STAT_TX_DIR_DATA_G_5_5,
...@@ -1549,12 +1491,6 @@ enum { ...@@ -1549,12 +1491,6 @@ enum {
IPW_ORD_STAT_TX_NON_DIR_DATA_B_11, IPW_ORD_STAT_TX_NON_DIR_DATA_B_11,
/* Hole */ /* Hole */
IPW_ORD_STAT_TX_NON_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 44, IPW_ORD_STAT_TX_NON_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 44,
IPW_ORD_STAT_TX_NON_DIR_DATA_G_2, IPW_ORD_STAT_TX_NON_DIR_DATA_G_2,
IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5, IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5,
...@@ -1685,7 +1621,7 @@ struct host_cmd { ...@@ -1685,7 +1621,7 @@ struct host_cmd {
#define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08
#define CFG_BT_COEXISTENCE_OOB 0x10 #define CFG_BT_COEXISTENCE_OOB 0x10
#define CFG_BT_COEXISTENCE_MAX 0xFF #define CFG_BT_COEXISTENCE_MAX 0xFF
#define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM*/ #define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM */
#define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0
#define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1
......
...@@ -30,7 +30,6 @@ struct ieee80211_crypto_alg { ...@@ -30,7 +30,6 @@ struct ieee80211_crypto_alg {
struct ieee80211_crypto_ops *ops; struct ieee80211_crypto_ops *ops;
}; };
struct ieee80211_crypto { struct ieee80211_crypto {
struct list_head algs; struct list_head algs;
spinlock_t lock; spinlock_t lock;
...@@ -38,8 +37,7 @@ struct ieee80211_crypto { ...@@ -38,8 +37,7 @@ struct ieee80211_crypto {
static struct ieee80211_crypto *hcrypt; static struct ieee80211_crypto *hcrypt;
void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force)
int force)
{ {
struct list_head *ptr, *n; struct list_head *ptr, *n;
struct ieee80211_crypt_data *entry; struct ieee80211_crypt_data *entry;
...@@ -140,7 +138,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) ...@@ -140,7 +138,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
spin_lock_irqsave(&hcrypt->lock, flags); spin_lock_irqsave(&hcrypt->lock, flags);
for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) {
struct ieee80211_crypto_alg *alg = struct ieee80211_crypto_alg *alg =
(struct ieee80211_crypto_alg *) ptr; (struct ieee80211_crypto_alg *)ptr;
if (alg->ops == ops) { if (alg->ops == ops) {
list_del(&alg->list); list_del(&alg->list);
del_alg = alg; del_alg = alg;
...@@ -158,8 +156,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) ...@@ -158,8 +156,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
return del_alg ? 0 : -1; return del_alg ? 0 : -1;
} }
struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name)
struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
{ {
unsigned long flags; unsigned long flags;
struct list_head *ptr; struct list_head *ptr;
...@@ -171,7 +168,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) ...@@ -171,7 +168,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
spin_lock_irqsave(&hcrypt->lock, flags); spin_lock_irqsave(&hcrypt->lock, flags);
for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) {
struct ieee80211_crypto_alg *alg = struct ieee80211_crypto_alg *alg =
(struct ieee80211_crypto_alg *) ptr; (struct ieee80211_crypto_alg *)ptr;
if (strcmp(alg->ops->name, name) == 0) { if (strcmp(alg->ops->name, name) == 0) {
found_alg = alg; found_alg = alg;
break; break;
...@@ -185,9 +182,13 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) ...@@ -185,9 +182,13 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
return NULL; return NULL;
} }
static void *ieee80211_crypt_null_init(int keyidx)
static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } {
static void ieee80211_crypt_null_deinit(void *priv) {} return (void *)1;
}
static void ieee80211_crypt_null_deinit(void *priv)
{
}
static struct ieee80211_crypto_ops ieee80211_crypt_null = { static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL", .name = "NULL",
...@@ -204,7 +205,6 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { ...@@ -204,7 +205,6 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_init(void) static int __init ieee80211_crypto_init(void)
{ {
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -222,11 +222,10 @@ static int __init ieee80211_crypto_init(void) ...@@ -222,11 +222,10 @@ static int __init ieee80211_crypto_init(void)
kfree(hcrypt); kfree(hcrypt);
hcrypt = NULL; hcrypt = NULL;
} }
out: out:
return ret; return ret;
} }
static void __exit ieee80211_crypto_deinit(void) static void __exit ieee80211_crypto_deinit(void)
{ {
struct list_head *ptr, *n; struct list_head *ptr, *n;
...@@ -237,7 +236,7 @@ static void __exit ieee80211_crypto_deinit(void) ...@@ -237,7 +236,7 @@ static void __exit ieee80211_crypto_deinit(void)
for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs;
ptr = n, n = ptr->next) { ptr = n, n = ptr->next) {
struct ieee80211_crypto_alg *alg = struct ieee80211_crypto_alg *alg =
(struct ieee80211_crypto_alg *) ptr; (struct ieee80211_crypto_alg *)ptr;
list_del(ptr); list_del(ptr);
printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm "
"'%s' (deinit)\n", alg->ops->name); "'%s' (deinit)\n", alg->ops->name);
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
...@@ -75,7 +74,7 @@ static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, ...@@ -75,7 +74,7 @@ static void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
} }
static void * ieee80211_ccmp_init(int key_idx) static void *ieee80211_ccmp_init(int key_idx)
{ {
struct ieee80211_ccmp_data *priv; struct ieee80211_ccmp_data *priv;
...@@ -94,7 +93,7 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -94,7 +93,7 @@ static void * ieee80211_ccmp_init(int key_idx)
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm) if (priv->tfm)
crypto_free_tfm(priv->tfm); crypto_free_tfm(priv->tfm);
...@@ -104,7 +103,6 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -104,7 +103,6 @@ static void * ieee80211_ccmp_init(int key_idx)
return NULL; return NULL;
} }
static void ieee80211_ccmp_deinit(void *priv) static void ieee80211_ccmp_deinit(void *priv)
{ {
struct ieee80211_ccmp_data *_priv = priv; struct ieee80211_ccmp_data *_priv = priv;
...@@ -113,19 +111,16 @@ static void ieee80211_ccmp_deinit(void *priv) ...@@ -113,19 +111,16 @@ static void ieee80211_ccmp_deinit(void *priv)
kfree(priv); kfree(priv);
} }
static inline void xor_block(u8 * b, u8 * a, size_t len)
static inline void xor_block(u8 *b, u8 *a, size_t len)
{ {
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
b[i] ^= a[i]; b[i] ^= a[i];
} }
static void ccmp_init_blocks(struct crypto_tfm *tfm, static void ccmp_init_blocks(struct crypto_tfm *tfm,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth, u8 * pn, size_t dlen, u8 * b0, u8 * auth, u8 * s0)
u8 *s0)
{ {
u8 *pos, qc = 0; u8 *pos, qc = 0;
size_t aad_len; size_t aad_len;
...@@ -142,7 +137,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -142,7 +137,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
if (a4_included) if (a4_included)
aad_len += 6; aad_len += 6;
if (qc_included) { if (qc_included) {
pos = (u8 *) &hdr->addr4; pos = (u8 *) & hdr->addr4;
if (a4_included) if (a4_included)
pos += 6; pos += 6;
qc = *pos & 0x0f; qc = *pos & 0x0f;
...@@ -174,7 +169,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -174,7 +169,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
aad[2] = pos[0] & 0x8f; aad[2] = pos[0] & 0x8f;
aad[3] = pos[1] & 0xc7; aad[3] = pos[1] & 0xc7;
memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN);
pos = (u8 *) &hdr->seq_ctl; pos = (u8 *) & hdr->seq_ctl;
aad[22] = pos[0] & 0x0f; aad[22] = pos[0] & 0x0f;
aad[23] = 0; /* all bits masked */ aad[23] = 0; /* all bits masked */
memset(aad + 24, 0, 8); memset(aad + 24, 0, 8);
...@@ -196,7 +191,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, ...@@ -196,7 +191,6 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
ieee80211_ccmp_aes_encrypt(tfm, b0, s0); ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
} }
static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct ieee80211_ccmp_data *key = priv; struct ieee80211_ccmp_data *key = priv;
...@@ -209,8 +203,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -209,8 +203,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
u8 *s0 = key->tx_s0; u8 *s0 = key->tx_s0;
if (skb_headroom(skb) < CCMP_HDR_LEN || if (skb_headroom(skb) < CCMP_HDR_LEN ||
skb_tailroom(skb) < CCMP_MIC_LEN || skb_tailroom(skb) < CCMP_MIC_LEN || skb->len < hdr_len)
skb->len < hdr_len)
return -1; return -1;
data_len = skb->len - hdr_len; data_len = skb->len - hdr_len;
...@@ -230,13 +223,13 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -230,13 +223,13 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
*pos++ = key->tx_pn[5]; *pos++ = key->tx_pn[5];
*pos++ = key->tx_pn[4]; *pos++ = key->tx_pn[4];
*pos++ = 0; *pos++ = 0;
*pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */ ;
*pos++ = key->tx_pn[3]; *pos++ = key->tx_pn[3];
*pos++ = key->tx_pn[2]; *pos++ = key->tx_pn[2];
*pos++ = key->tx_pn[1]; *pos++ = key->tx_pn[1];
*pos++ = key->tx_pn[0]; *pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
...@@ -261,7 +254,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -261,7 +254,6 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
return 0; return 0;
} }
static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
struct ieee80211_ccmp_data *key = priv; struct ieee80211_ccmp_data *key = priv;
...@@ -280,7 +272,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -280,7 +272,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return -1; return -1;
} }
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
pos = skb->data + hdr_len; pos = skb->data + hdr_len;
keyidx = pos[3]; keyidx = pos[3];
if (!(keyidx & (1 << 5))) { if (!(keyidx & (1 << 5))) {
...@@ -364,8 +356,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -364,8 +356,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return keyidx; return keyidx;
} }
static int ieee80211_ccmp_set_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_ccmp_data *data = priv; struct ieee80211_ccmp_data *data = priv;
int keyidx; int keyidx;
...@@ -395,8 +386,7 @@ static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -395,8 +386,7 @@ static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
return 0; return 0;
} }
static int ieee80211_ccmp_get_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_ccmp_data *data = priv; struct ieee80211_ccmp_data *data = priv;
...@@ -419,8 +409,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) ...@@ -419,8 +409,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
return CCMP_TK_LEN; return CCMP_TK_LEN;
} }
static char *ieee80211_ccmp_print_stats(char *p, void *priv)
static char * ieee80211_ccmp_print_stats(char *p, void *priv)
{ {
struct ieee80211_ccmp_data *ccmp = priv; struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d " p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
...@@ -436,7 +425,6 @@ static char * ieee80211_ccmp_print_stats(char *p, void *priv) ...@@ -436,7 +425,6 @@ static char * ieee80211_ccmp_print_stats(char *p, void *priv)
return p; return p;
} }
static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.name = "CCMP", .name = "CCMP",
.init = ieee80211_ccmp_init, .init = ieee80211_ccmp_init,
...@@ -453,18 +441,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { ...@@ -453,18 +441,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_ccmp_init(void) static int __init ieee80211_crypto_ccmp_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
} }
static void __exit ieee80211_crypto_ccmp_exit(void) static void __exit ieee80211_crypto_ccmp_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
} }
module_init(ieee80211_crypto_ccmp_init); module_init(ieee80211_crypto_ccmp_init);
module_exit(ieee80211_crypto_ccmp_exit); module_exit(ieee80211_crypto_ccmp_exit);
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include <linux/crc32.h> #include <linux/crc32.h>
...@@ -62,7 +61,7 @@ struct ieee80211_tkip_data { ...@@ -62,7 +61,7 @@ struct ieee80211_tkip_data {
u8 rx_hdr[16], tx_hdr[16]; u8 rx_hdr[16], tx_hdr[16];
}; };
static void * ieee80211_tkip_init(int key_idx) static void *ieee80211_tkip_init(int key_idx)
{ {
struct ieee80211_tkip_data *priv; struct ieee80211_tkip_data *priv;
...@@ -88,7 +87,7 @@ static void * ieee80211_tkip_init(int key_idx) ...@@ -88,7 +87,7 @@ static void * ieee80211_tkip_init(int key_idx)
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm_michael) if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael); crypto_free_tfm(priv->tfm_michael);
...@@ -100,7 +99,6 @@ static void * ieee80211_tkip_init(int key_idx) ...@@ -100,7 +99,6 @@ static void * ieee80211_tkip_init(int key_idx)
return NULL; return NULL;
} }
static void ieee80211_tkip_deinit(void *priv) static void ieee80211_tkip_deinit(void *priv)
{ {
struct ieee80211_tkip_data *_priv = priv; struct ieee80211_tkip_data *_priv = priv;
...@@ -111,51 +109,42 @@ static void ieee80211_tkip_deinit(void *priv) ...@@ -111,51 +109,42 @@ static void ieee80211_tkip_deinit(void *priv)
kfree(priv); kfree(priv);
} }
static inline u16 RotR1(u16 val) static inline u16 RotR1(u16 val)
{ {
return (val >> 1) | (val << 15); return (val >> 1) | (val << 15);
} }
static inline u8 Lo8(u16 val) static inline u8 Lo8(u16 val)
{ {
return val & 0xff; return val & 0xff;
} }
static inline u8 Hi8(u16 val) static inline u8 Hi8(u16 val)
{ {
return val >> 8; return val >> 8;
} }
static inline u16 Lo16(u32 val) static inline u16 Lo16(u32 val)
{ {
return val & 0xffff; return val & 0xffff;
} }
static inline u16 Hi16(u32 val) static inline u16 Hi16(u32 val)
{ {
return val >> 16; return val >> 16;
} }
static inline u16 Mk16(u8 hi, u8 lo) static inline u16 Mk16(u8 hi, u8 lo)
{ {
return lo | (((u16) hi) << 8); return lo | (((u16) hi) << 8);
} }
static inline u16 Mk16_le(u16 * v)
static inline u16 Mk16_le(u16 *v)
{ {
return le16_to_cpu(*v); return le16_to_cpu(*v);
} }
static const u16 Sbox[256] = {
static const u16 Sbox[256] =
{
0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154,
0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A,
0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B,
...@@ -190,17 +179,16 @@ static const u16 Sbox[256] = ...@@ -190,17 +179,16 @@ static const u16 Sbox[256] =
0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A,
}; };
static inline u16 _S_(u16 v) static inline u16 _S_(u16 v)
{ {
u16 t = Sbox[Hi8(v)]; u16 t = Sbox[Hi8(v)];
return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8));
} }
#define PHASE1_LOOP_COUNT 8 #define PHASE1_LOOP_COUNT 8
static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) static void tkip_mixing_phase1(u16 * TTAK, const u8 * TK, const u8 * TA,
u32 IV32)
{ {
int i, j; int i, j;
...@@ -221,13 +209,12 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) ...@@ -221,13 +209,12 @@ static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
} }
} }
static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK,
static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16) u16 IV16)
{ {
/* Make temporary area overlap WEP seed so that the final copy can be /* Make temporary area overlap WEP seed so that the final copy can be
* avoided on little endian hosts. */ * avoided on little endian hosts. */
u16 *PPK = (u16 *) &WEPSeed[4]; u16 *PPK = (u16 *) & WEPSeed[4];
/* Step 1 - make copy of TTAK and bring in TSC */ /* Step 1 - make copy of TTAK and bring in TSC */
PPK[0] = TTAK[0]; PPK[0] = TTAK[0];
...@@ -238,15 +225,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, ...@@ -238,15 +225,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
PPK[5] = TTAK[4] + IV16; PPK[5] = TTAK[4] + IV16;
/* Step 2 - 96-bit bijective mixing using S-box */ /* Step 2 - 96-bit bijective mixing using S-box */
PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) & TK[0]));
PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) & TK[2]));
PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) & TK[4]));
PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) & TK[6]));
PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) & TK[8]));
PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) & TK[10]));
PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) & TK[12]));
PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) & TK[14]));
PPK[2] += RotR1(PPK[1]); PPK[2] += RotR1(PPK[1]);
PPK[3] += RotR1(PPK[2]); PPK[3] += RotR1(PPK[2]);
PPK[4] += RotR1(PPK[3]); PPK[4] += RotR1(PPK[3]);
...@@ -257,7 +244,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, ...@@ -257,7 +244,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
WEPSeed[0] = Hi8(IV16); WEPSeed[0] = Hi8(IV16);
WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F;
WEPSeed[2] = Lo8(IV16); WEPSeed[2] = Lo8(IV16);
WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) & TK[0])) >> 1);
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
{ {
...@@ -281,7 +268,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -281,7 +268,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
skb->len < hdr_len) skb->len < hdr_len)
return -1; return -1;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
if (!tkey->tx_phase1_done) { if (!tkey->tx_phase1_done) {
tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32); tkey->tx_iv32);
...@@ -298,7 +285,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -298,7 +285,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
*pos++ = rc4key[0]; *pos++ = rc4key[0];
*pos++ = rc4key[1]; *pos++ = rc4key[1];
*pos++ = rc4key[2]; *pos++ = rc4key[2];
*pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ;
*pos++ = tkey->tx_iv32 & 0xff; *pos++ = tkey->tx_iv32 & 0xff;
*pos++ = (tkey->tx_iv32 >> 8) & 0xff; *pos++ = (tkey->tx_iv32 >> 8) & 0xff;
*pos++ = (tkey->tx_iv32 >> 16) & 0xff; *pos++ = (tkey->tx_iv32 >> 16) & 0xff;
...@@ -341,7 +328,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -341,7 +328,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
if (skb->len < hdr_len + 8 + 4) if (skb->len < hdr_len + 8 + 4)
return -1; return -1;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
pos = skb->data + hdr_len; pos = skb->data + hdr_len;
keyidx = pos[3]; keyidx = pos[3];
if (!(keyidx & (1 << 5))) { if (!(keyidx & (1 << 5))) {
...@@ -427,9 +414,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -427,9 +414,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return keyidx; return keyidx;
} }
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr,
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, u8 * data, size_t data_len, u8 * mic)
u8 *data, size_t data_len, u8 *mic)
{ {
struct scatterlist sg[2]; struct scatterlist sg[2];
...@@ -453,11 +439,11 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, ...@@ -453,11 +439,11 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
return 0; return 0;
} }
static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr)
{ {
struct ieee80211_hdr *hdr11; struct ieee80211_hdr *hdr11;
hdr11 = (struct ieee80211_hdr *) skb->data; hdr11 = (struct ieee80211_hdr *)skb->data;
switch (le16_to_cpu(hdr11->frame_ctl) & switch (le16_to_cpu(hdr11->frame_ctl) &
(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_TODS: case IEEE80211_FCTL_TODS:
...@@ -482,8 +468,8 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) ...@@ -482,8 +468,8 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */
} }
static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len,
static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
u8 *pos; u8 *pos;
...@@ -504,11 +490,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri ...@@ -504,11 +490,9 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri
return 0; return 0;
} }
#if WIRELESS_EXT >= 18 #if WIRELESS_EXT >= 18
static void ieee80211_michael_mic_failure(struct net_device *dev, static void ieee80211_michael_mic_failure(struct net_device *dev,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr, int keyidx)
int keyidx)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
struct iw_michaelmicfailure ev; struct iw_michaelmicfailure ev;
...@@ -524,12 +508,11 @@ static void ieee80211_michael_mic_failure(struct net_device *dev, ...@@ -524,12 +508,11 @@ static void ieee80211_michael_mic_failure(struct net_device *dev,
memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN);
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = sizeof(ev); wrqu.data.length = sizeof(ev);
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev);
} }
#elif WIRELESS_EXT >= 15 #elif WIRELESS_EXT >= 15
static void ieee80211_michael_mic_failure(struct net_device *dev, static void ieee80211_michael_mic_failure(struct net_device *dev,
struct ieee80211_hdr *hdr, struct ieee80211_hdr *hdr, int keyidx)
int keyidx)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
char buf[128]; char buf[128];
...@@ -550,7 +533,6 @@ static inline void ieee80211_michael_mic_failure(struct net_device *dev, ...@@ -550,7 +533,6 @@ static inline void ieee80211_michael_mic_failure(struct net_device *dev,
} }
#endif /* WIRELESS_EXT >= 15 */ #endif /* WIRELESS_EXT >= 15 */
static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv) int hdr_len, void *priv)
{ {
...@@ -566,7 +548,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -566,7 +548,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
return -1; return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *)skb->data;
printk(KERN_DEBUG "%s: Michael MIC verification failed for " printk(KERN_DEBUG "%s: Michael MIC verification failed for "
"MSDU from " MAC_FMT " keyidx=%d\n", "MSDU from " MAC_FMT " keyidx=%d\n",
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
...@@ -587,8 +569,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, ...@@ -587,8 +569,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
return 0; return 0;
} }
static int ieee80211_tkip_set_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
int keyidx; int keyidx;
...@@ -617,8 +598,7 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -617,8 +598,7 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
return 0; return 0;
} }
static int ieee80211_tkip_get_key(void *key, int len, u8 * seq, void *priv)
static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
{ {
struct ieee80211_tkip_data *tkey = priv; struct ieee80211_tkip_data *tkey = priv;
...@@ -647,8 +627,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) ...@@ -647,8 +627,7 @@ static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
return TKIP_KEY_LEN; return TKIP_KEY_LEN;
} }
static char *ieee80211_tkip_print_stats(char *p, void *priv)
static char * ieee80211_tkip_print_stats(char *p, void *priv)
{ {
struct ieee80211_tkip_data *tkip = priv; struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d " p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
...@@ -674,7 +653,6 @@ static char * ieee80211_tkip_print_stats(char *p, void *priv) ...@@ -674,7 +653,6 @@ static char * ieee80211_tkip_print_stats(char *p, void *priv)
return p; return p;
} }
static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
.name = "TKIP", .name = "TKIP",
.init = ieee80211_tkip_init, .init = ieee80211_tkip_init,
...@@ -691,18 +669,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { ...@@ -691,18 +669,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_tkip_init(void) static int __init ieee80211_crypto_tkip_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
} }
static void __exit ieee80211_crypto_tkip_exit(void) static void __exit ieee80211_crypto_tkip_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
} }
module_init(ieee80211_crypto_tkip_init); module_init(ieee80211_crypto_tkip_init);
module_exit(ieee80211_crypto_tkip_exit); module_exit(ieee80211_crypto_tkip_exit);
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include <linux/crc32.h> #include <linux/crc32.h>
...@@ -29,7 +28,6 @@ MODULE_AUTHOR("Jouni Malinen"); ...@@ -29,7 +28,6 @@ MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP"); MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
struct prism2_wep_data { struct prism2_wep_data {
u32 iv; u32 iv;
#define WEP_KEY_LEN 13 #define WEP_KEY_LEN 13
...@@ -39,8 +37,7 @@ struct prism2_wep_data { ...@@ -39,8 +37,7 @@ struct prism2_wep_data {
struct crypto_tfm *tfm; struct crypto_tfm *tfm;
}; };
static void *prism2_wep_init(int keyidx)
static void * prism2_wep_init(int keyidx)
{ {
struct prism2_wep_data *priv; struct prism2_wep_data *priv;
...@@ -62,7 +59,7 @@ static void * prism2_wep_init(int keyidx) ...@@ -62,7 +59,7 @@ static void * prism2_wep_init(int keyidx)
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm) if (priv->tfm)
crypto_free_tfm(priv->tfm); crypto_free_tfm(priv->tfm);
...@@ -71,7 +68,6 @@ static void * prism2_wep_init(int keyidx) ...@@ -71,7 +68,6 @@ static void * prism2_wep_init(int keyidx)
return NULL; return NULL;
} }
static void prism2_wep_deinit(void *priv) static void prism2_wep_deinit(void *priv)
{ {
struct prism2_wep_data *_priv = priv; struct prism2_wep_data *_priv = priv;
...@@ -80,7 +76,6 @@ static void prism2_wep_deinit(void *priv) ...@@ -80,7 +76,6 @@ static void prism2_wep_deinit(void *priv)
kfree(priv); kfree(priv);
} }
/* Perform WEP encryption on given skb that has at least 4 bytes of headroom /* Perform WEP encryption on given skb that has at least 4 bytes of headroom
* for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted,
* so the payload length increases with 8 bytes. * so the payload length increases with 8 bytes.
...@@ -143,7 +138,6 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -143,7 +138,6 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
return 0; return 0;
} }
/* Perform WEP decryption on given buffer. Buffer includes whole WEP part of /* Perform WEP decryption on given buffer. Buffer includes whole WEP part of
* the frame: IV (4 bytes), encrypted payload (including SNAP header), * the frame: IV (4 bytes), encrypted payload (including SNAP header),
* ICV (4 bytes). len includes both IV and ICV. * ICV (4 bytes). len includes both IV and ICV.
...@@ -202,8 +196,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -202,8 +196,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
return 0; return 0;
} }
static int prism2_wep_set_key(void *key, int len, u8 * seq, void *priv)
static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
{ {
struct prism2_wep_data *wep = priv; struct prism2_wep_data *wep = priv;
...@@ -216,8 +209,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) ...@@ -216,8 +209,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
return 0; return 0;
} }
static int prism2_wep_get_key(void *key, int len, u8 * seq, void *priv)
static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
{ {
struct prism2_wep_data *wep = priv; struct prism2_wep_data *wep = priv;
...@@ -229,16 +221,13 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) ...@@ -229,16 +221,13 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
return wep->key_len; return wep->key_len;
} }
static char *prism2_wep_print_stats(char *p, void *priv)
static char * prism2_wep_print_stats(char *p, void *priv)
{ {
struct prism2_wep_data *wep = priv; struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n", p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len);
wep->key_idx, wep->key_len);
return p; return p;
} }
static struct ieee80211_crypto_ops ieee80211_crypt_wep = { static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
.name = "WEP", .name = "WEP",
.init = prism2_wep_init, .init = prism2_wep_init,
...@@ -255,18 +244,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { ...@@ -255,18 +244,15 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __init ieee80211_crypto_wep_init(void) static int __init ieee80211_crypto_wep_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
} }
static void __exit ieee80211_crypto_wep_exit(void) static void __exit ieee80211_crypto_wep_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
} }
module_init(ieee80211_crypto_wep_init); module_init(ieee80211_crypto_wep_init);
module_exit(ieee80211_crypto_wep_exit); module_exit(ieee80211_crypto_wep_exit);
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
MODULE_DESCRIPTION("802.11 data/management/control stack"); MODULE_DESCRIPTION("802.11 data/management/control stack");
MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); MODULE_AUTHOR
("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define DRV_NAME "ieee80211" #define DRV_NAME "ieee80211"
...@@ -64,8 +65,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) ...@@ -64,8 +65,8 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
if (ieee->networks) if (ieee->networks)
return 0; return 0;
ieee->networks = kmalloc( ieee->networks =
MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), kmalloc(MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
GFP_KERNEL); GFP_KERNEL);
if (!ieee->networks) { if (!ieee->networks) {
printk(KERN_WARNING "%s: Out of memory allocating beacons\n", printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
...@@ -94,10 +95,10 @@ static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) ...@@ -94,10 +95,10 @@ static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
INIT_LIST_HEAD(&ieee->network_free_list); INIT_LIST_HEAD(&ieee->network_free_list);
INIT_LIST_HEAD(&ieee->network_list); INIT_LIST_HEAD(&ieee->network_list);
for (i = 0; i < MAX_NETWORK_COUNT; i++) for (i = 0; i < MAX_NETWORK_COUNT; i++)
list_add_tail(&ieee->networks[i].list, &ieee->network_free_list); list_add_tail(&ieee->networks[i].list,
&ieee->network_free_list);
} }
struct net_device *alloc_ieee80211(int sizeof_priv) struct net_device *alloc_ieee80211(int sizeof_priv)
{ {
struct ieee80211_device *ieee; struct ieee80211_device *ieee;
...@@ -118,8 +119,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -118,8 +119,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
err = ieee80211_networks_allocate(ieee); err = ieee80211_networks_allocate(ieee);
if (err) { if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", err);
err);
goto failed; goto failed;
} }
ieee80211_networks_initialize(ieee); ieee80211_networks_initialize(ieee);
...@@ -155,7 +155,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -155,7 +155,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
return NULL; return NULL;
} }
void free_ieee80211(struct net_device *dev) void free_ieee80211(struct net_device *dev)
{ {
struct ieee80211_device *ieee = netdev_priv(dev); struct ieee80211_device *ieee = netdev_priv(dev);
...@@ -193,7 +192,7 @@ static int show_debug_level(char *page, char **start, off_t offset, ...@@ -193,7 +192,7 @@ static int show_debug_level(char *page, char **start, off_t offset,
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
} }
static int store_debug_level(struct file *file, const char __user *buffer, static int store_debug_level(struct file *file, const char __user * buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
char buf[] = "0x00000000"; char buf[] = "0x00000000";
...@@ -264,13 +263,12 @@ static void __exit ieee80211_exit(void) ...@@ -264,13 +263,12 @@ static void __exit ieee80211_exit(void)
module_param(debug, int, 0444); module_param(debug, int, 0444);
MODULE_PARM_DESC(debug, "debug output mask"); MODULE_PARM_DESC(debug, "debug output mask");
module_exit(ieee80211_exit); module_exit(ieee80211_exit);
module_init(ieee80211_init); module_init(ieee80211_init);
#endif #endif
const char *escape_essid(const char *essid, u8 essid_len)
const char *escape_essid(const char *essid, u8 essid_len) { {
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
const char *s = essid; const char *s = essid;
char *d = escaped; char *d = escaped;
...@@ -280,7 +278,7 @@ const char *escape_essid(const char *essid, u8 essid_len) { ...@@ -280,7 +278,7 @@ const char *escape_essid(const char *essid, u8 essid_len) {
return escaped; return escaped;
} }
essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
while (essid_len--) { while (essid_len--) {
if (*s == '\0') { if (*s == '\0') {
*d++ = '\\'; *d++ = '\\';
......
此差异已折叠。
...@@ -45,10 +45,8 @@ ...@@ -45,10 +45,8 @@
#include <net/ieee80211.h> #include <net/ieee80211.h>
/* /*
802.11 Data Frame 802.11 Data Frame
,-------------------------------------------------------------------. ,-------------------------------------------------------------------.
...@@ -82,7 +80,6 @@ Desc. | IV | Encrypted | ICV | ...@@ -82,7 +80,6 @@ Desc. | IV | Encrypted | ICV |
`-----------------------' `-----------------------'
Total: 8 non-data bytes Total: 8 non-data bytes
802.3 Ethernet Data Frame 802.3 Ethernet Data Frame
,-----------------------------------------. ,-----------------------------------------.
...@@ -131,7 +128,7 @@ payload of each frame is reduced to 492 bytes. ...@@ -131,7 +128,7 @@ payload of each frame is reduced to 492 bytes.
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
static inline int ieee80211_put_snap(u8 *data, u16 h_proto) static inline int ieee80211_put_snap(u8 * data, u16 h_proto)
{ {
struct ieee80211_snap_hdr *snap; struct ieee80211_snap_hdr *snap;
u8 *oui; u8 *oui;
...@@ -149,17 +146,15 @@ static inline int ieee80211_put_snap(u8 *data, u16 h_proto) ...@@ -149,17 +146,15 @@ static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
snap->oui[1] = oui[1]; snap->oui[1] = oui[1];
snap->oui[2] = oui[2]; snap->oui[2] = oui[2];
*(u16 *)(data + SNAP_SIZE) = htons(h_proto); *(u16 *) (data + SNAP_SIZE) = htons(h_proto);
return SNAP_SIZE + sizeof(u16); return SNAP_SIZE + sizeof(u16);
} }
static inline int ieee80211_encrypt_fragment( static inline int ieee80211_encrypt_fragment(struct ieee80211_device *ieee,
struct ieee80211_device *ieee, struct sk_buff *frag, int hdr_len)
struct sk_buff *frag,
int hdr_len)
{ {
struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx]; struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
int res; int res;
#ifdef CONFIG_IEEE80211_CRYPT_TKIP #ifdef CONFIG_IEEE80211_CRYPT_TKIP
...@@ -167,7 +162,7 @@ static inline int ieee80211_encrypt_fragment( ...@@ -167,7 +162,7 @@ static inline int ieee80211_encrypt_fragment(
if (ieee->tkip_countermeasures && if (ieee->tkip_countermeasures &&
crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) {
header = (struct ieee80211_hdr *) frag->data; header = (struct ieee80211_hdr *)frag->data;
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
"TX packet to " MAC_FMT "\n", "TX packet to " MAC_FMT "\n",
...@@ -200,8 +195,8 @@ static inline int ieee80211_encrypt_fragment( ...@@ -200,8 +195,8 @@ static inline int ieee80211_encrypt_fragment(
return 0; return 0;
} }
void ieee80211_txb_free(struct ieee80211_txb *txb)
void ieee80211_txb_free(struct ieee80211_txb *txb) { {
int i; int i;
if (unlikely(!txb)) if (unlikely(!txb))
return; return;
...@@ -216,8 +211,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, ...@@ -216,8 +211,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
{ {
struct ieee80211_txb *txb; struct ieee80211_txb *txb;
int i; int i;
txb = kmalloc( txb = kmalloc(sizeof(struct ieee80211_txb) + (sizeof(u8 *) * nr_frags),
sizeof(struct ieee80211_txb) + (sizeof(u8*) * nr_frags),
gfp_mask); gfp_mask);
if (!txb) if (!txb)
return NULL; return NULL;
...@@ -243,8 +237,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, ...@@ -243,8 +237,7 @@ static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
} }
/* SKBs are added to the ieee->tx_queue. */ /* SKBs are added to the ieee->tx_queue. */
int ieee80211_xmit(struct sk_buff *skb, int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
struct net_device *dev)
{ {
struct ieee80211_device *ieee = netdev_priv(dev); struct ieee80211_device *ieee = netdev_priv(dev);
struct ieee80211_txb *txb = NULL; struct ieee80211_txb *txb = NULL;
...@@ -261,15 +254,14 @@ int ieee80211_xmit(struct sk_buff *skb, ...@@ -261,15 +254,14 @@ int ieee80211_xmit(struct sk_buff *skb,
}; };
u8 dest[ETH_ALEN], src[ETH_ALEN]; u8 dest[ETH_ALEN], src[ETH_ALEN];
struct ieee80211_crypt_data* crypt; struct ieee80211_crypt_data *crypt;
spin_lock_irqsave(&ieee->lock, flags); spin_lock_irqsave(&ieee->lock, flags);
/* If there is no driver handler to take the TXB, dont' bother /* If there is no driver handler to take the TXB, dont' bother
* creating it... */ * creating it... */
if (!ieee->hard_start_xmit) { if (!ieee->hard_start_xmit) {
printk(KERN_WARNING "%s: No xmit handler.\n", printk(KERN_WARNING "%s: No xmit handler.\n", ieee->dev->name);
ieee->dev->name);
goto success; goto success;
} }
...@@ -294,7 +286,7 @@ int ieee80211_xmit(struct sk_buff *skb, ...@@ -294,7 +286,7 @@ int ieee80211_xmit(struct sk_buff *skb,
/* Save source and destination addresses */ /* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN); memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); memcpy(&src, skb->data + ETH_ALEN, ETH_ALEN);
/* Advance the SKB to the start of the payload */ /* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr)); skb_pull(skb, sizeof(struct ethhdr));
...@@ -327,8 +319,7 @@ int ieee80211_xmit(struct sk_buff *skb, ...@@ -327,8 +319,7 @@ int ieee80211_xmit(struct sk_buff *skb,
/* Determine fragmentation size based on destination (multicast /* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */ * and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) || if (is_multicast_ether_addr(dest) || is_broadcast_ether_addr(dest))
is_broadcast_ether_addr(dest))
frag_size = MAX_FRAG_THRESHOLD; frag_size = MAX_FRAG_THRESHOLD;
else else
frag_size = ieee->fts; frag_size = ieee->fts;
...@@ -380,8 +371,8 @@ int ieee80211_xmit(struct sk_buff *skb, ...@@ -380,8 +371,8 @@ int ieee80211_xmit(struct sk_buff *skb,
/* If this is not the last fragment, then add the MOREFRAGS /* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */ * bit to the frame control */
if (i != nr_frags - 1) { if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16( frag_hdr->frame_ctl =
fc | IEEE80211_FCTL_MOREFRAGS); cpu_to_le16(fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag; bytes = bytes_per_frag;
} else { } else {
/* The last fragment takes the remaining length */ /* The last fragment takes the remaining length */
...@@ -390,8 +381,8 @@ int ieee80211_xmit(struct sk_buff *skb, ...@@ -390,8 +381,8 @@ int ieee80211_xmit(struct sk_buff *skb,
/* Put a SNAP header on the first fragment */ /* Put a SNAP header on the first fragment */
if (i == 0) { if (i == 0) {
ieee80211_put_snap( ieee80211_put_snap(skb_put
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), (skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type); ether_type);
bytes -= SNAP_SIZE + sizeof(u16); bytes -= SNAP_SIZE + sizeof(u16);
} }
...@@ -410,14 +401,13 @@ int ieee80211_xmit(struct sk_buff *skb, ...@@ -410,14 +401,13 @@ int ieee80211_xmit(struct sk_buff *skb,
skb_put(skb_frag, 4); skb_put(skb_frag, 4);
} }
success: success:
spin_unlock_irqrestore(&ieee->lock, flags); spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
if (txb) { if (txb) {
if ((*ieee->hard_start_xmit)(txb, dev) == 0) { if ((*ieee->hard_start_xmit) (txb, dev) == 0) {
stats->tx_packets++; stats->tx_packets++;
stats->tx_bytes += txb->payload_size; stats->tx_bytes += txb->payload_size;
return 0; return 0;
......
...@@ -66,26 +66,25 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -66,26 +66,25 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
iwe.u.data.length = sizeof("<hidden>"); iwe.u.data.length = sizeof("<hidden>");
start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
} else { } else {
iwe.u.data.length = min(network->ssid_len, (u8)32); iwe.u.data.length = min(network->ssid_len, (u8) 32);
start = iwe_stream_add_point(start, stop, &iwe, network->ssid); start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
} }
/* Add the protocol name */ /* Add the protocol name */
iwe.cmd = SIOCGIWNAME; iwe.cmd = SIOCGIWNAME;
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s",
ieee80211_modes[network->mode]);
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN);
/* Add mode */ /* Add mode */
iwe.cmd = SIOCGIWMODE; iwe.cmd = SIOCGIWMODE;
if (network->capability & if (network->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
(WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
if (network->capability & WLAN_CAPABILITY_ESS) if (network->capability & WLAN_CAPABILITY_ESS)
iwe.u.mode = IW_MODE_MASTER; iwe.u.mode = IW_MODE_MASTER;
else else
iwe.u.mode = IW_MODE_ADHOC; iwe.u.mode = IW_MODE_ADHOC;
start = iwe_stream_add_event(start, stop, &iwe, start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN);
IW_EV_UINT_LEN);
} }
/* Add frequency/channel */ /* Add frequency/channel */
...@@ -110,7 +109,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -110,7 +109,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
max_rate = 0; max_rate = 0;
p = custom; p = custom;
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): ");
for (i = 0, j = 0; i < network->rates_len; ) { for (i = 0, j = 0; i < network->rates_len;) {
if (j < network->rates_ex_len && if (j < network->rates_ex_len &&
((network->rates_ex[j] & 0x7F) < ((network->rates_ex[j] & 0x7F) <
(network->rates[i] & 0x7F))) (network->rates[i] & 0x7F)))
...@@ -133,8 +132,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -133,8 +132,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
iwe.cmd = SIOCGIWRATE; iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
iwe.u.bitrate.value = max_rate * 500000; iwe.u.bitrate.value = max_rate * 500000;
start = iwe_stream_add_event(start, stop, &iwe, start = iwe_stream_add_event(start, stop, &iwe, IW_EV_PARAM_LEN);
IW_EV_PARAM_LEN);
iwe.cmd = IWEVCUSTOM; iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = p - custom; iwe.u.data.length = p - custom;
...@@ -164,7 +162,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -164,7 +162,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
if (iwe.u.data.length) if (iwe.u.data.length)
start = iwe_stream_add_point(start, stop, &iwe, custom); start = iwe_stream_add_point(start, stop, &iwe, custom);
if (ieee->wpa_enabled && network->wpa_ie_len){ if (ieee->wpa_enabled && network->wpa_ie_len) {
char buf[MAX_WPA_IE_LEN * 2 + 30]; char buf[MAX_WPA_IE_LEN * 2 + 30];
u8 *p = buf; u8 *p = buf;
...@@ -179,7 +177,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -179,7 +177,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
start = iwe_stream_add_point(start, stop, &iwe, buf); start = iwe_stream_add_point(start, stop, &iwe, buf);
} }
if (ieee->wpa_enabled && network->rsn_ie_len){ if (ieee->wpa_enabled && network->rsn_ie_len) {
char buf[MAX_WPA_IE_LEN * 2 + 30]; char buf[MAX_WPA_IE_LEN * 2 + 30];
u8 *p = buf; u8 *p = buf;
...@@ -199,12 +197,12 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, ...@@ -199,12 +197,12 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
iwe.cmd = IWEVCUSTOM; iwe.cmd = IWEVCUSTOM;
p = custom; p = custom;
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
" Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); " Last beacon: %lums ago",
(jiffies - network->last_scanned) / (HZ / 100));
iwe.u.data.length = p - custom; iwe.u.data.length = p - custom;
if (iwe.u.data.length) if (iwe.u.data.length)
start = iwe_stream_add_point(start, stop, &iwe, custom); start = iwe_stream_add_point(start, stop, &iwe, custom);
return start; return start;
} }
...@@ -229,13 +227,14 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, ...@@ -229,13 +227,14 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
time_after(network->last_scanned + ieee->scan_age, jiffies)) time_after(network->last_scanned + ieee->scan_age, jiffies))
ev = ipw2100_translate_scan(ieee, ev, stop, network); ev = ipw2100_translate_scan(ieee, ev, stop, network);
else else
IEEE80211_DEBUG_SCAN( IEEE80211_DEBUG_SCAN("Not showing network '%s ("
"Not showing network '%s ("
MAC_FMT ")' due to age (%lums).\n", MAC_FMT ")' due to age (%lums).\n",
escape_essid(network->ssid, escape_essid(network->ssid,
network->ssid_len), network->ssid_len),
MAC_ARG(network->bssid), MAC_ARG(network->bssid),
(jiffies - network->last_scanned) / (HZ / 100)); (jiffies -
network->last_scanned) / (HZ /
100));
} }
spin_unlock_irqrestore(&ieee->lock, flags); spin_unlock_irqrestore(&ieee->lock, flags);
...@@ -292,8 +291,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, ...@@ -292,8 +291,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
if (ieee->crypt[i] != NULL) { if (ieee->crypt[i] != NULL) {
if (key_provided) if (key_provided)
break; break;
ieee80211_crypt_delayed_deinit( ieee80211_crypt_delayed_deinit(ieee,
ieee, &ieee->crypt[i]); &ieee->crypt[i]);
} }
} }
...@@ -306,8 +305,6 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, ...@@ -306,8 +305,6 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
goto done; goto done;
} }
sec.enabled = 1; sec.enabled = 1;
sec.flags |= SEC_ENABLED; sec.flags |= SEC_ENABLED;
...@@ -341,8 +338,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, ...@@ -341,8 +338,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
new_crypt = NULL; new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: " printk(KERN_WARNING "%s: could not initialize WEP: "
"load module ieee80211_crypt_wep\n", "load module ieee80211_crypt_wep\n", dev->name);
dev->name);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
*crypt = new_crypt; *crypt = new_crypt;
...@@ -382,8 +378,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, ...@@ -382,8 +378,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
/* No key data - just set the default TX key index */ /* No key data - just set the default TX key index */
if (key_provided) { if (key_provided) {
IEEE80211_DEBUG_WX( IEEE80211_DEBUG_WX
"Setting key %d to default Tx key.\n", key); ("Setting key %d to default Tx key.\n", key);
ieee->tx_keyidx = key; ieee->tx_keyidx = key;
sec.active_key = key; sec.active_key = key;
sec.flags |= SEC_ACTIVE_KEY; sec.flags |= SEC_ACTIVE_KEY;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册