aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/mpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm/mpc.c')
-rw-r--r--net/atm/mpc.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index a48a5d580408..0d2b994af511 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -25,7 +25,6 @@
25#include <linux/atmlec.h> 25#include <linux/atmlec.h>
26#include <linux/atmmpc.h> 26#include <linux/atmmpc.h>
27/* Modular too */ 27/* Modular too */
28#include <linux/config.h>
29#include <linux/module.h> 28#include <linux/module.h>
30 29
31#include "lec.h" 30#include "lec.h"
@@ -99,11 +98,6 @@ static struct notifier_block mpoa_notifier = {
99 0 98 0
100}; 99};
101 100
102#ifdef CONFIG_PROC_FS
103extern int mpc_proc_init(void);
104extern void mpc_proc_clean(void);
105#endif
106
107struct mpoa_client *mpcs = NULL; /* FIXME */ 101struct mpoa_client *mpcs = NULL; /* FIXME */
108static struct atm_mpoa_qos *qos_head = NULL; 102static struct atm_mpoa_qos *qos_head = NULL;
109static DEFINE_TIMER(mpc_timer, NULL, 0, 0); 103static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
@@ -259,10 +253,9 @@ static struct mpoa_client *alloc_mpc(void)
259{ 253{
260 struct mpoa_client *mpc; 254 struct mpoa_client *mpc;
261 255
262 mpc = kmalloc(sizeof (struct mpoa_client), GFP_KERNEL); 256 mpc = kzalloc(sizeof (struct mpoa_client), GFP_KERNEL);
263 if (mpc == NULL) 257 if (mpc == NULL)
264 return NULL; 258 return NULL;
265 memset(mpc, 0, sizeof(struct mpoa_client));
266 rwlock_init(&mpc->ingress_lock); 259 rwlock_init(&mpc->ingress_lock);
267 rwlock_init(&mpc->egress_lock); 260 rwlock_init(&mpc->egress_lock);
268 mpc->next = mpcs; 261 mpc->next = mpcs;
@@ -567,7 +560,6 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
567 struct atmmpc_ioc ioc_data; 560 struct atmmpc_ioc ioc_data;
568 in_cache_entry *in_entry; 561 in_cache_entry *in_entry;
569 uint32_t ipaddr; 562 uint32_t ipaddr;
570 unsigned char *ip;
571 563
572 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); 564 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc));
573 if (bytes_left != 0) { 565 if (bytes_left != 0) {
@@ -590,9 +582,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
590 if (in_entry != NULL) mpc->in_ops->put(in_entry); 582 if (in_entry != NULL) mpc->in_ops->put(in_entry);
591 return -EINVAL; 583 return -EINVAL;
592 } 584 }
593 ip = (unsigned char*)&in_entry->ctrl_info.in_dst_ip;
594 printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n", 585 printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %u.%u.%u.%u\n",
595 mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); 586 mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
596 in_entry->shortcut = vcc; 587 in_entry->shortcut = vcc;
597 mpc->in_ops->put(in_entry); 588 mpc->in_ops->put(in_entry);
598 } else { 589 } else {
@@ -623,10 +614,8 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
623 dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); 614 dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name);
624 in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); 615 in_entry = mpc->in_ops->get_by_vcc(vcc, mpc);
625 if (in_entry) { 616 if (in_entry) {
626 unsigned char *ip __attribute__ ((unused)) =
627 (unsigned char *)&in_entry->ctrl_info.in_dst_ip;
628 dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n", 617 dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %u.%u.%u.%u\n",
629 mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); 618 mpc->dev->name, NIPQUAD(in_entry->ctrl_info.in_dst_ip));
630 in_entry->shortcut = NULL; 619 in_entry->shortcut = NULL;
631 mpc->in_ops->put(in_entry); 620 mpc->in_ops->put(in_entry);
632 } 621 }
@@ -1113,10 +1102,9 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
1113 1102
1114static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) 1103static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1115{ 1104{
1116 unsigned char *ip;
1117
1118 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1105 uint32_t dst_ip = msg->content.in_info.in_dst_ip;
1119 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); 1106 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc);
1107
1120 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip)); 1108 dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %u.%u.%u.%u\n", mpc->dev->name, NIPQUAD(dst_ip));
1121 ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); 1109 ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry);
1122 if(entry == NULL){ 1110 if(entry == NULL){
@@ -1162,18 +1150,17 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
1162{ 1150{
1163 uint32_t dst_ip = msg->content.in_info.in_dst_ip; 1151 uint32_t dst_ip = msg->content.in_info.in_dst_ip;
1164 uint32_t mask = msg->ip_mask; 1152 uint32_t mask = msg->ip_mask;
1165 unsigned char *ip = (unsigned char *)&dst_ip;
1166 in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); 1153 in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask);
1167 1154
1168 if(entry == NULL){ 1155 if(entry == NULL){
1169 printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name); 1156 printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ", mpc->dev->name);
1170 printk("ip = %u.%u.%u.%u\n", ip[0], ip[1], ip[2], ip[3]); 1157 printk("ip = %u.%u.%u.%u\n", NIPQUAD(dst_ip));
1171 return; 1158 return;
1172 } 1159 }
1173 1160
1174 do { 1161 do {
1175 dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" , 1162 dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %u.%u.%u.%u\n" ,
1176 mpc->dev->name, ip[0], ip[1], ip[2], ip[3]); 1163 mpc->dev->name, NIPQUAD(dst_ip));
1177 write_lock_bh(&mpc->ingress_lock); 1164 write_lock_bh(&mpc->ingress_lock);
1178 mpc->in_ops->remove_entry(entry, mpc); 1165 mpc->in_ops->remove_entry(entry, mpc);
1179 write_unlock_bh(&mpc->ingress_lock); 1166 write_unlock_bh(&mpc->ingress_lock);
@@ -1442,12 +1429,8 @@ static __init int atm_mpoa_init(void)
1442{ 1429{
1443 register_atm_ioctl(&atm_ioctl_ops); 1430 register_atm_ioctl(&atm_ioctl_ops);
1444 1431
1445#ifdef CONFIG_PROC_FS
1446 if (mpc_proc_init() != 0) 1432 if (mpc_proc_init() != 0)
1447 printk(KERN_INFO "mpoa: failed to initialize /proc/mpoa\n"); 1433 printk(KERN_INFO "mpoa: failed to initialize /proc/mpoa\n");
1448 else
1449 printk(KERN_INFO "mpoa: /proc/mpoa initialized\n");
1450#endif
1451 1434
1452 printk("mpc.c: " __DATE__ " " __TIME__ " initialized\n"); 1435 printk("mpc.c: " __DATE__ " " __TIME__ " initialized\n");
1453 1436
@@ -1460,9 +1443,7 @@ static void __exit atm_mpoa_cleanup(void)
1460 struct atm_mpoa_qos *qos, *nextqos; 1443 struct atm_mpoa_qos *qos, *nextqos;
1461 struct lec_priv *priv; 1444 struct lec_priv *priv;
1462 1445
1463#ifdef CONFIG_PROC_FS
1464 mpc_proc_clean(); 1446 mpc_proc_clean();
1465#endif
1466 1447
1467 del_timer(&mpc_timer); 1448 del_timer(&mpc_timer);
1468 unregister_netdevice_notifier(&mpoa_notifier); 1449 unregister_netdevice_notifier(&mpoa_notifier);