Commit a2bfd708 authored by Steve Wise's avatar Steve Wise Committed by Jason Gunthorpe

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: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent a78e8723
...@@ -38,14 +38,21 @@ u16 iwpm_ulib_version = IWPM_UABI_VERSION_MIN; ...@@ -38,14 +38,21 @@ u16 iwpm_ulib_version = IWPM_UABI_VERSION_MIN;
static int iwpm_user_pid = IWPM_PID_UNDEFINED; static int iwpm_user_pid = IWPM_PID_UNDEFINED;
static atomic_t echo_nlmsg_seq; static atomic_t echo_nlmsg_seq;
/**
* iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
*
* Returns true if the pid is greater than zero, otherwise returns false
*/
int iwpm_valid_pid(void) int iwpm_valid_pid(void)
{ {
return iwpm_user_pid > 0; return iwpm_user_pid > 0;
} }
/* /**
* iwpm_register_pid - Send a netlink query to user space * iwpm_register_pid - Send a netlink query to userspace
* for the iwarp port mapper pid * to get the iwarp port mapper pid
* @pm_msg: Contains driver info to send to the userspace port mapper
* @nl_client: The index of the netlink client
* *
* nlmsg attributes: * nlmsg attributes:
* [IWPM_NLA_REG_PID_SEQ] * [IWPM_NLA_REG_PID_SEQ]
...@@ -124,13 +131,19 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) ...@@ -124,13 +131,19 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
return ret; return ret;
} }
/* /**
* iwpm_add_mapping - Send a netlink add mapping message * iwpm_add_mapping - Send a netlink add mapping request to
* to the port mapper * the userspace port mapper
* @pm_msg: Contains the local ip/tcp address info to send
* @nl_client: The index of the netlink client
*
* nlmsg attributes: * nlmsg attributes:
* [IWPM_NLA_MANAGE_MAPPING_SEQ] * [IWPM_NLA_MANAGE_MAPPING_SEQ]
* [IWPM_NLA_MANAGE_ADDR] * [IWPM_NLA_MANAGE_ADDR]
* [IWPM_NLA_MANAGE_FLAGS] * [IWPM_NLA_MANAGE_FLAGS]
*
* If the request is successful, the pm_msg stores
* the port mapper response (mapped address info)
*/ */
int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
{ {
...@@ -208,9 +221,12 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) ...@@ -208,9 +221,12 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
return ret; return ret;
} }
/* /**
* iwpm_add_and_query_mapping - Send a netlink add and query * iwpm_add_and_query_mapping - Process the port mapper response to
* mapping message to the port mapper * iwpm_add_and_query_mapping request
* @pm_msg: Contains the local ip/tcp address info to send
* @nl_client: The index of the netlink client
*
* nlmsg attributes: * nlmsg attributes:
* [IWPM_NLA_QUERY_MAPPING_SEQ] * [IWPM_NLA_QUERY_MAPPING_SEQ]
* [IWPM_NLA_QUERY_LOCAL_ADDR] * [IWPM_NLA_QUERY_LOCAL_ADDR]
...@@ -299,9 +315,13 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) ...@@ -299,9 +315,13 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
return ret; return ret;
} }
/* /**
* iwpm_remove_mapping - Send a netlink remove mapping message * iwpm_remove_mapping - Send a netlink remove mapping request
* to the port mapper * to the userspace port mapper
*
* @local_addr: Local ip/tcp address to remove
* @nl_client: The index of the netlink client
*
* nlmsg attributes: * nlmsg attributes:
* [IWPM_NLA_MANAGE_MAPPING_SEQ] * [IWPM_NLA_MANAGE_MAPPING_SEQ]
* [IWPM_NLA_MANAGE_ADDR] * [IWPM_NLA_MANAGE_ADDR]
...@@ -372,9 +392,14 @@ static const struct nla_policy resp_reg_policy[IWPM_NLA_RREG_PID_MAX] = { ...@@ -372,9 +392,14 @@ static const struct nla_policy resp_reg_policy[IWPM_NLA_RREG_PID_MAX] = {
[IWPM_NLA_RREG_PID_ERR] = { .type = NLA_U16 } [IWPM_NLA_RREG_PID_ERR] = { .type = NLA_U16 }
}; };
/* /**
* iwpm_register_pid_cb - Process a port mapper response to * iwpm_register_pid_cb - Process the port mapper response to
* iwpm_register_pid() * iwpm_register_pid query
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* If successful, the function receives the userspace port mapper pid
* which is used in future communication with the port mapper
*/ */
int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
...@@ -443,9 +468,11 @@ static const struct nla_policy resp_add_policy[IWPM_NLA_RMANAGE_MAPPING_MAX] = { ...@@ -443,9 +468,11 @@ static const struct nla_policy resp_add_policy[IWPM_NLA_RMANAGE_MAPPING_MAX] = {
[IWPM_NLA_RMANAGE_MAPPING_ERR] = { .type = NLA_U16 } [IWPM_NLA_RMANAGE_MAPPING_ERR] = { .type = NLA_U16 }
}; };
/* /**
* iwpm_add_mapping_cb - Process a port mapper response to * iwpm_add_mapping_cb - Process the port mapper response to
* iwpm_add_mapping() * iwpm_add_mapping request
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/ */
int iwpm_add_mapping_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_add_mapping_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
...@@ -518,9 +545,11 @@ static const struct nla_policy resp_query_policy[IWPM_NLA_RQUERY_MAPPING_MAX] = ...@@ -518,9 +545,11 @@ static const struct nla_policy resp_query_policy[IWPM_NLA_RQUERY_MAPPING_MAX] =
[IWPM_NLA_RQUERY_MAPPING_ERR] = { .type = NLA_U16 } [IWPM_NLA_RQUERY_MAPPING_ERR] = { .type = NLA_U16 }
}; };
/* /**
* iwpm_add_and_query_mapping_cb - Process a port mapper response to * iwpm_add_and_query_mapping_cb - Process the port mapper response to
* iwpm_add_and_query_mapping() * iwpm_add_and_query_mapping request
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/ */
int iwpm_add_and_query_mapping_cb(struct sk_buff *skb, int iwpm_add_and_query_mapping_cb(struct sk_buff *skb,
struct netlink_callback *cb) struct netlink_callback *cb)
...@@ -598,9 +627,13 @@ int iwpm_add_and_query_mapping_cb(struct sk_buff *skb, ...@@ -598,9 +627,13 @@ int iwpm_add_and_query_mapping_cb(struct sk_buff *skb,
return 0; return 0;
} }
/* /**
* iwpm_remote_info_cb - Process a port mapper message, containing * iwpm_remote_info_cb - Process remote connecting peer address info, which
* the remote connecting peer address info * the port mapper has received from the connecting peer
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* Stores the IPv4/IPv6 address info in a hash table
*/ */
int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
...@@ -673,8 +706,14 @@ static const struct nla_policy resp_mapinfo_policy[IWPM_NLA_MAPINFO_REQ_MAX] = { ...@@ -673,8 +706,14 @@ static const struct nla_policy resp_mapinfo_policy[IWPM_NLA_MAPINFO_REQ_MAX] = {
[IWPM_NLA_MAPINFO_ULIB_VER] = { .type = NLA_U16 } [IWPM_NLA_MAPINFO_ULIB_VER] = { .type = NLA_U16 }
}; };
/* /**
* iwpm_mapping_info_cb - Process a port mapper request for mapping info * iwpm_mapping_info_cb - Process a notification that the userspace
* port mapper daemon is started
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* Using the received port mapper pid, send all the local mapping
* info records to the userspace port mapper
*/ */
int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
...@@ -727,9 +766,11 @@ static const struct nla_policy ack_mapinfo_policy[IWPM_NLA_MAPINFO_NUM_MAX] = { ...@@ -727,9 +766,11 @@ static const struct nla_policy ack_mapinfo_policy[IWPM_NLA_MAPINFO_NUM_MAX] = {
[IWPM_NLA_MAPINFO_ACK_NUM] = { .type = NLA_U32 } [IWPM_NLA_MAPINFO_ACK_NUM] = { .type = NLA_U32 }
}; };
/* /**
* iwpm_ack_mapping_info_cb - Process a port mapper ack for * iwpm_ack_mapping_info_cb - Process the port mapper ack for
* the provided mapping info records * the provided local mapping info records
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/ */
int iwpm_ack_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_ack_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
...@@ -755,8 +796,11 @@ static const struct nla_policy map_error_policy[IWPM_NLA_ERR_MAX] = { ...@@ -755,8 +796,11 @@ static const struct nla_policy map_error_policy[IWPM_NLA_ERR_MAX] = {
[IWPM_NLA_ERR_CODE] = { .type = NLA_U16 }, [IWPM_NLA_ERR_CODE] = { .type = NLA_U16 },
}; };
/* /**
* iwpm_mapping_error_cb - Process a port mapper error message * iwpm_mapping_error_cb - Process port mapper notification for error
*
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/ */
int iwpm_mapping_error_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_mapping_error_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
...@@ -797,8 +841,14 @@ static const struct nla_policy hello_policy[IWPM_NLA_HELLO_MAX] = { ...@@ -797,8 +841,14 @@ static const struct nla_policy hello_policy[IWPM_NLA_HELLO_MAX] = {
[IWPM_NLA_HELLO_ABI_VERSION] = { .type = NLA_U16 } [IWPM_NLA_HELLO_ABI_VERSION] = { .type = NLA_U16 }
}; };
/* /**
* iwpm_hello_cb - Process a port mapper hello request * iwpm_hello_cb - Process a hello message from iwpmd
*
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* Using the received port mapper pid, send the kernel's abi_version
* after adjusting it to support the iwpmd version.
*/ */
int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb) int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb)
{ {
......
...@@ -51,6 +51,12 @@ static DEFINE_SPINLOCK(iwpm_reminfo_lock); ...@@ -51,6 +51,12 @@ static DEFINE_SPINLOCK(iwpm_reminfo_lock);
static DEFINE_MUTEX(iwpm_admin_lock); static DEFINE_MUTEX(iwpm_admin_lock);
static struct iwpm_admin_data iwpm_admin; static struct iwpm_admin_data iwpm_admin;
/**
* iwpm_init - Allocate resources for the iwarp port mapper
* @nl_client: The index of the netlink client
*
* Should be called when network interface goes up.
*/
int iwpm_init(u8 nl_client) int iwpm_init(u8 nl_client)
{ {
int ret = 0; int ret = 0;
...@@ -87,6 +93,12 @@ int iwpm_init(u8 nl_client) ...@@ -87,6 +93,12 @@ int iwpm_init(u8 nl_client)
static void free_hash_bucket(void); static void free_hash_bucket(void);
static void free_reminfo_bucket(void); static void free_reminfo_bucket(void);
/**
* iwpm_exit - Deallocate resources for the iwarp port mapper
* @nl_client: The index of the netlink client
*
* Should be called when network interface goes down.
*/
int iwpm_exit(u8 nl_client) int iwpm_exit(u8 nl_client)
{ {
...@@ -112,6 +124,14 @@ int iwpm_exit(u8 nl_client) ...@@ -112,6 +124,14 @@ int iwpm_exit(u8 nl_client)
static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage *, static struct hlist_head *get_mapinfo_hash_bucket(struct sockaddr_storage *,
struct sockaddr_storage *); struct sockaddr_storage *);
/**
* iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
* info in a hash table
* @local_addr: Local ip/tcp address
* @mapped_addr: Mapped local ip/tcp address
* @nl_client: The index of the netlink client
* @map_flags: IWPM mapping flags
*/
int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr, int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
struct sockaddr_storage *mapped_sockaddr, struct sockaddr_storage *mapped_sockaddr,
u8 nl_client, u32 map_flags) u8 nl_client, u32 map_flags)
...@@ -151,6 +171,15 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr, ...@@ -151,6 +171,15 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
return ret; return ret;
} }
/**
* iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
* info from the hash table
* @local_addr: Local ip/tcp address
* @mapped_local_addr: Mapped local ip/tcp address
*
* Returns err code if mapping info is not found in the hash table,
* otherwise returns 0
*/
int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr, int iwpm_remove_mapinfo(struct sockaddr_storage *local_sockaddr,
struct sockaddr_storage *mapped_local_addr) struct sockaddr_storage *mapped_local_addr)
{ {
...@@ -251,6 +280,17 @@ void iwpm_add_remote_info(struct iwpm_remote_info *rem_info) ...@@ -251,6 +280,17 @@ void iwpm_add_remote_info(struct iwpm_remote_info *rem_info)
spin_unlock_irqrestore(&iwpm_reminfo_lock, flags); spin_unlock_irqrestore(&iwpm_reminfo_lock, flags);
} }
/**
* iwpm_get_remote_info - Get the remote connecting peer address info
*
* @mapped_loc_addr: Mapped local address of the listening peer
* @mapped_rem_addr: Mapped remote address of the connecting peer
* @remote_addr: To store the remote address of the connecting peer
* @nl_client: The index of the netlink client
*
* The remote address info is retrieved and provided to the client in
* the remote_addr. After that it is removed from the hash table
*/
int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr, int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
struct sockaddr_storage *mapped_rem_addr, struct sockaddr_storage *mapped_rem_addr,
struct sockaddr_storage *remote_addr, struct sockaddr_storage *remote_addr,
......
...@@ -61,177 +61,28 @@ struct iwpm_sa_data { ...@@ -61,177 +61,28 @@ struct iwpm_sa_data {
u32 flags; u32 flags;
}; };
/**
* iwpm_init - Allocate resources for the iwarp port mapper
*
* Should be called when network interface goes up.
*/
int iwpm_init(u8); int iwpm_init(u8);
/**
* iwpm_exit - Deallocate resources for the iwarp port mapper
*
* Should be called when network interface goes down.
*/
int iwpm_exit(u8); int iwpm_exit(u8);
/**
* iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
*
* Returns true if the pid is greater than zero, otherwise returns false
*/
int iwpm_valid_pid(void); int iwpm_valid_pid(void);
/**
* iwpm_register_pid - Send a netlink query to userspace
* to get the iwarp port mapper pid
* @pm_msg: Contains driver info to send to the userspace port mapper
* @nl_client: The index of the netlink client
*/
int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client); int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client);
/**
* iwpm_add_mapping - Send a netlink add mapping request to
* the userspace port mapper
* @pm_msg: Contains the local ip/tcp address info to send
* @nl_client: The index of the netlink client
*
* If the request is successful, the pm_msg stores
* the port mapper response (mapped address info)
*/
int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client); int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
/**
* iwpm_add_and_query_mapping - Send a netlink add and query mapping request
* to the userspace port mapper
* @pm_msg: Contains the local and remote ip/tcp address info to send
* @nl_client: The index of the netlink client
*
* If the request is successful, the pm_msg stores the
* port mapper response (mapped local and remote address info)
*/
int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client); int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
/**
* iwpm_remove_mapping - Send a netlink remove mapping request
* to the userspace port mapper
*
* @local_addr: Local ip/tcp address to remove
* @nl_client: The index of the netlink client
*/
int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client); int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client);
/**
* iwpm_register_pid_cb - Process the port mapper response to
* iwpm_register_pid query
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* If successful, the function receives the userspace port mapper pid
* which is used in future communication with the port mapper
*/
int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *); int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_add_mapping_cb - Process the port mapper response to
* iwpm_add_mapping request
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/
int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *); int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_add_and_query_mapping_cb - Process the port mapper response to
* iwpm_add_and_query_mapping request
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/
int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *); int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_remote_info_cb - Process remote connecting peer address info, which
* the port mapper has received from the connecting peer
*
* @cb: Contains the received message (payload and netlink header)
*
* Stores the IPv4/IPv6 address info in a hash table
*/
int iwpm_remote_info_cb(struct sk_buff *, struct netlink_callback *); int iwpm_remote_info_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_mapping_error_cb - Process port mapper notification for error
*
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/
int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *); int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_mapping_info_cb - Process a notification that the userspace
* port mapper daemon is started
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* Using the received port mapper pid, send all the local mapping
* info records to the userspace port mapper
*/
int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *); int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_ack_mapping_info_cb - Process the port mapper ack for
* the provided local mapping info records
* @skb:
* @cb: Contains the received message (payload and netlink header)
*/
int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *); int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
/**
* iwpm_get_remote_info - Get the remote connecting peer address info
*
* @mapped_loc_addr: Mapped local address of the listening peer
* @mapped_rem_addr: Mapped remote address of the connecting peer
* @remote_addr: To store the remote address of the connecting peer
* @nl_client: The index of the netlink client
*
* The remote address info is retrieved and provided to the client in
* the remote_addr. After that it is removed from the hash table
*/
int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr, int iwpm_get_remote_info(struct sockaddr_storage *mapped_loc_addr,
struct sockaddr_storage *mapped_rem_addr, struct sockaddr_storage *mapped_rem_addr,
struct sockaddr_storage *remote_addr, u8 nl_client); struct sockaddr_storage *remote_addr, u8 nl_client);
/**
* iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
* info in a hash table
* @local_addr: Local ip/tcp address
* @mapped_addr: Mapped local ip/tcp address
* @nl_client: The index of the netlink client
* @map_flags: IWPM mapping flags
*/
int iwpm_create_mapinfo(struct sockaddr_storage *local_addr, int iwpm_create_mapinfo(struct sockaddr_storage *local_addr,
struct sockaddr_storage *mapped_addr, u8 nl_client, struct sockaddr_storage *mapped_addr, u8 nl_client,
u32 map_flags); u32 map_flags);
/**
* iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
* info from the hash table
* @local_addr: Local ip/tcp address
* @mapped_addr: Mapped local ip/tcp address
*
* Returns err code if mapping info is not found in the hash table,
* otherwise returns 0
*/
int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr, int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr,
struct sockaddr_storage *mapped_addr); struct sockaddr_storage *mapped_addr);
/**
* iwpm_hello_cb - Process a hello message from iwpmd
*
* @skb:
* @cb: Contains the received message (payload and netlink header)
*
* Using the received port mapper pid, send the kernel's abi_version
* after adjusting it to support the iwpmd version.
*/
int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb); int iwpm_hello_cb(struct sk_buff *skb, struct netlink_callback *cb);
#endif /* _IW_PORTMAP_H */ #endif /* _IW_PORTMAP_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment