aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_pathtbl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 00:04:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 00:04:47 -0400
commit3b59bf081622b6446db77ad06c93fe23677bc533 (patch)
tree3f4bb5a27c90cc86994a1f6d3c53fbf9208003cb /net/mac80211/mesh_pathtbl.c
parente45836fafe157df137a837093037f741ad8f4c90 (diff)
parentbbdb32cb5b73597386913d052165423b9d736145 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking merge from David Miller: "1) Move ixgbe driver over to purely page based buffering on receive. From Alexander Duyck. 2) Add receive packet steering support to e1000e, from Bruce Allan. 3) Convert TCP MD5 support over to RCU, from Eric Dumazet. 4) Reduce cpu usage in handling out-of-order TCP packets on modern systems, also from Eric Dumazet. 5) Support the IP{,V6}_UNICAST_IF socket options, making the wine folks happy, from Erich Hoover. 6) Support VLAN trunking from guests in hyperv driver, from Haiyang Zhang. 7) Support byte-queue-limtis in r8169, from Igor Maravic. 8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but was never properly implemented, Jiri Benc fixed that. 9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang. 10) Support kernel side dump filtering by ctmark in netfilter ctnetlink, from Pablo Neira Ayuso. 11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker. 12) Add new peek socket options to assist with socket migration, from Pavel Emelyanov. 13) Add sch_plug packet scheduler whose queue is controlled by userland daemons using explicit freeze and release commands. From Shriram Rajagopalan. 14) Fix FCOE checksum offload handling on transmit, from Yi Zou." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits) Fix pppol2tp getsockname() Remove printk from rds_sendmsg ipv6: fix incorrent ipv6 ipsec packet fragment cpsw: Hook up default ndo_change_mtu. net: qmi_wwan: fix build error due to cdc-wdm dependecy netdev: driver: ethernet: Add TI CPSW driver netdev: driver: ethernet: add cpsw address lookup engine support phy: add am79c874 PHY support mlx4_core: fix race on comm channel bonding: send igmp report for its master fs_enet: Add MPC5125 FEC support and PHY interface selection net: bpf_jit: fix BPF_S_LDX_B_MSH compilation net: update the usage of CHECKSUM_UNNECESSARY fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso ixgbe: Fix issues with SR-IOV loopback when flow control is disabled net/hyperv: Fix the code handling tx busy ixgbe: fix namespace issues when FCoE/DCB is not enabled rtlwifi: Remove unused ETH_ADDR_LEN defines igbvf: Use ETH_ALEN ... Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Diffstat (limited to 'net/mac80211/mesh_pathtbl.c')
-rw-r--r--net/mac80211/mesh_pathtbl.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 30420bc1f699..49aaefd99635 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -336,7 +336,7 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath,
336} 336}
337 337
338 338
339static struct mesh_path *path_lookup(struct mesh_table *tbl, u8 *dst, 339static struct mesh_path *mpath_lookup(struct mesh_table *tbl, u8 *dst,
340 struct ieee80211_sub_if_data *sdata) 340 struct ieee80211_sub_if_data *sdata)
341{ 341{
342 struct mesh_path *mpath; 342 struct mesh_path *mpath;
@@ -348,7 +348,7 @@ static struct mesh_path *path_lookup(struct mesh_table *tbl, u8 *dst,
348 hlist_for_each_entry_rcu(node, n, bucket, list) { 348 hlist_for_each_entry_rcu(node, n, bucket, list) {
349 mpath = node->mpath; 349 mpath = node->mpath;
350 if (mpath->sdata == sdata && 350 if (mpath->sdata == sdata &&
351 memcmp(dst, mpath->dst, ETH_ALEN) == 0) { 351 compare_ether_addr(dst, mpath->dst) == 0) {
352 if (MPATH_EXPIRED(mpath)) { 352 if (MPATH_EXPIRED(mpath)) {
353 spin_lock_bh(&mpath->state_lock); 353 spin_lock_bh(&mpath->state_lock);
354 mpath->flags &= ~MESH_PATH_ACTIVE; 354 mpath->flags &= ~MESH_PATH_ACTIVE;
@@ -371,12 +371,12 @@ static struct mesh_path *path_lookup(struct mesh_table *tbl, u8 *dst,
371 */ 371 */
372struct mesh_path *mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata) 372struct mesh_path *mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata)
373{ 373{
374 return path_lookup(rcu_dereference(mesh_paths), dst, sdata); 374 return mpath_lookup(rcu_dereference(mesh_paths), dst, sdata);
375} 375}
376 376
377struct mesh_path *mpp_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata) 377struct mesh_path *mpp_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata)
378{ 378{
379 return path_lookup(rcu_dereference(mpp_paths), dst, sdata); 379 return mpath_lookup(rcu_dereference(mpp_paths), dst, sdata);
380} 380}
381 381
382 382
@@ -517,7 +517,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
517 int err = 0; 517 int err = 0;
518 u32 hash_idx; 518 u32 hash_idx;
519 519
520 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) 520 if (compare_ether_addr(dst, sdata->vif.addr) == 0)
521 /* never add ourselves as neighbours */ 521 /* never add ourselves as neighbours */
522 return -ENOTSUPP; 522 return -ENOTSUPP;
523 523
@@ -553,12 +553,13 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
553 hash_idx = mesh_table_hash(dst, sdata, tbl); 553 hash_idx = mesh_table_hash(dst, sdata, tbl);
554 bucket = &tbl->hash_buckets[hash_idx]; 554 bucket = &tbl->hash_buckets[hash_idx];
555 555
556 spin_lock_bh(&tbl->hashwlock[hash_idx]); 556 spin_lock(&tbl->hashwlock[hash_idx]);
557 557
558 err = -EEXIST; 558 err = -EEXIST;
559 hlist_for_each_entry(node, n, bucket, list) { 559 hlist_for_each_entry(node, n, bucket, list) {
560 mpath = node->mpath; 560 mpath = node->mpath;
561 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) 561 if (mpath->sdata == sdata &&
562 compare_ether_addr(dst, mpath->dst) == 0)
562 goto err_exists; 563 goto err_exists;
563 } 564 }
564 565
@@ -569,7 +570,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
569 570
570 mesh_paths_generation++; 571 mesh_paths_generation++;
571 572
572 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 573 spin_unlock(&tbl->hashwlock[hash_idx]);
573 read_unlock_bh(&pathtbl_resize_lock); 574 read_unlock_bh(&pathtbl_resize_lock);
574 if (grow) { 575 if (grow) {
575 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags); 576 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags);
@@ -578,7 +579,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
578 return 0; 579 return 0;
579 580
580err_exists: 581err_exists:
581 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 582 spin_unlock(&tbl->hashwlock[hash_idx]);
582 read_unlock_bh(&pathtbl_resize_lock); 583 read_unlock_bh(&pathtbl_resize_lock);
583 kfree(new_node); 584 kfree(new_node);
584err_node_alloc: 585err_node_alloc:
@@ -649,7 +650,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
649 int err = 0; 650 int err = 0;
650 u32 hash_idx; 651 u32 hash_idx;
651 652
652 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) 653 if (compare_ether_addr(dst, sdata->vif.addr) == 0)
653 /* never add ourselves as neighbours */ 654 /* never add ourselves as neighbours */
654 return -ENOTSUPP; 655 return -ENOTSUPP;
655 656
@@ -681,12 +682,13 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
681 hash_idx = mesh_table_hash(dst, sdata, tbl); 682 hash_idx = mesh_table_hash(dst, sdata, tbl);
682 bucket = &tbl->hash_buckets[hash_idx]; 683 bucket = &tbl->hash_buckets[hash_idx];
683 684
684 spin_lock_bh(&tbl->hashwlock[hash_idx]); 685 spin_lock(&tbl->hashwlock[hash_idx]);
685 686
686 err = -EEXIST; 687 err = -EEXIST;
687 hlist_for_each_entry(node, n, bucket, list) { 688 hlist_for_each_entry(node, n, bucket, list) {
688 mpath = node->mpath; 689 mpath = node->mpath;
689 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) 690 if (mpath->sdata == sdata &&
691 compare_ether_addr(dst, mpath->dst) == 0)
690 goto err_exists; 692 goto err_exists;
691 } 693 }
692 694
@@ -695,7 +697,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
695 tbl->mean_chain_len * (tbl->hash_mask + 1)) 697 tbl->mean_chain_len * (tbl->hash_mask + 1))
696 grow = 1; 698 grow = 1;
697 699
698 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 700 spin_unlock(&tbl->hashwlock[hash_idx]);
699 read_unlock_bh(&pathtbl_resize_lock); 701 read_unlock_bh(&pathtbl_resize_lock);
700 if (grow) { 702 if (grow) {
701 set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags); 703 set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags);
@@ -704,7 +706,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
704 return 0; 706 return 0;
705 707
706err_exists: 708err_exists:
707 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 709 spin_unlock(&tbl->hashwlock[hash_idx]);
708 read_unlock_bh(&pathtbl_resize_lock); 710 read_unlock_bh(&pathtbl_resize_lock);
709 kfree(new_node); 711 kfree(new_node);
710err_node_alloc: 712err_node_alloc:
@@ -803,9 +805,9 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta)
803 for_each_mesh_entry(tbl, p, node, i) { 805 for_each_mesh_entry(tbl, p, node, i) {
804 mpath = node->mpath; 806 mpath = node->mpath;
805 if (rcu_dereference(mpath->next_hop) == sta) { 807 if (rcu_dereference(mpath->next_hop) == sta) {
806 spin_lock_bh(&tbl->hashwlock[i]); 808 spin_lock(&tbl->hashwlock[i]);
807 __mesh_path_del(tbl, node); 809 __mesh_path_del(tbl, node);
808 spin_unlock_bh(&tbl->hashwlock[i]); 810 spin_unlock(&tbl->hashwlock[i]);
809 } 811 }
810 } 812 }
811 read_unlock_bh(&pathtbl_resize_lock); 813 read_unlock_bh(&pathtbl_resize_lock);
@@ -876,11 +878,11 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
876 hash_idx = mesh_table_hash(addr, sdata, tbl); 878 hash_idx = mesh_table_hash(addr, sdata, tbl);
877 bucket = &tbl->hash_buckets[hash_idx]; 879 bucket = &tbl->hash_buckets[hash_idx];
878 880
879 spin_lock_bh(&tbl->hashwlock[hash_idx]); 881 spin_lock(&tbl->hashwlock[hash_idx]);
880 hlist_for_each_entry(node, n, bucket, list) { 882 hlist_for_each_entry(node, n, bucket, list) {
881 mpath = node->mpath; 883 mpath = node->mpath;
882 if (mpath->sdata == sdata && 884 if (mpath->sdata == sdata &&
883 memcmp(addr, mpath->dst, ETH_ALEN) == 0) { 885 compare_ether_addr(addr, mpath->dst) == 0) {
884 __mesh_path_del(tbl, node); 886 __mesh_path_del(tbl, node);
885 goto enddel; 887 goto enddel;
886 } 888 }
@@ -889,7 +891,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
889 err = -ENXIO; 891 err = -ENXIO;
890enddel: 892enddel:
891 mesh_paths_generation++; 893 mesh_paths_generation++;
892 spin_unlock_bh(&tbl->hashwlock[hash_idx]); 894 spin_unlock(&tbl->hashwlock[hash_idx]);
893 read_unlock_bh(&pathtbl_resize_lock); 895 read_unlock_bh(&pathtbl_resize_lock);
894 return err; 896 return err;
895} 897}