@@ -38,14 +38,21 @@ u16 iwpm_ulib_version = IWPM_UABI_VERSION_MIN;
3838static int iwpm_user_pid = IWPM_PID_UNDEFINED ;
3939static 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+ */
4146int 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 */
135148int 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 */
379404int 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 */
450477int 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 */
525554int 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 */
605638int 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 */
679718int 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 */
734775int 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 */
761805int 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 */
803853int iwpm_hello_cb (struct sk_buff * skb , struct netlink_callback * cb )
804854{
0 commit comments