linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Markus Theil <markus.theil@tu-ilmenau.de>
Cc: nbd@nbd.name, linux-wireless@vger.kernel.org,
	lorenzo.bianconi@redhat.com,
	Stanislaw Gruszka <sgruszka@redhat.com>
Subject: Re: [PATCH v9 4/6] mt76: mt76x02: remove a copy call for usb speedup
Date: Tue, 17 Dec 2019 10:40:19 +0100	[thread overview]
Message-ID: <20191217094019.GA2567@localhost.localdomain> (raw)
In-Reply-To: <20191126214704.27297-5-markus.theil@tu-ilmenau.de>

[-- Attachment #1: Type: text/plain, Size: 2246 bytes --]

> This patch removes a mt76_wr_copy call from the beacon path to hw.
> The skb which is used in this place gets therefore build with txwi
> inside its data. For mt76 usb drivers, this saves one synchronuous
> copy call over usb, which lets the beacon work complete faster.
> 
> In mmio case, there is not enough headroom to put the txwi into the
> skb, it is therefore using an additional mt76_wr_copy, which is fast
> over mmio. Thanks Stanislaw for pointing this out.
> 
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---
>  .../wireless/mediatek/mt76/mt76x02_beacon.c   | 20 +++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> index 1c4bdf88f712..68a4f512319e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c
> @@ -26,15 +26,27 @@ static int
>  mt76x02_write_beacon(struct mt76x02_dev *dev, int offset, struct sk_buff *skb)
>  {
>  	int beacon_len = dev->beacon_ops->slot_size;
> -	struct mt76x02_txwi txwi;
>  
>  	if (WARN_ON_ONCE(beacon_len < skb->len + sizeof(struct mt76x02_txwi)))
>  		return -ENOSPC;
>  
> -	mt76x02_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len);
> +	/* USB devices already reserve enough skb headroom for txwi's. This
> +	 * helps to save slow copies over USB.
> +	 */
> +	if (mt76_is_usb(&dev->mt76)) {
> +		struct mt76x02_txwi *txwi;
> +
> +		mt76_insert_hdr_pad(skb);

Do we really need mt76_insert_hdr_pad? I think beacon header should be 4B
aligned.

Regards,
Lorenzo

> +		txwi = (struct mt76x02_txwi *)(skb->data - sizeof(*txwi));
> +		mt76x02_mac_write_txwi(dev, txwi, skb, NULL, NULL, skb->len);
> +		skb_push(skb, sizeof(*txwi));
> +	} else {
> +		struct mt76x02_txwi txwi;
>  
> -	mt76_wr_copy(dev, offset, &txwi, sizeof(txwi));
> -	offset += sizeof(txwi);
> +		mt76x02_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len);
> +		mt76_wr_copy(dev, offset, &txwi, sizeof(txwi));
> +		offset += sizeof(txwi);
> +	}
>  
>  	mt76_wr_copy(dev, offset, skb->data, skb->len);
>  	return 0;
> -- 
> 2.24.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2019-12-17  9:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 21:46 [PATCH v9 0/6] mt76: channel switch support for USB devices Markus Theil
2019-11-26 21:46 ` [PATCH v9 1/6] mt76: mt76x02: ommit beacon slot clearing Markus Theil
2019-11-26 21:47 ` [PATCH v9 2/6] mt76: mt76x02: split beaconing Markus Theil
2019-12-17  9:50   ` Lorenzo Bianconi
2019-12-18  9:37   ` Lorenzo Bianconi
2019-12-18 12:12     ` Markus Theil
2019-11-26 21:47 ` [PATCH v9 3/6] mt76: mt76x02: add check for invalid vif idx Markus Theil
2019-11-26 21:47 ` [PATCH v9 4/6] mt76: mt76x02: remove a copy call for usb speedup Markus Theil
2019-12-17  9:40   ` Lorenzo Bianconi [this message]
2019-12-18 12:11     ` Markus Theil
2019-12-18 13:17       ` Lorenzo Bianconi
2019-12-18 14:57         ` Markus Theil
2019-11-26 21:47 ` [PATCH v9 5/6] mt76: speed up usb bulk copy Markus Theil
2019-11-26 21:47 ` [PATCH v9 6/6] mt76: mt76x02: add channel switch support for usb interfaces Markus Theil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191217094019.GA2567@localhost.localdomain \
    --to=lorenzo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=markus.theil@tu-ilmenau.de \
    --cc=nbd@nbd.name \
    --cc=sgruszka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).