Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 11/16] wcn36xx: Add txrx.c
From: Eugene Krasnikov @ 2013-08-20 17:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: wcn36xx, Eugene Krasnikov
In-Reply-To: <1377020479-16935-1-git-send-email-k.eugene.e@gmail.com>

Adding txrx.c

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/txrx.c | 261 ++++++++++++++++++++++++++++++++
 1 file changed, 261 insertions(+)
 create mode 100644 drivers/net/wireless/ath/wcn36xx/txrx.c

diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
new file mode 100644
index 0000000..54fb86e
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "txrx.h"
+
+static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
+{
+	return 100 - ((bd->phy_stat0 >> 24) & 0xff);
+}
+
+int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
+{
+	struct ieee80211_rx_status status;
+	struct ieee80211_hdr *hdr;
+	struct wcn36xx_rx_bd *bd;
+	u16 fc, sn;
+
+	/*
+	 * All fields must be 0, otherwise it can lead to
+	 * unexpected consequences.
+	 */
+	memset(&status, 0, sizeof(status));
+
+	bd = (struct wcn36xx_rx_bd *)skb->data;
+	buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
+	wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP,
+			 "BD   <<< ", (char *)bd,
+			 sizeof(struct wcn36xx_rx_bd));
+
+	skb_put(skb, bd->pdu.mpdu_header_off + bd->pdu.mpdu_len);
+	skb_pull(skb, bd->pdu.mpdu_header_off);
+
+	status.mactime = 10;
+	status.freq = WCN36XX_CENTER_FREQ(wcn);
+	status.band = WCN36XX_BAND(wcn);
+	status.signal = -get_rssi0(bd);
+	status.antenna = 1;
+	status.rate_idx = 1;
+	status.flag = 0;
+	status.rx_flags = 0;
+	status.flag |= RX_FLAG_IV_STRIPPED |
+		       RX_FLAG_MMIC_STRIPPED |
+		       RX_FLAG_DECRYPTED;
+
+	wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=%x status->vendor_radiotap_len=%x",
+		    status.flag,  status.vendor_radiotap_len);
+
+	memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
+
+	hdr = (struct ieee80211_hdr *) skb->data;
+	fc = __le16_to_cpu(hdr->frame_control);
+	sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl));
+
+	if (ieee80211_is_beacon(hdr->frame_control)) {
+		wcn36xx_dbg(WCN36XX_DBG_BEACON, "beacon skb %p len %d fc %04x sn %d",
+			    skb, skb->len, fc, sn);
+		wcn36xx_dbg_dump(WCN36XX_DBG_BEACON_DUMP, "SKB <<< ",
+				 (char *)skb->data, skb->len);
+	} else {
+		wcn36xx_dbg(WCN36XX_DBG_RX, "rx skb %p len %d fc %04x sn %d",
+			    skb, skb->len, fc, sn);
+		wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP, "SKB <<< ",
+				 (char *)skb->data, skb->len);
+	}
+
+	ieee80211_rx_irqsafe(wcn->hw, skb);
+
+	return 0;
+}
+
+static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd,
+			       u32 mpdu_header_len,
+			       u32 len,
+			       u16 tid)
+{
+	bd->pdu.mpdu_header_len = mpdu_header_len;
+	bd->pdu.mpdu_header_off = sizeof(*bd);
+	bd->pdu.mpdu_data_off = bd->pdu.mpdu_header_len +
+		bd->pdu.mpdu_header_off;
+	bd->pdu.mpdu_len = len;
+	bd->pdu.tid = tid;
+}
+
+static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,
+				struct wcn36xx *wcn,
+				struct wcn36xx_sta *sta_priv,
+				struct ieee80211_hdr *hdr,
+				bool bcast)
+{
+	struct ieee80211_vif *vif = container_of((void *)wcn->current_vif,
+						 struct ieee80211_vif,
+						 drv_priv);
+	bd->bd_rate = WCN36XX_BD_RATE_DATA;
+	bd->dpu_sign = wcn->current_vif->ucast_dpu_signature;
+
+	/*
+	 * For not unicast frames mac80211 will not set sta pointer so use
+	 * self_sta_index instead.
+	 */
+	if (sta_priv) {
+		if (vif->type == NL80211_IFTYPE_STATION) {
+			bd->sta_index = sta_priv->bss_sta_index;
+			bd->dpu_desc_idx = sta_priv->bss_dpu_desc_index;
+		} else if (vif->type == NL80211_IFTYPE_AP ||
+			   vif->type == NL80211_IFTYPE_ADHOC ||
+			   vif->type == NL80211_IFTYPE_MESH_POINT) {
+			bd->sta_index = sta_priv->sta_index;
+			bd->dpu_desc_idx = sta_priv->dpu_desc_index;
+		}
+	} else {
+		bd->sta_index = wcn->current_vif->self_sta_index;
+		bd->dpu_desc_idx = wcn->current_vif->self_dpu_desc_index;
+	}
+
+	if (ieee80211_is_nullfunc(hdr->frame_control) ||
+	   (sta_priv && !sta_priv->is_data_encrypted))
+		bd->dpu_ne = 1;
+
+	if (bcast) {
+		bd->ub = 1;
+		bd->ack_policy = 1;
+	}
+}
+
+static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
+				struct wcn36xx *wcn,
+				struct ieee80211_hdr *hdr,
+				bool bcast)
+{
+	bd->sta_index = wcn->current_vif->self_sta_index;
+	bd->dpu_desc_idx = wcn->current_vif->self_dpu_desc_index;
+	bd->dpu_ne = 1;
+
+	/* default rate for unicast */
+	if (ieee80211_is_mgmt(hdr->frame_control))
+		bd->bd_rate = (WCN36XX_BAND(wcn) == IEEE80211_BAND_5GHZ) ?
+			WCN36XX_BD_RATE_CTRL :
+			WCN36XX_BD_RATE_MGMT;
+	else if (ieee80211_is_ctl(hdr->frame_control))
+		bd->bd_rate = WCN36XX_BD_RATE_CTRL;
+	else
+		wcn36xx_warn("frame control type unknown");
+
+	/*
+	 * In joining state trick hardware that probe is sent as
+	 * unicast even if address is broadcast.
+	 */
+	if (wcn->is_joining &&
+	    ieee80211_is_probe_req(hdr->frame_control))
+		bcast = false;
+
+	if (bcast) {
+		/* broadcast */
+		bd->ub = 1;
+		/* No ack needed not unicast */
+		bd->ack_policy = 1;
+		bd->queue_id = WCN36XX_TX_B_WQ_ID;
+	} else
+		bd->queue_id = WCN36XX_TX_U_WQ_ID;
+}
+
+int wcn36xx_start_tx(struct wcn36xx *wcn,
+		     struct wcn36xx_sta *sta_priv,
+		     struct sk_buff *skb)
+{
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	unsigned long flags;
+	bool is_low = ieee80211_is_data(hdr->frame_control);
+	bool bcast = is_broadcast_ether_addr(hdr->addr1) ||
+		is_multicast_ether_addr(hdr->addr1);
+	struct wcn36xx_tx_bd *bd = wcn36xx_dxe_get_next_bd(wcn, is_low);
+
+	if (!bd) {
+		/*
+		 * TX DXE are used in pairs. One for the BD and one for the
+		 * actual frame. The BD DXE's has a preallocated buffer while
+		 * the skb ones does not. If this isn't true something is really
+		 * wierd. TODO: Recover from this situation
+		 */
+
+		wcn36xx_error("bd address may not be NULL for BD DXE");
+		return -EINVAL;
+	}
+
+	memset(bd, 0, sizeof(*bd));
+
+	wcn36xx_dbg(WCN36XX_DBG_TX,
+		    "tx skb %p len %d fc %04x sn %d %s %s",
+		    skb, skb->len, __le16_to_cpu(hdr->frame_control),
+		    IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)),
+		    is_low ? "low" : "high", bcast ? "bcast" : "ucast");
+
+	wcn36xx_dbg_dump(WCN36XX_DBG_TX_DUMP, "", skb->data, skb->len);
+
+	bd->dpu_rf = WCN36XX_BMU_WQ_TX;
+
+	bd->tx_comp = info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS;
+	if (bd->tx_comp) {
+		wcn36xx_dbg(WCN36XX_DBG_DXE, "TX_ACK status requested");
+		spin_lock_irqsave(&wcn->dxe_lock, flags);
+		if (wcn->tx_ack_skb) {
+			spin_unlock_irqrestore(&wcn->dxe_lock, flags);
+			wcn36xx_warn("tx_ack_skb already set");
+			ieee80211_free_txskb(wcn->hw, skb);
+			return -EINVAL;
+		}
+
+		wcn->tx_ack_skb = skb;
+		spin_unlock_irqrestore(&wcn->dxe_lock, flags);
+
+		/* Only one at a time is supported by fw. Stop the TX queues
+		 * until the ack status gets back.
+		 *
+		 * TODO: Add watchdog in case FW does not answer
+		 */
+		ieee80211_stop_queues(wcn->hw);
+	}
+
+	/* Data frames served first*/
+	if (is_low) {
+		/*
+		 * Sometimes in AP mode mac80211 is trying to send data
+		 * frame to nobody. Why?
+		 */
+		if (!sta_priv)
+			wcn36xx_warn("Sending data packet to nobody");
+		wcn36xx_set_tx_data(bd, wcn, sta_priv, hdr, bcast);
+		wcn36xx_set_tx_pdu(bd,
+			   ieee80211_is_data_qos(hdr->frame_control) ?
+			   sizeof(struct ieee80211_qos_hdr) :
+			   sizeof(struct ieee80211_hdr_3addr),
+			   skb->len, sta_priv ? sta_priv->tid : 0);
+	} else {
+		/* MGMT and CTRL frames are handeld here*/
+		wcn36xx_set_tx_mgmt(bd, wcn, hdr, bcast);
+		wcn36xx_set_tx_pdu(bd,
+			   ieee80211_is_data_qos(hdr->frame_control) ?
+			   sizeof(struct ieee80211_qos_hdr) :
+			   sizeof(struct ieee80211_hdr_3addr),
+			   skb->len, WCN36XX_TID);
+	}
+
+	buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
+	bd->tx_bd_sign = 0xbdbdbdbd;
+
+	return wcn36xx_dxe_tx_frame(wcn, skb, is_low);
+}
-- 
1.8.2.2


^ permalink raw reply related

* [PATCH 12/16] wcn36xx: Add txrx.h
From: Eugene Krasnikov @ 2013-08-20 17:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: wcn36xx, Eugene Krasnikov
In-Reply-To: <1377020479-16935-1-git-send-email-k.eugene.e@gmail.com>

Adding txrx.h

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/txrx.h | 160 ++++++++++++++++++++++++++++++++
 1 file changed, 160 insertions(+)
 create mode 100644 drivers/net/wireless/ath/wcn36xx/txrx.h

diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.h b/drivers/net/wireless/ath/wcn36xx/txrx.h
new file mode 100644
index 0000000..bbfbcf8
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _TXRX_H_
+#define _TXRX_H_
+
+#include <linux/etherdevice.h>
+#include "wcn36xx.h"
+
+/* TODO describe all properties */
+#define WCN36XX_802_11_HEADER_LEN	24
+#define WCN36XX_BMU_WQ_TX		25
+#define WCN36XX_TID			7
+/* broadcast wq ID */
+#define WCN36XX_TX_B_WQ_ID		0xA
+#define WCN36XX_TX_U_WQ_ID		0x9
+/* bd_rate */
+#define WCN36XX_BD_RATE_DATA 0
+#define WCN36XX_BD_RATE_MGMT 2
+#define WCN36XX_BD_RATE_CTRL 3
+
+struct wcn36xx_pdu {
+	u32	dpu_fb:8;
+	u32	adu_fb:8;
+	u32	pdu_id:16;
+
+	/* 0x04*/
+	u32	tail_pdu_idx:16;
+	u32	head_pdu_idx:16;
+
+	/* 0x08*/
+	u32	pdu_count:7;
+	u32	mpdu_data_off:9;
+	u32	mpdu_header_off:8;
+	u32	mpdu_header_len:8;
+
+	/* 0x0c*/
+	u32	reserved4:8;
+	u32	tid:4;
+	u32	reserved3:4;
+	u32	mpdu_len:16;
+};
+
+struct wcn36xx_rx_bd {
+	u32	bdt:2;
+	u32	ft:1;
+	u32	dpu_ne:1;
+	u32	rx_key_id:3;
+	u32	ub:1;
+	u32	rmf:1;
+	u32	uma_bypass:1;
+	u32	csr11:1;
+	u32	reserved0:1;
+	u32	scan_learn:1;
+	u32	rx_ch:4;
+	u32	rtsf:1;
+	u32	bsf:1;
+	u32	a2hf:1;
+	u32	st_auf:1;
+	u32	dpu_sign:3;
+	u32	dpu_rf:8;
+
+	struct wcn36xx_pdu pdu;
+
+	/* 0x14*/
+	u32	addr3:8;
+	u32	addr2:8;
+	u32	addr1:8;
+	u32	dpu_desc_idx:8;
+
+	/* 0x18*/
+	u32	rxp_flags:23;
+	u32	rate_id:9;
+
+	u32	phy_stat0;
+	u32	phy_stat1;
+
+	/* 0x24 */
+	u32	rx_times;
+
+	u32	pmi_cmd[6];
+
+	/* 0x40 */
+	u32	reserved7:4;
+	u32	reorder_slot_id:6;
+	u32	reorder_fwd_id:6;
+	u32	reserved6:12;
+	u32	reorder_code:4;
+
+	/* 0x44 */
+	u32	exp_seq_num:12;
+	u32	cur_seq_num:12;
+	u32	fr_type_subtype:8;
+
+	/* 0x48 */
+	u32	msdu_size:16;
+	u32	sub_fr_id:4;
+	u32	proc_order:4;
+	u32	reserved9:4;
+	u32	aef:1;
+	u32	lsf:1;
+	u32	esf:1;
+	u32	asf:1;
+};
+
+struct wcn36xx_tx_bd {
+	u32	bdt:2;
+	u32	ft:1;
+	u32	dpu_ne:1;
+	u32	fw_tx_comp:1;
+	u32	tx_comp:1;
+	u32	reserved1:1;
+	u32	ub:1;
+	u32	rmf:1;
+	u32	reserved0:12;
+	u32	dpu_sign:3;
+	u32	dpu_rf:8;
+
+	struct wcn36xx_pdu pdu;
+
+	/* 0x14*/
+	u32	reserved5:7;
+	u32	queue_id:5;
+	u32	bd_rate:2;
+	u32	ack_policy:2;
+	u32	sta_index:8;
+	u32	dpu_desc_idx:8;
+
+	u32	tx_bd_sign;
+	u32	reserved6;
+	u32	dxe_start_time;
+	u32	dxe_end_time;
+
+	/*u32	tcp_udp_start_off:10;
+	u32	header_cks:16;
+	u32	reserved7:6;*/
+};
+
+struct wcn36xx_sta;
+struct wcn36xx;
+
+int  wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb);
+int wcn36xx_start_tx(struct wcn36xx *wcn,
+		     struct wcn36xx_sta *sta_priv,
+		     struct sk_buff *skb);
+
+#endif	/* _TXRX_H_ */
-- 
1.8.2.2


^ permalink raw reply related

* [PATCH 13/16] wcn36xx: Add wcn36xx.h
From: Eugene Krasnikov @ 2013-08-20 17:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: wcn36xx, Eugene Krasnikov
In-Reply-To: <1377020479-16935-1-git-send-email-k.eugene.e@gmail.com>

Adding wcn36xx.h

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 239 +++++++++++++++++++++++++++++
 1 file changed, 239 insertions(+)
 create mode 100644 drivers/net/wireless/ath/wcn36xx/wcn36xx.h

diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
new file mode 100644
index 0000000..74e27fe
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WCN36XX_H_
+#define _WCN36XX_H_
+
+#include <linux/completion.h>
+#include <linux/printk.h>
+#include <linux/spinlock.h>
+#include <net/mac80211.h>
+
+#include "hal.h"
+#include "smd.h"
+#include "txrx.h"
+#include "dxe.h"
+#include "pmc.h"
+#include "debug.h"
+
+#define DRIVER_PREFIX "wcn36xx: "
+#define WLAN_NV_FILE               "wlan/prima/WCNSS_qcom_wlan_nv.bin"
+#define WCN36XX_AGGR_BUFFER_SIZE 64
+
+extern unsigned int debug_mask;
+
+enum wcn36xx_debug_mask {
+	WCN36XX_DBG_DXE		= 0x00000001,
+	WCN36XX_DBG_DXE_DUMP	= 0x00000002,
+	WCN36XX_DBG_SMD		= 0x00000004,
+	WCN36XX_DBG_SMD_DUMP	= 0x00000008,
+	WCN36XX_DBG_RX		= 0x00000010,
+	WCN36XX_DBG_RX_DUMP	= 0x00000020,
+	WCN36XX_DBG_TX		= 0x00000040,
+	WCN36XX_DBG_TX_DUMP	= 0x00000080,
+	WCN36XX_DBG_HAL		= 0x00000100,
+	WCN36XX_DBG_HAL_DUMP	= 0x00000200,
+	WCN36XX_DBG_MAC		= 0x00000400,
+	WCN36XX_DBG_BEACON	= 0x00000800,
+	WCN36XX_DBG_BEACON_DUMP	= 0x00001000,
+	WCN36XX_DBG_PMC		= 0x00002000,
+	WCN36XX_DBG_PMC_DUMP	= 0x00004000,
+	WCN36XX_DBG_ANY		= 0xffffffff,
+};
+
+#define wcn36xx_error(fmt, arg...) do {			\
+	pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg);	\
+	__WARN();					\
+} while (0)
+
+#define wcn36xx_warn(fmt, arg...)				\
+	pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
+
+#define wcn36xx_info(fmt, arg...)		\
+	pr_info(DRIVER_PREFIX fmt "\n", ##arg)
+
+#define wcn36xx_dbg(mask, fmt, arg...) do {			\
+	if (debug_mask & mask)					\
+		pr_debug(DRIVER_PREFIX fmt "\n", ##arg);	\
+} while (0)
+
+#define wcn36xx_dbg_dump(mask, prefix_str, buf, len) do {	\
+	if (debug_mask & mask)					\
+		print_hex_dump(KERN_DEBUG, prefix_str,		\
+			       DUMP_PREFIX_OFFSET, 32, 1,	\
+			       buf, len, false);		\
+} while (0)
+
+#define WCN36XX_HW_CHANNEL(__wcn) (__wcn->hw->conf.chandef.chan->hw_value)
+#define WCN36XX_BAND(__wcn) (__wcn->hw->conf.chandef.chan->band)
+#define WCN36XX_CENTER_FREQ(__wcn) (__wcn->hw->conf.chandef.chan->center_freq)
+#define WCN36XX_LISTEN_INTERVAL(__wcn) (__wcn->hw->conf.listen_interval)
+#define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags)
+#define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power)
+
+static inline void buff_to_be(u32 *buf, size_t len)
+{
+	int i;
+	for (i = 0; i < len; i++)
+		buf[i] = cpu_to_be32(buf[i]);
+}
+
+struct nv_data {
+	int	is_valid;
+	void	*table;
+};
+
+/* Interface for platform control path
+ *
+ * @open: hook must be called when wcn36xx wants to open control channel.
+ * @tx: sends a buffer.
+ */
+struct wcn36xx_platform_ctrl_ops {
+	int (*open)(void *drv_priv, void *rsp_cb);
+	void (*close)(void);
+	int (*tx)(char *buf, size_t len);
+	int (*get_hw_mac)(u8 *addr);
+	int (*smsm_change_state)(u32 clear_mask, u32 set_mask);
+};
+
+/**
+ * struct wcn36xx_vif - holds VIF related fields
+ *
+ * @bss_index: bss_index is initially set to 0xFF. bss_index is received from
+ * HW after first config_bss call and must be used in delete_bss and
+ * enter/exit_bmps.
+ */
+struct wcn36xx_vif {
+	u8 bss_index;
+	u8 ucast_dpu_signature;
+	/* Returned from WCN36XX_HAL_ADD_STA_SELF_RSP */
+	u8 self_sta_index;
+	u8 self_dpu_desc_index;
+};
+
+/**
+ * struct wcn36xx_sta - holds STA related fields
+ *
+ * @tid: traffic ID that is used during AMPDU and in TX BD.
+ * @sta_index: STA index is returned from HW after config_sta call and is
+ * used in both SMD channel and TX BD.
+ * @dpu_desc_index: DPU descriptor index is returned from HW after config_sta
+ * call and is used in TX BD.
+ * @bss_sta_index: STA index is returned from HW after config_bss call and is
+ * used in both SMD channel and TX BD. See table bellow when it is used.
+ * @bss_dpu_desc_index: DPU descriptor index is returned from HW after
+ * config_bss call and is used in TX BD.
+ * ______________________________________________
+ * |		  |	STA	|	AP	|
+ * |______________|_____________|_______________|
+ * |    TX BD     |bss_sta_index|   sta_index   |
+ * |______________|_____________|_______________|
+ * |all SMD calls |bss_sta_index|   sta_index	|
+ * |______________|_____________|_______________|
+ * |smd_delete_sta|  sta_index  |   sta_index	|
+ * |______________|_____________|_______________|
+ */
+struct wcn36xx_sta {
+	u16 tid;
+	u8 sta_index;
+	u8 dpu_desc_index;
+	u8 bss_sta_index;
+	u8 bss_dpu_desc_index;
+	bool is_data_encrypted;
+};
+struct wcn36xx_dxe_ch;
+struct wcn36xx {
+	struct ieee80211_hw	*hw;
+	struct device		*dev;
+	struct mac_address	addresses;
+	struct wcn36xx_hal_mac_ssid ssid;
+	u16			aid;
+	struct wcn36xx_vif	*current_vif;
+	struct wcn36xx_sta	*sta;
+	u8			dtim_period;
+	enum ani_ed_type	encrypt_type;
+
+	/* WoW related*/
+	struct mutex		pm_mutex;
+	bool			is_suspended;
+	bool			is_con_lost_pending;
+
+	u8			fw_revision;
+	u8			fw_version;
+	u8			fw_minor;
+	u8			fw_major;
+
+	/* extra byte for the NULL termination */
+	u8			crm_version[WCN36XX_HAL_VERSION_LENGTH + 1];
+	u8			wlan_version[WCN36XX_HAL_VERSION_LENGTH + 1];
+
+	/* IRQs */
+	int			tx_irq;
+	int			rx_irq;
+	void __iomem		*mmio;
+
+	/* Rates */
+	struct wcn36xx_hal_supported_rates supported_rates;
+
+	struct wcn36xx_platform_ctrl_ops *ctrl_ops;
+	/*
+	 * smd_buf must be protected with smd_mutex to garantee
+	 * that all messages are sent one after another
+	 */
+	u8			*smd_buf;
+	struct mutex		smd_mutex;
+
+	bool			is_joining;
+
+	/* DXE channels */
+	struct wcn36xx_dxe_ch	dxe_tx_l_ch;	/* TX low */
+	struct wcn36xx_dxe_ch	dxe_tx_h_ch;	/* TX high */
+	struct wcn36xx_dxe_ch	dxe_rx_l_ch;	/* RX low */
+	struct wcn36xx_dxe_ch	dxe_rx_h_ch;	/* RX high */
+
+	/* For synchronization of DXE resources from BH, IRQ and WQ contexts */
+	spinlock_t	dxe_lock;
+	bool                    queues_stopped;
+
+	/* Memory pools */
+	struct wcn36xx_dxe_mem_pool mgmt_mem_pool;
+	struct wcn36xx_dxe_mem_pool data_mem_pool;
+
+	struct sk_buff		*tx_ack_skb;
+
+	/* Power management */
+	enum wcn36xx_power_state     pw_state;
+
+#ifdef CONFIG_WCN36XX_DEBUGFS
+	/* Debug file system entry */
+	struct wcn36xx_dfs_entry    dfs;
+#endif /* CONFIG_WCN36XX_DEBUGFS */
+
+};
+
+static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
+					 u8 major,
+					 u8 minor,
+					 u8 version,
+					 u8 revision)
+{
+	return (wcn->fw_major == major &&
+		wcn->fw_minor == minor &&
+		wcn->fw_version == version &&
+		wcn->fw_revision == revision);
+}
+
+#endif	/* _WCN36XX_H_ */
-- 
1.8.2.2


