[NET] ATM: Fix whitespace errors.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
YOSHIFUJI Hideaki 2007-02-09 23:24:29 +09:00 committed by David S. Miller
parent ed4477b960
commit f7d57453d2
18 changed files with 287 additions and 287 deletions

View File

@ -30,15 +30,15 @@ static ssize_t show_address(struct class_device *cdev, char *buf)
static ssize_t show_atmaddress(struct class_device *cdev, char *buf) static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
{ {
unsigned long flags; unsigned long flags;
char *pos = buf; char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev); struct atm_dev *adev = to_atm_dev(cdev);
struct atm_dev_addr *aaddr; struct atm_dev_addr *aaddr;
int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin; int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
int i, j; int i, j;
spin_lock_irqsave(&adev->lock, flags); spin_lock_irqsave(&adev->lock, flags);
list_for_each_entry(aaddr, &adev->local, entry) { list_for_each_entry(aaddr, &adev->local, entry) {
for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) { for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
if (j == *fmt) { if (j == *fmt) {
pos += sprintf(pos, "."); pos += sprintf(pos, ".");
@ -49,7 +49,7 @@ static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
} }
pos += sprintf(pos, "\n"); pos += sprintf(pos, "\n");
} }
spin_unlock_irqrestore(&adev->lock, flags); spin_unlock_irqrestore(&adev->lock, flags);
return pos - buf; return pos - buf;
} }
@ -61,7 +61,7 @@ static ssize_t show_carrier(struct class_device *cdev, char *buf)
pos += sprintf(pos, "%d\n", pos += sprintf(pos, "%d\n",
adev->signal == ATM_PHY_SIG_LOST ? 0 : 1); adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
return pos - buf; return pos - buf;
} }
@ -86,7 +86,7 @@ static ssize_t show_link_rate(struct class_device *cdev, char *buf)
link_rate = adev->link_rate * 8 * 53; link_rate = adev->link_rate * 8 * 53;
} }
pos += sprintf(pos, "%d\n", link_rate); pos += sprintf(pos, "%d\n", link_rate);
return pos - buf; return pos - buf;
} }

View File

@ -182,7 +182,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
if (!atm_may_send(atmvcc, skb->truesize)) { if (!atm_may_send(atmvcc, skb->truesize)) {
/* we free this here for now, because we cannot know in a higher /* we free this here for now, because we cannot know in a higher
layer whether the skb point it supplied wasn't freed yet. layer whether the skb point it supplied wasn't freed yet.
now, it always is. now, it always is.
*/ */
@ -718,7 +718,7 @@ static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos; ++*pos;
brd = list_entry(brd->br2684_devs.next, brd = list_entry(brd->br2684_devs.next,
struct br2684_dev, br2684_devs); struct br2684_dev, br2684_devs);
return (&brd->br2684_devs != &br2684_devs) ? brd : NULL; return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
} }

View File

@ -109,11 +109,11 @@ static inline int vcc_writable(struct sock *sk)
struct atm_vcc *vcc = atm_sk(sk); struct atm_vcc *vcc = atm_sk(sk);
return (vcc->qos.txtp.max_sdu + return (vcc->qos.txtp.max_sdu +
atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf; atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf;
} }
static void vcc_write_space(struct sock *sk) static void vcc_write_space(struct sock *sk)
{ {
read_lock(&sk->sk_callback_lock); read_lock(&sk->sk_callback_lock);
if (vcc_writable(sk)) { if (vcc_writable(sk)) {
@ -131,7 +131,7 @@ static struct proto vcc_proto = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.obj_size = sizeof(struct atm_vcc), .obj_size = sizeof(struct atm_vcc),
}; };
int vcc_create(struct socket *sock, int protocol, int family) int vcc_create(struct socket *sock, int protocol, int family)
{ {
struct sock *sk; struct sock *sk;
@ -359,7 +359,7 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
return error; return error;
vcc->dev = dev; vcc->dev = dev;
write_lock_irq(&vcc_sklist_lock); write_lock_irq(&vcc_sklist_lock);
if (test_bit(ATM_DF_REMOVED, &dev->flags) || if (test_bit(ATM_DF_REMOVED, &dev->flags) ||
(error = find_ci(vcc, &vpi, &vci))) { (error = find_ci(vcc, &vpi, &vci))) {
write_unlock_irq(&vcc_sklist_lock); write_unlock_irq(&vcc_sklist_lock);
goto fail_module_put; goto fail_module_put;
@ -494,20 +494,20 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
if (!skb) if (!skb)
return error; return error;
copied = skb->len; copied = skb->len;
if (copied > size) { if (copied > size) {
copied = size; copied = size;
msg->msg_flags |= MSG_TRUNC; msg->msg_flags |= MSG_TRUNC;
} }
error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
if (error) if (error)
return error; return error;
sock_recv_timestamp(msg, sk, skb); sock_recv_timestamp(msg, sk, skb);
DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize); DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);
atm_return(vcc, skb->truesize); atm_return(vcc, skb->truesize);
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
return copied; return copied;
} }
@ -675,7 +675,7 @@ static int check_qos(struct atm_qos *qos)
int error; int error;
if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class) if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class)
return -EINVAL; return -EINVAL;
if (qos->txtp.traffic_class != qos->rxtp.traffic_class && if (qos->txtp.traffic_class != qos->rxtp.traffic_class &&
qos->txtp.traffic_class && qos->rxtp.traffic_class && qos->txtp.traffic_class && qos->rxtp.traffic_class &&
qos->txtp.traffic_class != ATM_ANYCLASS && qos->txtp.traffic_class != ATM_ANYCLASS &&
@ -786,11 +786,11 @@ static int __init atm_init(void)
printk(KERN_ERR "atmsvc_init() failed with %d\n", error); printk(KERN_ERR "atmsvc_init() failed with %d\n", error);
goto out_atmpvc_exit; goto out_atmpvc_exit;
} }
if ((error = atm_proc_init()) < 0) { if ((error = atm_proc_init()) < 0) {
printk(KERN_ERR "atm_proc_init() failed with %d\n",error); printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
goto out_atmsvc_exit; goto out_atmsvc_exit;
} }
if ((error = atm_sysfs_init()) < 0) { if ((error = atm_sysfs_init()) < 0) {
printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error); printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error);
goto out_atmproc_exit; goto out_atmproc_exit;
} }

View File

@ -1,5 +1,5 @@
/* net/atm/common.h - ATM sockets (common part for PVC and SVC) */ /* net/atm/common.h - ATM sockets (common part for PVC and SVC) */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */

View File

@ -76,7 +76,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
} }
skb = skb_peek(&sk->sk_receive_queue); skb = skb_peek(&sk->sk_receive_queue);
error = put_user(skb ? skb->len : 0, error = put_user(skb ? skb->len : 0,
(int __user *)argp) ? -EFAULT : 0; (int __user *)argp) ? -EFAULT : 0;
goto done; goto done;
} }
case SIOCGSTAMP: /* borrowed from IP */ case SIOCGSTAMP: /* borrowed from IP */

View File

