int kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; 
gfp_t kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; 
static int ether1394_tx (struct sk_buff *skb, struct net_device *dev){	int kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;	struct eth1394hdr *eth;	struct eth1394_priv *priv = netdev_priv(dev);	int proto;	unsigned long flags;	nodeid_t dest_node;	eth1394_tx_type tx_type;	int ret = 0;	unsigned int tx_len;	unsigned int max_payload;	u16 dg_size;	u16 dgl;	struct packet_task *ptask;	struct eth1394_node_ref *node;	struct eth1394_node_info *node_info = NULL;	ptask = kmem_cache_alloc(packet_task_cache, kmflags);	if (ptask == NULL) {		ret = -ENOMEM;		goto fail;	}	/* XXX Ignore this for now. Noticed that when MacOSX is the IRM,	 * it does not set our validity bit. We need to compensate for	 * that somewhere else, but not in eth1394. */#if 0	if ((priv->host->csr.broadcast_channel & 0xc0000000) != 0xc0000000) {		ret = -EAGAIN;		goto fail;	}#endif	if ((skb = skb_share_check (skb, kmflags)) == NULL) {		ret = -ENOMEM;		goto fail;	}	/* Get rid of the fake eth1394 header, but save a pointer */	eth = (struct eth1394hdr*)skb->data;	skb_pull(skb, ETH1394_HLEN);	proto = eth->h_proto;	dg_size = skb->len;	/* Set the transmission type for the packet.  ARP packets and IP	 * broadcast packets are sent via GASP. */	if (memcmp(eth->h_dest, dev->broadcast, ETH1394_ALEN) == 0 ||	    proto == __constant_htons(ETH_P_ARP) ||	    (proto == __constant_htons(ETH_P_IP) &&	     IN_MULTICAST(__constant_ntohl(skb->nh.iph->daddr)))) {		tx_type = ETH1394_GASP;		dest_node = LOCAL_BUS | ALL_NODES;		max_payload = priv->bc_maxpayload - ETHER1394_GASP_OVERHEAD;		BUG_ON(max_payload < (512 - ETHER1394_GASP_OVERHEAD));		dgl = priv->bc_dgl;		if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])			priv->bc_dgl++;	} else {		node = eth1394_find_node_guid(&priv->ip_node_list,					      be64_to_cpu(*(u64*)eth->h_dest));		if (!node) {			ret = -EAGAIN;			goto fail;		}		node_info = (struct eth1394_node_info*)node->ud->device.driver_data;		if (node_info->fifo == ETHER1394_INVALID_ADDR) {			ret = -EAGAIN;			goto fail;		}		dest_node = node->ud->ne->nodeid;		max_payload = node_info->maxpayload;		BUG_ON(max_payload < (512 - ETHER1394_GASP_OVERHEAD));		dgl = node_info->dgl;		if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF])			node_info->dgl++;		tx_type = ETH1394_WRREQ;	}	/* If this is an ARP packet, convert it */	if (proto == __constant_htons (ETH_P_ARP))		ether1394_arp_to_1394arp (skb, dev);	ptask->hdr.words.word1 = 0;	ptask->hdr.words.word2 = 0;	ptask->hdr.words.word3 = 0;	ptask->hdr.words.word4 = 0;	ptask->skb = skb;	ptask->priv = priv;	ptask->tx_type = tx_type;	if (tx_type != ETH1394_GASP) {		u64 addr;		spin_lock_irqsave(&priv->lock, flags);		addr = node_info->fifo;		spin_unlock_irqrestore(&priv->lock, flags);		ptask->addr = addr;		ptask->dest_node = dest_node;	}	ptask->tx_type = tx_type;	ptask->max_payload = max_payload;        ptask->outstanding_pkts = ether1394_encapsulate_prep(max_payload, proto,							     &ptask->hdr, dg_size,							     dgl);	/* Add the encapsulation header to the fragment */	tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr);	dev->trans_start = jiffies;	if (ether1394_send_packet(ptask, tx_len))		goto fail;	netif_wake_queue(dev);	return 0;fail:	if (ptask)		kmem_cache_free(packet_task_cache, ptask);	if (skb != NULL)		dev_kfree_skb(skb);	spin_lock_irqsave (&priv->lock, flags);	priv->stats.tx_dropped++;	priv->stats.tx_errors++;	spin_unlock_irqrestore (&priv->lock, flags);	if (netif_queue_stopped(dev))		netif_wake_queue(dev);	return 0;  /* returning non-zero causes serious problems */}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b4e3ca1ab1ae9ae86134126dcdc88da1caaa32ca/eth1394.c/buggy/drivers/ieee1394/eth1394.c