From dwmw2 at infradead.org  Thu Jun  1 07:43:36 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Thu, 01 Jun 2006 12:43:36 +0100
Subject: progress on the wireless driver and working together
In-Reply-To: <20060531174917.biq82rulryiscsk8@www.cozybit.com>
References: <D1575D47310FC94D902C8675241E8E3E01AF3A6C@msiexch01.marvell.com>
	<447E2987.7060907@redhat.com>
	<20060531174917.biq82rulryiscsk8@www.cozybit.com>
Message-ID: <1149162216.8593.67.camel@pmac.infradead.org>

On Wed, 2006-05-31 at 17:49 -0700, Javier Cardona wrote:
> That said, it's my first experience with a project that leaves the proprietary
> world and into the open source.  We'll need to (re)define the release/check-in
> policy (who has commit rights?  release schedule?  devel/stable branches?) and
> to set up a public bug tracking system.  Any suggestions on this?

I've added Jeff Garzik to Cc, since he's also expressed an interest in
assisting with the task of getting the driver into a state where it can
be merged. Is there any chance of getting a USB device to him?

He also asked if we have actual specifications for it, or if we (the
non-Marvell folks) are only working from the existing driver source.

We should probably set up a mailing list for this kind of discussion
instead of just using private mail. I've set up a list at
libertas-dev at lists.infradead.org; if we're agreed on the need for that,
then I'll subscribe the recipients of this mail to the list.


With respect to your questions... everyone in the group has commit
rights to the tree in /home/git/libertas-2.6.git but as I said last
night, it's probably best of we don't _use_ them. Let's let Peter and/or
Marcelo act as 'gatekeeper', put changes into our own git trees and ask
them to pull those into the main tree.

The distributed development model with git may be different to what
you're familiar with -- it allows us to have multiple repositories, and
'pull' changes from one to another. I'm not going to expand upon that
very much -- I'm sure google will find far more coherent explanations
than I could offer if I tried. The pages linked from my page at
http://www.linux-mtd.infradead.org/doc/git.html are a good start.

I'm not entirely sure we need a bug tracking system just yet -- a
mailing list for discussion would be a good enough start. Release
schedules are less of an issue with open source software too -- it's out
there all the time, and people start using it as and when it becomes
good enough for _their_ purposes. Our main concern in that respect is
that we want it working properly, and ideally merged, in time for the
OLPC deadlines.

-- 
dwmw2



From marcelo at kvack.org  Tue Jun  6 15:14:20 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Tue, 6 Jun 2006 16:14:20 -0300
Subject: Requests and questions on Libertas driver
Message-ID: <20060606191420.GA19393@dmt>

Hi folks,

Got a few comments and requests to make, with reference to our work on
merging the Libertas driver to the mainline Linux kernel.

1) At the very moment we don't have a way to test the driver
on the OLPC boards due to lack of antenna (should be fixed soon), more
details available at
http://wiki.laptop.org/index.php/Notes_on_using_the_OLPC_developer_boards

That said, I would like to ask about the availability of a person from
Marvell with the necessary environment to perform testing while we
progress on cleaning up the driver.

2) I will merge the changes from version 5.110.7 into our modified      
5.110.5 GIT SCM tree (will post a patch here soon for review, first).   

Can I request the Marvell developers to _not_ release any further
versions, or, if you do, make sure that you merge such changes first
into the GIT tree? Its clearly unproductive for us to keep track of your
work.

3) Technical question: Is there any reason for implementing your own
ioctl configuration program (wlanconfig.c) instead of using iwpriv to
handle private ioctl's? Seems you went halfway into that direction, but 
for some reason implemented your own ioctl interface directly.

/*
 * iwpriv settable callbacks
 */

static const iw_handler wlan_private_handler[] = {
        NULL,                   /* SIOCIWFIRSTPRIV */
};

Just need to fill that table with the appropriate callbacks and should be 
all set to kill wlanconfig.c in favour of iwpriv.

Thanks



From marcelo at kvack.org  Tue Jun  6 16:25:45 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Tue, 6 Jun 2006 17:25:45 -0300
Subject: User pointer dereferencing
Message-ID: <20060606202545.GA20808@dmt>

Guys,

You cannot dereference a user pointer directly, thats why
copy_from_user/copy_to_user exists. Otherwise the user could pass an
invalid pointer and boom.

This change from 5.110.5 -> 5.110.7 is broken.

diff -Nur USB-8388-LINUX26-X86-5.110.5.p0-26318.P4/src_usb8388/wlan/wlan_wext.c USB-8388-FEDORA26-X86-5.110.7.p0-26318.P7/src_usb8388/wlan/wlan_wext.c
--- USB-8388-LINUX26-X86-5.110.5.p0-26318.P4/src_usb8388/wlan/wlan_wext.c	2006-04-27 22:50:38.000000000 -0300
+++ USB-8388-FEDORA26-X86-5.110.7.p0-26318.P7/src_usb8388/wlan/wlan_wext.c	2006-06-06 15:19:30.000000000 -0300
@@ -2572,16 +2632,14 @@
 	init_waitqueue_head(&pCmdNode->cmdwait_q);
 
 	pCmdPtr = (HostCmd_DS_GEN *) pCmdNode->BufVirtualAddr;
-	if (copy_from_user(&gencmd, req->ifr_data, sizeof(gencmd))) {
-		PRINTM(INFO, "Copy from user failed\n");
-		return -EFAULT;
-	}
+	gencmd = (HostCmd_DS_GEN *) req->ifr_data;
 
 	/*
 	 * Copy the whole command into the command buffer 
 	 */
 	if (copy_from_user(pCmdPtr, req->ifr_data, gencmd->Size)) {
 		PRINTM(INFO, "Copy from user failed\n");
+		kfree(tempResponseBuffer);
 		return -EFAULT;
 	}


From marcelo at kvack.org  Tue Jun  6 17:13:26 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Tue, 6 Jun 2006 18:13:26 -0300
Subject: [PATCH] Libertas 5.110.5 -> 5.110.7 upgrade
Message-ID: <20060606211326.GA21056@dmt>


So, here they are, the changes from Marvell relative to the GIT tree.

Next step is to get rid of the thread buffering commands from the net
driver API to the hardware. This is a pretty large task (since most of
the driver is structured based on it), but will greatly simplify the
driver getting rid of a _large_ amount of deadly bugs.

-------------------------------------

Merge Libertas 5.110.7 changes.

- You can configure forwarding tables

- You can configure blinding nodes

- You can use the standalone USB 8388 device (i.e. not using click
router) and put it in power save mode while associated to an AP or
joined to an adhoc network.

Signed-off-by: Marcelo Tosatti <marcelo at kvack.org>

diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index b253305..164f8f3 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -187,7 +187,8 @@ #define HostCmd_CMD_GET_TSF             
 
 
 
-
+#define HostCmd_CMD_DFT_ACCESS                   0x0087
+#define HostCmd_RET_DFT_ACCESS                   0x8087
 
 /* For the IEEE Power Save */
 #define HostCmd_SubCmd_Enter_PS               0x0030
@@ -451,6 +452,18 @@ #define HostCmd_TYPE_CAM                
 #define HostCmd_TYPE_MAX_PSP                    0x0001
 #define HostCmd_TYPE_FAST_PSP                   0x0002
 
+/* Define action or option for HostCmd_CMD_DFT_ACCESS */
+enum HostCmd_CMD_DFT_ACCESS_OPTS {
+	HostCmd_ACT_DFT_ACCESS_ADD = 1,
+	HostCmd_ACT_DFT_ACCESS_DEL,
+	HostCmd_ACT_DFT_ACCESS_LIST,
+	HostCmd_ACT_DFT_ACCESS_RESET,
+	HostCmd_ACT_BT_ACCESS_ADD,
+	HostCmd_ACT_BT_ACCESS_DEL,
+	HostCmd_ACT_BT_ACCESS_LIST,
+	HostCmd_ACT_BT_ACCESS_RESET 
+};
+
 /** Card Event definition */
 #define MACREG_INT_CODE_TX_PPA_FREE             0x00000000
 #define MACREG_INT_CODE_TX_DMA_DONE             0x00000001
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index b89697e..2e79e11 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -883,6 +883,15 @@ struct HostCmd_DS_GET_TSF {
 	u64 TsfValue;
 } __attribute__ ((packed));
 
+/** HostCmd_CMD_DFT_ACCESS */
+struct HostCmd_DS_DFT_ACCESS
+{
+	u16	Action;
+	u32	id;
+	u8	addr1[ETH_ALEN];
+	u8	addr2[ETH_ALEN];
+} __attribute__ ((packed));
+
 /* HostCmd_DS_COMMAND*/
 struct HostCmd_DS_COMMAND {
 	/* Command Header */
@@ -944,6 +953,7 @@ struct HostCmd_DS_COMMAND {
 		struct HostCmd_DS_802_11_LED_CTRL ledgpio;
 
 		struct HostCmd_TX_RATE_QUERY txrate;
+		struct HostCmd_DS_DFT_ACCESS dft;
 		struct HostCmd_DS_GET_TSF gettsf;
 	} params;
 } __attribute__ ((packed));
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 80c03f9..6b61be4 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -74,6 +74,8 @@ static void if_usb_receive(struct urb *u
 static int if_usb_probe(struct usb_interface *intf,  
 			const struct usb_device_id *id);
 static void if_usb_disconnect(struct usb_interface *intf);
+static int if_usb_suspend(struct usb_interface *intf, pm_message_t message);
+static int if_usb_resume(struct usb_interface *intf);
 
 /** if_usb_driver */
 static struct usb_driver if_usb_driver = {
@@ -89,6 +91,9 @@ static struct usb_driver if_usb_driver =
 		/* device signature table */
 	.id_table = if_usb_table,
 
+	.suspend = if_usb_suspend,
+  
+	.resume = if_usb_resume,
 };
 
 MODULE_DEVICE_TABLE(usb, if_usb_table);
@@ -142,9 +147,11 @@ static void if_usb_write_bulk_callback(s
 		PRINTM(INFO, "Actual length transmitted %d\n", urb->actual_length);
 		priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
 	}
+
 	if (!cardp->IsFWDnld) {
 		usb_int_cause |= HIS_TxDnLdRdy;
-		if_usb_interrupt(priv, HIS_TxDnLdRdy, TX_SUCCESS);
+		if (priv->adapter->PSState != PS_STATE_SLEEP)
+			if_usb_interrupt(priv, HIS_TxDnLdRdy, TX_SUCCESS);
 	}
 
 tx_exit:		
@@ -1010,4 +1017,36 @@ inline int sbi_resume(wlan_private * pri
 }
 #endif
 
+static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct usb_card_rec	*cardp = usb_get_intfdata(intf);
+	wlan_private	*priv = cardp->priv;
+
+	ENTER();
+
+	if (priv->adapter->PSState != PS_STATE_FULL_POWER)
+		return -1;
+	netif_device_detach(cardp->eth_dev); 	
+
+	cardp->rx_urb_recall = TRUE;
+
+	LEAVE();
+	return 0;	
+}
 
+static int if_usb_resume(struct usb_interface *intf)
+{
+	struct usb_card_rec	*cardp = usb_get_intfdata(intf);
+
+	ENTER();
+
+	cardp->rx_urb_recall = FALSE;
+	if (!cardp->rx_urb_pending) {
+		if_usb_submit_rx_urb(cardp->priv);
+	}
+
+	netif_device_attach(cardp->eth_dev);
+    
+	LEAVE();
+	return 0;	
+}
diff --git a/drivers/net/wireless/libertas/include.h b/drivers/net/wireless/libertas/include.h
index c4b4d2a..bdc52b4 100644
--- a/drivers/net/wireless/libertas/include.h
+++ b/drivers/net/wireless/libertas/include.h
@@ -35,6 +35,8 @@ #define _INCLUDE_H_
 #include    "os_headers.h"
 #include    "wlan_defs.h"
 #include    "wlan_thread.h"
+#include    "radiotap.h"
+#include    <linux/kernel.h>
 #include    "wlan_types.h"
 
 #include    "wlan_11d.h"
@@ -55,5 +57,4 @@ #include    "sbi.h"
 #include    "wlan_fw.h"
 #include    "wlan_wext.h"
 #include    "wlan_decl.h"
-#include    "radiotap.h"
 #endif /* _INCLUDE_H_ */
diff --git a/drivers/net/wireless/libertas/radiotap.h b/drivers/net/wireless/libertas/radiotap.h
index 19b115e..6fd796a 100644
--- a/drivers/net/wireless/libertas/radiotap.h
+++ b/drivers/net/wireless/libertas/radiotap.h
@@ -226,5 +226,68 @@ #define	IEEE80211_RADIOTAP_F_TX_FAIL	0x0
 #define	IEEE80211_RADIOTAP_F_TX_CTS	0x0002	/* used cts 'protection' */
 #define	IEEE80211_RADIOTAP_F_TX_RTS	0x0004	/* used rts/cts handshake */
 
+struct IEEE80211_Hdr
+{
+    u16  FrameControl;
+    u16  DurationID;
+    u8  address1[6];
+    u8  address2[6];
+    u8  address3[6];
+    u16  SeqControl;
+    u8  address4[6];
+} __attribute__ ((packed));
+
+struct TxRadiotapHdr
+{
+    struct ieee80211_radiotap_header hdr;
+    u8           rate;
+    u8           txpower;
+    u8           rts_retries;
+    u8           data_retries;
+    //u8           pad[IEEE80211_RADIOTAP_HDRLEN - 12];
+} __attribute__ ((packed));
+
+#define TX_RADIOTAP_PRESENT (   \
+		(1 << IEEE80211_RADIOTAP_RATE)    | \
+		(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)  | \
+		(1 << IEEE80211_RADIOTAP_RTS_RETRIES) | \
+		(1 << IEEE80211_RADIOTAP_DATA_RETRIES)  | \
+		0)
+
+#define IEEE80211_FC_VERSION_MASK    0x0003
+#define IEEE80211_FC_TYPE_MASK       0x000c
+#define IEEE80211_FC_TYPE_MGT        0x0000
+#define IEEE80211_FC_TYPE_CTL        0x0004
+#define IEEE80211_FC_TYPE_DATA       0x0008
+#define IEEE80211_FC_SUBTYPE_MASK    0x00f0
+#define IEEE80211_FC_TOFROMDS_MASK   0x0300
+#define IEEE80211_FC_TODS_MASK       0x0100
+#define IEEE80211_FC_FROMDS_MASK     0x0200
+#define IEEE80211_FC_NODS            0x0000
+#define IEEE80211_FC_TODS            0x0100
+#define IEEE80211_FC_FROMDS          0x0200
+#define IEEE80211_FC_DSTODS          0x0300
+
+struct RxRadiotapHdr
+{
+    struct ieee80211_radiotap_header hdr;
+    u8           flags;
+    u8           rate;
+    u16          chan_freq;
+    u16          chan_flags;
+    u8           antenna;
+    u8           antsignal;
+    u16          rx_flags;
+    //u8           pad[IEEE80211_RADIOTAP_HDRLEN - 18];
+} __attribute__ ((packed));
+
+#define RX_RADIOTAP_PRESENT (   \
+		(1 << IEEE80211_RADIOTAP_FLAGS)   | \
+		(1 << IEEE80211_RADIOTAP_RATE)    | \
+		(1 << IEEE80211_RADIOTAP_CHANNEL) | \
+		(1 << IEEE80211_RADIOTAP_ANTENNA) | \
+		(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)  | \
+		(1 << IEEE80211_RADIOTAP_RX_FLAGS)  | \
+		0)
 
 #endif /* _NET_IF_IEEE80211RADIOTAP_H_ */
