Ticket #1329: madwifi-locks.diff
| File madwifi-locks.diff, 9.1 kB (added by mentor, 5 years ago) |
|---|
-
net80211/ieee80211_node.c
old new 1417 1417 * the table. 1418 1418 */ 1419 1419 if (ni->ni_table != NULL) { 1420 IEEE80211_NODE_LOCK (nt);1420 IEEE80211_NODE_LOCK_IRQ(nt); 1421 1421 _ieee80211_free_node(ni); 1422 IEEE80211_NODE_UNLOCK (nt);1422 IEEE80211_NODE_UNLOCK_IRQ(nt); 1423 1423 } else 1424 1424 _ieee80211_free_node(ni); 1425 1425 } … … 1661 1661 IEEE80211_SCAN_LOCK_IRQ(nt); 1662 1662 gen = ++nt->nt_scangen; 1663 1663 restart: 1664 IEEE80211_NODE_LOCK (nt);1664 IEEE80211_NODE_LOCK_IRQ(nt); 1665 1665 TAILQ_FOREACH(ni, &nt->nt_node, ni_list) { 1666 1666 if (dev != NULL && ni->ni_vap->iv_dev != dev) 1667 1667 continue; /* skip node not for this vap */ 1668 1668 if (ni->ni_scangen != gen) { 1669 1669 ni->ni_scangen = gen; 1670 1670 (void) ieee80211_ref_node(ni); 1671 IEEE80211_NODE_UNLOCK (nt);1671 IEEE80211_NODE_UNLOCK_IRQ_EARLY(nt); 1672 1672 (*f)(arg, ni); 1673 1673 ieee80211_free_node(ni); 1674 1674 goto restart; 1675 1675 } 1676 1676 } 1677 IEEE80211_NODE_UNLOCK (nt);1677 IEEE80211_NODE_UNLOCK_IRQ(nt); 1678 1678 1679 1679 IEEE80211_SCAN_UNLOCK_IRQ(nt); 1680 1680 } -
net80211/ieee80211_beacon.c
old new 286 286 int len_changed = 0; 287 287 u_int16_t capinfo; 288 288 289 IEEE80211_LOCK (ic);289 IEEE80211_LOCK_IRQ(ic); 290 290 291 291 if ((ic->ic_flags & IEEE80211_F_DOTH) && 292 292 (vap->iv_flags & IEEE80211_F_CHANSWITCH) && … … 307 307 if (c == NULL) { 308 308 IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH, 309 309 "%s: find channel failure\n", __func__); 310 IEEE80211_UNLOCK (ic);310 IEEE80211_UNLOCK_IRQ_EARLY(ic); 311 311 return 0; 312 312 } 313 313 ic->ic_bsschan = c; … … 547 547 vap->iv_flags_ext &= ~IEEE80211_FEXT_APPIE_UPDATE; 548 548 } 549 549 550 IEEE80211_UNLOCK (ic);550 IEEE80211_UNLOCK_IRQ(ic); 551 551 552 552 return len_changed; 553 553 } -
net80211/ieee80211_input.c
old new 3675 3675 } 3676 3676 3677 3677 /* Okay, take the first queued packet and put it out... */ 3678 IEEE80211_NODE_SAVEQ_LOCK (ni);3678 IEEE80211_NODE_SAVEQ_LOCK_BH(ni); 3679 3679 IEEE80211_NODE_SAVEQ_DEQUEUE(ni, skb, qlen); 3680 IEEE80211_NODE_SAVEQ_UNLOCK (ni);3680 IEEE80211_NODE_SAVEQ_UNLOCK_BH(ni); 3681 3681 if (skb == NULL) { 3682 3682 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_POWER, wh->i_addr2, 3683 3683 "%s", "recv ps-poll, but queue empty"); -
net80211/ieee80211_power.c
old new 112 112 struct sk_buff *skb; 113 113 int qlen; 114 114 115 IEEE80211_NODE_SAVEQ_LOCK (ni);115 IEEE80211_NODE_SAVEQ_LOCK_BH(ni); 116 116 qlen = skb_queue_len(&ni->ni_savedq); 117 117 while ((skb = __skb_dequeue(&ni->ni_savedq)) != NULL) { 118 118 ieee80211_free_node(ni); 119 119 dev_kfree_skb_any(skb); 120 120 } 121 IEEE80211_NODE_SAVEQ_UNLOCK (ni);121 IEEE80211_NODE_SAVEQ_UNLOCK_BH(ni); 122 122 123 123 return qlen; 124 124 } … … 145 145 #endif 146 146 struct sk_buff *skb; 147 147 148 IEEE80211_NODE_SAVEQ_LOCK (ni);148 IEEE80211_NODE_SAVEQ_LOCK_BH(ni); 149 149 while ((skb = skb_peek(&ni->ni_savedq)) != NULL && 150 150 M_AGE_GET(skb) < IEEE80211_INACT_WAIT) { 151 151 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, … … 157 157 } 158 158 if (skb != NULL) 159 159 M_AGE_SUB(skb, IEEE80211_INACT_WAIT); 160 IEEE80211_NODE_SAVEQ_UNLOCK (ni);160 IEEE80211_NODE_SAVEQ_UNLOCK_BH(ni); 161 161 162 162 IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, 163 163 "discard %u frames for age", discard); … … 183 183 KASSERT(aid < vap->iv_max_aid, 184 184 ("bogus aid %u, max %u", aid, vap->iv_max_aid)); 185 185 186 IEEE80211_LOCK (ni->ni_ic);186 IEEE80211_LOCK_IRQ(ni->ni_ic); 187 187 if (set != (isset(vap->iv_tim_bitmap, aid) != 0)) { 188 188 if (set) { 189 189 setbit(vap->iv_tim_bitmap, aid); … … 194 194 } 195 195 vap->iv_flags |= IEEE80211_F_TIMUPDATE; 196 196 } 197 IEEE80211_UNLOCK (ni->ni_ic);197 IEEE80211_UNLOCK_IRQ(ni->ni_ic); 198 198 } 199 199 200 200 /* … … 295 295 struct sk_buff *skb; 296 296 int qlen; 297 297 298 IEEE80211_NODE_SAVEQ_LOCK (ni);298 IEEE80211_NODE_SAVEQ_LOCK_BH(ni); 299 299 IEEE80211_NODE_SAVEQ_DEQUEUE(ni, skb, qlen); 300 IEEE80211_NODE_SAVEQ_UNLOCK (ni);300 IEEE80211_NODE_SAVEQ_UNLOCK_BH(ni); 301 301 if (skb == NULL) 302 302 break; 303 303 /* … … 359 359 for (;;) { 360 360 struct sk_buff *skb; 361 361 362 IEEE80211_NODE_SAVEQ_LOCK (ni);362 IEEE80211_NODE_SAVEQ_LOCK_BH(ni); 363 363 skb = __skb_dequeue(&ni->ni_savedq); 364 IEEE80211_NODE_SAVEQ_UNLOCK (ni);364 IEEE80211_NODE_SAVEQ_UNLOCK_BH(ni); 365 365 if (skb == NULL) 366 366 break; 367 367 ieee80211_parent_queue_xmit(skb); -
net80211/ieee80211_proto.c
old new 633 633 { 634 634 struct ieee80211com *ic = vap->iv_ic; 635 635 636 IEEE80211_LOCK (ic);636 IEEE80211_LOCK_IRQ(ic); 637 637 ieee80211_wme_initparams_locked(vap); 638 IEEE80211_UNLOCK (ic);638 IEEE80211_UNLOCK_IRQ(ic); 639 639 } 640 640 641 641 void … … 918 918 struct ieee80211com *ic = vap->iv_ic; 919 919 920 920 if (ic->ic_caps & IEEE80211_C_WME) { 921 IEEE80211_LOCK (ic);921 IEEE80211_LOCK_IRQ(ic); 922 922 ieee80211_wme_updateparams_locked(vap); 923 IEEE80211_UNLOCK (ic);923 IEEE80211_UNLOCK_IRQ(ic); 924 924 } 925 925 } 926 926 -
net80211/ieee80211_linux.h
old new 80 80 } while (0) 81 81 #define IEEE80211_UNLOCK_IRQ_EARLY(_ic) \ 82 82 spin_unlock_irqrestore(&(_ic)->ic_comlock, __ilockflags); 83 #define IEEE80211_LOCK_BH(_ic) spin_lock_bh(&(_ic)->ic_comlock)84 #define IEEE80211_UNLOCK_BH(_ic) spin_unlock_bh(&(_ic)->ic_comlock)85 #define IEEE80211_LOCK(_ic) spin_lock(&(_ic)->ic_comlock)86 #define IEEE80211_UNLOCK(_ic) spin_unlock(&(_ic)->ic_comlock)87 83 88 84 /* NB: beware, spin_is_locked() is unusable for !SMP */ 89 85 #if defined(CONFIG_SMP) … … 96 92 #define IEEE80211_VAPS_LOCK_INIT(_ic, _name) \ 97 93 spin_lock_init(&(_ic)->ic_vapslock) 98 94 #define IEEE80211_VAPS_LOCK_DESTROY(_ic) 99 #define IEEE80211_VAPS_LOCK(_ic) spin_lock(&(_ic)->ic_vapslock);100 #define IEEE80211_VAPS_UNLOCK(_ic) spin_unlock(&(_ic)->ic_vapslock);101 95 #define IEEE80211_VAPS_LOCK_BH(_ic) spin_lock_bh(&(_ic)->ic_vapslock); 102 96 #define IEEE80211_VAPS_UNLOCK_BH(_ic) spin_unlock_bh(&(_ic)->ic_vapslock); 103 #define IEEE80211_VAPS_LOCK_IRQ(_ic) do { \104 int _vaps_lockflags; \105 spin_lock_irqsave(&(_ic)->ic_vapslock, _vaps_lockflags);106 #define IEEE80211_VAPS_UNLOCK_IRQ(_ic) \107 spin_unlock_irqrestore(&(_ic)->ic_vapslock, _vaps_lockflags); \108 } while (0)109 #define IEEE80211_VAPS_UNLOCK_IRQ_EARLY(_ic) spin_unlock_irqrestore(&(_ic)->ic_vapslock, _vaps_lockflags)110 97 111 112 98 /* NB: beware, spin_is_locked() is unusable for !SMP */ 113 99 #if defined(CONFIG_SMP) 114 100 #define IEEE80211_VAPS_LOCK_ASSERT(_ic) \ … … 124 110 typedef spinlock_t ieee80211_node_lock_t; 125 111 #define IEEE80211_NODE_LOCK_INIT(_nt, _name) spin_lock_init(&(_nt)->nt_nodelock) 126 112 #define IEEE80211_NODE_LOCK_DESTROY(_nt) 127 #define IEEE80211_NODE_LOCK(_nt) spin_lock(&(_nt)->nt_nodelock)128 #define IEEE80211_NODE_UNLOCK(_nt) spin_unlock(&(_nt)->nt_nodelock)129 #define IEEE80211_NODE_LOCK_BH(_nt) spin_lock_bh(&(_nt)->nt_nodelock)130 #define IEEE80211_NODE_UNLOCK_BH(_nt) spin_unlock_bh(&(_nt)->nt_nodelock)131 113 #define IEEE80211_NODE_LOCK_IRQ(_nt) do { \ 132 114 unsigned long __node_lockflags; \ 133 115 spin_lock_irqsave(&(_nt)->nt_nodelock, __node_lockflags); … … 152 134 typedef spinlock_t ieee80211_scan_lock_t; 153 135 #define IEEE80211_SCAN_LOCK_INIT(_nt, _name) spin_lock_init(&(_nt)->nt_scanlock) 154 136 #define IEEE80211_SCAN_LOCK_DESTROY(_nt) 155 #define IEEE80211_SCAN_LOCK_BH(_nt) spin_lock_bh(&(_nt)->nt_scanlock)156 #define IEEE80211_SCAN_UNLOCK_BH(_nt) spin_unlock_bh(&(_nt)->nt_scanlock)157 137 #define IEEE80211_SCAN_LOCK_IRQ(_nt) do { \ 158 138 unsigned long __scan_lockflags; \ 159 139 spin_lock_irqsave(&(_nt)->nt_scanlock, __scan_lockflags); … … 179 159 #define ACL_LOCK_DESTROY(_as) 180 160 #define ACL_LOCK(_as) spin_lock(&(_as)->as_lock) 181 161 #define ACL_UNLOCK(_as) spin_unlock(&(_as)->as_lock) 182 #define ACL_LOCK_BH(_as) spin_lock_bh(&(_as)->as_lock)183 #define ACL_UNLOCK_BH(_as) spin_unlock_bh(&(_as)->as_lock)184 162 185 163 /* NB: beware, spin_is_locked() is unusable for !SMP */ 186 164 #if defined(CONFIG_SMP) … … 203 181 skb_queue_head_init(&(_ni)->ni_savedq); \ 204 182 } while (0) 205 183 #define IEEE80211_NODE_SAVEQ_DESTROY(_ni) 206 #define IEEE80211_NODE_SAVEQ_QLEN(_ni) skb_queue_len(&(_ni)->ni_savedq) 207 #define IEEE80211_NODE_SAVEQ_LOCK(_ni) \ 208 spin_lock(&(_ni)->ni_savedq.lock) 209 #define IEEE80211_NODE_SAVEQ_UNLOCK(_ni) \ 210 spin_unlock(&(_ni)->ni_savedq.lock) 211 #define IEEE80211_NODE_SAVEQ_LOCK_IRQ(_ni) do { \ 212 unsigned long __sqlockflags; \ 213 spin_lock_irqsave(&(_ni)->ni_savedq.lock, __sqlockflags); 214 #define IEEE80211_NODE_SAVEQ_UNLOCK_IRQ(_ni) \ 215 spin_unlock_irqrestore(&(_ni)->ni_savedq.lock, __sqlockflags);\ 216 } while (0) 184 #define IEEE80211_NODE_SAVEQ_QLEN(_ni) skb_queue_len(&(_ni)->ni_savedq) 185 #define IEEE80211_NODE_SAVEQ_LOCK_BH(_ni) spin_lock_bh(&(_ni)->ni_savedq); 186 #define IEEE80211_NODE_SAVEQ_UNLOCK_BH(_ni) spin_unlock_bh(&(_ni)->ni_savedq); 217 187 218 188 /* caller MUST lock IEEE80211_NODE_SAVEQ */ 219 189 #define IEEE80211_NODE_SAVEQ_DEQUEUE(_ni, _skb, _qlen) do { \