^ permalink raw reply related

* [PATCH 14/16] wcn36xx: Add Makefile
From: Eugene Krasnikov @ 2013-08-20 17:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: wcn36xx, Eugene Krasnikov
In-Reply-To: <1377020479-16935-1-git-send-email-k.eugene.e@gmail.com>

Adding Makefile

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 drivers/net/wireless/ath/wcn36xx/Makefile

diff --git a/drivers/net/wireless/ath/wcn36xx/Makefile b/drivers/net/wireless/ath/wcn36xx/Makefile
new file mode 100644
index 0000000..3351185
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/Makefile
@@ -0,0 +1,9 @@
+obj-$(CONFIG_WCN36XX) := wcn36xx.o
+wcn36xx-y += 	main.o \
+		dxe.o \
+		txrx.o \
+		smd.o \
+		pmc.o \
+		debug.o
+
+
-- 
1.8.2.2


^ permalink raw reply related

* [PATCH 15/16] wcn36xx: Add Kconfig
From: Eugene Krasnikov @ 2013-08-20 17:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: wcn36xx, Eugene Krasnikov
In-Reply-To: <1377020479-16935-1-git-send-email-k.eugene.e@gmail.com>

Adding Kconfig

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/Kconfig | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 drivers/net/wireless/ath/wcn36xx/Kconfig

diff --git a/drivers/net/wireless/ath/wcn36xx/Kconfig b/drivers/net/wireless/ath/wcn36xx/Kconfig
new file mode 100644
index 0000000..591ebae
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/Kconfig
@@ -0,0 +1,16 @@
+config WCN36XX
+	tristate "Qualcomm Atheros WCN3660/3680 support"
+	depends on MAC80211 && HAS_DMA
+	---help---
+	  This module adds support for wireless adapters based on
+	  Qualcomm Atheros WCN3660 and WCN3680 mobile chipsets.
+
+	  If you choose to build a module, it'll be called wcn36xx.
+
+config WCN36XX_DEBUGFS
+	bool "WCN36XX debugfs support"
+	depends on WCN36XX
+	---help---
+	  Enabled debugfs support
+
+	  If unsure, say Y to make it easier to debug problems.
-- 
1.8.2.2


^ permalink raw reply related

* [PATCH 16/16] wcn36xx: Add wcn36xx to ath Makefile and Kconfig
From: Eugene Krasnikov @ 2013-08-20 17:41 UTC (permalink / raw)
  To: linux-wireless; +Cc: wcn36xx, Eugene Krasnikov
In-Reply-To: <1377020479-16935-1-git-send-email-k.eugene.e@gmail.com>

Now wcn36xx is part of ath family.

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
 drivers/net/wireless/ath/Kconfig  | 1 +
 drivers/net/wireless/ath/Makefile | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
index 1abf1d4..ba81d62 100644
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
@@ -32,5 +32,6 @@ source "drivers/net/wireless/ath/ath6kl/Kconfig"
 source "drivers/net/wireless/ath/ar5523/Kconfig"
 source "drivers/net/wireless/ath/wil6210/Kconfig"
 source "drivers/net/wireless/ath/ath10k/Kconfig"
+source "drivers/net/wireless/ath/wcn36xx/Kconfig"
 
 endif
diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile
index fb05cfd..363b056 100644
--- a/drivers/net/wireless/ath/Makefile
+++ b/drivers/net/wireless/ath/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATH6KL)		+= ath6kl/
 obj-$(CONFIG_AR5523)		+= ar5523/
 obj-$(CONFIG_WIL6210)		+= wil6210/
 obj-$(CONFIG_ATH10K)		+= ath10k/
+obj-$(CONFIG_WCN36XX)		+= wcn36xx/
 
 obj-$(CONFIG_ATH_COMMON)	+= ath.o
 
-- 
1.8.2.2


^ permalink raw reply related

* [PATCH 3.11] mac80211: add a flag to indicate CCK support for HT clients
From: Felix Fietkau @ 2013-08-20 17:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, teg

brcm80211 cannot handle sending frames with CCK rates as part of an
A-MPDU session. Other drivers may have issues too. Set the flag in all
drivers that have been tested with CCK rates.

This fixes a reported brcmsmac regression introduced in
commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
"mac80211/minstrel_ht: fix cck rate sampling"

Cc: stable@vger.kernel.org # 3.10
Reported-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/init.c    | 3 ++-
 drivers/net/wireless/ath/carl9170/main.c | 3 ++-
 drivers/net/wireless/rt2x00/rt2800lib.c  | 3 ++-
 include/net/mac80211.h                   | 1 +
 net/mac80211/rc80211_minstrel_ht.c       | 3 +++
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 16f8b20..026a2a0 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -802,7 +802,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 		IEEE80211_HW_PS_NULLFUNC_STACK |
 		IEEE80211_HW_SPECTRUM_MGMT |
 		IEEE80211_HW_REPORTS_TX_ACK_STATUS |
-		IEEE80211_HW_SUPPORTS_RC_TABLE;
+		IEEE80211_HW_SUPPORTS_RC_TABLE |
+		IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
 
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
 		hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 4a33c6e..349fa22 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1860,7 +1860,8 @@ void *carl9170_alloc(size_t priv_size)
 		     IEEE80211_HW_PS_NULLFUNC_STACK |
 		     IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC |
 		     IEEE80211_HW_SUPPORTS_RC_TABLE |
-		     IEEE80211_HW_SIGNAL_DBM;
+		     IEEE80211_HW_SIGNAL_DBM |
+		     IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
 
 	if (!modparam_noht) {
 		/*
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 1f80ea5..1b41c8e 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -6133,7 +6133,8 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	    IEEE80211_HW_SUPPORTS_PS |
 	    IEEE80211_HW_PS_NULLFUNC_STACK |
 	    IEEE80211_HW_AMPDU_AGGREGATION |
-	    IEEE80211_HW_REPORTS_TX_ACK_STATUS;
+	    IEEE80211_HW_REPORTS_TX_ACK_STATUS |
+	    IEEE80211_HW_SUPPORTS_HT_CCK_RATES;
 
 	/*
 	 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5b7a3da..551ba6a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1499,6 +1499,7 @@ enum ieee80211_hw_flags {
 	IEEE80211_HW_SUPPORTS_RC_TABLE			= 1<<24,
 	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF		= 1<<25,
 	IEEE80211_HW_TIMING_BEACON_ONLY			= 1<<26,
+	IEEE80211_HW_SUPPORTS_HT_CCK_RATES		= 1<<27,
 };
 
 /**
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index f5aed96..f3bbea1 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -828,6 +828,9 @@ minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
 	if (sband->band != IEEE80211_BAND_2GHZ)
 		return;
 
+	if (!(mp->hw->flags & IEEE80211_HW_SUPPORTS_HT_CCK_RATES))
+		return;
+
 	mi->cck_supported = 0;
 	mi->cck_supported_short = 0;
 	for (i = 0; i < 4; i++) {
-- 
1.8.0.2


^ permalink raw reply related

* Re: [PATCH 13/16] wcn36xx: Add wcn36xx.h
From: Joe Perches @ 2013-08-20 18:04 UTC (permalink / raw)
  To: Eugene Krasnikov; +Cc: linux-wireless, wcn36xx
In-Reply-To: <1377020479-16935-14-git-send-email-k.eugene.e@gmail.com>

On Tue, 2013-08-20 at 19:41 +0200, Eugene Krasnikov wrote:
> Adding wcn36xx.h
[]
> +#define DRIVER_PREFIX "wcn36xx: "
[]

I think you should use pr_fmt and/or netdev_<level>

> +#define wcn36xx_error(fmt, arg...) do {			\
> +	pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg);	\
> +	__WARN();					\
> +} while (0)

What value is there in this __WARN?

Please use _err rather than _error

> +#define wcn36xx_warn(fmt, arg...)				\
> +	pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
> +
> +#define wcn36xx_info(fmt, arg...)		\
> +	pr_info(DRIVER_PREFIX fmt "\n", ##arg)
> +
> +#define wcn36xx_dbg(mask, fmt, arg...) do {			\
> +	if (debug_mask & mask)					\
> +		pr_debug(DRIVER_PREFIX fmt "\n", ##arg);	\
> +} while (0)
> +
> +#define wcn36xx_dbg_dump(mask, prefix_str, buf, len) do {	\
> +	if (debug_mask & mask)					\
> +		print_hex_dump(KERN_DEBUG, prefix_str,		\
> +			       DUMP_PREFIX_OFFSET, 32, 1,	\
> +			       buf, len, false);		\
> +} while (0)
> +

Please move the "\n" to the uses instead of the macro.
This would be consistent with all the other ath macros.



^ permalink raw reply

* Re: [PATCH 09/16] wcn36xx: Add smd.c
From: Joe Perches @ 2013-08-20 18:12 UTC (permalink / raw)
  To: Eugene Krasnikov; +Cc: linux-wireless, wcn36xx
In-Reply-To: <1377020479-16935-10-git-send-email-k.eugene.e@gmail.com>

On Tue, 2013-08-20 at 19:41 +0200, Eugene Krasnikov wrote:

> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
[]
> +int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
> +{
[]
> +		/* Add NV body itself */
> +		/* Rework me */
> +		memcpy(wcn->smd_buf + sizeof(msg_body),
> +		       (void *)(&nv_d->table) + fm_offset,
> +		       msg_body.nv_img_buffer_size);

Does this really do what you want?

Perhaps it should be:

		memcpy(wcn->smd_buf + sizeof(msg_body),
		       ((void *)&nv_d->table) + fm_offset,
		       msg_body.nv_img_buffer_size);




^ permalink raw reply

* Re: [PATCH 12/12] brcmsmac: add support for BCM4313 iPA variant
From: Joe Perches @ 2013-08-20 18:30 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: John W. Linville, linux-wireless
In-Reply-To: <1377007246-9957-13-git-send-email-arend@broadcom.com>

On Tue, 2013-08-20 at 16:00 +0200, Arend van Spriel wrote:
> This patch completes the changes needed for supporting the
> iPA variant cards of the BCM4313 wireless chipset.
[]
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
[]
> @@ -1826,6 +1826,17 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
>  		write_radio_reg(pi, RADIO_2064_REG038, 3);
>  		write_radio_reg(pi, RADIO_2064_REG091, 7);
>  	}
> +
> +	if (!(pi->sh->boardflags & BFL_FEM)) {
> +		u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc,
> +			0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0};