@ -1,5 +1,5 @@
/* /*
* lec.c: Lan Emulation driver * lec.c: Lan Emulation driver
* *
* Marko Kiiskila <mkiiskila@yahoo.com> * Marko Kiiskila <mkiiskila@yahoo.com>
*/ */
@ -1457,7 +1457,7 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
static void lec_arp_check_expire(struct work_struct *work); static void lec_arp_check_expire(struct work_struct *work);
static void lec_arp_expire_arp(unsigned long data); static void lec_arp_expire_arp(unsigned long data);
/* /*
* Arp table funcs * Arp table funcs
*/ */
@ -1473,9 +1473,9 @@ static void lec_arp_init(struct lec_priv *priv)
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
} }
INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
INIT_HLIST_HEAD(&priv->lec_no_forward); INIT_HLIST_HEAD(&priv->lec_no_forward);
INIT_HLIST_HEAD(&priv->mcast_fwds); INIT_HLIST_HEAD(&priv->mcast_fwds);
spin_lock_init(&priv->lec_arp_lock); spin_lock_init(&priv->lec_arp_lock);
INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire); INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire);
schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL); schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
@ -1770,7 +1770,7 @@ static void lec_arp_destroy(struct lec_priv *priv)
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
} }
/* /*
* Find entry by mac_address * Find entry by mac_address
*/ */
static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
@ -1949,7 +1949,7 @@ restart:
/* /*
* Try to find vcc where mac_address is attached. * Try to find vcc where mac_address is attached.
* *
*/ */
static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
unsigned char *mac_to_find, int is_rdesc, unsigned char *mac_to_find, int is_rdesc,
@ -2075,7 +2075,7 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
} }
/* /*
* Notifies: Response to arp_request (atm_addr != NULL) * Notifies: Response to arp_request (atm_addr != NULL)
*/ */
static void static void
lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
@ -2176,7 +2176,7 @@ out:
} }
/* /*
* Notifies: Vcc setup ready * Notifies: Vcc setup ready
*/ */
static void static void
lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
@ -2380,7 +2380,7 @@ lec_set_flush_tran_id(struct lec_priv *priv,
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
entry->flush_tran_id = tran_id; entry->flush_tran_id = tran_id;
DPRINTK("Set flush transaction id to %lx for %p\n", DPRINTK("Set flush transaction id to %lx for %p\n",
tran_id, entry); tran_id, entry);
} }
} }
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);

View File

