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
isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
isdn_net_local *lp = (isdn_net_local *) dev->priv;
isdn_net_dev *idev = lp->netdev;
unsigned long len = 0;
unsigned long expires = 0;
int tmp = 0;
......@@ -77,7 +78,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
mod_timer(&lp->cisco_timer, expires);
printk(KERN_INFO "%s: Keepalive period set "
"to %d seconds.\n",
lp->name, lp->cisco_keepalive_period);
idev->name, lp->cisco_keepalive_period);
}
break;
......@@ -111,6 +112,7 @@ static void
isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
{
isdn_net_local *lp = (isdn_net_local *) data;
isdn_net_dev *idev = lp->netdev;
struct sk_buff *skb;
unsigned char *p;
unsigned long last_cisco_myseq = lp->cisco_myseq;
......@@ -124,7 +126,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
lp->cisco_line_state = 0;
printk (KERN_WARNING
"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 */
} else if ((!lp->cisco_line_state) &&
(myseq_diff >= 0) && (myseq_diff <= 2)) {
......@@ -132,17 +134,17 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
lp->cisco_line_state = 1;
printk (KERN_WARNING
"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 */
}
if (lp->cisco_debserint)
printk (KERN_DEBUG "%s: HDLC "
"myseq %lu, mineseen %lu%c, yourseen %lu, %s\n",
lp->name, last_cisco_myseq, lp->cisco_mineseen,
((last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040),
idev->name, last_cisco_myseq, lp->cisco_mineseen,
(last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040,
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);
if (!skb)
......@@ -268,6 +270,7 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
static void
isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
{
isdn_net_dev *idev = lp->netdev;
unsigned char *p;
int period;
u32 code;
......@@ -299,7 +302,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
"remote ip: %d.%d.%d.%d, "
"local ip: %d.%d.%d.%d "
"mask: %d.%d.%d.%d\n",
lp->name,
idev->name,
HIPQUAD(addr),
HIPQUAD(local),
HIPQUAD(mask));
......@@ -307,7 +310,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
slarp_reply_out:
printk(KERN_INFO "%s: got invalid slarp "
"reply (%d.%d.%d.%d/%d.%d.%d.%d) "
"- ignored\n", lp->name,
"- ignored\n", idev->name,
HIPQUAD(addr), HIPQUAD(mask));
break;
case CISCO_SLARP_KEEPALIVE:
......@@ -318,7 +321,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
lp->cisco_last_slarp_in) {
printk(KERN_DEBUG "%s: Keepalive period mismatch - "
"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;
p += get_u32(p, &my_seq);
......@@ -352,7 +355,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
if ((addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) ||
ctrl != CISCO_CTRL) {
printk(KERN_DEBUG "%s: Unknown Cisco header %#02x %#02x\n",
lp->name, addr, ctrl);
idev->name, addr, ctrl);
goto out_free;
}
......@@ -363,7 +366,7 @@ isdn_ciscohdlck_receive(isdn_net_dev *idev, isdn_net_local *olp,
case CISCO_TYPE_CDP:
if (lp->cisco_debserint)
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;
default:
/* no special cisco protocol */
......
......@@ -375,6 +375,8 @@ static void isdn_net_lp_disconnected(isdn_net_local *lp)
static void isdn_net_connected(isdn_net_local *lp)
{
isdn_net_dev *idev = lp->netdev;
lp->dialstate = ST_ACTIVE;
lp->hup_timer.expires = jiffies + HZ;
add_timer(&lp->hup_timer);
......@@ -385,7 +387,7 @@ static void isdn_net_connected(isdn_net_local *lp)
isdn_net_add_to_bundle(nd, lp);
}
}
printk(KERN_INFO "isdn_net: %s connected\n", lp->name);
printk(KERN_INFO "isdn_net: %s connected\n", idev->name);
/* If first Chargeinfo comes before B-Channel connect,
* we correct the timestamp here.
*/
......@@ -538,7 +540,7 @@ do_dialout(isdn_net_local *lp)
static int
isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
{
isdn_net_dev *p = lp->netdev;
isdn_net_dev *idev = lp->netdev;
isdn_ctrl *c = arg;
isdn_ctrl cmd;
......@@ -565,8 +567,8 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
isdn_net_lp_disconnected(lp);
isdn_slot_all_eaz(lp->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", lp->name);
printk(KERN_INFO "%s: Chargesum is %d\n", lp->name,
printk(KERN_INFO "%s: remote hangup\n", idev->name);
printk(KERN_INFO "%s: Chargesum is %d\n", idev->name,
lp->charge);
isdn_net_unbind_channel(lp);
return 1;
......@@ -601,7 +603,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
case EV_NET_TIMER_CB:
/* Remote does callback. Hangup after cbdelay,
* then wait for incoming call */
printk(KERN_INFO "%s: hangup waiting for callback ...\n", lp->name);
printk(KERN_INFO "%s: hangup waiting for callback ...\n", idev->name);
isdn_net_hangup(lp);
return 1;
case ISDN_STAT_DCONN:
......@@ -616,7 +618,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
case ISDN_STAT_DHUP:
del_timer(&lp->dial_timer);
isdn_slot_all_eaz(lp->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", lp->name);
printk(KERN_INFO "%s: remote hangup\n", idev->name);
isdn_net_unbind_channel(lp);
return 1;
}
......@@ -635,7 +637,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
case ISDN_STAT_DHUP:
del_timer(&lp->dial_timer);
isdn_slot_all_eaz(lp->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", lp->name);
printk(KERN_INFO "%s: remote hangup\n", idev->name);
isdn_net_unbind_channel(lp);
return 1;
}
......@@ -656,7 +658,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
case ISDN_STAT_DHUP:
del_timer(&lp->dial_timer);
isdn_slot_all_eaz(lp->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", lp->name);
printk(KERN_INFO "%s: remote hangup\n", idev->name);
isdn_net_unbind_channel(lp);
return 1;
}
......@@ -668,13 +670,13 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
break;
case ISDN_STAT_BCONN:
del_timer(&lp->dial_timer);
isdn_slot_set_rx_netdev(lp->isdn_slot, p);
isdn_slot_set_rx_netdev(lp->isdn_slot, idev);
isdn_net_connected(lp);
return 1;
case ISDN_STAT_DHUP:
del_timer(&lp->dial_timer);
isdn_slot_all_eaz(lp->isdn_slot);
printk(KERN_INFO "%s: remote hangup\n", lp->name);
printk(KERN_INFO "%s: remote hangup\n", idev->name);
isdn_net_unbind_channel(lp);
return 1;
}
......@@ -701,27 +703,29 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
void
isdn_net_hangup(isdn_net_local *lp)
{
isdn_net_dev *idev = lp->netdev;
isdn_ctrl cmd;
del_timer_sync(&lp->hup_timer);
if (isdn_net_bound(lp)) {
if (lp->slave != NULL) {
isdn_net_local *slp = (isdn_net_local *)lp->slave->priv;
isdn_net_dev *sidev = slp->netdev;
if (isdn_net_bound(slp)) {
printk(KERN_INFO
"isdn_net: hang up slave %s before %s\n",
slp->name, lp->name);
sidev->name, idev->name);
isdn_net_hangup(slp);
}
}
printk(KERN_INFO "isdn_net: local hangup %s\n", lp->name);
printk(KERN_INFO "isdn_net: local hangup %s\n", idev->name);
if (lp->ops->disconnected)
lp->ops->disconnected(lp);
isdn_net_lp_disconnected(lp);
isdn_slot_command(lp->isdn_slot, ISDN_CMD_HANGUP, &cmd);
printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, lp->charge);
printk(KERN_INFO "%s: Chargesum is %d\n", idev->name, lp->charge);
isdn_slot_all_eaz(lp->isdn_slot);
}
isdn_net_unbind_channel(lp);
......@@ -746,6 +750,7 @@ typedef struct {
static void
isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
{
isdn_net_dev *idev = lp->netdev;
u_char *p = skb->nh.raw; /* hopefully, this was set correctly */
unsigned short proto = ntohs(skb->protocol);
int data_ofs;
......@@ -758,7 +763,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
/* fall back to old isdn_net_log_packet method() */
char * buf = skb->data;
printk(KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n", skb->protocol, lp->name);
printk(KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n", skb->protocol, idev->name);
p = buf;
proto = ETH_P_IP;
switch (lp->p_encap) {
......@@ -878,6 +883,7 @@ static void isdn_net_softint(void *private)
*/
void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
{
isdn_net_dev *idev = lp->netdev;
int ret;
int len = skb->len; /* save len */
......@@ -895,7 +901,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
ret = isdn_slot_write(lp->isdn_slot, skb);
if (ret != len) {
/* we should never get here */
printk(KERN_WARNING "%s: HL driver queue full\n", lp->name);
printk(KERN_WARNING "%s: HL driver queue full\n", idev->name);
goto error;
}
......@@ -962,7 +968,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
lp->transcount = 0;
}
if (dev->net_verbose > 3)
printk(KERN_DEBUG "%s: %d bogocps\n", lp->name, lp->cps);
printk(KERN_DEBUG "%s: %d bogocps\n", lp->netdev->name, lp->cps);
if (lp->cps > lp->triggercps) {
if (lp->slave) {
......@@ -1213,6 +1219,7 @@ isdn_net_init(struct net_device *ndev)
static int
isdn_net_do_callback(isdn_net_local *lp)
{
isdn_net_dev *idev = lp->netdev;
int slot;
/*
* Is the state MANUAL?
......@@ -1221,10 +1228,10 @@ isdn_net_do_callback(isdn_net_local *lp)
*/
if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) {
printk(KERN_INFO "incoming call for callback, interface %s `off' -> rejected\n",
lp->name);
idev->name);
return 3;
}
printk(KERN_DEBUG "%s: start callback\n", lp->name);
printk(KERN_DEBUG "%s: start callback\n", idev->name);
/* Grab a free ISDN-Channel */
slot = isdn_get_free_slot(ISDN_USAGE_NET, lp->l2_proto, lp->l3_proto,
......@@ -1313,8 +1320,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
isdn_slot_usage(idx));
list_for_each(l, &isdn_net_devs) {
isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list);
isdn_net_local *lp = &p->local;
isdn_net_dev *idev = list_entry(l, isdn_net_dev, global_list);
isdn_net_local *lp = &idev->local;
/* check acceptable call types for DOV */
dbg_net_icall("n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n",
......@@ -1378,17 +1385,17 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) {
restore_flags(flags);
printk(KERN_INFO "incoming call, interface %s `stopped' -> rejected\n",
lp->name);
idev->name);
return 3;
}
/*
* Is the interface up?
* If not, reject the call actively.
*/
if (!isdn_net_device_started(p)) {
if (!isdn_net_device_started(idev)) {
restore_flags(flags);
printk(KERN_INFO "%s: incoming call, interface down -> rejected\n",
lp->name);
idev->name);
return 3;
}
/* Interface is up, now see if it's a slave. If so, see if
......@@ -1396,8 +1403,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
*/
if (lp->master) {
isdn_net_local *mlp = (isdn_net_local *) lp->master->priv;
printk(KERN_DEBUG "ICALLslv: %s\n", lp->name);
printk(KERN_DEBUG "master=%s\n", mlp->name);
printk(KERN_DEBUG "ICALLslv: %s\n", idev->name);
printk(KERN_DEBUG "master=%s\n", mlp->netdev->name);
if (isdn_net_bound(mlp)) {
printk(KERN_DEBUG "master online\n");
/* Master is online, find parent-slave (master if first slave) */
......@@ -1419,7 +1426,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
restore_flags(flags);
return retval;
}
printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name,
printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", idev->name,
nr, eaz);
strcpy(isdn_slot_num(idx), nr);
......@@ -1462,7 +1469,7 @@ isdn_net_findif(char *name)
list_for_each(l, &isdn_net_devs) {
isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list);
if (!strcmp(p->local.name, name))
if (!strcmp(p->name, name))
return p;
}
return NULL;
......@@ -1555,7 +1562,7 @@ isdn_net_new(char *name, struct net_device *master)
return -ENOMEM;
}
memset(netdev, 0, sizeof(isdn_net_dev));
strcpy(netdev->local.name, name);
strcpy(netdev->name, name);
strcpy(netdev->dev.name, name);
netdev->dev.priv = &netdev->local;
netdev->dev.init = isdn_net_init;
......@@ -1926,11 +1933,11 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1;
cfg->dialwait = lp->dialwait / HZ;
if (lp->slave)
strcpy(cfg->slave, ((isdn_net_local *) lp->slave->priv)->name);
strcpy(cfg->slave, ((isdn_net_local *) lp->slave->priv)->netdev->name);
else
cfg->slave[0] = '\0';
if (lp->master)
strcpy(cfg->master, ((isdn_net_local *) lp->master->priv)->name);
strcpy(cfg->master, ((isdn_net_local *) lp->master->priv)->netdev->name);
else
cfg->master[0] = '\0';
......@@ -2137,12 +2144,12 @@ isdn_net_realrm(isdn_net_dev *p)
list_del(&p->global_list);
if (p->local.slave) {
/* If this interface has a slave, remove it also */
char *slavename = ((isdn_net_local *) (p->local.slave->priv))->name;
char *slavename = ((isdn_net_local *) (p->local.slave->priv))->netdev->name;
struct list_head *l;
list_for_each(l, &isdn_net_devs) {
isdn_net_dev *n = list_entry(l, isdn_net_dev, global_list);
if (!strcmp(n->local.name, slavename)) {
if (!strcmp(n->name, slavename)) {
isdn_net_realrm(n);
break;
}
......@@ -2165,7 +2172,7 @@ isdn_net_rm(char *name)
/* Search name in netdev-chain */
list_for_each(l, &isdn_net_devs) {
isdn_net_dev *p = list_entry(l, isdn_net_dev, global_list);
if (!strcmp(p->local.name, name))
if (!strcmp(p->name, name))
return isdn_net_realrm(p);
}
return -ENODEV;
......
......@@ -153,6 +153,7 @@ isdn_ppp_free(isdn_net_local * lp)
int
isdn_ppp_bind(isdn_net_local * lp)
{
isdn_net_dev *idev = lp->netdev;
int i;
int unit = 0;
long flags;
......@@ -194,9 +195,9 @@ isdn_ppp_bind(isdn_net_local * lp)
retval = -1;
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) {
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;
goto out;
}
......@@ -428,11 +429,13 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
unsigned long val;
int r,i,j;
struct ippp_struct *is;
isdn_net_dev *idev;
isdn_net_local *lp;
struct isdn_ppp_comp_data data;
is = (struct ippp_struct *) file->private_data;
lp = is->lp;
idev = lp->netdev;
if (is->debug & 0x1)
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
case PPPIOCGIFNAME:
if(!lp)
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;
break;
case PPPIOCGMPFLAGS: /* get configuration flags */
......
......@@ -311,7 +311,6 @@ struct isdn_netif_ops {
typedef struct isdn_net_local_s {
spinlock_t lock;
ulong magic;
char name[10]; /* Name of device */
struct timer_list dial_timer; /* dial events timer */
int dial_event; /* event in case of timer expiry */
struct net_device_stats stats; /* Ethernet Statistics */
......@@ -410,6 +409,7 @@ typedef struct isdn_net_dev_s {
channels, which are currently
online */
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 net_device dev; /* interface to upper levels */
#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