From patchwork Mon Nov 18 08:23:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249063 X-Patchwork-Delegate: kvalo@adurom.com 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 934C71599 for ; Mon, 18 Nov 2019 08:26:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B11C2075C for ; Mon, 18 Nov 2019 08:26:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="K0XlKaOq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726464AbfKRI0x (ORCPT ); Mon, 18 Nov 2019 03:26:53 -0500 Received: from mx0b-00183b01.pphosted.com ([67.231.157.42]:59130 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726371AbfKRI0w (ORCPT ); Mon, 18 Nov 2019 03:26:52 -0500 Received: from pps.filterd (m0048104.ppops.net [127.0.0.1]) by mx0b-00183b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAI8Mo7Y014367 for ; Mon, 18 Nov 2019 01:26:51 -0700 Received: from nam05-dm3-obe.outbound.protection.outlook.com (mail-dm3nam05lp2053.outbound.protection.outlook.com [104.47.49.53]) by mx0b-00183b01.pphosted.com with ESMTP id 2wad7bc1r7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:26:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mFJu/bcHouWlKu0a30wbwrIif9lGKiME0yTcdyJV7lh5bCWMilAtni7oAbqlBYAWX7iggMb44dAf2GolIZIeEpgaCbxBwOh/7m4/COhd0+8JH9QAymxG9Sl+OrQiiGSq0uCR0DaNPNqb8Z6ERXPNV2MK+3GvMFc1HYAraP16dlpX9tKWZT6u9ofnNF0Pfa9P/yrVBYk1bQE3kN6Q+WxZ4ejf7TNRtP6NiBFubulvph4ih4LBoiiWbLPTa3ZAkL1DyWR6dQIBAQkdWiCuOZYPRvXyMxmeJqUyTZ30sfuluPSTM6dCk+ucBRkHqY8/8bW3dt1eqkJn0/iuVTz9k9FFzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NjlOWrVV3nAfIqrveudgWRQEJaz3xB+ca0UcR504I0w=; b=C95emdOORagFQog1amrFisFkps3nuD5vYS717QPqrxn1CUZPS898hQ1bCSLHVqaYo0MVWQ4duYqaYZYJ+/vtgcoeKOhdNilrgNRHaVA2xX4ZwVQP3tT7Oj6tMaAyRluFQhYOCNwKunQWCcQtaz5KiZS36iXi5cIhC7Dj/2pANAYbAWWEqeZKwwaLDZOeVVCCcMXkNfpum939PAyvif8HfL/xG4MH6Sak9LWRma1f0mefDoQzn82QW3NpiT504ecBxeUegAm2Fqrb74sgoGi5YPJwz0voh1RsUx01UE1/wxvOFWGbitEGY+ovXc/J/9jl9V6OoeiMlJaNc+YQwHCdDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NjlOWrVV3nAfIqrveudgWRQEJaz3xB+ca0UcR504I0w=; b=K0XlKaOq6zt6i7dGArNKoGCYHxJz/mnDjRD+N6ZLyEhw3u81W4+iGqnSTCUjfSLjtaXxS00rNhndVEtFcaBEFatPEXzgsq5+WjzVb5QwDEQymCbC+10+K6geB1C1vHBTdyhNmCfSkh2cQSgRmIIuNlaD4rZ/jB/OaKpDKhWYlg0= Received: from CY4PR05MB3654.namprd05.prod.outlook.com (10.171.247.150) by CY4PR05MB2901.namprd05.prod.outlook.com (10.169.187.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.10; Mon, 18 Nov 2019 08:26:49 +0000 Received: from CY4PR05MB3654.namprd05.prod.outlook.com ([fe80::bc1b:71ab:9da9:f5e7]) by CY4PR05MB3654.namprd05.prod.outlook.com ([fe80::bc1b:71ab:9da9:f5e7%7]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:26:49 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:04 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:04 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 1/7] qtnfmac: remove VIF in firmware in case of error Thread-Topic: [PATCH 1/7] qtnfmac: remove VIF in firmware in case of error Thread-Index: AQHVnelmcE/9nT2PWUyUjLHxu0IUeA== Date: Mon, 18 Nov 2019 08:23:04 +0000 Message-ID: <20191118082255.6032-2-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ea7c2389-fd4a-4dc7-effb-08d76c008893 x-ms-traffictypediagnostic: SN6PR05MB6320:|CY4PR05MB2901: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:26:47 AM x-ms-oob-tlc-oobclassifiers: OLM:4303; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39840400004)(136003)(396003)(346002)(366004)(199004)(189003)(54906003)(86362001)(2906002)(446003)(11346002)(102836004)(305945005)(26005)(7736002)(186003)(6506007)(386003)(3846002)(6116002)(66066001)(436003)(476003)(2616005)(71190400001)(6486002)(76176011)(52116002)(5640700003)(486006)(6916009)(71200400001)(6436002)(6512007)(256004)(5024004)(4326008)(103116003)(316002)(50226002)(64756008)(2501003)(36756003)(2351001)(66476007)(66446008)(66556008)(478600001)(66946007)(14454004)(81166006)(25786009)(107886003)(81156014)(1076003)(99286004)(8936002)(5660300002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR05MB2901;H:CY4PR05MB3654.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: H9Ycm842lfkaq5+yBq9ECa4iGRn0XyWotVR41EbZss713cP1VToKCh0+3LskV+un0yn92v1rMEeq5wDdmkc3Akft4AU4BFAXP/JVERyixJ/M4072u/B9w6q20vb2XVaCMmY0QkOwUO3oBhhuBb/leLqDEEWXKtyCPa53wWQZM2JKPNIcyOmeZjRSiCjw7rJVU+wDjRC65ZP1efCMQxARj42iKAI0mH2ksg2vkyuvGrH7NXsgORnPhqhGPs3FdoF9yNjHLXzLlullFpd9BQE1cxRQRP+ijYyZpMs3736gYchRP/gOJowpkMofuQE4sol14nL7zpIBMQO9uU9+NEDQLyaxlEIU/3k6u2ZwVSesGsZVjQ+Vhwb8ko3aXb7/2viJs/7GNkWVk7t3Md5nykE5shczdHU5NtQCpEJ0HTyq1N6Eq9Y7g27qnM8HaZs5K2+Z MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea7c2389-fd4a-4dc7-effb-08d76c008893 X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sT09YimVnJXhddSOq602oOv8Odvt3wpyivMGkZPkvhH3n3APwcXrJo84F6DuUc2S0qice9UjD99exsgYDCP0ST3PagrcjXDSPoqaejesvW4HXtgqfNQybVS1EkYTeeXyjWOjg+xgdnrP5u9cMcF2VbOZEbP2v/FNJsnxOPEO1UBR61F3r/jRj+3niy4L434nzhy4mrVqXWcjDufGmcT7J8SQXsocenTwJ/nZCZxMW4c= X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:26:49.2108 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR05MB2901 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 malwarescore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180075 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Igor Mitsyanko Currently in case of error when registering network device with the kernel, we won't properly cleanup VIF state in firmware due to DEL_VIF command will not be send to wifi card. Make sure it does. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 8 +++----- drivers/net/wireless/quantenna/qtnfmac/core.c | 19 +++++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index aa0ed0f2b973..4f02159a69db 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -238,22 +238,20 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy, pr_err("VIF%u.%u: FW reported bad MAC: %pM\n", mac->macid, vif->vifid, vif->mac_addr); ret = -EINVAL; - goto err_mac; + goto error_del_vif; } ret = qtnf_core_net_attach(mac, vif, name, name_assign_t); if (ret) { pr_err("VIF%u.%u: failed to attach netdev\n", mac->macid, vif->vifid); - goto err_net; + goto error_del_vif; } vif->wdev.netdev = vif->netdev; return &vif->wdev; -err_net: - vif->netdev = NULL; -err_mac: +error_del_vif: qtnf_cmd_send_del_intf(vif); err_cmd: vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 8116b224c946..9ccc17ad1176 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -465,10 +465,8 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif, dev = alloc_netdev_mqs(sizeof(struct qtnf_vif *), name, name_assign_type, ether_setup, 1, 1); - if (!dev) { - vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; + if (!dev) return -ENOMEM; - } vif->netdev = dev; @@ -491,7 +489,7 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif, ret = register_netdevice(dev); if (ret) { free_netdev(dev); - vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; + vif->netdev = NULL; } return ret; @@ -588,19 +586,19 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) ret = qtnf_cmd_send_get_phy_params(mac); if (ret) { pr_err("MAC%u: failed to get PHY settings\n", macid); - goto error; + goto error_del_vif; } ret = qtnf_mac_init_bands(mac); if (ret) { pr_err("MAC%u: failed to init bands\n", macid); - goto error; + goto error_del_vif; } ret = qtnf_wiphy_register(&bus->hw_info, mac); if (ret) { pr_err("MAC%u: wiphy registration failed\n", macid); - goto error; + goto error_del_vif; } mac->wiphy_registered = 1; @@ -612,15 +610,16 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) if (ret) { pr_err("MAC%u: failed to attach netdev\n", macid); - vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; - vif->netdev = NULL; - goto error; + goto error_del_vif; } pr_debug("MAC%u initialized\n", macid); return 0; +error_del_vif: + qtnf_cmd_send_del_intf(vif); + vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; error: qtnf_core_mac_detach(bus, macid); return ret; From patchwork Mon Nov 18 08:23:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249065 X-Patchwork-Delegate: kvalo@adurom.com 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 61F551599 for ; Mon, 18 Nov 2019 08:27:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2546D2073A for ; Mon, 18 Nov 2019 08:27:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="aj8tntAq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726747AbfKRI07 (ORCPT ); Mon, 18 Nov 2019 03:26:59 -0500 Received: from mx0b-00183b01.pphosted.com ([67.231.157.42]:10636 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726371AbfKRI06 (ORCPT ); Mon, 18 Nov 2019 03:26:58 -0500 Received: from pps.filterd (m0048104.ppops.net [127.0.0.1]) by mx0b-00183b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAI8NxTe015074 for ; Mon, 18 Nov 2019 01:26:56 -0700 Received: from nam05-co1-obe.outbound.protection.outlook.com (mail-co1nam05lp2052.outbound.protection.outlook.com [104.47.48.52]) by mx0b-00183b01.pphosted.com with ESMTP id 2wad7bc1rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:26:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A7uJWuqebZd80X91kWSflonD3B+T8Q1i8lRDLOKGHV9DxhSopgAzXpcDsIHVg6dNuzWWnhjXPKRfvUtUDILGBKk9FcJhKJ0Gojwpv/p4pSTuhLDL59BTUjuoctHiJmBtYd/6Dg04xAYa9JWP5cxqZEWENR5iZwRUpckia15P5wXtJKDJ4VFiV0BlsNKFRwOGRBhlqWbf4UiRBf40NoG8274CCDDs8Q/3io0wAJ4dBlb5BKVUGw0PrwpFwfN97Kjd1Qilk1+Yc1SjIQgNeISULnpOqOBNRiPJU2W+fKXYjLvlIyxUhOpQimKCHHlzTnKpp6uDNSeIdLh1rDbXaMKUFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DdvrTNHhKKMnUidpFvPhzQn9hXJVCe3h6fBbTrVZdVI=; b=YHAYT57YhQUFembzDaApdjKJKkM3tmEaGysrIM1C7ZD6VcwjZ//eEdy4hTf9t7KFhhsOkGp6liZrIvnbQDlrzlyzQNsMa+5Iugus+8ZiUPxab7QNCEEoyINs4h2fgF+0gUP0Bn7Pw6GmGcT7sN1CJfzIB/Z5Q+IFiYVS9ALWvJoXRTbPw4g42oddBLU9VfFNYnybNBMphX7F/ZXes+BRLkcpjoTC5AgPglZWzD+GugOnxojSQ4UTsNEQ9L7W4TGr6kdmomoHiSgJ5jvcV9sP2Wq4GUqXJ1VSqurJ9IHM3CrutXN1zLAGHFJdGo4Rv1LdA8ATiYLBDGXgvpd1RAmySg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DdvrTNHhKKMnUidpFvPhzQn9hXJVCe3h6fBbTrVZdVI=; b=aj8tntAqCKIvs0uGQrrf5YI8Gs7hXRfwrAI1PPELIccTqPIFw+V78coMiervBJ4yhTHehXS/8zpgk3AayImqrq4qEONsoSW4UQwNMIud2qNSyJ49GIOKGGE+Odd5xTsy7aA+Sv4dZnHuzhy2NfCXuQF+dbgD9hhobdy9Pereip8= Received: from CY4PR0501MB3763.namprd05.prod.outlook.com (52.132.102.159) by CY4PR0501MB3730.namprd05.prod.outlook.com (52.132.99.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.7; Mon, 18 Nov 2019 08:26:53 +0000 Received: from CY4PR0501MB3763.namprd05.prod.outlook.com ([fe80::8c7a:969e:4ab7:ffc5]) by CY4PR0501MB3763.namprd05.prod.outlook.com ([fe80::8c7a:969e:4ab7:ffc5%4]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:26:53 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:06 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:06 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 2/7] qtnfmac: track broadcast domain of each interface Thread-Topic: [PATCH 2/7] qtnfmac: track broadcast domain of each interface Thread-Index: AQHVnelnRWZLzXsMUkGxyb/eIIRpag== Date: Mon, 18 Nov 2019 08:23:06 +0000 Message-ID: <20191118082255.6032-3-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 683cef50-8d3d-4d13-2ae7-08d76c0089b2 x-ms-traffictypediagnostic: SN6PR05MB6320:|CY4PR0501MB3730: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:26:50 AM x-ms-oob-tlc-oobclassifiers: OLM:317; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(376002)(136003)(346002)(396003)(39840400004)(199004)(189003)(478600001)(6116002)(476003)(2616005)(50226002)(25786009)(11346002)(3846002)(436003)(71200400001)(446003)(2501003)(71190400001)(102836004)(2351001)(6506007)(386003)(6512007)(8676002)(5640700003)(6436002)(316002)(486006)(103116003)(6486002)(36756003)(76176011)(99286004)(54906003)(1076003)(66066001)(2906002)(5660300002)(107886003)(86362001)(256004)(14444005)(8936002)(4326008)(52116002)(186003)(66946007)(66476007)(81156014)(81166006)(66446008)(66556008)(64756008)(5024004)(7736002)(14454004)(6916009)(305945005)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR0501MB3730;H:CY4PR0501MB3763.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Y1z1Kv1WrKH1Igs14ea1nnnzw2A3BLP4F45nTnBfq0uIn5PAfXa4dYJwOAtaoOBpX2TpkPIRp4/OyfcVd4xEPo0+zaT6gCYDkSIQuDKPn2ZP6+zLPwJsCF5Rfv+uzm5hqOOspRzrAe91rDNxcQoHk7T5BXE8RHxJE0XfJ/impdU5+Bc1T1SdG5ZF2DY1dhyKGGtg5R/XeB2pqAZYUQPExrPEAtiaNoeNDnv45MJ/A9f/1Oy3QxMC//omvbSZo4TvorYdJrgKpwWaN4/wXwQlgXw8IYVpt5LbJbk2N9LOcRDM8M4u7M3XUb/eIL8iuzOb+wOUuiYf6TXV8pPe+NmVIrFPhTiRZ311dg2YZloicIkVYECOPuEWrZZmbJGxeCbEAQEqffG2ekXHWlJOlDzLY9pRfduW8Fpr6RELim2KMpeDbxtFQN3HYS+1Qs9ojSuI MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 683cef50-8d3d-4d13-2ae7-08d76c0089b2 X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YvX0Q4Djmh9euxTe3fF3TRZltKU++AWfn7aMBeme6GK0C71AlPA6D98TaPPJiSutsuJP0iRbOCFUjnfTy8nZSRIP6iiDndTyUpdE4v6+Dte5xs5cX8XRtWYQCmlJc5jN7xybcENgQnZ/J7AdExF4OlVgWI6q5sVAEGcRF+eYrE1HlHwlydApodiTbfOdlVKKq3EsyyHc4CXumPNelVv+2/OMI8IiB52K7PXTGjehqNQ= X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:26:53.5410 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0501MB3730 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 malwarescore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180075 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Igor Mitsyanko If firmware reports that it supports hardware switch capabilities, driver needs to track and notify device whenever broadcast domain of a particular network device changes (ie. whenever it's upper master device changes). Firmware needs a unique ID to tell broadcast domains from each other which is an opaque number otherwise. For that purpose we can use netspace:ifidx pair to uniquely identify each broadcast domain: - if netdev is not part of a bridge, then use it's own ifidx as a broadcast domain ID - if netdev is part of a bridge, then use bridge netdev ifidx as broadcast domain ID Firmware makes sure that packets are only forwarded between interfaces marked with the same broadcast domain ID. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/bus.h | 1 + drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 9 ++++ drivers/net/wireless/quantenna/qtnfmac/commands.c | 32 ++++++++++++ drivers/net/wireless/quantenna/qtnfmac/commands.h | 1 + drivers/net/wireless/quantenna/qtnfmac/core.c | 64 +++++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/core.h | 1 + drivers/net/wireless/quantenna/qtnfmac/qlink.h | 41 +++++++++++++++ 7 files changed, 149 insertions(+) diff --git a/drivers/net/wireless/quantenna/qtnfmac/bus.h b/drivers/net/wireless/quantenna/qtnfmac/bus.h index 7cea08f71838..4c6eca344a09 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/bus.h +++ b/drivers/net/wireless/quantenna/qtnfmac/bus.h @@ -54,6 +54,7 @@ struct qtnf_bus { struct work_struct event_work; struct mutex bus_lock; /* lock during command/event processing */ struct dentry *dbg_dir; + struct notifier_block netdev_nb; /* bus private data */ char bus_priv[0] __aligned(sizeof(void *)); }; diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 4f02159a69db..59d089e092f9 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -248,6 +248,15 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy, goto error_del_vif; } + if (mac->bus->hw_info.hw_capab & QLINK_HW_CAPAB_HW_BRIDGE) { + ret = qtnf_cmd_netdev_changeupper(vif, vif->netdev->ifindex); + if (ret) { + unregister_netdevice(vif->netdev); + vif->netdev = NULL; + goto error_del_vif; + } + } + vif->wdev.netdev = vif->netdev; return &vif->wdev; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 61bda34e2ac2..cbc56464220e 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -2756,3 +2756,35 @@ int qtnf_cmd_send_wowlan_set(const struct qtnf_vif *vif, qtnf_bus_unlock(bus); return ret; } + +int qtnf_cmd_netdev_changeupper(const struct qtnf_vif *vif, int br_domain) +{ + struct qtnf_bus *bus = vif->mac->bus; + struct sk_buff *cmd_skb; + struct qlink_cmd_ndev_changeupper *cmd; + int ret; + + cmd_skb = qtnf_cmd_alloc_new_cmdskb(vif->mac->macid, vif->vifid, + QLINK_CMD_NDEV_EVENT, + sizeof(*cmd)); + if (!cmd_skb) + return -ENOMEM; + + pr_debug("[VIF%u.%u] set broadcast domain to %d\n", + vif->mac->macid, vif->vifid, br_domain); + + cmd = (struct qlink_cmd_ndev_changeupper *)cmd_skb->data; + cmd->nehdr.event = cpu_to_le16(QLINK_NDEV_EVENT_CHANGEUPPER); + cmd->upper_type = QLINK_NDEV_UPPER_TYPE_BRIDGE; + cmd->br_domain = cpu_to_le32(br_domain); + + qtnf_bus_lock(bus); + ret = qtnf_cmd_send(bus, cmd_skb); + qtnf_bus_unlock(bus); + + if (ret) + pr_err("[VIF%u.%u] failed to set broadcast domain\n", + vif->mac->macid, vif->vifid); + + return ret; +} diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.h b/drivers/net/wireless/quantenna/qtnfmac/commands.h index e0de65261213..761755bf9ede 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.h +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.h @@ -75,5 +75,6 @@ int qtnf_cmd_set_tx_power(const struct qtnf_vif *vif, enum nl80211_tx_power_setting type, int mbm); int qtnf_cmd_send_wowlan_set(const struct qtnf_vif *vif, const struct cfg80211_wowlan *wowl); +int qtnf_cmd_netdev_changeupper(const struct qtnf_vif *vif, int br_domain); #endif /* QLINK_COMMANDS_H_ */ diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 9ccc17ad1176..3ba19a966c7f 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -613,6 +613,12 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) goto error_del_vif; } + if (bus->hw_info.hw_capab & QLINK_HW_CAPAB_HW_BRIDGE) { + ret = qtnf_cmd_netdev_changeupper(vif, vif->netdev->ifindex); + if (ret) + goto error; + } + pr_debug("MAC%u initialized\n", macid); return 0; @@ -625,6 +631,54 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) return ret; } +bool qtnf_netdev_is_qtn(const struct net_device *ndev) +{ + return ndev->netdev_ops == &qtnf_netdev_ops; +} + +static int qtnf_core_netdevice_event(struct notifier_block *nb, + unsigned long event, void *ptr) +{ + struct net_device *ndev = netdev_notifier_info_to_dev(ptr); + const struct netdev_notifier_changeupper_info *info; + struct qtnf_vif *vif; + int br_domain; + int ret = 0; + + if (!qtnf_netdev_is_qtn(ndev)) + return NOTIFY_DONE; + + if (!net_eq(dev_net(ndev), &init_net)) + return NOTIFY_OK; + + vif = qtnf_netdev_get_priv(ndev); + + switch (event) { + case NETDEV_CHANGEUPPER: + info = ptr; + + if (!netif_is_bridge_master(info->upper_dev)) + break; + + pr_debug("[VIF%u.%u] change bridge: %s %s\n", + vif->mac->macid, vif->vifid, + netdev_name(info->upper_dev), + info->linking ? "add" : "del"); + + if (info->linking) + br_domain = info->upper_dev->ifindex; + else + br_domain = ndev->ifindex; + + ret = qtnf_cmd_netdev_changeupper(vif, br_domain); + break; + default: + break; + } + + return notifier_from_errno(ret); +} + int qtnf_core_attach(struct qtnf_bus *bus) { unsigned int i; @@ -685,6 +739,15 @@ int qtnf_core_attach(struct qtnf_bus *bus) } } + if (bus->hw_info.hw_capab & QLINK_HW_CAPAB_HW_BRIDGE) { + bus->netdev_nb.notifier_call = qtnf_core_netdevice_event; + ret = register_netdevice_notifier(&bus->netdev_nb); + if (ret) { + pr_err("failed to register netdev notifier: %d\n", ret); + goto error; + } + } + bus->fw_state = QTNF_FW_STATE_RUNNING; return 0; @@ -698,6 +761,7 @@ void qtnf_core_detach(struct qtnf_bus *bus) { unsigned int macid; + unregister_netdevice_notifier(&bus->netdev_nb); qtnf_bus_data_rx_stop(bus); for (macid = 0; macid < QTNF_MAX_MAC; macid++) diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index e3feea31191e..75b70f0c2b8e 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -153,6 +153,7 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev); void qtnf_netdev_updown(struct net_device *ndev, bool up); void qtnf_scan_done(struct qtnf_wmac *mac, bool aborted); struct dentry *qtnf_get_debugfs_dir(void); +bool qtnf_netdev_is_qtn(const struct net_device *ndev); static inline struct qtnf_vif *qtnf_netdev_get_priv(struct net_device *dev) { diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 59c69c0a6e06..18b2ddf39ef8 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -59,6 +59,7 @@ struct qlink_msg_header { * @QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR: device supports MAC Address * Randomization in probe requests. * @QLINK_HW_CAPAB_OBSS_SCAN: device can perform OBSS scanning. + * @QLINK_HW_CAPAB_HW_BRIDGE: device has hardware switch capabilities. */ enum qlink_hw_capab { QLINK_HW_CAPAB_REG_UPDATE = BIT(0), @@ -69,6 +70,7 @@ enum qlink_hw_capab { QLINK_HW_CAPAB_OBSS_SCAN = BIT(5), QLINK_HW_CAPAB_SCAN_DWELL = BIT(6), QLINK_HW_CAPAB_SAE = BIT(8), + QLINK_HW_CAPAB_HW_BRIDGE = BIT(9), }; enum qlink_iface_type { @@ -219,6 +221,8 @@ struct qlink_sta_info_state { * @QLINK_CMD_START_CAC: start radar detection procedure on a specified channel. * @QLINK_CMD_TXPWR: get or set current channel transmit power for * the specified MAC. + * @QLINK_CMD_NDEV_EVENT: signalizes changes made with a corresponding network + * device. */ enum qlink_cmd_type { QLINK_CMD_FW_INIT = 0x0001, @@ -251,6 +255,7 @@ enum qlink_cmd_type { QLINK_CMD_DEL_STA = 0x0052, QLINK_CMD_SCAN = 0x0053, QLINK_CMD_CHAN_STATS = 0x0054, + QLINK_CMD_NDEV_EVENT = 0x0055, QLINK_CMD_CONNECT = 0x0060, QLINK_CMD_DISCONNECT = 0x0061, QLINK_CMD_PM_SET = 0x0062, @@ -771,6 +776,42 @@ struct qlink_cmd_wowlan_set { u8 data[0]; } __packed; +enum qlink_ndev_event_type { + QLINK_NDEV_EVENT_CHANGEUPPER, +}; + +/** + * struct qlink_cmd_ndev_event - data for QLINK_CMD_NDEV_EVENT command + * + * @event: type of event, one of &enum qlink_ndev_event_type + */ +struct qlink_cmd_ndev_event { + struct qlink_cmd chdr; + __le16 event; + u8 rsvd[2]; +} __packed; + +enum qlink_ndev_upper_type { + QLINK_NDEV_UPPER_TYPE_NONE, + QLINK_NDEV_UPPER_TYPE_BRIDGE, +}; + +/** + * struct qlink_cmd_ndev_changeupper - data for QLINK_NDEV_EVENT_CHANGEUPPER + * + * @br_domain: layer 2 broadcast domain ID that ndev is a member of + * @upper_type: type of upper device, one of &enum qlink_ndev_upper_type + */ +struct qlink_cmd_ndev_changeupper { + struct qlink_cmd_ndev_event nehdr; + __le64 flags; + __le32 br_domain; + __le32 netspace_id; + __le16 vlanid; + u8 upper_type; + u8 rsvd[1]; +} __packed; + /* QLINK Command Responses messages related definitions */ From patchwork Mon Nov 18 08:23:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249069 X-Patchwork-Delegate: kvalo@adurom.com 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 EAE5D1390 for ; Mon, 18 Nov 2019 08:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B635C20740 for ; Mon, 18 Nov 2019 08:27:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="m+B/DjZl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfKRI1K (ORCPT ); Mon, 18 Nov 2019 03:27:10 -0500 Received: from mx0b-00183b01.pphosted.com ([67.231.157.42]:43296 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726748AbfKRI1J (ORCPT ); Mon, 18 Nov 2019 03:27:09 -0500 Received: from pps.filterd (m0059811.ppops.net [127.0.0.1]) by mx0b-00183b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAI8Ku74011085 for ; Mon, 18 Nov 2019 01:27:07 -0700 Received: from nam01-bn3-obe.outbound.protection.outlook.com (mail-bn3nam01lp2055.outbound.protection.outlook.com [104.47.33.55]) by mx0b-00183b01.pphosted.com with ESMTP id 2wacguuxqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:27:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=crY7DZEiSCuRYFWjBsb/LLOblr0wizB+g9S3E1swtios+eO7EhBewJUmtvy91Y+P2LmUOHWMtyx/hMbTw+A4C8cEH7yxTsiLe0oFE4hIZz3fugU6HqJV+wWPZnPa0K7CGpHYkIfjydWmUC0JIrcTNRLCInEaspX9mYQ8FXsyGcidM1+1eG84DWO7+NqN4sgSDhTpv9YeZtidLnQzWDPdLqt/+L3oALR0rtuNbZALoIUBUpM8T6tHuKMc61Wvvldy/3AXVR7667mgED0hpcmaK5cUlfy9rkXFJfk1pG0/cyr4voNZHOz4dfUf5of5RqtBDweVBGxVkZS9RVMqFg7h5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MV0/t9xiXFPzko9FTw8FhJ3Hx0pphJPfN99MKIP52zs=; b=PTY8NYSMZKNLpr4KKh/YBBy8YpXUZ4k5MWZoOY8sYloxADysrNV7R1UGOO+wZ1t42zpMAEIe4IdSYStOZBlQRaqmdrOtz/GH1M7avnIqKHJKePktYH+p9OZSyScaagRINF5R0nVWtKwgHZUQo4xOQgGtD1SwCWJ8H9ZnWJK3EF06HId9g1+x7qmLh4YqA0sHZsnjNV/Od3D1uVT2e8h2YVmgf7jlRI5svm+h7xFcnAFbsq0fNvjmNwQT71kEWPep4EM4Ifk3VI5FVx4O4owBNhSr3+a0jIwkChW48UhaAU/S3zqu8r52sLnHsnlZYGkpAS5WHcksMpvxj02zAgGm0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MV0/t9xiXFPzko9FTw8FhJ3Hx0pphJPfN99MKIP52zs=; b=m+B/DjZlV0oQ/j1Iu2IYVbeqQKADXEGnxyYDlSCSq6kQ70qRMJUTzGFYzd+1ng5Q3TcKUgiiK9T+D9LmvXBBsrSHrUWlju9C4IkXK8O4JDKQFvLdlSdprl4+5ru8LMT/GWL2G4HyruMxdXcvWEjhzd0Ih84F2udhNoTGqsI9fTA= Received: from BYAPR05MB5624.namprd05.prod.outlook.com (20.177.186.205) by BYAPR05MB4408.namprd05.prod.outlook.com (20.176.250.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.7; Mon, 18 Nov 2019 08:27:05 +0000 Received: from BYAPR05MB5624.namprd05.prod.outlook.com ([fe80::7904:4402:567b:e628]) by BYAPR05MB5624.namprd05.prod.outlook.com ([fe80::7904:4402:567b:e628%6]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:27:05 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:09 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:08 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 3/7] qtnfmac: add interface ID to each packet Thread-Topic: [PATCH 3/7] qtnfmac: add interface ID to each packet Thread-Index: AQHVneloCPLSMiIVkUO4dYO7a4s6EQ== Date: Mon, 18 Nov 2019 08:23:08 +0000 Message-ID: <20191118082255.6032-4-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0b8b1669-5235-4076-fe8f-08d76c008afd x-ms-traffictypediagnostic: SN6PR05MB6320:|BYAPR05MB4408: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:27:02 AM x-ms-oob-tlc-oobclassifiers: OLM:201; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(136003)(366004)(39840400004)(189003)(199004)(478600001)(76176011)(6436002)(6512007)(5640700003)(52116002)(66946007)(102836004)(107886003)(386003)(14444005)(5024004)(6506007)(256004)(4326008)(50226002)(71190400001)(71200400001)(66066001)(2906002)(3846002)(103116003)(6116002)(2501003)(6486002)(86362001)(81166006)(81156014)(8936002)(8676002)(36756003)(66476007)(436003)(305945005)(11346002)(446003)(2616005)(486006)(2351001)(54906003)(476003)(6916009)(7736002)(1076003)(316002)(5660300002)(26005)(25786009)(186003)(14454004)(64756008)(66446008)(66556008)(99286004);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR05MB4408;H:BYAPR05MB5624.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CCF3kJHT+ppOv4oqEheCFN/JdkXOAvUlWbKIzIisNrKilGVVWuFDHQDFCrqAB1Km2WDslFjKXl3qHCE08qknnlAp2p5PSHOcrxcmQDphmq27UR473IH1eGW0Q6AuxGt7vmylX6jhefqzDMMU1Yk0sFg2MswZDeju0QSUan6k5XEAgKhOvMROahACSxxtT/KwsSyhVNBToqdQrEkupHFkc22ILwsp9s4BJvieUm8tNdW0CN02sHETOQPadzyEbuj3O1lNpFGe2rCnvDf8CwSMyLE8YLK/pSU6GAvKgQXxr5Tg0riLgOWf7CUMMyyZAO03iBRFOYIwNWx6j7t8IuANexUiNznLrPL/EBIdXg3WysW4zNrIhwc0mWTG66n++J7QZLRO4hfQbiNlb5d9oN0FQyakEhox0BlQ3gLDBHtWebiEzyibhLhioM1GarSElfbK MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b8b1669-5235-4076-fe8f-08d76c008afd X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bN1h3zAQIxzv9CKrdvsy1/Mq16hz03sRmh+PhY6uP4d6yf4p9qHj3G587oQQ8D6YBwVNgvSA9plHU98oTLnffYsQyXU10imwlQ8UHsiITxn6QZvHwk7Wd7/Uxy5axZ9OrUSBh17P7jDn5X6/xJ7Mw1YTARoaczF838Sondzdgy6JG/rmAsLDdSGcnvBY3RLdIFGEc2oISUHf7MSLVSa6SHki4gpzMmSY+u8Xye4HLg8= X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:27:05.7620 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR05MB4408 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 clxscore=1015 impostorscore=0 phishscore=0 bulkscore=0 adultscore=0 priorityscore=1501 spamscore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180075 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Igor Mitsyanko Add interface ID information to the tail of each transmitted packet so that firmware can know to which interface the packet belongs to. This is only needed if device supports HW switch capability. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/bus.h | 21 ++++++++-- drivers/net/wireless/quantenna/qtnfmac/core.c | 19 ++++----- .../wireless/quantenna/qtnfmac/pcie/pearl_pcie.c | 47 ++++++++++++++++++++-- .../wireless/quantenna/qtnfmac/pcie/topaz_pcie.c | 5 ++- 4 files changed, 74 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/bus.h b/drivers/net/wireless/quantenna/qtnfmac/bus.h index 4c6eca344a09..49372d42e471 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/bus.h +++ b/drivers/net/wireless/quantenna/qtnfmac/bus.h @@ -12,6 +12,16 @@ #define QTNF_MAX_MAC 3 +#define HBM_FRAME_META_MAGIC_PATTERN_S 0xAB +#define HBM_FRAME_META_MAGIC_PATTERN_E 0xBA + +struct qtnf_frame_meta_info { + u8 magic_s; + u8 ifidx; + u8 macid; + u8 magic_e; +} __packed; + enum qtnf_fw_state { QTNF_FW_STATE_DETACHED, QTNF_FW_STATE_BOOT_DONE, @@ -31,8 +41,10 @@ struct qtnf_bus_ops { int (*control_tx)(struct qtnf_bus *, struct sk_buff *); /* data xfer methods */ - int (*data_tx)(struct qtnf_bus *, struct sk_buff *); + int (*data_tx)(struct qtnf_bus *bus, struct sk_buff *skb, + unsigned int macid, unsigned int vifid); void (*data_tx_timeout)(struct qtnf_bus *, struct net_device *); + void (*data_tx_use_meta_set)(struct qtnf_bus *bus, bool use_meta); void (*data_rx_start)(struct qtnf_bus *); void (*data_rx_stop)(struct qtnf_bus *); }; @@ -42,7 +54,7 @@ struct qtnf_bus { enum qtnf_fw_state fw_state; u32 chip; u32 chiprev; - const struct qtnf_bus_ops *bus_ops; + struct qtnf_bus_ops *bus_ops; struct qtnf_wmac *mac[QTNF_MAX_MAC]; struct qtnf_qlink_transport trans; struct qtnf_hw_info hw_info; @@ -100,9 +112,10 @@ static inline void qtnf_bus_stop(struct qtnf_bus *bus) bus->bus_ops->stop(bus); } -static inline int qtnf_bus_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) +static inline int qtnf_bus_data_tx(struct qtnf_bus *bus, struct sk_buff *skb, + unsigned int macid, unsigned int vifid) { - return bus->bus_ops->data_tx(bus, skb); + return bus->bus_ops->data_tx(bus, skb, macid, vifid); } static inline void diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 3ba19a966c7f..7300ab407cd6 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -22,13 +22,6 @@ MODULE_PARM_DESC(slave_radar, "set 0 to disable radar detection in slave mode"); static struct dentry *qtnf_debugfs_dir; -struct qtnf_frame_meta_info { - u8 magic_s; - u8 ifidx; - u8 macid; - u8 magic_e; -} __packed; - struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid) { struct qtnf_wmac *mac = NULL; @@ -121,7 +114,7 @@ qtnf_netdev_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) return NETDEV_TX_OK; } - return qtnf_bus_data_tx(mac->bus, skb); + return qtnf_bus_data_tx(mac->bus, skb, mac->macid, vif->vifid); } /* Netdev handler for getting stats. @@ -481,6 +474,9 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif, dev->tx_queue_len = 100; dev->ethtool_ops = &qtnf_ethtool_ops; + if (mac->bus->hw_info.hw_capab & QLINK_HW_CAPAB_HW_BRIDGE) + dev->needed_tailroom = sizeof(struct qtnf_frame_meta_info); + qdev_vif = netdev_priv(dev); *((void **)qdev_vif) = vif; @@ -723,6 +719,10 @@ int qtnf_core_attach(struct qtnf_bus *bus) goto error; } + if ((bus->hw_info.hw_capab & QLINK_HW_CAPAB_HW_BRIDGE) && + bus->bus_ops->data_tx_use_meta_set) + bus->bus_ops->data_tx_use_meta_set(bus, true); + if (bus->hw_info.num_mac > QTNF_MAX_MAC) { pr_err("no support for number of MACs=%u\n", bus->hw_info.num_mac); @@ -790,7 +790,8 @@ EXPORT_SYMBOL_GPL(qtnf_core_detach); static inline int qtnf_is_frame_meta_magic_valid(struct qtnf_frame_meta_info *m) { - return m->magic_s == 0xAB && m->magic_e == 0xBA; + return m->magic_s == HBM_FRAME_META_MAGIC_PATTERN_S && + m->magic_e == HBM_FRAME_META_MAGIC_PATTERN_E; } struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb) diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c index a501a1fd5332..8e0d8018208a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c @@ -532,7 +532,7 @@ static int qtnf_tx_queue_ready(struct qtnf_pcie_pearl_state *ps) return 1; } -static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) +static int qtnf_pcie_skb_send(struct qtnf_bus *bus, struct sk_buff *skb) { struct qtnf_pcie_pearl_state *ps = get_bus_priv(bus); struct qtnf_pcie_bus_priv *priv = &ps->base; @@ -608,6 +608,38 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) return NETDEV_TX_OK; } +static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb, + unsigned int macid, unsigned int vifid) +{ + return qtnf_pcie_skb_send(bus, skb); +} + +static int qtnf_pcie_data_tx_meta(struct qtnf_bus *bus, struct sk_buff *skb, + unsigned int macid, unsigned int vifid) +{ + struct qtnf_frame_meta_info *meta; + int tail_need = sizeof(*meta) - skb_tailroom(skb); + int ret; + + if (tail_need > 0 && pskb_expand_head(skb, 0, tail_need, GFP_ATOMIC)) { + skb->dev->stats.tx_dropped++; + dev_kfree_skb_any(skb); + return NETDEV_TX_OK; + } + + meta = skb_put(skb, sizeof(*meta)); + meta->magic_s = HBM_FRAME_META_MAGIC_PATTERN_S; + meta->magic_e = HBM_FRAME_META_MAGIC_PATTERN_E; + meta->macid = macid; + meta->ifidx = vifid; + + ret = qtnf_pcie_skb_send(bus, skb); + if (unlikely(ret == NETDEV_TX_BUSY)) + __skb_trim(skb, skb->len - sizeof(*meta)); + + return ret; +} + static irqreturn_t qtnf_pcie_pearl_interrupt(int irq, void *data) { struct qtnf_bus *bus = (struct qtnf_bus *)data; @@ -796,13 +828,22 @@ static void qtnf_pcie_data_rx_stop(struct qtnf_bus *bus) qtnf_disable_hdp_irqs(ps); } -static const struct qtnf_bus_ops qtnf_pcie_pearl_bus_ops = { +static void qtnf_pearl_tx_use_meta_info_set(struct qtnf_bus *bus, bool use_meta) +{ + if (use_meta) + bus->bus_ops->data_tx = qtnf_pcie_data_tx_meta; + else + bus->bus_ops->data_tx = qtnf_pcie_data_tx; +} + +static struct qtnf_bus_ops qtnf_pcie_pearl_bus_ops = { /* control path methods */ .control_tx = qtnf_pcie_control_tx, /* data path methods */ .data_tx = qtnf_pcie_data_tx, .data_tx_timeout = qtnf_pcie_data_tx_timeout, + .data_tx_use_meta_set = qtnf_pearl_tx_use_meta_info_set, .data_rx_start = qtnf_pcie_data_rx_start, .data_rx_stop = qtnf_pcie_data_rx_stop, }; @@ -905,7 +946,7 @@ static int qtnf_ep_fw_send(struct pci_dev *pdev, uint32_t size, memcpy(pdata, pblk, len); hdr->crc = cpu_to_le32(~crc32(0, pdata, len)); - ret = qtnf_pcie_data_tx(bus, skb); + ret = qtnf_pcie_skb_send(bus, skb); return (ret == NETDEV_TX_OK) ? len : 0; } diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c index a0587472736f..dbf3c5fd751f 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/topaz_pcie.c @@ -497,7 +497,8 @@ static int qtnf_tx_queue_ready(struct qtnf_pcie_topaz_state *ts) return 1; } -static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) +static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb, + unsigned int macid, unsigned int vifid) { struct qtnf_pcie_topaz_state *ts = (void *)get_bus_priv(bus); struct qtnf_pcie_bus_priv *priv = &ts->base; @@ -740,7 +741,7 @@ static void qtnf_pcie_data_rx_stop(struct qtnf_bus *bus) napi_disable(&bus->mux_napi); } -static const struct qtnf_bus_ops qtnf_pcie_topaz_bus_ops = { +static struct qtnf_bus_ops qtnf_pcie_topaz_bus_ops = { /* control path methods */ .control_tx = qtnf_pcie_control_tx, From patchwork Mon Nov 18 08:23:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249067 X-Patchwork-Delegate: kvalo@adurom.com 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 4841F1390 for ; Mon, 18 Nov 2019 08:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D40E20740 for ; Mon, 18 Nov 2019 08:27:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="Dzbx5Lpk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbfKRI1I (ORCPT ); Mon, 18 Nov 2019 03:27:08 -0500 Received: from mx0a-00183b01.pphosted.com ([67.231.149.44]:31106 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbfKRI1H (ORCPT ); Mon, 18 Nov 2019 03:27:07 -0500 Received: from pps.filterd (m0048105.ppops.net [127.0.0.1]) by mx0a-00183b01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAI8QnCP010305 for ; Mon, 18 Nov 2019 01:27:06 -0700 Received: from nam01-sn1-obe.outbound.protection.outlook.com (mail-sn1nam01lp2055.outbound.protection.outlook.com [104.47.32.55]) by mx0a-00183b01.pphosted.com with ESMTP id 2waf9fmcxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:27:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljEVtVeNGaCNObce1lsbwvzxNDZydoD5AZpj97v28aVkkv6LoAjX3JMUUk4ixh2VQZm7ZfbByjIFIzzvx4VGzP425KDSBCtUK7jj8tsk5nlrNtfgwSNJlzCZ2Bqy089t/ALj3IO6sfDZ0C3U8mHP8D03jdhnpp+nbEm/M7fUt7xMN9tCaQemiFxhRizjpyXuJzhVx4PXIIFa7fv+ptzCgHEPtjZGxnM8kDENppVtm5y8/w/Ylr6E4kRMbvN4dmIXfpmVbujJiBiaORn+J7QgpX64TVmeRABrDfemA5llzO6xQQApqjXFQyYSNqJT7lvHYtyO7b+ns6wqNCFXIs9t0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UBNKvRNvp8Zha2QucmYhsu48xVVkDGBXKWvwg8ybNqs=; b=bEq9LaL5/CvH+AS210/p4fA8jYUg1XRlRoKIVA6ir5DtGuWoJCTD/TRkTirbFOLzj7AzaY3FDEPazVTw1ZLof0q4tYcVygsUV6VQOJdwrATn0jDySoSqxeBByVpL8vepjqXS8/T/gsDErGF65J+cqVY1QwkwE9N6p7SItlkOO1bidDaECysvLDdHwHetjlMVp7L6K+ukOJEDX0TcBYrQ/BprzQMK/JVXMsChzZWvV7sEWkAeKqRA2ztjm77zfe4y0/0Jz2nNvsBh6SJn6vxPmRvvEyWfzTSX62k8XUx+ogSn2daEhWrBN1zEay1qLKrB2lDG3Jd3cE639kGFyksB7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UBNKvRNvp8Zha2QucmYhsu48xVVkDGBXKWvwg8ybNqs=; b=Dzbx5LpkF0MJaBCQcApXys/0qnuPwPAb3lwdW5Rkoh5X7jVsQdhR1I7WVct7z+TqbyMkmZf51hZba4y9Hyr1qyGUwjaiD4ZdLWqMUzAI/CutXMWvYNqAW8CppoKbVfFrLhq/9G5wdQIh6j0TxZBT2cgr3zATQb7h8MNjxq95oHk= Received: from DM6PR05MB4075.namprd05.prod.outlook.com (20.176.66.159) by DM6PR05MB4187.namprd05.prod.outlook.com (20.176.67.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.9; Mon, 18 Nov 2019 08:27:04 +0000 Received: from DM6PR05MB4075.namprd05.prod.outlook.com ([fe80::5cfb:e35:2d06:b51e]) by DM6PR05MB4075.namprd05.prod.outlook.com ([fe80::5cfb:e35:2d06:b51e%7]) with mapi id 15.20.2474.015; Mon, 18 Nov 2019 08:27:04 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:11 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:11 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 4/7] qtnfmac: advertise netdev port parent ID Thread-Topic: [PATCH 4/7] qtnfmac: advertise netdev port parent ID Thread-Index: AQHVnelpnzg40VYOU0+vG+wFVvyC5Q== Date: Mon, 18 Nov 2019 08:23:10 +0000 Message-ID: <20191118082255.6032-5-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1e98a1ad-3e7b-4146-36f9-08d76c008c40 x-ms-traffictypediagnostic: SN6PR05MB6320:|DM6PR05MB4187: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:27:02 AM x-ms-oob-tlc-oobclassifiers: OLM:854; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(366004)(396003)(136003)(39840400004)(376002)(189003)(199004)(86362001)(2351001)(386003)(11346002)(446003)(52116002)(76176011)(6506007)(186003)(478600001)(7736002)(436003)(2616005)(476003)(6916009)(103116003)(26005)(14454004)(102836004)(6512007)(5660300002)(99286004)(1076003)(66946007)(8936002)(107886003)(14444005)(2501003)(81166006)(81156014)(305945005)(486006)(2906002)(8676002)(50226002)(71190400001)(5024004)(256004)(5640700003)(71200400001)(4326008)(3846002)(6116002)(316002)(36756003)(66066001)(54906003)(64756008)(6436002)(66446008)(66476007)(66556008)(25786009)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR05MB4187;H:DM6PR05MB4075.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kr2p4p3zvrLxcOdetwobMmnNHYA5FBd09aYlkzHL8HNxZi8KqGIJjWeOxrK752wCsMm5Q5U5Rq0k3HenIkUfvGfu0EMw3+yMcb35G3vzgYup484MW2A7gmRtOIevUInBUqrUYKa0zpdy+04wq9FSZXnny6MfrEaPwIb+KrC4le1ySPC9OpISQj/ETtyOzbE5+UgkQWtpAnuLoZE4kpsa4F0ROj1VbnfDjsS2DLo1QqyTQE74dQUUIIxbQmQ259GdrNr54M0leHdzxg+8yFEPJSJmTMLEsRSjBxvQkRmV5/ivy0bzwHYQVL1G99UdAIaQURG7N2JvIXKs2MPcvv5LdKvYU9HScdIrzcI5UEUl+5F4e7EsGE/8bhw9PiBRef0I0+udOuAbwlJ38ApAjewGo1iIhUFbOevSvLB9HPUmrzmuJwYDE4HfAFuBmVMthPXD MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e98a1ad-3e7b-4146-36f9-08d76c008c40 X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HwsZWbqQ5t7Km4UXYUqpl30+CoR1oPF8MTyY0cQFf1b56dfG5plWTCjMDQYbY7NIoPkMs/xD5IKah2VZdEHE3sZBKplBXeXvo3Z8ENh75Y3FXgL5z5MoK2Qy55em9GB0OyColjGaOGMuE56GtS0G3wcQ6NnxyjyjqiCr5RJCYLqxly6urZ5en8kIPAjv/3iyQPoUM9NVlzqKGs6ckmLZaQ== X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:27:04.4710 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4187 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 impostorscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180076 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Igor Mitsyanko Use MAC address of the first active radio as a unique device ID. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/bus.h | 1 + drivers/net/wireless/quantenna/qtnfmac/commands.c | 5 +---- drivers/net/wireless/quantenna/qtnfmac/core.c | 20 ++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/core.h | 1 - 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/bus.h b/drivers/net/wireless/quantenna/qtnfmac/bus.h index 49372d42e471..87d048df09d1 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/bus.h +++ b/drivers/net/wireless/quantenna/qtnfmac/bus.h @@ -67,6 +67,7 @@ struct qtnf_bus { struct mutex bus_lock; /* lock during command/event processing */ struct dentry *dbg_dir; struct notifier_block netdev_nb; + u8 hw_id[ETH_ALEN]; /* bus private data */ char bus_priv[0] __aligned(sizeof(void *)); }; diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index cbc56464220e..1c1b377932cf 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -1242,10 +1242,7 @@ qtnf_cmd_resp_proc_mac_info(struct qtnf_wmac *mac, mac_info = &mac->macinfo; mac_info->bands_cap = resp_info->bands_cap; - memcpy(&mac_info->dev_mac, &resp_info->dev_mac, - sizeof(mac_info->dev_mac)); - - ether_addr_copy(mac->macaddr, mac_info->dev_mac); + ether_addr_copy(mac->macaddr, resp_info->dev_mac); vif = qtnf_mac_get_base_vif(mac); if (vif) diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index 7300ab407cd6..a709e378928d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -204,6 +204,21 @@ static int qtnf_netdev_set_mac_address(struct net_device *ndev, void *addr) return ret; } +static int qtnf_netdev_port_parent_id(struct net_device *ndev, + struct netdev_phys_item_id *ppid) +{ + const struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); + const struct qtnf_bus *bus = vif->mac->bus; + + if (!(bus->hw_info.hw_capab & QLINK_HW_CAPAB_HW_BRIDGE)) + return -EOPNOTSUPP; + + ppid->id_len = sizeof(bus->hw_id); + memcpy(&ppid->id, bus->hw_id, ppid->id_len); + + return 0; +} + /* Network device ops handlers */ const struct net_device_ops qtnf_netdev_ops = { .ndo_open = qtnf_netdev_open, @@ -212,6 +227,7 @@ const struct net_device_ops qtnf_netdev_ops = { .ndo_tx_timeout = qtnf_netdev_tx_timeout, .ndo_get_stats64 = qtnf_netdev_get_stats64, .ndo_set_mac_address = qtnf_netdev_set_mac_address, + .ndo_get_port_parent_id = qtnf_netdev_port_parent_id, }; static int qtnf_mac_init_single_band(struct wiphy *wiphy, @@ -565,6 +581,10 @@ static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) goto error; } + /* Use MAC address of the first active radio as a unique device ID */ + if (is_zero_ether_addr(mac->bus->hw_id)) + ether_addr_copy(mac->bus->hw_id, mac->macaddr); + vif = qtnf_mac_get_base_vif(mac); if (!vif) { pr_err("MAC%u: primary VIF is not ready\n", macid); diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index 75b70f0c2b8e..116ec16aa15b 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -74,7 +74,6 @@ struct qtnf_vif { struct qtnf_mac_info { u8 bands_cap; - u8 dev_mac[ETH_ALEN]; u8 num_tx_chain; u8 num_rx_chain; u16 max_ap_assoc_sta; From patchwork Mon Nov 18 08:23:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249073 X-Patchwork-Delegate: kvalo@adurom.com 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 7600314DB for ; Mon, 18 Nov 2019 08:27:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AF4C20740 for ; Mon, 18 Nov 2019 08:27:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="osy7VqYp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726748AbfKRI1R (ORCPT ); Mon, 18 Nov 2019 03:27:17 -0500 Received: from mx0b-00183b01.pphosted.com ([67.231.157.42]:61766 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726566AbfKRI1R (ORCPT ); Mon, 18 Nov 2019 03:27:17 -0500 Received: from pps.filterd (m0048104.ppops.net [127.0.0.1]) by mx0b-00183b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAI8Mlle014325 for ; Mon, 18 Nov 2019 01:27:15 -0700 Received: from nam04-co1-obe.outbound.protection.outlook.com (mail-co1nam04lp2053.outbound.protection.outlook.com [104.47.45.53]) by mx0b-00183b01.pphosted.com with ESMTP id 2wad7bc1rx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:27:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GXRI+C9Yre5sB/1FYFw/rl4saw1GlvbslLeMbFT0WtgBxUc9+CqXB1I5YzG17y4cfxVZN4w6ed//VgugrdZ3XFFXAOqdQoqI4fXLg9Nr8DOhAVK0Zjb85VA9jRKiqUQsr8MARt8oBN2pJ6ps1gbVWxCWZp1tngr9aV0VbqhZQNzP44/py4vdKEEBRs3xKzmX9wzcz2LVy0bxFDo6vja4TVDfp4uDPo5YCgj1B2OW3rB0pewMNh1JRjg2ZIqU3SiI89qut5y/gXIdz+Gad3n+1OMbGiGrphJartoIPYcDZkITd8Kt/MrfLQsbCXYv563UOMrumQh7v+Wgbq3Gpv056Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tz+aGO6FxesWLVKR36+ihU76ivqeb9mzzPkv9/LyX2w=; b=bTYymC4W0BrybCGXmykYj1a6SeqxTdE1ysFBC+aROobt4HUtqzehTD2CJhz7bzUrq8PQmFLskY7I57MZe8lwPTzi2hb/7hDSVvXVjJ1qv4ckIQyWnTdSh3bAtUNG9OvrmkkjlEoE8AdzDazwx06W857sU41XMykTMt+UfQtJ5aVSDrF3mYv+uQv3X7yl528WtnLG6b4wUc3xz+YmRlEGI9sFByLy9bsK1S3GLRlCX79zRjvMknX6qJTn2h44xKjISreWYa3wJBgI44a9poVMU5mzV0d/tj2pvy1I455Hydrj5QagzozG8A3TSODt/8TTf2POHnTBa6FQJNFXoP/Dng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tz+aGO6FxesWLVKR36+ihU76ivqeb9mzzPkv9/LyX2w=; b=osy7VqYpgHMUZfQBbzHYu2RV0qYCudIGejU3dC/XxXX9GE6gqUXGbRS+M04JoPHV0w39vQbBLe+n25Pz3hQGLx92E8zzZE/7nEvGfDeV/OnpN4Cwnj6hbHEWO3eXjcY7fGhu9JX9f6/k8UmJ3w0WkzqNhLLqYnr4g4DsLs75R9A= Received: from CY4PR0501MB3698.namprd05.prod.outlook.com (52.132.97.154) by CY4PR0501MB3841.namprd05.prod.outlook.com (52.132.100.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.12; Mon, 18 Nov 2019 08:27:13 +0000 Received: from CY4PR0501MB3698.namprd05.prod.outlook.com ([fe80::b07b:5f7b:c148:ab17]) by CY4PR0501MB3698.namprd05.prod.outlook.com ([fe80::b07b:5f7b:c148:ab17%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:27:13 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:13 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:13 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 5/7] qtnfmac: signal that all packets coming from device are already flooded Thread-Topic: [PATCH 5/7] qtnfmac: signal that all packets coming from device are already flooded Thread-Index: AQHVnelrOi5WAr643ESUN0HcEyw7Xw== Date: Mon, 18 Nov 2019 08:23:12 +0000 Message-ID: <20191118082255.6032-6-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 08592d55-6f81-4c93-f777-08d76c008d71 x-ms-traffictypediagnostic: SN6PR05MB6320:|CY4PR0501MB3841: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:27:11 AM x-ms-oob-tlc-oobclassifiers: OLM:1303; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(376002)(366004)(39840400004)(396003)(199004)(189003)(2351001)(2906002)(4326008)(71200400001)(71190400001)(8936002)(8676002)(81156014)(81166006)(107886003)(50226002)(3846002)(6116002)(103116003)(76176011)(7736002)(26005)(102836004)(186003)(305945005)(386003)(6506007)(6436002)(256004)(6512007)(52116002)(6486002)(1076003)(99286004)(2501003)(316002)(54906003)(5640700003)(64756008)(25786009)(66946007)(66556008)(66446008)(66476007)(66066001)(2616005)(478600001)(436003)(476003)(486006)(11346002)(86362001)(446003)(36756003)(14454004)(5660300002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR0501MB3841;H:CY4PR0501MB3698.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: X5FqRQ7+kUukC6cfs2XyiO/ftgGxheedeg40nfOb4kLZSYlAtsnWzIo8SQ8v6y0InAKZhgAbUVJ/t47BVCu5PeCxJTTmYq1gNlH6zrEK10LPgyPnItSjathTi4TGc0jxhGLafRB+ZiypJHZKo5gbmUvwbwwGXjl0WrJkcXDwBwgQHrRg1KvAi25uSQkZOdUY4JfO4r788keNlmODgfIlvA4hw3qrbc9fVmv+L7uKkvFRThHCAFXp4mf4kz7bpEs7w/RnOcZYJMr43P9c8NbTKgzTQ8Ko/1rV4KgDZveLnjqweG9oJ7qsDZk7mpzz5WCRT2w9xQoHOBH2yUU/LGgliarcW0u2CHIVTszvAu/nzn01Lk9db+Egm9hUs1uwbf70Da9f1xjULoN8PQZ+YAj+7M6E5NkMN7wzV/C3k7oTykYXbbUDUNLFT7i944yOYHjD MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08592d55-6f81-4c93-f777-08d76c008d71 X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RQzqbI+tdoDMLCt5LuwiCGF8MQ/tC5pbfuBaf2duNSwSYuz900qAwyJn0GjxPiqtbmHYvOaoWBQXEGbRCuGtWRXtzfI0aFYTkf8MTi+iInWZBUN71I98xd4P0WRuIbFcS8uL8s80+Ps0OXA4+MZsqLHmbGSICqYduZMQtL0Lhz/xdp50vjPDboLqRJV0cNwjaFW8zg19poZvOgeXOCLiFu6ql1EXkduoPepZRMNk7jA= X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:27:13.5674 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0501MB3841 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Reason: safe Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Igor Mitsyanko Firmware floods all packets that need to be flooded (multicast, broadcast, unknown unicast) as required. Tell kernel bridge subsystem it does not need to flood packet itself by marking each incoming frame with skb->offload_fwd_mark flag. Signed-off-by: Igor Mitsyanko --- drivers/net/wireless/quantenna/qtnfmac/core.c | 3 +++ drivers/net/wireless/quantenna/qtnfmac/switchdev.h | 24 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 drivers/net/wireless/quantenna/qtnfmac/switchdev.h diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index a709e378928d..f5aa2c547b94 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -12,6 +12,7 @@ #include "cfg80211.h" #include "event.h" #include "util.h" +#include "switchdev.h" #define QTNF_DMP_MAX_LEN 48 #define QTNF_PRIMARY_VIF_IDX 0 @@ -866,6 +867,8 @@ struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb) } __skb_trim(skb, skb->len - sizeof(*meta)); + /* Firmware always handles packets that require flooding */ + qtnfmac_switch_mark_skb_flooded(skb); out: return ndev; diff --git a/drivers/net/wireless/quantenna/qtnfmac/switchdev.h b/drivers/net/wireless/quantenna/qtnfmac/switchdev.h new file mode 100644 index 000000000000..b962e670c4b0 --- /dev/null +++ b/drivers/net/wireless/quantenna/qtnfmac/switchdev.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2019 Quantenna Communications. All rights reserved. */ + +#ifndef QTNFMAC_SWITCHDEV_H_ +#define QTNFMAC_SWITCHDEV_H_ + +#include + +#ifdef CONFIG_NET_SWITCHDEV + +static inline void qtnfmac_switch_mark_skb_flooded(struct sk_buff *skb) +{ + skb->offload_fwd_mark = 1; +} + +#else + +static inline void qtnfmac_switch_mark_skb_flooded(struct sk_buff *skb) +{ +} + +#endif + +#endif /* QTNFMAC_SWITCHDEV_H_ */ From patchwork Mon Nov 18 08:23:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249071 X-Patchwork-Delegate: kvalo@adurom.com 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 2277D14DB for ; Mon, 18 Nov 2019 08:27:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB85C20740 for ; Mon, 18 Nov 2019 08:27:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="IKriHdIF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbfKRI1Q (ORCPT ); Mon, 18 Nov 2019 03:27:16 -0500 Received: from mx0a-00183b01.pphosted.com ([67.231.149.44]:3032 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbfKRI1Q (ORCPT ); Mon, 18 Nov 2019 03:27:16 -0500 Received: from pps.filterd (m0048105.ppops.net [127.0.0.1]) by mx0a-00183b01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAI8Qmac009660 for ; Mon, 18 Nov 2019 01:27:14 -0700 Received: from nam04-bn3-obe.outbound.protection.outlook.com (mail-bn3nam04lp2052.outbound.protection.outlook.com [104.47.46.52]) by mx0a-00183b01.pphosted.com with ESMTP id 2waf9fmcye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:27:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WgSeudefy1vOjZ+g3fWJ6auZSEj3/HD+dXB6KOXJh8gcvjww8Ef+FOWjCHUqaqYBS41b7iX+kJVFpYScEnS/rTRpI7JsfL/leTMP7oD0i+YRttz9GjmclogqD44uzsAxh78aaJRBhFbBDie3TNTSfTbuQ+5egl9lsvFgeQ2HLiStsCysTDpJMcZxA4AJI8h+pYBnMNYzMobtQTCQWh31TZI9iOfSqztmr4CGSaqOPd2BmcsZM+zTFKur1qlcL2YUi8gAWviYOexXDP+LgiHJ5cG4zWCuis0GneyWZjPfbJ2pTAjiLYhLsdgz3b5ennMlMuBYLmpYP3IEe03aqRq2iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A8qmQSiGqlh+K6uSBRe/FMnu2F+3KVrUnGIGu+n32/Q=; b=XnMeit0uoSjbd1pOQ6eTkDx7ku7x5dhqAfTviNhLzSJkEjbNWbttJ5CJgBNz+5pmYu37KnsFCSg9uwAmngxGNGqEoFuvrtVPJxBheIF2VFgmaGqGUu+rZCG0hV5jNuCAwlSqpF1ZH2xSs4J2yIWA62kUrjAepZ+v1ce4jUFNfo6vDirX5soHcinpvsI8wfLzb53KKMfEvWFDpia0Us90fhWELw2Qx+a2uij7s+qDwJPiYUbGIGEiHbOGWmTjH+1h79h0wBNufwW/On1vzJT31D8AzQSSwP8hJ+HRSBy6337vRZAjp8q+PZ+0Nu7DeqvQ2LUvK5XwW7c295vP2SSDcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A8qmQSiGqlh+K6uSBRe/FMnu2F+3KVrUnGIGu+n32/Q=; b=IKriHdIFaIuYoflRHK86QyxLP2M52Yao0LsOYprDGgIeoZvXfa44IgyGpOSSWFivkQortw5IVQOdyYVZryKufIedaZydwt8xWqfcaqMtWQCUbDkFzZyXgeAIE7GA/uoArbJU4FOLFtfjSAL0wq/RxUa5JlHFjOWTSKeFcagCAC4= Received: from BN8PR05MB5987.namprd05.prod.outlook.com (20.178.212.145) by BN8PR05MB6162.namprd05.prod.outlook.com (20.178.208.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.7; Mon, 18 Nov 2019 08:27:12 +0000 Received: from BN8PR05MB5987.namprd05.prod.outlook.com ([fe80::c5af:987b:6787:7138]) by BN8PR05MB5987.namprd05.prod.outlook.com ([fe80::c5af:987b:6787:7138%7]) with mapi id 15.20.2474.015; Mon, 18 Nov 2019 08:27:11 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:15 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:15 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 6/7] qtnfmac: add TLV for extension IEs Thread-Topic: [PATCH 6/7] qtnfmac: add TLV for extension IEs Thread-Index: AQHVnelsK5u2FZ+VPU+PV+ooq5Q2rA== Date: Mon, 18 Nov 2019 08:23:14 +0000 Message-ID: <20191118082255.6032-7-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 30d4c86e-5cb0-4f57-3105-08d76c008eab x-ms-traffictypediagnostic: SN6PR05MB6320:|BN8PR05MB6162: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:27:09 AM x-ms-oob-tlc-oobclassifiers: OLM:46; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(396003)(136003)(376002)(39840400004)(346002)(199004)(189003)(103116003)(107886003)(66476007)(66066001)(66556008)(64756008)(446003)(305945005)(5640700003)(1076003)(54906003)(6916009)(66946007)(52116002)(14454004)(6506007)(386003)(186003)(50226002)(316002)(7736002)(66446008)(25786009)(4326008)(2351001)(36756003)(71190400001)(11346002)(8936002)(2616005)(476003)(2501003)(76176011)(486006)(478600001)(86362001)(436003)(3846002)(6512007)(81166006)(99286004)(5660300002)(71200400001)(8676002)(6116002)(102836004)(14444005)(6436002)(81156014)(26005)(2906002)(6486002)(256004);DIR:OUT;SFP:1101;SCL:1;SRVR:BN8PR05MB6162;H:BN8PR05MB5987.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FM4cTHTXHjfGtVniKfjLE0VI+tCE5n53bYmvJhz7ByRp16YV9etmMPbCyxQsGHrEtDb8fm94DzAGbMG/yjkN7XYgGVUYZl/r6OQaS3uAuAghbUiDkl9npfVXb2seQ7FabV/uvpB6eIlGrE2ZiDwrEC9zPrFYOpw1ydih0H3H4hyzLveDRICOosEqi2g2LYohvkUD4oG8Kd31x7d852KQOVIqhG7vxvgwpeN3XzWhUYUCBH5vuxzA6AoaBQiRCGIzCANhHOhpeOx1ogWis/2upYNPENWBRZ9IE718xevhz4GyuzU6Uvtmg1UChCdNpHTKAV3AhhTyf4JBHP/dkWiqzlPASltkTa3Y+TRungW9mZKj/6tNivsYo+FfcumnHCjXarRrkYHzrKllDukX8C2HUyjS3TNUQHLlhEIuG7ZNWCJVw4Zps0bWS7iro/iEa8S4 MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30d4c86e-5cb0-4f57-3105-08d76c008eab X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +7Z7L6LWr29m9E97Wq6mX9NvUK1Q6nXZA+bFDSq6RpfwyoVzO0moFdq4LnvIxx9Fry+tGimIAm14EkWaTtrHqNVc5+2bmrGneKarI5D4mjq1O6VMobzH1eNgpNR7BnwcVESn7fg51hLxLJK6eN655cBZH1U1DHN/DWCLNh5jWZjToTKK3OBg5nwSwEXr0QA2JdcI8MzFJT9t5ojZx8cw9kjROwAfbZFDH9hujQ9mWMQ= X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:27:11.9641 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR05MB6162 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 impostorscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911180076 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Mikhail Karpenko Extension information elements have additional field for ID. This commit adds TLV for such elements and a structure for interface HE capabilities communication with firmware. Signed-off-by: Mikhail Karpenko --- drivers/net/wireless/quantenna/qtnfmac/qlink.h | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h index 18b2ddf39ef8..75527f1bb306 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h +++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h @@ -1269,6 +1269,7 @@ struct qlink_event_mic_failure { * @QTN_TLV_ID_SCAN_SAMPLE_DURATION: total duration of sampling a single channel * during a scan including off-channel dwell time and operating channel * time. + * @QTN_TLV_ID_IFTYPE_DATA: supported band data. */ enum qlink_tlv_id { QTN_TLV_ID_FRAG_THRESH = 0x0201, @@ -1304,6 +1305,7 @@ enum qlink_tlv_id { QTN_TLV_ID_SCAN_DWELL_ACTIVE = 0x0413, QTN_TLV_ID_SCAN_DWELL_PASSIVE = 0x0416, QTN_TLV_ID_SCAN_SAMPLE_DURATION = 0x0417, + QTN_TLV_ID_IFTYPE_DATA = 0x0418, }; struct qlink_tlv_hdr { @@ -1465,6 +1467,39 @@ struct qlink_tlv_ie_set { u8 ie_data[0]; } __packed; +/** + * struct qlink_tlv_ext_ie - extension IE + * + * @eid_ext: element ID extension, one of &enum ieee80211_eid_ext. + * @ie_data: IEs data. + */ +struct qlink_tlv_ext_ie { + struct qlink_tlv_hdr hdr; + u8 eid_ext; + u8 ie_data[0]; +} __packed; + +#define IEEE80211_HE_PPE_THRES_MAX_LEN 25 +struct qlink_sband_iftype_data { + __le16 types_mask; + struct ieee80211_he_cap_elem he_cap_elem; + struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; + u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; +} __packed; + +/** + * struct qlink_tlv_iftype_data - data for QTN_TLV_ID_IFTYPE_DATA + * + * @n_iftype_data: number of entries in iftype_data. + * @iftype_data: interface type data entries. + */ +struct qlink_tlv_iftype_data { + struct qlink_tlv_hdr hdr; + u8 n_iftype_data; + u8 rsvd[3]; + struct qlink_sband_iftype_data iftype_data[0]; +} __packed; + struct qlink_chan_stats { __le32 chan_num; __le32 cca_tx; From patchwork Mon Nov 18 08:23:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 11249119 X-Patchwork-Delegate: kvalo@adurom.com 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 AAD721393 for ; Mon, 18 Nov 2019 08:42:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D6A620748 for ; Mon, 18 Nov 2019 08:42:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=quantenna.com header.i=@quantenna.com header.b="S3TXQj+X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbfKRImP (ORCPT ); Mon, 18 Nov 2019 03:42:15 -0500 Received: from mx0b-00183b01.pphosted.com ([67.231.157.42]:64690 "EHLO mx0a-00183b01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726404AbfKRImP (ORCPT ); Mon, 18 Nov 2019 03:42:15 -0500 Received: from pps.filterd (m0048103.ppops.net [127.0.0.1]) by mx0b-00183b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAI8e7fK006573 for ; Mon, 18 Nov 2019 01:42:13 -0700 Received: from nam04-co1-obe.outbound.protection.outlook.com (mail-co1nam04lp2056.outbound.protection.outlook.com [104.47.45.56]) by mx0b-00183b01.pphosted.com with ESMTP id 2waew9ux9k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Nov 2019 01:42:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e4t7JfgTYAjlSW3e+538f+0/j9GpITR4vdUee1rU1imI93LcL3Ay7lCwp2tWq71T4Fk2NLfcs/mWEizEKCaZ24gLug5I0dL3hcc6YPZq98+GCk0GnbiWevYYkGfdrM/C76liW6wgK+njIIpa57uKB4QbLd5BXDKSVgKhQCoqTyQ3695hKeqcki8JGnn0COZe0IWAwxJEgL4TZbsOWRwKfOcmvkQwJrwVu8kXZUoOGwe5kjEEFPwsTdFKTylY4KoiPgBKastJQue3XMw0GQZL0rN/rRdO+smV29mDpMmsuID2PdKx5eTEntNLruzBfP78r5SVIdYuChZ1mYmyWQ9xDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AFPXb7eGTO4UjtFF0jCHL6v2DUynuNFrC+UtByV6kXA=; b=m6w+c6AJB0gqDu49ppNjFgxpmBbjc3Q2jQ20R1i3kPGWDHeVLKEFceD/lxYWqfO6iOhfBzaJ3j3IL9zBYjVVfSRBTo7USqSXAQv8IwgM9Rc98lyda6szv0e7uRdmXL/f7exlRi+NgxW4rkkfZnvoEjcNXU/WR6Okn4WT1nyFAOR6PuNXpZBCw0WkOel7mzvGMIn+T9DdJhFuZIUqzL1BZePZKtUr8XmZjF2LeT5Wy9pE2Efazztqwuuk5UwmUgjZ6PEjR7TFV3gAd4Gl6AfayZEm2C155P1rHY4VC/jmlbSRKy3x2C/6xMnct58xyagqyafNvHHR7bxs/WJOgo8THg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=quantenna.com; dmarc=pass action=none header.from=quantenna.com; dkim=pass header.d=quantenna.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AFPXb7eGTO4UjtFF0jCHL6v2DUynuNFrC+UtByV6kXA=; b=S3TXQj+Xnik4AjgN+IeFhkyWOXk93mRPGOMUo+4YBc4XeIAA2mffxedjEYFwIt+AyOr3XqamMTMhL/vSnGkvqIOot2P7tinxGK5S5kWYItmkSTc/CAbLKnjMFb4grLT/+rgUWv34PPQpw2xgXJrXeJMXVSG8X6SheTydYQ2a9Ac= Received: from SN6PR05MB5328.namprd05.prod.outlook.com (52.135.111.216) by SN6PR05MB4095.namprd05.prod.outlook.com (52.135.66.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.9; Mon, 18 Nov 2019 08:27:24 +0000 Received: from SN6PR05MB5328.namprd05.prod.outlook.com ([fe80::3801:4c01:20fc:2aa6]) by SN6PR05MB5328.namprd05.prod.outlook.com ([fe80::3801:4c01:20fc:2aa6%6]) with mapi id 15.20.2474.015; Mon, 18 Nov 2019 08:27:24 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com (52.135.117.74) by SN6PR05MB6320.namprd05.prod.outlook.com (20.177.254.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.13; Mon, 18 Nov 2019 08:23:17 +0000 Received: from SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9]) by SN6PR05MB4928.namprd05.prod.outlook.com ([fe80::61a0:dd3d:3477:29c9%5]) with mapi id 15.20.2474.012; Mon, 18 Nov 2019 08:23:17 +0000 From: Sergey Matyukevich To: "linux-wireless@vger.kernel.org" CC: Igor Mitsyanko , Mikhail Karpenko , Sergey Matyukevich Subject: [PATCH 7/7] qtnfmac: process HE capabilities requests Thread-Topic: [PATCH 7/7] qtnfmac: process HE capabilities requests Thread-Index: AQHVneltVi/rQ8KGKEyoXxJmDlwU6w== Date: Mon, 18 Nov 2019 08:23:16 +0000 Message-ID: <20191118082255.6032-8-sergey.matyukevich.os@quantenna.com> References: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> In-Reply-To: <20191118082255.6032-1-sergey.matyukevich.os@quantenna.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0053.namprd02.prod.outlook.com (2603:10b6:a03:54::30) To SN6PR05MB4928.namprd05.prod.outlook.com (2603:10b6:805:9d::10) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.11.0 x-originating-ip: [195.182.157.78] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9d00f7b5-fb3a-47a8-b513-08d76c008fdd x-ms-traffictypediagnostic: SN6PR05MB6320:|SN6PR05MB4095: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-moderation-data: 11/18/2019 8:27:21 AM x-ms-oob-tlc-oobclassifiers: OLM:16; x-forefront-prvs: 0225B0D5BC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39840400004)(376002)(136003)(366004)(396003)(346002)(199004)(189003)(446003)(436003)(2906002)(2616005)(486006)(476003)(11346002)(71200400001)(71190400001)(66066001)(316002)(305945005)(478600001)(36756003)(6506007)(386003)(7736002)(6512007)(5640700003)(6436002)(54906003)(3846002)(4326008)(186003)(86362001)(52116002)(66446008)(64756008)(66556008)(66476007)(81156014)(81166006)(26005)(8676002)(6116002)(66946007)(1076003)(107886003)(76176011)(2501003)(2351001)(102836004)(103116003)(25786009)(6486002)(14454004)(99286004)(50226002)(256004)(14444005)(5660300002)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR05MB4095;H:SN6PR05MB5328.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: F+Ik266OuNc8hAGTunRuBeBpIu4EtKKAcBegNiN3L6LklMtUHdbyrrIp+SKPlIIvvTvpK9OEuJwho2EeBAXuMtje0wSVNj4FjVwLgmTs6MLJbsm6gBDItJhNQ/yOVDHFGdO1/GyuKSR8/igvX3n7w9yRA4bKp8UN7tDjYkBV18JUrUiihGhiFCi3CJ0CVeJn/tarRpKXTBxvTh5pZcj8C8IDdmi6EH/sL74RGhKhXcDWVtz6voDndm89R7P9iUJCPfOV4Qe1JV9t/mzmo5H6DelqyAndCDraU4twV4hrNYHoFo1o5H4HHOxw0FEYCzQLhAWbMeC89ctlCL0TVyJOpXzx5wLfyjjRsTjvoKcqL0k61XunZ8MyDmmdBTzaDjndufPF6Z9jvxeMyZ/Klzezt3XwGNYz8foV+MMEPcGHCDNL+hxybqBwADcnwFdYsBsE MIME-Version: 1.0 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d00f7b5-fb3a-47a8-b513-08d76c008fdd X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Lj7BcbTLQ4pIom5dutm6PLblnXxfK7zra9ZcSwtz7XxsO2GWiBSVA2IMw83AZlyoiRE22mgvfRRjDGB6T5+N7frDa8BvDq/gANJvPhdBRhDQcxKWw8V1I++MeRZ6AyMSe/WMQEacSFPws1w0HFW3wqTxsgqGnr8/jKwLET3/4851ECD2HYQHwhIIghO7n66BS+ug3OJakHujQjZW7q3yRn5iy+eZuRFOGsAqHuf1Yz8= X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2019 08:27:24.0472 (UTC) X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR05MB4095 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-18_01:2019-11-15,2019-11-17 signatures=0 X-Proofpoint-Spam-Reason: safe Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Mikhail Karpenko Pass HE interface type data requests between firmware and driver. Signed-off-by: Mikhail Karpenko --- drivers/net/wireless/quantenna/qtnfmac/commands.c | 90 ++++++++++++++++++++++- drivers/net/wireless/quantenna/qtnfmac/core.c | 3 + 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index 1c1b377932cf..548f6ff6d0f2 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -214,6 +214,20 @@ static bool qtnf_cmd_start_ap_can_fit(const struct qtnf_vif *vif, return true; } +static void qtnf_cmd_tlv_ie_ext_add(struct sk_buff *cmd_skb, u8 eid_ext, + const void *buf, size_t len) +{ + struct qlink_tlv_ext_ie *tlv; + + tlv = (struct qlink_tlv_ext_ie *)skb_put(cmd_skb, sizeof(*tlv) + len); + tlv->hdr.type = cpu_to_le16(WLAN_EID_EXTENSION); + tlv->hdr.len = cpu_to_le16(sizeof(*tlv) + len - sizeof(tlv->hdr)); + tlv->eid_ext = eid_ext; + + if (len && buf) + memcpy(tlv->ie_data, buf, len); +} + int qtnf_cmd_send_start_ap(struct qtnf_vif *vif, const struct cfg80211_ap_settings *s) { @@ -309,6 +323,10 @@ int qtnf_cmd_send_start_ap(struct qtnf_vif *vif, memcpy(tlv->val, s->vht_cap, sizeof(*s->vht_cap)); } + if (s->he_cap) + qtnf_cmd_tlv_ie_ext_add(cmd_skb, WLAN_EID_EXT_HE_CAPABILITY, + s->he_cap, sizeof(*s->he_cap)); + if (s->acl) { size_t acl_size = struct_size(s->acl, mac_addrs, s->acl->n_acl_entries); @@ -1292,6 +1310,69 @@ static void qtnf_cmd_resp_band_fill_vhtcap(const u8 *info, memcpy(&bcap->vht_mcs, &vht_cap->supp_mcs, sizeof(bcap->vht_mcs)); } +static void qtnf_cmd_conv_iftype(struct ieee80211_sband_iftype_data + *iftype_data, + const struct qlink_sband_iftype_data + *qlink_data) +{ + iftype_data->types_mask = le16_to_cpu(qlink_data->types_mask); + + iftype_data->he_cap.has_he = true; + memcpy(&iftype_data->he_cap.he_cap_elem, &qlink_data->he_cap_elem, + sizeof(qlink_data->he_cap_elem)); + memcpy(iftype_data->he_cap.ppe_thres, qlink_data->ppe_thres, + ARRAY_SIZE(qlink_data->ppe_thres)); + + iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_80 = + qlink_data->he_mcs_nss_supp.rx_mcs_80; + iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80 = + qlink_data->he_mcs_nss_supp.tx_mcs_80; + iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_160 = + qlink_data->he_mcs_nss_supp.rx_mcs_160; + iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160 = + qlink_data->he_mcs_nss_supp.tx_mcs_160; + iftype_data->he_cap.he_mcs_nss_supp.rx_mcs_80p80 = + qlink_data->he_mcs_nss_supp.rx_mcs_80p80; + iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_80p80 = + qlink_data->he_mcs_nss_supp.tx_mcs_80p80; +} + +static int qtnf_cmd_band_fill_iftype(const u8 *data, + struct ieee80211_supported_band *band) +{ + unsigned int i; + struct ieee80211_sband_iftype_data *iftype_data; + const struct qlink_tlv_iftype_data *tlv = + (const struct qlink_tlv_iftype_data *)data; + size_t payload_len = tlv->n_iftype_data * sizeof(*tlv->iftype_data) + + sizeof(*tlv) - + sizeof(struct qlink_tlv_hdr); + + if (tlv->hdr.len != cpu_to_le16(payload_len)) { + pr_err("bad IFTYPE_DATA TLV len %u\n", tlv->hdr.len); + return -EINVAL; + } + + kfree(band->iftype_data); + band->iftype_data = NULL; + band->n_iftype_data = tlv->n_iftype_data; + if (band->n_iftype_data == 0) + return 0; + + iftype_data = kcalloc(band->n_iftype_data, sizeof(*iftype_data), + GFP_KERNEL); + if (!iftype_data) { + band->n_iftype_data = 0; + return -ENOMEM; + } + band->iftype_data = iftype_data; + + for (i = 0; i < band->n_iftype_data; i++) + qtnf_cmd_conv_iftype(iftype_data++, &tlv->iftype_data[i]); + + return 0; +} + static int qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, struct qlink_resp_band_info_get *resp, @@ -1305,6 +1386,7 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, struct ieee80211_channel *chan; unsigned int chidx = 0; u32 qflags; + int ret = -EINVAL; memset(&band->ht_cap, 0, sizeof(band->ht_cap)); memset(&band->vht_cap, 0, sizeof(band->vht_cap)); @@ -1442,6 +1524,12 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, qtnf_cmd_resp_band_fill_vhtcap(tlv->val, &band->vht_cap); break; + case QTN_TLV_ID_IFTYPE_DATA: + ret = qtnf_cmd_band_fill_iftype((const uint8_t *)tlv, + band); + if (ret) + goto error_ret; + break; default: pr_warn("unknown TLV type: %#x\n", tlv_type); break; @@ -1469,7 +1557,7 @@ qtnf_cmd_resp_fill_band_info(struct ieee80211_supported_band *band, band->channels = NULL; band->n_channels = 0; - return -EINVAL; + return ret; } static int qtnf_cmd_resp_proc_phy_params(struct qtnf_wmac *mac, diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index f5aa2c547b94..5fb598389487 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -543,6 +543,9 @@ static void qtnf_core_mac_detach(struct qtnf_bus *bus, unsigned int macid) if (!wiphy->bands[band]) continue; + kfree(wiphy->bands[band]->iftype_data); + wiphy->bands[band]->n_iftype_data = 0; + kfree(wiphy->bands[band]->channels); wiphy->bands[band]->n_channels = 0;