Commit 2228b27d authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: renamed ioctl functions/structs to dcmd

The fullmac dongle communicates with the driver using certain codes. These
codes were named 'ioctls' in the code, but this term is confusing since
it is used in kernel<->driver context. The term 'ioctl' has been replaced
with 'dcmd' for 'dongle command'.
Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8ff3a896
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
#define BRCMF_VERSION_STR "4.218.248.5" #define BRCMF_VERSION_STR "4.218.248.5"
#define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */ #define BRCMF_C_DCMD_SMLEN 256 /* "small" cmd buffer required */
#define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */ #define BRCMF_C_DCMD_MEDLEN 1536 /* "med" cmd buffer required */
#define BRCMF_C_IOCTL_MAXLEN 8192 #define BRCMF_C_DCMD_MAXLEN 8192
/******************************************************************************* /*******************************************************************************
* IO codes that are interpreted by dongle firmware * IO codes that are interpreted by dongle firmware
...@@ -572,12 +572,12 @@ struct brcmf_channel_info_le { ...@@ -572,12 +572,12 @@ struct brcmf_channel_info_le {
__le32 scan_channel; __le32 scan_channel;
}; };
/* Linux network driver ioctl encoding */ /* Bus independent dongle command */
struct brcmf_ioctl { struct brcmf_dcmd {
uint cmd; /* common ioctl definition */ uint cmd; /* common dongle cmd definition */
void *buf; /* pointer to user buffer */ void *buf; /* pointer to user buffer */
uint len; /* length of user buffer */ uint len; /* length of user buffer */
u8 set; /* get or set request (optional) */ u8 set; /* get or set request (optional) */
uint used; /* bytes read or written (optional) */ uint used; /* bytes read or written (optional) */
uint needed; /* bytes needed (optional) */ uint needed; /* bytes needed (optional) */
}; };
...@@ -694,7 +694,7 @@ extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, ...@@ -694,7 +694,7 @@ extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,
extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
extern s32 brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len); extern s32 brcmf_exec_dcmd(struct net_device *dev, u32 cmd, void *arg, u32 len);
/* Indication from bus module regarding removal/absence of dongle */ /* Indication from bus module regarding removal/absence of dongle */
extern void brcmf_detach(struct brcmf_pub *drvr); extern void brcmf_detach(struct brcmf_pub *drvr);
...@@ -716,8 +716,8 @@ extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); ...@@ -716,8 +716,8 @@ extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp,
bool success); bool success);
/* Query ioctl */ /* Query dongle */
extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx,
uint cmd, void *buf, uint len); uint cmd, void *buf, uint len);
/* OS independent layer functions */ /* OS independent layer functions */
...@@ -749,17 +749,7 @@ extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg); ...@@ -749,17 +749,7 @@ extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
int enable, int master_mode); int enable, int master_mode);
/* per-driver magic numbers */ #define BRCMF_DCMD_MAXLEN 8192 /* max length cmd buffer required */
#define BRCMF_IOCTL_MAGIC 0x00444944
/* bump this number if you change the ioctl interface */
#define BRCMF_IOCTL_VERSION 1
#define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */
/* common ioctl definitions */
#define BRCMF_GET_VERSION 1
#define BRCMF_GET_VAR 2
#define BRCMF_SET_VAR 3
/* message levels */ /* message levels */
#define BRCMF_ERROR_VAL 0x0001 #define BRCMF_ERROR_VAL 0x0001
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
*/ */
/******************************************************************************* /*******************************************************************************
* Communicates with the dongle by using Broadcom specific ioctl codes. * Communicates with the dongle by using dcmd codes.
* For certain ioctl codes, the dongle interprets string data from the host. * For certain dcmd codes, the dongle interprets string data from the host.
******************************************************************************/ ******************************************************************************/
#include <linux/types.h> #include <linux/types.h>
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include "dhd_bus.h" #include "dhd_bus.h"
#include "dhd_dbg.h" #include "dhd_dbg.h"
struct brcmf_proto_cdc_ioctl { struct brcmf_proto_cdc_dcmd {
__le32 cmd; /* ioctl command value */ __le32 cmd; /* dongle command value */
__le32 len; /* lower 16: output buflen; __le32 len; /* lower 16: output buflen;
* upper 16: input buflen (excludes header) */ * upper 16: input buflen (excludes header) */
__le32 flags; /* flag defns given below */ __le32 flags; /* flag defns given below */
...@@ -44,14 +44,14 @@ struct brcmf_proto_cdc_ioctl { ...@@ -44,14 +44,14 @@ struct brcmf_proto_cdc_ioctl {
#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) #define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN)
/* CDC flag definitions */ /* CDC flag definitions */
#define CDCF_IOC_ERROR 0x01 /* 1=ioctl cmd failed */ #define CDC_DCMD_ERROR 0x01 /* 1=cmd failed */
#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */ #define CDC_DCMD_SET 0x02 /* 0=get, 1=set cmd */
#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */ #define CDC_DCMD_IF_MASK 0xF000 /* I/F index */
#define CDCF_IOC_IF_SHIFT 12 #define CDC_DCMD_IF_SHIFT 12
#define CDCF_IOC_ID_MASK 0xFFFF0000 /* id an ioctl pairing */ #define CDC_DCMD_ID_MASK 0xFFFF0000 /* id an cmd pairing */
#define CDCF_IOC_ID_SHIFT 16 /* ID Mask shift bits */ #define CDC_DCMD_ID_SHIFT 16 /* ID Mask shift bits */
#define CDC_IOC_ID(flags) \ #define CDC_DCMD_ID(flags) \
(((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT) (((flags) & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT)
/* /*
* BDC header - Broadcom specific extension of CDC. * BDC header - Broadcom specific extension of CDC.
...@@ -81,7 +81,7 @@ struct brcmf_proto_bdc_header { ...@@ -81,7 +81,7 @@ struct brcmf_proto_bdc_header {
}; };
#define RETRIES 2 /* # of retries to retrieve matching ioctl response */ #define RETRIES 2 /* # of retries to retrieve matching dcmd response */
#define BUS_HEADER_LEN (16+BRCMF_SDALIGN) /* Must be atleast SDPCM_RESERVE #define BUS_HEADER_LEN (16+BRCMF_SDALIGN) /* Must be atleast SDPCM_RESERVE
* (amount of header tha might be added) * (amount of header tha might be added)
* plus any space that might be needed * plus any space that might be needed
...@@ -96,15 +96,15 @@ struct brcmf_proto { ...@@ -96,15 +96,15 @@ struct brcmf_proto {
u8 pending; u8 pending;
u32 lastcmd; u32 lastcmd;
u8 bus_header[BUS_HEADER_LEN]; u8 bus_header[BUS_HEADER_LEN];
struct brcmf_proto_cdc_ioctl msg; struct brcmf_proto_cdc_dcmd msg;
unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN]; unsigned char buf[BRCMF_C_DCMD_MAXLEN + ROUND_UP_MARGIN];
}; };
static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr) static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr)
{ {
struct brcmf_proto *prot = drvr->prot; struct brcmf_proto *prot = drvr->prot;
int len = le32_to_cpu(prot->msg.len) + int len = le32_to_cpu(prot->msg.len) +
sizeof(struct brcmf_proto_cdc_ioctl); sizeof(struct brcmf_proto_cdc_dcmd);
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
...@@ -130,20 +130,20 @@ static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) ...@@ -130,20 +130,20 @@ static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len)
do { do {
ret = brcmf_sdbrcm_bus_rxctl(drvr->bus, ret = brcmf_sdbrcm_bus_rxctl(drvr->bus,
(unsigned char *)&prot->msg, (unsigned char *)&prot->msg,
len + sizeof(struct brcmf_proto_cdc_ioctl)); len + sizeof(struct brcmf_proto_cdc_dcmd));
if (ret < 0) if (ret < 0)
break; break;
} while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id); } while (CDC_DCMD_ID(le32_to_cpu(prot->msg.flags)) != id);
return ret; return ret;
} }
int int
brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
void *buf, uint len) void *buf, uint len)
{ {
struct brcmf_proto *prot = drvr->prot; struct brcmf_proto *prot = drvr->prot;
struct brcmf_proto_cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_dcmd *msg = &prot->msg;
void *info; void *info;
int ret = 0, retries = 0; int ret = 0, retries = 0;
u32 id, flags; u32 id, flags;
...@@ -163,12 +163,13 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -163,12 +163,13 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
} }
} }
memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl)); memset(msg, 0, sizeof(struct brcmf_proto_cdc_dcmd));
msg->cmd = cpu_to_le32(cmd); msg->cmd = cpu_to_le32(cmd);
msg->len = cpu_to_le32(len); msg->len = cpu_to_le32(len);
flags = (++prot->reqid << CDCF_IOC_ID_SHIFT); flags = (++prot->reqid << CDC_DCMD_ID_SHIFT);
flags = (flags & ~CDCF_IOC_IF_MASK) | (ifidx << CDCF_IOC_IF_SHIFT); flags = (flags & ~CDC_DCMD_IF_MASK) |
(ifidx << CDC_DCMD_IF_SHIFT);
msg->flags = cpu_to_le32(flags); msg->flags = cpu_to_le32(flags);
if (buf) if (buf)
...@@ -188,7 +189,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -188,7 +189,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
goto done; goto done;
flags = le32_to_cpu(msg->flags); flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT;
if ((id < prot->reqid) && (++retries < RETRIES)) if ((id < prot->reqid) && (++retries < RETRIES))
goto retry; goto retry;
...@@ -210,7 +211,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -210,7 +211,7 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
} }
/* Check the ERROR flag */ /* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) { if (flags & CDC_DCMD_ERROR) {
ret = le32_to_cpu(msg->status); ret = le32_to_cpu(msg->status);
/* Cache error from dongle */ /* Cache error from dongle */
drvr->dongle_error = ret; drvr->dongle_error = ret;
...@@ -220,23 +221,24 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -220,23 +221,24 @@ brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
return ret; return ret;
} }
int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
void *buf, uint len) void *buf, uint len)
{ {
struct brcmf_proto *prot = drvr->prot; struct brcmf_proto *prot = drvr->prot;
struct brcmf_proto_cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_dcmd *msg = &prot->msg;
int ret = 0; int ret = 0;
u32 flags, id; u32 flags, id;
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
brcmf_dbg(CTL, "cmd %d len %d\n", cmd, len); brcmf_dbg(CTL, "cmd %d len %d\n", cmd, len);
memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl)); memset(msg, 0, sizeof(struct brcmf_proto_cdc_dcmd));
msg->cmd = cpu_to_le32(cmd); msg->cmd = cpu_to_le32(cmd);
msg->len = cpu_to_le32(len); msg->len = cpu_to_le32(len);
flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET; flags = (++prot->reqid << CDC_DCMD_ID_SHIFT) | CDC_DCMD_SET;
flags = (flags & ~CDCF_IOC_IF_MASK) | (ifidx << CDCF_IOC_IF_SHIFT); flags = (flags & ~CDC_DCMD_IF_MASK) |
(ifidx << CDC_DCMD_IF_SHIFT);
msg->flags = cpu_to_le32(flags); msg->flags = cpu_to_le32(flags);
if (buf) if (buf)
...@@ -251,7 +253,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -251,7 +253,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
goto done; goto done;
flags = le32_to_cpu(msg->flags); flags = le32_to_cpu(msg->flags);
id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT;
if (id != prot->reqid) { if (id != prot->reqid) {
brcmf_dbg(ERROR, "%s: unexpected request id %d (expected %d)\n", brcmf_dbg(ERROR, "%s: unexpected request id %d (expected %d)\n",
...@@ -261,7 +263,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -261,7 +263,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
} }
/* Check the ERROR flag */ /* Check the ERROR flag */
if (flags & CDCF_IOC_ERROR) { if (flags & CDC_DCMD_ERROR) {
ret = le32_to_cpu(msg->status); ret = le32_to_cpu(msg->status);
/* Cache error from dongle */ /* Cache error from dongle */
drvr->dongle_error = ret; drvr->dongle_error = ret;
...@@ -272,7 +274,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, ...@@ -272,7 +274,7 @@ int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd,
} }
int int
brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc, brcmf_proto_dcmd(struct brcmf_pub *drvr, int ifidx, struct brcmf_dcmd *dcmd,
int len) int len)
{ {
struct brcmf_proto *prot = drvr->prot; struct brcmf_proto *prot = drvr->prot;
...@@ -286,50 +288,50 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc, ...@@ -286,50 +288,50 @@ brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc,
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
if (len > BRCMF_C_IOCTL_MAXLEN) if (len > BRCMF_C_DCMD_MAXLEN)
goto done; goto done;
if (prot->pending == true) { if (prot->pending == true) {
brcmf_dbg(TRACE, "CDC packet is pending!!!! cmd=0x%x (%lu) lastcmd=0x%x (%lu)\n", brcmf_dbg(TRACE, "CDC packet is pending!!!! cmd=0x%x (%lu) lastcmd=0x%x (%lu)\n",
ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd, dcmd->cmd, (unsigned long)dcmd->cmd, prot->lastcmd,
(unsigned long)prot->lastcmd); (unsigned long)prot->lastcmd);
if ((ioc->cmd == BRCMF_C_SET_VAR) || if (dcmd->cmd == BRCMF_C_SET_VAR ||
(ioc->cmd == BRCMF_C_GET_VAR)) dcmd->cmd == BRCMF_C_GET_VAR)
brcmf_dbg(TRACE, "iovar cmd=%s\n", (char *)ioc->buf); brcmf_dbg(TRACE, "iovar cmd=%s\n", (char *)dcmd->buf);
goto done; goto done;
} }
prot->pending = true; prot->pending = true;
prot->lastcmd = ioc->cmd; prot->lastcmd = dcmd->cmd;
if (ioc->set) if (dcmd->set)
ret = brcmf_proto_cdc_set_ioctl(drvr, ifidx, ioc->cmd, ret = brcmf_proto_cdc_set_dcmd(drvr, ifidx, dcmd->cmd,
ioc->buf, len); dcmd->buf, len);
else { else {
ret = brcmf_proto_cdc_query_ioctl(drvr, ifidx, ioc->cmd, ret = brcmf_proto_cdc_query_dcmd(drvr, ifidx, dcmd->cmd,
ioc->buf, len); dcmd->buf, len);
if (ret > 0) if (ret > 0)
ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl); dcmd->used = ret -
sizeof(struct brcmf_proto_cdc_dcmd);
} }
/* Too many programs assume ioctl() returns 0 on success */
if (ret >= 0) if (ret >= 0)
ret = 0; ret = 0;
else { else {
struct brcmf_proto_cdc_ioctl *msg = &prot->msg; struct brcmf_proto_cdc_dcmd *msg = &prot->msg;
/* len == needed when set/query fails from dongle */ /* len == needed when set/query fails from dongle */
ioc->needed = le32_to_cpu(msg->len); dcmd->needed = le32_to_cpu(msg->len);
} }
/* Intercept the wme_dp ioctl here */ /* Intercept the wme_dp dongle cmd here */
if (!ret && ioc->cmd == BRCMF_C_SET_VAR && if (!ret && dcmd->cmd == BRCMF_C_SET_VAR &&
!strcmp(ioc->buf, "wme_dp")) { !strcmp(dcmd->buf, "wme_dp")) {
int slen; int slen;
__le32 val = 0; __le32 val = 0;
slen = strlen("wme_dp") + 1; slen = strlen("wme_dp") + 1;
if (len >= (int)(slen + sizeof(int))) if (len >= (int)(slen + sizeof(int)))
memcpy(&val, (char *)ioc->buf + slen, sizeof(int)); memcpy(&val, (char *)dcmd->buf + slen, sizeof(int));
drvr->wme_dp = (u8) le32_to_cpu(val); drvr->wme_dp = (u8) le32_to_cpu(val);
} }
...@@ -433,8 +435,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr) ...@@ -433,8 +435,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
drvr->prot = cdc; drvr->prot = cdc;
drvr->hdrlen += BDC_HEADER_LEN; drvr->hdrlen += BDC_HEADER_LEN;
drvr->maxctl = BRCMF_C_IOCTL_MAXLEN + drvr->maxctl = BRCMF_C_DCMD_MAXLEN +
sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN; sizeof(struct brcmf_proto_cdc_dcmd) + ROUND_UP_MARGIN;
return 0; return 0;
fail: fail:
...@@ -472,7 +474,7 @@ int brcmf_proto_init(struct brcmf_pub *drvr) ...@@ -472,7 +474,7 @@ int brcmf_proto_init(struct brcmf_pub *drvr)
/* Get the device MAC address */ /* Get the device MAC address */
strcpy(buf, "cur_etheraddr"); strcpy(buf, "cur_etheraddr");
ret = brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, ret = brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR,
buf, sizeof(buf)); buf, sizeof(buf));
if (ret < 0) { if (ret < 0) {
brcmf_os_proto_unblock(drvr); brcmf_os_proto_unblock(drvr);
...@@ -482,7 +484,7 @@ int brcmf_proto_init(struct brcmf_pub *drvr) ...@@ -482,7 +484,7 @@ int brcmf_proto_init(struct brcmf_pub *drvr)
brcmf_os_proto_unblock(drvr); brcmf_os_proto_unblock(drvr);
ret = brcmf_c_preinit_ioctls(drvr); ret = brcmf_c_preinit_dcmds(drvr);
/* Always assumes wl for now */ /* Always assumes wl for now */
drvr->iswl = true; drvr->iswl = true;
......
...@@ -596,7 +596,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable, ...@@ -596,7 +596,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm)); memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm));
/* Enable/disable the specified filter. */ /* Enable/disable the specified filter. */
rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len); rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
rc = rc >= 0 ? 0 : rc; rc = rc >= 0 ? 0 : rc;
if (rc) if (rc)
brcmf_dbg(TRACE, "failed to add pktfilter %s, retcode = %d\n", brcmf_dbg(TRACE, "failed to add pktfilter %s, retcode = %d\n",
...@@ -607,7 +607,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable, ...@@ -607,7 +607,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable,
/* Contorl the master mode */ /* Contorl the master mode */
brcmu_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf, brcmu_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf,
sizeof(buf)); sizeof(buf));
rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf,
sizeof(buf)); sizeof(buf));
rc = rc >= 0 ? 0 : rc; rc = rc >= 0 ? 0 : rc;
if (rc) if (rc)
...@@ -734,7 +734,7 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg) ...@@ -734,7 +734,7 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
&pkt_filter, &pkt_filter,
BRCMF_PKT_FILTER_FIXED_LEN + BRCMF_PKT_FILTER_PATTERN_FIXED_LEN); BRCMF_PKT_FILTER_FIXED_LEN + BRCMF_PKT_FILTER_PATTERN_FIXED_LEN);
rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len); rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len);
rc = rc >= 0 ? 0 : rc; rc = rc >= 0 ? 0 : rc;
if (rc) if (rc)
...@@ -755,7 +755,7 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode) ...@@ -755,7 +755,7 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode)
int retcode; int retcode;
brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf));
retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR,
iovbuf, sizeof(iovbuf)); iovbuf, sizeof(iovbuf));
retcode = retcode >= 0 ? 0 : retcode; retcode = retcode >= 0 ? 0 : retcode;
if (retcode) if (retcode)
...@@ -772,7 +772,7 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable) ...@@ -772,7 +772,7 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
int retcode; int retcode;
brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf)); brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf));
retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR,
iovbuf, sizeof(iovbuf)); iovbuf, sizeof(iovbuf));
retcode = retcode >= 0 ? 0 : retcode; retcode = retcode >= 0 ? 0 : retcode;
if (retcode) if (retcode)
...@@ -783,7 +783,7 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable) ...@@ -783,7 +783,7 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable)
arp_enable); arp_enable);
} }
int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr) int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr)
{ {
char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for
"event_msgs" + '\0' + bitvec */ "event_msgs" + '\0' + bitvec */
...@@ -801,7 +801,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr) ...@@ -801,7 +801,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
/* Set Country code */ /* Set Country code */
if (drvr->country_code[0] != 0) { if (drvr->country_code[0] != 0) {
if (brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_COUNTRY, if (brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_COUNTRY,
drvr->country_code, drvr->country_code,
sizeof(drvr->country_code)) < 0) sizeof(drvr->country_code)) < 0)
brcmf_dbg(ERROR, "country code setting failed\n"); brcmf_dbg(ERROR, "country code setting failed\n");
...@@ -811,7 +811,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr) ...@@ -811,7 +811,7 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
ptr = buf; ptr = buf;
brcmu_mkiovar("ver", NULL, 0, buf, sizeof(buf)); brcmu_mkiovar("ver", NULL, 0, buf, sizeof(buf));
brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf)); brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf));
strsep(&ptr, "\n"); strsep(&ptr, "\n");
/* Print fw version info */ /* Print fw version info */
brcmf_dbg(ERROR, "Firmware version = %s\n", buf); brcmf_dbg(ERROR, "Firmware version = %s\n", buf);
...@@ -819,40 +819,40 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr) ...@@ -819,40 +819,40 @@ int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr)
/* Match Host and Dongle rx alignment */ /* Match Host and Dongle rx alignment */
brcmu_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, brcmu_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
/* disable glom option per default */ /* disable glom option per default */
brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
/* Setup timeout if Beacons are lost and roam is off to report /* Setup timeout if Beacons are lost and roam is off to report
link down */ link down */
brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
/* Enable/Disable build-in roaming to allowed ext supplicant to take /* Enable/Disable build-in roaming to allowed ext supplicant to take
of romaing */ of romaing */
brcmu_mkiovar("roam_off", (char *)&roaming, 4, brcmu_mkiovar("roam_off", (char *)&roaming, 4,
iovbuf, sizeof(iovbuf)); iovbuf, sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
/* Force STA UP */ /* Force STA UP */
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up)); brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up));
/* Setup event_msgs */ /* Setup event_msgs */
brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN, brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
iovbuf, sizeof(iovbuf)); iovbuf, sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME,
(char *)&scan_assoc_time, sizeof(scan_assoc_time)); (char *)&scan_assoc_time, sizeof(scan_assoc_time));
brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME, brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME,
(char *)&scan_unassoc_time, sizeof(scan_unassoc_time)); (char *)&scan_unassoc_time, sizeof(scan_unassoc_time));
/* Set and enable ARP offload feature */ /* Set and enable ARP offload feature */
......
...@@ -141,7 +141,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -141,7 +141,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
__le32 cnt_le; __le32 cnt_le;
__le32 allmulti_le; __le32 allmulti_le;
struct brcmf_ioctl ioc; struct brcmf_dcmd dcmd;
char *buf, *bufp; char *buf, *bufp;
uint buflen; uint buflen;
int ret; int ret;
...@@ -177,13 +177,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -177,13 +177,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
cnt--; cnt--;
} }
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = BRCMF_C_SET_VAR; dcmd.cmd = BRCMF_C_SET_VAR;
ioc.buf = buf; dcmd.buf = buf;
ioc.len = buflen; dcmd.len = buflen;
ioc.set = true; dcmd.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, 0, &dcmd, dcmd.len);
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: set mcast_list failed, cnt %d\n", brcmf_dbg(ERROR, "%s: set mcast_list failed, cnt %d\n",
brcmf_ifname(&drvr_priv->pub, 0), cnt); brcmf_ifname(&drvr_priv->pub, 0), cnt);
...@@ -214,13 +214,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -214,13 +214,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
return; return;
} }
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = BRCMF_C_SET_VAR; dcmd.cmd = BRCMF_C_SET_VAR;
ioc.buf = buf; dcmd.buf = buf;
ioc.len = buflen; dcmd.len = buflen;
ioc.set = true; dcmd.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, 0, &dcmd, dcmd.len);
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: set allmulti %d failed\n", brcmf_dbg(ERROR, "%s: set allmulti %d failed\n",
brcmf_ifname(&drvr_priv->pub, 0), brcmf_ifname(&drvr_priv->pub, 0),
...@@ -235,13 +235,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -235,13 +235,13 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
allmulti = (ndev->flags & IFF_PROMISC) ? true : false; allmulti = (ndev->flags & IFF_PROMISC) ? true : false;
allmulti_le = cpu_to_le32(allmulti); allmulti_le = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = BRCMF_C_SET_PROMISC; dcmd.cmd = BRCMF_C_SET_PROMISC;
ioc.buf = &allmulti_le; dcmd.buf = &allmulti_le;
ioc.len = sizeof(allmulti_le); dcmd.len = sizeof(allmulti_le);
ioc.set = true; dcmd.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, 0, &dcmd, dcmd.len);
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: set promisc %d failed\n", brcmf_dbg(ERROR, "%s: set promisc %d failed\n",
brcmf_ifname(&drvr_priv->pub, 0), brcmf_ifname(&drvr_priv->pub, 0),
...@@ -253,7 +253,7 @@ static void ...@@ -253,7 +253,7 @@ static void
_brcmf_set_mac_address(struct work_struct *work) _brcmf_set_mac_address(struct work_struct *work)
{ {
char buf[32]; char buf[32];
struct brcmf_ioctl ioc; struct brcmf_dcmd dcmd;
int ret; int ret;
struct brcmf_info *drvr_priv = container_of(work, struct brcmf_info, struct brcmf_info *drvr_priv = container_of(work, struct brcmf_info,
...@@ -266,13 +266,13 @@ _brcmf_set_mac_address(struct work_struct *work) ...@@ -266,13 +266,13 @@ _brcmf_set_mac_address(struct work_struct *work)
brcmf_ifname(&drvr_priv->pub, 0)); brcmf_ifname(&drvr_priv->pub, 0));
return; return;
} }
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = BRCMF_C_SET_VAR; dcmd.cmd = BRCMF_C_SET_VAR;
ioc.buf = buf; dcmd.buf = buf;
ioc.len = 32; dcmd.len = 32;
ioc.set = true; dcmd.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, 0, &dcmd, dcmd.len);
if (ret < 0) if (ret < 0)
brcmf_dbg(ERROR, "%s: set cur_etheraddr failed\n", brcmf_dbg(ERROR, "%s: set cur_etheraddr failed\n",
brcmf_ifname(&drvr_priv->pub, 0)); brcmf_ifname(&drvr_priv->pub, 0));
...@@ -628,19 +628,19 @@ static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev) ...@@ -628,19 +628,19 @@ static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev)
as a bitmap in toe_ol iovar */ as a bitmap in toe_ol iovar */
static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol) static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol)
{ {
struct brcmf_ioctl ioc; struct brcmf_dcmd dcmd;
char buf[32]; char buf[32];
int ret; int ret;
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = BRCMF_C_GET_VAR; dcmd.cmd = BRCMF_C_GET_VAR;
ioc.buf = buf; dcmd.buf = buf;
ioc.len = (uint) sizeof(buf); dcmd.len = (uint) sizeof(buf);
ioc.set = false; dcmd.set = false;
strcpy(buf, "toe_ol"); strcpy(buf, "toe_ol");
ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, ifidx, &dcmd, dcmd.len);
if (ret < 0) { if (ret < 0) {
/* Check for older dongle image that doesn't support toe_ol */ /* Check for older dongle image that doesn't support toe_ol */
if (ret == -EIO) { if (ret == -EIO) {
...@@ -662,23 +662,23 @@ static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol) ...@@ -662,23 +662,23 @@ static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol)
and set toe global enable iovar */ and set toe global enable iovar */
static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol) static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
{ {
struct brcmf_ioctl ioc; struct brcmf_dcmd dcmd;
char buf[32]; char buf[32];
int toe, ret; int toe, ret;
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = BRCMF_C_SET_VAR; dcmd.cmd = BRCMF_C_SET_VAR;
ioc.buf = buf; dcmd.buf = buf;
ioc.len = (uint) sizeof(buf); dcmd.len = (uint) sizeof(buf);
ioc.set = true; dcmd.set = true;
/* Set toe_ol as requested */ /* Set toe_ol as requested */
strcpy(buf, "toe_ol"); strcpy(buf, "toe_ol");
memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32)); memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32));
ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, ifidx, &dcmd, dcmd.len);
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: could not set toe_ol: ret=%d\n", brcmf_dbg(ERROR, "%s: could not set toe_ol: ret=%d\n",
brcmf_ifname(&drvr_priv->pub, ifidx), ret); brcmf_ifname(&drvr_priv->pub, ifidx), ret);
...@@ -692,7 +692,7 @@ static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol) ...@@ -692,7 +692,7 @@ static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol)
strcpy(buf, "toe"); strcpy(buf, "toe");
memcpy(&buf[sizeof("toe")], &toe, sizeof(u32)); memcpy(&buf[sizeof("toe")], &toe, sizeof(u32));
ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.len); ret = brcmf_proto_dcmd(&drvr_priv->pub, ifidx, &dcmd, dcmd.len);
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: could not set toe: ret=%d\n", brcmf_dbg(ERROR, "%s: could not set toe: ret=%d\n",
brcmf_ifname(&drvr_priv->pub, ifidx), ret); brcmf_ifname(&drvr_priv->pub, ifidx), ret);
...@@ -849,10 +849,10 @@ static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr, ...@@ -849,10 +849,10 @@ static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
/* called only from within this driver. Sends an ioctl to the dongle. */ /* called only from within this driver. Sends a command to the dongle. */
s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len) s32 brcmf_exec_dcmd(struct net_device *ndev, u32 cmd, void *arg, u32 len)
{ {
struct brcmf_ioctl ioc; struct brcmf_dcmd dcmd;
s32 err = 0; s32 err = 0;
int buflen = 0; int buflen = 0;
bool is_set_key_cmd; bool is_set_key_cmd;
...@@ -860,15 +860,15 @@ s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len) ...@@ -860,15 +860,15 @@ s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len)
netdev_priv(ndev); netdev_priv(ndev);
int ifidx; int ifidx;
memset(&ioc, 0, sizeof(ioc)); memset(&dcmd, 0, sizeof(dcmd));
ioc.cmd = cmd; dcmd.cmd = cmd;
ioc.buf = arg; dcmd.buf = arg;
ioc.len = len; dcmd.len = len;
ifidx = brcmf_net2idx(drvr_priv, ndev); ifidx = brcmf_net2idx(drvr_priv, ndev);
if (ioc.buf != NULL) if (dcmd.buf != NULL)
buflen = min_t(uint, ioc.len, BRCMF_IOCTL_MAXLEN); buflen = min_t(uint, dcmd.len, BRCMF_DCMD_MAXLEN);
/* send to dongle (must be up, and wl) */ /* send to dongle (must be up, and wl) */
if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) { if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) {
...@@ -883,18 +883,18 @@ s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len) ...@@ -883,18 +883,18 @@ s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len)
} }
/* /*
* Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and * Intercept BRCMF_C_SET_KEY CMD - serialize M4 send and
* set key IOCTL to prevent M4 encryption. * set key CMD to prevent M4 encryption.
*/ */
is_set_key_cmd = ((ioc.cmd == BRCMF_C_SET_KEY) || is_set_key_cmd = ((dcmd.cmd == BRCMF_C_SET_KEY) ||
((ioc.cmd == BRCMF_C_SET_VAR) && ((dcmd.cmd == BRCMF_C_SET_VAR) &&
!(strncmp("wsec_key", ioc.buf, 9))) || !(strncmp("wsec_key", dcmd.buf, 9))) ||
((ioc.cmd == BRCMF_C_SET_VAR) && ((dcmd.cmd == BRCMF_C_SET_VAR) &&
!(strncmp("bsscfg:wsec_key", ioc.buf, 15)))); !(strncmp("bsscfg:wsec_key", dcmd.buf, 15))));
if (is_set_key_cmd) if (is_set_key_cmd)
brcmf_netdev_wait_pend8021x(ndev); brcmf_netdev_wait_pend8021x(ndev);
err = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, buflen); err = brcmf_proto_dcmd(&drvr_priv->pub, ifidx, &dcmd, buflen);
done: done:
if (err > 0) if (err > 0)
...@@ -1107,7 +1107,7 @@ int brcmf_bus_start(struct brcmf_pub *drvr) ...@@ -1107,7 +1107,7 @@ int brcmf_bus_start(struct brcmf_pub *drvr)
brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN, brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN,
iovbuf, sizeof(iovbuf)); iovbuf, sizeof(iovbuf));
brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, iovbuf, brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, iovbuf,
sizeof(iovbuf)); sizeof(iovbuf));
memcpy(drvr->eventmask, iovbuf, BRCMF_EVENTING_MASK_LEN); memcpy(drvr->eventmask, iovbuf, BRCMF_EVENTING_MASK_LEN);
......
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
#ifndef _BRCMF_PROTO_H_ #ifndef _BRCMF_PROTO_H_
#define _BRCMF_PROTO_H_ #define _BRCMF_PROTO_H_
#define IOCTL_RESP_TIMEOUT 2000 /* In milli second */
#define IOCTL_CHIP_ACTIVE_TIMEOUT 10 /* In milli second */
/* /*
* Exported from the brcmf protocol module (brcmf_cdc) * Exported from the brcmf protocol module (brcmf_cdc)
*/ */
...@@ -48,16 +45,16 @@ extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx, ...@@ -48,16 +45,16 @@ extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx,
extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx, extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx,
struct sk_buff *rxp); struct sk_buff *rxp);
/* Use protocol to issue ioctl to dongle */ /* Use protocol to issue command to dongle */
extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, extern int brcmf_proto_dcmd(struct brcmf_pub *drvr, int ifidx,
struct brcmf_ioctl *ioc, int len); struct brcmf_dcmd *dcmd, int len);
/* Update local copy of dongle statistics */ /* Update local copy of dongle statistics */
extern void brcmf_proto_dstats(struct brcmf_pub *drvr); extern void brcmf_proto_dstats(struct brcmf_pub *drvr);
extern int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr); extern int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr);
extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx,
uint cmd, void *buf, uint len); uint cmd, void *buf, uint len);
#endif /* _BRCMF_PROTO_H_ */ #endif /* _BRCMF_PROTO_H_ */
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <soc.h> #include <soc.h>
#include "sdio_host.h" #include "sdio_host.h"
#define DCMD_RESP_TIMEOUT 2000 /* In milli second */
#ifdef BCMDBG #ifdef BCMDBG
#define BRCMF_TRAP_INFO_SIZE 80 #define BRCMF_TRAP_INFO_SIZE 80
...@@ -641,7 +643,7 @@ struct brcmf_bus { ...@@ -641,7 +643,7 @@ struct brcmf_bus {
spinlock_t txqlock; spinlock_t txqlock;
wait_queue_head_t ctrl_wait; wait_queue_head_t ctrl_wait;
wait_queue_head_t ioctl_resp_wait; wait_queue_head_t dcmd_resp_wait;
struct timer_list timer; struct timer_list timer;
struct completion watchdog_wait; struct completion watchdog_wait;
...@@ -1616,14 +1618,14 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq) ...@@ -1616,14 +1618,14 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
return num; return num;
} }
static int brcmf_sdbrcm_ioctl_resp_wait(struct brcmf_bus *bus, uint *condition, static int brcmf_sdbrcm_dcmd_resp_wait(struct brcmf_bus *bus, uint *condition,
bool *pending) bool *pending)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
int timeout = msecs_to_jiffies(IOCTL_RESP_TIMEOUT); int timeout = msecs_to_jiffies(DCMD_RESP_TIMEOUT);
/* Wait until control frame is available */ /* Wait until control frame is available */
add_wait_queue(&bus->ioctl_resp_wait, &wait); add_wait_queue(&bus->dcmd_resp_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
while (!(*condition) && (!signal_pending(current) && timeout)) while (!(*condition) && (!signal_pending(current) && timeout))
...@@ -1633,15 +1635,15 @@ static int brcmf_sdbrcm_ioctl_resp_wait(struct brcmf_bus *bus, uint *condition, ...@@ -1633,15 +1635,15 @@ static int brcmf_sdbrcm_ioctl_resp_wait(struct brcmf_bus *bus, uint *condition,
*pending = true; *pending = true;
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&bus->ioctl_resp_wait, &wait); remove_wait_queue(&bus->dcmd_resp_wait, &wait);
return timeout; return timeout;
} }
static int brcmf_sdbrcm_ioctl_resp_wake(struct brcmf_bus *bus) static int brcmf_sdbrcm_dcmd_resp_wake(struct brcmf_bus *bus)
{ {
if (waitqueue_active(&bus->ioctl_resp_wait)) if (waitqueue_active(&bus->dcmd_resp_wait))
wake_up_interruptible(&bus->ioctl_resp_wait); wake_up_interruptible(&bus->dcmd_resp_wait);
return 0; return 0;
} }
...@@ -1732,7 +1734,7 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff) ...@@ -1732,7 +1734,7 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
done: done:
/* Awake any waiters */ /* Awake any waiters */
brcmf_sdbrcm_ioctl_resp_wake(bus); brcmf_sdbrcm_dcmd_resp_wake(bus);
} }
/* Pad read to blocksize for efficiency */ /* Pad read to blocksize for efficiency */
...@@ -3106,7 +3108,7 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) ...@@ -3106,7 +3108,7 @@ brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
brcmf_dbg(TRACE, "Enter\n"); brcmf_dbg(TRACE, "Enter\n");
/* Wait until control frame is available */ /* Wait until control frame is available */
timeleft = brcmf_sdbrcm_ioctl_resp_wait(bus, &bus->rxlen, &pending); timeleft = brcmf_sdbrcm_dcmd_resp_wait(bus, &bus->rxlen, &pending);
down(&bus->sdsem); down(&bus->sdsem);
rxlen = bus->rxlen; rxlen = bus->rxlen;
...@@ -3714,7 +3716,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus) ...@@ -3714,7 +3716,7 @@ void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus)
/* Clear rx control and wake any waiters */ /* Clear rx control and wake any waiters */
bus->rxlen = 0; bus->rxlen = 0;
brcmf_sdbrcm_ioctl_resp_wake(bus); brcmf_sdbrcm_dcmd_resp_wake(bus);
/* Reset some F2 state stuff */ /* Reset some F2 state stuff */
bus->rxskip = false; bus->rxskip = false;
...@@ -4508,7 +4510,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype, ...@@ -4508,7 +4510,7 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
spin_lock_init(&bus->txqlock); spin_lock_init(&bus->txqlock);
init_waitqueue_head(&bus->ctrl_wait); init_waitqueue_head(&bus->ctrl_wait);
init_waitqueue_head(&bus->ioctl_resp_wait); init_waitqueue_head(&bus->dcmd_resp_wait);
/* Set up the watchdog timer */ /* Set up the watchdog timer */
init_timer(&bus->timer); init_timer(&bus->timer);
......
...@@ -103,10 +103,10 @@ do { \ ...@@ -103,10 +103,10 @@ do { \
* report it to cfg80211 through "connect" * report it to cfg80211 through "connect"
* event * event
*/ */
#define WL_IOCTL_LEN_MAX 1024 #define WL_DCMD_LEN_MAX 1024
#define WL_EXTRA_BUF_MAX 2048 #define WL_EXTRA_BUF_MAX 2048
#define WL_ISCAN_BUF_MAX 2048 /* #define WL_ISCAN_BUF_MAX 2048 /*
* the buf length can be BRCMF_C_IOCTL_MAXLEN * the buf length can be BRCMF_C_DCMD_MAXLEN
* to reduce iteration * to reduce iteration
*/ */
#define WL_ISCAN_TIMER_INTERVAL_MS 3000 #define WL_ISCAN_TIMER_INTERVAL_MS 3000
...@@ -251,7 +251,7 @@ struct brcmf_cfg80211_iscan_ctrl { ...@@ -251,7 +251,7 @@ struct brcmf_cfg80211_iscan_ctrl {
struct work_struct work; struct work_struct work;
struct brcmf_cfg80211_iscan_eloop el; struct brcmf_cfg80211_iscan_eloop el;
void *data; void *data;
s8 ioctl_buf[BRCMF_C_IOCTL_SMLEN]; s8 dcmd_buf[BRCMF_C_DCMD_SMLEN];
s8 scan_buf[WL_ISCAN_BUF_MAX]; s8 scan_buf[WL_ISCAN_BUF_MAX];
}; };
...@@ -312,8 +312,8 @@ struct brcmf_cfg80211_priv { ...@@ -312,8 +312,8 @@ struct brcmf_cfg80211_priv {
bool dongle_up; /* indicate whether dongle up or not */ bool dongle_up; /* indicate whether dongle up or not */
bool roam_on; /* on/off switch for dongle self-roaming */ bool roam_on; /* on/off switch for dongle self-roaming */
bool scan_tried; /* indicates if first scan attempted */ bool scan_tried; /* indicates if first scan attempted */
u8 *ioctl_buf; /* ioctl buffer */ u8 *dcmd_buf; /* dcmd buffer */
u8 *extra_buf; /* maily to grab assoc information */ u8 *extra_buf; /* maily to grab assoc information */
struct dentry *debugfsdir; struct dentry *debugfsdir;
u8 ci[0] __aligned(NETDEV_ALIGN); u8 ci[0] __aligned(NETDEV_ALIGN);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment