[RFC PATCH] move command header into command structures

Dan Williams dcbw at redhat.com
Mon Dec 10 23:31:11 EST 2007


In preparation for getting rid of the big switches in
lbs_prepare_and_send_command() and the command response function.  It's
a pretty big patch so more eyes are need to see if stuff got screwed up.
I haven't run-tested it yet, will do that first thing in the morning.

Dan

diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index 5e10ce0..a6421b7 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -498,25 +498,22 @@ int lbs_set_universaltable(struct lbs_private *priv, u8 band)
  *  @return 	      0
 */
 int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
-				 struct cmd_ds_command *cmd, u16 cmdno,
-				 u16 cmdoption)
+				 struct cmd_ds_802_11d_domain_info *cmd,
+				 u16 cmdno, u16 cmdoption)
 {
-	struct cmd_ds_802_11d_domain_info *pdomaininfo =
-	    &cmd->params.domaininfo;
-	struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain;
+	struct mrvlietypes_domainparamset *domain = &cmd->domain;
 	u8 nr_subband = priv->domainreg.nr_subband;
 
 	lbs_deb_enter(LBS_DEB_11D);
 
 	lbs_deb_11d("nr_subband=%x\n", nr_subband);
 
-	cmd->command = cpu_to_le16(cmdno);
-	pdomaininfo->action = cpu_to_le16(cmdoption);
+	cmd->hdr.command = cpu_to_le16(cmdno);
+	cmd->action = cpu_to_le16(cmdoption);
 	if (cmdoption == CMD_ACT_GET) {
-		cmd->size =
-		    cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
+		cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 		lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd,
-			le16_to_cpu(cmd->size));
+			le16_to_cpu(cmd->hdr.size));
 		goto done;
 	}
 
@@ -532,16 +529,16 @@ int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
 		memcpy(domain->subband, priv->domainreg.subband,
 		       nr_subband * sizeof(struct ieeetypes_subbandset));
 
-		cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) +
-					     le16_to_cpu(domain->header.len) +
-					     sizeof(struct mrvlietypesheader) +
-					     S_DS_GEN);
+		cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_header) +
+					    sizeof(cmd->action) +
+					    le16_to_cpu(domain->header.len) +
+					    sizeof(struct mrvlietypesheader));
 	} else {
-		cmd->size =
-		    cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
+		cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 	}
 
-	lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, le16_to_cpu(cmd->size));
+	lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd,
+			le16_to_cpu(cmd->hdr.size));
 
 done:
 	lbs_deb_enter(LBS_DEB_11D);
@@ -555,18 +552,17 @@ done:
  *  @return 	   0; -1
  */
 int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
-				 struct cmd_ds_command *resp)
+				struct cmd_ds_802_11d_domain_info *resp)
 {
-	struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
-	struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
-	u16 action = le16_to_cpu(domaininfo->action);
+	struct mrvlietypes_domainparamset *domain = &resp->domain;
+	u16 action = le16_to_cpu(resp->action);
 	s16 ret = 0;
 	u8 nr_subband = 0;
 
 	lbs_deb_enter(LBS_DEB_11D);
 
 	lbs_deb_hex(LBS_DEB_11D, "domain info resp", (u8 *) resp,
-		(int)le16_to_cpu(resp->size));
+		(int)le16_to_cpu(resp->hdr.size));
 
 	nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
 		      sizeof(struct ieeetypes_subbandset);
@@ -581,11 +577,10 @@ int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
 	switch (action) {
 	case CMD_ACT_SET:	/*Proc Set action */
 		break;
-
 	case CMD_ACT_GET:
 		break;
 	default:
-		lbs_deb_11d("Invalid action:%d\n", domaininfo->action);
+		lbs_deb_11d("Invalid action:%d\n", resp->action);
 		ret = -1;
 		break;
 	}
diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h
index 811eea2..d69eddb 100644
--- a/drivers/net/wireless/libertas/11d.h
+++ b/drivers/net/wireless/libertas/11d.h
@@ -7,6 +7,7 @@
 
 #include "types.h"
 #include "defs.h"
+#include "hostcmd.h"
 
 #define UNIVERSAL_REGION_CODE			0xff
 
@@ -14,18 +15,6 @@
  */
 #define MRVDRV_MAX_SUBBAND_802_11D		83
 
-#define COUNTRY_CODE_LEN			3
-#define MAX_NO_OF_CHAN 				40
-
-struct cmd_ds_command;
-
-/** Data structure for Country IE*/
-struct ieeetypes_subbandset {
-	u8 firstchan;
-	u8 nrchan;
-	u8 maxtxpwr;
-} __attribute__ ((packed));
-
 struct ieeetypes_countryinfoset {
 	u8 element_id;
 	u8 len;
@@ -40,17 +29,6 @@ struct ieeetypes_countryinfofullset {
 	struct ieeetypes_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D];
 } __attribute__ ((packed));
 
-struct mrvlietypes_domainparamset {
-	struct mrvlietypesheader header;
-	u8 countrycode[COUNTRY_CODE_LEN];
-	struct ieeetypes_subbandset subband[1];
-} __attribute__ ((packed));
-
-struct cmd_ds_802_11d_domain_info {
-	__le16 action;
-	struct mrvlietypes_domainparamset domain;
-} __attribute__ ((packed));
-
 /** domain regulatory information */
 struct lbs_802_11d_domain_reg {
 	/** country Code*/
@@ -90,11 +68,11 @@ void lbs_init_11d(struct lbs_private *priv);
 int lbs_set_universaltable(struct lbs_private *priv, u8 band);
 
 int lbs_cmd_802_11d_domain_info(struct lbs_private *priv,
-				 struct cmd_ds_command *cmd, u16 cmdno,
-				 u16 cmdOption);
+				 struct cmd_ds_802_11d_domain_info *cmd,
+				 u16 cmdno, u16 cmdOption);
 
 int lbs_ret_802_11d_domain_info(struct lbs_private *priv,
-				 struct cmd_ds_command *resp);
+				struct cmd_ds_802_11d_domain_info *resp);
 
 struct bss_descriptor;
 int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv,
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 63bd692..207e83f 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -151,10 +151,10 @@ static int assoc_helper_mode(struct lbs_private *priv,
 
 	priv->mode = assoc_req->mode;
 	ret = lbs_prepare_and_send_command(priv,
-				    CMD_802_11_SNMP_MIB,
-				    0, CMD_OPTION_WAITFORRSP,
+				    CMD_802_11_SNMP_MIB, CMD_ACT_SET,
+				    CMD_OPTION_WAITFORRSP,
 				    OID_802_11_INFRASTRUCTURE_MODE,
-		/* Shoot me now */  (void *) (size_t) assoc_req->mode);
+				    &assoc_req->mode);
 
 done:
 	lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 2efba57..50619c0 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -36,51 +36,43 @@ static u8 is_command_allowed_in_ps(u16 cmd)
 	return 0;
 }
 
-static int lbs_cmd_hw_spec(struct lbs_private *priv, struct cmd_ds_command *cmd)
+static int lbs_cmd_hw_spec(struct lbs_private *priv,
+                           struct cmd_ds_get_hw_spec *cmd)
 {
-	struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_GET_HW_SPEC);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
-	memcpy(hwspec->permanentaddr, priv->current_addr, ETH_ALEN);
+	cmd->hdr.command = cpu_to_le16(CMD_GET_HW_SPEC);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	memcpy(cmd->permanentaddr, priv->current_addr, ETH_ALEN);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv,
-				   struct cmd_ds_command *cmd,
+				   struct cmd_ds_802_11_ps_mode *cmd,
 				   u16 cmd_action)
 {
-	struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_PS_MODE);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) +
-				S_DS_GEN);
-	psm->action = cpu_to_le16(cmd_action);
-	psm->multipledtim = 0;
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_PS_MODE);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->multipledtim = 0;
+
 	switch (cmd_action) {
 	case CMD_SUBCMD_ENTER_PS:
 		lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
-
-		psm->locallisteninterval = 0;
-		psm->nullpktinterval = 0;
-		psm->multipledtim =
-		    cpu_to_le16(MRVDRV_DEFAULT_MULTIPLE_DTIM);
+		cmd->locallisteninterval = 0;
+		cmd->nullpktinterval = 0;
+		cmd->multipledtim = cpu_to_le16(MRVDRV_DEFAULT_MULTIPLE_DTIM);
 		break;
-
 	case CMD_SUBCMD_EXIT_PS:
 		lbs_deb_cmd("PS command:" "SubCode- Exit PS\n");
 		break;
-
 	case CMD_SUBCMD_SLEEP_CONFIRMED:
 		lbs_deb_cmd("PS command: SubCode- sleep confirm\n");
 		break;
-
 	default:
 		break;
 	}
@@ -90,53 +82,47 @@ static int lbs_cmd_802_11_ps_mode(struct lbs_private *priv,
 }
 
 static int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv,
-					      struct cmd_ds_command *cmd,
-					      u16 cmd_action, void *pdata_buf)
+					     struct cmd_ds_802_11_inactivity_timeout *cmd,
+					     u16 cmd_action, void *pdata_buf)
 {
 	u16 *timeout = pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT);
-	cmd->size =
-	    cpu_to_le16(sizeof(struct cmd_ds_802_11_inactivity_timeout)
-			     + S_DS_GEN);
-
-	cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action);
-
-	if (cmd_action)
-		cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout);
-	else
-		cmd->params.inactivity_timeout.timeout = 0;
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->timeout = cmd_action ? cpu_to_le16(*timeout) : 0;
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_sleep_params(struct lbs_private *priv,
-					struct cmd_ds_command *cmd,
-					u16 cmd_action)
+				       struct cmd_ds_802_11_sleep_params *cmd,
+				       u16 cmd_action)
 {
-	struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
-				S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_802_11_SLEEP_PARAMS);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_SLEEP_PARAMS);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
 	if (cmd_action == CMD_ACT_GET) {
 		memset(&priv->sp, 0, sizeof(struct sleep_params));
-		memset(sp, 0, sizeof(struct cmd_ds_802_11_sleep_params));
-		sp->action = cpu_to_le16(cmd_action);
+		cmd->error = 0;
+		cmd->offset = 0;
+		cmd->stabletime = 0;
+		cmd->calcontrol = 0;
+		cmd->externalsleepclk = 0;
+		cmd->reserved = 0;
 	} else if (cmd_action == CMD_ACT_SET) {
-		sp->action = cpu_to_le16(cmd_action);
-		sp->error = cpu_to_le16(priv->sp.sp_error);
-		sp->offset = cpu_to_le16(priv->sp.sp_offset);
-		sp->stabletime = cpu_to_le16(priv->sp.sp_stabletime);
-		sp->calcontrol = (u8) priv->sp.sp_calcontrol;
-		sp->externalsleepclk = (u8) priv->sp.sp_extsleepclk;
-		sp->reserved = cpu_to_le16(priv->sp.sp_reserved);
+		cmd->error = cpu_to_le16(priv->sp.sp_error);
+		cmd->offset = cpu_to_le16(priv->sp.sp_offset);
+		cmd->stabletime = cpu_to_le16(priv->sp.sp_stabletime);
+		cmd->calcontrol = (u8) priv->sp.sp_calcontrol;
+		cmd->externalsleepclk = (u8) priv->sp.sp_extsleepclk;
+		cmd->reserved = cpu_to_le16(priv->sp.sp_reserved);
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -144,18 +130,17 @@ static int lbs_cmd_802_11_sleep_params(struct lbs_private *priv,
 }
 
 static int lbs_cmd_802_11_set_wep(struct lbs_private *priv,
-                                   struct cmd_ds_command *cmd,
-                                   u32 cmd_act,
-                                   void * pdata_buf)
+				  struct cmd_ds_802_11_set_wep *cmd,
+				  u32 cmd_act, void *pdata_buf)
 {
-	struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep;
+	struct assoc_request *assoc_req = pdata_buf;
 	int ret = 0;
-	struct assoc_request * assoc_req = pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_SET_WEP);
-	cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_SET_WEP);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_act);
 
 	if (cmd_act == CMD_ACT_ADD) {
 		int i;
@@ -166,10 +151,8 @@ static int lbs_cmd_802_11_set_wep(struct lbs_private *priv,
 			goto done;
 		}
 
-		wep->action = cpu_to_le16(CMD_ACT_ADD);
-
 		/* default tx key index */
-		wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
+		cmd->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
 						  (u32)CMD_WEP_KEY_INDEX_MASK));
 
 		/* Copy key types and material to host command structure */
@@ -178,14 +161,14 @@ static int lbs_cmd_802_11_set_wep(struct lbs_private *priv,
 
 			switch (pkey->len) {
 			case KEY_LEN_WEP_40:
-				wep->keytype[i] = CMD_TYPE_WEP_40_BIT;
-				memmove(&wep->keymaterial[i], pkey->key,
+				cmd->keytype[i] = CMD_TYPE_WEP_40_BIT;
+				memmove(&cmd->keymaterial[i], pkey->key,
 				        pkey->len);
 				lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
 				break;
 			case KEY_LEN_WEP_104:
-				wep->keytype[i] = CMD_TYPE_WEP_104_BIT;
-				memmove(&wep->keymaterial[i], pkey->key,
+				cmd->keytype[i] = CMD_TYPE_WEP_104_BIT;
+				memmove(&cmd->keymaterial[i], pkey->key,
 				        pkey->len);
 				lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);
 				break;
@@ -201,40 +184,38 @@ static int lbs_cmd_802_11_set_wep(struct lbs_private *priv,
 		}
 	} else if (cmd_act == CMD_ACT_REMOVE) {
 		/* ACT_REMOVE clears _all_ WEP keys */
-		wep->action = cpu_to_le16(CMD_ACT_REMOVE);
 
 		/* default tx key index */
-		wep->keyindex = cpu_to_le16((u16)(priv->wep_tx_keyidx &
+		cmd->keyindex = cpu_to_le16((u16)(priv->wep_tx_keyidx &
 						  (u32)CMD_WEP_KEY_INDEX_MASK));
 		lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx);
+	} else {
+		lbs_deb_cmd("SET_WEP: unknown action %d\n", cmd_act);
+		ret = -1;
 	}
 
-	ret = 0;
-
 done:
 	lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
 	return ret;
 }
 
 static int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv,
-				      struct cmd_ds_command *cmd,
-				      u16 cmd_action,
-				      void * pdata_buf)
+				     struct cmd_ds_802_11_enable_rsn *cmd,
+				     u16 cmd_action, void *pdata_buf)
 {
-	struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn;
-	u32 * enable = pdata_buf;
+	u32 *enable = (u32 *) pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_ENABLE_RSN);
-	cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN);
-	penableRSN->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_ENABLE_RSN);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
 	if (cmd_action == CMD_ACT_SET) {
 		if (*enable)
-			penableRSN->enable = cpu_to_le16(CMD_ENABLE_RSN);
+			cmd->enable = cpu_to_le16(CMD_ENABLE_RSN);
 		else
-			penableRSN->enable = cpu_to_le16(CMD_DISABLE_RSN);
+			cmd->enable = cpu_to_le16(CMD_DISABLE_RSN);
 		lbs_deb_cmd("ENABLE_RSN: %d\n", *enable);
 	}
 
@@ -262,8 +243,8 @@ static ssize_t lbs_tlv_size(const u8 *tlv, u16 size)
 
 
 static void lbs_cmd_802_11_subscribe_event(struct lbs_private *priv,
-	struct cmd_ds_command *cmd, u16 cmd_action,
-	void *pdata_buf)
+					   struct cmd_ds_802_11_subscribe_event *cmd,
+					   u16 cmd_action, void *pdata_buf)
 {
 	struct cmd_ds_802_11_subscribe_event *events =
 		(struct cmd_ds_802_11_subscribe_event *) pdata_buf;
@@ -273,17 +254,17 @@ static void lbs_cmd_802_11_subscribe_event(struct lbs_private *priv,
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->size = cpu_to_le16(sizeof(*events)
-			- sizeof(events->tlv)
-			+ S_DS_GEN);
-	cmd->params.subscribe_event.action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_SUBSCRIBE_EVENT);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd) - sizeof(cmd->tlv));
+	cmd->action = cpu_to_le16(cmd_action);
+
 	if (cmd_action == CMD_ACT_GET) {
-		cmd->params.subscribe_event.events = 0;
+		cmd->events = 0;
 	} else {
 		ssize_t sz = lbs_tlv_size(events->tlv, sizeof(events->tlv));
-		cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + sz);
-		cmd->params.subscribe_event.events = events->events;
-		memcpy(cmd->params.subscribe_event.tlv, events->tlv, sz);
+		cmd->hdr.size = cpu_to_le16(le16_to_cpu(cmd->hdr.size) + sz);
+		cmd->events = events->events;
+		memcpy(cmd->tlv, events->tlv, sz);
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -316,45 +297,42 @@ static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset,
 }
 
 static int lbs_cmd_802_11_key_material(struct lbs_private *priv,
-					struct cmd_ds_command *cmd,
-					u16 cmd_action,
-					u32 cmd_oid, void *pdata_buf)
+				       struct cmd_ds_802_11_key_material *cmd,
+				       u16 cmd_action,
+				       u32 cmd_oid, void *pdata_buf)
 {
-	struct cmd_ds_802_11_key_material *pkeymaterial =
-	    &cmd->params.keymaterial;
 	struct assoc_request * assoc_req = pdata_buf;
-	int ret = 0;
-	int index = 0;
+	int ret = -1;
+	int idx = 0;
+	size_t sz;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_KEY_MATERIAL);
-	pkeymaterial->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_KEY_MATERIAL);
+	cmd->action = cpu_to_le16(cmd_action);
 
 	if (cmd_action == CMD_ACT_GET) {
-		cmd->size = cpu_to_le16(S_DS_GEN + sizeof (pkeymaterial->action));
+		cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 		ret = 0;
 		goto done;
 	}
 
-	memset(&pkeymaterial->keyParamSet, 0, sizeof(pkeymaterial->keyParamSet));
+	memset(&cmd->keyParamSet, 0, sizeof(cmd->keyParamSet));
 
 	if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
-		set_one_wpa_key(&pkeymaterial->keyParamSet[index],
+		set_one_wpa_key(&cmd->keyParamSet[idx],
 		                &assoc_req->wpa_unicast_key);
-		index++;
+		idx++;
 	}
 
 	if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) {
-		set_one_wpa_key(&pkeymaterial->keyParamSet[index],
+		set_one_wpa_key(&cmd->keyParamSet[idx],
 		                &assoc_req->wpa_mcast_key);
-		index++;
+		idx++;
 	}
 
-	cmd->size = cpu_to_le16(  S_DS_GEN
-	                        + sizeof (pkeymaterial->action)
-	                        + (index * sizeof(struct MrvlIEtype_keyParamSet)));
-
+	sz = idx * sizeof(struct MrvlIEtype_keyParamSet);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd) + sz);
 	ret = 0;
 
 done:
