Commit a01d4ab4 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[wan lapb] switch to use net_device instead of custom token

lapb functions that used to take a token to select lapb_cb they'll deal with
are switched to getting net_device instead.  Callbacks switched to using
lapb->dev instead of lapb->token.
parent c360d0a6
......@@ -44,7 +44,7 @@ static void comxlapb_rx(struct net_device *dev, struct sk_buff *skb)
if (!dev || !dev->priv) {
dev_kfree_skb(skb);
} else {
lapb_data_received(dev->priv, skb);
lapb_data_received(dev, skb);
}
}
......@@ -82,7 +82,7 @@ static int comxlapb_open(struct net_device *dev)
return -ENODEV;
}
err = lapb_connect_request(ch);
err = lapb_connect_request(dev);
if (ch->debug_flags & DEBUG_COMX_LAPB) {
comx_debug(dev, "%s: lapb opened, error code: %d\n",
......@@ -108,7 +108,7 @@ static int comxlapb_close(struct net_device *dev)
comx_debug(dev, "%s: lapb closed\n", dev->name);
}
lapb_disconnect_request(ch);
lapb_disconnect_request(dev);
ch->init_status &= ~LINE_OPEN;
ch->line_status &= ~PROTO_UP;
......@@ -130,11 +130,11 @@ static int comxlapb_xmit(struct sk_buff *skb, struct net_device *dev)
case 0x00:
break; // transmit
case 0x01:
lapb_connect_request(ch);
lapb_connect_request(dev);
kfree_skb(skb);
return 0;
case 0x02:
lapb_disconnect_request(ch);
lapb_disconnect_request(dev);
default:
kfree_skb(skb);
return 0;
......@@ -145,7 +145,7 @@ static int comxlapb_xmit(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev);
if ((skb2 = skb_clone(skb, GFP_ATOMIC)) != NULL) {
lapb_data_request(ch, skb2);
lapb_data_request(dev, skb2);
}
return FRAME_ACCEPTED;
......@@ -157,7 +157,7 @@ static int comxlapb_statistics(struct net_device *dev, char *page)
int len = 0;
len += sprintf(page + len, "Line status: ");
if (lapb_getparms(dev->priv, &parms) != LAPB_OK) {
if (lapb_getparms(dev, &parms) != LAPB_OK) {
len += sprintf(page + len, "not initialized\n");
return len;
}
......@@ -178,7 +178,7 @@ static int comxlapb_read_proc(char *page, char **start, off_t off, int count,
struct lapb_parms_struct parms;
int len = 0;
if (lapb_getparms(dev->priv, &parms)) {
if (lapb_getparms(dev, &parms)) {
return -ENODEV;
}
......@@ -223,7 +223,7 @@ static int comxlapb_write_proc(struct file *file, const char *buffer,
unsigned long parm;
char *page;
if (lapb_getparms(dev->priv, &parms)) {
if (lapb_getparms(dev, &parms)) {
return -ENODEV;
}
......@@ -243,23 +243,23 @@ static int comxlapb_write_proc(struct file *file, const char *buffer,
parm=simple_strtoul(page,NULL,10);
if (parm > 0 && parm < 100) {
parms.t1=parm;
lapb_setparms(dev->priv, &parms);
lapb_setparms(dev, &parms);
}
} else if (strcmp(entry->name, FILENAME_T2) == 0) {
parm=simple_strtoul(page, NULL, 10);
if (parm > 0 && parm < 100) {
parms.t2=parm;
lapb_setparms(dev->priv, &parms);
lapb_setparms(dev, &parms);
}
} else if (strcmp(entry->name, FILENAME_N2) == 0) {
parm=simple_strtoul(page, NULL, 10);
if (parm > 0 && parm < 100) {
parms.n2=parm;
lapb_setparms(dev->priv, &parms);
lapb_setparms(dev, &parms);
}
} else if (strcmp(entry->name, FILENAME_WINDOW) == 0) {
parms.window = simple_strtoul(page, NULL, 10);
lapb_setparms(dev->priv, &parms);
lapb_setparms(dev, &parms);
} else if (strcmp(entry->name, FILENAME_MODE) == 0) {
if (comx_strcasecmp(page, "dte") == 0) {
parms.mode &= ~(LAPB_DCE | LAPB_DTE);
......@@ -276,7 +276,7 @@ static int comxlapb_write_proc(struct file *file, const char *buffer,
parms.mode &= ~LAPB_STANDARD;
parms.mode |= LAPB_EXTENDED;
}
lapb_setparms(dev->priv, &parms);
lapb_setparms(dev, &parms);
} else {
printk(KERN_ERR "comxlapb_write_proc: internal error, filename %s\n",
entry->name);
......@@ -287,9 +287,9 @@ static int comxlapb_write_proc(struct file *file, const char *buffer,
return count;
}
static void comxlapb_connected(void *token, int reason)
static void comxlapb_connected(struct net_device *dev, int reason)
{
struct comx_channel *ch = token;
struct comx_channel *ch = dev->priv;
struct proc_dir_entry *comxdir = ch->procdir->subdir;
if (ch->debug_flags & DEBUG_COMX_LAPB) {
......@@ -327,9 +327,9 @@ static void comxlapb_connected(void *token, int reason)
comx_status(ch->dev, ch->line_status);
}
static void comxlapb_disconnected(void *token, int reason)
static void comxlapb_disconnected(struct net_device *dev, int reason)
{
struct comx_channel *ch = token;
struct comx_channel *ch = dev->priv;
struct proc_dir_entry *comxdir = ch->procdir->subdir;
if (ch->debug_flags & DEBUG_COMX_LAPB) {
......@@ -366,9 +366,9 @@ static void comxlapb_disconnected(void *token, int reason)
comx_status(ch->dev, ch->line_status);
}
static int comxlapb_data_indication(void *token, struct sk_buff *skb)
static int comxlapb_data_indication(struct net_device *dev, struct sk_buff *skb)
{
struct comx_channel *ch = token;
struct comx_channel *ch = dev->priv;
if (ch->dev->type == ARPHRD_X25) {
skb_push(skb, 1);
......@@ -387,9 +387,9 @@ static int comxlapb_data_indication(void *token, struct sk_buff *skb)
return comx_rx(ch->dev, skb);
}
static void comxlapb_data_transmit(void *token, struct sk_buff *skb)
static void comxlapb_data_transmit(struct net_device *dev, struct sk_buff *skb)
{
struct comx_channel *ch = token;
struct comx_channel *ch = dev->priv;
if (ch->HW_send_packet) {
ch->HW_send_packet(ch->dev, skb);
......@@ -417,7 +417,7 @@ static int comxlapb_exit(struct net_device *dev)
if (ch->debug_flags & DEBUG_COMX_LAPB) {
comx_debug(dev, "%s: unregistering lapb\n", dev->name);
}
lapb_unregister(dev->priv);
lapb_unregister(dev);
remove_proc_entry(FILENAME_T1, ch->procdir);
remove_proc_entry(FILENAME_T2, ch->procdir);
......
......@@ -25,21 +25,20 @@
/* These functions are callbacks called by LAPB layer */
static void x25_connect_disconnect(void *token, int reason, int code)
static void x25_connect_disconnect(struct net_device *dev, int reason, int code)
{
hdlc_device *hdlc = token;
struct sk_buff *skb;
unsigned char *ptr;
if ((skb = dev_alloc_skb(1)) == NULL) {
printk(KERN_ERR "%s: out of memory\n", hdlc_to_name(hdlc));
printk(KERN_ERR "%s: out of memory\n", dev->name);
return;
}
ptr = skb_put(skb, 1);
*ptr = code;
skb->dev = hdlc_to_dev(hdlc);
skb->dev = dev;
skb->protocol = htons(ETH_P_X25);
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
......@@ -49,23 +48,22 @@ static void x25_connect_disconnect(void *token, int reason, int code)
static void x25_connected(void *token, int reason)
static void x25_connected(struct net_device *dev, int reason)
{
x25_connect_disconnect(token, reason, 1);
x25_connect_disconnect(dev, reason, 1);
}
static void x25_disconnected(void *token, int reason)
static void x25_disconnected(struct net_device *dev, int reason)
{
x25_connect_disconnect(token, reason, 2);
x25_connect_disconnect(dev, reason, 2);
}
static int x25_data_indication(void *token, struct sk_buff *skb)
static int x25_data_indication(struct net_device *dev, struct sk_buff *skb)
{
hdlc_device *hdlc = token;
unsigned char *ptr;
skb_push(skb, 1);
......@@ -76,7 +74,7 @@ static int x25_data_indication(void *token, struct sk_buff *skb)
ptr = skb->data;
*ptr = 0;
skb->dev = hdlc_to_dev(hdlc);
skb->dev = dev;
skb->protocol = htons(ETH_P_X25);
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
......@@ -86,10 +84,10 @@ static int x25_data_indication(void *token, struct sk_buff *skb)
static void x25_data_transmit(void *token, struct sk_buff *skb)
static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb)
{
hdlc_device *hdlc = token;
hdlc->xmit(skb, hdlc_to_dev(hdlc)); /* Ignore return value :-( */
hdlc_device *hdlc = dev_to_hdlc(dev);
hdlc->xmit(skb, dev); /* Ignore return value :-( */
}
......@@ -104,15 +102,15 @@ static int x25_xmit(struct sk_buff *skb, struct net_device *dev)
switch (skb->data[0]) {
case 0: /* Data to be transmitted */
skb_pull(skb, 1);
if ((result = lapb_data_request(hdlc, skb)) != LAPB_OK)
if ((result = lapb_data_request(dev, skb)) != LAPB_OK)
dev_kfree_skb(skb);
return 0;
case 1:
if ((result = lapb_connect_request(hdlc))!= LAPB_OK) {
if ((result = lapb_connect_request(dev))!= LAPB_OK) {
if (result == LAPB_CONNECTED)
/* Send connect confirm. msg to level 3 */
x25_connected(hdlc, 0);
x25_connected(dev, 0);
else
printk(KERN_ERR "%s: LAPB connect request "
"failed, error code = %i\n",
......@@ -121,10 +119,10 @@ static int x25_xmit(struct sk_buff *skb, struct net_device *dev)
break;
case 2:
if ((result = lapb_disconnect_request(hdlc)) != LAPB_OK) {
if ((result = lapb_disconnect_request(dev)) != LAPB_OK) {
if (result == LAPB_NOTCONNECTED)
/* Send disconnect confirm. msg to level 3 */
x25_disconnected(hdlc, 0);
x25_disconnected(dev, 0);
else
printk(KERN_ERR "%s: LAPB disconnect request "
"failed, error code = %i\n",
......@@ -164,7 +162,7 @@ static int x25_open(hdlc_device *hdlc)
static void x25_close(hdlc_device *hdlc)
{
lapb_unregister(hdlc);
lapb_unregister(hdlc_to_dev(hdlc));
}
......@@ -178,7 +176,7 @@ static int x25_rx(struct sk_buff *skb)
return NET_RX_DROP;
}
if (lapb_data_received(hdlc, skb) == LAPB_OK)
if (lapb_data_received(skb->dev, skb) == LAPB_OK)
return NET_RX_SUCCESS;
hdlc->stats.rx_errors++;
......
......@@ -110,7 +110,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
skb_pull(skb, 2); /* Remove the length bytes */
skb_trim(skb, len); /* Set the length of the data */
if ((err = lapb_data_received(lapbeth, skb)) != LAPB_OK) {
if ((err = lapb_data_received(lapbeth->axdev, skb)) != LAPB_OK) {
printk(KERN_DEBUG "lapbether: lapb_data_received err - %d\n", err);
goto drop_unlock;
}
......@@ -125,9 +125,8 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
return 0;
}
static int lapbeth_data_indication(void *token, struct sk_buff *skb)
static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)token;
unsigned char *ptr;
skb_push(skb, 1);
......@@ -138,7 +137,7 @@ static int lapbeth_data_indication(void *token, struct sk_buff *skb)
ptr = skb->data;
*ptr = 0x00;
skb->dev = lapbeth->axdev;
skb->dev = dev;
skb->protocol = htons(ETH_P_X25);
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
......@@ -152,7 +151,6 @@ static int lapbeth_data_indication(void *token, struct sk_buff *skb)
*/
static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)dev->priv;
int err = -ENODEV;
/*
......@@ -168,12 +166,12 @@ static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
err = 0;
break;
case 0x01:
if ((err = lapb_connect_request(lapbeth)) != LAPB_OK)
if ((err = lapb_connect_request(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_connect_request "
"error: %d\n", err);
goto drop_ok;
case 0x02:
if ((err = lapb_disconnect_request(lapbeth)) != LAPB_OK)
if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_disconnect_request "
"err: %d\n", err);
/* Fall thru */
......@@ -183,7 +181,7 @@ static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
skb_pull(skb, 1);
if ((err = lapb_data_request(lapbeth, skb)) != LAPB_OK) {
if ((err = lapb_data_request(dev, skb)) != LAPB_OK) {
printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err);
err = -ENOMEM;
goto drop;
......@@ -198,9 +196,9 @@ static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
goto out;
}
static void lapbeth_data_transmit(void *token, struct sk_buff *skb)
static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)token;
struct lapbethdev *lapbeth = ndev->priv;
unsigned char *ptr;
struct net_device *dev;
int size = skb->len;
......@@ -222,9 +220,8 @@ static void lapbeth_data_transmit(void *token, struct sk_buff *skb)
dev_queue_xmit(skb);
}
static void lapbeth_connected(void *token, int reason)
static void lapbeth_connected(struct net_device *dev, int reason)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)token;
unsigned char *ptr;
struct sk_buff *skb = dev_alloc_skb(1);
......@@ -236,7 +233,7 @@ static void lapbeth_connected(void *token, int reason)
ptr = skb_put(skb, 1);
*ptr = 0x01;
skb->dev = lapbeth->axdev;
skb->dev = dev;
skb->protocol = htons(ETH_P_X25);
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
......@@ -245,9 +242,8 @@ static void lapbeth_connected(void *token, int reason)
netif_rx(skb);
}
static void lapbeth_disconnected(void *token, int reason)
static void lapbeth_disconnected(struct net_device *dev, int reason)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)token;
unsigned char *ptr;
struct sk_buff *skb = dev_alloc_skb(1);
......@@ -259,7 +255,7 @@ static void lapbeth_disconnected(void *token, int reason)
ptr = skb_put(skb, 1);
*ptr = 0x02;
skb->dev = lapbeth->axdev;
skb->dev = dev;
skb->protocol = htons(ETH_P_X25);
skb->mac.raw = skb->data;
skb->pkt_type = PACKET_HOST;
......@@ -318,12 +314,11 @@ static int lapbeth_open(struct net_device *dev)
static int lapbeth_close(struct net_device *dev)
{
struct lapbethdev *lapbeth = (struct lapbethdev *)dev->priv;
int err;
netif_stop_queue(dev);
if ((err = lapb_unregister(lapbeth)) != LAPB_OK)
if ((err = lapb_unregister(dev)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_unregister error - %d\n", err);
return 0;
......
......@@ -213,7 +213,7 @@ static void x25_asy_bump(struct x25_asy *sl)
memcpy(skb_put(skb,count), sl->rbuff, count);
skb->mac.raw=skb->data;
skb->protocol=htons(ETH_P_X25);
if((err=lapb_data_received(sl,skb))!=LAPB_OK)
if((err=lapb_data_received(skb->dev, skb))!=LAPB_OK)
{
kfree_skb(skb);
printk(KERN_DEBUG "x25_asy: data received err - %d\n",err);
......@@ -324,12 +324,12 @@ static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev)
{
case 0x00:break;
case 0x01: /* Connection request .. do nothing */
if((err=lapb_connect_request(sl))!=LAPB_OK)
if((err=lapb_connect_request(dev))!=LAPB_OK)
printk(KERN_ERR "x25_asy: lapb_connect_request error - %d\n", err);
kfree_skb(skb);
return 0;
case 0x02: /* Disconnect request .. do nothing - hang up ?? */
if((err=lapb_disconnect_request(sl))!=LAPB_OK)
if((err=lapb_disconnect_request(dev))!=LAPB_OK)
printk(KERN_ERR "x25_asy: lapb_disconnect_request error - %d\n", err);
default:
kfree_skb(skb);
......@@ -347,7 +347,7 @@ static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev)
* 14 Oct 1994 Dmitry Gorodchanin.
*/
if((err=lapb_data_request(sl,skb))!=LAPB_OK)
if((err=lapb_data_request(dev,skb))!=LAPB_OK)
{
printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err);
kfree_skb(skb);
......@@ -366,7 +366,7 @@ static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev)
* at the net layer.
*/
static int x25_asy_data_indication(void *token, struct sk_buff *skb)
static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb)
{
skb->dev->last_rx = jiffies;
return netif_rx(skb);
......@@ -378,9 +378,9 @@ static int x25_asy_data_indication(void *token, struct sk_buff *skb)
* perhaps lapb should allow us to bounce this ?
*/
static void x25_asy_data_transmit(void *token, struct sk_buff *skb)
static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb)
{
struct x25_asy *sl=token;
struct x25_asy *sl=dev->priv;
spin_lock(&sl->lock);
if (netif_queue_stopped(sl->dev) || sl->tty == NULL)
......@@ -405,9 +405,9 @@ static void x25_asy_data_transmit(void *token, struct sk_buff *skb)
* LAPB connection establish/down information.
*/
static void x25_asy_connected(void *token, int reason)
static void x25_asy_connected(struct net_device *dev, int reason)
{
struct x25_asy *sl = token;
struct x25_asy *sl = dev->priv;
struct sk_buff *skb;
unsigned char *ptr;
......@@ -428,9 +428,9 @@ static void x25_asy_connected(void *token, int reason)
sl->dev->last_rx = jiffies;
}
static void x25_asy_disconnected(void *token, int reason)
static void x25_asy_disconnected(struct net_device *dev, int reason)
{
struct x25_asy *sl = token;
struct x25_asy *sl = dev->priv;
struct sk_buff *skb;
unsigned char *ptr;
......@@ -525,7 +525,7 @@ static int x25_asy_close(struct net_device *dev)
netif_stop_queue(dev);
sl->rcount = 0;
sl->xleft = 0;
if((err=lapb_unregister(sl))!=LAPB_OK)
if((err=lapb_unregister(dev))!=LAPB_OK)
printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n",err);
spin_unlock(&sl->lock);
return 0;
......
......@@ -24,12 +24,12 @@
#define LAPB_DCE 0x04
struct lapb_register_struct {
void (*connect_confirmation)(void *token, int reason);
void (*connect_indication)(void *token, int reason);
void (*disconnect_confirmation)(void *token, int reason);
void (*disconnect_indication)(void *token, int reason);
int (*data_indication)(void *token, struct sk_buff *skb);
void (*data_transmit)(void *token, struct sk_buff *skb);
void (*connect_confirmation)(struct net_device *dev, int reason);
void (*connect_indication)(struct net_device *dev, int reason);
void (*disconnect_confirmation)(struct net_device *dev, int reason);
void (*disconnect_indication)(struct net_device *dev, int reason);
int (*data_indication)(struct net_device *dev, struct sk_buff *skb);
void (*data_transmit)(struct net_device *dev, struct sk_buff *skb);
};
struct lapb_parms_struct {
......@@ -45,12 +45,12 @@ struct lapb_parms_struct {
};
extern int lapb_register(struct net_device *dev, void *token, struct lapb_register_struct *callbacks);
extern int lapb_unregister(void *token);
extern int lapb_getparms(void *token, struct lapb_parms_struct *parms);
extern int lapb_setparms(void *token, struct lapb_parms_struct *parms);
extern int lapb_connect_request(void *token);
extern int lapb_disconnect_request(void *token);
extern int lapb_data_request(void *token, struct sk_buff *skb);
extern int lapb_data_received(void *token, struct sk_buff *skb);
extern int lapb_unregister(struct net_device *dev);
extern int lapb_getparms(struct net_device *dev, struct lapb_parms_struct *parms);
extern int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms);
extern int lapb_connect_request(struct net_device *dev);
extern int lapb_disconnect_request(struct net_device *dev);
extern int lapb_data_request(struct net_device *dev, struct sk_buff *skb);
extern int lapb_data_received(struct net_device *dev, struct sk_buff *skb);
#endif
......@@ -81,18 +81,14 @@ static void __lapb_insert_cb(struct lapb_cb *lapb)
lapb_hold(lapb);
}
/*
* Convert the integer token used by the device driver into a pointer
* to a LAPB control structure.
*/
static struct lapb_cb *__lapb_tokentostruct(void *token)
static struct lapb_cb *__lapb_devtostruct(struct net_device *dev)
{
struct list_head *entry;
struct lapb_cb *lapb, *use = NULL;
list_for_each(entry, &lapb_list) {
lapb = list_entry(entry, struct lapb_cb, node);
if (lapb->token == token) {
if (lapb->dev == dev) {
use = lapb;
break;
}
......@@ -104,12 +100,12 @@ static struct lapb_cb *__lapb_tokentostruct(void *token)
return use;
}
static struct lapb_cb *lapb_tokentostruct(void *token)
static struct lapb_cb *lapb_devtostruct(struct net_device *dev)
{
struct lapb_cb *rc;
read_lock_bh(&lapb_list_lock);
rc = __lapb_tokentostruct(token);
rc = __lapb_devtostruct(dev);
read_unlock_bh(&lapb_list_lock);
return rc;
......@@ -151,7 +147,7 @@ int lapb_register(struct net_device *dev, void *token, struct lapb_register_stru
write_lock_bh(&lapb_list_lock);
lapb = __lapb_tokentostruct(token);
lapb = __lapb_devtostruct(dev);
if (lapb) {
lapb_put(lapb);
goto out;
......@@ -176,13 +172,13 @@ int lapb_register(struct net_device *dev, void *token, struct lapb_register_stru
return rc;
}
int lapb_unregister(void *token)
int lapb_unregister(struct net_device *dev)
{
struct lapb_cb *lapb;
int rc = LAPB_BADTOKEN;
write_unlock_bh(&lapb_list_lock);
lapb = __lapb_tokentostruct(token);
lapb = __lapb_devtostruct(dev);
if (!lapb)
goto out;
......@@ -200,10 +196,10 @@ int lapb_unregister(void *token)
return rc;
}
int lapb_getparms(void *token, struct lapb_parms_struct *parms)
int lapb_getparms(struct net_device *dev, struct lapb_parms_struct *parms)
{
int rc = LAPB_BADTOKEN;
struct lapb_cb *lapb = lapb_tokentostruct(token);
struct lapb_cb *lapb = lapb_devtostruct(dev);
if (!lapb)
goto out;
......@@ -232,10 +228,10 @@ int lapb_getparms(void *token, struct lapb_parms_struct *parms)
return rc;
}
int lapb_setparms(void *token, struct lapb_parms_struct *parms)
int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms)
{
int rc = LAPB_BADTOKEN;
struct lapb_cb *lapb = lapb_tokentostruct(token);
struct lapb_cb *lapb = lapb_devtostruct(dev);
if (!lapb)
goto out;
......@@ -265,9 +261,9 @@ int lapb_setparms(void *token, struct lapb_parms_struct *parms)
return rc;
}
int lapb_connect_request(void *token)
int lapb_connect_request(struct net_device *dev)
{
struct lapb_cb *lapb = lapb_tokentostruct(token);
struct lapb_cb *lapb = lapb_devtostruct(dev);
int rc = LAPB_BADTOKEN;
if (!lapb)
......@@ -295,9 +291,9 @@ int lapb_connect_request(void *token)
return rc;
}
int lapb_disconnect_request(void *token)
int lapb_disconnect_request(struct net_device *dev)
{
struct lapb_cb *lapb = lapb_tokentostruct(token);
struct lapb_cb *lapb = lapb_devtostruct(dev);
int rc = LAPB_BADTOKEN;
if (!lapb)
......@@ -347,9 +343,9 @@ int lapb_disconnect_request(void *token)
return rc;
}
int lapb_data_request(void *token, struct sk_buff *skb)
int lapb_data_request(struct net_device *dev, struct sk_buff *skb)
{
struct lapb_cb *lapb = lapb_tokentostruct(token);
struct lapb_cb *lapb = lapb_devtostruct(dev);
int rc = LAPB_BADTOKEN;
if (!lapb)
......@@ -368,9 +364,9 @@ int lapb_data_request(void *token, struct sk_buff *skb)
return rc;
}
int lapb_data_received(void *token, struct sk_buff *skb)
int lapb_data_received(struct net_device *dev, struct sk_buff *skb)
{
struct lapb_cb *lapb = lapb_tokentostruct(token);
struct lapb_cb *lapb = lapb_devtostruct(dev);
int rc = LAPB_BADTOKEN;
if (lapb) {
......@@ -385,31 +381,31 @@ int lapb_data_received(void *token, struct sk_buff *skb)
void lapb_connect_confirmation(struct lapb_cb *lapb, int reason)
{
if (lapb->callbacks.connect_confirmation)
lapb->callbacks.connect_confirmation(lapb->token, reason);
lapb->callbacks.connect_confirmation(lapb->dev, reason);
}
void lapb_connect_indication(struct lapb_cb *lapb, int reason)
{
if (lapb->callbacks.connect_indication)
lapb->callbacks.connect_indication(lapb->token, reason);
lapb->callbacks.connect_indication(lapb->dev, reason);
}
void lapb_disconnect_confirmation(struct lapb_cb *lapb, int reason)
{
if (lapb->callbacks.disconnect_confirmation)
lapb->callbacks.disconnect_confirmation(lapb->token, reason);
lapb->callbacks.disconnect_confirmation(lapb->dev, reason);
}
void lapb_disconnect_indication(struct lapb_cb *lapb, int reason)
{
if (lapb->callbacks.disconnect_indication)
lapb->callbacks.disconnect_indication(lapb->token, reason);
lapb->callbacks.disconnect_indication(lapb->dev, reason);
}
int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *skb)
{
if (lapb->callbacks.data_indication)
return lapb->callbacks.data_indication(lapb->token, skb);
return lapb->callbacks.data_indication(lapb->dev, skb);
kfree_skb(skb);
return NET_RX_CN_HIGH; /* For now; must be != NET_RX_DROP */
......@@ -420,7 +416,7 @@ int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *skb)
int used = 0;
if (lapb->callbacks.data_transmit) {
lapb->callbacks.data_transmit(lapb->token, skb);
lapb->callbacks.data_transmit(lapb->dev, skb);
used = 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment