ath10k: sdio: use same endpoint id for all packets in a bundle
authorAlagu Sankar <alagusankar@silex-india.com>
Fri, 29 Jun 2018 13:27:56 +0000 (16:27 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Oct 2018 00:00:49 +0000 (17:00 -0700)
[ Upstream commit 679e1f07c86221b7183dd69df7068fd42d0041f6 ]

All packets in a bundle should use the same endpoint id as the
first lookahead.

This matches how things are done is ath6kl, however,
this patch can theoretically handle several bundles
in ath10k_sdio_mbox_rx_process_packets().

Without this patch we get lots of errors about invalid endpoint id:

ath10k_sdio mmc2:0001:1: invalid endpoint in look-ahead: 224
ath10k_sdio mmc2:0001:1: failed to get pending recv messages: -12
ath10k_sdio mmc2:0001:1: failed to process pending SDIO interrupts: -12

Co-Developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Alagu Sankar <alagusankar@silex-india.com>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/ath/ath10k/sdio.c

index 03a69e5b11165753717517f098480306af881f26..895ccfb2141ff7d88be9bf356a0db4a1976ec4b8 100644 (file)
@@ -434,12 +434,14 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar,
        enum ath10k_htc_ep_id id;
        int ret, i, *n_lookahead_local;
        u32 *lookaheads_local;
+       int lookahead_idx = 0;
 
        for (i = 0; i < ar_sdio->n_rx_pkts; i++) {
                lookaheads_local = lookaheads;
                n_lookahead_local = n_lookahead;
 
-               id = ((struct ath10k_htc_hdr *)&lookaheads[i])->eid;
+               id = ((struct ath10k_htc_hdr *)
+                     &lookaheads[lookahead_idx++])->eid;
 
                if (id >= ATH10K_HTC_EP_COUNT) {
                        ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n",
@@ -462,6 +464,7 @@ static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar,
                        /* Only read lookahead's from RX trailers
                         * for the last packet in a bundle.
                         */
+                       lookahead_idx--;
                        lookaheads_local = NULL;
                        n_lookahead_local = NULL;
                }