@@ -363,240 +341,178 @@ done:
 }
 
 static int lbs_cmd_802_11_reset(struct lbs_private *priv,
-				 struct cmd_ds_command *cmd, int cmd_action)
+				struct cmd_ds_802_11_reset *cmd,
+				int cmd_action)
 {
-	struct cmd_ds_802_11_reset *reset = &cmd->params.reset;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_RESET);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN);
-	reset->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RESET);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_get_log(struct lbs_private *priv,
-				   struct cmd_ds_command *cmd)
+				  struct cmd_ds_802_11_get_log *cmd)
 {
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->command = cpu_to_le16(CMD_802_11_GET_LOG);
-	cmd->size =
-		cpu_to_le16(sizeof(struct cmd_ds_802_11_get_log) + S_DS_GEN);
+
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_GET_LOG);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_get_stat(struct lbs_private *priv,
-				    struct cmd_ds_command *cmd)
+				   struct cmd_ds_802_11_get_stat *cmd)
 {
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->command = cpu_to_le16(CMD_802_11_GET_STAT);
-	cmd->size =
-	    cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
+
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_GET_STAT);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
-				    struct cmd_ds_command *cmd,
+				    struct cmd_ds_802_11_snmp_mib *cmd,
 				    int cmd_action,
 				    int cmd_oid, void *pdata_buf)
 {
-	struct cmd_ds_802_11_snmp_mib *pSNMPMIB = &cmd->params.smib;
-	u8 ucTemp;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
 	lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
 
-	cmd->command = cpu_to_le16(CMD_802_11_SNMP_MIB);
-	cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_SNMP_MIB);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->querytype = cpu_to_le16(cmd_action);
 
 	switch (cmd_oid) {
-	case OID_802_11_INFRASTRUCTURE_MODE:
-	{
-		u8 mode = (u8) (size_t) pdata_buf;
-		pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
-		pSNMPMIB->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I);
-		pSNMPMIB->bufsize = cpu_to_le16(sizeof(u8));
-		if (mode == IW_MODE_ADHOC) {
-			ucTemp = SNMP_MIB_VALUE_ADHOC;
-		} else {
-			/* Infra and Auto modes */
-			ucTemp = SNMP_MIB_VALUE_INFRA;
-		}
-
-		memmove(pSNMPMIB->value, &ucTemp, sizeof(u8));
-
+	case OID_802_11_INFRASTRUCTURE_MODE: {
+		u8 *mode = (u8 *) pdata_buf;
+		cmd->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I);
+		cmd->bufsize = cpu_to_le16(sizeof(u8));
+		if (*mode == IW_MODE_ADHOC)
+			cmd->value = cpu_to_le16(SNMP_MIB_VALUE_ADHOC);
+		else
+			cmd->value = cpu_to_le16(SNMP_MIB_VALUE_INFRA);
 		break;
 	}
-
-	case OID_802_11D_ENABLE:
-		{
-			u32 ulTemp;
-
-			pSNMPMIB->oid = cpu_to_le16((u16) DOT11D_I);
-
-			if (cmd_action == CMD_ACT_SET) {
-				pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
-				pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
-				ulTemp = *(u32 *)pdata_buf;
-				*((__le16 *)(pSNMPMIB->value)) =
-				    cpu_to_le16((u16) ulTemp);
-			}
-			break;
+	case OID_802_11D_ENABLE: {
+		cmd->oid = cpu_to_le16((u16) DOT11D_I);
+		if (cmd_action == CMD_ACT_SET) {
+			cmd->bufsize = cpu_to_le16(sizeof(u16));
+			cmd->value = cpu_to_le16(*((u16 *) pdata_buf));
 		}
-
-	case OID_802_11_FRAGMENTATION_THRESHOLD:
-		{
-			u32 ulTemp;
-
-			pSNMPMIB->oid = cpu_to_le16((u16) FRAGTHRESH_I);
-
-			if (cmd_action == CMD_ACT_GET) {
-				pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
-			} else if (cmd_action == CMD_ACT_SET) {
-				pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
-				pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
-				ulTemp = *((u32 *) pdata_buf);
-				*((__le16 *)(pSNMPMIB->value)) =
-				    cpu_to_le16((u16) ulTemp);
-
-			}
-
-			break;
+		break;
+	}
+	case OID_802_11_FRAGMENTATION_THRESHOLD: {
+		cmd->oid = cpu_to_le16((u16) FRAGTHRESH_I);
+		if (cmd_action == CMD_ACT_SET) {
+			cmd->bufsize = cpu_to_le16(sizeof(u16));
+			cmd->value = cpu_to_le16(*((u16 *) pdata_buf));
 		}
-
-	case OID_802_11_RTS_THRESHOLD:
-		{
-
-			u32 ulTemp;
-			pSNMPMIB->oid = cpu_to_le16(RTSTHRESH_I);
-
-			if (cmd_action == CMD_ACT_GET) {
-				pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
-			} else if (cmd_action == CMD_ACT_SET) {
-				pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
-				pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
-				ulTemp = *((u32 *)pdata_buf);
-				*(__le16 *)(pSNMPMIB->value) =
-				    cpu_to_le16((u16) ulTemp);
-
-			}
-			break;
+		break;
+	}
+	case OID_802_11_RTS_THRESHOLD: {
+		cmd->oid = cpu_to_le16(RTSTHRESH_I);
+		if (cmd_action == CMD_ACT_SET) {
+			cmd->bufsize = cpu_to_le16(sizeof(u16));
+			cmd->value = cpu_to_le16(*((u16 *) pdata_buf));
 		}
-	case OID_802_11_TX_RETRYCOUNT:
-		pSNMPMIB->oid = cpu_to_le16((u16) SHORT_RETRYLIM_I);
-
-		if (cmd_action == CMD_ACT_GET) {
-			pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
-		} else if (cmd_action == CMD_ACT_SET) {
-			pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
-			pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
-			*((__le16 *)(pSNMPMIB->value)) =
-			    cpu_to_le16((u16) priv->txretrycount);
+		break;
+	}
+	case OID_802_11_TX_RETRYCOUNT: {
+		cmd->oid = cpu_to_le16((u16) SHORT_RETRYLIM_I);
+		if (cmd_action == CMD_ACT_SET) {
+			cmd->bufsize = cpu_to_le16(sizeof(u16));
+			cmd->value = cpu_to_le16(*((u16 *) pdata_buf));
 		}
-
 		break;
+	}
 	default:
 		break;
 	}
 
 	lbs_deb_cmd(
 	       "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
-	       le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
-	       le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result));
+	       le16_to_cpu(cmd->hdr.command), le16_to_cpu(cmd->hdr.size),
+	       le16_to_cpu(cmd->hdr.seqnum), le16_to_cpu(cmd->hdr.result));
 
 	lbs_deb_cmd(
 	       "SNMP_CMD: action 0x%x, oid 0x%x, oidsize 0x%x, value 0x%x\n",
-	       le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid),
-	       le16_to_cpu(pSNMPMIB->bufsize),
-	       le16_to_cpu(*(__le16 *) pSNMPMIB->value));
+	       le16_to_cpu(cmd->querytype), le16_to_cpu(cmd->oid),
+	       le16_to_cpu(cmd->bufsize), le16_to_cpu(cmd->value));
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_radio_control(struct lbs_private *priv,
-					 struct cmd_ds_command *cmd,
-					 int cmd_action)
+					struct cmd_ds_802_11_radio_control *cmd,
+					int cmd_action)
 {
-	struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->size =
-	    cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) +
-			     S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_802_11_RADIO_CONTROL);
-
-	pradiocontrol->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RADIO_CONTROL);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
 	switch (priv->preamble) {
 	case CMD_TYPE_SHORT_PREAMBLE:
-		pradiocontrol->control = cpu_to_le16(SET_SHORT_PREAMBLE);
+		cmd->control = cpu_to_le16(SET_SHORT_PREAMBLE);
 		break;
-
 	case CMD_TYPE_LONG_PREAMBLE:
-		pradiocontrol->control = cpu_to_le16(SET_LONG_PREAMBLE);
+		cmd->control = cpu_to_le16(SET_LONG_PREAMBLE);
 		break;
-
 	case CMD_TYPE_AUTO_PREAMBLE:
 	default:
-		pradiocontrol->control = cpu_to_le16(SET_AUTO_PREAMBLE);
+		cmd->control = cpu_to_le16(SET_AUTO_PREAMBLE);
 		break;
 	}
 
 	if (priv->radioon)
-		pradiocontrol->control |= cpu_to_le16(TURN_ON_RF);
+		cmd->control |= cpu_to_le16(TURN_ON_RF);
 	else
-		pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF);
+		cmd->control &= cpu_to_le16(~TURN_ON_RF);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
-				       struct cmd_ds_command *cmd,
-				       u16 cmd_action, void *pdata_buf)
+				      struct cmd_ds_802_11_rf_tx_power *cmd,
+				      u16 cmd_action, void *pdata_buf)
 {
-
-	struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->size =
-	    cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_802_11_RF_TX_POWER);
-	prtp->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RF_TX_POWER);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
 	lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n",
-		    le16_to_cpu(cmd->size), le16_to_cpu(cmd->command),
-		    le16_to_cpu(prtp->action));
+		    le16_to_cpu(cmd->hdr.size), le16_to_cpu(cmd->hdr.command),
+		    le16_to_cpu(cmd->action));
 
 	switch (cmd_action) {
 	case CMD_ACT_TX_POWER_OPT_GET:
-		prtp->action = cpu_to_le16(CMD_ACT_GET);
-		prtp->currentlevel = 0;
+		cmd->action = cpu_to_le16(CMD_ACT_GET);
+		cmd->currentlevel = 0;
 		break;
-
 	case CMD_ACT_TX_POWER_OPT_SET_HIGH:
-		prtp->action = cpu_to_le16(CMD_ACT_SET);
-		prtp->currentlevel = cpu_to_le16(CMD_ACT_TX_POWER_INDEX_HIGH);
+		cmd->action = cpu_to_le16(CMD_ACT_SET);
+		cmd->currentlevel = cpu_to_le16(CMD_ACT_TX_POWER_INDEX_HIGH);
 		break;
-
 	case CMD_ACT_TX_POWER_OPT_SET_MID:
-		prtp->action = cpu_to_le16(CMD_ACT_SET);
-		prtp->currentlevel = cpu_to_le16(CMD_ACT_TX_POWER_INDEX_MID);
+		cmd->action = cpu_to_le16(CMD_ACT_SET);
+		cmd->currentlevel = cpu_to_le16(CMD_ACT_TX_POWER_INDEX_MID);
 		break;
-
 	case CMD_ACT_TX_POWER_OPT_SET_LOW:
-		prtp->action = cpu_to_le16(CMD_ACT_SET);
-		prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf));
+		cmd->action = cpu_to_le16(CMD_ACT_SET);
+		cmd->currentlevel = cpu_to_le16(*((u16 *) pdata_buf));
 		break;
 	}
 
@@ -605,64 +521,55 @@ static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
 }
 
 static int lbs_cmd_802_11_monitor_mode(struct lbs_private *priv,
-				      struct cmd_ds_command *cmd,
-				      u16 cmd_action, void *pdata_buf)
+				       struct cmd_ds_802_11_monitor_mode *cmd,
+				       u16 cmd_action, void *pdata_buf)
 {
-	struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor;
+	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_MONITOR_MODE);
-	cmd->size =
-	    cpu_to_le16(sizeof(struct cmd_ds_802_11_monitor_mode) +
-			     S_DS_GEN);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_MONITOR_MODE);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
-	monitor->action = cpu_to_le16(cmd_action);
-	if (cmd_action == CMD_ACT_SET) {
-		monitor->mode =
-		    cpu_to_le16((u16) (*(u32 *) pdata_buf));
-	}
+	if (cmd_action == CMD_ACT_SET)
+		cmd->mode = cpu_to_le16(*(u16 *) pdata_buf);
 
+	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv,
-					      struct cmd_ds_command *cmd,
-					      u16 cmd_action)
+					     struct cmd_ds_802_11_rate_adapt_rateset *cmd,
+					     u16 cmd_action)
 {
-	struct cmd_ds_802_11_rate_adapt_rateset
-	*rateadapt = &cmd->params.rateset;
-
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->size =
-	    cpu_to_le16(sizeof(struct cmd_ds_802_11_rate_adapt_rateset)
-			     + S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_802_11_RATE_ADAPT_RATESET);
 
-	rateadapt->action = cpu_to_le16(cmd_action);
-	rateadapt->enablehwauto = cpu_to_le16(priv->enablehwauto);
-	rateadapt->bitmap = cpu_to_le16(priv->ratebitmap);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RATE_ADAPT_RATESET);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->enablehwauto = cpu_to_le16(priv->enablehwauto);
+	cmd->bitmap = cpu_to_le16(priv->ratebitmap);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_data_rate(struct lbs_private *priv,
-				     struct cmd_ds_command *cmd,
-				     u16 cmd_action)
+				    struct cmd_ds_802_11_data_rate *cmd,
+				    u16 cmd_action)
 {
-	struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
-			     S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_802_11_DATA_RATE);
-	memset(pdatarate, 0, sizeof(struct cmd_ds_802_11_data_rate));
-	pdatarate->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_DATA_RATE);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->reserved = 0;
+	memset(cmd->rates, 0, sizeof(cmd->rates));
 
 	if (cmd_action == CMD_ACT_SET_TX_FIX_RATE) {
-		pdatarate->rates[0] = lbs_data_rate_to_fw_index(priv->cur_rate);
-		lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n",
-		       priv->cur_rate);
+		cmd->rates[0] = lbs_data_rate_to_fw_index(priv->cur_rate);
+		lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", priv->cur_rate);
 	} else if (cmd_action == CMD_ACT_SET_TX_AUTO) {
 		lbs_deb_cmd("DATA_RATE: setting auto\n");
 	}
@@ -671,22 +578,20 @@ static int lbs_cmd_802_11_data_rate(struct lbs_private *priv,
 	return 0;
 }
 
-static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv,
-				      struct cmd_ds_command *cmd,
+static int lbs_cmd_mac_multicast_addr(struct lbs_private *priv,
+				      struct cmd_ds_mac_multicast_addr *cmd,
 				      u16 cmd_action)
 {
-	struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr;
-
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
-			     S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_MAC_MULTICAST_ADR);
-
-	lbs_deb_cmd("MULTICAST_ADR: setting %d addresses\n", pMCastAdr->nr_of_adrs);
-	pMCastAdr->action = cpu_to_le16(cmd_action);
-	pMCastAdr->nr_of_adrs =
-	    cpu_to_le16((u16) priv->nr_of_multicastmacaddr);
-	memcpy(pMCastAdr->maclist, priv->multicastlist,
+
+	cmd->hdr.command = cpu_to_le16(CMD_MAC_MULTICAST_ADDR);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+
+	lbs_deb_cmd("MULTICAST_ADR: setting %d addresses\n", cmd->num_addrs);
+
+	cmd->num_addrs = cpu_to_le16((u16) priv->nr_of_multicastmacaddr);
+	memcpy(cmd->maclist, priv->multicastlist,
 	       priv->nr_of_multicastmacaddr * ETH_ALEN);
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -694,34 +599,30 @@ static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv,
 }
 
 static int lbs_cmd_802_11_rf_channel(struct lbs_private *priv,
-				      struct cmd_ds_command *cmd,
-				      int option, void *pdata_buf)
+				     struct cmd_ds_802_11_rf_channel *cmd,
+				     int option, void *pdata_buf)
 {
-	struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel;
-
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->command = cpu_to_le16(CMD_802_11_RF_CHANNEL);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) +
-				S_DS_GEN);
 
-	if (option == CMD_OPT_802_11_RF_CHANNEL_SET) {
-		rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf));
-	}
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RF_CHANNEL);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(option);
 
-	rfchan->action = cpu_to_le16(option);
+	if (option == CMD_OPT_802_11_RF_CHANNEL_SET)
+		cmd->currentchannel = cpu_to_le16(*((u16 *) pdata_buf));
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_rssi(struct lbs_private *priv,
-				struct cmd_ds_command *cmd)
+			       struct cmd_ds_802_11_rssi *cmd)
 {
-
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->command = cpu_to_le16(CMD_802_11_RSSI);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
-	cmd->params.rssi.N = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR);
+
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RSSI);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->N = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR);
 
 	/* reset Beacon SNR/NF/RSSI values */
 	priv->SNR[TYPE_BEACON][TYPE_NOAVG] = 0;
@@ -735,98 +636,74 @@ static int lbs_cmd_802_11_rssi(struct lbs_private *priv,
 	return 0;
 }
 
-static int lbs_cmd_reg_access(struct lbs_private *priv,
-			       struct cmd_ds_command *cmdptr,
-			       u8 cmd_action, void *pdata_buf)
+static int lbs_cmd_mac_reg_access(struct lbs_private *priv,
+			          struct cmd_ds_mac_reg_access *cmd,
+			          u8 cmd_action, void *pdata_buf)
 {
-	struct lbs_offset_value *offval;
+	struct lbs_offset_value *offval = (struct lbs_offset_value *) pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	offval = (struct lbs_offset_value *)pdata_buf;
+	cmd->hdr.command = cpu_to_le16(CMD_MAC_REG_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof (*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->offset = cpu_to_le16((u16) offval->offset);
+	cmd->value = cpu_to_le32(offval->value);
 
-	switch (le16_to_cpu(cmdptr->command)) {
-	case CMD_MAC_REG_ACCESS:
-		{
-			struct cmd_ds_mac_reg_access *macreg;
+	lbs_deb_leave(LBS_DEB_CMD);
+	return 0;
+}
 
-			cmdptr->size =
-			    cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access)
-					+ S_DS_GEN);
-			macreg =
-			    (struct cmd_ds_mac_reg_access *)&cmdptr->params.
-			    macreg;
+static int lbs_cmd_bbp_reg_access(struct lbs_private *priv,
+			          struct cmd_ds_bbp_reg_access *cmd,
+			          u8 cmd_action, void *pdata_buf)
+{
+	struct lbs_offset_value *offval = (struct lbs_offset_value *) pdata_buf;
 
-			macreg->action = cpu_to_le16(cmd_action);
-			macreg->offset = cpu_to_le16((u16) offval->offset);
-			macreg->value = cpu_to_le32(offval->value);
+	lbs_deb_enter(LBS_DEB_CMD);
 
-			break;
-		}
+	cmd->hdr.command = cpu_to_le16(CMD_BBP_REG_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof (*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->offset = cpu_to_le16((u16) offval->offset);
+	cmd->value = (u8) offval->value;
 
-	case CMD_BBP_REG_ACCESS:
-		{
-			struct cmd_ds_bbp_reg_access *bbpreg;
-
-			cmdptr->size =
-			    cpu_to_le16(sizeof
-					     (struct cmd_ds_bbp_reg_access)
-					     + S_DS_GEN);
-			bbpreg =
-			    (struct cmd_ds_bbp_reg_access *)&cmdptr->params.
-			    bbpreg;
-
-			bbpreg->action = cpu_to_le16(cmd_action);
-			bbpreg->offset = cpu_to_le16((u16) offval->offset);
-			bbpreg->value = (u8) offval->value;
-
-			break;
-		}
+	lbs_deb_leave(LBS_DEB_CMD);
+	return 0;
+}
 
-	case CMD_RF_REG_ACCESS:
-		{
-			struct cmd_ds_rf_reg_access *rfreg;
-
-			cmdptr->size =
-			    cpu_to_le16(sizeof
-					     (struct cmd_ds_rf_reg_access) +
-					     S_DS_GEN);
-			rfreg =
-			    (struct cmd_ds_rf_reg_access *)&cmdptr->params.
-			    rfreg;
-
-			rfreg->action = cpu_to_le16(cmd_action);
-			rfreg->offset = cpu_to_le16((u16) offval->offset);
-			rfreg->value = (u8) offval->value;
-
-			break;
-		}
+static int lbs_cmd_rf_reg_access(struct lbs_private *priv,
+			         struct cmd_ds_rf_reg_access *cmd,
+			         u8 cmd_action, void *pdata_buf)
+{
+	struct lbs_offset_value *offval = (struct lbs_offset_value *) pdata_buf;
 
-	default:
-		break;
-	}
+	lbs_deb_enter(LBS_DEB_CMD);
+
+	cmd->hdr.command = cpu_to_le16(CMD_RF_REG_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof (*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->offset = cpu_to_le16((u16) offval->offset);
+	cmd->value = (u8) offval->value;
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_802_11_mac_address(struct lbs_private *priv,
-				       struct cmd_ds_command *cmd,
-				       u16 cmd_action)
+				      struct cmd_ds_802_11_mac_address *cmd,
+				      u16 cmd_action)
 {
-
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
-			     S_DS_GEN);
-	cmd->result = 0;
 
-	cmd->params.macadd.action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_MAC_ADDRESS);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
 	if (cmd_action == CMD_ACT_SET) {
-		memcpy(cmd->params.macadd.macadd,
-		       priv->current_addr, ETH_ALEN);
-		lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr", priv->current_addr, 6);
+		memcpy(cmd->macadd, priv->current_addr, ETH_ALEN);
+		lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr",
+		            priv->current_addr, ETH_ALEN);
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -834,125 +711,122 @@ static int lbs_cmd_802_11_mac_address(struct lbs_private *priv,
 }
 
 static int lbs_cmd_802_11_eeprom_access(struct lbs_private *priv,
-					 struct cmd_ds_command *cmd,
-					 int cmd_action, void *pdata_buf)
+					struct cmd_ds_802_11_eeprom_access *cmd,
+					int cmd_action, void *pdata_buf)
 {
-	struct lbs_ioctl_regrdwr *ea = pdata_buf;
+	struct lbs_ioctl_regrdwr *ea = (struct lbs_ioctl_regrdwr *) pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_802_11_EEPROM_ACCESS);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) +
-				S_DS_GEN);
-	cmd->result = 0;
-
-	cmd->params.rdeeprom.action = cpu_to_le16(ea->action);
-	cmd->params.rdeeprom.offset = cpu_to_le16(ea->offset);
-	cmd->params.rdeeprom.bytecount = cpu_to_le16(ea->NOB);
-	cmd->params.rdeeprom.value = 0;
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_EEPROM_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(ea->action);
+	cmd->offset = cpu_to_le16(ea->offset);
+	cmd->bytecount = cpu_to_le16(ea->NOB);
+	cmd->value = 0;
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_bt_access(struct lbs_private *priv,
-			       struct cmd_ds_command *cmd,
+			       struct cmd_ds_bt_access *cmd,
 			       u16 cmd_action, void *pdata_buf)
 {
-	struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
 	lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
 
-	cmd->command = cpu_to_le16(CMD_BT_ACCESS);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN);
-	cmd->result = 0;
-	bt_access->action = cpu_to_le16(cmd_action);
+	cmd->hdr.command = cpu_to_le16(CMD_BT_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
 
 	switch (cmd_action) {
 	case CMD_ACT_BT_ACCESS_ADD:
-		memcpy(bt_access->addr1, pdata_buf, 2 * ETH_ALEN);
-		lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", bt_access->addr1, 6);
+		memcpy(cmd->addr1, pdata_buf, 2 * ETH_ALEN);
+		lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr",
+		            cmd->addr1, ETH_ALEN);
 		break;
 	case CMD_ACT_BT_ACCESS_DEL:
-		memcpy(bt_access->addr1, pdata_buf, 1 * ETH_ALEN);
-		lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", bt_access->addr1, 6);
+		memcpy(cmd->addr1, pdata_buf, 1 * ETH_ALEN);
+		lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr",
+		            cmd->addr1, ETH_ALEN);
 		break;
 	case CMD_ACT_BT_ACCESS_LIST:
-		bt_access->id = cpu_to_le32(*(u32 *) pdata_buf);
+		cmd->id = cpu_to_le32(*(u32 *) pdata_buf);
 		break;
 	case CMD_ACT_BT_ACCESS_RESET:
 		break;
 	case CMD_ACT_BT_ACCESS_SET_INVERT:
-		bt_access->id = cpu_to_le32(*(u32 *) pdata_buf);
+		cmd->id = cpu_to_le32(*(u32 *) pdata_buf);
 		break;
 	case CMD_ACT_BT_ACCESS_GET_INVERT:
 		break;
 	default:
 		break;
 	}
+
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_fwt_access(struct lbs_private *priv,
-			       struct cmd_ds_command *cmd,
-			       u16 cmd_action, void *pdata_buf)
+			      struct cmd_ds_fwt_access *cmd,
+			      u16 cmd_action, void *pdata_buf)
 {
-	struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
 	lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
 
-	cmd->command = cpu_to_le16(CMD_FWT_ACCESS);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN);
-	cmd->result = 0;
+	cmd->hdr.command = cpu_to_le16(CMD_FWT_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
-	if (pdata_buf)
-		memcpy(fwt_access, pdata_buf, sizeof(*fwt_access));
-	else
-		memset(fwt_access, 0, sizeof(*fwt_access));
+	/* ICK */
+	if (pdata_buf) {
+		memcpy((u8 *) (cmd + sizeof(struct cmd_header)),
+		       pdata_buf, (sizeof(*cmd) - sizeof (struct cmd_header)));
+	} else {
+		memset((u8 *) (cmd + sizeof(struct cmd_header)),
+		       0, (sizeof(*cmd) - sizeof (struct cmd_header)));
+	}
 
-	fwt_access->action = cpu_to_le16(cmd_action);
+	cmd->action = cpu_to_le16(cmd_action);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_mesh_access(struct lbs_private *priv,
-				struct cmd_ds_command *cmd,
-				u16 cmd_action, void *pdata_buf)
+			       struct cmd_ds_mesh_access *cmd,
+			       u16 cmd_action, void *pdata_buf)
 {
-	struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
 	lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
 
-	cmd->command = cpu_to_le16(CMD_MESH_ACCESS);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
-	cmd->result = 0;
+	cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
-	if (pdata_buf)
-		memcpy(mesh_access, pdata_buf, sizeof(*mesh_access));
-	else
-		memset(mesh_access, 0, sizeof(*mesh_access));
+	/* ICK */
+	if (pdata_buf) {
+		memcpy((u8 *) (cmd + sizeof(struct cmd_header)),
+		       pdata_buf, (sizeof(*cmd) - sizeof (struct cmd_header)));
+	} else {
+		memset((u8 *) (cmd + sizeof(struct cmd_header)),
+		       0, (sizeof(*cmd) - sizeof (struct cmd_header)));
+	}
 
-	mesh_access->action = cpu_to_le16(cmd_action);
+	cmd->action = cpu_to_le16(cmd_action);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
-				struct cmd_ds_command *cmd,
-				u16 cmd_action)
+			    struct cmd_ds_802_11_beacon_control *cmd,
+			    u16 cmd_action)
 {
-	struct cmd_ds_802_11_beacon_control
-		*bcn_ctrl = &cmd->params.bcn_ctrl;
-
 	lbs_deb_enter(LBS_DEB_CMD);
-	cmd->size =
-	    cpu_to_le16(sizeof(struct cmd_ds_802_11_beacon_control)
-			     + S_DS_GEN);
-	cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL);
 
-	bcn_ctrl->action = cpu_to_le16(cmd_action);
-	bcn_ctrl->beacon_enable = cpu_to_le16(priv->beacon_enable);
-	bcn_ctrl->beacon_period = cpu_to_le16(priv->beacon_period);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_BEACON_CTRL);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(cmd_action);
+	cmd->beacon_enable = cpu_to_le16(priv->beacon_enable);
+	cmd->beacon_period = cpu_to_le16(priv->beacon_period);
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
@@ -962,12 +836,11 @@ static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
  * Note: NEVER use lbs_queue_cmd() with addtail==0 other than for
  * the command timer, because it does not account for queued commands.
  */
