| 14890 | static bool bbr_mod_inited = false; |
| 14891 | |
| 14892 | static int |
| 14893 | tcp_addbbr(module_t mod, int32_t type, void *data) |
| 14894 | { |
| 14895 | int32_t err = 0; |
| 14896 | int num_stacks; |
| 14897 | |
| 14898 | switch (type) { |
| 14899 | case MOD_LOAD: |
| 14900 | printf("Attempting to load " __XSTRING(MODNAME) "\n"); |
| 14901 | bbr_zone = uma_zcreate(__XSTRING(MODNAME) "_map", |
| 14902 | sizeof(struct bbr_sendmap), |
| 14903 | NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); |
| 14904 | bbr_pcb_zone = uma_zcreate(__XSTRING(MODNAME) "_pcb", |
| 14905 | sizeof(struct tcp_bbr), |
| 14906 | NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); |
| 14907 | sysctl_ctx_init(&bbr_sysctl_ctx); |
| 14908 | bbr_sysctl_root = SYSCTL_ADD_NODE(&bbr_sysctl_ctx, |
| 14909 | SYSCTL_STATIC_CHILDREN(_net_inet_tcp), |
| 14910 | OID_AUTO, |
| 14911 | #ifdef STACKALIAS |
| 14912 | __XSTRING(STACKALIAS), |
| 14913 | #else |
| 14914 | __XSTRING(STACKNAME), |
| 14915 | #endif |
| 14916 | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, |
| 14917 | ""); |
| 14918 | if (bbr_sysctl_root == NULL) { |
| 14919 | printf("Failed to add sysctl node\n"); |
| 14920 | err = EFAULT; |
| 14921 | goto free_uma; |
| 14922 | } |
| 14923 | bbr_init_sysctls(); |
| 14924 | num_stacks = nitems(bbr_stack_names); |
| 14925 | err = register_tcp_functions_as_names(&__tcp_bbr, M_WAITOK, |
| 14926 | bbr_stack_names, &num_stacks); |
| 14927 | if (err) { |
| 14928 | printf("Failed to register %s stack name for " |
| 14929 | "%s module\n", bbr_stack_names[num_stacks], |
| 14930 | __XSTRING(MODNAME)); |
| 14931 | sysctl_ctx_free(&bbr_sysctl_ctx); |
| 14932 | free_uma: |
| 14933 | uma_zdestroy(bbr_zone); |
| 14934 | uma_zdestroy(bbr_pcb_zone); |
| 14935 | bbr_counter_destroy(); |
| 14936 | printf("Failed to register " __XSTRING(MODNAME) |
| 14937 | " module err:%d\n", err); |
| 14938 | return (err); |
| 14939 | } |
| 14940 | tcp_lro_reg_mbufq(); |
| 14941 | bbr_mod_inited = true; |
| 14942 | printf(__XSTRING(MODNAME) " is now available\n"); |
| 14943 | break; |
| 14944 | case MOD_QUIESCE: |
| 14945 | err = deregister_tcp_functions(&__tcp_bbr, true, false); |
| 14946 | break; |
| 14947 | case MOD_UNLOAD: |
| 14948 | err = deregister_tcp_functions(&__tcp_bbr, false, true); |
| 14949 | if (err == EBUSY) |
nothing calls this directly
no test coverage detected