/* Return value: number of bytes accepted for sending (skb->len) if ok, error code < 0 (eg. -ENOMEM) on error  */
int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
/* Return value: number of bytes accepted for sending (skb->len) if ok, error code < 0 (eg. -ENOMEM) on error  */
int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb)
{
	struct cardstate *cs = bcs->cs;
	unsigned len = skb->len;
	unsigned long flags;
	if (bcs->proto2 == L2_HDLC)
		skb = HDLC_Encode(skb);
	else
		skb = iraw_encode(skb);
	if (!skb) {
		dev_err(cs->dev,
			"unable to allocate memory for encoding!\n");
		return -ENOMEM;
	}
	skb_queue_tail(&bcs->squeue, skb);
	spin_lock_irqsave(&cs->lock, flags);
	if (cs->connected)
		tasklet_schedule(&cs->write_tasklet);
	spin_unlock_irqrestore(&cs->lock, flags);
	return len;
}