@ -52,12 +52,12 @@ struct lane2_ops {
/* /*
* ATM LAN Emulation supports both LLC & Dix Ethernet EtherType * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
* frames. * frames.
* *
* 1. Dix Ethernet EtherType frames encoded by placing EtherType * 1. Dix Ethernet EtherType frames encoded by placing EtherType
* field in h_type field. Data follows immediatelly after header. * field in h_type field. Data follows immediatelly after header.
* 2. LLC Data frames whose total length, including LLC field and data, * 2. LLC Data frames whose total length, including LLC field and data,
* but not padding required to meet the minimum data frame length, * but not padding required to meet the minimum data frame length,
* is less than 1536(0x0600) MUST be encoded by placing that length * is less than 1536(0x0600) MUST be encoded by placing that length
* in the h_type field. The LLC field follows header immediatelly. * in the h_type field. The LLC field follows header immediatelly.
* 3. LLC data frames longer than this maximum MUST be encoded by placing * 3. LLC data frames longer than this maximum MUST be encoded by placing

View File

@ -32,7 +32,7 @@
#include "resources.h" #include "resources.h"
/* /*
* mpc.c: Implementation of MPOA client kernel part * mpc.c: Implementation of MPOA client kernel part
*/ */
#if 0 #if 0
@ -80,17 +80,17 @@ static struct llc_snap_hdr llc_snap_mpoa_ctrl = {
0xaa, 0xaa, 0x03, 0xaa, 0xaa, 0x03,
{0x00, 0x00, 0x5e}, {0x00, 0x00, 0x5e},
{0x00, 0x03} /* For MPOA control PDUs */ {0x00, 0x03} /* For MPOA control PDUs */
}; };
static struct llc_snap_hdr llc_snap_mpoa_data = { static struct llc_snap_hdr llc_snap_mpoa_data = {
0xaa, 0xaa, 0x03, 0xaa, 0xaa, 0x03,
{0x00, 0x00, 0x00}, {0x00, 0x00, 0x00},
{0x08, 0x00} /* This is for IP PDUs only */ {0x08, 0x00} /* This is for IP PDUs only */
}; };
static struct llc_snap_hdr llc_snap_mpoa_data_tagged = { static struct llc_snap_hdr llc_snap_mpoa_data_tagged = {
0xaa, 0xaa, 0x03, 0xaa, 0xaa, 0x03,
{0x00, 0x00, 0x00}, {0x00, 0x00, 0x00},
{0x88, 0x4c} /* This is for tagged data PDUs */ {0x88, 0x4c} /* This is for tagged data PDUs */
}; };
static struct notifier_block mpoa_notifier = { static struct notifier_block mpoa_notifier = {
mpoa_event_listener, mpoa_event_listener,
@ -106,12 +106,12 @@ static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
static struct mpoa_client *find_mpc_by_itfnum(int itf) static struct mpoa_client *find_mpc_by_itfnum(int itf)
{ {
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpc = mpcs; /* our global linked list */ mpc = mpcs; /* our global linked list */
while (mpc != NULL) { while (mpc != NULL) {
if (mpc->dev_num == itf) if (mpc->dev_num == itf)
return mpc; return mpc;
mpc = mpc->next; mpc = mpc->next;
} }
return NULL; /* not found */ return NULL; /* not found */
@ -120,7 +120,7 @@ static struct mpoa_client *find_mpc_by_itfnum(int itf)
static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc) static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc)
{ {
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpc = mpcs; /* our global linked list */ mpc = mpcs; /* our global linked list */
while (mpc != NULL) { while (mpc != NULL) {
if (mpc->mpoad_vcc == vcc) if (mpc->mpoad_vcc == vcc)
@ -134,7 +134,7 @@ static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc)
static struct mpoa_client *find_mpc_by_lec(struct net_device *dev) static struct mpoa_client *find_mpc_by_lec(struct net_device *dev)
{ {
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpc = mpcs; /* our global linked list */ mpc = mpcs; /* our global linked list */
while (mpc != NULL) { while (mpc != NULL) {
if (mpc->dev == dev) if (mpc->dev == dev)
@ -190,7 +190,7 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip)
} }
return qos; return qos;
} }
/* /*
* Returns 0 for failure * Returns 0 for failure
@ -245,7 +245,7 @@ static struct net_device *find_lec_by_itfnum(int itf)
sprintf(name, "lec%d", itf); sprintf(name, "lec%d", itf);
dev = dev_get_by_name(name); dev = dev_get_by_name(name);
return dev; return dev;
} }
@ -265,25 +265,25 @@ static struct mpoa_client *alloc_mpc(void)
mpc->parameters.mpc_p2 = MPC_P2; mpc->parameters.mpc_p2 = MPC_P2;
memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3)); memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3));
mpc->parameters.mpc_p4 = MPC_P4; mpc->parameters.mpc_p4 = MPC_P4;
mpc->parameters.mpc_p5 = MPC_P5; mpc->parameters.mpc_p5 = MPC_P5;
mpc->parameters.mpc_p6 = MPC_P6; mpc->parameters.mpc_p6 = MPC_P6;
mpcs = mpc; mpcs = mpc;
return mpc; return mpc;
} }
/* /*
* *
* start_mpc() puts the MPC on line. All the packets destined * start_mpc() puts the MPC on line. All the packets destined
* to the lec underneath us are now being monitored and * to the lec underneath us are now being monitored and
* shortcuts will be established. * shortcuts will be established.
* *
*/ */
static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) static void start_mpc(struct mpoa_client *mpc, struct net_device *dev)
{ {
dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name);
if (dev->hard_start_xmit == NULL) { if (dev->hard_start_xmit == NULL) {
printk("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n", printk("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n",
dev->name); dev->name);
@ -297,8 +297,8 @@ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev)
static void stop_mpc(struct mpoa_client *mpc) static void stop_mpc(struct mpoa_client *mpc)
{ {
dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name);
/* Lets not nullify lec device's dev->hard_start_xmit */ /* Lets not nullify lec device's dev->hard_start_xmit */
if (mpc->dev->hard_start_xmit != mpc_send_packet) { if (mpc->dev->hard_start_xmit != mpc_send_packet) {
@ -309,7 +309,7 @@ static void stop_mpc(struct mpoa_client *mpc)
mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit; mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit;
mpc->old_hard_start_xmit = NULL; mpc->old_hard_start_xmit = NULL;
/* close_shortcuts(mpc); ??? FIXME */ /* close_shortcuts(mpc); ??? FIXME */
return; return;
} }
@ -358,7 +358,7 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
uint8_t length, mpoa_device_type, number_of_mps_macs; uint8_t length, mpoa_device_type, number_of_mps_macs;
uint8_t *end_of_tlvs; uint8_t *end_of_tlvs;
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */
dprintk("mpoa: (%s) lane2_assoc_ind: received TLV(s), ", dev->name); dprintk("mpoa: (%s) lane2_assoc_ind: received TLV(s), ", dev->name);
dprintk("total length of all TLVs %d\n", sizeoftlvs); dprintk("total length of all TLVs %d\n", sizeoftlvs);
@ -377,7 +377,7 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
printk("TLV value extends past its buffer, aborting parse\n"); printk("TLV value extends past its buffer, aborting parse\n");
return; return;
} }
if (type == 0) { if (type == 0) {
printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name); printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name);
return; return;
@ -412,10 +412,10 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
continue; /* someone should read the spec */ continue; /* someone should read the spec */
} }
dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs); dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs);
/* ok, now we can go and tell our daemon the control address of MPS */ /* ok, now we can go and tell our daemon the control address of MPS */
send_set_mps_ctrl_addr(tlvs, mpc); send_set_mps_ctrl_addr(tlvs, mpc);
tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type); tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type);
if (tlvs == NULL) return; if (tlvs == NULL) return;
} }
@ -474,7 +474,7 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
iph = (struct iphdr *)buff; iph = (struct iphdr *)buff;
ipaddr = iph->daddr; ipaddr = iph->daddr;
ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr); ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr);
entry = mpc->in_ops->get(ipaddr, mpc); entry = mpc->in_ops->get(ipaddr, mpc);
if (entry == NULL) { if (entry == NULL) {
@ -483,15 +483,15 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
return 1; return 1;
} }
if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */ if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */
ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name); ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name);
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return 1; return 1;
} }
ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name); ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name);
/* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */
if (iph->ttl <= 1) { if (iph->ttl <= 1) {
ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl); ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl);
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return 1; return 1;
} }
@ -529,7 +529,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
struct mpoa_client *mpc; struct mpoa_client *mpc;
struct ethhdr *eth; struct ethhdr *eth;
int i = 0; int i = 0;
mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ mpc = find_mpc_by_lec(dev); /* this should NEVER fail */
if(mpc == NULL) { if(mpc == NULL) {
printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name); printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name);
@ -549,7 +549,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
non_ip: non_ip:
retval = mpc->old_hard_start_xmit(skb,dev); retval = mpc->old_hard_start_xmit(skb,dev);
return retval; return retval;
} }
@ -569,11 +569,11 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
ipaddr = ioc_data.ipaddr; ipaddr = ioc_data.ipaddr;
if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF) if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF)
return -EINVAL; return -EINVAL;
mpc = find_mpc_by_itfnum(ioc_data.dev_num); mpc = find_mpc_by_itfnum(ioc_data.dev_num);
if (mpc == NULL) if (mpc == NULL)
return -EINVAL; return -EINVAL;
if (ioc_data.type == MPC_SOCKET_INGRESS) { if (ioc_data.type == MPC_SOCKET_INGRESS) {
in_entry = mpc->in_ops->get(ipaddr, mpc); in_entry = mpc->in_ops->get(ipaddr, mpc);
if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) { if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) {
@ -604,7 +604,7 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
struct mpoa_client *mpc; struct mpoa_client *mpc;
in_cache_entry *in_entry; in_cache_entry *in_entry;
eg_cache_entry *eg_entry; eg_cache_entry *eg_entry;
mpc = find_mpc_by_lec(dev); mpc = find_mpc_by_lec(dev);
if (mpc == NULL) { if (mpc == NULL) {
printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name); printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name);
@ -640,14 +640,14 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
struct mpoa_client *mpc; struct mpoa_client *mpc;
__be32 tag; __be32 tag;
char *tmp; char *tmp;
ddprintk("mpoa: (%s) mpc_push:\n", dev->name); ddprintk("mpoa: (%s) mpc_push:\n", dev->name);
if (skb == NULL) { if (skb == NULL) {
dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name); dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name);
mpc_vcc_close(vcc, dev); mpc_vcc_close(vcc, dev);
return; return;
} }
skb->dev = dev; skb->dev = dev;
if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) { if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) {
struct sock *sk = sk_atm(vcc); struct sock *sk = sk_atm(vcc);
@ -693,11 +693,11 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return; return;
} }
/* /*
* See if ingress MPC is using shortcut we opened as a return channel. * See if ingress MPC is using shortcut we opened as a return channel.
* This means we have a bi-directional vcc opened by us. * This means we have a bi-directional vcc opened by us.
*/ */
if (eg->shortcut == NULL) { if (eg->shortcut == NULL) {
eg->shortcut = vcc; eg->shortcut = vcc;
printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name); printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name);
@ -743,7 +743,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
struct mpoa_client *mpc; struct mpoa_client *mpc;
struct lec_priv *priv; struct lec_priv *priv;
int err; int err;
if (mpcs == NULL) { if (mpcs == NULL) {
init_timer(&mpc_timer); init_timer(&mpc_timer);
mpc_timer_refresh(); mpc_timer_refresh();
@ -755,7 +755,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
return err; return err;
} }
} }
mpc = find_mpc_by_itfnum(arg); mpc = find_mpc_by_itfnum(arg);
if (mpc == NULL) { if (mpc == NULL) {
dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg); dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg);
@ -776,7 +776,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
dev_put(mpc->dev); dev_put(mpc->dev);
mpc->dev = NULL; mpc->dev = NULL;
} else } else
priv->lane2_ops->associate_indicator = lane2_assoc_ind; priv->lane2_ops->associate_indicator = lane2_assoc_ind;
} }
mpc->mpoad_vcc = vcc; mpc->mpoad_vcc = vcc;
@ -788,7 +788,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
if (mpc->dev) { if (mpc->dev) {
char empty[ATM_ESA_LEN]; char empty[ATM_ESA_LEN];
memset(empty, 0, ATM_ESA_LEN); memset(empty, 0, ATM_ESA_LEN);
start_mpc(mpc, mpc->dev); start_mpc(mpc, mpc->dev);
/* set address if mpcd e.g. gets killed and restarted. /* set address if mpcd e.g. gets killed and restarted.
* If we do not do it now we have to wait for the next LE_ARP * If we do not do it now we have to wait for the next LE_ARP
@ -806,7 +806,7 @@ static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc)
struct k_message mesg; struct k_message mesg;
memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN);
mesg.type = SET_MPS_CTRL_ADDR; mesg.type = SET_MPS_CTRL_ADDR;
memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN);
msg_to_mpoad(&mesg, mpc); msg_to_mpoad(&mesg, mpc);
@ -828,7 +828,7 @@ static void mpoad_close(struct atm_vcc *vcc)
printk("mpoa: mpoad_close: close for non-present mpoad\n"); printk("mpoa: mpoad_close: close for non-present mpoad\n");
return; return;
} }
mpc->mpoad_vcc = NULL; mpc->mpoad_vcc = NULL;
if (mpc->dev) { if (mpc->dev) {
struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv;
@ -844,7 +844,7 @@ static void mpoad_close(struct atm_vcc *vcc)
atm_return(vcc, skb->truesize); atm_return(vcc, skb->truesize);
kfree_skb(skb); kfree_skb(skb);
} }
printk("mpoa: (%s) going down\n", printk("mpoa: (%s) going down\n",
(mpc->dev) ? mpc->dev->name : "<unknown>"); (mpc->dev) ? mpc->dev->name : "<unknown>");
module_put(THIS_MODULE); module_put(THIS_MODULE);
@ -857,11 +857,11 @@ static void mpoad_close(struct atm_vcc *vcc)
*/ */
static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb)
{ {
struct mpoa_client *mpc = find_mpc_by_vcc(vcc); struct mpoa_client *mpc = find_mpc_by_vcc(vcc);
struct k_message *mesg = (struct k_message*)skb->data; struct k_message *mesg = (struct k_message*)skb->data;
atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
if (mpc == NULL) { if (mpc == NULL) {
printk("mpoa: msg_from_mpoad: no mpc found\n"); printk("mpoa: msg_from_mpoad: no mpc found\n");
return 0; return 0;
@ -938,7 +938,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
skb_put(skb, sizeof(struct k_message)); skb_put(skb, sizeof(struct k_message));
memcpy(skb->data, mesg, sizeof(struct k_message)); memcpy(skb->data, mesg, sizeof(struct k_message));
atm_force_charge(mpc->mpoad_vcc, skb->truesize); atm_force_charge(mpc->mpoad_vcc, skb->truesize);
sk = sk_atm(mpc->mpoad_vcc); sk = sk_atm(mpc->mpoad_vcc);
skb_queue_tail(&sk->sk_receive_queue, skb); skb_queue_tail(&sk->sk_receive_queue, skb);
sk->sk_data_ready(sk, skb->len); sk->sk_data_ready(sk, skb->len);
@ -955,7 +955,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo
dev = (struct net_device *)dev_ptr; dev = (struct net_device *)dev_ptr;
if (dev->name == NULL || strncmp(dev->name, "lec", 3)) if (dev->name == NULL || strncmp(dev->name, "lec", 3))
return NOTIFY_DONE; /* we are only interested in lec:s */ return NOTIFY_DONE; /* we are only interested in lec:s */
switch (event) { switch (event) {
case NETDEV_REGISTER: /* a new lec device was allocated */ case NETDEV_REGISTER: /* a new lec device was allocated */
priv = (struct lec_priv *)dev->priv; priv = (struct lec_priv *)dev->priv;
@ -1043,7 +1043,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; return;
} }
if(entry->entry_state == INGRESS_INVALID){ if(entry->entry_state == INGRESS_INVALID){
entry->entry_state = INGRESS_RESOLVING; entry->entry_state = INGRESS_RESOLVING;
msg->type = SND_MPOA_RES_RQST; msg->type = SND_MPOA_RES_RQST;
@ -1053,7 +1053,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; return;
} }
printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n", printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n",
(mpc->dev) ? mpc->dev->name : "<unknown>"); (mpc->dev) ? mpc->dev->name : "<unknown>");
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
@ -1062,7 +1062,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
/* /*
* Things get complicated because we have to check if there's an egress * Things get complicated because we have to check if there's an egress
* shortcut with suitable traffic parameters we could use. * shortcut with suitable traffic parameters we could use.
*/ */
static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry)
{ {
@ -1079,7 +1079,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
else if(eg_entry->shortcut->qos.txtp.max_pcr > 0) else if(eg_entry->shortcut->qos.txtp.max_pcr > 0)
entry->shortcut = eg_entry->shortcut; entry->shortcut = eg_entry->shortcut;
} }
if(entry->shortcut){ if(entry->shortcut){
dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip)); dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip));
client->eg_ops->put(eg_entry); client->eg_ops->put(eg_entry);
return; return;
@ -1094,7 +1094,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
{ {
msg->qos = qos->qos; msg->qos = qos->qos;
printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name); printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name);
} }
else memset(&msg->qos,0,sizeof(struct atm_qos)); else memset(&msg->qos,0,sizeof(struct atm_qos));
msg_to_mpoad(msg, client); msg_to_mpoad(msg, client);
return; return;
@ -1111,7 +1111,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name);
return; return;
} }
ddprintk(" entry_state = %d ", entry->entry_state); ddprintk(" entry_state = %d ", entry->entry_state);
if (entry->entry_state == INGRESS_RESOLVED) { if (entry->entry_state == INGRESS_RESOLVED) {
printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name); printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name);
@ -1126,7 +1126,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
ddprintk("entry->shortcut = %p\n", entry->shortcut); ddprintk("entry->shortcut = %p\n", entry->shortcut);
if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){ if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){
entry->entry_state = INGRESS_RESOLVED; entry->entry_state = INGRESS_RESOLVED;
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; /* Shortcut already open... */ return; /* Shortcut already open... */
} }
@ -1137,7 +1137,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; return;
} }
check_qos_and_open_shortcut(msg, mpc, entry); check_qos_and_open_shortcut(msg, mpc, entry);
entry->entry_state = INGRESS_RESOLVED; entry->entry_state = INGRESS_RESOLVED;
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
@ -1169,13 +1169,13 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
} while (entry != NULL); } while (entry != NULL);
return; return;
} }
static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{ {
__be32 cache_id = msg->content.eg_info.cache_id; __be32 cache_id = msg->content.eg_info.cache_id;
eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc);
if (entry == NULL) { if (entry == NULL) {
dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name); dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name);
return; return;
@ -1188,7 +1188,7 @@ static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->eg_ops->put(entry); mpc->eg_ops->put(entry);
return; return;
} }
static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
{ {
@ -1259,7 +1259,7 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client *
{ {
uint16_t holding_time; uint16_t holding_time;
eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc);
holding_time = msg->content.eg_info.holding_time; holding_time = msg->content.eg_info.holding_time;
dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n", dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n",
mpc->dev->name, entry, holding_time); mpc->dev->name, entry, holding_time);
@ -1272,13 +1272,13 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client *
mpc->eg_ops->update(entry, holding_time); mpc->eg_ops->update(entry, holding_time);
return; return;
} }
write_lock_irq(&mpc->egress_lock); write_lock_irq(&mpc->egress_lock);
mpc->eg_ops->remove_entry(entry, mpc); mpc->eg_ops->remove_entry(entry, mpc);
write_unlock_irq(&mpc->egress_lock); write_unlock_irq(&mpc->egress_lock);
mpc->eg_ops->put(entry); mpc->eg_ops->put(entry);
return; return;
} }
@ -1328,7 +1328,7 @@ static void set_mps_mac_addr_rcvd(struct k_message *msg, struct mpoa_client *cli
return; return;
} }
client->number_of_mps_macs = 1; client->number_of_mps_macs = 1;
return; return;
} }
@ -1364,7 +1364,7 @@ static void mpc_timer_refresh(void)
mpc_timer.data = mpc_timer.expires; mpc_timer.data = mpc_timer.expires;
mpc_timer.function = mpc_cache_check; mpc_timer.function = mpc_cache_check;
add_timer(&mpc_timer); add_timer(&mpc_timer);
return; return;
} }
@ -1373,7 +1373,7 @@ static void mpc_cache_check( unsigned long checking_time )
struct mpoa_client *mpc = mpcs; struct mpoa_client *mpc = mpcs;
static unsigned long previous_resolving_check_time; static unsigned long previous_resolving_check_time;
static unsigned long previous_refresh_time; static unsigned long previous_refresh_time;
while( mpc != NULL ){ while( mpc != NULL ){
mpc->in_ops->clear_count(mpc); mpc->in_ops->clear_count(mpc);
mpc->eg_ops->clear_expired(mpc); mpc->eg_ops->clear_expired(mpc);
@ -1388,7 +1388,7 @@ static void mpc_cache_check( unsigned long checking_time )
mpc = mpc->next; mpc = mpc->next;
} }
mpc_timer_refresh(); mpc_timer_refresh();
return; return;
} }

