int s2io_xmit(struct sk_buff *skb, struct net_device *dev) 
static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) 
int s2io_xmit(struct sk_buff *skb, struct net_device *dev){	nic_t *sp = dev->priv;	u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off;	register u64 val64;	TxD_t *txdp;	TxFIFO_element_t __iomem *tx_fifo;	unsigned long flags;#ifdef NETIF_F_TSO	int mss;#endif	u16 vlan_tag = 0;	int vlan_priority = 0;	mac_info_t *mac_control;	struct config_param *config;	mac_control = &sp->mac_control;	config = &sp->config;	DBG_PRINT(TX_DBG, "%s: In Neterion Tx routine\n", dev->name);	spin_lock_irqsave(&sp->tx_lock, flags);	if (atomic_read(&sp->card_state) == CARD_DOWN) {		DBG_PRINT(TX_DBG, "%s: Card going down for reset\n",			  dev->name);		spin_unlock_irqrestore(&sp->tx_lock, flags);		dev_kfree_skb(skb);		return 0;	}	queue = 0;	/* Get Fifo number to Transmit based on vlan priority */	if (sp->vlgrp && vlan_tx_tag_present(skb)) {		vlan_tag = vlan_tx_tag_get(skb);		vlan_priority = vlan_tag >> 13;		queue = config->fifo_mapping[vlan_priority];	}	put_off = (u16) mac_control->fifos[queue].tx_curr_put_info.offset;	get_off = (u16) mac_control->fifos[queue].tx_curr_get_info.offset;	txdp = (TxD_t *) mac_control->fifos[queue].list_info[put_off].		list_virt_addr;	queue_len = mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1;	/* Avoid "put" pointer going beyond "get" pointer */	if (txdp->Host_Control || (((put_off + 1) % queue_len) == get_off)) {		DBG_PRINT(TX_DBG, "Error in xmit, No free TXDs.\n");		netif_stop_queue(dev);		dev_kfree_skb(skb);		spin_unlock_irqrestore(&sp->tx_lock, flags);		return 0;	}	/* A buffer with no data will be dropped */	if (!skb->len) {		DBG_PRINT(TX_DBG, "%s:Buffer has no data..\n", dev->name);		dev_kfree_skb(skb);		spin_unlock_irqrestore(&sp->tx_lock, flags);		return 0;	}#ifdef NETIF_F_TSO	mss = skb_shinfo(skb)->tso_size;	if (mss) {		txdp->Control_1 |= TXD_TCP_LSO_EN;		txdp->Control_1 |= TXD_TCP_LSO_MSS(mss);	}#endif	frg_cnt = skb_shinfo(skb)->nr_frags;	frg_len = skb->len - skb->data_len;	txdp->Buffer_Pointer = pci_map_single	    (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE);	txdp->Host_Control = (unsigned long) skb;	if (skb->ip_summed == CHECKSUM_HW) {		txdp->Control_2 |=		    (TXD_TX_CKO_IPV4_EN | TXD_TX_CKO_TCP_EN |		     TXD_TX_CKO_UDP_EN);	}	txdp->Control_2 |= config->tx_intr_type;	if (sp->vlgrp && vlan_tx_tag_present(skb)) {		txdp->Control_2 |= TXD_VLAN_ENABLE;		txdp->Control_2 |= TXD_VLAN_TAG(vlan_tag);	}	txdp->Control_1 |= (TXD_BUFFER0_SIZE(frg_len) |			    TXD_GATHER_CODE_FIRST);	txdp->Control_1 |= TXD_LIST_OWN_XENA;	/* For fragmented SKB. */	for (i = 0; i < frg_cnt; i++) {		skb_frag_t *frag = &skb_shinfo(skb)->frags[i];		/* A '0' length fragment will be ignored */		if (!frag->size)			continue;		txdp++;		txdp->Buffer_Pointer = (u64) pci_map_page		    (sp->pdev, frag->page, frag->page_offset,		     frag->size, PCI_DMA_TODEVICE);		txdp->Control_1 |= TXD_BUFFER0_SIZE(frag->size);	}	txdp->Control_1 |= TXD_GATHER_CODE_LAST;	tx_fifo = mac_control->tx_FIFO_start[queue];	val64 = mac_control->fifos[queue].list_info[put_off].list_phy_addr;	writeq(val64, &tx_fifo->TxDL_Pointer);	val64 = (TX_FIFO_LAST_TXD_NUM(frg_cnt) | TX_FIFO_FIRST_LIST |		 TX_FIFO_LAST_LIST);#ifdef NETIF_F_TSO	if (mss)		val64 |= TX_FIFO_SPECIAL_FUNC;#endif	writeq(val64, &tx_fifo->List_Control);	mmiowb();	put_off++;	put_off %= mac_control->fifos[queue].tx_curr_put_info.fifo_len + 1;	mac_control->fifos[queue].tx_curr_put_info.offset = put_off;	/* Avoid "put" pointer going beyond "get" pointer */	if (((put_off + 1) % queue_len) == get_off) {		DBG_PRINT(TX_DBG,			  "No free TxDs for xmit, Put: 0x%x Get:0x%x\n",			  put_off, get_off);		netif_stop_queue(dev);	}	dev->trans_start = jiffies;	spin_unlock_irqrestore(&sp->tx_lock, flags);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/ac1f60db6a62c8605b551497c8002ba267ea1f4a/s2io.c/buggy/drivers/net/s2io.c