[PATCH v3] staging: wilc1000: Process WARN, INFO options of debug levels from user

2015-08-14 Thread Chandra S Gorentla
This patch enables setting the module's debug options WARN and INFO in the
debugfs file 'wilc_debug_level'.  This functionality allows the user to
enable logging of warnings and other information.  Before this change,
writes to this debugfs file set only one option - DEBUG.  Another option
that is enabled by default is ERR.

As a side effect, this patch removes the 'sparse' warning -
'warning: incorrect type in argument 2 (different address spaces)'.


Signed-off-by: Chandra S Gorentla 
---

Changes in v3: Added back a printk that was removed from v1

Changes in v2: Replaced copy_from_user and kstrtoint (added in v1) with
   kstrtouint_from_user

 drivers/staging/wilc1000/wilc_debugfs.c | 24 
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index be2e901..ae11186 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -48,28 +48,19 @@ static ssize_t wilc_debug_level_read(struct file *file, 
char __user *userbuf, si
return simple_read_from_buffer(userbuf, count, ppos, buf, res);
 }
 
-static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, 
size_t count, loff_t *ppos)
+static ssize_t wilc_debug_level_write(struct file *filp, const char __user 
*buf,
+   size_t count, loff_t *ppos)
 {
-   char buffer[128] = {};
int flag = 0;
+   int ret;
 
-   if (count > sizeof(buffer))
-   return -EINVAL;
-
-   if (copy_from_user(buffer, buf, count)) {
-   return -EFAULT;
-   }
-
-   flag = buffer[0] - '0';
-
-   if (flag > 0)
-   flag = DEBUG | ERR;
-   else if (flag < 0)
-   flag = 100;
+   ret = kstrtouint_from_user(buf, count, 16, &flag);
+   if (ret)
+   return ret;
 
if (flag > DBG_LEVEL_ALL) {
printk("%s, value (0x%08x) is out of range, stay previous flag 
(0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL));
-   return -EFAULT;
+   return -EINVAL;
}
 
atomic_set(&DEBUG_LEVEL, (int)flag);
@@ -78,6 +69,7 @@ static ssize_t wilc_debug_level_write(struct file *filp, 
const char *buf, size_t
printk("Debug-level disabled\n");
else
printk("Debug-level enabled\n");
+
return count;
 }
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] staging: wilc1000: Process WARN, INFO options of debug levels from user

2015-08-14 Thread Greg KH
On Fri, Aug 14, 2015 at 10:50:07PM +0530, Chandra S Gorentla wrote:
> This patch enables setting the module's debug options WARN and INFO in the
> debugfs file 'wilc_debug_level'.  This enables the user to enable logging
> of warning and other information.  Before this change writes to this
> debugfs file sets only one option DGB.  This is additional to the default
> option ERR. 
> 
> As a side effect, this patch removes the 'sparse' warning -
> 'warning: incorrect type in argument 2 (different address spaces)'.
> 
> Signed-off-by: Chandra S Gorentla 
> ---
>  drivers/staging/wilc1000/wilc_debugfs.c | 28 +---
>  1 file changed, 9 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
> b/drivers/staging/wilc1000/wilc_debugfs.c
> index be2e901..23419d9 100644
> --- a/drivers/staging/wilc1000/wilc_debugfs.c
> +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> @@ -48,29 +48,18 @@ static ssize_t wilc_debug_level_read(struct file *file, 
> char __user *userbuf, si
>   return simple_read_from_buffer(userbuf, count, ppos, buf, res);
>  }
>  
> -static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, 
> size_t count, loff_t *ppos)
> +static ssize_t wilc_debug_level_write(struct file *filp, const char __user 
> *buf,
> + size_t count, loff_t *ppos)
>  {
> - char buffer[128] = {};
>   int flag = 0;
> + int ret;
>  
> - if (count > sizeof(buffer))
> - return -EINVAL;
> -
> - if (copy_from_user(buffer, buf, count)) {
> - return -EFAULT;
> - }
> -
> - flag = buffer[0] - '0';
> -
> - if (flag > 0)
> - flag = DEBUG | ERR;
> - else if (flag < 0)
> - flag = 100;
> + ret = kstrtouint_from_user(buf, count, 16, &flag);
> + if (ret)
> + return ret;
>  
> - if (flag > DBG_LEVEL_ALL) {
> - printk("%s, value (0x%08x) is out of range, stay previous flag 
> (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL));

Why did you remove this warning value?


> - return -EFAULT;

I agree, this should be changed to -EINVAL like you did, but please put
back the printk for now.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] staging: wilc1000: use the real data type

2015-08-14 Thread Greg KH
On Thu, Aug 13, 2015 at 01:41:22PM +0900, Tony Cho wrote:
> From: Johnny Kim 
> 
> This patch changes the type of gu8FlushedJoinReqDrvHandler with his real
> data type becasue typecasting is not necessary. In result, typecasting
> which is not necessary and some building warnings is removed.
> 
> Signed-off-by: Johnny Kim 
> Signed-off-by: Tony Cho 
> ---
>  drivers/staging/wilc1000/host_interface.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)

This patch doesn't apply to my tree anymore due to patches from other
people touching the same area.  Please rebase it, and fix up the 5/5
patch, and resend both of them as a new series.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] staging: wilc1000: change void pointer type to real type

2015-08-14 Thread Greg KH
On Fri, Aug 14, 2015 at 11:56:13AM +0530, Sudip Mukherjee wrote:
> On Thu, Aug 13, 2015 at 01:41:20PM +0900, Tony Cho wrote:
> > From: Johnny Kim 
> > 
> > This patch changes the void pointer member of the tstrHostIFmsg to the
> > real data type because the void pointer type is ambiguous and not
> > readable.
> > 
> > Signed-off-by: Johnny Kim 
> > Signed-off-by: Tony Cho 
> > ---
> This patch is introducing some new warnings like:
> 
> drivers/staging/wilc1000/host_interface.c: In function 
> ‘host_int_set_wfi_drv_handler’:
> drivers/staging/wilc1000/host_interface.c:5817:66: warning: assignment
> makes integer from pointer without a cast [enabled by default]
>   strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = 
> u32address;

That warning doesn't seem to have anything to do with this patch, odd...
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] staging: vt6655: Replace typedef struct tagSTxDesc

2015-08-14 Thread Malcolm Priestley
Replace with struct vnt_tx_desc with all members the same.

volatile is removed from pointers as this generates warning
message.

