aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/iwpm_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/iwpm_util.c')
-rw-r--r--drivers/infiniband/core/iwpm_util.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 363938435476..7b97f6e2075f 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -51,6 +51,12 @@ static DEFINE_SPINLOCK(iwpm_reminfo_lock);
51static DEFINE_MUTEX(iwpm_admin_lock); 51static DEFINE_MUTEX(iwpm_admin_lock);
52static struct iwpm_admin_data iwpm_admin; 52static struct iwpm_admin_data iwpm_admin;
53 53
54/**
55 * iwpm_init - Allocate resources for the iwarp port mapper
56 * @nl_client: The index of the netlink client
57 *
58 * Should be called when network interface goes up.
59 */
54int iwpm_init(u8 nl_client) 60int iwpm_init(u8 nl_client)
55{ 61{
56 int ret = 0; 62 int ret = 0;
@@ -87,6 +93,12 @@ init_exit:
87static void free_hash_bucket(void); 93static void free_hash_bucket(void);
88static void free_reminfo_bucket(void); 94static void free_reminfo_bucket(void);
89 95
96/**
97 * iwpm_exit - Deallocate resources for the iwarp port mapper
98 * @nl_client: The index of the netlink client
99 *
100 * Should be called when network interface goes down.
101 */
90int iwpm_exit(u8 nl_client) 102int iwpm_exit(u8 nl_client)
91{ 103{
92 104
@@ -112,6 +124,14 @@ int iwpm_exit(u8 nl_client)
112static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage *, 124static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage *,
113 struct sockaddr_storage *); 125 struct sockaddr_storage *);
114 126
127/**
128 * iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
129 * info in a hash table
130 * @local_addr: Local ip/tcp address
131 * @mapped_addr: Mapped local ip/tcp address
132 * @nl_client: The index of the netlink client
133 * @map_flags: IWPM mapping flags
134 */
115int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr, 135int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
116 struct sockaddr_storage *mapped_sockaddr, 136 struct sockaddr_storage *mapped_sockaddr,
117 u8 nl_client, u32 map_flags) 137 u8 nl_client, u32 map_flags)
@@ -151,6 +171,15 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
151 return ret; 171 return ret;
152} 172}
153 173
174/**
175 * iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
176 * info from the hash table
177 * @local_addr: Local ip/tcp address
178 * @mapped_local_addr: Mapped local ip/tcp address
179 *
180 * Returns err code if mapping info is not found in the hash table,
181 * otherwise returns 0
182 */
154int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr, 183int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr,
155 struct sockaddr_storage *mapped_local_addr) 184 struct sockaddr_storage *mapped_local_addr)
156{ 185{
@@ -251,6 +280,17 @@ void iwpm_add_remote_info(struct iwpm_remote_info *rem_info)
251 spin_unlock_irqrestore(&iwpm_reminfo_lock, flags); 280 spin_unlock_irqrestore(&iwpm_reminfo_lock, flags);
252} 281}
253 282
283/**
284 * iwpm_get_remote_info - Get the remote connecting peer address info
285 *
286 * @mapped_loc_addr: Mapped local address of the listening peer
287 * @mapped_rem_addr: Mapped remote address of the connecting peer
288 * @remote_addr: To store the remote address of the connecting peer
289 * @nl_client: The index of the netlink client
290 *
291 * The remote address info is retrieved and provided to the client in
292 * the remote_addr. After that it is removed from the hash table
293 */
254int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr, 294int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
255 struct sockaddr_storage *mapped_rem_addr, 295 struct sockaddr_storage *mapped_rem_addr,
256 struct sockaddr_storage *remote_addr, 296 struct sockaddr_storage *remote_addr,