-/* Open the low-level part of the 6pack channel. */
-static int sp_open(struct net_device *dev)
-{
- struct sixpack *sp = netdev_priv(dev);
- char *rbuff, *xbuff = NULL;
- int err = -ENOBUFS;
- unsigned long len;
-
- /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */
-
- len = dev->mtu * 2;
-
- rbuff = kmalloc(len + 4, GFP_KERNEL);
- if (rbuff == NULL)
- goto err_exit;
-
- xbuff = kmalloc(len + 4, GFP_KERNEL);
- if (xbuff == NULL)
- goto err_exit;
-
- spin_lock_bh(&sp->lock);
-
- if (sp->tty == NULL)
- return -ENODEV;
-
- /*
- * Allocate the 6pack frame buffers:
- *
- * rbuff Receive buffer.
- * xbuff Transmit buffer.
- */
-
- rbuff = xchg(&sp->rbuff, rbuff);
- xbuff = xchg(&sp->xbuff, xbuff);
-
- sp->mtu = AX25_MTU + 73;
- sp->buffsize = len;
- sp->rcount = 0;
- sp->rx_count = 0;
- sp->rx_count_cooked = 0;
- sp->xleft = 0;
-
- sp->flags = 0; /* Clear ESCAPE & ERROR flags */
-
- sp->duplex = 0;
- sp->tx_delay = SIXP_TXDELAY;
- sp->persistence = SIXP_PERSIST;
- sp->slottime = SIXP_SLOTTIME;
- sp->led_state = 0x60;
- sp->status = 1;
- sp->status1 = 1;
- sp->status2 = 0;
- sp->tnc_ok = 0;
- sp->tx_enable = 0;
-
- netif_start_queue(dev);
-
- init_timer(&sp->tx_t);
- init_timer(&sp->resync_t);
-
- spin_unlock_bh(&sp->lock);
-
- err = 0;
-
-err_exit:
- if (xbuff)
- kfree(xbuff);
- if (rbuff)
- kfree(rbuff);
-
- return err;
-}
-
-