> On Wed, Feb 20, 2019 at 02:22:08PM +0100, Lorenzo Bianconi wrote: > > > On Tue, Feb 19, 2019 at 01:19:26PM +0100, Felix Fietkau wrote: > > > > >> >> The way I see it, we have two choices. > > > > >> >> 1. Fix dwc2 to do its alignment quirk for the urb->sg != NULL case > > > > >> >> 2. Rely on urb->transfer_buffer and keep urb->sg NULL > > > > >> > > > > > >> > I agree, if this is only needed for dwc2. Though I would investigate > > > > >> > if this is not a bug on other platforms as well. > > > > >> >From what I can see, using Lorenzo's patches seems to be the better > > > > >> solution, since they avoid these corner cases in dwc2 (and maybe other > > > > >> drivers as well). I will apply them and then we'll see if we need to do > > > > >> any further improvements later on. > > > > > > > > > > They work on rpi dwc2, but they do not address root of the problem. > > > > > There is clearly something wrong how mt76usb handle SG, what is not > > > > > fixed. And adding disable_usb_sg module parameter for hcd's supporting > > > > > SG should be red flag. > > > > I think we're simply dealing with multiple issues here, only some of > > > > which are fixed by Lorenzo's patches. > > > > I'm pretty sure it's still wrong for mt76 to try to align its buffers, > > > > since the Linux USB API supports non-aligned transfer buffers and it > > > > should be up to the controller driver to deal with that. > > > > > > Agree. > > > > > > > dwc2 tries to do that, but that has limitations which I already pointed > > > > out and which are properly dealt with by Lorenzo's patches. > > > > > > I planed to just accept current solution, but I started to work on patch > > > that remove len, sglen arguments from mt76u_buf_alloc() and use > > > q->buf_size and SKB_WITH_OVERHEAD(q->buf_size) directly and realized how > > > related code is now tangled. > > > > > > Would be ok to send this patch with proper changelog as fix for RPI > > > against wireless-drivers and cc:stable (assuming it works and really > > > fix things on RPI) and revert Lorenzo's patches in -next ? > > > > Hi Stanislaw, > > > > what is the advantage of doing so? > To have small fix proper for -stable to fix the problem in 4.20 and 4.19, > and have simpler code. merging the series I sent we will have a pretty simple approach, just a single routine that allocates the rx buffers in the control path according to the operating mode. > > > You have duplicated most of the fields that are > > already in the urb data structure and you use transfer_buffer (no SG I/O). > URB has plenty of fields, I duplicated 2. If size of mt76u_buf is a concern > this can be optimized by packing num_sgs, len, done into fields variable. > > > Moreover I have ready a series that removes 99% of the dual allocation code and > > maintain it in the control path (instead of the datapath one). > > I need just to rebase it ontop of your series. I will post it soon. > So I would ask what is the point to adding bunch of code and remove it in very > next patch? In the first series I fixed the issue, in this one I improved the code, I have no added any new feature Regards, Lorenzo > > Stanislaw