diff options
author | Luis Carlos Cobo <luisca@cozybit.com> | 2008-02-29 18:46:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-06 16:40:52 -0500 |
commit | b4e08ea141e6d663dec31b31d6289baeaaa2a3a2 (patch) | |
tree | f6ca4b30e480f803f5f83c2d60e0df29fb2177ea /net/mac80211/mesh_plink.c | |
parent | cfa22c716f65b4d286a68aeacee4a7361a4035e6 (diff) |
mac80211: add PLINK_ prefix and kernel doc to enum plink_state
Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r-- | net/mac80211/mesh_plink.c | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 23d951a83668..18fe52436c47 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -84,7 +84,7 @@ void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) | |||
84 | */ | 84 | */ |
85 | static inline void mesh_plink_fsm_restart(struct sta_info *sta) | 85 | static inline void mesh_plink_fsm_restart(struct sta_info *sta) |
86 | { | 86 | { |
87 | sta->plink_state = LISTEN; | 87 | sta->plink_state = PLINK_LISTEN; |
88 | sta->llid = sta->plid = sta->reason = 0; | 88 | sta->llid = sta->plid = sta->reason = 0; |
89 | sta->plink_retries = 0; | 89 | sta->plink_retries = 0; |
90 | } | 90 | } |
@@ -121,9 +121,9 @@ static void __mesh_plink_deactivate(struct sta_info *sta) | |||
121 | { | 121 | { |
122 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 122 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
123 | 123 | ||
124 | if (sta->plink_state == ESTAB) | 124 | if (sta->plink_state == PLINK_ESTAB) |
125 | mesh_plink_dec_estab_count(sdata); | 125 | mesh_plink_dec_estab_count(sdata); |
126 | sta->plink_state = BLOCKED; | 126 | sta->plink_state = PLINK_BLOCKED; |
127 | mesh_path_flush_by_nexthop(sta); | 127 | mesh_path_flush_by_nexthop(sta); |
128 | } | 128 | } |
129 | 129 | ||
@@ -243,7 +243,7 @@ void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev, | |||
243 | 243 | ||
244 | sta->last_rx = jiffies; | 244 | sta->last_rx = jiffies; |
245 | sta->supp_rates[local->hw.conf.channel->band] = rates; | 245 | sta->supp_rates[local->hw.conf.channel->band] = rates; |
246 | if (peer_accepting_plinks && sta->plink_state == LISTEN && | 246 | if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN && |
247 | sdata->u.sta.accepting_plinks && | 247 | sdata->u.sta.accepting_plinks && |
248 | sdata->u.sta.mshcfg.auto_open_plinks) | 248 | sdata->u.sta.mshcfg.auto_open_plinks) |
249 | mesh_plink_open(sta); | 249 | mesh_plink_open(sta); |
@@ -283,8 +283,8 @@ static void mesh_plink_timer(unsigned long data) | |||
283 | dev = sdata->dev; | 283 | dev = sdata->dev; |
284 | 284 | ||
285 | switch (sta->plink_state) { | 285 | switch (sta->plink_state) { |
286 | case OPN_RCVD: | 286 | case PLINK_OPN_RCVD: |
287 | case OPN_SNT: | 287 | case PLINK_OPN_SNT: |
288 | /* retry timer */ | 288 | /* retry timer */ |
289 | if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { | 289 | if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { |
290 | u32 rand; | 290 | u32 rand; |
@@ -303,17 +303,17 @@ static void mesh_plink_timer(unsigned long data) | |||
303 | } | 303 | } |
304 | reason = cpu_to_le16(MESH_MAX_RETRIES); | 304 | reason = cpu_to_le16(MESH_MAX_RETRIES); |
305 | /* fall through on else */ | 305 | /* fall through on else */ |
306 | case CNF_RCVD: | 306 | case PLINK_CNF_RCVD: |
307 | /* confirm timer */ | 307 | /* confirm timer */ |
308 | if (!reason) | 308 | if (!reason) |
309 | reason = cpu_to_le16(MESH_CONFIRM_TIMEOUT); | 309 | reason = cpu_to_le16(MESH_CONFIRM_TIMEOUT); |
310 | sta->plink_state = HOLDING; | 310 | sta->plink_state = PLINK_HOLDING; |
311 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 311 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
312 | spin_unlock_bh(&sta->plink_lock); | 312 | spin_unlock_bh(&sta->plink_lock); |
313 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, plid, | 313 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, plid, |
314 | reason); | 314 | reason); |
315 | break; | 315 | break; |
316 | case HOLDING: | 316 | case PLINK_HOLDING: |
317 | /* holding timer */ | 317 | /* holding timer */ |
318 | del_timer(&sta->plink_timer); | 318 | del_timer(&sta->plink_timer); |
319 | mesh_plink_fsm_restart(sta); | 319 | mesh_plink_fsm_restart(sta); |
@@ -345,11 +345,11 @@ int mesh_plink_open(struct sta_info *sta) | |||
345 | spin_lock_bh(&sta->plink_lock); | 345 | spin_lock_bh(&sta->plink_lock); |
346 | get_random_bytes(&llid, 2); | 346 | get_random_bytes(&llid, 2); |
347 | sta->llid = llid; | 347 | sta->llid = llid; |
348 | if (sta->plink_state != LISTEN) { | 348 | if (sta->plink_state != PLINK_LISTEN) { |
349 | spin_unlock_bh(&sta->plink_lock); | 349 | spin_unlock_bh(&sta->plink_lock); |
350 | return -EBUSY; | 350 | return -EBUSY; |
351 | } | 351 | } |
352 | sta->plink_state = OPN_SNT; | 352 | sta->plink_state = PLINK_OPN_SNT; |
353 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); | 353 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); |
354 | spin_unlock_bh(&sta->plink_lock); | 354 | spin_unlock_bh(&sta->plink_lock); |
355 | mpl_dbg("Mesh plink: starting establishment with %s\n", | 355 | mpl_dbg("Mesh plink: starting establishment with %s\n", |
@@ -367,7 +367,7 @@ void mesh_plink_block(struct sta_info *sta) | |||
367 | 367 | ||
368 | spin_lock_bh(&sta->plink_lock); | 368 | spin_lock_bh(&sta->plink_lock); |
369 | __mesh_plink_deactivate(sta); | 369 | __mesh_plink_deactivate(sta); |
370 | sta->plink_state = BLOCKED; | 370 | sta->plink_state = PLINK_BLOCKED; |
371 | spin_unlock_bh(&sta->plink_lock); | 371 | spin_unlock_bh(&sta->plink_lock); |
372 | } | 372 | } |
373 | 373 | ||
@@ -385,18 +385,19 @@ int mesh_plink_close(struct sta_info *sta) | |||
385 | sta->reason = cpu_to_le16(MESH_LINK_CANCELLED); | 385 | sta->reason = cpu_to_le16(MESH_LINK_CANCELLED); |
386 | reason = sta->reason; | 386 | reason = sta->reason; |
387 | 387 | ||
388 | if (sta->plink_state == LISTEN || sta->plink_state == BLOCKED) { | 388 | if (sta->plink_state == PLINK_LISTEN || |
389 | sta->plink_state == PLINK_BLOCKED) { | ||
389 | mesh_plink_fsm_restart(sta); | 390 | mesh_plink_fsm_restart(sta); |
390 | spin_unlock_bh(&sta->plink_lock); | 391 | spin_unlock_bh(&sta->plink_lock); |
391 | return 0; | 392 | return 0; |
392 | } else if (sta->plink_state == ESTAB) { | 393 | } else if (sta->plink_state == PLINK_ESTAB) { |
393 | __mesh_plink_deactivate(sta); | 394 | __mesh_plink_deactivate(sta); |
394 | /* The timer should not be running */ | 395 | /* The timer should not be running */ |
395 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 396 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
396 | } else if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata))) | 397 | } else if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata))) |
397 | sta->ignore_plink_timer = true; | 398 | sta->ignore_plink_timer = true; |
398 | 399 | ||
399 | sta->plink_state = HOLDING; | 400 | sta->plink_state = PLINK_HOLDING; |
400 | llid = sta->llid; | 401 | llid = sta->llid; |
401 | plid = sta->plid; | 402 | plid = sta->plid; |
402 | spin_unlock_bh(&sta->plink_lock); | 403 | spin_unlock_bh(&sta->plink_lock); |
@@ -468,7 +469,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
468 | return; | 469 | return; |
469 | } | 470 | } |
470 | 471 | ||
471 | if (sta && sta->plink_state == BLOCKED) { | 472 | if (sta && sta->plink_state == PLINK_BLOCKED) { |
472 | rcu_read_unlock(); | 473 | rcu_read_unlock(); |
473 | return; | 474 | return; |
474 | } | 475 | } |
@@ -529,7 +530,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
529 | event = CNF_ACPT; | 530 | event = CNF_ACPT; |
530 | break; | 531 | break; |
531 | case PLINK_CLOSE: | 532 | case PLINK_CLOSE: |
532 | if (sta->plink_state == ESTAB) | 533 | if (sta->plink_state == PLINK_ESTAB) |
533 | /* Do not check for llid or plid. This does not | 534 | /* Do not check for llid or plid. This does not |
534 | * follow the standard but since multiple plinks | 535 | * follow the standard but since multiple plinks |
535 | * per sta are not supported, it is necessary in | 536 | * per sta are not supported, it is necessary in |
@@ -562,14 +563,14 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
562 | reason = 0; | 563 | reason = 0; |
563 | switch (sta->plink_state) { | 564 | switch (sta->plink_state) { |
564 | /* spin_unlock as soon as state is updated at each case */ | 565 | /* spin_unlock as soon as state is updated at each case */ |
565 | case LISTEN: | 566 | case PLINK_LISTEN: |
566 | switch (event) { | 567 | switch (event) { |
567 | case CLS_ACPT: | 568 | case CLS_ACPT: |
568 | mesh_plink_fsm_restart(sta); | 569 | mesh_plink_fsm_restart(sta); |
569 | spin_unlock_bh(&sta->plink_lock); | 570 | spin_unlock_bh(&sta->plink_lock); |
570 | break; | 571 | break; |
571 | case OPN_ACPT: | 572 | case OPN_ACPT: |
572 | sta->plink_state = OPN_RCVD; | 573 | sta->plink_state = PLINK_OPN_RCVD; |
573 | sta->plid = plid; | 574 | sta->plid = plid; |
574 | get_random_bytes(&llid, 2); | 575 | get_random_bytes(&llid, 2); |
575 | sta->llid = llid; | 576 | sta->llid = llid; |
@@ -586,7 +587,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
586 | } | 587 | } |
587 | break; | 588 | break; |
588 | 589 | ||
589 | case OPN_SNT: | 590 | case PLINK_OPN_SNT: |
590 | switch (event) { | 591 | switch (event) { |
591 | case OPN_RJCT: | 592 | case OPN_RJCT: |
592 | case CNF_RJCT: | 593 | case CNF_RJCT: |
@@ -595,7 +596,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
595 | if (!reason) | 596 | if (!reason) |
596 | reason = cpu_to_le16(MESH_CLOSE_RCVD); | 597 | reason = cpu_to_le16(MESH_CLOSE_RCVD); |
597 | sta->reason = reason; | 598 | sta->reason = reason; |
598 | sta->plink_state = HOLDING; | 599 | sta->plink_state = PLINK_HOLDING; |
599 | if (!mod_plink_timer(sta, | 600 | if (!mod_plink_timer(sta, |
600 | dot11MeshHoldingTimeout(sdata))) | 601 | dot11MeshHoldingTimeout(sdata))) |
601 | sta->ignore_plink_timer = true; | 602 | sta->ignore_plink_timer = true; |
@@ -607,7 +608,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
607 | break; | 608 | break; |
608 | case OPN_ACPT: | 609 | case OPN_ACPT: |
609 | /* retry timer is left untouched */ | 610 | /* retry timer is left untouched */ |
610 | sta->plink_state = OPN_RCVD; | 611 | sta->plink_state = PLINK_OPN_RCVD; |
611 | sta->plid = plid; | 612 | sta->plid = plid; |
612 | llid = sta->llid; | 613 | llid = sta->llid; |
613 | spin_unlock_bh(&sta->plink_lock); | 614 | spin_unlock_bh(&sta->plink_lock); |
@@ -615,7 +616,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
615 | plid, 0); | 616 | plid, 0); |
616 | break; | 617 | break; |
617 | case CNF_ACPT: | 618 | case CNF_ACPT: |
618 | sta->plink_state = CNF_RCVD; | 619 | sta->plink_state = PLINK_CNF_RCVD; |
619 | if (!mod_plink_timer(sta, | 620 | if (!mod_plink_timer(sta, |
620 | dot11MeshConfirmTimeout(sdata))) | 621 | dot11MeshConfirmTimeout(sdata))) |
621 | sta->ignore_plink_timer = true; | 622 | sta->ignore_plink_timer = true; |
@@ -628,7 +629,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
628 | } | 629 | } |
629 | break; | 630 | break; |
630 | 631 | ||
631 | case OPN_RCVD: | 632 | case PLINK_OPN_RCVD: |
632 | switch (event) { | 633 | switch (event) { |
633 | case OPN_RJCT: | 634 | case OPN_RJCT: |
634 | case CNF_RJCT: | 635 | case CNF_RJCT: |
@@ -637,7 +638,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
637 | if (!reason) | 638 | if (!reason) |
638 | reason = cpu_to_le16(MESH_CLOSE_RCVD); | 639 | reason = cpu_to_le16(MESH_CLOSE_RCVD); |
639 | sta->reason = reason; | 640 | sta->reason = reason; |
640 | sta->plink_state = HOLDING; | 641 | sta->plink_state = PLINK_HOLDING; |
641 | if (!mod_plink_timer(sta, | 642 | if (!mod_plink_timer(sta, |
642 | dot11MeshHoldingTimeout(sdata))) | 643 | dot11MeshHoldingTimeout(sdata))) |
643 | sta->ignore_plink_timer = true; | 644 | sta->ignore_plink_timer = true; |
@@ -655,7 +656,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
655 | break; | 656 | break; |
656 | case CNF_ACPT: | 657 | case CNF_ACPT: |
657 | del_timer(&sta->plink_timer); | 658 | del_timer(&sta->plink_timer); |
658 | sta->plink_state = ESTAB; | 659 | sta->plink_state = PLINK_ESTAB; |
659 | mesh_plink_inc_estab_count(sdata); | 660 | mesh_plink_inc_estab_count(sdata); |
660 | spin_unlock_bh(&sta->plink_lock); | 661 | spin_unlock_bh(&sta->plink_lock); |
661 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", | 662 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", |
@@ -667,7 +668,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
667 | } | 668 | } |
668 | break; | 669 | break; |
669 | 670 | ||
670 | case CNF_RCVD: | 671 | case PLINK_CNF_RCVD: |
671 | switch (event) { | 672 | switch (event) { |
672 | case OPN_RJCT: | 673 | case OPN_RJCT: |
673 | case CNF_RJCT: | 674 | case CNF_RJCT: |
@@ -676,7 +677,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
676 | if (!reason) | 677 | if (!reason) |
677 | reason = cpu_to_le16(MESH_CLOSE_RCVD); | 678 | reason = cpu_to_le16(MESH_CLOSE_RCVD); |
678 | sta->reason = reason; | 679 | sta->reason = reason; |
679 | sta->plink_state = HOLDING; | 680 | sta->plink_state = PLINK_HOLDING; |
680 | if (!mod_plink_timer(sta, | 681 | if (!mod_plink_timer(sta, |
681 | dot11MeshHoldingTimeout(sdata))) | 682 | dot11MeshHoldingTimeout(sdata))) |
682 | sta->ignore_plink_timer = true; | 683 | sta->ignore_plink_timer = true; |
@@ -688,7 +689,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
688 | break; | 689 | break; |
689 | case OPN_ACPT: | 690 | case OPN_ACPT: |
690 | del_timer(&sta->plink_timer); | 691 | del_timer(&sta->plink_timer); |
691 | sta->plink_state = ESTAB; | 692 | sta->plink_state = PLINK_ESTAB; |
692 | mesh_plink_inc_estab_count(sdata); | 693 | mesh_plink_inc_estab_count(sdata); |
693 | spin_unlock_bh(&sta->plink_lock); | 694 | spin_unlock_bh(&sta->plink_lock); |
694 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", | 695 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", |
@@ -702,13 +703,13 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
702 | } | 703 | } |
703 | break; | 704 | break; |
704 | 705 | ||
705 | case ESTAB: | 706 | case PLINK_ESTAB: |
706 | switch (event) { | 707 | switch (event) { |
707 | case CLS_ACPT: | 708 | case CLS_ACPT: |
708 | reason = cpu_to_le16(MESH_CLOSE_RCVD); | 709 | reason = cpu_to_le16(MESH_CLOSE_RCVD); |
709 | sta->reason = reason; | 710 | sta->reason = reason; |
710 | __mesh_plink_deactivate(sta); | 711 | __mesh_plink_deactivate(sta); |
711 | sta->plink_state = HOLDING; | 712 | sta->plink_state = PLINK_HOLDING; |
712 | llid = sta->llid; | 713 | llid = sta->llid; |
713 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 714 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
714 | spin_unlock_bh(&sta->plink_lock); | 715 | spin_unlock_bh(&sta->plink_lock); |
@@ -726,7 +727,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
726 | break; | 727 | break; |
727 | } | 728 | } |
728 | break; | 729 | break; |
729 | case HOLDING: | 730 | case PLINK_HOLDING: |
730 | switch (event) { | 731 | switch (event) { |
731 | case CLS_ACPT: | 732 | case CLS_ACPT: |
732 | if (del_timer(&sta->plink_timer)) | 733 | if (del_timer(&sta->plink_timer)) |
@@ -749,8 +750,8 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
749 | } | 750 | } |
750 | break; | 751 | break; |
751 | default: | 752 | default: |
752 | /* should not get here, BLOCKED is dealt with at the beggining | 753 | /* should not get here, PLINK_BLOCKED is dealt with at the |
753 | * of the function | 754 | * beggining of the function |
754 | */ | 755 | */ |
755 | spin_unlock_bh(&sta->plink_lock); | 756 | spin_unlock_bh(&sta->plink_lock); |
756 | break; | 757 | break; |