From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 889C2C432C3 for ; Thu, 21 Nov 2019 18:00:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6198C2068F for ; Thu, 21 Nov 2019 18:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726922AbfKUSA0 (ORCPT ); Thu, 21 Nov 2019 13:00:26 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:53962 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726623AbfKUSAZ (ORCPT ); Thu, 21 Nov 2019 13:00:25 -0500 Received: from localhost.localdomain (unknown [141.24.207.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id 0AA22580076; Thu, 21 Nov 2019 19:00:24 +0100 (CET) From: Markus Theil To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, Stanislaw Gruszka , Markus Theil Subject: [PATCH v8 4/6] mt76: mt76x02: remove a copy call for usb speedup Date: Thu, 21 Nov 2019 18:59:59 +0100 Message-Id: <20191121180001.22451-5-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191121180001.22451-1-markus.theil@tu-ilmenau.de> References: <20191121180001.22451-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- .../wireless/mediatek/mt76/mt76x02_beacon.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c index b01a6745ed47..043cb03c86a2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c @@ -27,15 +27,26 @@ 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); + 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); + 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