diff options
Diffstat (limited to 'net/atm/mpc.c')
| -rw-r--r-- | net/atm/mpc.c | 575 |
1 files changed, 304 insertions, 271 deletions
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 38a6cb0863f0..74bcc662c3dd 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ | ||
| 2 | |||
| 1 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
| 2 | #include <linux/string.h> | 4 | #include <linux/string.h> |
| 5 | #include <linux/slab.h> | ||
| 3 | #include <linux/timer.h> | 6 | #include <linux/timer.h> |
| 4 | #include <linux/init.h> | 7 | #include <linux/init.h> |
| 5 | #include <linux/bitops.h> | 8 | #include <linux/bitops.h> |
| @@ -13,8 +16,8 @@ | |||
| 13 | #include <net/sock.h> | 16 | #include <net/sock.h> |
| 14 | #include <linux/skbuff.h> | 17 | #include <linux/skbuff.h> |
| 15 | #include <linux/ip.h> | 18 | #include <linux/ip.h> |
| 19 | #include <linux/uaccess.h> | ||
| 16 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
| 17 | #include <asm/uaccess.h> | ||
| 18 | #include <net/checksum.h> /* for ip_fast_csum() */ | 21 | #include <net/checksum.h> /* for ip_fast_csum() */ |
| 19 | #include <net/arp.h> | 22 | #include <net/arp.h> |
| 20 | #include <net/dst.h> | 23 | #include <net/dst.h> |
| @@ -36,31 +39,47 @@ | |||
| 36 | */ | 39 | */ |
| 37 | 40 | ||
| 38 | #if 0 | 41 | #if 0 |
| 39 | #define dprintk printk /* debug */ | 42 | #define dprintk(format, args...) \ |
| 43 | printk(KERN_DEBUG "mpoa:%s: " format, __func__, ##args) | ||
| 44 | #define dprintk_cont(format, args...) printk(KERN_CONT format, ##args) | ||
| 40 | #else | 45 | #else |
| 41 | #define dprintk(format,args...) | 46 | #define dprintk(format, args...) \ |
| 47 | do { if (0) \ | ||
| 48 | printk(KERN_DEBUG "mpoa:%s: " format, __func__, ##args);\ | ||
| 49 | } while (0) | ||
| 50 | #define dprintk_cont(format, args...) \ | ||
| 51 | do { if (0) printk(KERN_CONT format, ##args); } while (0) | ||
| 42 | #endif | 52 | #endif |
| 43 | 53 | ||
| 44 | #if 0 | 54 | #if 0 |
| 45 | #define ddprintk printk /* more debug */ | 55 | #define ddprintk(format, args...) \ |
| 56 | printk(KERN_DEBUG "mpoa:%s: " format, __func__, ##args) | ||
| 57 | #define ddprintk_cont(format, args...) printk(KERN_CONT format, ##args) | ||
| 46 | #else | 58 | #else |
| 47 | #define ddprintk(format,args...) | 59 | #define ddprintk(format, args...) \ |
| 60 | do { if (0) \ | ||
| 61 | printk(KERN_DEBUG "mpoa:%s: " format, __func__, ##args);\ | ||
| 62 | } while (0) | ||
| 63 | #define ddprintk_cont(format, args...) \ | ||
| 64 | do { if (0) printk(KERN_CONT format, ##args); } while (0) | ||
| 48 | #endif | 65 | #endif |
| 49 | 66 | ||
| 50 | |||
| 51 | |||
| 52 | #define MPOA_TAG_LEN 4 | 67 | #define MPOA_TAG_LEN 4 |
| 53 | 68 | ||
| 54 | /* mpc_daemon -> kernel */ | 69 | /* mpc_daemon -> kernel */ |
| 55 | static void MPOA_trigger_rcvd (struct k_message *msg, struct mpoa_client *mpc); | 70 | static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
| 56 | static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 71 | static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
| 57 | static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 72 | static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
| 58 | static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 73 | static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc); |
| 59 | static void mps_death(struct k_message *msg, struct mpoa_client *mpc); | 74 | static void mps_death(struct k_message *msg, struct mpoa_client *mpc); |
| 60 | static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action); | 75 | static void clean_up(struct k_message *msg, struct mpoa_client *mpc, |
| 61 | static void MPOA_cache_impos_rcvd(struct k_message *msg, struct mpoa_client *mpc); | 76 | int action); |
| 62 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); | 77 | static void MPOA_cache_impos_rcvd(struct k_message *msg, |
| 63 | static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); | 78 | struct mpoa_client *mpc); |
| 79 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, | ||
| 80 | struct mpoa_client *mpc); | ||
| 81 | static void set_mps_mac_addr_rcvd(struct k_message *mesg, | ||
| 82 | struct mpoa_client *mpc); | ||
| 64 | 83 | ||
| 65 | static const uint8_t *copy_macs(struct mpoa_client *mpc, | 84 | static const uint8_t *copy_macs(struct mpoa_client *mpc, |
| 66 | const uint8_t *router_mac, | 85 | const uint8_t *router_mac, |
| @@ -74,10 +93,11 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb); | |||
| 74 | 93 | ||
| 75 | static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb); | 94 | static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb); |
| 76 | static netdev_tx_t mpc_send_packet(struct sk_buff *skb, | 95 | static netdev_tx_t mpc_send_packet(struct sk_buff *skb, |
| 77 | struct net_device *dev); | 96 | struct net_device *dev); |
| 78 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned long event, void *dev); | 97 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, |
| 98 | unsigned long event, void *dev); | ||
| 79 | static void mpc_timer_refresh(void); | 99 | static void mpc_timer_refresh(void); |
| 80 | static void mpc_cache_check( unsigned long checking_time ); | 100 | static void mpc_cache_check(unsigned long checking_time); |
| 81 | 101 | ||
| 82 | static struct llc_snap_hdr llc_snap_mpoa_ctrl = { | 102 | static struct llc_snap_hdr llc_snap_mpoa_ctrl = { |
| 83 | 0xaa, 0xaa, 0x03, | 103 | 0xaa, 0xaa, 0x03, |
| @@ -167,7 +187,7 @@ struct atm_mpoa_qos *atm_mpoa_add_qos(__be32 dst_ip, struct atm_qos *qos) | |||
| 167 | 187 | ||
| 168 | entry = kmalloc(sizeof(struct atm_mpoa_qos), GFP_KERNEL); | 188 | entry = kmalloc(sizeof(struct atm_mpoa_qos), GFP_KERNEL); |
| 169 | if (entry == NULL) { | 189 | if (entry == NULL) { |
| 170 | printk("mpoa: atm_mpoa_add_qos: out of memory\n"); | 190 | pr_info("mpoa: out of memory\n"); |
| 171 | return entry; | 191 | return entry; |
| 172 | } | 192 | } |
| 173 | 193 | ||
| @@ -185,10 +205,9 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip) | |||
| 185 | struct atm_mpoa_qos *qos; | 205 | struct atm_mpoa_qos *qos; |
| 186 | 206 | ||
| 187 | qos = qos_head; | 207 | qos = qos_head; |
| 188 | while( qos != NULL ){ | 208 | while (qos) { |
| 189 | if(qos->ipaddr == dst_ip) { | 209 | if (qos->ipaddr == dst_ip) |
| 190 | break; | 210 | break; |
| 191 | } | ||
| 192 | qos = qos->next; | 211 | qos = qos->next; |
| 193 | } | 212 | } |
| 194 | 213 | ||
| @@ -200,10 +219,10 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip) | |||
| 200 | */ | 219 | */ |
| 201 | int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry) | 220 | int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry) |
| 202 | { | 221 | { |
| 203 | |||
| 204 | struct atm_mpoa_qos *curr; | 222 | struct atm_mpoa_qos *curr; |
| 205 | 223 | ||
| 206 | if (entry == NULL) return 0; | 224 | if (entry == NULL) |
| 225 | return 0; | ||
| 207 | if (entry == qos_head) { | 226 | if (entry == qos_head) { |
| 208 | qos_head = qos_head->next; | 227 | qos_head = qos_head->next; |
| 209 | kfree(entry); | 228 | kfree(entry); |
| @@ -234,9 +253,17 @@ void atm_mpoa_disp_qos(struct seq_file *m) | |||
| 234 | 253 | ||
| 235 | while (qos != NULL) { | 254 | while (qos != NULL) { |
| 236 | seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", | 255 | seq_printf(m, "%pI4\n %-7d %-7d %-7d %-7d %-7d\n %-7d %-7d %-7d %-7d %-7d\n", |
| 237 | &qos->ipaddr, | 256 | &qos->ipaddr, |
| 238 | qos->qos.txtp.max_pcr, qos->qos.txtp.pcr, qos->qos.txtp.min_pcr, qos->qos.txtp.max_cdv, qos->qos.txtp.max_sdu, | 257 | qos->qos.txtp.max_pcr, |
| 239 | qos->qos.rxtp.max_pcr, qos->qos.rxtp.pcr, qos->qos.rxtp.min_pcr, qos->qos.rxtp.max_cdv, qos->qos.rxtp.max_sdu); | 258 | qos->qos.txtp.pcr, |
| 259 | qos->qos.txtp.min_pcr, | ||
| 260 | qos->qos.txtp.max_cdv, | ||
| 261 | qos->qos.txtp.max_sdu, | ||
| 262 | qos->qos.rxtp.max_pcr, | ||
| 263 | qos->qos.rxtp.pcr, | ||
| 264 | qos->qos.rxtp.min_pcr, | ||
| 265 | qos->qos.rxtp.max_cdv, | ||
| 266 | qos->qos.rxtp.max_sdu); | ||
| 240 | qos = qos->next; | 267 | qos = qos->next; |
| 241 | } | 268 | } |
| 242 | } | 269 | } |
| @@ -256,7 +283,7 @@ static struct mpoa_client *alloc_mpc(void) | |||
| 256 | { | 283 | { |
| 257 | struct mpoa_client *mpc; | 284 | struct mpoa_client *mpc; |
| 258 | 285 | ||
| 259 | mpc = kzalloc(sizeof (struct mpoa_client), GFP_KERNEL); | 286 | mpc = kzalloc(sizeof(struct mpoa_client), GFP_KERNEL); |
| 260 | if (mpc == NULL) | 287 | if (mpc == NULL) |
| 261 | return NULL; | 288 | return NULL; |
| 262 | rwlock_init(&mpc->ingress_lock); | 289 | rwlock_init(&mpc->ingress_lock); |
| @@ -266,7 +293,7 @@ static struct mpoa_client *alloc_mpc(void) | |||
| 266 | 293 | ||
| 267 | mpc->parameters.mpc_p1 = MPC_P1; | 294 | mpc->parameters.mpc_p1 = MPC_P1; |
| 268 | mpc->parameters.mpc_p2 = MPC_P2; | 295 | mpc->parameters.mpc_p2 = MPC_P2; |
| 269 | memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3)); | 296 | memset(mpc->parameters.mpc_p3, 0, sizeof(mpc->parameters.mpc_p3)); |
| 270 | mpc->parameters.mpc_p4 = MPC_P4; | 297 | mpc->parameters.mpc_p4 = MPC_P4; |
| 271 | mpc->parameters.mpc_p5 = MPC_P5; | 298 | mpc->parameters.mpc_p5 = MPC_P5; |
| 272 | mpc->parameters.mpc_p6 = MPC_P6; | 299 | mpc->parameters.mpc_p6 = MPC_P6; |
| @@ -286,9 +313,9 @@ static struct mpoa_client *alloc_mpc(void) | |||
| 286 | static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) | 313 | static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) |
| 287 | { | 314 | { |
| 288 | 315 | ||
| 289 | dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); | 316 | dprintk("(%s)\n", mpc->dev->name); |
| 290 | if (!dev->netdev_ops) | 317 | if (!dev->netdev_ops) |
| 291 | printk("mpoa: (%s) start_mpc not starting\n", dev->name); | 318 | pr_info("(%s) not starting\n", dev->name); |
| 292 | else { | 319 | else { |
| 293 | mpc->old_ops = dev->netdev_ops; | 320 | mpc->old_ops = dev->netdev_ops; |
| 294 | mpc->new_ops = *mpc->old_ops; | 321 | mpc->new_ops = *mpc->old_ops; |
| @@ -300,14 +327,14 @@ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) | |||
| 300 | static void stop_mpc(struct mpoa_client *mpc) | 327 | static void stop_mpc(struct mpoa_client *mpc) |
| 301 | { | 328 | { |
| 302 | struct net_device *dev = mpc->dev; | 329 | struct net_device *dev = mpc->dev; |
| 303 | dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); | 330 | dprintk("(%s)", mpc->dev->name); |
| 304 | 331 | ||
| 305 | /* Lets not nullify lec device's dev->hard_start_xmit */ | 332 | /* Lets not nullify lec device's dev->hard_start_xmit */ |
| 306 | if (dev->netdev_ops != &mpc->new_ops) { | 333 | if (dev->netdev_ops != &mpc->new_ops) { |
| 307 | dprintk(" mpc already stopped, not fatal\n"); | 334 | dprintk_cont(" mpc already stopped, not fatal\n"); |
| 308 | return; | 335 | return; |
| 309 | } | 336 | } |
| 310 | dprintk("\n"); | 337 | dprintk_cont("\n"); |
| 311 | 338 | ||
| 312 | dev->netdev_ops = mpc->old_ops; | 339 | dev->netdev_ops = mpc->old_ops; |
| 313 | mpc->old_ops = NULL; | 340 | mpc->old_ops = NULL; |
| @@ -319,25 +346,18 @@ static const char *mpoa_device_type_string(char type) __attribute__ ((unused)); | |||
| 319 | 346 | ||
| 320 | static const char *mpoa_device_type_string(char type) | 347 | static const char *mpoa_device_type_string(char type) |
| 321 | { | 348 | { |
| 322 | switch(type) { | 349 | switch (type) { |
| 323 | case NON_MPOA: | 350 | case NON_MPOA: |
| 324 | return "non-MPOA device"; | 351 | return "non-MPOA device"; |
| 325 | break; | ||
| 326 | case MPS: | 352 | case MPS: |
| 327 | return "MPS"; | 353 | return "MPS"; |
| 328 | break; | ||
| 329 | case MPC: | 354 | case MPC: |
| 330 | return "MPC"; | 355 | return "MPC"; |
| 331 | break; | ||
| 332 | case MPS_AND_MPC: | 356 | case MPS_AND_MPC: |
| 333 | return "both MPS and MPC"; | 357 | return "both MPS and MPC"; |
| 334 | break; | ||
| 335 | default: | ||
| 336 | return "unspecified (non-MPOA) device"; | ||
| 337 | break; | ||
| 338 | } | 358 | } |
| 339 | 359 | ||
| 340 | return ""; /* not reached */ | 360 | return "unspecified (non-MPOA) device"; |
| 341 | } | 361 | } |
| 342 | 362 | ||
| 343 | /* | 363 | /* |
| @@ -362,26 +382,28 @@ static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr, | |||
| 362 | struct mpoa_client *mpc; | 382 | struct mpoa_client *mpc; |
| 363 | 383 | ||
| 364 | mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ | 384 | mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ |
| 365 | dprintk("mpoa: (%s) lane2_assoc_ind: received TLV(s), ", dev->name); | 385 | dprintk("(%s) received TLV(s), ", dev->name); |
| 366 | dprintk("total length of all TLVs %d\n", sizeoftlvs); | 386 | dprintk("total length of all TLVs %d\n", sizeoftlvs); |
| 367 | mpc = find_mpc_by_lec(dev); /* Sampo-Fix: moved here from below */ | 387 | mpc = find_mpc_by_lec(dev); /* Sampo-Fix: moved here from below */ |
| 368 | if (mpc == NULL) { | 388 | if (mpc == NULL) { |
| 369 | printk("mpoa: (%s) lane2_assoc_ind: no mpc\n", dev->name); | 389 | pr_info("(%s) no mpc\n", dev->name); |
| 370 | return; | 390 | return; |
| 371 | } | 391 | } |
| 372 | end_of_tlvs = tlvs + sizeoftlvs; | 392 | end_of_tlvs = tlvs + sizeoftlvs; |
| 373 | while (end_of_tlvs - tlvs >= 5) { | 393 | while (end_of_tlvs - tlvs >= 5) { |
| 374 | type = (tlvs[0] << 24) | (tlvs[1] << 16) | (tlvs[2] << 8) | tlvs[3]; | 394 | type = ((tlvs[0] << 24) | (tlvs[1] << 16) | |
| 395 | (tlvs[2] << 8) | tlvs[3]); | ||
| 375 | length = tlvs[4]; | 396 | length = tlvs[4]; |
| 376 | tlvs += 5; | 397 | tlvs += 5; |
| 377 | dprintk(" type 0x%x length %02x\n", type, length); | 398 | dprintk(" type 0x%x length %02x\n", type, length); |
| 378 | if (tlvs + length > end_of_tlvs) { | 399 | if (tlvs + length > end_of_tlvs) { |
| 379 | printk("TLV value extends past its buffer, aborting parse\n"); | 400 | pr_info("TLV value extends past its buffer, aborting parse\n"); |
| 380 | return; | 401 | return; |
| 381 | } | 402 | } |
| 382 | 403 | ||
| 383 | if (type == 0) { | 404 | if (type == 0) { |
| 384 | printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name); | 405 | pr_info("mpoa: (%s) TLV type was 0, returning\n", |
| 406 | dev->name); | ||
| 385 | return; | 407 | return; |
| 386 | } | 408 | } |
| 387 | 409 | ||
| @@ -391,40 +413,48 @@ static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr, | |||
| 391 | } | 413 | } |
| 392 | mpoa_device_type = *tlvs++; | 414 | mpoa_device_type = *tlvs++; |
| 393 | number_of_mps_macs = *tlvs++; | 415 | number_of_mps_macs = *tlvs++; |
| 394 | dprintk("mpoa: (%s) MPOA device type '%s', ", dev->name, mpoa_device_type_string(mpoa_device_type)); | 416 | dprintk("(%s) MPOA device type '%s', ", |
| 417 | dev->name, mpoa_device_type_string(mpoa_device_type)); | ||
| 395 | if (mpoa_device_type == MPS_AND_MPC && | 418 | if (mpoa_device_type == MPS_AND_MPC && |
| 396 | length < (42 + number_of_mps_macs*ETH_ALEN)) { /* :) */ | 419 | length < (42 + number_of_mps_macs*ETH_ALEN)) { /* :) */ |
| 397 | printk("\nmpoa: (%s) lane2_assoc_ind: short MPOA Device Type TLV\n", | 420 | pr_info("(%s) short MPOA Device Type TLV\n", |
| 398 | dev->name); | 421 | dev->name); |
| 399 | continue; | 422 | continue; |
| 400 | } | 423 | } |
| 401 | if ((mpoa_device_type == MPS || mpoa_device_type == MPC) | 424 | if ((mpoa_device_type == MPS || mpoa_device_type == MPC) && |
| 402 | && length < 22 + number_of_mps_macs*ETH_ALEN) { | 425 | length < 22 + number_of_mps_macs*ETH_ALEN) { |
| 403 | printk("\nmpoa: (%s) lane2_assoc_ind: short MPOA Device Type TLV\n", | 426 | pr_info("(%s) short MPOA Device Type TLV\n", dev->name); |
| 404 | dev->name); | ||
| 405 | continue; | 427 | continue; |
| 406 | } | 428 | } |
| 407 | if (mpoa_device_type != MPS && mpoa_device_type != MPS_AND_MPC) { | 429 | if (mpoa_device_type != MPS && |
| 408 | dprintk("ignoring non-MPS device\n"); | 430 | mpoa_device_type != MPS_AND_MPC) { |
| 409 | if (mpoa_device_type == MPC) tlvs += 20; | 431 | dprintk("ignoring non-MPS device "); |
| 432 | if (mpoa_device_type == MPC) | ||
| 433 | tlvs += 20; | ||
| 410 | continue; /* we are only interested in MPSs */ | 434 | continue; /* we are only interested in MPSs */ |
| 411 | } | 435 | } |
| 412 | if (number_of_mps_macs == 0 && mpoa_device_type == MPS_AND_MPC) { | 436 | if (number_of_mps_macs == 0 && |
| 413 | printk("\nmpoa: (%s) lane2_assoc_ind: MPS_AND_MPC has zero MACs\n", dev->name); | 437 | mpoa_device_type == MPS_AND_MPC) { |
| 438 | pr_info("(%s) MPS_AND_MPC has zero MACs\n", dev->name); | ||
| 414 | continue; /* someone should read the spec */ | 439 | continue; /* someone should read the spec */ |
| 415 | } | 440 | } |
| 416 | dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs); | 441 | dprintk_cont("this MPS has %d MAC addresses\n", |
| 442 | number_of_mps_macs); | ||
| 417 | 443 | ||
| 418 | /* ok, now we can go and tell our daemon the control address of MPS */ | 444 | /* |
| 445 | * ok, now we can go and tell our daemon | ||
| 446 | * the control address of MPS | ||
| 447 | */ | ||
| 419 | send_set_mps_ctrl_addr(tlvs, mpc); | 448 | send_set_mps_ctrl_addr(tlvs, mpc); |
| 420 | 449 | ||
| 421 | tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type); | 450 | tlvs = copy_macs(mpc, mac_addr, tlvs, |
| 422 | if (tlvs == NULL) return; | 451 | number_of_mps_macs, mpoa_device_type); |
| 452 | if (tlvs == NULL) | ||
| 453 | return; | ||
| 423 | } | 454 | } |
| 424 | if (end_of_tlvs - tlvs != 0) | 455 | if (end_of_tlvs - tlvs != 0) |
| 425 | printk("mpoa: (%s) lane2_assoc_ind: ignoring %Zd bytes of trailing TLV carbage\n", | 456 | pr_info("(%s) ignoring %Zd bytes of trailing TLV garbage\n", |
| 426 | dev->name, end_of_tlvs - tlvs); | 457 | dev->name, end_of_tlvs - tlvs); |
| 427 | return; | ||
| 428 | } | 458 | } |
| 429 | 459 | ||
| 430 | /* | 460 | /* |
| @@ -441,11 +471,12 @@ static const uint8_t *copy_macs(struct mpoa_client *mpc, | |||
| 441 | num_macs = (mps_macs > 1) ? mps_macs : 1; | 471 | num_macs = (mps_macs > 1) ? mps_macs : 1; |
| 442 | 472 | ||
| 443 | if (mpc->number_of_mps_macs != num_macs) { /* need to reallocate? */ | 473 | if (mpc->number_of_mps_macs != num_macs) { /* need to reallocate? */ |
| 444 | if (mpc->number_of_mps_macs != 0) kfree(mpc->mps_macs); | 474 | if (mpc->number_of_mps_macs != 0) |
| 475 | kfree(mpc->mps_macs); | ||
| 445 | mpc->number_of_mps_macs = 0; | 476 | mpc->number_of_mps_macs = 0; |
| 446 | mpc->mps_macs = kmalloc(num_macs*ETH_ALEN, GFP_KERNEL); | 477 | mpc->mps_macs = kmalloc(num_macs * ETH_ALEN, GFP_KERNEL); |
| 447 | if (mpc->mps_macs == NULL) { | 478 | if (mpc->mps_macs == NULL) { |
| 448 | printk("mpoa: (%s) copy_macs: out of mem\n", mpc->dev->name); | 479 | pr_info("(%s) out of mem\n", mpc->dev->name); |
| 449 | return NULL; | 480 | return NULL; |
| 450 | } | 481 | } |
| 451 | } | 482 | } |
| @@ -478,24 +509,30 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
| 478 | iph = (struct iphdr *)buff; | 509 | iph = (struct iphdr *)buff; |
| 479 | ipaddr = iph->daddr; | 510 | ipaddr = iph->daddr; |
| 480 | 511 | ||
| 481 | ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr); | 512 | ddprintk("(%s) ipaddr 0x%x\n", |
| 513 | mpc->dev->name, ipaddr); | ||
| 482 | 514 | ||
| 483 | entry = mpc->in_ops->get(ipaddr, mpc); | 515 | entry = mpc->in_ops->get(ipaddr, mpc); |
| 484 | if (entry == NULL) { | 516 | if (entry == NULL) { |
| 485 | entry = mpc->in_ops->add_entry(ipaddr, mpc); | 517 | entry = mpc->in_ops->add_entry(ipaddr, mpc); |
| 486 | if (entry != NULL) mpc->in_ops->put(entry); | 518 | if (entry != NULL) |
| 519 | mpc->in_ops->put(entry); | ||
| 487 | return 1; | 520 | return 1; |
| 488 | } | 521 | } |
| 489 | if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */ | 522 | /* threshold not exceeded or VCC not ready */ |
| 490 | ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name); | 523 | if (mpc->in_ops->cache_hit(entry, mpc) != OPEN) { |
| 524 | ddprintk("(%s) cache_hit: returns != OPEN\n", | ||
| 525 | mpc->dev->name); | ||
| 491 | mpc->in_ops->put(entry); | 526 | mpc->in_ops->put(entry); |
| 492 | return 1; | 527 | return 1; |
| 493 | } | 528 | } |
| 494 | 529 | ||
| 495 | ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name); | 530 | ddprintk("(%s) using shortcut\n", |
| 531 | mpc->dev->name); | ||
| 496 | /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ | 532 | /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ |
| 497 | if (iph->ttl <= 1) { | 533 | if (iph->ttl <= 1) { |
| 498 | ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl); | 534 | ddprintk("(%s) IP ttl = %u, using LANE\n", |
| 535 | mpc->dev->name, iph->ttl); | ||
| 499 | mpc->in_ops->put(entry); | 536 | mpc->in_ops->put(entry); |
| 500 | return 1; | 537 | return 1; |
| 501 | } | 538 | } |
| @@ -504,15 +541,18 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) | |||
| 504 | iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); | 541 | iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); |
| 505 | 542 | ||
| 506 | if (entry->ctrl_info.tag != 0) { | 543 | if (entry->ctrl_info.tag != 0) { |
| 507 | ddprintk("mpoa: (%s) send_via_shortcut: adding tag 0x%x\n", mpc->dev->name, entry->ctrl_info.tag); | 544 | ddprintk("(%s) adding tag 0x%x\n", |
| 545 | mpc->dev->name, entry->ctrl_info.tag); | ||
| 508 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; | 546 | tagged_llc_snap_hdr.tag = entry->ctrl_info.tag; |
| 509 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 547 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
| 510 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); /* add LLC/SNAP header */ | 548 | skb_push(skb, sizeof(tagged_llc_snap_hdr)); |
| 549 | /* add LLC/SNAP header */ | ||
| 511 | skb_copy_to_linear_data(skb, &tagged_llc_snap_hdr, | 550 | skb_copy_to_linear_data(skb, &tagged_llc_snap_hdr, |
| 512 | sizeof(tagged_llc_snap_hdr)); | 551 | sizeof(tagged_llc_snap_hdr)); |
| 513 | } else { | 552 | } else { |
| 514 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ | 553 | skb_pull(skb, ETH_HLEN); /* get rid of Eth header */ |
| 515 | skb_push(skb, sizeof(struct llc_snap_hdr)); /* add LLC/SNAP header + tag */ | 554 | skb_push(skb, sizeof(struct llc_snap_hdr)); |
| 555 | /* add LLC/SNAP header + tag */ | ||
| 516 | skb_copy_to_linear_data(skb, &llc_snap_mpoa_data, | 556 | skb_copy_to_linear_data(skb, &llc_snap_mpoa_data, |
| 517 | sizeof(struct llc_snap_hdr)); | 557 | sizeof(struct llc_snap_hdr)); |
| 518 | } | 558 | } |
| @@ -537,8 +577,8 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb, | |||
| 537 | int i = 0; | 577 | int i = 0; |
| 538 | 578 | ||
| 539 | mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ | 579 | mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ |
| 540 | if(mpc == NULL) { | 580 | if (mpc == NULL) { |
| 541 | printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name); | 581 | pr_info("(%s) no MPC found\n", dev->name); |
| 542 | goto non_ip; | 582 | goto non_ip; |
| 543 | } | 583 | } |
| 544 | 584 | ||
| @@ -554,14 +594,15 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb, | |||
| 554 | goto non_ip; | 594 | goto non_ip; |
| 555 | 595 | ||
| 556 | while (i < mpc->number_of_mps_macs) { | 596 | while (i < mpc->number_of_mps_macs) { |
| 557 | if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN))) | 597 | if (!compare_ether_addr(eth->h_dest, |
| 558 | if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */ | 598 | (mpc->mps_macs + i*ETH_ALEN))) |
| 559 | return NETDEV_TX_OK; /* success! */ | 599 | if (send_via_shortcut(skb, mpc) == 0) /* try shortcut */ |
| 600 | return NETDEV_TX_OK; | ||
| 560 | i++; | 601 | i++; |
| 561 | } | 602 | } |
| 562 | 603 | ||
| 563 | non_ip: | 604 | non_ip: |
| 564 | return mpc->old_ops->ndo_start_xmit(skb,dev); | 605 | return mpc->old_ops->ndo_start_xmit(skb, dev); |
| 565 | } | 606 | } |
| 566 | 607 | ||
| 567 | static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | 608 | static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) |
| @@ -574,7 +615,8 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
| 574 | 615 | ||
| 575 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); | 616 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc)); |
| 576 | if (bytes_left != 0) { | 617 | if (bytes_left != 0) { |
| 577 | printk("mpoa: mpc_vcc_attach: Short read (missed %d bytes) from userland\n", bytes_left); | 618 | pr_info("mpoa:Short read (missed %d bytes) from userland\n", |
| 619 | bytes_left); | ||
| 578 | return -EFAULT; | 620 | return -EFAULT; |
| 579 | } | 621 | } |
| 580 | ipaddr = ioc_data.ipaddr; | 622 | ipaddr = ioc_data.ipaddr; |
| @@ -587,18 +629,20 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
| 587 | 629 | ||
| 588 | if (ioc_data.type == MPC_SOCKET_INGRESS) { | 630 | if (ioc_data.type == MPC_SOCKET_INGRESS) { |
| 589 | in_entry = mpc->in_ops->get(ipaddr, mpc); | 631 | in_entry = mpc->in_ops->get(ipaddr, mpc); |
| 590 | if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) { | 632 | if (in_entry == NULL || |
| 591 | printk("mpoa: (%s) mpc_vcc_attach: did not find RESOLVED entry from ingress cache\n", | 633 | in_entry->entry_state < INGRESS_RESOLVED) { |
| 634 | pr_info("(%s) did not find RESOLVED entry from ingress cache\n", | ||
| 592 | mpc->dev->name); | 635 | mpc->dev->name); |
| 593 | if (in_entry != NULL) mpc->in_ops->put(in_entry); | 636 | if (in_entry != NULL) |
| 637 | mpc->in_ops->put(in_entry); | ||
| 594 | return -EINVAL; | 638 | return -EINVAL; |
| 595 | } | 639 | } |
| 596 | printk("mpoa: (%s) mpc_vcc_attach: attaching ingress SVC, entry = %pI4\n", | 640 | pr_info("(%s) attaching ingress SVC, entry = %pI4\n", |
| 597 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); | 641 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
| 598 | in_entry->shortcut = vcc; | 642 | in_entry->shortcut = vcc; |
| 599 | mpc->in_ops->put(in_entry); | 643 | mpc->in_ops->put(in_entry); |
| 600 | } else { | 644 | } else { |
| 601 | printk("mpoa: (%s) mpc_vcc_attach: attaching egress SVC\n", mpc->dev->name); | 645 | pr_info("(%s) attaching egress SVC\n", mpc->dev->name); |
| 602 | } | 646 | } |
| 603 | 647 | ||
| 604 | vcc->proto_data = mpc->dev; | 648 | vcc->proto_data = mpc->dev; |
| @@ -618,29 +662,27 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev) | |||
| 618 | 662 | ||
| 619 | mpc = find_mpc_by_lec(dev); | 663 | mpc = find_mpc_by_lec(dev); |
| 620 | if (mpc == NULL) { | 664 | if (mpc == NULL) { |
| 621 | printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name); | 665 | pr_info("(%s) close for unknown MPC\n", dev->name); |
| 622 | return; | 666 | return; |
| 623 | } | 667 | } |
| 624 | 668 | ||
| 625 | dprintk("mpoa: (%s) mpc_vcc_close:\n", dev->name); | 669 | dprintk("(%s)\n", dev->name); |
| 626 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); | 670 | in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); |
| 627 | if (in_entry) { | 671 | if (in_entry) { |
| 628 | dprintk("mpoa: (%s) mpc_vcc_close: ingress SVC closed ip = %pI4\n", | 672 | dprintk("(%s) ingress SVC closed ip = %pI4\n", |
| 629 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); | 673 | mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); |
| 630 | in_entry->shortcut = NULL; | 674 | in_entry->shortcut = NULL; |
| 631 | mpc->in_ops->put(in_entry); | 675 | mpc->in_ops->put(in_entry); |
| 632 | } | 676 | } |
| 633 | eg_entry = mpc->eg_ops->get_by_vcc(vcc, mpc); | 677 | eg_entry = mpc->eg_ops->get_by_vcc(vcc, mpc); |
| 634 | if (eg_entry) { | 678 | if (eg_entry) { |
| 635 | dprintk("mpoa: (%s) mpc_vcc_close: egress SVC closed\n", mpc->dev->name); | 679 | dprintk("(%s) egress SVC closed\n", mpc->dev->name); |
| 636 | eg_entry->shortcut = NULL; | 680 | eg_entry->shortcut = NULL; |
| 637 | mpc->eg_ops->put(eg_entry); | 681 | mpc->eg_ops->put(eg_entry); |
| 638 | } | 682 | } |
| 639 | 683 | ||
| 640 | if (in_entry == NULL && eg_entry == NULL) | 684 | if (in_entry == NULL && eg_entry == NULL) |
| 641 | dprintk("mpoa: (%s) mpc_vcc_close: unused vcc closed\n", dev->name); | 685 | dprintk("(%s) unused vcc closed\n", dev->name); |
| 642 | |||
| 643 | return; | ||
| 644 | } | 686 | } |
| 645 | 687 | ||
| 646 | static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | 688 | static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) |
| @@ -652,18 +694,19 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 652 | __be32 tag; | 694 | __be32 tag; |
| 653 | char *tmp; | 695 | char *tmp; |
| 654 | 696 | ||
| 655 | ddprintk("mpoa: (%s) mpc_push:\n", dev->name); | 697 | ddprintk("(%s)\n", dev->name); |
| 656 | if (skb == NULL) { | 698 | if (skb == NULL) { |
| 657 | dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name); | 699 | dprintk("(%s) null skb, closing VCC\n", dev->name); |
| 658 | mpc_vcc_close(vcc, dev); | 700 | mpc_vcc_close(vcc, dev); |
| 659 | return; | 701 | return; |
| 660 | } | 702 | } |
| 661 | 703 | ||
| 662 | skb->dev = dev; | 704 | skb->dev = dev; |
| 663 | if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) { | 705 | if (memcmp(skb->data, &llc_snap_mpoa_ctrl, |
| 706 | sizeof(struct llc_snap_hdr)) == 0) { | ||
| 664 | struct sock *sk = sk_atm(vcc); | 707 | struct sock *sk = sk_atm(vcc); |
| 665 | 708 | ||
| 666 | dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name); | 709 | dprintk("(%s) control packet arrived\n", dev->name); |
| 667 | /* Pass control packets to daemon */ | 710 | /* Pass control packets to daemon */ |
| 668 | skb_queue_tail(&sk->sk_receive_queue, skb); | 711 | skb_queue_tail(&sk->sk_receive_queue, skb); |
| 669 | sk->sk_data_ready(sk, skb->len); | 712 | sk->sk_data_ready(sk, skb->len); |
| @@ -675,20 +718,22 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 675 | 718 | ||
| 676 | mpc = find_mpc_by_lec(dev); | 719 | mpc = find_mpc_by_lec(dev); |
| 677 | if (mpc == NULL) { | 720 | if (mpc == NULL) { |
| 678 | printk("mpoa: (%s) mpc_push: unknown MPC\n", dev->name); | 721 | pr_info("(%s) unknown MPC\n", dev->name); |
| 679 | return; | 722 | return; |
| 680 | } | 723 | } |
| 681 | 724 | ||
| 682 | if (memcmp(skb->data, &llc_snap_mpoa_data_tagged, sizeof(struct llc_snap_hdr)) == 0) { /* MPOA tagged data */ | 725 | if (memcmp(skb->data, &llc_snap_mpoa_data_tagged, |
| 683 | ddprintk("mpoa: (%s) mpc_push: tagged data packet arrived\n", dev->name); | 726 | sizeof(struct llc_snap_hdr)) == 0) { /* MPOA tagged data */ |
| 727 | ddprintk("(%s) tagged data packet arrived\n", dev->name); | ||
| 684 | 728 | ||
| 685 | } else if (memcmp(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr)) == 0) { /* MPOA data */ | 729 | } else if (memcmp(skb->data, &llc_snap_mpoa_data, |
| 686 | printk("mpoa: (%s) mpc_push: non-tagged data packet arrived\n", dev->name); | 730 | sizeof(struct llc_snap_hdr)) == 0) { /* MPOA data */ |
| 687 | printk(" mpc_push: non-tagged data unsupported, purging\n"); | 731 | pr_info("(%s) Unsupported non-tagged data packet arrived. Purging\n", |
| 732 | dev->name); | ||
| 688 | dev_kfree_skb_any(skb); | 733 | dev_kfree_skb_any(skb); |
| 689 | return; | 734 | return; |
| 690 | } else { | 735 | } else { |
| 691 | printk("mpoa: (%s) mpc_push: garbage arrived, purging\n", dev->name); | 736 | pr_info("(%s) garbage arrived, purging\n", dev->name); |
| 692 | dev_kfree_skb_any(skb); | 737 | dev_kfree_skb_any(skb); |
| 693 | return; | 738 | return; |
| 694 | } | 739 | } |
| @@ -698,8 +743,8 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 698 | 743 | ||
| 699 | eg = mpc->eg_ops->get_by_tag(tag, mpc); | 744 | eg = mpc->eg_ops->get_by_tag(tag, mpc); |
| 700 | if (eg == NULL) { | 745 | if (eg == NULL) { |
| 701 | printk("mpoa: (%s) mpc_push: Didn't find egress cache entry, tag = %u\n", | 746 | pr_info("mpoa: (%s) Didn't find egress cache entry, tag = %u\n", |
| 702 | dev->name,tag); | 747 | dev->name, tag); |
| 703 | purge_egress_shortcut(vcc, NULL); | 748 | purge_egress_shortcut(vcc, NULL); |
| 704 | dev_kfree_skb_any(skb); | 749 | dev_kfree_skb_any(skb); |
| 705 | return; | 750 | return; |
| @@ -711,13 +756,15 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 711 | */ | 756 | */ |
| 712 | if (eg->shortcut == NULL) { | 757 | if (eg->shortcut == NULL) { |
| 713 | eg->shortcut = vcc; | 758 | eg->shortcut = vcc; |
| 714 | printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name); | 759 | pr_info("(%s) egress SVC in use\n", dev->name); |
| 715 | } | 760 | } |
| 716 | 761 | ||
| 717 | skb_pull(skb, sizeof(struct llc_snap_hdr) + sizeof(tag)); /* get rid of LLC/SNAP header */ | 762 | skb_pull(skb, sizeof(struct llc_snap_hdr) + sizeof(tag)); |
| 718 | new_skb = skb_realloc_headroom(skb, eg->ctrl_info.DH_length); /* LLC/SNAP is shorter than MAC header :( */ | 763 | /* get rid of LLC/SNAP header */ |
| 764 | new_skb = skb_realloc_headroom(skb, eg->ctrl_info.DH_length); | ||
| 765 | /* LLC/SNAP is shorter than MAC header :( */ | ||
| 719 | dev_kfree_skb_any(skb); | 766 | dev_kfree_skb_any(skb); |
| 720 | if (new_skb == NULL){ | 767 | if (new_skb == NULL) { |
| 721 | mpc->eg_ops->put(eg); | 768 | mpc->eg_ops->put(eg); |
| 722 | return; | 769 | return; |
| 723 | } | 770 | } |
| @@ -731,10 +778,8 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 731 | eg->packets_rcvd++; | 778 | eg->packets_rcvd++; |
| 732 | mpc->eg_ops->put(eg); | 779 | mpc->eg_ops->put(eg); |
| 733 | 780 | ||
| 734 | memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); | 781 | memset(ATM_SKB(new_skb), 0, sizeof(struct atm_skb_data)); |
| 735 | netif_rx(new_skb); | 782 | netif_rx(new_skb); |
| 736 | |||
| 737 | return; | ||
| 738 | } | 783 | } |
| 739 | 784 | ||
| 740 | static struct atmdev_ops mpc_ops = { /* only send is required */ | 785 | static struct atmdev_ops mpc_ops = { /* only send is required */ |
| @@ -750,7 +795,7 @@ static struct atm_dev mpc_dev = { | |||
| 750 | /* members not explicitly initialised will be 0 */ | 795 | /* members not explicitly initialised will be 0 */ |
| 751 | }; | 796 | }; |
| 752 | 797 | ||
| 753 | static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | 798 | static int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg) |
| 754 | { | 799 | { |
| 755 | struct mpoa_client *mpc; | 800 | struct mpoa_client *mpc; |
| 756 | struct lec_priv *priv; | 801 | struct lec_priv *priv; |
| @@ -770,15 +815,16 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
| 770 | 815 | ||
| 771 | mpc = find_mpc_by_itfnum(arg); | 816 | mpc = find_mpc_by_itfnum(arg); |
| 772 | if (mpc == NULL) { | 817 | if (mpc == NULL) { |
| 773 | dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg); | 818 | dprintk("allocating new mpc for itf %d\n", arg); |
| 774 | mpc = alloc_mpc(); | 819 | mpc = alloc_mpc(); |
| 775 | if (mpc == NULL) | 820 | if (mpc == NULL) |
| 776 | return -ENOMEM; | 821 | return -ENOMEM; |
| 777 | mpc->dev_num = arg; | 822 | mpc->dev_num = arg; |
| 778 | mpc->dev = find_lec_by_itfnum(arg); /* NULL if there was no lec */ | 823 | mpc->dev = find_lec_by_itfnum(arg); |
| 824 | /* NULL if there was no lec */ | ||
| 779 | } | 825 | } |
| 780 | if (mpc->mpoad_vcc) { | 826 | if (mpc->mpoad_vcc) { |
| 781 | printk("mpoa: mpoad_attach: mpoad is already present for itf %d\n", arg); | 827 | pr_info("mpoad is already present for itf %d\n", arg); |
| 782 | return -EADDRINUSE; | 828 | return -EADDRINUSE; |
| 783 | } | 829 | } |
| 784 | 830 | ||
| @@ -794,8 +840,8 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
| 794 | mpc->mpoad_vcc = vcc; | 840 | mpc->mpoad_vcc = vcc; |
| 795 | vcc->dev = &mpc_dev; | 841 | vcc->dev = &mpc_dev; |
| 796 | vcc_insert_socket(sk_atm(vcc)); | 842 | vcc_insert_socket(sk_atm(vcc)); |
| 797 | set_bit(ATM_VF_META,&vcc->flags); | 843 | set_bit(ATM_VF_META, &vcc->flags); |
| 798 | set_bit(ATM_VF_READY,&vcc->flags); | 844 | set_bit(ATM_VF_READY, &vcc->flags); |
| 799 | 845 | ||
| 800 | if (mpc->dev) { | 846 | if (mpc->dev) { |
| 801 | char empty[ATM_ESA_LEN]; | 847 | char empty[ATM_ESA_LEN]; |
| @@ -805,7 +851,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) | |||
| 805 | /* set address if mpcd e.g. gets killed and restarted. | 851 | /* set address if mpcd e.g. gets killed and restarted. |
| 806 | * If we do not do it now we have to wait for the next LE_ARP | 852 | * If we do not do it now we have to wait for the next LE_ARP |
| 807 | */ | 853 | */ |
| 808 | if ( memcmp(mpc->mps_ctrl_addr, empty, ATM_ESA_LEN) != 0 ) | 854 | if (memcmp(mpc->mps_ctrl_addr, empty, ATM_ESA_LEN) != 0) |
| 809 | send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc); | 855 | send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc); |
| 810 | } | 856 | } |
| 811 | 857 | ||
| @@ -817,13 +863,11 @@ static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc) | |||
| 817 | { | 863 | { |
| 818 | struct k_message mesg; | 864 | struct k_message mesg; |
| 819 | 865 | ||
| 820 | memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); | 866 | memcpy(mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); |
| 821 | 867 | ||
| 822 | mesg.type = SET_MPS_CTRL_ADDR; | 868 | mesg.type = SET_MPS_CTRL_ADDR; |
| 823 | memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); | 869 | memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); |
| 824 | msg_to_mpoad(&mesg, mpc); | 870 | msg_to_mpoad(&mesg, mpc); |
| 825 | |||
| 826 | return; | ||
| 827 | } | 871 | } |
| 828 | 872 | ||
| 829 | static void mpoad_close(struct atm_vcc *vcc) | 873 | static void mpoad_close(struct atm_vcc *vcc) |
| @@ -833,11 +877,11 @@ static void mpoad_close(struct atm_vcc *vcc) | |||
| 833 | 877 | ||
| 834 | mpc = find_mpc_by_vcc(vcc); | 878 | mpc = find_mpc_by_vcc(vcc); |
| 835 | if (mpc == NULL) { | 879 | if (mpc == NULL) { |
| 836 | printk("mpoa: mpoad_close: did not find MPC\n"); | 880 | pr_info("did not find MPC\n"); |
| 837 | return; | 881 | return; |
| 838 | } | 882 | } |
| 839 | if (!mpc->mpoad_vcc) { | 883 | if (!mpc->mpoad_vcc) { |
| 840 | printk("mpoa: mpoad_close: close for non-present mpoad\n"); | 884 | pr_info("close for non-present mpoad\n"); |
| 841 | return; | 885 | return; |
| 842 | } | 886 | } |
| 843 | 887 | ||
| @@ -857,11 +901,9 @@ static void mpoad_close(struct atm_vcc *vcc) | |||
| 857 | kfree_skb(skb); | 901 | kfree_skb(skb); |
| 858 | } | 902 | } |
| 859 | 903 | ||
| 860 | printk("mpoa: (%s) going down\n", | 904 | pr_info("(%s) going down\n", |
| 861 | (mpc->dev) ? mpc->dev->name : "<unknown>"); | 905 | (mpc->dev) ? mpc->dev->name : "<unknown>"); |
| 862 | module_put(THIS_MODULE); | 906 | module_put(THIS_MODULE); |
| 863 | |||
| 864 | return; | ||
| 865 | } | 907 | } |
| 866 | 908 | ||
| 867 | /* | 909 | /* |
| @@ -871,61 +913,61 @@ static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) | |||
| 871 | { | 913 | { |
| 872 | 914 | ||
| 873 | struct mpoa_client *mpc = find_mpc_by_vcc(vcc); | 915 | struct mpoa_client *mpc = find_mpc_by_vcc(vcc); |
| 874 | struct k_message *mesg = (struct k_message*)skb->data; | 916 | struct k_message *mesg = (struct k_message *)skb->data; |
| 875 | atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); | 917 | atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); |
| 876 | 918 | ||
| 877 | if (mpc == NULL) { | 919 | if (mpc == NULL) { |
| 878 | printk("mpoa: msg_from_mpoad: no mpc found\n"); | 920 | pr_info("no mpc found\n"); |
| 879 | return 0; | 921 | return 0; |
| 880 | } | 922 | } |
| 881 | dprintk("mpoa: (%s) msg_from_mpoad:", (mpc->dev) ? mpc->dev->name : "<unknown>"); | 923 | dprintk("(%s)", mpc->dev ? mpc->dev->name : "<unknown>"); |
| 882 | switch(mesg->type) { | 924 | switch (mesg->type) { |
| 883 | case MPOA_RES_REPLY_RCVD: | 925 | case MPOA_RES_REPLY_RCVD: |
| 884 | dprintk(" mpoa_res_reply_rcvd\n"); | 926 | dprintk_cont("mpoa_res_reply_rcvd\n"); |
| 885 | MPOA_res_reply_rcvd(mesg, mpc); | 927 | MPOA_res_reply_rcvd(mesg, mpc); |
| 886 | break; | 928 | break; |
| 887 | case MPOA_TRIGGER_RCVD: | 929 | case MPOA_TRIGGER_RCVD: |
| 888 | dprintk(" mpoa_trigger_rcvd\n"); | 930 | dprintk_cont("mpoa_trigger_rcvd\n"); |
| 889 | MPOA_trigger_rcvd(mesg, mpc); | 931 | MPOA_trigger_rcvd(mesg, mpc); |
| 890 | break; | 932 | break; |
| 891 | case INGRESS_PURGE_RCVD: | 933 | case INGRESS_PURGE_RCVD: |
| 892 | dprintk(" nhrp_purge_rcvd\n"); | 934 | dprintk_cont("nhrp_purge_rcvd\n"); |
| 893 | ingress_purge_rcvd(mesg, mpc); | 935 | ingress_purge_rcvd(mesg, mpc); |
| 894 | break; | 936 | break; |
| 895 | case EGRESS_PURGE_RCVD: | 937 | case EGRESS_PURGE_RCVD: |
| 896 | dprintk(" egress_purge_reply_rcvd\n"); | 938 | dprintk_cont("egress_purge_reply_rcvd\n"); |
| 897 | egress_purge_rcvd(mesg, mpc); | 939 | egress_purge_rcvd(mesg, mpc); |
| 898 | break; | 940 | break; |
| 899 | case MPS_DEATH: | 941 | case MPS_DEATH: |
| 900 | dprintk(" mps_death\n"); | 942 | dprintk_cont("mps_death\n"); |
| 901 | mps_death(mesg, mpc); | 943 | mps_death(mesg, mpc); |
| 902 | break; | 944 | break; |
| 903 | case CACHE_IMPOS_RCVD: | 945 | case CACHE_IMPOS_RCVD: |
| 904 | dprintk(" cache_impos_rcvd\n"); | 946 | dprintk_cont("cache_impos_rcvd\n"); |
| 905 | MPOA_cache_impos_rcvd(mesg, mpc); | 947 | MPOA_cache_impos_rcvd(mesg, mpc); |
| 906 | break; | 948 | break; |
| 907 | case SET_MPC_CTRL_ADDR: | 949 | case SET_MPC_CTRL_ADDR: |
| 908 | dprintk(" set_mpc_ctrl_addr\n"); | 950 | dprintk_cont("set_mpc_ctrl_addr\n"); |
| 909 | set_mpc_ctrl_addr_rcvd(mesg, mpc); | 951 | set_mpc_ctrl_addr_rcvd(mesg, mpc); |
| 910 | break; | 952 | break; |
| 911 | case SET_MPS_MAC_ADDR: | 953 | case SET_MPS_MAC_ADDR: |
| 912 | dprintk(" set_mps_mac_addr\n"); | 954 | dprintk_cont("set_mps_mac_addr\n"); |
| 913 | set_mps_mac_addr_rcvd(mesg, mpc); | 955 | set_mps_mac_addr_rcvd(mesg, mpc); |
| 914 | break; | 956 | break; |
| 915 | case CLEAN_UP_AND_EXIT: | 957 | case CLEAN_UP_AND_EXIT: |
| 916 | dprintk(" clean_up_and_exit\n"); | 958 | dprintk_cont("clean_up_and_exit\n"); |
| 917 | clean_up(mesg, mpc, DIE); | 959 | clean_up(mesg, mpc, DIE); |
| 918 | break; | 960 | break; |
| 919 | case RELOAD: | 961 | case RELOAD: |
| 920 | dprintk(" reload\n"); | 962 | dprintk_cont("reload\n"); |
| 921 | clean_up(mesg, mpc, RELOAD); | 963 | clean_up(mesg, mpc, RELOAD); |
| 922 | break; | 964 | break; |
| 923 | case SET_MPC_PARAMS: | 965 | case SET_MPC_PARAMS: |
| 924 | dprintk(" set_mpc_params\n"); | 966 | dprintk_cont("set_mpc_params\n"); |
| 925 | mpc->parameters = mesg->content.params; | 967 | mpc->parameters = mesg->content.params; |
| 926 | break; | 968 | break; |
| 927 | default: | 969 | default: |
| 928 | dprintk(" unknown message %d\n", mesg->type); | 970 | dprintk_cont("unknown message %d\n", mesg->type); |
| 929 | break; | 971 | break; |
| 930 | } | 972 | } |
| 931 | kfree_skb(skb); | 973 | kfree_skb(skb); |
| @@ -940,7 +982,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
| 940 | struct sock *sk; | 982 | struct sock *sk; |
| 941 | 983 | ||
| 942 | if (mpc == NULL || !mpc->mpoad_vcc) { | 984 | if (mpc == NULL || !mpc->mpoad_vcc) { |
| 943 | printk("mpoa: msg_to_mpoad: mesg %d to a non-existent mpoad\n", mesg->type); | 985 | pr_info("mesg %d to a non-existent mpoad\n", mesg->type); |
| 944 | return -ENXIO; | 986 | return -ENXIO; |
| 945 | } | 987 | } |
| 946 | 988 | ||
| @@ -958,7 +1000,8 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
| 958 | return 0; | 1000 | return 0; |
| 959 | } | 1001 | } |
| 960 | 1002 | ||
| 961 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned long event, void *dev_ptr) | 1003 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, |
| 1004 | unsigned long event, void *dev_ptr) | ||
| 962 | { | 1005 | { |
| 963 | struct net_device *dev; | 1006 | struct net_device *dev; |
| 964 | struct mpoa_client *mpc; | 1007 | struct mpoa_client *mpc; |
| @@ -980,25 +1023,24 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
| 980 | priv->lane2_ops->associate_indicator = lane2_assoc_ind; | 1023 | priv->lane2_ops->associate_indicator = lane2_assoc_ind; |
| 981 | mpc = find_mpc_by_itfnum(priv->itfnum); | 1024 | mpc = find_mpc_by_itfnum(priv->itfnum); |
| 982 | if (mpc == NULL) { | 1025 | if (mpc == NULL) { |
| 983 | dprintk("mpoa: mpoa_event_listener: allocating new mpc for %s\n", | 1026 | dprintk("allocating new mpc for %s\n", dev->name); |
| 984 | dev->name); | ||
| 985 | mpc = alloc_mpc(); | 1027 | mpc = alloc_mpc(); |
| 986 | if (mpc == NULL) { | 1028 | if (mpc == NULL) { |
| 987 | printk("mpoa: mpoa_event_listener: no new mpc"); | 1029 | pr_info("no new mpc"); |
| 988 | break; | 1030 | break; |
| 989 | } | 1031 | } |
| 990 | } | 1032 | } |
| 991 | mpc->dev_num = priv->itfnum; | 1033 | mpc->dev_num = priv->itfnum; |
| 992 | mpc->dev = dev; | 1034 | mpc->dev = dev; |
| 993 | dev_hold(dev); | 1035 | dev_hold(dev); |
| 994 | dprintk("mpoa: (%s) was initialized\n", dev->name); | 1036 | dprintk("(%s) was initialized\n", dev->name); |
| 995 | break; | 1037 | break; |
| 996 | case NETDEV_UNREGISTER: | 1038 | case NETDEV_UNREGISTER: |
| 997 | /* the lec device was deallocated */ | 1039 | /* the lec device was deallocated */ |
| 998 | mpc = find_mpc_by_lec(dev); | 1040 | mpc = find_mpc_by_lec(dev); |
| 999 | if (mpc == NULL) | 1041 | if (mpc == NULL) |
| 1000 | break; | 1042 | break; |
| 1001 | dprintk("mpoa: device (%s) was deallocated\n", dev->name); | 1043 | dprintk("device (%s) was deallocated\n", dev->name); |
| 1002 | stop_mpc(mpc); | 1044 | stop_mpc(mpc); |
| 1003 | dev_put(mpc->dev); | 1045 | dev_put(mpc->dev); |
| 1004 | mpc->dev = NULL; | 1046 | mpc->dev = NULL; |
| @@ -1008,9 +1050,8 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
| 1008 | mpc = find_mpc_by_lec(dev); | 1050 | mpc = find_mpc_by_lec(dev); |
| 1009 | if (mpc == NULL) | 1051 | if (mpc == NULL) |
| 1010 | break; | 1052 | break; |
| 1011 | if (mpc->mpoad_vcc != NULL) { | 1053 | if (mpc->mpoad_vcc != NULL) |
| 1012 | start_mpc(mpc, dev); | 1054 | start_mpc(mpc, dev); |
| 1013 | } | ||
| 1014 | break; | 1055 | break; |
| 1015 | case NETDEV_DOWN: | 1056 | case NETDEV_DOWN: |
| 1016 | /* the dev was ifconfig'ed down */ | 1057 | /* the dev was ifconfig'ed down */ |
| @@ -1020,9 +1061,8 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
| 1020 | mpc = find_mpc_by_lec(dev); | 1061 | mpc = find_mpc_by_lec(dev); |
| 1021 | if (mpc == NULL) | 1062 | if (mpc == NULL) |
| 1022 | break; | 1063 | break; |
| 1023 | if (mpc->mpoad_vcc != NULL) { | 1064 | if (mpc->mpoad_vcc != NULL) |
| 1024 | stop_mpc(mpc); | 1065 | stop_mpc(mpc); |
| 1025 | } | ||
| 1026 | break; | 1066 | break; |
| 1027 | case NETDEV_REBOOT: | 1067 | case NETDEV_REBOOT: |
| 1028 | case NETDEV_CHANGE: | 1068 | case NETDEV_CHANGE: |
| @@ -1049,7 +1089,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1049 | in_cache_entry *entry; | 1089 | in_cache_entry *entry; |
| 1050 | 1090 | ||
| 1051 | entry = mpc->in_ops->get(dst_ip, mpc); | 1091 | entry = mpc->in_ops->get(dst_ip, mpc); |
| 1052 | if(entry == NULL){ | 1092 | if (entry == NULL) { |
| 1053 | entry = mpc->in_ops->add_entry(dst_ip, mpc); | 1093 | entry = mpc->in_ops->add_entry(dst_ip, mpc); |
| 1054 | entry->entry_state = INGRESS_RESOLVING; | 1094 | entry->entry_state = INGRESS_RESOLVING; |
| 1055 | msg->type = SND_MPOA_RES_RQST; | 1095 | msg->type = SND_MPOA_RES_RQST; |
| @@ -1060,7 +1100,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1060 | return; | 1100 | return; |
| 1061 | } | 1101 | } |
| 1062 | 1102 | ||
| 1063 | if(entry->entry_state == INGRESS_INVALID){ | 1103 | if (entry->entry_state == INGRESS_INVALID) { |
| 1064 | entry->entry_state = INGRESS_RESOLVING; | 1104 | entry->entry_state = INGRESS_RESOLVING; |
| 1065 | msg->type = SND_MPOA_RES_RQST; | 1105 | msg->type = SND_MPOA_RES_RQST; |
| 1066 | msg->content.in_info = entry->ctrl_info; | 1106 | msg->content.in_info = entry->ctrl_info; |
| @@ -1070,33 +1110,34 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1070 | return; | 1110 | return; |
| 1071 | } | 1111 | } |
| 1072 | 1112 | ||
| 1073 | printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n", | 1113 | pr_info("(%s) entry already in resolving state\n", |
| 1074 | (mpc->dev) ? mpc->dev->name : "<unknown>"); | 1114 | (mpc->dev) ? mpc->dev->name : "<unknown>"); |
| 1075 | mpc->in_ops->put(entry); | 1115 | mpc->in_ops->put(entry); |
| 1076 | return; | ||
| 1077 | } | 1116 | } |
| 1078 | 1117 | ||
| 1079 | /* | 1118 | /* |
| 1080 | * Things get complicated because we have to check if there's an egress | 1119 | * Things get complicated because we have to check if there's an egress |
| 1081 | * shortcut with suitable traffic parameters we could use. | 1120 | * shortcut with suitable traffic parameters we could use. |
| 1082 | */ | 1121 | */ |
| 1083 | static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) | 1122 | static void check_qos_and_open_shortcut(struct k_message *msg, |
| 1123 | struct mpoa_client *client, | ||
| 1124 | in_cache_entry *entry) | ||
| 1084 | { | 1125 | { |
| 1085 | __be32 dst_ip = msg->content.in_info.in_dst_ip; | 1126 | __be32 dst_ip = msg->content.in_info.in_dst_ip; |
| 1086 | struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); | 1127 | struct atm_mpoa_qos *qos = atm_mpoa_search_qos(dst_ip); |
| 1087 | eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); | 1128 | eg_cache_entry *eg_entry = client->eg_ops->get_by_src_ip(dst_ip, client); |
| 1088 | 1129 | ||
| 1089 | if(eg_entry && eg_entry->shortcut){ | 1130 | if (eg_entry && eg_entry->shortcut) { |
| 1090 | if(eg_entry->shortcut->qos.txtp.traffic_class & | 1131 | if (eg_entry->shortcut->qos.txtp.traffic_class & |
| 1091 | msg->qos.txtp.traffic_class & | 1132 | msg->qos.txtp.traffic_class & |
| 1092 | (qos ? qos->qos.txtp.traffic_class : ATM_UBR | ATM_CBR)){ | 1133 | (qos ? qos->qos.txtp.traffic_class : ATM_UBR | ATM_CBR)) { |
| 1093 | if(eg_entry->shortcut->qos.txtp.traffic_class == ATM_UBR) | 1134 | if (eg_entry->shortcut->qos.txtp.traffic_class == ATM_UBR) |
| 1094 | entry->shortcut = eg_entry->shortcut; | 1135 | entry->shortcut = eg_entry->shortcut; |
| 1095 | else if(eg_entry->shortcut->qos.txtp.max_pcr > 0) | 1136 | else if (eg_entry->shortcut->qos.txtp.max_pcr > 0) |
| 1096 | entry->shortcut = eg_entry->shortcut; | 1137 | entry->shortcut = eg_entry->shortcut; |
| 1097 | } | 1138 | } |
| 1098 | if(entry->shortcut){ | 1139 | if (entry->shortcut) { |
| 1099 | dprintk("mpoa: (%s) using egress SVC to reach %pI4\n", | 1140 | dprintk("(%s) using egress SVC to reach %pI4\n", |
| 1100 | client->dev->name, &dst_ip); | 1141 | client->dev->name, &dst_ip); |
| 1101 | client->eg_ops->put(eg_entry); | 1142 | client->eg_ops->put(eg_entry); |
| 1102 | return; | 1143 | return; |
| @@ -1107,14 +1148,14 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien | |||
| 1107 | 1148 | ||
| 1108 | /* No luck in the egress cache we must open an ingress SVC */ | 1149 | /* No luck in the egress cache we must open an ingress SVC */ |
| 1109 | msg->type = OPEN_INGRESS_SVC; | 1150 | msg->type = OPEN_INGRESS_SVC; |
| 1110 | if (qos && (qos->qos.txtp.traffic_class == msg->qos.txtp.traffic_class)) | 1151 | if (qos && |
| 1111 | { | 1152 | (qos->qos.txtp.traffic_class == msg->qos.txtp.traffic_class)) { |
| 1112 | msg->qos = qos->qos; | 1153 | msg->qos = qos->qos; |
| 1113 | printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name); | 1154 | pr_info("(%s) trying to get a CBR shortcut\n", |
| 1114 | } | 1155 | client->dev->name); |
| 1115 | else memset(&msg->qos,0,sizeof(struct atm_qos)); | 1156 | } else |
| 1157 | memset(&msg->qos, 0, sizeof(struct atm_qos)); | ||
| 1116 | msg_to_mpoad(msg, client); | 1158 | msg_to_mpoad(msg, client); |
| 1117 | return; | ||
| 1118 | } | 1159 | } |
| 1119 | 1160 | ||
| 1120 | static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | 1161 | static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) |
| @@ -1122,17 +1163,19 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1122 | __be32 dst_ip = msg->content.in_info.in_dst_ip; | 1163 | __be32 dst_ip = msg->content.in_info.in_dst_ip; |
| 1123 | in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); | 1164 | in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); |
| 1124 | 1165 | ||
| 1125 | dprintk("mpoa: (%s) MPOA_res_reply_rcvd: ip %pI4\n", | 1166 | dprintk("(%s) ip %pI4\n", |
| 1126 | mpc->dev->name, &dst_ip); | 1167 | mpc->dev->name, &dst_ip); |
| 1127 | ddprintk("mpoa: (%s) MPOA_res_reply_rcvd() entry = %p", mpc->dev->name, entry); | 1168 | ddprintk("(%s) entry = %p", |
| 1128 | if(entry == NULL){ | 1169 | mpc->dev->name, entry); |
| 1129 | printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); | 1170 | if (entry == NULL) { |
| 1171 | pr_info("(%s) ARGH, received res. reply for an entry that doesn't exist.\n", | ||
| 1172 | mpc->dev->name); | ||
| 1130 | return; | 1173 | return; |
| 1131 | } | 1174 | } |
| 1132 | ddprintk(" entry_state = %d ", entry->entry_state); | 1175 | ddprintk_cont(" entry_state = %d ", entry->entry_state); |
| 1133 | 1176 | ||
| 1134 | if (entry->entry_state == INGRESS_RESOLVED) { | 1177 | if (entry->entry_state == INGRESS_RESOLVED) { |
| 1135 | printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name); | 1178 | pr_info("(%s) RESOLVED entry!\n", mpc->dev->name); |
| 1136 | mpc->in_ops->put(entry); | 1179 | mpc->in_ops->put(entry); |
| 1137 | return; | 1180 | return; |
| 1138 | } | 1181 | } |
| @@ -1141,17 +1184,18 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1141 | do_gettimeofday(&(entry->tv)); | 1184 | do_gettimeofday(&(entry->tv)); |
| 1142 | do_gettimeofday(&(entry->reply_wait)); /* Used in refreshing func from now on */ | 1185 | do_gettimeofday(&(entry->reply_wait)); /* Used in refreshing func from now on */ |
| 1143 | entry->refresh_time = 0; | 1186 | entry->refresh_time = 0; |
| 1144 | ddprintk("entry->shortcut = %p\n", entry->shortcut); | 1187 | ddprintk_cont("entry->shortcut = %p\n", entry->shortcut); |
| 1145 | 1188 | ||
| 1146 | if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){ | 1189 | if (entry->entry_state == INGRESS_RESOLVING && |
| 1190 | entry->shortcut != NULL) { | ||
| 1147 | entry->entry_state = INGRESS_RESOLVED; | 1191 | entry->entry_state = INGRESS_RESOLVED; |
| 1148 | mpc->in_ops->put(entry); | 1192 | mpc->in_ops->put(entry); |
| 1149 | return; /* Shortcut already open... */ | 1193 | return; /* Shortcut already open... */ |
| 1150 | } | 1194 | } |
| 1151 | 1195 | ||
| 1152 | if (entry->shortcut != NULL) { | 1196 | if (entry->shortcut != NULL) { |
| 1153 | printk("mpoa: (%s) MPOA_res_reply_rcvd: entry->shortcut != NULL, impossible!\n", | 1197 | pr_info("(%s) entry->shortcut != NULL, impossible!\n", |
| 1154 | mpc->dev->name); | 1198 | mpc->dev->name); |
| 1155 | mpc->in_ops->put(entry); | 1199 | mpc->in_ops->put(entry); |
| 1156 | return; | 1200 | return; |
| 1157 | } | 1201 | } |
| @@ -1170,14 +1214,14 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1170 | __be32 mask = msg->ip_mask; | 1214 | __be32 mask = msg->ip_mask; |
| 1171 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); | 1215 | in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); |
| 1172 | 1216 | ||
| 1173 | if(entry == NULL){ | 1217 | if (entry == NULL) { |
| 1174 | printk("mpoa: (%s) ingress_purge_rcvd: purge for a non-existing entry, ip = %pI4\n", | 1218 | pr_info("(%s) purge for a non-existing entry, ip = %pI4\n", |
| 1175 | mpc->dev->name, &dst_ip); | 1219 | mpc->dev->name, &dst_ip); |
| 1176 | return; | 1220 | return; |
| 1177 | } | 1221 | } |
| 1178 | 1222 | ||
| 1179 | do { | 1223 | do { |
| 1180 | dprintk("mpoa: (%s) ingress_purge_rcvd: removing an ingress entry, ip = %pI4\n", | 1224 | dprintk("(%s) removing an ingress entry, ip = %pI4\n", |
| 1181 | mpc->dev->name, &dst_ip); | 1225 | mpc->dev->name, &dst_ip); |
| 1182 | write_lock_bh(&mpc->ingress_lock); | 1226 | write_lock_bh(&mpc->ingress_lock); |
| 1183 | mpc->in_ops->remove_entry(entry, mpc); | 1227 | mpc->in_ops->remove_entry(entry, mpc); |
| @@ -1185,8 +1229,6 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1185 | mpc->in_ops->put(entry); | 1229 | mpc->in_ops->put(entry); |
| 1186 | entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); | 1230 | entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); |
| 1187 | } while (entry != NULL); | 1231 | } while (entry != NULL); |
| 1188 | |||
| 1189 | return; | ||
| 1190 | } | 1232 | } |
| 1191 | 1233 | ||
| 1192 | static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | 1234 | static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) |
| @@ -1195,7 +1237,8 @@ static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1195 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); | 1237 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); |
| 1196 | 1238 | ||
| 1197 | if (entry == NULL) { | 1239 | if (entry == NULL) { |
| 1198 | dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name); | 1240 | dprintk("(%s) purge for a non-existing entry\n", |
| 1241 | mpc->dev->name); | ||
| 1199 | return; | 1242 | return; |
| 1200 | } | 1243 | } |
| 1201 | 1244 | ||
| @@ -1204,8 +1247,6 @@ static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) | |||
| 1204 | write_unlock_irq(&mpc->egress_lock); | 1247 | write_unlock_irq(&mpc->egress_lock); |
| 1205 | 1248 | ||
| 1206 | mpc->eg_ops->put(entry); | 1249 | mpc->eg_ops->put(entry); |
| 1207 | |||
| 1208 | return; | ||
| 1209 | } | 1250 | } |
| 1210 | 1251 | ||
| 1211 | static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) | 1252 | static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) |
| @@ -1214,15 +1255,15 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) | |||
| 1214 | struct k_message *purge_msg; | 1255 | struct k_message *purge_msg; |
| 1215 | struct sk_buff *skb; | 1256 | struct sk_buff *skb; |
| 1216 | 1257 | ||
| 1217 | dprintk("mpoa: purge_egress_shortcut: entering\n"); | 1258 | dprintk("entering\n"); |
| 1218 | if (vcc == NULL) { | 1259 | if (vcc == NULL) { |
| 1219 | printk("mpoa: purge_egress_shortcut: vcc == NULL\n"); | 1260 | pr_info("vcc == NULL\n"); |
| 1220 | return; | 1261 | return; |
| 1221 | } | 1262 | } |
| 1222 | 1263 | ||
| 1223 | skb = alloc_skb(sizeof(struct k_message), GFP_ATOMIC); | 1264 | skb = alloc_skb(sizeof(struct k_message), GFP_ATOMIC); |
| 1224 | if (skb == NULL) { | 1265 | if (skb == NULL) { |
| 1225 | printk("mpoa: purge_egress_shortcut: out of memory\n"); | 1266 | pr_info("out of memory\n"); |
| 1226 | return; | 1267 | return; |
| 1227 | } | 1268 | } |
| 1228 | 1269 | ||
| @@ -1238,23 +1279,21 @@ static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) | |||
| 1238 | sk = sk_atm(vcc); | 1279 | sk = sk_atm(vcc); |
| 1239 | skb_queue_tail(&sk->sk_receive_queue, skb); | 1280 | skb_queue_tail(&sk->sk_receive_queue, skb); |
| 1240 | sk->sk_data_ready(sk, skb->len); | 1281 | sk->sk_data_ready(sk, skb->len); |
| 1241 | dprintk("mpoa: purge_egress_shortcut: exiting:\n"); | 1282 | dprintk("exiting\n"); |
| 1242 | |||
| 1243 | return; | ||
| 1244 | } | 1283 | } |
| 1245 | 1284 | ||
| 1246 | /* | 1285 | /* |
| 1247 | * Our MPS died. Tell our daemon to send NHRP data plane purge to each | 1286 | * Our MPS died. Tell our daemon to send NHRP data plane purge to each |
| 1248 | * of the egress shortcuts we have. | 1287 | * of the egress shortcuts we have. |
| 1249 | */ | 1288 | */ |
| 1250 | static void mps_death( struct k_message * msg, struct mpoa_client * mpc ) | 1289 | static void mps_death(struct k_message *msg, struct mpoa_client *mpc) |
| 1251 | { | 1290 | { |
| 1252 | eg_cache_entry *entry; | 1291 | eg_cache_entry *entry; |
| 1253 | 1292 | ||
| 1254 | dprintk("mpoa: (%s) mps_death:\n", mpc->dev->name); | 1293 | dprintk("(%s)\n", mpc->dev->name); |
| 1255 | 1294 | ||
| 1256 | if(memcmp(msg->MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN)){ | 1295 | if (memcmp(msg->MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN)) { |
| 1257 | printk("mpoa: (%s) mps_death: wrong MPS\n", mpc->dev->name); | 1296 | pr_info("(%s) wrong MPS\n", mpc->dev->name); |
| 1258 | return; | 1297 | return; |
| 1259 | } | 1298 | } |
| 1260 | 1299 | ||
| @@ -1269,24 +1308,23 @@ static void mps_death( struct k_message * msg, struct mpoa_client * mpc ) | |||
| 1269 | 1308 | ||
| 1270 | mpc->in_ops->destroy_cache(mpc); | 1309 | mpc->in_ops->destroy_cache(mpc); |
| 1271 | mpc->eg_ops->destroy_cache(mpc); | 1310 | mpc->eg_ops->destroy_cache(mpc); |
| 1272 | |||
| 1273 | return; | ||
| 1274 | } | 1311 | } |
| 1275 | 1312 | ||
| 1276 | static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client * mpc) | 1313 | static void MPOA_cache_impos_rcvd(struct k_message *msg, |
| 1314 | struct mpoa_client *mpc) | ||
| 1277 | { | 1315 | { |
| 1278 | uint16_t holding_time; | 1316 | uint16_t holding_time; |
| 1279 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); | 1317 | eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); |
| 1280 | 1318 | ||
| 1281 | holding_time = msg->content.eg_info.holding_time; | 1319 | holding_time = msg->content.eg_info.holding_time; |
| 1282 | dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n", | 1320 | dprintk("(%s) entry = %p, holding_time = %u\n", |
| 1283 | mpc->dev->name, entry, holding_time); | 1321 | mpc->dev->name, entry, holding_time); |
| 1284 | if(entry == NULL && holding_time) { | 1322 | if (entry == NULL && holding_time) { |
| 1285 | entry = mpc->eg_ops->add_entry(msg, mpc); | 1323 | entry = mpc->eg_ops->add_entry(msg, mpc); |
| 1286 | mpc->eg_ops->put(entry); | 1324 | mpc->eg_ops->put(entry); |
| 1287 | return; | 1325 | return; |
| 1288 | } | 1326 | } |
| 1289 | if(holding_time){ | 1327 | if (holding_time) { |
| 1290 | mpc->eg_ops->update(entry, holding_time); | 1328 | mpc->eg_ops->update(entry, holding_time); |
| 1291 | return; | 1329 | return; |
| 1292 | } | 1330 | } |
| @@ -1296,11 +1334,10 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client * | |||
| 1296 | write_unlock_irq(&mpc->egress_lock); | 1334 | write_unlock_irq(&mpc->egress_lock); |
| 1297 | 1335 | ||
| 1298 | mpc->eg_ops->put(entry); | 1336 | mpc->eg_ops->put(entry); |
| 1299 | |||
| 1300 | return; | ||
| 1301 | } | 1337 | } |
| 1302 | 1338 | ||
| 1303 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc) | 1339 | static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, |
| 1340 | struct mpoa_client *mpc) | ||
| 1304 | { | 1341 | { |
| 1305 | struct lec_priv *priv; | 1342 | struct lec_priv *priv; |
| 1306 | int i, retval ; | 1343 | int i, retval ; |
| @@ -1315,39 +1352,40 @@ static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *m | |||
| 1315 | memcpy(&tlv[7], mesg->MPS_ctrl, ATM_ESA_LEN); /* MPC ctrl ATM addr */ | 1352 | memcpy(&tlv[7], mesg->MPS_ctrl, ATM_ESA_LEN); /* MPC ctrl ATM addr */ |
| 1316 | memcpy(mpc->our_ctrl_addr, mesg->MPS_ctrl, ATM_ESA_LEN); | 1353 | memcpy(mpc->our_ctrl_addr, mesg->MPS_ctrl, ATM_ESA_LEN); |
| 1317 | 1354 | ||
| 1318 | dprintk("mpoa: (%s) setting MPC ctrl ATM address to ", | 1355 | dprintk("(%s) setting MPC ctrl ATM address to", |
| 1319 | (mpc->dev) ? mpc->dev->name : "<unknown>"); | 1356 | mpc->dev ? mpc->dev->name : "<unknown>"); |
| 1320 | for (i = 7; i < sizeof(tlv); i++) | 1357 | for (i = 7; i < sizeof(tlv); i++) |
| 1321 | dprintk("%02x ", tlv[i]); | 1358 | dprintk_cont(" %02x", tlv[i]); |
| 1322 | dprintk("\n"); | 1359 | dprintk_cont("\n"); |
| 1323 | 1360 | ||
| 1324 | if (mpc->dev) { | 1361 | if (mpc->dev) { |
| 1325 | priv = netdev_priv(mpc->dev); | 1362 | priv = netdev_priv(mpc->dev); |
| 1326 | retval = priv->lane2_ops->associate_req(mpc->dev, mpc->dev->dev_addr, tlv, sizeof(tlv)); | 1363 | retval = priv->lane2_ops->associate_req(mpc->dev, |
| 1364 | mpc->dev->dev_addr, | ||
| 1365 | tlv, sizeof(tlv)); | ||
| 1327 | if (retval == 0) | 1366 | if (retval == 0) |
| 1328 | printk("mpoa: (%s) MPOA device type TLV association failed\n", mpc->dev->name); | 1367 | pr_info("(%s) MPOA device type TLV association failed\n", |
| 1368 | mpc->dev->name); | ||
| 1329 | retval = priv->lane2_ops->resolve(mpc->dev, NULL, 1, NULL, NULL); | 1369 | retval = priv->lane2_ops->resolve(mpc->dev, NULL, 1, NULL, NULL); |
| 1330 | if (retval < 0) | 1370 | if (retval < 0) |
| 1331 | printk("mpoa: (%s) targetless LE_ARP request failed\n", mpc->dev->name); | 1371 | pr_info("(%s) targetless LE_ARP request failed\n", |
| 1372 | mpc->dev->name); | ||
| 1332 | } | 1373 | } |
| 1333 | |||
| 1334 | return; | ||
| 1335 | } | 1374 | } |
| 1336 | 1375 | ||
| 1337 | static void set_mps_mac_addr_rcvd(struct k_message *msg, struct mpoa_client *client) | 1376 | static void set_mps_mac_addr_rcvd(struct k_message *msg, |
| 1377 | struct mpoa_client *client) | ||
| 1338 | { | 1378 | { |
| 1339 | 1379 | ||
| 1340 | if(client->number_of_mps_macs) | 1380 | if (client->number_of_mps_macs) |
| 1341 | kfree(client->mps_macs); | 1381 | kfree(client->mps_macs); |
| 1342 | client->number_of_mps_macs = 0; | 1382 | client->number_of_mps_macs = 0; |
| 1343 | client->mps_macs = kmemdup(msg->MPS_ctrl, ETH_ALEN, GFP_KERNEL); | 1383 | client->mps_macs = kmemdup(msg->MPS_ctrl, ETH_ALEN, GFP_KERNEL); |
| 1344 | if (client->mps_macs == NULL) { | 1384 | if (client->mps_macs == NULL) { |
| 1345 | printk("mpoa: set_mps_mac_addr_rcvd: out of memory\n"); | 1385 | pr_info("out of memory\n"); |
| 1346 | return; | 1386 | return; |
| 1347 | } | 1387 | } |
| 1348 | client->number_of_mps_macs = 1; | 1388 | client->number_of_mps_macs = 1; |
| 1349 | |||
| 1350 | return; | ||
| 1351 | } | 1389 | } |
| 1352 | 1390 | ||
| 1353 | /* | 1391 | /* |
| @@ -1363,17 +1401,16 @@ static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action) | |||
| 1363 | /* FIXME: This knows too much of the cache structure */ | 1401 | /* FIXME: This knows too much of the cache structure */ |
| 1364 | read_lock_irq(&mpc->egress_lock); | 1402 | read_lock_irq(&mpc->egress_lock); |
| 1365 | entry = mpc->eg_cache; | 1403 | entry = mpc->eg_cache; |
| 1366 | while (entry != NULL){ | 1404 | while (entry != NULL) { |
| 1367 | msg->content.eg_info = entry->ctrl_info; | 1405 | msg->content.eg_info = entry->ctrl_info; |
| 1368 | dprintk("mpoa: cache_id %u\n", entry->ctrl_info.cache_id); | 1406 | dprintk("cache_id %u\n", entry->ctrl_info.cache_id); |
| 1369 | msg_to_mpoad(msg, mpc); | 1407 | msg_to_mpoad(msg, mpc); |
| 1370 | entry = entry->next; | 1408 | entry = entry->next; |
| 1371 | } | 1409 | } |
| 1372 | read_unlock_irq(&mpc->egress_lock); | 1410 | read_unlock_irq(&mpc->egress_lock); |
| 1373 | 1411 | ||
| 1374 | msg->type = action; | 1412 | msg->type = action; |
| 1375 | msg_to_mpoad(msg, mpc); | 1413 | msg_to_mpoad(msg, mpc); |
| 1376 | return; | ||
| 1377 | } | 1414 | } |
| 1378 | 1415 | ||
| 1379 | static void mpc_timer_refresh(void) | 1416 | static void mpc_timer_refresh(void) |
| @@ -1382,35 +1419,34 @@ static void mpc_timer_refresh(void) | |||
| 1382 | mpc_timer.data = mpc_timer.expires; | 1419 | mpc_timer.data = mpc_timer.expires; |
| 1383 | mpc_timer.function = mpc_cache_check; | 1420 | mpc_timer.function = mpc_cache_check; |
| 1384 | add_timer(&mpc_timer); | 1421 | add_timer(&mpc_timer); |
| 1385 | |||
| 1386 | return; | ||
| 1387 | } | 1422 | } |
| 1388 | 1423 | ||
| 1389 | static void mpc_cache_check( unsigned long checking_time ) | 1424 | static void mpc_cache_check(unsigned long checking_time) |
| 1390 | { | 1425 | { |
| 1391 | struct mpoa_client *mpc = mpcs; | 1426 | struct mpoa_client *mpc = mpcs; |
| 1392 | static unsigned long previous_resolving_check_time; | 1427 | static unsigned long previous_resolving_check_time; |
| 1393 | static unsigned long previous_refresh_time; | 1428 | static unsigned long previous_refresh_time; |
| 1394 | 1429 | ||
| 1395 | while( mpc != NULL ){ | 1430 | while (mpc != NULL) { |
| 1396 | mpc->in_ops->clear_count(mpc); | 1431 | mpc->in_ops->clear_count(mpc); |
| 1397 | mpc->eg_ops->clear_expired(mpc); | 1432 | mpc->eg_ops->clear_expired(mpc); |
| 1398 | if(checking_time - previous_resolving_check_time > mpc->parameters.mpc_p4 * HZ ){ | 1433 | if (checking_time - previous_resolving_check_time > |
| 1434 | mpc->parameters.mpc_p4 * HZ) { | ||
| 1399 | mpc->in_ops->check_resolving(mpc); | 1435 | mpc->in_ops->check_resolving(mpc); |
| 1400 | previous_resolving_check_time = checking_time; | 1436 | previous_resolving_check_time = checking_time; |
| 1401 | } | 1437 | } |
| 1402 | if(checking_time - previous_refresh_time > mpc->parameters.mpc_p5 * HZ ){ | 1438 | if (checking_time - previous_refresh_time > |
| 1439 | mpc->parameters.mpc_p5 * HZ) { | ||
| 1403 | mpc->in_ops->refresh(mpc); | 1440 | mpc->in_ops->refresh(mpc); |
| 1404 | previous_refresh_time = checking_time; | 1441 | previous_refresh_time = checking_time; |
| 1405 | } | 1442 | } |
| 1406 | mpc = mpc->next; | 1443 | mpc = mpc->next; |
| 1407 | } | 1444 | } |
| 1408 | mpc_timer_refresh(); | 1445 | mpc_timer_refresh(); |
| 1409 | |||
| 1410 | return; | ||
| 1411 | } | 1446 | } |
| 1412 | 1447 | ||
| 1413 | static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 1448 | static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, |
| 1449 | unsigned long arg) | ||
| 1414 | { | 1450 | { |
| 1415 | int err = 0; | 1451 | int err = 0; |
| 1416 | struct atm_vcc *vcc = ATM_SD(sock); | 1452 | struct atm_vcc *vcc = ATM_SD(sock); |
| @@ -1422,21 +1458,20 @@ static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, unsigned long a | |||
| 1422 | return -EPERM; | 1458 | return -EPERM; |
| 1423 | 1459 | ||
| 1424 | switch (cmd) { | 1460 | switch (cmd) { |
| 1425 | case ATMMPC_CTRL: | 1461 | case ATMMPC_CTRL: |
| 1426 | err = atm_mpoa_mpoad_attach(vcc, (int)arg); | 1462 | err = atm_mpoa_mpoad_attach(vcc, (int)arg); |
| 1427 | if (err >= 0) | 1463 | if (err >= 0) |
| 1428 | sock->state = SS_CONNECTED; | 1464 | sock->state = SS_CONNECTED; |
| 1429 | break; | 1465 | break; |
| 1430 | case ATMMPC_DATA: | 1466 | case ATMMPC_DATA: |
| 1431 | err = atm_mpoa_vcc_attach(vcc, (void __user *)arg); | 1467 | err = atm_mpoa_vcc_attach(vcc, (void __user *)arg); |
| 1432 | break; | 1468 | break; |
| 1433 | default: | 1469 | default: |
| 1434 | break; | 1470 | break; |
| 1435 | } | 1471 | } |
| 1436 | return err; | 1472 | return err; |
| 1437 | } | 1473 | } |
| 1438 | 1474 | ||
| 1439 | |||
| 1440 | static struct atm_ioctl atm_ioctl_ops = { | 1475 | static struct atm_ioctl atm_ioctl_ops = { |
| 1441 | .owner = THIS_MODULE, | 1476 | .owner = THIS_MODULE, |
| 1442 | .ioctl = atm_mpoa_ioctl, | 1477 | .ioctl = atm_mpoa_ioctl, |
| @@ -1447,9 +1482,9 @@ static __init int atm_mpoa_init(void) | |||
| 1447 | register_atm_ioctl(&atm_ioctl_ops); | 1482 | register_atm_ioctl(&atm_ioctl_ops); |
| 1448 | 1483 | ||
| 1449 | if (mpc_proc_init() != 0) | 1484 | if (mpc_proc_init() != 0) |
| 1450 | printk(KERN_INFO "mpoa: failed to initialize /proc/mpoa\n"); | 1485 | pr_info("failed to initialize /proc/mpoa\n"); |
| 1451 | 1486 | ||
| 1452 | printk("mpc.c: " __DATE__ " " __TIME__ " initialized\n"); | 1487 | pr_info("mpc.c: " __DATE__ " " __TIME__ " initialized\n"); |
| 1453 | 1488 | ||
| 1454 | return 0; | 1489 | return 0; |
| 1455 | } | 1490 | } |
| @@ -1476,15 +1511,15 @@ static void __exit atm_mpoa_cleanup(void) | |||
| 1476 | if (priv->lane2_ops != NULL) | 1511 | if (priv->lane2_ops != NULL) |
| 1477 | priv->lane2_ops->associate_indicator = NULL; | 1512 | priv->lane2_ops->associate_indicator = NULL; |
| 1478 | } | 1513 | } |
| 1479 | ddprintk("mpoa: cleanup_module: about to clear caches\n"); | 1514 | ddprintk("about to clear caches\n"); |
| 1480 | mpc->in_ops->destroy_cache(mpc); | 1515 | mpc->in_ops->destroy_cache(mpc); |
| 1481 | mpc->eg_ops->destroy_cache(mpc); | 1516 | mpc->eg_ops->destroy_cache(mpc); |
| 1482 | ddprintk("mpoa: cleanup_module: caches cleared\n"); | 1517 | ddprintk("caches cleared\n"); |
| 1483 | kfree(mpc->mps_macs); | 1518 | kfree(mpc->mps_macs); |
| 1484 | memset(mpc, 0, sizeof(struct mpoa_client)); | 1519 | memset(mpc, 0, sizeof(struct mpoa_client)); |
| 1485 | ddprintk("mpoa: cleanup_module: about to kfree %p\n", mpc); | 1520 | ddprintk("about to kfree %p\n", mpc); |
| 1486 | kfree(mpc); | 1521 | kfree(mpc); |
| 1487 | ddprintk("mpoa: cleanup_module: next mpc is at %p\n", tmp); | 1522 | ddprintk("next mpc is at %p\n", tmp); |
| 1488 | mpc = tmp; | 1523 | mpc = tmp; |
| 1489 | } | 1524 | } |
| 1490 | 1525 | ||
| @@ -1492,12 +1527,10 @@ static void __exit atm_mpoa_cleanup(void) | |||
| 1492 | qos_head = NULL; | 1527 | qos_head = NULL; |
| 1493 | while (qos != NULL) { | 1528 | while (qos != NULL) { |
| 1494 | nextqos = qos->next; | 1529 | nextqos = qos->next; |
| 1495 | dprintk("mpoa: cleanup_module: freeing qos entry %p\n", qos); | 1530 | dprintk("freeing qos entry %p\n", qos); |
| 1496 | kfree(qos); | 1531 | kfree(qos); |
| 1497 | qos = nextqos; | 1532 | qos = nextqos; |
| 1498 | } | 1533 | } |
| 1499 | |||
| 1500 | return; | ||
| 1501 | } | 1534 | } |
| 1502 | 1535 | ||
| 1503 | module_init(atm_mpoa_init); | 1536 | module_init(atm_mpoa_init); |
