2015-02-06 11:12:28

by Avinash Patil

[permalink] [raw]
Subject: [PATCH 1/5] mwifiex: more_task flag for main_process

This patch handles a corner case where TX packet would remain in
driver queue till next packet comes in.
Here is sequence:
1. TX packet is queued via hard_start_xmit and main_work is queued
2. SDIO interrupt comes in which directly call mwifiex_main_process.
This starts executing main superloop.
3. Now work from step1 is scheduled but at first check itself it sees
mwifiex_processing is set and exits.
4. Now if superloop from step2 has passed TX processing part of superloop
this packet would remain in queue until next packet/command/SDIO interrupt
arrives and queues main_work.

This patch fixes this corner case by defining more_task flag which is set when
mwifiex_processing is found to be true. At end of superloop we again check if
more_task flag is set and if set, execute superloop again.

Signed-off-by: Shengzhen Li <[email protected]>
Signed-off-by: Avinash Patil <[email protected]>
Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/mwifiex/main.c | 16 +++++++++-------
drivers/net/wireless/mwifiex/main.h | 1 +
2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 7e74b4f..74488ab 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -190,14 +190,16 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter)

/* Check if already processing */
if (adapter->mwifiex_processing) {
+ adapter->more_task_flag = true;
spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
goto exit_main_proc;
} else {
adapter->mwifiex_processing = true;
- spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
}
process_start:
do {
+ adapter->more_task_flag = false;
+ spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
if ((adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) ||
(adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY))
break;
@@ -238,6 +240,7 @@ process_start:
adapter->pm_wakeup_fw_try = true;
mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3));
adapter->if_ops.wakeup(adapter);
+ spin_lock_irqsave(&adapter->main_proc_lock, flags);
continue;
}

@@ -295,8 +298,10 @@ process_start:
if ((adapter->ps_state == PS_STATE_SLEEP) ||
(adapter->ps_state == PS_STATE_PRE_SLEEP) ||
(adapter->ps_state == PS_STATE_SLEEP_CFM) ||
- adapter->tx_lock_flag)
+ adapter->tx_lock_flag){
+ spin_lock_irqsave(&adapter->main_proc_lock, flags);
continue;
+ }

if (!adapter->cmd_sent && !adapter->curr_cmd) {
if (mwifiex_exec_next_cmd(adapter) == -1) {
@@ -330,15 +335,12 @@ process_start:
}
break;
}
+ spin_lock_irqsave(&adapter->main_proc_lock, flags);
} while (true);

spin_lock_irqsave(&adapter->main_proc_lock, flags);
- if (!adapter->delay_main_work &&
- (adapter->int_status || IS_CARD_RX_RCVD(adapter))) {
- spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
+ if (adapter->more_task_flag)
goto process_start;
- }
-
adapter->mwifiex_processing = false;
spin_unlock_irqrestore(&adapter->main_proc_lock, flags);

diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index f0a6af1..2089a30 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -774,6 +774,7 @@ struct mwifiex_adapter {
/* spin lock for main process */
spinlock_t main_proc_lock;
u32 mwifiex_processing;
+ u8 more_task_flag;
u16 tx_buf_size;
u16 curr_tx_buf_size;
u32 ioport;
--
1.8.1.4



2015-02-06 11:13:19

by Avinash Patil

[permalink] [raw]
Subject: [PATCH 4/5] mwifiex: change datatype to bool for device capability flags

This patch changes datatypes for device capability flags to bool.
Patch also aggregates these variables at single place.

Signed-off-by: Avinash Patil <[email protected]>
---
drivers/net/wireless/mwifiex/pcie.c | 4 +--
drivers/net/wireless/mwifiex/pcie.h | 6 ++--
drivers/net/wireless/mwifiex/sdio.c | 8 ++---
drivers/net/wireless/mwifiex/sdio.h | 60 ++++++++++++++++++-------------------
4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 29c4e8e..4b463c3 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -203,7 +203,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
card->pcie.reg = data->reg;
card->pcie.blksz_fw_dl = data->blksz_fw_dl;
card->pcie.tx_buf_size = data->tx_buf_size;
- card->pcie.supports_fw_dump = data->supports_fw_dump;
+ card->pcie.can_dump_fw = data->can_dump_fw;
card->pcie.can_ext_scan = data->can_ext_scan;
}

@@ -2273,7 +2273,7 @@ static void mwifiex_pcie_fw_dump_work(struct mwifiex_adapter *adapter)
int ret;
static char *env[] = { "DRIVER=mwifiex_pcie", "EVENT=fw_dump", NULL };