-void lbs_queue_cmd(struct lbs_private *priv,
-	struct cmd_ctrl_node *cmdnode,
-	u8 addtail)
+void lbs_queue_cmd(struct lbs_private *priv, struct cmd_ctrl_node *cmdnode,
+		   u8 addtail)
 {
 	unsigned long flags;
-	struct cmd_ds_command *cmdptr;
+	struct cmd_header *cmd;
 
 	lbs_deb_enter(LBS_DEB_HOST);
 
@@ -976,15 +849,17 @@ void lbs_queue_cmd(struct lbs_private *priv,
 		goto done;
 	}
 
-	cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
-	if (!cmdptr) {
+	cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
+	if (!cmd) {
 		lbs_deb_host("QUEUE_CMD: cmdptr is NULL\n");
 		goto done;
 	}
 
 	/* Exit_PS command needs to be queued in the header always. */
-	if (le16_to_cpu(cmdptr->command) == CMD_802_11_PS_MODE) {
-		struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode;
+	if (le16_to_cpu(cmd->command) == CMD_802_11_PS_MODE) {
+		struct cmd_ds_802_11_ps_mode *psm = 
+			(struct cmd_ds_802_11_ps_mode *) cmd;
+
 		if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) {
 			if (priv->psstate != PS_STATE_FULL_POWER)
 				addtail = 0;
@@ -1001,7 +876,7 @@ void lbs_queue_cmd(struct lbs_private *priv,
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
 
 	lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n",
-	       le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command));
+	       le16_to_cpu(cmd->command));
 
 done:
 	lbs_deb_leave(LBS_DEB_HOST);
@@ -1018,7 +893,7 @@ static int DownloadcommandToStation(struct lbs_private *priv,
 				    struct cmd_ctrl_node *cmdnode)
 {
 	unsigned long flags;
-	struct cmd_ds_command *cmdptr;
+	struct cmd_header *cmd;
 	int ret = -1;
 	u16 cmdsize;
 	u16 command;
@@ -1030,10 +905,10 @@ static int DownloadcommandToStation(struct lbs_private *priv,
 		goto done;
 	}
 
-	cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
+	cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
 
 	spin_lock_irqsave(&priv->driver_lock, flags);
-	if (!cmdptr || !cmdptr->size) {
+	if (!cmd || !cmd->size) {
 		lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
 		__lbs_cleanup_and_insert_cmd(priv, cmdnode);
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
@@ -1044,8 +919,8 @@ static int DownloadcommandToStation(struct lbs_private *priv,
 	priv->cur_cmd_retcode = 0;
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
 
-	cmdsize = le16_to_cpu(cmdptr->size);
-	command = le16_to_cpu(cmdptr->command);
+	cmdsize = le16_to_cpu(cmd->size);
+	command = le16_to_cpu(cmd->command);
 
 	lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n",
 		    command, cmdsize, jiffies);
@@ -1053,7 +928,7 @@ static int DownloadcommandToStation(struct lbs_private *priv,
 
 	cmdnode->cmdwaitqwoken = 0;
 
-	ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
+	ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);
 
 	if (ret != 0) {
 		lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n");
@@ -1082,18 +957,16 @@ done:
 }
 
 static int lbs_cmd_mac_control(struct lbs_private *priv,
-				struct cmd_ds_command *cmd)
+			       struct cmd_ds_mac_control *cmd)
 {
-	struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	cmd->command = cpu_to_le16(CMD_MAC_CONTROL);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
-	mac->action = cpu_to_le16(priv->currentpacketfilter);
+	cmd->hdr.command = cpu_to_le16(CMD_MAC_CONTROL);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->action = cpu_to_le16(priv->currentpacketfilter);
 
 	lbs_deb_cmd("MAC_CONTROL: action 0x%x, size %d\n",
-		    le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
+		    le16_to_cpu(cmd->action), le16_to_cpu(cmd->hdr.size));
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
@@ -1174,7 +1047,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
 {
 	int ret = 0;
 	struct cmd_ctrl_node *cmdnode;
-	struct cmd_ds_command *cmdptr;
+	struct cmd_header *cmd;
 	unsigned long flags;
 
 	lbs_deb_enter(LBS_DEB_HOST);
@@ -1204,11 +1077,10 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
 
 	lbs_set_cmd_ctrl_node(priv, cmdnode, wait_option, pdata_buf);
 
-	cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
-
 	lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no);
 
-	if (!cmdptr) {
+	cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
+	if (!cmd) {
 		lbs_deb_host("PREP_CMD: cmdptr is NULL\n");
 		lbs_cleanup_and_insert_cmd(priv, cmdnode);
 		ret = -1;
@@ -1217,235 +1089,234 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
 
 	/* Set sequence number, command and INT option */
 	priv->seqnum++;
-	cmdptr->seqnum = cpu_to_le16(priv->seqnum);
-
-	cmdptr->command = cpu_to_le16(cmd_no);
-	cmdptr->result = 0;
+	cmd->seqnum = cpu_to_le16(priv->seqnum);
+	cmd->command = cpu_to_le16(cmd_no);
+	cmd->result = 0;
 
 	switch (cmd_no) {
 	case CMD_GET_HW_SPEC:
-		ret = lbs_cmd_hw_spec(priv, cmdptr);
+		ret = lbs_cmd_hw_spec(priv, (struct cmd_ds_get_hw_spec *) cmd);
 		break;
 	case CMD_802_11_PS_MODE:
-		ret = lbs_cmd_802_11_ps_mode(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_802_11_ps_mode(priv,
+			(struct cmd_ds_802_11_ps_mode *) cmd, cmd_action);
 		break;
-
 	case CMD_802_11_SCAN:
-		ret = lbs_cmd_80211_scan(priv, cmdptr, pdata_buf);
+		ret = lbs_cmd_80211_scan(priv,
+			(struct cmd_ds_802_11_scan *) cmd, pdata_buf);
 		break;
-
 	case CMD_MAC_CONTROL:
-		ret = lbs_cmd_mac_control(priv, cmdptr);
+		ret = lbs_cmd_mac_control(priv,
+			(struct cmd_ds_mac_control *) cmd);
 		break;
-
 	case CMD_802_11_ASSOCIATE:
 	case CMD_802_11_REASSOCIATE:
-		ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf);
+		ret = lbs_cmd_80211_associate(priv,
+			(struct cmd_ds_802_11_associate *) cmd, pdata_buf);
 		break;
-
 	case CMD_802_11_DEAUTHENTICATE:
-		ret = lbs_cmd_80211_deauthenticate(priv, cmdptr);
+		ret = lbs_cmd_80211_deauthenticate(priv,
+			(struct cmd_ds_802_11_deauthenticate *) cmd);
 		break;
-
 	case CMD_802_11_SET_WEP:
-		ret = lbs_cmd_802_11_set_wep(priv, cmdptr, cmd_action, pdata_buf);
+		ret = lbs_cmd_802_11_set_wep(priv,
+			(struct cmd_ds_802_11_set_wep *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_AD_HOC_START:
-		ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf);
+		ret = lbs_cmd_80211_ad_hoc_start(priv,
+			(struct cmd_ds_802_11_ad_hoc_start *) cmd, pdata_buf);
 		break;
 	case CMD_CODE_DNLD:
 		break;
-
 	case CMD_802_11_RESET:
-		ret = lbs_cmd_802_11_reset(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_802_11_reset(priv,
+			(struct cmd_ds_802_11_reset *) cmd, cmd_action);
 		break;
-
 	case CMD_802_11_GET_LOG:
-		ret = lbs_cmd_802_11_get_log(priv, cmdptr);
+		ret = lbs_cmd_802_11_get_log(priv,
+			(struct cmd_ds_802_11_get_log *) cmd);
 		break;
-
 	case CMD_802_11_AUTHENTICATE:
-		ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
+		ret = lbs_cmd_80211_authenticate(priv,
+			(struct cmd_ds_802_11_authenticate *) cmd, pdata_buf);
 		break;
-
 	case CMD_802_11_GET_STAT:
-		ret = lbs_cmd_802_11_get_stat(priv, cmdptr);
+		ret = lbs_cmd_802_11_get_stat(priv,
+			(struct cmd_ds_802_11_get_stat *) cmd);
 		break;
-
 	case CMD_802_11_SNMP_MIB:
-		ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr,
-					       cmd_action, cmd_oid, pdata_buf);
+		ret = lbs_cmd_802_11_snmp_mib(priv,
+			(struct cmd_ds_802_11_snmp_mib *) cmd,
+			cmd_action, cmd_oid, pdata_buf);
 		break;
-
 	case CMD_MAC_REG_ACCESS:
+		ret = lbs_cmd_mac_reg_access(priv,
+			(struct cmd_ds_mac_reg_access *) cmd,
+			cmd_action, pdata_buf);
+		break;
 	case CMD_BBP_REG_ACCESS:
+		ret = lbs_cmd_bbp_reg_access(priv,
+			(struct cmd_ds_bbp_reg_access *) cmd,
+			cmd_action, pdata_buf);
+		break;
 	case CMD_RF_REG_ACCESS:
-		ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf);
+		ret = lbs_cmd_rf_reg_access(priv,
+			(struct cmd_ds_rf_reg_access *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_RF_CHANNEL:
-		ret = lbs_cmd_802_11_rf_channel(priv, cmdptr,
-						 cmd_action, pdata_buf);
+		ret = lbs_cmd_802_11_rf_channel(priv,
+			(struct cmd_ds_802_11_rf_channel *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_RF_TX_POWER:
-		ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr,
-						  cmd_action, pdata_buf);
+		ret = lbs_cmd_802_11_rf_tx_power(priv,
+			(struct cmd_ds_802_11_rf_tx_power *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_RADIO_CONTROL:
-		ret = lbs_cmd_802_11_radio_control(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_802_11_radio_control(priv,
+			(struct cmd_ds_802_11_radio_control *) cmd, cmd_action);
 		break;
-
 	case CMD_802_11_DATA_RATE:
-		ret = lbs_cmd_802_11_data_rate(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_802_11_data_rate(priv,
+			(struct cmd_ds_802_11_data_rate *) cmd,
+			cmd_action);
 		break;
 	case CMD_802_11_RATE_ADAPT_RATESET:
 		ret = lbs_cmd_802_11_rate_adapt_rateset(priv,
-							 cmdptr, cmd_action);
+			(struct cmd_ds_802_11_rate_adapt_rateset *) cmd,
+			cmd_action);
 		break;
-
-	case CMD_MAC_MULTICAST_ADR:
-		ret = lbs_cmd_mac_multicast_adr(priv, cmdptr, cmd_action);
+	case CMD_MAC_MULTICAST_ADDR:
+		ret = lbs_cmd_mac_multicast_addr(priv,
+			(struct cmd_ds_mac_multicast_addr *) cmd,
+			cmd_action);
 		break;
-
 	case CMD_802_11_MONITOR_MODE:
-		ret = lbs_cmd_802_11_monitor_mode(priv, cmdptr,
-				          cmd_action, pdata_buf);
+		ret = lbs_cmd_802_11_monitor_mode(priv,
+			(struct cmd_ds_802_11_monitor_mode *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_AD_HOC_JOIN:
-		ret = lbs_cmd_80211_ad_hoc_join(priv, cmdptr, pdata_buf);
+		ret = lbs_cmd_80211_ad_hoc_join(priv,
+			(struct cmd_ds_802_11_ad_hoc_join *) cmd, pdata_buf);
 		break;
-
 	case CMD_802_11_RSSI:
-		ret = lbs_cmd_802_11_rssi(priv, cmdptr);
+		ret = lbs_cmd_802_11_rssi(priv,
+			(struct cmd_ds_802_11_rssi *) cmd);
 		break;
-
 	case CMD_802_11_AD_HOC_STOP:
-		ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr);
+		ret = lbs_cmd_80211_ad_hoc_stop(priv, (struct cmd_header *) cmd);
 		break;
-
 	case CMD_802_11_ENABLE_RSN:
-		ret = lbs_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action,
-				pdata_buf);
+		ret = lbs_cmd_802_11_enable_rsn(priv,
+			(struct cmd_ds_802_11_enable_rsn *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_KEY_MATERIAL:
-		ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action,
-				cmd_oid, pdata_buf);
-		break;
-
-	case CMD_802_11_PAIRWISE_TSC:
-		break;
-	case CMD_802_11_GROUP_TSC:
+		ret = lbs_cmd_802_11_key_material(priv,
+			(struct cmd_ds_802_11_key_material *) cmd,
+			cmd_action, cmd_oid, pdata_buf);
 		break;
-
 	case CMD_802_11_MAC_ADDRESS:
-		ret = lbs_cmd_802_11_mac_address(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_802_11_mac_address(priv,
+			(struct cmd_ds_802_11_mac_address *) cmd, cmd_action);
 		break;
-
 	case CMD_802_11_EEPROM_ACCESS:
-		ret = lbs_cmd_802_11_eeprom_access(priv, cmdptr,
-						    cmd_action, pdata_buf);
+		ret = lbs_cmd_802_11_eeprom_access(priv,
+			(struct cmd_ds_802_11_eeprom_access *) cmd,
+			cmd_action, pdata_buf);
 		break;
-
 	case CMD_802_11_SET_AFC:
-	case CMD_802_11_GET_AFC:
-
-		cmdptr->command = cpu_to_le16(cmd_no);
-		cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) +
-					   S_DS_GEN);
-
-		memmove(&cmdptr->params.afc,
-			pdata_buf, sizeof(struct cmd_ds_802_11_afc));
+	case CMD_802_11_GET_AFC: {
+		struct cmd_ds_802_11_afc *afc_cmd = (struct cmd_ds_802_11_afc *) cmd;
 
+		afc_cmd->hdr.command = cpu_to_le16(cmd_no);
+		afc_cmd->hdr.size = cpu_to_le16(sizeof(*afc_cmd));
+		memmove((u8 *)(afc_cmd + sizeof (struct cmd_header)), pdata_buf,
+			sizeof(*afc_cmd) - sizeof (struct cmd_header));
 		ret = 0;
 		goto done;
-
+	}
 	case CMD_802_11D_DOMAIN_INFO:
-		ret = lbs_cmd_802_11d_domain_info(priv, cmdptr,
-						   cmd_no, cmd_action);
+		ret = lbs_cmd_802_11d_domain_info(priv,
+			(struct cmd_ds_802_11d_domain_info *) cmd,
+			cmd_no, cmd_action);
 		break;
-
 	case CMD_802_11_SLEEP_PARAMS:
-		ret = lbs_cmd_802_11_sleep_params(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_802_11_sleep_params(priv,
+			(struct cmd_ds_802_11_sleep_params *) cmd, cmd_action);
 		break;
 	case CMD_802_11_INACTIVITY_TIMEOUT:
-		ret = lbs_cmd_802_11_inactivity_timeout(priv, cmdptr,
-							 cmd_action, pdata_buf);
+		ret = lbs_cmd_802_11_inactivity_timeout(priv,
+			(struct cmd_ds_802_11_inactivity_timeout *) cmd,
+			cmd_action, pdata_buf);
 		lbs_set_cmd_ctrl_node(priv, cmdnode, 0, pdata_buf);
 		break;
+	case CMD_802_11_TPC_CFG: {
+		struct cmd_ds_802_11_tpc_cfg *tpc_cmd = 
+			(struct cmd_ds_802_11_tpc_cfg *) cmd;
 
-	case CMD_802_11_TPC_CFG:
-		cmdptr->command = cpu_to_le16(CMD_802_11_TPC_CFG);
-		cmdptr->size =
-		    cpu_to_le16(sizeof(struct cmd_ds_802_11_tpc_cfg) +
-				     S_DS_GEN);
-
-		memmove(&cmdptr->params.tpccfg,
-			pdata_buf, sizeof(struct cmd_ds_802_11_tpc_cfg));
-
+		tpc_cmd->hdr.command = cpu_to_le16(CMD_802_11_TPC_CFG);
+		tpc_cmd->hdr.size = cpu_to_le16(sizeof(*tpc_cmd));
+		memmove((u8 *)(tpc_cmd + sizeof (struct cmd_header)), pdata_buf,
+			sizeof(*tpc_cmd) - sizeof (struct cmd_header));
 		ret = 0;
 		break;
-	case CMD_802_11_LED_GPIO_CTRL:
-		{
-			struct mrvlietypes_ledgpio *gpio =
-			    (struct mrvlietypes_ledgpio*)
-			    cmdptr->params.ledgpio.data;
-
-			memmove(&cmdptr->params.ledgpio,
-				pdata_buf,
-				sizeof(struct cmd_ds_802_11_led_ctrl));
-
-			cmdptr->command =
-			    cpu_to_le16(CMD_802_11_LED_GPIO_CTRL);
-
-#define ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN 8
-			cmdptr->size =
-			    cpu_to_le16(le16_to_cpu(gpio->header.len)
-				+ S_DS_GEN
-				+ ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN);
-			gpio->header.len = gpio->header.len;
-
-			ret = 0;
-			break;
-		}
+	}
+	case CMD_802_11_LED_GPIO_CTRL: {
+		struct cmd_ds_802_11_led_ctrl *led_cmd = 
+			(struct cmd_ds_802_11_led_ctrl *) cmd;
+		struct mrvlietypes_ledgpio *gpio =
+		    (struct mrvlietypes_ledgpio*) led_cmd->data;
+
+		led_cmd->hdr.command = cpu_to_le16(CMD_802_11_LED_GPIO_CTRL);
+		memmove((u8 *)(led_cmd + sizeof (struct cmd_header)), pdata_buf,
+			sizeof(*led_cmd) - sizeof (struct cmd_header));
+		led_cmd->hdr.size = cpu_to_le16(sizeof(*cmd)
+					+ le16_to_cpu(gpio->header.len));
+		ret = 0;
+		break;
+	}
 	case CMD_802_11_SUBSCRIBE_EVENT:
-		lbs_cmd_802_11_subscribe_event(priv, cmdptr,
+		lbs_cmd_802_11_subscribe_event(priv,
+			(struct cmd_ds_802_11_subscribe_event *) cmd,
 			cmd_action, pdata_buf);
 		break;
-	case CMD_802_11_PWR_CFG:
-		cmdptr->command = cpu_to_le16(CMD_802_11_PWR_CFG);
-		cmdptr->size =
-		    cpu_to_le16(sizeof(struct cmd_ds_802_11_pwr_cfg) +
-				     S_DS_GEN);
-		memmove(&cmdptr->params.pwrcfg, pdata_buf,
-			sizeof(struct cmd_ds_802_11_pwr_cfg));
+	case CMD_802_11_PWR_CFG: {
+		struct cmd_ds_802_11_pwr_cfg *pwr_cmd = 
+			(struct cmd_ds_802_11_pwr_cfg *) cmd;
 
+		pwr_cmd->hdr.command = cpu_to_le16(CMD_802_11_PWR_CFG);
+		pwr_cmd->hdr.size = cpu_to_le16(sizeof(*pwr_cmd));
+		memmove((u8 *)(pwr_cmd + sizeof (struct cmd_header)), pdata_buf,
+			sizeof(*pwr_cmd) - sizeof (struct cmd_header));
 		ret = 0;
 		break;
+	}
 	case CMD_BT_ACCESS:
-		ret = lbs_cmd_bt_access(priv, cmdptr, cmd_action, pdata_buf);
+		ret = lbs_cmd_bt_access(priv,
+			(struct cmd_ds_bt_access *) cmd, cmd_action, pdata_buf);
 		break;
-
 	case CMD_FWT_ACCESS:
-		ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf);
+		ret = lbs_cmd_fwt_access(priv,
+			(struct cmd_ds_fwt_access *) cmd, cmd_action, pdata_buf);
 		break;
-
 	case CMD_MESH_ACCESS:
-		ret = lbs_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf);
+		ret = lbs_cmd_mesh_access(priv,
+			(struct cmd_ds_mesh_access *) cmd, cmd_action, pdata_buf);
 		break;
-
-	case CMD_GET_TSF:
-		cmdptr->command = cpu_to_le16(CMD_GET_TSF);
-		cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) +
-					   S_DS_GEN);
+	case CMD_GET_TSF: {
+		cmd->command = cpu_to_le16(CMD_GET_TSF);
+		cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf));
 		ret = 0;
 		break;
+	}
 	case CMD_802_11_BEACON_CTRL:
-		ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action);
+		ret = lbs_cmd_bcn_ctrl(priv,
+			(struct cmd_ds_802_11_beacon_control *) cmd, cmd_action);
 		break;
 	default:
 		lbs_deb_host("PREP_CMD: unknown command 0x%04x\n", cmd_no);
@@ -1681,7 +1552,7 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
 int lbs_execute_next_command(struct lbs_private *priv)
 {
 	struct cmd_ctrl_node *cmdnode = NULL;
-	struct cmd_ds_command *cmdptr;
+	struct cmd_header *cmd;
 	unsigned long flags;
 	int ret = 0;
 
@@ -1707,21 +1578,21 @@ int lbs_execute_next_command(struct lbs_private *priv)
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
 
 	if (cmdnode) {
-		cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
+		cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
 
-		if (is_command_allowed_in_ps(le16_to_cpu(cmdptr->command))) {
+		if (is_command_allowed_in_ps(le16_to_cpu(cmd->command))) {
 			if ((priv->psstate == PS_STATE_SLEEP) ||
 			    (priv->psstate == PS_STATE_PRE_SLEEP)) {
 				lbs_deb_host(
 				       "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n",
-				       le16_to_cpu(cmdptr->command),
+				       le16_to_cpu(cmd->command),
 				       priv->psstate);
 				ret = -1;
 				goto done;
 			}
 			lbs_deb_host("EXEC_NEXT_CMD: OK to send command "
 			       "0x%04x in psstate %d\n",
-				    le16_to_cpu(cmdptr->command),
+				    le16_to_cpu(cmd->command),
 				    priv->psstate);
 		} else if (priv->psstate != PS_STATE_FULL_POWER) {
 			/*
@@ -1735,8 +1606,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
 			 * otherwise send this command down to firmware
 			 * immediately.
 			 */
-			if (cmdptr->command !=
-			    cpu_to_le16(CMD_802_11_PS_MODE)) {
+			if (le16_to_cpu(cmd->command) != CMD_802_11_PS_MODE) {
 				/*  Prepare to send Exit PS,
 				 *  this non PS command will be sent later */
 				if ((priv->psstate == PS_STATE_SLEEP)
@@ -1747,7 +1617,6 @@ int lbs_execute_next_command(struct lbs_private *priv)
 					priv->needtowakeup = 1;
 				} else
 					lbs_ps_wakeup(priv, 0);
-
 				ret = 0;
 				goto done;
 			} else {
@@ -1756,7 +1625,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
 				 * otherwise send it down immediately.
 				 */
 				struct cmd_ds_802_11_ps_mode *psm =
-				    &cmdptr->params.psmode;
+				    (struct cmd_ds_802_11_ps_mode *) cmd;
 
 				lbs_deb_host(
 				       "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n",
@@ -1790,7 +1659,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
 		}
 		list_del(&cmdnode->list);
 		lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
-			    le16_to_cpu(cmdptr->command));
+			    le16_to_cpu(cmd->command));
 		DownloadcommandToStation(priv, cmdnode);
 	} else {
 		/*
@@ -1988,12 +1857,12 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
  *                      the result code from the firmware
  */
 
-int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
-	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *),
+int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd_data, int cmd_size,
+	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
 	      unsigned long callback_arg)
 {
 	struct cmd_ctrl_node *cmdnode;
-	struct cmd_ds_gen *cmdptr;
+	struct cmd_header *cmd;
 	unsigned long flags;
 	int ret = 0;
 
@@ -2022,18 +1891,17 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_siz
 		goto done;
 	}
 
-	cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr;
+	cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
 	cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
 	cmdnode->callback = callback;
 	cmdnode->callback_arg = callback_arg;
 
 	/* Set sequence number, clean result, move to buffer */
 	priv->seqnum++;
-	cmdptr->command = cpu_to_le16(command);
-	cmdptr->size    = cpu_to_le16(cmd_size + S_DS_GEN);
-	cmdptr->seqnum = cpu_to_le16(priv->seqnum);
-	cmdptr->result = 0;
-	memcpy(cmdptr->cmdresp, cmd, cmd_size);
+	cmd->command = cpu_to_le16(command);
+	cmd->size    = cpu_to_le16(cmd_size);
+	cmd->seqnum  = cpu_to_le16(priv->seqnum);
+	cmd->result  = 0;
 
 	lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
 
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h
index 546db49..d801344 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -9,8 +9,8 @@
 #define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \
 	__lbs_cmd(priv, cmdnr, &cmd, sizeof(cmd), callback, callback_arg)
 
-int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size, 
-	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *),
+int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd_data, int cmd_size, 
+	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
 	      unsigned long callback_arg);
 
 #endif /* _LBS_CMD_H */
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 7bad257..77a10ba 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -102,76 +102,68 @@ static void handle_mic_failureevent(struct lbs_private *priv, u32 event)
 	lbs_deb_leave(LBS_DEB_CMD);
 }
 
-static int lbs_ret_reg_access(struct lbs_private *priv,
-			       u16 type, struct cmd_ds_command *resp)
+static int lbs_ret_mac_reg_access(struct lbs_private *priv, u16 type,
+				  struct cmd_ds_mac_reg_access *resp)
 {
-	int ret = 0;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	switch (type) {
-	case CMD_RET(CMD_MAC_REG_ACCESS):
-		{
-			struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
+	priv->offsetvalue.offset = (u32)le16_to_cpu(resp->offset);
+	priv->offsetvalue.value = le32_to_cpu(resp->value);
 
-			priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
-			priv->offsetvalue.value = le32_to_cpu(reg->value);
-			break;
-		}
+	lbs_deb_leave(LBS_DEB_CMD);
+	return 0;
+}
 
-	case CMD_RET(CMD_BBP_REG_ACCESS):
-		{
-			struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
+static int lbs_ret_bbp_reg_access(struct lbs_private *priv, u16 type,
+				  struct cmd_ds_bbp_reg_access *resp)
+{
+	lbs_deb_enter(LBS_DEB_CMD);
 
-			priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
-			priv->offsetvalue.value = reg->value;
-			break;
-		}
+	priv->offsetvalue.offset = (u32)le16_to_cpu(resp->offset);
+	priv->offsetvalue.value = resp->value;
 
-	case CMD_RET(CMD_RF_REG_ACCESS):
-		{
-			struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
+	lbs_deb_leave(LBS_DEB_CMD);
+	return 0;
+}
 
-			priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
-			priv->offsetvalue.value = reg->value;
-			break;
-		}
+static int lbs_ret_rf_reg_access(struct lbs_private *priv, u16 type,
+				  struct cmd_ds_rf_reg_access *resp)
+{
+	lbs_deb_enter(LBS_DEB_CMD);
 
-	default:
-		ret = -1;
-	}
+	priv->offsetvalue.offset = (u32)le16_to_cpu(resp->offset);
+	priv->offsetvalue.value = resp->value;
 
-	lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
-	return ret;
+	lbs_deb_leave(LBS_DEB_CMD);
+	return 0;
 }
 
 static int lbs_ret_get_hw_spec(struct lbs_private *priv,
-				struct cmd_ds_command *resp)
+				struct cmd_ds_get_hw_spec *resp)
 {
 	u32 i;
-	struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec;
 	int ret = 0;
 	DECLARE_MAC_BUF(mac);
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	priv->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
+	priv->fwcapinfo = le32_to_cpu(resp->fwcapinfo);
 
-	memcpy(priv->fwreleasenumber, hwspec->fwreleasenumber, 4);
+	memcpy(priv->fwreleasenumber, resp->fwreleasenumber, 4);
 
 	lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n",
 		    priv->fwreleasenumber[2], priv->fwreleasenumber[1],
 		    priv->fwreleasenumber[0], priv->fwreleasenumber[3]);
 	lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n",
-		    print_mac(mac, hwspec->permanentaddr));
+		    print_mac(mac, resp->permanentaddr));
 	lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n",
-	       hwspec->hwifversion, hwspec->version);
+	       resp->hwifversion, resp->version);
 
 	/* Clamp region code to 8-bit since FW spec indicates that it should
 	 * only ever be 8-bit, even though the field size is 16-bit.  Some firmware
 	 * returns non-zero high 8 bits here.
 	 */
-	priv->regioncode = le16_to_cpu(hwspec->regioncode) & 0xFF;
+	priv->regioncode = le16_to_cpu(resp->regioncode) & 0xFF;
 
 	for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
 		/* use the region code to search for the index */
@@ -187,7 +179,7 @@ static int lbs_ret_get_hw_spec(struct lbs_private *priv,
 	}
 
 	if (priv->current_addr[0] == 0xff)
-		memmove(priv->current_addr, hwspec->permanentaddr, ETH_ALEN);
+		memmove(priv->current_addr, resp->permanentaddr, ETH_ALEN);
 
 	memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN);
 	if (priv->mesh_dev)
@@ -209,74 +201,51 @@ done:
 }
 
 static int lbs_ret_802_11_sleep_params(struct lbs_private *priv,
-					struct cmd_ds_command *resp)
+				       struct cmd_ds_802_11_sleep_params *resp)
 {
-	struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
 	lbs_deb_cmd("error 0x%x, offset 0x%x, stabletime 0x%x, calcontrol 0x%x "
-		    "extsleepclk 0x%x\n", le16_to_cpu(sp->error),
-		    le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime),
-		    sp->calcontrol, sp->externalsleepclk);
+		    "extsleepclk 0x%x\n", le16_to_cpu(resp->error),
+		    le16_to_cpu(resp->offset), le16_to_cpu(resp->stabletime),
+		    resp->calcontrol, resp->externalsleepclk);
 
