2014-05-30 19:13:41

by Bing Zhao

[permalink] [raw]
Subject: [PATCH 1/2] mwifiex: fix PCIe tx_info overlap

From: Chin-Ran Lo <[email protected]>

On PCIe Tx data path, network interface specific parameters
bss_num and bss_type are saved at "skb->cb + sizeof(dma_addr_t)"
(returned by MWIFIEX_SKB_TXCB). Later mwifiex_map_pci_memory()
called from mwifiex_pcie_send_data() will memcpy
sizeof(struct mwifiex_dma_mapping) bytes to save PCIe DMA
address and length information at beginning of skb->cb.
This accidently overwrites bss_num and bss_type saved in skb->cb
previously because bss_num/bss_type and mwifiex_dma_mapping data
overlap. Fix it by having MWIFIEX_SKB_TXCB return the correct
offset for bss_num and bss_type.

Cc: Aaron Durbin <[email protected]>
Signed-off-by: Chin-Ran Lo <[email protected]>
Signed-off-by: Bing Zhao <[email protected]>
---
drivers/net/wireless/mwifiex/util.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h
index ddae570..2cde441 100644
--- a/drivers/net/wireless/mwifiex/util.h
+++ b/drivers/net/wireless/mwifiex/util.h
@@ -25,16 +25,17 @@ static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb)
return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t));
}

-static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb)
-{
- return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t));
-}
-
struct mwifiex_dma_mapping {
dma_addr_t addr;
size_t len;
};

+static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb)
+{
+ return (struct mwifiex_txinfo *)(skb->cb +
+ sizeof(struct mwifiex_dma_mapping));
+}
+
static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb,
struct mwifiex_dma_mapping *mapping)
{
--
1.8.2.3



2014-05-30 19:13:29

by Bing Zhao

[permalink] [raw]
Subject: [PATCH 2/2] mwifiex: support wowlan magic-packet encapsulated as UDP packet

From: Zhiyuan Yang <[email protected]>

When magic-packet is generated as a UDP packet the offset should
be 20+8 more bytes to cover IPv4 header and UDP header. So the
total offset become 56.
Add a new MEF entry to support both magic-packet patterns
generated by different tools.

Cc: Andreas Fenkart <[email protected]>
Signed-off-by: Zhiyuan Yang <[email protected]>
Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Bing Zhao <[email protected]>
---
drivers/net/wireless/mwifiex/cfg80211.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index e95dec9..9afac2b 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2483,6 +2483,16 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
mef_entry->filter[filt_num].filt_type = TYPE_EQ;
if (filt_num)
mef_entry->filter[filt_num].filt_action = TYPE_OR;
+
+ filt_num++;
+ mef_entry->filter[filt_num].repeat = 16;
+ memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr,
+ ETH_ALEN);
+ mef_entry->filter[filt_num].byte_seq[MWIFIEX_MEF_MAX_BYTESEQ] =
+ ETH_ALEN;
+ mef_entry->filter[filt_num].offset = 56;
+ mef_entry->filter[filt_num].filt_type = TYPE_EQ;
+ mef_entry->filter[filt_num].filt_action = TYPE_OR;
}

if (!mef_cfg.criteria)
--
1.8.2.3


2014-05-30 21:18:26

by Bing Zhao

[permalink] [raw]
Subject: RE: [PATCH 1/2] mwifiex: fix PCIe tx_info overlap

> From: Chin-Ran Lo <[email protected]>
>
> On PCIe Tx data path, network interface specific parameters
> bss_num and bss_type are saved at "skb->cb + sizeof(dma_addr_t)"
> (returned by MWIFIEX_SKB_TXCB). Later mwifiex_map_pci_memory()
> called from mwifiex_pcie_send_data() will memcpy
> sizeof(struct mwifiex_dma_mapping) bytes to save PCIe DMA
> address and length information at beginning of skb->cb.
> This accidently overwrites bss_num and bss_type saved in skb->cb
> previously because bss_num/bss_type and mwifiex_dma_mapping data
> overlap. Fix it by having MWIFIEX_SKB_TXCB return the correct
> offset for bss_num and bss_type.
>
> Cc: Aaron Durbin <[email protected]>
> Signed-off-by: Chin-Ran Lo <[email protected]>
> Signed-off-by: Bing Zhao <[email protected]>

Hi John,

Please ignore this patch.
As Aaron pointed out offline, it needs more work on RX path as well.

Thanks,
Bing