ib.c (c74a7469f97c0f40b46e82ee979f9fb1bb6e847c) ib.c (eee2fa6ab3225192d6d894c54a6fb02ac9efdff6)
1/*
1/*
2 * Copyright (c) 2006 Oracle. All rights reserved.
2 * Copyright (c) 2006, 2017 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:
9 *
10 * Redistribution and use in source and binary forms, with or

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

291{
292 struct rds_info_rdma_connection *iinfo = buffer;
293 struct rds_ib_connection *ic;
294
295 /* We will only ever look at IB transports */
296 if (conn->c_trans != &rds_ib_transport)
297 return 0;
298
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:
9 *
10 * Redistribution and use in source and binary forms, with or

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

291{
292 struct rds_info_rdma_connection *iinfo = buffer;
293 struct rds_ib_connection *ic;
294
295 /* We will only ever look at IB transports */
296 if (conn->c_trans != &rds_ib_transport)
297 return 0;
298
299 iinfo->src_addr = conn->c_laddr;
300 iinfo->dst_addr = conn->c_faddr;
299 iinfo->src_addr = conn->c_laddr.s6_addr32[3];
300 iinfo->dst_addr = conn->c_faddr.s6_addr32[3];
301
302 memset(&iinfo->src_gid, 0, sizeof(iinfo->src_gid));
303 memset(&iinfo->dst_gid, 0, sizeof(iinfo->dst_gid));
304 if (rds_conn_state(conn) == RDS_CONN_UP) {
305 struct rds_ib_device *rds_ibdev;
306
307 ic = conn->c_transport_data;
308

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

336 * device with that address set.
337 *
338 * If it were me, I'd advocate for something more flexible. Sending and
339 * receiving should be device-agnostic. Transports would try and maintain
340 * connections between peers who have messages queued. Userspace would be
341 * allowed to influence which paths have priority. We could call userspace
342 * asserting this policy "routing".
343 */
301
302 memset(&iinfo->src_gid, 0, sizeof(iinfo->src_gid));
303 memset(&iinfo->dst_gid, 0, sizeof(iinfo->dst_gid));
304 if (rds_conn_state(conn) == RDS_CONN_UP) {
305 struct rds_ib_device *rds_ibdev;
306
307 ic = conn->c_transport_data;
308

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

336 * device with that address set.
337 *
338 * If it were me, I'd advocate for something more flexible. Sending and
339 * receiving should be device-agnostic. Transports would try and maintain
340 * connections between peers who have messages queued. Userspace would be
341 * allowed to influence which paths have priority. We could call userspace
342 * asserting this policy "routing".
343 */
344static int rds_ib_laddr_check(struct net *net, __be32 addr)
344static int rds_ib_laddr_check(struct net *net, const struct in6_addr *addr,
345 __u32 scope_id)
345{
346 int ret;
347 struct rdma_cm_id *cm_id;
348 struct sockaddr_in sin;
349
350 /* Create a CMA ID and try to bind it. This catches both
351 * IB and iWARP capable NICs.
352 */
353 cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
354 NULL, RDMA_PS_TCP, IB_QPT_RC);
355 if (IS_ERR(cm_id))
356 return PTR_ERR(cm_id);
357
358 memset(&sin, 0, sizeof(sin));
359 sin.sin_family = AF_INET;
346{
347 int ret;
348 struct rdma_cm_id *cm_id;
349 struct sockaddr_in sin;
350
351 /* Create a CMA ID and try to bind it. This catches both
352 * IB and iWARP capable NICs.
353 */
354 cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
355 NULL, RDMA_PS_TCP, IB_QPT_RC);
356 if (IS_ERR(cm_id))
357 return PTR_ERR(cm_id);
358
359 memset(&sin, 0, sizeof(sin));
360 sin.sin_family = AF_INET;
360 sin.sin_addr.s_addr = addr;
361 sin.sin_addr.s_addr = addr->s6_addr32[3];
361
362 /* rdma_bind_addr will only succeed for IB & iWARP devices */
363 ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
364 /* due to this, we will claim to support iWARP devices unless we
365 check node_type. */
366 if (ret || !cm_id->device ||
367 cm_id->device->node_type != RDMA_NODE_IB_CA)
368 ret = -EADDRNOTAVAIL;
369
362
363 /* rdma_bind_addr will only succeed for IB & iWARP devices */
364 ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
365 /* due to this, we will claim to support iWARP devices unless we
366 check node_type. */
367 if (ret || !cm_id->device ||
368 cm_id->device->node_type != RDMA_NODE_IB_CA)
369 ret = -EADDRNOTAVAIL;
370
370 rdsdebug("addr %pI4 ret %d node type %d\n",
371 &addr, ret,
372 cm_id->device ? cm_id->device->node_type : -1);
371 rdsdebug("addr %pI6c ret %d node type %d\n",
372 addr, ret,
373 cm_id->device ? cm_id->device->node_type : -1);
373
374 rdma_destroy_id(cm_id);
375
376 return ret;
377}
378
379static void rds_ib_unregister_client(void)
380{

--- 99 unchanged lines hidden ---
374
375 rdma_destroy_id(cm_id);
376
377 return ret;
378}
379
380static void rds_ib_unregister_client(void)
381{

--- 99 unchanged lines hidden ---