CX2_RX_BUF_SIZE, 
IPW_RX_BUF_SIZE, 
static void ipw_rx(struct ipw_priv *priv){	struct ipw_rx_mem_buffer *rxb;	struct ipw_rx_packet *pkt;	struct ieee80211_hdr_4addr *header;	u32 r, w, i;	u8 network_packet;	r = ipw_read32(priv, CX2_RX_READ_INDEX);	w = ipw_read32(priv, CX2_RX_WRITE_INDEX);	i = (priv->rxq->processed + 1) % RX_QUEUE_SIZE;	while (i != r) {		rxb = priv->rxq->queue[i];#ifdef CONFIG_IPW_DEBUG		if (unlikely(rxb == NULL)) {			printk(KERN_CRIT "Queue not allocated!\n");			break;		}#endif		priv->rxq->queue[i] = NULL;		pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,					    CX2_RX_BUF_SIZE,					    PCI_DMA_FROMDEVICE);		pkt = (struct ipw_rx_packet *)rxb->skb->data;		IPW_DEBUG_RX("Packet: type=%02X seq=%02X bits=%02X\n",			     pkt->header.message_type,			     pkt->header.rx_seq_num, pkt->header.control_bits);		switch (pkt->header.message_type) {		case RX_FRAME_TYPE:	/* 802.11 frame */  {				struct ieee80211_rx_stats stats = {					.rssi =					    le16_to_cpu(pkt->u.frame.rssi_dbm) -					    IPW_RSSI_TO_DBM,					.signal =					    le16_to_cpu(pkt->u.frame.signal),					.noise =					    le16_to_cpu(pkt->u.frame.noise),					.rate = pkt->u.frame.rate,					.mac_time = jiffies,					.received_channel =					    pkt->u.frame.received_channel,					.freq =					    (pkt->u.frame.					     control & (1 << 0)) ?					    IEEE80211_24GHZ_BAND :					    IEEE80211_52GHZ_BAND,					.len = le16_to_cpu(pkt->u.frame.length),				};				if (stats.rssi != 0)					stats.mask |= IEEE80211_STATMASK_RSSI;				if (stats.signal != 0)					stats.mask |= IEEE80211_STATMASK_SIGNAL;				if (stats.noise != 0)					stats.mask |= IEEE80211_STATMASK_NOISE;				if (stats.rate != 0)					stats.mask |= IEEE80211_STATMASK_RATE;				priv->rx_packets++;#ifdef CONFIG_IPW_MONITOR				if (priv->ieee->iw_mode == IW_MODE_MONITOR) {					ipw_handle_data_packet(priv, rxb,							       &stats);					break;				}#endif				header =				    (struct ieee80211_hdr_4addr *)(rxb->skb->								   data +								   IPW_RX_FRAME_SIZE);				/* TODO: Check Ad-Hoc dest/source and make sure				 * that we are actually parsing these packets				 * correctly -- we should probably use the				 * frame control of the packet and disregard				 * the current iw_mode */				network_packet =				    is_network_packet(priv, header);				if (network_packet && priv->assoc_network) {					priv->assoc_network->stats.rssi =					    stats.rssi;					average_add(&priv->average_rssi,						    stats.rssi);					priv->last_rx_rssi = stats.rssi;				}				IPW_DEBUG_RX("Frame: len=%u\n",					     le16_to_cpu(pkt->u.frame.length));				if (le16_to_cpu(pkt->u.frame.length) <				    frame_hdr_len(header)) {					IPW_DEBUG_DROP					    ("Received packet is too small. "					     "Dropping.\n");					priv->ieee->stats.rx_errors++;					priv->wstats.discard.misc++;					break;				}				switch (WLAN_FC_GET_TYPE					(le16_to_cpu(header->frame_ctl))) {				case IEEE80211_FTYPE_MGMT:					ieee80211_rx_mgt(priv->ieee, header,							 &stats);					if (priv->ieee->iw_mode == IW_MODE_ADHOC					    &&					    ((WLAN_FC_GET_STYPE					      (le16_to_cpu(header->frame_ctl))					      == IEEE80211_STYPE_PROBE_RESP)					     ||					     (WLAN_FC_GET_STYPE					      (le16_to_cpu(header->frame_ctl))					      == IEEE80211_STYPE_BEACON))) {						if (!memcmp						    (header->addr3, priv->bssid,						     ETH_ALEN))							ipw_add_station(priv,									header->									addr2);						else {							struct							    ieee80211_probe_response							*beacon;							beacon =							    (struct							     ieee80211_probe_response							     *)header;							if (le16_to_cpu							    (beacon->							     capability) &							    WLAN_CAPABILITY_IBSS)							{								queue_work								    (priv->								     workqueue,								     &priv->								     merge_networks);							}						}					}					break;				case IEEE80211_FTYPE_CTL:					break;				case IEEE80211_FTYPE_DATA:					if (network_packet)						ipw_handle_data_packet(priv,								       rxb,								       &stats);					else						IPW_DEBUG_DROP("Dropping: "							       MAC_FMT ", "							       MAC_FMT ", "							       MAC_FMT "\n",							       MAC_ARG(header->								       addr1),							       MAC_ARG(header->								       addr2),							       MAC_ARG(header->								       addr3));					break;				}				break;			}		case RX_HOST_NOTIFICATION_TYPE:{				IPW_DEBUG_RX				    ("Notification: subtype=%02X flags=%02X size=%d\n",				     pkt->u.notification.subtype,				     pkt->u.notification.flags,				     pkt->u.notification.size);				ipw_rx_notification(priv, &pkt->u.notification);				break;			}		default:			IPW_DEBUG_RX("Bad Rx packet of type %d\n",				     pkt->header.message_type);			break;		}		/* For now we just don't re-use anything.  We can tweak this		 * later to try and re-use notification packets and SKBs that		 * fail to Rx correctly */		if (rxb->skb != NULL) {			dev_kfree_skb_any(rxb->skb);			rxb->skb = NULL;		}		pci_unmap_single(priv->pci_dev, rxb->dma_addr,				 CX2_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);		list_add_tail(&rxb->list, &priv->rxq->rx_used);		i = (i + 1) % RX_QUEUE_SIZE;	}	/* Backtrack one entry */	priv->rxq->processed = (i ? i : RX_QUEUE_SIZE) - 1;	ipw_rx_queue_restock(priv);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b095c3819805f87d73d41641a53e4c070360d783/ipw2200.c/buggy/drivers/net/wireless/ipw2200.c