diff options
author | Avinash Patil <patila@marvell.com> | 2013-01-03 21:21:31 -0800 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-01-07 15:18:30 -0500 |
commit | fbd7e7ac6db3db8bccf3210d23b5a2a66471c538 (patch) | |
tree | 3a138321b0a97fc6ece0874d217e824e5290c5ea /drivers/net/wireless/mwifiex/pcie.c | |
parent | fc3314609047daf472b3ffc49f9a1c5608068713 (diff) | |
download | op-kernel-dev-fbd7e7ac6db3db8bccf3210d23b5a2a66471c538.zip op-kernel-dev-fbd7e7ac6db3db8bccf3210d23b5a2a66471c538.tar.gz |
mwifiex: flush TX ring for PCIe after disconnect or bss stop
This patch adds handler to clean PCIe TX rings after disconnect
or bss stop is called for PCIe based mwifiex driver.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/pcie.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index ac20bc4..19b5a83 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c @@ -764,6 +764,37 @@ static int mwifiex_pcie_delete_sleep_cookie_buf(struct mwifiex_adapter *adapter) return 0; } +/* This function flushes the TX buffer descriptor ring + * This function defined as handler is also called while cleaning TXRX + * during disconnect/ bss stop. + */ +static int mwifiex_clean_pcie_ring_buf(struct mwifiex_adapter *adapter) +{ + struct pcie_service_card *card = adapter->card; + u32 rdptr; + + /* Read the TX ring read pointer set by firmware */ + if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) { + dev_err(adapter->dev, + "Flush TXBD: failed to read REG_TXBD_RDPTR\n"); + return -1; + } + + if (!mwifiex_pcie_txbd_empty(card, rdptr)) { + card->txbd_flush = 1; + /* write pointer already set at last send + * send dnld-rdy intr again, wait for completion. + */ + if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, + CPU_INTR_DNLD_RDY)) { + dev_err(adapter->dev, + "failed to assert dnld-rdy interrupt.\n"); + return -1; + } + } + return 0; +} + /* * This function sends data buffer to device */ @@ -1995,6 +2026,7 @@ static struct mwifiex_if_ops pcie_ops = { .update_mp_end_port = NULL, .cleanup_mpa_buf = NULL, .init_fw_port = mwifiex_pcie_init_fw_port, + .clean_pcie_ring = mwifiex_clean_pcie_ring_buf, }; /* |