static const would reduce the object size.

> +		write_radio_reg(pi, RADIO_2064_REG02A, 0xf);
> +		write_radio_reg(pi, RADIO_2064_REG091, 0x3);
> +		write_radio_reg(pi, RADIO_2064_REG038, 0x3);
> +
> +		write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]);

Does anything limit channel to < 15?

There seem to be an awful lot of magic numbers
in the patch.



^ permalink raw reply

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Arend van Spriel @ 2013-08-20 19:04 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: Linux Wireless List
In-Reply-To: <5213A926.8060306@openwrt.org>

On 08/20/2013 07:36 PM, Felix Fietkau wrote:
> On 2013-08-20 10:15 AM, Arend van Spriel wrote:
>> Hi Felix,
>>
>> I have been diving into root causing why brcmsmac can not handle cck
>> fallback rates, because it should. Maybe it is better to flag no cck
>> support and only change brcmsmac.
> I prefer having a flag to enable it over one to disable it, because it
> fits better with the existing flags. Also, future drivers may not always
> be properly prepared to handle CCK in A-MPDU sessions either.

Ok. It just looked a bit strange that a problem in brcmsmac results in 
changing other drivers.

> By the way, I took a short look at brcmsmac and found more issues that
> you should look into if you want to fix this.
>
> First of all, you should probably make sure that the hardware does not
> try to send an A-MPDU using a CCK rate (prepare it as a single frame in
> brcms_c_ampdu_add_frame). It also does not seem to have any checks to
> ensure that rate control probing frames are not aggregated.

Thanks, Felix. I also noticed that our proprietary driver has code in 
place for these scenarios.

Gr. AvS


^ permalink raw reply

* [PATCH ] staging: vt6656: rxtx.c dead code TYPE_ATIMDMA/TYPE_BEACONDMA
From: Malcolm Priestley @ 2013-08-20 19:47 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

Both TYPE_ATIMDMA/TYPE_BEACONDMA are not used in driver for the value of uDMAIdx.

Remove dead code.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/rxtx.c | 41 +++++++----------------------------------
 1 file changed, 7 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index d7f920d..06950c4 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -499,22 +499,6 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
     }
 
     if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
-	if ((uDMAIdx == TYPE_ATIMDMA) || (uDMAIdx == TYPE_BEACONDMA)) {
-		struct vnt_tx_datahead_ab *pBuf =
-			(struct vnt_tx_datahead_ab *)pTxDataHead;
-            //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
-                (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-            );
-            //Get Duration and TimeStampOff
-		pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A,
-					byPktType, bNeedAck);
-            if(uDMAIdx!=TYPE_ATIMDMA) {
-                pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
-            }
-            return (pBuf->wDuration);
-        }
-        else { // DATA & MANAGE Frame
             if (byFBOption == AUTO_FB_NONE) {
 		struct vnt_tx_datahead_g *pBuf =
 				(struct vnt_tx_datahead_g *)pTxDataHead;
@@ -558,11 +542,9 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
                 pBuf->wTimeStampOff_b = wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE];
                 return (pBuf->wDuration_a);
             } //if (byFBOption == AUTO_FB_NONE)
-        }
     }
     else if (byPktType == PK_TYPE_11A) {
-        if ((byFBOption != AUTO_FB_NONE) && (uDMAIdx != TYPE_ATIMDMA) && (uDMAIdx != TYPE_BEACONDMA)) {
-            // Auto Fallback
+	if (byFBOption != AUTO_FB_NONE) {
 		struct vnt_tx_datahead_a_fb *pBuf =
 			(struct vnt_tx_datahead_a_fb *)pTxDataHead;
             //Get SignalField,ServiceField,Length
@@ -576,9 +558,7 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
 				DATADUR_A_F0, byPktType, bNeedAck);
 		pBuf->wDuration_f1 = (u16)s_uGetDataDuration(pDevice,
 				DATADUR_A_F1, byPktType, bNeedAck);
-            if(uDMAIdx!=TYPE_ATIMDMA) {
                 pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
-            }
             return (pBuf->wDuration);
         } else {
 		struct vnt_tx_datahead_ab *pBuf =
@@ -590,10 +570,8 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
             //Get Duration and TimeStampOff
 		pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A,
 				byPktType, bNeedAck);
-
-            if(uDMAIdx!=TYPE_ATIMDMA) {
                 pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
-            }
+
             return (pBuf->wDuration);
         }
     }
@@ -607,9 +585,8 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
             //Get Duration and TimeStampOff
 		pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_B,
 				byPktType, bNeedAck);
-            if (uDMAIdx != TYPE_ATIMDMA) {
                 pBuf->wTimeStampOff = wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE];
-            }
+
             return (pBuf->wDuration);
     }
     return 0;
@@ -826,8 +803,8 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
     }
 
     if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
-        if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) {
-            // Auto Fall back
+	if (byFBOption != AUTO_FB_NONE) {
+		/* Auto Fall back */
 		struct vnt_cts_fb *pBuf = (struct vnt_cts_fb *)pvCTS;
             //Get SignalField,ServiceField,Length
             BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
@@ -849,7 +826,7 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
 		pBuf->data.duration = pBuf->wDuration_ba;
 		pBuf->data.frame_control = TYPE_CTL_CTS;
 		memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
-        } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
+	} else {
 		struct vnt_cts *pBuf = (struct vnt_cts *)pvCTS;
             //Get SignalField,ServiceField,Length
             BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
@@ -1462,11 +1439,7 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice,
 {
 	struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyBufferAddr;
 
-    if (uDMAIdx == TYPE_ATIMDMA) {
-    	pMACHeader->frame_control = TYPE_802_11_ATIM;
-    } else {
-        pMACHeader->frame_control = TYPE_802_11_DATA;
-    }
+	pMACHeader->frame_control = TYPE_802_11_DATA;
 
     if (pDevice->eOPMode == OP_MODE_AP) {
 	memcpy(&(pMACHeader->addr1[0]),
-- 
1.8.1.2


^ permalink raw reply related

* Re: [rt2x00-users] [PATCH 1/2] rt2x00: rt2800lib: introduce rt2800_get_txwi_rxwi_size helper
From: Stanislaw Gruszka @ 2013-08-20 20:13 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John W. Linville, linux-wireless, users
In-Reply-To: <1376641410-20798-1-git-send-email-juhosg@openwrt.org>

On Fri, Aug 16, 2013 at 10:23:29AM +0200, Gabor Juhos wrote:
> The rt2800pci driver uses the same [RT]XWI size
> for all chipsets, however some chips requires
> different values.
> 
> The size of the [RT]XWI structures is a constant
> value for a given chipset and it does not depend
> on the underlying interface. Add a helper function
> which returns the correct values for the actual
> chipset and use the new helper both in the rt2800usb
> and in the rt2800pci drivers. This ensures that both
> drivers are using the correct values.
> 
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>


^ permalink raw reply

* Re: [rt2x00-users] [PATCH 2/2] rt2x00: rt2800pci: fix AUX_CTRL register setup for RT3090/3390/3593/5592
From: Stanislaw Gruszka @ 2013-08-20 20:13 UTC (permalink / raw)
  To: Gabor Juhos; +Cc: John W. Linville, linux-wireless, users
In-Reply-To: <1376641410-20798-2-git-send-email-juhosg@openwrt.org>

On Fri, Aug 16, 2013 at 10:23:30AM +0200, Gabor Juhos wrote:
> The 2011_1007_RT5390_RT5392_Linux_STA_V2.5.0.3_DPO
> driver enables PCIe wakeup for these chips as well.
> Do the same in rt2x00.
> 
> References:
>   rt28xx_init in common/rtmp_init_intf.c
>   RTMPInitPCIeLinkCtrlValue in os/linux/rt_rbus_pci_drv.c
> 
> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>


^ permalink raw reply

* Re: [PATCH 3.10 0/3] Enable 7000 device family on 3.10
From: Emmanuel Grumbach @ 2013-08-20 20:22 UTC (permalink / raw)
  To: Greg KH
  Cc: Johannes Berg, Emmanuel Grumbach, stable@vger.kernel.org,
	linux-wireless
In-Reply-To: <20130806134218.GB525@kroah.com>

On Tue, Aug 6, 2013 at 4:42 PM, Greg KH <greg@kroah.com> wrote:
> On Tue, Aug 06, 2013 at 02:39:39PM +0200, Johannes Berg wrote:
>> [Emmanuel is on vacation, I'll cover for him]
>>
>> On Fri, 2013-08-02 at 17:02 +0800, Greg KH wrote:
>> > On Mon, Jul 15, 2013 at 02:44:57PM +0300, Emmanuel Grumbach wrote:
>> > > This small patch series enables 7260 and 3160 devices on 3.10
>> > > kernel. Three patches are already in linux.git (3.11-rc1).
>> > > One patch is 3.10 specific and disables configuration that is not
>> > > supported in 3.10.
>> >
>> > I need the git commit id of these patches in Linus's tree before I can
>> > apply them.  Please resend them with that information.
>>
>> The second and third patch does have it, and the first patch is only
>> relevant for 3.10 since 3.11 will have more device types enabled, we
>> just didn't get all the code in. This seems to be described in the
>> commit log, do you want more details?
>
> Yes, please resend them with those details.  For me to take a patch that
> is not in Linus's tree is a big deal, I need a whole lot of
> justification for it.
>

Just got back. Sorry for the delay.
I guess I will just drop that patch that is not in Linus's tree.
This patch disables a feature that is not likely to be used but we
*know* it is buggy.
So people who want more than just associating to their router will see
a bug in 3.10.
I guess we can leave with that since I was suggesting to disable the
feature anyway.

So - do you want to resend, or you can apply the 2 patches I sent as is?

^ permalink raw reply

* Re: Signal loss rtl8723ae wifi driver
From: Phillip Moss @ 2013-08-20 20:50 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless
In-Reply-To: <520AFD5C.3010905@lwfinger.net>

Hi Larry,
Sorry for taking so long to reply.
I am using Arch Linux  3.10.7-1-ARCH  x86_64 with KDE and Network-Manager.
wlp3s0 is the name of my wireless interface: https://wiki.archlinux.org/index.php/Network_Configuration#Network_Interfaces
I have renamed the interface to the default wlan0 we all know and love with: ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

To measure signal strength I am using "Link Quality", "Signal Level" from iwconfig and signal strength from network manager.

When I am right next to my router I get between: -36  and -42dbm.
Link quality is between 68/70 and 70/70.
Network Manager reports signal at 84%.

When a signal loss period ocurrs Link quality drops to 14/70 (In some cases 12-13) and then quickly jumps back up to 40 then up to 68-70.
While this happens Signal level bounces up to between +2 and +10dbm then backdown to around -90dbm and then stabalizes again at -36 -42.
Network Manager reports signal around 32%

If I step a few meters away signal level is stable around -52 and -64 dbm. Link Quality is around 56/70.
During a Signal loss period Link Quality jumps down to about 12-13/70 and Signal Level to around 14dbm with occasional spikes up to 99.
These spikes only sometimes result in the interface dropping the connection to the AP when at this distance, but never when I am very close to the router.

I am not sure if this is pure paranoia but it seems that the card gets “stuck” and then keeps on receiving/transmitting. To see if this was true I tried airodump and it does seem as if the card stops receiving beacons at irregular intervals.

I have recompiled backports with the proposed patch and I am still experiencing the same problem.
Thank you very much for all your help,
Phillip

--------------------------------------------
El mié, 14/8/13, Larry Finger <Larry.Finger@lwfinger.net> escribió:

 Asunto: Re: Signal loss rtl8723ae wifi driver
 Para: "Phillip Moss" <phillipmoss12@yahoo.es>
 CC: linux-wireless@vger.kernel.org
 Fecha: miércoles, 14 de agosto, 2013 05:45
 
 On 08/13/2013 11:23 AM, Phillip Moss
 wrote:
 > Hi all,
 > I have a rtl8723ae wifi card on my laptop. When
 connecting to any wifi Access Point
 > the wifi signal fluctuates from full strength to very
 low.  In order to connect and
 > stay connected I must be no farther than two meters
 from my router otherwise I get
 > disconnected. I have tried the kernel driver on
 multiple distros as well as the
 > vendor drivers for older kernel versions. All seem to
 have the same problem. The card
 > works ok on Windows 7 with vendor drivers. I have also
 tried compiling
 > backports-3.10-rc1-2 with no luck. During a signal loss
 period I get no logs but if I
 > take the laptop too far from the AP dmesg reports:
 
 Philip,
 
 Could you try the attached patch?
 
 Larry
 
 

^ permalink raw reply

* Re: [PATCH 01/16] wcn36xx: Add main.c
From: Johannes Berg @ 2013-08-20 20:59 UTC (permalink / raw)
  To: Eugene Krasnikov; +Cc: linux-wireless, wcn36xx
In-Reply-To: <1377020479-16935-2-git-send-email-k.eugene.e@gmail.com>

Just a cursory review ...


> +		.cap = IEEE80211_HT_CAP_GRN_FLD
> +			| IEEE80211_HT_CAP_SGI_20

wouldn't that usually be written as

GRN_FLD |
SGI_20 |
...

(multiple similar places)

> +#ifdef CONFIG_PM
> +
> +static const struct wiphy_wowlan_support wowlan_support = {
> +	.flags = WIPHY_WOWLAN_ANY,
> +	.n_patterns = 0,

that n_patterns is pretty useless.


> +#define WCN36XX_SUPPORTED_FILTERS (0)
> +
> +static void wcn36xx_configure_filter(struct ieee80211_hw *hw,
> +				       unsigned int changed,
> +				       unsigned int *total, u64 multicast)
> +{
> +	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter");
> +
> +	changed &= WCN36XX_SUPPORTED_FILTERS;

That's pointless

> +		if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
> +			sta_priv->is_data_encrypted = true;
> +			/* Reconfigure bss with encrypt_type */
> +			if (NL80211_IFTYPE_STATION == vif->type)
> +				wcn36xx_smd_config_bss(wcn,
> +						       vif,
> +						       sta,
> +						       sta->addr,
> +						       true);

It seems to me this should not be here but you should have mac80211 set
something in e.g. bss_conf that indicates encryption?


> +	/* Not supported so far*/
> +	case IEEE80211_AMPDU_TX_STOP_CONT:
> +		ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
> +		break;
> +	case IEEE80211_AMPDU_TX_STOP_FLUSH:
> +	case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
> +		break;

You can't just "not support" them - you have to at least stop the
aggregation session, see the commit that introduced this.

> +	static const u32 cipher_suites[] = {
> +		WLAN_CIPHER_SUITE_TKIP,
> +		WLAN_CIPHER_SUITE_CCMP,
> +	};

You actually don't want to support WEP, not even in software? Otherwise
just leave this out and mac80211 will add it.

> +	wcn->hw->wiphy->iface_combinations = &if_comb;
> +	wcn->hw->wiphy->n_iface_combinations = 1;

Your code with "wcn->current_vif = " etc. *really* doesn't look like you
support combinations. Are you positive this is OK?

> +	wcn->hw->wiphy->max_scan_ssids = 1;

Really? You don't even have hardware scan, so why?

johannes


^ permalink raw reply

* Re: [PATCH 11/16] wcn36xx: Add txrx.c
From: Johannes Berg @ 2013-08-20 21:01 UTC (permalink / raw)
  To: Eugene Krasnikov; +Cc: linux-wireless, wcn36xx
In-Reply-To: <1377020479-16935-12-git-send-email-k.eugene.e@gmail.com>

On Tue, 2013-08-20 at 19:41 +0200, Eugene Krasnikov wrote:

> +	/* Data frames served first*/
> +	if (is_low) {
> +		/*
> +		 * Sometimes in AP mode mac80211 is trying to send data
> +		 * frame to nobody. Why?
> +		 */
> +		if (!sta_priv)
> +			wcn36xx_warn("Sending data packet to nobody");

Umm, really? Have you heard of something called multicast? ;-)

johannes


^ permalink raw reply

* Re: [PATCH 11/16] wcn36xx: Add txrx.c
From: Johannes Berg @ 2013-08-20 21:03 UTC (permalink / raw)
  To: Eugene Krasnikov; +Cc: linux-wireless, wcn36xx
In-Reply-To: <1377020479-16935-12-git-send-email-k.eugene.e@gmail.com>

On Tue, 2013-08-20 at 19:41 +0200, Eugene Krasnikov wrote:

> +int wcn36xx_start_tx(struct wcn36xx *wcn,
> +		     struct wcn36xx_sta *sta_priv,
> +		     struct sk_buff *skb)

err ... this can return errors that you never handle, probably gets you
leaks that way?

johannes


^ permalink raw reply

* Re: [PATCH 3.10 0/3] Enable 7000 device family on 3.10
From: Greg KH @ 2013-08-20 21:25 UTC (permalink / raw)
  To: Emmanuel Grumbach
  Cc: Johannes Berg, Emmanuel Grumbach, stable@vger.kernel.org,
	linux-wireless
In-Reply-To: <CANUX_P0BxGr9coDjOmHJm+8kVJVsM9XiTDTVsb_kysuRmcmpNw@mail.gmail.com>

On Tue, Aug 20, 2013 at 11:22:21PM +0300, Emmanuel Grumbach wrote:
> On Tue, Aug 6, 2013 at 4:42 PM, Greg KH <greg@kroah.com> wrote:
> > On Tue, Aug 06, 2013 at 02:39:39PM +0200, Johannes Berg wrote:
> >> [Emmanuel is on vacation, I'll cover for him]
> >>
> >> On Fri, 2013-08-02 at 17:02 +0800, Greg KH wrote:
> >> > On Mon, Jul 15, 2013 at 02:44:57PM +0300, Emmanuel Grumbach wrote:
> >> > > This small patch series enables 7260 and 3160 devices on 3.10
> >> > > kernel. Three patches are already in linux.git (3.11-rc1).
> >> > > One patch is 3.10 specific and disables configuration that is not
> >> > > supported in 3.10.
> >> >
> >> > I need the git commit id of these patches in Linus's tree before I can
> >> > apply them.  Please resend them with that information.
> >>
> >> The second and third patch does have it, and the first patch is only
> >> relevant for 3.10 since 3.11 will have more device types enabled, we
> >> just didn't get all the code in. This seems to be described in the
> >> commit log, do you want more details?
> >
> > Yes, please resend them with those details.  For me to take a patch that
> > is not in Linus's tree is a big deal, I need a whole lot of
> > justification for it.
> >
> 
> Just got back. Sorry for the delay.
> I guess I will just drop that patch that is not in Linus's tree.
> This patch disables a feature that is not likely to be used but we
> *know* it is buggy.
> So people who want more than just associating to their router will see
> a bug in 3.10.
> I guess we can leave with that since I was suggesting to disable the
> feature anyway.

Why would this patch not go to Linus's tree?  If it's broken, fix it,
and I can take the backported patch into the 3.10 tree.

> So - do you want to resend, or you can apply the 2 patches I sent as is?

Please resend.

thanks,

greg k-h

^ permalink raw reply

* [PATCH 1/2] staging: vt6656: baseband.c  BBvCalculateParameter pwPhyLen return endian corrected.
From: Malcolm Priestley @ 2013-08-20 21:49 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

In rxtx.c many calls to BBvCaculateParameter are not endian
corrected all calls here need to be endian corrected.

Correct the endian in BBvCaculateParameter.

In card.c: CARDvSetRSPINF pwPhyLen points to awLen and is
manually applied to abyData.  Because it is now endian
corrected put_unaligned is needed to correct it.

In rxtx.c remove were endian is corrected.

This allows to merge  BBvCalculateParameter *pwPhyLen,*pbyPhySrv
and *pbyPhySgn to singles structure for tx buffers.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/baseband.c | 19 +++++++++----------
 drivers/staging/vt6656/card.c     | 12 ++++--------
 drivers/staging/vt6656/rxtx.c     |  9 ---------
 3 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
index a14a6a0..7d34403 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -870,16 +870,15 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
         break;
     }
 
-    if (byPacketType == PK_TYPE_11B) {
-        *pbyPhySrv = 0x00;
-        if (bExtBit)
-            *pbyPhySrv = *pbyPhySrv | 0x80;
-        *pwPhyLen = (u16) cbUsCount;
-    }
-    else {
-        *pbyPhySrv = 0x00;
-        *pwPhyLen = (u16)cbFrameLength;
-    }
+	if (byPacketType == PK_TYPE_11B) {
+		*pbyPhySrv = 0x00;
+		if (bExtBit)
+			*pbyPhySrv = *pbyPhySrv | 0x80;
+		*pwPhyLen = cpu_to_le16((u16)cbUsCount);
+	} else {
+		*pbyPhySrv = 0x00;
+		*pwPhyLen = cpu_to_le16((u16)cbFrameLength);
+	}
 }
 
 /*
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 24291ae..c0815d8 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -421,23 +421,19 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
                                  &abyTxRate[8],
                                  &abyRsvTime[8]);
 
-    abyData[0] = (u8)(awLen[0]&0xFF);
-    abyData[1] = (u8)(awLen[0]>>8);
+	put_unaligned(awLen[0], (u16 *)&abyData[0]);
     abyData[2] = abySignal[0];
     abyData[3] = abyServ[0];
 
-    abyData[4] = (u8)(awLen[1]&0xFF);
-    abyData[5] = (u8)(awLen[1]>>8);
+	put_unaligned(awLen[1], (u16 *)&abyData[4]);
     abyData[6] = abySignal[1];
     abyData[7] = abyServ[1];
 
-    abyData[8] = (u8)(awLen[2]&0xFF);
-    abyData[9] = (u8)(awLen[2]>>8);
+	put_unaligned(awLen[2], (u16 *)&abyData[8]);
     abyData[10] = abySignal[2];
     abyData[11] = abyServ[2];
 
-    abyData[12] = (u8)(awLen[3]&0xFF);
-    abyData[13] = (u8)(awLen[3]>>8);
+	put_unaligned(awLen[3], (u16 *)&abyData[12]);
     abyData[14] = abySignal[3];
     abyData[15] = abyServ[3];
 
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 06950c4..8c42781 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -617,11 +617,9 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
             );
-            pBuf->wTransmitLength_b = cpu_to_le16(wLen);
             BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
             );
-            pBuf->wTransmitLength_a = cpu_to_le16(wLen);
             //Get Duration
 		pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
 			cbFrameLength, PK_TYPE_11B,
@@ -653,11 +651,9 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
             );
-            pBuf->wTransmitLength_b = cpu_to_le16(wLen);
             BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
             );
-            pBuf->wTransmitLength_a = cpu_to_le16(wLen);
             //Get Duration
 		pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
 			cbFrameLength, PK_TYPE_11B,
@@ -703,7 +699,6 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
             );
-            pBuf->wTransmitLength = cpu_to_le16(wLen);
             //Get Duration
 		pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
 			cbFrameLength, byPktType, wCurrentRate,
@@ -729,7 +724,6 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
             BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
             );
-            pBuf->wTransmitLength = cpu_to_le16(wLen);
             //Get Duration
 		pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
 			cbFrameLength, byPktType, wCurrentRate,
@@ -762,7 +756,6 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
         BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
             (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
         );
-        pBuf->wTransmitLength = cpu_to_le16(wLen);
         //Get Duration
 	pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
 		cbFrameLength, byPktType, wCurrentRate,
@@ -810,7 +803,6 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
             BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
             );
-            pBuf->wTransmitLength_b = cpu_to_le16(wLen);
 		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
 			cbFrameLength, byPktType,
 			wCurrentRate, bNeedAck, byFBOption);
@@ -832,7 +824,6 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
             BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
                 (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
             );
-            pBuf->wTransmitLength_b = cpu_to_le16(wLen);
 		/* Get CTSDuration_ba */
 		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice,
 			CTSDUR_BA, cbFrameLength, byPktType,
-- 
1.8.1.2





^ permalink raw reply related

* [PATCH 2/2] staging: vt6656: baseband.c BBvCalculateParameter create structure for pwPhyLen, pbyPhySrv and pbyPhySgn
From: Malcolm Priestley @ 2013-08-20 21:52 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

Create single packed structure vnt_phy_field for rxtx.h structures.

In card.c CARDvSetRSPINF a vnt_phy_field replaces abyServ,
abySignal, awLen variables.

In rxtx.c point BBvCalculateParameter to relevant field.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/baseband.c | 70 ++++++++++++++--------------
 drivers/staging/vt6656/baseband.h | 10 +++-
 drivers/staging/vt6656/card.c     | 68 +++++++++------------------
 drivers/staging/vt6656/rxtx.c     | 97 +++++++++++++++------------------------
 drivers/staging/vt6656/rxtx.h     | 57 ++++++-----------------
 5 files changed, 117 insertions(+), 185 deletions(-)

diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
index 7d34403..1e8b841 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -723,16 +723,16 @@ BBuGetFrameTime(
  *      cbFrameLength   - Tx Frame Length
  *      wRate           - Tx Rate
  *  Out:
- *      pwPhyLen        - pointer to Phy Length field
- *      pbyPhySrv       - pointer to Phy Service field
- *      pbyPhySgn       - pointer to Phy Signal field
+ *	struct vnt_phy_field *phy
+ * 			- pointer to Phy Length field
+ *			- pointer to Phy Service field
+ * 			- pointer to Phy Signal field
  *
  * Return Value: none
  *
  */
 void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
-	u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv,
-		u8 *pbyPhySgn)
+	u16 wRate, u8 byPacketType, struct vnt_phy_field *phy)
 {
 	u32 cbBitCount;
 	u32 cbUsCount = 0;
@@ -747,15 +747,15 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
     switch (wRate) {
     case RATE_1M :
         cbUsCount = cbBitCount;
-        *pbyPhySgn = 0x00;
+	phy->signal = 0x00;
         break;
 
     case RATE_2M :
         cbUsCount = cbBitCount / 2;
         if (byPreambleType == 1)
-            *pbyPhySgn = 0x09;
+		phy->signal = 0x09;
         else // long preamble
-            *pbyPhySgn = 0x01;
+		phy->signal = 0x01;
         break;
 
     case RATE_5M :
@@ -766,9 +766,9 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
         if (cbTmp != cbBitCount)
             cbUsCount ++;
         if (byPreambleType == 1)
-            *pbyPhySgn = 0x0a;
+		phy->signal = 0x0a;
         else // long preamble
-            *pbyPhySgn = 0x02;
+		phy->signal = 0x02;
         break;
 
     case RATE_11M :
@@ -783,101 +783,101 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength,
                 bExtBit = true;
         }
         if (byPreambleType == 1)
-            *pbyPhySgn = 0x0b;
+		phy->signal = 0x0b;
         else // long preamble
-            *pbyPhySgn = 0x03;
+		phy->signal = 0x03;
         break;
 
     case RATE_6M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9B; //1001 1011
+		phy->signal = 0x9b;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8B; //1000 1011
+		phy->signal = 0x8b;
         }
         break;
 
     case RATE_9M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9F; //1001 1111
+		phy->signal = 0x9f;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8F; //1000 1111
+		phy->signal = 0x8f;
         }
         break;
 
     case RATE_12M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9A; //1001 1010
+		phy->signal = 0x9a;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8A; //1000 1010
+		phy->signal = 0x8a;
         }
         break;
 
     case RATE_18M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9E; //1001 1110
+		phy->signal = 0x9e;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8E; //1000 1110
+		phy->signal = 0x8e;
         }
         break;
 
     case RATE_24M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x99; //1001 1001
+		phy->signal = 0x99;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x89; //1000 1001
+		phy->signal = 0x89;
         }
         break;
 
     case RATE_36M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9D; //1001 1101
+		phy->signal = 0x9d;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8D; //1000 1101
+		phy->signal = 0x8d;
         }
         break;
 
     case RATE_48M :
         if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x98; //1001 1000
