Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9047811b authored by Ismail, Mustafa's avatar Ismail, Mustafa Committed by Leon Romanovsky
Browse files

RDMA/core: Add wait/retry version of ibnl_unicast



Add a wait/retry version of ibnl_unicast, ibnl_unicast_wait,
and modify ibnl_unicast to not wait/retry.  This eliminates
the undesirable wait for future users of ibnl_unicast.

Change Portmapper calls originating from kernel to user-space
to use ibnl_unicast_wait and take advantage of the wait/retry
logic in netlink_unicast.

Signed-off-by: default avatarMustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: default avatarChien Tin Tung <chien.tin.tung@intel.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 913cc671
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -174,7 +174,7 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
		goto add_mapping_error;
		goto add_mapping_error;
	nlmsg_request->req_buffer = pm_msg;
	nlmsg_request->req_buffer = pm_msg;


	ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
	ret = ibnl_unicast_wait(skb, nlh, iwpm_user_pid);
	if (ret) {
	if (ret) {
		skb = NULL; /* skb is freed in the netlink send-op handling */
		skb = NULL; /* skb is freed in the netlink send-op handling */
		iwpm_user_pid = IWPM_PID_UNDEFINED;
		iwpm_user_pid = IWPM_PID_UNDEFINED;
@@ -251,7 +251,7 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
		goto query_mapping_error;
		goto query_mapping_error;
	nlmsg_request->req_buffer = pm_msg;
	nlmsg_request->req_buffer = pm_msg;


	ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
	ret = ibnl_unicast_wait(skb, nlh, iwpm_user_pid);
	if (ret) {
	if (ret) {
		skb = NULL; /* skb is freed in the netlink send-op handling */
		skb = NULL; /* skb is freed in the netlink send-op handling */
		err_str = "Unable to send a nlmsg";
		err_str = "Unable to send a nlmsg";
@@ -312,7 +312,7 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)
	if (ret)
	if (ret)
		goto remove_mapping_error;
		goto remove_mapping_error;


	ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
	ret = ibnl_unicast_wait(skb, nlh, iwpm_user_pid);
	if (ret) {
	if (ret) {
		skb = NULL; /* skb is freed in the netlink send-op handling */
		skb = NULL; /* skb is freed in the netlink send-op handling */
		iwpm_user_pid = IWPM_PID_UNDEFINED;
		iwpm_user_pid = IWPM_PID_UNDEFINED;
+11 −1
Original line number Original line Diff line number Diff line
@@ -232,11 +232,21 @@ int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
{
{
	int err;
	int err;


	err = netlink_unicast(nls, skb, pid, 0);
	err = netlink_unicast(nls, skb, pid, MSG_DONTWAIT);
	return (err < 0) ? err : 0;
	return (err < 0) ? err : 0;
}
}
EXPORT_SYMBOL(ibnl_unicast);
EXPORT_SYMBOL(ibnl_unicast);


int ibnl_unicast_wait(struct sk_buff *skb, struct nlmsghdr *nlh,
		      __u32 pid)
{
	int err;

	err = netlink_unicast(nls, skb, pid, 0);
	return (err < 0) ? err : 0;
}
EXPORT_SYMBOL(ibnl_unicast_wait);

int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
			unsigned int group, gfp_t flags)
			unsigned int group, gfp_t flags)
{
{
+10 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,16 @@ int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
			__u32 pid);
			__u32 pid);


/**
 * Send, with wait/1 retry, the supplied skb to a specific userspace PID.
 * @skb: The netlink skb
 * @nlh: Header of the netlink message to send
 * @pid: Userspace netlink process ID
 * Returns 0 on success or a negative error code.
 */
int ibnl_unicast_wait(struct sk_buff *skb, struct nlmsghdr *nlh,
		      __u32 pid);

/**
/**
 * Send the supplied skb to a netlink group.
 * Send the supplied skb to a netlink group.
 * @skb: The netlink skb
 * @skb: The netlink skb