ib.c (1e2b44e78eead7bcadfbf96f70d95773191541c9) ib.c (b7ff8b1036f0b0df1390ba6b5e9bc7ec458e857a)
1/*
2 * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

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

316 iinfo->max_send_wr = ic->i_send_ring.w_nr;
317 iinfo->max_recv_wr = ic->i_recv_ring.w_nr;
318 iinfo->max_send_sge = rds_ibdev->max_sge;
319 rds_ib_get_mr_info(rds_ibdev, iinfo);
320 }
321 return 1;
322}
323
1/*
2 * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

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

316 iinfo->max_send_wr = ic->i_send_ring.w_nr;
317 iinfo->max_recv_wr = ic->i_recv_ring.w_nr;
318 iinfo->max_send_sge = rds_ibdev->max_sge;
319 rds_ib_get_mr_info(rds_ibdev, iinfo);
320 }
321 return 1;
322}
323
324/* IPv6 version of rds_ib_conn_info_visitor(). */
325static int rds6_ib_conn_info_visitor(struct rds_connection *conn,
326 void *buffer)
327{
328 struct rds6_info_rdma_connection *iinfo6 = buffer;
329 struct rds_ib_connection *ic;
330
331 /* We will only ever look at IB transports */
332 if (conn->c_trans != &rds_ib_transport)
333 return 0;
334
335 iinfo6->src_addr = conn->c_laddr;
336 iinfo6->dst_addr = conn->c_faddr;
337
338 memset(&iinfo6->src_gid, 0, sizeof(iinfo6->src_gid));
339 memset(&iinfo6->dst_gid, 0, sizeof(iinfo6->dst_gid));
340
341 if (rds_conn_state(conn) == RDS_CONN_UP) {
342 struct rds_ib_device *rds_ibdev;
343 struct rdma_dev_addr *dev_addr;
344
345 ic = conn->c_transport_data;
346 dev_addr = &ic->i_cm_id->route.addr.dev_addr;
347 rdma_addr_get_sgid(dev_addr,
348 (union ib_gid *)&iinfo6->src_gid);
349 rdma_addr_get_dgid(dev_addr,
350 (union ib_gid *)&iinfo6->dst_gid);
351
352 rds_ibdev = ic->rds_ibdev;
353 iinfo6->max_send_wr = ic->i_send_ring.w_nr;
354 iinfo6->max_recv_wr = ic->i_recv_ring.w_nr;
355 iinfo6->max_send_sge = rds_ibdev->max_sge;
356 rds6_ib_get_mr_info(rds_ibdev, iinfo6);
357 }
358 return 1;
359}
360
324static void rds_ib_ic_info(struct socket *sock, unsigned int len,
325 struct rds_info_iterator *iter,
326 struct rds_info_lengths *lens)
327{
328 u64 buffer[(sizeof(struct rds_info_rdma_connection) + 7) / 8];
329
330 rds_for_each_conn_info(sock, len, iter, lens,
331 rds_ib_conn_info_visitor,
332 buffer,
333 sizeof(struct rds_info_rdma_connection));
334}
335
361static void rds_ib_ic_info(struct socket *sock, unsigned int len,
362 struct rds_info_iterator *iter,
363 struct rds_info_lengths *lens)
364{
365 u64 buffer[(sizeof(struct rds_info_rdma_connection) + 7) / 8];
366
367 rds_for_each_conn_info(sock, len, iter, lens,
368 rds_ib_conn_info_visitor,
369 buffer,
370 sizeof(struct rds_info_rdma_connection));
371}
372
373/* IPv6 version of rds_ib_ic_info(). */
374static void rds6_ib_ic_info(struct socket *sock, unsigned int len,
375 struct rds_info_iterator *iter,
376 struct rds_info_lengths *lens)
377{
378 u64 buffer[(sizeof(struct rds6_info_rdma_connection) + 7) / 8];
379
380 rds_for_each_conn_info(sock, len, iter, lens,
381 rds6_ib_conn_info_visitor,
382 buffer,
383 sizeof(struct rds6_info_rdma_connection));
384}
385
336/*
337 * Early RDS/IB was built to only bind to an address if there is an IPoIB
338 * device with that address set.
339 *
340 * If it were me, I'd advocate for something more flexible. Sending and
341 * receiving should be device-agnostic. Transports would try and maintain
342 * connections between peers who have messages queued. Userspace would be
343 * allowed to influence which paths have priority. We could call userspace

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

436 atomic_read(&rds_ib_unloading) != 0);
437}
438
439void rds_ib_exit(void)
440{
441 rds_ib_set_unloading();
442 synchronize_rcu();
443 rds_info_deregister_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info);
386/*
387 * Early RDS/IB was built to only bind to an address if there is an IPoIB
388 * device with that address set.
389 *
390 * If it were me, I'd advocate for something more flexible. Sending and
391 * receiving should be device-agnostic. Transports would try and maintain
392 * connections between peers who have messages queued. Userspace would be
393 * allowed to influence which paths have priority. We could call userspace

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

486 atomic_read(&rds_ib_unloading) != 0);
487}
488
489void rds_ib_exit(void)
490{
491 rds_ib_set_unloading();
492 synchronize_rcu();
493 rds_info_deregister_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info);
494 rds_info_deregister_func(RDS6_INFO_IB_CONNECTIONS, rds6_ib_ic_info);
444 rds_ib_unregister_client();
445 rds_ib_destroy_nodev_conns();
446 rds_ib_sysctl_exit();
447 rds_ib_recv_exit();
448 rds_trans_unregister(&rds_ib_transport);
449 rds_ib_mr_exit();
450}
451

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

497
498 ret = rds_ib_recv_init();
499 if (ret)
500 goto out_sysctl;
501
502 rds_trans_register(&rds_ib_transport);
503
504 rds_info_register_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info);
495 rds_ib_unregister_client();
496 rds_ib_destroy_nodev_conns();
497 rds_ib_sysctl_exit();
498 rds_ib_recv_exit();
499 rds_trans_unregister(&rds_ib_transport);
500 rds_ib_mr_exit();
501}
502

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

548
549 ret = rds_ib_recv_init();
550 if (ret)
551 goto out_sysctl;
552
553 rds_trans_register(&rds_ib_transport);
554
555 rds_info_register_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info);
556 rds_info_register_func(RDS6_INFO_IB_CONNECTIONS, rds6_ib_ic_info);
505
506 goto out;
507
508out_sysctl:
509 rds_ib_sysctl_exit();
510out_ibreg:
511 rds_ib_unregister_client();
512out_mr_exit:
513 rds_ib_mr_exit();
514out:
515 return ret;
516}
517
518MODULE_LICENSE("GPL");
519
557
558 goto out;
559
560out_sysctl:
561 rds_ib_sysctl_exit();
562out_ibreg:
563 rds_ib_unregister_client();
564out_mr_exit:
565 rds_ib_mr_exit();
566out:
567 return ret;
568}
569
570MODULE_LICENSE("GPL");
571