+		phy->signal = 0x98;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x88; //1000 1000
+		phy->signal = 0x88;
         }
         break;
 
     case RATE_54M :
         if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9C; //1001 1100
+		phy->signal = 0x9c;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8C; //1000 1100
+		phy->signal = 0x8c;
         }
         break;
 
     default :
         if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
-            *pbyPhySgn = 0x9C; //1001 1100
+		phy->signal = 0x9c;
         }
         else {//11g, 2.4GHZ
-            *pbyPhySgn = 0x8C; //1000 1100
+		phy->signal = 0x8c;
         }
         break;
     }
 
 	if (byPacketType == PK_TYPE_11B) {
-		*pbyPhySrv = 0x00;
+		phy->service = 0x00;
 		if (bExtBit)
-			*pbyPhySrv = *pbyPhySrv | 0x80;
-		*pwPhyLen = cpu_to_le16((u16)cbUsCount);
+			phy->service |= 0x80;
+		phy->len = cpu_to_le16((u16)cbUsCount);
 	} else {
-		*pbyPhySrv = 0x00;
-		*pwPhyLen = cpu_to_le16((u16)cbFrameLength);
+		phy->service = 0x00;
+		phy->len = cpu_to_le16((u16)cbFrameLength);
 	}
 }
 
diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h
index 0a634ad..a8db17d 100644
--- a/drivers/staging/vt6656/baseband.h
+++ b/drivers/staging/vt6656/baseband.h
@@ -81,6 +81,13 @@
 #define TOP_RATE_2M         0x00200000
 #define TOP_RATE_1M         0x00100000
 
