rxe.c (d862060a4b43479887ae8e2c0b74a58c4e27e5f3) rxe.c (63fa15dbd488457117e779f8a6b4917ba83f4b77)
1// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
1/*
2 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
3 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
2/*
3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
4 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33
34#include <rdma/rdma_netlink.h>
35#include <net/addrconf.h>
36#include "rxe.h"
37#include "rxe_loc.h"
38
39MODULE_AUTHOR("Bob Pearson, Frank Zago, John Groves, Kamal Heib");
40MODULE_DESCRIPTION("Soft RDMA transport");
41MODULE_LICENSE("Dual BSD/GPL");
42
5 */
6
7#include <rdma/rdma_netlink.h>
8#include <net/addrconf.h>
9#include "rxe.h"
10#include "rxe_loc.h"
11
12MODULE_AUTHOR("Bob Pearson, Frank Zago, John Groves, Kamal Heib");
13MODULE_DESCRIPTION("Soft RDMA transport");
14MODULE_LICENSE("Dual BSD/GPL");
15
43bool rxe_initialized;
44
45/* free resources for a rxe device all objects created for this device must
46 * have been destroyed
47 */
48void rxe_dealloc(struct ib_device *ib_dev)
49{
50 struct rxe_dev *rxe = container_of(ib_dev, struct rxe_dev, ib_dev);
51
52 rxe_pool_cleanup(&rxe->uc_pool);

--- 221 unchanged lines hidden (view full) ---

274 return rxe_register_device(rxe, ibdev_name);
275}
276
277static int rxe_newlink(const char *ibdev_name, struct net_device *ndev)
278{
279 struct rxe_dev *exists;
280 int err = 0;
281
16/* free resources for a rxe device all objects created for this device must
17 * have been destroyed
18 */
19void rxe_dealloc(struct ib_device *ib_dev)
20{
21 struct rxe_dev *rxe = container_of(ib_dev, struct rxe_dev, ib_dev);
22
23 rxe_pool_cleanup(&rxe->uc_pool);

--- 221 unchanged lines hidden (view full) ---

245 return rxe_register_device(rxe, ibdev_name);
246}
247
248static int rxe_newlink(const char *ibdev_name, struct net_device *ndev)
249{
250 struct rxe_dev *exists;
251 int err = 0;
252
253 if (is_vlan_dev(ndev)) {
254 pr_err("rxe creation allowed on top of a real device only\n");
255 err = -EPERM;
256 goto err;
257 }
258
282 exists = rxe_get_dev_from_net(ndev);
283 if (exists) {
284 ib_device_put(&exists->ib_dev);
285 pr_err("already configured on %s\n", ndev->name);
286 err = -EEXIST;
287 goto err;
288 }
289

--- 22 unchanged lines hidden (view full) ---

312 return err;
313 }
314
315 err = rxe_net_init();
316 if (err)
317 return err;
318
319 rdma_link_register(&rxe_link_ops);
259 exists = rxe_get_dev_from_net(ndev);
260 if (exists) {
261 ib_device_put(&exists->ib_dev);
262 pr_err("already configured on %s\n", ndev->name);
263 err = -EEXIST;
264 goto err;
265 }
266

--- 22 unchanged lines hidden (view full) ---

289 return err;
290 }
291
292 err = rxe_net_init();
293 if (err)
294 return err;
295
296 rdma_link_register(&rxe_link_ops);
320 rxe_initialized = true;
321 pr_info("loaded\n");
322 return 0;
323}
324
325static void __exit rxe_module_exit(void)
326{
327 rdma_link_unregister(&rxe_link_ops);
328 ib_unregister_driver(RDMA_DRIVER_RXE);
329 rxe_net_exit();
330 rxe_cache_exit();
331
297 pr_info("loaded\n");
298 return 0;
299}
300
301static void __exit rxe_module_exit(void)
302{
303 rdma_link_unregister(&rxe_link_ops);
304 ib_unregister_driver(RDMA_DRIVER_RXE);
305 rxe_net_exit();
306 rxe_cache_exit();
307
332 rxe_initialized = false;
333 pr_info("unloaded\n");
334}
335
336late_initcall(rxe_module_init);
337module_exit(rxe_module_exit);
338
339MODULE_ALIAS_RDMA_LINK("rxe");
308 pr_info("unloaded\n");
309}
310
311late_initcall(rxe_module_init);
312module_exit(rxe_module_exit);
313
314MODULE_ALIAS_RDMA_LINK("rxe");