-	priv->sp.sp_error = le16_to_cpu(sp->error);
-	priv->sp.sp_offset = le16_to_cpu(sp->offset);
-	priv->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
-	priv->sp.sp_calcontrol = sp->calcontrol;
-	priv->sp.sp_extsleepclk = sp->externalsleepclk;
-	priv->sp.sp_reserved = le16_to_cpu(sp->reserved);
+	priv->sp.sp_error = le16_to_cpu(resp->error);
+	priv->sp.sp_offset = le16_to_cpu(resp->offset);
+	priv->sp.sp_stabletime = le16_to_cpu(resp->stabletime);
+	priv->sp.sp_calcontrol = resp->calcontrol;
+	priv->sp.sp_extsleepclk = resp->externalsleepclk;
+	priv->sp.sp_reserved = le16_to_cpu(resp->reserved);
 
 	lbs_deb_enter(LBS_DEB_CMD);
 	return 0;
 }
 
-static int lbs_ret_802_11_stat(struct lbs_private *priv,
-				struct cmd_ds_command *resp)
-{
-	lbs_deb_enter(LBS_DEB_CMD);
-/*	currently priv->wlan802_11Stat is unused
-
-	struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat;
-
-	// TODO Convert it to Big endian befor copy
-	memcpy(&priv->wlan802_11Stat,
-	       p11Stat, sizeof(struct cmd_ds_802_11_get_stat));
-*/
-	lbs_deb_leave(LBS_DEB_CMD);
-	return 0;
-}
-
 static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv,
-				    struct cmd_ds_command *resp)
+				   struct cmd_ds_802_11_snmp_mib *resp)
 {
-	struct cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
-	u16 oid = le16_to_cpu(smib->oid);
-	u16 querytype = le16_to_cpu(smib->querytype);
+	u16 oid = le16_to_cpu(resp->oid);
+	u16 querytype = le16_to_cpu(resp->querytype);
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	lbs_deb_cmd("SNMP_RESP: oid 0x%x, querytype 0x%x\n", oid,
-	       querytype);
-	lbs_deb_cmd("SNMP_RESP: Buf size %d\n", le16_to_cpu(smib->bufsize));
+	lbs_deb_cmd("SNMP_RESP: oid 0x%x, querytype 0x%x\n", oid, querytype);
+	lbs_deb_cmd("SNMP_RESP: Buf size %d\n", le16_to_cpu(resp->bufsize));
 
 	if (querytype == CMD_ACT_GET) {
 		switch (oid) {
 		case FRAGTHRESH_I:
-			priv->fragthsd =
-				le16_to_cpu(*((__le16 *)(smib->value)));
+			priv->fragthsd = le16_to_cpu(resp->value);
 			lbs_deb_cmd("SNMP_RESP: frag threshold %u\n",
 				    priv->fragthsd);
 			break;
 		case RTSTHRESH_I:
-			priv->rtsthsd =
-				le16_to_cpu(*((__le16 *)(smib->value)));
+			priv->rtsthsd = le16_to_cpu(resp->value);
 			lbs_deb_cmd("SNMP_RESP: rts threshold %u\n",
 				    priv->rtsthsd);
 			break;
 		case SHORT_RETRYLIM_I:
-			priv->txretrycount =
-				le16_to_cpu(*((__le16 *)(smib->value)));
+			priv->txretrycount = le16_to_cpu(resp->value);
 			lbs_deb_cmd("SNMP_RESP: tx retry count %u\n",
 				    priv->rtsthsd);
 			break;
@@ -290,82 +259,77 @@ static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_key_material(struct lbs_private *priv,
-					struct cmd_ds_command *resp)
+				       struct cmd_ds_802_11_key_material *resp)
 {
-	struct cmd_ds_802_11_key_material *pkeymaterial =
-	    &resp->params.keymaterial;
-	u16 action = le16_to_cpu(pkeymaterial->action);
+	u16 action = le16_to_cpu(resp->action);
+	u8 * buf_ptr = (u8 *) &resp->keyParamSet;
+	u8 * resp_end = (u8 *) (resp + sizeof(struct cmd_header)
+				+ le16_to_cpu(resp->hdr.size));
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
 	/* Copy the returned key to driver private data */
-	if (action == CMD_ACT_GET) {
-		u8 * buf_ptr = (u8 *) &pkeymaterial->keyParamSet;
-		u8 * resp_end = (u8 *) (resp + le16_to_cpu(resp->size));
-
-		while (buf_ptr < resp_end) {
-			struct MrvlIEtype_keyParamSet * pkeyparamset =
-			    (struct MrvlIEtype_keyParamSet *) buf_ptr;
-			struct enc_key * pkey;
-			u16 param_set_len = le16_to_cpu(pkeyparamset->length);
-			u16 key_len = le16_to_cpu(pkeyparamset->keylen);
-			u16 key_flags = le16_to_cpu(pkeyparamset->keyinfo);
-			u16 key_type = le16_to_cpu(pkeyparamset->keytypeid);
-			u8 * end;
-
-			end = (u8 *) pkeyparamset + sizeof (pkeyparamset->type)
-			                          + sizeof (pkeyparamset->length)
-			                          + param_set_len;
-			/* Make sure we don't access past the end of the IEs */
-			if (end > resp_end)
-				break;
-
-			if (key_flags & KEY_INFO_WPA_UNICAST)
-				pkey = &priv->wpa_unicast_key;
-			else if (key_flags & KEY_INFO_WPA_MCAST)
-				pkey = &priv->wpa_mcast_key;
-			else
-				break;
-
-			/* Copy returned key into driver */
-			memset(pkey, 0, sizeof(struct enc_key));
-			if (key_len > sizeof(pkey->key))
-				break;
-			pkey->type = key_type;
-			pkey->flags = key_flags;
-			pkey->len = key_len;
-			memcpy(pkey->key, pkeyparamset->key, pkey->len);
-
-			buf_ptr = end + 1;
-		}
+	if (action != CMD_ACT_GET)
+		goto out;
+
+	while (buf_ptr < resp_end) {
+		struct MrvlIEtype_keyParamSet * pkeyparamset =
+		    (struct MrvlIEtype_keyParamSet *) buf_ptr;
+		struct enc_key * pkey;
+		u16 param_set_len = le16_to_cpu(pkeyparamset->length);
+		u16 key_len = le16_to_cpu(pkeyparamset->keylen);
+		u16 key_flags = le16_to_cpu(pkeyparamset->keyinfo);
+		u16 key_type = le16_to_cpu(pkeyparamset->keytypeid);
+		u8 * end;
+
+		end = (u8 *) pkeyparamset + sizeof (pkeyparamset->type)
+		                          + sizeof (pkeyparamset->length)
+		                          + param_set_len;
+		/* Make sure we don't access past the end of the IEs */
+		if (end > resp_end)
+			break;
+
+		if (key_flags & KEY_INFO_WPA_UNICAST)
+			pkey = &priv->wpa_unicast_key;
+		else if (key_flags & KEY_INFO_WPA_MCAST)
+			pkey = &priv->wpa_mcast_key;
+		else
+			break;
+
+		/* Copy returned key into driver */
+		memset(pkey, 0, sizeof(struct enc_key));
+		if (key_len > sizeof(pkey->key))
+			break;
+		pkey->type = key_type;
+		pkey->flags = key_flags;
+		pkey->len = key_len;
+		memcpy(pkey->key, pkeyparamset->key, pkey->len);
+
+		buf_ptr = end + 1;
 	}
 
+out:
 	lbs_deb_enter(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_ret_802_11_mac_address(struct lbs_private *priv,
-				       struct cmd_ds_command *resp)
+				      struct cmd_ds_802_11_mac_address *resp)
 {
-	struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	memcpy(priv->current_addr, macadd->macadd, ETH_ALEN);
+	memcpy(priv->current_addr, resp->macadd, ETH_ALEN);
 
 	lbs_deb_enter(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv,
-				       struct cmd_ds_command *resp)
+				      struct cmd_ds_802_11_rf_tx_power *resp)
 {
-	struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	priv->txpowerlevel = le16_to_cpu(rtp->currentlevel);
-
+	priv->txpowerlevel = le16_to_cpu(resp->currentlevel);
 	lbs_deb_cmd("TX power currently %d\n", priv->txpowerlevel);
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -373,15 +337,13 @@ static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv,
-					      struct cmd_ds_command *resp)
+				struct cmd_ds_802_11_rate_adapt_rateset *resp)
 {
-	struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	if (rates->action == CMD_ACT_GET) {
-		priv->enablehwauto = le16_to_cpu(rates->enablehwauto);
-		priv->ratebitmap = le16_to_cpu(rates->bitmap);
+	if (resp->action == CMD_ACT_GET) {
+		priv->enablehwauto = le16_to_cpu(resp->enablehwauto);
+		priv->ratebitmap = le16_to_cpu(resp->bitmap);
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -389,19 +351,17 @@ static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_data_rate(struct lbs_private *priv,
-				     struct cmd_ds_command *resp)
+				    struct cmd_ds_802_11_data_rate *resp)
 {
-	struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) pdatarate,
-		sizeof(struct cmd_ds_802_11_data_rate));
+	lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", resp->rates,
+		sizeof(resp->rates));
 
 	/* FIXME: get actual rates FW can do if this command actually returns
 	 * all data rates supported.
 	 */
-	priv->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]);
+	priv->cur_rate = lbs_fw_index_to_data_rate(resp->rates[0]);
 	lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", priv->cur_rate);
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -409,11 +369,10 @@ static int lbs_ret_802_11_data_rate(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_rf_channel(struct lbs_private *priv,
-				      struct cmd_ds_command *resp)
+				     struct cmd_ds_802_11_rf_channel *resp)
 {
-	struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel;
-	u16 action = le16_to_cpu(rfchannel->action);
-	u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
+	u16 action = le16_to_cpu(resp->action);
+	u16 newchannel = le16_to_cpu(resp->currentchannel);
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
@@ -431,18 +390,16 @@ static int lbs_ret_802_11_rf_channel(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_rssi(struct lbs_private *priv,
-				struct cmd_ds_command *resp)
+			       struct cmd_ds_802_11_rssi_rsp *resp)
 {
-	struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
 	/* store the non average value */
-	priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
-	priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
+	priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(resp->SNR);
+	priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(resp->noisefloor);
 
-	priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
-	priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
+	priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(resp->avgSNR);
+	priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(resp->avgnoisefloor);
 
 	priv->RSSI[TYPE_BEACON][TYPE_NOAVG] =
 	    CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
@@ -461,55 +418,50 @@ static int lbs_ret_802_11_rssi(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv,
-				  struct cmd_ds_command *resp)
+				  struct cmd_ds_802_11_eeprom_access *resp)
 {
 	struct lbs_ioctl_regrdwr *pbuf;
 	pbuf = (struct lbs_ioctl_regrdwr *) priv->prdeeprom;
 
-	lbs_deb_enter_args(LBS_DEB_CMD, "len %d",
-	       le16_to_cpu(resp->params.rdeeprom.bytecount));
-	if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
+	lbs_deb_enter_args(LBS_DEB_CMD, "len %d", le16_to_cpu(resp->bytecount));
+	if (pbuf->NOB < le16_to_cpu(resp->bytecount)) {
 		pbuf->NOB = 0;
 		lbs_deb_cmd("EEPROM read length too big\n");
 		return -1;
 	}
-	pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
+	pbuf->NOB = le16_to_cpu(resp->bytecount);
 	if (pbuf->NOB > 0) {
-
-		memcpy(&pbuf->value, (u8 *) & resp->params.rdeeprom.value,
-		       le16_to_cpu(resp->params.rdeeprom.bytecount));
+		memcpy(&pbuf->value, (u8 *) & resp->value,
+		       le16_to_cpu(resp->bytecount));
 		lbs_deb_hex(LBS_DEB_CMD, "EEPROM", (char *)&pbuf->value,
-			le16_to_cpu(resp->params.rdeeprom.bytecount));
+			le16_to_cpu(resp->bytecount));
 	}
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_ret_get_log(struct lbs_private *priv,
-			    struct cmd_ds_command *resp)
+			   struct cmd_ds_802_11_get_log *resp)
 {
-	struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
 	/* Stored little-endian */
-	memcpy(&priv->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
+	memcpy(&priv->logmsg, resp, sizeof(*resp));
 
 	lbs_deb_leave(LBS_DEB_CMD);
 	return 0;
 }
 
 static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv,
-                                          struct cmd_ds_command *resp)
+                                     struct cmd_ds_802_11_enable_rsn *resp)
 {
-	struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn;
 	u32 * pdata_buf = priv->cur_cmd->pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	if (enable_rsn->action == cpu_to_le16(CMD_ACT_GET)) {
+	if (resp->action == cpu_to_le16(CMD_ACT_GET)) {
 		if (pdata_buf)
-			*pdata_buf = (u32) le16_to_cpu(enable_rsn->enable);
+			*pdata_buf = (u32) le16_to_cpu(resp->enable);
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -517,16 +469,13 @@ static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv,
 }
 
 static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
-					struct cmd_ds_command *resp)
+				   struct cmd_ds_802_11_beacon_control *resp)
 {
-	struct cmd_ds_802_11_beacon_control *bcn_ctrl =
-	    &resp->params.bcn_ctrl;
-
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	if (bcn_ctrl->action == CMD_ACT_GET) {
-		priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable);
-		priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period);
+	if (resp->action == CMD_ACT_GET) {
+		priv->beacon_enable = (u8) le16_to_cpu(resp->beacon_enable);
+		priv->beacon_period = le16_to_cpu(resp->beacon_period);
 	}
 
 	lbs_deb_enter(LBS_DEB_CMD);
@@ -534,18 +483,16 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
 }
 
 static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv,
-	struct cmd_ds_command *resp)
+				struct cmd_ds_802_11_subscribe_event *resp)
 {
-	struct cmd_ds_802_11_subscribe_event *cmd_event =
-		&resp->params.subscribe_event;
 	struct cmd_ds_802_11_subscribe_event *dst_event =
 		priv->cur_cmd->pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_CMD);
 
-	if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) {
-		dst_event->events = cmd_event->events;
-		memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv));
+	if (resp->action == cpu_to_le16(CMD_ACT_GET)) {
+		dst_event->events = resp->events;
+		memcpy(dst_event->tlv, resp->tlv, sizeof(resp->tlv));
 	}
 
 	lbs_deb_leave(LBS_DEB_CMD);
