Commit 3814794a authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move "name" member from isdn_net_local to isdn_net_dev

This is the first step of a long series moving members between
isdn_net_local and isdn_net_dev.

Today, a one-to-one relationship between these both structures exist, so
it does not really matter where the members live. However, the goal
is to get a correspondence like

net_device -> isdn_net_local -> master isdn_net_device
                                           |
                                slave  isdn_net_device
                                           |
                                slave  isdn_net_device

where more than one isdn_net_device can exist per actual net_device,
due to channel bundling.
parent 1a5f681b
...@@ -43,6 +43,7 @@ static int ...@@ -43,6 +43,7 @@ static int
isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
isdn_net_local *lp = (isdn_net_local *) dev->priv; isdn_net_local *lp = (isdn_net_local *) dev->priv;
isdn_net_dev *idev = lp->netdev;
unsigned long len = 0; unsigned long len = 0;
unsigned long expires = 0; unsigned long expires = 0;
int tmp = 0; int tmp = 0;
...@@ -77,7 +78,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -77,7 +78,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
mod_timer(&lp->cisco_timer, expires); mod_timer(&lp->cisco_timer, expires);
printk(KERN_INFO "%s: Keepalive period set " printk(KERN_INFO "%s: Keepalive period set "
"to %d seconds.\n", "to %d seconds.\n",
lp->name, lp->cisco_keepalive_period); idev->name, lp->cisco_keepalive_period);
} }
break; break;
...@@ -111,6 +112,7 @@ static void ...@@ -111,6 +112,7 @@ static void
isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
{ {
isdn_net_local *lp = (isdn_net_local *) data; isdn_net_local *lp = (isdn_net_local *) data;
isdn_net_dev *idev = lp->netdev;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *p; unsigned char *p;
unsigned long last_cisco_myseq = lp->cisco_myseq; unsigned long last_cisco_myseq = lp->cisco_myseq;
...@@ -124,7 +126,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) ...@@ -124,7 +126,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
lp->cisco_line_state = 0; lp->cisco_line_state = 0;
printk (KERN_WARNING printk (KERN_WARNING
"UPDOWN: Line protocol on Interface %s," "UPDOWN: Line protocol on Interface %s,"
" changed state to down\n", lp->name); " changed state to down\n", idev->name);
/* should stop routing higher-level data accross */ /* should stop routing higher-level data accross */
} else if ((!lp->cisco_line_state) && } else if ((!lp->cisco_line_state) &&
(myseq_diff >= 0) && (myseq_diff <= 2)) { (myseq_diff >= 0) && (myseq_diff <= 2)) {
...@@ -132,17 +134,17 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data) ...@@ -132,17 +134,17 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
lp->cisco_line_state = 1; lp->cisco_line_state = 1;
printk (KERN_WARNING printk (KERN_WARNING
"UPDOWN: Line protocol on Interface %s," "UPDOWN: Line protocol on Interface %s,"
" changed state to up\n", lp->name); " changed state to up\n", idev->name);
/* restart routing higher-level data accross */ /* restart routing higher-level data accross */
} }
if (lp->cisco_debserint) if (lp->cisco_debserint)
printk (KERN_DEBUG "%s: HDLC " printk (KERN_DEBUG "%s: HDLC "
"myseq %lu, mineseen %lu%c, yourseen %lu, %s\n", "myseq %lu, mineseen %lu%c, yourseen %lu, %s\n",
lp->name, last_cisco_myseq, lp->cisco_mineseen, idev->name, last_cisco_myseq, lp->cisco_mineseen,
((last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040), (last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040,
lp->cisco_yourseq, lp->cisco_yourseq,
((lp->cisco_line_state) ? "line up" : "line down")); (lp->cisco_line_state) ? "line up" : "line down");
skb = isdn_net_ciscohdlck_alloc_skb(lp, 4 + 14); skb = isdn_net_ciscohdlck_alloc_skb(lp, 4 + 14);
if (!skb) if (!skb)
...@@ -268,6 +270,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) ...@@ -268,6 +270,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
static void static void
isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
{ {
isdn_net_dev *idev = lp->netdev;
unsigned char *p; unsigned char *p;
int period; int period;
u32 code; u32 code;
...@@ -299,7 +302,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) ...@@ -299,7 +302,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
"remote ip: %d.%d.%d.%d, " "remote ip: %d.%d.%d.%d, "
"local ip: %d.%d.%d.%d " "local ip: %d.%d.%d.%d "
"mask: %d.%d.%d.%d\n", "mask: %d.%d.%d.%d\n",
lp->name, idev->name,
HIPQUAD(addr), HIPQUAD(addr),
HIPQUAD(local), HIPQUAD(local),
HIPQUAD(mask)); HIPQUAD(mask));
...@@ -307,7 +310,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) ...@@ -307,7 +310,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
slarp_reply_out: slarp_reply_out:
printk(KERN_INFO "%s: got invalid slarp " printk(KERN_INFO "%s: got invalid slarp "
"reply (%d.%d.%d.%d/%d.%d.%d.%d) " "reply (%d.%d.%d.%d/%d.%d.%d.%d) "
"- ignored\n", lp->name, "- ignored\n", idev->name,
HIPQUAD(addr), HIPQUAD(mask)); HIPQUAD(addr), HIPQUAD(mask));
break; break;
case CISCO_SLARP_KEEPALIVE: case CISCO_SLARP_KEEPALIVE:
...@@ -318,7 +321,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) ...@@ -318,7 +321,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
lp->cisco_last_slarp_in) { lp->cisco_last_slarp_in) {
printk(KERN_DEBUG "%s: Keepalive period mismatch - " printk(KERN_DEBUG "%s: Keepalive period mismatch - "
"is %d but should be %d.\n", "is %d but should be %d.\n",
lp->name, period, lp->cisco_keepalive_period); idev->name, period, lp->cisco_keepalive_period);
} }
lp->cisco_last_slarp_in = jiffies; lp->cisco_last_slarp_in = jiffies;
p += get_u32(p, &my_seq); p += get_u32(p, &my_seq);
...@@ -352,7 +355,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp, ...@@ -352,7 +355,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
if ((addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) || if ((addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) ||
ctrl != CISCO_CTRL) { ctrl != CISCO_CTRL) {
printk(KERN_DEBUG "%s: Unknown Cisco header %#02x %#02x\n", printk(KERN_DEBUG "%s: Unknown Cisco header %#02x %#02x\n",
lp->name, addr, ctrl); idev->name, addr, ctrl);
goto out_free; goto out_free;
} }
...@@ -363,7 +366,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp, ...@@ -363,7 +366,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
case CISCO_TYPE_CDP: case CISCO_TYPE_CDP:
if (lp->cisco_debserint) if (lp->cisco_debserint)
printk(KERN_DEBUG "%s: Received CDP packet. use " printk(KERN_DEBUG "%s: Received CDP packet. use "
"\"no cdp enable\" on cisco.\n", lp->name); "\"no cdp enable\" on cisco.\n", idev->name);
goto out_free; goto out_free;
default: default:
/* no special cisco protocol */ /* no special cisco protocol */
......
This diff is collapsed.
...@@ -153,6 +153,7 @@ isdn_ppp_free(isdn_net_local * lp) ...@@ -153,6 +153,7 @@ isdn_ppp_free(isdn_net_local * lp)
int int
isdn_ppp_bind(isdn_net_local * lp) isdn_ppp_bind(isdn_net_local * lp)
{ {
isdn_net_dev *idev = lp->netdev;
int i; int i;
int unit = 0; int unit = 0;
long flags; long flags;
...@@ -194,9 +195,9 @@ isdn_ppp_bind(isdn_net_local * lp) ...@@ -194,9 +195,9 @@ isdn_ppp_bind(isdn_net_local * lp)
retval = -1; retval = -1;
goto out; goto out;
} }
unit = isdn_ppp_if_get_unit(lp->name); /* get unit number from interface name .. ugly! */ unit = isdn_ppp_if_get_unit(idev->name); /* get unit number from interface name .. ugly! */
if (unit < 0) { if (unit < 0) {
printk(KERN_ERR "isdn_ppp_bind: illegal interface name %s.\n", lp->name); printk(KERN_ERR "isdn_ppp_bind: illegal interface name %s.\n", idev->name);
retval = -1; retval = -1;
goto out; goto out;
} }
...@@ -428,11 +429,13 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -428,11 +429,13 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
unsigned long val; unsigned long val;
int r,i,j; int r,i,j;
struct ippp_struct *is; struct ippp_struct *is;
isdn_net_dev *idev;
isdn_net_local *lp; isdn_net_local *lp;
struct isdn_ppp_comp_data data; struct isdn_ppp_comp_data data;
is = (struct ippp_struct *) file->private_data; is = (struct ippp_struct *) file->private_data;
lp = is->lp; lp = is->lp;
idev = lp->netdev;
if (is->debug & 0x1) if (is->debug & 0x1)
printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n", is->minor, cmd, is->state); printk(KERN_DEBUG "isdn_ppp_ioctl: minor: %d cmd: %x state: %x\n", is->minor, cmd, is->state);
...@@ -461,7 +464,7 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -461,7 +464,7 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
case PPPIOCGIFNAME: case PPPIOCGIFNAME:
if(!lp) if(!lp)
return -EINVAL; return -EINVAL;
if ((r = set_arg((void *) arg, lp->name, strlen(lp->name)))) if ((r = set_arg((void *) arg, idev->name, strlen(idev->name))))
return r; return r;
break; break;
case PPPIOCGMPFLAGS: /* get configuration flags */ case PPPIOCGMPFLAGS: /* get configuration flags */
......
...@@ -311,7 +311,6 @@ struct isdn_netif_ops { ...@@ -311,7 +311,6 @@ struct isdn_netif_ops {
typedef struct isdn_net_local_s { typedef struct isdn_net_local_s {
spinlock_t lock; spinlock_t lock;
ulong magic; ulong magic;
char name[10]; /* Name of device */
struct timer_list dial_timer; /* dial events timer */ struct timer_list dial_timer; /* dial events timer */
int dial_event; /* event in case of timer expiry */ int dial_event; /* event in case of timer expiry */
struct net_device_stats stats; /* Ethernet Statistics */ struct net_device_stats stats; /* Ethernet Statistics */
...@@ -410,6 +409,7 @@ typedef struct isdn_net_dev_s { ...@@ -410,6 +409,7 @@ typedef struct isdn_net_dev_s {
channels, which are currently channels, which are currently
online */ online */
spinlock_t queue_lock; /* lock to protect queue */ spinlock_t queue_lock; /* lock to protect queue */
char name[10]; /* Name of device */
struct list_head global_list; /* global list of all isdn_net_devs */ struct list_head global_list; /* global list of all isdn_net_devs */
struct net_device dev; /* interface to upper levels */ struct net_device dev; /* interface to upper levels */
#ifdef CONFIG_ISDN_PPP #ifdef CONFIG_ISDN_PPP
......
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