struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) 
struct ieee80211_hdr_3addr *hdr = (struct ieee80211_hdr_3addr *) 
static inline void ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb){	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)	    txb->fragments[0]->data;	int i = 0;	struct tfd_frame *tfd;	struct clx2_tx_queue *txq = &priv->txq[0];	struct clx2_queue *q = &txq->q;	u8 id, hdr_len, unicast;	u16 remaining_bytes;	switch (priv->ieee->iw_mode) {	case IW_MODE_ADHOC:		hdr_len = IEEE80211_3ADDR_LEN;		unicast = !is_broadcast_ether_addr(hdr->addr1) &&		    !is_multicast_ether_addr(hdr->addr1);		id = ipw_find_station(priv, hdr->addr1);		if (id == IPW_INVALID_STATION) {			id = ipw_add_station(priv, hdr->addr1);			if (id == IPW_INVALID_STATION) {				IPW_WARNING("Attempt to send data to "					    "invalid cell: " MAC_FMT "\n",					    MAC_ARG(hdr->addr1));				goto drop;			}		}		break;	case IW_MODE_INFRA:	default:		unicast = !is_broadcast_ether_addr(hdr->addr3) &&		    !is_multicast_ether_addr(hdr->addr3);		hdr_len = IEEE80211_3ADDR_LEN;		id = 0;		break;	}	tfd = &txq->bd[q->first_empty];	txq->txb[q->first_empty] = txb;	memset(tfd, 0, sizeof(*tfd));	tfd->u.data.station_number = id;	tfd->control_flags.message_type = TX_FRAME_TYPE;	tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK;	tfd->u.data.cmd_id = DINO_CMD_TX;	tfd->u.data.len = txb->payload_size;	remaining_bytes = txb->payload_size;	if (unlikely(!unicast))		tfd->u.data.tx_flags = DCT_FLAG_NO_WEP;	else		tfd->u.data.tx_flags = DCT_FLAG_NO_WEP | DCT_FLAG_ACK_REQD;	if (priv->assoc_request.ieee_mode == IPW_B_MODE)		tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_CCK;	else		tfd->u.data.tx_flags_ext = DCT_FLAG_EXT_MODE_OFDM;	if (priv->config & CFG_PREAMBLE)		tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREMBL;	memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len);	/* payload */	tfd->u.data.num_chunks = min((u8) (NUM_TFD_CHUNKS - 2), txb->nr_frags);	for (i = 0; i < tfd->u.data.num_chunks; i++) {		IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n",			     i, tfd->u.data.num_chunks,			     txb->fragments[i]->len - hdr_len);		printk_buf(IPW_DL_TX, txb->fragments[i]->data + hdr_len,			   txb->fragments[i]->len - hdr_len);		tfd->u.data.chunk_ptr[i] =		    pci_map_single(priv->pci_dev,				   txb->fragments[i]->data + hdr_len,				   txb->fragments[i]->len - hdr_len,				   PCI_DMA_TODEVICE);		tfd->u.data.chunk_len[i] = txb->fragments[i]->len - hdr_len;	}	if (i != txb->nr_frags) {		struct sk_buff *skb;		u16 remaining_bytes = 0;		int j;		for (j = i; j < txb->nr_frags; j++)			remaining_bytes += txb->fragments[j]->len - hdr_len;		printk(KERN_INFO "Trying to reallocate for %d bytes\n",		       remaining_bytes);		skb = alloc_skb(remaining_bytes, GFP_ATOMIC);		if (skb != NULL) {			tfd->u.data.chunk_len[i] = remaining_bytes;			for (j = i; j < txb->nr_frags; j++) {				int size = txb->fragments[j]->len - hdr_len;				printk(KERN_INFO "Adding frag %d %d...\n",				       j, size);				memcpy(skb_put(skb, size),				       txb->fragments[j]->data + hdr_len, size);			}			dev_kfree_skb_any(txb->fragments[i]);			txb->fragments[i] = skb;			tfd->u.data.chunk_ptr[i] =			    pci_map_single(priv->pci_dev, skb->data,					   tfd->u.data.chunk_len[i],					   PCI_DMA_TODEVICE);			tfd->u.data.num_chunks++;		}	}	/* kick DMA */	q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd);	ipw_write32(priv, q->reg_w, q->first_empty);	if (ipw_queue_space(q) < q->high_mark)		netif_stop_queue(priv->net_dev);	return;      drop:	IPW_DEBUG_DROP("Silently dropping Tx packet.\n");	ieee80211_txb_free(txb);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/0dacca1f0a53938dd7d5ba35c692bd1a3356d504/ipw2200.c/buggy/drivers/net/wireless/ipw2200.c