Lines Matching refs:dn_db
263 struct dn_dev *dn_db; in dn_forwarding_proc() local
270 dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_forwarding_proc()
271 old = dn_db->parms.forwarding; in dn_forwarding_proc()
276 if (dn_db->parms.forwarding < 0) in dn_forwarding_proc()
277 dn_db->parms.forwarding = 0; in dn_forwarding_proc()
278 if (dn_db->parms.forwarding > 2) in dn_forwarding_proc()
279 dn_db->parms.forwarding = 2; in dn_forwarding_proc()
286 tmp = dn_db->parms.forwarding; in dn_forwarding_proc()
287 dn_db->parms.forwarding = old; in dn_forwarding_proc()
288 if (dn_db->parms.down) in dn_forwarding_proc()
289 dn_db->parms.down(dev); in dn_forwarding_proc()
290 dn_db->parms.forwarding = tmp; in dn_forwarding_proc()
291 if (dn_db->parms.up) in dn_forwarding_proc()
292 dn_db->parms.up(dev); in dn_forwarding_proc()
345 static void dn_dev_del_ifa(struct dn_dev *dn_db, struct dn_ifaddr __rcu **ifap, int destroy) in dn_dev_del_ifa() argument
349 struct net_device *dev = dn_db->dev; in dn_dev_del_ifa()
355 if (dn_db->dev->type == ARPHRD_ETHER) { in dn_dev_del_ifa()
367 if (dn_db->ifa_list == NULL) in dn_dev_del_ifa()
368 dn_dev_delete(dn_db->dev); in dn_dev_del_ifa()
372 static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa) in dn_dev_insert_ifa() argument
374 struct net_device *dev = dn_db->dev; in dn_dev_insert_ifa()
381 for (ifa1 = rtnl_dereference(dn_db->ifa_list); in dn_dev_insert_ifa()
395 ifa->ifa_next = dn_db->ifa_list; in dn_dev_insert_ifa()
396 rcu_assign_pointer(dn_db->ifa_list, ifa); in dn_dev_insert_ifa()
406 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_set_ifa() local
409 if (dn_db == NULL) { in dn_dev_set_ifa()
411 dn_db = dn_dev_create(dev, &err); in dn_dev_set_ifa()
412 if (dn_db == NULL) in dn_dev_set_ifa()
416 ifa->ifa_dev = dn_db; in dn_dev_set_ifa()
421 rv = dn_dev_insert_ifa(dn_db, ifa); in dn_dev_set_ifa()
433 struct dn_dev *dn_db; in dn_dev_ioctl() local
465 if ((dn_db = rtnl_dereference(dev->dn_ptr)) != NULL) { in dn_dev_ioctl()
466 for (ifap = &dn_db->ifa_list; in dn_dev_ioctl()
493 dn_dev_del_ifa(dn_db, ifap, 0); in dn_dev_ioctl()
587 struct dn_dev *dn_db; in dn_nl_deladdr() local
602 if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL) in dn_nl_deladdr()
606 for (ifap = &dn_db->ifa_list; in dn_nl_deladdr()
616 dn_dev_del_ifa(dn_db, ifap, 1); in dn_nl_deladdr()
629 struct dn_dev *dn_db; in dn_nl_newaddr() local
648 if ((dn_db = rtnl_dereference(dev->dn_ptr)) == NULL) { in dn_nl_newaddr()
649 dn_db = dn_dev_create(dev, &err); in dn_nl_newaddr()
650 if (!dn_db) in dn_nl_newaddr()
664 ifa->ifa_dev = dn_db; in dn_nl_newaddr()
671 err = dn_dev_insert_ifa(dn_db, ifa); in dn_nl_newaddr()
745 struct dn_dev *dn_db; in dn_nl_dump_ifaddr() local
764 if ((dn_db = rtnl_dereference(dev->dn_ptr)) == NULL) in dn_nl_dump_ifaddr()
767 for (ifa = rtnl_dereference(dn_db->ifa_list), dn_idx = 0; ifa; in dn_nl_dump_ifaddr()
789 struct dn_dev *dn_db; in dn_dev_get_first() local
794 dn_db = rcu_dereference(dev->dn_ptr); in dn_dev_get_first()
795 if (dn_db == NULL) in dn_dev_get_first()
798 ifa = rcu_dereference(dn_db->ifa_list); in dn_dev_get_first()
840 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_send_endnode_hello() local
858 if (dn_db->router) { in dn_send_endnode_hello()
859 struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; in dn_send_endnode_hello()
863 msg->timer = cpu_to_le16((unsigned short)dn_db->parms.t3); in dn_send_endnode_hello()
879 static int dn_am_i_a_router(struct dn_neigh *dn, struct dn_dev *dn_db, struct dn_ifaddr *ifa) in dn_am_i_a_router() argument
882 if ((jiffies - dn_db->uptime) < DRDELAY) in dn_am_i_a_router()
886 if (!dn_db->router) in dn_am_i_a_router()
890 if (dn->priority < dn_db->parms.priority) in dn_am_i_a_router()
894 if (dn->priority != dn_db->parms.priority) in dn_am_i_a_router()
906 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_send_router_hello() local
907 struct dn_neigh *dn = (struct dn_neigh *)dn_db->router; in dn_send_router_hello()
939 *ptr++ = dn_db->parms.forwarding == 1 ? in dn_send_router_hello()
943 *ptr++ = dn_db->parms.priority; /* Priority */ in dn_send_router_hello()
945 *((__le16 *)ptr) = cpu_to_le16((unsigned short)dn_db->parms.t3); in dn_send_router_hello()
965 if (dn_am_i_a_router(dn, dn_db, ifa)) { in dn_send_router_hello()
977 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_send_brd_hello() local
979 if (dn_db->parms.forwarding == 0) in dn_send_brd_hello()
1015 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_eth_up() local
1017 if (dn_db->parms.forwarding == 0) in dn_eth_up()
1022 dn_db->use_long = 1; in dn_eth_up()
1029 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_eth_down() local
1031 if (dn_db->parms.forwarding == 0) in dn_eth_down()
1042 struct dn_dev *dn_db; in dn_dev_timer_func() local
1046 dn_db = rcu_dereference(dev->dn_ptr); in dn_dev_timer_func()
1047 if (dn_db->t3 <= dn_db->parms.t2) { in dn_dev_timer_func()
1048 if (dn_db->parms.timer3) { in dn_dev_timer_func()
1049 for (ifa = rcu_dereference(dn_db->ifa_list); in dn_dev_timer_func()
1053 dn_db->parms.timer3(dev, ifa); in dn_dev_timer_func()
1056 dn_db->t3 = dn_db->parms.t3; in dn_dev_timer_func()
1058 dn_db->t3 -= dn_db->parms.t2; in dn_dev_timer_func()
1066 struct dn_dev *dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_dev_set_timer() local
1068 if (dn_db->parms.t2 > dn_db->parms.t3) in dn_dev_set_timer()
1069 dn_db->parms.t2 = dn_db->parms.t3; in dn_dev_set_timer()
1071 dn_db->timer.data = (unsigned long)dev; in dn_dev_set_timer()
1072 dn_db->timer.function = dn_dev_timer_func; in dn_dev_set_timer()
1073 dn_db->timer.expires = jiffies + (dn_db->parms.t2 * HZ); in dn_dev_set_timer()
1075 add_timer(&dn_db->timer); in dn_dev_set_timer()
1082 struct dn_dev *dn_db; in dn_dev_create() local
1094 if ((dn_db = kzalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL) in dn_dev_create()
1097 memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms)); in dn_dev_create()
1099 rcu_assign_pointer(dev->dn_ptr, dn_db); in dn_dev_create()
1100 dn_db->dev = dev; in dn_dev_create()
1101 init_timer(&dn_db->timer); in dn_dev_create()
1103 dn_db->uptime = jiffies; in dn_dev_create()
1105 dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table); in dn_dev_create()
1106 if (!dn_db->neigh_parms) { in dn_dev_create()
1108 kfree(dn_db); in dn_dev_create()
1112 if (dn_db->parms.up) { in dn_dev_create()
1113 if (dn_db->parms.up(dev) < 0) { in dn_dev_create()
1114 neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms); in dn_dev_create()
1116 kfree(dn_db); in dn_dev_create()
1121 dn_dev_sysctl_register(dev, &dn_db->parms); in dn_dev_create()
1126 return dn_db; in dn_dev_create()
1146 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_up() local
1157 if (dn_db == NULL) { in dn_dev_up()
1159 dn_db = dn_dev_create(dev, &err); in dn_dev_up()
1160 if (dn_db == NULL) in dn_dev_up()
1197 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_delete() local
1199 if (dn_db == NULL) in dn_dev_delete()
1202 del_timer_sync(&dn_db->timer); in dn_dev_delete()
1203 dn_dev_sysctl_unregister(&dn_db->parms); in dn_dev_delete()
1207 if (dn_db->parms.down) in dn_dev_delete()
1208 dn_db->parms.down(dev); in dn_dev_delete()
1212 neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms); in dn_dev_delete()
1215 if (dn_db->router) in dn_dev_delete()
1216 neigh_release(dn_db->router); in dn_dev_delete()
1217 if (dn_db->peer) in dn_dev_delete()
1218 neigh_release(dn_db->peer); in dn_dev_delete()
1220 kfree(dn_db); in dn_dev_delete()
1225 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_down() local
1228 if (dn_db == NULL) in dn_dev_down()
1231 while ((ifa = rtnl_dereference(dn_db->ifa_list)) != NULL) { in dn_dev_down()
1232 dn_dev_del_ifa(dn_db, &dn_db->ifa_list, 0); in dn_dev_down()
1361 struct dn_dev *dn_db = rcu_dereference(dev->dn_ptr); in dn_dev_seq_show() local
1366 dn_type2asc(dn_db->parms.mode), in dn_dev_seq_show()
1368 dn_db->t3, dn_db->parms.t3, in dn_dev_seq_show()
1370 dn_db->parms.priority, in dn_dev_seq_show()
1371 dn_db->parms.state, dn_db->parms.name, in dn_dev_seq_show()
1372 … dn_db->router ? dn_addr2asc(le16_to_cpu(*(__le16 *)dn_db->router->primary_key), router_buf) : "", in dn_dev_seq_show()
1373 dn_db->peer ? dn_addr2asc(le16_to_cpu(*(__le16 *)dn_db->peer->primary_key), peer_buf) : ""); in dn_dev_seq_show()