summaryrefslogtreecommitdiffstats
path: root/net/can/gw.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-08-21 13:12:29 -0400
committerJason Gunthorpe <jgg@mellanox.com>2019-08-21 19:58:18 -0400
commitdaa138a58c802e7b4c2fb73f9b85bb082616ef43 (patch)
treebe913e8e3745bb367d2ba371598f447649102cfc /net/can/gw.c
parent6869b7b206595ae0e326f59719090351eb8f4f5d (diff)
parentfba0e448a2c5b297a4ddc1ec4e48f4aa6600a1c9 (diff)
Merge branch 'odp_fixes' into hmm.git
From rdma.git Jason Gunthorpe says: ==================== This is a collection of general cleanups for ODP to clarify some of the flows around umem creation and use of the interval tree. ==================== The branch is based on v5.3-rc5 due to dependencies, and is being taken into hmm.git due to dependencies in the next patches. * odp_fixes: RDMA/mlx5: Use odp instead of mr->umem in pagefault_mr RDMA/mlx5: Use ib_umem_start instead of umem.address RDMA/core: Make invalidate_range a device operation RDMA/odp: Use kvcalloc for the dma_list and page_list RDMA/odp: Check for overflow when computing the umem_odp end RDMA/odp: Provide ib_umem_odp_release() to undo the allocs RDMA/odp: Split creating a umem_odp from ib_umem_get RDMA/odp: Make the three ways to create a umem_odp clear RMDA/odp: Consolidate umem_odp initialization RDMA/odp: Make it clearer when a umem is an implicit ODP umem RDMA/odp: Iterate over the whole rbtree directly RDMA/odp: Use the common interval tree library instead of generic RDMA/mlx5: Fix MR npages calculation for IB_ACCESS_HUGETLB Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'net/can/gw.c')
-rw-r--r--net/can/gw.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/net/can/gw.c b/net/can/gw.c
index 5275ddf580bc..72711053ebe6 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -1046,32 +1046,50 @@ static __init int cgw_module_init(void)
1046 pr_info("can: netlink gateway (rev " CAN_GW_VERSION ") max_hops=%d\n", 1046 pr_info("can: netlink gateway (rev " CAN_GW_VERSION ") max_hops=%d\n",
1047 max_hops); 1047 max_hops);
1048 1048
1049 register_pernet_subsys(&cangw_pernet_ops); 1049 ret = register_pernet_subsys(&cangw_pernet_ops);
1050 if (ret)
1051 return ret;
1052
1053 ret = -ENOMEM;
1050 cgw_cache = kmem_cache_create("can_gw", sizeof(struct cgw_job), 1054 cgw_cache = kmem_cache_create("can_gw", sizeof(struct cgw_job),
1051 0, 0, NULL); 1055 0, 0, NULL);
1052
1053 if (!cgw_cache) 1056 if (!cgw_cache)
1054 return -ENOMEM; 1057 goto out_cache_create;
1055 1058
1056 /* set notifier */ 1059 /* set notifier */
1057 notifier.notifier_call = cgw_notifier; 1060 notifier.notifier_call = cgw_notifier;
1058 register_netdevice_notifier(&notifier); 1061 ret = register_netdevice_notifier(&notifier);
1062 if (ret)
1063 goto out_register_notifier;
1059 1064
1060 ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_GETROUTE, 1065 ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_GETROUTE,
1061 NULL, cgw_dump_jobs, 0); 1066 NULL, cgw_dump_jobs, 0);
1062 if (ret) { 1067 if (ret)
1063 unregister_netdevice_notifier(&notifier); 1068 goto out_rtnl_register1;
1064 kmem_cache_destroy(cgw_cache); 1069
1065 return -ENOBUFS; 1070 ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_NEWROUTE,
1066 } 1071 cgw_create_job, NULL, 0);
1067 1072 if (ret)
1068 /* Only the first call to rtnl_register_module can fail */ 1073 goto out_rtnl_register2;
1069 rtnl_register_module(THIS_MODULE, PF_CAN, RTM_NEWROUTE, 1074 ret = rtnl_register_module(THIS_MODULE, PF_CAN, RTM_DELROUTE,
1070 cgw_create_job, NULL, 0); 1075 cgw_remove_job, NULL, 0);
1071 rtnl_register_module(THIS_MODULE, PF_CAN, RTM_DELROUTE, 1076 if (ret)
1072 cgw_remove_job, NULL, 0); 1077 goto out_rtnl_register3;
1073 1078
1074 return 0; 1079 return 0;
1080
1081out_rtnl_register3:
1082 rtnl_unregister(PF_CAN, RTM_NEWROUTE);
1083out_rtnl_register2:
1084 rtnl_unregister(PF_CAN, RTM_GETROUTE);
1085out_rtnl_register1:
1086 unregister_netdevice_notifier(&notifier);
1087out_register_notifier:
1088 kmem_cache_destroy(cgw_cache);
1089out_cache_create:
1090 unregister_pernet_subsys(&cangw_pernet_ops);
1091
1092 return ret;
1075} 1093}
1076 1094
1077static __exit void cgw_module_exit(void) 1095static __exit void cgw_module_exit(void)