Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4607134yba; Tue, 30 Apr 2019 01:00:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJFc56VvbGLqNsTVUAYhOWWxQwD4mOf1dnxp+gtnFbOfdCuqbhkl8tqDK1VICOC21+LWQD X-Received: by 2002:a62:f24e:: with SMTP id y14mr68811556pfl.209.1556611223489; Tue, 30 Apr 2019 01:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556611223; cv=none; d=google.com; s=arc-20160816; b=dlgxc1EZcdgsUikuuT03Em/BzTowNeeKSw5MggzixFe6YTYZjx/xiONGa/Id3bpAjQ glrpxYDkEsNMTXXVyP1o04Nr84dRekAolG8VQWkCltZplfqmUMqIROoe+Eyba/FKU1MG zvO955c/o4zC6EXjxw2e9LjOLHNxk5p/Rr9K9vWuL83vTmYNEg/Fgc+xLIZg98NjGhF9 1MuMxs0YgRnckbv1z8YOSXsChFQoruSqZO39Ig5B8e3UsnEnMNUXCqMrc7zWlM7QEbfW 5+TaZYofiB5COGGUcmzzxHnRTmti7Furk0RKDNNZXeY8PW9I1S9B8IKtQ1G7CqOKtqUx nqIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=ofQmiUNtMGLmtx6OXbH+MMPPCHdJjZh0l6IfxdBThgY=; b=yPGjkb4PzdLpxdRBtI2PKD5UmOJPBKp1K3D5oLXiri8EdSGc+qsjuqXRYMfv4HWjb9 XzGbWN40nzhxnB/HMYT5jYccy/lb6t2Vx++8LN5Xk8hKr2nw3RSbBu09Cc0TYNRnSqM/ NXSEAe2WRldaQi5wRNdifGV5IYVAAsOh53F9RlmuKpNZCSRiYoZmDEj5A0sAkLTUgKJ7 aJqknz6QqMglAZQipWjfEFFxd2nubTluFSk2Ur0FVzKYGe3ERqD4K0tbSKB9hTeJmfnB EOR/ExoovOQx5wfZA0gP0OIOF5NgFldMUp34bybqAb6z6cDHVnVle8RHyqUrECe7qmyh J6hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=YEyt7LoT; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si33499024pgq.23.2019.04.30.01.00.01; Tue, 30 Apr 2019 01:00:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=YEyt7LoT; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726345AbfD3H7f (ORCPT + 99 others); Tue, 30 Apr 2019 03:59:35 -0400 Received: from nbd.name ([46.4.11.11]:35354 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbfD3H7e (ORCPT ); Tue, 30 Apr 2019 03:59:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ofQmiUNtMGLmtx6OXbH+MMPPCHdJjZh0l6IfxdBThgY=; b=YEyt7LoTg0n7XNxRb3+EOvH7wW CawI16kkGOgmwYvldT7Ib1JzPd9CusFdadOvsoUe3W8E5wYxMhJJp6QI/XtaP2z/qLVBQNPmYCah3 /IIeJyPnACmXkYyXIkbjZWJr82rT1FpOFB84Cq/Qo1MsHA4LTKvpIg19sbXIm7W1CPHk=; Received: from p4ff135f1.dip0.t-ipconnect.de ([79.241.53.241] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hLNfp-0001xl-Cv; Tue, 30 Apr 2019 09:59:33 +0200 Subject: Re: [PATCH] mt76: usb: use EP max packet aligned buffer sizes for rx To: Stanislaw Gruszka , linux-wireless@vger.kernel.org Cc: Lorenzo Bianconi References: <20190430074219.8495-1-sgruszka@redhat.com> From: Felix Fietkau Openpgp: preference=signencrypt Autocrypt: addr=nbd@nbd.name; prefer-encrypt=mutual; keydata= mQGiBEah5CcRBADIY7pu4LIv3jBlyQ/2u87iIZGe6f0f8pyB4UjzfJNXhJb8JylYYRzIOSxh ExKsdLCnJqsG1PY1mqTtoG8sONpwsHr2oJ4itjcGHfn5NJSUGTbtbbxLro13tHkGFCoCr4Z5 Pv+XRgiANSpYlIigiMbOkide6wbggQK32tC20QxUIwCg4k6dtV/4kwEeiOUfErq00TVqIiEE AKcUi4taOuh/PQWx/Ujjl/P1LfJXqLKRPa8PwD4j2yjoc9l+7LptSxJThL9KSu6gtXQjcoR2 vCK0OeYJhgO4kYMI78h1TSaxmtImEAnjFPYJYVsxrhay92jisYc7z5R/76AaELfF6RCjjGeP wdalulG+erWju710Bif7E1yjYVWeA/9Wd1lsOmx6uwwYgNqoFtcAunDaMKi9xVQW18FsUusM TdRvTZLBpoUAy+MajAL+R73TwLq3LnKpIcCwftyQXK5pEDKq57OhxJVv1Q8XkA9Dn1SBOjNB l25vJDFAT9ntp9THeDD2fv15yk4EKpWhu4H00/YX8KkhFsrtUs69+vZQwbQcRmVsaXggRmll dGthdSA8bmJkQG5iZC5uYW1lPohgBBMRAgAgBQJGoeQnAhsjBgsJCAcDAgQVAggDBBYCAwEC HgECF4AACgkQ130UHQKnbvXsvgCgjsAIIOsY7xZ8VcSm7NABpi91yTMAniMMmH7FRenEAYMa VrwYTIThkTlQuQINBEah5FQQCACMIep/hTzgPZ9HbCTKm9xN4bZX0JjrqjFem1Nxf3MBM5vN CYGBn8F4sGIzPmLhl4xFeq3k5irVg/YvxSDbQN6NJv8o+tP6zsMeWX2JjtV0P4aDIN1pK2/w VxcicArw0VYdv2ZCarccFBgH2a6GjswqlCqVM3gNIMI8ikzenKcso8YErGGiKYeMEZLwHaxE Y7mTPuOTrWL8uWWRL5mVjhZEVvDez6em/OYvzBwbkhImrryF29e3Po2cfY2n7EKjjr3/141K DHBBdgXlPNfDwROnA5ugjjEBjwkwBQqPpDA7AYPvpHh5vLbZnVGu5CwG7NAsrb2isRmjYoqk wu++3117AAMFB/9S0Sj7qFFQcD4laADVsabTpNNpaV4wAgVTRHKV/kC9luItzwDnUcsZUPdQ f3MueRJ3jIHU0UmRBG3uQftqbZJj3ikhnfvyLmkCNe+/hXhPu9sGvXyi2D4vszICvc1KL4RD aLSrOsROx22eZ26KqcW4ny7+va2FnvjsZgI8h4sDmaLzKczVRIiLITiMpLFEU/VoSv0m1F4B FtRgoiyjFzigWG0MsTdAN6FJzGh4mWWGIlE7o5JraNhnTd+yTUIPtw3ym6l8P+gbvfoZida0 TspgwBWLnXQvP5EDvlZnNaKa/3oBes6z0QdaSOwZCRA3QSLHBwtgUsrT6RxRSweLrcabiEkE GBECAAkFAkah5FQCGwwACgkQ130UHQKnbvW2GgCfTKx80VvCR/PvsUlrvdOLsIgeRGAAn1ee RjMaxwtSdaCKMw3j33ZbsWS4 Message-ID: <634fa790-0cb4-ae68-894a-d778eacf78d2@nbd.name> Date: Tue, 30 Apr 2019 09:59:32 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190430074219.8495-1-sgruszka@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2019-04-30 09:42, Stanislaw Gruszka wrote: > If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple, > usb host driver has to use bounce buffer and copy data. For RX we can > avoid that since we alreay allocate q->buf_size (2kB) buffers and > mt76usb hardware will not fill more data as rx packet size is limited > by network protocol. However add error message if this assumption > somehow will be not true. > > Signed-off-by: Stanislaw Gruszka > --- > drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c > index c299c6591072..025e072cff28 100644 > --- a/drivers/net/wireless/mediatek/mt76/usb.c > +++ b/drivers/net/wireless/mediatek/mt76/usb.c > @@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb) > return 0; > > data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN); > - if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) > + if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) { > + dev_err(dev->dev, "rx data too big %d\n", data_len); Please use WARN_ON_ONCE here, or at least dev_err_ratelimited if you think it's necessary to print data_len. - Felix