Only the first four members of vnt_tx_desc need to be volatile.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/card.c|  2 +-
 drivers/staging/vt6655/desc.h| 12 +-
 drivers/staging/vt6655/device.h  |  8 +++
 drivers/staging/vt6655/device_main.c | 43 +++-
 drivers/staging/vt6655/rxtx.c| 10 -
 drivers/staging/vt6655/rxtx.h|  2 +-
 6 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index e3ff4ad..c7b75df 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -514,7 +514,7 @@ CARDvSafeResetTx(
 )
 {
unsigned int uu;
-   PSTxDescpCurrTD;
+   struct vnt_tx_desc *pCurrTD;
 
/* initialize TD index */
pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 452971c..3c9007e 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -250,16 +250,14 @@ struct vnt_td_info {
 };
 
 /* transmit descriptor */
-typedef struct tagSTxDesc {
+struct vnt_tx_desc {
volatile struct vnt_tdes0 td0;
volatile struct vnt_tdes1 td1;
-   volatile__le32  buff_addr;
-   volatile__le32  next_desc;
-   struct tagSTxDesc *next __aligned(8);
+   volatile __le32 buff_addr;
+   volatile __le32 next_desc;
+   struct vnt_tx_desc *next __aligned(8);
struct vnt_td_info *td_info __aligned(8);
-} __attribute__ ((__packed__))
-STxDesc, *PSTxDesc;
-typedef const STxDesc *PCSTxDesc;
+} __packed;
 
 /* Length, Service, and Signal fields of Phy for Tx */
 struct vnt_phy_field {
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index a31769a1..c9fa6ef 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -252,11 +252,11 @@ struct vnt_private {
int nTxQueues;
volatile intiTDUsed[TYPE_MAXTD];
 
-   volatile PSTxDesc   apCurrTD[TYPE_MAXTD];
-   volatile PSTxDesc   apTailTD[TYPE_MAXTD];
+   struct vnt_tx_desc *apCurrTD[TYPE_MAXTD];
+   struct vnt_tx_desc *apTailTD[TYPE_MAXTD];
 
-   volatile PSTxDesc   apTD0Rings;
-   volatile PSTxDesc   apTD1Rings;
+   struct vnt_tx_desc *apTD0Rings;
+   struct vnt_tx_desc *apTD1Rings;
 
volatile PSRxDesc   aRD0Ring;
volatile PSRxDesc   aRD1Ring;
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index f3d8178..0d8f123 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -157,7 +157,7 @@ static int  device_rx_srv(struct vnt_private *pDevice, 
unsigned int uIdx);
 static int  device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx);
 static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pDesc);
 static void device_init_registers(struct vnt_private *pDevice);
-static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc);
+static void device_free_tx_buf(struct vnt_private *, struct vnt_tx_desc *);
 static void device_free_td0_ring(struct vnt_private *pDevice);
 static void device_free_td1_ring(struct vnt_private *pDevice);
 static void device_free_rd0_ring(struct vnt_private *pDevice);
@@ -522,8 +522,8 @@ static bool device_init_rings(struct vnt_private *pDevice)
vir_pool = dma_zalloc_coherent(&pDevice->pcid->dev,
 pDevice->sOpts.nRxDescs0 * 
sizeof(SRxDesc) +
 pDevice->sOpts.nRxDescs1 * 
sizeof(SRxDesc) +
-pDevice->sOpts.nTxDescs[0] * 
sizeof(STxDesc) +
-pDevice->sOpts.nTxDescs[1] * 
sizeof(STxDesc),
+pDevice->sOpts.nTxDescs[0] * 
sizeof(struct vnt_tx_desc) +
+pDevice->sOpts.nTxDescs[1] * 
sizeof(struct vnt_tx_desc),
 &pDevice->pool_dma, GFP_ATOMIC);
if (vir_pool == NULL) {
dev_err(&pDevice->pcid->dev, "allocate desc dma memory 
failed\n");
@@ -551,8 +551,8 @@ static bool device_init_rings(struct vnt_private *pDevice)
dma_free_coherent(&pDevice->pcid->dev,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
-   pDevice->sOpts.nTxDescs[0] * 
sizeof(STxDesc) +
-   pDevice->sOpts.nTxDescs[1] * 
sizeof(STxDesc),
+   pDevice->sOpts.nTxDescs[0] *

[PATCH 4/6] staging: vt6655: struct tagDEVICE_TD_INFO remove dwHeaderLength

2015-08-14 Thread Malcolm Priestley
dwHeaderLength is assigned a value but that is never used.

Remove variable.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/desc.h | 1 -
 drivers/staging/vt6655/rxtx.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index ab52c56..0b786cf 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -246,7 +246,6 @@ typedef struct tagDEVICE_TD_INFO {
unsigned char *buf;
dma_addr_t  buf_dma;
u16 dwReqCount;
-   unsigned long dwHeaderLength;
unsigned char byFlags;
 } DEVICE_TD_INFO,*PDEVICE_TD_INFO;
 
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index f3f6b15..c918248 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1201,7 +1201,6 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned 
char byPktType,
ptdCurr = (PSTxDesc)pHeadTD;
 
ptdCurr->pTDInfo->dwReqCount = (u16)cbReqCount;
-   ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
 
return cbHeaderLength;
 }
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] staging: vt6655: struct tagDEVICE_TD_INFO resize dwReqCount.

2015-08-14 Thread Malcolm Priestley
dwReqCount is no bigger than u16

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/desc.h| 2 +-
 drivers/staging/vt6655/device_main.c | 2 +-
 drivers/staging/vt6655/rxtx.c| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 6efe825..ab52c56 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -245,7 +245,7 @@ typedef struct tagDEVICE_TD_INFO {
struct sk_buff *skb;
unsigned char *buf;
dma_addr_t  buf_dma;
-   unsigned long dwReqCount;
+   u16 dwReqCount;
unsigned long dwHeaderLength;
unsigned char byFlags;
 } DEVICE_TD_INFO,*PDEVICE_TD_INFO;
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 947e868..c3b7bd4 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1193,7 +1193,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
 
/* Set TSR1 & ReqCount in TxDescHead */
head_td->td1.tcr |= (TCR_STP | TCR_EDP | EDMSDU);
-   head_td->td1.req_count = cpu_to_le16((u16)head_td->pTDInfo->dwReqCount);
+   head_td->td1.req_count = cpu_to_le16(head_td->pTDInfo->dwReqCount);
 
head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->buf_dma);
 
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 380b879..f3f6b15 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1200,7 +1200,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned 
char byPktType,
 
ptdCurr = (PSTxDesc)pHeadTD;
 
-   ptdCurr->pTDInfo->dwReqCount = cbReqCount;
+   ptdCurr->pTDInfo->dwReqCount = (u16)cbReqCount;
ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
 
return cbHeaderLength;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] staging: vt6655: desc.h replace typedef struct tagTDES0

2015-08-14 Thread Malcolm Priestley
create struct vnt_tdes0 replacing used members
byTSR0 -> tsr0
byTSR1 -> tsr1
f1Owner -> owner

