Skip to contentSkip to conversation

staging: vt6656: conversion to mac80211

PATCH In review Malcolm Priestley 3 participants 21 messages Jun 25, 2014 – Jun 27, 2014 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: vt6656: conversion to mac80211

The patches in this series convert the driver to mac80211.

As well as infrastructure mode the driver now operates in IBSS and access point modes.

Host access point is now working with hostapd in nl80211 mode.

These patches creates huge amount of dead code.

The driver nolonger supports WEP 256 mode due to no support in mac80211. The vendors code had removed support for this in their last version anyway.

Malcolm Priestley (17):
staging: vt6656: mac80211 conversion: create rx function.
staging: vt6656: mac80211 conversion: Create tx functions
staging: vt6656: mac80211 conversion: add key functions
staging: vt6656: mac80211 conversion: main_usb add functions and
change usb_driver functions
staging: vt6656: mac80211 conversion: add channel bands
staging: vt6656: mac80211 conversion: add vnt_init to bScheduleCommand
staging: vt6656: mac80211 conversion: vnt_update_ifs change basic
rates
staging: vt6656: mac80211 conversion: enable power saving
staging: vt6656: mac80211 conversion: vRunCommand change beacon
staging: vt6656: mac80211 conversion: change vnt_next_tbtt_wakeup
staging: vt6656: mac80211 conversion: int.c changes
staging: vt6656: mac80211 conversion: vRunCommand channel changes
staging: vt6656: mac80211 conversion: move data rates to device.h
staging: vt6656: mac80211 conversion: change vnt_rf_set_txpower
staging: vt6656: vnt_mac_set_keyentry remove byLocalID check
staging: vt6656: mac80211 conversion: device_alloc_bufs use dev_err
staging: vt6656: mac80211 conversion: rxtx implement power save poll

 drivers/staging/vt6656/Kconfig    |   2 +-
 drivers/staging/vt6656/card.c     |  22 +-
 drivers/staging/vt6656/channel.c  | 139 +++++++++
 drivers/staging/vt6656/channel.h  |   2 +
 drivers/staging/vt6656/datarate.h |  14 -
 drivers/staging/vt6656/device.h   |  31 +-
 drivers/staging/vt6656/dpc.c      | 137 +++++++-
 drivers/staging/vt6656/dpc.h      |   3 +
 drivers/staging/vt6656/int.c      |  49 +--
 drivers/staging/vt6656/key.c      | 143 +++++++++
 drivers/staging/vt6656/key.h      |  13 +
 drivers/staging/vt6656/mac.c      |   4 -
 drivers/staging/vt6656/main_usb.c | 640 +++++++++++++++++++++++++++++++-------
 drivers/staging/vt6656/power.c    |  47 +--
 drivers/staging/vt6656/rf.c       |  23 +-
 drivers/staging/vt6656/rxtx.c     | 462 +++++++++++++++++++++++++--
 drivers/staging/vt6656/rxtx.h     |   7 +-
 drivers/staging/vt6656/usbpipe.c  |  32 +-
 drivers/staging/vt6656/wcmd.c     |  34 +-
 drivers/staging/vt6656/wcmd.h     |   2 +
 20 files changed, 1506 insertions(+), 300 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/17 staging: vt6656: mac80211 conversion: create rx function.

Add mac80211 header and depends.

Create new function vnt_rx_data to receive 80211 packets which is based on RXbBulkInProcessData and rx them into mac80211

The function also relays dbm, tsf_time(as mactime) and sets byBBPreEDRSSI and uCurrRSSI.

skb is modified slightly to skb_put the maxium tail room in PIPEnsBulkInUsbRead and trim back in vnt_rx_data. dev_alloc_skb is used to reallocate the sk_buff.

---
 drivers/staging/vt6656/Kconfig    |   2 +-
 drivers/staging/vt6656/device.h   |   6 ++
 drivers/staging/vt6656/dpc.c      | 137 +++++++++++++++++++++++++++++++++++++-
 drivers/staging/vt6656/dpc.h      |   3 +
 drivers/staging/vt6656/main_usb.c |   2 +-
 drivers/staging/vt6656/usbpipe.c  |   4 +-
 6 files changed, 149 insertions(+), 5 deletions(-)
drivers/staging/vt6656/Kconfig +1 -1
index f89ab20..839db3a 100644
@@ -1,6 +1,6 @@
 config VT6656
 	tristate "VIA Technologies VT6656 support"
-	depends on USB && WLAN && m
+	depends on MAC80211 && USB && WLAN && m
 	select WIRELESS_EXT
 	select WEXT_PRIV
 	select FW_LOADER
drivers/staging/vt6656/device.h +6 -0
index 11b863d..631f402 100644
@@ -44,6 +44,7 @@
 #include <linux/timer.h>
 #include <linux/usb.h>
 #include <linux/crc32.h>
+#include <net/mac80211.h>
 
 #ifdef SIOCETHTOOL
 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
