Commit 78de2c06 authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman
Browse files

staging: r8192ee: Add source files for core driver



This part is the equivalent of rtlwifi in the wireless tree. As the changes
needed for the RTL8192EE have not yet been merged, a separate version is still
needed.

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 69c1f053
Loading
Loading
Loading
Loading
+1852 −0

File added.

Preview size limit exceeded, changes collapsed.

+163 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 * Copyright(c) 2009-2010  Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *
 *****************************************************************************/

#ifndef __RTL_BASE_H__
#define __RTL_BASE_H__

#include "compat.h"

enum ap_peer {
	PEER_UNKNOWN = 0,
	PEER_RTL = 1,
	PEER_RTL_92SE = 2,
	PEER_BROAD = 3,
	PEER_RAL = 4,
	PEER_ATH = 5,
	PEER_CISCO = 6,
	PEER_MARV = 7,
	PEER_AIRGO = 9,
	PEER_MAX = 10,
};

#define RTL_DUMMY_OFFSET	0
#define RTL_DUMMY_UNIT		8
#define RTL_TX_DUMMY_SIZE	(RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
#define RTL_TX_DESC_SIZE	32
#define RTL_TX_HEADER_SIZE	(RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)

#define HT_AMSDU_SIZE_4K	3839
#define HT_AMSDU_SIZE_8K	7935

#define MAX_BIT_RATE_40MHZ_MCS15	300	/* Mbps */
#define MAX_BIT_RATE_40MHZ_MCS7		150	/* Mbps */

#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9	867	/* Mbps */
#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7	650	/* Mbps */
#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9	780	/* Mbps */
#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7	585	/* Mbps */

#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9	434	/* Mbps */
#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7	325	/* Mbps */
#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9	390	/* Mbps */
#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7	293	/* Mbps */


#define RTL_RATE_COUNT_LEGACY		12
#define RTL_CHANNEL_COUNT		14

#define FRAME_OFFSET_FRAME_CONTROL	0
#define FRAME_OFFSET_DURATION		2
#define FRAME_OFFSET_ADDRESS1		4
#define FRAME_OFFSET_ADDRESS2		10
#define FRAME_OFFSET_ADDRESS3		16
#define FRAME_OFFSET_SEQUENCE		22
#define FRAME_OFFSET_ADDRESS4		24

#define SET_80211_HDR_FRAME_CONTROL(_hdr, _val)		\
	WRITEEF2BYTE(_hdr, _val)
#define SET_80211_HDR_TYPE_AND_SUBTYPE(_hdr, _val)	\
	WRITEEF1BYTE(_hdr, _val)
#define SET_80211_HDR_PWR_MGNT(_hdr, _val)		\
	SET_BITS_TO_LE_2BYTE(_hdr, 12, 1, _val)
#define SET_80211_HDR_TO_DS(_hdr, _val)			\
	SET_BITS_TO_LE_2BYTE(_hdr, 8, 1, _val)

#define SET_80211_PS_POLL_AID(_hdr, _val)		\
	(*(u16 *)((u8 *)(_hdr) + 2) = _val)
#define SET_80211_PS_POLL_BSSID(_hdr, _val)		\
	memcpy(((u8 *)(_hdr)) + 4, (u8 *)(_val), ETH_ALEN)
#define SET_80211_PS_POLL_TA(_hdr, _val)		\
	memcpy(((u8 *)(_hdr)) + 10, (u8 *)(_val), ETH_ALEN)

#define SET_80211_HDR_DURATION(_hdr, _val)	\
	WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_DURATION, _val)
#define SET_80211_HDR_ADDRESS1(_hdr, _val)	\
	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))
#define SET_80211_HDR_ADDRESS2(_hdr, _val)	\
	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
#define SET_80211_HDR_ADDRESS3(_hdr, _val)	\
	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
#define SET_80211_HDR_FRAGMENT_SEQUENCE(_hdr, _val)  \
	WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_SEQUENCE, _val)

