diff mbox

[1/1] ath6kl: Fix SDIO broken scatter hif-scatter

Message ID 6EA3E0BCC03CC34B89B01BD57ECBC718B17AFE41@POBOX.postoffice.danego.net (mailing list archive)
State Rejected
Delegated to: Kalle Valo
Headers show

Commit Message

Robert Deliën Nov. 6, 2015, 8:42 a.m. UTC
This patch fixes broken hif-scatter in ath6kl SDIO. It is not my work; I have found it as a difference between two Digi distributed Kernel source trees. No commit comment was recorded. I am sure there are better/nicer/cleaner way, but copying it as I found it is yet another difference less in the future. Feel free to use it in any way you see fit.

Signed-off-by: Robert Delien <robert@delien.nl>


the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Robert Deliën Nov. 6, 2015, 2:13 p.m. UTC | #1
I have found the original post of this patch:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-November/210624.html
So all credits go to the original author, Jason Liu.

After reading Kalle's comments, I have isolated the cause of my problem and it turns out to be the major bug in drivers/net/wireless/ath/ath6kl/hif.h, causing hif_scatter_item scat_list to corrupt scat_q_depth. At bit unfortunate that this fix wasn't taken in...

Even though I am using GCC 4.8.1, I'm probably not stressing the target hard enough to require the work-around in drivers/net/wireless/ath/ath6kl/sdio.c

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julian Calaby March 16, 2016, 11:16 p.m. UTC | #2
Hi Robert,

On Fri, Nov 6, 2015 at 7:42 PM, Robert Deliën <robert@delien.nl> wrote:
> This patch fixes broken hif-scatter in ath6kl SDIO. It is not my work; I have found it as a difference between two Digi distributed Kernel source trees. No commit comment was recorded. I am sure there are better/nicer/cleaner way, but copying it as I found it is yet another difference less in the future. Feel free to use it in any way you see fit.
>
> Signed-off-by: Robert Delien <robert@delien.nl>

Did you ever re-send this patch? It looks like a fairly important fix
and was never applied.

Thanks,

Julian Calaby

>
>
> Index: drivers/net/wireless/ath/ath6kl/sdio.c
> ===================================================================
> --- drivers/net/wireless/ath/ath6kl/sdio.c      (revision 715)
> +++ drivers/net/wireless/ath/ath6kl/sdio.c      (revision 716)
> @@ -222,6 +222,7 @@
>                                         struct mmc_data *data)
>  {
>         struct scatterlist *sg;
> +       struct hif_scatter_item *scat_list;
>         int i;
>
>         data->blksz = HIF_MBOX_BLOCK_SIZE;
> @@ -240,14 +241,14 @@
>         sg = scat_req->sgentries;
>         sg_init_table(sg, scat_req->scat_entries);
>
> +       scat_list = &scat_req->scat_list[0];
> +
>         /* assemble SG list */
> -       for (i = 0; i < scat_req->scat_entries; i++, sg++) {
> +       for (i = 0; i < scat_req->scat_entries; i++, sg++, scat_list++) {
>                 ath6kl_dbg(ATH6KL_DBG_SCATTER, "%d: addr:0x%p, len:%d\n",
> -                          i, scat_req->scat_list[i].buf,
> -                          scat_req->scat_list[i].len);
> +                          i, scat_list->buf, scat_list->len);
>
> -               sg_set_buf(sg, scat_req->scat_list[i].buf,
> -                          scat_req->scat_list[i].len);
> +               sg_set_buf(sg, scat_list->buf, scat_list->len);
>         }
>
>         /* set scatter-gather table for request */
> @@ -348,7 +349,7 @@
>         int i, scat_req_sz, scat_list_sz, sg_sz, buf_sz;
>         u8 *virt_buf;
>
> -       scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
> +       scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item);
>         scat_req_sz = sizeof(*s_req) + scat_list_sz;
>
>         if (!virt_scat)
> Index: drivers/net/wireless/ath/ath6kl/hif.h
> ===================================================================
> --- drivers/net/wireless/ath/ath6kl/hif.h       (revision 715)
> +++ drivers/net/wireless/ath/ath6kl/hif.h       (revision 716)
> @@ -197,9 +197,9 @@
>         /* bounce buffer for upper layers to copy to/from */
>         u8 *virt_dma_buf;
>
> -       struct hif_scatter_item scat_list[1];
> +       u32 scat_q_depth;
>
> -       u32 scat_q_depth;
> +       struct hif_scatter_item scat_list[0];
>  };
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo June 20, 2016, 8:04 p.m. UTC | #3
Robert Deliën wrote:

> This patch fixes broken hif-scatter in ath6kl SDIO. It is not my work; I have
> found it as a difference between two Digi distributed Kernel source trees. No
> commit comment was recorded. I am sure there are better/nicer/cleaner way,
> but copying it as I found it is yet another difference less in the future.
> Feel free to use it in any way you see fit.

Robert told me privately that this is fixed in latest versions. The patch has
been dropped.
diff mbox

Patch

Index: drivers/net/wireless/ath/ath6kl/sdio.c
===================================================================
--- drivers/net/wireless/ath/ath6kl/sdio.c	(revision 715)
+++ drivers/net/wireless/ath/ath6kl/sdio.c	(revision 716)
@@ -222,6 +222,7 @@ 
 					struct mmc_data *data)
 {
 	struct scatterlist *sg;
+	struct hif_scatter_item *scat_list;
 	int i;
 
 	data->blksz = HIF_MBOX_BLOCK_SIZE;
@@ -240,14 +241,14 @@ 
 	sg = scat_req->sgentries;
 	sg_init_table(sg, scat_req->scat_entries);
 
+	scat_list = &scat_req->scat_list[0];
+
 	/* assemble SG list */
-	for (i = 0; i < scat_req->scat_entries; i++, sg++) {
+	for (i = 0; i < scat_req->scat_entries; i++, sg++, scat_list++) {
 		ath6kl_dbg(ATH6KL_DBG_SCATTER, "%d: addr:0x%p, len:%d\n",
-			   i, scat_req->scat_list[i].buf,
-			   scat_req->scat_list[i].len);
+			   i, scat_list->buf, scat_list->len);
 
-		sg_set_buf(sg, scat_req->scat_list[i].buf,
-			   scat_req->scat_list[i].len);
+		sg_set_buf(sg, scat_list->buf, scat_list->len);
 	}
 
 	/* set scatter-gather table for request */
@@ -348,7 +349,7 @@ 
 	int i, scat_req_sz, scat_list_sz, sg_sz, buf_sz;
 	u8 *virt_buf;
 
-	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+	scat_list_sz = n_scat_entry * sizeof(struct hif_scatter_item);
 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
 
 	if (!virt_scat)
Index: drivers/net/wireless/ath/ath6kl/hif.h
===================================================================
--- drivers/net/wireless/ath/ath6kl/hif.h	(revision 715)
+++ drivers/net/wireless/ath/ath6kl/hif.h	(revision 716)
@@ -197,9 +197,9 @@ 
 	/* bounce buffer for upper layers to copy to/from */
 	u8 *virt_dma_buf;
 
-	struct hif_scatter_item scat_list[1];
+	u32 scat_q_depth;
 
-	u32 scat_q_depth;
+	struct hif_scatter_item scat_list[0];
 };
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in