- if (!card->pcie.supports_fw_dump)
+ if (!card->pcie.can_dump_fw)
return;

for (idx = 0; idx < ARRAY_SIZE(mem_type_mapping_tbl); idx++) {
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h
index 666d40e..0e7ee8b 100644
--- a/drivers/net/wireless/mwifiex/pcie.h
+++ b/drivers/net/wireless/mwifiex/pcie.h
@@ -205,7 +205,7 @@ struct mwifiex_pcie_device {
const struct mwifiex_pcie_card_reg *reg;
u16 blksz_fw_dl;
u16 tx_buf_size;
- bool supports_fw_dump;
+ bool can_dump_fw;
bool can_ext_scan;
};

@@ -214,7 +214,7 @@ static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
.reg = &mwifiex_reg_8766,
.blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
- .supports_fw_dump = false,
+ .can_dump_fw = false,
.can_ext_scan = true,
};

@@ -223,7 +223,7 @@ static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
.reg = &mwifiex_reg_8897,
.blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
- .supports_fw_dump = true,
+ .can_dump_fw = true,
.can_ext_scan = true,
};

diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 998f3cb..57d85ab 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -105,8 +105,8 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
card->tx_buf_size = data->tx_buf_size;
card->mp_tx_agg_buf_size = data->mp_tx_agg_buf_size;
card->mp_rx_agg_buf_size = data->mp_rx_agg_buf_size;
- card->supports_fw_dump = data->supports_fw_dump;
- card->auto_tdls = data->auto_tdls;
+ card->can_dump_fw = data->can_dump_fw;
+ card->can_auto_tdls = data->can_auto_tdls;
card->can_ext_scan = data->can_ext_scan;
}

@@ -1888,7 +1888,7 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
return -1;
}

- adapter->auto_tdls = card->auto_tdls;
+ adapter->auto_tdls = card->can_auto_tdls;
adapter->ext_scan = card->can_ext_scan;
return ret;
}
@@ -2033,7 +2033,7 @@ static void mwifiex_sdio_fw_dump_work(struct work_struct *work)

mwifiex_dump_drv_info(adapter);

- if (!card->supports_fw_dump)
+ if (!card->can_dump_fw)
return;

for (idx = 0; idx < ARRAY_SIZE(mem_type_mapping_tbl); idx++) {
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h
index 957cca2..3fe9fb4 100644
--- a/drivers/net/wireless/mwifiex/sdio.h
+++ b/drivers/net/wireless/mwifiex/sdio.h
@@ -238,9 +238,6 @@ struct sdio_mmc_card {
const struct mwifiex_sdio_card_reg *reg;
u8 max_ports;
u8 mp_agg_pkt_limit;
- bool supports_sdio_new_mode;
- bool has_control_mask;
- bool supports_fw_dump;
u16 tx_buf_size;
u32 mp_tx_agg_buf_size;
u32 mp_rx_agg_buf_size;
@@ -255,7 +252,10 @@ struct sdio_mmc_card {
u8 curr_wr_port;

u8 *mp_regs;
- u8 auto_tdls;
+ bool supports_sdio_new_mode;
+ bool has_control_mask;
+ bool can_dump_fw;
+ bool can_auto_tdls;
bool can_ext_scan;

struct mwifiex_sdio_mpa_tx mpa_tx;
@@ -267,13 +267,13 @@ struct mwifiex_sdio_device {
const struct mwifiex_sdio_card_reg *reg;
u8 max_ports;
u8 mp_agg_pkt_limit;
- bool supports_sdio_new_mode;
- bool has_control_mask;
- bool supports_fw_dump;
u16 tx_buf_size;
u32 mp_tx_agg_buf_size;
u32 mp_rx_agg_buf_size;
- u8 auto_tdls;
+ bool supports_sdio_new_mode;
+ bool has_control_mask;
+ bool can_dump_fw;
+ bool can_auto_tdls;
bool can_ext_scan;
};

@@ -412,13 +412,13 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
.reg = &mwifiex_reg_sd87xx,
.max_ports = 16,
.mp_agg_pkt_limit = 8,
- .supports_sdio_new_mode = false,
- .has_control_mask = true,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
- .supports_fw_dump = false,
- .auto_tdls = false,
+ .supports_sdio_new_mode = false,
+ .has_control_mask = true,
+ .can_dump_fw = false,
+ .can_auto_tdls = false,
.can_ext_scan = false,
};

@@ -427,13 +427,13 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
.reg = &mwifiex_reg_sd87xx,
.max_ports = 16,
.mp_agg_pkt_limit = 8,
- .supports_sdio_new_mode = false,
- .has_control_mask = true,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
- .supports_fw_dump = false,
- .auto_tdls = false,
+ .supports_sdio_new_mode = false,
+ .has_control_mask = true,
+ .can_dump_fw = false,
+ .can_auto_tdls = false,
.can_ext_scan = true,
};

@@ -442,13 +442,13 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
.reg = &mwifiex_reg_sd87xx,
.max_ports = 16,
.mp_agg_pkt_limit = 8,
- .supports_sdio_new_mode = false,
- .has_control_mask = true,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
- .supports_fw_dump = false,
- .auto_tdls = false,
+ .supports_sdio_new_mode = false,
+ .has_control_mask = true,
+ .can_dump_fw = false,
+ .can_auto_tdls = false,
.can_ext_scan = true,
};

