Esempio n. 1
0
static int LOCOMX_send_packet(struct net_device *dev, struct sk_buff *skb) 
{
	struct comx_channel *ch = netdev_priv(dev);
	struct locomx_data *hw = ch->HW_privdata;

	if (ch->debug_flags & DEBUG_HW_TX) {
		comx_debug_bytes(dev, skb->data, skb->len, "LOCOMX_send_packet");
	}

	if (!(ch->line_status & LINE_UP)) {
		return FRAME_DROPPED;
	}

	if(z8530_queue_xmit(&hw->board.chanA,skb)) {
		printk(KERN_WARNING "%s: FRAME_DROPPED\n",dev->name);
		return FRAME_DROPPED;
	}

	if (ch->debug_flags & DEBUG_HW_TX) {
		comx_debug(dev, "%s: LOCOMX_send_packet was successful\n\n", dev->name);
	}

	if(!hw->board.chanA.tx_next_skb) {
		return FRAME_QUEUED;
	} else {
		return FRAME_ACCEPTED;
	}
}
Esempio n. 2
0
File: comx.c Progetto: nhanh0/hah
int comx_debug_skb(struct net_device *dev, struct sk_buff *skb, char *msg)
{
    struct comx_channel *ch = dev->priv;

    if (!ch->debug_area) return 0;
    if (!skb) comx_debug(dev, "%s: %s NULL skb\n\n", dev->name, msg);
    if (!skb->len) comx_debug(dev, "%s: %s empty skb\n\n", dev->name, msg);

    return comx_debug_bytes(dev, skb->data, skb->len, msg);
}
Esempio n. 3
0
static int MIXCOM_send_packet(struct net_device *dev, struct sk_buff *skb) 
{
	struct comx_channel *ch = dev->priv;
	struct mixcom_privdata *hw = ch->HW_privdata;
	unsigned long flags;

	if (ch->debug_flags & DEBUG_HW_TX) {
		comx_debug_bytes(dev, skb->data, skb->len, "MIXCOM_send_packet");
	}

	if (!(ch->line_status & LINE_UP)) {
		return FRAME_DROPPED;
	}

	if (skb->len > HSCX_MTU) {
		ch->stats.tx_errors++;	
		return FRAME_ERROR;
	}

	save_flags(flags); cli();

	if (test_and_set_bit(0, &hw->txbusy)) {
		printk(KERN_ERR "%s: transmitter called while busy... dropping frame (length %d)\n", dev->name, skb->len);
		restore_flags(flags);
		return FRAME_DROPPED;
	}


	hw->sending = skb;
	hw->tx_ptr = 0;
	hw->txbusy = 1;
//	atomic_inc(&skb->users);	// save it
	hscx_fill_fifo(dev);
	restore_flags(flags);

	ch->stats.tx_packets++;
	ch->stats.tx_bytes += skb->len; 

	if (ch->debug_flags & DEBUG_HW_TX) {
		comx_debug(dev, "MIXCOM_send_packet was successful\n\n");
	}

	return FRAME_ACCEPTED;
}