1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #define _RTW_STA_MGT_C_
8 
9 #include <drv_types.h>
10 #include <rtw_debug.h>
11 
12 void _rtw_init_stainfo(struct sta_info *psta);
13 void _rtw_init_stainfo(struct sta_info *psta)
14 {
15 	memset((u8 *)psta, 0, sizeof(struct sta_info));
16 
17 	spin_lock_init(&psta->lock);
18 	INIT_LIST_HEAD(&psta->list);
19 	INIT_LIST_HEAD(&psta->hash_list);
20 	/* INIT_LIST_HEAD(&psta->asoc_list); */
21 	/* INIT_LIST_HEAD(&psta->sleep_list); */
22 	/* INIT_LIST_HEAD(&psta->wakeup_list); */
23 
24 	_rtw_init_queue(&psta->sleep_q);
25 	psta->sleepq_len = 0;
26 
27 	_rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
28 	_rtw_init_sta_recv_priv(&psta->sta_recvpriv);
29 
30 	INIT_LIST_HEAD(&psta->asoc_list);
31 
32 	INIT_LIST_HEAD(&psta->auth_list);
33 
34 	psta->expire_to = 0;
35 
36 	psta->flags = 0;
37 
38 	psta->capability = 0;
39 
40 	psta->bpairwise_key_installed = false;
41 
42 	psta->nonerp_set = 0;
43 	psta->no_short_slot_time_set = 0;
44 	psta->no_short_preamble_set = 0;
45 	psta->no_ht_gf_set = 0;
46 	psta->no_ht_set = 0;
47 	psta->ht_20mhz_set = 0;
48 
49 	psta->under_exist_checking = 0;
50 
51 	psta->keep_alive_trycnt = 0;
52 }
53 
54 u32 _rtw_init_sta_priv(struct	sta_priv *pstapriv)
55 {
56 	struct sta_info *psta;
57 	s32 i;
58 
59 	pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA+4);
60 
61 	if (!pstapriv->pallocated_stainfo_buf)
62 		return _FAIL;
63 
64 	pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
65 		((SIZE_PTR)(pstapriv->pallocated_stainfo_buf) & 3);
66 
67 	_rtw_init_queue(&pstapriv->free_sta_queue);
68 
69 	spin_lock_init(&pstapriv->sta_hash_lock);
70 
71 	/* _rtw_init_queue(&pstapriv->asoc_q); */
72 	pstapriv->asoc_sta_count = 0;
73 	_rtw_init_queue(&pstapriv->sleep_q);
74 	_rtw_init_queue(&pstapriv->wakeup_q);
75 
76 	psta = (struct sta_info *)(pstapriv->pstainfo_buf);
77 
78 	for (i = 0; i < NUM_STA; i++) {
79 		_rtw_init_stainfo(psta);
80 
81 		INIT_LIST_HEAD(&(pstapriv->sta_hash[i]));
82 
83 		list_add_tail(&psta->list, get_list_head(&pstapriv->free_sta_queue));
84 
85 		psta++;
86 	}
87 
88 	pstapriv->sta_dz_bitmap = 0;
89 	pstapriv->tim_bitmap = 0;
90 
91 	INIT_LIST_HEAD(&pstapriv->asoc_list);
92 	INIT_LIST_HEAD(&pstapriv->auth_list);
93 	spin_lock_init(&pstapriv->asoc_list_lock);
94 	spin_lock_init(&pstapriv->auth_list_lock);
95 	pstapriv->asoc_list_cnt = 0;
96 	pstapriv->auth_list_cnt = 0;
97 
98 	pstapriv->auth_to = 3; /*  3*2 = 6 sec */
99 	pstapriv->assoc_to = 3;
100 	pstapriv->expire_to = 3; /*  3*2 = 6 sec */
101 	pstapriv->max_num_sta = NUM_STA;
102 	return _SUCCESS;
103 }
104 
105 inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
106 {
107 	int offset = (((u8 *)sta) - stapriv->pstainfo_buf)/sizeof(struct sta_info);
108 
109 	if (!stainfo_offset_valid(offset))
110 		DBG_871X("%s invalid offset(%d), out of range!!!", __func__, offset);
111 
112 	return offset;
113 }
114 
115 inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
116 {
117 	if (!stainfo_offset_valid(offset))
118 		DBG_871X("%s invalid offset(%d), out of range!!!", __func__, offset);
119 
120 	return (struct sta_info *)(stapriv->pstainfo_buf + offset * sizeof(struct sta_info));
121 }
122 
123 /*  this function is used to free the memory of lock || sema for all stainfos */
124 void kfree_all_stainfo(struct sta_priv *pstapriv);
125 void kfree_all_stainfo(struct sta_priv *pstapriv)
126 {
127 	struct list_head	*plist, *phead;
128 	struct sta_info *psta = NULL;
129 
130 	spin_lock_bh(&pstapriv->sta_hash_lock);
131 
132 	phead = get_list_head(&pstapriv->free_sta_queue);
133 	plist = get_next(phead);
134 
135 	while (phead != plist) {
136 		psta = container_of(plist, struct sta_info, list);
137 		plist = get_next(plist);
138 	}
139 
140 	spin_unlock_bh(&pstapriv->sta_hash_lock);
141 }
142 
143 void kfree_sta_priv_lock(struct	sta_priv *pstapriv);
144 void kfree_sta_priv_lock(struct	sta_priv *pstapriv)
145 {
146 	 kfree_all_stainfo(pstapriv); /* be done before free sta_hash_lock */
147 }
148 
149 u32 _rtw_free_sta_priv(struct	sta_priv *pstapriv)
150 {
151 	struct list_head	*phead, *plist;
152 	struct sta_info *psta = NULL;
153 	struct recv_reorder_ctrl *preorder_ctrl;
154 	int	index;
155 
156 	if (pstapriv) {
157 		/*delete all reordering_ctrl_timer		*/
158 		spin_lock_bh(&pstapriv->sta_hash_lock);
159 		for (index = 0; index < NUM_STA; index++) {
160 			phead = &(pstapriv->sta_hash[index]);
161 			plist = get_next(phead);
162 
163 			while (phead != plist) {
164 				int i;
165 
166 				psta = container_of(plist, struct sta_info, hash_list);
167 				plist = get_next(plist);
168 
169 				for (i = 0; i < 16 ; i++) {
170 					preorder_ctrl = &psta->recvreorder_ctrl[i];
171 					del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
172 				}
173 			}
174 		}
175 		spin_unlock_bh(&pstapriv->sta_hash_lock);
176 		/*===============================*/
177 
178 		kfree_sta_priv_lock(pstapriv);
179 
180 		vfree(pstapriv->pallocated_stainfo_buf);
181 	}
182 	return _SUCCESS;
183 }
184 
185 /* struct	sta_info *rtw_alloc_stainfo(_queue *pfree_sta_queue, unsigned char *hwaddr) */
186 struct	sta_info *rtw_alloc_stainfo(struct	sta_priv *pstapriv, u8 *hwaddr)
187 {
188 	s32	index;
189 	struct list_head	*phash_list;
190 	struct sta_info *psta;
191 	struct __queue *pfree_sta_queue;
192 	struct recv_reorder_ctrl *preorder_ctrl;
193 	int i = 0;
194 	u16  wRxSeqInitialValue = 0xffff;
195 
196 	pfree_sta_queue = &pstapriv->free_sta_queue;
197 
198 	/* spin_lock_bh(&(pfree_sta_queue->lock)); */
199 	spin_lock_bh(&(pstapriv->sta_hash_lock));
200 	if (list_empty(&pfree_sta_queue->queue)) {
201 		/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
202 		spin_unlock_bh(&(pstapriv->sta_hash_lock));
203 		return NULL;
204 	} else {
205 		psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);
206 
207 		list_del_init(&(psta->list));
208 
209 		/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
210 
211 		_rtw_init_stainfo(psta);
212 
213 		psta->padapter = pstapriv->padapter;
214 
215 		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
216 
217 		index = wifi_mac_hash(hwaddr);
218 
219 		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("rtw_alloc_stainfo: index  = %x", index));
220 
221 		if (index >= NUM_STA) {
222 			RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("ERROR => rtw_alloc_stainfo: index >= NUM_STA"));
223 			spin_unlock_bh(&(pstapriv->sta_hash_lock));
224 			psta = NULL;
225 			goto exit;
226 		}
227 		phash_list = &(pstapriv->sta_hash[index]);
228 
229 		/* spin_lock_bh(&(pstapriv->sta_hash_lock)); */
230 
231 		list_add_tail(&psta->hash_list, phash_list);
232 
233 		pstapriv->asoc_sta_count++;
234 
235 		/* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */
236 
237 /*  Commented by Albert 2009/08/13 */
238 /*  For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
239 /*  In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
240 /*  So, we initialize the tid_rxseq variable as the 0xffff. */
241 
242 		for (i = 0; i < 16; i++)
243 			memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
244 
245 		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_,
246 			 ("alloc number_%d stainfo  with hwaddr = %x %x %x %x %x %x \n",
247 			  pstapriv->asoc_sta_count,
248 			  hwaddr[0],
249 			  hwaddr[1],
250 			  hwaddr[2],
251 			  hwaddr[3],
252 			  hwaddr[4],
253 			  hwaddr[5])
254 		);
255 
256 		init_addba_retry_timer(pstapriv->padapter, psta);
257 
258 		/* for A-MPDU Rx reordering buffer control */
259 		for (i = 0; i < 16 ; i++) {
260 			preorder_ctrl = &psta->recvreorder_ctrl[i];
261 
262 			preorder_ctrl->padapter = pstapriv->padapter;
263 
264 			preorder_ctrl->enable = false;
265 
266 			preorder_ctrl->indicate_seq = 0xffff;
267 			#ifdef DBG_RX_SEQ
268 			DBG_871X("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __func__, __LINE__,
269 				preorder_ctrl->indicate_seq);
270 			#endif
271 			preorder_ctrl->wend_b = 0xffff;
272 			/* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
273 			preorder_ctrl->wsize_b = 64;/* 64; */
274 
275 			_rtw_init_queue(&preorder_ctrl->pending_recvframe_queue);
276 
277 			rtw_init_recv_timer(preorder_ctrl);
278 		}
279 
280 		/* init for DM */
281 		psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
282 		psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
283 
284 		/* init for the sequence number of received management frame */
285 		psta->RxMgmtFrameSeqNum = 0xffff;
286 		spin_unlock_bh(&(pstapriv->sta_hash_lock));
287 		/* alloc mac id for non-bc/mc station, */
288 		rtw_alloc_macid(pstapriv->padapter, psta);
289 	}
290 
291 exit:
292 
293 	return psta;
294 }
295 
296 /*  using pstapriv->sta_hash_lock to protect */
297 u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
298 {
299 	int i;
300 	struct __queue *pfree_sta_queue;
301 	struct recv_reorder_ctrl *preorder_ctrl;
302 	struct	sta_xmit_priv *pstaxmitpriv;
303 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
304 	struct	sta_priv *pstapriv = &padapter->stapriv;
305 	struct hw_xmit *phwxmit;
306 
307 	if (!psta)
308 		goto exit;
309 
310 	spin_lock_bh(&psta->lock);
311 	psta->state &= ~_FW_LINKED;
312 	spin_unlock_bh(&psta->lock);
313 
314 	pfree_sta_queue = &pstapriv->free_sta_queue;
315 
316 	pstaxmitpriv = &psta->sta_xmitpriv;
317 
318 	/* list_del_init(&psta->sleep_list); */
319 
320 	/* list_del_init(&psta->wakeup_list); */
321 
322 	spin_lock_bh(&pxmitpriv->lock);
323 
324 	rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
325 	psta->sleepq_len = 0;
326 
327 	/* vo */
328 	/* spin_lock_bh(&(pxmitpriv->vo_pending.lock)); */
329 	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);
330 	list_del_init(&(pstaxmitpriv->vo_q.tx_pending));
331 	phwxmit = pxmitpriv->hwxmits;
332 	phwxmit->accnt -= pstaxmitpriv->vo_q.qcnt;
333 	pstaxmitpriv->vo_q.qcnt = 0;
334 	/* spin_unlock_bh(&(pxmitpriv->vo_pending.lock)); */
335 
336 	/* vi */
337 	/* spin_lock_bh(&(pxmitpriv->vi_pending.lock)); */
338 	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
339 	list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
340 	phwxmit = pxmitpriv->hwxmits+1;
341 	phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
342 	pstaxmitpriv->vi_q.qcnt = 0;
343 	/* spin_unlock_bh(&(pxmitpriv->vi_pending.lock)); */
344 
345 	/* be */
346 	/* spin_lock_bh(&(pxmitpriv->be_pending.lock)); */
347 	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
348 	list_del_init(&(pstaxmitpriv->be_q.tx_pending));
349 	phwxmit = pxmitpriv->hwxmits+2;
350 	phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
351 	pstaxmitpriv->be_q.qcnt = 0;
352 	/* spin_unlock_bh(&(pxmitpriv->be_pending.lock)); */
353 
354 	/* bk */
355 	/* spin_lock_bh(&(pxmitpriv->bk_pending.lock)); */
356 	rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
357 	list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
358 	phwxmit = pxmitpriv->hwxmits+3;
359 	phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
360 	pstaxmitpriv->bk_q.qcnt = 0;
361 	/* spin_unlock_bh(&(pxmitpriv->bk_pending.lock)); */
362 
363 	spin_unlock_bh(&pxmitpriv->lock);
364 
365 	list_del_init(&psta->hash_list);
366 	RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_,
367 		 ("\n free number_%d stainfo  with hwaddr = 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x \n",
368 		  pstapriv->asoc_sta_count,
369 		  psta->hwaddr[0],
370 		  psta->hwaddr[1],
371 		  psta->hwaddr[2],
372 		  psta->hwaddr[3],
373 		  psta->hwaddr[4],
374 		  psta->hwaddr[5])
375 	);
376 	pstapriv->asoc_sta_count--;
377 
378 	/*  re-init sta_info; 20061114 will be init in alloc_stainfo */
379 	/* _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv); */
380 	/* _rtw_init_sta_recv_priv(&psta->sta_recvpriv); */
381 
382 	del_timer_sync(&psta->addba_retry_timer);
383 
384 	/* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
385 	for (i = 0; i < 16 ; i++) {
386 		struct list_head	*phead, *plist;
387 		union recv_frame *prframe;
388 		struct __queue *ppending_recvframe_queue;
389 		struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
390 
391 		preorder_ctrl = &psta->recvreorder_ctrl[i];
392 
393 		del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
394 
395 		ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
396 
397 		spin_lock_bh(&ppending_recvframe_queue->lock);
398 
399 		phead =		get_list_head(ppending_recvframe_queue);
400 		plist = get_next(phead);
401 
402 		while (!list_empty(phead)) {
403 			prframe = (union recv_frame *)plist;
404 
405 			plist = get_next(plist);
406 
407 			list_del_init(&(prframe->u.hdr.list));
408 
409 			rtw_free_recvframe(prframe, pfree_recv_queue);
410 		}
411 
412 		spin_unlock_bh(&ppending_recvframe_queue->lock);
413 	}
414 
415 	if (!(psta->state & WIFI_AP_STATE))
416 		rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, false);
417 
418 	/* release mac id for non-bc/mc station, */
419 	rtw_release_macid(pstapriv->padapter, psta);
420 
421 /*
422 	spin_lock_bh(&pstapriv->asoc_list_lock);
423 	list_del_init(&psta->asoc_list);
424 	spin_unlock_bh(&pstapriv->asoc_list_lock);
425 */
426 	spin_lock_bh(&pstapriv->auth_list_lock);
427 	if (!list_empty(&psta->auth_list)) {
428 		list_del_init(&psta->auth_list);
429 		pstapriv->auth_list_cnt--;
430 	}
431 	spin_unlock_bh(&pstapriv->auth_list_lock);
432 
433 	psta->expire_to = 0;
434 	psta->sleepq_ac_len = 0;
435 	psta->qos_info = 0;
436 
437 	psta->max_sp_len = 0;
438 	psta->uapsd_bk = 0;
439 	psta->uapsd_be = 0;
440 	psta->uapsd_vi = 0;
441 	psta->uapsd_vo = 0;
442 
443 	psta->has_legacy_ac = 0;
444 
445 	pstapriv->sta_dz_bitmap &= ~BIT(psta->aid);
446 	pstapriv->tim_bitmap &= ~BIT(psta->aid);
447 
448 	if ((psta->aid > 0) && (pstapriv->sta_aid[psta->aid - 1] == psta)) {
449 		pstapriv->sta_aid[psta->aid - 1] = NULL;
450 		psta->aid = 0;
451 	}
452 
453 	psta->under_exist_checking = 0;
454 
455 	/* spin_lock_bh(&(pfree_sta_queue->lock)); */
456 	list_add_tail(&psta->list, get_list_head(pfree_sta_queue));
457 	/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
458 
459 exit:
460 	return _SUCCESS;
461 }
462 
463 /*  free all stainfo which in sta_hash[all] */
464 void rtw_free_all_stainfo(struct adapter *padapter)
465 {
466 	struct list_head	*plist, *phead;
467 	s32	index;
468 	struct sta_info *psta = NULL;
469 	struct	sta_priv *pstapriv = &padapter->stapriv;
470 	struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter);
471 
472 	if (pstapriv->asoc_sta_count == 1)
473 		return;
474 
475 	spin_lock_bh(&pstapriv->sta_hash_lock);
476 
477 	for (index = 0; index < NUM_STA; index++) {
478 		phead = &(pstapriv->sta_hash[index]);
479 		plist = get_next(phead);
480 
481 		while (phead != plist) {
482 			psta = container_of(plist, struct sta_info, hash_list);
483 
484 			plist = get_next(plist);
485 
486 			if (pbcmc_stainfo != psta)
487 				rtw_free_stainfo(padapter, psta);
488 		}
489 	}
490 
491 	spin_unlock_bh(&pstapriv->sta_hash_lock);
492 }
493 
494 /* any station allocated can be searched by hash list */
495 struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
496 {
497 	struct list_head	*plist, *phead;
498 	struct sta_info *psta = NULL;
499 	u32 index;
500 	u8 *addr;
501 	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
502 
503 	if (!hwaddr)
504 		return NULL;
505 
506 	if (IS_MCAST(hwaddr))
507 		addr = bc_addr;
508 	else
509 		addr = hwaddr;
510 
511 	index = wifi_mac_hash(addr);
512 
513 	spin_lock_bh(&pstapriv->sta_hash_lock);
514 
515 	phead = &(pstapriv->sta_hash[index]);
516 	plist = get_next(phead);
517 
518 	while (phead != plist) {
519 		psta = container_of(plist, struct sta_info, hash_list);
520 
521 		if ((!memcmp(psta->hwaddr, addr, ETH_ALEN)))
522 		 /*  if found the matched address */
523 			break;
524 
525 		psta = NULL;
526 		plist = get_next(plist);
527 	}
528 
529 	spin_unlock_bh(&pstapriv->sta_hash_lock);
530 	return psta;
531 }
532 
533 u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
534 {
535 	struct sta_info *psta;
536 	u32 res = _SUCCESS;
537 	NDIS_802_11_MAC_ADDRESS	bcast_addr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
538 
539 	struct	sta_priv *pstapriv = &padapter->stapriv;
540 	/* struct __queue	*pstapending = &padapter->xmitpriv.bm_pending; */
541 
542 	psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
543 
544 	if (!psta) {
545 		res = _FAIL;
546 		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("rtw_alloc_stainfo fail"));
547 		goto exit;
548 	}
549 
550 	/*  default broadcast & multicast use macid 1 */
551 	psta->mac_id = 1;
552 
553 exit:
554 	return _SUCCESS;
555 }
556 
557 struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
558 {
559 	struct sta_priv *pstapriv = &padapter->stapriv;
560 	u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
561 
562 	return rtw_get_stainfo(pstapriv, bc_addr);
563 }
564 
565 u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
566 {
567 	bool res = true;
568 	struct list_head	*plist, *phead;
569 	struct rtw_wlan_acl_node *paclnode;
570 	bool match = false;
571 	struct sta_priv *pstapriv = &padapter->stapriv;
572 	struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
573 	struct __queue	*pacl_node_q = &pacl_list->acl_node_q;
574 
575 	spin_lock_bh(&(pacl_node_q->lock));
576 	phead = get_list_head(pacl_node_q);
577 	plist = get_next(phead);
578 	while (phead != plist) {
579 		paclnode = container_of(plist, struct rtw_wlan_acl_node, list);
580 		plist = get_next(plist);
581 
582 		if (!memcmp(paclnode->addr, mac_addr, ETH_ALEN))
583 			if (paclnode->valid == true) {
584 				match = true;
585 				break;
586 			}
587 	}
588 	spin_unlock_bh(&(pacl_node_q->lock));
589 
590 	if (pacl_list->mode == 1) /* accept unless in deny list */
591 		res = !match;
592 
593 	else if (pacl_list->mode == 2)/* deny unless in accept list */
594 		res = match;
595 	else
596 		 res = true;
597 
598 	return res;
599 }
600