@@ -457,13 +457,13 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
.reg = &mwifiex_reg_sd8897,
.max_ports = 32,
.mp_agg_pkt_limit = 16,
- .supports_sdio_new_mode = true,
- .has_control_mask = false,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
- .supports_fw_dump = true,
- .auto_tdls = false,
+ .supports_sdio_new_mode = true,
+ .has_control_mask = false,
+ .can_dump_fw = true,
+ .can_auto_tdls = false,
.can_ext_scan = true,
};

@@ -472,13 +472,13 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
.reg = &mwifiex_reg_sd8887,
.max_ports = 32,
.mp_agg_pkt_limit = 16,
- .supports_sdio_new_mode = true,
- .has_control_mask = false,
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
- .supports_fw_dump = false,
- .auto_tdls = true,
+ .supports_sdio_new_mode = true,
+ .has_control_mask = false,
+ .can_dump_fw = false,
+ .can_auto_tdls = true,
.can_ext_scan = true,
};

@@ -492,8 +492,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
.tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K,
- .supports_fw_dump = false,
- .auto_tdls = false,
+ .can_dump_fw = false,
+ .can_auto_tdls = false,
.can_ext_scan = true,
};

--
1.8.1.4


2015-02-06 11:12:49

by Avinash Patil

[permalink] [raw]
Subject: [PATCH 2/5] mwifiex: do not process mgmt rx on uninitialized interface

This patch fixes a crash which was happening because of RX of
management frames on uninitialzed interface. Now we drop management
frames for interfaces where cfg80211 has not registered any management
subtype reception or interface has no NL80211 iftype set.

Signed-off-by: Avinash Patil <[email protected]>
---
drivers/net/wireless/mwifiex/util.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index 3085506..47e215b 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -367,6 +367,13 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
if (!skb)
return -1;

+ if (!priv->mgmt_frame_mask ||
+ priv->wdev.iftype == NL80211_IFTYPE_UNSPECIFIED) {
+ dev_dbg(priv->adapter->dev,
+ "do not receive mgmt frames on uninitialized intf");
+ return -1;
+ }
+
rx_pd = (struct rxpd *)skb->data;

skb_pull(skb, le16_to_cpu(rx_pd->rx_pkt_offset));
--
1.8.1.4


2015-02-06 11:13:23

by Avinash Patil

[permalink] [raw]
Subject: [PATCH 5/5] mwifiex: modify TX buff size for SD8887

FW crash has been observed while running iperf TX with SD8887
devices. This is because of invalid TX buffer setting. SD8887
supports 2K buffer sizes. This patch fixes this issue.

Signed-off-by: Avinash Patil <[email protected]>
---
drivers/net/wireless/mwifiex/sdio.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h
index 3fe9fb4..c636944 100644
--- a/drivers/net/wireless/mwifiex/sdio.h
+++ b/drivers/net/wireless/mwifiex/sdio.h
@@ -472,7 +472,7 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
.reg = &mwifiex_reg_sd8887,
.max_ports = 32,
.mp_agg_pkt_limit = 16,
- .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
+ .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
.mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
.mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K,
.supports_sdio_new_mode = true,
--
1.8.1.4


2015-02-06 11:12:53

by Avinash Patil

[permalink] [raw]
Subject: [PATCH 3/5] mwifiex: DMA alignment for RX packets

This patch adds support for DMA alignment of sk_buffs
allocated for RX.
Patch also adds support to modify skb allocation flags.

