Skip to content

Commit a2bfd70

Browse files
Steve Wisejgunthorpe
authored andcommitted
RDMA/iwpm: move kdoc comments to functions
Move the iwpm kdoc comments from the prototype declarations to above the function bodies. There are no functional changes in this patch. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
1 parent a78e872 commit a2bfd70

3 files changed

Lines changed: 123 additions & 182 deletions

File tree

‎drivers/infiniband/core/iwpm_msg.c‎

Lines changed: 83 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,21 @@ u16 iwpm_ulib_version = IWPM_UABI_VERSION_MIN;
3838
static int iwpm_user_pid = IWPM_PID_UNDEFINED;
3939
static atomic_t echo_nlmsg_seq;
4040

41+
/**
42+
* iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
43+
*
44+
* Returns true if the pid is greater than zero, otherwise returns false
45+
*/
4146
int iwpm_valid_pid(void)
4247
{
4348
return iwpm_user_pid > 0;
4449
}
4550

46-
/*
47-
* iwpm_register_pid - Send a netlink query to user space
48-
* for the iwarp port mapper pid
51+
/**
52+
* iwpm_register_pid - Send a netlink query to userspace
53+
* to get the iwarp port mapper pid
54+
* @pm_msg: Contains driver info to send to the userspace port mapper
55+
* @nl_client: The index of the netlink client
4956
*
5057
* nlmsg attributes:
5158
* [IWPM_NLA_REG_PID_SEQ]
@@ -124,13 +131,19 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
124131
return ret;
125132
}
126133

127-
/*
128-
* iwpm_add_mapping - Send a netlink add mapping message
129-
* to the port mapper
134+
/**
135+
* iwpm_add_mapping - Send a netlink add mapping request to
136+
* the userspace port mapper
137+
* @pm_msg: Contains the local ip/tcp address info to send
138+
* @nl_client: The index of the netlink client
139+
*
130140
* nlmsg attributes:
131141
* [IWPM_NLA_MANAGE_MAPPING_SEQ]
132142
* [IWPM_NLA_MANAGE_ADDR]
133143
* [IWPM_NLA_MANAGE_FLAGS]
144+
*
145+
* If the request is successful, the pm_msg stores
146+
* the port mapper response (mapped address info)
134147
*/
135148
int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
136149
{
@@ -208,9 +221,12 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
208221
return ret;
209222
}
210223