+/* Length, Service, and Signal fields of Phy for Tx */
+struct vnt_phy_field {
+	u8 signal;
+	u8 service;
+	u16 len;
+} __packed;
+
 unsigned int
 BBuGetFrameTime(
      u8 byPreambleType,
@@ -90,8 +97,7 @@ BBuGetFrameTime(
     );
 
 void BBvCalculateParameter(struct vnt_private *, u32 cbFrameLength,
-	u16 wRate, u8 byPacketType, u16 *pwPhyLen, u8 *pbyPhySrv,
-	u8 *pbyPhySgn);
+	u16 wRate, u8 byPacketType, struct vnt_phy_field *);
 
 /* timer for antenna diversity */
 
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index c0815d8..dbf11ec 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -319,53 +319,27 @@ CARDvCalculateOFDMRParameter (
  */
 void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
 {
-	u8 abyServ[4] = {0, 0, 0, 0}; /* For CCK */
-	u8 abySignal[4] = {0, 0, 0, 0};
-	u16 awLen[4] = {0, 0, 0, 0};
+	struct vnt_phy_field phy[4];
 	u8 abyTxRate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */
 	u8 abyRsvTime[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
 	u8 abyData[34];
 	int i;
 
     //RSPINF_b_1
-    BBvCalculateParameter(pDevice,
-                         14,
-                         swGetCCKControlRate(pDevice, RATE_1M),
-                         PK_TYPE_11B,
-                         &awLen[0],
-                         &abyServ[0],
-                         &abySignal[0]
-    );
+	BBvCalculateParameter(pDevice, 14,
+		swGetCCKControlRate(pDevice, RATE_1M), PK_TYPE_11B, &phy[0]);
 
     ///RSPINF_b_2
-    BBvCalculateParameter(pDevice,
-                         14,
-                         swGetCCKControlRate(pDevice, RATE_2M),
-                         PK_TYPE_11B,
-                         &awLen[1],
-                         &abyServ[1],
-                         &abySignal[1]
-    );
+	BBvCalculateParameter(pDevice, 14,
+		swGetCCKControlRate(pDevice, RATE_2M), PK_TYPE_11B, &phy[1]);
 
     //RSPINF_b_5
-    BBvCalculateParameter(pDevice,
-                         14,
-                         swGetCCKControlRate(pDevice, RATE_5M),
-                         PK_TYPE_11B,
-                         &awLen[2],
-                         &abyServ[2],
-                         &abySignal[2]
-    );
+	BBvCalculateParameter(pDevice, 14,
+		swGetCCKControlRate(pDevice, RATE_5M), PK_TYPE_11B, &phy[2]);
 
     //RSPINF_b_11
-    BBvCalculateParameter(pDevice,
-                         14,
-                         swGetCCKControlRate(pDevice, RATE_11M),
-                         PK_TYPE_11B,
-                         &awLen[3],
-                         &abyServ[3],
-                         &abySignal[3]
-    );
+	BBvCalculateParameter(pDevice, 14,
+		swGetCCKControlRate(pDevice, RATE_11M), PK_TYPE_11B, &phy[3]);
 
     //RSPINF_a_6
     CARDvCalculateOFDMRParameter (RATE_6M,
@@ -421,21 +395,21 @@ void CARDvSetRSPINF(struct vnt_private *pDevice, u8 byBBType)
                                  &abyTxRate[8],
                                  &abyRsvTime[8]);
 
-	put_unaligned(awLen[0], (u16 *)&abyData[0]);
-    abyData[2] = abySignal[0];
-    abyData[3] = abyServ[0];
+	put_unaligned(phy[0].len, (u16 *)&abyData[0]);
+	abyData[2] = phy[0].signal;
+	abyData[3] = phy[0].service;
 
-	put_unaligned(awLen[1], (u16 *)&abyData[4]);
-    abyData[6] = abySignal[1];
-    abyData[7] = abyServ[1];
+	put_unaligned(phy[1].len, (u16 *)&abyData[4]);
+	abyData[6] = phy[1].signal;
+	abyData[7] = phy[1].service;
 
-	put_unaligned(awLen[2], (u16 *)&abyData[8]);
-    abyData[10] = abySignal[2];
-    abyData[11] = abyServ[2];
+	put_unaligned(phy[2].len, (u16 *)&abyData[8]);
+	abyData[10] = phy[2].signal;
+	abyData[11] = phy[2].service;
 
-	put_unaligned(awLen[3], (u16 *)&abyData[12]);
-    abyData[14] = abySignal[3];
-    abyData[15] = abyServ[3];
+	put_unaligned(phy[3].len, (u16 *)&abyData[12]);
+	abyData[14] = phy[3].signal;
+	abyData[15] = phy[3].service;
 
     for (i = 0; i < 9; i++) {
 	abyData[16+i*2] = abyTxRate[i];
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 8c42781..05e82ec 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -52,7 +52,6 @@
 #include "card.h"
 #include "bssdb.h"
 #include "mac.h"
-#include "baseband.h"
 #include "michael.h"
 #include "tkip.h"
 #include "tcrc.h"
@@ -503,12 +502,10 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
 		struct vnt_tx_datahead_g *pBuf =
 				(struct vnt_tx_datahead_g *)pTxDataHead;
                 //Get SignalField,ServiceField,Length
-                BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
-                    (u16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
-                );
-                BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-                    (u16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
-                );
+		BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+			byPktType, &pBuf->a);
+		BBvCalculateParameter(pDevice, cbFrameLength,
+			pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
                 //Get Duration and TimeStamp
 		pBuf->wDuration_a = (u16)s_uGetDataDuration(pDevice, DATADUR_A,
 							byPktType, bNeedAck);
@@ -523,12 +520,10 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
 		struct vnt_tx_datahead_g_fb *pBuf =
 			(struct vnt_tx_datahead_g_fb *)pTxDataHead;
                 //Get SignalField,ServiceField,Length
-                BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
-                    (u16 *)&(pBuf->wTransmitLength_a), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
-                );
-                BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-                    (u16 *)&(pBuf->wTransmitLength_b), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
-                );
+		BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+			byPktType, &pBuf->a);
+		BBvCalculateParameter(pDevice, cbFrameLength,
+			pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
                 //Get Duration and TimeStamp
 		pBuf->wDuration_a = (u16)s_uGetDataDuration(pDevice, DATADUR_A,
 							byPktType, bNeedAck);
@@ -548,9 +543,8 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
 		struct vnt_tx_datahead_a_fb *pBuf =
 			(struct vnt_tx_datahead_a_fb *)pTxDataHead;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
-                (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-            );
+		BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+			byPktType, &pBuf->a);
             //Get Duration and TimeStampOff
 		pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A,
 					byPktType, bNeedAck);
@@ -564,9 +558,8 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
 		struct vnt_tx_datahead_ab *pBuf =
 			(struct vnt_tx_datahead_ab *)pTxDataHead;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
-                (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-            );
+		BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+			byPktType, &pBuf->ab);
             //Get Duration and TimeStampOff
 		pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_A,
 				byPktType, bNeedAck);
@@ -579,9 +572,8 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice,
 		struct vnt_tx_datahead_ab *pBuf =
 			(struct vnt_tx_datahead_ab *)pTxDataHead;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
-                (u16 *)&(pBuf->wTransmitLength), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-            );
+		BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate,
+			byPktType, &pBuf->ab);
             //Get Duration and TimeStampOff
 		pBuf->wDuration = (u16)s_uGetDataDuration(pDevice, DATADUR_B,
 				byPktType, bNeedAck);
