Lines Matching refs:mpc

69 static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc);
70 static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc);
71 static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc);
72 static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc);
73 static void mps_death(struct k_message *msg, struct mpoa_client *mpc);
74 static void clean_up(struct k_message *msg, struct mpoa_client *mpc,
77 struct mpoa_client *mpc);
79 struct mpoa_client *mpc);
81 struct mpoa_client *mpc);
83 static const uint8_t *copy_macs(struct mpoa_client *mpc,
89 static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc);
130 struct mpoa_client *mpc; in find_mpc_by_itfnum() local
132 mpc = mpcs; /* our global linked list */ in find_mpc_by_itfnum()
133 while (mpc != NULL) { in find_mpc_by_itfnum()
134 if (mpc->dev_num == itf) in find_mpc_by_itfnum()
135 return mpc; in find_mpc_by_itfnum()
136 mpc = mpc->next; in find_mpc_by_itfnum()
144 struct mpoa_client *mpc; in find_mpc_by_vcc() local
146 mpc = mpcs; /* our global linked list */ in find_mpc_by_vcc()
147 while (mpc != NULL) { in find_mpc_by_vcc()
148 if (mpc->mpoad_vcc == vcc) in find_mpc_by_vcc()
149 return mpc; in find_mpc_by_vcc()
150 mpc = mpc->next; in find_mpc_by_vcc()
158 struct mpoa_client *mpc; in find_mpc_by_lec() local
160 mpc = mpcs; /* our global linked list */ in find_mpc_by_lec()
161 while (mpc != NULL) { in find_mpc_by_lec()
162 if (mpc->dev == dev) in find_mpc_by_lec()
163 return mpc; in find_mpc_by_lec()
164 mpc = mpc->next; in find_mpc_by_lec()
283 struct mpoa_client *mpc; in alloc_mpc() local
285 mpc = kzalloc(sizeof(struct mpoa_client), GFP_KERNEL); in alloc_mpc()
286 if (mpc == NULL) in alloc_mpc()
288 rwlock_init(&mpc->ingress_lock); in alloc_mpc()
289 rwlock_init(&mpc->egress_lock); in alloc_mpc()
290 mpc->next = mpcs; in alloc_mpc()
291 atm_mpoa_init_cache(mpc); in alloc_mpc()
293 mpc->parameters.mpc_p1 = MPC_P1; in alloc_mpc()
294 mpc->parameters.mpc_p2 = MPC_P2; in alloc_mpc()
295 memset(mpc->parameters.mpc_p3, 0, sizeof(mpc->parameters.mpc_p3)); in alloc_mpc()
296 mpc->parameters.mpc_p4 = MPC_P4; in alloc_mpc()
297 mpc->parameters.mpc_p5 = MPC_P5; in alloc_mpc()
298 mpc->parameters.mpc_p6 = MPC_P6; in alloc_mpc()
300 mpcs = mpc; in alloc_mpc()
302 return mpc; in alloc_mpc()
312 static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) in start_mpc() argument
315 dprintk("(%s)\n", mpc->dev->name); in start_mpc()
319 mpc->old_ops = dev->netdev_ops; in start_mpc()
320 mpc->new_ops = *mpc->old_ops; in start_mpc()
321 mpc->new_ops.ndo_start_xmit = mpc_send_packet; in start_mpc()
322 dev->netdev_ops = &mpc->new_ops; in start_mpc()
326 static void stop_mpc(struct mpoa_client *mpc) in stop_mpc() argument
328 struct net_device *dev = mpc->dev; in stop_mpc()
329 dprintk("(%s)", mpc->dev->name); in stop_mpc()
332 if (dev->netdev_ops != &mpc->new_ops) { in stop_mpc()
338 dev->netdev_ops = mpc->old_ops; in stop_mpc()
339 mpc->old_ops = NULL; in stop_mpc()
381 struct mpoa_client *mpc; in lane2_assoc_ind() local
386 mpc = find_mpc_by_lec(dev); /* Sampo-Fix: moved here from below */ in lane2_assoc_ind()
387 if (mpc == NULL) { in lane2_assoc_ind()
447 send_set_mps_ctrl_addr(tlvs, mpc); in lane2_assoc_ind()
449 tlvs = copy_macs(mpc, mac_addr, tlvs, in lane2_assoc_ind()
464 static const uint8_t *copy_macs(struct mpoa_client *mpc, in copy_macs() argument
472 if (mpc->number_of_mps_macs != num_macs) { /* need to reallocate? */ in copy_macs()
473 if (mpc->number_of_mps_macs != 0) in copy_macs()
474 kfree(mpc->mps_macs); in copy_macs()
475 mpc->number_of_mps_macs = 0; in copy_macs()
476 mpc->mps_macs = kmalloc_array(ETH_ALEN, num_macs, GFP_KERNEL); in copy_macs()
477 if (mpc->mps_macs == NULL) { in copy_macs()
478 pr_info("(%s) out of mem\n", mpc->dev->name); in copy_macs()
482 ether_addr_copy(mpc->mps_macs, router_mac); in copy_macs()
485 memcpy(mpc->mps_macs, tlvs, mps_macs*ETH_ALEN); in copy_macs()
487 mpc->number_of_mps_macs = num_macs; in copy_macs()
492 static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc) in send_via_shortcut() argument
507 buff = skb->data + mpc->dev->hard_header_len; in send_via_shortcut()
512 mpc->dev->name, ipaddr); in send_via_shortcut()
514 entry = mpc->in_ops->get(ipaddr, mpc); in send_via_shortcut()
516 entry = mpc->in_ops->add_entry(ipaddr, mpc); in send_via_shortcut()
518 mpc->in_ops->put(entry); in send_via_shortcut()
522 if (mpc->in_ops->cache_hit(entry, mpc) != OPEN) { in send_via_shortcut()
524 mpc->dev->name); in send_via_shortcut()
525 mpc->in_ops->put(entry); in send_via_shortcut()
530 mpc->dev->name); in send_via_shortcut()
534 mpc->dev->name, iph->ttl); in send_via_shortcut()
535 mpc->in_ops->put(entry); in send_via_shortcut()
544 mpc->dev->name, entry->ctrl_info.tag); in send_via_shortcut()
562 mpc->in_ops->put(entry); in send_via_shortcut()
573 struct mpoa_client *mpc; in mpc_send_packet() local
577 mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ in mpc_send_packet()
578 if (mpc == NULL) { in mpc_send_packet()
594 while (i < mpc->number_of_mps_macs) { in mpc_send_packet()
595 if (ether_addr_equal(eth->h_dest, mpc->mps_macs + i * ETH_ALEN)) in mpc_send_packet()
596 if (send_via_shortcut(skb, mpc) == 0) /* try shortcut */ in mpc_send_packet()
602 return __netdev_start_xmit(mpc->old_ops, skb, dev, false); in mpc_send_packet()
608 struct mpoa_client *mpc; in atm_mpoa_vcc_attach() local
623 mpc = find_mpc_by_itfnum(ioc_data.dev_num); in atm_mpoa_vcc_attach()
624 if (mpc == NULL) in atm_mpoa_vcc_attach()
628 in_entry = mpc->in_ops->get(ipaddr, mpc); in atm_mpoa_vcc_attach()
632 mpc->dev->name); in atm_mpoa_vcc_attach()
634 mpc->in_ops->put(in_entry); in atm_mpoa_vcc_attach()
638 mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); in atm_mpoa_vcc_attach()
640 mpc->in_ops->put(in_entry); in atm_mpoa_vcc_attach()
642 pr_info("(%s) attaching egress SVC\n", mpc->dev->name); in atm_mpoa_vcc_attach()
645 vcc->proto_data = mpc->dev; in atm_mpoa_vcc_attach()
656 struct mpoa_client *mpc; in mpc_vcc_close() local
660 mpc = find_mpc_by_lec(dev); in mpc_vcc_close()
661 if (mpc == NULL) { in mpc_vcc_close()
667 in_entry = mpc->in_ops->get_by_vcc(vcc, mpc); in mpc_vcc_close()
670 mpc->dev->name, &in_entry->ctrl_info.in_dst_ip); in mpc_vcc_close()
672 mpc->in_ops->put(in_entry); in mpc_vcc_close()
674 eg_entry = mpc->eg_ops->get_by_vcc(vcc, mpc); in mpc_vcc_close()
676 dprintk("(%s) egress SVC closed\n", mpc->dev->name); in mpc_vcc_close()
678 mpc->eg_ops->put(eg_entry); in mpc_vcc_close()
690 struct mpoa_client *mpc; in mpc_push() local
716 mpc = find_mpc_by_lec(dev); in mpc_push()
717 if (mpc == NULL) { in mpc_push()
741 eg = mpc->eg_ops->get_by_tag(tag, mpc); in mpc_push()
765 mpc->eg_ops->put(eg); in mpc_push()
776 mpc->eg_ops->put(eg); in mpc_push()
797 struct mpoa_client *mpc; in atm_mpoa_mpoad_attach() local
812 mpc = find_mpc_by_itfnum(arg); in atm_mpoa_mpoad_attach()
813 if (mpc == NULL) { in atm_mpoa_mpoad_attach()
815 mpc = alloc_mpc(); in atm_mpoa_mpoad_attach()
816 if (mpc == NULL) in atm_mpoa_mpoad_attach()
818 mpc->dev_num = arg; in atm_mpoa_mpoad_attach()
819 mpc->dev = find_lec_by_itfnum(arg); in atm_mpoa_mpoad_attach()
822 if (mpc->mpoad_vcc) { in atm_mpoa_mpoad_attach()
827 if (mpc->dev) { /* check if the lec is LANE2 capable */ in atm_mpoa_mpoad_attach()
828 priv = netdev_priv(mpc->dev); in atm_mpoa_mpoad_attach()
830 dev_put(mpc->dev); in atm_mpoa_mpoad_attach()
831 mpc->dev = NULL; in atm_mpoa_mpoad_attach()
836 mpc->mpoad_vcc = vcc; in atm_mpoa_mpoad_attach()
842 if (mpc->dev) { in atm_mpoa_mpoad_attach()
846 start_mpc(mpc, mpc->dev); in atm_mpoa_mpoad_attach()
850 if (memcmp(mpc->mps_ctrl_addr, empty, ATM_ESA_LEN) != 0) in atm_mpoa_mpoad_attach()
851 send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc); in atm_mpoa_mpoad_attach()
858 static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc) in send_set_mps_ctrl_addr() argument
862 memcpy(mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); in send_set_mps_ctrl_addr()
866 msg_to_mpoad(&mesg, mpc); in send_set_mps_ctrl_addr()
871 struct mpoa_client *mpc; in mpoad_close() local
874 mpc = find_mpc_by_vcc(vcc); in mpoad_close()
875 if (mpc == NULL) { in mpoad_close()
879 if (!mpc->mpoad_vcc) { in mpoad_close()
884 mpc->mpoad_vcc = NULL; in mpoad_close()
885 if (mpc->dev) { in mpoad_close()
886 struct lec_priv *priv = netdev_priv(mpc->dev); in mpoad_close()
888 stop_mpc(mpc); in mpoad_close()
889 dev_put(mpc->dev); in mpoad_close()
892 mpc->in_ops->destroy_cache(mpc); in mpoad_close()
893 mpc->eg_ops->destroy_cache(mpc); in mpoad_close()
901 (mpc->dev) ? mpc->dev->name : "<unknown>"); in mpoad_close()
911 struct mpoa_client *mpc = find_mpc_by_vcc(vcc); in msg_from_mpoad() local
915 if (mpc == NULL) { in msg_from_mpoad()
919 dprintk("(%s)", mpc->dev ? mpc->dev->name : "<unknown>"); in msg_from_mpoad()
923 MPOA_res_reply_rcvd(mesg, mpc); in msg_from_mpoad()
927 MPOA_trigger_rcvd(mesg, mpc); in msg_from_mpoad()
931 ingress_purge_rcvd(mesg, mpc); in msg_from_mpoad()
935 egress_purge_rcvd(mesg, mpc); in msg_from_mpoad()
939 mps_death(mesg, mpc); in msg_from_mpoad()
943 MPOA_cache_impos_rcvd(mesg, mpc); in msg_from_mpoad()
947 set_mpc_ctrl_addr_rcvd(mesg, mpc); in msg_from_mpoad()
951 set_mps_mac_addr_rcvd(mesg, mpc); in msg_from_mpoad()
955 clean_up(mesg, mpc, DIE); in msg_from_mpoad()
959 clean_up(mesg, mpc, RELOAD); in msg_from_mpoad()
963 mpc->parameters = mesg->content.params; in msg_from_mpoad()
975 int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) in msg_to_mpoad() argument
980 if (mpc == NULL || !mpc->mpoad_vcc) { in msg_to_mpoad()
990 atm_force_charge(mpc->mpoad_vcc, skb->truesize); in msg_to_mpoad()
992 sk = sk_atm(mpc->mpoad_vcc); in msg_to_mpoad()
1003 struct mpoa_client *mpc; in mpoa_event_listener() local
1018 mpc = find_mpc_by_itfnum(priv->itfnum); in mpoa_event_listener()
1019 if (mpc == NULL) { in mpoa_event_listener()
1021 mpc = alloc_mpc(); in mpoa_event_listener()
1022 if (mpc == NULL) { in mpoa_event_listener()
1027 mpc->dev_num = priv->itfnum; in mpoa_event_listener()
1028 mpc->dev = dev; in mpoa_event_listener()
1034 mpc = find_mpc_by_lec(dev); in mpoa_event_listener()
1035 if (mpc == NULL) in mpoa_event_listener()
1038 stop_mpc(mpc); in mpoa_event_listener()
1039 dev_put(mpc->dev); in mpoa_event_listener()
1040 mpc->dev = NULL; in mpoa_event_listener()
1044 mpc = find_mpc_by_lec(dev); in mpoa_event_listener()
1045 if (mpc == NULL) in mpoa_event_listener()
1047 if (mpc->mpoad_vcc != NULL) in mpoa_event_listener()
1048 start_mpc(mpc, dev); in mpoa_event_listener()
1055 mpc = find_mpc_by_lec(dev); in mpoa_event_listener()
1056 if (mpc == NULL) in mpoa_event_listener()
1058 if (mpc->mpoad_vcc != NULL) in mpoa_event_listener()
1059 stop_mpc(mpc); in mpoa_event_listener()
1080 static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc) in MPOA_trigger_rcvd() argument
1085 entry = mpc->in_ops->get(dst_ip, mpc); in MPOA_trigger_rcvd()
1087 entry = mpc->in_ops->add_entry(dst_ip, mpc); in MPOA_trigger_rcvd()
1091 msg_to_mpoad(msg, mpc); in MPOA_trigger_rcvd()
1093 mpc->in_ops->put(entry); in MPOA_trigger_rcvd()
1101 msg_to_mpoad(msg, mpc); in MPOA_trigger_rcvd()
1103 mpc->in_ops->put(entry); in MPOA_trigger_rcvd()
1108 (mpc->dev) ? mpc->dev->name : "<unknown>"); in MPOA_trigger_rcvd()
1109 mpc->in_ops->put(entry); in MPOA_trigger_rcvd()
1155 static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc) in MPOA_res_reply_rcvd() argument
1158 in_cache_entry *entry = mpc->in_ops->get(dst_ip, mpc); in MPOA_res_reply_rcvd()
1161 mpc->dev->name, &dst_ip); in MPOA_res_reply_rcvd()
1163 mpc->dev->name, entry); in MPOA_res_reply_rcvd()
1166 mpc->dev->name); in MPOA_res_reply_rcvd()
1172 pr_info("(%s) RESOLVED entry!\n", mpc->dev->name); in MPOA_res_reply_rcvd()
1173 mpc->in_ops->put(entry); in MPOA_res_reply_rcvd()
1187 mpc->in_ops->put(entry); in MPOA_res_reply_rcvd()
1193 mpc->dev->name); in MPOA_res_reply_rcvd()
1194 mpc->in_ops->put(entry); in MPOA_res_reply_rcvd()
1198 check_qos_and_open_shortcut(msg, mpc, entry); in MPOA_res_reply_rcvd()
1200 mpc->in_ops->put(entry); in MPOA_res_reply_rcvd()
1206 static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) in ingress_purge_rcvd() argument
1210 in_cache_entry *entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); in ingress_purge_rcvd()
1214 mpc->dev->name, &dst_ip); in ingress_purge_rcvd()
1220 mpc->dev->name, &dst_ip); in ingress_purge_rcvd()
1221 write_lock_bh(&mpc->ingress_lock); in ingress_purge_rcvd()
1222 mpc->in_ops->remove_entry(entry, mpc); in ingress_purge_rcvd()
1223 write_unlock_bh(&mpc->ingress_lock); in ingress_purge_rcvd()
1224 mpc->in_ops->put(entry); in ingress_purge_rcvd()
1225 entry = mpc->in_ops->get_with_mask(dst_ip, mpc, mask); in ingress_purge_rcvd()
1229 static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) in egress_purge_rcvd() argument
1232 eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); in egress_purge_rcvd()
1236 mpc->dev->name); in egress_purge_rcvd()
1240 write_lock_irq(&mpc->egress_lock); in egress_purge_rcvd()
1241 mpc->eg_ops->remove_entry(entry, mpc); in egress_purge_rcvd()
1242 write_unlock_irq(&mpc->egress_lock); in egress_purge_rcvd()
1244 mpc->eg_ops->put(entry); in egress_purge_rcvd()
1284 static void mps_death(struct k_message *msg, struct mpoa_client *mpc) in mps_death() argument
1288 dprintk("(%s)\n", mpc->dev->name); in mps_death()
1290 if (memcmp(msg->MPS_ctrl, mpc->mps_ctrl_addr, ATM_ESA_LEN)) { in mps_death()
1291 pr_info("(%s) wrong MPS\n", mpc->dev->name); in mps_death()
1296 read_lock_irq(&mpc->egress_lock); in mps_death()
1297 entry = mpc->eg_cache; in mps_death()
1302 read_unlock_irq(&mpc->egress_lock); in mps_death()
1304 mpc->in_ops->destroy_cache(mpc); in mps_death()
1305 mpc->eg_ops->destroy_cache(mpc); in mps_death()
1309 struct mpoa_client *mpc) in MPOA_cache_impos_rcvd() argument
1312 eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); in MPOA_cache_impos_rcvd()
1316 mpc->dev->name, entry, holding_time); in MPOA_cache_impos_rcvd()
1318 entry = mpc->eg_ops->add_entry(msg, mpc); in MPOA_cache_impos_rcvd()
1319 mpc->eg_ops->put(entry); in MPOA_cache_impos_rcvd()
1323 mpc->eg_ops->update(entry, holding_time); in MPOA_cache_impos_rcvd()
1327 write_lock_irq(&mpc->egress_lock); in MPOA_cache_impos_rcvd()
1328 mpc->eg_ops->remove_entry(entry, mpc); in MPOA_cache_impos_rcvd()
1329 write_unlock_irq(&mpc->egress_lock); in MPOA_cache_impos_rcvd()
1331 mpc->eg_ops->put(entry); in MPOA_cache_impos_rcvd()
1335 struct mpoa_client *mpc) in set_mpc_ctrl_addr_rcvd() argument
1348 memcpy(mpc->our_ctrl_addr, mesg->MPS_ctrl, ATM_ESA_LEN); in set_mpc_ctrl_addr_rcvd()
1351 mpc->dev ? mpc->dev->name : "<unknown>"); in set_mpc_ctrl_addr_rcvd()
1356 if (mpc->dev) { in set_mpc_ctrl_addr_rcvd()
1357 priv = netdev_priv(mpc->dev); in set_mpc_ctrl_addr_rcvd()
1358 retval = priv->lane2_ops->associate_req(mpc->dev, in set_mpc_ctrl_addr_rcvd()
1359 mpc->dev->dev_addr, in set_mpc_ctrl_addr_rcvd()
1363 mpc->dev->name); in set_mpc_ctrl_addr_rcvd()
1364 retval = priv->lane2_ops->resolve(mpc->dev, NULL, 1, NULL, NULL); in set_mpc_ctrl_addr_rcvd()
1367 mpc->dev->name); in set_mpc_ctrl_addr_rcvd()
1389 static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action) in clean_up() argument
1397 read_lock_irq(&mpc->egress_lock); in clean_up()
1398 entry = mpc->eg_cache; in clean_up()
1402 msg_to_mpoad(msg, mpc); in clean_up()
1405 read_unlock_irq(&mpc->egress_lock); in clean_up()
1408 msg_to_mpoad(msg, mpc); in clean_up()
1422 struct mpoa_client *mpc = mpcs; in mpc_cache_check() local
1426 while (mpc != NULL) { in mpc_cache_check()
1427 mpc->in_ops->clear_count(mpc); in mpc_cache_check()
1428 mpc->eg_ops->clear_expired(mpc); in mpc_cache_check()
1430 mpc->parameters.mpc_p4 * HZ) { in mpc_cache_check()
1431 mpc->in_ops->check_resolving(mpc); in mpc_cache_check()
1435 mpc->parameters.mpc_p5 * HZ) { in mpc_cache_check()
1436 mpc->in_ops->refresh(mpc); in mpc_cache_check()
1439 mpc = mpc->next; in mpc_cache_check()
1490 struct mpoa_client *mpc, *tmp; in atm_mpoa_cleanup() local
1500 mpc = mpcs; in atm_mpoa_cleanup()
1502 while (mpc != NULL) { in atm_mpoa_cleanup()
1503 tmp = mpc->next; in atm_mpoa_cleanup()
1504 if (mpc->dev != NULL) { in atm_mpoa_cleanup()
1505 stop_mpc(mpc); in atm_mpoa_cleanup()
1506 priv = netdev_priv(mpc->dev); in atm_mpoa_cleanup()
1511 mpc->in_ops->destroy_cache(mpc); in atm_mpoa_cleanup()
1512 mpc->eg_ops->destroy_cache(mpc); in atm_mpoa_cleanup()
1514 kfree(mpc->mps_macs); in atm_mpoa_cleanup()
1515 memset(mpc, 0, sizeof(struct mpoa_client)); in atm_mpoa_cleanup()
1516 ddprintk("about to kfree %p\n", mpc); in atm_mpoa_cleanup()
1517 kfree(mpc); in atm_mpoa_cleanup()
1519 mpc = tmp; in atm_mpoa_cleanup()