Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5abbcb2 authored by John W. Linville's avatar John W. Linville
Browse files

Merge branch 'for-linville' of git://github.com/kvalo/ath6kl

parents 49a59543 62c83ac4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,5 +31,7 @@ ath6kl-y += init.o
ath6kl-y += main.o
ath6kl-y += txrx.o
ath6kl-y += wmi.o
ath6kl-y += node.o
ath6kl-y += sdio.o
ath6kl-$(CONFIG_NL80211_TESTMODE) += testmode.o

ccflags-y += -D__CHECK_ENDIAN__
+10 −13
Original line number Diff line number Diff line
@@ -62,14 +62,14 @@ static int ath6kl_get_bmi_cmd_credits(struct ath6kl *ar)
	return 0;
}

static int ath6kl_bmi_get_rx_lkahd(struct ath6kl *ar, bool need_timeout)
static int ath6kl_bmi_get_rx_lkahd(struct ath6kl *ar)
{
	unsigned long timeout;
	u32 rx_word = 0;
	int ret = 0;

	timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT);
	while ((!need_timeout || time_before(jiffies, timeout)) && !rx_word) {
	while (time_before(jiffies, timeout) && !rx_word) {
		ret = hif_read_write_sync(ar, RX_LOOKAHEAD_VALID_ADDRESS,
					  (u8 *)&rx_word, sizeof(rx_word),
					  HIF_RD_SYNC_BYTE_INC);
@@ -109,8 +109,7 @@ static int ath6kl_bmi_send_buf(struct ath6kl *ar, u8 *buf, u32 len)
	return ret;
}

static int ath6kl_bmi_recv_buf(struct ath6kl *ar,
			u8 *buf, u32 len, bool want_timeout)
static int ath6kl_bmi_recv_buf(struct ath6kl *ar, u8 *buf, u32 len)
{
	int ret;
	u32 addr;
@@ -162,7 +161,7 @@ static int ath6kl_bmi_recv_buf(struct ath6kl *ar,
	 * a function of Host processor speed.
	 */
	if (len >= 4) { /* NB: Currently, always true */
		ret = ath6kl_bmi_get_rx_lkahd(ar, want_timeout);
		ret = ath6kl_bmi_get_rx_lkahd(ar);
		if (ret)
			return ret;
	}
@@ -220,7 +219,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,
	}

	ret = ath6kl_bmi_recv_buf(ar, (u8 *)&targ_info->version,
			sizeof(targ_info->version), true);
				  sizeof(targ_info->version));
	if (ret) {
		ath6kl_err("Unable to recv target info: %d\n", ret);
		return ret;
@@ -230,8 +229,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,
		/* Determine how many bytes are in the Target's targ_info */
		ret = ath6kl_bmi_recv_buf(ar,
				   (u8 *)&targ_info->byte_count,
				   sizeof(targ_info->byte_count),
				   true);
				   sizeof(targ_info->byte_count));
		if (ret) {
			ath6kl_err("unable to read target info byte count: %d\n",
				   ret);
@@ -252,8 +250,7 @@ int ath6kl_bmi_get_target_info(struct ath6kl *ar,
				   ((u8 *)targ_info) +
				   sizeof(targ_info->byte_count),
				   sizeof(*targ_info) -
				   sizeof(targ_info->byte_count),
				   true);
				   sizeof(targ_info->byte_count));

		if (ret) {
			ath6kl_err("Unable to read target info (%d bytes): %d\n",
@@ -311,7 +308,7 @@ int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
				   ret);
			return ret;
		}
		ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, rx_len, true);
		ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, rx_len);
		if (ret) {
			ath6kl_err("Unable to read from the device: %d\n",
				   ret);
@@ -424,7 +421,7 @@ int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param)
		return ret;
	}

	ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, sizeof(*param), false);
	ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, sizeof(*param));
	if (ret) {
		ath6kl_err("Unable to read from the device: %d\n", ret);
		return ret;
@@ -504,7 +501,7 @@ int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param)
		return ret;
	}

	ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, sizeof(*param), true);
	ret = ath6kl_bmi_recv_buf(ar, ar->bmi.cmd_buf, sizeof(*param));
	if (ret) {
		ath6kl_err("Unable to read from the device: %d\n", ret);
		return ret;
+2 −2
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@

#define TARGET_VERSION_SENTINAL 0xffffffff
#define TARGET_TYPE_AR6003      3

#define TARGET_TYPE_AR6004      5
#define BMI_ROMPATCH_INSTALL               9
/*
 * Semantics: Install a ROM Patch.
+635 −259

File changed.

Preview size limit exceeded, changes collapsed.

+0 −83
Original line number Diff line number Diff line
@@ -75,94 +75,11 @@ enum crypto_type {
	AES_CRYPT           = 0x08,
};

#define ATH6KL_NODE_HASHSIZE 32
/* simple hash is enough for variation of macaddr */
#define ATH6KL_NODE_HASH(addr)   \
	(((const u8 *)(addr))[ETH_ALEN - 1] % \
	 ATH6KL_NODE_HASHSIZE)

/*
 * Table of ath6kl_node instances.  Each ieee80211com
 * has at least one for holding the scan candidates.
 * When operating as an access point or in ibss mode there
 * is a second table for associated stations or neighbors.
 */
struct ath6kl_node_table {
	spinlock_t nt_nodelock;	/* on node table */
	struct bss *nt_node_first;	/* information of all nodes */
	struct bss *nt_node_last;	/* information of all nodes */
	struct bss *nt_hash[ATH6KL_NODE_HASHSIZE];
	const char *nt_name;	/* for debugging */
	u32 nt_node_age;		/* node aging time */
};

#define WLAN_NODE_INACT_TIMEOUT_MSEC    120000
#define WLAN_NODE_INACT_CNT		4

struct ath6kl_common_ie {
	u16 ie_chan;
	u8 *ie_tstamp;
	u8 *ie_ssid;
	u8 *ie_rates;
	u8 *ie_xrates;
	u8 *ie_country;
	u8 *ie_wpa;
	u8 *ie_rsn;
	u8 *ie_wmm;
	u8 *ie_ath;
	u16 ie_capInfo;
	u16 ie_beaconInt;
	u8 *ie_tim;
	u8 *ie_chswitch;
	u8 ie_erp;
	u8 *ie_wsc;
	u8 *ie_htcap;
	u8 *ie_htop;
};

struct bss {
	u8 ni_macaddr[ETH_ALEN];
	u8 ni_snr;
	s16 ni_rssi;
	struct bss *ni_list_next;
	struct bss *ni_list_prev;
	struct bss *ni_hash_next;
	struct bss *ni_hash_prev;
	struct ath6kl_common_ie ni_cie;
	u8 *ni_buf;
	u16 ni_framelen;
	struct ath6kl_node_table *ni_table;
	u32 ni_refcnt;

	u32 ni_tstamp;
	u32 ni_actcnt;
};

struct htc_endpoint_credit_dist;
struct ath6kl;
enum htc_credit_dist_reason;
struct htc_credit_state_info;

struct bss *wlan_node_alloc(int wh_size);
void wlan_node_free(struct bss *ni);
void wlan_setup_node(struct ath6kl_node_table *nt, struct bss *ni,
		     const u8 *mac_addr);
struct bss *wlan_find_node(struct ath6kl_node_table *nt,
			   const u8 *mac_addr);
void wlan_node_reclaim(struct ath6kl_node_table *nt, struct bss *ni);
void wlan_free_allnodes(struct ath6kl_node_table *nt);
void wlan_iterate_nodes(struct ath6kl_node_table *nt, void *arg);

void wlan_node_table_init(struct ath6kl_node_table *nt);
void wlan_node_table_cleanup(struct ath6kl_node_table *nt);

void wlan_refresh_inactive_nodes(struct ath6kl *ar);

struct bss *wlan_find_ssid_node(struct ath6kl_node_table *nt, u8 *ssid,
				  u32 ssid_len, bool is_wpa2, bool match_ssid);

void wlan_node_return(struct ath6kl_node_table *nt, struct bss *ni);

int ath6k_setup_credit_dist(void *htc_handle,
			    struct htc_credit_state_info *cred_info);
void ath6k_credit_distribute(struct htc_credit_state_info *cred_inf,
Loading