#define SET_BEACON_PROBE_RSP_TIME_STAMP_LOW(__phdr, __val)	\
	WRITEEF4BYTE(((u8 *)(__phdr)) + 24, __val)
#define SET_BEACON_PROBE_RSP_TIME_STAMP_HIGH(__phdr, __val) \
	WRITEEF4BYTE(((u8 *)(__phdr)) + 28, __val)
#define SET_BEACON_PROBE_RSP_BEACON_INTERVAL(__phdr, __val) \
	WRITEEF2BYTE(((u8 *)(__phdr)) + 32, __val)
#define GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr)		\
	READEF2BYTE(((u8 *)(__phdr)) + 34)
#define SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
	WRITEEF2BYTE(((u8 *)(__phdr)) + 34, __val)
#define MASK_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
	SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, \
	(GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) & (~(__val))))

int rtl92e_init_core(struct ieee80211_hw *hw);
void rtl92e_deinit_core(struct ieee80211_hw *hw);
void rtl92e_init_rx_config(struct ieee80211_hw *hw);
void rtl92e_init_rfkill(struct ieee80211_hw *hw);
void rtl92e_deinit_rfkill(struct ieee80211_hw *hw);

void rtl92e_watch_dog_timer_callback(unsigned long data);
void rtl92e_deinit_deferred_work(struct ieee80211_hw *hw);

bool rtl92e_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
bool rtl92e_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
u8 rtl92e_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb,
			  u8 is_tx);
void rtl92e_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
void rtl92e_watch_dog_timer_callback(unsigned long data);
int rtl92e_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		        struct ieee80211_sta *sta, u16 tid, u16 *ssn);
int rtl92e_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		       struct ieee80211_sta *sta, u16 tid);
int rtl92e_tx_agg_oper(struct ieee80211_hw *hw,
		       struct ieee80211_sta *sta, u16 tid);
int rtl92e_rx_agg_start(struct ieee80211_hw *hw,
		        struct ieee80211_sta *sta, u16 tid);
int rtl92e_rx_agg_stop(struct ieee80211_hw *hw,
		       struct ieee80211_sta *sta, u16 tid);
void rtl92e_watchdog_wq_callback(void *data);
void rtl92e_fwevt_wq_callback(void *data);

void stg_rtl_get_tcb_desc(struct ieee80211_hw *hw,
			  struct ieee80211_tx_info *info,
			  struct ieee80211_sta *sta,
			  struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);

int stg_rtl_send_smps_action(struct ieee80211_hw *hw,
			     struct ieee80211_sta *sta,
			     enum ieee80211_smps_mode smps);
u8 *rtl92e_find_ie(u8 *data, unsigned int len, u8 ie);
void rtl92e_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len);
u8 rtl92e_tid_to_ac(struct ieee80211_hw *hw, u8 tid);
void rtl92e_easy_concurrent_retrytimer_callback(unsigned long data);
extern struct rtl_global_var global_var;
int  rtl_core_module_init(void);
void  rtl_core_module_exit(void);

#endif
+337 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 * Copyright(c) 2009-2010  Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *
 *****************************************************************************/
#include "wifi.h"
#include "cam.h"

void rtl92e_cam_reset_sec_info(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	rtlpriv->sec.use_defaultkey = false;
	rtlpriv->sec.pairwise_enc_algorithm = NO_ENCRYPTION;
	rtlpriv->sec.group_enc_algorithm = NO_ENCRYPTION;
	memset(rtlpriv->sec.key_buf, 0, KEY_BUF_SIZE * MAX_KEY_LEN);
	memset(rtlpriv->sec.key_len, 0, KEY_BUF_SIZE);
	rtlpriv->sec.pairwise_key = NULL;
}

