cp->tx_skb[entry].frag = frag + 2; 
cp->tx_skb[entry].len = len; 
static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev){	struct cp_private *cp = netdev_priv(dev);	unsigned entry;	u32 eor, flags;#if CP_VLAN_TAG_USED	u32 vlan_tag = 0;#endif	int mss = 0;	spin_lock_irq(&cp->lock);	/* This is a hard error, log it. */	if (TX_BUFFS_AVAIL(cp) <= (skb_shinfo(skb)->nr_frags + 1)) {		netif_stop_queue(dev);		spin_unlock_irq(&cp->lock);		printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",		       dev->name);		return 1;	}#if CP_VLAN_TAG_USED	if (cp->vlgrp && vlan_tx_tag_present(skb))		vlan_tag = TxVlanTag | cpu_to_be16(vlan_tx_tag_get(skb));#endif	entry = cp->tx_head;	eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;	if (dev->features & NETIF_F_TSO)		mss = skb_shinfo(skb)->tso_size;	if (skb_shinfo(skb)->nr_frags == 0) {		struct cp_desc *txd = &cp->tx_ring[entry];		u32 len;		dma_addr_t mapping;		len = skb->len;		mapping = pci_map_single(cp->pdev, skb->data, len, PCI_DMA_TODEVICE);		CP_VLAN_TX_TAG(txd, vlan_tag);		txd->addr = cpu_to_le64(mapping);		wmb();		flags = eor | len | DescOwn | FirstFrag | LastFrag;		if (mss)			flags |= LargeSend | ((mss & MSSMask) << MSSShift);		else if (skb->ip_summed == CHECKSUM_HW) {			const struct iphdr *ip = skb->nh.iph;			if (ip->protocol == IPPROTO_TCP)				flags |= IPCS | TCPCS;			else if (ip->protocol == IPPROTO_UDP)				flags |= IPCS | UDPCS;			else				BUG();		}		txd->opts1 = cpu_to_le32(flags);		wmb();		cp->tx_skb[entry].skb = skb;		cp->tx_skb[entry].mapping = mapping;		cp->tx_skb[entry].frag = 0;		entry = NEXT_TX(entry);	} else {		struct cp_desc *txd;		u32 first_len, first_eor;		dma_addr_t first_mapping;		int frag, first_entry = entry;		const struct iphdr *ip = skb->nh.iph;		/* We must give this initial chunk to the device last.		 * Otherwise we could race with the device.		 */		first_eor = eor;		first_len = skb_headlen(skb);		first_mapping = pci_map_single(cp->pdev, skb->data,					       first_len, PCI_DMA_TODEVICE);		cp->tx_skb[entry].skb = skb;		cp->tx_skb[entry].mapping = first_mapping;		cp->tx_skb[entry].frag = 1;		entry = NEXT_TX(entry);		for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {			skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag];			u32 len;			u32 ctrl;			dma_addr_t mapping;			len = this_frag->size;			mapping = pci_map_single(cp->pdev,						 ((void *) page_address(this_frag->page) +						  this_frag->page_offset),						 len, PCI_DMA_TODEVICE);			eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;			ctrl = eor | len | DescOwn;			if (mss)				ctrl |= LargeSend |					((mss & MSSMask) << MSSShift);			else if (skb->ip_summed == CHECKSUM_HW) {				if (ip->protocol == IPPROTO_TCP)					ctrl |= IPCS | TCPCS;				else if (ip->protocol == IPPROTO_UDP)					ctrl |= IPCS | UDPCS;				else					BUG();			}			if (frag == skb_shinfo(skb)->nr_frags - 1)				ctrl |= LastFrag;			txd = &cp->tx_ring[entry];			CP_VLAN_TX_TAG(txd, vlan_tag);			txd->addr = cpu_to_le64(mapping);			wmb();			txd->opts1 = cpu_to_le32(ctrl);			wmb();			cp->tx_skb[entry].skb = skb;			cp->tx_skb[entry].mapping = mapping;			cp->tx_skb[entry].frag = frag + 2;			entry = NEXT_TX(entry);		}		txd = &cp->tx_ring[first_entry];		CP_VLAN_TX_TAG(txd, vlan_tag);		txd->addr = cpu_to_le64(first_mapping);		wmb();		if (skb->ip_summed == CHECKSUM_HW) {			if (ip->protocol == IPPROTO_TCP)				txd->opts1 = cpu_to_le32(first_eor | first_len |							 FirstFrag | DescOwn |							 IPCS | TCPCS);			else if (ip->protocol == IPPROTO_UDP)				txd->opts1 = cpu_to_le32(first_eor | first_len |							 FirstFrag | DescOwn |							 IPCS | UDPCS);			else				BUG();		} else			txd->opts1 = cpu_to_le32(first_eor | first_len |						 FirstFrag | DescOwn);		wmb();	}	cp->tx_head = entry;	if (netif_msg_tx_queued(cp))		printk(KERN_DEBUG "%s: tx queued, slot %d, skblen %d\n",		       dev->name, entry, skb->len);	if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))		netif_stop_queue(dev);	spin_unlock_irq(&cp->lock);	cpw8(TxPoll, NormalTxPoll);	dev->trans_start = jiffies;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/5734418d4f3420352eae38c8fcec699bf09874c1/8139cp.c/buggy/drivers/net/8139cp.c