From: Johannes Berg <johannes@sipsolutions.net>
To: Alina Friedrichsen <x-alina@gmx.net>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com
Subject: Re: [PATCH v2] mac80211: Introduce a generic commit() to apply changes
Date: Mon, 23 Feb 2009 17:44:50 -0800 [thread overview]
Message-ID: <1235439890.4455.37.camel@johannes.local> (raw)
In-Reply-To: <20090221002729.65900@gmx.net> (sfid-20090221_012801_080762_FF735B4B)
[-- Attachment #1: Type: text/plain, Size: 5182 bytes --]
On Sat, 2009-02-21 at 01:27 +0100, Alina Friedrichsen wrote:
> This patch introduces a generic commit() function which initiate a new
> network joining process. It should be called after some interface
> config changes, so that the changes get applied more cleanly.
> Currently set_ssid() and set_bssid() call it. Others can be added in
> future patches.
Seems fine to me.
johannes
> In version 1 the header files was forgotten, sorry.
>
> Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
> ---
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index 1bbfc70..aa8937c 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -788,6 +788,23 @@ void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata)
> IEEE80211_IBSS_AUTO_CHANNEL_SEL;
> }
>
> +int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata)
> +{
> + struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
> +
> + ifibss->flags &= ~IEEE80211_IBSS_PREV_BSSID_SET;
> +
> + if (ifibss->ssid_len)
> + ifibss->flags |= IEEE80211_IBSS_SSID_SET;
> + else
> + ifibss->flags &= ~IEEE80211_IBSS_SSID_SET;
> +
> + ifibss->ibss_join_req = jiffies;
> + ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
> +
> + return ieee80211_sta_find_ibss(sdata);
> +}
> +
> int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len)
> {
> struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
> @@ -801,16 +818,7 @@ int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, siz
> ifibss->ssid_len = len;
> }
>
> - ifibss->flags &= ~IEEE80211_IBSS_PREV_BSSID_SET;
> -
> - if (len)
> - ifibss->flags |= IEEE80211_IBSS_SSID_SET;
> - else
> - ifibss->flags &= ~IEEE80211_IBSS_SSID_SET;
> -
> - ifibss->ibss_join_req = jiffies;
> - ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
> - return ieee80211_sta_find_ibss(sdata);
> + return ieee80211_ibss_commit(sdata);
> }
>
> int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len)
> @@ -842,7 +850,7 @@ int ieee80211_ibss_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
> }
> }
>
> - return ieee80211_ibss_set_ssid(sdata, ifibss->ssid, ifibss->ssid_len);
> + return ieee80211_ibss_commit(sdata);
> }
>
> /* scan finished notification */
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index d06c757..ecbc8e0 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -934,6 +934,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
> ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata,
> struct sk_buff *skb,
> struct ieee80211_rx_status *rx_status);
> +int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata);
> int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
> int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
> int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
> @@ -944,6 +945,7 @@ void ieee80211_send_pspoll(struct ieee80211_local *local,
> struct ieee80211_sub_if_data *sdata);
>
> /* IBSS code */
> +int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata);
> int ieee80211_ibss_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
> int ieee80211_ibss_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
> int ieee80211_ibss_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 5a49779..7f23858 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -1855,6 +1855,20 @@ void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata)
> }
> }
>
> +int ieee80211_sta_commit(struct ieee80211_sub_if_data *sdata)
> +{
> + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> +
> + ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
> +
> + if (ifmgd->ssid_len)
> + ifmgd->flags |= IEEE80211_STA_SSID_SET;
> + else
> + ifmgd->flags &= ~IEEE80211_STA_SSID_SET;
> +
> + return 0;
> +}
> +
> int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len)
> {
> struct ieee80211_if_managed *ifmgd;
> @@ -1870,14 +1884,7 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
> ifmgd->ssid_len = len;
> }
>
> - ifmgd->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
> -
> - if (len)
> - ifmgd->flags |= IEEE80211_STA_SSID_SET;
> - else
> - ifmgd->flags &= ~IEEE80211_STA_SSID_SET;
> -
> - return 0;
> + return ieee80211_sta_commit(sdata);
> }
>
> int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len)
> @@ -1907,7 +1914,7 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
> }
> }
>
> - return ieee80211_sta_set_ssid(sdata, ifmgd->ssid, ifmgd->ssid_len);
> + return ieee80211_sta_commit(sdata);
> }
>
> int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len)
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2009-02-24 2:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-21 0:27 [PATCH v2] mac80211: Introduce a generic commit() to apply changes Alina Friedrichsen
2009-02-24 1:44 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1235439890.4455.37.camel@johannes.local \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=x-alina@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).