Signed-off-by: Avinash Patil <[email protected]>
Signed-off-by: Marc Yang <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/mwifiex/main.h | 4 ++++
drivers/net/wireless/mwifiex/pcie.c | 6 ++++--
drivers/net/wireless/mwifiex/sdio.c | 5 +++--
drivers/net/wireless/mwifiex/util.c | 21 +++++++++++++++++++++
4 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 2089a30..16be45e 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -140,6 +140,9 @@ enum {

#define MWIFIEX_DRV_INFO_SIZE_MAX 0x40000

+/* Address alignment */
+#define MWIFIEX_ALIGN_ADDR(p, a) (((long)(p) + (a) - 1) & ~((a) - 1))
+
struct mwifiex_dbg {
u32 num_cmd_host_to_card_failure;
u32 num_cmd_sleep_cfm_host_to_card_failure;
@@ -1418,6 +1421,7 @@ u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv,
u8 rx_rate, u8 ht_info);

void mwifiex_dump_drv_info(struct mwifiex_adapter *adapter);
+void *mwifiex_alloc_rx_buf(int rx_len, gfp_t flags);

#ifdef CONFIG_DEBUG_FS
void mwifiex_debugfs_init(void);
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index a5828da..29c4e8e 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -498,7 +498,8 @@ static int mwifiex_init_rxq_ring(struct mwifiex_adapter *adapter)

for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) {
/* Allocate skb here so that firmware can DMA data from it */
- skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE);
+ skb = mwifiex_alloc_rx_buf(MWIFIEX_RX_DATA_BUF_SIZE,
+ GFP_KERNEL | GFP_DMA);
if (!skb) {
dev_err(adapter->dev,
"Unable to allocate skb for RX ring.\n");
@@ -1297,7 +1298,8 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter)
}
}

- skb_tmp = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE);
+ skb_tmp = mwifiex_alloc_rx_buf(MWIFIEX_RX_DATA_BUF_SIZE,
+ GFP_KERNEL | GFP_DMA);
if (!skb_tmp) {
dev_err(adapter->dev,
"Unable to allocate skb.\n");
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 91e36cd..998f3cb 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -1357,7 +1357,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
return -1;
rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE);

- skb = dev_alloc_skb(rx_len);
+ skb = mwifiex_alloc_rx_buf(rx_len, GFP_KERNEL | GFP_DMA);
if (!skb)
return -1;

@@ -1454,7 +1454,8 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
}
rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE);

- skb = dev_alloc_skb(rx_len);
+ skb = mwifiex_alloc_rx_buf(rx_len,
+ GFP_KERNEL | GFP_DMA);

if (!skb) {
dev_err(adapter->dev, "%s: failed to alloc skb",
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index 47e215b..ed69154 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -631,3 +631,24 @@ void mwifiex_hist_data_reset(struct mwifiex_private *priv)
for (ix = 0; ix < MWIFIEX_MAX_SIG_STRENGTH; ix++)
atomic_set(&phist_data->sig_str[ix], 0);
}
+
+void *mwifiex_alloc_rx_buf(int rx_len, gfp_t flags)
+{
+ struct sk_buff *skb;
+ int buf_len, pad;
+
+ buf_len = rx_len + MWIFIEX_DMA_ALIGN_SZ;
+
+ skb = __dev_alloc_skb(buf_len, flags);
+
+ if (!skb)
+ return NULL;
+
+ pad = MWIFIEX_ALIGN_ADDR(skb->data, MWIFIEX_DMA_ALIGN_SZ) -
+ (long)skb->data;
+
+ skb_reserve(skb, pad);
+
+ return skb;
+}
+EXPORT_SYMBOL_GPL(mwifiex_alloc_rx_buf);
--
1.8.1.4


2015-02-10 14:17:54

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/5] mwifiex: more_task flag for main_process

Avinash Patil <[email protected]> writes:

> Please drop this series as we are seeing issue with DMA alignment patch.
> I will resend v2 after fixing this.

Ok, dropped.

--
Kalle Valo

2015-02-09 13:26:01

by Avinash Patil

[permalink] [raw]
Subject: RE: [PATCH 1/5] mwifiex: more_task flag for main_process

Hi Kalle,

> -----Original Message-----
> From: Avinash Patil [mailto:[email protected]]
> Sent: Friday, February 06, 2015 10:12 PM
> To: [email protected]
> Cc: Amitkumar Karwar; Cathy Luo; Marc Yang; Shengzhen Li; Avinash Patil
> Subject: [PATCH 1/5] mwifiex: more_task flag for main_process
>
> This patch handles a corner case where TX packet would remain in driver queue
> till next packet comes in.
> Here is sequence:
> 1. TX packet is queued via hard_start_xmit and main_work is queued 2. SDIO
> interrupt comes in which directly call mwifiex_main_process.
> This starts executing main superloop.
> 3. Now work from step1 is scheduled but at first check itself it sees
> mwifiex_processing is set and exits.
> 4. Now if superloop from step2 has passed TX processing part of superloop this
> packet would remain in queue until next packet/command/SDIO interrupt arrives
> and queues main_work.
>
> This patch fixes this corner case by defining more_task flag which is set when
> mwifiex_processing is found to be true. At end of superloop we again check if
> more_task flag is set and if set, execute superloop again.
>
> Signed-off-by: Shengzhen Li <[email protected]>
> Signed-off-by: Avinash Patil <[email protected]>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> Signed-off-by: Cathy Luo <[email protected]>
> ---
> drivers/net/wireless/mwifiex/main.c | 16 +++++++++-------
> drivers/net/wireless/mwifiex/main.h | 1 +
> 2 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/mwifiex/main.c
> b/drivers/net/wireless/mwifiex/main.c
> index 7e74b4f..74488ab 100644
> --- a/drivers/net/wireless/mwifiex/main.c
> +++ b/drivers/net/wireless/mwifiex/main.c
> @@ -190,14 +190,16 @@ int mwifiex_main_process(struct mwifiex_adapter
> *adapter)
>
> /* Check if already processing */
> if (adapter->mwifiex_processing) {
> + adapter->more_task_flag = true;
> spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
> goto exit_main_proc;
> } else {
> adapter->mwifiex_processing = true;
> - spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
> }
> process_start:
> do {
> + adapter->more_task_flag = false;
> + spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
> if ((adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) ||
> (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY))
> break;
> @@ -238,6 +240,7 @@ process_start:
> adapter->pm_wakeup_fw_try = true;
> mod_timer(&adapter->wakeup_timer, jiffies + (HZ*3));
> adapter->if_ops.wakeup(adapter);
> + spin_lock_irqsave(&adapter->main_proc_lock, flags);
> continue;
> }
>
> @@ -295,8 +298,10 @@ process_start:
> if ((adapter->ps_state == PS_STATE_SLEEP) ||
> (adapter->ps_state == PS_STATE_PRE_SLEEP) ||
> (adapter->ps_state == PS_STATE_SLEEP_CFM) ||
> - adapter->tx_lock_flag)
> + adapter->tx_lock_flag){
> + spin_lock_irqsave(&adapter->main_proc_lock, flags);
> continue;
> + }
>
> if (!adapter->cmd_sent && !adapter->curr_cmd) {
> if (mwifiex_exec_next_cmd(adapter) == -1) { @@ -330,15
> +335,12 @@ process_start:
> }
> break;
> }
> + spin_lock_irqsave(&adapter->main_proc_lock, flags);
> } while (true);
>
> spin_lock_irqsave(&adapter->main_proc_lock, flags);
> - if (!adapter->delay_main_work &&
> - (adapter->int_status || IS_CARD_RX_RCVD(adapter))) {
> - spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
> + if (adapter->more_task_flag)
> goto process_start;
> - }
> -
> adapter->mwifiex_processing = false;
> spin_unlock_irqrestore(&adapter->main_proc_lock, flags);
>
> diff --git a/drivers/net/wireless/mwifiex/main.h
> b/drivers/net/wireless/mwifiex/main.h
> index f0a6af1..2089a30 100644
> --- a/drivers/net/wireless/mwifiex/main.h
> +++ b/drivers/net/wireless/mwifiex/main.h
> @@ -774,6 +774,7 @@ struct mwifiex_adapter {
> /* spin lock for main process */
> spinlock_t main_proc_lock;
> u32 mwifiex_processing;
> + u8 more_task_flag;
> u16 tx_buf_size;
> u16 curr_tx_buf_size;
> u32 ioport;
> --
> 1.8.1.4

Please drop this series as we are seeing issue with DMA alignment patch.
I will resend v2 after fixing this.

Thanks,
Avinash

2015-02-11 17:57:33

by Avinash Patil

[permalink] [raw]
Subject: RE: [PATCH 1/5] mwifiex: more_task flag for main_process

> -----Original Message-----
> From: Kalle Valo [mailto:[email protected]]
> Sent: Tuesday, February 10, 2015 7:48 PM
> To: Avinash Patil
> Cc: [email protected]; Amitkumar Karwar; Cathy Luo; Marc Yang;
> Shengzhen Li
> Subject: Re: [PATCH 1/5] mwifiex: more_task flag for main_process
>
> Avinash Patil <[email protected]> writes:
>
> > Please drop this series as we are seeing issue with DMA alignment patch.
> > I will resend v2 after fixing this.
>
> Ok, dropped.
>
> --
> Kalle Valo
Hi Kalle,

I have sent v2 by omitting DMA alignment patch. I will send this patch separately after fixing issue.
-Avinash.