View File

@ -12,32 +12,32 @@
int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc); int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc);
struct mpoa_client { struct mpoa_client {
struct mpoa_client *next; struct mpoa_client *next;
struct net_device *dev; /* lec in question */ struct net_device *dev; /* lec in question */
int dev_num; /* e.g. 2 for lec2 */ int dev_num; /* e.g. 2 for lec2 */
int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
struct atm_vcc *mpoad_vcc; /* control channel to mpoad */ struct atm_vcc *mpoad_vcc; /* control channel to mpoad */
uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */ uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */
uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */ uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */
rwlock_t ingress_lock; rwlock_t ingress_lock;
struct in_cache_ops *in_ops; /* ingress cache operations */ struct in_cache_ops *in_ops; /* ingress cache operations */
in_cache_entry *in_cache; /* the ingress cache of this MPC */ in_cache_entry *in_cache; /* the ingress cache of this MPC */
rwlock_t egress_lock; rwlock_t egress_lock;
struct eg_cache_ops *eg_ops; /* egress cache operations */ struct eg_cache_ops *eg_ops; /* egress cache operations */
eg_cache_entry *eg_cache; /* the egress cache of this MPC */ eg_cache_entry *eg_cache; /* the egress cache of this MPC */
uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */ uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */
int number_of_mps_macs; /* number of the above MAC addresses */ int number_of_mps_macs; /* number of the above MAC addresses */
struct mpc_parameters parameters; /* parameters for this client */ struct mpc_parameters parameters; /* parameters for this client */
}; };
struct atm_mpoa_qos { struct atm_mpoa_qos {
struct atm_mpoa_qos *next; struct atm_mpoa_qos *next;
__be32 ipaddr; __be32 ipaddr;
struct atm_qos qos; struct atm_qos qos;
}; };