diff --git a/drivers/net/wireless/libertas/wlan_11d.c b/drivers/net/wireless/libertas/wlan_11d.c
index 41a0a11..236d6d0 100644
--- a/drivers/net/wireless/libertas/wlan_11d.c
+++ b/drivers/net/wireless/libertas/wlan_11d.c
@@ -422,8 +422,9 @@ int wlan_parse_domain_info_11d(
 		parsed_region_chan_11d_t * parsed_region_chan ) 
 {
 	u8 	NoOfSubband, NoOfChan;
-	u8 	lastChan, firstChan, curChan;
+	u8 	lastChan, firstChan;
 	u8	region;
+	u8	curChan = 0;
 
 	u8 	idx =0;		/*chan index in parsed_region_chan*/
 	
diff --git a/drivers/net/wireless/libertas/wlan_cmd.c b/drivers/net/wireless/libertas/wlan_cmd.c
index b05ce0d..24b1d37 100644
--- a/drivers/net/wireless/libertas/wlan_cmd.c
+++ b/drivers/net/wireless/libertas/wlan_cmd.c
@@ -1067,6 +1067,68 @@ static int wlan_cmd_802_11_eeprom_access
 
 
 
+/** 
+ *  @brief This function prepares command of DFT access.
+ *  
+ *  @param priv		A pointer to wlan_private structure
+ *  @param cmd	   	A pointer to HostCmd_DS_COMMAND structure
+ *  @param cmd_action   the action: ADD, DEL, RESET, or LIST
+ *  @param pdata_buf	A pointer to data buffer
+ *  @return 	   	WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
+ */
+static int wlan_cmd_dft_access(wlan_private * priv,
+			   struct HostCmd_DS_COMMAND * cmd,
+			   u16 cmd_action,
+			   void *pdata_buf)
+{
+	struct HostCmd_DS_DFT_ACCESS *dft_access = &cmd->params.dft;
+	PRINTM(INFO, "DFT CMD(%d)\n", cmd_action);
+
+	cmd->Command = wlan_cpu_to_le16(HostCmd_CMD_DFT_ACCESS);
+	cmd->Size = wlan_cpu_to_le16(sizeof(struct HostCmd_DS_DFT_ACCESS)
+                                 + S_DS_GEN);
+	cmd->Result 	= 0;
+	dft_access->Action = wlan_cpu_to_le16(cmd_action);
+
+	switch (cmd_action) {
+		case HostCmd_ACT_DFT_ACCESS_ADD:
+			memcpy(dft_access->addr1, pdata_buf, 2*ETH_ALEN);
+			HEXDUMP("DFT_ADD: index mac address-", 
+				dft_access->addr1, 6);
+			HEXDUMP("DFT_ADD: yield mac address-", 
+				dft_access->addr2, 6);
+			break;
+		case HostCmd_ACT_DFT_ACCESS_DEL:
+			memcpy(dft_access->addr1, pdata_buf, 1*ETH_ALEN);
+			HEXDUMP("DFT_DEL: index mac address-", 
+				dft_access->addr1, 6);
+			break;
+		case HostCmd_ACT_DFT_ACCESS_LIST:
+			dft_access->id = wlan_cpu_to_le32(*(u32 *)pdata_buf);
+			break;
+		case HostCmd_ACT_DFT_ACCESS_RESET:
+			break;
+		case HostCmd_ACT_BT_ACCESS_ADD:
+			memcpy(dft_access->addr1, pdata_buf, 2*ETH_ALEN);
+			HEXDUMP("BT_ADD: blinded mac address-", 
+				dft_access->addr1, 6);
+			break;
+		case HostCmd_ACT_BT_ACCESS_DEL:
+			memcpy(dft_access->addr1, pdata_buf, 1*ETH_ALEN);
+			HEXDUMP("BT_DEL: blinded mac address-", 
+				dft_access->addr1, 6);
+			break;
+		case HostCmd_ACT_BT_ACCESS_LIST:
+			dft_access->id = wlan_cpu_to_le32(*(u32 *)pdata_buf);
+			break;
+		case HostCmd_ACT_BT_ACCESS_RESET:
+			break;
+		default:
+			break;
+	}
+
+	return WLAN_STATUS_SUCCESS;
+}
 
 /** 
  *  @brief This function queues the command to cmd list.
@@ -1611,6 +1673,10 @@ #define ACTION_NUMLED_TLVTYPE_LEN_FIELDS
 							cmd_action, pdata_buf);
 			break;
 
+		case HostCmd_CMD_DFT_ACCESS:
+			ret = wlan_cmd_dft_access(priv, CmdPtr,
+					cmd_action, pdata_buf);
+			break;
 
 		case HostCmd_CMD_GET_TSF:
             CmdPtr->Command = wlan_cpu_to_le16(HostCmd_CMD_GET_TSF);
diff --git a/drivers/net/wireless/libertas/wlan_cmdresp.c b/drivers/net/wireless/libertas/wlan_cmdresp.c
index b68e158..94711ac 100644
--- a/drivers/net/wireless/libertas/wlan_cmdresp.c
+++ b/drivers/net/wireless/libertas/wlan_cmdresp.c
@@ -33,6 +33,7 @@ Change log:
 	04/10/06: Add hostcmd generic API
 	04/18/06: Remove old Subscrive Event and add new Subscribe Event
 		  implementation through generic hostcmd API
+	05/08/06: Remove Adapter->PermanentAddr memcpy
 ********************************************************/
 
 #include	"include.h"
@@ -281,15 +282,6 @@ static int wlan_ret_get_hw_spec(wlan_pri
 	Adapter->fwCapInfo = wlan_le32_to_cpu(hwspec->fwCapInfo);
 
 
-	/* permanent address should only be set once at start up */
-	if (Adapter->PermanentAddr[0] == 0xff) {
-		/* permanent address has not been set yet, set it */
-		memcpy(Adapter->PermanentAddr, hwspec->PermanentAddr,
-							MRVDRV_ETH_ADDR_LEN);
-	}
-
-	memcpy(priv->wlan_dev.netdev->dev_addr, hwspec->PermanentAddr,
-								ETH_ALEN);
 	Adapter->FWReleaseNumber = hwspec->FWReleaseNumber;
 
 	PRINTM(INFO, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n", Adapter->FWReleaseNumber);
@@ -321,6 +313,7 @@ static int wlan_ret_get_hw_spec(wlan_pri
 		memmove(Adapter->CurrentAddr, hwspec->PermanentAddr,
 				MRVDRV_ETH_ADDR_LEN);
 	}
+	memcpy(priv->wlan_dev.netdev->dev_addr, Adapter->CurrentAddr, ETH_ALEN);
 
 	if (wlan_set_regiontable(priv, Adapter->RegionCode, 0)) {
 			ret = WLAN_STATUS_FAILURE;
@@ -1100,6 +1093,11 @@ int wlan_process_rx_command(wlan_private
                &resp->params.gettsf.TsfValue,
                sizeof(u64));
 	    break;
+	case HostCmd_RET_DFT_ACCESS:
+	    if (Adapter->CurCmd->pdata_buf) 
+		    memcpy(Adapter->CurCmd->pdata_buf, &resp->params.dft.addr1, 
+                   	   2*ETH_ALEN);
+	    break;
 	case  HostCmd_RTE_802_11_TX_RATE_QUERY:
 	    priv->adapter->TxRate = resp->params.txrate.TxRate;
 	    break;
diff --git a/drivers/net/wireless/libertas/wlan_defs.h b/drivers/net/wireless/libertas/wlan_defs.h
index 2b4c5ed..0c1eb7e 100644
--- a/drivers/net/wireless/libertas/wlan_defs.h
+++ b/drivers/net/wireless/libertas/wlan_defs.h
@@ -223,7 +223,6 @@ #define MRVDRV_DEFAULT_MULTIPLE_DTIM		1
 
 #define MRVDRV_DEFAULT_LISTEN_INTERVAL		10
 #define MRVDRV_DEFAULT_LOCAL_LISTEN_INTERVAL		0
-#define MRVDRV_MAX_TX_POWER		      	15
 
 #define	MRVDRV_CHANNELS_PER_SCAN		4
 #define	MRVDRV_MAX_CHANNELS_PER_SCAN		14
@@ -287,7 +286,7 @@ #define MRVL_FIXED_IE_SIZE      12
 
 /* This is for firmware specific length */
 #define EXTRA_LEN	36 
-#define MRVDRV_MAXIMUM_ETH_PACKET_SIZE	1550
+#define MRVDRV_MAXIMUM_ETH_PACKET_SIZE	1514
 
 #define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE \
 	(MRVDRV_MAXIMUM_ETH_PACKET_SIZE + sizeof(struct TxPD) + EXTRA_LEN)
diff --git a/drivers/net/wireless/libertas/wlan_dev.h b/drivers/net/wireless/libertas/wlan_dev.h
index a7afce9..0f8d124 100644
--- a/drivers/net/wireless/libertas/wlan_dev.h
+++ b/drivers/net/wireless/libertas/wlan_dev.h
@@ -26,6 +26,7 @@ Change log:
 	01/11/06: Conditionalize new scan/join structures.
 	04/18/06: Remove old Subscrive Event and add new Subscribe Event
 		  implementation through generic hostcmd API
+	05/08/06: Remove PermanentAddr from Adapter
 
  ************************************************************/
 
@@ -266,7 +267,6 @@ #endif /* REASSOCIATION */
 	u8			ATIMEnabled;
 
 	/** MAC address information */
-	u8 			PermanentAddr[MRVDRV_ETH_ADDR_LEN];
 	u8 			CurrentAddr[MRVDRV_ETH_ADDR_LEN];
 	u8 			MulticastList[MRVDRV_MAX_MULTICAST_LIST_SIZE]
 						[MRVDRV_ETH_ADDR_LEN];
diff --git a/drivers/net/wireless/libertas/wlan_fw.c b/drivers/net/wireless/libertas/wlan_fw.c
index da872b9..53e4794 100644
--- a/drivers/net/wireless/libertas/wlan_fw.c
+++ b/drivers/net/wireless/libertas/wlan_fw.c
@@ -25,6 +25,7 @@ Change log:
 	01/11/06: Conditionalize new scan/join functions.
 	          Cleanup association response handler initialization.
 	01/06/05: Add FW file read
+	05/08/06: Remove the 2nd GET_HW_SPEC command and TempAddr/PermanentAddr
 
 ********************************************************/
 
@@ -68,17 +69,16 @@ static int wlan_setup_station_hw(wlan_pr
 {
 	int 		ret = WLAN_STATUS_SUCCESS;
 	wlan_adapter   *adapter = priv->adapter;
-	u16		dbm = MRVDRV_MAX_TX_POWER;
- 	u8           TempAddr[MRVDRV_ETH_ADDR_LEN];
-	
 
     	ENTER();
     
 	sbi_disable_host_int(priv);
 
 
-	if ((ret=request_firmware(&priv->firmware, fw_name, priv->hotplug_device)) < 0) {
-		PRINTM(FATAL, "request_firmware() failed, error code = %#x\n", ret);
+	if ((ret=request_firmware(&priv->firmware, fw_name,
+					priv->hotplug_device)) < 0) {
+		PRINTM(MSG, "request_firmware() failed, error code = %#x\n", ret);
+		PRINTM(MSG, "%s not found in /lib/firmware\n", fw_name);
 		goto done;
 	}
 
@@ -108,16 +108,8 @@ #define RF_REG_VALUE  0xc8
 
 	/*
 	 * Read MAC address from HW
-	 * permanent address is not read first before it gets set if
-	 * NetworkAddress entry exists in the registry, so need to read it
-	 * first
-	 * 
-	 * use permanentaddr as temp variable to store currentaddr if
-	 * NetworkAddress entry exists
 	 */
-	memmove(TempAddr, adapter->CurrentAddr, MRVDRV_ETH_ADDR_LEN);
 	memset(adapter->CurrentAddr, 0xff, MRVDRV_ETH_ADDR_LEN);
-	memset(adapter->PermanentAddr, 0xff, MRVDRV_ETH_ADDR_LEN);
 
 	ret = PrepareAndSendCommand(priv, HostCmd_CMD_GET_HW_SPEC, 
 			0, HostCmd_OPTION_WAITFORRSP,
@@ -128,38 +120,9 @@ #define RF_REG_VALUE  0xc8
 		goto done;
 	}
 
-	if (TempAddr[0] != 0xff) {
-		/*
-		 * an address was read, so need to send GET_HW_SPEC again to
-		 * set the soft mac
-		 */
-
-		memmove(adapter->CurrentAddr, TempAddr, MRVDRV_ETH_ADDR_LEN);
-
-		ret = PrepareAndSendCommand(priv, HostCmd_CMD_GET_HW_SPEC,
-			0, HostCmd_OPTION_WAITFORRSP,
-			0, NULL);
-
-		if (ret) {
-			ret = WLAN_STATUS_FAILURE;
-			goto done;
-		}
-	}
-
 	SetMacPacketFilter(priv);
 
 
-	/* set the max tx power */
-	ret = PrepareAndSendCommand(priv, HostCmd_CMD_802_11_RF_TX_POWER,
-		HostCmd_ACT_TX_POWER_OPT_SET_LOW,
-		HostCmd_OPTION_WAITFORRSP, 0,
-		&dbm);
-
-	if (ret) {
-		ret = WLAN_STATUS_FAILURE;
-		goto done;
-	}
-
 
 	/* Get the supported Data Rates */
 	ret = PrepareAndSendCommand(priv, HostCmd_CMD_802_11_DATA_RATE,
@@ -344,9 +307,6 @@ #define SHORT_PREAMBLE_ALLOWED		1
 
 	Adapter->EncryptionStatus = Wlan802_11WEPDisabled;
 
-	priv->adapter->linkmode = WLAN_LINKMODE_802_11;
-	priv->adapter->radiomode = WLAN_RADIOMODE_RADIOTAP;
-	
 	spin_lock_init(&Adapter->CurrentTxLock);
 
 	Adapter->CurrentTxSkb = NULL;
diff --git a/drivers/net/wireless/libertas/wlan_join.c b/drivers/net/wireless/libertas/wlan_join.c
index 02feb05..f20c8b8 100644
--- a/drivers/net/wireless/libertas/wlan_join.c
+++ b/drivers/net/wireless/libertas/wlan_join.c
@@ -1564,6 +1564,7 @@ int wlan_reassociation_thread(void *data
 
         OS_SET_THREAD_STATE(TASK_RUNNING);
         remove_wait_queue(&thread->waitQ, &wait);
+        try_to_freeze();
 
         if (Adapter->SurpriseRemoved) {
             break;
diff --git a/drivers/net/wireless/libertas/wlan_main.c b/drivers/net/wireless/libertas/wlan_main.c
index fbf7c56..97e0466 100644
--- a/drivers/net/wireless/libertas/wlan_main.c
+++ b/drivers/net/wireless/libertas/wlan_main.c
@@ -254,13 +254,11 @@ static int wlan_open(struct net_device *
 		}
 	}
 	
-	memcpy(dev->dev_addr, adapter->PermanentAddr, ETH_ALEN);
-	
 	MODULE_GET;
 
 	priv->open = TRUE;
 
-	if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected)
+	if (adapter->MediaConnectStatus == WlanMediaStateConnected)
 		os_carrier_on(priv);
 	else
 		os_carrier_off(priv);
@@ -695,6 +693,7 @@ static int wlan_service_main_thread(void
 
 		OS_SET_THREAD_STATE(TASK_RUNNING);
 		remove_wait_queue(&thread->waitQ, &wait);
+		try_to_freeze();
 
 		PRINTM(INFO, "main-thread 333: IntCounter=%d CurrentTxSkb=%p "
 				"dnld_sent=%d\n",
@@ -868,7 +867,6 @@ static wlan_private *wlan_add_card(void 
 
 #define	WLAN_WATCHDOG_TIMEOUT	(2 * HZ)
 
-	dev->mtu = MRVDRV_MAXIMUM_ETH_PACKET_SIZE;	
 	dev->tx_timeout = wlan_tx_timeout;
 	dev->get_stats = wlan_get_stats;
 	dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT;
diff --git a/drivers/net/wireless/libertas/wlan_rx.c b/drivers/net/wireless/libertas/wlan_rx.c
index 9878c7e..5238c0d 100644
--- a/drivers/net/wireless/libertas/wlan_rx.c
+++ b/drivers/net/wireless/libertas/wlan_rx.c
@@ -59,41 +59,11 @@ typedef struct
 
 typedef struct
 {
-    u8  dest_addr[6];
-    u8  src_addr[6];
-    u16 ethertype;
-
-} __attribute__ ((packed)) EthII_Hdr_t; 
-
-typedef struct
-{
     struct RxPD         rx_pd;
     void*        eth80211_hdr;
 
 } __attribute__ ((packed)) Rx80211PacketHdr_t;
 
-typedef struct
-{
-    struct ieee80211_radiotap_header hdr;
-    u8           flags;
-    u8           rate;
-    u16          chan_freq;
-    u16          chan_flags;
-    u8           antenna;
-    u8           antsignal;
-    u16          rx_flags;
-    //u8           pad[IEEE80211_RADIOTAP_HDRLEN - 18];
-} __attribute__ ((packed)) RxRadiotapHdr_t;
-
-#define RX_RADIOTAP_PRESENT (   \
-		(1 << IEEE80211_RADIOTAP_FLAGS)   | \
-		(1 << IEEE80211_RADIOTAP_RATE)    | \
-		(1 << IEEE80211_RADIOTAP_CHANNEL) | \
-		(1 << IEEE80211_RADIOTAP_ANTENNA) | \
-		(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)  | \
-		(1 << IEEE80211_RADIOTAP_RX_FLAGS)  | \
-		0)
-
 /********************************************************
 		Global Variables
 ********************************************************/
@@ -224,7 +194,7 @@ int ProcessRxedPacket(wlan_private *priv
 	struct RxPD*   pRxPD;
 
 	int            hdrChop;
-	EthII_Hdr_t*   pEthHdr;
+	struct EthII_Hdr*   pEthHdr;
 
 	
 	const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
@@ -282,7 +252,7 @@ int ProcessRxedPacket(wlan_private *priv
          *  To create the Ethernet II, just move the src, dst address right
          *    before the snap_type.
          */
-        pEthHdr = (EthII_Hdr_t*)
+        pEthHdr = (struct EthII_Hdr*)
             ((u8*)&pRxPkt->eth803_hdr
              + sizeof(pRxPkt->eth803_hdr) + sizeof(pRxPkt->rfc1042_hdr)
              - sizeof(pRxPkt->eth803_hdr.dest_addr)
@@ -379,8 +349,8 @@ int ProcessRxed_802_11_Packet(wlan_priva
 
 	Rx80211PacketHdr_t* pRxPkt;
 	struct RxPD*          pRxPD;
-	RxRadiotapHdr_t radiotap_hdr;
-	RxRadiotapHdr_t *pradiotap_hdr;
+	struct RxRadiotapHdr radiotap_hdr;
+	struct RxRadiotapHdr *pradiotap_hdr;
 
 	ENTER();
 
@@ -420,7 +390,7 @@ int ProcessRxed_802_11_Packet(wlan_priva
 			radiotap_hdr.hdr.it_version = 0;
 			/* XXX must check this value for pad */
 			radiotap_hdr.hdr.it_pad = 0;
-			radiotap_hdr.hdr.it_len = sizeof(RxRadiotapHdr_t);
+			radiotap_hdr.hdr.it_len = sizeof(struct RxRadiotapHdr);
 			radiotap_hdr.hdr.it_present = RX_RADIOTAP_PRESENT;
 			/* unknown values */
 			radiotap_hdr.flags = 0;
@@ -442,14 +412,14 @@ int ProcessRxed_802_11_Packet(wlan_priva
 			skb_pull(skb, sizeof(struct RxPD));
 
 			/* add space for the new radio header */
-			if ( (skb_headroom(skb) < sizeof(RxRadiotapHdr_t)) &&
-					pskb_expand_head(skb, sizeof(RxRadiotapHdr_t), 0, GFP_ATOMIC)) {
+			if ( (skb_headroom(skb) < sizeof(struct RxRadiotapHdr)) &&
+					pskb_expand_head(skb, sizeof(struct RxRadiotapHdr), 0, GFP_ATOMIC)) {
 				PRINTM(MSG, "%s: couldn't pskb_expand_head\n", __func__);
 			}
 
 
-			pradiotap_hdr = (RxRadiotapHdr_t *) skb_push(skb, sizeof(RxRadiotapHdr_t));
-			memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(RxRadiotapHdr_t));
+			pradiotap_hdr = (struct RxRadiotapHdr *) skb_push(skb, sizeof(struct RxRadiotapHdr));
+			memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct RxRadiotapHdr));
 			//HEXDUMP1("RX radiomode packet AFT: ", skb->data, MIN(skb->len, 100));
 			break;
 
diff --git a/drivers/net/wireless/libertas/wlan_tx.c b/drivers/net/wireless/libertas/wlan_tx.c
index d649933..5423ebe 100644
--- a/drivers/net/wireless/libertas/wlan_tx.c
+++ b/drivers/net/wireless/libertas/wlan_tx.c
@@ -29,65 +29,6 @@ Change log:
 #include	"include.h"
 
 /********************************************************
-		Local Variables
-********************************************************/
-
-typedef struct
-{
-    struct ieee80211_radiotap_header hdr;
-    u8           rate;
-    u8           txpower;
-    u8           rts_retries;
-    u8           data_retries;
-    //u8           pad[IEEE80211_RADIOTAP_HDRLEN - 12];
-} __attribute__ ((packed)) TxRadiotapHdr_t;
-
-#define TX_RADIOTAP_PRESENT (   \
-		(1 << IEEE80211_RADIOTAP_RATE)    | \
-		(1 << IEEE80211_RADIOTAP_DBM_TX_POWER)  | \
-		(1 << IEEE80211_RADIOTAP_RTS_RETRIES) | \
-		(1 << IEEE80211_RADIOTAP_DATA_RETRIES)  | \
-		0)
-
-typedef struct
-{
-    u8  dest_addr[6];
-    u8  src_addr[6];
-    u16 ethertype;
-
-} __attribute__ ((packed)) EthII_Hdr_t;
-
-#define IEEE80211_FC_VERSION_MASK    0x0003
-#define IEEE80211_FC_TYPE_MASK       0x000c
-#define IEEE80211_FC_TYPE_MGT        0x0000
-#define IEEE80211_FC_TYPE_CTL        0x0004
-#define IEEE80211_FC_TYPE_DATA       0x0008
-#define IEEE80211_FC_SUBTYPE_MASK    0x00f0
-#define IEEE80211_FC_TOFROMDS_MASK   0x0300
-#define IEEE80211_FC_TODS_MASK       0x0100
-#define IEEE80211_FC_FROMDS_MASK     0x0200
-#define IEEE80211_FC_NODS            0x0000
-#define IEEE80211_FC_TODS            0x0100
-#define IEEE80211_FC_FROMDS          0x0200
-#define IEEE80211_FC_DSTODS          0x0300
-typedef struct
-{
-    u16  FrameControl;
-    u16  DurationID;
-    u8  address1[6];
-    u8  address2[6];
-    u8  address3[6];
-    u16  SeqControl;
-    u8  address4[6];
-
-} __attribute__ ((packed)) IEEE80211_Hdr_t;
-
-
-/********************************************************
-		Global Variables
-********************************************************/
-
-/********************************************************
 		Local Functions
 ********************************************************/
 
@@ -132,7 +73,7 @@ static int SendSinglePacket(wlan_private
 	struct TxPD	LocalTxPD;
 	struct TxPD	*pLocalTxPD = &LocalTxPD;
 	u8		*p802x_hdr;
-	TxRadiotapHdr_t *pradiotap_hdr;
+	struct TxRadiotapHdr *pradiotap_hdr;
 	u32 new_rate;
 	u8		*ptr = priv->adapter->TmpTxBuf;
 
@@ -170,7 +111,7 @@ static int SendSinglePacket(wlan_private
 		if ( priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP ) {
 
 			/* locate radiotap header */
-			pradiotap_hdr = (TxRadiotapHdr_t*)skb->data;
+			pradiotap_hdr = (struct TxRadiotapHdr*)skb->data;
 		
 			/* set TxPD fields from the radiotap header */
 			new_rate = convert_radiotap_rate_to_mv(
@@ -183,8 +124,8 @@ static int SendSinglePacket(wlan_private
 			}
 
 			/* skip the radiotap header */
-			p802x_hdr += sizeof(TxRadiotapHdr_t);
-			pLocalTxPD->TxPacketLength -= sizeof(TxRadiotapHdr_t);	
+			p802x_hdr += sizeof(struct TxRadiotapHdr);
+			pLocalTxPD->TxPacketLength -= sizeof(struct TxRadiotapHdr);	
 
 		}
 		/* copy destination address from 802.3 or 802.11 header */
@@ -392,7 +333,7 @@ done:	
 void SendTxFeedback(wlan_private *priv)
 {
 	wlan_adapter 	*Adapter = priv->adapter;
-	TxRadiotapHdr_t *radiotap_hdr; 	
+	struct TxRadiotapHdr *radiotap_hdr; 	
 	u32 		status = Adapter->EventCause;
 	int txfail;
 	int try_count;
@@ -402,7 +343,7 @@ void SendTxFeedback(wlan_private *priv)
 	    Adapter->CurrentTxSkb == NULL)
 		return;
 
-	radiotap_hdr = (TxRadiotapHdr_t*) Adapter->CurrentTxSkb->data;
+	radiotap_hdr = (struct TxRadiotapHdr*) Adapter->CurrentTxSkb->data;
 
 	if ((Adapter->debugmode & MRVDRV_DEBUG_TX_PATH) != 0 )
 		HEXDUMP("TX feedback: ", (u8 *) radiotap_hdr, 
diff --git a/drivers/net/wireless/libertas/wlan_types.h b/drivers/net/wireless/libertas/wlan_types.h
index 17c4206..6410610 100644
--- a/drivers/net/wireless/libertas/wlan_types.h
+++ b/drivers/net/wireless/libertas/wlan_types.h
@@ -347,5 +347,12 @@ typedef struct 	_MrvlIEtypes_LedGpio_t {
 } __attribute__ ((packed)) MrvlIEtypes_LedGpio_t;
 
 
+struct EthII_Hdr
+{
+    u8  dest_addr[6];
+    u8  src_addr[6];
+    u16 ethertype;
+} __attribute__ ((packed));
+
 #endif /* _WLAN_TYPES_ */
 
diff --git a/drivers/net/wireless/libertas/wlan_version.h b/drivers/net/wireless/libertas/wlan_version.h
index 94282f8..8eb8d01 100644
--- a/drivers/net/wireless/libertas/wlan_version.h
+++ b/drivers/net/wireless/libertas/wlan_version.h
@@ -31,9 +31,6 @@ #define FPNUM "14"
 
 const char driver_version[]  = 
 	"COMM-USB8388-%s-" DRIVER_RELEASE_VERSION
-	"-("
-	"FP" FPNUM
-	")"
 #ifdef	DEBUG_LEVEL2
 	"-dbg"
 #endif
diff --git a/drivers/net/wireless/libertas/wlan_wext.c b/drivers/net/wireless/libertas/wlan_wext.c
index 7897045..bd6db30 100644
--- a/drivers/net/wireless/libertas/wlan_wext.c
+++ b/drivers/net/wireless/libertas/wlan_wext.c
@@ -88,6 +88,17 @@ static int wlan_set_txpow(struct net_dev
 static int wlan_get_txpow(struct net_device *dev, struct iw_request_info *info,
                           struct iw_param *vwrq, char *extra);
 
+/* DFT function declaration */
+static int wlan_dft_add_ioctl(wlan_private *priv, struct ifreq *req);
+static int wlan_dft_del_ioctl(wlan_private *priv, struct ifreq *req);
+static int wlan_dft_reset_ioctl(wlan_private *priv);
+static int wlan_dft_list_ioctl(wlan_private *priv, struct ifreq *req);
+
+/* BT function declaration */
+static int wlan_bt_add_ioctl(wlan_private *priv, struct ifreq *req);
+static int wlan_bt_del_ioctl(wlan_private *priv, struct ifreq *req);
+static int wlan_bt_reset_ioctl(wlan_private *priv);
+static int wlan_bt_list_ioctl(wlan_private *priv, struct ifreq *req);
 
 
 /** 
@@ -2203,22 +2214,22 @@ static const struct iw_priv_args wlan_pr
 	"setdataavg"
 	},
 	{
-		WLAN_SET_LINKMODE,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
-		IW_PRIV_TYPE_NONE,
-		"linkmode"
+	WLAN_SET_LINKMODE,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
+	IW_PRIV_TYPE_NONE,
+	"linkmode"
 	},
 	{
-		WLAN_SET_RADIOMODE,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
-		IW_PRIV_TYPE_NONE,
-		"radiomode"
+	WLAN_SET_RADIOMODE,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
+	IW_PRIV_TYPE_NONE,
+	"radiomode"
 	},
 	{
-		WLAN_SET_DEBUGMODE,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
-		IW_PRIV_TYPE_NONE,
-		"debugmode"
+	WLAN_SET_DEBUGMODE,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
+	IW_PRIV_TYPE_NONE,
+	"debugmode"
 	},
 	{ 
 	WLAN_SETNONE_GETONEINT, 
@@ -2257,22 +2268,22 @@ static const struct iw_priv_args wlan_pr
 	"getbcnavg"
 	},
 	{
-		WLAN_GET_LINKMODE,
-		IW_PRIV_TYPE_NONE,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
-		"get_linkmode"
+	WLAN_GET_LINKMODE,
+	IW_PRIV_TYPE_NONE,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
+	"get_linkmode"
 	},
 	{
-		WLAN_GET_RADIOMODE,
-		IW_PRIV_TYPE_NONE,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
-		"get_radiomode"
+	WLAN_GET_RADIOMODE,
+	IW_PRIV_TYPE_NONE,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
+	"get_radiomode"
 	},
 	{
-		WLAN_GET_DEBUGMODE,
-		IW_PRIV_TYPE_NONE,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
-		"get_debugmode"
+	WLAN_GET_DEBUGMODE,
+	IW_PRIV_TYPE_NONE,
+	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 
+	"get_debugmode"
 	},
 	{ 
 	WLAN_SETNONE_GETTWELVE_CHAR,
@@ -2355,6 +2366,18 @@ #endif /* REASSOCIATION */
 	"wlanidle-off"
 	},
 	{
+	WLAN_SUBCMD_DFT_RESET,
+	IW_PRIV_TYPE_NONE,
+	IW_PRIV_TYPE_NONE,
+	"dft_reset"
+	},
+	{
+	WLAN_SUBCMD_BT_RESET,
+	IW_PRIV_TYPE_NONE,
+	IW_PRIV_TYPE_NONE,
+	"bt_reset"
+	},
+	{
 	WLAN_SET64CHAR_GET64CHAR,
 	IW_PRIV_TYPE_CHAR | 64,
 	IW_PRIV_TYPE_CHAR | 64,
@@ -2367,6 +2390,44 @@ #endif /* REASSOCIATION */
 	"sleepparams"
 	},
 
+	/* DFT Management */
+	{
+	WLAN_SUBCMD_DFT_ADD,
+	IW_PRIV_TYPE_CHAR | 64, 
+	IW_PRIV_TYPE_CHAR | 64, 
+	"dft_add"
+	},
+	{
+	WLAN_SUBCMD_DFT_DEL,
+	IW_PRIV_TYPE_CHAR | 64, 
+	IW_PRIV_TYPE_CHAR | 64, 
+	"dft_del"
+	},
+	{
+	WLAN_SUBCMD_DFT_LIST,
+	IW_PRIV_TYPE_CHAR | 64, 
+	IW_PRIV_TYPE_CHAR | 64, 
+	"dft_list"
+	},
+	/* BT Management */
+	{
+	WLAN_SUBCMD_BT_ADD,
+	IW_PRIV_TYPE_CHAR | 64, 
+	IW_PRIV_TYPE_CHAR | 64, 
+	"bt_add"
+	},
+	{
+	WLAN_SUBCMD_BT_DEL,
+	IW_PRIV_TYPE_CHAR | 64, 
+	IW_PRIV_TYPE_CHAR | 64, 
+	"bt_del"
+	},
+	{
+	WLAN_SUBCMD_BT_LIST,
+	IW_PRIV_TYPE_CHAR | 64, 
+	IW_PRIV_TYPE_CHAR | 64, 
+	"bt_list"
+	},
 	{
 	WLANSCAN_MODE,
 	IW_PRIV_TYPE_CHAR | 64,
@@ -2521,7 +2582,6 @@ #endif /* REASSOCIATION */
 		"getscantable"
 	},
 
-
 };
 
 struct iw_handler_def wlan_handler_def = {
@@ -2574,6 +2634,7 @@ static int wlan_hostcmd_ioctl(struct net
 	pCmdPtr = (struct HostCmd_DS_GEN *) pCmdNode->BufVirtualAddr;
 	if (copy_from_user(&gencmd, req->ifr_data, sizeof(gencmd))) {
 		PRINTM(INFO, "Copy from user failed\n");
+		kfree(tempResponseBuffer);
 		return -EFAULT;
 	}
 
@@ -2582,6 +2643,7 @@ static int wlan_hostcmd_ioctl(struct net
 	 */
 	if (copy_from_user(pCmdPtr, req->ifr_data, gencmd->Size)) {
 		PRINTM(INFO, "Copy from user failed\n");
+		kfree(tempResponseBuffer);
 		return -EFAULT;
 	}
 
@@ -3369,6 +3431,21 @@ static int wlan_setencryptionmode_ioctl(
 	return WLAN_STATUS_SUCCESS;
 }
 
+static void adjust_mtu(wlan_private *priv)
+{
+	int mtu_increment = 0;
+
+	if (priv->adapter->linkmode == WLAN_LINKMODE_802_11)
+		mtu_increment += sizeof(struct IEEE80211_Hdr);
+
+	if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP)
+		mtu_increment += max(sizeof(struct TxRadiotapHdr),
+				     sizeof(struct RxRadiotapHdr));
+	priv->wlan_dev.netdev->mtu = MRVDRV_MAXIMUM_ETH_PACKET_SIZE 
+			              - sizeof(struct EthII_Hdr)
+	 			      + mtu_increment; 
+}
+
 /** 
  *  @brief Set Link-Layer Layer mode
  *  @param priv                 A pointer to wlan_private structure
@@ -3384,20 +3461,20 @@ static int wlan_set_linkmode_ioctl(wlan_
 	mode = (int) ((struct ifreq *)((u8 *)req + 4))->ifr_data;
 
 	switch (mode) {
-		case 0:
-			// mode: normal (802.3)
+		case WLAN_LINKMODE_802_3:
 			priv->adapter->linkmode = mode;
 			break;
-		case 2:
-			// mode: monitor (802.11)
+		case WLAN_LINKMODE_802_11:
 			priv->adapter->linkmode = mode;
 			break;
 		default:
-			printk(KERN_ALERT "usb8388-5: invalid link-layer mode (%#x)\n", mode);
+			PRINTM(FATAL, "usb8388-5: invalid link-layer mode (%#x)\n", mode);
 			return WLAN_STATUS_NOT_ACCEPTED;
 			break;
 	}
-	printk(KERN_ALERT "usb8388-5: link-layer mode is %#x\n", mode);
+	PRINTM(INFO, "usb8388-5: link-layer mode is %#x\n", mode);
+
+	adjust_mtu(priv);
 
 	LEAVE();
 	return WLAN_STATUS_SUCCESS;
@@ -3418,24 +3495,20 @@ static int wlan_set_radiomode_ioctl(wlan
 	mode = (int) ((struct ifreq *)((u8 *)req + 4))->ifr_data;
 
 	switch (mode) {
-		case 0:
-			// mode: no radioheader
+		case WLAN_RADIOMODE_NONE:
 			priv->adapter->radiomode = mode;
 			break;
-		case 1:
-			// mode: prism
-			printk(KERN_ALERT "usb8388-5: prism radio header still unsupported\n");
-			break;
-		case 2:
-			// mode: radiotap
+		case WLAN_RADIOMODE_RADIOTAP:
 			priv->adapter->radiomode = mode;
 			break;
 		default:
-			printk(KERN_ALERT "usb8388-5: invalid radio header mode (%#x)\n", mode);
+			PRINTM(INFO, "usb8388-5: invalid radio header mode (%#x)\n", mode);
 			return WLAN_STATUS_NOT_ACCEPTED;
 			break;
 	}
-	printk(KERN_ALERT "usb8388-5: radio-header mode is %#x\n", mode);
+	PRINTM(INFO, "usb8388-5: radio-header mode is %#x\n", mode);
+
+	adjust_mtu(priv);
 
 	LEAVE();
 	return WLAN_STATUS_SUCCESS;
@@ -4106,6 +4179,12 @@ #endif /* REASSOCIATION */
 		case WLANWLANIDLEOFF:
 			wlanidle_off(priv);
 			break;
+		case WLAN_SUBCMD_DFT_RESET:	/* dft_reset */
+			wlan_dft_reset_ioctl(priv);
+			break;
+		case WLAN_SUBCMD_BT_RESET:	/* bt_reset */
+			wlan_bt_reset_ioctl(priv);
+			break;
 		}	/* End of switch */
 		break;
 
@@ -4278,7 +4357,6 @@ #define MAX_U16_VAL	65535
 		
 		break;
 
-
 	case WLAN_SETNONE_GETTWELVE_CHAR: /* Get Antenna settings */
 		/* 
 		 * We've not used IW_PRIV_TYPE_FIXED so sub-ioctl number is
@@ -4318,6 +4396,24 @@ #define MAX_U16_VAL	65535
 		case WLAN_GET_ADHOC_STATUS:
 			ret = wlan_get_adhoc_status_ioctl(priv, wrq);
 			break;
+		case WLAN_SUBCMD_DFT_ADD:
+			ret = wlan_dft_add_ioctl(priv, req);
+			break;
+		case WLAN_SUBCMD_DFT_DEL: 
+			ret = wlan_dft_del_ioctl(priv, req);
+			break;
+		case WLAN_SUBCMD_DFT_LIST: 
+			ret = wlan_dft_list_ioctl(priv, req);
+			break;
+		case WLAN_SUBCMD_BT_ADD:
+			ret = wlan_bt_add_ioctl(priv, req);
+			break;
+		case WLAN_SUBCMD_BT_DEL: 
+			ret = wlan_bt_del_ioctl(priv, req);
+			break;
+		case WLAN_SUBCMD_BT_LIST: 
+			ret = wlan_bt_list_ioctl(priv, req);
+			break;
 		}
 		break;
 
@@ -5184,4 +5280,366 @@ void get_version(wlan_adapter *adapter, 
 	snprintf(version, maxlen, driver_version, fwver);
 }
 
+static inline int hex2int(char c)
+{
+	if (c >= '0' && c <= '9')
+		return (c - '0');
+	if (c >= 'a' && c <= 'f')
+		return (c - 'a' + 10);
+	if (c >= 'A' && c <= 'F')
+		return (c - 'A' + 10);
+	return -1;
+}
+
+/* Convert a string representation of a MAC address ("xx:xx:xx:xx:xx:xx")
+   into binary format (6 bytes).
+
+   This function expects that each byte is represented with 2 characters
+   (e.g., 11:2:11:11:11:11 is invalid) 
+
+ */
+static char *eth_str2addr(char *ethstr, u8 *addr)
+{
+	int i, val, val2;
+	char *pos = ethstr;
+
+	/* get rid of initial blanks */
+	while (*pos == ' ' || *pos == '\t') ++pos;
+
+	for (i = 0; i < 6; i++) {
+		val = hex2int(*pos++);
+		if (val < 0)
+			return NULL;
+		val2 = hex2int(*pos++);
+		if (val2 < 0)
+			return NULL;
+		addr[i] = (val * 16 + val2) & 0xff;
+
+		if (i < 5 && *pos++ != ':')
+			return NULL;
+	}
+	return pos;
+}
+
+/* this writes xx:xx:xx:xx:xx:xx into ethstr 
+   (ethstr must have space for 18 chars) */
+static int eth_addr2str(u8 *addr, char *ethstr)
+{
+	int i;
+	char *pos = ethstr;
+
+	for (i = 0; i < 6; i++) {
+		sprintf (pos, "%02x", addr[i] & 0xff);
+		pos += 2;
+		if (i < 5 )
+			*pos++ = ':';
+	}
+	return 17;
+}
+
+/** 
+ *  @brief          Add an entry to the DFT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_dft_add_ioctl(wlan_private *priv, struct ifreq *req)
+{
+	struct iwreq *wrq = (struct iwreq *) req;
+	char ethaddrs_str[36];
+	char *pos;
+	u8 ethaddrs[2*ETH_ALEN];
+#define ethaddr1 (ethaddrs+0)
+#define ethaddr2 (ethaddrs+6)
+
+	ENTER();
+	if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
+			   sizeof(ethaddrs_str)))
+		return -EFAULT;
+
+	if ((pos = eth_str2addr(ethaddrs_str, ethaddr1)) == NULL) {
+		PRINTM(FATAL, "DFT_ADD: Invalid MAC address 1\n");
+		return -EINVAL;
+	}
+
+	if (eth_str2addr(pos, ethaddr2) == NULL) {
+		PRINTM(FATAL, "DFT_ADD: Invalid MAC address 2\n");
+		return -EINVAL;
+	}
+
+#ifdef DEBUG_LEVEL4
+	{
+	char ethaddr1_str[18], ethaddr2_str[18];
+	PRINTM(INFO, "DFT: adding %s\n", ethaddrs_str);
+	eth_addr2str(ethaddr1, ethaddr1_str);
+	eth_addr2str(ethaddr2, ethaddr2_str);
+	PRINTM(INFO, "DFT: adding (%s,%s)\n", ethaddr1_str, ethaddr2_str);
+	}
+#endif
+
+	LEAVE();
+	return (PrepareAndSendCommand(priv, HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_DFT_ACCESS_ADD,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			ethaddrs));
+}
+
+/** 
+ *  @brief          Delete an entry from the DFT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_dft_del_ioctl(wlan_private *priv, struct ifreq *req)
+{
+	struct iwreq *wrq = (struct iwreq *) req;
+	char ethaddrs_str[18];
+	u8 ethaddr[ETH_ALEN];
+	char *pos;
+
+	ENTER();
+	if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
+			   sizeof(ethaddrs_str)))
+		return -EFAULT;
+
+	if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
+		PRINTM(FATAL, "Invalid MAC address\n");
+		return -EINVAL;
+	}
+
+	PRINTM(INFO, "DFT: deleting %s\n", ethaddrs_str);
+
+	LEAVE();
+	return (PrepareAndSendCommand(priv, 
+			HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_DFT_ACCESS_DEL,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			ethaddr));
+}
+
+/** 
+ *  @brief          Reset all entries from the DFT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_dft_reset_ioctl(wlan_private *priv)
+{
+	ENTER();
+
+	PRINTM(MSG, "DFT: resetting\n");
+
+	LEAVE();
+	return (PrepareAndSendCommand(priv, 
+			HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_DFT_ACCESS_RESET,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			NULL));
+}
+
+/** 
+ *  @brief          List an entry from the DFT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_dft_list_ioctl(wlan_private *priv, struct ifreq *req)
+{
+	int pos;
+	char *addr1, *addr2;
+	struct iwreq *wrq = (struct iwreq *) req;
+	/* used to pass id and store the dft entry returned by the FW */
+	union {
+		int id;
+		char addr1addr2[2 * ETH_ALEN];
+	} param;
+	static char outstr[64];
+	char *pbuf = outstr;
+	int ret;
+
+	ENTER();
+
+	if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
+		PRINTM(INFO, "Copy from user failed\n");
+		return WLAN_STATUS_FAILURE;
+	}
+	param.id = simple_strtoul(outstr, NULL, 10);	
+	pos = sprintf(pbuf, "%d: ", param.id);
+	pbuf += pos;
+
+	ret = PrepareAndSendCommand(priv, HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_DFT_ACCESS_LIST,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			(char *) &param);
+
+	if (ret == WLAN_STATUS_SUCCESS) {
+		addr1 = param.addr1addr2;
+		addr2 = param.addr1addr2+ ETH_ALEN;
+		
+		pos = sprintf(pbuf, "da ");
+		pbuf += pos;
+		pos = eth_addr2str(addr1, pbuf);		
+		pbuf += pos;		
+		pos = sprintf(pbuf, "    next hop ");
+		pbuf += pos;		
+		pos = eth_addr2str(addr2, pbuf);		
+		pbuf += pos;		
+	} else {
+		sprintf(pbuf, "(null)");
+		pbuf += pos;
+	}
+	wrq->u.data.length = strlen(outstr);
+	if (copy_to_user(wrq->u.data.pointer, (char *) outstr, 
+			 wrq->u.data.length)) {
+		PRINTM(INFO, "DFT_LIST: Copy to user failed!\n");
+		return -EFAULT;
+	}
+
+	LEAVE();
+	return WLAN_STATUS_SUCCESS;
+}
+
+/** 
+ *  @brief          Add an entry to the BT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_bt_add_ioctl(wlan_private *priv, struct ifreq *req)
+{
+	struct iwreq *wrq = (struct iwreq *) req;
+	char ethaddrs_str[18];
+	char *pos;
+	u8 ethaddr[ETH_ALEN];
+
+	ENTER();
+	if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
+			   sizeof(ethaddrs_str)))
+		return -EFAULT;
+
+	if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
+		PRINTM(FATAL, "BT_ADD: Invalid MAC address\n");
+		return -EINVAL;
+	}
+
+	PRINTM(INFO, "BT: adding %s\n", ethaddrs_str);
+	LEAVE();
+	return (PrepareAndSendCommand(priv, HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_BT_ACCESS_ADD,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			ethaddr));
+}
+
+/** 
+ *  @brief          Delete an entry from the BT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_bt_del_ioctl(wlan_private *priv, struct ifreq *req)
+{
+	struct iwreq *wrq = (struct iwreq *) req;
+	char ethaddrs_str[18];
+	u8 ethaddr[ETH_ALEN];
+	char *pos;
+
+	ENTER();
+	if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
+			   sizeof(ethaddrs_str)))
+		return -EFAULT;
+
+	if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
+		PRINTM(FATAL, "Invalid MAC address\n"); 
+		return -EINVAL;
+	}
+
+	PRINTM(INFO, "BT: deleting %s\n", ethaddrs_str);
+
+
+	return (PrepareAndSendCommand(priv, 
+			HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_BT_ACCESS_DEL,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			ethaddr));
+	LEAVE();
+	return WLAN_STATUS_SUCCESS;
+}
+
+/** 
+ *  @brief          Reset all entries from the BT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_bt_reset_ioctl(wlan_private *priv)
+{
+	ENTER();
+
+	PRINTM(MSG, "BT: resetting\n");
+
+	return (PrepareAndSendCommand(priv, 
+			HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_BT_ACCESS_RESET,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			NULL));
+
+	LEAVE();
+	return WLAN_STATUS_SUCCESS;
+}
+
+/** 
+ *  @brief          List an entry from the BT table
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         WLAN_STATUS_SUCCESS --success, otherwise fail
+ */
+static int wlan_bt_list_ioctl(wlan_private *priv, struct ifreq *req)
+{
+	int pos;
+	char *addr1;
+	struct iwreq *wrq = (struct iwreq *) req;
+	/* used to pass id and store the bt entry returned by the FW */
+	union {
+		int id;
+		char addr1addr2[2 * ETH_ALEN];
+	} param;
+	static char outstr[64];
+	char *pbuf = outstr;
+	int ret;
+
+	ENTER();
+
+	if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
+		PRINTM(INFO, "Copy from user failed\n");
+		return WLAN_STATUS_FAILURE;
+	}
+	param.id = simple_strtoul(outstr, NULL, 10);	
+	pos = sprintf(pbuf, "%d: ", param.id);
+	pbuf += pos;
+
+	ret = PrepareAndSendCommand(priv, HostCmd_CMD_DFT_ACCESS, 
+			HostCmd_ACT_BT_ACCESS_LIST,
+			HostCmd_OPTION_WAITFORRSP, 0,
+			(char *) &param);
+
+	if (ret == WLAN_STATUS_SUCCESS) {
+		addr1 = param.addr1addr2;
+		
+		pos = sprintf(pbuf, "ignoring traffic from ");
+		pbuf += pos;
+		pos = eth_addr2str(addr1, pbuf);		
+		pbuf += pos;		
+	} else {
+		sprintf(pbuf, "(null)");
+		pbuf += pos;
+	}
+
+	wrq->u.data.length = strlen(outstr);
+	if (copy_to_user(wrq->u.data.pointer, (char *) outstr, 
+			 wrq->u.data.length)) {
+		PRINTM(INFO, "BT_LIST: Copy to user failed!\n");
+		return -EFAULT;
+	}
+
+	LEAVE();
+	return WLAN_STATUS_SUCCESS;
+}
 
diff --git a/drivers/net/wireless/libertas/wlan_wext.h b/drivers/net/wireless/libertas/wlan_wext.h
index 0f227e9..041dde5 100644
--- a/drivers/net/wireless/libertas/wlan_wext.h
+++ b/drivers/net/wireless/libertas/wlan_wext.h
@@ -65,6 +65,8 @@ #endif /* REASSOCIATION */
 
 #define WLANWLANIDLEON				10
 #define WLANWLANIDLEOFF				11
+#define WLAN_SUBCMD_DFT_RESET			12
+#define WLAN_SUBCMD_BT_RESET			13
 
 #define WLANGETLOG                  	(WLANIOCTL + 9)
 #define WLAN_SETCONF_GETCONF		(WLANIOCTL + 10)
@@ -136,6 +138,12 @@ #define WLANSCAN_MODE				6
 
 #define WLAN_GET_ADHOC_STATUS			9
 
+#define WLAN_SUBCMD_DFT_ADD			15
+#define WLAN_SUBCMD_DFT_DEL   			16
+#define WLAN_SUBCMD_DFT_LIST			17 
+#define WLAN_SUBCMD_BT_ADD			18	
+#define WLAN_SUBCMD_BT_DEL   			19
+#define WLAN_SUBCMD_BT_LIST			20 
 
 #define WLANEXTSCAN			(WLANIOCTL + 26)
 
diff --git a/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c b/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
index eaf1108..ba000bc 100644
--- a/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
+++ b/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
@@ -54,9 +54,9 @@ typedef unsigned char		u8;
 typedef unsigned short  	u16;
 typedef unsigned long		u32;
 typedef unsigned long long	u64;
-typedef signed char		s8;
-typedef signed short  		s16;
-typedef signed long		s32;
+typedef char		s8;
+typedef short		s16;
+typedef long		s32;
 
 #ifdef 	BYTE_SWAP
 #define 	cpu_to_le16(x)	__swab16(x)
@@ -626,7 +626,8 @@ static int wlan_get_hostcmd_data(FILE *f
  */
 static int process_host_cmd(int argc, char *argv[])
 {
-	u8		line[256], cmdname[256], *buf, *pos;
+	s8		line[256], cmdname[256], *pos;
+	u8		*buf;
 	FILE		*fp;
 	HostCmd_DS_GEN	*hostcmd;
 	struct ifreq	userdata;


From dwmw2 at infradead.org  Tue Jun  6 17:42:05 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Tue, 06 Jun 2006 22:42:05 +0100
Subject: [PATCH] Libertas 5.110.5 -> 5.110.7 upgrade
In-Reply-To: <20060606211326.GA21056@dmt>
References: <20060606211326.GA21056@dmt>
Message-ID: <1149630126.30024.194.camel@pmac.infradead.org>

On Tue, 2006-06-06 at 18:13 -0300, Marcelo Tosatti wrote:
> --- a/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
> +++ b/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
> @@ -54,9 +54,9 @@ typedef unsigned char         u8;
>  typedef unsigned short         u16;
>  typedef unsigned long          u32;
>  typedef unsigned long long     u64;
> -typedef signed char            s8;
> -typedef signed short           s16;
> -typedef signed long            s32;
> +typedef char           s8;
> +typedef short          s16;
> +typedef long           s32; 

First, isn't this userspace? The silly 'u16' types don't belong in
userspace. Use the standard uint16_t, or perhaps __u16 if you must.

Second, 'char' isn't necessarily signed, and 'long' isn't necessarily 32
bits.

-- 
dwmw2



From marcelo at kvack.org  Wed Jun  7 10:14:27 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 7 Jun 2006 11:14:27 -0300
Subject: [PATCH] Libertas 5.110.5 -> 5.110.7 upgrade
In-Reply-To: <1149630126.30024.194.camel@pmac.infradead.org>
References: <20060606211326.GA21056@dmt>
	<1149630126.30024.194.camel@pmac.infradead.org>
Message-ID: <20060607141427.GB28803@dmt>

On Tue, Jun 06, 2006 at 10:42:05PM +0100, David Woodhouse wrote:
> On Tue, 2006-06-06 at 18:13 -0300, Marcelo Tosatti wrote:
> > --- a/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
> > +++ b/drivers/net/wireless/libertas/wlanconfig/wlanconfig.c
> > @@ -54,9 +54,9 @@ typedef unsigned char         u8;
> >  typedef unsigned short         u16;
> >  typedef unsigned long          u32;
> >  typedef unsigned long long     u64;
> > -typedef signed char            s8;
> > -typedef signed short           s16;
> > -typedef signed long            s32;
> > +typedef char           s8;
> > +typedef short          s16;
> > +typedef long           s32; 
> 
> First, isn't this userspace? The silly 'u16' types don't belong in
> userspace. Use the standard uint16_t, or perhaps __u16 if you must.
> 
> Second, 'char' isn't necessarily signed, and 'long' isn't necessarily 32
> bits.

David,

The plan is to kill wlanconfig.c and use iwpriv for driver private
ioctl's instead.

But yeah, this typedef's were and still continue to be wrong.




From marcelo at kvack.org  Wed Jun  7 15:53:10 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 7 Jun 2006 16:53:10 -0300
Subject: Documentation?
Message-ID: <20060607195310.GA28023@dmt>

Ronak,

Is there available documentation for the 88W8388 chip?

Thanks



From marcelo at kvack.org  Wed Jun  7 18:52:24 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 7 Jun 2006 19:52:24 -0300
Subject: Documentation?
In-Reply-To: <D1575D47310FC94D902C8675241E8E3E01B4B21D@msiexch01.marvell.com>
References: <D1575D47310FC94D902C8675241E8E3E01B4B21D@msiexch01.marvell.com>
Message-ID: <20060607225224.GA14346@dmt>

On Wed, Jun 07, 2006 at 02:43:07PM -0700, Ronak Chokshi wrote:
> Hi Marcelo,
> 
> What sort of documentation do you need? I will need to check with our
> marketing team as to what sort of documentation can we share with you
> given that we probably don't have an SLA with Redhat team.

The chip's programming interface? 

> 
> Thanks
> 
> Ronak
> 
>  
> 
> -----Original Message-----
> From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
> Sent: Wednesday, June 07, 2006 12:53 PM
> To: Ronak Chokshi; libertas-dev at lists.infradead.org
> Subject: Documentation?
> 
>  
> 
> Ronak,
> 
>  
> 
> Is there available documentation for the 88W8388 chip?
> 
>  
> 
> Thanks
> 
>  
> 


From jeff at garzik.org  Wed Jun  7 19:03:34 2006
From: jeff at garzik.org (Jeff Garzik)
Date: Wed, 7 Jun 2006 19:03:34 -0400
Subject: Documentation?
In-Reply-To: <20060607225224.GA14346@dmt>
References: <D1575D47310FC94D902C8675241E8E3E01B4B21D@msiexch01.marvell.com>
	<20060607225224.GA14346@dmt>
Message-ID: <20060607230334.GB12210@havoc.gtf.org>

On Wed, Jun 07, 2006 at 07:52:24PM -0300, Marcelo Tosatti wrote:
> On Wed, Jun 07, 2006 at 02:43:07PM -0700, Ronak Chokshi wrote:
> > Hi Marcelo,
> > 
> > What sort of documentation do you need? I will need to check with our
> > marketing team as to what sort of documentation can we share with you
> > given that we probably don't have an SLA with Redhat team.
> 
> The chip's programming interface? 

Red Hat doesn't have chip docs???

That needs to get fixed ASAP.

	Jeff





From marcelo at kvack.org  Wed Jun  7 19:27:22 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 7 Jun 2006 20:27:22 -0300
Subject: [PATCH] Get rid of transmit queue
Message-ID: <20060607232722.GB14346@dmt>

Hi,

Marvell's driver has a transmit queue, buffering operations between
start_xmit and the chip.

This is scheme is flawed, though, as there is only one placeholder for
data in-flight via USB bus - the code queues multiple USB Request Block
requests without waiting for the previous one to complete, potentially
thrashing the contents of the single placeholder.

It is possible to queue several URB's to the host controller for
increased throughput, might be interesting to try that later. There is
no need to use a thread for doing the parallel submission work.

So remove it and do direct transfers from start_xmit. The queue is
restarted after the USB tx callback is receive.

Needs testing. 

Signed-off-by: Marcelo Tosatti <marcelo at kvack.org>


diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 6b61be4..93a60d1 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -146,6 +146,7 @@ static void if_usb_write_bulk_callback(s
 		PRINTM(INFO, "URB status is successfull\n");
 		PRINTM(INFO, "Actual length transmitted %d\n", urb->actual_length);
 		priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
+		os_start_queue(priv);
 	}
 
 	if (!cardp->IsFWDnld) {
diff --git a/drivers/net/wireless/libertas/os_macros.h b/drivers/net/wireless/libertas/os_macros.h
index 54695f5..eaa878f 100644
--- a/drivers/net/wireless/libertas/os_macros.h
+++ b/drivers/net/wireless/libertas/os_macros.h
@@ -64,21 +64,6 @@ #define IPFIELD_ALIGN_OFFSET	2
 	return 0;
 }
 
-static inline void os_free_tx_packet(wlan_private *priv)
-{
-	ulong	flags;
-
-	spin_lock_irqsave(&priv->adapter->CurrentTxLock, flags);
-	
-	if (priv->adapter->CurrentTxSkb) {
-		kfree_skb(priv->adapter->CurrentTxSkb);
-	}
-
-	priv->adapter->CurrentTxSkb = NULL;
-	
-	spin_unlock_irqrestore(&priv->adapter->CurrentTxLock, flags);
-}
-
 /* netif carrier_on/off and start(wake)/stop_queue handling
 		carrier_on	carrier_off	start_queue	stop_queue
  open		x(connect)	x(disconnect)	x
diff --git a/drivers/net/wireless/libertas/wlan_cmdresp.c b/drivers/net/wireless/libertas/wlan_cmdresp.c
index 94711ac..dc38a6f 100644
--- a/drivers/net/wireless/libertas/wlan_cmdresp.c
+++ b/drivers/net/wireless/libertas/wlan_cmdresp.c
@@ -84,7 +84,8 @@ void MacEventDisconnected(wlan_private *
 		       		SIOCGIWAP, &wrqu, NULL);
 
 	/* Free Tx and Rx packets */
-	os_free_tx_packet(priv);
+	kfree_skb(priv->adapter->CurrentTxSkb);
+	priv->adapter->CurrentTxSkb = NULL;
 	wlan_send_rxskbQ(priv);
 
 	/* report disconnect to upper layer */
@@ -110,8 +111,6 @@ void MacEventDisconnected(wlan_private *
 	/* reset internal flags */
 	Adapter->AdHocCreated = FALSE;
 
-	cleanup_txqueues(priv);
-		
 	Adapter->SecInfo.WPAEnabled = FALSE;
 	Adapter->SecInfo.WPA2Enabled = FALSE;
 	Adapter->Wpa_ie_len = 0;
diff --git a/drivers/net/wireless/libertas/wlan_decl.h b/drivers/net/wireless/libertas/wlan_decl.h
index ed0368d..d936906 100644
--- a/drivers/net/wireless/libertas/wlan_decl.h
+++ b/drivers/net/wireless/libertas/wlan_decl.h
@@ -80,7 +80,7 @@ void wlan_proc_remove(wlan_private *priv
 void wlan_debug_entry(wlan_private *priv, struct net_device *dev);
 void wlan_debug_remove(wlan_private *priv);
 int wlan_process_rx_command(wlan_private * priv);
-void wlan_process_tx(wlan_private * priv);
+int wlan_process_tx(wlan_private * priv, struct sk_buff *skb);
 void CleanupAndInsertCmd(wlan_private * priv, struct CmdCtrlNode * pTempCmd);
 void MrvDrvCommandTimerFunction(void *FunctionContext);
 
@@ -114,8 +114,5 @@ #if WIRELESS_EXT > 14
 void send_iwevcustom_event(wlan_private *priv, s8 *str);
 #endif
 
-void cleanup_txqueues(wlan_private *priv);
-void wlan_process_txqueue(wlan_private * priv);
-
 
 #endif /* _WLAN_DECL_H_ */
diff --git a/drivers/net/wireless/libertas/wlan_dev.h b/drivers/net/wireless/libertas/wlan_dev.h
index 0f8d124..38c96b1 100644
--- a/drivers/net/wireless/libertas/wlan_dev.h
+++ b/drivers/net/wireless/libertas/wlan_dev.h
@@ -303,8 +303,6 @@ #endif /* REASSOCIATION */
 	spinlock_t 		TxSpinLock;
 	struct sk_buff 		*CurrentTxSkb;
 	struct sk_buff		RxSkbQ;
-	struct sk_buff		TxSkbQ;
-	u32			TxSkbNum;
 	u16			TxLockFlag;			
 	u16			gen_null_pkg;
 	spinlock_t 		CurrentTxLock;
diff --git a/drivers/net/wireless/libertas/wlan_fw.c b/drivers/net/wireless/libertas/wlan_fw.c
index 53e4794..356b6ac 100644
--- a/drivers/net/wireless/libertas/wlan_fw.c
+++ b/drivers/net/wireless/libertas/wlan_fw.c
@@ -301,10 +301,6 @@ #define SHORT_PREAMBLE_ALLOWED		1
 	Adapter->IntCounter = Adapter->IntCounterSaved = 0;
 	INIT_LIST_HEAD((struct list_head *)&Adapter->RxSkbQ);
 
-	INIT_LIST_HEAD((struct list_head *)&Adapter->TxSkbQ);
-	Adapter->TxSkbNum = 0;
-
-
 	Adapter->EncryptionStatus = Wlan802_11WEPDisabled;
 
 	spin_lock_init(&Adapter->CurrentTxLock);
diff --git a/drivers/net/wireless/libertas/wlan_main.c b/drivers/net/wireless/libertas/wlan_main.c
index 97e0466..41ef1df 100644
--- a/drivers/net/wireless/libertas/wlan_main.c
+++ b/drivers/net/wireless/libertas/wlan_main.c
@@ -415,27 +415,20 @@ #endif /* ENABLE_PM */
  */
 static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	int             ret;
+	int             ret = 0;
 	wlan_private   *priv = dev->priv;
 
     	ENTER();
 
-	
+	os_stop_queue(priv);
 
-	if (wlan_tx_packet(priv, skb)) {
-		/* Transmit failed */
-		ret = WLAN_STATUS_FAILURE;
+	if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) {
+		priv->stats.tx_dropped++;
 		goto done;
-	} else {
-		/* Transmit succeeded */
-		if(priv->adapter->TxSkbNum >= MAX_NUM_IN_TX_Q) 
-		{
-			UpdateTransStart(dev);
-			os_stop_queue(priv);
-		}
 	}
-    
-    	ret = WLAN_STATUS_SUCCESS;
+
+	if (wlan_process_tx(priv, skb) == 0)
+		UpdateTransStart(dev);
 done:
 
 	LEAVE();
@@ -671,7 +664,6 @@ static int wlan_service_main_thread(void
 			) ||
 			(
 			!Adapter->IntCounter 
-			&& (priv->wlan_dev.dnld_sent || !Adapter->TxSkbNum )
 			&& (priv->wlan_dev.dnld_sent || Adapter->CurCmd ||
 				list_empty(&Adapter->CmdPendingQ))
 			)
@@ -801,11 +793,6 @@ static int wlan_service_main_thread(void
 			ExecuteNextCommand(priv);
 		}
 
-
-			if(!priv->wlan_dev.dnld_sent && (Adapter->TxLockFlag == 0) 
-					&& !list_empty((struct list_head *)&priv->adapter->TxSkbQ)){
-				wlan_process_txqueue(priv);
-			}
 	}
 
 	wlan_deactivate_thread(thread);
@@ -1026,7 +1013,6 @@ #endif
 
 	/* Flush all the packets upto the OS before stopping */
 	wlan_send_rxskbQ(priv);
-	cleanup_txqueues(priv);
 	os_stop_queue(priv);
 	os_carrier_off(priv);
 
@@ -1070,55 +1056,6 @@ #endif
 	return WLAN_STATUS_SUCCESS;
 }
 
-/********************************************************
-		Global Functions
-********************************************************/
-/** 
- *  @brief Cleanup TX queue
- *  @param priv       pointer to wlan_private
- *  @return 	      N/A
-*/
-void cleanup_txqueues(wlan_private *priv)
-{
-	struct sk_buff	*delNode, *Q;
-
-	Q = &priv->adapter->TxSkbQ;
-	while (!list_empty((struct list_head *)Q)) {
-		delNode = Q->next;
-		list_del((struct list_head *)delNode);
-		kfree_skb(delNode);
-	}
-	priv->adapter->TxSkbNum = 0;
-}
-
-
-/** 
- *  @brief handle TX Queue
- *  @param priv       pointer to wlan_private
- *  @return 	      N/A
-*/
-void wlan_process_txqueue(wlan_private * priv)
-{
-	wlan_adapter   *Adapter = priv->adapter;
-	ulong		flags;
-	struct sk_buff *Q;
-	ENTER();
-	spin_lock_irqsave(&Adapter->CurrentTxLock, flags);
-	if(Adapter->TxSkbNum > 0){
-		Q = &priv->adapter->TxSkbQ;
-		Adapter->CurrentTxSkb = Q->next;	   
-		list_del((struct list_head *) Adapter->CurrentTxSkb);
-		Adapter->TxSkbNum --;
-	}
-	spin_unlock_irqrestore(&Adapter->CurrentTxLock, flags);
-	if (Adapter->CurrentTxSkb) {
-		wlan_process_tx(priv);
-	}
-	
-	LEAVE();
-}
-
-
 /**
  * @brief This function sends the rx packets to the os from the skb queue
  *
diff --git a/drivers/net/wireless/libertas/wlan_tx.c b/drivers/net/wireless/libertas/wlan_tx.c
index 5423ebe..704d947 100644
--- a/drivers/net/wireless/libertas/wlan_tx.c
+++ b/drivers/net/wireless/libertas/wlan_tx.c
@@ -172,15 +172,14 @@ done:
 	if (!ret && priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP)  {
 		/* Keep the skb to echo it back once Tx feedback is 
 		   received from FW */
-		skb_orphan(priv->adapter->CurrentTxSkb);
+		skb_orphan(skb);
 		/* stop processing outgoing pkts */
 		os_stop_queue(priv);
 		/* freeze any packets already in our queues */
 		priv->adapter->TxLockFlag = 1;
-	} else 
-	{
-		os_free_tx_packet(priv);
-		os_start_queue(priv);
+	} else {
+		dev_kfree_skb_any(skb);
+		priv->adapter->CurrentTxSkb = NULL;
 	}
 
 	LEAVE();
@@ -198,12 +197,14 @@ done:
  *  @param priv    A pointer to wlan_private structure
  *  @return 	   n/a
  */
-void wlan_process_tx(wlan_private *priv)
+int wlan_process_tx(wlan_private *priv, struct sk_buff *skb)
 {
 	unsigned long flags;
-	wlan_adapter   *Adapter = priv->adapter;
+	int ret = WLAN_STATUS_FAILURE;
 
 	ENTER();
+
+ 	HEXDUMP("TX Data", skb->data, MIN(skb->len, 100));
     
 	if(priv->wlan_dev.dnld_sent) {
 		PRINTM(MSG, "TX Error: dnld_sent = %d, not sending\n",
@@ -211,8 +212,9 @@ void wlan_process_tx(wlan_private *priv)
 		goto done;
 	}
 
+	priv->adapter->CurrentTxSkb = skb;
 
-	SendSinglePacket(priv, Adapter->CurrentTxSkb);
+	ret = SendSinglePacket(priv, skb);
 
 	spin_lock_irqsave(&driver_lock, flags);
 	priv->adapter->HisRegCpy &= ~HIS_TxDnLdRdy;
@@ -220,41 +222,9 @@ void wlan_process_tx(wlan_private *priv)
 
 done:
 	LEAVE();
-}
-
-/** 
- *  @brief This function queues the packet received from
- *  kernel/upper layer and wake up the main thread to handle it.
- *  
- *  @param priv    A pointer to wlan_private structure
-  * @param skb     A pointer to skb which includes TX packet
- *  @return 	   WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int wlan_tx_packet(wlan_private *priv, struct sk_buff *skb)
-{
-	ulong		flags;
-	wlan_adapter 	*Adapter = priv->adapter;
-	int		ret = WLAN_STATUS_SUCCESS;
-
-	ENTER();
-
- 	HEXDUMP("TX Data", skb->data, MIN(skb->len, 100));
-
-	spin_lock_irqsave(&Adapter->CurrentTxLock, flags);
-
-	{
-		Adapter->TxSkbNum ++;
-		list_add_tail((struct list_head *) skb,(struct list_head *) &priv->adapter->TxSkbQ);
-		wake_up_interruptible(&priv->MainThread.waitQ);
-	}
-	spin_unlock_irqrestore(&Adapter->CurrentTxLock, flags);
-
-	LEAVE();
-
 	return ret;
 }
 
-
 /** 
  *  @brief This function tells firmware to send a NULL data packet.
  *  




From marcelo at kvack.org  Wed Jun  7 20:28:02 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 7 Jun 2006 21:28:02 -0300
Subject: [PATCH] Kill most of netqueue macros
Message-ID: <20060608002802.GB15622@dmt>


Kill more os macros: os_{start,stop}_queue, os_carrier_{on,off}
and UpdateTransStart.

Signed-off-by: Marcelo Tosatti <marcelo at kvack.org>

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 93a60d1..0370ee3 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -146,7 +146,8 @@ static void if_usb_write_bulk_callback(s
 		PRINTM(INFO, "URB status is successfull\n");
 		PRINTM(INFO, "Actual length transmitted %d\n", urb->actual_length);
 		priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
-		os_start_queue(priv);
+		if (priv->adapter->MediaConnectStatus==WlanMediaStateConnected)
+			netif_wake_queue(priv->wlan_dev.netdev);
 	}
 
 	if (!cardp->IsFWDnld) {
diff --git a/drivers/net/wireless/libertas/os_macros.h b/drivers/net/wireless/libertas/os_macros.h
index eaa878f..d6d7dac 100644
--- a/drivers/net/wireless/libertas/os_macros.h
+++ b/drivers/net/wireless/libertas/os_macros.h
@@ -22,10 +22,6 @@ #define _OS_MACROS_H
 
 extern spinlock_t	driver_lock;
 
-#define UpdateTransStart(dev) { \
-	dev->trans_start = jiffies; \
-}
-
 #define OS_SET_THREAD_STATE(x)		set_current_state(x)
 
 #define MODULE_GET	try_module_get(THIS_MODULE)
@@ -83,34 +79,6 @@ #define IPFIELD_ALIGN_OFFSET	2
  tx-timeout
  */
 
-static inline void os_carrier_on(wlan_private *priv) 
-{
-	if (!netif_carrier_ok(priv->wlan_dev.netdev) &&
-		(priv->adapter->MediaConnectStatus == WlanMediaStateConnected))
-		netif_carrier_on(priv->wlan_dev.netdev);
-}
-
-static inline void os_carrier_off(wlan_private *priv) 
-{
-	if (netif_carrier_ok(priv->wlan_dev.netdev))
-		netif_carrier_off(priv->wlan_dev.netdev);
-}
-
-static inline void os_start_queue(wlan_private *priv) 
-{
-	if (netif_queue_stopped(priv->wlan_dev.netdev) && 
- 		(priv->adapter->MediaConnectStatus == WlanMediaStateConnected)) {
-		netif_wake_queue(priv->wlan_dev.netdev);
-	}
-}
-
-static inline void os_stop_queue(wlan_private *priv) 
-{
-	if (!netif_queue_stopped(priv->wlan_dev.netdev)) {
-		netif_stop_queue(priv->wlan_dev.netdev);
-	}
-}
-
 static inline int os_queue_is_active(wlan_private *priv)
 {
     return (netif_carrier_ok(priv->wlan_dev.netdev)
diff --git a/drivers/net/wireless/libertas/wlan_cmdresp.c b/drivers/net/wireless/libertas/wlan_cmdresp.c
index dc38a6f..f8c3432 100644
--- a/drivers/net/wireless/libertas/wlan_cmdresp.c
+++ b/drivers/net/wireless/libertas/wlan_cmdresp.c
@@ -89,8 +89,8 @@ void MacEventDisconnected(wlan_private *
 	wlan_send_rxskbQ(priv);
 
 	/* report disconnect to upper layer */
-	os_stop_queue(priv);
-	os_carrier_off(priv);
+	netif_stop_queue(priv->wlan_dev.netdev);
+	netif_carrier_off(priv->wlan_dev.netdev);
 
 	/* reset SNR/NF/RSSI values */
 	memset(Adapter->SNR, 0x00, sizeof(Adapter->SNR));
diff --git a/drivers/net/wireless/libertas/wlan_join.c b/drivers/net/wireless/libertas/wlan_join.c
index f20c8b8..857e4e6 100644
--- a/drivers/net/wireless/libertas/wlan_join.c
+++ b/drivers/net/wireless/libertas/wlan_join.c
@@ -1377,8 +1377,8 @@ int wlan_ret_802_11_associate(wlan_priva
 
 
     {
-        os_carrier_on(priv);
-        os_start_queue(priv);
+        netif_carrier_on(priv->wlan_dev.netdev);
+        netif_wake_queue(priv->wlan_dev.netdev);
     }
 
     PRINTM(INFO, "ASSOC_RESP: Associated \n");
@@ -1493,8 +1493,8 @@ int wlan_ret_802_11_ad_hoc_start(wlan_pr
            &pBSSDesc->Ssid,
            sizeof(struct WLAN_802_11_SSID));
 
-    os_carrier_on(priv);
-    os_start_queue(priv);
+    netif_carrier_on(priv->wlan_dev.netdev);
+    netif_wake_queue(priv->wlan_dev.netdev);
 
     memset(&wrqu, 0, sizeof(wrqu));
     memcpy(wrqu.ap_addr.sa_data, Adapter->CurBssParams.bssid, ETH_ALEN);
diff --git a/drivers/net/wireless/libertas/wlan_main.c b/drivers/net/wireless/libertas/wlan_main.c
index 41ef1df..ecd125e 100644
--- a/drivers/net/wireless/libertas/wlan_main.c
+++ b/drivers/net/wireless/libertas/wlan_main.c
@@ -258,12 +258,13 @@ static int wlan_open(struct net_device *
 
 	priv->open = TRUE;
 
-	if (adapter->MediaConnectStatus == WlanMediaStateConnected)
-		os_carrier_on(priv);
-	else
-		os_carrier_off(priv);
+	if (adapter->MediaConnectStatus == WlanMediaStateConnected) {
+		netif_carrier_on(priv->wlan_dev.netdev);
+		netif_wake_queue(priv->wlan_dev.netdev);
+	} else
+		netif_carrier_off(priv->wlan_dev.netdev);
 
-	os_start_queue(priv);
+	
 
 	LEAVE();
 	return WLAN_STATUS_SUCCESS;
@@ -283,8 +284,8 @@ static int wlan_close(struct net_device 
 
 	/* Flush all the packets upto the OS before stopping */
 	wlan_send_rxskbQ(priv);
-	os_stop_queue(priv);
-	os_carrier_off(priv);
+	netif_stop_queue(priv->wlan_dev.netdev);
+	netif_carrier_off(priv->wlan_dev.netdev);
 
 	MODULE_PUT;
 
@@ -420,15 +421,15 @@ static int wlan_hard_start_xmit(struct s
 
     	ENTER();
 
-	os_stop_queue(priv);
-
+	netif_stop_queue(priv->wlan_dev.netdev);
+	
 	if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) {
 		priv->stats.tx_dropped++;
 		goto done;
 	}
 
 	if (wlan_process_tx(priv, skb) == 0)
-		UpdateTransStart(dev);
+		dev->trans_start = jiffies;
 done:
 
 	LEAVE();
@@ -451,7 +452,7 @@ static void wlan_tx_timeout(struct net_d
 	PRINTM(FATAL, "tx watch dog timeout!\n");
 
 	priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
-	UpdateTransStart(dev);
+	dev->trans_start = jiffies;
 
 	if (priv->adapter->CurrentTxSkb) {
 		if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
@@ -461,10 +462,8 @@ static void wlan_tx_timeout(struct net_d
 			SendTxFeedback(priv);
 		} else
 		wake_up_interruptible(&priv->MainThread.waitQ);
-	}
-	else {
-		os_start_queue(priv);
-	}
+	} else if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected)
+		netif_wake_queue(priv->wlan_dev.netdev);
 
 	LEAVE();
 }
@@ -1013,8 +1012,8 @@ #endif
 
 	/* Flush all the packets upto the OS before stopping */
 	wlan_send_rxskbQ(priv);
-	os_stop_queue(priv);
-	os_carrier_off(priv);
+	netif_stop_queue(priv->wlan_dev.netdev);
+	netif_carrier_off(priv->wlan_dev.netdev);
 
 	Adapter->SurpriseRemoved = TRUE;
 
diff --git a/drivers/net/wireless/libertas/wlan_scan.c b/drivers/net/wireless/libertas/wlan_scan.c
index cc9f898..f6e44e3 100644
--- a/drivers/net/wireless/libertas/wlan_scan.c
+++ b/drivers/net/wireless/libertas/wlan_scan.c
@@ -821,8 +821,8 @@ static int wlan_scan_networks(wlan_priva
 
     /* Keep the data path active if we are only scanning our current channel */
     if (!scanCurrentChanOnly) {
-        os_stop_queue(priv);
-        os_carrier_off(priv);
+        netif_stop_queue(priv->wlan_dev.netdev);
+        netif_carrier_off(priv->wlan_dev.netdev);
     }
 
 
@@ -839,9 +839,10 @@ static int wlan_scan_networks(wlan_priva
      */
     wlan_scan_process_results(priv);
 
-
-    os_carrier_on(priv);
-    os_start_queue(priv);
+    if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected) {
+        netif_carrier_on(priv->wlan_dev.netdev);
+        netif_wake_queue(priv->wlan_dev.netdev);
+    }
 
     LEAVE();
     return ret;
diff --git a/drivers/net/wireless/libertas/wlan_tx.c b/drivers/net/wireless/libertas/wlan_tx.c
index 704d947..e7763c6 100644
--- a/drivers/net/wireless/libertas/wlan_tx.c
+++ b/drivers/net/wireless/libertas/wlan_tx.c
@@ -174,7 +174,7 @@ done:
 		   received from FW */
 		skb_orphan(skb);
 		/* stop processing outgoing pkts */
-		os_stop_queue(priv);
+		netif_stop_queue(priv->wlan_dev.netdev);
 		/* freeze any packets already in our queues */
 		priv->adapter->TxLockFlag = 1;
 	} else {
@@ -334,5 +334,6 @@ #endif
 	os_upload_rx_packet(priv, Adapter->CurrentTxSkb);
 	Adapter->CurrentTxSkb = NULL;
 	priv->adapter->TxLockFlag = 0;
-	os_start_queue(priv);
+	if (priv->adapter->MediaConnectStatus == WlanMediaStateConnected)	
+		netif_wake_queue(priv->wlan_dev.netdev);
 }


From alanc at marvell.com  Wed Jun  7 21:29:45 2006
From: alanc at marvell.com (Alan Cunningham)
Date: Wed, 7 Jun 2006 18:29:45 -0700
Subject: Documentation?
Message-ID: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>

Thanks for your email. We can certainly get Redhat documentation and
access to our Extranet. I believe an NDA is already in place. Please
send me the appropriate  contacts at Redhat, and I will setup the
access..

Thanks,

Alan

-----Original Message-----
From: libertas-dev-bounces at lists.infradead.org
[mailto:libertas-dev-bounces at lists.infradead.org] On Behalf Of Jeff
Garzik
Sent: Wednesday, June 07, 2006 4:04 PM
To: Marcelo Tosatti
Cc: Ronak Chokshi; Aswath Mohan; libertas-dev at lists.infradead.org
Subject: Re: Documentation?

On Wed, Jun 07, 2006 at 07:52:24PM -0300, Marcelo Tosatti wrote:
> On Wed, Jun 07, 2006 at 02:43:07PM -0700, Ronak Chokshi wrote:
> > Hi Marcelo,
> > 
> > What sort of documentation do you need? I will need to check with
our
> > marketing team as to what sort of documentation can we share with
you
> > given that we probably don't have an SLA with Redhat team.
> 
> The chip's programming interface? 

Red Hat doesn't have chip docs???

That needs to get fixed ASAP.

	Jeff




_______________________________________________
libertas-dev mailing list
libertas-dev at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/libertas-dev


From dwmw2 at infradead.org  Thu Jun  8 05:58:17 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Thu, 08 Jun 2006 10:58:17 +0100
Subject: Documentation?
In-Reply-To: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
References: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
Message-ID: <1149760697.13596.122.camel@pmac.infradead.org>

On Wed, 2006-06-07 at 18:29 -0700, Alan Cunningham wrote:
> Thanks for your email. We can certainly get Redhat documentation and
> access to our Extranet. I believe an NDA is already in place. Please
> send me the appropriate  contacts at Redhat, and I will setup the
> access..

I let this mail through to the list despite it having no References:
header -- please could you let me know if you can fix or work around
this bug in your mail program?

If your IT folks really can't manage to make it conform to RFC2822, then
I'll disable that check for this list. It's more important on lists with
higher volume anyway, where preserving threading information is more of
an issue.

-- 
dwmw2



From dwmw2 at infradead.org  Thu Jun  8 11:03:16 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Thu, 08 Jun 2006 16:03:16 +0100
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <45a44e480606080712t7cdc3138vb62d3000ca20adaf@mail.gmail.com>
References: <45a44e480605271701x76736c6cj8f5e00dd8052ac96@mail.gmail.com>
	<1149092702.5986.65.camel@localhost.localdomain>
	<45a44e480605312040m27ab2c26n3d993deca6eb5bcd@mail.gmail.com>
	<45a44e480606050601y49f622caudab487b6a6c3f704@mail.gmail.com>
	<45a44e480606050858t207d3151t6cfd14f6aafc93d1@mail.gmail.com>
	<1149609812.5844.60.camel@localhost.localdomain>
	<45a44e480606080712t7cdc3138vb62d3000ca20adaf@mail.gmail.com>
Message-ID: <1149778996.1608.59.camel@shinybook.infradead.org>

On Thu, 2006-06-08 at 22:12 +0800, Jaya Kumar wrote:
> 
> While looking up this chip, I was amused to see
> http://www.free60.org/wiki/Wifi_Adapter:
> 
> Feature of 88W8388: 8385 + TCP/IP termination NAND Flash I/F Audio
> Codec I/F
> 
> I haven't looked at the specs but maybe that NAND Flash I/F could be
> useful to Dave. 

Oooh, that's an interesting idea -- if we can use that, and get decent
bandwidth off it, it could be a very useful workaround for the slowness
of the CS5536.

We definitely need to get full specs on the Marvell chip ASAP.

-- 
dwmw2



From jeff at garzik.org  Thu Jun  8 11:03:14 2006
From: jeff at garzik.org (Jeff Garzik)
Date: Thu, 08 Jun 2006 11:03:14 -0400
Subject: Documentation?
In-Reply-To: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
References: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
Message-ID: <44883C32.10807@garzik.org>

Alan Cunningham wrote:
> Thanks for your email. We can certainly get Redhat documentation and
> access to our Extranet. I believe an NDA is already in place. Please
> send me the appropriate  contacts at Redhat, and I will setup the
> access..

Speaking only for myself:  jgarzik at redhat.com

FWIW I already have Extranet access, for working on unrelated projects 
(SATA, mostly).

	Jeff





From dwmw2 at infradead.org  Thu Jun  8 11:06:56 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Thu, 08 Jun 2006 16:06:56 +0100
Subject: Documentation?
In-Reply-To: <44883C32.10807@garzik.org>
References: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
	<44883C32.10807@garzik.org>
Message-ID: <1149779216.5213.61.camel@pmac.infradead.org>

On Thu, 2006-06-08 at 11:03 -0400, Jeff Garzik wrote:
> 
> Alan Cunningham wrote:
> > Thanks for your email. We can certainly get Redhat documentation and
> > access to our Extranet. I believe an NDA is already in place. Please
> > send me the appropriate  contacts at Redhat, and I will setup the
> > access..
> 
> Speaking only for myself:  jgarzik at redhat.com

And for me dwmw2 at infradead.org -- you can use the address
dwmw2 at redhat.com if you absolutely must, but @infradead.org is
preferred.

-- 
dwmw2



From tglx at linutronix.de  Thu Jun  8 11:21:54 2006
From: tglx at linutronix.de (Thomas Gleixner)
Date: Thu, 08 Jun 2006 17:21:54 +0200
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <1149778996.1608.59.camel@shinybook.infradead.org>
References: <45a44e480605271701x76736c6cj8f5e00dd8052ac96@mail.gmail.com>
	<1149092702.5986.65.camel@localhost.localdomain>
	<45a44e480605312040m27ab2c26n3d993deca6eb5bcd@mail.gmail.com>
	<45a44e480606050601y49f622caudab487b6a6c3f704@mail.gmail.com>
	<45a44e480606050858t207d3151t6cfd14f6aafc93d1@mail.gmail.com>
	<1149609812.5844.60.camel@localhost.localdomain>
	<45a44e480606080712t7cdc3138vb62d3000ca20adaf@mail.gmail.com>
	<1149778996.1608.59.camel@shinybook.infradead.org>
Message-ID: <1149780115.5257.40.camel@localhost.localdomain>

On Thu, 2006-06-08 at 16:03 +0100, David Woodhouse wrote:
> On Thu, 2006-06-08 at 22:12 +0800, Jaya Kumar wrote:
> > 
> > While looking up this chip, I was amused to see
> > http://www.free60.org/wiki/Wifi_Adapter:
> > 
> > Feature of 88W8388: 8385 + TCP/IP termination NAND Flash I/F Audio
> > Codec I/F
> > 
> > I haven't looked at the specs but maybe that NAND Flash I/F could be
> > useful to Dave. 
> 
> Oooh, that's an interesting idea -- if we can use that, and get decent
> bandwidth off it, it could be a very useful workaround for the slowness
> of the CS5536.
> 
> We definitely need to get full specs on the Marvell chip ASAP.

I fear thats for the firmware and not accessible as a raw NAND
interface, AFAICT from the scarce information available.

	tglx




From jeff at garzik.org  Thu Jun  8 11:35:40 2006
From: jeff at garzik.org (Jeff Garzik)
Date: Thu, 08 Jun 2006 11:35:40 -0400
Subject: Documentation?
In-Reply-To: <1149779216.5213.61.camel@pmac.infradead.org>
References: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>	
	<44883C32.10807@garzik.org>
	<1149779216.5213.61.camel@pmac.infradead.org>
Message-ID: <448843CC.9020408@garzik.org>

David Woodhouse wrote:
> On Thu, 2006-06-08 at 11:03 -0400, Jeff Garzik wrote:
>> Alan Cunningham wrote:
>>> Thanks for your email. We can certainly get Redhat documentation and
>>> access to our Extranet. I believe an NDA is already in place. Please
>>> send me the appropriate  contacts at Redhat, and I will setup the
>>> access..
>> Speaking only for myself:  jgarzik at redhat.com
> 
> And for me dwmw2 at infradead.org -- you can use the address
> dwmw2 at redhat.com if you absolutely must, but @infradead.org is
> preferred.

It's up to you, but for NDA materials I strongly recommend $foo at redhat.com.

I maintain a strict NDA/open separation with jgarzik at redhat versus 
jeff at garzik, and such a firewall has helped on more than one occasion. 
And if there is ever any legal question, a judge will see clearly the 
intent was not to muddy the waters.

	Jeff





From pjones at redhat.com  Thu Jun  8 11:58:14 2006
From: pjones at redhat.com (Peter Jones)
Date: Thu, 08 Jun 2006 11:58:14 -0400
Subject: Documentation?
In-Reply-To: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
References: <D8CE9CFA707C894180BAC8CDD154F8460550A3C8@msiexch01.marvell.com>
Message-ID: <1149782295.2940.2.camel@localhost.localdomain>

On Wed, 2006-06-07 at 18:29 -0700, Alan Cunningham wrote:
> Thanks for your email. We can certainly get Redhat documentation and
> access to our Extranet. I believe an NDA is already in place. Please
> send me the appropriate  contacts at Redhat, and I will setup the
> access..

pjones at redhat.com .  I've already set up an extranet account.

-- 
  Peter


From pjones at redhat.com  Thu Jun  8 12:53:00 2006
From: pjones at redhat.com (Peter Jones)
Date: Thu, 08 Jun 2006 12:53:00 -0400
Subject: Documentation?
In-Reply-To: <20060607230334.GB12210@havoc.gtf.org>
References: <D1575D47310FC94D902C8675241E8E3E01B4B21D@msiexch01.marvell.com>
	<20060607225224.GA14346@dmt>  <20060607230334.GB12210@havoc.gtf.org>
Message-ID: <1149785580.2940.8.camel@localhost.localdomain>

On Wed, 2006-06-07 at 19:03 -0400, Jeff Garzik wrote:
> On Wed, Jun 07, 2006 at 07:52:24PM -0300, Marcelo Tosatti wrote:
> > On Wed, Jun 07, 2006 at 02:43:07PM -0700, Ronak Chokshi wrote:
> > > Hi Marcelo,
> > > 
> > > What sort of documentation do you need? I will need to check with our
> > > marketing team as to what sort of documentation can we share with you
> > > given that we probably don't have an SLA with Redhat team.
> > 
> > The chip's programming interface? 
> 
> Red Hat doesn't have chip docs???
> 
> That needs to get fixed ASAP.

Actually we do, they just haven't been distributed widely.  I can get
them to whoever needs them; just ask.

-- 
  Peter


From rchokshi at marvell.com  Thu Jun  8 15:55:27 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Thu, 8 Jun 2006 12:55:27 -0700
Subject: Requests and questions on Libertas driver
Message-ID: <D1575D47310FC94D902C8675241E8E3E01B4B58B@msiexch01.marvell.com>

Hi Marcelo,
Here are some responses with "Ronak >>". Sorry for the delay. Hopefully
this email will go through fine on this list.


1) At the very moment we don't have a way to test the driver
on the OLPC boards due to lack of antenna (should be fixed soon), more
details available at
http://wiki.laptop.org/index.php/Notes_on_using_the_OLPC_developer_board
s

That said, I would like to ask about the availability of a person from
Marvell with the necessary environment to perform testing while we
progress on cleaning up the driver.

Ronak >> Yes, this is already planned. We have talked with Michail and
they are already shipping us the OLPC laptops and we should be able to
test our software on that.

2) I will merge the changes from version 5.110.7 into our modified      
5.110.5 GIT SCM tree (will post a patch here soon for review, first).   

Can I request the Marvell developers to _not_ release any further
versions, or, if you do, make sure that you merge such changes first
into the GIT tree? Its clearly unproductive for us to keep track of your
work.

Ronak >> Yes, agreed. That is inline with our plans.

3) Technical question: Is there any reason for implementing your own
ioctl configuration program (wlanconfig.c) instead of using iwpriv to
handle private ioctl's? Seems you went halfway into that direction, but 
for some reason implemented your own ioctl interface directly.

/*
 * iwpriv settable callbacks
 */

static const iw_handler wlan_private_handler[] = {
        NULL,                   /* SIOCIWFIRSTPRIV */
};

Just need to fill that table with the appropriate callbacks and should
be 
all set to kill wlanconfig.c in favour of iwpriv.

Ronak >> wlanconfig was designed for the following, since we didn't want
to modify iwpriv source code. 
	
	Syntax check for string parameter
	Read configuration from external file
	Construct WLAN command to be passed to the firmware for further
MAC processing.

If there is a smooth way to do these things using iwpriv, then there is
no problem in killing wlanconfig.

Thanks
Ronak


-----Original Message-----
From: libertas-dev-bounces at lists.infradead.org
[mailto:libertas-dev-bounces at lists.infradead.org] On Behalf Of Marcelo
Tosatti
Sent: Tuesday, June 06, 2006 12:14 PM
To: libertas-dev at lists.infradead.org
Subject: Requests and questions on Libertas driver

Hi folks,

Got a few comments and requests to make, with reference to our work on
merging the Libertas driver to the mainline Linux kernel.

1) At the very moment we don't have a way to test the driver
on the OLPC boards due to lack of antenna (should be fixed soon), more
details available at
http://wiki.laptop.org/index.php/Notes_on_using_the_OLPC_developer_board
s

That said, I would like to ask about the availability of a person from
Marvell with the necessary environment to perform testing while we
progress on cleaning up the driver.

2) I will merge the changes from version 5.110.7 into our modified      
5.110.5 GIT SCM tree (will post a patch here soon for review, first).   

Can I request the Marvell developers to _not_ release any further
versions, or, if you do, make sure that you merge such changes first
into the GIT tree? Its clearly unproductive for us to keep track of your
work.

3) Technical question: Is there any reason for implementing your own
ioctl configuration program (wlanconfig.c) instead of using iwpriv to
handle private ioctl's? Seems you went halfway into that direction, but 
for some reason implemented your own ioctl interface directly.

/*
 * iwpriv settable callbacks
 */

static const iw_handler wlan_private_handler[] = {
        NULL,                   /* SIOCIWFIRSTPRIV */
};

Just need to fill that table with the appropriate callbacks and should
be 
all set to kill wlanconfig.c in favour of iwpriv.

Thanks


_______________________________________________
libertas-dev mailing list
libertas-dev at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/libertas-dev


From marcelo at kvack.org  Thu Jun  8 17:12:33 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 8 Jun 2006 18:12:33 -0300
Subject: [PATCH] Get rid of receive queue
Message-ID: <20060608211233.GA11895@dmt>


The following patch:

- Gets rid of receive queue
- Use per rx callback pointer instead of global one

Needs testing

Signed-off-by: Marcelo Tosatti <marcelo at kvack.org>

Next step is to remove the command/event queue and process
command/event responses directly from IRQ context:

- serialize host-to-firmware command download with a per-device
semaphore.

- asynchronous commands are still necessary for a few contexts.
schedule_work() such cases, waiting on a per-device "wakeup_waitqueue"
if device is powered down before attempting to grab the download
semaphore.

- processing of command response made through schedule_work() (to free
load of IRQ context, might not be necessary).

Once thats done and working stable (sleep/wakeup will need very good
testing!), we can remove the main thread and kill PrepareAndSendCommand.

Its about time to run "Lindent" on this source (now that we won't have
to merge external patches).


diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 0370ee3..247f2ff 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -199,11 +199,6 @@ static void if_usb_free(struct usb_card_
 		}
 	}
 
-	if (cardp->skb) {
-		kfree_skb(cardp->skb);
-		cardp->skb = NULL;
-	
-
 	if (cardp->bulk_out_buffer) {
 		kfree(cardp->bulk_out_buffer);
 		cardp->bulk_out_buffer = NULL;
@@ -416,6 +411,12 @@ tx_ret:
 	return ret;
 }
 
+/* read callback private data */
+struct read_cb_info {
+	wlan_private *priv;
+	struct sk_buff *skb;
+};
+
 /**  
  *  @brief This function submit the rx data to OS
  *  @param priv		pointer to wlan_private structure
@@ -424,21 +425,32 @@ tx_ret:
 static int if_usb_submit_rx_urb(wlan_private *priv)
 {
 	struct usb_card_rec	*cardp = priv->wlan_dev.card;
+	struct sk_buff *skb;
+	struct read_cb_info *rinfo;
 	int			ret = WLAN_STATUS_FAILURE;
 	
 	ENTER();
 
-	if(!(cardp->skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) {
+	if(!(rinfo = kmalloc(sizeof (struct read_cb_info), GFP_ATOMIC))) {
+		PRINTM(FATAL, "No free read_callback_info\n");
+		goto rx_ret;
+	}
+
+	if(!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) {
 		PRINTM(FATAL, "No free skb\n");
+		kfree(rinfo);
 		goto rx_ret;
 	}
 
+	rinfo->skb = skb;
+	rinfo->priv = priv;
+
 	/* Fill the receive configuration URB and initialise the Rx call back */
 	usb_fill_bulk_urb(cardp->rx_urb, cardp->udev,
 			usb_rcvbulkpipe(cardp->udev, cardp->bulk_in_endpointAddr),
-			cardp->skb->tail + IPFIELD_ALIGN_OFFSET,
+			skb->tail + IPFIELD_ALIGN_OFFSET,
 			MRVDRV_ETH_RX_PACKET_BUFFER_SIZE,
-			if_usb_receive, priv);
+			if_usb_receive, rinfo);
 
 	cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
 
@@ -468,7 +480,9 @@ rx_ret:
  */
 static void if_usb_receive(struct urb *urb, struct pt_regs *regs)
 {
-	wlan_private	*priv = (wlan_private *)urb->context;
+	struct read_cb_info *rinfo = (struct read_cb_info *)urb->context;
+	wlan_private	*priv = rinfo->priv;
+	struct		sk_buff *skb = rinfo->skb;
 	struct		usb_card_rec *cardp = 
 			(struct usb_card_rec *)priv->wlan_dev.card;
 
@@ -479,23 +493,23 @@ static void if_usb_receive(struct urb *u
 
 	FWSyncHeader	SyncFWHeader;
 
+
 #define MRVDRV_MIN_PKT_LEN	30
 
 	ENTER();
 
+	kfree(rinfo);
+
 	cardp->rx_urb_pending = FALSE;
 
 	if (RecvLength) {
 		if (urb->status) {
 			PRINTM(INFO, "URB Status is failed\n");
-			if (cardp->skb) {
-				kfree_skb(cardp->skb);
-				cardp->skb = NULL;
-			}
+			kfree_skb(skb);
 			goto setup_for_next;
 		}
 
-		RecvBuff = cardp->skb->data + IPFIELD_ALIGN_OFFSET;
+		RecvBuff = skb->data + IPFIELD_ALIGN_OFFSET;
 		memcpy(&RecvType, RecvBuff, sizeof(u32));
 		PRINTM(INFO, "Recv length = 0x%x\n", RecvLength);
 		PRINTM(INFO, "Receive type = 0x%X\n", RecvType);
@@ -525,10 +539,7 @@ #define MRVDRV_MIN_PKT_LEN	30
 			cardp->CRC_OK = FALSE;
 		}
 		
-		if (cardp->skb) {
-			kfree_skb(cardp->skb);
-			cardp->skb = NULL;
-		}
+		kfree_skb(skb);
 
 		if (cardp->FWFinalBlk) {
 			cardp->FwDnldOver = TRUE;
@@ -549,33 +560,24 @@ #define MRVDRV_MIN_PKT_LEN	30
 				MESSAGE_HEADER_LEN || RecvLength < MRVDRV_MIN_PKT_LEN) {
 				PRINTM(INFO, "Packet length is Invalid\n");
 
-				if (cardp->skb) {
-					kfree_skb(cardp->skb);
-					cardp->skb = NULL;
-				}
+				kfree_skb(skb);
 
 				break;
 			}
 
-			usb_int_cause |= HIS_RxUpLdRdy;
-			skb_reserve(cardp->skb, IPFIELD_ALIGN_OFFSET);
-		        skb_put(cardp->skb, RecvLength);
-			skb_pull(cardp->skb, MESSAGE_HEADER_LEN);
-			list_add_tail((struct list_head *)cardp->skb,
-				(struct list_head *)&priv->adapter->RxSkbQ);	
+			skb_reserve(skb, IPFIELD_ALIGN_OFFSET);
+		        skb_put(skb, RecvLength);
+			skb_pull(skb, MESSAGE_HEADER_LEN);
+			ProcessRxedPacket(priv, skb);
 
 			priv->wlan_dev.upld_len = (RecvLength - MESSAGE_HEADER_LEN);
 
-			if_usb_interrupt(priv, HIS_RxUpLdRdy, RX_SUCCESS);
 			break;
 
 		case CMD_TYPE_REQUEST: 
 			if (RecvLength > MRVDRV_SIZE_OF_CMD_BUFFER) {
 				PRINTM(INFO, "The receive buffer is too large\n");
-				if (cardp->skb) {
-					kfree_skb(cardp->skb);
-					cardp->skb = NULL;
-				}
+				kfree_skb(skb);
 
 				break;	
 			}
@@ -594,10 +596,8 @@ #define MRVDRV_MIN_PKT_LEN	30
 			memcpy(cmdBuf, RecvBuff+MESSAGE_HEADER_LEN,
 				       		priv->wlan_dev.upld_len);
 			
-			if (cardp->skb) {
-				kfree_skb(cardp->skb);
-				cardp->skb = NULL;
-			}
+			kfree_skb(skb);
+
 			PRINTM(INFO, "Wake up main thread to handle cmd response\n");
 			if_usb_interrupt(priv, HIS_CmdUpLdRdy, RX_SUCCESS);
 			break;
@@ -614,19 +614,13 @@ #define MRVDRV_MIN_PKT_LEN	30
 			priv->adapter->EventCause = wlan_le32_to_cpu(priv->adapter->EventCause) << 3; 
 
 			usb_int_cause |= HIS_CardEvent;
-			if (cardp->skb) {
-				kfree_skb(cardp->skb);
-				cardp->skb = NULL;
-			}
+			kfree_skb(skb);
 			if_usb_interrupt(priv, HIS_CardEvent, RX_SUCCESS);
 			
 			break;
 
 		default:
-			if (cardp->skb) {
-				kfree_skb(cardp->skb);
-				cardp->skb = NULL;
-			}
+			kfree_skb(skb);
 			break;
 	}
 	
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h
index c752603..e00a7ef 100644
--- a/drivers/net/wireless/libertas/if_usb.h
+++ b/drivers/net/wireless/libertas/if_usb.h
@@ -60,7 +60,6 @@ struct usb_card_rec
 	void                    (*user_isr)(int, void*, struct pt_regs*);
 	void			*priv;
 	
-	struct sk_buff		*skb;
 	int			bulk_in_size;
 	u8			bulk_in_endpointAddr;
 
diff --git a/drivers/net/wireless/libertas/sbi.h b/drivers/net/wireless/libertas/sbi.h
index ab7abc5..969f5c6 100644
--- a/drivers/net/wireless/libertas/sbi.h
+++ b/drivers/net/wireless/libertas/sbi.h
@@ -43,7 +43,6 @@ #define B_BIT_9		0X200
 #define B_BIT_10	0x400
 
 /** INT Status Bit Definition*/
-#define HIS_RxUpLdRdy			B_BIT_0
 #define HIS_TxDnLdRdy			B_BIT_1
 #define HIS_CmdDnLdRdy			B_BIT_2
 #define HIS_CardEvent			B_BIT_3
diff --git a/drivers/net/wireless/libertas/wlan_cmdresp.c b/drivers/net/wireless/libertas/wlan_cmdresp.c
index f8c3432..4b20dc1 100644
--- a/drivers/net/wireless/libertas/wlan_cmdresp.c
+++ b/drivers/net/wireless/libertas/wlan_cmdresp.c
@@ -86,7 +86,6 @@ void MacEventDisconnected(wlan_private *
 	/* Free Tx and Rx packets */
 	kfree_skb(priv->adapter->CurrentTxSkb);
 	priv->adapter->CurrentTxSkb = NULL;
-	wlan_send_rxskbQ(priv);
 
 	/* report disconnect to upper layer */
 	netif_stop_queue(priv->wlan_dev.netdev);
diff --git a/drivers/net/wireless/libertas/wlan_decl.h b/drivers/net/wireless/libertas/wlan_decl.h
diff --git a/drivers/net/wireless/libertas/wlan_dev.h b/drivers/net/wireless/libertas/wlan_dev.h
index 38c96b1..66d8271 100644
--- a/drivers/net/wireless/libertas/wlan_dev.h
+++ b/drivers/net/wireless/libertas/wlan_dev.h
@@ -302,7 +302,6 @@ #endif /* REASSOCIATION */
 	/** Tx-related variables (for single packet tx) */
 	spinlock_t 		TxSpinLock;
 	struct sk_buff 		*CurrentTxSkb;
-	struct sk_buff		RxSkbQ;
 	u16			TxLockFlag;			
 	u16			gen_null_pkg;
 	spinlock_t 		CurrentTxLock;
diff --git a/drivers/net/wireless/libertas/wlan_fw.c b/drivers/net/wireless/libertas/wlan_fw.c
index 356b6ac..6f179dd 100644
--- a/drivers/net/wireless/libertas/wlan_fw.c
+++ b/drivers/net/wireless/libertas/wlan_fw.c
@@ -299,7 +299,6 @@ #define SHORT_PREAMBLE_ALLOWED		1
 	Adapter->adhoc_grate_enabled=FALSE;
 
 	Adapter->IntCounter = Adapter->IntCounterSaved = 0;
-	INIT_LIST_HEAD((struct list_head *)&Adapter->RxSkbQ);
 
 	Adapter->EncryptionStatus = Wlan802_11WEPDisabled;
 
diff --git a/drivers/net/wireless/libertas/wlan_join.c b/drivers/net/wireless/libertas/wlan_join.c
diff --git a/drivers/net/wireless/libertas/wlan_main.c b/drivers/net/wireless/libertas/wlan_main.c
index ecd125e..aa8a1a7 100644
--- a/drivers/net/wireless/libertas/wlan_main.c
+++ b/drivers/net/wireless/libertas/wlan_main.c
@@ -282,8 +282,6 @@ static int wlan_close(struct net_device 
 	
 	ENTER();
 
-	/* Flush all the packets upto the OS before stopping */
-	wlan_send_rxskbQ(priv);
 	netif_stop_queue(priv->wlan_dev.netdev);
 	netif_carrier_off(priv->wlan_dev.netdev);
 
@@ -606,24 +604,6 @@ static void wlan_set_multicast_list(stru
 }
 
 /** 
- *  @brief This function pops rx_skb from the rx queue.
- *  
- *  @param RxSkbQ  A pointer to rx_skb queue
- *  @return 	   A pointer to skb
- */
-static struct sk_buff* wlan_pop_rx_skb(struct sk_buff *RxSkbQ)
-{
-	struct sk_buff* skb_data = NULL;
-
-	if(!list_empty((struct list_head *) RxSkbQ)) {
-		skb_data = RxSkbQ->next;	
-		list_del((struct list_head *) RxSkbQ->next);
-	}
-
-	return skb_data;
-}
-
-/** 
  *  @brief This function hanldes the major job in WLAN driver.
  *  it handles the event generated by firmware, rx data received
  *  from firmware and tx data sent from kernel.
@@ -731,17 +711,6 @@ static int wlan_service_main_thread(void
 			wlan_process_rx_command(priv);
 		}
 
-		/* Any received data? */
-		if (Adapter->HisRegCpy & HIS_RxUpLdRdy) {
-			PRINTM(INFO, "main-thread: Rx Packet ready.\n");
-		
-			spin_lock_irqsave(&driver_lock, flags);	
-			Adapter->HisRegCpy &= ~HIS_RxUpLdRdy;
-			spin_unlock_irqrestore(&driver_lock, flags);
-
-			wlan_send_rxskbQ(priv);
-		}
-
 		/* Any Card Event */
 		if (Adapter->HisRegCpy & HIS_CardEvent) {
 			PRINTM(INFO, "main-thread: Card Event Activity.\n");
@@ -1010,8 +979,6 @@ #ifdef ENABLE_PM
         pm_unregister(wlan_pm_dev);
 #endif
 
-	/* Flush all the packets upto the OS before stopping */
-	wlan_send_rxskbQ(priv);
 	netif_stop_queue(priv->wlan_dev.netdev);
 	netif_carrier_off(priv->wlan_dev.netdev);
 
@@ -1055,26 +1022,6 @@ #endif
 	return WLAN_STATUS_SUCCESS;
 }
 
-/**
- * @brief This function sends the rx packets to the os from the skb queue
- *
- * @param priv	A pointer to wlan_private structure
- * @return	n/a
- */
-void wlan_send_rxskbQ(wlan_private *priv)
-{
-	struct sk_buff	*skb;
-
-	ENTER();
-	if (priv->adapter) {
-		while((skb = wlan_pop_rx_skb(&priv->adapter->RxSkbQ))) {
-			if (ProcessRxedPacket(priv, skb) == -ENOMEM)
-					break;
-		}
-	}
-	LEAVE();
-}
-
 /** 
  *  @brief This function finds the CFP in 
  *  region_cfp_table based on region and band parameter.


From dwmw2 at infradead.org  Fri Jun  9 18:27:31 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Fri, 09 Jun 2006 23:27:31 +0100
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <1149780115.5257.40.camel@localhost.localdomain>
References: <45a44e480605271701x76736c6cj8f5e00dd8052ac96@mail.gmail.com>
	<1149092702.5986.65.camel@localhost.localdomain>
	<45a44e480605312040m27ab2c26n3d993deca6eb5bcd@mail.gmail.com>
	<45a44e480606050601y49f622caudab487b6a6c3f704@mail.gmail.com>
	<45a44e480606050858t207d3151t6cfd14f6aafc93d1@mail.gmail.com>
	<1149609812.5844.60.camel@localhost.localdomain>
	<45a44e480606080712t7cdc3138vb62d3000ca20adaf@mail.gmail.com>
	<1149778996.1608.59.camel@shinybook.infradead.org>
	<1149780115.5257.40.camel@localhost.localdomain>
Message-ID: <1149892051.5213.180.camel@pmac.infradead.org>

On Thu, 2006-06-08 at 17:21 +0200, Thomas Gleixner wrote:
> I fear thats for the firmware and not accessible as a raw NAND
> interface, AFAICT from the scarce information available.

I assume it _is_ intended for firmware, yes -- but we don't have it
hooked up. We were loading firmware from Linux instead.

So there is a fairly capable NAND flash controller built into the
Marvell wireless SoC, going spare. Well spotted, Jaya.

-- 
dwmw2



From tglx at linutronix.de  Sat Jun 10 01:49:34 2006
From: tglx at linutronix.de (Thomas Gleixner)
Date: Sat, 10 Jun 2006 07:49:34 +0200
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <1149892051.5213.180.camel@pmac.infradead.org>
References: <45a44e480605271701x76736c6cj8f5e00dd8052ac96@mail.gmail.com>
	<1149092702.5986.65.camel@localhost.localdomain>
	<45a44e480605312040m27ab2c26n3d993deca6eb5bcd@mail.gmail.com>
	<45a44e480606050601y49f622caudab487b6a6c3f704@mail.gmail.com>
	<45a44e480606050858t207d3151t6cfd14f6aafc93d1@mail.gmail.com>
	<1149609812.5844.60.camel@localhost.localdomain>
	<45a44e480606080712t7cdc3138vb62d3000ca20adaf@mail.gmail.com>
	<1149778996.1608.59.camel@shinybook.infradead.org>
	<1149780115.5257.40.camel@localhost.localdomain>
	<1149892051.5213.180.camel@pmac.infradead.org>
Message-ID: <1149918574.5257.194.camel@localhost.localdomain>

On Fri, 2006-06-09 at 23:27 +0100, David Woodhouse wrote:
> On Thu, 2006-06-08 at 17:21 +0200, Thomas Gleixner wrote:
> > I fear thats for the firmware and not accessible as a raw NAND
> > interface, AFAICT from the scarce information available.
> 
> I assume it _is_ intended for firmware, yes -- but we don't have it
> hooked up. We were loading firmware from Linux instead.
> 
> So there is a fairly capable NAND flash controller built into the
> Marvell wireless SoC, going spare. Well spotted, Jaya.

Would be interesting if we could offload the NAND work to the Marvell
chip.  Do we have access to the firmware source ?

	tglx




From dwmw2 at infradead.org  Sat Jun 10 07:11:57 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Sat, 10 Jun 2006 12:11:57 +0100
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <1149918574.5257.194.camel@localhost.localdomain>
References: <45a44e480605271701x76736c6cj8f5e00dd8052ac96@mail.gmail.com>
	<1149092702.5986.65.camel@localhost.localdomain>
	<45a44e480605312040m27ab2c26n3d993deca6eb5bcd@mail.gmail.com>
	<45a44e480606050601y49f622caudab487b6a6c3f704@mail.gmail.com>
	<45a44e480606050858t207d3151t6cfd14f6aafc93d1@mail.gmail.com>
	<1149609812.5844.60.camel@localhost.localdomain>
	<45a44e480606080712t7cdc3138vb62d3000ca20adaf@mail.gmail.com>
	<1149778996.1608.59.camel@shinybook.infradead.org>
	<1149780115.5257.40.camel@localhost.localdomain>
	<1149892051.5213.180.camel@pmac.infradead.org>
	<1149918574.5257.194.camel@localhost.localdomain>
Message-ID: <1149937917.5213.212.camel@pmac.infradead.org>

On Sat, 2006-06-10 at 07:49 +0200, Thomas Gleixner wrote:
> > So there is a fairly capable NAND flash controller built into the
> > Marvell wireless SoC, going spare. Well spotted, Jaya.
> 
> Would be interesting if we could offload the NAND work to the Marvell
> chip.  Do we have access to the firmware source ? 

I think that should be possible. The last few messages were copied to
the libertas-dev mailing list in the hope that the Marvell engineers
subscribed there would respond, but they don't seem to have done so
yet...

-- 
dwmw2



From mbletsas at laptop.org  Sat Jun 10 18:17:43 2006
From: mbletsas at laptop.org (Michail Bletsas)
Date: Sat, 10 Jun 2006 18:17:43 -0400
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <1149937917.5213.212.camel@pmac.infradead.org>
Message-ID: <OFBB7C7357.502C7DC4-ON85257189.00795259-85257189.007A6074@notes-mail.media.mit.edu>

David,

I have a feeling that the Flash interface on the 88W8388 will not meet our 
performance requirements since its purpose is to access firmware.

A solution using the 88W8388's flash controller  will have a relative long 
path from the main CPU to the flash (GX2 <-> 5536 <-USB-> 88W8388 <-> 
Flash).
Such a chain will make it hard to run JFFS2 on, am I missing something?

Mark Foster has already started looking for an ASIC solution for 
interfacing the flash (separately from the DCON chip) via PCI.

Should we really pursue the 88W8388 option with Marvell?

M.





David Woodhouse <dwmw2 at infradead.org> 
Sent by: libertas-dev-bounces at lists.infradead.org
06/10/2006 07:11 AM

To
tglx at linutronix.de
cc
Jaya Kumar <jayakumar.lkml at gmail.com>, OLPC Developer's List 
<devel at laptop.org>, libertas-dev at lists.infradead.org
Subject
Re: [OLPC-devel] Re: OLPC development board






On Sat, 2006-06-10 at 07:49 +0200, Thomas Gleixner wrote:
> > So there is a fairly capable NAND flash controller built into the
> > Marvell wireless SoC, going spare. Well spotted, Jaya.
> 
> Would be interesting if we could offload the NAND work to the Marvell
> chip.  Do we have access to the firmware source ? 

I think that should be possible. The last few messages were copied to
the libertas-dev mailing list in the hope that the Marvell engineers
subscribed there would respond, but they don't seem to have done so
yet...

-- 
dwmw2


_______________________________________________
libertas-dev mailing list
libertas-dev at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/libertas-dev




From tglx at linutronix.de  Sat Jun 10 18:30:21 2006
From: tglx at linutronix.de (Thomas Gleixner)
Date: Sun, 11 Jun 2006 00:30:21 +0200
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <OFBB7C7357.502C7DC4-ON85257189.00795259-85257189.007A6074@notes-mail.media.mit.edu>
References: <OFBB7C7357.502C7DC4-ON85257189.00795259-85257189.007A6074@notes-mail.media.mit.edu>
Message-ID: <1149978621.5257.208.camel@localhost.localdomain>

On Sat, 2006-06-10 at 18:17 -0400, Michail Bletsas wrote:
> David,
> 
> I have a feeling that the Flash interface on the 88W8388 will not meet our 
> performance requirements since its purpose is to access firmware.
> 
> A solution using the 88W8388's flash controller  will have a relative long 
> path from the main CPU to the flash (GX2 <-> 5536 <-USB-> 88W8388 <-> 
> Flash).
> Such a chain will make it hard to run JFFS2 on, am I missing something?

This would only make sense if we could run JFFS2 on the 88W8388 itself
and exposing the fs contents via USB.

	tglx




From dwmw2 at infradead.org  Sat Jun 10 18:33:28 2006
From: dwmw2 at infradead.org (David Woodhouse)
Date: Sat, 10 Jun 2006 23:33:28 +0100
Subject: [OLPC-devel] Re: OLPC development board
In-Reply-To: <OFBB7C7357.502C7DC4-ON85257189.00795259-85257189.007A6074@notes-mail.media.mit.edu>
References: <OFBB7C7357.502C7DC4-ON85257189.00795259-85257189.007A6074@notes-mail.media.mit.edu>
Message-ID: <1149978809.18635.178.camel@shinybook.infradead.org>

On Sat, 2006-06-10 at 18:17 -0400, Michail Bletsas wrote:
> I have a feeling that the Flash interface on the 88W8388 will not meet our 
> performance requirements since its purpose is to access firmware.
> 
> A solution using the 88W8388's flash controller  will have a relative long 
> path from the main CPU to the flash (GX2 <-> 5536 <-USB-> 88W8388 <-> 
> Flash).
> Such a chain will make it hard to run JFFS2 on, am I missing something?

I don't think we actually _do_ use it for firmware, do we? We're loading
firmware from the host side instead? But yes, you're probably right --
the latency isn't going to be great.

> Mark Foster has already started looking for an ASIC solution for 
> interfacing the flash (separately from the DCON chip) via PCI.

OK, that's good. Have you spoken to Thomas about the working CPLD
implementation we already have working with Linux, and which we have
permission to relicense?

> Should we really pursue the 88W8388 option with Marvell? 

Since they seem to have gone silent, I suppose there's no point in
_chasing_ them to talk to us... :)

-- 
dwmw2



From marcelo at kvack.org  Wed Jun 14 15:30:30 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 14 Jun 2006 16:30:30 -0300
Subject: Progress on OLPC's board wireless device
Message-ID: <20060614193030.GA1338@dmt>

Hi Ronak,

I have been testing the Libertas driver on the OLPC board and got a few
questions for you.

Good news first: The device is detected by the USB subsystem and the
Libertas driver, and its able to scan for AP's correctly (with "iwlist
eth0 scan").

And the bad news:

One issue is that the firmware download is not reliable, it fails at
times (my first attempt to load the driver was not successful).

What happens is that no response is received from the device, even
though the URB write request containing the firmware data is ACKed (ie.
there is a successful URB write callback notification).

>From there on the device seems completly dead. Attempting to reload the
firmware results in no ACKs referring to the URB fw write.

To fix the situation I have to power off the board, reboot, and,
occassionaly, the firmware boots successfully. Obviously this situation
is not acceptable for production.

Any clues on what might be going on? Should a HostCmd_CMD_802_11_RESET help?
Is this a known issue?

Another issue is failure to associate to an AP.
HostCmd_CMD_802_11_ASSOCIATE _always_ returns status code "4", which
results in:

/**
 *  @brief This function handles the command response of associate
 *
 *  @param priv    A pointer to wlan_private structure
 *  @param resp    A pointer to HostCmd_DS_COMMAND
 *  @return        WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
 */
int wlan_ret_802_11_associate(wlan_private* priv,
                              struct HostCmd_DS_COMMAND* resp)
{
    wlan_adapter*           Adapter = priv->adapter;
    int                     ret     = WLAN_STATUS_SUCCESS;
    union iwreq_data        wrqu;
    IEEEtypes_AssocRsp_t*   pAssocRsp;
    BSSDescriptor_t*        pBSSDesc;

    ENTER();

    pAssocRsp = (IEEEtypes_AssocRsp_t*)&resp->params;

    if (pAssocRsp->StatusCode) {

        if (Adapter->MediaConnectStatus == WlanMediaStateConnected) {
            MacEventDisconnected(priv);
        }

        PRINTM(INFO, "ASSOC_RESP: Association Failed, status code = %d\n",
               pAssocRsp->StatusCode);


Where can I find more information about this status codes? I've
searched for the IEEE IE 802.11 types but no success. The documentation
Marvell provided is not very extensive. Is there anything more complete
other than "WLAN Subsystem Host Driver, Firmware, and Interface IEEE
802.11a/g/b Firmware Specification v5.0" ?

Thank you




From rchokshi at marvell.com  Wed Jun 14 17:10:04 2006
From: rchokshi at marvell.com (Ronak Chokshi)
Date: Wed, 14 Jun 2006 14:10:04 -0700
Subject: Progress on OLPC's board wireless device
Message-ID: <D1575D47310FC94D902C8675241E8E3E01BB75B5@msiexch01.marvell.com>

Hi Marcelo,
Regarding the USB firmware download hang issue, I don't think we have
seen that issue on our test beds. 

Regarding the issue with the Association command here are some points,
	I don't think we have seen that one also here in our side.
	Can you send me a sniffer capture on this?
	What is the AP that you are trying to associate?
	I hope that you are using the correct firmware (standalone
client firmware and not the firmware that works with Roofnet) by any
chance.

But I am confirming both of them with our teams.

Here is an updated document "WLAN Subsystem Host Driver, Firmware, and
Interface IEEE 802.11a/g/b Firmware Specification v5.1".

Are you testing these things on the OLPC board? If yes, then we should
be able to help you guys out better from next week when we get some
boards for us?

Thanks
Ronak


-----Original Message-----
From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
Sent: Wednesday, June 14, 2006 12:31 PM
To: Ronak Chokshi; libertas-dev at lists.infradead.org
Subject: Progress on OLPC's board wireless device

Hi Ronak,

I have been testing the Libertas driver on the OLPC board and got a few
questions for you.

Good news first: The device is detected by the USB subsystem and the
Libertas driver, and its able to scan for AP's correctly (with "iwlist
eth0 scan").

And the bad news:

One issue is that the firmware download is not reliable, it fails at
times (my first attempt to load the driver was not successful).

What happens is that no response is received from the device, even
though the URB write request containing the firmware data is ACKed (ie.
there is a successful URB write callback notification).

>From there on the device seems completly dead. Attempting to reload the
firmware results in no ACKs referring to the URB fw write.

To fix the situation I have to power off the board, reboot, and,
occassionaly, the firmware boots successfully. Obviously this situation
is not acceptable for production.

Any clues on what might be going on? Should a HostCmd_CMD_802_11_RESET
help?
Is this a known issue?

Another issue is failure to associate to an AP.
HostCmd_CMD_802_11_ASSOCIATE _always_ returns status code "4", which
results in:

/**
 *  @brief This function handles the command response of associate
 *
 *  @param priv    A pointer to wlan_private structure
 *  @param resp    A pointer to HostCmd_DS_COMMAND
 *  @return        WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
 */
int wlan_ret_802_11_associate(wlan_private* priv,
                              struct HostCmd_DS_COMMAND* resp)
{
    wlan_adapter*           Adapter = priv->adapter;
    int                     ret     = WLAN_STATUS_SUCCESS;
    union iwreq_data        wrqu;
    IEEEtypes_AssocRsp_t*   pAssocRsp;
    BSSDescriptor_t*        pBSSDesc;

    ENTER();

    pAssocRsp = (IEEEtypes_AssocRsp_t*)&resp->params;

    if (pAssocRsp->StatusCode) {

        if (Adapter->MediaConnectStatus == WlanMediaStateConnected) {
            MacEventDisconnected(priv);
        }

        PRINTM(INFO, "ASSOC_RESP: Association Failed, status code =
%d\n",
               pAssocRsp->StatusCode);


Where can I find more information about this status codes? I've
searched for the IEEE IE 802.11 types but no success. The documentation
Marvell provided is not very extensive. Is there anything more complete
other than "WLAN Subsystem Host Driver, Firmware, and Interface IEEE
802.11a/g/b Firmware Specification v5.0" ?

Thank you


-------------- next part --------------
A non-text attachment was scrubbed...
Name: WLAN Firmware Spec v5.1 - MV-S103752-00.zip
Type: application/x-zip-compressed
Size: 889243 bytes
Desc: WLAN Firmware Spec v5.1 - MV-S103752-00.zip
Url : http://lists.infradead.org/pipermail/libertas-dev/attachments/20060614/bb59070f/attachment-0001.bin 

From marcelo at kvack.org  Wed Jun 14 17:32:02 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 14 Jun 2006 18:32:02 -0300
Subject: Progress on OLPC's board wireless device
In-Reply-To: <D1575D47310FC94D902C8675241E8E3E01BB75B5@msiexch01.marvell.com>
References: <D1575D47310FC94D902C8675241E8E3E01BB75B5@msiexch01.marvell.com>
Message-ID: <20060614213202.GA3979@dmt>

On Wed, Jun 14, 2006 at 02:10:04PM -0700, Ronak Chokshi wrote:
> Hi Marcelo,
> Regarding the USB firmware download hang issue, I don't think we have
> seen that issue on our test beds. 
> 
> Regarding the issue with the Association command here are some points,
> 	I don't think we have seen that one also here in our side.
> 	Can you send me a sniffer capture on this?

OK - will do it tomorrow.

> 	What is the AP that you are trying to associate?

A D-Link 700G (802.11a/b/g) - tried 11 and 54Mbps.

> 	I hope that you are using the correct firmware (standalone
> client firmware and not the firmware that works with Roofnet) by any
> chance.

usb8388_A1_W8015FP14_FW2.bin which is the standalone one, right?

Will recheck that I'm running that tomorrow.

> But I am confirming both of them with our teams.

Also tried Ad-Hoc mode to a laptop and the main thread hangs waiting forever
for an SNMP MIB command response, which then triggers the TX watchdog.

> Here is an updated document "WLAN Subsystem Host Driver, Firmware, and
> Interface IEEE 802.11a/g/b Firmware Specification v5.1".
> 
> Are you testing these things on the OLPC board? If yes, then we should
> be able to help you guys out better from next week when we get some
> boards for us?

Surely, thanks!


From marcelo at kvack.org  Thu Jun 15 16:48:51 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 15 Jun 2006 17:48:51 -0300
Subject: Progress on OLPC's board wireless device
In-Reply-To: <20060614213202.GA3979@dmt>
References: <D1575D47310FC94D902C8675241E8E3E01BB75B5@msiexch01.marvell.com>
	<20060614213202.GA3979@dmt>
Message-ID: <20060615204851.GA9586@dmt>

On Wed, Jun 14, 2006 at 06:32:02PM -0300, Marcelo Tosatti wrote:
> On Wed, Jun 14, 2006 at 02:10:04PM -0700, Ronak Chokshi wrote:
> > Hi Marcelo,
> > Regarding the USB firmware download hang issue, I don't think we have
> > seen that issue on our test beds. 
> > 
> > Regarding the issue with the Association command here are some points,
> > 	I don't think we have seen that one also here in our side.
> > 	Can you send me a sniffer capture on this?
> 
> OK - will do it tomorrow.
> 
> > 	What is the AP that you are trying to associate?
> 
> A D-Link 700G (802.11a/b/g) - tried 11 and 54Mbps.
> 
> > 	I hope that you are using the correct firmware (standalone
> > client firmware and not the firmware that works with Roofnet) by any
> > chance.
> 
> usb8388_A1_W8015FP14_FW2.bin which is the standalone one, right?
> 
> Will recheck that I'm running that tomorrow.

I _am_ an idiot. Was using the wrong firmware. 

Its working now!


From javier at cozybit.com  Fri Jun 16 05:40:21 2006
From: javier at cozybit.com (Javier Cardona)
Date: Fri, 16 Jun 2006 02:40:21 -0700
Subject: Progress on OLPC's board wireless device
In-Reply-To: <20060615204851.GA9586@dmt>
References: <D1575D47310FC94D902C8675241E8E3E01BB75B5@msiexch01.marvell.com>
	<20060614213202.GA3979@dmt> <20060615204851.GA9586@dmt>
Message-ID: <200606160240.21473.javier@cozybit.com>


Hi Marcelo,

On Thursday 15 June 2006 13:48, Marcelo Tosatti wrote:
> On Wed, Jun 14, 2006 at 06:32:02PM -0300, Marcelo Tosatti wrote:
> > On Wed, Jun 14, 2006 at 02:10:04PM -0700, Ronak Chokshi wrote:
> > > Hi Marcelo,
> > > Regarding the USB firmware download hang issue, I don't think we have
> > > seen that issue on our test beds.
> > >
> > > Regarding the issue with the Association command here are some points,
> > > 	I don't think we have seen that one also here in our side.
> > > 	Can you send me a sniffer capture on this?
> >
> > OK - will do it tomorrow.
> >
> > > 	What is the AP that you are trying to associate?
> >
> > A D-Link 700G (802.11a/b/g) - tried 11 and 54Mbps.
> >
> > > 	I hope that you are using the correct firmware (standalone
> > > client firmware and not the firmware that works with Roofnet) by any
> > > chance.
> >
> > usb8388_A1_W8015FP14_FW2.bin which is the standalone one, right?
> >
> > Will recheck that I'm running that tomorrow.
>
> I _am_ an idiot. Was using the wrong firmware.

Just wanted to give you a bit more info about the raw firmware so you
can understand what was going on...

The other (raw) firmware, expects 802.11 frames from the driver.
In that case, the association state machine in the firmware is disabled, 
and any 802.3 frame received from the driver is dropped (this was the cause of 
the Tx timeouts that you saw).

The raw firmware is only useful for generating test traffic or for other 
networking applications that require 802.11 frames (e.g. roofnet).  In that 
case, you must use libpcap to inject the traffic, and set the linkmode 
parameter on the driver to 2.

Cheers,

--
Javier Cardona
cozybit Inc.


From marcelo at kvack.org  Wed Jun 21 14:36:32 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Wed, 21 Jun 2006 15:36:32 -0300
Subject: GIT tree
Message-ID: <20060621183632.GA10503@dmt>

Folks,

I'm keeping a GIT tree with current work at

http://git.infradead.org/?p=users/marcelo/libertas;a=summary


Marcelo Tosatti:
      Add Libertas entry to Makefile
      Convert __ATTRIB_PACK__ to direct __attribute__((packed)) usage.
      Get rid of standard types typedef's
      Get rid of standard types typedef's
      Get rid of "os_get_time()" macro, use jiffies directly.
      Get rid of OS_INT_{DIS,EN}ABLE macros
      Remove unnecessary aligned attribute
      Get rid of struct typedef's
      Merge marcelo at git.infradead.org:~/libertas/
      Libertas: Get rid of tx queue
      Libertas: Get rid of rx queue
      Libertas: Kill more os macros
      Libertas: Missed netif_stop_queue/carrier_off conversion
      Libertas: Fix debug option
      Libertas: remove useless HIS_TxDnLdRdy flag
      Libertas: Run scripts/Lindent
      Libertas: Remove unused struct definitions, remove typedefs from if_usb.h
      Libertas: Remove handling of firmware download from main RX callback
      Libertas: Kill URBs on suspend
      Libertas: Get rid of try_module_get/module_put
      Libertas: Fix if_usb_receive_fwload memcpy() screwup
      Libertas: Update and use include/net/ieee80211_radiotap.h
      Libertas: Get rid of timer abstraction, use Linux functions directly
      Libertas: Get rid of unused os_queue_is_active
      Libertas: Get rid of OS_SET_THREAD_STATE macro
      Libertas: fix if_usb label identation
      Libertas: Fix wlan_fw.c label identation

Peter Jones:
      foo
      foo
      - just drop the marvell in wholesale
      - er... actually add the marvell stuff in?
      - does cg-add -r not actually work?
      - use find instead of 'cg-add -r'
      - move everything so there's no silly subdirs
      - add libertas
      - get rid of release_version.h completely; it serves no purpose.
      - use sane types for helper_name/fw_name
      - so I don't lose what was here
      - add define formerly in makefile
      - fix include path
      - actually, those can't be static
      - move the wlanconfig stuff to a closer directory, and make it build
      Merge with git://git.kernel.org/.../jgarzik/netdev-2.6.git
      - get rid of some "BOOLEAN" types
      Merge with git://git.kernel.org/.../torvalds/linux-2.6.git
      - attack with lindent and such
      - add -Wpacked, which makes the build very noisy, and shows lots of places
      - comment out -Wpacked for now
      Remove unused type WLAN_802_11_MAC_ADDRESS
      Remove use of macro for align attributes.
      Merge with git://git.kernel.org/.../torvalds/linux-2.6.git
      Get rid of semaphore macros
      Get rid of "os_sched" macros, use msleep.
      Get rid of empty macros
      Fix 2 missing "struct" keywords from RxPD -> struct RxDP conversion.
      Merge with git://git.kernel.org/.../torvalds/linux-2.6.git
      Merge suspend/resume code for usb interface.
      - Merge update from Marvell



From marcelo at kvack.org  Thu Jun 22 13:45:55 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 22 Jun 2006 14:45:55 -0300
Subject: help on compiling the Marvell driver on FC6
In-Reply-To: <OF66A61D35.F131F664-ON85257195.005F5F96-85257195.005FD837@notes-mail.media.mit.edu>
References: <20060621183632.GA10503@dmt>
	<OF66A61D35.F131F664-ON85257195.005F5F96-85257195.005FD837@notes-mail.media.mit.edu>
Message-ID: <20060622174555.GB7228@dmt>

On Thu, Jun 22, 2006 at 01:27:48PM -0400, Michail Bletsas wrote:
> Marcelo, Ronak,
> 
> I am trying to compile the Marvell driver 
> (USB-8388-FEDORA26-X86-5.110.7.p0-26318.P7) on FC6 for Barry Vercoe's demo 
> in Las Vegas this monday.
> I am getting an error on the MODULE_PARM macros in lines 44 and 44 of 
> wlan/wlan_fw.c 
> I noticed that the MODULE_PARM is defined in /usr/include/linux/module.h 
> in FC5 and that file is missing in FC6 
> 
> Any ideas?

The MODULE_PARM() macro was used back in v2.4, v2.6 uses module_param()
instead.

Please use the GIT tree, fixed there already.


From marcelo at kvack.org  Thu Jun 22 17:59:35 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 22 Jun 2006 18:59:35 -0300
Subject: SendTxFeedback?
Message-ID: <20060622215935.GA15558@dmt>

Hi Ronak,

It is my understanding that given a packet transmission failure, the
driver attempts to send the failed packet back to the upper layers (what
is called "tx feedback"), if radiotap mode is enabled.

At this level, the packet transmission can only fail due to a removed
card or failure in the USB transfer.

I fail to see any use for such an "error reporting", can you explain
what is going on?

Thanks

PS: do you have any numbers for the savings gained by enabling the power
mode saving mode, when idle?



From javier at cozybit.com  Thu Jun 22 18:34:44 2006
From: javier at cozybit.com (Javier Cardona)
Date: Thu, 22 Jun 2006 15:34:44 -0700
Subject: SendTxFeedback?
In-Reply-To: <20060622215935.GA15558@dmt>
References: <20060622215935.GA15558@dmt>
Message-ID: <200606221534.44659.javier@cozybit.com>



Hi Marcelo,

> It is my understanding that given a packet transmission failure, the
> driver attempts to send the failed packet back to the upper layers (what
> is called "tx feedback"), if radiotap mode is enabled.

The Tx Feedback is only operational in the raw firmware, not in the cooked 
firmware.  

The design goal of the raw firmware was to support mesh routing on the host 
(e.g. roofnet), for which tx feedback is needed.

The design goal of the cooked firmware is to eventually implement mesh routing 
in the firmware itself, so no transmission feedback needs to be reported to 
the driver.  

> At this level, the packet transmission can only fail due to a removed
> card or failure in the USB transfer.

Not really.  Tx Feedback tells the driver the number of retries that were 
needed to send a frame or an error if no ACK was received from the 
destination host.  This is used by the mesh routing protocol to determine the 
quality of a link.

> I fail to see any use for such an "error reporting", can you explain
> what is going on?

You are probably using the cooked firmware, so no tx feedback.

> PS: do you have any numbers for the savings gained by enabling the power
> mode saving mode, when idle?

I'll let someone else answer this... 


Cheers,

Javier

-- 
Javier Cardona
cozybit Inc.
t 415 974 6770
f 415 974 6771
c 415 630 0627
w http://www.cozybit.com
e javier at cozybit.com


From marcelo at kvack.org  Fri Jun 23 18:58:22 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Fri, 23 Jun 2006 19:58:22 -0300
Subject: SendTxFeedback?
In-Reply-To: <D1575D47310FC94D902C8675241E8E3E01C85FAC@msiexch01.marvell.com>
References: <D1575D47310FC94D902C8675241E8E3E01C85FAC@msiexch01.marvell.com>
Message-ID: <20060623225822.GA21722@dmt>


Hi Ronak,

On Thu, Jun 22, 2006 at 03:12:36PM -0700, Ronak Chokshi wrote:
> -----Original Message-----
> From: Marcelo Tosatti [mailto:marcelo at kvack.org] 
> Sent: Thursday, June 22, 2006 3:00 PM
> To: Ronak Chokshi; libertas-dev at lists.infradead.org
> Subject: SendTxFeedback?
> 
> Hi Ronak,
> 
> It is my understanding that given a packet transmission failure, the
> driver attempts to send the failed packet back to the upper layers (what
> is called "tx feedback"), if radiotap mode is enabled.
> 
> At this level, the packet transmission can only fail due to a removed
> card or failure in the USB transfer.
> 
> >> yes this is true.
> 
> I fail to see any use for such an "error reporting", can you explain
> what is going on?
> 
> >> This has been adopted from the Roofnet stack. It depends on your
> choice to remove this error reporting. This is useful mainly to depict
> the wireless environment around the STA.

Since this is nonstandard behaviour I will remove it, then.

> Thanks
> 
> PS: do you have any numbers for the savings gained by enabling the power
> mode saving mode, when idle?
> 
> >> Yes, we might have some numbers for the power save mode. Let me check
> and get back to you. How will you guys use these numbers? 

> Are you in the process of characterizing power consumption of the WLAN
> device in the power save mode?

Well, I'm sort of wondering what the power savings are... We still haven't 
started a more serious procedure for this.

> I am assuming that by idle, you mean that the STA is
> associated with the AP but is not engaged in Tx or Rx of any traffic,
> right?

Correct.


From dcbw at redhat.com  Thu Jun 29 12:25:29 2006
From: dcbw at redhat.com (Dan Williams)
Date: Thu, 29 Jun 2006 12:25:29 -0400
Subject: wireless extensions improvement tasks
Message-ID: <1151598329.20455.13.camel@localhost.localdomain>

Hi,

Some points to start with for WEXT cleanups:

a) Need to separate the ENCODE handler into WPA and non-WPA sections;
the WPA sections should be handled by an ENCODEEXT handler and an AUTH
handler, rather than overloading the ENCODE handler for WPA too

b) Need to fix the non-WPA ENCODE handler to turn the key on when you
just set 'iwconfig eth1 essid bar key <foo>' instead of requiring a
separate 'iwconfig eth1 key on'.  I've got a patch for this already in
the works.

c) Need to convert more of the private ioctl() calls over to WEXT where
appropriate (WLANSCAN_TYPE, WLANSETWPAIE, etc)

d) Turn on reassociation by default

e) Ensure bitrate reporting works correctly when reported via WEXT calls
(Wasn't seeing it change in iwconfig when signal quality changed
drastically)

f) Send more WEXT events to userspace (HandleMICFailureEvent() call
should report via IWEVMICHAELMICFAILURE rather than IWEVCUSTOM)

Cheers,
Dan

PS - For those of you who may not know who I am...

My name is Dan Williams and I work for Red Hat on OLPC.  Previously to
being on the RH OLPC team I worked quite a bit on Linux wireless
networking, including driver cleanups for conformance to the Linux
Wireless Extensions "standard".




From marcelo at kvack.org  Thu Jun 29 14:55:49 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 29 Jun 2006 15:55:49 -0300
Subject: Transmit under power save mode
Message-ID: <20060629185549.GA5828@dmt>

Hi Ronak,

I'm trying to enhance TX latency under PS mode and need some help.

After removing the internal TX queue, I had to fixup power save mode by
stopping the Linux queue when confirm sleep command is sent to firmware,
and restarting it upon receival of awake event:

http://git.infradead.org/?p=users/marcelo/libertas;a=commit;h=4d45a22f86fce4b4625a56577fb9287efffac20f

Problem is that this change degraded latency, as noted in the changelog:

"Latency under power saving mode has degraded due to this change, in
comparison with the in-driver transmit queue. If it ends up being a
problem, it might be necessary to go back to the old scheme (note:
throughput without TX/RX queue is 8% higher).

Worst case latency with original driver ~= 500ms
Worst case latency with current driver ~= 1500ms"

I've noticed that _not_ stopping the OS queue when the device is
in sleep state does not cause harm, and packets are transmitted
successfully.

However, doing that is not recommended:

5.13.6 Assumptions
The host must not issue any command (except the disable PS mode command,
HOST_WAKE_UP_CFG command, or HOST_AWAKE_CONFIRM command) after it
enables PS mode. It may, however, continue to process data transmit and
receive. After sending the sleep confirm message, the host must not
issue the disable PS mode command until it receives an awake indication.
It should also not attempt to transmit or receive any data during this
window (see Figure 5).

                                    Enable PS mode req/rsp
  Host may Tx/Rx data. Host
must not issue any command
   except disable PS mode,
 HOST_WAKE_UP_CFG, or
 HOST_AWAKE_CONFIRM
                                    Sleep event
                                    Sleep confirm
 Host must NOT Tx /Rx data
     Host must not issue any                                        Dozing
   command (no exception)
                                    Awake event

I'm guessing that what happens is the USB controller queues the
transfers until the device wakes up (so we don't lose any of them).

Another advantage is that latency goes to 300ms worst case, versus      
500ms worst case in the original driver.

So, my question is, is it harmful to transmit data while the device is
in sleep state, via the USB bus?

And another related question is, do you have implementation of driver 
code for different buses?

Thanks


From marcelo at kvack.org  Thu Jun 29 17:17:14 2006
From: marcelo at kvack.org (Marcelo Tosatti)
Date: Thu, 29 Jun 2006 18:17:14 -0300
Subject: unknown event id: 0x0
Message-ID: <20060629211714.GA11524@dmt>

Ronak,

Any idea why the firmware signals event 0x0 while in power mode? 

Its unknown to the driver: 

root at pegasos:~# grep EVENT log4 | head -50
[  251.291587] **EVENT** 0xA
[  251.476152] **EVENT** 0xB
[  251.704846] EVENT Cause 58
[  251.707608] EVENT: SLEEP
[  253.547731] **EVENT** 0xA
[  253.652387] EVENT Cause 50
[  253.655148] EVENT: AWAKE
[  253.673566] **EVENT** 0xB
[  253.796187] EVENT Cause 58
[  253.798910] EVENT: SLEEP
[  254.172411] **EVENT** 0xA
[  254.242431] **EVENT** 0xB
[  254.347187] EVENT Cause 58
[  254.349913] EVENT: SLEEP
[  254.522774] **EVENT** 0xA
[  254.523155] **EVENT** 0xB
[  254.729492] EVENT Cause 58
[  254.732222] EVENT: SLEEP
[  254.892801] **EVENT** 0xA
[  254.962592] **EVENT** 0xB
[  255.111650] EVENT Cause 58
[  255.114410] EVENT: SLEEP
[  255.256749] **EVENT** 0xA
[  255.326539] **EVENT** 0xB
[  255.493829] EVENT Cause 0
[  255.496475] EVENT: unknown event id: 0x0
[  255.619934] **EVENT** 0xA
[  255.620300] **EVENT** 0xB
[  255.857498] EVENT Cause 58
[  255.860227] EVENT: SLEEP
[  255.987109] **EVENT** 0xA
[  255.987486] **EVENT** 0xB
[  256.239803] EVENT Cause 0
[  256.242443] EVENT: unknown event id: 0x0
[  256.365855] **EVENT** 0xA
[  256.366233] **EVENT** 0xB
[  256.603161] EVENT Cause 58
[  256.605926] EVENT: SLEEP
[  256.716980] **EVENT** 0xA
[  256.717437] **EVENT** 0xB
[  256.985944] EVENT Cause 0
[  256.988593] EVENT: unknown event id: 0x0

This pattern repeats forever in PS mode (with the original driver too).