static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
				  u8 *mac_addr, u8 *key_cont_128, u16 us_config)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	u32 target_command;
	u32 target_content = 0;
	u8 entry_i;

	RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_DMESG, "Key content:",
		      key_cont_128, 16);

	for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
		target_command = entry_i + CAM_CONTENT_COUNT * entry_no;
		target_command = target_command | BIT(31) | BIT(16);

		if (entry_i == 0) {
			target_content = (u32) (*(mac_addr + 0)) << 16 |
			    (u32) (*(mac_addr + 1)) << 24 | (u32) us_config;

			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI],
					target_content);
			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
					target_command);

			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("WRITE %x: %x\n",
				  rtlpriv->cfg->maps[WCAMI], target_content));
			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("The Key ID is %d\n", entry_no));
			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("WRITE %x: %x\n",
				  rtlpriv->cfg->maps[RWCAM], target_command));
		} else if (entry_i == 1) {
			target_content = (u32) (*(mac_addr + 5)) << 24 |
			    (u32) (*(mac_addr + 4)) << 16 |
			    (u32) (*(mac_addr + 3)) << 8 |
			    (u32) (*(mac_addr + 2));

			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI],
					target_content);
			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
					target_command);

			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("WRITE A4: %x\n", target_content));
			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("WRITE A0: %x\n", target_command));
		} else {
			target_content =
			    (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 3)) <<
			    24 | (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 2))
			    << 16 |
			    (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 1)) << 8
			    | (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 0));

			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI],
					target_content);
			rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
					target_command);
			udelay(100);

			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("WRITE A4: %x\n", target_content));
			RT_TRACE(COMP_SEC, DBG_LOUD,
				 ("WRITE A0: %x\n", target_command));
		}
	}

	RT_TRACE(COMP_SEC, DBG_LOUD,
		 ("after set key, usconfig:%x\n", us_config));
}

u8 stg_rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
			     u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg,
			     u32 ul_default_key, u8 *key_content)
{
	u32 us_config;
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	RT_TRACE(COMP_SEC, DBG_DMESG,
		 ("EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
		  ul_entry_idx, ul_key_id, ul_enc_alg,
		  ul_default_key, mac_addr));

	if (ul_key_id == TOTAL_CAM_ENTRY) {
		RT_TRACE(COMP_ERR, DBG_WARNING,
			 ("ulKeyId exceed!\n"));
		return 0;
	}

	if (ul_default_key == 1)
		us_config = CFG_VALID | ((u16) (ul_enc_alg) << 2);
	else
		us_config = CFG_VALID | ((ul_enc_alg) << 2) | ul_key_id;

	rtl_cam_program_entry(hw, ul_entry_idx, mac_addr,
			      (u8 *)key_content, us_config);

	RT_TRACE(COMP_SEC, DBG_DMESG, ("end\n"));

	return 1;
}
EXPORT_SYMBOL(stg_rtl_cam_add_one_entry);