211-
/*
212-
* iwpm_add_and_query_mapping - Send a netlink add and query
213-
* mapping message to the port mapper
224+
/**
225+
* iwpm_add_and_query_mapping - Process the port mapper response to
226+
* iwpm_add_and_query_mapping request
227+
* @pm_msg: Contains the local ip/tcp address info to send
228+
* @nl_client: The index of the netlink client
229+
*
214230
* nlmsg attributes:
215231
* [IWPM_NLA_QUERY_MAPPING_SEQ]
216232
* [IWPM_NLA_QUERY_LOCAL_ADDR]
@@ -299,9 +315,13 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
299315
return ret;
300316
}
301317

302-
/*
303-
* iwpm_remove_mapping - Send a netlink remove mapping message
304-
* to the port mapper
318+
/**
319+
* iwpm_remove_mapping - Send a netlink remove mapping request
320+
* to the userspace port mapper
321+
*
322+
* @local_addr: Local ip/tcp address to remove
323+
* @nl_client: The index of the netlink client
324+
*
305325
* nlmsg attributes:
306326
* [IWPM_NLA_MANAGE_MAPPING_SEQ]
307327
* [IWPM_NLA_MANAGE_ADDR]
@@ -372,9 +392,14 @@ static const struct nla_policy resp_reg_policy[IWPM_NLA_RREG_PID_MAX] = {
372392
[IWPM_NLA_RREG_PID_ERR] = { .type = NLA_U16 }
373393
};
374394

375-
/*
376-
* iwpm_register_pid_cb - Process a port mapper response to
377-
* iwpm_register_pid()
395+
/**
396+
* iwpm_register_pid_cb - Process the port mapper response to
397+
* iwpm_register_pid query
398+
* @skb:
399+
* @cb: Contains the received message (payload and netlink header)
400+
*
401+
* If successful, the function receives the userspace port mapper pid
402+
* which is used in future communication with the port mapper
378403
*/
379404
int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb)
380405
{
@@ -443,9 +468,11 @@ static const struct nla_policy resp_add_policy[IWPM_NLA_RMANAGE_MAPPING_MAX] = {
443468
[IWPM_NLA_RMANAGE_MAPPING_ERR] = { .type = NLA_U16 }
444469
};
445470

446-
/*
447-
* iwpm_add_mapping_cb - Process a port mapper response to
448-
* iwpm_add_mapping()
471+
/**
472+
* iwpm_add_mapping_cb - Process the port mapper response to
473+
* iwpm_add_mapping request
474+
* @skb:
475+
* @cb: Contains the received message (payload and netlink header)
449476
*/
450477
int iwpm_add_mapping_cb(struct sk_buff *skb, struct netlink_callback *cb)
451478
{
@@ -518,9 +545,11 @@ static const struct nla_policy resp_query_policy[IWPM_NLA_RQUERY_MAPPING_MAX] =
518545
[IWPM_NLA_RQUERY_MAPPING_ERR] = { .type = NLA_U16 }
519546
};
520547

521-
/*
522-
* iwpm_add_and_query_mapping_cb - Process a port mapper response to
523-
* iwpm_add_and_query_mapping()
548+
/**
549+
* iwpm_add_and_query_mapping_cb - Process the port mapper response to
550+
* iwpm_add_and_query_mapping request
551+
* @skb:
552+
* @cb: Contains the received message (payload and netlink header)
524553
*/
525554
int iwpm_add_and_query_mapping_cb(struct sk_buff *skb,
526555
struct netlink_callback *cb)
@@ -598,9 +627,13 @@ int iwpm_add_and_query_mapping_cb(struct sk_buff *skb,
598627
return 0;
599628
}
600629

601-
/*
602-
* iwpm_remote_info_cb - Process a port mapper message, containing
603-
* the remote connecting peer address info
630+
/**
631+
* iwpm_remote_info_cb - Process remote connecting peer address info, which
632+
* the port mapper has received from the connecting peer
633+
* @skb:
634+
* @cb: Contains the received message (payload and netlink header)
635+
*
636+
* Stores the IPv4/IPv6 address info in a hash table
604637
*/
605638
int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
606639
{
@@ -673,8 +706,14 @@ static const struct nla_policy resp_mapinfo_policy[IWPM_NLA_MAPINFO_REQ_MAX] = {
673706
[IWPM_NLA_MAPINFO_ULIB_VER] = { .type = NLA_U16 }
674707
};
675708

676-
/*
677-
* iwpm_mapping_info_cb - Process a port mapper request for mapping info
709+
/**
710+
* iwpm_mapping_info_cb - Process a notification that the userspace
711+
* port mapper daemon is started
712+
* @skb:
713+
* @cb: Contains the received message (payload and netlink header)
714+
*
715+
* Using the received port mapper pid, send all the local mapping
716+
* info records to the userspace port mapper
678717
*/
679718
int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
680719
{
@@ -727,9 +766,11 @@ static const struct nla_policy ack_mapinfo_policy[IWPM_NLA_MAPINFO_NUM_MAX] = {
727766
[IWPM_NLA_MAPINFO_ACK_NUM] = { .type = NLA_U32 }
728767
};
729768

730-
/*
731-
* iwpm_ack_mapping_info_cb - Process a port mapper ack for
732-
* the provided mapping info records
769+
/**
770+
* iwpm_ack_mapping_info_cb - Process the port mapper ack for
771+
* the provided local mapping info records
772+
* @skb:
773+
* @cb: Contains the received message (payload and netlink header)
733774
*/
734775
int iwpm_ack_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
735776
{
@@ -755,8 +796,11 @@ static const struct nla_policy map_error_policy[IWPM_NLA_ERR_MAX] = {
755796
[IWPM_NLA_ERR_CODE] = { .type = NLA_U16 },
756797
};
757798

758-
/*
759-
* iwpm_mapping_error_cb - Process a port mapper error message
799+
/**
800+
* iwpm_mapping_error_cb - Process port mapper notification for error
801+
*
802+
* @skb:
803+
* @cb: Contains the received message (payload and netlink header)
760804
*/
761805
int iwpm_mapping_error_cb(struct sk_buff *skb, struct netlink_callback *cb)
762806
{
@@ -797,8 +841,14 @@ static const struct nla_policy hello_policy[IWPM_NLA_HELLO_MAX] = {
797841
[IWPM_NLA_HELLO_ABI_VERSION] = { .type = NLA_U16 }
798842
};
799843

800-
/*
801-
* iwpm_hello_cb - Process a port mapper hello request
844+
/**
845+
* iwpm_hello_cb - Process a hello message from iwpmd
846+
*
847+
* @skb:
848+
* @cb: Contains the received message (payload and netlink header)
849+
*
850+
* Using the received port mapper pid, send the kernel's abi_version
851+
* after adjusting it to support the iwpmd version.
802852
*/
803853
int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb)
804854
{

‎drivers/infiniband/core/iwpm_util.c‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ static DEFINE_SPINLOCK(iwpm_reminfo_lock);
5151
static DEFINE_MUTEX(iwpm_admin_lock);
5252
static struct iwpm_admin_data iwpm_admin;
5353

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+
*/
5460
int iwpm_init(u8 nl_client)
5561
{
5662
int ret = 0;
@@ -87,6 +93,12 @@ int iwpm_init(u8 nl_client)
8793
static void free_hash_bucket(void);
8894
static void free_reminfo_bucket(void);
8995

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+
*/
90102
int iwpm_exit(u8 nl_client)
91103
{
92104

@@ -112,6 +124,14 @@ int iwpm_exit(u8 nl_client)
112124
static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage *,
113125
struct sockaddr_storage *);
114126

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+
*/
115135
int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
116136
struct sockaddr_storage *mapped_sockaddr,
117137
u8 nl_client, u32 map_flags)
@@ -151,6 +171,15 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
151171
return ret;
152172
}
153173

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+
*/
154183
int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr,
155184
struct sockaddr_storage *mapped_local_addr)
156185
{
@@ -251,6 +280,17 @@ void iwpm_add_remote_info(struct iwpm_remote_info *rem_info)
251280
spin_unlock_irqrestore(&iwpm_reminfo_lock, flags);
252281
}
253282

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+
*/
254294
int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
255295
struct sockaddr_storage *mapped_rem_addr,
256296
struct sockaddr_storage *remote_addr,

0 commit comments

Comments
 (0)