diff mbox

[v8,4/5] mac80211: align ieee80211_mesh_csa_beacon() with ieee80211_csa_beacon()

Message ID 1386257143-29840-5-git-send-email-luciano.coelho@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Luca Coelho Dec. 5, 2013, 3:25 p.m. UTC
The return value of ieee80211_mesh_csa_beacon is not aligned with the
return value of ieee80211_csa_beacon() and
ieee80211_ibss_csa_beacon().  For consistency and to be able to use
both functions with similar code, change ieee80211_mesh_csa_beacon()
not to send the bss changed notification itself, but return what has
changed so the caller can send the notification instead.

Change-Id: If4c111fd874a3e17a5df98d306f7f1c8fcaa6a1a
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
---
 net/mac80211/mesh.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Johannes Berg Dec. 5, 2013, 4:04 p.m. UTC | #1
On Thu, 2013-12-05 at 17:25 +0200, Luciano Coelho wrote:
> The return value of ieee80211_mesh_csa_beacon is not aligned with the
> return value of ieee80211_csa_beacon() and
> ieee80211_ibss_csa_beacon().  For consistency and to be able to use
> both functions with similar code, change ieee80211_mesh_csa_beacon()
> not to send the bss changed notification itself, but return what has
> changed so the caller can send the notification instead.

It seems to me that the caller should be updated?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luca Coelho Dec. 5, 2013, 6:53 p.m. UTC | #2
On Thu, 2013-12-05 at 17:04 +0100, Johannes Berg wrote:
> On Thu, 2013-12-05 at 17:25 +0200, Luciano Coelho wrote:

> > The return value of ieee80211_mesh_csa_beacon is not aligned with the

> > return value of ieee80211_csa_beacon() and

> > ieee80211_ibss_csa_beacon().  For consistency and to be able to use

> > both functions with similar code, change ieee80211_mesh_csa_beacon()

> > not to send the bss changed notification itself, but return what has

> > changed so the caller can send the notification instead.

> 

> It seems to me that the caller should be updated?


With this patch only, the caller just checks if the return value is < 0
(ie. an error), otherwise it assumes it was okay.  With this patch, we
still return < 0 on errors, but we return positive, saying that the
beacon has changed.

My next patch (5/5) changes the caller so that the value is used
properly (ie. ORing the return value to the changed variable).

--
Luca.
Johannes Berg Dec. 5, 2013, 6:53 p.m. UTC | #3
On Thu, 2013-12-05 at 18:53 +0000, Coelho, Luciano wrote:
> On Thu, 2013-12-05 at 17:04 +0100, Johannes Berg wrote:
> > On Thu, 2013-12-05 at 17:25 +0200, Luciano Coelho wrote:
> > > The return value of ieee80211_mesh_csa_beacon is not aligned with the
> > > return value of ieee80211_csa_beacon() and
> > > ieee80211_ibss_csa_beacon().  For consistency and to be able to use
> > > both functions with similar code, change ieee80211_mesh_csa_beacon()
> > > not to send the bss changed notification itself, but return what has
> > > changed so the caller can send the notification instead.
> > 
> > It seems to me that the caller should be updated?
> 
> With this patch only, the caller just checks if the return value is < 0
> (ie. an error), otherwise it assumes it was okay.  With this patch, we
> still return < 0 on errors, but we return positive, saying that the
> beacon has changed.
> 
> My next patch (5/5) changes the caller so that the value is used
> properly (ie. ORing the return value to the changed variable).

But doesn't that leave this patch broken?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luca Coelho Dec. 5, 2013, 7:01 p.m. UTC | #4
T24gVGh1LCAyMDEzLTEyLTA1IGF0IDE5OjUzICswMTAwLCBKb2hhbm5lcyBCZXJnIHdyb3RlOg0K
PiBPbiBUaHUsIDIwMTMtMTItMDUgYXQgMTg6NTMgKzAwMDAsIENvZWxobywgTHVjaWFubyB3cm90
ZToNCj4gPiBPbiBUaHUsIDIwMTMtMTItMDUgYXQgMTc6MDQgKzAxMDAsIEpvaGFubmVzIEJlcmcg
d3JvdGU6DQo+ID4gPiBPbiBUaHUsIDIwMTMtMTItMDUgYXQgMTc6MjUgKzAyMDAsIEx1Y2lhbm8g
Q29lbGhvIHdyb3RlOg0KPiA+ID4gPiBUaGUgcmV0dXJuIHZhbHVlIG9mI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dGhhdCB0aGUgdmFsdWUgaXMgdXNlZA0KPiA+IHByb3Blcmx5
IChpZS4gT1JpbmcgdGhlIHJldHVybiB2YWx1ZSB0byB0aGUgY2hhbmdlZCB2YXJpYWJsZSkuDQo+
IA0KPiBCdXQgZG9lc24ndCB0aGF0IGxlYXZlIHRoaXMgcGF0Y2ggYnJva2VuPw0KDQpOby4gIFdl
IHVzZWQgdG8gcmV0dXJuIDAgaW4gY2FzZSBvZiBzdWNjZXNzIChvciAtRU5PTUVNIG9uIGZhaWx1
cmUpLg0KVGhlIGNhbGxlciBjaGVja3MgdGhlIHJldHVybiB2YWx1ZSBsaWtlIHRoaXM6DQoNCgkJ
ZXJyID0gaWVlZTgwMjExX21lc2hfY3NhX2JlYWNvbihzZGF0YSwgcGFyYW1zLA0KCQkJKGlmbXNo
LT5jc2Ffcm9sZSA9PSBJRUVFODAyMTFfTUVTSF9DU0FfUk9MRV9JTklUKSk7DQoJCWlmIChlcnIg
PCAwKSB7DQoJCQlpZm1zaC0+Y3NhX3JvbGUgPSBJRUVFODAyMTFfTUVTSF9DU0FfUk9MRV9OT05F
Ow0KCQkJcmV0dXJuIGVycjsNCgkJfQ0KDQpXaXRoIG15IGNoYW5nZSwgaW5zdGVhZCBvZiByZXR1
cm5pbmcgMCBvbiBzdWNjZXNzLCB3ZSByZXR1cm4NCkJTU19DSEFOR0VEX0JFQUNPTi4gIFRoZSBp
ZiAoZXJyIDwgMCkgd2lsbCBzdGlsbCBldmFsdWF0ZSB0byBmYWxzZSwgc28NCml0IHdpbGwgYmUg
dGhlIHNhbWUgYXMgYmVmb3JlLg0KDQpOb3RlIHRoYXQgdGhpcyBwYXRjaCBpcyBvbiB0b3Agb2Yg
dGhlICJtYWM4MDIxMTogcmVmYWN0b3INCmllZWU4MDIxMV9tZXNoX2NoYW5zd2l0Y2goKSIuDQoN
Ci0tDQpMdWNhLg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 980cc12..5476ad9 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -1089,12 +1089,10 @@  int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
 		return ret;
 	}
 
-	ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
-
 	if (csa_action)
 		ieee80211_send_action_csa(sdata, csa_settings);
 
-	return 0;
+	return BSS_CHANGED_BEACON;
 }
 
 static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,