!!(le16_to_cpu(hdr->frame_ctl) & WLAN_FC_PWRMGT)); 
!!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM)); 
static void handle_pspoll(local_info_t *local,			  struct ieee80211_hdr *hdr,			  struct hostap_80211_rx_status *rx_stats){	struct net_device *dev = local->dev;	struct sta_info *sta;	u16 aid;	struct sk_buff *skb;	PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR	       " PWRMGT=%d\n",	       MAC2STR(hdr->addr1), MAC2STR(hdr->addr2),	       !!(le16_to_cpu(hdr->frame_ctl) & WLAN_FC_PWRMGT));	if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {		PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR		       " not own MAC\n", MAC2STR(hdr->addr1));		return;	}	aid = __le16_to_cpu(hdr->duration_id);	if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) {		PDEBUG(DEBUG_PS, "   PSPOLL and AID[15:14] not set\n");		return;	}	aid &= ~BIT(15) & ~BIT(14);	if (aid == 0 || aid > MAX_AID_TABLE_SIZE) {		PDEBUG(DEBUG_PS, "   invalid aid=%d\n", aid);		return;	}	PDEBUG(DEBUG_PS2, "   aid=%d\n", aid);	spin_lock_bh(&local->ap->sta_table_lock);	sta = ap_get_sta(local->ap, hdr->addr2);	if (sta)		atomic_inc(&sta->users);	spin_unlock_bh(&local->ap->sta_table_lock);	if (sta == NULL) {		PDEBUG(DEBUG_PS, "   STA not found\n");		return;	}	if (sta->aid != aid) {		PDEBUG(DEBUG_PS, "   received aid=%i does not match with "		       "assoc.aid=%d\n", aid, sta->aid);		return;	}	/* FIX: todo:	 * - add timeout for buffering (clear aid in TIM vector if buffer timed	 *   out (expiry time must be longer than ListenInterval for	 *   the corresponding STA; "8802-11: 11.2.1.9 AP aging function"	 * - what to do, if buffered, pspolled, and sent frame is not ACKed by	 *   sta; store buffer for later use and leave TIM aid bit set? use	 *   TX event to check whether frame was ACKed?	 */	while ((skb = skb_dequeue(&sta->tx_buf)) != NULL) {		/* send buffered frame .. */		PDEBUG(DEBUG_PS2, "Sending buffered frame to STA after PS POLL"		       " (buffer_count=%d)\n", skb_queue_len(&sta->tx_buf));		pspoll_send_buffered(local, sta, skb);		if (sta->flags & WLAN_STA_PS) {			/* send only one buffered packet per PS Poll */			/* FIX: should ignore further PS Polls until the			 * buffered packet that was just sent is acknowledged			 * (Tx or TxExc event) */			break;		}	}	if (skb_queue_empty(&sta->tx_buf)) {		/* try to clear aid from TIM */		if (!(sta->flags & WLAN_STA_TIM))			PDEBUG(DEBUG_PS2,  "Re-unsetting TIM for aid %d\n",			       aid);		hostap_set_tim(local, aid, 0);		sta->flags &= ~WLAN_STA_TIM;	}	atomic_dec(&sta->users);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b2f4a2e3b1620667da9654f9e220c92ea52bdbe4/hostap_ap.c/clean/drivers/net/wireless/hostap/hostap_ap.c