On 12/11/2012 02:38 PM, Thomas Pedersen wrote:
On Tue, Dec 11, 2012 at 12:53 PM, Marco Porsch <[email protected]> wrote:
The established peer link count is indicated in mesh beacons and used for
other internal tasks.

Signed-off-by: Marco Porsch <[email protected]>
---
  net/mac80211/cfg.c        |   22 +++++++++++++++++++---
  net/mac80211/mesh.h       |   14 ++++++++++++++
  net/mac80211/mesh_plink.c |   14 --------------
  3 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 2523d85..b6317c6 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1206,18 +1206,33 @@ static int sta_apply_parameters(struct ieee80211_local 
*local,

         if (ieee80211_vif_is_mesh(&sdata->vif)) {
  #ifdef CONFIG_MAC80211_MESH
-               if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED)
+               if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) {
+                       u32 changed = 0;
+

You might as well declare this up top with the others. Some people
might object to declaring inside a new block.

Oh, I just realized the #ifdef CONFIG_MAC80211_MESH makes this neccessary. Without mesh compiled-in it would issue an unused variable warning.

Otherwise the rest looks ok.

                         switch (params->plink_state) {
-                       case NL80211_PLINK_LISTEN:
                         case NL80211_PLINK_ESTAB:
+                               if (sta->plink_state != params->plink_state)
+                                       changed = mesh_plink_inc_estab_count(
+                                                       sdata);
+                               sta->plink_state = params->plink_state;
+                               break;
+                       case NL80211_PLINK_LISTEN:
                         case NL80211_PLINK_BLOCKED:
+                       case NL80211_PLINK_OPN_SNT:
+                       case NL80211_PLINK_OPN_RCVD:
+                       case NL80211_PLINK_CNF_RCVD:
+                       case NL80211_PLINK_HOLDING:
+                               if (sta->plink_state == NL80211_PLINK_ESTAB)
+                                       changed = mesh_plink_dec_estab_count(
+                                                       sdata);
                                 sta->plink_state = params->plink_state;
                                 break;
                         default:
                                 /*  nothing  */
                                 break;
                         }
-               else
+                       ieee80211_bss_info_change_notify(sdata, changed);
+               } else {
                         switch (params->plink_action) {
                         case PLINK_ACTION_OPEN:
                                 mesh_plink_open(sta);
@@ -1226,6 +1241,7 @@ static int sta_apply_parameters(struct ieee80211_local 
*local,
                                 mesh_plink_block(sta);
                                 break;
                         }
+               }

                 if (params->local_pm)
                         ieee80211_mps_set_sta_local_pm(sta, params->local_pm,
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 8ecbd42..7c31fd2 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -326,6 +326,20 @@ extern int mesh_paths_generation;
  #ifdef CONFIG_MAC80211_MESH
  extern int mesh_allocated;

+static inline
+u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
+{
+       atomic_inc(&sdata->u.mesh.estab_plinks);
+       return mesh_accept_plinks_update(sdata);
+}
+
+static inline
+u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
+{
+       atomic_dec(&sdata->u.mesh.estab_plinks);
+       return mesh_accept_plinks_update(sdata);
+}
+
  static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata)
  {
         return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks -
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 7606faa..4d7c6f2 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -41,20 +41,6 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data 
*sdata,
                 enum ieee80211_self_protected_actioncode action,
                 u8 *da, __le16 llid, __le16 plid, __le16 reason);

-static inline
-u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
-{
-       atomic_inc(&sdata->u.mesh.estab_plinks);
-       return mesh_accept_plinks_update(sdata);
-}
-
-static inline
-u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
-{
-       atomic_dec(&sdata->u.mesh.estab_plinks);
-       return mesh_accept_plinks_update(sdata);
-}
-
  /**
   * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
   *
--
1.7.9.5

_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel
_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel


_______________________________________________
Devel mailing list
[email protected]
http://lists.open80211s.org/cgi-bin/mailman/listinfo/devel

Reply via email to