View File

@ -369,7 +369,7 @@ static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_clie
while (entry != NULL){ while (entry != NULL){
if (entry->shortcut == vcc) { if (entry->shortcut == vcc) {
atomic_inc(&entry->use); atomic_inc(&entry->use);
read_unlock_irqrestore(&mpc->egress_lock, flags); read_unlock_irqrestore(&mpc->egress_lock, flags);
return entry; return entry;
} }
entry = entry->next; entry = entry->next;
@ -388,7 +388,7 @@ static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, struct mpoa_client
while(entry != NULL){ while(entry != NULL){
if(entry->latest_ip_addr == ipaddr) { if(entry->latest_ip_addr == ipaddr) {
atomic_inc(&entry->use); atomic_inc(&entry->use);
read_unlock_irq(&mpc->egress_lock); read_unlock_irq(&mpc->egress_lock);
return entry; return entry;
} }
entry = entry->next; entry = entry->next;

View File

@ -12,66 +12,66 @@ struct mpoa_client;
void atm_mpoa_init_cache(struct mpoa_client *mpc); void atm_mpoa_init_cache(struct mpoa_client *mpc);
typedef struct in_cache_entry { typedef struct in_cache_entry {
struct in_cache_entry *next; struct in_cache_entry *next;
struct in_cache_entry *prev; struct in_cache_entry *prev;
struct timeval tv; struct timeval tv;
struct timeval reply_wait; struct timeval reply_wait;
struct timeval hold_down; struct timeval hold_down;
uint32_t packets_fwded; uint32_t packets_fwded;
uint16_t entry_state; uint16_t entry_state;
uint32_t retry_time; uint32_t retry_time;
uint32_t refresh_time; uint32_t refresh_time;
uint32_t count; uint32_t count;
struct atm_vcc *shortcut; struct atm_vcc *shortcut;
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
struct in_ctrl_info ctrl_info; struct in_ctrl_info ctrl_info;
atomic_t use; atomic_t use;
} in_cache_entry; } in_cache_entry;
struct in_cache_ops{ struct in_cache_ops{
in_cache_entry *(*add_entry)(__be32 dst_ip, in_cache_entry *(*add_entry)(__be32 dst_ip,
struct mpoa_client *client); struct mpoa_client *client);
in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client); in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
in_cache_entry *(*get_with_mask)(__be32 dst_ip, in_cache_entry *(*get_with_mask)(__be32 dst_ip,
struct mpoa_client *client, struct mpoa_client *client,
__be32 mask); __be32 mask);
in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
struct mpoa_client *client); struct mpoa_client *client);
void (*put)(in_cache_entry *entry); void (*put)(in_cache_entry *entry);
void (*remove_entry)(in_cache_entry *delEntry, void (*remove_entry)(in_cache_entry *delEntry,
struct mpoa_client *client ); struct mpoa_client *client );
int (*cache_hit)(in_cache_entry *entry, int (*cache_hit)(in_cache_entry *entry,
struct mpoa_client *client); struct mpoa_client *client);
void (*clear_count)(struct mpoa_client *client); void (*clear_count)(struct mpoa_client *client);
void (*check_resolving)(struct mpoa_client *client); void (*check_resolving)(struct mpoa_client *client);
void (*refresh)(struct mpoa_client *client); void (*refresh)(struct mpoa_client *client);
void (*destroy_cache)(struct mpoa_client *mpc); void (*destroy_cache)(struct mpoa_client *mpc);
}; };
typedef struct eg_cache_entry{ typedef struct eg_cache_entry{
struct eg_cache_entry *next; struct eg_cache_entry *next;
struct eg_cache_entry *prev; struct eg_cache_entry *prev;
struct timeval tv; struct timeval tv;
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
struct atm_vcc *shortcut; struct atm_vcc *shortcut;
uint32_t packets_rcvd; uint32_t packets_rcvd;
uint16_t entry_state; uint16_t entry_state;
__be32 latest_ip_addr; /* The src IP address of the last packet */ __be32 latest_ip_addr; /* The src IP address of the last packet */
struct eg_ctrl_info ctrl_info; struct eg_ctrl_info ctrl_info;
atomic_t use; atomic_t use;
} eg_cache_entry; } eg_cache_entry;
struct eg_cache_ops{ struct eg_cache_ops{
eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client); eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client); eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client); eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client); eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client); eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
void (*put)(eg_cache_entry *entry); void (*put)(eg_cache_entry *entry);
void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client); void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
void (*update)(eg_cache_entry *entry, uint16_t holding_time); void (*update)(eg_cache_entry *entry, uint16_t holding_time);
void (*clear_expired)(struct mpoa_client *client); void (*clear_expired)(struct mpoa_client *client);
void (*destroy_cache)(struct mpoa_client *mpc); void (*destroy_cache)(struct mpoa_client *mpc);
}; };
@ -85,7 +85,7 @@ struct eg_cache_ops{
/* VCC states */ /* VCC states */
#define OPEN 1 #define OPEN 1
#define CLOSED 0 #define CLOSED 0
/* Egress cache entry states */ /* Egress cache entry states */

View File

@ -2,7 +2,7 @@
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
@ -16,7 +16,7 @@
/* /*
* mpoa_proc.c: Implementation MPOA client's proc * mpoa_proc.c: Implementation MPOA client's proc
* file system statistics * file system statistics
*/ */
#if 1 #if 1
@ -32,7 +32,7 @@ extern struct proc_dir_entry *atm_proc_root; /* from proc.c. */
static int proc_mpc_open(struct inode *inode, struct file *file); static int proc_mpc_open(struct inode *inode, struct file *file);
static ssize_t proc_mpc_write(struct file *file, const char __user *buff, static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
size_t nbytes, loff_t *ppos); size_t nbytes, loff_t *ppos);
static int parse_qos(const char *buff); static int parse_qos(const char *buff);
@ -52,18 +52,18 @@ static struct file_operations mpc_file_operations = {
* Returns the state of an ingress cache entry as a string * Returns the state of an ingress cache entry as a string
*/ */
static const char *ingress_state_string(int state){ static const char *ingress_state_string(int state){
switch(state) { switch(state) {
case INGRESS_RESOLVING: case INGRESS_RESOLVING:
return "resolving "; return "resolving ";
break; break;
case INGRESS_RESOLVED: case INGRESS_RESOLVED:
return "resolved "; return "resolved ";
break; break;
case INGRESS_INVALID: case INGRESS_INVALID:
return "invalid "; return "invalid ";
break; break;
case INGRESS_REFRESHING: case INGRESS_REFRESHING:
return "refreshing "; return "refreshing ";
break; break;
default: default:
return ""; return "";
@ -74,15 +74,15 @@ static const char *ingress_state_string(int state){
* Returns the state of an egress cache entry as a string * Returns the state of an egress cache entry as a string
*/ */
static const char *egress_state_string(int state){ static const char *egress_state_string(int state){
switch(state) { switch(state) {
case EGRESS_RESOLVED: case EGRESS_RESOLVED:
return "resolved "; return "resolved ";
break; break;
case EGRESS_PURGE: case EGRESS_PURGE:
return "purge "; return "purge ";
break; break;
case EGRESS_INVALID: case EGRESS_INVALID:
return "invalid "; return "invalid ";
break; break;
default: default:
return ""; return "";
@ -135,7 +135,7 @@ static int mpc_show(struct seq_file *m, void *v)
return 0; return 0;
} }
seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num); seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num);
seq_printf(m, "Ingress Entries:\nIP address State Holding time Packets fwded VPI VCI\n"); seq_printf(m, "Ingress Entries:\nIP address State Holding time Packets fwded VPI VCI\n");
do_gettimeofday(&now); do_gettimeofday(&now);
@ -163,7 +163,7 @@ static int mpc_show(struct seq_file *m, void *v)
egress_state_string(eg_entry->entry_state), egress_state_string(eg_entry->entry_state),
(eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)), (eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)),
eg_entry->packets_rcvd); eg_entry->packets_rcvd);
/* latest IP address */ /* latest IP address */
temp = (unsigned char *)&eg_entry->latest_ip_addr; temp = (unsigned char *)&eg_entry->latest_ip_addr;
sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]); sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
@ -190,51 +190,51 @@ static int proc_mpc_open(struct inode *inode, struct file *file)
} }
static ssize_t proc_mpc_write(struct file *file, const char __user *buff, static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
size_t nbytes, loff_t *ppos) size_t nbytes, loff_t *ppos)
{ {
char *page, *p; char *page, *p;
unsigned len; unsigned len;
if (nbytes == 0) if (nbytes == 0)
return 0; return 0;
if (nbytes >= PAGE_SIZE) if (nbytes >= PAGE_SIZE)
nbytes = PAGE_SIZE-1; nbytes = PAGE_SIZE-1;
page = (char *)__get_free_page(GFP_KERNEL); page = (char *)__get_free_page(GFP_KERNEL);
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
for (p = page, len = 0; len < nbytes; p++, len++) { for (p = page, len = 0; len < nbytes; p++, len++) {
if (get_user(*p, buff++)) { if (get_user(*p, buff++)) {
free_page((unsigned long)page); free_page((unsigned long)page);
return -EFAULT; return -EFAULT;
} }
if (*p == '\0' || *p == '\n') if (*p == '\0' || *p == '\n')
break; break;
} }
*p = '\0'; *p = '\0';
if (!parse_qos(page)) if (!parse_qos(page))
printk("mpoa: proc_mpc_write: could not parse '%s'\n", page); printk("mpoa: proc_mpc_write: could not parse '%s'\n", page);
free_page((unsigned long)page); free_page((unsigned long)page);
return len; return len;
} }
static int parse_qos(const char *buff) static int parse_qos(const char *buff)
{ {
/* possible lines look like this /* possible lines look like this
* add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu * add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu
*/ */
unsigned char ip[4]; unsigned char ip[4];
int tx_pcr, tx_sdu, rx_pcr, rx_sdu; int tx_pcr, tx_sdu, rx_pcr, rx_sdu;
__be32 ipaddr; __be32 ipaddr;
struct atm_qos qos; struct atm_qos qos;
memset(&qos, 0, sizeof(struct atm_qos)); memset(&qos, 0, sizeof(struct atm_qos));
if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu", if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu",
ip, ip+1, ip+2, ip+3) == 4) { ip, ip+1, ip+2, ip+3) == 4) {
@ -250,14 +250,14 @@ static int parse_qos(const char *buff)
ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8) ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8)
return 0; return 0;
ipaddr = *(__be32 *)ip; ipaddr = *(__be32 *)ip;
qos.txtp.traffic_class = ATM_CBR; qos.txtp.traffic_class = ATM_CBR;
qos.txtp.max_pcr = tx_pcr; qos.txtp.max_pcr = tx_pcr;
qos.txtp.max_sdu = tx_sdu; qos.txtp.max_sdu = tx_sdu;
qos.rxtp.traffic_class = ATM_CBR; qos.rxtp.traffic_class = ATM_CBR;
qos.rxtp.max_pcr = rx_pcr; qos.rxtp.max_pcr = rx_pcr;
qos.rxtp.max_sdu = rx_sdu; qos.rxtp.max_sdu = rx_sdu;
qos.aal = ATM_AAL5; qos.aal = ATM_AAL5;
dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n", dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n",
qos.txtp.max_pcr, qos.txtp.max_pcr,
qos.txtp.max_sdu, qos.txtp.max_sdu,
@ -276,11 +276,11 @@ int mpc_proc_init(void)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root); p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root);
if (!p) { if (!p) {
printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
return -ENOMEM; return -ENOMEM;
} }
p->proc_fops = &mpc_file_operations; p->proc_fops = &mpc_file_operations;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
return 0; return 0;

