Lines Matching +full:port +full:- +full:mapping
15 * - Redistributions of source code must retain the above
19 * - Redistributions in binary form must reproduce the above
42 * iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
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
70 int ret = -EINVAL; in iwpm_register_pid()
80 nlh->nlmsg_seq = iwpm_get_nlmsg_seq(); in iwpm_register_pid()
81 nlmsg_request = iwpm_get_nlmsg_request(nlh->nlmsg_seq, nl_client, GFP_KERNEL); in iwpm_register_pid()
94 pm_msg->if_name, IWPM_NLA_REG_IF_NAME); in iwpm_register_pid()
98 pm_msg->dev_name, IWPM_NLA_REG_IBDEV_NAME); in iwpm_register_pid()
109 __func__, pm_msg->dev_name, pm_msg->if_name, iwpm_ulib_name); in iwpm_register_pid()
113 skb = NULL; /* skb is freed in the netlink send-op handling */ in iwpm_register_pid()
118 nlmsg_request->req_buffer = pm_msg; in iwpm_register_pid()
125 iwpm_free_nlmsg_request(&nlmsg_request->kref); in iwpm_register_pid()
130 * iwpm_add_mapping - Send a netlink add mapping request to
131 * the userspace port mapper
141 * the port mapper response (mapped address info)
150 int ret = -EINVAL; in iwpm_add_mapping()
155 err_str = "Unregistered port mapper client"; in iwpm_add_mapping()
163 nlh->nlmsg_seq = iwpm_get_nlmsg_seq(); in iwpm_add_mapping()
164 nlmsg_request = iwpm_get_nlmsg_request(nlh->nlmsg_seq, nl_client, GFP_KERNEL); in iwpm_add_mapping()
170 /* fill in the add mapping message */ in iwpm_add_mapping()
177 &pm_msg->loc_addr, IWPM_NLA_MANAGE_ADDR); in iwpm_add_mapping()
182 if (pm_msg->flags && iwpm_ulib_version == IWPM_UABI_VERSION_MIN) { in iwpm_add_mapping()
183 ret = -EINVAL; in iwpm_add_mapping()
187 ret = ibnl_put_attr(skb, nlh, sizeof(u32), &pm_msg->flags, in iwpm_add_mapping()
194 nlmsg_request->req_buffer = pm_msg; in iwpm_add_mapping()
198 skb = NULL; /* skb is freed in the netlink send-op handling */ in iwpm_add_mapping()
210 iwpm_free_nlmsg_request(&nlmsg_request->kref); in iwpm_add_mapping()
215 * iwpm_add_and_query_mapping - Process the port mapper response to
233 int ret = -EINVAL; in iwpm_add_and_query_mapping()
238 err_str = "Unregistered port mapper client"; in iwpm_add_and_query_mapping()
241 ret = -ENOMEM; in iwpm_add_and_query_mapping()
247 nlh->nlmsg_seq = iwpm_get_nlmsg_seq(); in iwpm_add_and_query_mapping()
248 nlmsg_request = iwpm_get_nlmsg_request(nlh->nlmsg_seq, in iwpm_add_and_query_mapping()
263 &pm_msg->loc_addr, IWPM_NLA_QUERY_LOCAL_ADDR); in iwpm_add_and_query_mapping()
267 &pm_msg->rem_addr, IWPM_NLA_QUERY_REMOTE_ADDR); in iwpm_add_and_query_mapping()
272 if (pm_msg->flags && iwpm_ulib_version == IWPM_UABI_VERSION_MIN) { in iwpm_add_and_query_mapping()
273 ret = -EINVAL; in iwpm_add_and_query_mapping()
277 ret = ibnl_put_attr(skb, nlh, sizeof(u32), &pm_msg->flags, in iwpm_add_and_query_mapping()
284 nlmsg_request->req_buffer = pm_msg; in iwpm_add_and_query_mapping()
288 skb = NULL; /* skb is freed in the netlink send-op handling */ in iwpm_add_and_query_mapping()
299 iwpm_free_nlmsg_request(&nlmsg_request->kref); in iwpm_add_and_query_mapping()
304 * iwpm_remove_mapping - Send a netlink remove mapping request
305 * to the userspace port mapper
320 int ret = -EINVAL; in iwpm_remove_mapping()
325 err_str = "Unregistered port mapper client"; in iwpm_remove_mapping()
330 ret = -ENOMEM; in iwpm_remove_mapping()
335 nlh->nlmsg_seq = iwpm_get_nlmsg_seq(); in iwpm_remove_mapping()
350 skb = NULL; /* skb is freed in the netlink send-op handling */ in iwpm_remove_mapping()
369 .len = IWPM_DEVNAME_SIZE - 1 },
371 .len = IWPM_ULIBNAME_SIZE - 1 },
377 * iwpm_register_pid_cb - Process the port mapper response to
382 * If successful, the function receives the userspace port mapper pid
383 * which is used in future communication with the port mapper
398 return -EINVAL; in iwpm_register_pid_cb()
405 return -EINVAL; in iwpm_register_pid_cb()
407 pm_msg = nlmsg_request->req_buffer; in iwpm_register_pid_cb()
408 nl_client = nlmsg_request->nl_client; in iwpm_register_pid_cb()
414 if (strcmp(pm_msg->dev_name, dev_name) || in iwpm_register_pid_cb()
420 nlmsg_request->err_code = IWPM_USER_LIB_INFO_ERR; in iwpm_register_pid_cb()
423 iwpm_user_pid = cb->nlh->nlmsg_pid; in iwpm_register_pid_cb()
428 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_register_pid_cb()
429 pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", in iwpm_register_pid_cb()
433 nlmsg_request->request_done = 1; in iwpm_register_pid_cb()
435 kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request); in iwpm_register_pid_cb()
437 up(&nlmsg_request->sem); in iwpm_register_pid_cb()
441 /* netlink attribute policy for the received response to add mapping request */
452 * iwpm_add_mapping_cb - Process the port mapper response to
467 msg_type = "Add Mapping response"; in iwpm_add_mapping_cb()
470 return -EINVAL; in iwpm_add_mapping_cb()
472 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_add_mapping_cb()
479 return -EINVAL; in iwpm_add_mapping_cb()
481 pm_msg = nlmsg_request->req_buffer; in iwpm_add_mapping_cb()
487 if (iwpm_compare_sockaddr(local_sockaddr, &pm_msg->loc_addr)) { in iwpm_add_mapping_cb()
488 nlmsg_request->err_code = IWPM_USER_LIB_INFO_ERR; in iwpm_add_mapping_cb()
491 if (mapped_sockaddr->ss_family != local_sockaddr->ss_family) { in iwpm_add_mapping_cb()
494 nlmsg_request->err_code = IWPM_USER_LIB_INFO_ERR; in iwpm_add_mapping_cb()
497 memcpy(&pm_msg->mapped_loc_addr, mapped_sockaddr, in iwpm_add_mapping_cb()
499 iwpm_print_sockaddr(&pm_msg->loc_addr, in iwpm_add_mapping_cb()
501 iwpm_print_sockaddr(&pm_msg->mapped_loc_addr, in iwpm_add_mapping_cb()
505 nlmsg_request->request_done = 1; in iwpm_add_mapping_cb()
507 kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request); in iwpm_add_mapping_cb()
509 up(&nlmsg_request->sem); in iwpm_add_mapping_cb()
513 /* netlink attribute policy for the response to add and query mapping request
530 * iwpm_add_and_query_mapping_cb - Process the port mapper response to
547 msg_type = "Query Mapping response"; in iwpm_add_and_query_mapping_cb()
550 return -EINVAL; in iwpm_add_and_query_mapping_cb()
551 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_add_and_query_mapping_cb()
558 return -EINVAL; in iwpm_add_and_query_mapping_cb()
560 pm_msg = nlmsg_request->req_buffer; in iwpm_add_and_query_mapping_cb()
573 __func__, cb->nlh->nlmsg_pid, msg_seq); in iwpm_add_and_query_mapping_cb()
574 nlmsg_request->err_code = IWPM_REMOTE_QUERY_REJECT; in iwpm_add_and_query_mapping_cb()
576 if (iwpm_compare_sockaddr(local_sockaddr, &pm_msg->loc_addr) || in iwpm_add_and_query_mapping_cb()
577 iwpm_compare_sockaddr(remote_sockaddr, &pm_msg->rem_addr)) { in iwpm_add_and_query_mapping_cb()
579 nlmsg_request->err_code = IWPM_USER_LIB_INFO_ERR; in iwpm_add_and_query_mapping_cb()
582 if (mapped_loc_sockaddr->ss_family != local_sockaddr->ss_family || in iwpm_add_and_query_mapping_cb()
583 mapped_rem_sockaddr->ss_family != remote_sockaddr->ss_family) { in iwpm_add_and_query_mapping_cb()
586 nlmsg_request->err_code = IWPM_USER_LIB_INFO_ERR; in iwpm_add_and_query_mapping_cb()
589 memcpy(&pm_msg->mapped_loc_addr, mapped_loc_sockaddr, in iwpm_add_and_query_mapping_cb()
591 memcpy(&pm_msg->mapped_rem_addr, mapped_rem_sockaddr, in iwpm_add_and_query_mapping_cb()
594 iwpm_print_sockaddr(&pm_msg->loc_addr, in iwpm_add_and_query_mapping_cb()
596 iwpm_print_sockaddr(&pm_msg->mapped_loc_addr, in iwpm_add_and_query_mapping_cb()
598 iwpm_print_sockaddr(&pm_msg->rem_addr, in iwpm_add_and_query_mapping_cb()
600 iwpm_print_sockaddr(&pm_msg->mapped_rem_addr, in iwpm_add_and_query_mapping_cb()
603 nlmsg_request->request_done = 1; in iwpm_add_and_query_mapping_cb()
605 kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request); in iwpm_add_and_query_mapping_cb()
607 up(&nlmsg_request->sem); in iwpm_add_and_query_mapping_cb()
612 * iwpm_remote_info_cb - Process remote connecting peer address info, which
613 * the port mapper has received from the connecting peer
627 int ret = -EINVAL; in iwpm_remote_info_cb()
629 msg_type = "Remote Mapping info"; in iwpm_remote_info_cb()
634 nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type); in iwpm_remote_info_cb()
635 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_remote_info_cb()
646 if (mapped_loc_sockaddr->ss_family != local_sockaddr->ss_family || in iwpm_remote_info_cb()
647 mapped_rem_sockaddr->ss_family != remote_sockaddr->ss_family) { in iwpm_remote_info_cb()
654 ret = -ENOMEM; in iwpm_remote_info_cb()
657 memcpy(&rem_info->mapped_loc_sockaddr, mapped_loc_sockaddr, in iwpm_remote_info_cb()
659 memcpy(&rem_info->remote_sockaddr, remote_sockaddr, in iwpm_remote_info_cb()
661 memcpy(&rem_info->mapped_rem_sockaddr, mapped_rem_sockaddr, in iwpm_remote_info_cb()
663 rem_info->nl_client = nl_client; in iwpm_remote_info_cb()
678 /* netlink attribute policy for the received request for mapping info */
681 .len = IWPM_ULIBNAME_SIZE - 1 },
686 * iwpm_mapping_info_cb - Process a notification that the userspace
687 * port mapper daemon is started
691 * Using the received port mapper pid, send all the local mapping
692 * info records to the userspace port mapper
697 const char *msg_type = "Mapping Info response"; in iwpm_mapping_info_cb()
701 int ret = -EINVAL; in iwpm_mapping_info_cb()
712 pr_info("%s: Invalid port mapper name = %s version = %u\n", in iwpm_mapping_info_cb()
716 nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type); in iwpm_mapping_info_cb()
718 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_mapping_info_cb()
719 iwpm_user_pid = cb->nlh->nlmsg_pid; in iwpm_mapping_info_cb()
727 pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", in iwpm_mapping_info_cb()
733 /* netlink attribute policy for the received mapping info ack */
741 * iwpm_ack_mapping_info_cb - Process the port mapper ack for
742 * the provided local mapping info records
750 const char *msg_type = "Mapping Info Ack"; in iwpm_ack_mapping_info_cb()
754 return -EINVAL; in iwpm_ack_mapping_info_cb()
758 pr_info("%s: Invalid mapinfo number (sent = %u ack-ed = %u)\n", in iwpm_ack_mapping_info_cb()
760 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_ack_mapping_info_cb()
764 /* netlink attribute policy for the received port mapper error message */
771 * iwpm_mapping_error_cb - Process port mapper notification for error
779 int nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type); in iwpm_mapping_error_cb()
783 const char *msg_type = "Mapping Error Msg"; in iwpm_mapping_error_cb()
787 return -EINVAL; in iwpm_mapping_error_cb()
800 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_mapping_error_cb()
801 nlmsg_request->err_code = err_code; in iwpm_mapping_error_cb()
802 nlmsg_request->request_done = 1; in iwpm_mapping_error_cb()
804 kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request); in iwpm_mapping_error_cb()
806 up(&nlmsg_request->sem); in iwpm_mapping_error_cb()
816 * iwpm_hello_cb - Process a hello message from iwpmd
821 * Using the received port mapper pid, send the kernel's abi_version
830 int ret = -EINVAL; in iwpm_hello_cb()
838 nl_client = RDMA_NL_GET_CLIENT(cb->nlh->nlmsg_type); in iwpm_hello_cb()
840 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); in iwpm_hello_cb()
843 iwpm_user_pid = cb->nlh->nlmsg_pid; in iwpm_hello_cb()