* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <typedefs.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <bcmdefs.h>
+#include <linux/netdevice.h>
#include <osl.h>
#include <bcmutils.h>
#include <bcmendian.h>
static int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen)
{
- char eabuf[ETHER_ADDR_STR_LEN];
-
struct bcmstrbuf b;
struct bcmstrbuf *strbuf = &b;
dhdp->up, dhdp->txoff, dhdp->busstate);
bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",
dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz);
- bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %s\n",
- dhdp->iswl, dhdp->drv_version, bcm_ether_ntoa(&dhdp->mac,
- eabuf));
+ bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n",
+ dhdp->iswl, dhdp->drv_version, &dhdp->mac);
bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror,
dhdp->tickcnt);
}
}
-bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec)
+bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
+ int prec)
{
- void *p;
+ struct sk_buff *p;
int eprec = -1; /* precedence to evict from */
bool discard_oldest;
*/
if (!pktq_pfull(q, prec) && !pktq_full(q)) {
pktq_penq(q, prec, pkt);
- return TRUE;
+ return true;
}
/* Determine precedence from which to evict packet, if any */
p = pktq_peek_tail(q, &eprec);
ASSERT(p);
if (eprec > prec)
- return FALSE;
+ return false;
}
/* Evict if needed */
ASSERT(!pktq_pempty(q, eprec));
discard_oldest = AC_BITMAP_TST(dhdp->wme_dp, eprec);
if (eprec == prec && !discard_oldest)
- return FALSE; /* refuse newer (incoming) packet */
+ return false; /* refuse newer (incoming) packet */
/* Evict packet according to discard policy */
p = discard_oldest ? pktq_pdeq(q, eprec) : pktq_pdeq_tail(q,
eprec);
ASSERT(p);
}
- PKTFREE(dhdp->osh, p, TRUE);
+ PKTFREE(dhdp->osh, p, true);
}
/* Enqueue */
ASSERT(p);
}
- return TRUE;
+ return true;
}
static int
static void wl_show_host_event(wl_event_msg_t *event, void *event_data)
{
uint i, status, reason;
- bool group = FALSE, flush_txq = FALSE, link = FALSE;
+ bool group = false, flush_txq = false, link = false;
char *auth_str, *event_name;
unsigned char *buf;
char err_msg[256], eabuf[ETHER_ADDR_STR_LEN];
auth_type = ntoh32(event->auth_type);
datalen = ntoh32(event->datalen);
/* debug dump of event messages */
- sprintf(eabuf, "%02x:%02x:%02x:%02x:%02x:%02x",
- (unsigned char) event->addr.octet[0] & 0xff,
- (unsigned char) event->addr.octet[1] & 0xff,
- (unsigned char) event->addr.octet[2] & 0xff,
- (unsigned char) event->addr.octet[3] & 0xff,
- (unsigned char) event->addr.octet[4] & 0xff,
- (unsigned char) event->addr.octet[5] & 0xff);
+ sprintf(eabuf, "%pM", event->addr.octet);
event_name = "UNKNOWN";
for (i = 0; i < ARRAY_SIZE(event_names); i++) {
DHD_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type));
if (flags & WLC_EVENT_MSG_LINK)
- link = TRUE;
+ link = true;
if (flags & WLC_EVENT_MSG_GROUP)
- group = TRUE;
+ group = true;
if (flags & WLC_EVENT_MSG_FLUSHTXQ)
- flush_txq = TRUE;
+ flush_txq = true;
switch (event_type) {
case WLC_E_START:
printf("\n");
}
-#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
-
/* Convert user's input in hex pattern to byte-size mask */
static int wl_pattern_atoh(char *src, char *dst)
{
char num[3];
strncpy(num, src, 2);
num[2] = '\0';
- dst[i] = (u8) strtoul(num, NULL, 16);
+ dst[i] = (u8) simple_strtoul(num, NULL, 16);
src += 2;
}
return i;
wl_pkt_filter_enable_t enable_parm;
wl_pkt_filter_enable_t *pkt_filterp;
- arg_save = MALLOC(dhd->osh, strlen(arg) + 1);
+ arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
if (!arg_save) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
arg_org = arg_save;
memcpy(arg_save, arg, strlen(arg) + 1);
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
i = 0;
if (NULL == argv[i]) {
pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- enable_parm.id = htod32(strtoul(argv[i], NULL, 0));
+ enable_parm.id = htod32(simple_strtoul(argv[i], NULL, 0));
/* Parse enable/disable value. */
enable_parm.enable = htod32(enable);
fail:
if (arg_org)
- MFREE(dhd->osh, arg_org, strlen(arg) + 1);
+ kfree(arg_org);
}
void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
char *arg_save = 0, *arg_org = 0;
#define BUF_SIZE 2048
- arg_save = MALLOC(dhd->osh, strlen(arg) + 1);
+ arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
if (!arg_save) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
arg_org = arg_save;
- buf = MALLOC(dhd->osh, BUF_SIZE);
+ buf = kmalloc(BUF_SIZE, GFP_ATOMIC);
if (!buf) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
goto fail;
}
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
while (argv[i++])
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
i = 0;
if (NULL == argv[i]) {
pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- pkt_filter.id = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.id = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Polarity not provided\n"));
}
/* Parse filter polarity. */
- pkt_filter.negate_match = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.negate_match = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Filter type not provided\n"));
}
/* Parse filter type. */
- pkt_filter.type = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.type = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Offset not provided\n"));
}
/* Parse pattern filter offset. */
- pkt_filter.u.pattern.offset = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.u.pattern.offset = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Bitmask not provided\n"));
fail:
if (arg_org)
- MFREE(dhd->osh, arg_org, strlen(arg) + 1);
+ kfree(arg_org);
if (buf)
- MFREE(dhd->osh, buf, BUF_SIZE);
+ kfree(buf);
}
void dhd_arp_offload_set(dhd_pub_t *dhd, int arp_mode)
ptr = buf;
bcm_mkiovar("ver", 0, 0, buf, sizeof(buf));
dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));
- bcmstrtok(&ptr, "\n", 0);
+ strsep(&ptr, "\n");
/* Print fw version info */
DHD_ERROR(("Firmware version = %s\n", buf));
dhd_iscan_lock();
- iscanbuf_alloc = (iscan_buf_t *) MALLOC(dhd->osh, sizeof(iscan_buf_t));
+ iscanbuf_alloc = kmalloc(sizeof(iscan_buf_t), GFP_ATOMIC);
if (iscanbuf_alloc == NULL)
goto fail;
iscanbuf_free = iscanbuf_cur;
iscanbuf_cur = iscanbuf_cur->next;
iscanbuf_free->next = 0;
- MFREE(dhd->osh, iscanbuf_free, sizeof(iscan_buf_t));
+ kfree(iscanbuf_free);
}
iscan_chain = 0;
} else {
iscanbuf_prv->next = iscan_delete->next;
iscan_delete->next = 0;
- MFREE(dhd->osh, iscan_delete, sizeof(iscan_buf_t));
+ kfree(iscan_delete);
if (!iscanbuf_prv)
iscan_chain = 0;
bi->BSSID.octet[2], bi->BSSID.octet[3],
bi->BSSID.octet[4], bi->BSSID.octet[5]));
- bi = (wl_bss_info_t *) ((uintptr) bi +
+ bi = (wl_bss_info_t *)((unsigned long)bi +
dtoh32(bi->length));
}
iscan_cur = iscan_cur->next;
bi->BSSID.octet[5]));
bi_new = bi;
- bi = (wl_bss_info_t *) ((uintptr) bi +
+ bi = (wl_bss_info_t *)((unsigned long)bi +
dtoh32
(bi->length));
/*
bi->BSSID.octet[5]));
bi_next =
- (wl_bss_info_t
- *) ((uintptr) bi +
+ (wl_bss_info_t *)((unsigned long)bi +
dtoh32
(bi->length));
bcopy(bi, bi_new,
dtoh32
(bi->length));
bi_new =
- (wl_bss_info_t
- *) ((uintptr)
- bi_new +
+ (wl_bss_info_t *)((unsigned long)bi_new +
dtoh32
(bi_new->
length));
}
break;
}
- bi = (wl_bss_info_t *) ((uintptr) bi +
+ bi = (wl_bss_info_t *)((unsigned long)bi +
dtoh32(bi->length));
}
}
dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur);
- bi = (wl_bss_info_t *) ((uintptr) bi + dtoh32(bi->length));
+ bi = (wl_bss_info_t *)((unsigned long)bi + dtoh32(bi->length));
}
done: