diff options
author | Avinash Patil <patila@marvell.com> | 2013-01-04 00:21:32 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-01-07 15:18:30 -0500 |
commit | e7f767a7d9f809c494bfffffeda2bbdbfec110b4 (patch) | |
tree | 1f1e96d6d2c430b1cb841b5cefbd69133c28f7ce | |
parent | fbd7e7ac6db3db8bccf3210d23b5a2a66471c538 (diff) |
mwifiex: use map/unmap APIs in TX and RX to reduce memcpy
This patch is an enhacement to mwifiex_pcie driver to use
map/unmap PCI memory APIs. This reduces one memcpy each in TX
path and RX path, and enhances throughput.
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>
-rw-r--r-- | drivers/net/wireless/mwifiex/11n_aggr.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.c | 219 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/txrx.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/wmm.c | 6 |
5 files changed, 193 insertions, 55 deletions
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 68d52cfc1ebd..af8fe6352eed 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -278,14 +278,16 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
278 | dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); | 278 | dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); |
279 | break; | 279 | break; |
280 | case -1: | 280 | case -1: |
281 | adapter->data_sent = false; | 281 | if (adapter->iface_type != MWIFIEX_PCIE) |
282 | adapter->data_sent = false; | ||
282 | dev_err(adapter->dev, "%s: host_to_card failed: %#x\n", | 283 | dev_err(adapter->dev, "%s: host_to_card failed: %#x\n", |
283 | __func__, ret); | 284 | __func__, ret); |
284 | adapter->dbg.num_tx_host_to_card_failure++; | 285 | adapter->dbg.num_tx_host_to_card_failure++; |
285 | mwifiex_write_data_complete(adapter, skb_aggr, 1, ret); | 286 | mwifiex_write_data_complete(adapter, skb_aggr, 1, ret); |
286 | return 0; | 287 | return 0; |
287 | case -EINPROGRESS: | 288 | case -EINPROGRESS: |
288 | adapter->data_sent = false; | 289 | if (adapter->iface_type != MWIFIEX_PCIE) |
290 | adapter->data_sent = false; | ||
289 | break; | 291 | break; |
290 | case 0: | 292 | case 0: |
291 | mwifiex_write_data_complete(adapter, skb_aggr, 1, ret); | 293 | mwifiex_write_data_complete(adapter, skb_aggr, 1, ret); |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 19b5a83f4e7f..3da89b456c13 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -796,15 +796,15 @@ static int mwifiex_clean_pcie_ring_buf(struct mwifiex_adapter *adapter) | |||
796 | } | 796 | } |
797 | 797 | ||
798 | /* | 798 | /* |
799 | * This function sends data buffer to device | 799 | * This function unmaps and frees downloaded data buffer |
800 | */ | 800 | */ |
801 | static int | 801 | static int mwifiex_pcie_send_data_complete(struct mwifiex_adapter *adapter) |
802 | mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) | ||
803 | { | 802 | { |
803 | const u32 num_tx_buffs = MWIFIEX_MAX_TXRX_BD; | ||
804 | struct sk_buff *skb; | ||
805 | dma_addr_t buf_pa; | ||
806 | u32 wrdoneidx, rdptr, unmap_count = 0; | ||
804 | struct pcie_service_card *card = adapter->card; | 807 | struct pcie_service_card *card = adapter->card; |
805 | u32 wrindx, rdptr; | ||
806 | phys_addr_t buf_pa; | ||
807 | __le16 *tmp; | ||
808 | 808 | ||
809 | if (!mwifiex_pcie_ok_to_access_hw(adapter)) | 809 | if (!mwifiex_pcie_ok_to_access_hw(adapter)) |
810 | mwifiex_pm_wakeup_card(adapter); | 810 | mwifiex_pm_wakeup_card(adapter); |
@@ -812,34 +812,112 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
812 | /* Read the TX ring read pointer set by firmware */ | 812 | /* Read the TX ring read pointer set by firmware */ |
813 | if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) { | 813 | if (mwifiex_read_reg(adapter, REG_TXBD_RDPTR, &rdptr)) { |
814 | dev_err(adapter->dev, | 814 | dev_err(adapter->dev, |
815 | "SEND DATA: failed to read REG_TXBD_RDPTR\n"); | 815 | "SEND COMP: failed to read REG_TXBD_RDPTR\n"); |
816 | return -1; | 816 | return -1; |
817 | } | 817 | } |
818 | 818 | ||
819 | wrindx = card->txbd_wrptr & MWIFIEX_TXBD_MASK; | 819 | dev_dbg(adapter->dev, "SEND COMP: rdptr_prev=0x%x, rdptr=0x%x\n", |
820 | card->txbd_rdptr, rdptr); | ||
820 | 821 | ||
821 | dev_dbg(adapter->dev, "info: SEND DATA: <Rd: %#x, Wr: %#x>\n", rdptr, | 822 | /* free from previous txbd_rdptr to current txbd_rdptr */ |
822 | card->txbd_wrptr); | 823 | while (((card->txbd_rdptr & MWIFIEX_TXBD_MASK) != |
823 | if (((card->txbd_wrptr & MWIFIEX_TXBD_MASK) != | 824 | (rdptr & MWIFIEX_TXBD_MASK)) || |
824 | (rdptr & MWIFIEX_TXBD_MASK)) || | 825 | ((card->txbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) != |
825 | ((card->txbd_wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) != | 826 | (rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { |
826 | (rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { | 827 | wrdoneidx = card->txbd_rdptr & MWIFIEX_TXBD_MASK; |
827 | struct sk_buff *skb_data; | 828 | |
829 | skb = card->tx_buf_list[wrdoneidx]; | ||
830 | if (skb) { | ||
831 | dev_dbg(adapter->dev, | ||
832 | "SEND COMP: Detach skb %p at txbd_rdidx=%d\n", | ||
833 | skb, wrdoneidx); | ||
834 | MWIFIEX_SKB_PACB(skb, &buf_pa); | ||
835 | pci_unmap_single(card->dev, buf_pa, skb->len, | ||
836 | PCI_DMA_TODEVICE); | ||
837 | |||
838 | unmap_count++; | ||
839 | |||
840 | if (card->txbd_flush) | ||
841 | mwifiex_write_data_complete(adapter, skb, 0, | ||
842 | -1); | ||
843 | else | ||
844 | mwifiex_write_data_complete(adapter, skb, 0, 0); | ||
845 | } | ||
846 | |||
847 | card->tx_buf_list[wrdoneidx] = NULL; | ||
848 | card->txbd_ring[wrdoneidx]->paddr = 0; | ||
849 | card->rxbd_ring[wrdoneidx]->len = 0; | ||
850 | card->rxbd_ring[wrdoneidx]->flags = 0; | ||
851 | card->txbd_rdptr++; | ||
852 | |||
853 | if ((card->txbd_rdptr & MWIFIEX_TXBD_MASK) == num_tx_buffs) | ||
854 | card->txbd_rdptr = ((card->txbd_rdptr & | ||
855 | MWIFIEX_BD_FLAG_ROLLOVER_IND) ^ | ||
856 | MWIFIEX_BD_FLAG_ROLLOVER_IND); | ||
857 | } | ||
858 | |||
859 | if (unmap_count) | ||
860 | adapter->data_sent = false; | ||
861 | |||
862 | if (card->txbd_flush) { | ||
863 | if (((card->txbd_wrptr & MWIFIEX_TXBD_MASK) == | ||
864 | (card->txbd_rdptr & MWIFIEX_TXBD_MASK)) && | ||
865 | ((card->txbd_wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) != | ||
866 | (card->txbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) | ||
867 | card->txbd_flush = 0; | ||
868 | else | ||
869 | mwifiex_clean_pcie_ring_buf(adapter); | ||
870 | } | ||
871 | |||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | /* This function sends data buffer to device. First 4 bytes of payload | ||
876 | * are filled with payload length and payload type. Then this payload | ||
877 | * is mapped to PCI device memory. Tx ring pointers are advanced accordingly. | ||
878 | * Download ready interrupt to FW is deffered if Tx ring is not full and | ||
879 | * additional payload can be accomodated. | ||
880 | */ | ||
881 | static int | ||
882 | mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb, | ||
883 | struct mwifiex_tx_param *tx_param) | ||
884 | { | ||
885 | struct pcie_service_card *card = adapter->card; | ||
886 | u32 wrindx; | ||
887 | int ret; | ||
888 | dma_addr_t buf_pa; | ||
889 | __le16 *tmp; | ||
890 | |||
891 | if (!(skb->data && skb->len)) { | ||
892 | dev_err(adapter->dev, "%s(): invalid parameter <%p, %#x>\n", | ||
893 | __func__, skb->data, skb->len); | ||
894 | return -1; | ||
895 | } | ||
896 | |||
897 | if (!mwifiex_pcie_ok_to_access_hw(adapter)) | ||
898 | mwifiex_pm_wakeup_card(adapter); | ||
899 | |||
900 | dev_dbg(adapter->dev, "info: SEND DATA: <Rd: %#x, Wr: %#x>\n", | ||
901 | card->txbd_rdptr, card->txbd_wrptr); | ||
902 | if (mwifiex_pcie_txbd_not_full(card)) { | ||
828 | u8 *payload; | 903 | u8 *payload; |
829 | 904 | ||
830 | adapter->data_sent = true; | 905 | adapter->data_sent = true; |
831 | skb_data = card->tx_buf_list[wrindx]; | 906 | payload = skb->data; |
832 | memcpy(skb_data->data, skb->data, skb->len); | ||
833 | payload = skb_data->data; | ||
834 | tmp = (__le16 *)&payload[0]; | 907 | tmp = (__le16 *)&payload[0]; |
835 | *tmp = cpu_to_le16((u16)skb->len); | 908 | *tmp = cpu_to_le16((u16)skb->len); |
836 | tmp = (__le16 *)&payload[2]; | 909 | tmp = (__le16 *)&payload[2]; |
837 | *tmp = cpu_to_le16(MWIFIEX_TYPE_DATA); | 910 | *tmp = cpu_to_le16(MWIFIEX_TYPE_DATA); |
838 | skb_put(skb_data, MWIFIEX_RX_DATA_BUF_SIZE - skb_data->len); | 911 | |
839 | skb_trim(skb_data, skb->len); | 912 | if (mwifiex_map_pci_memory(adapter, skb, skb->len , |
840 | MWIFIEX_SKB_PACB(skb_data, &buf_pa); | 913 | PCI_DMA_TODEVICE)) |
914 | return -1; | ||
915 | |||
916 | wrindx = card->txbd_wrptr & MWIFIEX_TXBD_MASK; | ||
917 | MWIFIEX_SKB_PACB(skb, &buf_pa); | ||
918 | card->tx_buf_list[wrindx] = skb; | ||
841 | card->txbd_ring[wrindx]->paddr = buf_pa; | 919 | card->txbd_ring[wrindx]->paddr = buf_pa; |
842 | card->txbd_ring[wrindx]->len = (u16)skb_data->len; | 920 | card->txbd_ring[wrindx]->len = (u16)skb->len; |
843 | card->txbd_ring[wrindx]->flags = MWIFIEX_BD_FLAG_FIRST_DESC | | 921 | card->txbd_ring[wrindx]->flags = MWIFIEX_BD_FLAG_FIRST_DESC | |
844 | MWIFIEX_BD_FLAG_LAST_DESC; | 922 | MWIFIEX_BD_FLAG_LAST_DESC; |
845 | 923 | ||
@@ -854,19 +932,28 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
854 | card->txbd_wrptr)) { | 932 | card->txbd_wrptr)) { |
855 | dev_err(adapter->dev, | 933 | dev_err(adapter->dev, |
856 | "SEND DATA: failed to write REG_TXBD_WRPTR\n"); | 934 | "SEND DATA: failed to write REG_TXBD_WRPTR\n"); |
857 | return 0; | 935 | ret = -1; |
936 | goto done_unmap; | ||
858 | } | 937 | } |
859 | 938 | if ((mwifiex_pcie_txbd_not_full(card)) && | |
860 | /* Send the TX ready interrupt */ | 939 | tx_param->next_pkt_len) { |
861 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, | 940 | /* have more packets and TxBD still can hold more */ |
862 | CPU_INTR_DNLD_RDY)) { | 941 | dev_dbg(adapter->dev, |
863 | dev_err(adapter->dev, | 942 | "SEND DATA: delay dnld-rdy interrupt.\n"); |
864 | "SEND DATA: failed to assert door-bell intr\n"); | 943 | adapter->data_sent = false; |
865 | return -1; | 944 | } else { |
945 | /* Send the TX ready interrupt */ | ||
946 | if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, | ||
947 | CPU_INTR_DNLD_RDY)) { | ||
948 | dev_err(adapter->dev, | ||
949 | "SEND DATA: failed to assert dnld-rdy interrupt.\n"); | ||
950 | ret = -1; | ||
951 | goto done_unmap; | ||
952 | } | ||
866 | } | 953 | } |
867 | dev_dbg(adapter->dev, "info: SEND DATA: Updated <Rd: %#x, Wr: " | 954 | dev_dbg(adapter->dev, "info: SEND DATA: Updated <Rd: %#x, Wr: " |
868 | "%#x> and sent packet to firmware successfully\n", | 955 | "%#x> and sent packet to firmware successfully\n", |
869 | rdptr, card->txbd_wrptr); | 956 | card->txbd_rdptr, card->txbd_wrptr); |
870 | } else { | 957 | } else { |
871 | dev_dbg(adapter->dev, | 958 | dev_dbg(adapter->dev, |
872 | "info: TX Ring full, can't send packets to fw\n"); | 959 | "info: TX Ring full, can't send packets to fw\n"); |
@@ -879,7 +966,15 @@ mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb) | |||
879 | return -EBUSY; | 966 | return -EBUSY; |
880 | } | 967 | } |
881 | 968 | ||
882 | return 0; | 969 | return -EINPROGRESS; |
970 | done_unmap: | ||
971 | MWIFIEX_SKB_PACB(skb, &buf_pa); | ||
972 | pci_unmap_single(card->dev, buf_pa, skb->len, PCI_DMA_TODEVICE); | ||
973 | card->tx_buf_list[wrindx] = NULL; | ||
974 | card->txbd_ring[wrindx]->paddr = 0; | ||
975 | card->txbd_ring[wrindx]->len = 0; | ||
976 | card->txbd_ring[wrindx]->flags = 0; | ||
977 | return ret; | ||
883 | } | 978 | } |
884 | 979 | ||
885 | /* | 980 | /* |
@@ -890,9 +985,13 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
890 | { | 985 | { |
891 | struct pcie_service_card *card = adapter->card; | 986 | struct pcie_service_card *card = adapter->card; |
892 | u32 wrptr, rd_index; | 987 | u32 wrptr, rd_index; |
988 | dma_addr_t buf_pa; | ||
893 | int ret = 0; | 989 | int ret = 0; |
894 | struct sk_buff *skb_tmp = NULL; | 990 | struct sk_buff *skb_tmp = NULL; |
895 | 991 | ||
992 | if (!mwifiex_pcie_ok_to_access_hw(adapter)) | ||
993 | mwifiex_pm_wakeup_card(adapter); | ||
994 | |||
896 | /* Read the RX ring Write pointer set by firmware */ | 995 | /* Read the RX ring Write pointer set by firmware */ |
897 | if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { | 996 | if (mwifiex_read_reg(adapter, REG_RXBD_WRPTR, &wrptr)) { |
898 | dev_err(adapter->dev, | 997 | dev_err(adapter->dev, |
@@ -900,6 +999,7 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
900 | ret = -1; | 999 | ret = -1; |
901 | goto done; | 1000 | goto done; |
902 | } | 1001 | } |
1002 | card->rxbd_wrptr = wrptr; | ||
903 | 1003 | ||
904 | while (((wrptr & MWIFIEX_RXBD_MASK) != | 1004 | while (((wrptr & MWIFIEX_RXBD_MASK) != |
905 | (card->rxbd_rdptr & MWIFIEX_RXBD_MASK)) || | 1005 | (card->rxbd_rdptr & MWIFIEX_RXBD_MASK)) || |
@@ -907,27 +1007,50 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
907 | (card->rxbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { | 1007 | (card->rxbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) { |
908 | struct sk_buff *skb_data; | 1008 | struct sk_buff *skb_data; |
909 | u16 rx_len; | 1009 | u16 rx_len; |
1010 | __le16 pkt_len; | ||
910 | 1011 | ||
911 | rd_index = card->rxbd_rdptr & MWIFIEX_RXBD_MASK; | 1012 | rd_index = card->rxbd_rdptr & MWIFIEX_RXBD_MASK; |
912 | skb_data = card->rx_buf_list[rd_index]; | 1013 | skb_data = card->rx_buf_list[rd_index]; |
913 | 1014 | ||
1015 | MWIFIEX_SKB_PACB(skb_data, &buf_pa); | ||
1016 | pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE, | ||
1017 | PCI_DMA_FROMDEVICE); | ||
1018 | card->rx_buf_list[rd_index] = NULL; | ||
1019 | |||
914 | /* Get data length from interface header - | 1020 | /* Get data length from interface header - |
915 | first byte is len, second byte is type */ | 1021 | * first 2 bytes for len, next 2 bytes is for type |
916 | rx_len = *((u16 *)skb_data->data); | 1022 | */ |
1023 | pkt_len = *((__le16 *)skb_data->data); | ||
1024 | rx_len = le16_to_cpu(pkt_len); | ||
1025 | skb_put(skb_data, rx_len); | ||
917 | dev_dbg(adapter->dev, | 1026 | dev_dbg(adapter->dev, |
918 | "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n", | 1027 | "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n", |
919 | card->rxbd_rdptr, wrptr, rx_len); | 1028 | card->rxbd_rdptr, wrptr, rx_len); |
920 | skb_tmp = dev_alloc_skb(rx_len); | 1029 | skb_pull(skb_data, INTF_HEADER_LEN); |
1030 | mwifiex_handle_rx_packet(adapter, skb_data); | ||
1031 | |||
1032 | skb_tmp = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); | ||
921 | if (!skb_tmp) { | 1033 | if (!skb_tmp) { |
922 | dev_dbg(adapter->dev, | 1034 | dev_err(adapter->dev, |
923 | "info: Failed to alloc skb for RX\n"); | 1035 | "Unable to allocate skb.\n"); |
924 | ret = -EBUSY; | 1036 | return -ENOMEM; |
925 | goto done; | ||
926 | } | 1037 | } |
927 | 1038 | ||
928 | skb_put(skb_tmp, rx_len); | 1039 | if (mwifiex_map_pci_memory(adapter, skb_tmp, |
1040 | MWIFIEX_RX_DATA_BUF_SIZE, | ||
1041 | PCI_DMA_FROMDEVICE)) | ||
1042 | return -1; | ||
1043 | |||
1044 | MWIFIEX_SKB_PACB(skb_tmp, &buf_pa); | ||
1045 | |||
1046 | dev_dbg(adapter->dev, | ||
1047 | "RECV DATA: Attach new sk_buff %p at rxbd_rdidx=%d\n", | ||
1048 | skb_tmp, rd_index); | ||
1049 | card->rx_buf_list[rd_index] = skb_tmp; | ||
1050 | card->rxbd_ring[rd_index]->paddr = buf_pa; | ||
1051 | card->rxbd_ring[rd_index]->len = skb_tmp->len; | ||
1052 | card->rxbd_ring[rd_index]->flags = 0; | ||
929 | 1053 | ||
930 | memcpy(skb_tmp->data, skb_data->data + INTF_HEADER_LEN, rx_len); | ||
931 | if ((++card->rxbd_rdptr & MWIFIEX_RXBD_MASK) == | 1054 | if ((++card->rxbd_rdptr & MWIFIEX_RXBD_MASK) == |
932 | MWIFIEX_MAX_TXRX_BD) { | 1055 | MWIFIEX_MAX_TXRX_BD) { |
933 | card->rxbd_rdptr = ((card->rxbd_rdptr & | 1056 | card->rxbd_rdptr = ((card->rxbd_rdptr & |
@@ -955,12 +1078,10 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
955 | } | 1078 | } |
956 | dev_dbg(adapter->dev, | 1079 | dev_dbg(adapter->dev, |
957 | "info: RECV DATA: Rcvd packet from fw successfully\n"); | 1080 | "info: RECV DATA: Rcvd packet from fw successfully\n"); |
958 | mwifiex_handle_rx_packet(adapter, skb_tmp); | 1081 | card->rxbd_wrptr = wrptr; |
959 | } | 1082 | } |
960 | 1083 | ||
961 | done: | 1084 | done: |
962 | if (ret && skb_tmp) | ||
963 | dev_kfree_skb_any(skb_tmp); | ||
964 | return ret; | 1085 | return ret; |
965 | } | 1086 | } |
966 | 1087 | ||
@@ -1732,10 +1853,10 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) | |||
1732 | while (pcie_ireg & HOST_INTR_MASK) { | 1853 | while (pcie_ireg & HOST_INTR_MASK) { |
1733 | if (pcie_ireg & HOST_INTR_DNLD_DONE) { | 1854 | if (pcie_ireg & HOST_INTR_DNLD_DONE) { |
1734 | pcie_ireg &= ~HOST_INTR_DNLD_DONE; | 1855 | pcie_ireg &= ~HOST_INTR_DNLD_DONE; |
1735 | if (adapter->data_sent) { | 1856 | dev_dbg(adapter->dev, "info: TX DNLD Done\n"); |
1736 | dev_dbg(adapter->dev, "info: DATA sent intr\n"); | 1857 | ret = mwifiex_pcie_send_data_complete(adapter); |
1737 | adapter->data_sent = false; | 1858 | if (ret) |
1738 | } | 1859 | return ret; |
1739 | } | 1860 | } |
1740 | if (pcie_ireg & HOST_INTR_UPLD_RDY) { | 1861 | if (pcie_ireg & HOST_INTR_UPLD_RDY) { |
1741 | pcie_ireg &= ~HOST_INTR_UPLD_RDY; | 1862 | pcie_ireg &= ~HOST_INTR_UPLD_RDY; |
@@ -1812,7 +1933,7 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type, | |||
1812 | } | 1933 | } |
1813 | 1934 | ||
1814 | if (type == MWIFIEX_TYPE_DATA) | 1935 | if (type == MWIFIEX_TYPE_DATA) |
1815 | return mwifiex_pcie_send_data(adapter, skb); | 1936 | return mwifiex_pcie_send_data(adapter, skb, tx_param); |
1816 | else if (type == MWIFIEX_TYPE_CMD) | 1937 | else if (type == MWIFIEX_TYPE_CMD) |
1817 | return mwifiex_pcie_send_cmd(adapter, skb); | 1938 | return mwifiex_pcie_send_cmd(adapter, skb); |
1818 | 1939 | ||
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 24a39b32a222..37eeb2ca6b29 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
@@ -159,4 +159,15 @@ mwifiex_pcie_txbd_empty(struct pcie_service_card *card, u32 rdptr) | |||
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
161 | 161 | ||
162 | static inline int | ||
163 | mwifiex_pcie_txbd_not_full(struct pcie_service_card *card) | ||
164 | { | ||
165 | if (((card->txbd_wrptr & MWIFIEX_TXBD_MASK) != | ||
166 | (card->txbd_rdptr & MWIFIEX_TXBD_MASK)) || | ||
167 | ((card->txbd_wrptr & MWIFIEX_BD_FLAG_ROLLOVER_IND) != | ||
168 | (card->txbd_rdptr & MWIFIEX_BD_FLAG_ROLLOVER_IND))) | ||
169 | return 1; | ||
170 | |||
171 | return 0; | ||
172 | } | ||
162 | #endif /* _MWIFIEX_PCIE_H */ | 173 | #endif /* _MWIFIEX_PCIE_H */ |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index 8c80024c30ff..296faec14365 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
@@ -117,14 +117,16 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, | |||
117 | dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); | 117 | dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); |
118 | break; | 118 | break; |
119 | case -1: | 119 | case -1: |
120 | adapter->data_sent = false; | 120 | if (adapter->iface_type != MWIFIEX_PCIE) |
121 | adapter->data_sent = false; | ||
121 | dev_err(adapter->dev, "mwifiex_write_data_async failed: 0x%X\n", | 122 | dev_err(adapter->dev, "mwifiex_write_data_async failed: 0x%X\n", |
122 | ret); | 123 | ret); |
123 | adapter->dbg.num_tx_host_to_card_failure++; | 124 | adapter->dbg.num_tx_host_to_card_failure++; |
124 | mwifiex_write_data_complete(adapter, skb, 0, ret); | 125 | mwifiex_write_data_complete(adapter, skb, 0, ret); |
125 | break; | 126 | break; |
126 | case -EINPROGRESS: | 127 | case -EINPROGRESS: |
127 | adapter->data_sent = false; | 128 | if (adapter->iface_type != MWIFIEX_PCIE) |
129 | adapter->data_sent = false; | ||
128 | break; | 130 | break; |
129 | case 0: | 131 | case 0: |
130 | mwifiex_write_data_complete(adapter, skb, 0, ret); | 132 | mwifiex_write_data_complete(adapter, skb, 0, ret); |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 6d641cbce726..135d96df2063 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -1208,13 +1208,15 @@ mwifiex_send_processed_packet(struct mwifiex_private *priv, | |||
1208 | ra_list_flags); | 1208 | ra_list_flags); |
1209 | break; | 1209 | break; |
1210 | case -1: | 1210 | case -1: |
1211 | adapter->data_sent = false; | 1211 | if (adapter->iface_type != MWIFIEX_PCIE) |
1212 | adapter->data_sent = false; | ||
1212 | dev_err(adapter->dev, "host_to_card failed: %#x\n", ret); | 1213 | dev_err(adapter->dev, "host_to_card failed: %#x\n", ret); |
1213 | adapter->dbg.num_tx_host_to_card_failure++; | 1214 | adapter->dbg.num_tx_host_to_card_failure++; |
1214 | mwifiex_write_data_complete(adapter, skb, 0, ret); | 1215 | mwifiex_write_data_complete(adapter, skb, 0, ret); |
1215 | break; | 1216 | break; |
1216 | case -EINPROGRESS: | 1217 | case -EINPROGRESS: |
1217 | adapter->data_sent = false; | 1218 | if (adapter->iface_type != MWIFIEX_PCIE) |
1219 | adapter->data_sent = false; | ||
1218 | default: | 1220 | default: |
1219 | break; | 1221 | break; |
1220 | } | 1222 | } |