aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/ib.c
diff options
context:
space:
mode:
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>2018-07-23 23:51:23 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-24 00:17:44 -0400
commitb7ff8b1036f0b0df1390ba6b5e9bc7ec458e857a (patch)
tree398bab1a171b7da3be14fe9f7f1d5936032b7f74 /net/rds/ib.c
parent1e2b44e78eead7bcadfbf96f70d95773191541c9 (diff)
rds: Extend RDS API for IPv6 support
There are many data structures (RDS socket options) used by RDS apps which use a 32 bit integer to store IP address. To support IPv6, struct in6_addr needs to be used. To ensure backward compatibility, a new data structure is introduced for each of those data structures which use a 32 bit integer to represent an IP address. And new socket options are introduced to use those new structures. This means that existing apps should work without a problem with the new RDS module. For apps which want to use IPv6, those new data structures and socket options can be used. IPv4 mapped address is used to represent IPv4 address in the new data structures. v4: Revert changes to SO_RDS_TRANSPORT Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/ib.c')
-rw-r--r--net/rds/ib.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 756225c5540f..63d95ea7cdff 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -321,6 +321,43 @@ static int rds_ib_conn_info_visitor(struct rds_connection *conn,
321 return 1; 321 return 1;
322} 322}
323 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, 361static void rds_ib_ic_info(struct socket *sock, unsigned int len,
325 struct rds_info_iterator *iter, 362 struct rds_info_iterator *iter,
326 struct rds_info_lengths *lens) 363 struct rds_info_lengths *lens)
@@ -333,6 +370,19 @@ static void rds_ib_ic_info(struct socket *sock, unsigned int len,
333 sizeof(struct rds_info_rdma_connection)); 370 sizeof(struct rds_info_rdma_connection));
334} 371}
335 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/* 386/*
337 * Early RDS/IB was built to only bind to an address if there is an IPoIB 387 * Early RDS/IB was built to only bind to an address if there is an IPoIB
338 * device with that address set. 388 * device with that address set.
@@ -441,6 +491,7 @@ void rds_ib_exit(void)
441 rds_ib_set_unloading(); 491 rds_ib_set_unloading();
442 synchronize_rcu(); 492 synchronize_rcu();
443 rds_info_deregister_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info); 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(); 495 rds_ib_unregister_client();
445 rds_ib_destroy_nodev_conns(); 496 rds_ib_destroy_nodev_conns();
446 rds_ib_sysctl_exit(); 497 rds_ib_sysctl_exit();
@@ -502,6 +553,7 @@ int rds_ib_init(void)
502 rds_trans_register(&rds_ib_transport); 553 rds_trans_register(&rds_ib_transport);
503 554
504 rds_info_register_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info); 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 557
506 goto out; 558 goto out;
507 559