From patchwork Tue Feb 11 09:57:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 11375133 X-Patchwork-Delegate: johannes@sipsolutions.net 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 C21291580 for ; Tue, 11 Feb 2020 09:57:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E9702086A for ; Tue, 11 Feb 2020 09:57:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="T4fdKXFl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728121AbgBKJ5I (ORCPT ); Tue, 11 Feb 2020 04:57:08 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:55200 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbgBKJ5I (ORCPT ); Tue, 11 Feb 2020 04:57:08 -0500 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Ajay.Kathat@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Ajay.Kathat@microchip.com"; x-sender="Ajay.Kathat@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Ajay.Kathat@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; spf=Pass smtp.mailfrom=Ajay.Kathat@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: ZHWv/U98qwThbkB5de7MBwBx0MY/uld9p7idERc/f6loWo+pCz3QL/oAJErV1XA6FXb5wNTRve bgeC1/ZYX/iK7kw/DamZl1Po5zAye+aNtxMtdaNAUHJn7y9enCwMekorgNB4+8+UPaHFpp2uPj Szrlx+Ue4X8sPPOQETnSNQYN660DNZXbB2r1ezGxJEqgLqsmy8kuHR+9oem0sFjDZ5ne8Cc0Wt 7TXnh9pjOgQRnfkG0Q66It5gCDwD4iIEO2PqCgNiiM0VdC1Pq+sCbJUP0VK+9z9EIyPeeRZ7Bz 7J0= X-IronPort-AV: E=Sophos;i="5.70,428,1574146800"; d="scan'208";a="1964595" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Feb 2020 02:57:06 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 11 Feb 2020 02:57:06 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 11 Feb 2020 02:57:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b2zgchnid3knrWocqXKkAW75m/IQgneU7YNxxYnwT0LcomdmwQgXYsNY74BQNNJaV8NsKEc6LAbETW283xmSpbcgANieKTJ1Xdl5NQFgeyNij8QbAlVRnh3rN3s4F0kY/YGgphhmjRxRl3OieiUt02eN0sHrL++q6vYWXzkkQaSwrqfYbs66TDn5t7joNPjPCPmDbjnBh2Aw/I4EsptuqXrYfSKCojPqItyl8Tac+I0Gbe6Mh9I18f8T3Tmg/cOJ5IRDSUGhKlxOoW5JYxRqCYJaVcp4uVoHt9HymZjIYzhozGxyZL8cl8S4PCjsDnvRWBkDmV13xTERS8WcEKEwUw== 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=C7PmeSnPdlauPWetS7DvnA9uLb9KnyRn8iajT4mZn9I=; b=IfI4KlrUUVbE0ZQ3cjgkHj50xqE+Z1a9CsokumDT5KtrIAzwek+3Vvul2f7tdgwoVVEkoMyTXw//Gw/+z+Ab/WD6NqR5i1ouvOJAsB0PPOfFaJsI+Su0ll0wCz1Y/FtQJuNwdAhGQAK3uaWRwxZWVWW2+I5Q0W6A+eR+rLO0FsO3k69hlNR29jo3GqyWdHZbkzmtDhLy9uUAJeThgCseQyHaiUOz1dv5Z9r3t4SRfPx37FyA3n6NG1iPxrUl5nHxJOl82YfhvFKaf5L3FWMESkvWa3U0mynP2ObKJNG71lOoz4OBUrCSyRuORBqlVb2rdcHAixF9QcHE3HTCx2dnWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C7PmeSnPdlauPWetS7DvnA9uLb9KnyRn8iajT4mZn9I=; b=T4fdKXFlYkdn8OCTxUFQCkfxye/iRc8GP8rERU24oA52jxmJH+ODqEADUunX3KVb0hMIS0SvxXidZZeTS7rAzldFzRGn9YcBCjW4lqbbyUfKLMePPjBgZgP8a5/zv1ANsRUyi1qd0usDRmIL6dcc/927Lc925Gb1gnPNQRD6xPs= Received: from DM6PR11MB3996.namprd11.prod.outlook.com (20.176.125.206) by DM6PR11MB4345.namprd11.prod.outlook.com (52.132.251.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.28; Tue, 11 Feb 2020 09:57:05 +0000 Received: from DM6PR11MB3996.namprd11.prod.outlook.com ([fe80::75b4:bb0c:c245:4392]) by DM6PR11MB3996.namprd11.prod.outlook.com ([fe80::75b4:bb0c:c245:4392%5]) with mapi id 15.20.2707.030; Tue, 11 Feb 2020 09:57:05 +0000 From: To: CC: , , , , Subject: [PATCH v2 1/3] staging: wilc1000: remove use of vendor specific IE for p2p handling Thread-Topic: [PATCH v2 1/3] staging: wilc1000: remove use of vendor specific IE for p2p handling Thread-Index: AQHV4MGdH4tCboNUMUWXTbBDKdXu/Q== Date: Tue, 11 Feb 2020 09:57:05 +0000 Message-ID: <20200211152802.6096-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-originating-ip: [121.244.27.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fd9b68c5-4023-48b2-44dd-08d7aed8bfea x-ms-traffictypediagnostic: DM6PR11MB4345: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 0310C78181 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(346002)(39860400002)(366004)(199004)(189003)(71200400001)(316002)(107886003)(6916009)(2616005)(36756003)(6486002)(4326008)(1076003)(6512007)(54906003)(6506007)(5660300002)(66446008)(8936002)(186003)(26005)(86362001)(8676002)(81166006)(81156014)(64756008)(2906002)(66556008)(76116006)(91956017)(66476007)(478600001)(66946007);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR11MB4345;H:DM6PR11MB3996.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wMMi/7kjQI5zvnxfierib4jE92lBBgbjd3w6WUdnBBIyV5/hP0TMSphWgkagCcUxwGxbYK/eo046vTUzvEw2UK/bKIAOSmVvvd5oeGBXrDSB+1JSoekUMLb47JyW7SSWfIJtF9BFrrFpeC9ravODNWjLRHothGZtYJIW5aXyx+JiCFMSbUSBiHIxBPCupiqVK/VbRJBoqpuNrsYqCGqvcl370zTdBwo1Rd4Ekyrep2osI5dqguqkNo2qu9sVYUSqrIEM5RVKeFkVuicpUpelF1vL5vNtOQLcsBoh9qmZ81zu3SMtoOuLk7WDrHhII2d7TBgnKcQVUkExw26uwRzoiXqblfzjjFmZdTcMwdnlEAq0jQupqhl80EteR5p/4XiPy4oizSOH3b1So5tEcLiM+8LCHWZjE7t4ncU0QPtXYaLCpLJ6HfCFwKZWmfkQKYgt x-ms-exchange-antispam-messagedata: JzPhywv+JbAvOaxSYci/ujGPwa4QsXMMxUMGoq5n8aPXyLHPTk8GWRUHBoFHn/kumDfdIw1YFro38/jMWmZH+DvTZjhbVc0b1SQKhPOoCzRhYlymF3DTVI6f2VlfCxdiXLxUMf9a64xfF60oRhEPtQ== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: fd9b68c5-4023-48b2-44dd-08d7aed8bfea X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2020 09:57:05.1235 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0UGVLpULBYH+qwUVcv9BM0sK5FJXsC25lco8zjUDTcoGV4i4X0af2p94jnELty2reWszld77yQfPcJKiJzrOze6Lkn/wGhc+wxY72K95rk4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4345 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Remove the use of vendor specific IE parameter to decide p2p_GO/p2p_Client roles between two 'wilc' device. Previously p2p group formation between two 'wilc' device make use of vendor IE for roles decision. The role is decided based on the 'go_intent' value. Signed-off-by: Ajay Singh --- v2: No change drivers/staging/wilc1000/cfg80211.c | 72 ++--------------------------- drivers/staging/wilc1000/netdev.c | 2 - drivers/staging/wilc1000/netdev.h | 7 --- 3 files changed, 4 insertions(+), 77 deletions(-) diff --git a/drivers/staging/wilc1000/cfg80211.c b/drivers/staging/wilc1000/cfg80211.c index 4863e516ff13..7afbc475b3ea 100644 --- a/drivers/staging/wilc1000/cfg80211.c +++ b/drivers/staging/wilc1000/cfg80211.c @@ -68,7 +68,6 @@ struct wilc_p2p_mgmt_data { }; static const u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; -static const u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; static void cfg_scan_result(enum scan_event scan_event, struct wilc_rcvd_net_info *info, void *user_void) @@ -172,9 +171,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, u8 mac_status, } else if (conn_disconn_evt == CONN_DISCONN_EVENT_DISCONN_NOTIF) { u16 reason = 0; - priv->p2p.local_random = 0x01; - priv->p2p.recv_random = 0x00; - priv->p2p.is_wilc_ie = false; eth_zero_addr(priv->associated_bss); wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE); @@ -446,9 +442,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, wilc->sta_ch = WILC_INVALID_CHANNEL; wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE); - priv->p2p.local_random = 0x01; - priv->p2p.recv_random = 0x00; - priv->p2p.is_wilc_ie = false; priv->hif_drv->p2p_timeout = 0; ret = wilc_disconnect(vif); @@ -934,9 +927,6 @@ static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len, u8 sta_ch) u8 channel_list_attr_index = 0; while (index < len) { - if (buf[index] == GO_INTENT_ATTR_ID) - buf[index + 3] = (buf[index + 3] & 0x01) | (0x00 << 1); - if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; else if (buf[index] == OPERCHAN_ATTR_ID) @@ -956,12 +946,6 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, u8 channel_list_attr_index = 0; while (index < len) { - if (buf[index] == GO_INTENT_ATTR_ID) { - buf[index + 3] = (buf[index + 3] & 0x01) | (0x0f << 1); - - break; - } - if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; else if (buf[index] == OPERCHAN_ATTR_ID) @@ -981,24 +965,6 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff, struct wilc_vif *vif = netdev_priv(priv->dev); subtype = buff[P2P_PUB_ACTION_SUBTYPE]; - if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && - !priv->p2p.is_wilc_ie) { - for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { - if (!memcmp(p2p_vendor_spec, &buff[i], 6)) { - priv->p2p.recv_random = buff[i + 6]; - priv->p2p.is_wilc_ie = true; - break; - } - } - } - - if (priv->p2p.local_random <= priv->p2p.recv_random) { - netdev_dbg(vif->ndev, - "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", - priv->p2p.local_random, priv->p2p.recv_random); - return; - } - if (subtype == GO_NEG_REQ || subtype == GO_NEG_RSP || subtype == P2P_INV_REQ || subtype == P2P_INV_RSP) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { @@ -1051,8 +1017,6 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) return; } if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { - u8 subtype = buff[P2P_PUB_ACTION_SUBTYPE]; - switch (buff[ACTION_SUBTYPE_ID]) { case GAS_INITIAL_REQ: case GAS_INITIAL_RSP: @@ -1063,10 +1027,6 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) wilc_wfi_cfg_parse_rx_vendor_spec(priv, buff, size); - if ((subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) && - priv->p2p.is_wilc_ie) - size -= 7; - break; default: @@ -1167,17 +1127,8 @@ static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, u8 subtype = buf[P2P_PUB_ACTION_SUBTYPE]; struct wilc_vif *vif = netdev_priv(priv->dev); - if (subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) { - if (priv->p2p.local_random == 1 && - priv->p2p.recv_random < priv->p2p.local_random) { - get_random_bytes(&priv->p2p.local_random, 1); - priv->p2p.local_random++; - } - } - - if (priv->p2p.local_random <= priv->p2p.recv_random || - !(subtype == GO_NEG_REQ || subtype == GO_NEG_RSP || - subtype == P2P_INV_REQ || subtype == P2P_INV_RSP)) + if (subtype != GO_NEG_REQ && subtype != GO_NEG_RSP && + subtype != P2P_INV_REQ && subtype != P2P_INV_RSP) return; for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { @@ -1196,15 +1147,6 @@ static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, break; } } - - if (subtype != P2P_INV_REQ && subtype != P2P_INV_RSP) { - int vendor_spec_len = sizeof(p2p_vendor_spec); - - memcpy(&mgmt_tx->buff[len], p2p_vendor_spec, - vendor_spec_len); - mgmt_tx->buff[len + vendor_spec_len] = priv->p2p.local_random; - mgmt_tx->size = buf_len; - } } static int mgmt_tx(struct wiphy *wiphy, @@ -1221,8 +1163,6 @@ static int mgmt_tx(struct wiphy *wiphy, struct wilc_vif *vif = netdev_priv(wdev->netdev); struct wilc_priv *priv = &vif->priv; struct host_if_drv *wfi_drv = priv->hif_drv; - u32 buf_len = len + sizeof(p2p_vendor_spec) + - sizeof(priv->p2p.local_random); int ret = 0; *cookie = prandom_u32(); @@ -1238,7 +1178,7 @@ static int mgmt_tx(struct wiphy *wiphy, goto out; } - mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL); + mgmt_tx->buff = kmalloc(len, GFP_KERNEL); if (!mgmt_tx->buff) { ret = -ENOMEM; kfree(mgmt_tx); @@ -1272,7 +1212,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) wilc_wfi_cfg_tx_vendor_spec(priv, mgmt_tx, params, vif->iftype, - buf_len); + len); else netdev_dbg(vif->ndev, "Not a P2P public action frame\n"); @@ -1400,10 +1340,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, struct wilc_vif *vif = netdev_priv(dev); struct wilc_priv *priv = &vif->priv; - priv->p2p.local_random = 0x01; - priv->p2p.recv_random = 0x00; - priv->p2p.is_wilc_ie = false; - switch (type) { case NL80211_IFTYPE_STATION: vif->connecting = false; diff --git a/drivers/staging/wilc1000/netdev.c b/drivers/staging/wilc1000/netdev.c index fce5bf2d82fa..045f5cdfdca0 100644 --- a/drivers/staging/wilc1000/netdev.c +++ b/drivers/staging/wilc1000/netdev.c @@ -577,7 +577,6 @@ static int wilc_mac_open(struct net_device *ndev) { struct wilc_vif *vif = netdev_priv(ndev); struct wilc *wl = vif->wilc; - struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr); unsigned char mac_add[ETH_ALEN] = {0}; int ret = 0; @@ -621,7 +620,6 @@ static int wilc_mac_open(struct net_device *ndev) vif->frame_reg[1].reg); netif_wake_queue(ndev); wl->open_ifcs++; - priv->p2p.local_random = 0x01; vif->mac_opened = 1; return 0; } diff --git a/drivers/staging/wilc1000/netdev.h b/drivers/staging/wilc1000/netdev.h index d5f7a6037fbc..c475e78e3a69 100644 --- a/drivers/staging/wilc1000/netdev.h +++ b/drivers/staging/wilc1000/netdev.h @@ -66,12 +66,6 @@ struct wilc_wfi_p2p_listen_params { u64 listen_cookie; }; -struct wilc_p2p_var { - u8 local_random; - u8 recv_random; - bool is_wilc_ie; -}; - static const u32 wilc_cipher_suites[] = { WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, @@ -155,7 +149,6 @@ struct wilc_priv { struct mutex scan_req_lock; bool p2p_listen_state; int scanned_cnt; - struct wilc_p2p_var p2p; u64 inc_roc_cookie; }; From patchwork Tue Feb 11 09:57:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 11375135 X-Patchwork-Delegate: johannes@sipsolutions.net 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 B409E139A for ; Tue, 11 Feb 2020 09:57:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88E4A2086A for ; Tue, 11 Feb 2020 09:57:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="DKsdt6zM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728126AbgBKJ5M (ORCPT ); Tue, 11 Feb 2020 04:57:12 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:61018 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbgBKJ5L (ORCPT ); Tue, 11 Feb 2020 04:57:11 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Ajay.Kathat@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Ajay.Kathat@microchip.com"; x-sender="Ajay.Kathat@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Ajay.Kathat@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Ajay.Kathat@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: oBZYQbpI6g9Iv7J1SGkfgbUwazEFQSu0lOS6CfhZQb9jeeXfkTEsBxQr/ZxtGMbRAOjfdHusMH 70Q+ZZMGU1aoW1/ZBGLwQLlnak/r7dP26x1IhOlCH7+q2b/u/Dl3MrIuiR2+CZGIRTs1nDrjOs s3wKxE6fiKQdq6KzvKd/nPpIA3nS+wb5TYHP0Qy8qMhP7gwARVFZgv5zpzL+hIYHkPcEI1BVuQ R0Au/y1cZcAddTUnq1BaeibdidSPgwO2aKHxyapVAen2tiyZ0+BFQQciMttKUpGiFTLbKhwy5X FMs= X-IronPort-AV: E=Sophos;i="5.70,428,1574146800"; d="scan'208";a="64951095" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Feb 2020 02:57:11 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 11 Feb 2020 02:57:10 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 11 Feb 2020 02:57:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVZ8b0AXtHedULaBIy0U6mEXWyQqEk66bITLwSArRhqFU449zJdVYi6loVQsi2Bjq2hp/IeYFWCJeOmDPSoYxCUy7rVr8wVBzkVwhiWdx0BBhDV6ypHXis5UJRJlMItmZ6AG7t/c8x7Vrx7gBdizpQUJDXbJYWdyTgZQHszrqnaaVlRnQr5UvQ2xgwFhPb+LPr/h7Y9ml994fRfgMKb7r1QvtJ76qWxmBc5tIyj1y0nd+jS2ePEghTQn7OC3ewcnOGOgjC7jppLVKO1WxVNi+rKIWqaMhx3kgBVxk9qTZZ4lKVE7n8cK9Hb8x3O2iwycshR+rNy5pZ0tLjk+tFjZbA== 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=sLttIJPt2yvWuWPKDmgXwiMVhVmZ8TePhqebF7LaFLY=; b=Y7Gzl7GMv8Li08HwQACmto5eU2a2bhEcutxlkZDv0dfES+X4lMAxbR1AgOKC/7o9/5/GvibrrH2kCPVtuHTBrJ9dg4K2HxYqcJCp86X4ofclySNonWwqVctoRVo4FdtFmXB3Yl6idOPVsM3N4/RakZGFE6sdWrh1cOXgoFrWYS5X+grm9G5Ne/FR7iew+/n2WhMqk3TvgTZ+2v9lK0KZGyxka3SLbXmQ9/VykmKENLMcnbbxwSVmPu3Y4yOMdCBeBcg79HNb6gI+olblNqM+o3tvVSai3tGkRO9btX0jkEXXZFHc3JOhSSGAXKjZqURIIfeHOn5ktKKiivVNXbRL6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sLttIJPt2yvWuWPKDmgXwiMVhVmZ8TePhqebF7LaFLY=; b=DKsdt6zM+SHBEBwqjZRja2feXK1EaDKyWyxUdn77UDcQ8VJvf6SsqqAm8X1caToMP0HyBfDnhSOeOSDkTL7cNSKVSEkBjuYBCwuQ3DvihJrCcszjMz9SfZwfe2CnQ8FdUo8A4FXlqhlVRq1PoECnGke53Ve8ja+4u8RG2/n7DeA= Received: from DM6PR11MB3996.namprd11.prod.outlook.com (20.176.125.206) by DM6PR11MB4345.namprd11.prod.outlook.com (52.132.251.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.28; Tue, 11 Feb 2020 09:57:09 +0000 Received: from DM6PR11MB3996.namprd11.prod.outlook.com ([fe80::75b4:bb0c:c245:4392]) by DM6PR11MB3996.namprd11.prod.outlook.com ([fe80::75b4:bb0c:c245:4392%5]) with mapi id 15.20.2707.030; Tue, 11 Feb 2020 09:57:09 +0000 From: To: CC: , , , , Subject: [PATCH v2 2/3] staging: wilc1000: directly fetch 'priv' handler from 'vif' instance Thread-Topic: [PATCH v2 2/3] staging: wilc1000: directly fetch 'priv' handler from 'vif' instance Thread-Index: AQHV4MGfRmCkk9Wg2kqH0Gz37eYVrw== Date: Tue, 11 Feb 2020 09:57:09 +0000 Message-ID: <20200211152802.6096-2-ajay.kathat@microchip.com> References: <20200211152802.6096-1-ajay.kathat@microchip.com> In-Reply-To: <20200211152802.6096-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-originating-ip: [121.244.27.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fb6d9332-b155-49d3-d80c-08d7aed8c284 x-ms-traffictypediagnostic: DM6PR11MB4345: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-forefront-prvs: 0310C78181 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(346002)(39860400002)(366004)(199004)(189003)(71200400001)(316002)(107886003)(6916009)(2616005)(36756003)(6486002)(4326008)(1076003)(6512007)(54906003)(6506007)(4744005)(5660300002)(66446008)(8936002)(186003)(26005)(86362001)(8676002)(81166006)(81156014)(64756008)(2906002)(66556008)(76116006)(91956017)(66476007)(478600001)(66946007);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR11MB4345;H:DM6PR11MB3996.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CffaL5owBvW+kF+xg1YNobfxmQib31JTckiL57FgNp49F3HkZ7nEaqo3c7NIRZwkFopRyAgtUgOL0Zh0Dd7stxhHUENPmEGuc/OJvg0waiq0BPRhdaDu8nxaO+/Yf74tEJrzDk4doam6eTLr074aGrj3kApWmUhNOZC4PQqgV8iN99QNO/hhwmw9qZZcQ8OkxPtpSfYFZ1x6dP/SPz1RCfU2GdF9upQE6OGxKyetovlVClTtwMso/8laoMHgJHn5jEZLivSOW6sTlx1lM5dibZtPtdphjZ3TJaxGO6sNAQ0g8Rhn1GrkcoSQHSX8JjNL3ibE9cWblUWKry9YC1+mGn7Mw+hSyyHpHpAOyUZRNmkn3/rd8H2iNqxCYznB7Z/k7y6xvTdDFNjBhyhCp85Nule5E6KVDhNYplL9kIcaX9uBYNFQUbjMioABaa1vaTd/ x-ms-exchange-antispam-messagedata: xy26EVs3I0yG8QdCHaO1oq0IEKq/hwbxaGMenGy1tei+MG9qbRkekzxERcSDLfw9Sc8VEOjBiJrIt93m8hKwjI7Xlux5vZ1sLt0NKVSH+UV2JxgBGBLyKB2Dt+BiAmHMC9cMAm2W6Tu+2H/cgqnD5Q== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: fb6d9332-b155-49d3-d80c-08d7aed8c284 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2020 09:57:09.4520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AMJ5mnDf4NcAQILJAvTWX8o89iqFmXygmf6qOoqsFbJWh/pu96TOrWknSHUivcjiAfCOrFWMbOmFfFAMm3k7CzY098HLMOYU4qiTngbkzpk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4345 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh The 'priv' handler is already present in 'vif' struct so directly fetch its value from vif handler in wilc_handle_roc_expired(). Signed-off-by: Ajay Singh --- v2: No change drivers/staging/wilc1000/hif.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/hif.c b/drivers/staging/wilc1000/hif.c index 658790bd465b..c8c41c2df4ec 100644 --- a/drivers/staging/wilc1000/hif.c +++ b/drivers/staging/wilc1000/hif.c @@ -861,9 +861,8 @@ static int wilc_handle_roc_expired(struct wilc_vif *vif, u64 cookie) struct wid wid; int result; struct host_if_drv *hif_drv = vif->hif_drv; - struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr); - if (priv->p2p_listen_state) { + if (vif->priv.p2p_listen_state) { remain_on_chan_flag = false; wid.id = WID_REMAIN_ON_CHAN; wid.type = WID_STR; From patchwork Tue Feb 11 09:57:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 11375137 X-Patchwork-Delegate: johannes@sipsolutions.net 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 1EA38186E for ; Tue, 11 Feb 2020 09:57:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC5EC2086A for ; Tue, 11 Feb 2020 09:57:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="Y0LP/CDD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728087AbgBKJ5O (ORCPT ); Tue, 11 Feb 2020 04:57:14 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:55200 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728128AbgBKJ5N (ORCPT ); Tue, 11 Feb 2020 04:57:13 -0500 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Ajay.Kathat@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Ajay.Kathat@microchip.com"; x-sender="Ajay.Kathat@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Ajay.Kathat@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; spf=Pass smtp.mailfrom=Ajay.Kathat@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: f47VGBtrxBJpS4suX/jX5rLeNpgbkCya6DjfPYFApVg45nj+lJ3e1OQxF3AL7OJKdFm6TRizAD NucnGBXgpsuiNC9llfov3XZLMqjKn0SfhEK7cZStA8d/7IZoESSHS7Oqhf559vjryPO+nfOAjM HxF3lgBYPTmt/fEulNVorx5qDuR3AkrNGy9U7g6dQfD+qDESWHiDENTdZZOhMknyXa1RBylgpC L6Mk9B2OuaCkJayPk4+LxfKV9nNXDaGeisGJRbDfJ3tyOSrDZm+Y8j3GuvjlRZG3cOw0ug/1XF RJs= X-IronPort-AV: E=Sophos;i="5.70,428,1574146800"; d="scan'208";a="1964613" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Feb 2020 02:57:12 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 11 Feb 2020 02:57:12 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 11 Feb 2020 02:57:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XL7bOZv0qb/ylp1uWYETOOcbHVVXz2k17uE5N4FjdW366Sa6SaetZ/aZ/IhmN7NNbYDjVoP4m3esXaQ2fJxUvqq+VykMHqgbikT6ZRiFrLMwTcqMFxKNHTY8I35efdTJ946bYq6a1gjjVli4O1DccQ1Ex0RAlxxoXEclI8fIc0ByXOEmg9Yab0N31kBB5n1t+dVsKGN3mp3q6UNjMKOC3J/LCdnryQmU7AVmZwu4y9fZMfWE7hdPrvEqVpxjXU2PIYM70fDWOE0is4vW7tsQf9DXhn0d1Qfgzo09m/ZU9hFy9BKMEzzfmPFqJOTYimyQ5otGJro99JvzHRDvaYQxrg== 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=LenVVEMGP3o9j/SgaxFIL56IpHLQuIgaq05K+9KpRXg=; b=CQJXtdWYisgaJpxz5nC5p4H5rWzcYkgooY8/EOn7XmOdSmODpMCgkd7miuUeFBDQP1Dvivkwej3lQuI7BH9+cMrSdyqS6/KENm/H6tKGDw0j0lX8MWe16FaLdSOXLy7qdM2acNOO2C5u4w08MVupdhO2rliXpo+Qwcest4XUAg9pS277kBbW3XPdXg5WnjOIlKdzphVz5crWpz59/QdGCclr2mz1N7+FQBbsZ5s0Iy+LGNOa3b7PcgC9/dpuwfJS8cWW6yEL6NGc8sSlo1zwsrh0tQIj62uidJEZ4tgtpx+BfIOISbKLmQVSWuvEvVtpX8RMGh8XlJDF0IRBXj6r9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LenVVEMGP3o9j/SgaxFIL56IpHLQuIgaq05K+9KpRXg=; b=Y0LP/CDD8dghUwSmiskt3b0S+KmJgaGKUE7jXwZLEqlCWTD8JuTsU03aBEUZXTamfeDhw4j1STRtbZRQvU+VHbdPlrw2/H4N5/yukGB6lTJrH0HKq56AaZoiM5q8e2d1hUSseHIgGFMWeZ85N20q2hn0A0lT8uiHlpBwJEGx4QU= Received: from DM6PR11MB3996.namprd11.prod.outlook.com (20.176.125.206) by DM6PR11MB4345.namprd11.prod.outlook.com (52.132.251.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.28; Tue, 11 Feb 2020 09:57:10 +0000 Received: from DM6PR11MB3996.namprd11.prod.outlook.com ([fe80::75b4:bb0c:c245:4392]) by DM6PR11MB3996.namprd11.prod.outlook.com ([fe80::75b4:bb0c:c245:4392%5]) with mapi id 15.20.2707.030; Tue, 11 Feb 2020 09:57:10 +0000 From: To: CC: , , , , Subject: [PATCH v2 3/3] staging: wilc1000: refactor p2p action frames handling API's Thread-Topic: [PATCH v2 3/3] staging: wilc1000: refactor p2p action frames handling API's Thread-Index: AQHV4MGgpY9wAVPMCES4mYM6Bflaaw== Date: Tue, 11 Feb 2020 09:57:10 +0000 Message-ID: <20200211152802.6096-3-ajay.kathat@microchip.com> References: <20200211152802.6096-1-ajay.kathat@microchip.com> In-Reply-To: <20200211152802.6096-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-originating-ip: [121.244.27.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4b0b6267-e275-4eed-b87f-08d7aed8c349 x-ms-traffictypediagnostic: DM6PR11MB4345: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:107; x-forefront-prvs: 0310C78181 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(346002)(39860400002)(366004)(199004)(189003)(71200400001)(316002)(107886003)(6916009)(2616005)(36756003)(6486002)(4326008)(1076003)(6512007)(54906003)(6506007)(30864003)(5660300002)(66446008)(8936002)(186003)(26005)(86362001)(8676002)(81166006)(81156014)(64756008)(2906002)(66556008)(76116006)(91956017)(66476007)(478600001)(66946007);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR11MB4345;H:DM6PR11MB3996.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: e312NgztwEhSVDYinf/+AC4ZPFmklhUQC+ZvUzpMK6M9jkqXsdVNh9uZ2RNle8C9tTvhOHbHIdd6LOqohHVShEagE6UxnjUW8UfM5ybFFsoyPv0fU0ZW992SnRvrEBq0txMSVGbViQCTU2oYTCC+898m/B1sCxn7SvWpRPAzVyXy3/5r1zL6YFiQfkETrFL2Gbb0VMoX5qB791L1FrmzA5E1Yt1YVBtWZUFncbxLMeYFLpeKAMcxLl/Q6Amz0YU/TwyxOAGbldDUFzfk65ZPSY5cN9tZdpRvoK5cpaXAOO9U4kVXWFQ4EgllK66QEJuGoY64LukGDLs07a38G4JOAz8kLPvJZ6C9/YeudRlg8TftZTg1Cy9dccLyl1yRHhI8pHgL5OZU/YToGyjExEO2no4Ccx6NRRqRvWjsqqrm1w55TB4hL79ejjithrbzewZp x-ms-exchange-antispam-messagedata: MhsZZsPdk5sDlvqqpEMMIbN91jEyF4mvXTWBy95OyUiF5+cn9rn5vCrSv3DSz6C0HDYlg5AV5wL1REkCh/BCtg8ySfrd9jx8LMTogJqlhLH0MUV+8L7JLjUwrqrlfYmGhApPyJl+r6STZVS4Y+T12A== Content-ID: <6E1DD813305BE24ABA02021C71334604@namprd11.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4b0b6267-e275-4eed-b87f-08d7aed8c349 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2020 09:57:10.7482 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZgYoOOjvFG7zlbpwSHYZ3UxSn2h+MO2vJaR+i4GUQMGQkOfZ6ZO1vy9tIKQ6nyXDj/jTwjkcdPX/A/Jfslf0tUNccj5YjHkHZoJ8nEWvS4c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4345 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Refactor handling of P2P specific action frames. Make use of 'struct' to handle the P2P frames instead of manipulating using 'buf' pointer. Signed-off-by: Ajay Singh --- v2: corrected 'while' condition by adding 'struct' size as suggested by Dan. drivers/staging/wilc1000/cfg80211.c | 300 ++++++++++++---------------- 1 file changed, 128 insertions(+), 172 deletions(-) diff --git a/drivers/staging/wilc1000/cfg80211.c b/drivers/staging/wilc1000/cfg80211.c index 7afbc475b3ea..d9c7bed2e6fb 100644 --- a/drivers/staging/wilc1000/cfg80211.c +++ b/drivers/staging/wilc1000/cfg80211.c @@ -6,29 +6,17 @@ #include "cfg80211.h" -#define FRAME_TYPE_ID 0 -#define ACTION_CAT_ID 24 -#define ACTION_SUBTYPE_ID 25 -#define P2P_PUB_ACTION_SUBTYPE 30 - -#define ACTION_FRAME 0xd0 -#define GO_INTENT_ATTR_ID 0x04 -#define CHANLIST_ATTR_ID 0x0b -#define OPERCHAN_ATTR_ID 0x11 -#define PUB_ACTION_ATTR_ID 0x04 -#define P2PELEM_ATTR_ID 0xdd - #define GO_NEG_REQ 0x00 #define GO_NEG_RSP 0x01 #define GO_NEG_CONF 0x02 #define P2P_INV_REQ 0x03 #define P2P_INV_RSP 0x04 -#define PUBLIC_ACT_VENDORSPEC 0x09 -#define GAS_INITIAL_REQ 0x0a -#define GAS_INITIAL_RSP 0x0b #define WILC_INVALID_CHANNEL 0 +/* Operation at 2.4 GHz with channels 1-13 */ +#define WILC_WLAN_OPERATING_CLASS_2_4GHZ 0x51 + static const struct ieee80211_txrx_stypes wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = { [NL80211_IFTYPE_STATION] = { @@ -67,7 +55,50 @@ struct wilc_p2p_mgmt_data { u8 *buff; }; -static const u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; +struct wilc_p2p_pub_act_frame { + u8 category; + u8 action; + u8 oui[3]; + u8 oui_type; + u8 oui_subtype; + u8 dialog_token; + u8 elem[0]; +} __packed; + +struct wilc_vendor_specific_ie { + u8 tag_number; + u8 tag_len; + u8 oui[3]; + u8 oui_type; + u8 attr[0]; +} __packed; + +struct wilc_attr_entry { + u8 attr_type; + __le16 attr_len; + u8 val[0]; +} __packed; + +struct wilc_attr_oper_ch { + u8 attr_type; + __le16 attr_len; + u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; + u8 op_class; + u8 op_channel; +} __packed; + +struct wilc_attr_ch_list { + u8 attr_type; + __le16 attr_len; + u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; + u8 elem[0]; +} __packed; + +struct wilc_ch_list_elem { + u8 op_class; + u8 no_of_channels; + u8 ch_list[0]; +} __packed; static void cfg_scan_result(enum scan_event scan_event, struct wilc_rcvd_net_info *info, void *user_void) @@ -896,87 +927,51 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) return 0; } -static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx, - u8 op_ch_attr_idx, u8 sta_ch) +static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u32 len, u8 sta_ch) { - int i = 0; - int j = 0; - - if (ch_list_attr_idx) { - u8 limit = ch_list_attr_idx + 3 + buf[ch_list_attr_idx + 1]; + struct wilc_attr_entry *e; + struct wilc_attr_ch_list *ch_list; + struct wilc_attr_oper_ch *op_ch; + u32 index = 0; + u8 ch_list_idx = 0; + u8 op_ch_idx = 0; - for (i = ch_list_attr_idx + 3; i < limit; i++) { - if (buf[i] == 0x51) { - for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) - buf[j] = sta_ch; - break; - } - } - } + if (sta_ch == WILC_INVALID_CHANNEL) + return; - if (op_ch_attr_idx) { - buf[op_ch_attr_idx + 6] = 0x51; - buf[op_ch_attr_idx + 7] = sta_ch; + while (index + sizeof(*e) <= len) { + e = (struct wilc_attr_entry *)&buf[index]; + if (e->attr_type == IEEE80211_P2P_ATTR_CHANNEL_LIST) + ch_list_idx = index; + else if (e->attr_type == IEEE80211_P2P_ATTR_OPER_CHANNEL) + op_ch_idx = index; + if (ch_list_idx && op_ch_idx) + break; + index += le16_to_cpu(e->attr_len) + sizeof(*e); } -} -static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len, u8 sta_ch) -{ - u32 index = 0; - u8 op_channel_attr_index = 0; - u8 channel_list_attr_index = 0; - - while (index < len) { - if (buf[index] == CHANLIST_ATTR_ID) - channel_list_attr_index = index; - else if (buf[index] == OPERCHAN_ATTR_ID) - op_channel_attr_index = index; - index += buf[index + 1] + 3; - } - if (sta_ch != WILC_INVALID_CHANNEL) - wilc_wfi_cfg_parse_ch_attr(buf, channel_list_attr_index, - op_channel_attr_index, sta_ch); -} + if (ch_list_idx) { + u16 attr_size; + struct wilc_ch_list_elem *e; + int i; -static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, - u8 iftype, u8 sta_ch) -{ - u32 index = 0; - u8 op_channel_attr_index = 0; - u8 channel_list_attr_index = 0; - - while (index < len) { - if (buf[index] == CHANLIST_ATTR_ID) - channel_list_attr_index = index; - else if (buf[index] == OPERCHAN_ATTR_ID) - op_channel_attr_index = index; - index += buf[index + 1] + 3; - } - if (sta_ch != WILC_INVALID_CHANNEL && oper_ch) - wilc_wfi_cfg_parse_ch_attr(buf, channel_list_attr_index, - op_channel_attr_index, sta_ch); -} - -static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff, - u32 size) -{ - int i; - u8 subtype; - struct wilc_vif *vif = netdev_priv(priv->dev); - - subtype = buff[P2P_PUB_ACTION_SUBTYPE]; - if (subtype == GO_NEG_REQ || subtype == GO_NEG_RSP || - subtype == P2P_INV_REQ || subtype == P2P_INV_RSP) { - for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { - if (buff[i] == P2PELEM_ATTR_ID && - !(memcmp(p2p_oui, &buff[i + 2], 4))) { - wilc_wfi_cfg_parse_rx_action(&buff[i + 6], - size - (i + 6), - vif->wilc->sta_ch); + ch_list = (struct wilc_attr_ch_list *)&buf[ch_list_idx]; + attr_size = le16_to_cpu(ch_list->attr_len); + for (i = 0; i < attr_size;) { + e = (struct wilc_ch_list_elem *)(ch_list->elem + i); + if (e->op_class == WILC_WLAN_OPERATING_CLASS_2_4GHZ) { + memset(e->ch_list, sta_ch, e->no_of_channels); break; } + i += e->no_of_channels; } } + + if (op_ch_idx) { + op_ch = (struct wilc_attr_oper_ch *)&buf[op_ch_idx]; + op_ch->op_class = WILC_WLAN_OPERATING_CLASS_2_4GHZ; + op_ch->op_channel = sta_ch; + } } void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) @@ -984,17 +979,22 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) struct wilc *wl = vif->wilc; struct wilc_priv *priv = &vif->priv; struct host_if_drv *wfi_drv = priv->hif_drv; + struct ieee80211_mgmt *mgmt; + struct wilc_vendor_specific_ie *p; + struct wilc_p2p_pub_act_frame *d; + int ie_offset = offsetof(struct ieee80211_mgmt, u) + sizeof(*d); + const u8 *vendor_ie; u32 header, pkt_offset; s32 freq; - __le16 fc; header = get_unaligned_le32(buff - HOST_HDR_OFFSET); pkt_offset = GET_PKT_OFFSET(header); if (pkt_offset & IS_MANAGMEMENT_CALLBACK) { bool ack = false; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)buff; - if (buff[FRAME_TYPE_ID] == IEEE80211_STYPE_PROBE_RESP || + if (ieee80211_is_probe_resp(hdr->frame_control) || pkt_offset & IS_MGMT_STATUS_SUCCES) ack = true; @@ -1005,38 +1005,33 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) freq = ieee80211_channel_to_frequency(wl->op_ch, NL80211_BAND_2GHZ); - fc = ((struct ieee80211_hdr *)buff)->frame_control; - if (!ieee80211_is_action(fc)) { - cfg80211_rx_mgmt(&priv->wdev, freq, 0, buff, size, 0); - return; - } + mgmt = (struct ieee80211_mgmt *)buff; + if (!ieee80211_is_action(mgmt->frame_control)) + goto out_rx_mgmt; if (priv->cfg_scanning && time_after_eq(jiffies, (unsigned long)wfi_drv->p2p_timeout)) { netdev_dbg(vif->ndev, "Receiving action wrong ch\n"); return; } - if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { - switch (buff[ACTION_SUBTYPE_ID]) { - case GAS_INITIAL_REQ: - case GAS_INITIAL_RSP: - break; - case PUBLIC_ACT_VENDORSPEC: - if (!memcmp(p2p_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) - wilc_wfi_cfg_parse_rx_vendor_spec(priv, buff, - size); + if (!ieee80211_is_public_action((struct ieee80211_hdr *)buff, size)) + goto out_rx_mgmt; - break; + d = (struct wilc_p2p_pub_act_frame *)(&mgmt->u.action); + if (d->oui_subtype != GO_NEG_REQ && d->oui_subtype != GO_NEG_RSP && + d->oui_subtype != P2P_INV_REQ && d->oui_subtype != P2P_INV_RSP) + goto out_rx_mgmt; - default: - netdev_dbg(vif->ndev, - "%s: Not handled action frame type:%x\n", - __func__, buff[ACTION_SUBTYPE_ID]); - break; - } - } + vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P, + buff + ie_offset, size - ie_offset); + if (!vendor_ie) + goto out_rx_mgmt; + + p = (struct wilc_vendor_specific_ie *)vendor_ie; + wilc_wfi_cfg_parse_ch_attr(p->attr, p->tag_len - 4, vif->wilc->sta_ch); +out_rx_mgmt: cfg80211_rx_mgmt(&priv->wdev, freq, 0, buff, size, 0); } @@ -1116,39 +1111,6 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, return wilc_listen_state_expired(vif, cookie); } -static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, - struct wilc_p2p_mgmt_data *mgmt_tx, - struct cfg80211_mgmt_tx_params *params, - u8 iftype, u32 buf_len) -{ - const u8 *buf = params->buf; - size_t len = params->len; - u32 i; - u8 subtype = buf[P2P_PUB_ACTION_SUBTYPE]; - struct wilc_vif *vif = netdev_priv(priv->dev); - - if (subtype != GO_NEG_REQ && subtype != GO_NEG_RSP && - subtype != P2P_INV_REQ && subtype != P2P_INV_RSP) - return; - - for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { - if (buf[i] == P2PELEM_ATTR_ID && - !memcmp(p2p_oui, &buf[i + 2], 4)) { - bool oper_ch = false; - u8 *tx_buff = &mgmt_tx->buff[i + 6]; - - if (subtype == P2P_INV_REQ || subtype == P2P_INV_RSP) - oper_ch = true; - - wilc_wfi_cfg_parse_tx_action(tx_buff, len - (i + 6), - oper_ch, iftype, - vif->wilc->sta_ch); - - break; - } - } -} - static int mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_mgmt_tx_params *params, @@ -1163,6 +1125,10 @@ static int mgmt_tx(struct wiphy *wiphy, struct wilc_vif *vif = netdev_priv(wdev->netdev); struct wilc_priv *priv = &vif->priv; struct host_if_drv *wfi_drv = priv->hif_drv; + struct wilc_vendor_specific_ie *p; + struct wilc_p2p_pub_act_frame *d; + int ie_offset = offsetof(struct ieee80211_mgmt, u) + sizeof(*d); + const u8 *vendor_ie; int ret = 0; *cookie = prandom_u32(); @@ -1194,39 +1160,29 @@ static int mgmt_tx(struct wiphy *wiphy, goto out_txq_add_pkt; } - if (!ieee80211_is_action(mgmt->frame_control)) - goto out_txq_add_pkt; + if (!ieee80211_is_public_action((struct ieee80211_hdr *)buf, len)) + goto out_set_timeout; - if (buf[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { - if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || - buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { - wilc_set_mac_chnl_num(vif, chan->hw_value); - vif->wilc->op_ch = chan->hw_value; - } - switch (buf[ACTION_SUBTYPE_ID]) { - case GAS_INITIAL_REQ: - case GAS_INITIAL_RSP: - break; + d = (struct wilc_p2p_pub_act_frame *)(&mgmt->u.action); + if (d->oui_type != WLAN_OUI_TYPE_WFA_P2P || + d->oui_subtype != GO_NEG_CONF) { + wilc_set_mac_chnl_num(vif, chan->hw_value); + vif->wilc->op_ch = chan->hw_value; + } - case PUBLIC_ACT_VENDORSPEC: - if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) - wilc_wfi_cfg_tx_vendor_spec(priv, mgmt_tx, - params, vif->iftype, - len); - else - netdev_dbg(vif->ndev, - "Not a P2P public action frame\n"); + if (d->oui_subtype != P2P_INV_REQ && d->oui_subtype != P2P_INV_RSP) + goto out_set_timeout; - break; + vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P, + mgmt_tx->buff + ie_offset, + len - ie_offset); + if (!vendor_ie) + goto out_set_timeout; - default: - netdev_dbg(vif->ndev, - "%s: Not handled action frame type:%x\n", - __func__, buf[ACTION_SUBTYPE_ID]); - break; - } - } + p = (struct wilc_vendor_specific_ie *)vendor_ie; + wilc_wfi_cfg_parse_ch_attr(p->attr, p->tag_len - 4, vif->wilc->sta_ch); +out_set_timeout: wfi_drv->p2p_timeout = (jiffies + msecs_to_jiffies(wait)); out_txq_add_pkt: