• Home
  • Raw
  • Download

Lines Matching refs:query

739 static inline void ib_sa_disable_local_svc(struct ib_sa_query *query)  in ib_sa_disable_local_svc()  argument
741 query->flags &= ~IB_SA_ENABLE_LOCAL_SERVICE; in ib_sa_disable_local_svc()
744 static inline int ib_sa_query_cancelled(struct ib_sa_query *query) in ib_sa_query_cancelled() argument
746 return (query->flags & IB_SA_CANCEL); in ib_sa_query_cancelled()
750 struct ib_sa_query *query) in ib_nl_set_path_rec_attrs() argument
752 struct sa_path_rec *sa_rec = query->mad_buf->context[1]; in ib_nl_set_path_rec_attrs()
753 struct ib_sa_mad *mad = query->mad_buf->mad; in ib_nl_set_path_rec_attrs()
759 query->mad_buf->context[1] = NULL; in ib_nl_set_path_rec_attrs()
763 memcpy(header->device_name, dev_name(&query->port->agent->device->dev), in ib_nl_set_path_rec_attrs()
765 header->port_num = query->port->port_num; in ib_nl_set_path_rec_attrs()
769 query->path_use = LS_RESOLVE_PATH_USE_GMP; in ib_nl_set_path_rec_attrs()
771 query->path_use = LS_RESOLVE_PATH_USE_UNIDIRECTIONAL; in ib_nl_set_path_rec_attrs()
772 header->path_use = query->path_use; in ib_nl_set_path_rec_attrs()
832 static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask) in ib_nl_send_msg() argument
840 mad = query->mad_buf->mad; in ib_nl_send_msg()
850 data = ibnl_put_msg(skb, &nlh, query->seq, 0, RDMA_NL_LS, in ib_nl_send_msg()
858 ib_nl_set_path_rec_attrs(skb, query); in ib_nl_send_msg()
866 static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask) in ib_nl_make_request() argument
872 INIT_LIST_HEAD(&query->list); in ib_nl_make_request()
873 query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq); in ib_nl_make_request()
878 query->timeout = delay + jiffies; in ib_nl_make_request()
879 list_add_tail(&query->list, &ib_nl_request_list); in ib_nl_make_request()
881 if (ib_nl_request_list.next == &query->list) in ib_nl_make_request()
885 ret = ib_nl_send_msg(query, gfp_mask); in ib_nl_make_request()
890 list_del(&query->list); in ib_nl_make_request()
897 static int ib_nl_cancel_request(struct ib_sa_query *query) in ib_nl_cancel_request() argument
906 if (query == wait_query) { in ib_nl_cancel_request()
907 query->flags |= IB_SA_CANCEL; in ib_nl_cancel_request()
908 query->timeout = jiffies; in ib_nl_cancel_request()
909 list_move(&query->list, &ib_nl_request_list); in ib_nl_cancel_request()
923 static void ib_nl_process_good_resolve_rsp(struct ib_sa_query *query, in ib_nl_process_good_resolve_rsp() argument
934 if (query->callback) { in ib_nl_process_good_resolve_rsp()
937 switch (query->path_use) { in ib_nl_process_good_resolve_rsp()
957 mad = query->mad_buf->mad; in ib_nl_process_good_resolve_rsp()
967 query->callback(query, status, mad); in ib_nl_process_good_resolve_rsp()
970 mad_send_wc.send_buf = query->mad_buf; in ib_nl_process_good_resolve_rsp()
972 send_handler(query->mad_buf->mad_agent, &mad_send_wc); in ib_nl_process_good_resolve_rsp()
978 struct ib_sa_query *query; in ib_nl_request_timeout() local
985 query = list_entry(ib_nl_request_list.next, in ib_nl_request_timeout()
988 if (time_after(query->timeout, jiffies)) { in ib_nl_request_timeout()
989 delay = query->timeout - jiffies; in ib_nl_request_timeout()
996 list_del(&query->list); in ib_nl_request_timeout()
997 ib_sa_disable_local_svc(query); in ib_nl_request_timeout()
999 if (ib_sa_query_cancelled(query)) in ib_nl_request_timeout()
1002 ret = ib_post_send_mad(query->mad_buf, NULL); in ib_nl_request_timeout()
1004 mad_send_wc.send_buf = query->mad_buf; in ib_nl_request_timeout()
1007 send_handler(query->port->agent, &mad_send_wc); in ib_nl_request_timeout()
1021 struct ib_sa_query *query; in ib_nl_handle_set_timeout() local
1051 list_for_each_entry(query, &ib_nl_request_list, list) { in ib_nl_handle_set_timeout()
1052 if (delta < 0 && abs_delta > query->timeout) in ib_nl_handle_set_timeout()
1053 query->timeout = 0; in ib_nl_handle_set_timeout()
1055 query->timeout += delta; in ib_nl_handle_set_timeout()
1059 delay = query->timeout - jiffies; in ib_nl_handle_set_timeout()
1095 struct ib_sa_query *query; in ib_nl_handle_resolve_resp() local
1106 list_for_each_entry(query, &ib_nl_request_list, list) { in ib_nl_handle_resolve_resp()
1111 if (nlh->nlmsg_seq == query->seq) { in ib_nl_handle_resolve_resp()
1112 found = !ib_sa_query_cancelled(query); in ib_nl_handle_resolve_resp()
1114 list_del(&query->list); in ib_nl_handle_resolve_resp()
1124 send_buf = query->mad_buf; in ib_nl_handle_resolve_resp()
1128 ib_sa_disable_local_svc(query); in ib_nl_handle_resolve_resp()
1129 ret = ib_post_send_mad(query->mad_buf, NULL); in ib_nl_handle_resolve_resp()
1134 send_handler(query->port->agent, &mad_send_wc); in ib_nl_handle_resolve_resp()
1138 ib_nl_process_good_resolve_rsp(query, nlh); in ib_nl_handle_resolve_resp()
1176 void ib_sa_cancel_query(int id, struct ib_sa_query *query) in ib_sa_cancel_query() argument
1183 if (xa_load(&queries, id) != query) { in ib_sa_cancel_query()
1187 agent = query->port->agent; in ib_sa_cancel_query()
1188 mad_buf = query->mad_buf; in ib_sa_cancel_query()
1196 if (!ib_nl_cancel_request(query)) in ib_sa_cancel_query()
1295 static int alloc_mad(struct ib_sa_query *query, gfp_t gfp_mask) in alloc_mad() argument
1300 spin_lock_irqsave(&query->port->ah_lock, flags); in alloc_mad()
1301 if (!query->port->sm_ah) { in alloc_mad()
1302 spin_unlock_irqrestore(&query->port->ah_lock, flags); in alloc_mad()
1305 kref_get(&query->port->sm_ah->ref); in alloc_mad()
1306 query->sm_ah = query->port->sm_ah; in alloc_mad()
1307 spin_unlock_irqrestore(&query->port->ah_lock, flags); in alloc_mad()
1313 if ((rdma_query_ah(query->sm_ah->ah, &ah_attr) < 0) || in alloc_mad()
1315 kref_put(&query->sm_ah->ref, free_sm_ah); in alloc_mad()
1318 query->mad_buf = ib_create_send_mad(query->port->agent, 1, in alloc_mad()
1319 query->sm_ah->pkey_index, in alloc_mad()
1322 ((query->flags & IB_SA_QUERY_OPA) ? in alloc_mad()
1325 if (IS_ERR(query->mad_buf)) { in alloc_mad()
1326 kref_put(&query->sm_ah->ref, free_sm_ah); in alloc_mad()
1330 query->mad_buf->ah = query->sm_ah->ah; in alloc_mad()
1335 static void free_mad(struct ib_sa_query *query) in free_mad() argument
1337 ib_free_send_mad(query->mad_buf); in free_mad()
1338 kref_put(&query->sm_ah->ref, free_sm_ah); in free_mad()
1341 static void init_mad(struct ib_sa_query *query, struct ib_mad_agent *agent) in init_mad() argument
1343 struct ib_sa_mad *mad = query->mad_buf->mad; in init_mad()
1348 if (query->flags & IB_SA_QUERY_OPA) { in init_mad()
1362 static int send_mad(struct ib_sa_query *query, unsigned long timeout_ms, in send_mad() argument
1369 ret = __xa_alloc(&queries, &id, query, xa_limit_32b, gfp_mask); in send_mad()
1374 query->mad_buf->timeout_ms = timeout_ms; in send_mad()
1375 query->mad_buf->context[0] = query; in send_mad()
1376 query->id = id; in send_mad()
1378 if ((query->flags & IB_SA_ENABLE_LOCAL_SERVICE) && in send_mad()
1379 (!(query->flags & IB_SA_QUERY_OPA))) { in send_mad()
1381 if (!ib_nl_make_request(query, gfp_mask)) in send_mad()
1384 ib_sa_disable_local_svc(query); in send_mad()
1387 ret = ib_post_send_mad(query->mad_buf, NULL); in send_mad()
1475 struct ib_sa_path_query *query = in ib_sa_path_rec_callback() local
1486 query->callback(status, &rec, query->context); in ib_sa_path_rec_callback()
1494 if (query->conv_pr) { in ib_sa_path_rec_callback()
1499 query->callback(status, &opa, query->context); in ib_sa_path_rec_callback()
1501 query->callback(status, &rec, query->context); in ib_sa_path_rec_callback()
1505 query->callback(status, NULL, query->context); in ib_sa_path_rec_callback()
1510 struct ib_sa_path_query *query = in ib_sa_path_rec_release() local
1513 kfree(query->conv_pr); in ib_sa_path_rec_release()
1514 kfree(query); in ib_sa_path_rec_release()
1553 struct ib_sa_path_query *query; in ib_sa_path_rec_get() local
1571 query = kzalloc(sizeof(*query), gfp_mask); in ib_sa_path_rec_get()
1572 if (!query) in ib_sa_path_rec_get()
1575 query->sa_query.port = port; in ib_sa_path_rec_get()
1582 query->sa_query.flags |= IB_SA_QUERY_OPA; in ib_sa_path_rec_get()
1584 query->conv_pr = in ib_sa_path_rec_get()
1585 kmalloc(sizeof(*query->conv_pr), gfp_mask); in ib_sa_path_rec_get()
1586 if (!query->conv_pr) { in ib_sa_path_rec_get()
1593 ret = alloc_mad(&query->sa_query, gfp_mask); in ib_sa_path_rec_get()
1598 query->sa_query.client = client; in ib_sa_path_rec_get()
1599 query->callback = callback; in ib_sa_path_rec_get()
1600 query->context = context; in ib_sa_path_rec_get()
1602 mad = query->sa_query.mad_buf->mad; in ib_sa_path_rec_get()
1603 init_mad(&query->sa_query, agent); in ib_sa_path_rec_get()
1605 query->sa_query.callback = callback ? ib_sa_path_rec_callback : NULL; in ib_sa_path_rec_get()
1606 query->sa_query.release = ib_sa_path_rec_release; in ib_sa_path_rec_get()
1611 if (query->sa_query.flags & IB_SA_QUERY_OPA) { in ib_sa_path_rec_get()
1614 } else if (query->conv_pr) { in ib_sa_path_rec_get()
1615 sa_convert_path_opa_to_ib(query->conv_pr, rec); in ib_sa_path_rec_get()
1617 query->conv_pr, mad->data); in ib_sa_path_rec_get()
1623 *sa_query = &query->sa_query; in ib_sa_path_rec_get()
1625 query->sa_query.flags |= IB_SA_ENABLE_LOCAL_SERVICE; in ib_sa_path_rec_get()
1626 query->sa_query.mad_buf->context[1] = (query->conv_pr) ? in ib_sa_path_rec_get()
1627 query->conv_pr : rec; in ib_sa_path_rec_get()
1629 ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); in ib_sa_path_rec_get()
1637 ib_sa_client_put(query->sa_query.client); in ib_sa_path_rec_get()
1638 free_mad(&query->sa_query); in ib_sa_path_rec_get()
1640 kfree(query->conv_pr); in ib_sa_path_rec_get()
1642 kfree(query); in ib_sa_path_rec_get()
1651 struct ib_sa_service_query *query = in ib_sa_service_rec_callback() local
1659 query->callback(status, &rec, query->context); in ib_sa_service_rec_callback()
1661 query->callback(status, NULL, query->context); in ib_sa_service_rec_callback()
1707 struct ib_sa_service_query *query; in ib_sa_service_rec_query() local
1725 query = kzalloc(sizeof(*query), gfp_mask); in ib_sa_service_rec_query()
1726 if (!query) in ib_sa_service_rec_query()
1729 query->sa_query.port = port; in ib_sa_service_rec_query()
1730 ret = alloc_mad(&query->sa_query, gfp_mask); in ib_sa_service_rec_query()
1735 query->sa_query.client = client; in ib_sa_service_rec_query()
1736 query->callback = callback; in ib_sa_service_rec_query()
1737 query->context = context; in ib_sa_service_rec_query()
1739 mad = query->sa_query.mad_buf->mad; in ib_sa_service_rec_query()
1740 init_mad(&query->sa_query, agent); in ib_sa_service_rec_query()
1742 query->sa_query.callback = callback ? ib_sa_service_rec_callback : NULL; in ib_sa_service_rec_query()
1743 query->sa_query.release = ib_sa_service_rec_release; in ib_sa_service_rec_query()
1751 *sa_query = &query->sa_query; in ib_sa_service_rec_query()
1753 ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); in ib_sa_service_rec_query()
1761 ib_sa_client_put(query->sa_query.client); in ib_sa_service_rec_query()
1762 free_mad(&query->sa_query); in ib_sa_service_rec_query()
1765 kfree(query); in ib_sa_service_rec_query()
1774 struct ib_sa_mcmember_query *query = in ib_sa_mcmember_rec_callback() local
1782 query->callback(status, &rec, query->context); in ib_sa_mcmember_rec_callback()
1784 query->callback(status, NULL, query->context); in ib_sa_mcmember_rec_callback()
1804 struct ib_sa_mcmember_query *query; in ib_sa_mcmember_rec_query() local
1817 query = kzalloc(sizeof(*query), gfp_mask); in ib_sa_mcmember_rec_query()
1818 if (!query) in ib_sa_mcmember_rec_query()
1821 query->sa_query.port = port; in ib_sa_mcmember_rec_query()
1822 ret = alloc_mad(&query->sa_query, gfp_mask); in ib_sa_mcmember_rec_query()
1827 query->sa_query.client = client; in ib_sa_mcmember_rec_query()
1828 query->callback = callback; in ib_sa_mcmember_rec_query()
1829 query->context = context; in ib_sa_mcmember_rec_query()
1831 mad = query->sa_query.mad_buf->mad; in ib_sa_mcmember_rec_query()
1832 init_mad(&query->sa_query, agent); in ib_sa_mcmember_rec_query()
1834 query->sa_query.callback = callback ? ib_sa_mcmember_rec_callback : NULL; in ib_sa_mcmember_rec_query()
1835 query->sa_query.release = ib_sa_mcmember_rec_release; in ib_sa_mcmember_rec_query()
1843 *sa_query = &query->sa_query; in ib_sa_mcmember_rec_query()
1845 ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); in ib_sa_mcmember_rec_query()
1853 ib_sa_client_put(query->sa_query.client); in ib_sa_mcmember_rec_query()
1854 free_mad(&query->sa_query); in ib_sa_mcmember_rec_query()
1857 kfree(query); in ib_sa_mcmember_rec_query()
1866 struct ib_sa_guidinfo_query *query = in ib_sa_guidinfo_rec_callback() local
1874 query->callback(status, &rec, query->context); in ib_sa_guidinfo_rec_callback()
1876 query->callback(status, NULL, query->context); in ib_sa_guidinfo_rec_callback()
1895 struct ib_sa_guidinfo_query *query; in ib_sa_guid_info_rec_query() local
1914 query = kzalloc(sizeof(*query), gfp_mask); in ib_sa_guid_info_rec_query()
1915 if (!query) in ib_sa_guid_info_rec_query()
1918 query->sa_query.port = port; in ib_sa_guid_info_rec_query()
1919 ret = alloc_mad(&query->sa_query, gfp_mask); in ib_sa_guid_info_rec_query()
1924 query->sa_query.client = client; in ib_sa_guid_info_rec_query()
1925 query->callback = callback; in ib_sa_guid_info_rec_query()
1926 query->context = context; in ib_sa_guid_info_rec_query()
1928 mad = query->sa_query.mad_buf->mad; in ib_sa_guid_info_rec_query()
1929 init_mad(&query->sa_query, agent); in ib_sa_guid_info_rec_query()
1931 query->sa_query.callback = callback ? ib_sa_guidinfo_rec_callback : NULL; in ib_sa_guid_info_rec_query()
1932 query->sa_query.release = ib_sa_guidinfo_rec_release; in ib_sa_guid_info_rec_query()
1941 *sa_query = &query->sa_query; in ib_sa_guid_info_rec_query()
1943 ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); in ib_sa_guid_info_rec_query()
1951 ib_sa_client_put(query->sa_query.client); in ib_sa_guid_info_rec_query()
1952 free_mad(&query->sa_query); in ib_sa_guid_info_rec_query()
1955 kfree(query); in ib_sa_guid_info_rec_query()
2001 struct ib_sa_classport_info_query *query = in ib_sa_classport_info_rec_callback() local
2045 query->callback(query->context); in ib_sa_classport_info_rec_callback()
2061 struct ib_sa_classport_info_query *query; in ib_sa_classport_info_rec_query() local
2068 query = kzalloc(sizeof(*query), gfp_mask); in ib_sa_classport_info_rec_query()
2069 if (!query) in ib_sa_classport_info_rec_query()
2072 query->sa_query.port = port; in ib_sa_classport_info_rec_query()
2073 query->sa_query.flags |= rdma_cap_opa_ah(port->agent->device, in ib_sa_classport_info_rec_query()
2076 ret = alloc_mad(&query->sa_query, gfp_mask); in ib_sa_classport_info_rec_query()
2080 query->callback = callback; in ib_sa_classport_info_rec_query()
2081 query->context = context; in ib_sa_classport_info_rec_query()
2083 mad = query->sa_query.mad_buf->mad; in ib_sa_classport_info_rec_query()
2084 init_mad(&query->sa_query, agent); in ib_sa_classport_info_rec_query()
2086 query->sa_query.callback = ib_sa_classport_info_rec_callback; in ib_sa_classport_info_rec_query()
2087 query->sa_query.release = ib_sa_classport_info_rec_release; in ib_sa_classport_info_rec_query()
2091 *sa_query = &query->sa_query; in ib_sa_classport_info_rec_query()
2093 ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); in ib_sa_classport_info_rec_query()
2101 free_mad(&query->sa_query); in ib_sa_classport_info_rec_query()
2104 kfree(query); in ib_sa_classport_info_rec_query()
2164 struct ib_sa_query *query = mad_send_wc->send_buf->context[0]; in send_handler() local
2167 if (query->callback) in send_handler()
2173 query->callback(query, -ETIMEDOUT, NULL); in send_handler()
2176 query->callback(query, -EINTR, NULL); in send_handler()
2179 query->callback(query, -EIO, NULL); in send_handler()
2184 __xa_erase(&queries, query->id); in send_handler()
2187 free_mad(query); in send_handler()
2188 if (query->client) in send_handler()
2189 ib_sa_client_put(query->client); in send_handler()
2190 query->release(query); in send_handler()
2197 struct ib_sa_query *query; in recv_handler() local
2202 query = send_buf->context[0]; in recv_handler()
2203 if (query->callback) { in recv_handler()
2205 query->callback(query, in recv_handler()
2210 query->callback(query, -EIO, NULL); in recv_handler()