Lines Matching refs:dn_db
252 struct dn_dev *dn_db; in dn_forwarding_proc() local
259 dn_db = rcu_dereference_raw(dev->dn_ptr); in dn_forwarding_proc()
260 old = dn_db->parms.forwarding; in dn_forwarding_proc()
265 if (dn_db->parms.forwarding < 0) in dn_forwarding_proc()
266 dn_db->parms.forwarding = 0; in dn_forwarding_proc()
267 if (dn_db->parms.forwarding > 2) in dn_forwarding_proc()
268 dn_db->parms.forwarding = 2; in dn_forwarding_proc()
275 tmp = dn_db->parms.forwarding; in dn_forwarding_proc()
276 dn_db->parms.forwarding = old; in dn_forwarding_proc()
277 if (dn_db->parms.down) in dn_forwarding_proc()
278 dn_db->parms.down(dev); in dn_forwarding_proc()
279 dn_db->parms.forwarding = tmp; in dn_forwarding_proc()
280 if (dn_db->parms.up) in dn_forwarding_proc()
281 dn_db->parms.up(dev); in dn_forwarding_proc()
329 static void dn_dev_del_ifa(struct dn_dev *dn_db, struct dn_ifaddr __rcu **ifap, int destroy) in dn_dev_del_ifa() argument
333 struct net_device *dev = dn_db->dev; in dn_dev_del_ifa()
339 if (dn_db->dev->type == ARPHRD_ETHER) { in dn_dev_del_ifa()
351 if (dn_db->ifa_list == NULL) in dn_dev_del_ifa()
352 dn_dev_delete(dn_db->dev); in dn_dev_del_ifa()
356 static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa) in dn_dev_insert_ifa() argument
358 struct net_device *dev = dn_db->dev; in dn_dev_insert_ifa()
365 for (ifa1 = rtnl_dereference(dn_db->ifa_list); in dn_dev_insert_ifa()
379 ifa->ifa_next = dn_db->ifa_list; in dn_dev_insert_ifa()
380 rcu_assign_pointer(dn_db->ifa_list, ifa); in dn_dev_insert_ifa()
390 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_set_ifa() local
393 if (dn_db == NULL) { in dn_dev_set_ifa()
395 dn_db = dn_dev_create(dev, &err); in dn_dev_set_ifa()
396 if (dn_db == NULL) in dn_dev_set_ifa()
400 ifa->ifa_dev = dn_db; in dn_dev_set_ifa()
405 rv = dn_dev_insert_ifa(dn_db, ifa); in dn_dev_set_ifa()
417 struct dn_dev *dn_db; in dn_dev_ioctl() local
449 if ((dn_db = rtnl_dereference(dev->dn_ptr)) != NULL) { in dn_dev_ioctl()
450 for (ifap = &dn_db->ifa_list; in dn_dev_ioctl()
479 dn_dev_del_ifa(dn_db, ifap, 0); in dn_dev_ioctl()
571 struct dn_dev *dn_db; in dn_nl_deladdr() local
590 if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL) in dn_nl_deladdr()
594 for (ifap = &dn_db->ifa_list; in dn_nl_deladdr()
604 dn_dev_del_ifa(dn_db, ifap, 1); in dn_nl_deladdr()
618 struct dn_dev *dn_db; in dn_nl_newaddr() local
641 if ((dn_db = rtnl_dereference(dev->dn_ptr)) == NULL) { in dn_nl_newaddr()
642 dn_db = dn_dev_create(dev, &err); in dn_nl_newaddr()
643 if (!dn_db) in dn_nl_newaddr()
658 ifa->ifa_dev = dn_db; in dn_nl_newaddr()
665 err = dn_dev_insert_ifa(dn_db, ifa); in dn_nl_newaddr()
743 struct dn_dev *dn_db; in dn_nl_dump_ifaddr() local
763 if ((dn_db = rcu_dereference(dev->dn_ptr)) == NULL) in dn_nl_dump_ifaddr()
766 for (ifa = rcu_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 (time_before(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()
1041 struct dn_dev *dn_db = from_timer(dn_db, t, timer); in dn_dev_timer_func() local
1046 dev = dn_db->dev; 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.expires = jiffies + (dn_db->parms.t2 * HZ); in dn_dev_set_timer()
1073 add_timer(&dn_db->timer); in dn_dev_set_timer()
1080 struct dn_dev *dn_db; in dn_dev_create() local
1092 if ((dn_db = kzalloc(sizeof(struct dn_dev), GFP_ATOMIC)) == NULL) in dn_dev_create()
1095 memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms)); in dn_dev_create()
1097 rcu_assign_pointer(dev->dn_ptr, dn_db); in dn_dev_create()
1098 dn_db->dev = dev; in dn_dev_create()
1099 timer_setup(&dn_db->timer, dn_dev_timer_func, 0); in dn_dev_create()
1101 dn_db->uptime = jiffies; in dn_dev_create()
1103 dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table); in dn_dev_create()
1104 if (!dn_db->neigh_parms) { in dn_dev_create()
1106 kfree(dn_db); in dn_dev_create()
1110 if (dn_db->parms.up) { in dn_dev_create()
1111 if (dn_db->parms.up(dev) < 0) { in dn_dev_create()
1112 neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms); in dn_dev_create()
1114 kfree(dn_db); in dn_dev_create()
1119 dn_dev_sysctl_register(dev, &dn_db->parms); in dn_dev_create()
1124 return dn_db; in dn_dev_create()
1144 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_up() local
1155 if (dn_db == NULL) { in dn_dev_up()
1157 dn_db = dn_dev_create(dev, &err); in dn_dev_up()
1158 if (dn_db == NULL) in dn_dev_up()
1195 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_delete() local
1197 if (dn_db == NULL) in dn_dev_delete()
1200 del_timer_sync(&dn_db->timer); in dn_dev_delete()
1201 dn_dev_sysctl_unregister(&dn_db->parms); in dn_dev_delete()
1205 if (dn_db->parms.down) in dn_dev_delete()
1206 dn_db->parms.down(dev); in dn_dev_delete()
1210 neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms); in dn_dev_delete()
1213 if (dn_db->router) in dn_dev_delete()
1214 neigh_release(dn_db->router); in dn_dev_delete()
1215 if (dn_db->peer) in dn_dev_delete()
1216 neigh_release(dn_db->peer); in dn_dev_delete()
1218 kfree(dn_db); in dn_dev_delete()
1223 struct dn_dev *dn_db = rtnl_dereference(dev->dn_ptr); in dn_dev_down() local
1226 if (dn_db == NULL) in dn_dev_down()
1229 while ((ifa = rtnl_dereference(dn_db->ifa_list)) != NULL) { in dn_dev_down()
1230 dn_dev_del_ifa(dn_db, &dn_db->ifa_list, 0); in dn_dev_down()
1359 struct dn_dev *dn_db = rcu_dereference(dev->dn_ptr); in dn_dev_seq_show() local
1364 dn_type2asc(dn_db->parms.mode), in dn_dev_seq_show()
1366 dn_db->t3, dn_db->parms.t3, in dn_dev_seq_show()
1368 dn_db->parms.priority, in dn_dev_seq_show()
1369 dn_db->parms.state, dn_db->parms.name, in dn_dev_seq_show()
1370 … dn_db->router ? dn_addr2asc(le16_to_cpu(*(__le16 *)dn_db->router->primary_key), router_buf) : "", in dn_dev_seq_show()
1371 dn_db->peer ? dn_addr2asc(le16_to_cpu(*(__le16 *)dn_db->peer->primary_key), peer_buf) : ""); in dn_dev_seq_show()