View File

@ -86,7 +86,7 @@ static int __vcc_walk(struct sock **sock, int family, int *bucket, loff_t l)
break; break;
} }
l--; l--;
} }
try_again: try_again:
for (; sk; sk = sk_next(sk)) { for (; sk; sk = sk_next(sk)) {
l -= compare_family(sk, family); l -= compare_family(sk, family);
@ -205,7 +205,7 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc)
seq_printf(seq, "%p ", vcc); seq_printf(seq, "%p ", vcc);
if (!vcc->dev) if (!vcc->dev)
seq_printf(seq, "Unassigned "); seq_printf(seq, "Unassigned ");
else else
seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi, seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi,
vcc->vci); vcc->vci);
switch (sk->sk_family) { switch (sk->sk_family) {
@ -249,7 +249,7 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
static char atm_dev_banner[] = static char atm_dev_banner[] =
"Itf Type ESI/\"MAC\"addr " "Itf Type ESI/\"MAC\"addr "
"AAL(TX,err,RX,err,drop) ... [refcnt]\n"; "AAL(TX,err,RX,err,drop) ... [refcnt]\n";
if (v == (void *)1) if (v == (void *)1)
seq_puts(seq, atm_dev_banner); seq_puts(seq, atm_dev_banner);
else { else {
@ -257,21 +257,21 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
atm_dev_info(seq, dev); atm_dev_info(seq, dev);
} }
return 0; return 0;
} }
static struct seq_operations atm_dev_seq_ops = { static struct seq_operations atm_dev_seq_ops = {
.start = atm_dev_seq_start, .start = atm_dev_seq_start,
.next = atm_dev_seq_next, .next = atm_dev_seq_next,
.stop = atm_dev_seq_stop, .stop = atm_dev_seq_stop,
.show = atm_dev_seq_show, .show = atm_dev_seq_show,
}; };
static int atm_dev_seq_open(struct inode *inode, struct file *file) static int atm_dev_seq_open(struct inode *inode, struct file *file)
{ {
return seq_open(file, &atm_dev_seq_ops); return seq_open(file, &atm_dev_seq_ops);
} }
static struct file_operations devices_seq_fops = { static struct file_operations devices_seq_fops = {
.open = atm_dev_seq_open, .open = atm_dev_seq_open,
.read = seq_read, .read = seq_read,
@ -281,7 +281,7 @@ static struct file_operations devices_seq_fops = {
static int pvc_seq_show(struct seq_file *seq, void *v) static int pvc_seq_show(struct seq_file *seq, void *v)
{ {
static char atm_pvc_banner[] = static char atm_pvc_banner[] =
"Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n"; "Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n";
if (v == (void *)1) if (v == (void *)1)
@ -316,31 +316,31 @@ static struct file_operations pvc_seq_fops = {
static int vcc_seq_show(struct seq_file *seq, void *v) static int vcc_seq_show(struct seq_file *seq, void *v)
{ {
if (v == (void *)1) { if (v == (void *)1) {
seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s",
"Address ", "Itf VPI VCI Fam Flags Reply " "Address ", "Itf VPI VCI Fam Flags Reply "
"Send buffer Recv buffer [refcnt]\n"); "Send buffer Recv buffer [refcnt]\n");
} else { } else {
struct vcc_state *state = seq->private; struct vcc_state *state = seq->private;
struct atm_vcc *vcc = atm_sk(state->sk); struct atm_vcc *vcc = atm_sk(state->sk);
vcc_info(seq, vcc); vcc_info(seq, vcc);
} }
return 0; return 0;
} }
static struct seq_operations vcc_seq_ops = { static struct seq_operations vcc_seq_ops = {
.start = vcc_seq_start, .start = vcc_seq_start,
.next = vcc_seq_next, .next = vcc_seq_next,
.stop = vcc_seq_stop, .stop = vcc_seq_stop,
.show = vcc_seq_show, .show = vcc_seq_show,
}; };
static int vcc_seq_open(struct inode *inode, struct file *file) static int vcc_seq_open(struct inode *inode, struct file *file)
{ {
return __vcc_seq_open(inode, file, 0, &vcc_seq_ops); return __vcc_seq_open(inode, file, 0, &vcc_seq_ops);
} }
static struct file_operations vcc_seq_fops = { static struct file_operations vcc_seq_fops = {
.open = vcc_seq_open, .open = vcc_seq_open,
.read = seq_read, .read = seq_read,
@ -350,7 +350,7 @@ static struct file_operations vcc_seq_fops = {
static int svc_seq_show(struct seq_file *seq, void *v) static int svc_seq_show(struct seq_file *seq, void *v)
{ {
static char atm_svc_banner[] = static char atm_svc_banner[] =
"Itf VPI VCI State Remote\n"; "Itf VPI VCI State Remote\n";
if (v == (void *)1) if (v == (void *)1)
@ -472,7 +472,7 @@ static void atm_proc_dirs_remove(void)
static struct atm_proc_entry *e; static struct atm_proc_entry *e;
for (e = atm_proc_ents; e->name; e++) { for (e = atm_proc_ents; e->name; e++) {
if (e->dirent) if (e->dirent)
remove_proc_entry(e->name, atm_proc_root); remove_proc_entry(e->name, atm_proc_root);
} }
remove_proc_entry("net/atm", NULL); remove_proc_entry("net/atm", NULL);

View File

@ -72,7 +72,7 @@ static int pvc_setsockopt(struct socket *sock, int level, int optname,
static int pvc_getsockopt(struct socket *sock, int level, int optname, static int pvc_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int error; int error;
@ -91,7 +91,7 @@ static int pvc_getname(struct socket *sock,struct sockaddr *sockaddr,
struct atm_vcc *vcc = ATM_SD(sock); struct atm_vcc *vcc = ATM_SD(sock);
if (!vcc->dev || !test_bit(ATM_VF_ADDR,&vcc->flags)) return -ENOTCONN; if (!vcc->dev || !test_bit(ATM_VF_ADDR,&vcc->flags)) return -ENOTCONN;
*sockaddr_len = sizeof(struct sockaddr_atmpvc); *sockaddr_len = sizeof(struct sockaddr_atmpvc);
addr = (struct sockaddr_atmpvc *) sockaddr; addr = (struct sockaddr_atmpvc *) sockaddr;
addr->sap_family = AF_ATMPVC; addr->sap_family = AF_ATMPVC;
addr->sap_addr.itf = vcc->dev->number; addr->sap_addr.itf = vcc->dev->number;

View File

@ -56,12 +56,12 @@ static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
* still work * still work
*/ */
if (!capable(CAP_NET_ADMIN) && if (!capable(CAP_NET_ADMIN) &&
(((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) != (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT))) ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
{ {
kfree_skb(skb); kfree_skb(skb);
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
return vcc->dev->ops->send(vcc,skb); return vcc->dev->ops->send(vcc,skb);
} }

View File

@ -142,8 +142,8 @@ void atm_dev_deregister(struct atm_dev *dev)
set_bit(ATM_DF_REMOVED, &dev->flags); set_bit(ATM_DF_REMOVED, &dev->flags);
/* /*
* if we remove current device from atm_devs list, new device * if we remove current device from atm_devs list, new device
* with same number can appear, such we need deregister proc, * with same number can appear, such we need deregister proc,
* release async all vccs and remove them from vccs list too * release async all vccs and remove them from vccs list too
*/ */
mutex_lock(&atm_dev_mutex); mutex_lock(&atm_dev_mutex);
@ -228,7 +228,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
*tmp_p++ = dev->number; *tmp_p++ = dev->number;
} }
mutex_unlock(&atm_dev_mutex); mutex_unlock(&atm_dev_mutex);
error = ((copy_to_user(buf, tmp_buf, size)) || error = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, &iobuf->length)) put_user(size, &iobuf->length))
? -EFAULT : 0; ? -EFAULT : 0;
kfree(tmp_buf); kfree(tmp_buf);
@ -247,7 +247,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
if (!(dev = try_then_request_module(atm_dev_lookup(number), if (!(dev = try_then_request_module(atm_dev_lookup(number),
"atm-device-%d", number))) "atm-device-%d", number)))
return -ENODEV; return -ENODEV;
switch (cmd) { switch (cmd) {
case ATM_GETTYPE: case ATM_GETTYPE:
size = strlen(dev->type) + 1; size = strlen(dev->type) + 1;
@ -390,7 +390,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
goto done; goto done;
} }
} }
if (size) if (size)
error = put_user(size, &sioc->length) error = put_user(size, &sioc->length)
? -EFAULT : 0; ? -EFAULT : 0;
@ -414,15 +414,15 @@ static __inline__ void *dev_get_idx(loff_t left)
void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
{ {
mutex_lock(&atm_dev_mutex); mutex_lock(&atm_dev_mutex);
return *pos ? dev_get_idx(*pos) : (void *) 1; return *pos ? dev_get_idx(*pos) : (void *) 1;
} }
void atm_dev_seq_stop(struct seq_file *seq, void *v) void atm_dev_seq_stop(struct seq_file *seq, void *v)
{ {
mutex_unlock(&atm_dev_mutex); mutex_unlock(&atm_dev_mutex);
} }
void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
++*pos; ++*pos;

View File

@ -1,7 +1,7 @@
/* net/atm/signaling.h - ATM signaling */ /* net/atm/signaling.h - ATM signaling */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
#ifndef NET_ATM_SIGNALING_H #ifndef NET_ATM_SIGNALING_H
#define NET_ATM_SIGNALING_H #define NET_ATM_SIGNALING_H

View File

@ -89,7 +89,7 @@ static int svc_release(struct socket *sock)
clear_bit(ATM_VF_READY, &vcc->flags); clear_bit(ATM_VF_READY, &vcc->flags);
/* VCC pointer is used as a reference, so we must not free it /* VCC pointer is used as a reference, so we must not free it
(thereby subjecting it to re-use) before all pending connections (thereby subjecting it to re-use) before all pending connections
are closed */ are closed */
svc_disconnect(vcc); svc_disconnect(vcc);
vcc_release(sock); vcc_release(sock);
} }
@ -144,7 +144,7 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr,
error = -EUNATCH; error = -EUNATCH;
goto out; goto out;
} }
if (!sk->sk_err) if (!sk->sk_err)
set_bit(ATM_VF_BOUND,&vcc->flags); set_bit(ATM_VF_BOUND,&vcc->flags);
error = -sk->sk_err; error = -sk->sk_err;
out: out:
@ -229,7 +229,7 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
* This is tricky: * This is tricky:
* Kernel ---close--> Demon * Kernel ---close--> Demon
* Kernel <--close--- Demon * Kernel <--close--- Demon
* or * or
* Kernel ---close--> Demon * Kernel ---close--> Demon
* Kernel <--error--- Demon * Kernel <--error--- Demon
* or * or
@ -470,13 +470,13 @@ static int svc_setsockopt(struct socket *sock, int level, int optname,
} }
set_bit(ATM_VF_HASSAP, &vcc->flags); set_bit(ATM_VF_HASSAP, &vcc->flags);
break; break;
case SO_MULTIPOINT: case SO_MULTIPOINT:
if (level != SOL_ATM || optlen != sizeof(int)) { if (level != SOL_ATM || optlen != sizeof(int)) {
error = -EINVAL; error = -EINVAL;
goto out; goto out;
} }
if (get_user(value, (int __user *) optval)) { if (get_user(value, (int __user *) optval)) {
error = -EFAULT; error = -EFAULT;
goto out; goto out;
} }
if (value == 1) { if (value == 1) {
@ -486,7 +486,7 @@ static int svc_setsockopt(struct socket *sock, int level, int optname,
} else { } else {
error = -EINVAL; error = -EINVAL;
} }
break; break;
default: default:
error = vcc_setsockopt(sock, level, optname, error = vcc_setsockopt(sock, level, optname,
optval, optlen); optval, optlen);
@ -539,7 +539,7 @@ static int svc_addparty(struct socket *sock, struct sockaddr *sockaddr,
set_bit(ATM_VF_WAITING, &vcc->flags); set_bit(ATM_VF_WAITING, &vcc->flags);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
sigd_enq(vcc, as_addparty, NULL, NULL, sigd_enq(vcc, as_addparty, NULL, NULL,
(struct sockaddr_atmsvc *) sockaddr); (struct sockaddr_atmsvc *) sockaddr);
if (flags & O_NONBLOCK) { if (flags & O_NONBLOCK) {
finish_wait(sk->sk_sleep, &wait); finish_wait(sk->sk_sleep, &wait);
error = -EINPROGRESS; error = -EINPROGRESS;
@ -587,26 +587,26 @@ out:
static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
int error, ep_ref; int error, ep_ref;
struct sockaddr_atmsvc sa; struct sockaddr_atmsvc sa;
struct atm_vcc *vcc = ATM_SD(sock); struct atm_vcc *vcc = ATM_SD(sock);
switch (cmd) { switch (cmd) {
case ATM_ADDPARTY: case ATM_ADDPARTY:
if (!test_bit(ATM_VF_SESSION, &vcc->flags)) if (!test_bit(ATM_VF_SESSION, &vcc->flags))
return -EINVAL; return -EINVAL;
if (copy_from_user(&sa, (void __user *) arg, sizeof(sa))) if (copy_from_user(&sa, (void __user *) arg, sizeof(sa)))
return -EFAULT; return -EFAULT;
error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0); error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0);
break; break;
case ATM_DROPPARTY: case ATM_DROPPARTY:
if (!test_bit(ATM_VF_SESSION, &vcc->flags)) if (!test_bit(ATM_VF_SESSION, &vcc->flags))
return -EINVAL; return -EINVAL;
if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int))) if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int)))
return -EFAULT; return -EFAULT;
error = svc_dropparty(sock, ep_ref); error = svc_dropparty(sock, ep_ref);
break; break;
default: default:
error = vcc_ioctl(sock, cmd, arg); error = vcc_ioctl(sock, cmd, arg);
} }