Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1418594

Re: [PATCH] brcmfmac: slightly simplify building interface combinations

Path csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Arend van Spriel <arend.vanspriel@broadcom.com>
Newsgroups linux.kernel
Subject Re: [PATCH] brcmfmac: slightly simplify building interface combinations
Date Thu, 09 Jun 2016 21:00:02 +0200
Message-ID <rIdlo-1OU-19@gated-at.bofh.it> (permalink)
References <rHuHE-6FD-9@gated-at.bofh.it>
X-Original-To Rafał Miłecki <zajec5@gmail.com>, Kalle Valo <kvalo@codeaurora.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=z19cchmU+o6rMxr7CWwKB88F3WXWeLtJyB3fiO+T33M=; b=ZSrw890szF3Xg+gVWE3fEvp8MD3LB4fz3Y97JNf5QoN1OYqDG6T5uIwtbXHvuenv9u J6JlyWTv+JBC6QYjwT630G6eh0BC9ksIGV6jopazv9mBY4k/y/nhOkonHChr13S8h+c3 IkZ9u2ConOlwyKBmKkhVpT7etIdObxmWZ0slI=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=z19cchmU+o6rMxr7CWwKB88F3WXWeLtJyB3fiO+T33M=; b=RC32xzKV80ks6ug5MIe+iM8dka6d6ui8XvXAjEw6G61VlAI4RfwxI0lNuvGW+4xHg5 ezqzr/tG7/ZAVpjnEfBBhocjP5NiFie655AxfGrbOPEWhyybhPPGYT8OvIjVUPmfMKau 8I8gPyMHURRu34Fwo2UZQLb99MMiydHGMt8f2MvkG9OgoPWyQdRBGQDoL/VMN8+2rqd4 DWT/2SMI+9rkXGTxUqIJFcvu4+jChXds4YxzqeLMUpj/7MyzYtp2ukYr1lBZa+lqqxCb B2uXeXliupJqJ/paQshSf7+dM9iaakIXPJ3yeFfHDplZRpT2JxfburcsuTTbUQ6/g8vC ArBw==
X-Gm-Message-State ALyK8tIVp17intsFFmh+Gzo+hMz/LUKJD5vHtrY8O6ynscAt2N8T306fk3NKSpGdcQCLjBUE
X-Received by 10.28.144.203 with SMTP id s194mr12100396wmd.12.1465498614538; Thu, 09 Jun 2016 11:56:54 -0700 (PDT)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 106
Organization linux.* mail to news gateway
X-Original-Cc Brett Rudley <brudley@broadcom.com>, Arend van Spriel <arend@broadcom.com>, "Franky (Zhenhui) Lin" <frankyl@broadcom.com>, Hante Meuleman <meuleman@broadcom.com>, Pieter-Paul Giesberts <pieterpg@broadcom.com>, "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" <linux-wireless@vger.kernel.org>, "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" <brcm80211-dev-list@broadcom.com>, "open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>, open list <linux-kernel@vger.kernel.org>
X-Original-Date Thu, 9 Jun 2016 20:56:52 +0200
X-Original-Message-ID <5759BBF4.1080807@broadcom.com>
X-Original-References <1465326626-365-1-git-send-email-zajec5@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1418594

Show key headers only | View raw


On 07-06-16 21:10, Rafał Miłecki wrote:
> This change reorders some operations in brcmf_setup_ifmodes in hope to
> make it simpler:
> 1) It allocates arrays right before filling them. This way it's easier
>    to follow requested array length as it's immediately followed by
>    code filling it. It's easier to check e.g. why we need 4 entries for
>    P2P. Other than that it deduplicates some checks (e.g. for P2P).
> 2) It reorders code to first prepare limits and then define a new combo.
>    Previously this was mixed (e.g. we were setting num of channels
>    before preparing limits).
> 3) It modifies mbss code to use i variable just like other combos do.

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  .../broadcom/brcm80211/brcmfmac/cfg80211.c         | 37 ++++++++++------------
>  1 file changed, 16 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> index 4894eb7..33e682e 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -6300,29 +6300,15 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
>  	if (!combo)
>  		goto err;
>  
> -	c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
> -	if (!c0_limits)
> -		goto err;
> -
> -	if (p2p) {
> -		p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
> -		if (!p2p_limits)
> -			goto err;
> -	}
> -
> -	if (mbss) {
> -		mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
> -		if (!mbss_limits)
> -			goto err;
> -	}
> -
>  	wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
>  				 BIT(NL80211_IFTYPE_ADHOC) |
>  				 BIT(NL80211_IFTYPE_AP);
>  
>  	c = 0;
>  	i = 0;
> -	combo[c].num_different_channels = 1;
> +	c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
> +	if (!c0_limits)
> +		goto err;
>  	c0_limits[i].max = 1;
>  	c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
>  	if (p2p) {
> @@ -6340,6 +6326,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
>  		c0_limits[i].max = 1;
>  		c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
>  	}
> +	combo[c].num_different_channels = 1;
>  	combo[c].max_interfaces = i;
>  	combo[c].n_limits = i;
>  	combo[c].limits = c0_limits;
> @@ -6347,7 +6334,9 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
>  	if (p2p) {
>  		c++;
>  		i = 0;
> -		combo[c].num_different_channels = 1;
> +		p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
> +		if (!p2p_limits)
> +			goto err;
>  		p2p_limits[i].max = 1;
>  		p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
>  		p2p_limits[i].max = 1;
> @@ -6356,6 +6345,7 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
>  		p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
>  		p2p_limits[i].max = 1;
>  		p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
> +		combo[c].num_different_channels = 1;
>  		combo[c].max_interfaces = i;
>  		combo[c].n_limits = i;
>  		combo[c].limits = p2p_limits;
> @@ -6363,14 +6353,19 @@ static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
>  
>  	if (mbss) {
>  		c++;
> +		i = 0;
> +		mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
> +		if (!mbss_limits)
> +			goto err;
> +		mbss_limits[i].max = 4;
> +		mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
>  		combo[c].beacon_int_infra_match = true;
>  		combo[c].num_different_channels = 1;
> -		mbss_limits[0].max = 4;
> -		mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
>  		combo[c].max_interfaces = 4;
> -		combo[c].n_limits = 1;
> +		combo[c].n_limits = i;
>  		combo[c].limits = mbss_limits;
>  	}
> +
>  	wiphy->n_iface_combinations = n_combos;
>  	wiphy->iface_combinations = combo;
>  	return 0;
> 

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] brcmfmac: slightly simplify building interface combinations Rafał Miłecki <zajec5@gmail.com> - 2016-06-07 21:20 +0200
  Re: [PATCH] brcmfmac: slightly simplify building interface  combinations Arend van Spriel <arend.vanspriel@broadcom.com> - 2016-06-09 21:00 +0200

csiph-web