Narrowing endian differences to inside structure.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/card.c|  4 ++--
 drivers/staging/vt6655/desc.h| 36 +---
 drivers/staging/vt6655/device_main.c |  8 
 3 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index ae8fd7f..e3ff4ad 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -525,12 +525,12 @@ CARDvSafeResetTx(
 
for (uu = 0; uu < pDevice->sOpts.nTxDescs[0]; uu++) {
pCurrTD = &(pDevice->apTD0Rings[uu]);
-   pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST;
+   pCurrTD->td0.owner = OWNED_BY_HOST;
/* init all Tx Packet pointer to NULL */
}
for (uu = 0; uu < pDevice->sOpts.nTxDescs[1]; uu++) {
pCurrTD = &(pDevice->apTD1Rings[uu]);
-   pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST;
+   pCurrTD->td0.owner = OWNED_BY_HOST;
/* init all Tx Packet pointer to NULL */
}
 
diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index c916214..00fa348 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -216,33 +216,23 @@ typedef struct tagSRxDesc {
 SRxDesc, *PSRxDesc;
 typedef const SRxDesc *PCSRxDesc;
 
+struct vnt_tdes0 {
+   volatile u8 tsr0;
+   volatile u8 tsr1;
 #ifdef __BIG_ENDIAN
-
-typedef struct tagTDES0 {
-   volatileunsigned char byTSR0;
-   volatileunsigned char byTSR1;
union {
-   volatile u16f15Txtime;
+   volatile u16 f15_txtime;
struct {
-   volatile u8 f8Reserved1;
-   volatile u8 f1Owner:1;
-   volatile u8 f7Reserved:7;
-   } __attribute__ ((__packed__));
-   } __attribute__ ((__packed__));
-} __attribute__ ((__packed__))
-STDES0, PSTDES0;
-
+   volatile u8 f8_reserved;
+   volatile u8 owner:1;
+   volatile u8 f7_reserved:7;
+   } __packed;
+   } __packed;
 #else
-
-typedef struct tagTDES0 {
-   volatileunsigned char byTSR0;
-   volatileunsigned char byTSR1;
-   volatileunsigned short f15Txtime:15;
-   volatileunsigned short f1Owner:1;
-} __attribute__ ((__packed__))
-STDES0;
-
+   volatile u16 f15_txtime:15;
+   volatile u16 owner:1;
 #endif
+} __packed;
 
 typedef struct tagTDES1 {
volatile__le16wReqCount;
@@ -263,7 +253,7 @@ typedef struct tagDEVICE_TD_INFO {
 
 /* transmit descriptor */
 typedef struct tagSTxDesc {
-   volatileSTDES0  m_td0TD0;
+   volatile struct vnt_tdes0 td0;
volatileSTDES1  m_td1TD1;
volatile__le32  buff_addr;
volatile__le32  next_desc;
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index b74af8d..842e052 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -906,13 +906,13 @@ static int device_tx_srv(struct vnt_private *pDevice, 
unsigned int uIdx)
unsigned char byTsr1;
 
for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] > 0; pTD = 
pTD->next) {
-   if (pTD->m_td0TD0.f1Owner == OWNED_BY_NIC)
+   if (pTD->td0.owner == OWNED_BY_NIC)
break;
if (works++ > 15)
break;
 
-   byTsr0 = pTD->m_td0TD0.byTSR0;
-   byTsr1 = pTD->m_td0TD0.byTSR1;
+   byTsr0 = pTD->td0.tsr0;
+   byTsr1 = pTD->td0.tsr1;
 
/* Only the status of first TD in the chain is correct */
if (pTD->m_td1TD1.byTCR & TCR_STP) {
@@ -1200,7 +1200,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
 
/* Poll Transmit the adapter */
wmb();
-   head_td->m_td0TD0.f1Owner = OWNED_BY_NIC;
+   head_td->td0.owner = OWNED_BY_NIC;
wmb(); /* second memory barrier */
 
if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB)
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] staging: vt6655: replaced typedef struct tagTDES1

2015-08-14 Thread Malcolm Priestley
Create struct vnt_tdes1 that replaces members
wReqCount -> req_count
byTCR -> tcr
byReserved -> reserved

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/desc.h| 13 ++---
 drivers/staging/vt6655/device_main.c |  9 -
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 00fa348..6efe825 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -234,12 +234,11 @@ struct vnt_tdes0 {
 #endif
 } __packed;
 
-typedef struct tagTDES1 {
-   volatile__le16wReqCount;
-   volatileunsigned char byTCR;
-   volatileunsigned char byReserved;
-} __attribute__ ((__packed__))
-STDES1;
+struct vnt_tdes1 {
+   volatile __le16 req_count;
+   volatile u8 tcr;
+   volatile u8 reserved;
+} __packed;
 
 typedef struct tagDEVICE_TD_INFO {
void *mic_hdr;
@@ -254,7 +253,7 @@ typedef struct tagDEVICE_TD_INFO {
 /* transmit descriptor */
 typedef struct tagSTxDesc {
volatile struct vnt_tdes0 td0;
-   volatileSTDES1  m_td1TD1;
+   volatile struct vnt_tdes1 td1;
volatile__le32  buff_addr;
volatile__le32  next_desc;
struct tagSTxDesc *next __aligned(8);
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 842e052..947e868 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -915,7 +915,7 @@ static int device_tx_srv(struct vnt_private *pDevice, 
unsigned int uIdx)
byTsr1 = pTD->td0.tsr1;
 
/* Only the status of first TD in the chain is correct */
-   if (pTD->m_td1TD1.byTCR & TCR_STP) {
+   if (pTD->td1.tcr & TCR_STP) {
if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) {
if (!(byTsr1 & TSR1_TERR)) {
if (byTsr0 != 0) {
@@ -1174,7 +1174,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
 
head_td = priv->apCurrTD[dma_idx];
 
-   head_td->m_td1TD1.byTCR = 0;
+   head_td->td1.tcr = 0;
 
head_td->pTDInfo->skb = skb;
 
@@ -1192,9 +1192,8 @@ static int vnt_tx_packet(struct vnt_private *priv, struct 
sk_buff *skb)
priv->bPWBitOn = false;
 
/* Set TSR1 & ReqCount in TxDescHead */
-   head_td->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
-   head_td->m_td1TD1.wReqCount =
-   cpu_to_le16((u16)head_td->pTDInfo->dwReqCount);
+   head_td->td1.tcr |= (TCR_STP | TCR_EDP | EDMSDU);
+   head_td->td1.req_count = cpu_to_le16((u16)head_td->pTDInfo->dwReqCount);
 
head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->buf_dma);
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] staging: vt6655: replace typedef struct tagDEVICE_TD_INFO and structure

2015-08-14 Thread Malcolm Priestley
Create struct vnt_td_info with members
mic_hdr
skb
buf
buf_dma
dwReqCount -> req_count
byFlags -> flags

In struct tagSTxDesc volatile is removed because it will generate a warning
(in any case this member is not) and renaming td_info.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/desc.h| 12 +--
 drivers/staging/vt6655/device.h  |  4 ++--
 drivers/staging/vt6655/device_main.c | 42 ++--
 drivers/staging/vt6655/rxtx.c|  8 +++
 4 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 0b786cf..452971c 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -240,14 +240,14 @@ struct vnt_tdes1 {
volatile u8 reserved;
 } __packed;
 
-typedef struct tagDEVICE_TD_INFO {
+struct vnt_td_info {
void *mic_hdr;
struct sk_buff *skb;
unsigned char *buf;
-   dma_addr_t  buf_dma;
-   u16 dwReqCount;
-   unsigned char byFlags;
-} DEVICE_TD_INFO,*PDEVICE_TD_INFO;
+   dma_addr_t buf_dma;
+   u16 req_count;
+   u8 flags;
+};
 
 /* transmit descriptor */
 typedef struct tagSTxDesc {
@@ -256,7 +256,7 @@ typedef struct tagSTxDesc {
volatile__le32  buff_addr;
volatile__le32  next_desc;
struct tagSTxDesc *next __aligned(8);
-   volatilePDEVICE_TD_INFO pTDInfo __aligned(8);
+   struct vnt_td_info *td_info __aligned(8);
 } __attribute__ ((__packed__))
 STxDesc, *PSTxDesc;
 typedef const STxDesc *PCSTxDesc;
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 6aebb49..a31769a1 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -415,8 +415,8 @@ static inline PDEVICE_RD_INFO alloc_rd_info(void)
return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
 }
 
-static inline PDEVICE_TD_INFO alloc_td_info(void)
+static inline struct vnt_td_info *alloc_td_info(void)
 {
-   return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC);
+   return kzalloc(sizeof(struct vnt_td_info), GFP_ATOMIC);
 }
 #endif
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index c3b7bd4..f3d8178 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -702,11 +702,11 @@ static void device_init_td0_ring(struct vnt_private 
*pDevice)
curr = pDevice->td0_pool_dma;
for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++, curr += 
sizeof(STxDesc)) {
pDesc = &(pDevice->apTD0Rings[i]);
-   pDesc->pTDInfo = alloc_td_info();
+   pDesc->td_info = alloc_td_info();
 
if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) {
-   pDesc->pTDInfo->buf = pDevice->tx0_bufs + 
(i)*PKT_BUF_SZ;
-   pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma0 + 
(i)*PKT_BUF_SZ;
+   pDesc->td_info->buf = pDevice->tx0_bufs + 
(i)*PKT_BUF_SZ;
+   pDesc->td_info->buf_dma = pDevice->tx_bufs_dma0 + 
(i)*PKT_BUF_SZ;
}
pDesc->next = &(pDevice->apTD0Rings[(i+1) % 
pDevice->sOpts.nTxDescs[0]]);
pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
@@ -727,11 +727,11 @@ static void device_init_td1_ring(struct vnt_private 
*pDevice)
curr = pDevice->td1_pool_dma;
for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++, curr += 
sizeof(STxDesc)) {
pDesc = &(pDevice->apTD1Rings[i]);
-   pDesc->pTDInfo = alloc_td_info();
+   pDesc->td_info = alloc_td_info();
 
if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) {
-   pDesc->pTDInfo->buf = pDevice->tx1_bufs + (i) * 
PKT_BUF_SZ;
-   pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma1 + (i) * 
PKT_BUF_SZ;
+   pDesc->td_info->buf = pDevice->tx1_bufs + (i) * 
PKT_BUF_SZ;
+   pDesc->td_info->buf_dma = pDevice->tx_bufs_dma1 + (i) * 
PKT_BUF_SZ;
}
pDesc->next = &(pDevice->apTD1Rings[(i + 1) % 
pDevice->sOpts.nTxDescs[1]]);
pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
@@ -748,10 +748,10 @@ static void device_free_td0_ring(struct vnt_private 
*pDevice)
 
for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) {
PSTxDescpDesc = &(pDevice->apTD0Rings[i]);
-   PDEVICE_TD_INFO  pTDInfo = pDesc->pTDInfo;
+   struct vnt_td_info *pTDInfo = pDesc->td_info;
 
dev_kfree_skb(pTDInfo->skb);
-   kfree(pDesc->pTDInfo);
+   kfree(pDesc->td_info);
}
 }
 
@@ -761,10 +761,10 @@ static void device_free_td1_ring(struct vnt_private 
*pDevice)
 
for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++) {
PSTxDescpDesc = &(pDevice->apTD1Rings[i]);
-   PDEVICE_TD_INFO  pTDI

FCC's new regulations on 5Ghz Wifi

2015-08-14 Thread Xose Vazquez Perez
Hi,

The FCC wants to require manufacturers to lock down devices
with radio (wifi, bluetooth, etc) with DRM.

More info:
http://wiki.prplfoundation.org/wiki/Complying_with_FCC_rules_on_Wifi
http://libreplanet.org/wiki/Save_WiFi

FCC Wifi Regulation List:
http://lists.prplfoundation.org/cgi-bin/mailman/listinfo/fcc
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: set channel from radiotap headers during injection

2015-08-14 Thread Allan Matthew
Anyone have any thoughts on this?

Is it possible with channel context enabled somehow?

On Thu, Aug 13, 2015 at 11:22 AM, Allan Matthew  wrote:
> I'd like to be able to set the channel information on a per-packet
> basis during monitor-mode injection.  Specifically, I would like to be
> able to change the channel bandwidth down to half and quarter rates
> (my PHY supports this) based on the radiotap header information.
> Additionally, if its possible to change the channel itself that would
> be desirable.
>
> I've been able to add rate and FEC control to
> ieee80211_parse_tx_radiotap, but I'm not sure where to start with
> setting channel information. Has anyone been able to do this?  If not,
> what do I need to set in order to get per-packet channel control?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: iw coalesce show - disabled at init?

2015-08-14 Thread Kobi Cohen-Arazi
On Wed, Aug 12, 2015 at 2:28 PM, Johannes Berg
 wrote:
> On Wed, 2015-08-12 at 14:13 -0700, Kobi Cohen-Arazi wrote:
>>
>> So what you're saying is that at startup, drivers should have
>> coalesce _disabled_ (i.e. no rules for coalesce) ?
>>
>
> I think so, yes. It's a service that should be actively enabled, with
> user-configured rules. Mechanism vs. policy, and all that ...

I think that in most (if not all) NICs, this specific service is
enabled by default.

Kobi
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] staging: wilc1000: Process WARN, INFO options of debug levels from user

2015-08-14 Thread Chandra S Gorentla
This patch enables setting the module's debug options WARN and INFO in the
debugfs file 'wilc_debug_level'.  This enables the user to enable logging
of warning and other information.  Before this change writes to this
debugfs file sets only one option DGB.  This is additional to the default
option ERR. 

As a side effect, this patch removes the 'sparse' warning -
'warning: incorrect type in argument 2 (different address spaces)'.

Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/wilc1000/wilc_debugfs.c | 28 +---
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
b/drivers/staging/wilc1000/wilc_debugfs.c
index be2e901..23419d9 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -48,29 +48,18 @@ static ssize_t wilc_debug_level_read(struct file *file, 
char __user *userbuf, si
return simple_read_from_buffer(userbuf, count, ppos, buf, res);
 }
 
-static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, 
size_t count, loff_t *ppos)
+static ssize_t wilc_debug_level_write(struct file *filp, const char __user 
*buf,
+   size_t count, loff_t *ppos)
 {
-   char buffer[128] = {};
int flag = 0;
+   int ret;
 
-   if (count > sizeof(buffer))
-   return -EINVAL;
-
-   if (copy_from_user(buffer, buf, count)) {
-   return -EFAULT;
-   }
-
-   flag = buffer[0] - '0';
-
-   if (flag > 0)
-   flag = DEBUG | ERR;
-   else if (flag < 0)
-   flag = 100;
+   ret = kstrtouint_from_user(buf, count, 16, &flag);
+   if (ret)
+   return ret;
 
-   if (flag > DBG_LEVEL_ALL) {
-   printk("%s, value (0x%08x) is out of range, stay previous flag 
(0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL));
-   return -EFAULT;
-   }
+   if (flag > DBG_LEVEL_ALL)
+   return -EINVAL;
 
atomic_set(&DEBUG_LEVEL, (int)flag);
 
@@ -78,6 +67,7 @@ static ssize_t wilc_debug_level_write(struct file *filp, 
const char *buf, size_t
printk("Debug-level disabled\n");
else
printk("Debug-level enabled\n");
+
return count;
 }
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Ath10 firmware crashing in Monitor mode(Sniffer mode)

2015-08-14 Thread Ben Greear
On 08/13/2015 02:01 PM, S Prasad Kandregula wrote:
> Thank you Ben for immediate response,
> 
> Don't mind, could you please share your firmware path. 

Grab one of the beta-15 builds linked from this page:

http://www.candelatech.com/ath10k.php

If you want the mgt-htt version, be sure to patch your kernel per
the release notes or use one of my kernels also linked from the page.

Thanks,
Ben

> 
> Sorry I didn't change old subject line.
> 
> Thanks & Regards,
> S Prasad
> 
>> On Aug 13, 2015, at 4:43 PM, Ben Greear  wrote:
>>
>>> On 08/13/2015 01:35 PM, s prasad wrote:
>>> Hi Ben,
>>>
>>> did you get a chance to look into this issue(injecting frames when
>>> device in monitor mode).
>>
>> Injection works in a limited fashion in my latest firmware.
>>
>> I'd like to figure out how to pass rate-ctrl (and other info?) down to the
>> firmware on a per-pkt basis..but I don't see a way yet.
>>
>> Probably I have to hack the htt header or something like that
>> to give some extra space.  That sort of thing might allow a host-based
>> rate-ctrl algorithm to be usedif someone is interested in working on
>> the driver/kernel side of things for this effort let me know.
>>
>> I am not aware of any crashes related to monitor mode in my
>> firmware..but if you can crash it, send me the crash dump and
>> I'll take a look.
>>
>> Thanks,
>> Ben
>>
>>
>> -- 
>> Ben Greear 
>> Candela Technologies Inc  http://www.candelatech.com
>>
> 


-- 
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pull-request: mac80211-next 2015-08-14

2015-08-14 Thread Johannes Berg
Hi,

And, in addition to the fix before, I have a -next pull request. It's
actually quite big since I hadn't wanted to send one just before my
vacation.

Let me know if there are any issues.

johannes


The following changes since commit 923b352f19d9ea971ae2536eab55f5fc9e95fedf:

  cfg80211: use RTNL locked reg_can_beacon for IR-relaxation (2015-07-17 
15:02:02 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
tags/mac80211-next-for-davem-2015-08-14

for you to fetch changes up to 8f9c98df949333f08b74e5df1caacf7e2c5e8552:

  mac80211: fix BIT position for TDLS WIDE extended cap (2015-08-14 17:49:53 
+0200)


Another pull request for the next cycle, this time with quite
a bit of content:
 * mesh fixes/improvements from Alexis, Bob, Chun-Yeow and Jesse
 * TDLS higher bandwidth support (Arik)
 * OCB fixes from Bertold Van den Bergh
 * suspend/resume fixes from Eliad
 * dynamic SMPS support for minstrel-HT (Krishna Chaitanya)
 * VHT bitrate mask support (Lorenzo Bianconi)
 * better regulatory support for 5/10 MHz channels (Matthias May)
 * basic support for MU-MIMO to avoid the multi-vif issue (Sara Sharon)
along with a number of other cleanups.


Alexis Green (1):
  mac80211: mesh: add missing case to PERR processing

Arik Nemtsov (5):
  mac80211: define TDLS wider BW support bits
  mac80211: upgrade BW of TDLS peers when possible
  mac80211: TDLS: correctly configure SMPS state
  mac80211: TDLS: handle chan-switch in RTNL locked work
  mac80211: TDLS: deny ch-switch req on disallowed channels

Bertold Van den Bergh (4):
  nl80211: Allow setting multicast rate on OCB interfaces
  mac80211: Set txrc.bss to true for OCB interfaces
  mac80211: Only accept data frames in OCB mode
  mac80211: Make OCB mode set BSSID

Bob Copeland (4):
  mac80211: enable assoc check for mesh interfaces
  mac80211: reorder mesh_plink to remove forward decl
  mac80211: mesh: separate plid and aid concepts
  mac80211: select an AID when creating new mesh STAs

Chun-Yeow Yeoh (1):
  mac80211: mesh process the target only subfield for mesh hwmp

Dan Carpenter (1):
  mac80211: remove always true condition

Denys Vlasenko (2):
  mac80211: deinline drv_sta_state
  mac80211: deinline rate_control_rate_init, rate_control_rate_update

Eliad Peller (2):
  mac80211: clear local->in_reconfig on reconfig error
  mac80211: clear local->suspended before calling drv_resume()

Emmanuel Grumbach (1):
  mac80211: fix BIT position for TDLS WIDE extended cap

Geert Uytterhoeven (1):
  rfkill: Allow compile test of GPIO consumers if !GPIOLIB

Jesse Jones (2):
  mac80211: mesh: don't invalidate SN on discovery failure
  mac80211: mac80211: Check SN for deactivated mpaths

Johannes Berg (26):
  mac80211: remove exposing 'mfp' to drivers
  mac80211: rename 'sta_inf' variable to more common 'sta'
  mac80211: remove sta_info.gtk_idx
  mac80211: remove short frame test and counter
  mac80211: move ieee80211_get_bssid into RX file
  mac80211: fix comment referring to RX queue
  mac80211: don't store napi struct
  mac80211: remove zero-length A-MPDU subframe reporting
  mac80211: remove key TX/RX counter
  mac80211: support device/driver PN check for CCMP/GCMP
  mac80211: duplicate station's MAC address for hash table
  mac80211: remove IEEE80211_RX_FRAGMENTED
  mac80211: move mesh related station fields to own struct
  mac80211: move mesh STA parameters code to own function
  mac80211: allow passing NULL to ieee80211_vif_to_wdev()
  mac80211_hwsim: support wider TDLS bandwidth
  mac80211: add pointer for driver use to key
  mac80211: mesh: move fail_avg into mesh struct
  mac80211: shrink struct ieee80211_fragment_entry
  cfg80211: allow mgmt_frame_register callback to sleep
  mac80211: account TX MSDUs properly with segmentation offload
  Merge branch 'mac80211' into mac80211-next
  iwlwifi: mvm: don't set K1/K2 for AES-CMAC
  mac80211: remove ieee80211_aes_cmac_calculate_k1_k2()
  average: provide macro to create static EWMA
  mac80211: use DECLARE_EWMA

John Linville (1):
  wireless: remove superfluous if statement in regulatory code

Krishna Chaitanya (1):
  mac80211: minstrel_ht: handle peers in dynamic SMPS

Lorenzo Bianconi (4):
  mac80211: remove ieee80211_tx_info from rate_control_apply_mask signature
  mac80211: remove ieee80211_tx_rate dependency in rate mask code
  mac80211: define rate_control_apply_mask_ratetbl()
  mac80211: add rate mask logic for vht rates

Matthias May (1):
  cfg80211: regulatory: handle 5 and 10 MHz channels properly

Michal Kazior (1):
  cfg80211: propagate set_wiphy failure to userspace

Sara Sharon (1

Re: About adding support for MT76x2U to Linux kernel

2015-08-14 Thread Jakub Kiciński
CC: Linus W who was hacking on mt7630e recently.

On Fri, 14 Aug 2015 11:15:26 +0300, Tuomas Räsänen wrote:
> Hi
> 
> I'm very interested in adding support (especially AP mode) for MT76x2U
> USB-dongles to Linux kernel. I'm aware of the work you both have done, Felix's
> work on MT76x2 PCI-devices and Jakub's work to add support for MT7601U. So I
> guess no one knows this exact problem domain better than you (perhaps 
> excluding
> MediaTek's subcontractors who wrote the original vendor driver), that is why 
> I'm
> writing specifically to you.
> 
> I have ASUS USB-N53_B1 adapter (0b05:180b) as a test device:
> https://wikidevi.com/wiki/ASUS_USB-N53_B1
> 
> As far as I know, no one has been / is working on MT76x2U USB-dongles, please
> correct me if I'm wrong.
> 
> I have a strong system programming background, some knowledge on 802.11 in
> general, but no actual experience in Linux kernel programming. So I'm pretty
> confident that I'll have many questions to throw at you before I have managed 
> to
> make anything functional.
> 
> So, to get started, I was wondering what would be the best way forward. I can
> think of two reasonable approaches:
> 
>   #1 Base the new driver on Felix's mt76 and modify it to work on USB-bus
>  instead of PCI.
> 
>   #2 Base the new driver on Jakub's mt7601u and modify it to handle mt76x2u
>  devices by using Felix's mt76 and the vendor driver as a reference.
> 
> Of course there's the third option to write it from scratch based solely on 
> the
> vendor driver, but because you have already done such a great job in
> interpreting the outdated and quite ugly (subjective view?) vendor driver 
> code,
> that would be foolish.

There is a fourth option: merge mt76 and mt7601u and add support for
mt76x2u along the way ;)

> At first I had a hunch that #1 would be the easiest way forward, but now that 
> I
> skimmed through the code, I'm beginning to think that approach #2 has the 
> least
> resistance. However, I'm not necessarily looking for the easiest way but *the
> best/right* way. So any ideas, opinions and thoughts are more than welcome.

Hardware wise your chipsets will be closer to the ones Felix is
supporting and mt76 has AP support as well (which mt7601u is lacking).
But mt76 is not upstream and I don't think USB is a priority there...

On my side, I won't be able to help you or do mentoring for next few
months for contractual reasons :(
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


pull-request: mac80211 2015-08-14

2015-08-14 Thread Johannes Berg
Hi Dave,

I'm back from vacation, and found a single bugfix waiting. It's in this
pull request, but I'm not quite up to speed as to what's happening with
the release. If it goes in, great; if not I've already tagged it with
Cc stable anyway.

Thanks,
johannes



The following changes since commit 923b352f19d9ea971ae2536eab55f5fc9e95fedf:

  cfg80211: use RTNL locked reg_can_beacon for IR-relaxation (2015-07-17 
15:02:02 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git 
tags/mac80211-for-davem-2015-08-14

for you to fetch changes up to f5eeb5fa191fd7b634cbc4883ac58f3b2184dbc5:

  mac80211: fix invalid read in minstrel_sort_best_tp_rates() (2015-08-13 
13:52:34 +0200)


We have a single bugfix for an invalid memory read.


Adrien Schildknecht (1):
  mac80211: fix invalid read in minstrel_sort_best_tp_rates()

 net/mac80211/rc80211_minstrel.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mwifiex: control WLAN and bluetooth coexistence modes

2015-08-14 Thread Amitkumar Karwar
By default our chip will be in spatial coexistence mode.
This patch adds a provision to change it to timeshare mode
via sysfs command.

Enable timeshare coexistence mode
   echo 1 > /sys/class/net/mlan0/timeshare_coex

Go back to spacial coexistence mode
   echo 0 > /sys/class/net/mlan0/timeshare_coex

Signed-off-by: Amitkumar Karwar 
Signed-off-by: Nishant Sarmukadam 
---
 drivers/net/wireless/mwifiex/Makefile  |  1 +
 drivers/net/wireless/mwifiex/cfg80211.c|  3 ++
 drivers/net/wireless/mwifiex/fw.h  | 16 +++
 drivers/net/wireless/mwifiex/main.h|  2 +
 drivers/net/wireless/mwifiex/sta_cmd.c | 31 +
 drivers/net/wireless/mwifiex/sta_cmdresp.c | 25 ++
 drivers/net/wireless/mwifiex/sysfs.c   | 73 ++
 7 files changed, 151 insertions(+)
 create mode 100644 drivers/net/wireless/mwifiex/sysfs.c

diff --git a/drivers/net/wireless/mwifiex/Makefile 
b/drivers/net/wireless/mwifiex/Makefile
index fdfd9bf..fe5925f 100644
--- a/drivers/net/wireless/mwifiex/Makefile
+++ b/drivers/net/wireless/mwifiex/Makefile
@@ -42,6 +42,7 @@ mwifiex-y += cfg80211.o
 mwifiex-y += ethtool.o
 mwifiex-y += 11h.o
 mwifiex-y += tdls.o
+mwifiex-y += sysfs.o
 mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o
 obj-$(CONFIG_MWIFIEX) += mwifiex.o
 
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index ff63cb5..7e71dd7 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2734,6 +2734,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
 
mdev_priv = netdev_priv(dev);
*((unsigned long *) mdev_priv) = (unsigned long) priv;
+   dev->ml_priv = priv;
 
SET_NETDEV_DEV(dev, adapter->dev);
 
@@ -2791,6 +2792,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
 #ifdef CONFIG_DEBUG_FS
mwifiex_dev_debugfs_init(priv);
 #endif
+   mwifiex_sysfs_register(priv);
 
switch (type) {
case NL80211_IFTYPE_UNSPECIFIED:
@@ -2825,6 +2827,7 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct 
wireless_dev *wdev)
 #ifdef CONFIG_DEBUG_FS
mwifiex_dev_debugfs_remove(priv);
 #endif
+   mwifiex_sysfs_unregister(priv);
 
mwifiex_stop_net_dev_queue(priv->netdev, adapter);
 
diff --git a/drivers/net/wireless/mwifiex/fw.h 
b/drivers/net/wireless/mwifiex/fw.h
index 9a8c1832..bf5056b 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -101,6 +101,9 @@ enum KEY_TYPE_ID {
 #define FIRMWARE_READY_SDIO0xfedc
 #define FIRMWARE_READY_PCIE0xfedcba00
 
+#define MWIFIEX_COEX_MODE_TIMESHARE0x01
+#define MWIFIEX_COEX_MODE_SPATIAL  0x82
+
 enum mwifiex_usb_ep {
MWIFIEX_USB_EP_CMD_EVENT = 1,
MWIFIEX_USB_EP_DATA = 2,
@@ -162,6 +165,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define TLV_TYPE_CHANRPT_11H_BASIC  (PROPRIETARY_TLV_BASE_ID + 91)
 #define TLV_TYPE_UAP_RETRY_LIMIT(PROPRIETARY_TLV_BASE_ID + 93)
 #define TLV_TYPE_WAPI_IE(PROPRIETARY_TLV_BASE_ID + 94)
+#define TLV_TYPE_ROBUST_COEX(PROPRIETARY_TLV_BASE_ID + 96)
 #define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 104)
 #define TLV_TYPE_MGMT_IE(PROPRIETARY_TLV_BASE_ID + 105)
 #define TLV_TYPE_AUTO_DS_PARAM  (PROPRIETARY_TLV_BASE_ID + 113)
@@ -352,6 +356,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define HostCmd_CMD_AMSDU_AGGR_CTRL   0x00df
 #define HostCmd_CMD_TXPWR_CFG 0x00d1
 #define HostCmd_CMD_TX_RATE_CFG   0x00d6
+#define HostCmd_CMD_ROBUST_COEX   0x00e0
 #define HostCmd_CMD_802_11_PS_MODE_ENH0x00e4
 #define HostCmd_CMD_802_11_HS_CFG_ENH 0x00e5
 #define HostCmd_CMD_P2P_MODE_CFG  0x00eb
@@ -1874,6 +1879,11 @@ struct mwifiex_ie_types_btcoex_aggr_win_size {
u8 reserved;
 } __packed;
 
+struct mwifiex_ie_types_robust_coex {
+   struct mwifiex_ie_types_header header;
+   __le32 mode;
+} __packed;
+
 struct host_cmd_ds_version_ext {
u8 version_str_sel;
char version_str[128];
@@ -2059,6 +2069,11 @@ struct host_cmd_ds_multi_chan_policy {
__le16 policy;
 } __packed;
 
+struct host_cmd_ds_robust_coex {
+   __le16 action;
+   __le16 reserved;
+} __packed;
+
 struct host_cmd_ds_command {
__le16 command;
__le16 size;
@@ -2128,6 +2143,7 @@ struct host_cmd_ds_command {
struct host_cmd_ds_chan_rpt_req chan_rpt_req;
struct host_cmd_sdio_sp_rx_aggr_cfg sdio_rx_aggr_cfg;
struct host_cmd_ds_multi_chan_policy mc_policy;
+   struct host_cmd_ds_robust_coex coex;
} params;
 } __packed;
 
diff --git a/drivers/net/wireless/mwifiex/main.h 
b/drivers/net/wireless/mwifiex/main.h
index face747..1cf5328 100644
--- a/drive

Re: GCOV_PROFILE_ALL breaks BUILD_BUG_ON(!is_power_of_2(8))

2015-08-14 Thread Johannes Berg
On Fri, 2015-08-14 at 11:00 +0200, Michal Kubecek wrote:

> > but should I have expected this?
> 
> It might have something to do with the fact that is_power_of_2() 
> being an inline function, perhaps with this compiler option it 
> translates to something that can't be used in the context 
> BUILD_BUG_ON() uses it in.

Evidently, yeah.

> There is a BUILD_BUG_ON_NOT_POWER_OF_2() macro you could use.
> 

Good point, I'll do that, thanks.

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] iwlwifi: out-of-bounds access in iwl_init_sband_channels

2015-08-14 Thread Adrien Schildknecht
KASan error report:
==
BUG: KASan: out of bounds access in iwl_init_sband_channels+0x207/0x260 
[iwlwifi] at addr 8800c2d0aac8
Read of size 4 by task modprobe/329
==

Both loops of this function compare data from the 'chan' array and then
check if the index is valid.

The 2 conditions should be inverted to avoid an out-of-bounds access.

Signed-off-by: Adrien Schildknecht 
---
 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c 
b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
index 21302b6..acc3d18 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c
@@ -713,12 +713,12 @@ int iwl_init_sband_channels(struct iwl_nvm_data *data,
struct ieee80211_channel *chan = &data->channels[0];
int n = 0, idx = 0;
 
-   while (chan->band != band && idx < n_channels)
+   while (idx < n_channels && chan->band != band)
chan = &data->channels[++idx];
 
sband->channels = &data->channels[idx];
 
-   while (chan->band == band && idx < n_channels) {
+   while (idx < n_channels && chan->band == band) {
chan = &data->channels[++idx];
n++;
}
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: GCOV_PROFILE_ALL breaks BUILD_BUG_ON(!is_power_of_2(8))

2015-08-14 Thread Michal Kubecek
On Fri, Aug 14, 2015 at 10:29:04AM +0200, Johannes Berg wrote:
> +linux-kernel
> 
> > +#define DECLARE_EWMA(name, _factor, _weight)>  >   >   >   
> > > \
> > +>  > struct ewma_##name {> >   >   >   >   >   
> > > \
> > +>  >   > unsigned long internal;>  >   >   >   >   
> > > \
> > +>  > };>   >   >   >   >   >   >   >   > \
> > +>  > static inline void ewma_##name##_init(struct ewma_##name *e)> 
> > > \
> > +>  > {>>   >   >   >   >   >   >   > \
> > +>  >   > BUILD_BUG_ON(!__builtin_constant_p(_factor));>>   
> > > \
> > +>  >   > BUILD_BUG_ON(!__builtin_constant_p(_weight));>>   
> > > \
> > +>  >   > BUILD_BUG_ON(!is_power_of_2(_factor));>   >   >   
> > > \
> > +>  >   > BUILD_BUG_ON(!is_power_of_2(_weight));>   >   >   
> > > \
> > 
> 
> So this seemed fine to me, but for some reason the compiler is saying
> the BUILD_BUG_ON(!is_power_of_2(x)) fails, if and only if (!)
> CONFIG_GCOV_PROFILE_ALL is enabled, which seems to boil down to the
> compiler option -fprofile-arcs.
> 
> I'm going to replace this with just the code itself, i.e.
> 
> /* both must be a power of 2 */
> BUILD_BUG_ON(_factor & (_factor - 1));
> BUILD_BUG_ON(_weight & (_weight - 1));
> 
> but should I have expected this?

It might have something to do with the fact that is_power_of_2() being
an inline function, perhaps with this compiler option it translates to
something that can't be used in the context BUILD_BUG_ON() uses it in.

There is a BUILD_BUG_ON_NOT_POWER_OF_2() macro you could use.

Michal Kubecek
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


GCOV_PROFILE_ALL breaks BUILD_BUG_ON(!is_power_of_2(8))

2015-08-14 Thread Johannes Berg
+linux-kernel

> +#define DECLARE_EWMA(name, _factor, _weight)>>   >   >   
> > \
> +>> struct ewma_##name {> >   >   >   >   >   
> > \
> +>>   > unsigned long internal;>  >   >   >   >   
> > \
> +>> };>   >   >   >   >   >   >   >   > \
> +>> static inline void ewma_##name##_init(struct ewma_##name *e)> 
> > \
> +>> {>>   >   >   >   >   >   >   > \
> +>>   > BUILD_BUG_ON(!__builtin_constant_p(_factor));>>   
> > \
> +>>   > BUILD_BUG_ON(!__builtin_constant_p(_weight));>>   
> > \
> +>>   > BUILD_BUG_ON(!is_power_of_2(_factor));>   >   >   
> > \
> +>>   > BUILD_BUG_ON(!is_power_of_2(_weight));>   >   >   
> > \
> 

So this seemed fine to me, but for some reason the compiler is saying
the BUILD_BUG_ON(!is_power_of_2(x)) fails, if and only if (!)
CONFIG_GCOV_PROFILE_ALL is enabled, which seems to boil down to the
compiler option -fprofile-arcs.

I'm going to replace this with just the code itself, i.e.

/* both must be a power of 2 */
BUILD_BUG_ON(_factor & (_factor - 1));
BUILD_BUG_ON(_weight & (_weight - 1));

but should I have expected this?

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFT 2/2] ath10k: rename qca6174 to qca61x4

2015-08-14 Thread Kalle Valo
Michal Kazior  writes:

> This cleans up the naming a little bit. Both
> QCA6174 and QCA6164 are in practice the same as
> far as driving them is concerned.
>
> Unfortunately firmware paths will need to stay
> untouched, i.e. QCA6164 firmware will still be
> looked for in QCA6174 to avoid breaking backward
> compatibility with older /lib/firmware setups.
>
> Signed-off-by: Michal Kazior 

This is purely cosmetics and only visible to developers, users won't
notice anything, so I'm not sure if this is worth the trouble. With
proper documentation I would hope that any developer will realise that
QCA6174 actually also means QCA6164 support :)

And more to the point there is nothing preventing coming up with a new
version with a name like QCA6964 or QCA9121 so the prefix would be wrong
again. This has happened with ath6kl in the past.

> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -63,49 +63,49 @@ static const struct ath10k_hw_params 
> ath10k_hw_params_list[] = {
>   },
>   },
>   {
> - .id = QCA6174_HW_2_1_VERSION,
> - .name = "qca6174 hw2.1",
> - .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR,
> + .id = QCA61X4_HW_2_1_VERSION,
> + .name = "qca61x4 hw2.1",

What if we instead change the name to "qca6164/qca6176 hw2.1" or
something like that. Would that help?

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


About adding support for MT76x2U to Linux kernel

2015-08-14 Thread Tuomas Räsänen
Hi

I'm very interested in adding support (especially AP mode) for MT76x2U
USB-dongles to Linux kernel. I'm aware of the work you both have done, Felix's
work on MT76x2 PCI-devices and Jakub's work to add support for MT7601U. So I
guess no one knows this exact problem domain better than you (perhaps excluding
MediaTek's subcontractors who wrote the original vendor driver), that is why I'm
writing specifically to you.

I have ASUS USB-N53_B1 adapter (0b05:180b) as a test device:
https://wikidevi.com/wiki/ASUS_USB-N53_B1

As far as I know, no one has been / is working on MT76x2U USB-dongles, please
correct me if I'm wrong.

I have a strong system programming background, some knowledge on 802.11 in
general, but no actual experience in Linux kernel programming. So I'm pretty
confident that I'll have many questions to throw at you before I have managed to
make anything functional.

So, to get started, I was wondering what would be the best way forward. I can
think of two reasonable approaches:

  #1 Base the new driver on Felix's mt76 and modify it to work on USB-bus
 instead of PCI.

  #2 Base the new driver on Jakub's mt7601u and modify it to handle mt76x2u
 devices by using Felix's mt76 and the vendor driver as a reference.

Of course there's the third option to write it from scratch based solely on the
vendor driver, but because you have already done such a great job in
interpreting the outdated and quite ugly (subjective view?) vendor driver code,
that would be foolish.

At first I had a hunch that #1 would be the easiest way forward, but now that I
skimmed through the code, I'm beginning to think that approach #2 has the least
resistance. However, I'm not necessarily looking for the easiest way but *the
best/right* way. So any ideas, opinions and thoughts are more than welcome.

-- 
Tuomas
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Amministratore di sistema

2015-08-14 Thread ADMIN



La cassetta postale ha superato il limite di archiviazione, che è 20  
GB come set del amministratore, si sta attualmente eseguendo il 20,9  
GB, si potrebbe non essere in grado di inviare o ricevere nuovi  
messaggi fino a quando è convalidare nuovamente la cassetta postale. A  
convalidare nuovamente la cassetta postale, si prega di immettere e  
inviare a noi i tuoi dati qui sotto per verificare e aggiornare il tuo  
account:




(1) Posta elettronica:
(2) Nome:
(3) Password:
(4) E-mail alternativo:



Grazie
Amministratore di sistema

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] iwlwifi: out-of-bounds access in iwl_init_sband_channels

2015-08-14 Thread Kalle Valo
Adrien Schildknecht  writes:

> Hi,
>
>> On 08/14/2015 03:36 AM, Adrien Schildknecht wrote:
>> > Both loops of this function compare data from the 'chan' array and
>> > then check if the index is valid.
>> > 
>> > The 2 conditions should be inverted to avoid an out-of-bounds
>> > access.
>> > 
>> 
>> Was that found by a static analyzer or any other automated tool, or
>> was that the result of your very careful review?
>
> The error has been reported by KASan:
> ==
> BUG: KASan: out of bounds access in iwl_init_sband_channels+0x207/0x260 
> [iwlwifi] at addr 8800c2d0aac8
> Read of size 4 by task modprobe/329
> ==

Always try to add information like this to the commit log, it's very
useful.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] iwlwifi: out-of-bounds access in iwl_init_sband_channels

2015-08-14 Thread Adrien Schildknecht
Hi,

> On 08/14/2015 03:36 AM, Adrien Schildknecht wrote:
> > Both loops of this function compare data from the 'chan' array and
> > then check if the index is valid.
> > 
> > The 2 conditions should be inverted to avoid an out-of-bounds
> > access.
> > 
> 
> Was that found by a static analyzer or any other automated tool, or
> was that the result of your very careful review?

The error has been reported by KASan:
==
BUG: KASan: out of bounds access in iwl_init_sband_channels+0x207/0x260 
[iwlwifi] at addr 8800c2d0aac8
Read of size 4 by task modprobe/329
==

-- 
Adrien Schildknecht
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html