@@ -392,6 +393,8 @@ typedef struct __device_opt {
 } OPTIONS, *POPTIONS;
 
 struct vnt_private {
+	/* mac80211 */
+	struct ieee80211_hw *hw;
 	/* netdev */
 	struct usb_device *usb;
 	struct net_device *dev;
@@ -402,6 +405,9 @@ struct vnt_private {
 	struct work_struct read_work_item;
 	struct work_struct rx_mng_work_item;
 
+	u64 tsf_time;
+	u8 rx_rate;
+
 	u32 rx_buf_sz;
 	int multicast_limit;
 	u8 byRxMode;
drivers/staging/vt6656/dpc.c +136 -1

146 lines not on this page · raw message

drivers/staging/vt6656/dpc.h +3 -0
index 8d52434..45da7b2 100644
@@ -41,4 +41,7 @@ void RXvFreeRCB(struct vnt_rcb *pRCB, int bReAllocSkb);
 int RXbBulkInProcessData(struct vnt_private *, struct vnt_rcb *pRCB,
 	unsigned long BytesToIndicate);
 
+int vnt_rx_data(struct vnt_private *, struct vnt_rcb *,
+	unsigned long bytes_recieved);
+
 #endif /* __RXTX_H__ */
drivers/staging/vt6656/main_usb.c +1 -1
index 4662a3e..ebbb10d 100644
@@ -793,7 +793,7 @@ static bool device_alloc_bufs(struct vnt_private *priv)
 			goto free_rx_tx;
 		}
 
-		rcb->skb = netdev_alloc_skb(priv->dev, priv->rx_buf_sz);
+		rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
 		if (rcb->skb == NULL) {
 			DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
 						" Failed to alloc rx skb\n");
drivers/staging/vt6656/usbpipe.c +2 -2
index e4751b7..e30150e 100644
@@ -242,7 +242,7 @@ int PIPEnsBulkInUsbRead(struct vnt_private *priv, struct vnt_rcb *rcb)
 	usb_fill_bulk_urb(urb,
 		priv->usb,
 		usb_rcvbulkpipe(priv->usb, 2),
-		(void *) (rcb->skb->data),
+		skb_put(rcb->skb, skb_tailroom(rcb->skb)),
 		MAX_TOTAL_SIZE_WITH_ALL_HEADERS,
 		s_nsBulkInUsbIoCompleteRead,
 		rcb);
@@ -297,7 +297,7 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb)
 	if (urb->actual_length) {
 		spin_lock_irqsave(&priv->lock, flags);
 
-		if (RXbBulkInProcessData(priv, rcb, urb->actual_length) == true)
+		if (vnt_rx_data(priv, rcb, urb->actual_length))
 			re_alloc_skb = true;
 
 		spin_unlock_irqrestore(&priv->lock, flags);
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/17 staging: vt6656: mac80211 conversion: Create tx functions

In reply to Malcolm Priestley

Create vnt_fill_txkey as mac80211 replacement for s_vFillTxKey.

Create vnt_tx_packet which a merger of s_bPacketToWirelessUsb, nsDMA_tx_packet and csMgmt_xmit using mac80211 signalling.

Create vnt_beacon_xmit as mac80211 replacement for csBeacon_xmit. Changing header in vnt_beacon_buffer to struct ieee80211_mgmt deleting some of old code. vnt_beacon_make is needed to make beacon for vnt_beacon_xmit.

Create vnt_beacon_enable as mac80211 call to enable beacon.

vnt_fill_ieee80211_rts is modified to use struct ieee80211_hdr instead of struct ethhdr and access to tx_context.

In s_nsBulkOutIoCompleteWrite modify context handling

---
 drivers/staging/vt6656/device.h  |   3 +-
 drivers/staging/vt6656/rxtx.c    | 437 ++++++++++++++++++++++++++++++++++++---
 drivers/staging/vt6656/rxtx.h    |   7 +-
 drivers/staging/vt6656/usbpipe.c |  28 +--
 4 files changed, 432 insertions(+), 43 deletions(-)
drivers/staging/vt6656/device.h +2 -1
index 631f402..23fc5e2 100644
@@ -223,7 +223,8 @@ struct vnt_rsp_card_init {
  */
 enum {
 	CONTEXT_DATA_PACKET = 1,
-	CONTEXT_MGMT_PACKET
+	CONTEXT_MGMT_PACKET,
+	CONTEXT_BEACON_PACKET
 };
 
 /* RCB (Receive Control Block) */
drivers/staging/vt6656/rxtx.c +413 -24

487 lines not on this page · raw message

drivers/staging/vt6656/rxtx.h +6 -1
index 95a4e2c..65f7e26 100644
@@ -247,7 +247,7 @@ struct vnt_beacon_buffer {
 	u8 byPKTNO;
 	__le16 tx_byte_count;
 	struct vnt_tx_short_buf_head short_head;
-	struct ieee80211_hdr hdr;
+	struct ieee80211_mgmt mgmt_hdr;
 } __packed;
 
 void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
@@ -255,4 +255,9 @@ int nsDMA_tx_packet(struct vnt_private *, struct sk_buff *skb);
 CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *);
 CMD_STATUS csBeacon_xmit(struct vnt_private *, struct vnt_tx_mgmt *);
 
+int vnt_tx_packet(struct vnt_private *, struct sk_buff *);
+int vnt_beacon_make(struct vnt_private *, struct ieee80211_vif *);
+int vnt_beacon_enable(struct vnt_private *, struct ieee80211_vif *,
+	struct ieee80211_bss_conf *);
+
 #endif /* __RXTX_H__ */
drivers/staging/vt6656/usbpipe.c +11 -17
index e30150e..fd8776c 100644
@@ -398,7 +398,7 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
 {
 	struct vnt_usb_send_context *context = urb->context;
 	struct vnt_private *priv = context->priv;
-	u8 context_type = context->type;
+	struct ieee80211_tx_info *info;
 
 	switch (urb->status) {
 	case 0:
@@ -415,24 +415,18 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb)
 		break;
 	}
 
-	if (!netif_device_present(priv->dev))
-		return;
-
-	if (CONTEXT_DATA_PACKET == context_type) {
-		if (context->skb != NULL) {
-			dev_kfree_skb_irq(context->skb);
-			context->skb = NULL;
-			dev_dbg(&priv->usb->dev,
-					"tx  %d bytes\n", context->buf_len);
-		}
-
-		priv->dev->trans_start = jiffies;
+	if (context->skb) {
+		info = IEEE80211_SKB_CB(context->skb);
+		ieee80211_tx_info_clear_status(info);
+		info->status.rates[0].idx = priv->wCurrentRate;
+		info->status.rates[0].count = 0;
+		if (!urb->status)
+			info->flags |= IEEE80211_TX_STAT_ACK;
+		ieee80211_tx_status_irqsafe(priv->hw, context->skb);
 	}
 
-	if (priv->bLinkPass == true) {
-		if (netif_queue_stopped(priv->dev))
-			netif_wake_queue(priv->dev);
-	}
+	if (context->type == CONTEXT_DATA_PACKET)
+		ieee80211_wake_queues(priv->hw);
 
 	context->in_use = false;
 
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/17 staging: vt6656: mac80211 conversion: add key functions

In reply to Malcolm Priestley

Create vnt_key_init_table to replace KeyvInitTable.

Create vnt_set_keymode to handle key setting operations with five different modes VNT_KEY_DEFAULTKEY, VNT_KEY_GROUP_ADDRESS, VNT_KEY_ALLGROUP, VNT_KEY_GROUP and VNT_KEY_PAIRWISE. VNT_KEY_ONFLY and VNT_KEY_ONFLY_ALL are for when key latching in driver is not required.

Create vnt_set_keys to handle mac80211 key cipher modes, four modes are supported WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, WLAN_CIPHER_SUITE_TKIP and WLAN_CIPHER_SUITE_CCMP.

---
 drivers/staging/vt6656/device.h |   1 +
 drivers/staging/vt6656/key.c    | 143 ++++++++++++++++++++++++++++++++++++++++
 drivers/staging/vt6656/key.h    |  13 ++++
 3 files changed, 157 insertions(+)
drivers/staging/vt6656/device.h +1 -0
index 23fc5e2..112e0b0 100644
@@ -631,6 +631,7 @@ struct vnt_private {
 
 	u32 uKeyLength;
 	u8 abyKey[WLAN_WEP232_KEYLEN];
+	unsigned long key_entry_inuse;
 
 	/* for AP mode */
 	u32 uAssocCount;
drivers/staging/vt6656/key.c +143 -0

146 lines not on this page · raw message

drivers/staging/vt6656/key.h +13 -0
index 23e188d..7b8c960 100644
@@ -51,6 +51,14 @@
 #define KEY_CTL_CCMP        0x03
 #define KEY_CTL_INVALID     0xFF
 
+#define VNT_KEY_DEFAULTKEY	0x1
+#define VNT_KEY_GROUP_ADDRESS	0x2
+#define VNT_KEY_ALLGROUP	0x4
+#define VNT_KEY_GROUP		0x40
+#define VNT_KEY_PAIRWISE	0x00
+#define VNT_KEY_ONFLY		0x8000
+#define VNT_KEY_ONFLY_ALL	0x4000
+
 typedef struct tagSKeyItem
 {
     bool        bKeyValid;
@@ -109,4 +117,9 @@ int KeybSetAllGroupKey(struct vnt_private *, PSKeyManagement pTable,
 	u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey,
 	u8 byKeyDecMode);
 
+int vnt_key_init_table(struct vnt_private *);
+
+int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+	struct ieee80211_vif *vif, struct ieee80211_key_conf *key);
+
 #endif /* __KEY_H__ */
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/17 staging: vt6656: mac80211 conversion: main_usb add functions and change usb_driver functions

In reply to Malcolm Priestley

Create new functions for the operations of mac80211 vnt_tx_80211
vnt_start
vnt_stop
vnt_add_interface
vnt_remove_interface
vnt_config
vnt_bss_info_changed
vnt_prepare_multicast
vnt_configure
vnt_set_key
vnt_sw_scan_start
vnt_sw_scan_complete
vnt_get_tsf
vnt_set_tsf
vnt_reset_tsf

Create vnt_init to call device_init_registers to get permanent mac address. This will be linked to vt6656_probe via bScheduleCommand in another patch as firmware needs to be loaded first.

Modify vt6656_probe, vt6656_disconnect for mac80211

Change vt6656_suspend and vt6656_resume, nothing needs to be done here let mac80211 handle the suspend.

---
 drivers/staging/vt6656/device.h   |   3 +
 drivers/staging/vt6656/main_usb.c | 619 ++++++++++++++++++++++++++++++++------
 2 files changed, 522 insertions(+), 100 deletions(-)
drivers/staging/vt6656/device.h +3 -0
index 112e0b0..46d7704 100644
@@ -396,6 +396,7 @@ typedef struct __device_opt {
 struct vnt_private {
 	/* mac80211 */
 	struct ieee80211_hw *hw;
+	struct ieee80211_vif *vif;
 	/* netdev */
 	struct usb_device *usb;
 	struct net_device *dev;
@@ -410,6 +411,7 @@ struct vnt_private {
 	u8 rx_rate;
 
 	u32 rx_buf_sz;
+	int mc_list_count;
 	int multicast_limit;
 	u8 byRxMode;
 
@@ -574,6 +576,7 @@ struct vnt_private {
 	int bRadioOff;
 
 	/* Power save */
+	u16 current_aid;
 	int bEnablePSMode;
 	u16 wListenInterval;
 	int bPWBitOn;
drivers/staging/vt6656/main_usb.c +519 -100

648 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/17 staging: vt6656: mac80211 conversion: add channel bands

In reply to Malcolm Priestley

Add rates and channels according to rf type for vnt_init_bands which is a mac80211 replacement for CHvInitChannelTable.

---
 drivers/staging/vt6656/channel.c  | 139 ++++++++++++++++++++++++++++++++++++++
 drivers/staging/vt6656/channel.h  |   2 +
 drivers/staging/vt6656/main_usb.c |   2 +
 3 files changed, 143 insertions(+)
drivers/staging/vt6656/channel.c +139 -0
index 5a4fa0e..29c2ed3 100644
@@ -36,6 +36,8 @@
 
 #include <linux/kernel.h>
 #include "country.h"
+#include "device.h"
+#include "datarate.h"
 #include "channel.h"
 #include "rf.h"
 
@@ -471,3 +473,140 @@ void CHvInitChannelTable(struct vnt_private *pDevice)
         }*/
     }
 }
+
+static struct ieee80211_rate vnt_rates_bg[] = {
+	{ .bitrate = 10,  .hw_value = RATE_1M },
+	{ .bitrate = 20,  .hw_value = RATE_2M },
+	{ .bitrate = 55,  .hw_value = RATE_5M },
+	{ .bitrate = 110, .hw_value = RATE_11M },
+	{ .bitrate = 60,  .hw_value = RATE_6M },
+	{ .bitrate = 90,  .hw_value = RATE_9M },
+	{ .bitrate = 120, .hw_value = RATE_12M },
+	{ .bitrate = 180, .hw_value = RATE_18M },
+	{ .bitrate = 240, .hw_value = RATE_24M },
+	{ .bitrate = 360, .hw_value = RATE_36M },
+	{ .bitrate = 480, .hw_value = RATE_48M },
+	{ .bitrate = 540, .hw_value = RATE_54M },
+};
+
+static struct ieee80211_rate vnt_rates_a[] = {
+	{ .bitrate = 60,  .hw_value = RATE_6M },
+	{ .bitrate = 90,  .hw_value = RATE_9M },
+	{ .bitrate = 120, .hw_value = RATE_12M },
+	{ .bitrate = 180, .hw_value = RATE_18M },
+	{ .bitrate = 240, .hw_value = RATE_24M },
+	{ .bitrate = 360, .hw_value = RATE_36M },
+	{ .bitrate = 480, .hw_value = RATE_48M },
+	{ .bitrate = 540, .hw_value = RATE_54M },
+};
+
+static struct ieee80211_channel vnt_channels_2ghz[] = {
+	{ .center_freq = 2412, .hw_value = 1 },
+	{ .center_freq = 2417, .hw_value = 2 },
+	{ .center_freq = 2422, .hw_value = 3 },
+	{ .center_freq = 2427, .hw_value = 4 },
+	{ .center_freq = 2432, .hw_value = 5 },
+	{ .center_freq = 2437, .hw_value = 6 },
+	{ .center_freq = 2442, .hw_value = 7 },
+	{ .center_freq = 2447, .hw_value = 8 },
+	{ .center_freq = 2452, .hw_value = 9 },
+	{ .center_freq = 2457, .hw_value = 10 },
+	{ .center_freq = 2462, .hw_value = 11 },
+	{ .center_freq = 2467, .hw_value = 12 },
+	{ .center_freq = 2472, .hw_value = 13 },
+	{ .center_freq = 2484, .hw_value = 14 }
+};
+
+static struct ieee80211_channel vnt_channels_5ghz[] = {
+	{ .center_freq = 4915, .hw_value = 15 },
+	{ .center_freq = 4920, .hw_value = 16 },
+	{ .center_freq = 4925, .hw_value = 17 },
+	{ .center_freq = 4935, .hw_value = 18 },
+	{ .center_freq = 4940, .hw_value = 19 },
+	{ .center_freq = 4945, .hw_value = 20 },
+	{ .center_freq = 4960, .hw_value = 21 },
+	{ .center_freq = 4980, .hw_value = 22 },
+	{ .center_freq = 5035, .hw_value = 23 },
+	{ .center_freq = 5040, .hw_value = 24 },
+	{ .center_freq = 5045, .hw_value = 25 },
+	{ .center_freq = 5055, .hw_value = 26 },
+	{ .center_freq = 5060, .hw_value = 27 },
+	{ .center_freq = 5080, .hw_value = 28 },
+	{ .center_freq = 5170, .hw_value = 29 },
+	{ .center_freq = 5180, .hw_value = 30 },
+	{ .center_freq = 5190, .hw_value = 31 },
+	{ .center_freq = 5200, .hw_value = 32 },
+	{ .center_freq = 5210, .hw_value = 33 },
+	{ .center_freq = 5220, .hw_value = 34 },
+	{ .center_freq = 5230, .hw_value = 35 },
+	{ .center_freq = 5240, .hw_value = 36 },
+	{ .center_freq = 5260, .hw_value = 37 },
+	{ .center_freq = 5280, .hw_value = 38 },
+	{ .center_freq = 5300, .hw_value = 39 },
+	{ .center_freq = 5320, .hw_value = 40 },
+	{ .center_freq = 5500, .hw_value = 41 },
+	{ .center_freq = 5520, .hw_value = 42 },
+	{ .center_freq = 5540, .hw_value = 43 },
+	{ .center_freq = 5560, .hw_value = 44 },
+	{ .center_freq = 5580, .hw_value = 45 },
+	{ .center_freq = 5600, .hw_value = 46 },
+	{ .center_freq = 5620, .hw_value = 47 },
+	{ .center_freq = 5640, .hw_value = 48 },
+	{ .center_freq = 5660, .hw_value = 49 },
+	{ .center_freq = 5680, .hw_value = 50 },
+	{ .center_freq = 5700, .hw_value = 51 },
+	{ .center_freq = 5745, .hw_value = 52 },
+	{ .center_freq = 5765, .hw_value = 53 },
+	{ .center_freq = 5785, .hw_value = 54 },
+	{ .center_freq = 5805, .hw_value = 55 },
+	{ .center_freq = 5825, .hw_value = 56 }
+};
+
+static struct ieee80211_supported_band vnt_supported_2ghz_band = {
+	.channels = vnt_channels_2ghz,
+	.n_channels = ARRAY_SIZE(vnt_channels_2ghz),
+	.bitrates = vnt_rates_bg,
+	.n_bitrates = ARRAY_SIZE(vnt_rates_bg),
+};
+
+static struct ieee80211_supported_band vnt_supported_5ghz_band = {
+	.channels = vnt_channels_5ghz,
+	.n_channels = ARRAY_SIZE(vnt_channels_5ghz),
+	.bitrates = vnt_rates_a,
+	.n_bitrates = ARRAY_SIZE(vnt_rates_a),
+};
+
+void vnt_init_bands(struct vnt_private *priv)
+{
+	struct ieee80211_channel *ch;
+	int i;
+
+	switch (priv->byRFType) {
+	case RF_AIROHA7230:
+	case RF_VT3342A0:
+		ch = vnt_channels_5ghz;
+
+		for (i = 0; i < ARRAY_SIZE(vnt_channels_5ghz); i++) {
+			ch[i].max_power = VNT_RF_MAX_POWER;
+			ch[i].flags = IEEE80211_CHAN_NO_HT40;
+		}
+
+		priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+						&vnt_supported_5ghz_band;
+	/* fallthrough */
+	case RF_AL2230:
+	case RF_AL2230S:
+	case RF_VT3226:
+	case RF_VT3226D0:
+		ch = vnt_channels_2ghz;
+
+		for (i = 0; i < ARRAY_SIZE(vnt_channels_2ghz); i++) {
+			ch[i].max_power = VNT_RF_MAX_POWER;
+			ch[i].flags = IEEE80211_CHAN_NO_HT40;
+		}
+
+		priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+						&vnt_supported_2ghz_band;
+		break;
+	}
+}
drivers/staging/vt6656/channel.h +2 -0
index 95701e0..0d52225 100644
@@ -41,4 +41,6 @@ typedef struct tagSChannelTblElement {
 bool    ChannelValid(unsigned int CountryCode, unsigned int ChannelNum);
 void    CHvInitChannelTable(struct vnt_private *pDevice);
 
+void vnt_init_bands(struct vnt_private *);
+
 #endif  /* _CHANNEL_H_ */
drivers/staging/vt6656/main_usb.c +2 -0
index 6f66b86..663ea0c 100644
@@ -1378,6 +1378,8 @@ int vnt_init(struct vnt_private *priv)
 
 	SET_IEEE80211_PERM_ADDR(priv->hw, priv->abyPermanentNetAddr);
 
+	vnt_init_bands(priv);
+
 	if (ieee80211_register_hw(priv->hw))
 		return -ENODEV;
 
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/17 staging: vt6656: mac80211 conversion: add vnt_init to bScheduleCommand

In reply to Malcolm Priestley

start driver by linking vnt_init to vt6656_probe use bScheduleCommand to schedule new command WLAN_CMD_INIT_MAC80211

vResetCommandTimer is now used to initiate command timer.

---
 drivers/staging/vt6656/device.h   |  2 ++
 drivers/staging/vt6656/main_usb.c | 10 +++++++++-
 drivers/staging/vt6656/wcmd.c     | 19 +++++++++++++++++--
 drivers/staging/vt6656/wcmd.h     |  2 ++
 4 files changed, 30 insertions(+), 3 deletions(-)
drivers/staging/vt6656/device.h +2 -0
index 46d7704..46584c7 100644
@@ -397,6 +397,7 @@ struct vnt_private {
 	/* mac80211 */
 	struct ieee80211_hw *hw;
 	struct ieee80211_vif *vif;
+	u8 mac_hw;
 	/* netdev */
 	struct usb_device *usb;
 	struct net_device *dev;
@@ -744,5 +745,6 @@ struct vnt_private {
 
 int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
 void vnt_configure_filter(struct vnt_private *);
+int vnt_init(struct vnt_private *priv);
 
 #endif
drivers/staging/vt6656/main_usb.c +9 -1
index 663ea0c..ee63390 100644
@@ -1383,6 +1383,8 @@ int vnt_init(struct vnt_private *priv)
 	if (ieee80211_register_hw(priv->hw))
 		return -ENODEV;
 
+	priv->mac_hw = true;
+
 	return 0;
 }
 
@@ -1443,6 +1445,11 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
 	usb_device_reset(priv);
 
+	MP_CLEAR_FLAG(priv, fMP_DISCONNECTED);
+	vResetCommandTimer(priv);
+
+	bScheduleCommand(priv, WLAN_CMD_INIT_MAC80211, NULL);
+
 	return 0;
 
 err_nomem:
@@ -1458,7 +1465,8 @@ static void vt6656_disconnect(struct usb_interface *intf)
 	if (!priv)
 		return;
 
-	ieee80211_unregister_hw(priv->hw);
+	if (priv->mac_hw)
+		ieee80211_unregister_hw(priv->hw);
 
 	usb_set_intfdata(intf, NULL);
 	usb_put_dev(interface_to_usbdev(intf));
drivers/staging/vt6656/wcmd.c +17 -2
index 4c37908..85adc1c 100644
@@ -287,7 +287,20 @@ void vRunCommand(struct work_struct *work)
 		return;
 
 	switch (pDevice->eCommandState) {
+	case WLAN_CMD_INIT_MAC80211_START:
+		if (pDevice->mac_hw)
+			break;
+
+		dev_info(&pDevice->usb->dev, "Starting mac80211\n");
+
+		if (vnt_init(pDevice)) {
+			/* If fail all ends TODO retry */
+			dev_err(&pDevice->usb->dev, "failed to start\n");
+			ieee80211_free_hw(pDevice->hw);
+			return;
+		}
 
+		break;
 	case WLAN_CMD_SCAN_START:
 
 		pDevice->byReAssocCount = 0;
@@ -915,6 +928,10 @@ static int s_bCommandComplete(struct vnt_private *pDevice)
 		pDevice->cbFreeCmdQueue++;
 		pDevice->bCmdRunning = true;
 		switch (pDevice->eCommand) {
+		case WLAN_CMD_INIT_MAC80211:
+			pDevice->eCommandState = WLAN_CMD_INIT_MAC80211_START;
+			break;
+
 		case WLAN_CMD_BSSID_SCAN:
 			DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n");
 			pDevice->eCommandState = WLAN_CMD_SCAN_START;
@@ -1083,8 +1100,6 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice)
 //mike add:reset command timer
 void vResetCommandTimer(struct vnt_private *pDevice)
 {
-	cancel_delayed_work_sync(&pDevice->run_command_work);
-
 	pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
 	pDevice->uCmdDequeueIdx = 0;
 	pDevice->uCmdEnqueueIdx = 0;
drivers/staging/vt6656/wcmd.h +2 -0
index 7365721..894eea1 100644
@@ -37,6 +37,7 @@
 
 // Command code
 typedef enum tagCMD_CODE {
+    WLAN_CMD_INIT_MAC80211,
     WLAN_CMD_BSSID_SCAN,
     WLAN_CMD_SSID,
     WLAN_CMD_DISASSOCIATE,
@@ -78,6 +79,7 @@ typedef struct tagCMD_ITEM {
 
 // Command state
 typedef enum tagCMD_STATE {
+    WLAN_CMD_INIT_MAC80211_START,
     WLAN_CMD_SCAN_START,
     WLAN_CMD_SCAN_END,
     WLAN_CMD_DISASSOCIATE_START,
Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/17 staging: vt6656: mac80211 conversion: vnt_update_ifs change basic rates

In reply to Malcolm Priestley

Use wBasicRate to find ofdm_rate.

wBasicRate is changed to u32 to match struct ieee80211_bss_conf -> basic_rates

---
 drivers/staging/vt6656/card.c   | 22 ++--------------------
 drivers/staging/vt6656/device.h |  2 +-
 2 files changed, 3 insertions(+), 21 deletions(-)
drivers/staging/vt6656/card.c +2 -20
index 8be3a89..1b3e0af 100644
@@ -402,10 +402,8 @@ void vnt_update_ifs(struct vnt_private *priv)
 		priv->uCwMin = C_CWMIN_B;
 		max_min = 5;
 	} else {/* PK_TYPE_11GA & PK_TYPE_11GB */
-		u8 rate = 0;
 		bool ofdm_rate = false;
 		unsigned int ii = 0;
-		PWLAN_IE_SUPP_RATES item_rates = NULL;
 
 		priv->uSIFS = C_SIFS_BG;
 
@@ -416,29 +414,13 @@ void vnt_update_ifs(struct vnt_private *priv)
 
 		priv->uDIFS = C_SIFS_BG + 2 * priv->uSlot;
 
-		item_rates =
-			(PWLAN_IE_SUPP_RATES)priv->vnt_mgmt.abyCurrSuppRates;
-
-		for (ii = 0; ii < item_rates->len; ii++) {
-			rate = (u8)(item_rates->abyRates[ii] & 0x7f);
-			if (RATEwGetRateIdx(rate) > RATE_11M) {
+		for (ii = RATE_54M; ii >= RATE_6M; ii--) {
+			if (priv->wBasicRate & ((u32)(0x1 << ii))) {
 				ofdm_rate = true;
 				break;
 			}
 		}
 
-		if (ofdm_rate == false) {
-			item_rates = (PWLAN_IE_SUPP_RATES)priv->vnt_mgmt
-				.abyCurrExtSuppRates;
-			for (ii = 0; ii < item_rates->len; ii++) {
-				rate = (u8)(item_rates->abyRates[ii] & 0x7f);
-				if (RATEwGetRateIdx(rate) > RATE_11M) {
-					ofdm_rate = true;
-					break;
-				}
-			}
-		}
-
 		if (ofdm_rate == true) {
 			priv->uCwMin = C_CWMIN_A;
 			max_min = 4;
drivers/staging/vt6656/device.h +1 -1
index 46584c7..2bd9830 100644
@@ -522,7 +522,7 @@ struct vnt_private {
 	/* Rate */
 	u8 byBBType; /* 0: 11A, 1:11B, 2:11G */
 	u8 byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */
-	u16 wBasicRate;
+	u32 wBasicRate;
 	u8 byTopOFDMBasicRate;
 	u8 byTopCCKBasicRate;
 
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/17 staging: vt6656: mac80211 conversion: enable power saving

In reply to Malcolm Priestley

Convert vnt_enable_power_saving and vnt_disable_power_saving

Remove mgmt->wCurrAID and use priv->current_aid

We nolonger send the PSbSendNullPacket from vnt_enable_power_saving

---
 drivers/staging/vt6656/power.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)
drivers/staging/vt6656/power.c +1 -22
index cc28192..6c34d36 100644
@@ -60,8 +60,7 @@ static int msglevel = MSG_LEVEL_INFO;
 
 void vnt_enable_power_saving(struct vnt_private *priv, u16 listen_interval)
 {
-	struct vnt_manager *mgmt = &priv->vnt_mgmt;
-	u16 aid = mgmt->wCurrAID | BIT14 | BIT15;
+	u16 aid = priv->current_aid | BIT(14) | BIT(15);
 
 	/* set period of power up before TBTT */
 	vnt_mac_write_word(priv, MAC_REG_PWBT, C_PWBT);
@@ -92,26 +91,12 @@ void vnt_enable_power_saving(struct vnt_private *priv, u16 listen_interval)
 
 		/* first time set listen next beacon */
 		vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
-
-		mgmt->wCountToWakeUp = listen_interval;
-
 	} else {
 
 		/* always listen beacon */
 		vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
-
-		mgmt->wCountToWakeUp = 0;
 	}
 
-	priv->bEnablePSMode = true;
-
-	/* We don't send null pkt in ad hoc mode
-	 * since beacon will handle this.
-	 */
-	if (priv->op_mode == NL80211_IFTYPE_STATION)
-		PSbSendNullPacket(priv);
-
-	priv->bPWBitOn = true;
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable...\n");
 }
 
@@ -137,12 +122,6 @@ void vnt_disable_power_saving(struct vnt_private *priv)
 
 	/* set always listen beacon */
 	vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
-	priv->bEnablePSMode = false;
-
-	if (priv->op_mode == NL80211_IFTYPE_STATION)
-		PSbSendNullPacket(priv);
-
-	priv->bPWBitOn = false;
 }
 
 /*
Signature · 1 line
1.9.1
#9 lore raw

PATCH 9/17 staging: vt6656: mac80211 conversion: vRunCommand change beacon

In reply to Malcolm Priestley

Remove bMgrPrepareBeaconToSend

Check that vif is not null

Call vnt_beacon_make and turn on TCR_AUTOBCNTX.

---
 drivers/staging/vt6656/wcmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/vt6656/wcmd.c +7 -1
index 85adc1c..3095689 100644
@@ -843,7 +843,13 @@ void vRunCommand(struct work_struct *work)
 		break;
 
 	case WLAN_CMD_BECON_SEND_START:
-		bMgrPrepareBeaconToSend(pDevice, pMgmt);
+		if (!pDevice->vif)
+			break;
+
+		vnt_beacon_make(pDevice, pDevice->vif);
+
+		vnt_mac_reg_bits_on(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX);
+
 		break;
 
 	case WLAN_CMD_SETPOWER_START:
Signature · 1 line
1.9.1
#10 lore raw

PATCH 10/17 staging: vt6656: mac80211 conversion: change vnt_next_tbtt_wakeup

In reply to Malcolm Priestley

Wake up to listen to next beacon when struct ieee80211_conf -> listen_interval == 1

---
 drivers/staging/vt6656/power.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/staging/vt6656/power.c +7 -17
index 6c34d36..ace0cba 100644
@@ -293,25 +293,15 @@ int PSbSendNullPacket(struct vnt_private *pDevice)
 
 int vnt_next_tbtt_wakeup(struct vnt_private *priv)
 {
-	struct vnt_manager *mgmt = &priv->vnt_mgmt;
+	struct ieee80211_hw *hw = priv->hw;
+	struct ieee80211_conf *conf = &hw->conf;
 	int wake_up = false;
 
-	if (mgmt->wListenInterval >= 2) {
-		if (mgmt->wCountToWakeUp == 0)
-			mgmt->wCountToWakeUp = mgmt->wListenInterval;
-
-		mgmt->wCountToWakeUp--;
-
-		if (mgmt->wCountToWakeUp == 1) {
-			/* Turn on wake up to listen next beacon */
-			vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
-			priv->bPSRxBeacon = false;
-			wake_up = true;
-		} else if (!priv->bPSRxBeacon) {
-			/* Listen until RxBeacon */
-			vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
-		}
+	if (conf->listen_interval == 1) {
+		/* Turn on wake up to listen next beacon */
+		vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
+		wake_up = true;
 	}
+
 	return wake_up;
 }
-
Signature · 1 line
1.9.1
#11 lore raw

PATCH 11/17 staging: vt6656: mac80211 conversion: int.c changes

In reply to Malcolm Priestley

Remove BSSvUpdateNodeTxCounter which is not used. net_device_stats and wsats will be removed later.

Change handling of ISR_BNTX to mac80211

Change handling of ISR_TBTT. Use IEEE80211_CONF_PS for WLAN_CMD_TBTT_WAKEUP disable bChannelSwitch this is yet to be done.

---
 drivers/staging/vt6656/int.c | 49 ++++++--------------------------------------
 1 file changed, 6 insertions(+), 43 deletions(-)
drivers/staging/vt6656/int.c +6 -43
index f2a5225..b717ace 100644
@@ -80,7 +80,6 @@ void INTvWorkItem(struct vnt_private *pDevice)
 void INTnsProcessData(struct vnt_private *priv)
 {
 	struct vnt_interrupt_data *int_data;
-	struct vnt_manager *mgmt = &priv->vnt_mgmt;
 	struct net_device_stats *stats = &priv->stats;
 
 	DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
@@ -92,10 +91,6 @@ void INTnsProcessData(struct vnt_private *priv)
 			priv->wstats.discard.retries++;
 		else
 			stats->tx_packets++;
-
-		BSSvUpdateNodeTxCounter(priv,
-					int_data->tsr0,
-					int_data->pkt0);
 	}
 
 	if (int_data->tsr1 & TSR_VALID) {
@@ -103,11 +98,6 @@ void INTnsProcessData(struct vnt_private *priv)
 			priv->wstats.discard.retries++;
 		else
 			stats->tx_packets++;
-
-
-		BSSvUpdateNodeTxCounter(priv,
-					int_data->tsr1,
-					int_data->pkt1);
 	}
 
 	if (int_data->tsr2 & TSR_VALID) {
@@ -115,10 +105,6 @@ void INTnsProcessData(struct vnt_private *priv)
 			priv->wstats.discard.retries++;
 		else
 			stats->tx_packets++;
-
-		BSSvUpdateNodeTxCounter(priv,
-					int_data->tsr2,
-					int_data->pkt2);
 	}
 
 	if (int_data->tsr3 & TSR_VALID) {
@@ -126,43 +112,19 @@ void INTnsProcessData(struct vnt_private *priv)
 			priv->wstats.discard.retries++;
 		else
 			stats->tx_packets++;
-
-		BSSvUpdateNodeTxCounter(priv,
-					int_data->tsr3,
-					int_data->pkt3);
 	}
 
 	if (int_data->isr0 != 0) {
-		if (int_data->isr0 & ISR_BNTX) {
-			if (priv->op_mode == NL80211_IFTYPE_AP) {
-				if (mgmt->byDTIMCount > 0) {
-					mgmt->byDTIMCount--;
-					mgmt->sNodeDBTable[0].bRxPSPoll =
-						false;
-				} else if (mgmt->byDTIMCount == 0) {
-					/* check if multicast tx buffering */
-					mgmt->byDTIMCount =
-						mgmt->byDTIMPeriod-1;
-					mgmt->sNodeDBTable[0].bRxPSPoll = true;
-					if (mgmt->sNodeDBTable[0].bPSEnable)
-						bScheduleCommand((void *) priv,
-								 WLAN_CMD_RX_PSPOLL,
-								 NULL);
-				}
-				bScheduleCommand((void *) priv,
-						WLAN_CMD_BECON_SEND,
-						NULL);
-			}
-			priv->bBeaconSent = true;
-		} else {
-			priv->bBeaconSent = false;
-		}
+		if (int_data->isr0 & ISR_BNTX &&
+				priv->op_mode == NL80211_IFTYPE_AP)
+			bScheduleCommand(priv, WLAN_CMD_BECON_SEND, NULL);
 
 		if (int_data->isr0 & ISR_TBTT) {
-			if (priv->bEnablePSMode)
+			if (priv->hw->conf.flags & IEEE80211_CONF_PS)
 				bScheduleCommand((void *) priv,
 						WLAN_CMD_TBTT_WAKEUP,
 						NULL);
+#if 0 /* TODO channel switch */
 			if (priv->bChannelSwitch) {
 				priv->byChannelSwitchCount--;
 				if (priv->byChannelSwitchCount == 0)
@@ -170,6 +132,7 @@ void INTnsProcessData(struct vnt_private *priv)
 							WLAN_CMD_11H_CHSW,
 							NULL);
 			}
+#endif
 		}
 		priv->qwCurrTSF = le64_to_cpu(int_data->tsf);
 	}
Signature · 1 line
1.9.1
#12 lore raw

PATCH 12/17 staging: vt6656: mac80211 conversion: vRunCommand channel changes

In reply to Malcolm Priestley

pDevice->hw->conf.chandef.chan->hw_value to find current channel

Remove bChannelSwitch, uCurrChannel, byNewChannel and bStopDataPkt

---
 drivers/staging/vt6656/wcmd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/vt6656/wcmd.c +2 -5
index 3095689..81a6683 100644
@@ -855,7 +855,7 @@ void vRunCommand(struct work_struct *work)
 	case WLAN_CMD_SETPOWER_START:
 
 		vnt_rf_setpower(pDevice, pDevice->wCurrentRate,
-							pMgmt->uCurrChannel);
+				pDevice->hw->conf.chandef.chan->hw_value);
 
 		break;
 
@@ -895,10 +895,7 @@ void vRunCommand(struct work_struct *work)
 		break;
 
 	case WLAN_CMD_11H_CHSW_START:
-		vnt_set_channel(pDevice, pDevice->byNewChannel);
-		pDevice->bChannelSwitch = false;
-		pMgmt->uCurrChannel = pDevice->byNewChannel;
-		pDevice->bStopDataPkt = false;
+		vnt_set_channel(pDevice, pDevice->hw->conf.chandef.chan->hw_value);
 		break;
 
 	case WLAN_CMD_CONFIGURE_FILTER_START:
Signature · 1 line
1.9.1
#13 lore raw

PATCH 13/17 staging: vt6656: mac80211 conversion: move data rates to device.h

In reply to Malcolm Priestley

Move all RATE_* macros to device.h

---
 drivers/staging/vt6656/datarate.h | 14 --------------
 drivers/staging/vt6656/device.h   | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/staging/vt6656/datarate.h +0 -14
index 96252ad..19b2c66 100644
@@ -39,20 +39,6 @@
 #define RETRY_TIMES_THRD_H         2    /* times */
 #define RETRY_TIMES_THRD_L         1    /* times */
 
-#define RATE_1M         0
-#define RATE_2M         1
-#define RATE_5M         2
-#define RATE_11M        3
-#define RATE_6M         4
-#define RATE_9M         5
-#define RATE_12M        6
-#define RATE_18M        7
-#define RATE_24M        8
-#define RATE_36M        9
-#define RATE_48M       10
-#define RATE_54M       11
-#define RATE_AUTO      12
-
 void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates,
 	PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate,
 	u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate,
drivers/staging/vt6656/device.h +14 -0
index 2bd9830..6696365 100644
@@ -53,6 +53,20 @@
 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
 #endif
 
+#define RATE_1M		0
+#define RATE_2M		1
+#define RATE_5M		2
+#define RATE_11M	3
+#define RATE_6M		4
+#define RATE_9M		5
+#define RATE_12M	6
+#define RATE_18M	7
+#define RATE_24M	8
+#define RATE_36M	9
+#define RATE_48M	10
+#define RATE_54M	11
+#define RATE_AUTO	12
+
 #define MAX_RATE			12
 
 /*
Signature · 1 line
1.9.1
#14 lore raw

PATCH 14/17 staging: vt6656: mac80211 conversion: change vnt_rf_set_txpower

In reply to Malcolm Priestley

Remove old eScanState code and use.

priv->hw->conf.chandef.chan->hw_value to find current channel

Check hw_value for bounds of vt3226d0_lo_current_table

---
 drivers/staging/vt6656/rf.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)
drivers/staging/vt6656/rf.c +9 -14
index 3f54ae3..6bfd272 100644
@@ -891,6 +891,8 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
 			return false;
 
 		if (rate <= RATE_11M) {
+			u16 hw_value = priv->hw->conf.chandef.chan->hw_value;
+
 			power_setting = ((0x3f-priv->byCurPwr) << 20) |
 				(0xe07 << 8) | (BY_VT3226_REG_LEN << 3) |
 						IFREGCTL_REGW;
@@ -899,21 +901,14 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
 			ret &= vnt_rf_write_embedded(priv, 0x03c6a200 +
 					(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
 
-			if (priv->vnt_mgmt.eScanState != WMAC_NO_SCANNING) {
-				dev_dbg(&priv->usb->dev,
-				"vnt_rf_set_txpower> 11B mode uCurrChannel[%d]\n",
-						priv->vnt_mgmt.uScanChannel);
-				ret &= vnt_rf_write_embedded(priv,
-					vt3226d0_lo_current_table[priv->
-						vnt_mgmt.uScanChannel - 1]);
-			} else {
-				dev_dbg(&priv->usb->dev,
-				"vnt_rf_set_txpower> 11B mode uCurrChannel[%d]\n",
-						priv->vnt_mgmt.uCurrChannel);
+			dev_dbg(&priv->usb->dev,
+				"%s 11b channel [%d]\n", __func__, hw_value);
+
+			hw_value--;
+
+			if (hw_value < ARRAY_SIZE(vt3226d0_lo_current_table))
 				ret &= vnt_rf_write_embedded(priv,
-					vt3226d0_lo_current_table[priv->
-						vnt_mgmt.uCurrChannel - 1]);
-			}
+					vt3226d0_lo_current_table[hw_value]);
 
 			ret &= vnt_rf_write_embedded(priv, 0x015C0800 +
 				(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
Signature · 1 line
1.9.1
#16 lore raw

PATCH 16/17 staging: vt6656: mac80211 conversion: device_alloc_bufs use dev_err

In reply to Malcolm Priestley

priv->dev->name is now null change to dev_err

---
 drivers/staging/vt6656/main_usb.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/vt6656/main_usb.c +3 -6
index ee63390..5cc3d42 100644
@@ -650,9 +650,8 @@ static bool device_alloc_bufs(struct vnt_private *priv)
 		tx_context = kmalloc(sizeof(struct vnt_usb_send_context),
 								GFP_KERNEL);
 		if (tx_context == NULL) {
-			DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
-				"%s : allocate tx usb context failed\n",
-					priv->dev->name);
+			dev_err(&priv->usb->dev,
+					"allocate tx usb context failed\n");
 			goto free_tx;
 		}
 
@@ -674,9 +673,7 @@ static bool device_alloc_bufs(struct vnt_private *priv)
 	priv->pRCBMem = kzalloc((sizeof(struct vnt_rcb) * priv->cbRD),
 								GFP_KERNEL);
 	if (priv->pRCBMem == NULL) {
-		DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
-			"%s : alloc rx usb context failed\n",
-				priv->dev->name);
+		dev_err(&priv->usb->dev, "alloc rx usb context failed\n");
 		goto free_tx;
 	}
 
Signature · 1 line
1.9.1
#17 lore raw

PATCH 17/17 staging: vt6656: mac80211 conversion: rxtx implement power save poll

In reply to Malcolm Priestley
---
 drivers/staging/vt6656/rxtx.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/staging/vt6656/rxtx.c +22 -3
index 7f7c13a..c3d4778 100644
@@ -492,6 +492,8 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context,
 {
 
 	struct vnt_private *priv = tx_context->priv;
+	struct ieee80211_hdr *hdr =
+				(struct ieee80211_hdr *)tx_context->skb->data;
 
 	/* Get SignalField,ServiceField,Length */
 	vnt_get_phy_field(priv, frame_len, rate, pkt_type, &buf->a);
@@ -499,8 +501,16 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context,
 							PK_TYPE_11B, &buf->b);
 
 	/* Get Duration and TimeStamp */
-	buf->duration_a = s_uGetDataDuration(priv, pkt_type, need_ack);
-	buf->duration_b = s_uGetDataDuration(priv, PK_TYPE_11B, need_ack);
+	if (ieee80211_is_pspoll(hdr->frame_control)) {
+		__le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15));
+
+		buf->duration_a = dur;
+		buf->duration_b = dur;
+	} else {
+		buf->duration_a = s_uGetDataDuration(priv, pkt_type, need_ack);
+		buf->duration_b = s_uGetDataDuration(priv,
+							PK_TYPE_11B, need_ack);
+	}
 
 	buf->time_stamp_off_a = vnt_time_stamp_off(priv, rate);
 	buf->time_stamp_off_b = vnt_time_stamp_off(priv,
@@ -565,11 +575,20 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context,
 		u32 frame_len, int need_ack)
 {
 	struct vnt_private *priv = tx_context->priv;
+	struct ieee80211_hdr *hdr =
+				(struct ieee80211_hdr *)tx_context->skb->data;
 
 	/* Get SignalField,ServiceField,Length */
 	vnt_get_phy_field(priv, frame_len, rate, pkt_type, &buf->ab);
+
 	/* Get Duration and TimeStampOff */
-	buf->duration = s_uGetDataDuration(priv, pkt_type, need_ack);
+	if (ieee80211_is_pspoll(hdr->frame_control)) {
+		__le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15));
+
+		buf->duration = dur;
+	} else {
+		buf->duration = s_uGetDataDuration(priv, pkt_type, need_ack);
+	}
 
 	buf->time_stamp_off = vnt_time_stamp_off(priv, rate);
 
Signature · 1 line
1.9.1
#15 lore raw

PATCH 15/17 staging: vt6656: vnt_mac_set_keyentry remove byLocalID check

In reply to Malcolm Priestley

This is now set in vnt_set_keys.

---
 drivers/staging/vt6656/mac.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/staging/vt6656/mac.c +0 -4
index b06436f..a60240c 100644
@@ -125,10 +125,6 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	struct vnt_mac_set_key set_key;
 	u16 offset;
 
-	if (priv->byLocalID <= MAC_REVISION_A1)
-		if (priv->vnt_mgmt.byCSSPK == KEY_CTL_CCMP)
-			return;
-
 	offset = MISCFIFO_KEYETRY0;
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
Signature · 1 line
1.9.1
#18 lore raw
In reply to Malcolm Priestley
Quoted 1 line · Malcolm Priestley

The patches in this series convert the driver to mac80211.

Impressive! I didn't think it was actually *possible* to convert a driver, I used to think a rewrite with selective copy/pasting would be the right approach :-)

johannes

maintainer
#19 lore raw
Quoted 6 lines · Johannes Berg
Quoted 1 line · Malcolm Priestley

The patches in this series convert the driver to mac80211.

Impressive! I didn't think it was actually *possible* to convert a driver, I used to think a rewrite with selective copy/pasting would be the right approach :-)

I agree, very nice job with all of this, great to see this happen.

greg k-h

#20 lore raw
Quoted 10 lines · Greg KH
Quoted 6 lines · Johannes Berg
Quoted 1 line · Malcolm Priestley

The patches in this series convert the driver to mac80211.

Impressive! I didn't think it was actually *possible* to convert a driver, I used to think a rewrite with selective copy/pasting would be the right approach :-)

I agree, very nice job with all of this, great to see this happen.

Thanks all,

It's taken a while to convert to driver but interesting.

Still a little more work needs doing and hopefully get this driver out of staging.

Malcolm