int stg_rtl_cam_delete_one_entry(struct ieee80211_hw *hw,
				 u8 *mac_addr, u32 ul_key_id)
{
	u32 ul_command;
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	RT_TRACE(COMP_SEC, DBG_DMESG, ("key_idx:%d\n", ul_key_id));

	ul_command = ul_key_id * CAM_CONTENT_COUNT;
	ul_command = ul_command | BIT(31) | BIT(16);

	rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], 0);
	rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);

	RT_TRACE(COMP_SEC, DBG_DMESG,
		 ("stg_rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0));
	RT_TRACE(COMP_SEC, DBG_DMESG,
		 ("stg_rtl_cam_delete_one_entry(): WRITE A0: %x\n",
		  ul_command));
	return 0;
}
EXPORT_SYMBOL(stg_rtl_cam_delete_one_entry);

void stg_rtl_cam_reset_all_entry(struct ieee80211_hw *hw)
{
	u32 ul_command;
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	ul_command = BIT(31) | BIT(30);
	rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
}
EXPORT_SYMBOL(stg_rtl_cam_reset_all_entry);

void stg_rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	u32 ul_command;
	u32 ul_content;
	u32 ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_AES];

	switch (rtlpriv->sec.pairwise_enc_algorithm) {
	case WEP40_ENCRYPTION:
		ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_WEP40];
		break;
	case WEP104_ENCRYPTION:
		ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_WEP104];
		break;
	case TKIP_ENCRYPTION:
		ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_TKIP];
		break;
	case AESCCMP_ENCRYPTION:
		ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_AES];
		break;
	default:
		ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_AES];
	}

	ul_content = (uc_index & 3) | ((u16) (ul_enc_algo) << 2);

	ul_content |= BIT(15);
	ul_command = CAM_CONTENT_COUNT * uc_index;
	ul_command = ul_command | BIT(31) | BIT(16);

	rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], ul_content);
	rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);

	RT_TRACE(COMP_SEC, DBG_DMESG,
		 ("stg_rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content));
	RT_TRACE(COMP_SEC, DBG_DMESG,
		 ("stg_rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command));
}
EXPORT_SYMBOL(stg_rtl_cam_mark_invalid);

void stg_rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);

	u32 ul_command;
	u32 ul_content;
	u32 ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES];
	u8 entry_i;

	switch (rtlpriv->sec.pairwise_enc_algorithm) {
	case WEP40_ENCRYPTION:
		ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_WEP40];
		break;
	case WEP104_ENCRYPTION:
		ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_WEP104];
		break;
	case TKIP_ENCRYPTION:
		ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_TKIP];
		break;
	case AESCCMP_ENCRYPTION:
		ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES];
		break;
	default:
		ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES];
	}

	for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) {
		if (entry_i == 0) {
			ul_content =
			    (uc_index & 0x03) | ((u16) (ul_encalgo) << 2);
			ul_content |= BIT(15);

		} else {
			ul_content = 0;
		}

		ul_command = CAM_CONTENT_COUNT * uc_index + entry_i;
		ul_command = ul_command | BIT(31) | BIT(16);

		rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], ul_content);
		rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);

		RT_TRACE(COMP_SEC, DBG_LOUD,
			 ("stg_rtl_cam_empty_entry(): WRITE A4: %x\n",
			  ul_content));
		RT_TRACE(COMP_SEC, DBG_LOUD,
			 ("stg_rtl_cam_empty_entry(): WRITE A0: %x\n",
			  ul_command));
	}
}
EXPORT_SYMBOL(stg_rtl_cam_empty_entry);

u8 stg_rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	u32 bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> 4;
	u8 entry_idx = 0;
	u8 i, *addr;

	if (!sta_addr) {
		RT_TRACE(COMP_SEC, DBG_EMERG,
			 ("sta_addr is NULL\n"));
		return TOTAL_CAM_ENTRY;
	}
	/* Does STA already exist? */
	for (i = 4; i < TOTAL_CAM_ENTRY; i++) {
		addr = rtlpriv->sec.hwsec_cam_sta_addr[i];
		if (memcmp(addr, sta_addr, ETH_ALEN) == 0)
			return i;
	}
	/* Get a free CAM entry. */
	for (entry_idx = 4; entry_idx < TOTAL_CAM_ENTRY; entry_idx++) {
		if ((bitmap & BIT(0)) == 0) {
			RT_TRACE(COMP_SEC, DBG_EMERG,
				 ("-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n",
					  rtlpriv->sec.hwsec_cam_bitmap, entry_idx));
			rtlpriv->sec.hwsec_cam_bitmap |= BIT(0) << entry_idx;
			memcpy(rtlpriv->sec.hwsec_cam_sta_addr[entry_idx],
			       sta_addr, ETH_ALEN);
			return entry_idx;
		}
		bitmap = bitmap >> 1;
	}
	return TOTAL_CAM_ENTRY;
}
EXPORT_SYMBOL(stg_rtl_cam_get_free_entry);

