From c3b4f1bf4bad6d596c2a05fb967a4408c563e755 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 18 Jul 2017 16:58:38 +0800 Subject: [PATCH] netisr: netisr_forwardmsg -> netisr_forwardmsg_all This function actually forwards netmsg to all available netisrs, instead of netisr_ncpus netisrs. For some modules, this is obviously not necessary; they will be fixed one-by-one later. --- sys/net/bridge/if_bridge.c | 10 +++++----- sys/net/if.c | 6 +++--- sys/net/ipfw/ip_fw2.c | 26 +++++++++++++------------- sys/net/ipfw3/ip_fw3.c | 26 +++++++++++++------------- sys/net/ipfw3/ip_fw3_table.c | 14 +++++++------- sys/net/ipfw3_basic/ip_fw3_basic.c | 4 ++-- sys/net/ipfw3_nat/ip_fw3_nat.c | 6 +++--- sys/net/netisr2.h | 5 ++++- sys/net/vlan/if_vlan.c | 4 ++-- sys/netinet/in.c | 8 ++++---- sys/netinet/ip_flow.c | 2 +- 11 files changed, 57 insertions(+), 54 deletions(-) diff --git a/sys/net/bridge/if_bridge.c b/sys/net/bridge/if_bridge.c index 99e8bdb628..bf83c56033 100644 --- a/sys/net/bridge/if_bridge.c +++ b/sys/net/bridge/if_bridge.c @@ -3168,7 +3168,7 @@ bridge_span(struct bridge_softc *sc, struct mbuf *m) static void bridge_rtmsg_sync_handler(netmsg_t msg) { - netisr_forwardmsg(&msg->base, mycpuid + 1); + netisr_forwardmsg_all(&msg->base, mycpuid + 1); } static void @@ -3275,7 +3275,7 @@ bridge_rtinstall_handler(netmsg_t msg) netisr_replymsg(&brmsg->base, 0); return; } - netisr_forwardmsg(&brmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&brmsg->base, mycpuid + 1); } /* @@ -3365,7 +3365,7 @@ bridge_rtreap_handler(netmsg_t msg) if (brt->brt_info->bri_dead) bridge_rtnode_destroy(sc, brt); } - netisr_forwardmsg(&msg->base, mycpuid + 1); + netisr_forwardmsg_all(&msg->base, mycpuid + 1); } static void @@ -4421,7 +4421,7 @@ bridge_add_bif_handler(netmsg_t msg) TAILQ_INSERT_HEAD(&sc->sc_iflists[mycpuid], bif, bif_next); - netisr_forwardmsg(&amsg->base, mycpuid + 1); + netisr_forwardmsg_all(&amsg->base, mycpuid + 1); } static void @@ -4464,7 +4464,7 @@ bridge_del_bif_handler(netmsg_t msg) /* Save the removed bif for later freeing */ TAILQ_INSERT_HEAD(dmsg->br_bif_list, bif, bif_next); - netisr_forwardmsg(&dmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&dmsg->base, mycpuid + 1); } static void diff --git a/sys/net/if.c b/sys/net/if.c index ba479c2d50..761411c2f8 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -3182,7 +3182,7 @@ ifa_iflink_dispatch(netmsg_t nmsg) crit_exit(); - netisr_forwardmsg(&nmsg->base, cpu + 1); + netisr_forwardmsg_all(&nmsg->base, cpu + 1); } void @@ -3220,7 +3220,7 @@ ifa_ifunlink_dispatch(netmsg_t nmsg) crit_exit(); - netisr_forwardmsg(&nmsg->base, cpu + 1); + netisr_forwardmsg_all(&nmsg->base, cpu + 1); } void @@ -3242,7 +3242,7 @@ ifa_destroy_dispatch(netmsg_t nmsg) struct netmsg_ifaddr *msg = (struct netmsg_ifaddr *)nmsg; IFAFREE(msg->ifa); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } void diff --git a/sys/net/ipfw/ip_fw2.c b/sys/net/ipfw/ip_fw2.c index 42c6d0fe48..4f05932941 100644 --- a/sys/net/ipfw/ip_fw2.c +++ b/sys/net/ipfw/ip_fw2.c @@ -2538,7 +2538,7 @@ ipfw_add_rule_dispatch(netmsg_t nmsg) nmsg->lmsg.u.ms_resultp = rule; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -2553,7 +2553,7 @@ ipfw_enable_state_dispatch(netmsg_t nmsg) rule->rule_flags |= IPFW_RULE_F_STATE; lmsg->u.ms_resultp = rule->sibling; - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -2725,7 +2725,7 @@ ipfw_flush_dispatch(netmsg_t nmsg) (kill_default || rule->rulenum != IPFW_DEFAULT_RULE)) ipfw_delete_rule(ctx, NULL, rule); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -2756,7 +2756,7 @@ ipfw_disable_rule_state_dispatch(netmsg_t nmsg) rule = rule->next; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -2882,7 +2882,7 @@ ipfw_alt_delete_rule_dispatch(netmsg_t nmsg) while (rule && rule->rulenum == dmsg->rulenum) rule = ipfw_delete_rule(ctx, prev, rule); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -2992,7 +2992,7 @@ ipfw_alt_delete_ruleset_dispatch(netmsg_t nmsg) } KASSERT(del, ("no match set?!")); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -3015,7 +3015,7 @@ ipfw_disable_ruleset_state_dispatch(netmsg_t nmsg) } KASSERT(cleared, ("no match set?!")); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -3113,7 +3113,7 @@ ipfw_alt_move_rule_dispatch(netmsg_t nmsg) rule->set = dmsg->to_set; rule = rule->next; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -3159,7 +3159,7 @@ ipfw_alt_move_ruleset_dispatch(netmsg_t nmsg) if (rule->set == dmsg->from_set) rule->set = dmsg->to_set; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -3192,7 +3192,7 @@ ipfw_alt_swap_ruleset_dispatch(netmsg_t nmsg) else if (rule->set == dmsg->to_set) rule->set = dmsg->from_set; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -3320,7 +3320,7 @@ ipfw_zero_entry_dispatch(netmsg_t nmsg) */ zmsg->start_rule = start->sibling; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -3771,7 +3771,7 @@ ipfw_set_disable_dispatch(netmsg_t nmsg) ctx->ipfw_set_disable = lmsg->u.ms_result32; - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -4293,7 +4293,7 @@ ipfw_ctx_init_dispatch(netmsg_t nmsg) if (mycpuid == 0) ipfw_inc_static_count(def_rule); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void diff --git a/sys/net/ipfw3/ip_fw3.c b/sys/net/ipfw3/ip_fw3.c index 53f1af3fa8..02493514f7 100644 --- a/sys/net/ipfw3/ip_fw3.c +++ b/sys/net/ipfw3/ip_fw3.c @@ -738,7 +738,7 @@ ipfw_add_rule_dispatch(netmsg_t nmsg) /* Statistics only need to be updated once */ ipfw_inc_static_count(rule); } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -841,7 +841,7 @@ ipfw_flush_rule_dispatch(netmsg_t nmsg) kfree(the_rule, M_IPFW3); } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -850,7 +850,7 @@ ipfw_append_state_dispatch(netmsg_t nmsg) struct netmsg_del *dmsg = (struct netmsg_del *)nmsg; struct ipfw_ioc_state *ioc_state = dmsg->ioc_state; (*ipfw_basic_append_state_prt)(ioc_state); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -867,7 +867,7 @@ ipfw_delete_state_dispatch(netmsg_t nmsg) } (*ipfw_basic_flush_state_prt)(rule); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -946,7 +946,7 @@ ipfw_delete_rule_dispatch(netmsg_t nmsg) rule = rule->next; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -1003,7 +1003,7 @@ ipfw_alt_delete_ruleset_dispatch(netmsg_t nmsg) } KASSERT(del, ("no match set?!")); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -1025,7 +1025,7 @@ ipfw_disable_ruleset_state_dispatch(netmsg_t nmsg) } KASSERT(cleared, ("no match set?!")); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -1097,7 +1097,7 @@ ipfw_alt_move_rule_dispatch(netmsg_t nmsg) rule->set = dmsg->to_set; rule = rule->next; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -1143,7 +1143,7 @@ ipfw_alt_move_ruleset_dispatch(netmsg_t nmsg) if (rule->set == dmsg->from_set) rule->set = dmsg->to_set; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -1176,7 +1176,7 @@ ipfw_alt_swap_ruleset_dispatch(netmsg_t nmsg) else if (rule->set == dmsg->to_set) rule->set = dmsg->from_set; } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static int @@ -1272,7 +1272,7 @@ ipfw_zero_entry_dispatch(netmsg_t nmsg) } } } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /** @@ -1560,7 +1560,7 @@ ipfw_set_disable_dispatch(netmsg_t nmsg) ctx->ipfw_set_disable = lmsg->u.ms_result32; - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -2000,7 +2000,7 @@ ipfw_ctx_init_dispatch(netmsg_t nmsg) if (mycpuid == 0) ipfw_inc_static_count(def_rule); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void diff --git a/sys/net/ipfw3/ip_fw3_table.c b/sys/net/ipfw3/ip_fw3_table.c index e69d0dcdac..73dc7b64cb 100644 --- a/sys/net/ipfw3/ip_fw3_table.c +++ b/sys/net/ipfw3/ip_fw3_table.c @@ -107,7 +107,7 @@ table_create_dispatch(netmsg_t nmsg) goto done; } done: - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -135,7 +135,7 @@ table_delete_dispatch(netmsg_t nmsg) rnh->rnh_walktree(rnh, flush_table_mac_entry, rnh); } table_ctx->type = 0; - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -193,7 +193,7 @@ table_append_dispatch(netmsg_t nmsg) } done: - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void @@ -230,7 +230,7 @@ table_remove_dispatch(netmsg_t nmsg) kfree(ent, M_IPFW3_TABLE); } done: - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } int @@ -275,7 +275,7 @@ table_flush_dispatch(netmsg_t nmsg) table_ctx->count = 0; rnh->rnh_walktree(rnh, flush_table_ip_entry, rnh); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -293,7 +293,7 @@ table_rename_dispatch(netmsg_t nmsg) table_ctx = ctx->table_ctx; table_ctx += ioc_tbl->id; strlcpy(table_ctx->name, ioc_tbl->name, IPFW_TABLE_NAME_LEN); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* @@ -594,7 +594,7 @@ table_init_ctx_dispatch(netmsg_t nmsg) struct ipfw_context *ctx = ipfw_ctx[mycpuid]; ctx->table_ctx = kmalloc(sizeof(struct ipfw_table_context) * IPFW_TABLES_MAX, M_IPFW3_TABLE, M_WAITOK | M_ZERO); - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } /* diff --git a/sys/net/ipfw3_basic/ip_fw3_basic.c b/sys/net/ipfw3_basic/ip_fw3_basic.c index 05ac6d41e3..76516f229f 100644 --- a/sys/net/ipfw3_basic/ip_fw3_basic.c +++ b/sys/net/ipfw3_basic/ip_fw3_basic.c @@ -173,7 +173,7 @@ adjust_hash_size_dispatch(netmsg_t nmsg) sizeof(struct ipfw_state_context), M_IPFW3_BASIC, M_WAITOK | M_ZERO); ctx->state_hash_size = state_hash_size; - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } @@ -1045,7 +1045,7 @@ ipfw_cleanup_expired_state(netmsg_t nmsg) } } } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void diff --git a/sys/net/ipfw3_nat/ip_fw3_nat.c b/sys/net/ipfw3_nat/ip_fw3_nat.c index 238d06857d..50cba05aae 100644 --- a/sys/net/ipfw3_nat/ip_fw3_nat.c +++ b/sys/net/ipfw3_nat/ip_fw3_nat.c @@ -603,7 +603,7 @@ nat_add_dispatch(netmsg_t nat_add_msg) nat_ctx = ipfw_nat_ctx[mycpuid]; HOOK_NAT(&(nat_ctx->nat), ptr); - netisr_forwardmsg(&msg->base, mycpuid + 1); + netisr_forwardmsg_all(&msg->base, mycpuid + 1); } int @@ -769,7 +769,7 @@ nat_init_ctx_dispatch(netmsg_t msg) tmp = kmalloc(sizeof(struct ipfw_nat_context), M_IPFW_NAT, M_WAITOK | M_ZERO); ipfw_nat_ctx[mycpuid] = tmp; - netisr_forwardmsg(&msg->base, mycpuid + 1); + netisr_forwardmsg_all(&msg->base, mycpuid + 1); } static void @@ -784,7 +784,7 @@ ipfw3_nat_cleanup_func_dispatch(netmsg_t nmsg) (*libalias_housekeeping_prt)(ptr->lib); } } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void diff --git a/sys/net/netisr2.h b/sys/net/netisr2.h index 2ef578105b..0346bc670b 100644 --- a/sys/net/netisr2.h +++ b/sys/net/netisr2.h @@ -167,8 +167,11 @@ netisr_replymsg(struct netmsg_base *nm, int error) lwkt_replymsg(&nm->lmsg, error); } +/* + * To all netisrs, instead of netisr_ncpus. + */ static __inline void -netisr_forwardmsg(struct netmsg_base *nm, int next_cpu) +netisr_forwardmsg_all(struct netmsg_base *nm, int next_cpu) { KKASSERT(next_cpu > mycpuid && next_cpu <= ncpus); diff --git a/sys/net/vlan/if_vlan.c b/sys/net/vlan/if_vlan.c index 2745944e40..207b13d79f 100644 --- a/sys/net/vlan/if_vlan.c +++ b/sys/net/vlan/if_vlan.c @@ -643,7 +643,7 @@ vlan_link_dispatch(netmsg_t msg) LIST_INSERT_HEAD(&trunk->vlan_list, entry, ifv_link); crit_exit(); - netisr_forwardmsg(&vmsg->base, cpu + 1); + netisr_forwardmsg_all(&vmsg->base, cpu + 1); } static void @@ -801,7 +801,7 @@ vlan_unlink_dispatch(netmsg_t msg) LIST_REMOVE(entry, ifv_link); crit_exit(); - netisr_forwardmsg(&vmsg->base, cpu + 1); + netisr_forwardmsg_all(&vmsg->base, cpu + 1); } static void diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 898b2a0dfd..82707b8df2 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -269,7 +269,7 @@ in_ialink_dispatch(netmsg_t msg) crit_exit(); - netisr_forwardmsg(&msg->base, cpu + 1); + netisr_forwardmsg_all(&msg->base, cpu + 1); } static void @@ -293,7 +293,7 @@ in_iaunlink_dispatch(netmsg_t msg) crit_exit(); - netisr_forwardmsg(&msg->base, cpu + 1); + netisr_forwardmsg_all(&msg->base, cpu + 1); } static void @@ -318,7 +318,7 @@ in_iahashins_dispatch(netmsg_t msg) crit_exit(); - netisr_forwardmsg(&msg->base, cpu + 1); + netisr_forwardmsg_all(&msg->base, cpu + 1); } static void @@ -342,7 +342,7 @@ in_iahashrem_dispatch(netmsg_t msg) crit_exit(); - netisr_forwardmsg(&msg->base, cpu + 1); + netisr_forwardmsg_all(&msg->base, cpu + 1); } static void diff --git a/sys/netinet/ip_flow.c b/sys/netinet/ip_flow.c index 3286b9f075..1d8905e417 100644 --- a/sys/netinet/ip_flow.c +++ b/sys/netinet/ip_flow.c @@ -531,7 +531,7 @@ ipflow_ifaddr_handler(netmsg_t nmsg) IPFLOW_FREE(ipf); } } - netisr_forwardmsg(&nmsg->base, mycpuid + 1); + netisr_forwardmsg_all(&nmsg->base, mycpuid + 1); } static void -- 2.11.4.GIT