mt76x0u: Probing issues on Raspberry Pi 3 B+
Subsystems (3)
Quoted 22 lines · Stefan Wahren
Hi Stanislaw,
Am 14.02.19 um 10:25 schrieb Stanislaw Gruszka:
Quoted 19 lines · Stefan Wahren
Quoted 6 lines
Hi Stanislaw,
Quoted 4 lines
Stanislaw Gruszka <[email protected]> hat am 12. Februar 2019 um 10:30 geschrieben:
Quoted 7 lines
Quoted 5 lines
In
usb_sg_init()urb->num_sgsis set 0 forsg_tablesize= 0 controllers. In mt76 we seturb->num_sgsto 1. I thought it is fine, but now I think this is bug. We can fix that without changing allocation method and still use SG allocation. Attached patch do this, please check if it works on rpi. Patch is on top of your error path fixes.your patch didn't apply cleanly to yesterdays next. After some minor manual fixup, i was able to build them and here are the results starting from boot (please ignore the invalid time in the kernel log):
https://gist.github.com/lategoodbye/33bd5bc75b9fc935faa231bc472defa8I think this is due to
urb->transfer_lengthand sg[0]->length mismatch, which should be addressed by my other patch. I'm attaching the patch rebased on -next with this line integrated, please test.But there could be other bug's in mt76-usb SG code.
I found another bug in mt76usb SG code. We set sg->offset bigger than PAGE_SIZE that actually make sg point to memory in different page than sg->page. Correcting this with another patch that avoid using sg mapping with sg->length > PAGE_SIZE, fixed mt76x0u with AMD IOMMU:
https://bugzilla.kernel.org/show_bug.cgi?id=202241
I'm attaching 3 patches, they should also fix issue on rpi. It's also possible that only 2 patches are sufficient:
0001-mt76usb-do-not-set-urb-num_sgs-to-1-for-non-SG-usb-h.patch 0003-mt76usb-do-not-use-compound-head-page-for-SG-I-O.patch
to fix the issue, if doing dma_map_{page,sg} is fine with sg->offset == 0 and sg->length bigger than one page.
Please test, thanks.
Stanislaw
From 49654f00b5071602a9182f0cb488f346f01ec5ac Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <[email protected]>
Date: Fri, 15 Feb 2019 07:39:00 +0100
Subject: [PATCH v5 1/3] mt76usb: do not set urb->num_sgs to 1 for non SG usb
host drivers
Track number of segments in mt76u_buf structure and do not submit urbs with urb->num_sgs = 1 if usb host driver sg_tablesize is zero.
This suppose fix problem of mt76 not working with some usb host controllers like dwc2.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/usb.c | 57 +++++++++++++++++++------------ 2 files changed, 37 insertions(+), 21 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +1 -0
@@ -86,6 +86,7 @@ struct mt76_queue_buf {struct mt76u_buf {struct mt76_dev *dev;struct urb *urb; +int num_sgs;size_t len;bool done; };
drivers/net/wireless/mediatek/mt76/usb.c +36 -21
125 lines not on this page · raw message