~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to net/mac80211/mesh_hwmp.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
                            (mpath->flags & MESH_PATH_SN_VALID)) {
392
392
                                if (SN_GT(mpath->sn, orig_sn) ||
393
393
                                    (mpath->sn == orig_sn &&
394
 
                                     action == MPATH_PREQ &&
395
394
                                     new_metric >= mpath->metric)) {
396
395
                                        process = false;
397
396
                                        fresh_info = false;
561
560
}
562
561
 
563
562
 
 
563
static inline struct sta_info *
 
564
next_hop_deref_protected(struct mesh_path *mpath)
 
565
{
 
566
        return rcu_dereference_protected(mpath->next_hop,
 
567
                                         lockdep_is_held(&mpath->state_lock));
 
568
}
 
569
 
 
570
 
564
571
static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
565
572
                                    struct ieee80211_mgmt *mgmt,
566
573
                                    u8 *prep_elem, u32 metric)
600
607
                spin_unlock_bh(&mpath->state_lock);
601
608
                goto fail;
602
609
        }
603
 
        memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN);
 
610
        memcpy(next_hop, next_hop_deref_protected(mpath)->sta.addr, ETH_ALEN);
604
611
        spin_unlock_bh(&mpath->state_lock);
605
612
        --ttl;
606
613
        flags = PREP_IE_FLAGS(prep_elem);
633
640
        struct mesh_path *mpath;
634
641
        u8 ttl;
635
642
        u8 *ta, *target_addr;
636
 
        u8 target_flags;
637
643
        u32 target_sn;
638
644
        u16 target_rcode;
639
645
 
644
650
                return;
645
651
        }
646
652
        ttl--;
647
 
        target_flags = PERR_IE_TARGET_FLAGS(perr_elem);
648
653
        target_addr = PERR_IE_TARGET_ADDR(perr_elem);
649
654
        target_sn = PERR_IE_TARGET_SN(perr_elem);
650
655
        target_rcode = PERR_IE_TARGET_RCODE(perr_elem);
654
659
        if (mpath) {
655
660
                spin_lock_bh(&mpath->state_lock);
656
661
                if (mpath->flags & MESH_PATH_ACTIVE &&
657
 
                    memcmp(ta, mpath->next_hop->sta.addr, ETH_ALEN) == 0 &&
 
662
                    memcmp(ta, next_hop_deref_protected(mpath)->sta.addr,
 
663
                                                        ETH_ALEN) == 0 &&
658
664
                    (!(mpath->flags & MESH_PATH_SN_VALID) ||
659
665
                    SN_GT(target_sn, mpath->sn))) {
660
666
                        mpath->flags &= ~MESH_PATH_ACTIVE;
675
681
{
676
682
        struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
677
683
        struct mesh_path *mpath;
678
 
        u8 *ta;
679
684
        u8 ttl, flags, hopcount;
680
685
        u8 *orig_addr;
681
686
        u32 orig_sn, metric;
682
687
 
683
 
        ta = mgmt->sa;
684
688
        ttl = rann->rann_ttl;
685
689
        if (ttl <= 1) {
686
690
                ifmsh->mshstats.dropped_frames_ttl++;
918
922
{
919
923
        struct sk_buff *skb_to_free = NULL;
920
924
        struct mesh_path *mpath;
 
925
        struct sta_info *next_hop;
921
926
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
922
927
        u8 *target_addr = hdr->addr3;
923
928
        int err = 0;
945
950
                        mesh_queue_preq(mpath,
946
951
                                        PREQ_Q_F_START | PREQ_Q_F_REFRESH);
947
952
                }
948
 
                memcpy(hdr->addr1, mpath->next_hop->sta.addr, ETH_ALEN);
 
953
                next_hop = rcu_dereference(mpath->next_hop);
 
954
                if (next_hop)
 
955
                        memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
 
956
                else
 
957
                        err = -ENOENT;
949
958
        } else {
950
959
                struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
951
960
                if (!(mpath->flags & MESH_PATH_RESOLVING)) {
971
980
 
972
981
void mesh_path_timer(unsigned long data)
973
982
{
974
 
        struct ieee80211_sub_if_data *sdata;
975
 
        struct mesh_path *mpath;
976
 
 
977
 
        rcu_read_lock();
978
 
        mpath = (struct mesh_path *) data;
979
 
        mpath = rcu_dereference(mpath);
980
 
        if (!mpath)
981
 
                goto endmpathtimer;
982
 
        sdata = mpath->sdata;
983
 
 
984
 
        if (sdata->local->quiescing) {
985
 
                rcu_read_unlock();
 
983
        struct mesh_path *mpath = (void *) data;
 
984
        struct ieee80211_sub_if_data *sdata = mpath->sdata;
 
985
 
 
986
        if (sdata->local->quiescing)
986
987
                return;
987
 
        }
988
988
 
989
989
        spin_lock_bh(&mpath->state_lock);
990
990
        if (mpath->flags & MESH_PATH_RESOLVED ||
1001
1001
        }
1002
1002
 
1003
1003
        spin_unlock_bh(&mpath->state_lock);
1004
 
endmpathtimer:
1005
 
        rcu_read_unlock();
1006
1004
}
1007
1005
 
1008
1006
void