@@ -597,7 +589,6 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
 	struct ethhdr *psEthHeader, u16 wCurrentRate, u8 byFBOption)
 {
 	u32 uRTSFrameLen = 20;
-	u16 wLen = 0;
 
     if (pvRTS == NULL)
     	return;
@@ -614,12 +605,10 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
         if (byFBOption == AUTO_FB_NONE) {
 		struct vnt_rts_g *pBuf = (struct vnt_rts_g *)pvRTS;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
-            );
-            BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
-            );
+		BBvCalculateParameter(pDevice, uRTSFrameLen,
+			pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
+		BBvCalculateParameter(pDevice, uRTSFrameLen,
+			pDevice->byTopOFDMBasicRate, byPktType, &pBuf->a);
             //Get Duration
 		pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
 			cbFrameLength, PK_TYPE_11B,
@@ -648,12 +637,10 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
         else {
 		struct vnt_rts_g_fb *pBuf = (struct vnt_rts_g_fb *)pvRTS;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
-            );
-            BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_a), (u8 *)&(pBuf->bySignalField_a)
-            );
+		BBvCalculateParameter(pDevice, uRTSFrameLen,
+			pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
+		BBvCalculateParameter(pDevice, uRTSFrameLen,
+			pDevice->byTopOFDMBasicRate, byPktType, &pBuf->a);
             //Get Duration
 		pBuf->wDuration_bb = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
 			cbFrameLength, PK_TYPE_11B,
@@ -696,9 +683,8 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
         if (byFBOption == AUTO_FB_NONE) {
 		struct vnt_rts_ab *pBuf = (struct vnt_rts_ab *)pvRTS;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-            );
+		BBvCalculateParameter(pDevice, uRTSFrameLen,
+			pDevice->byTopOFDMBasicRate, byPktType, &pBuf->ab);
             //Get Duration
 		pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
 			cbFrameLength, byPktType, wCurrentRate,
@@ -721,9 +707,8 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
         else {
 		struct vnt_rts_a_fb *pBuf = (struct vnt_rts_a_fb *)pvRTS;
             //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-            );
+		BBvCalculateParameter(pDevice, uRTSFrameLen,
+			pDevice->byTopOFDMBasicRate, byPktType, &pBuf->a);
             //Get Duration
 		pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_AA,
 			cbFrameLength, byPktType, wCurrentRate,
@@ -753,9 +738,8 @@ static void s_vFillRTSHead(struct vnt_private *pDevice, u8 byPktType,
     else if (byPktType == PK_TYPE_11B) {
 	struct vnt_rts_ab *pBuf = (struct vnt_rts_ab *)pvRTS;
         //Get SignalField,ServiceField,Length
-        BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-            (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField), (u8 *)&(pBuf->bySignalField)
-        );
+	BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate,
+		PK_TYPE_11B, &pBuf->ab);
         //Get Duration
 	pBuf->wDuration = s_uGetRTSCTSDuration(pDevice, RTSDUR_BB,
 		cbFrameLength, byPktType, wCurrentRate,
@@ -783,7 +767,6 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
 	int bDisCRC, u16 wCurrentRate, u8 byFBOption)
 {
 	u32 uCTSFrameLen = 14;
-	u16 wLen = 0;
 
     if (pvCTS == NULL) {
         return;
@@ -799,10 +782,9 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
 	if (byFBOption != AUTO_FB_NONE) {
 		/* Auto Fall back */
 		struct vnt_cts_fb *pBuf = (struct vnt_cts_fb *)pvCTS;
-            //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
-            );
+		/* Get SignalField,ServiceField,Length */
+		BBvCalculateParameter(pDevice, uCTSFrameLen,
+			pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
 		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice, CTSDUR_BA,
 			cbFrameLength, byPktType,
 			wCurrentRate, bNeedAck, byFBOption);
@@ -820,10 +802,9 @@ static void s_vFillCTSHead(struct vnt_private *pDevice, u32 uDMAIdx,
 		memcpy(pBuf->data.ra, pDevice->abyCurrentNetAddr, ETH_ALEN);
 	} else {
 		struct vnt_cts *pBuf = (struct vnt_cts *)pvCTS;
-            //Get SignalField,ServiceField,Length
-            BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
-                (u16 *)&(wLen), (u8 *)&(pBuf->byServiceField_b), (u8 *)&(pBuf->bySignalField_b)
-            );
+		/* Get SignalField,ServiceField,Length */
+		BBvCalculateParameter(pDevice, uCTSFrameLen,
+			pDevice->byTopCCKBasicRate, PK_TYPE_11B, &pBuf->b);
 		/* Get CTSDuration_ba */
 		pBuf->wDuration_ba = s_uGetRTSCTSDuration(pDevice,
 			CTSDUR_BA, cbFrameLength, byPktType,
@@ -1821,9 +1802,8 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
 	pTxDataHead = (struct vnt_tx_datahead_ab *)
 			(pbyTxBufferAddr + wTxBufSize);
         //Get SignalField,ServiceField,Length
-        BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11A,
-            (u16 *)&(pTxDataHead->wTransmitLength), (u8 *)&(pTxDataHead->byServiceField), (u8 *)&(pTxDataHead->bySignalField)
-        );
+	BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11A,
+							&pTxDataHead->ab);
         //Get Duration and TimeStampOff
 	pTxDataHead->wDuration = cpu_to_le16((u16)s_uGetDataDuration(pDevice,
 				DATADUR_A, PK_TYPE_11A, false));
@@ -1835,9 +1815,8 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice,
 	pTxDataHead = (struct vnt_tx_datahead_ab *)
 				(pbyTxBufferAddr + wTxBufSize);
         //Get SignalField,ServiceField,Length
-        BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11B,
-            (u16 *)&(pTxDataHead->wTransmitLength), (u8 *)&(pTxDataHead->byServiceField), (u8 *)&(pTxDataHead->bySignalField)
-        );
+	BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, PK_TYPE_11B,
+							&pTxDataHead->ab);
         //Get Duration and TimeStampOff
 	pTxDataHead->wDuration = cpu_to_le16((u16)s_uGetDataDuration(pDevice,
 				DATADUR_B, PK_TYPE_11B, false));
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index b1ef90e..3484f2b 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -31,6 +31,7 @@
 
 #include "device.h"
 #include "wcmd.h"
+#include "baseband.h"
 
 /* RsvTime buffer header */
 struct vnt_rrv_time_rts {
@@ -56,12 +57,8 @@ struct vnt_rrv_time_ab {
 
 /* TX data header */
 struct vnt_tx_datahead_g {
-	u8 bySignalField_b;
-	u8 byServiceField_b;
-	u16 wTransmitLength_b;
-	u8 bySignalField_a;
-	u8 byServiceField_a;
-	u16 wTransmitLength_a;
+	struct vnt_phy_field b;
+	struct vnt_phy_field a;
 	u16 wDuration_b;
 	u16 wDuration_a;
 	u16 wTimeStampOff_b;
@@ -69,12 +66,8 @@ struct vnt_tx_datahead_g {
 } __packed;
 
 struct vnt_tx_datahead_g_fb {
-	u8 bySignalField_b;
-	u8 byServiceField_b;
-	u16 wTransmitLength_b;
-	u8 bySignalField_a;
-	u8 byServiceField_a;
-	u16 wTransmitLength_a;
+	struct vnt_phy_field b;
+	struct vnt_phy_field a;
 	u16 wDuration_b;
 	u16 wDuration_a;
 	u16 wDuration_a_f0;
@@ -84,17 +77,13 @@ struct vnt_tx_datahead_g_fb {
 } __packed;
 
 struct vnt_tx_datahead_ab {
-	u8 bySignalField;
-	u8 byServiceField;
-	u16 wTransmitLength;
+	struct vnt_phy_field ab;
 	u16 wDuration;
 	u16 wTimeStampOff;
 } __packed;
 
 struct vnt_tx_datahead_a_fb {
-	u8 bySignalField;
-	u8 byServiceField;
-	u16 wTransmitLength;
+	struct vnt_phy_field a;
 	u16 wDuration;
 	u16 wTimeStampOff;
 	u16 wDuration_f0;
@@ -103,12 +92,8 @@ struct vnt_tx_datahead_a_fb {
 
 /* RTS buffer header */
 struct vnt_rts_g {
-	u8 bySignalField_b;
-	u8 byServiceField_b;
-	u16 wTransmitLength_b;
-	u8 bySignalField_a;
-	u8 byServiceField_a;
-	u16 wTransmitLength_a;
+	struct vnt_phy_field b;
+	struct vnt_phy_field a;
 	u16 wDuration_ba;
 	u16 wDuration_aa;
 	u16 wDuration_bb;
@@ -117,12 +102,8 @@ struct vnt_rts_g {
 } __packed;
 
 struct vnt_rts_g_fb {
-	u8 bySignalField_b;
-	u8 byServiceField_b;
-	u16 wTransmitLength_b;
-	u8 bySignalField_a;
-	u8 byServiceField_a;
-	u16 wTransmitLength_a;
+	struct vnt_phy_field b;
+	struct vnt_phy_field a;
 	u16 wDuration_ba;
 	u16 wDuration_aa;
 	u16 wDuration_bb;
@@ -135,18 +116,14 @@ struct vnt_rts_g_fb {
 } __packed;
 
 struct vnt_rts_ab {
-	u8 bySignalField;
-	u8 byServiceField;
-	u16 wTransmitLength;
+	struct vnt_phy_field ab;
 	u16 wDuration;
 	u16 wReserved;
 	struct ieee80211_rts data;
 } __packed;
 
 struct vnt_rts_a_fb {
-	u8 bySignalField;
-	u8 byServiceField;
-	u16 wTransmitLength;
+	struct vnt_phy_field a;
 	u16 wDuration;
 	u16 wReserved;
 	u16 wRTSDuration_f0;
@@ -156,9 +133,7 @@ struct vnt_rts_a_fb {
 
 /* CTS buffer header */
 struct vnt_cts {
-	u8 bySignalField_b;
-	u8 byServiceField_b;
-	u16 wTransmitLength_b;
+	struct vnt_phy_field b;
 	u16 wDuration_ba;
 	u16 wReserved;
 	struct ieee80211_cts data;
@@ -166,9 +141,7 @@ struct vnt_cts {
 } __packed;
 
 struct vnt_cts_fb {
-	u8 bySignalField_b;
-	u8 byServiceField_b;
-	u16 wTransmitLength_b;
+	struct vnt_phy_field b;
 	u16 wDuration_ba;
 	u16 wReserved;
 	u16 wCTSDuration_ba_f0;
-- 
1.8.1.2




^ permalink raw reply related

* Re: [REGRESSION] 3.10.{6,7} crashes on network activity
From: Josh Boyer @ 2013-08-21  0:11 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Felix Fietkau, Greg Kroah-Hartman, Tom Gundersen,
	stable@vger.kernel.org, Linux Wireless List, LKML, Johannes Berg
In-Reply-To: <52132589.5000306@broadcom.com>

On Tue, Aug 20, 2013 at 4:15 AM, Arend van Spriel <arend@broadcom.com> wrote:
> On 08/20/2013 06:56 AM, Felix Fietkau wrote:
>>
>> On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
>>>
>>> On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
>>>>
>>>> On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
>>>> <gregkh@linuxfoundation.org> wrote:
>>>>>
>>>>> On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
>>>>>>
>>>>>> Hi guys,
>>>>>>
>>>>>> Starting with 3.10.6 (and still present in .7) I get an oops on
>>>>>> connecting to the network.
>>>>>>
>>>>>> The attached picture shows the oops. In case it does not reach the ML,
>>>>>> the top of the call trace reads:
>>>>>>
>>>>>> brcms_c_compute_rtscts_dur
>>>>>> brcms_c_ampdu_finalize
>>>>>> ampdu_finalize
>>>>>> dma_txfast
>>>>>> brcms_c_txfifo
>>>>>> brcms_c_sendpkt_mac80211
>>>>>> brcms_ops_tx
>>>>>> __ieee80211_tx
>>>>>>
>>>>>> I bisected the problem and the first bad commit is
>>>>>>
>>>>>> commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
>>>>>> Author: Felix Fietkau <nbd@openwrt.org>
>>>>>> Date:   Fri Jun 28 21:04:35 2013 +0200
>>>>>>
>>>>>>      mac80211/minstrel_ht: fix cck rate sampling
>>>>>>
>>>>>>      commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
>>>>>>
>>>>>> Reverting it on top of .7 fixes the problem.
>>>>>>
>>>>>> I had the same (I suppose) problem on mainline some time ago, but I
>>>>>> have not bisected it, verified that the problem still occurs there, or
>>>>>> checked if reverting the upstream patch fixes it. I'd be happy to do
>>>>>> that if it would help though.
>>>>>>
>>>>>> Let me know if you need any more information.
>>>>>
>>>>>
>>>>> Do you have this same problem with 3.11-rc6 as well?
>>>>
>>>>
>>>> Yes, I just confirmed. I also confirmed that reverting the mainline
>>>> commit on top of -rc6 fixes the problem.
>>>
>>>
>>> Great, thanks.
>>>
>>> Felix and Johannes, any chance we can get this reverted in Linus tree
>>> soon, and push that revert back to the 3.10 stable tree as well?
>>
>> I'd like to avoid a revert, since that will simply replace one set of
>> issues with another. Let's limit the use of the feature that brcmsmac
>> can't handle to drivers that are known to work with it. Tom, Please
>> test this patch to see if it fixes your issue.
>
>
> Hi Felix,
>
> I have been diving into root causing why brcmsmac can not handle cck
> fallback rates, because it should. Maybe it is better to flag no cck support
> and only change brcmsmac.

We have a number of users hitting this in Fedora 18 and 19 now.  We're
tracking it with https://bugzilla.redhat.com/show_bug.cgi?id=998080
and I'm sure we can find people to test easily.

If you have a patch disabling cck in brcmsmac, I'd be happy to build a
kernel for people.  If that's going to be some time coming, perhaps
it's better to grab Felix's patch on a temporary basis?

josh

^ permalink raw reply

* Re: pull request: wireless 2013-08-19
From: David Miller @ 2013-08-21  0:26 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20130819185940.GE30753@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Mon, 19 Aug 2013 14:59:40 -0400

> This is a batch of fixes intended for the 3.11 stream...
> 
> Regarding the iwlwifi bits, Johannes says:
> 
> "We revert an rfkill bugfix that unfortunately caused more bugs, shuffle
> some code to avoid touching the PCIe device before it's enabled and
> disconnect if firmware fails to do our bidding. I also have Stanislaw's
> fix to not crash in some channel switch scenarios."
> 
> As for the mac80211 bits, Johannes says:
> 
> "This time, I have one fix from Dan Carpenter for users of
> nl80211hdr_put(), and one fix from myself fixing a regression with the
> libertas driver."
> 
> Along with the above...
> 
> Dan Carpenter fixes some incorrectly placed "address of" operators
> in hostap that caused copying of junk data.
> 
> Jussi Kivilinna corrects zd1201 to use an allocated buffer rather
> than the stack for a URB operation.
> 
> Please let me know if there are problems!

Pulled, thanks John.

^ permalink raw reply

* Re: [RFC 1/2] mac80211: allow APs to send SMPS frames
From: Julian Calaby @ 2013-08-21  0:57 UTC (permalink / raw)
  To: Emmanuel Grumbach; +Cc: linux-wireless
In-Reply-To: <1376997139-6228-1-git-send-email-emmanuel.grumbach@intel.com>

Hi Emmanuel,

One minor thing I noticed:

On Tue, Aug 20, 2013 at 9:12 PM, Emmanuel Grumbach
<emmanuel.grumbach@intel.com> wrote:
> SMPS code checks all over the place that the vif is
> BSS. Remove that constraint and allow SMPS for AP too.
>
> Provide dummy implementation that will be used for
> further patches.
>
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> ---
>  net/mac80211/cfg.c            |   15 ++++++++++++---
>  net/mac80211/debugfs_netdev.c |   24 +++++++++++++++---------
>  net/mac80211/ht.c             |   38 ++++++++++++++++++++++++++++----------
>  net/mac80211/ieee80211_i.h    |   13 ++++++++++---
>  net/mac80211/iface.c          |    2 ++
>  net/mac80211/mlme.c           |    2 +-
>  6 files changed, 68 insertions(+), 26 deletions(-)
>
> diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
> index e601c9f..7609e47 100644
> --- a/net/mac80211/debugfs_netdev.c
> +++ b/net/mac80211/debugfs_netdev.c
> @@ -245,12 +248,15 @@ static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = {
>  static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata,
>                                      char *buf, int buflen)
>  {
> -       if (sdata->vif.type != NL80211_IFTYPE_STATION)
> -               return -EOPNOTSUPP;
> -
> -       return snprintf(buf, buflen, "request: %s\nused: %s\n",
> -                       smps_modes[sdata->u.mgd.req_smps],
> -                       smps_modes[sdata->smps_mode]);
> +       if (sdata->vif.type == NL80211_IFTYPE_STATION)
> +               return snprintf(buf, buflen, "request: %s\nused: %s\n",
> +                               smps_modes[sdata->u.mgd.req_smps],
> +                               smps_modes[sdata->smps_mode]);
> +       if (sdata->vif.type == NL80211_IFTYPE_AP)
> +               return snprintf(buf, buflen, "request: %s\nused: %s\n",
> +                               smps_modes[sdata->u.ap.req_smps],
> +                               smps_modes[sdata->smps_mode]);
> +       return -EINVAL;

Do you intend to change the return value for this function when we
can't do SMPS from -EOPNOTSUPP to -EINVAL?

You've also included a couple of other cases where you return -EINVAL.
I'm assuming those are correct.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox