Commit 2bef7a0f authored by Mithlesh Thukral's avatar Mithlesh Thukral Committed by Greg Kroah-Hartman

Staging: otus : checkpatch.pl cleanup for some more .c files

Second lot of checkpatch.pl error and warning fixes for .c files of
otus driver in staging tree.
(Externs would be removed in a seperate patch)
Signed-off-by: default avatarMithlesh Thukral <mithlesh@linsyssoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b767fa1d
...@@ -111,7 +111,7 @@ extern u8_t zfLnxCreateThread(zdev_t *dev); ...@@ -111,7 +111,7 @@ extern u8_t zfLnxCreateThread(zdev_t *dev);
/* Definition of Wireless Extension */ /* Definition of Wireless Extension */
//wireless extension helper functions /* wireless extension helper functions */
extern int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq); extern int usbdrv_ioctl_setessid(struct net_device *dev, struct iw_point *erq);
extern int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq); extern int usbdrv_ioctl_setrts(struct net_device *dev, struct iw_param *rrq);
/* Wireless Extension Handler functions */ /* Wireless Extension Handler functions */
...@@ -282,8 +282,8 @@ static struct iw_handler_def p80211wext_handler_def = { ...@@ -282,8 +282,8 @@ static struct iw_handler_def p80211wext_handler_def = {
}; };
/* WDS */ /* WDS */
//struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; /* struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */
//void zfInitWdsStruct(void); /* void zfInitWdsStruct(void); */
/* VAP */ /* VAP */
struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
...@@ -314,13 +314,11 @@ irqreturn_t usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs) ...@@ -314,13 +314,11 @@ irqreturn_t usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs)
return IRQ_NONE; return IRQ_NONE;
/* the device is closed, don't continue or else bad things may happen. */ /* the device is closed, don't continue or else bad things may happen. */
if (!netif_running(dev)) { if (!netif_running(dev))
return IRQ_NONE; return IRQ_NONE;
}
if (macp->driver_isolated) { if (macp->driver_isolated)
return IRQ_NONE; return IRQ_NONE;
}
#if (WLAN_HOSTIF == WLAN_PCI) #if (WLAN_HOSTIF == WLAN_PCI)
//zfiIsrPci(dev); //zfiIsrPci(dev);
...@@ -340,9 +338,11 @@ int usbdrv_open(struct net_device *dev) ...@@ -340,9 +338,11 @@ int usbdrv_open(struct net_device *dev)
printk("Enter open()\n"); printk("Enter open()\n");
//#ifndef CONFIG_SMP /*
// read_lock(&(macp->isolate_lock)); * #ifndef CONFIG_SMP
//#endif * read_lock(&(macp->isolate_lock));
* #endif
*/
if (macp->driver_isolated) { if (macp->driver_isolated) {
rc = -EBUSY; rc = -EBUSY;
goto exit; goto exit;
...@@ -393,11 +393,11 @@ int usbdrv_open(struct net_device *dev) ...@@ -393,11 +393,11 @@ int usbdrv_open(struct net_device *dev)
dev->dev_addr[4] = addr[4]; dev->dev_addr[4] = addr[4];
dev->dev_addr[5] = addr[5]; dev->dev_addr[5] = addr[5];
#endif #endif
//zfwMacAddressNotify() will be called to setup dev->dev_addr[] /* zfwMacAddressNotify() will be called to setup dev->dev_addr[] */
zfLnxCreateThread(dev); zfLnxCreateThread(dev);
mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); //10 ms mod_timer(&(macp->hbTimer10ms), jiffies + (1*HZ)/100); /* 10 ms */
netif_carrier_on(dev); netif_carrier_on(dev);
...@@ -425,15 +425,15 @@ int usbdrv_open(struct net_device *dev) ...@@ -425,15 +425,15 @@ int usbdrv_open(struct net_device *dev)
#if ZM_SHARE_AUTH == 1 #if ZM_SHARE_AUTH == 1
zfiWlanSetAuthenticationMode(dev, 1); zfiWlanSetAuthenticationMode(dev, 1);
#endif //#if ZM_SHARE_AUTH == 1 #endif /* #if ZM_SHARE_AUTH == 1 */
#endif //#if ZM_WEP_MOME == 1 #endif /* #if ZM_WEP_MOME == 1 */
#elif ZM_PIBSS_MODE == 1 #elif ZM_PIBSS_MODE == 1
zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO); zfiWlanSetWlanMode(dev, ZM_MODE_PSEUDO);
#else #else
zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE); zfiWlanSetWlanMode(dev, ZM_MODE_INFRASTRUCTURE);
#endif #endif
//zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE); /* zfiWlanSetChannel(dev, ZM_CHANNEL, FALSE); */
zfiWlanSetFrequency(dev, 2462000, FALSE); zfiWlanSetFrequency(dev, 2462000, FALSE);
zfiWlanSetRtsThreshold(dev, 32767); zfiWlanSetRtsThreshold(dev, 32767);
zfiWlanSetFragThreshold(dev, 0); zfiWlanSetFragThreshold(dev, 0);
...@@ -720,7 +720,7 @@ void zfLnxInitVapStruct(void) ...@@ -720,7 +720,7 @@ void zfLnxInitVapStruct(void)
{ {
u16_t i; u16_t i;
for (i=0; i<ZM_VAP_PORT_NUMBER; i++) for (i = 0; i < ZM_VAP_PORT_NUMBER; i++)
{ {
vap[i].dev = NULL; vap[i].dev = NULL;
vap[i].openFlag = 0; vap[i].openFlag = 0;
...@@ -1128,8 +1128,7 @@ u8_t zfLnxClearStructs(struct net_device *dev) ...@@ -1128,8 +1128,7 @@ u8_t zfLnxClearStructs(struct net_device *dev)
printk(KERN_ERR "TxQCnt: %d\n", TxQCnt); printk(KERN_ERR "TxQCnt: %d\n", TxQCnt);
for(ii = 0; ii < TxQCnt; ii++) for (ii = 0; ii < TxQCnt; ii++) {
{
UsbTxQ_t *TxQ = zfLnxGetUsbTxBuffer(dev); UsbTxQ_t *TxQ = zfLnxGetUsbTxBuffer(dev);
printk(KERN_ERR "dev_kfree_skb_any\n"); printk(KERN_ERR "dev_kfree_skb_any\n");
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
/* Called to allocate buffer, must return a continue buffer space */ /* Called to allocate buffer, must return a continue buffer space */
zbuf_t* zfwBufAllocate(zdev_t* dev, u16_t len) zbuf_t *zfwBufAllocate(zdev_t *dev, u16_t len)
{ {
zbuf_t* buf; zbuf_t *buf;
/* Allocate SKB for packet*/ /* Allocate SKB for packet*/
buf = dev_alloc_skb(len); buf = dev_alloc_skb(len);
...@@ -46,15 +46,15 @@ zbuf_t* zfwBufAllocate(zdev_t* dev, u16_t len) ...@@ -46,15 +46,15 @@ zbuf_t* zfwBufAllocate(zdev_t* dev, u16_t len)
/* Called to free buffer, replace below 3 functions */ /* Called to free buffer, replace below 3 functions */
void zfwBufFree(zdev_t* dev, zbuf_t* buf, u16_t status) void zfwBufFree(zdev_t *dev, zbuf_t *buf, u16_t status)
{ {
dev_kfree_skb_any(buf); dev_kfree_skb_any(buf);
} }
/* Called to adjust buffer size and head pointer */ /* Called to adjust buffer size and head pointer */
u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size) u16_t zfwBufRemoveHead(zdev_t *dev, zbuf_t *buf, u16_t size)
{ {
//zm_assert(buf->len > size); /* zm_assert(buf->len > size); */
buf->data += size; buf->data += size;
buf->len -= size; buf->len -= size;
...@@ -68,7 +68,7 @@ u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size) ...@@ -68,7 +68,7 @@ u16_t zfwBufRemoveHead(zdev_t* dev, zbuf_t* buf, u16_t size)
/* Used to chain Rx buffer to form a frame. if the prepared Rx buffer */ /* Used to chain Rx buffer to form a frame. if the prepared Rx buffer */
/* is greater than an ethernet frame(1518+32 byte), then this function */ /* is greater than an ethernet frame(1518+32 byte), then this function */
/* will only be called with head=NULL. */ /* will only be called with head=NULL. */
u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail) u16_t zfwBufChain(zdev_t *dev, zbuf_t **head, zbuf_t *tail)
{ {
*head = tail; *head = tail;
...@@ -77,7 +77,7 @@ u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail) ...@@ -77,7 +77,7 @@ u16_t zfwBufChain(zdev_t* dev, zbuf_t** head, zbuf_t* tail)
/* Called when doing infra-bss forwarding */ /* Called when doing infra-bss forwarding */
u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src) u16_t zfwBufCopy(zdev_t *dev, zbuf_t *dst, zbuf_t *src)
{ {
memcpy(dst->data, src->data, src->len); memcpy(dst->data, src->data, src->len);
dst->tail = dst->data; dst->tail = dst->data;
...@@ -87,7 +87,7 @@ u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src) ...@@ -87,7 +87,7 @@ u16_t zfwBufCopy(zdev_t* dev, zbuf_t* dst, zbuf_t* src)
/* Called to adjust buffer size and tail pointer */ /* Called to adjust buffer size and tail pointer */
u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size) u16_t zfwBufSetSize(zdev_t *dev, zbuf_t *buf, u16_t size)
{ {
#ifdef NET_SKBUFF_DATA_USES_OFFSET #ifdef NET_SKBUFF_DATA_USES_OFFSET
buf->tail = 0; buf->tail = 0;
...@@ -101,11 +101,11 @@ u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size) ...@@ -101,11 +101,11 @@ u16_t zfwBufSetSize(zdev_t* dev, zbuf_t* buf, u16_t size)
return 0; return 0;
} }
u16_t zfwBufGetSize(zdev_t* dev, zbuf_t* buf) u16_t zfwBufGetSize(zdev_t *dev, zbuf_t *buf)
{ {
return buf->len; return buf->len;
} }
void zfwCopyBufContext(zdev_t* dev, zbuf_t* source, zbuf_t* dst) void zfwCopyBufContext(zdev_t *dev, zbuf_t *source, zbuf_t *dst)
{ {
} }
This diff is collapsed.
...@@ -30,76 +30,73 @@ ...@@ -30,76 +30,73 @@
#include <linux/netlink.h> #include <linux/netlink.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; /* extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */
extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
extern u16_t zfLnxGetVapId(zdev_t* dev); extern u16_t zfLnxGetVapId(zdev_t *dev);
/* Simply return 0xffff if VAP function is not supported */ /* Simply return 0xffff if VAP function is not supported */
u16_t zfwGetVapId(zdev_t* dev) u16_t zfwGetVapId(zdev_t *dev)
{ {
return zfLnxGetVapId(dev); return zfLnxGetVapId(dev);
} }
void zfwSleep(zdev_t* dev, u32_t ms) void zfwSleep(zdev_t *dev, u32_t ms)
{ {
if (in_interrupt() == 0) if (in_interrupt() == 0)
{ mdelay(ms);
mdelay(ms); else {
} int ii;
else int iter = 100000 * ms;
{
int ii; for (ii = 0; ii < iter; ii++) {
int iter = 100000 * ms; }
}
for (ii = 0; ii < iter; ii++)
{
}
}
} }
#ifdef ZM_HALPLUS_LOCK #ifdef ZM_HALPLUS_LOCK
asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t* dev) asmlinkage struct zsWlanDev *zfwGetWlanDev(zdev_t *dev)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
return macp->wd; return macp->wd;
} }
asmlinkage void zfwEnterCriticalSection(zdev_t* dev) asmlinkage void zfwEnterCriticalSection(zdev_t *dev)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
spin_lock_irqsave(&macp->cs_lock, macp->hal_irqFlag); spin_lock_irqsave(&macp->cs_lock, macp->hal_irqFlag);
} }
asmlinkage void zfwLeaveCriticalSection(zdev_t* dev) asmlinkage void zfwLeaveCriticalSection(zdev_t *dev)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
spin_unlock_irqrestore(&macp->cs_lock, macp->hal_irqFlag); spin_unlock_irqrestore(&macp->cs_lock, macp->hal_irqFlag);
} }
asmlinkage u8_t zfwBufReadByte(zdev_t* dev, zbuf_t* buf, u16_t offset) asmlinkage u8_t zfwBufReadByte(zdev_t *dev, zbuf_t *buf, u16_t offset)
{ {
return *(u8_t*)((u8_t*)buf->data+offset); return *(u8_t *)((u8_t *)buf->data+offset);
} }
asmlinkage u16_t zfwBufReadHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset) asmlinkage u16_t zfwBufReadHalfWord(zdev_t *dev, zbuf_t *buf, u16_t offset)
{ {
return zmw_cpu_to_le16(*(u16_t*)((u8_t*)buf->data+offset)); return zmw_cpu_to_le16(*(u16_t *)((u8_t *)buf->data+offset));
} }
asmlinkage void zfwBufWriteByte(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t value) asmlinkage void zfwBufWriteByte(zdev_t *dev, zbuf_t *buf, u16_t offset,
u8_t value)
{ {
*(u8_t*)((u8_t*)buf->data+offset) = value; *(u8_t *)((u8_t *)buf->data+offset) = value;
} }
asmlinkage void zfwBufWriteHalfWord(zdev_t* dev, zbuf_t* buf, u16_t offset, u16_t value) asmlinkage void zfwBufWriteHalfWord(zdev_t *dev, zbuf_t *buf, u16_t offset,
u16_t value)
{ {
*(u16_t*)((u8_t*)buf->data+offset) = zmw_cpu_to_le16(value); *(u16_t *)((u8_t *)buf->data+offset) = zmw_cpu_to_le16(value);
} }
asmlinkage u8_t *zfwGetBuffer(zdev_t* dev, zbuf_t* buf) asmlinkage u8_t *zfwGetBuffer(zdev_t *dev, zbuf_t *buf)
{ {
return (u8_t*)(buf->data); return (u8_t *)(buf->data);
} }
#endif #endif
......
...@@ -31,136 +31,122 @@ ...@@ -31,136 +31,122 @@
#include <net/iw_handler.h> #include <net/iw_handler.h>
//extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; /* extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */
extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER]; extern struct zsVapStruct vap[ZM_VAP_PORT_NUMBER];
/***** Rx *****/ /***** Rx *****/
void zfLnxRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo) void zfLnxRecv80211(zdev_t *dev, zbuf_t *buf, struct zsAdditionInfo *addInfo)
{ {
u16_t frameType; u16_t frameType;
u16_t frameCtrl; u16_t frameCtrl;
u16_t frameSubtype; u16_t frameSubtype;
zbuf_t *skb1; zbuf_t *skb1;
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
//frameCtrl = zmw_buf_readb(dev, buf, 0); /* frameCtrl = zmw_buf_readb(dev, buf, 0); */
frameCtrl = *(u8_t*)((u8_t*)buf->data); frameCtrl = *(u8_t *)((u8_t *)buf->data);
frameType = frameCtrl & 0xf; frameType = frameCtrl & 0xf;
frameSubtype = frameCtrl & 0xf0; frameSubtype = frameCtrl & 0xf0;
if ((frameType == 0x0) && (macp->forwardMgmt)) if ((frameType == 0x0) && (macp->forwardMgmt)) {
{ switch (frameSubtype) {
switch (frameSubtype) /* Beacon */
{ case 0x80:
/* Beacon */ /* Probe response */
case 0x80 : case 0x50:
/* Probe response */ skb1 = skb_copy(buf, GFP_ATOMIC);
case 0x50 : if (skb1 != NULL) {
skb1 = skb_copy(buf, GFP_ATOMIC); skb1->dev = dev;
if(skb1 != NULL) skb1->mac_header = skb1->data;
{ skb1->ip_summed = CHECKSUM_NONE;
skb1->dev = dev; skb1->pkt_type = PACKET_OTHERHOST;
skb1->mac_header = skb1->data; /* ETH_P_80211_RAW */
skb1->ip_summed = CHECKSUM_NONE; skb1->protocol = __constant_htons(0x0019);
skb1->pkt_type = PACKET_OTHERHOST; netif_rx(skb1);
skb1->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */ }
netif_rx(skb1); break;
} default:
break; break;
default: }
break; }
}
} zfiRecv80211(dev, buf, addInfo);
return;
zfiRecv80211(dev, buf, addInfo);
return;
} }
#define ZM_AVOID_UDP_LARGE_PACKET_FAIL #define ZM_AVOID_UDP_LARGE_PACKET_FAIL
void zfLnxRecvEth(zdev_t* dev, zbuf_t* buf, u16_t port) void zfLnxRecvEth(zdev_t *dev, zbuf_t *buf, u16_t port)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
#ifdef ZM_AVOID_UDP_LARGE_PACKET_FAIL #ifdef ZM_AVOID_UDP_LARGE_PACKET_FAIL
zbuf_t *new_buf; zbuf_t *new_buf;
//new_buf = dev_alloc_skb(2048); /* new_buf = dev_alloc_skb(2048); */
new_buf = dev_alloc_skb(buf->len); new_buf = dev_alloc_skb(buf->len);
#ifdef NET_SKBUFF_DATA_USES_OFFSET #ifdef NET_SKBUFF_DATA_USES_OFFSET
new_buf->tail = 0; new_buf->tail = 0;
new_buf->len = 0; new_buf->len = 0;
#else #else
new_buf->tail = new_buf->data; new_buf->tail = new_buf->data;
new_buf->len = 0; new_buf->len = 0;
#endif #endif
skb_put(new_buf, buf->len); skb_put(new_buf, buf->len);
memcpy(new_buf->data, buf->data, buf->len); memcpy(new_buf->data, buf->data, buf->len);
/* Free buffer */ /* Free buffer */
dev_kfree_skb_any(buf); dev_kfree_skb_any(buf);
if (port == 0) if (port == 0) {
{ new_buf->dev = dev;
new_buf->dev = dev; new_buf->protocol = eth_type_trans(new_buf, dev);
new_buf->protocol = eth_type_trans(new_buf, dev); } else {
} /* VAP */
else if (vap[0].dev != NULL) {
{ new_buf->dev = vap[0].dev;
/* VAP */ new_buf->protocol = eth_type_trans(new_buf, vap[0].dev);
if (vap[0].dev != NULL) } else {
{ new_buf->dev = dev;
new_buf->dev = vap[0].dev; new_buf->protocol = eth_type_trans(new_buf, dev);
new_buf->protocol = eth_type_trans(new_buf, vap[0].dev); }
} }
else
{ new_buf->ip_summed = CHECKSUM_NONE;
new_buf->dev = dev; dev->last_rx = jiffies;
new_buf->protocol = eth_type_trans(new_buf, dev);
} switch (netif_rx(new_buf))
}
new_buf->ip_summed = CHECKSUM_NONE;
dev->last_rx = jiffies;
switch(netif_rx(new_buf))
#else #else
if (port == 0) if (port == 0) {
{ buf->dev = dev;
buf->dev = dev; buf->protocol = eth_type_trans(buf, dev);
buf->protocol = eth_type_trans(buf, dev); } else {
} /* VAP */
else if (vap[0].dev != NULL) {
{ buf->dev = vap[0].dev;
/* VAP */ buf->protocol = eth_type_trans(buf, vap[0].dev);
if (vap[0].dev != NULL) } else {
{ buf->dev = dev;
buf->dev = vap[0].dev; buf->protocol = eth_type_trans(buf, dev);
buf->protocol = eth_type_trans(buf, vap[0].dev); }
} }
else
{ buf->ip_summed = CHECKSUM_NONE;
buf->dev = dev; dev->last_rx = jiffies;
buf->protocol = eth_type_trans(buf, dev);
} switch (netif_rx(buf))
}
buf->ip_summed = CHECKSUM_NONE;
dev->last_rx = jiffies;
switch(netif_rx(buf))
#endif #endif
{ {
case NET_RX_DROP: case NET_RX_DROP:
break; break;
default: default:
macp->drv_stats.net_stats.rx_packets++; macp->drv_stats.net_stats.rx_packets++;
macp->drv_stats.net_stats.rx_bytes += buf->len; macp->drv_stats.net_stats.rx_bytes += buf->len;
break; break;
} }
return; return;
} }
/* Leave an empty line below to remove warning message on some compiler */ /* Leave an empty line below to remove warning message on some compiler */
...@@ -33,92 +33,93 @@ ...@@ -33,92 +33,93 @@
#ifdef ZM_ENABLE_CENC #ifdef ZM_ENABLE_CENC
extern int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len); extern int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len);
u16_t zfLnxCencAsocNotify(zdev_t* dev, u16_t* macAddr, u8_t* body, u16_t bodySize, u16_t port) u16_t zfLnxCencAsocNotify(zdev_t *dev, u16_t *macAddr, u8_t *body,
u16_t bodySize, u16_t port)
{ {
struct usbdrv_private *macp = (struct usbdrv_private *)dev->priv; struct usbdrv_private *macp = (struct usbdrv_private *)dev->priv;
struct zydas_cenc_sta_info cenc_info; struct zydas_cenc_sta_info cenc_info;
//struct sock *netlink_sk; /* struct sock *netlink_sk; */
u8_t ie_len; u8_t ie_len;
int ii; int ii;
/* Create NETLINK socket */ /* Create NETLINK socket */
//netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL); /*netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL); */
if (macp->netlink_sk == NULL) if (macp->netlink_sk == NULL) {
{ printk(KERN_ERR "NETLINK Socket is NULL\n");
printk(KERN_ERR "NETLINK Socket is NULL\n"); return -1;
return -1; }
}
memset(&cenc_info, 0, sizeof(cenc_info)); memset(&cenc_info, 0, sizeof(cenc_info));
//memcpy(cenc_info.gsn, vap->iv_cencmsk_keys.wk_txiv, ZM_CENC_IV_LEN); /* memcpy(cenc_info.gsn, vap->iv_cencmsk_keys.wk_txiv,
zfiWlanQueryGSN(dev, cenc_info.gsn, port); * ZM_CENC_IV_LEN);
cenc_info.datalen += ZM_CENC_IV_LEN; */
ie_len = body[1] + 2; zfiWlanQueryGSN(dev, cenc_info.gsn, port);
memcpy(cenc_info.wie, body, ie_len); cenc_info.datalen += ZM_CENC_IV_LEN;
cenc_info.datalen += ie_len; ie_len = body[1] + 2;
memcpy(cenc_info.wie, body, ie_len);
cenc_info.datalen += ie_len;
memcpy(cenc_info.sta_mac, macAddr, 6); memcpy(cenc_info.sta_mac, macAddr, 6);
cenc_info.msg_type = ZM_CENC_WAI_REQUEST; cenc_info.msg_type = ZM_CENC_WAI_REQUEST;
cenc_info.datalen += 6 + 2; cenc_info.datalen += 6 + 2;
printk(KERN_ERR "===== zfwCencSendMsg, bodySize: %d =====\n", bodySize); printk(KERN_ERR "===== zfwCencSendMsg, bodySize: %d =====\n", bodySize);
for(ii = 0; ii < bodySize; ii++) for (ii = 0; ii < bodySize; ii++) {
{ printk(KERN_ERR "%02x ", body[ii]);
printk(KERN_ERR "%02x ", body[ii]);
if ((ii & 0xf) == 0xf) if ((ii & 0xf) == 0xf)
{ printk(KERN_ERR "\n");
printk(KERN_ERR "\n"); }
}
}
zfLnxCencSendMsg(macp->netlink_sk, (u8_t *)&cenc_info, cenc_info.datalen+4); zfLnxCencSendMsg(macp->netlink_sk, (u8_t *)&cenc_info,
cenc_info.datalen+4);
/* Close NETLINK socket */ /* Close NETLINK socket */
//sock_release(netlink_sk); /* sock_release(netlink_sk); */
return 0; return 0;
} }
#endif //ZM_ENABLE_CENC #endif /* ZM_ENABLE_CENC */
u8_t zfwCencHandleBeaconProbrespon(zdev_t* dev, u8_t *pWIEc, u8_t zfwCencHandleBeaconProbrespon(zdev_t *dev, u8_t *pWIEc,
u8_t *pPeerSSIDc, u8_t *pPeerAddrc) u8_t *pPeerSSIDc, u8_t *pPeerAddrc)
{ {
return 0; return 0;
} }
u8_t zfwGetPktEncExemptionActionType(zdev_t* dev, zbuf_t* buf) u8_t zfwGetPktEncExemptionActionType(zdev_t *dev, zbuf_t *buf)
{ {
return ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION; return ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION;
} }
void copyToIntTxBuffer(zdev_t* dev, zbuf_t* buf, u8_t* src, void copyToIntTxBuffer(zdev_t *dev, zbuf_t *buf, u8_t *src,
u16_t offset, u16_t length) u16_t offset, u16_t length)
{ {
u16_t i; u16_t i;
for(i=0; i<length;i++) for (i = 0; i < length; i++) {
{ /* zmw_tx_buf_writeb(dev, buf, offset+i, src[i]); */
//zmw_tx_buf_writeb(dev, buf, offset+i, src[i]); *(u8_t *)((u8_t *)buf->data+offset+i) = src[i];
*(u8_t*)((u8_t*)buf->data+offset+i) = src[i]; }
}
} }
u16_t zfwStaAddIeWpaRsn(zdev_t* dev, zbuf_t* buf, u16_t offset, u8_t frameType) u16_t zfwStaAddIeWpaRsn(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t frameType)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
//zm_msg1_mm(ZM_LV_0, "CWY - add wpaie content Length : ", macp->supIe[1]); /* zm_msg1_mm(ZM_LV_0, "CWY - add wpaie content Length : "
if (macp->supIe[1] != 0) * , macp->supIe[1]);
{ */
copyToIntTxBuffer(dev, buf, macp->supIe, offset, macp->supIe[1]+2); if (macp->supIe[1] != 0) {
//memcpy(buf->data[offset], macp->supIe, macp->supIe[1]+2); copyToIntTxBuffer(dev, buf, macp->supIe, offset,
offset += (macp->supIe[1]+2); macp->supIe[1]+2);
} /* memcpy(buf->data[offset], macp->supIe, macp->supIe[1]+2);*/
offset += (macp->supIe[1]+2);
return offset; }
return offset;
} }
/* Leave an empty line below to remove warning message on some compiler */ /* Leave an empty line below to remove warning message on some compiler */
...@@ -30,159 +30,152 @@ ...@@ -30,159 +30,152 @@
#include <linux/netlink.h> #include <linux/netlink.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
extern void zfLnxInitUsbTxQ(zdev_t* dev); extern void zfLnxInitUsbTxQ(zdev_t *dev);
extern void zfLnxInitUsbRxQ(zdev_t* dev); extern void zfLnxInitUsbRxQ(zdev_t *dev);
extern u32_t zfLnxSubmitRegInUrb(zdev_t *dev); extern u32_t zfLnxSubmitRegInUrb(zdev_t *dev);
u32_t zfLnxUsbOut(zdev_t* dev, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen, u32_t zfLnxUsbOut(zdev_t *dev, u8_t *hdr, u16_t hdrlen, u8_t *snap,
u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset); u16_t snapLen, u8_t *tail, u16_t tailLen, zbuf_t *buf,
u32_t zfLnxUsbWriteReg(zdev_t* dev, u32_t* cmd, u16_t cmdLen); u16_t offset);
u32_t zfLnxUsbWriteReg(zdev_t *dev, u32_t *cmd, u16_t cmdLen);
void zfwUsbRegisterCallBack(zdev_t* dev, struct zfCbUsbFuncTbl *zfUsbFunc) { void zfwUsbRegisterCallBack(zdev_t *dev, struct zfCbUsbFuncTbl *zfUsbFunc)
struct usbdrv_private *macp = dev->ml_priv; {
struct usbdrv_private *macp = dev->ml_priv;
macp->usbCbFunctions.zfcbUsbRecv = zfUsbFunc->zfcbUsbRecv; macp->usbCbFunctions.zfcbUsbRecv = zfUsbFunc->zfcbUsbRecv;
macp->usbCbFunctions.zfcbUsbRegIn = zfUsbFunc->zfcbUsbRegIn; macp->usbCbFunctions.zfcbUsbRegIn = zfUsbFunc->zfcbUsbRegIn;
macp->usbCbFunctions.zfcbUsbOutComplete = zfUsbFunc->zfcbUsbOutComplete; macp->usbCbFunctions.zfcbUsbOutComplete = zfUsbFunc->zfcbUsbOutComplete;
return; return;
} }
u32_t zfwUsbGetFreeTxQSize(zdev_t* dev) u32_t zfwUsbGetFreeTxQSize(zdev_t *dev)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
u32_t freeTxQSize; u32_t freeTxQSize;
unsigned long irqFlag; unsigned long irqFlag;
//zmw_declare_for_critical_section(); /* zmw_declare_for_critical_section(); */
//zmw_enter_critical_section(dev); /* zmw_enter_critical_section(dev); */
spin_lock_irqsave(&macp->cs_lock, irqFlag); spin_lock_irqsave(&macp->cs_lock, irqFlag);
freeTxQSize = ZM_MAX_TX_BUF_NUM - macp->TxBufCnt; freeTxQSize = ZM_MAX_TX_BUF_NUM - macp->TxBufCnt;
//zmw_leave_critical_section(dev); /* zmw_leave_critical_section(dev); */
spin_unlock_irqrestore(&macp->cs_lock, irqFlag); spin_unlock_irqrestore(&macp->cs_lock, irqFlag);
return freeTxQSize; return freeTxQSize;
} }
u32_t zfwUsbGetMaxTxQSize(zdev_t* dev) u32_t zfwUsbGetMaxTxQSize(zdev_t *dev)
{ {
return ZM_MAX_TX_BUF_NUM; return ZM_MAX_TX_BUF_NUM;
} }
u32_t zfwUsbEnableIntEpt(zdev_t *dev, u8_t endpt) u32_t zfwUsbEnableIntEpt(zdev_t *dev, u8_t endpt)
{ {
/* Initialize USB TxQ */ /* Initialize USB TxQ */
zfLnxInitUsbTxQ(dev); zfLnxInitUsbTxQ(dev);
/* Initialize USB RxQ */ /* Initialize USB RxQ */
zfLnxInitUsbRxQ(dev); zfLnxInitUsbRxQ(dev);
/* Initialize USB Register In URB */ /* Initialize USB Register In URB */
//zfwUsbSubmitRegIn(dev); /* zfwUsbSubmitRegIn(dev); */
/* Initialize USB Register In URB */ /* Initialize USB Register In URB */
zfLnxSubmitRegInUrb(dev); zfLnxSubmitRegInUrb(dev);
return 0; return 0;
} }
int zfwUsbEnableRxEpt(zdev_t* dev, u8_t endpt) int zfwUsbEnableRxEpt(zdev_t *dev, u8_t endpt)
{ {
return 0; return 0;
} }
u32_t zfwUsbSubmitControl(zdev_t* dev, u8_t req, u16_t value, u16_t index, void *data, u32_t size) u32_t zfwUsbSubmitControl(zdev_t *dev, u8_t req, u16_t value, u16_t index,
void *data, u32_t size)
{ {
int result = 0; int result = 0;
u32_t ret = 0; u32_t ret = 0;
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
u8_t* buf; u8_t *buf;
if (size > 0) if (size > 0) {
{ buf = kmalloc(size, GFP_KERNEL);
buf = kmalloc(size, GFP_KERNEL); memcpy(buf, (u8_t *)data, size);
memcpy(buf, (u8_t*)data, size); } else
} buf = NULL;
else
{
buf = NULL;
}
#if 0 #if 0
printk(KERN_ERR "req = 0x%02x\n", req); printk(KERN_ERR "req = 0x%02x\n", req);
printk(KERN_ERR "value = 0x%04x\n", value); printk(KERN_ERR "value = 0x%04x\n", value);
printk(KERN_ERR "index = 0x%04x\n", index); printk(KERN_ERR "index = 0x%04x\n", index);
printk(KERN_ERR "data = 0x%lx\n", (u32_t) data); printk(KERN_ERR "data = 0x%lx\n", (u32_t) data);
printk(KERN_ERR "size = %ld\n", size); printk(KERN_ERR "size = %ld\n", size);
#endif #endif
result = usb_control_msg(macp->udev, usb_sndctrlpipe(macp->udev, 0), result = usb_control_msg(macp->udev, usb_sndctrlpipe(macp->udev, 0),
req, USB_DIR_OUT | 0x40, value, index, buf, size, HZ); req, USB_DIR_OUT | 0x40, value, index, buf, size, HZ);
if (result < 0) if (result < 0) {
{ printk(KERN_ERR "zfwUsbSubmitControl() failed, result = 0x%x\n",
printk("zfwUsbSubmitControl() failed, result=0x%x\n", result); result);
ret = 1; ret = 1;
} }
kfree(buf); kfree(buf);
return ret; return ret;
} }
void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen) void zfwUsbCmd(zdev_t *dev, u8_t endpt, u32_t *cmd, u16_t cmdLen)
{ {
struct usbdrv_private *macp = dev->ml_priv; struct usbdrv_private *macp = dev->ml_priv;
u32_t ret; u32_t ret;
//MPUsbCommand(dev, endpt, cmd, cmdLen); /* MPUsbCommand(dev, endpt, cmd, cmdLen); */
ret = zfLnxUsbWriteReg(dev, cmd, cmdLen); ret = zfLnxUsbWriteReg(dev, cmd, cmdLen);
/* if zfLnxUsbWriteReg() return error, free and allocate urb, resend again */ /*
if (ret != 0) * if zfLnxUsbWriteReg() return error, free and allocate urb,
{ * resend again
usb_free_urb(macp->RegOutUrb); */
macp->RegOutUrb = usb_alloc_urb(0, GFP_ATOMIC); if (ret != 0) {
ret = zfLnxUsbWriteReg(dev, cmd, cmdLen); usb_free_urb(macp->RegOutUrb);
} macp->RegOutUrb = usb_alloc_urb(0, GFP_ATOMIC);
ret = zfLnxUsbWriteReg(dev, cmd, cmdLen);
}
} }
u32_t zfwUsbSend(zdev_t* dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap, u16_t snapLen, u32_t zfwUsbSend(zdev_t *dev, u8_t endpt, u8_t *hdr, u16_t hdrlen, u8_t *snap,
u8_t *tail, u16_t tailLen, zbuf_t *buf, u16_t offset) u16_t snapLen, u8_t *tail, u16_t tailLen,
zbuf_t *buf, u16_t offset)
{ {
u32_t status; u32_t status;
#ifdef ZM_CONFIG_BIG_ENDIAN #ifdef ZM_CONFIG_BIG_ENDIAN
u32_t ii = 0; u32_t ii = 0;
u16_t *pc = NULL; u16_t *pc = NULL;
pc = (u16_t *)hdr; pc = (u16_t *)hdr;
for(ii=0; ii<(hdrlen>>1); ii++) for (ii = 0; ii < (hdrlen >> 1); ii++)
{ pc[ii] = cpu_to_le16(pc[ii]);
pc[ii] = cpu_to_le16(pc[ii]);
} pc = (u16_t *)snap;
for (ii = 0; ii < (snapLen >> 1); ii++)
pc = (u16_t *)snap; pc[ii] = cpu_to_le16(pc[ii]);
for(ii=0; ii<(snapLen>>1); ii++)
{ pc = (u16_t *)tail;
pc[ii] = cpu_to_le16(pc[ii]); for (ii = 0; ii < (tailLen>>1); ii++)
} pc[ii] = cpu_to_le16(pc[ii]);
pc = (u16_t *)tail;
for(ii=0; ii<(tailLen>>1); ii++)
{
pc[ii] = cpu_to_le16(pc[ii]);
}
#endif #endif
status = zfLnxUsbOut(dev, hdr, hdrlen, snap, snapLen, tail, tailLen, buf, offset); status = zfLnxUsbOut(dev, hdr, hdrlen, snap, snapLen, tail, tailLen,
if ( status == 0 ) buf, offset);
{ if (status == 0)
return 0; return 0;
} else
else return 1;
{
return 1;
}
} }
/* Leave an empty line below to remove warning message on some compiler */ /* Leave an empty line below to remove warning message on some compiler */
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