aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_addr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma/ib_addr.h')
-rw-r--r--include/rdma/ib_addr.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index fde33ac6b58a..11528591d0d7 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -47,6 +47,7 @@
47#include <rdma/ib_verbs.h> 47#include <rdma/ib_verbs.h>
48#include <rdma/ib_pack.h> 48#include <rdma/ib_pack.h>
49#include <net/ipv6.h> 49#include <net/ipv6.h>
50#include <net/net_namespace.h>
50 51
51struct rdma_addr_client { 52struct rdma_addr_client {
52 atomic_t refcount; 53 atomic_t refcount;
@@ -64,6 +65,16 @@ void rdma_addr_register_client(struct rdma_addr_client *client);
64 */ 65 */
65void rdma_addr_unregister_client(struct rdma_addr_client *client); 66void rdma_addr_unregister_client(struct rdma_addr_client *client);
66 67
68/**
69 * struct rdma_dev_addr - Contains resolved RDMA hardware addresses
70 * @src_dev_addr: Source MAC address.
71 * @dst_dev_addr: Destination MAC address.
72 * @broadcast: Broadcast address of the device.
73 * @dev_type: The interface hardware type of the device.
74 * @bound_dev_if: An optional device interface index.
75 * @transport: The transport type used.
76 * @net: Network namespace containing the bound_dev_if net_dev.
77 */
67struct rdma_dev_addr { 78struct rdma_dev_addr {
68 unsigned char src_dev_addr[MAX_ADDR_LEN]; 79 unsigned char src_dev_addr[MAX_ADDR_LEN];
69 unsigned char dst_dev_addr[MAX_ADDR_LEN]; 80 unsigned char dst_dev_addr[MAX_ADDR_LEN];
@@ -71,11 +82,14 @@ struct rdma_dev_addr {
71 unsigned short dev_type; 82 unsigned short dev_type;
72 int bound_dev_if; 83 int bound_dev_if;
73 enum rdma_transport_type transport; 84 enum rdma_transport_type transport;
85 struct net *net;
74}; 86};
75 87
76/** 88/**
77 * rdma_translate_ip - Translate a local IP address to an RDMA hardware 89 * rdma_translate_ip - Translate a local IP address to an RDMA hardware
78 * address. 90 * address.
91 *
92 * The dev_addr->net field must be initialized.
79 */ 93 */
80int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr, 94int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr,
81 u16 *vlan_id); 95 u16 *vlan_id);
@@ -90,7 +104,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr,
90 * @dst_addr: The destination address to resolve. 104 * @dst_addr: The destination address to resolve.
91 * @addr: A reference to a data location that will receive the resolved 105 * @addr: A reference to a data location that will receive the resolved
92 * addresses. The data location must remain valid until the callback has 106 * addresses. The data location must remain valid until the callback has
93 * been invoked. 107 * been invoked. The net field of the addr struct must be valid.
94 * @timeout_ms: Amount of time to wait for the address resolution to complete. 108 * @timeout_ms: Amount of time to wait for the address resolution to complete.
95 * @callback: Call invoked once address resolution has completed, timed out, 109 * @callback: Call invoked once address resolution has completed, timed out,
96 * or been canceled. A status of 0 indicates success. 110 * or been canceled. A status of 0 indicates success.
@@ -112,7 +126,7 @@ int rdma_addr_size(struct sockaddr *addr);
112 126
113int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id); 127int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id);
114int rdma_addr_find_dmac_by_grh(const union ib_gid *sgid, const union ib_gid *dgid, 128int rdma_addr_find_dmac_by_grh(const union ib_gid *sgid, const union ib_gid *dgid,
115 u8 *smac, u16 *vlan_id); 129 u8 *smac, u16 *vlan_id, int if_index);
116 130
117static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr) 131static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
118{ 132{