@@ -554,7 +501,7 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv,
 
 static inline int handle_cmd_response(struct lbs_private *priv,
 				      unsigned long dummy,
-				      struct cmd_ds_command *resp)
+				      struct cmd_header *resp)
 {
 	int ret = 0;
 	unsigned long flags;
@@ -564,170 +511,188 @@ static inline int handle_cmd_response(struct lbs_private *priv,
 
 	switch (respcmd) {
 	case CMD_RET(CMD_MAC_REG_ACCESS):
+		ret = lbs_ret_mac_reg_access(priv, respcmd,
+			(struct cmd_ds_mac_reg_access *) resp);
+		break;
 	case CMD_RET(CMD_BBP_REG_ACCESS):
+		ret = lbs_ret_bbp_reg_access(priv, respcmd,
+			(struct cmd_ds_bbp_reg_access *) resp);
+		break;
 	case CMD_RET(CMD_RF_REG_ACCESS):
-		ret = lbs_ret_reg_access(priv, respcmd, resp);
+		ret = lbs_ret_rf_reg_access(priv, respcmd,
+			(struct cmd_ds_rf_reg_access *) resp);
 		break;
-
 	case CMD_RET(CMD_GET_HW_SPEC):
-		ret = lbs_ret_get_hw_spec(priv, resp);
+		ret = lbs_ret_get_hw_spec(priv,
+			(struct cmd_ds_get_hw_spec *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_SCAN):
-		ret = lbs_ret_80211_scan(priv, resp);
+		ret = lbs_ret_80211_scan(priv,
+			(struct cmd_ds_802_11_scan_rsp *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_GET_LOG):
-		ret = lbs_ret_get_log(priv, resp);
+		ret = lbs_ret_get_log(priv,
+			(struct cmd_ds_802_11_get_log *) resp);
 		break;
-
 	case CMD_RET_802_11_ASSOCIATE:
 	case CMD_RET(CMD_802_11_ASSOCIATE):
 	case CMD_RET(CMD_802_11_REASSOCIATE):
-		ret = lbs_ret_80211_associate(priv, resp);
+		ret = lbs_ret_80211_associate(priv,
+			(struct cmd_ds_802_11_associate_rsp *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_DISASSOCIATE):
 	case CMD_RET(CMD_802_11_DEAUTHENTICATE):
-		ret = lbs_ret_80211_disassociate(priv, resp);
+		ret = lbs_ret_80211_disassociate(priv);
 		break;
-
 	case CMD_RET(CMD_802_11_AD_HOC_START):
 	case CMD_RET(CMD_802_11_AD_HOC_JOIN):
-		ret = lbs_ret_80211_ad_hoc_start(priv, resp);
-		break;
-
-	case CMD_RET(CMD_802_11_GET_STAT):
-		ret = lbs_ret_802_11_stat(priv, resp);
+		ret = lbs_ret_80211_ad_hoc_start(priv,
+			(struct cmd_ds_802_11_ad_hoc_rsp *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_SNMP_MIB):
-		ret = lbs_ret_802_11_snmp_mib(priv, resp);
+		ret = lbs_ret_802_11_snmp_mib(priv,
+			(struct cmd_ds_802_11_snmp_mib *) resp);
 		break;
 
 	case CMD_RET(CMD_802_11_RF_TX_POWER):
-		ret = lbs_ret_802_11_rf_tx_power(priv, resp);
+		ret = lbs_ret_802_11_rf_tx_power(priv,
+			(struct cmd_ds_802_11_rf_tx_power *) resp);
 		break;
 
 	case CMD_RET(CMD_802_11_SET_AFC):
-	case CMD_RET(CMD_802_11_GET_AFC):
+	case CMD_RET(CMD_802_11_GET_AFC): {
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		memmove(priv->cur_cmd->pdata_buf, &resp->params.afc,
+		memmove(priv->cur_cmd->pdata_buf, resp,
 			sizeof(struct cmd_ds_802_11_afc));
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
-
-		break;
-
-	case CMD_RET(CMD_MAC_MULTICAST_ADR):
-	case CMD_RET(CMD_MAC_CONTROL):
-	case CMD_RET(CMD_802_11_SET_WEP):
-	case CMD_RET(CMD_802_11_RESET):
-	case CMD_RET(CMD_802_11_AUTHENTICATE):
-	case CMD_RET(CMD_802_11_RADIO_CONTROL):
-	case CMD_RET(CMD_802_11_BEACON_STOP):
 		break;
-
+	}
 	case CMD_RET(CMD_802_11_ENABLE_RSN):
-		ret = lbs_ret_802_11_enable_rsn(priv, resp);
+		ret = lbs_ret_802_11_enable_rsn(priv,
+			(struct cmd_ds_802_11_enable_rsn *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_DATA_RATE):
-		ret = lbs_ret_802_11_data_rate(priv, resp);
+		ret = lbs_ret_802_11_data_rate(priv,
+			(struct cmd_ds_802_11_data_rate *) resp);
 		break;
 	case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET):
-		ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp);
+		ret = lbs_ret_802_11_rate_adapt_rateset(priv,
+			(struct cmd_ds_802_11_rate_adapt_rateset *) resp);
 		break;
 	case CMD_RET(CMD_802_11_RF_CHANNEL):
-		ret = lbs_ret_802_11_rf_channel(priv, resp);
+		ret = lbs_ret_802_11_rf_channel(priv,
+			(struct cmd_ds_802_11_rf_channel *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_RSSI):
-		ret = lbs_ret_802_11_rssi(priv, resp);
+		ret = lbs_ret_802_11_rssi(priv,
+			(struct cmd_ds_802_11_rssi_rsp *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_MAC_ADDRESS):
-		ret = lbs_ret_802_11_mac_address(priv, resp);
+		ret = lbs_ret_802_11_mac_address(priv,
+			(struct cmd_ds_802_11_mac_address *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_AD_HOC_STOP):
-		ret = lbs_ret_80211_ad_hoc_stop(priv, resp);
+		ret = lbs_ret_80211_ad_hoc_stop(priv);
 		break;
-
 	case CMD_RET(CMD_802_11_KEY_MATERIAL):
-		ret = lbs_ret_802_11_key_material(priv, resp);
+		ret = lbs_ret_802_11_key_material(priv,
+			(struct cmd_ds_802_11_key_material *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_EEPROM_ACCESS):
-		ret = lbs_ret_802_11_eeprom_access(priv, resp);
+		ret = lbs_ret_802_11_eeprom_access(priv,
+			(struct cmd_ds_802_11_eeprom_access *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11D_DOMAIN_INFO):
-		ret = lbs_ret_802_11d_domain_info(priv, resp);
+		ret = lbs_ret_802_11d_domain_info(priv,
+			(struct cmd_ds_802_11d_domain_info *) resp);
 		break;
-
 	case CMD_RET(CMD_802_11_SLEEP_PARAMS):
-		ret = lbs_ret_802_11_sleep_params(priv, resp);
+		ret = lbs_ret_802_11_sleep_params(priv,
+			(struct cmd_ds_802_11_sleep_params *) resp);
 		break;
-	case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT):
+	case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): {
+		struct cmd_ds_802_11_inactivity_timeout * it_resp = 
+			(struct cmd_ds_802_11_inactivity_timeout *) resp;
 		spin_lock_irqsave(&priv->driver_lock, flags);
 		*((u16 *) priv->cur_cmd->pdata_buf) =
-		    le16_to_cpu(resp->params.inactivity_timeout.timeout);
+		    le16_to_cpu(it_resp->timeout);
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
-
-	case CMD_RET(CMD_802_11_TPC_CFG):
+	}
+	case CMD_RET(CMD_802_11_TPC_CFG): {
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		memmove(priv->cur_cmd->pdata_buf, &resp->params.tpccfg,
+		memmove(priv->cur_cmd->pdata_buf, resp,
 			sizeof(struct cmd_ds_802_11_tpc_cfg));
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
-	case CMD_RET(CMD_802_11_LED_GPIO_CTRL):
+	}
+	case CMD_RET(CMD_802_11_LED_GPIO_CTRL): {
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		memmove(priv->cur_cmd->pdata_buf, &resp->params.ledgpio,
+		memmove(priv->cur_cmd->pdata_buf, resp,
 			sizeof(struct cmd_ds_802_11_led_ctrl));
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
+	}
 	case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT):
-		ret = lbs_ret_802_11_subscribe_event(priv, resp);
+		ret = lbs_ret_802_11_subscribe_event(priv,
+			(struct cmd_ds_802_11_subscribe_event *) resp);
 		break;
-
-	case CMD_RET(CMD_802_11_PWR_CFG):
+	case CMD_RET(CMD_802_11_PWR_CFG): {
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		memmove(priv->cur_cmd->pdata_buf, &resp->params.pwrcfg,
+		memmove(priv->cur_cmd->pdata_buf, resp,
 			sizeof(struct cmd_ds_802_11_pwr_cfg));
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
-
 		break;
-
-	case CMD_RET(CMD_GET_TSF):
+	}
+	case CMD_RET(CMD_GET_TSF): {
+		struct cmd_ds_get_tsf *tsf_resp = (struct cmd_ds_get_tsf *) resp;
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		memcpy(priv->cur_cmd->pdata_buf,
-		       &resp->params.gettsf.tsfvalue, sizeof(u64));
+		memcpy(priv->cur_cmd->pdata_buf, &tsf_resp->tsfvalue,
+			sizeof(u64));
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
-	case CMD_RET(CMD_BT_ACCESS):
+	}
+	case CMD_RET(CMD_BT_ACCESS): {
+		struct cmd_ds_bt_access *bt_resp = 
+			(struct cmd_ds_bt_access *) resp;
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		if (priv->cur_cmd->pdata_buf)
+		if (priv->cur_cmd->pdata_buf) {
 			memcpy(priv->cur_cmd->pdata_buf,
-			       &resp->params.bt.addr1, 2 * ETH_ALEN);
+			       &bt_resp->addr1, 2 * ETH_ALEN);
+		}
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
-	case CMD_RET(CMD_FWT_ACCESS):
+	}
+	case CMD_RET(CMD_FWT_ACCESS): {
 		spin_lock_irqsave(&priv->driver_lock, flags);
-		if (priv->cur_cmd->pdata_buf)
-			memcpy(priv->cur_cmd->pdata_buf, &resp->params.fwt,
-			       sizeof(resp->params.fwt));
+		if (priv->cur_cmd->pdata_buf) {
+			memcpy(priv->cur_cmd->pdata_buf, resp,
+			       sizeof(struct cmd_ds_fwt_access));
+		}
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
-	case CMD_RET(CMD_MESH_ACCESS):
+	}
+	case CMD_RET(CMD_MESH_ACCESS): {
+		spin_lock_irqsave(&priv->driver_lock, flags);
 		if (priv->cur_cmd->pdata_buf)
-			memcpy(priv->cur_cmd->pdata_buf, &resp->params.mesh,
-			       sizeof(resp->params.mesh));
+			memcpy(priv->cur_cmd->pdata_buf, resp,
+			       sizeof(struct cmd_ds_mesh_access));
+		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		break;
+	}
 	case CMD_RET(CMD_802_11_BEACON_CTRL):
-		ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
+		ret = lbs_ret_802_11_bcn_ctrl(priv,
+			(struct cmd_ds_802_11_beacon_control *) resp);
+		break;
+	case CMD_RET(CMD_802_11_GET_STAT):
+	case CMD_RET(CMD_MAC_MULTICAST_ADDR):
+	case CMD_RET(CMD_MAC_CONTROL):
+	case CMD_RET(CMD_802_11_SET_WEP):
+	case CMD_RET(CMD_802_11_RESET):
+	case CMD_RET(CMD_802_11_AUTHENTICATE):
+	case CMD_RET(CMD_802_11_RADIO_CONTROL):
+	case CMD_RET(CMD_802_11_BEACON_STOP):
 		break;
-
 	default:
 		lbs_deb_host("CMD_RESP: unknown cmd response 0x%04x\n",
 			    resp->command);
@@ -740,7 +705,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
 int lbs_process_rx_command(struct lbs_private *priv)
 {
 	u16 respcmd;
-	struct cmd_ds_command *resp;
+	struct cmd_header *resp;
 	int ret = 0;
 	ulong flags;
 	u16 result;
@@ -759,7 +724,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
 		spin_unlock_irqrestore(&priv->driver_lock, flags);
 		goto done;
 	}
-	resp = (struct cmd_ds_command *)(priv->cur_cmd->bufvirtualaddr);
+	resp = (struct cmd_header *) priv->cur_cmd->bufvirtualaddr;
 
 	respcmd = le16_to_cpu(resp->command);
 	result = le16_to_cpu(resp->result);
@@ -783,7 +748,8 @@ int lbs_process_rx_command(struct lbs_private *priv)
 	priv->cur_cmd_retcode = result;
 
 	if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
-		struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
+		struct cmd_ds_802_11_ps_mode *psmode = 
+			(struct cmd_ds_802_11_ps_mode *) resp;
 		u16 action = le16_to_cpu(psmode->action);
 
 		lbs_deb_host(
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 9921d0c..b2c1d12 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -311,7 +311,7 @@ struct lbs_private {
 
 	struct cmd_ds_802_11_get_log logmsg;
 
-	u32 monitormode;
+	u16 monitormode;
 	int last_scanned_channel;
 	u8 fw_ready;
 };
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index 4828bbf..155a7d8 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -39,7 +39,7 @@
 #define CMD_802_11_RESET              0x0005
 #define CMD_802_11_SCAN               0x0006
 #define CMD_802_11_GET_LOG            0x000b
-#define CMD_MAC_MULTICAST_ADR         0x0010
+#define CMD_MAC_MULTICAST_ADDR        0x0010
 #define CMD_802_11_AUTHENTICATE       0x0011
 #define CMD_802_11_EEPROM_ACCESS      0x0059
 #define CMD_802_11_ASSOCIATE          0x0050
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index ed502b7..e239558 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -6,8 +6,8 @@
 #define _LBS_HOSTCMD_H
 
 #include <linux/wireless.h>
-#include "11d.h"
 #include "types.h"
+#include "defs.h"
 
 /* 802.11-related definitions */
 
@@ -65,13 +65,22 @@ struct rxpd {
 	u8 reserved[3];
 };
 
+struct cmd_header {
+	__le16 command;
+	__le16 size;
+	__le16 seqnum;
+	__le16 result;
+} __attribute__ ((packed));
+
+struct lbs_private;
+
 struct cmd_ctrl_node {
 	struct list_head list;
 	/* wait for finish or not */
 	u16 wait_option;
 	/* command response */
 	void *pdata_buf;
-	int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_ds_command *resp);
+	int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_header *resp);
 	unsigned long callback_arg;
 	/* command data */
 	u8 *bufvirtualaddr;
@@ -94,24 +103,13 @@ struct lbs_offset_value {
 	u32 value;
 };
 
-/* Define general data structure */
-/* cmd_DS_GEN */
-struct cmd_ds_gen {
-	__le16 command;
-	__le16 size;
-	__le16 seqnum;
-	__le16 result;
-	void *cmdresp[0];
-};
-
-#define S_DS_GEN sizeof(struct cmd_ds_gen)
-
-
 /*
  * Define data structure for CMD_GET_HW_SPEC
  * This structure defines the response for the GET_HW_SPEC command
  */
 struct cmd_ds_get_hw_spec {
+	struct cmd_header hdr;
+
 	/* HW Interface version number */
 	__le16 hwifversion;
 	/* HW version number */
@@ -145,10 +143,14 @@ struct cmd_ds_get_hw_spec {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_reset {
+	struct cmd_header hdr;
+
 	__le16 action;
 };
 
 struct cmd_ds_802_11_subscribe_event {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 events;
 
@@ -165,9 +167,11 @@ struct cmd_ds_802_11_subscribe_event {
  * Define data structure for CMD_802_11_SCAN
  */
 struct cmd_ds_802_11_scan {
+	struct cmd_header hdr;
+
 	u8 bsstype;
 	u8 bssid[ETH_ALEN];
-	u8 tlvbuffer[1];
+	void *tlvbuffer[0];
 #if 0
 	mrvlietypes_ssidparamset_t ssidParamSet;
 	mrvlietypes_chanlistparamset_t ChanListParamSet;
@@ -176,12 +180,16 @@ struct cmd_ds_802_11_scan {
 };
 
 struct cmd_ds_802_11_scan_rsp {
+	struct cmd_header hdr;
+
 	__le16 bssdescriptsize;
 	u8 nr_sets;
 	u8 bssdesc_and_tlvbuffer[1];
 };
 
 struct cmd_ds_802_11_get_log {
+	struct cmd_header hdr;
+
 	__le32 mcasttxframe;
 	__le32 failed;
 	__le32 retry;
@@ -198,28 +206,38 @@ struct cmd_ds_802_11_get_log {
 };
 
 struct cmd_ds_mac_control {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 reserved;
 };
 
-struct cmd_ds_mac_multicast_adr {
+struct cmd_ds_mac_multicast_addr {
+	struct cmd_header hdr;
+
 	__le16 action;
-	__le16 nr_of_adrs;
+	__le16 num_addrs;
 	u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
 };
 
 struct cmd_ds_802_11_authenticate {
+	struct cmd_header hdr;
+
 	u8 macaddr[ETH_ALEN];
 	u8 authtype;
 	u8 reserved[10];
 };
 
 struct cmd_ds_802_11_deauthenticate {
+	struct cmd_header hdr;
+
 	u8 macaddr[6];
 	__le16 reasoncode;
 };
 
 struct cmd_ds_802_11_associate {
+	struct cmd_header hdr;
+
 	u8 peerstaaddr[6];
 	__le16 capability;
 	__le16 listeninterval;
@@ -235,20 +253,28 @@ struct cmd_ds_802_11_associate {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_disassociate {
+	struct cmd_header hdr;
+
 	u8 destmacaddr[6];
 	__le16 reasoncode;
 };
 
 struct cmd_ds_802_11_associate_rsp {
+	struct cmd_header hdr;
+
 	struct ieeetypes_assocrsp assocRsp;
 };
 
-struct cmd_ds_802_11_ad_hoc_result {
+struct cmd_ds_802_11_ad_hoc_rsp {
+	struct cmd_header hdr;
+
 	u8 pad[3];
 	u8 bssid[ETH_ALEN];
 };
 
 struct cmd_ds_802_11_set_wep {
+	struct cmd_header hdr;
+
 	/* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
 	__le16 action;
 
@@ -261,6 +287,8 @@ struct cmd_ds_802_11_set_wep {
 };
 
 struct cmd_ds_802_3_get_stat {
+	struct cmd_header hdr;
+
 	__le32 xmitok;
 	__le32 rcvok;
 	__le32 xmiterror;
@@ -270,6 +298,8 @@ struct cmd_ds_802_3_get_stat {
 };
 
 struct cmd_ds_802_11_get_stat {
+	struct cmd_header hdr;
+
 	__le32 txfragmentcnt;
 	__le32 mcasttxframecnt;
 	__le32 failedcnt;
@@ -290,10 +320,14 @@ struct cmd_ds_802_11_get_stat {
 };
 
 struct cmd_ds_802_11_snmp_mib {
+	struct cmd_header hdr;
+
 	__le16 querytype;
 	__le16 oid;
 	__le16 bufsize;
-	u8 value[128];
+
+	/* Can be as large as 128 bytes, but nothing uses that much yet */
+	__le16 value;
 };
 
 struct cmd_ds_mac_reg_map {
@@ -315,12 +349,16 @@ struct cmd_ds_rf_reg_map {
 };
 
 struct cmd_ds_mac_reg_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 offset;
 	__le32 value;
 };
 
 struct cmd_ds_bbp_reg_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 offset;
 	u8 value;
@@ -328,6 +366,8 @@ struct cmd_ds_bbp_reg_access {
 };
 
 struct cmd_ds_rf_reg_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 offset;
 	u8 value;
@@ -335,17 +375,23 @@ struct cmd_ds_rf_reg_access {
 };
 
 struct cmd_ds_802_11_radio_control {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 control;
 };
 
 struct cmd_ds_802_11_beacon_control {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 beacon_enable;
 	__le16 beacon_period;
 };
 
 struct cmd_ds_802_11_sleep_params {
+	struct cmd_header hdr;
+
 	/* ACT_GET/ACT_SET */
 	__le16 action;
 
@@ -369,6 +415,8 @@ struct cmd_ds_802_11_sleep_params {
 };
 
 struct cmd_ds_802_11_inactivity_timeout {
+	struct cmd_header hdr;
+
 	/* ACT_GET/ACT_SET */
 	__le16 action;
 
@@ -377,6 +425,8 @@ struct cmd_ds_802_11_inactivity_timeout {
 };
 
 struct cmd_ds_802_11_rf_channel {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 currentchannel;
 	__le16 rftype;
@@ -385,6 +435,8 @@ struct cmd_ds_802_11_rf_channel {
 };
 
 struct cmd_ds_802_11_rssi {
+	struct cmd_header hdr;
+
 	/* weighting factor */
 	__le16 N;
 
@@ -394,6 +446,8 @@ struct cmd_ds_802_11_rssi {
 };
 
 struct cmd_ds_802_11_rssi_rsp {
+	struct cmd_header hdr;
+
 	__le16 SNR;
 	__le16 noisefloor;
 	__le16 avgSNR;
@@ -401,16 +455,22 @@ struct cmd_ds_802_11_rssi_rsp {
 };
 
 struct cmd_ds_802_11_mac_address {
+	struct cmd_header hdr;
+
 	__le16 action;
 	u8 macadd[ETH_ALEN];
 };
 
 struct cmd_ds_802_11_rf_tx_power {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 currentlevel;
 };
 
 struct cmd_ds_802_11_rf_antenna {
+	struct cmd_header hdr;
+
 	__le16 action;
 
 	/* Number of antennas or 0xffff(diversity) */
@@ -419,16 +479,22 @@ struct cmd_ds_802_11_rf_antenna {
 };
 
 struct cmd_ds_802_11_monitor_mode {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 mode;
 };
 
 struct cmd_ds_set_boot2_ver {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 version;
 };
 
 struct cmd_ds_802_11_ps_mode {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 nullpktinterval;
 	__le16 multipledtim;
@@ -450,18 +516,24 @@ struct PS_CMD_ConfirmSleep {
 };
 
 struct cmd_ds_802_11_data_rate {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 reserved;
 	u8 rates[MAX_RATES];
 };
 
 struct cmd_ds_802_11_rate_adapt_rateset {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 enablehwauto;
 	__le16 bitmap;
 };
 
 struct cmd_ds_802_11_ad_hoc_start {
+	struct cmd_header hdr;
+
 	u8 ssid[IW_ESSID_MAX_SIZE];
 	u8 bsstype;
 	__le16 beaconperiod;
@@ -494,6 +566,8 @@ struct adhoc_bssdesc {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_ad_hoc_join {
+	struct cmd_header hdr;
+
 	struct adhoc_bssdesc bss;
 	__le16 failtimeout;
 	__le16 probedelay;
@@ -501,6 +575,8 @@ struct cmd_ds_802_11_ad_hoc_join {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_enable_rsn {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 enable;
 } __attribute__ ((packed));
@@ -526,11 +602,15 @@ struct MrvlIEtype_keyParamSet {
 };
 
 struct cmd_ds_802_11_key_material {
+	struct cmd_header hdr;
+
 	__le16 action;
 	struct MrvlIEtype_keyParamSet keyParamSet[2];
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_eeprom_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 
 	/* multiple 4 */
@@ -540,6 +620,8 @@ struct cmd_ds_802_11_eeprom_access {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_tpc_cfg {
+	struct cmd_header hdr;
+
 	__le16 action;
 	u8 enable;
 	s8 P0;
@@ -549,12 +631,16 @@ struct cmd_ds_802_11_tpc_cfg {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_led_ctrl {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le16 numled;
-	u8 data[256];
+	void *data[0];
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_pwr_cfg {
+	struct cmd_header hdr;
+
 	__le16 action;
 	u8 enable;
 	s8 PA_P0;
@@ -563,6 +649,8 @@ struct cmd_ds_802_11_pwr_cfg {
 } __attribute__ ((packed));
 
 struct cmd_ds_802_11_afc {
+	struct cmd_header hdr;
+
 	__le16 afc_auto;
 	union {
 		struct {
@@ -577,14 +665,20 @@ struct cmd_ds_802_11_afc {
 } __attribute__ ((packed));
 
 struct cmd_tx_rate_query {
+	struct cmd_header hdr;
+
 	__le16 txrate;
 } __attribute__ ((packed));
 
 struct cmd_ds_get_tsf {
+	struct cmd_header hdr;
+
 	__le64 tsfvalue;
 } __attribute__ ((packed));
 
 struct cmd_ds_bt_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le32 id;
 	u8 addr1[ETH_ALEN];
@@ -592,6 +686,8 @@ struct cmd_ds_bt_access {
 } __attribute__ ((packed));
 
 struct cmd_ds_fwt_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le32 id;
 	u8 valid;
@@ -612,77 +708,37 @@ struct cmd_ds_fwt_access {
 } __attribute__ ((packed));
 
 struct cmd_ds_mesh_access {
+	struct cmd_header hdr;
+
 	__le16 action;
 	__le32 data[32];	/* last position reserved */
 } __attribute__ ((packed));
 
-/* Number of stats counters returned by the firmware */
-#define MESH_STATS_NUM 8
 
-struct cmd_ds_command {
-	/* command header */
-	__le16 command;
-	__le16 size;
-	__le16 seqnum;
-	__le16 result;
+#define COUNTRY_CODE_LEN	3
+#define MAX_NO_OF_CHAN 		40
 
-	/* command Body */
-	union {
-		struct cmd_ds_get_hw_spec hwspec;
-		struct cmd_ds_802_11_ps_mode psmode;
-		struct cmd_ds_802_11_scan scan;
-		struct cmd_ds_802_11_scan_rsp scanresp;
-		struct cmd_ds_mac_control macctrl;
-		struct cmd_ds_802_11_associate associate;
-		struct cmd_ds_802_11_deauthenticate deauth;
-		struct cmd_ds_802_11_set_wep wep;
-		struct cmd_ds_802_11_ad_hoc_start ads;
-		struct cmd_ds_802_11_reset reset;
-		struct cmd_ds_802_11_ad_hoc_result result;
-		struct cmd_ds_802_11_get_log glog;
-		struct cmd_ds_802_11_authenticate auth;
-		struct cmd_ds_802_11_get_stat gstat;
-		struct cmd_ds_802_3_get_stat gstat_8023;
-		struct cmd_ds_802_11_snmp_mib smib;
-		struct cmd_ds_802_11_rf_tx_power txp;
-		struct cmd_ds_802_11_rf_antenna rant;
-		struct cmd_ds_802_11_monitor_mode monitor;
-		struct cmd_ds_802_11_data_rate drate;
-		struct cmd_ds_802_11_rate_adapt_rateset rateset;
-		struct cmd_ds_mac_multicast_adr madr;
-		struct cmd_ds_802_11_ad_hoc_join adj;
-		struct cmd_ds_802_11_radio_control radio;
-		struct cmd_ds_802_11_rf_channel rfchannel;
-		struct cmd_ds_802_11_rssi rssi;
-		struct cmd_ds_802_11_rssi_rsp rssirsp;
-		struct cmd_ds_802_11_disassociate dassociate;
-		struct cmd_ds_802_11_mac_address macadd;
-		struct cmd_ds_802_11_enable_rsn enbrsn;
-		struct cmd_ds_802_11_key_material keymaterial;
-		struct cmd_ds_mac_reg_access macreg;
-		struct cmd_ds_bbp_reg_access bbpreg;
-		struct cmd_ds_rf_reg_access rfreg;
-		struct cmd_ds_802_11_eeprom_access rdeeprom;
-
-		struct cmd_ds_802_11d_domain_info domaininfo;
-		struct cmd_ds_802_11d_domain_info domaininforesp;
-
-		struct cmd_ds_802_11_sleep_params sleep_params;
-		struct cmd_ds_802_11_inactivity_timeout inactivity_timeout;
-		struct cmd_ds_802_11_tpc_cfg tpccfg;
-		struct cmd_ds_802_11_pwr_cfg pwrcfg;
-		struct cmd_ds_802_11_afc afc;
-		struct cmd_ds_802_11_led_ctrl ledgpio;
-
-		struct cmd_tx_rate_query txrate;
-		struct cmd_ds_bt_access bt;
-		struct cmd_ds_fwt_access fwt;
-		struct cmd_ds_mesh_access mesh;
-		struct cmd_ds_set_boot2_ver boot2_ver;
-		struct cmd_ds_get_tsf gettsf;
-		struct cmd_ds_802_11_subscribe_event subscribe_event;
-		struct cmd_ds_802_11_beacon_control bcn_ctrl;
-	} params;
+/** Data structure for Country IE*/
+struct ieeetypes_subbandset {
+	u8 firstchan;
+	u8 nrchan;
+	u8 maxtxpwr;
+} __attribute__ ((packed));
+
+struct mrvlietypes_domainparamset {
+	struct mrvlietypesheader header;
+	u8 countrycode[COUNTRY_CODE_LEN];
+	struct ieeetypes_subbandset subband[1];
+} __attribute__ ((packed));
+
+struct cmd_ds_802_11d_domain_info {
+	struct cmd_header hdr;
+
+	__le16 action;
+	struct mrvlietypes_domainparamset domain;
 } __attribute__ ((packed));
 
+/* Number of stats counters returned by the firmware */
+#define MESH_STATS_NUM 8
+
 #endif
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 8ff57a6..97c1401 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -375,19 +375,19 @@ static int if_prog_firmware(struct usb_card_rec *cardp)
 
 static int if_usb_reset_device(struct usb_card_rec *cardp)
 {
-	struct cmd_ds_command *cmd = (void *)&cardp->bulk_out_buffer[4];
+	struct cmd_ds_802_11_reset *cmd = (void *)&cardp->bulk_out_buffer[4];
 	int ret;
 
 	lbs_deb_enter(LBS_DEB_USB);
 
 	*(__le32 *)cardp->bulk_out_buffer = cpu_to_le32(CMD_TYPE_REQUEST);
 
-	cmd->command = cpu_to_le16(CMD_802_11_RESET);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset) + S_DS_GEN);
-	cmd->result = cpu_to_le16(0);
-	cmd->seqnum = cpu_to_le16(0x5a5a);
-	cmd->params.reset.action = cpu_to_le16(CMD_ACT_HALT);
-	usb_tx_block(cardp, cardp->bulk_out_buffer, 4 + S_DS_GEN + sizeof(struct cmd_ds_802_11_reset));
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_RESET);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
+	cmd->hdr.result = cpu_to_le16(0);
+	cmd->hdr.seqnum = cpu_to_le16(0x5a5a);
+	cmd->action = cpu_to_le16(CMD_ACT_HALT);
+	usb_tx_block(cardp, cardp->bulk_out_buffer, 4 + sizeof(*cmd));
 
 	msleep(10);
 	ret = usb_reset_device(cardp->udev);
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index 14425d9..b14b2fa 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -287,30 +287,28 @@ int lbs_send_deauthentication(struct lbs_private *priv)
  *  @return         0 or -1
  */
 int lbs_cmd_80211_authenticate(struct lbs_private *priv,
-				 struct cmd_ds_command *cmd,
-				 void *pdata_buf)
+			       struct cmd_ds_802_11_authenticate *cmd,
+			       void *pdata_buf)
 {
-	struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth;
 	int ret = -1;
 	u8 *bssid = pdata_buf;
 	DECLARE_MAC_BUF(mac);
 
 	lbs_deb_enter(LBS_DEB_JOIN);
 
-	cmd->command = cpu_to_le16(CMD_802_11_AUTHENTICATE);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
-	                        + S_DS_GEN);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_AUTHENTICATE);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
 	/* translate auth mode to 802.11 defined wire value */
 	switch (priv->secinfo.auth_mode) {
 	case IW_AUTH_ALG_OPEN_SYSTEM:
-		pauthenticate->authtype = 0x00;
+		cmd->authtype = 0x00;
 		break;
 	case IW_AUTH_ALG_SHARED_KEY:
-		pauthenticate->authtype = 0x01;
+		cmd->authtype = 0x01;
 		break;
 	case IW_AUTH_ALG_LEAP:
-		pauthenticate->authtype = 0x80;
+		cmd->authtype = 0x80;
 		break;
 	default:
 		lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
@@ -318,10 +316,10 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
 		goto out;
 	}
 
-	memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
+	memcpy(cmd->macaddr, bssid, ETH_ALEN);
 
 	lbs_deb_join("AUTH_CMD: BSSID %s, auth 0x%x\n",
-	             print_mac(mac, bssid), pauthenticate->authtype);
+	             print_mac(mac, bssid), cmd->authtype);
 	ret = 0;
 
 out:
@@ -330,31 +328,28 @@ out:
 }
 
 int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
-				   struct cmd_ds_command *cmd)
+				 struct cmd_ds_802_11_deauthenticate *cmd)
 {
-	struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
-
 	lbs_deb_enter(LBS_DEB_JOIN);
 
-	cmd->command = cpu_to_le16(CMD_802_11_DEAUTHENTICATE);
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
-			     S_DS_GEN);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_DEAUTHENTICATE);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
 	/* set AP MAC address */
-	memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN);
+	memmove(cmd->macaddr, priv->curbssparams.bssid, ETH_ALEN);
 
 	/* Reason code 3 = Station is leaving */
 #define REASON_CODE_STA_LEAVING 3
-	dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
+	cmd->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
 
 	lbs_deb_leave(LBS_DEB_JOIN);
 	return 0;
 }
 
 int lbs_cmd_80211_associate(struct lbs_private *priv,
-			      struct cmd_ds_command *cmd, void *pdata_buf)
+			    struct cmd_ds_802_11_associate *cmd,
+			    void *pdata_buf)
 {
-	struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
 	int ret = 0;
 	struct assoc_request * assoc_req = pdata_buf;
 	struct bss_descriptor * bss = &assoc_req->bss;
@@ -368,25 +363,25 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
 
 	lbs_deb_enter(LBS_DEB_ASSOC);
 
-	pos = (u8 *) passo;
+	pos = (u8 *) (cmd + sizeof (struct cmd_header));
 
 	if (!priv) {
 		ret = -1;
 		goto done;
 	}
 
-	cmd->command = cpu_to_le16(CMD_802_11_ASSOCIATE);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_ASSOCIATE);
 
-	memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr));
-	pos += sizeof(passo->peerstaaddr);
+	memcpy(cmd->peerstaaddr, bss->bssid, sizeof(cmd->peerstaaddr));
+	pos += sizeof(cmd->peerstaaddr);
 
 	/* set the listen interval */
-	passo->listeninterval = cpu_to_le16(MRVDRV_DEFAULT_LISTEN_INTERVAL);
+	cmd->listeninterval = cpu_to_le16(MRVDRV_DEFAULT_LISTEN_INTERVAL);
 
-	pos += sizeof(passo->capability);
-	pos += sizeof(passo->listeninterval);
-	pos += sizeof(passo->bcnperiod);
-	pos += sizeof(passo->dtimperiod);
+	pos += sizeof(cmd->capability);
+	pos += sizeof(cmd->listeninterval);
+	pos += sizeof(cmd->bcnperiod);
+	pos += sizeof(cmd->dtimperiod);
 
 	ssid = (struct mrvlietypes_ssidparamset *) pos;
 	ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
@@ -451,13 +446,13 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
 		goto done;
 	}
 
-	cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
+	cmd->hdr.size = cpu_to_le16((u16) (pos - (u8 *) cmd));
 
 	/* set the capability info */
 	tmpcap = (bss->capability & CAPINFO_MASK);
 	if (bss->mode == IW_MODE_INFRA)
 		tmpcap |= WLAN_CAPABILITY_ESS;
-	passo->capability = cpu_to_le16(tmpcap);
+	cmd->capability = cpu_to_le16(tmpcap);
 	lbs_deb_assoc("ASSOC_CMD: capability 0x%04x\n", tmpcap);
 
 done:
@@ -466,11 +461,10 @@ done:
 }
 
 int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
-				 struct cmd_ds_command *cmd, void *pdata_buf)
+			       struct cmd_ds_802_11_ad_hoc_start *cmd,
+			       void *pdata_buf)
 {
-	struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
 	int ret = 0;
-	int cmdappendsize = 0;
 	struct assoc_request * assoc_req = pdata_buf;
 	u16 tmpcap = 0;
 	size_t ratesize = 0;
@@ -482,7 +476,8 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
 		goto done;
 	}
 
-	cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_START);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_AD_HOC_START);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
 	/*
 	 * Fill in the parameters for 2 data structures:
@@ -496,41 +491,41 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
 	 *   and operational rates.
 	 */
 
-	memset(adhs->ssid, 0, IW_ESSID_MAX_SIZE);
-	memcpy(adhs->ssid, assoc_req->ssid, assoc_req->ssid_len);
+	memset(cmd->ssid, 0, IW_ESSID_MAX_SIZE);
+	memcpy(cmd->ssid, assoc_req->ssid, assoc_req->ssid_len);
 
 	lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n",
 	             escape_essid(assoc_req->ssid, assoc_req->ssid_len),
 	             assoc_req->ssid_len);
 
 	/* set the BSS type */
-	adhs->bsstype = CMD_BSS_TYPE_IBSS;
+	cmd->bsstype = CMD_BSS_TYPE_IBSS;
 	priv->mode = IW_MODE_ADHOC;
 	if (priv->beacon_period == 0)
 		priv->beacon_period = MRVDRV_BEACON_INTERVAL;
-	adhs->beaconperiod = cpu_to_le16(priv->beacon_period);
+	cmd->beaconperiod = cpu_to_le16(priv->beacon_period);
 
 	/* set Physical param set */
 #define DS_PARA_IE_ID   3
 #define DS_PARA_IE_LEN  1
 
-	adhs->phyparamset.dsparamset.elementid = DS_PARA_IE_ID;
-	adhs->phyparamset.dsparamset.len = DS_PARA_IE_LEN;
+	cmd->phyparamset.dsparamset.elementid = DS_PARA_IE_ID;
+	cmd->phyparamset.dsparamset.len = DS_PARA_IE_LEN;
 
 	WARN_ON(!assoc_req->channel);
 
 	lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
 		     assoc_req->channel);
 
-	adhs->phyparamset.dsparamset.currentchan = assoc_req->channel;
+	cmd->phyparamset.dsparamset.currentchan = assoc_req->channel;
 
 	/* set IBSS param set */
 #define IBSS_PARA_IE_ID   6
 #define IBSS_PARA_IE_LEN  2
 
-	adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
-	adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
-	adhs->ssparamset.ibssparamset.atimwindow = 0;
+	cmd->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
+	cmd->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
+	cmd->ssparamset.ibssparamset.atimwindow = 0;
 
 	/* set capability info */
 	tmpcap = WLAN_CAPABILITY_IBSS;
@@ -540,26 +535,26 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
 	} else {
 		lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
 	}
-	adhs->capability = cpu_to_le16(tmpcap);
+	cmd->capability = cpu_to_le16(tmpcap);
 
 	/* probedelay */
-	adhs->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME);
+	cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME);
 
-	memset(adhs->rates, 0, sizeof(adhs->rates));
-	ratesize = min(sizeof(adhs->rates), sizeof(lbs_bg_rates));
-	memcpy(adhs->rates, lbs_bg_rates, ratesize);
+	memset(cmd->rates, 0, sizeof(cmd->rates));
+	ratesize = min(sizeof(cmd->rates), sizeof(lbs_bg_rates));
+	memcpy(cmd->rates, lbs_bg_rates, ratesize);
 
 	/* Copy the ad-hoc creating rates into Current BSS state structure */
 	memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
-	memcpy(&priv->curbssparams.rates, &adhs->rates, ratesize);
+	memcpy(&priv->curbssparams.rates, &cmd->rates, ratesize);
 
 	/* Set MSB on basic rates as the firmware requires, but _after_
 	 * copying to current bss rates.
 	 */
-	lbs_set_basic_rate_flags(adhs->rates, ratesize);
+	lbs_set_basic_rate_flags(cmd->rates, ratesize);
 
 	lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
-	       adhs->rates[0], adhs->rates[1], adhs->rates[2], adhs->rates[3]);
+	       cmd->rates[0], cmd->rates[1], cmd->rates[2], cmd->rates[3]);
 
 	lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n");
 
@@ -568,75 +563,69 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
 		ret = -1;
 		goto done;
 	}
-
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) +
-				S_DS_GEN + cmdappendsize);
-
 	ret = 0;
+
 done:
 	lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
 	return ret;
 }
 
 int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv,
-				struct cmd_ds_command *cmd)
+				struct cmd_header *cmd)
 {
 	cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_STOP);
-	cmd->size = cpu_to_le16(S_DS_GEN);
-
+	cmd->size = cpu_to_le16(sizeof(struct cmd_header));
 	return 0;
 }
 
 int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
-				struct cmd_ds_command *cmd, void *pdata_buf)
+			      struct cmd_ds_802_11_ad_hoc_join *cmd,
+			      void *pdata_buf)
 {
-	struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj;
 	struct assoc_request * assoc_req = pdata_buf;
 	struct bss_descriptor *bss = &assoc_req->bss;
-	int cmdappendsize = 0;
 	int ret = 0;
 	u16 ratesize = 0;
 	DECLARE_MAC_BUF(mac);
 
 	lbs_deb_enter(LBS_DEB_JOIN);
 
-	cmd->command = cpu_to_le16(CMD_802_11_AD_HOC_JOIN);
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_AD_HOC_JOIN);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd));
 
-	join_cmd->bss.type = CMD_BSS_TYPE_IBSS;
-	join_cmd->bss.beaconperiod = cpu_to_le16(bss->beaconperiod);
+	cmd->bss.type = CMD_BSS_TYPE_IBSS;
+	cmd->bss.beaconperiod = cpu_to_le16(bss->beaconperiod);
 
-	memcpy(&join_cmd->bss.bssid, &bss->bssid, ETH_ALEN);
-	memcpy(&join_cmd->bss.ssid, &bss->ssid, bss->ssid_len);
+	memcpy(&cmd->bss.bssid, &bss->bssid, ETH_ALEN);
+	memcpy(&cmd->bss.ssid, &bss->ssid, bss->ssid_len);
 
-	memcpy(&join_cmd->bss.phyparamset, &bss->phyparamset,
+	memcpy(&cmd->bss.phyparamset, &bss->phyparamset,
 	       sizeof(union ieeetypes_phyparamset));
 
-	memcpy(&join_cmd->bss.ssparamset, &bss->ssparamset,
+	memcpy(&cmd->bss.ssparamset, &bss->ssparamset,
 	       sizeof(union IEEEtypes_ssparamset));
 
-	join_cmd->bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK);
+	cmd->bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK);
 	lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
 	       bss->capability, CAPINFO_MASK);
 
 	/* information on BSSID descriptor passed to FW */
-	lbs_deb_join(
-	       "ADHOC_J_CMD: BSSID = %s, SSID = '%s'\n",
-	       print_mac(mac, join_cmd->bss.bssid),
-	       join_cmd->bss.ssid);
+	lbs_deb_join("ADHOC_J_CMD: BSSID = %s, SSID = '%s'\n",
+	             print_mac(mac, cmd->bss.bssid), cmd->bss.ssid);
 
 	/* failtimeout */
-	join_cmd->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
+	cmd->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
 
 	/* probedelay */
-	join_cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME);
+	cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME);
 
 	priv->curbssparams.channel = bss->channel;
 
 	/* Copy Data rates from the rates recorded in scan response */
-	memset(join_cmd->bss.rates, 0, sizeof(join_cmd->bss.rates));
-	ratesize = min_t(u16, sizeof(join_cmd->bss.rates), MAX_RATES);
-	memcpy(join_cmd->bss.rates, bss->rates, ratesize);
-	if (get_common_rates(priv, join_cmd->bss.rates, &ratesize)) {
+	memset(cmd->bss.rates, 0, sizeof(cmd->bss.rates));
+	ratesize = min_t(u16, sizeof(cmd->bss.rates), MAX_RATES);
+	memcpy(cmd->bss.rates, bss->rates, ratesize);
+	if (get_common_rates(priv, cmd->bss.rates, &ratesize)) {
 		lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
 		ret = -1;
 		goto done;
@@ -644,32 +633,31 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
 
 	/* Copy the ad-hoc creating rates into Current BSS state structure */
 	memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
-	memcpy(&priv->curbssparams.rates, join_cmd->bss.rates, ratesize);
+	memcpy(&priv->curbssparams.rates, cmd->bss.rates, ratesize);
 
 	/* Set MSB on basic rates as the firmware requires, but _after_
 	 * copying to current bss rates.
 	 */
-	lbs_set_basic_rate_flags(join_cmd->bss.rates, ratesize);
+	lbs_set_basic_rate_flags(cmd->bss.rates, ratesize);
 
-	join_cmd->bss.ssparamset.ibssparamset.atimwindow =
+	cmd->bss.ssparamset.ibssparamset.atimwindow =
 	    cpu_to_le16(bss->atimwindow);
 
 	if (assoc_req->secinfo.wep_enabled) {
-		u16 tmp = le16_to_cpu(join_cmd->bss.capability);
+		u16 tmp = le16_to_cpu(cmd->bss.capability);
 		tmp |= WLAN_CAPABILITY_PRIVACY;
-		join_cmd->bss.capability = cpu_to_le16(tmp);
+		cmd->bss.capability = cpu_to_le16(tmp);
 	}
 
 	if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
 		/* wake up first */
-		__le32 Localpsmode;
+		__le32 local_ps_mode;
 
-		Localpsmode = cpu_to_le32(LBS802_11POWERMODECAM);
+		local_ps_mode = cpu_to_le32(LBS802_11POWERMODECAM);
 		ret = lbs_prepare_and_send_command(priv,
 					    CMD_802_11_PS_MODE,
-					    CMD_ACT_SET,
-					    0, 0, &Localpsmode);
-
+					    CMD_SUBCMD_EXIT_PS,
+					    0, 0, &local_ps_mode);
 		if (ret) {
 			ret = -1;
 			goto done;
@@ -681,16 +669,13 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
 		goto done;
 	}
 
-	cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) +
-				S_DS_GEN + cmdappendsize);
-
 done:
 	lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
 	return ret;
 }
 
 int lbs_ret_80211_associate(struct lbs_private *priv,
-			      struct cmd_ds_command *resp)
+			    struct cmd_ds_802_11_associate_rsp *resp)
 {
 	int ret = 0;
 	union iwreq_data wrqu;
@@ -707,7 +692,7 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
 	}
 	bss = &priv->in_progress_assoc_req->bss;
 
-	passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
+	passocrsp = (struct ieeetypes_assocrsp *) &resp->assocRsp;
 
 	/*
 	 * Older FW versions map the IEEE 802.11 Status Code in the association
@@ -758,8 +743,8 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
 		goto done;
 	}
 
-	lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_RESP", (void *)&resp->params,
-		le16_to_cpu(resp->size) - S_DS_GEN);
+	lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_RESP", (void *)&resp->assocRsp,
+		le16_to_cpu(resp->hdr.size) - sizeof(struct cmd_header));
 
 	/* Send a Media Connected event, according to the Spec */
 	priv->connect_status = LBS_CONNECTED;
@@ -793,8 +778,7 @@ done:
 	return ret;
 }
 
-int lbs_ret_80211_disassociate(struct lbs_private *priv,
-				 struct cmd_ds_command *resp)
+int lbs_ret_80211_disassociate(struct lbs_private *priv)
 {
 	lbs_deb_enter(LBS_DEB_JOIN);
 
@@ -805,21 +789,18 @@ int lbs_ret_80211_disassociate(struct lbs_private *priv,
 }
 
 int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
-				 struct cmd_ds_command *resp)
+			       struct cmd_ds_802_11_ad_hoc_rsp *resp)
 {
 	int ret = 0;
-	u16 command = le16_to_cpu(resp->command);
-	u16 result = le16_to_cpu(resp->result);
-	struct cmd_ds_802_11_ad_hoc_result *padhocresult;
+	u16 command = le16_to_cpu(resp->hdr.command);
+	u16 result = le16_to_cpu(resp->hdr.result);
 	union iwreq_data wrqu;
 	struct bss_descriptor *bss;
 	DECLARE_MAC_BUF(mac);
 
 	lbs_deb_enter(LBS_DEB_JOIN);
 
-	padhocresult = &resp->params.result;
-
-	lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->size));
+	lbs_deb_join("ADHOC_RESP: size = %d\n", le16_to_cpu(resp->hdr.size));
 	lbs_deb_join("ADHOC_RESP: command = %x\n", command);
 	lbs_deb_join("ADHOC_RESP: result = %x\n", result);
 
