Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp825385ybi; Fri, 14 Jun 2019 04:05:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbnsOHzQKyc+LPK4rb5WiVDKgW/VdPop6QfhXpNA1ufcFpvOf9Vq3HefXZd5Tp19ZgJ11M X-Received: by 2002:a63:84c1:: with SMTP id k184mr32875663pgd.7.1560510335226; Fri, 14 Jun 2019 04:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560510335; cv=none; d=google.com; s=arc-20160816; b=HweggOlBrVgwYBhDpDwQJEmHb4BcDksN14hOhhq+3yieDdQUW3pG0AUgtq4EehsuVW k+HTJaC8FHW73UU/yqqMeMUdHGiF2jj0YBbZwINSoKJ3YL1VWlCgXrSnNHLNla1bxx15 cpgjsh9hpPPF2PIAX/cfp4tZNBCoiwFVoBsSLfnBvKWLwf+uehWLU7Swvr95jXTC6uzR Qe+GqcbLTnHFASQAaF8GZzGb8Z6VUKYSpRXrE4b90Jkwm+eIl/2ZyVMStAJZAbtrZ3N5 M4PGEqBTSSjGNHi72WwLh7efAZyUvqsO7TOiZf8EnzbsSWf7DtGufCSqQLfzl6M4w0Y2 35jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=+i0gAePx7vXU1tO/ugVY5PNWOq6vAKk4BqrVAgGFuIE=; b=PLEvc+bgcN/9x5YIIdVisEZUIOUwhiJgeDDr/2NcinRPycKYFzDXl4J7ZZiI18WYYA 9biHZSuPS8x3g/CvO8wlWMw+nYXLcipxVbtzPD5DMlhAVhDUWQCsVHpuAS71GmQJ5YYn jauRQbTVmtOjm9oNbfQfGav+S0KHF1g3N6+ssgLGO0xYipD7dfkk08vQrFVo0kXnwI4t X9VU6s0m7W+Tl4maNV0UkXD/Q5iWZdG0zbzB3rY6HxFnt+gfjcYeSxLij0h8gWbGOJFA 9Krf4aDQWc1veb+I/nFyZYY2E1jQewVum9sUK47tzXwWGbCXd8bM7wsIhsYefTe062+l 8y1g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si1985397plo.170.2019.06.14.04.05.18; Fri, 14 Jun 2019 04:05:35 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbfFNLEt (ORCPT + 99 others); Fri, 14 Jun 2019 07:04:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31807 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbfFNLEs (ORCPT ); Fri, 14 Jun 2019 07:04:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F289309264F; Fri, 14 Jun 2019 11:04:48 +0000 (UTC) Received: from localhost (ovpn-204-80.brq.redhat.com [10.40.204.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EB0317CFE; Fri, 14 Jun 2019 11:04:43 +0000 (UTC) Date: Fri, 14 Jun 2019 13:04:43 +0200 From: Stanislaw Gruszka To: Lorenzo Bianconi Cc: Lorenzo Bianconi , kvalo@codeaurora.org, linux-wireless@vger.kernel.org, nbd@nbd.name Subject: Re: [PATCH v3 wireless-drivers 3/3] mt76: usb: do not always copy the first part of received frames Message-ID: <20190614110442.GA17298@redhat.com> References: <1a9566c0a41ad0d940487a9d3f0008993c075ef2.1560461404.git.lorenzo@kernel.org> <20190614075303.GB3395@redhat.com> <20190614102247.GB2669@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190614102247.GB2669@localhost.localdomain> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 14 Jun 2019 11:04:48 +0000 (UTC) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, Jun 14, 2019 at 12:22:48PM +0200, Lorenzo Bianconi wrote: > > On Thu, Jun 13, 2019 at 11:43:13PM +0200, Lorenzo Bianconi wrote: > > > Set usb buffer size taking into account skb_shared_info in order to > > > not always copy the first part of received frames if A-MSDU is enabled > > > for SG capable devices. Moreover align usb buffer size to max_ep > > > boundaries and set buf_size to PAGE_SIZE even for sg case > > > > I think this should not be applied to wirless-drivers, only first patch > > that fix the bug and optimizations should be done in -next. > > ack, right. I think patch 2/3 and 3/3 can go directly in Felix's tree > > > > > > + int i, data_size; > > > > > > + data_size = rounddown(SKB_WITH_OVERHEAD(q->buf_size), > > > + dev->usb.in_ep[MT_EP_IN_PKT_RX].max_packet); > > > for (i = 0; i < nsgs; i++) { > > > struct page *page; > > > void *data; > > > @@ -302,7 +304,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb, > > > > > > page = virt_to_head_page(data); > > > offset = data - page_address(page); > > > - sg_set_page(&urb->sg[i], page, q->buf_size, offset); > > > + sg_set_page(&urb->sg[i], page, data_size, offset); > > > > > - q->buf_size = dev->usb.sg_en ? MT_RX_BUF_SIZE : PAGE_SIZE; > > > q->ndesc = MT_NUM_RX_ENTRIES; > > > + q->buf_size = PAGE_SIZE; > > > + > > > > This should be associated with decrease of MT_SG_MAX_SIZE to value that > > is actually needed and currently this is 2 for 4k AMSDU. > > MT_SG_MAX_SIZE is used even on tx side and I do not think we will end up with a > huge difference here So use different value as argument for mt76u_fill_rx_sg() in mt76u_rx_urb_alloc(). After changing buf_size to PAGE_SIZE we will allocate 8 pages per rx queue entry, but only 2 pages will be used (with data_size change, 1 without data_size change). Or I'm wrong? > > However I don't think allocating 2 pages to avoid ieee80211 header and SNAP > > copy is worth to do. For me best approach would be allocate 1 page for > > 4k AMSDU, 2 for 8k and 3 for 12k (still using sg, but without data_size > > change to avoid 32B copying). > > From my point of view it is better to avoid copying if it is possible. Are you > sure there is no difference? I do not understand what you mean by difference here. Stanislaw