From patchwork Thu Feb 25 00:08:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 8415111 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D60F59F372 for ; Thu, 25 Feb 2016 00:09:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED3D5202EC for ; Thu, 25 Feb 2016 00:09:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDABF202E6 for ; Thu, 25 Feb 2016 00:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758308AbcBYAJJ (ORCPT ); Wed, 24 Feb 2016 19:09:09 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34169 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756664AbcBYAJH (ORCPT ); Wed, 24 Feb 2016 19:09:07 -0500 Received: by mail-wm0-f49.google.com with SMTP id b205so10857035wmb.1 for ; Wed, 24 Feb 2016 16:09:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fOK19AkvBSAFsIXDLOC5hxiPDlXPsiQF3G+q4cLebUg=; b=v/Y3Dm6LQ4GA/g4iWy0zLOhxn/DTbsiRJIMc8pZ46oR1d/kVE72Mjd2dyGvwlSXIJl cL8EYC4wIbyVD5IiPTzq9S2IPHc1hgmYoa7kjkQJfWzEJrp2ktMyw0MWVPECMGdT+VSZ q7AGJ6Z6rcWdxGo6jdrBeKrvqQ0sKB/pVPukzxLv7MgbP3mHcq1jP0RXe6MueSdsnRvN dp7onk3zCknGT/rjG2QDCWW15rX2K+6zTYDv4m2JpOI4l1VEy/hb07b345XDMfXqjd2k 40AjzCxGUq8QNEGkeTruBFLrCv6t+4K0jQxt6MnGyrJuaxzyCxwG5XELY6OgzfCppbn0 FvfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fOK19AkvBSAFsIXDLOC5hxiPDlXPsiQF3G+q4cLebUg=; b=BzUnH2Wn33I0Or0QBarH7dqmHQxkVSskhvrM+uEg+qJkWET/zaeVKqLBXnCH2CSK7L TprfsKD6j93vo6sG1s0Y/s3UaAsZond/mg5A58X9uYlKiyrOBIWJi09v2LqYD9IXdNDB bfybuNUfxjt1PhJmveJyU9BASSPEipEMhSz1Yl80gjxgV5tBjuLrvL3d6ldEOfIz2EZm 28OHgoBMhN/WiQdsL9WBgaGefh3jKSgIlMeqVdydXPasIjlUePUpYPs0uTLJ56aOqelN VzCtSncQTlWjnHceNfQRRhUTNfiCpm4NT6zGKn+pR7eJrG/2ADgSs1joG+K9g4tuhpj1 IB2Q== X-Gm-Message-State: AG10YORbWyDCjLxcRrtL9zcudQE32bebSu03sH7kVqHkdKablAT+KGjblaeE2XVtJd6Plg== X-Received: by 10.28.189.212 with SMTP id n203mr279077wmf.50.1456358945354; Wed, 24 Feb 2016 16:09:05 -0800 (PST) Received: from localhost (b195.sivinet.vp.cust.gts.sk. [85.248.57.195]) by smtp.gmail.com with ESMTPSA id g1sm1082164wmc.0.2016.02.24.16.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Feb 2016 16:09:04 -0800 (PST) From: Andreas Fenkart To: linux-wireless@vger.kernel.org Cc: Amitkumar Karwar , Nishant Sarmukadam , Kalle Valo , Andreas Fenkart Subject: [PATCH 4/7] mwifiex: scan: factor out dbg_security_flags Date: Thu, 25 Feb 2016 01:08:49 +0100 Message-Id: <1456358932-23114-5-git-send-email-afenkart@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456358932-23114-1-git-send-email-afenkart@gmail.com> References: <1456358932-23114-1-git-send-email-afenkart@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP merge copy/paste code Signed-off-by: Andreas Fenkart --- drivers/net/wireless/marvell/mwifiex/scan.c | 73 ++++++++++------------------- 1 file changed, 24 insertions(+), 49 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c index f612c1b..5588750 100644 --- a/drivers/net/wireless/marvell/mwifiex/scan.c +++ b/drivers/net/wireless/marvell/mwifiex/scan.c @@ -76,6 +76,26 @@ static u8 mwifiex_rsn_oui[CIPHER_SUITE_MAX][4] = { { 0x00, 0x0f, 0xac, 0x04 }, /* AES */ }; +static void +_dbg_security_flags(int log_level, struct mwifiex_private *priv, + struct mwifiex_bssdescriptor *bss_desc) +{ + _mwifiex_dbg(priv->adapter, log_level, + "info: %s: WPA:\twpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\tEncMode=%#x privacy=%#x\n", + __func__, + bss_desc->bcn_wpa_ie ? + bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0, + bss_desc->bcn_rsn_ie ? + bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0, + priv->sec_info.wep_enabled ? "e" : "d", + priv->sec_info.wpa_enabled ? "e" : "d", + priv->sec_info.wpa2_enabled ? "e" : "d", + priv->sec_info.encryption_mode, + bss_desc->privacy); +} +#define dbg_security_flags(mask, priv, bss_desc) \ + _dbg_security_flags(MWIFIEX_DBG_##mask, priv, bss_desc) + static bool has_ieee_hdr(struct ieee_types_generic *ie, u8 key) { @@ -243,19 +263,7 @@ mwifiex_is_bss_wpa(struct mwifiex_private *priv, * LinkSys WRT54G && bss_desc->privacy */ ) { - mwifiex_dbg(priv->adapter, INFO, - "info: %s: WPA:\t" - "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t" - "EncMode=%#x privacy=%#x\n", __func__, - bss_desc->bcn_wpa_ie ? - bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0, - bss_desc->bcn_rsn_ie ? - bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0, - (priv->sec_info.wep_enabled) ? "e" : "d", - (priv->sec_info.wpa_enabled) ? "e" : "d", - (priv->sec_info.wpa2_enabled) ? "e" : "d", - priv->sec_info.encryption_mode, - bss_desc->privacy); + dbg_security_flags(INFO, priv, bss_desc); return true; } return false; @@ -276,19 +284,7 @@ mwifiex_is_bss_wpa2(struct mwifiex_private *priv, * Privacy bit may NOT be set in some APs like * LinkSys WRT54G && bss_desc->privacy */ - mwifiex_dbg(priv->adapter, INFO, - "info: %s: WPA2:\t" - "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t" - "EncMode=%#x privacy=%#x\n", __func__, - bss_desc->bcn_wpa_ie ? - bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0, - bss_desc->bcn_rsn_ie ? - bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0, - (priv->sec_info.wep_enabled) ? "e" : "d", - (priv->sec_info.wpa_enabled) ? "e" : "d", - (priv->sec_info.wpa2_enabled) ? "e" : "d", - priv->sec_info.encryption_mode, - bss_desc->privacy); + dbg_security_flags(INFO, priv, bss_desc); return true; } return false; @@ -325,17 +321,7 @@ mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv, !has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC) && !has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN) && priv->sec_info.encryption_mode && bss_desc->privacy) { - mwifiex_dbg(priv->adapter, INFO, - "info: %s: dynamic\t" - "WEP: wpa_ie=%#x wpa2_ie=%#x\t" - "EncMode=%#x privacy=%#x\n", - __func__, - bss_desc->bcn_wpa_ie ? - bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0, - bss_desc->bcn_rsn_ie ? - bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0, - priv->sec_info.encryption_mode, - bss_desc->privacy); + dbg_security_flags(INFO, priv, bss_desc); return true; } return false; @@ -448,18 +434,7 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv, } /* Security doesn't match */ - mwifiex_dbg(adapter, ERROR, - "info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s\t" - "WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n", - __func__, - bss_desc->bcn_wpa_ie ? - bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0, - bss_desc->bcn_rsn_ie ? - bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0, - (priv->sec_info.wep_enabled) ? "e" : "d", - (priv->sec_info.wpa_enabled) ? "e" : "d", - (priv->sec_info.wpa2_enabled) ? "e" : "d", - priv->sec_info.encryption_mode, bss_desc->privacy); + dbg_security_flags(ERROR, priv, bss_desc); return -1; }