void stg_rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	u32 bitmap;
	u8 i, *addr;

	if (NULL == sta_addr) {
		RT_TRACE(COMP_SEC, DBG_EMERG,
			 ("sta_addr is NULL.\n"));
		return;
	}

	if (is_zero_ether_addr(sta_addr)) {
		RT_TRACE(COMP_SEC, DBG_EMERG,
			 ("sta_addr is 00:00:00:00:00:00.\n"));
		return;
	}
	/* Does STA already exist? */
	for (i = 4; i < TOTAL_CAM_ENTRY; i++) {
		addr = rtlpriv->sec.hwsec_cam_sta_addr[i];
		bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> i;
		if (((bitmap & BIT(0)) == BIT(0)) &&
		    (memcmp(addr, sta_addr, ETH_ALEN) == 0)) {
			/* Remove from HW Security CAM */
			memset(rtlpriv->sec.hwsec_cam_sta_addr[i], 0, ETH_ALEN);
			rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i);
			pr_info("&&&&&&&&&del entry %d\n", i);
		}
	}
	return;
}
EXPORT_SYMBOL(stg_rtl_cam_del_entry);
+52 −0
Original line number Diff line number Diff line
/******************************************************************************
 *
 * Copyright(c) 2009-2010  Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *
 *****************************************************************************/

#ifndef __RTL_CAM_H_
#define __RTL_CAM_H_

#define CAM_CONTENT_COUNT				8

#define CFG_DEFAULT_KEY					BIT(5)
#define CFG_VALID					BIT(15)

#define PAIRWISE_KEYIDX					0
#define CAM_PAIRWISE_KEY_POSITION			4

#define	CAM_CONFIG_USEDK				1
#define	CAM_CONFIG_NO_USEDK				0

void stg_rtl_cam_reset_all_entry(struct ieee80211_hw *hw);
u8 stg_rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
			     u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg,
			     u32 ul_default_key, u8 *key_content);
int stg_rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
				 u32 ul_key_id);
void stg_rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index);
void stg_rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index);
void rtl92e_cam_reset_sec_info(struct ieee80211_hw *hw);
u8 stg_rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr);
void stg_rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr);

#endif
+70 −0
Original line number Diff line number Diff line
#ifndef __RTL_COMPAT_H__
#define __RTL_COMPAT_H__


#define RX_FLAG_MACTIME_MPDU RX_FLAG_MACTIME_START

#define IEEE80211_KEY_FLAG_SW_MGMT IEEE80211_KEY_FLAG_SW_MGMT_TX

struct ieee80211_mgmt_compat {
	__le16 frame_control;
	__le16 duration;
	u8 da[6];
	u8 sa[6];
	u8 bssid[6];
	__le16 seq_ctrl;
	union {
		struct {
			u8 category;
			union {
				struct {
					u8 action_code;
					u8 dialog_token;
					u8 status_code;
					u8 variable[0];
				} __packed wme_action;
				struct {
					u8 action_code;
					u8 dialog_token;
					__le16 capab;
					__le16 timeout;
					__le16 start_seq_num;
				} __packed addba_req;
				struct{
					u8 action_code;
					u8 dialog_token;
					__le16 status;
					__le16 capab;
					__le16 timeout;
				} __packed addba_resp;
				struct {
					u8 action_code;
					__le16 params;
					__le16 reason_code;
				} __packed delba;
				struct {
					u8 action_code;
					/* capab_info for open and confirm,
					 * reason for close
					 */
					__le16 aux;
					/* Followed in plink_confirm by status
					 * code, AID and supported rates,
					 * and directly by supported rates in
					 * plink_open and plink_close
					 */
					u8 variable[0];
				} __packed plink_action;
				struct {
					u8 action_code;
					u8 variable[0];
				} __packed mesh_action;
				struct {
					u8 action;
					u8 smps_control;
				} __packed ht_smps;
			} u;
		} __packed action;
	} u;
} __packed;
#endif
Loading