From patchwork Wed Nov 20 22:28:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11254989 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1175E14ED for ; Wed, 20 Nov 2019 22:28:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5CE920718 for ; Wed, 20 Nov 2019 22:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726855AbfKTW2m (ORCPT ); Wed, 20 Nov 2019 17:28:42 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:49962 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbfKTW2l (ORCPT ); Wed, 20 Nov 2019 17:28:41 -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 B19FF58007E; Wed, 20 Nov 2019 23:28:39 +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 v7 1/5] mt76: mt76x02: ommit beacon slot clearing Date: Wed, 20 Nov 2019 23:28:22 +0100 Message-Id: <20191120222826.14871-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> References: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org mt76 hw does not send beacons from beacon slots, if the corresponding bitmask is set accordingly. Therefore we can ommit clearing the beacon memory. Clearing uses many usb calls, if usb drivers are used. These calls unnecessarily slow down the beacon tasklet. Thanks to Stanislaw Gruzska for pointing this out. Signed-off-by: Markus Theil --- drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c index 4209209ac940..403866496640 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c @@ -58,8 +58,6 @@ __mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 bcn_idx, dev->beacon_data_mask |= BIT(bcn_idx); } else { dev->beacon_data_mask &= ~BIT(bcn_idx); - for (i = 0; i < beacon_len; i += 4) - mt76_wr(dev, beacon_addr + i, 0); } mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xff00 | ~dev->beacon_data_mask); @@ -241,17 +239,11 @@ EXPORT_SYMBOL_GPL(mt76x02_enqueue_buffered_bc); void mt76x02_init_beacon_config(struct mt76x02_dev *dev) { - int i; - mt76_clear(dev, MT_BEACON_TIME_CFG, (MT_BEACON_TIME_CFG_TIMER_EN | MT_BEACON_TIME_CFG_TBTT_EN | MT_BEACON_TIME_CFG_BEACON_TX)); mt76_set(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_SYNC_MODE); mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff); - - for (i = 0; i < 8; i++) - mt76x02_mac_set_beacon(dev, i, NULL); - mt76x02_set_beacon_offsets(dev); } EXPORT_SYMBOL_GPL(mt76x02_init_beacon_config); From patchwork Wed Nov 20 22:28:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11254985 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F56E14E5 for ; Wed, 20 Nov 2019 22:28:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40540206CB for ; Wed, 20 Nov 2019 22:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbfKTW2n (ORCPT ); Wed, 20 Nov 2019 17:28:43 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:49966 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726813AbfKTW2m (ORCPT ); Wed, 20 Nov 2019 17:28:42 -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 C116E58007F; Wed, 20 Nov 2019 23:28:39 +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 v7 2/5] mt76: mt76x02: split beaconing Date: Wed, 20 Nov 2019 23:28:23 +0100 Message-Id: <20191120222826.14871-3-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> References: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Sending beacons to the hardware always happens in batches. In order to speed up beacon processing on usb devices, this patch splits out common code an calls it only once (mt76x02_mac_set_beacon_prepare, mt76x02_mac_set_beacon_finish). Making this split breaks beacon enabling/disabling per vif. This is fixed by adding a call to set the bypass mask, if beaconing should be disabled for a vif. Otherwise the beacon is send after the next beacon interval. The code is also adapted for the mmio part of the driver, but should not have any performance implication there. Signed-off-by: Markus Theil --- .../wireless/mediatek/mt76/mt76x02_beacon.c | 63 ++++++++----------- .../net/wireless/mediatek/mt76/mt76x02_mac.h | 1 + .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 5 ++ .../wireless/mediatek/mt76/mt76x02_usb_core.c | 5 ++ 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c index 403866496640..50e68af63d4f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c @@ -31,10 +31,22 @@ mt76x02_write_beacon(struct mt76x02_dev *dev, int offset, struct sk_buff *skb) 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; @@ -47,10 +59,6 @@ __mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 bcn_idx, int beacon_len = dev->beacon_ops->slot_size; int beacon_addr = MT_BEACON_BASE + (beacon_len * bcn_idx); int ret = 0; - int i; - - /* Prevent corrupt transmissions during update */ - mt76_set(dev, MT_BCN_BYPASS_MASK, BIT(bcn_idx)); if (skb) { ret = mt76x02_write_beacon(dev, beacon_addr, skb); @@ -60,41 +68,23 @@ __mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 bcn_idx, dev->beacon_data_mask &= ~BIT(bcn_idx); } - mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xff00 | ~dev->beacon_data_mask); - return ret; } +void mt76x02_mac_set_beacon_finish(struct mt76x02_dev *dev) +{ + mt76_rmw_field(dev, MT_MAC_BSSID_DW1, MT_MAC_BSSID_DW1_MBEACON_N, + hweight8(dev->beacon_data_mask) - 1); + mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xff00 | ~dev->beacon_data_mask); +} +EXPORT_SYMBOL_GPL(mt76x02_mac_set_beacon_finish); + int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, struct sk_buff *skb) { - bool force_update = false; - int bcn_idx = 0; - int i; - - for (i = 0; i < ARRAY_SIZE(dev->beacons); i++) { - if (vif_idx == i) { - force_update = !!dev->beacons[i] ^ !!skb; - dev_kfree_skb(dev->beacons[i]); - dev->beacons[i] = skb; - __mt76x02_mac_set_beacon(dev, bcn_idx, skb); - } else if (force_update && dev->beacons[i]) { - __mt76x02_mac_set_beacon(dev, bcn_idx, - dev->beacons[i]); - } - - bcn_idx += !!dev->beacons[i]; - } - - for (i = bcn_idx; i < ARRAY_SIZE(dev->beacons); i++) { - if (!(dev->beacon_data_mask & BIT(i))) - break; - - __mt76x02_mac_set_beacon(dev, i, NULL); - } - - mt76_rmw_field(dev, MT_MAC_BSSID_DW1, MT_MAC_BSSID_DW1_MBEACON_N, - bcn_idx - 1); + dev_kfree_skb(dev->beacons[vif_idx]); + dev->beacons[vif_idx] = skb; + __mt76x02_mac_set_beacon(dev, vif_idx, skb); return 0; } EXPORT_SYMBOL_GPL(mt76x02_mac_set_beacon); @@ -115,6 +105,7 @@ void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, } else { dev->mt76.beacon_mask &= ~BIT(mvif->idx); mt76x02_mac_set_beacon(dev, mvif->idx, NULL); + mt76_set(dev, MT_BCN_BYPASS_MASK, BIT(mvif->idx)); } if (!!old_mask == !!dev->mt76.beacon_mask) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h index 7d946aa77182..26853f7acba9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h @@ -205,6 +205,7 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, struct sk_buff *skb); void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, struct ieee80211_vif *vif, bool enable); +void mt76x02_mac_set_beacon_finish(struct mt76x02_dev *dev); void mt76x02_edcca_init(struct mt76x02_dev *dev); #endif diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c index 4e2371c926d8..644bc8c284cc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c @@ -24,10 +24,15 @@ static void mt76x02_pre_tbtt_tasklet(unsigned long arg) mt76x02_resync_beacon_timer(dev); + /* Prevent corrupt transmissions during update */ + mt76_set(dev, MT_BCN_BYPASS_MASK, 0xffff); + ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev), IEEE80211_IFACE_ITER_RESUME_ALL, mt76x02_update_beacon_iter, dev); + mt76x02_mac_set_beacon_finish(dev); + mt76_csa_check(&dev->mt76); if (dev->mt76.csa_complete) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c index d03d3c8e296c..0b3437a30b02 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c @@ -208,6 +208,9 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work) mt76x02_resync_beacon_timer(dev); + /* Prevent corrupt transmissions during update */ + mt76_set(dev, MT_BCN_BYPASS_MASK, 0xffff); + ieee80211_iterate_active_interfaces(mt76_hw(dev), IEEE80211_IFACE_ITER_RESUME_ALL, mt76x02_update_beacon_iter, dev); @@ -220,6 +223,8 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work) mt76x02_mac_set_beacon(dev, i, skb); } + mt76x02_mac_set_beacon_finish(dev); + mt76x02u_restart_pre_tbtt_timer(dev); } From patchwork Wed Nov 20 22:28:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11254991 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C0E014DB for ; Wed, 20 Nov 2019 22:28:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E68C20718 for ; Wed, 20 Nov 2019 22:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726846AbfKTW2m (ORCPT ); Wed, 20 Nov 2019 17:28:42 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:49970 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfKTW2l (ORCPT ); Wed, 20 Nov 2019 17:28:41 -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 D183A580080; Wed, 20 Nov 2019 23:28:39 +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 v7 3/5] mt76: mt76x02: remove a copy call for usb speedup Date: Wed, 20 Nov 2019 23:28:24 +0100 Message-Id: <20191120222826.14871-4-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> References: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 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 --- drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c index 50e68af63d4f..060f0fc7a563 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_beacon.c @@ -26,7 +26,6 @@ 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; @@ -44,6 +43,7 @@ mt76x02_write_beacon(struct mt76x02_dev *dev, int offset, struct sk_buff *skb) } else { struct mt76x02_txwi txwi; + mt76x02_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len); mt76_wr_copy(dev, offset, &txwi, sizeof(txwi)); offset += sizeof(txwi); } From patchwork Wed Nov 20 22:28:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11254983 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC42814DB for ; Wed, 20 Nov 2019 22:28:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CD1820872 for ; Wed, 20 Nov 2019 22:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbfKTW2n (ORCPT ); Wed, 20 Nov 2019 17:28:43 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:49974 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726825AbfKTW2m (ORCPT ); Wed, 20 Nov 2019 17:28:42 -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 E0803580081; Wed, 20 Nov 2019 23:28:39 +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 v7 4/5] mt76: speed up usb bulk copy Date: Wed, 20 Nov 2019 23:28:25 +0100 Message-Id: <20191120222826.14871-5-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> References: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Use larger batches for usb copy to speed this operation up. Otherwise it would be too slow for copying new beacons or broadcast frames over usb. Assure, that always a multiple of 4 Bytes is copied, as outlined in 850e8f6fbd "mt76: round up length on mt76_wr_copy" from Felix Fietkau. Signed-off-by: Markus Theil --- drivers/net/wireless/mediatek/mt76/mt76.h | 2 +- drivers/net/wireless/mediatek/mt76/usb.c | 24 +++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index fb077760347a..1981912de1f9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -382,7 +382,7 @@ enum mt76u_out_ep { struct mt76_usb { struct mutex usb_ctrl_mtx; union { - u8 data[32]; + u8 data[128]; __le32 reg_val; }; diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index d6d47081e281..97b263ce3872 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -149,18 +149,30 @@ static void mt76u_copy(struct mt76_dev *dev, u32 offset, const void *data, int len) { struct mt76_usb *usb = &dev->usb; - const u32 *val = data; - int i, ret; + const u8 *val = data; + int ret; + int current_batch_size; + int i = 0; + + /* Assure that always a multiple of 4 bytes are copied, + * otherwise beacons can be corrupted. + * See: "mt76: round up length on mt76_wr_copy" + * Commit 850e8f6fbd5d0003b0 + */ + len = round_up(len, 4); mutex_lock(&usb->usb_ctrl_mtx); - for (i = 0; i < DIV_ROUND_UP(len, 4); i++) { - put_unaligned(val[i], (u32 *)usb->data); + while (i < len) { + current_batch_size = min_t(int, sizeof(usb->data), len - i); + memcpy(usb->data, val + i, current_batch_size); ret = __mt76u_vendor_request(dev, MT_VEND_MULTI_WRITE, USB_DIR_OUT | USB_TYPE_VENDOR, - 0, offset + i * 4, usb->data, - sizeof(u32)); + 0, offset + i, usb->data, + current_batch_size); if (ret < 0) break; + + i += current_batch_size; } mutex_unlock(&usb->usb_ctrl_mtx); } From patchwork Wed Nov 20 22:28:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11254987 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9645F14E5 for ; Wed, 20 Nov 2019 22:28:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74C2220718 for ; Wed, 20 Nov 2019 22:28:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbfKTW2o (ORCPT ); Wed, 20 Nov 2019 17:28:44 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:49977 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726836AbfKTW2m (ORCPT ); Wed, 20 Nov 2019 17:28:42 -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 EF312580082; Wed, 20 Nov 2019 23:28:39 +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 v7 5/5] mt76: mt76x02: add channel switch support for usb interfaces Date: Wed, 20 Nov 2019 23:28:26 +0100 Message-Id: <20191120222826.14871-6-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> References: <20191120222826.14871-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch enables channel switch support on mt76 usb interfaces. Signed-off-by: Markus Theil --- drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c index 0b3437a30b02..600938a4b0c9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c @@ -211,6 +211,12 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work) /* Prevent corrupt transmissions during update */ mt76_set(dev, MT_BCN_BYPASS_MASK, 0xffff); + mt76_csa_check(&dev->mt76); + if (dev->mt76.csa_complete) { + mt76_csa_finish(&dev->mt76); + goto out; + } + ieee80211_iterate_active_interfaces(mt76_hw(dev), IEEE80211_IFACE_ITER_RESUME_ALL, mt76x02_update_beacon_iter, dev); @@ -225,6 +231,7 @@ static void mt76x02u_pre_tbtt_work(struct work_struct *work) mt76x02_mac_set_beacon_finish(dev); +out: mt76x02u_restart_pre_tbtt_timer(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c index 0960fc56b672..df381443cb52 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c @@ -166,7 +166,6 @@ void mt76x02_init_device(struct mt76x02_dev *dev) wiphy->reg_notifier = mt76x02_regd_notifier; wiphy->iface_combinations = mt76x02_if_comb; wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb); - wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; /* init led callbacks */ if (IS_ENABLED(CONFIG_MT76_LEDS)) { @@ -176,6 +175,7 @@ void mt76x02_init_device(struct mt76x02_dev *dev) } } + wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); hw->sta_data_size = sizeof(struct mt76x02_sta);