@@ -854,7 +835,7 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
 
 	if (command == CMD_RET(CMD_802_11_AD_HOC_START)) {
 		/* Update the created network descriptor with the new BSSID */
-		memcpy(bss->bssid, padhocresult->bssid, ETH_ALEN);
+		memcpy(bss->bssid, resp->bssid, ETH_ALEN);
 	}
 
 	/* Set the BSSID from the joined/started descriptor */
@@ -875,15 +856,14 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
 	lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
 	lbs_deb_join("ADHOC_RESP: channel = %d\n", priv->curbssparams.channel);
 	lbs_deb_join("ADHOC_RESP: BSSID = %s\n",
-		     print_mac(mac, padhocresult->bssid));
+		     print_mac(mac, resp->bssid));
 
 done:
 	lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
 	return ret;
 }
 
-int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv,
-				struct cmd_ds_command *resp)
+int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv)
 {
 	lbs_deb_enter(LBS_DEB_JOIN);
 
diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h
index c617d07..2e7ea6d 100644
--- a/drivers/net/wireless/libertas/join.h
+++ b/drivers/net/wireless/libertas/join.h
@@ -10,33 +10,32 @@
 
 #include "defs.h"
 #include "dev.h"
+#include "hostcmd.h"
 
 struct cmd_ds_command;
 int lbs_cmd_80211_authenticate(struct lbs_private *priv,
-					struct cmd_ds_command *cmd,
-					void *pdata_buf);
+				struct cmd_ds_802_11_authenticate *cmd,
+				void *pdata_buf);
 int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
-				       struct cmd_ds_command *cmd,
-				       void *pdata_buf);
+				struct cmd_ds_802_11_ad_hoc_join *cmd,
+				void *pdata_buf);
 int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv,
-				       struct cmd_ds_command *cmd);
+				struct cmd_header *cmd);
 int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
-					struct cmd_ds_command *cmd,
-					void *pdata_buf);
+				struct cmd_ds_802_11_ad_hoc_start *cmd,
+				void *pdata_buf);
 int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
-					  struct cmd_ds_command *cmd);
+				struct cmd_ds_802_11_deauthenticate *cmd);
 int lbs_cmd_80211_associate(struct lbs_private *priv,
-				     struct cmd_ds_command *cmd,
-				     void *pdata_buf);
+				struct cmd_ds_802_11_associate *cmd,
+				void *pdata_buf);
 
 int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
-					struct cmd_ds_command *resp);
-int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv,
-				       struct cmd_ds_command *resp);
-int lbs_ret_80211_disassociate(struct lbs_private *priv,
-					struct cmd_ds_command *resp);
+			       struct cmd_ds_802_11_ad_hoc_rsp *resp);
+int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv);
+int lbs_ret_80211_disassociate(struct lbs_private *priv);
 int lbs_ret_80211_associate(struct lbs_private *priv,
-				     struct cmd_ds_command *resp);
+			    struct cmd_ds_802_11_associate_rsp *resp);
 
 int lbs_start_adhoc_network(struct lbs_private *priv,
 			     struct assoc_request * assoc_req);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 8866402..3761138 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -282,10 +282,8 @@ static ssize_t lbs_rtap_set(struct device *dev,
 				lbs_stop_adhoc_network(priv);
 			lbs_add_rtap(priv);
 		}
-		priv->monitormode = monitor_mode;
-	}
-
-	else {
+		priv->monitormode = (u16) monitor_mode;
+	} else {
 		if (priv->monitormode == LBS_MONITOR_OFF)
 			return strlen(buf);
 		priv->monitormode = LBS_MONITOR_OFF;
@@ -620,7 +618,7 @@ static void lbs_set_multicast_list(struct net_device *dev)
 				}
 				/* send multicast addresses to firmware */
 				lbs_prepare_and_send_command(priv,
-						      CMD_MAC_MULTICAST_ADR,
+						      CMD_MAC_MULTICAST_ADDR,
 						      CMD_ACT_SET, 0, 0,
 						      NULL);
 			}
@@ -888,7 +886,7 @@ static void command_timer_fn(unsigned long data)
 {
 	struct lbs_private *priv = (struct lbs_private *)data;
 	struct cmd_ctrl_node *ptempnode;
-	struct cmd_ds_command *cmd;
+	struct cmd_header *cmd;
 	unsigned long flags;
 
 	ptempnode = priv->cur_cmd;
@@ -897,7 +895,7 @@ static void command_timer_fn(unsigned long data)
 		return;
 	}
 
-	cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
+	cmd = (struct cmd_header *)ptempnode->bufvirtualaddr;
 	if (!cmd) {
 		lbs_deb_fw("cmd is NULL\n");
 		return;
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 8b6ce61..18d7e7a 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -1483,21 +1483,20 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
  *  @return           0 or -1
  */
 int lbs_cmd_80211_scan(struct lbs_private *priv,
-	struct cmd_ds_command *cmd, void *pdata_buf)
+	struct cmd_ds_802_11_scan *cmd, void *pdata_buf)
 {
-	struct cmd_ds_802_11_scan *pscan = &cmd->params.scan;
 	struct lbs_scan_cmd_config *pscancfg = pdata_buf;
 
 	lbs_deb_enter(LBS_DEB_SCAN);
 
-	/* Set fixed field variables in scan command */
-	pscan->bsstype = pscancfg->bsstype;
-	memcpy(pscan->bssid, pscancfg->bssid, ETH_ALEN);
-	memcpy(pscan->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen);
-
+	cmd->hdr.command = cpu_to_le16(CMD_802_11_SCAN);
 	/* size is equal to the sizeof(fixed portions) + the TLV len + header */
-	cmd->size = cpu_to_le16(sizeof(pscan->bsstype) + ETH_ALEN
-				+ pscancfg->tlvbufferlen + S_DS_GEN);
+	cmd->hdr.size = cpu_to_le16(sizeof(*cmd) + pscancfg->tlvbufferlen);
+
+	/* Set fixed field variables in scan command */
+	cmd->bsstype = pscancfg->bsstype;
+	memcpy(cmd->bssid, pscancfg->bssid, ETH_ALEN);
+	memcpy(cmd->tlvbuffer, pscancfg->tlvbuffer, pscancfg->tlvbufferlen);
 
 	lbs_deb_leave(LBS_DEB_SCAN);
 	return 0;
@@ -1529,9 +1528,9 @@ int lbs_cmd_80211_scan(struct lbs_private *priv,
  *
  *  @return        0 or -1
  */
-int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp)
+int lbs_ret_80211_scan(struct lbs_private *priv,
+		       struct cmd_ds_802_11_scan_rsp *resp)
 {
-	struct cmd_ds_802_11_scan_rsp *pscan;
 	struct bss_descriptor * iter_bss;
 	struct bss_descriptor * safe;
 	u8 *pbssinfo;
@@ -1552,33 +1551,30 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp)
 		clear_bss_descriptor(iter_bss);
 	}
 
-	pscan = &resp->params.scanresp;
-
-	if (pscan->nr_sets > MAX_NETWORK_COUNT) {
+	if (resp->nr_sets > MAX_NETWORK_COUNT) {
 		lbs_deb_scan(
 		       "SCAN_RESP: too many scan results (%d, max %d)!!\n",
-		       pscan->nr_sets, MAX_NETWORK_COUNT);
+		       resp->nr_sets, MAX_NETWORK_COUNT);
 		ret = -1;
 		goto done;
 	}
 
-	bytesleft = le16_to_cpu(get_unaligned((u16*)&pscan->bssdescriptsize));
+	bytesleft = le16_to_cpu(get_unaligned((u16*)&resp->bssdescriptsize));
 	lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
 
-	scanrespsize = le16_to_cpu(get_unaligned((u16*)&resp->size));
-	lbs_deb_scan("SCAN_RESP: scan results %d\n",
-	       pscan->nr_sets);
+	scanrespsize = le16_to_cpu(get_unaligned((u16*)&resp->hdr.size));
+	lbs_deb_scan("SCAN_RESP: scan results %d\n", resp->nr_sets);
 
-	pbssinfo = pscan->bssdesc_and_tlvbuffer;
+	pbssinfo = resp->bssdesc_and_tlvbuffer;
 
 	/* The size of the TLV buffer is equal to the entire command response
 	 *   size (scanrespsize) minus the fixed fields (sizeof()'s), the
 	 *   BSS Descriptions (bssdescriptsize as bytesLef) and the command
 	 *   response header (S_DS_GEN)
 	 */
-	tlvbufsize = scanrespsize - (bytesleft + sizeof(pscan->bssdescriptsize)
-				     + sizeof(pscan->nr_sets)
-				     + S_DS_GEN);
+	tlvbufsize = scanrespsize - (bytesleft + sizeof(resp->bssdescriptsize)
+				     + sizeof(resp->nr_sets)
+				     + sizeof(struct cmd_header));
 
 	/*
 	 *  Process each scan response returned (pscan->nr_sets).  Save
@@ -1586,7 +1582,7 @@ int lbs_ret_80211_scan(struct lbs_private *priv, struct cmd_ds_command *resp)
 	 *    driver scan table either as an update to an existing entry
 	 *    or as an addition at the end of the table
 	 */
-	for (idx = 0; idx < pscan->nr_sets && bytesleft; idx++) {
+	for (idx = 0; idx < resp->nr_sets && bytesleft; idx++) {
 		struct bss_descriptor new;
 		struct bss_descriptor * found = NULL;
 		struct bss_descriptor * oldest = NULL;
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index 319f70d..fee37aa 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -9,6 +9,7 @@
 
 #include <net/ieee80211.h>
 #include "hostcmd.h"
+#include "11d.h"
 
 /**
  *  @brief Maximum number of channels that can be sent in a setuserscan ioctl
@@ -180,11 +181,11 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid,
 				u8 ssid_len, u8 clear_ssid);
 
 int lbs_cmd_80211_scan(struct lbs_private *priv,
-				struct cmd_ds_command *cmd,
+				struct cmd_ds_802_11_scan *cmd,
 				void *pdata_buf);
 
 int lbs_ret_80211_scan(struct lbs_private *priv,
-				struct cmd_ds_command *resp);
+				struct cmd_ds_802_11_scan_rsp *resp);
 
 int lbs_scan_networks(struct lbs_private *priv,
 	const struct lbs_ioctl_user_scan_cfg *puserscanin,
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 1e0b224..fe49a1b 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -293,14 +293,14 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
 {
 	int ret = 0;
 	struct lbs_private *priv = dev->priv;
-	u32 rthr = vwrq->value;
+	u16 rthr = vwrq->value;
 
 	lbs_deb_enter(LBS_DEB_WEXT);
 
 	if (vwrq->disabled) {
 		priv->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
 	} else {
-		if (rthr < MRVDRV_RTS_MIN_VALUE || rthr > MRVDRV_RTS_MAX_VALUE)
+		if (rthr > MRVDRV_RTS_MAX_VALUE)
 			return -EINVAL;
 		priv->rtsthsd = rthr;
 	}
@@ -342,7 +342,7 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,
 			 struct iw_param *vwrq, char *extra)
 {
 	int ret = 0;
-	u32 fthr = vwrq->value;
+	u16 fthr = vwrq->value;
 	struct lbs_private *priv = dev->priv;
 
 	lbs_deb_enter(LBS_DEB_WEXT);
@@ -469,7 +469,8 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info,
 		ret = lbs_prepare_and_send_command(priv, CMD_802_11_SNMP_MIB,
 					    CMD_ACT_SET,
 					    CMD_OPTION_WAITFORRSP,
-					    OID_802_11_TX_RETRYCOUNT, NULL);
+					    OID_802_11_TX_RETRYCOUNT,
+					    &priv->txretrycount);
 
 		if (ret)
 			goto out;




More information about the libertas-dev mailing list