printk(KERN_DEBUG "%s: tx queued, slot %d, len %d\n", 
printk(KERN_DEBUG "%s: tx queued, slot %td, len %d\n", 
static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev){	struct skge_port *skge = netdev_priv(dev);	struct skge_hw *hw = skge->hw;	struct skge_ring *ring = &skge->tx_ring;	struct skge_element *e;	struct skge_tx_desc *td;	int i;	u32 control, len;	u64 map;	unsigned long flags;	skb = skb_padto(skb, ETH_ZLEN);	if (!skb)		return NETDEV_TX_OK;	local_irq_save(flags);	if (!spin_trylock(&skge->tx_lock)) { 		/* Collision - tell upper layer to requeue */  		local_irq_restore(flags);  		return NETDEV_TX_LOCKED;  	} 	if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) {		netif_stop_queue(dev);		spin_unlock_irqrestore(&skge->tx_lock, flags);		printk(KERN_WARNING PFX "%s: ring full when queue awake!\n",		       dev->name);		return NETDEV_TX_BUSY;	}	e = ring->to_use;	td = e->desc;	e->skb = skb;	len = skb_headlen(skb);	map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);	pci_unmap_addr_set(e, mapaddr, map);	pci_unmap_len_set(e, maplen, len);	td->dma_lo = map;	td->dma_hi = map >> 32;	if (skb->ip_summed == CHECKSUM_HW) {		const struct iphdr *ip			= (const struct iphdr *) (skb->data + ETH_HLEN);		int offset = skb->h.raw - skb->data;		/* This seems backwards, but it is what the sk98lin		 * does.  Looks like hardware is wrong?		 */		if (ip->protocol == IPPROTO_UDP	            && chip_rev(hw) == 0 && hw->chip_id == CHIP_ID_YUKON)			control = BMU_TCP_CHECK;		else			control = BMU_UDP_CHECK;		td->csum_offs = 0;		td->csum_start = offset;		td->csum_write = offset + skb->csum;	} else		control = BMU_CHECK;	if (!skb_shinfo(skb)->nr_frags) /* single buffer i.e. no fragments */		control |= BMU_EOF| BMU_IRQ_EOF;	else {		struct skge_tx_desc *tf = td;		control |= BMU_STFWD;		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {			skb_frag_t *frag = &skb_shinfo(skb)->frags[i];			map = pci_map_page(hw->pdev, frag->page, frag->page_offset,					   frag->size, PCI_DMA_TODEVICE);			e = e->next;			e->skb = NULL;			tf = e->desc;			tf->dma_lo = map;			tf->dma_hi = (u64) map >> 32;			pci_unmap_addr_set(e, mapaddr, map);			pci_unmap_len_set(e, maplen, frag->size);			tf->control = BMU_OWN | BMU_SW | control | frag->size;		}		tf->control |= BMU_EOF | BMU_IRQ_EOF;	}	/* Make sure all the descriptors written */	wmb();	td->control = BMU_OWN | BMU_SW | BMU_STF | control | len;	wmb();	skge_write8(hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_START);	if (netif_msg_tx_queued(skge))		printk(KERN_DEBUG "%s: tx queued, slot %d, len %d\n",		       dev->name, e - ring->start, skb->len);	ring->to_use = e->next;	skge->tx_avail -= skb_shinfo(skb)->nr_frags + 1;	if (skge->tx_avail <= MAX_SKB_FRAGS + 1) {		pr_debug("%s: transmit queue full\n", dev->name);		netif_stop_queue(dev);	}	dev->trans_start = jiffies;	spin_unlock_irqrestore(&skge->tx_lock, flags);	return NETDEV_TX_OK;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/0b2d7fea1c3893c3790e0b89c310ec1321f1b8c0/skge.c/clean/drivers/net/skge.c