Pull rdma fixes from Doug Ledford: "This is the second batch of queued up rdma patches for this rc cycle. There isn't anything really major in here. It's passed 0day, linux-next, and local testing across a wide variety of hardware. There are still a few known issues to be tracked down, but this should amount to the vast majority of the rdma RC fixes. Round two of 4.7 rc fixes: - A couple minor fixes to the rdma core - Multiple minor fixes to hfi1 - Multiple minor fixes to mlx4/mlx4 - A few minor fixes to i40iw" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (31 commits) IB/srpt: Reduce QP buffer size i40iw: Enable level-1 PBL for fast memory registration i40iw: Return correct max_fast_reg_page_list_len i40iw: Correct status check on i40iw_get_pble i40iw: Correct CQ arming IB/rdmavt: Correct qp_priv_alloc() return value test IB/hfi1: Don't zero out qp->s_ack_queue in rvt_reset_qp IB/hfi1: Fix deadlock with txreq allocation slow path IB/mlx4: Prevent cross page boundary allocation IB/mlx4: Fix memory leak if QP creation failed IB/mlx4: Verify port number in flow steering create flow IB/mlx4: Fix error flow when sending mads under SRIOV IB/mlx4: Fix the SQ size of an RC QP IB/mlx5: Fix wrong naming of port_rcv_data counter IB/mlx5: Fix post send fence logic IB/uverbs: Initialize ib_qp_init_attr with zeros IB/core: Fix false search of the IB_SA_WELL_KNOWN_GUID IB/core: Fix RoCE v1 multicast join logic issue IB/core: Fix no default GIDs when netdevice reregisters IB/hfi1: Send a pkey change event on driver pkey update ...
Unified · Split
| @@ -411,7 +411,9 @@ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, · 410 unmodified lines | |||
| 411 | 411 | ||
| 412 | for (ix = 0; ix < table->sz; ix++) | 412 | for (ix = 0; ix < table->sz; ix++) |
| 413 | if (table->data_vec[ix].attr.ndev == ndev) | 413 | if (table->data_vec[ix].attr.ndev == ndev) |
| 414 | if (!del_gid(ib_dev, port, table, ix, false)) | 414 | if (!del_gid(ib_dev, port, table, ix, |
| 415 | !!(table->data_vec[ix].props & | ||
| 416 | GID_TABLE_ENTRY_DEFAULT))) | ||
| 415 | deleted = true; | 417 | deleted = true; |
| 416 | 418 | ||
| 417 | write_unlock_irq(&table->rwlock); | 419 | write_unlock_irq(&table->rwlock); |
| @@ -708,17 +708,6 @@ static void cma_deref_id(struct rdma_id_private *id_priv) · 707 unmodified lines | |||
| 708 | complete(&id_priv->comp); | 708 | complete(&id_priv->comp); |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | static int cma_disable_callback(struct rdma_id_private *id_priv, | ||
| 712 | enum rdma_cm_state state) | ||
| 713 | { | ||
| 714 | mutex_lock(&id_priv->handler_mutex); | ||
| 715 | if (id_priv->state != state) { | ||
| 716 | mutex_unlock(&id_priv->handler_mutex); | ||
| 717 | return -EINVAL; | ||
| 718 | } | ||
| 719 | return 0; | ||
| 720 | } | ||
| 721 | |||
| 722 | struct rdma_cm_id *rdma_create_id(struct net *net, | 711 | struct rdma_cm_id *rdma_create_id(struct net *net, |
| 723 | rdma_cm_event_handler event_handler, | 712 | rdma_cm_event_handler event_handler, |
| 724 | void *context, enum rdma_port_space ps, | 713 | void *context, enum rdma_port_space ps, |
| @@ -1671,11 +1660,12 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) · 946 unmodified lines | |||
| 1671 | struct rdma_cm_event event; | 1660 | struct rdma_cm_event event; |
| 1672 | int ret = 0; | 1661 | int ret = 0; |
| 1673 | 1662 | ||
| 1663 | mutex_lock(&id_priv->handler_mutex); | ||
| 1674 | if ((ib_event->event != IB_CM_TIMEWAIT_EXIT && | 1664 | if ((ib_event->event != IB_CM_TIMEWAIT_EXIT && |
| 1675 | cma_disable_callback(id_priv, RDMA_CM_CONNECT)) || | 1665 | id_priv->state != RDMA_CM_CONNECT) || |
| 1676 | (ib_event->event == IB_CM_TIMEWAIT_EXIT && | 1666 | (ib_event->event == IB_CM_TIMEWAIT_EXIT && |
| 1677 | cma_disable_callback(id_priv, RDMA_CM_DISCONNECT))) | 1667 | id_priv->state != RDMA_CM_DISCONNECT)) |
| 1678 | return 0; | 1668 | goto out; |
| 1679 | 1669 | ||
| 1680 | memset(&event, 0, sizeof event); | 1670 | memset(&event, 0, sizeof event); |
| 1681 | switch (ib_event->event) { | 1671 | switch (ib_event->event) { |
| @@ -1870,7 +1860,7 @@ static int cma_check_req_qp_type(struct rdma_cm_id *id, struct ib_cm_event *ib_e · 188 unmodified lines | |||
| 1870 | 1860 | ||
| 1871 | static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) | 1861 | static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) |
| 1872 | { | 1862 | { |
| 1873 | struct rdma_id_private *listen_id, *conn_id; | 1863 | struct rdma_id_private *listen_id, *conn_id = NULL; |
| 1874 | struct rdma_cm_event event; | 1864 | struct rdma_cm_event event; |
| 1875 | struct net_device *net_dev; | 1865 | struct net_device *net_dev; |
| 1876 | int offset, ret; | 1866 | int offset, ret; |
| @@ -1884,9 +1874,10 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) · 7 unmodified lines | |||
| 1884 | goto net_dev_put; | 1874 | goto net_dev_put; |
| 1885 | } | 1875 | } |
| 1886 | 1876 | ||
| 1887 | if (cma_disable_callback(listen_id, RDMA_CM_LISTEN)) { | 1877 | mutex_lock(&listen_id->handler_mutex); |
| 1878 | if (listen_id->state != RDMA_CM_LISTEN) { | ||
| 1888 | ret = -ECONNABORTED; | 1879 | ret = -ECONNABORTED; |
| 1889 | goto net_dev_put; | 1880 | goto err1; |
| 1890 | } | 1881 | } |
| 1891 | 1882 | ||
| 1892 | memset(&event, 0, sizeof event); | 1883 | memset(&event, 0, sizeof event); |
| @@ -1976,8 +1967,9 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event) · 83 unmodified lines | |||
| 1976 | struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr; | 1967 | struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr; |
| 1977 | struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr; | 1968 | struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr; |
| 1978 | 1969 | ||
| 1979 | if (cma_disable_callback(id_priv, RDMA_CM_CONNECT)) | 1970 | mutex_lock(&id_priv->handler_mutex); |
| 1980 | return 0; | 1971 | if (id_priv->state != RDMA_CM_CONNECT) |
| 1972 | goto out; | ||
| 1981 | 1973 | ||
| 1982 | memset(&event, 0, sizeof event); | 1974 | memset(&event, 0, sizeof event); |
| 1983 | switch (iw_event->event) { | 1975 | switch (iw_event->event) { |
| @@ -2029,6 +2021,7 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event) · 45 unmodified lines | |||
| 2029 | return ret; | 2021 | return ret; |
| 2030 | } | 2022 | } |
| 2031 | 2023 | ||
| 2024 | out: | ||
| 2032 | mutex_unlock(&id_priv->handler_mutex); | 2025 | mutex_unlock(&id_priv->handler_mutex); |
| 2033 | return ret; | 2026 | return ret; |
| 2034 | } | 2027 | } |
| @@ -2039,13 +2032,15 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id, · 4 unmodified lines | |||
| 2039 | struct rdma_cm_id *new_cm_id; | 2032 | struct rdma_cm_id *new_cm_id; |
| 2040 | struct rdma_id_private *listen_id, *conn_id; | 2033 | struct rdma_id_private *listen_id, *conn_id; |
| 2041 | struct rdma_cm_event event; | 2034 | struct rdma_cm_event event; |
| 2042 | int ret; | 2035 | int ret = -ECONNABORTED; |
| 2043 | struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr; | 2036 | struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr; |
| 2044 | struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr; | 2037 | struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr; |
| 2045 | 2038 | ||
| 2046 | listen_id = cm_id->context; | 2039 | listen_id = cm_id->context; |
| 2047 | if (cma_disable_callback(listen_id, RDMA_CM_LISTEN)) | 2040 | |
| 2048 | return -ECONNABORTED; | 2041 | mutex_lock(&listen_id->handler_mutex); |
| 2042 | if (listen_id->state != RDMA_CM_LISTEN) | ||
| 2043 | goto out; | ||
| 2049 | 2044 | ||
| 2050 | /* Create a new RDMA id for the new IW CM ID */ | 2045 | /* Create a new RDMA id for the new IW CM ID */ |
| 2051 | new_cm_id = rdma_create_id(listen_id->id.route.addr.dev_addr.net, | 2046 | new_cm_id = rdma_create_id(listen_id->id.route.addr.dev_addr.net, |
| @@ -3216,8 +3211,9 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id, · 1164 unmodified lines | |||
| 3216 | struct ib_cm_sidr_rep_event_param *rep = &ib_event->param.sidr_rep_rcvd; | 3211 | struct ib_cm_sidr_rep_event_param *rep = &ib_event->param.sidr_rep_rcvd; |
| 3217 | int ret = 0; | 3212 | int ret = 0; |
| 3218 | 3213 | ||
| 3219 | if (cma_disable_callback(id_priv, RDMA_CM_CONNECT)) | 3214 | mutex_lock(&id_priv->handler_mutex); |
| 3220 | return 0; | 3215 | if (id_priv->state != RDMA_CM_CONNECT) |
| 3216 | goto out; | ||
| 3221 | 3217 | ||
| 3222 | memset(&event, 0, sizeof event); | 3218 | memset(&event, 0, sizeof event); |
| 3223 | switch (ib_event->event) { | 3219 | switch (ib_event->event) { |
| @@ -3673,12 +3669,13 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) · 449 unmodified lines | |||
| 3673 | struct rdma_id_private *id_priv; | 3669 | struct rdma_id_private *id_priv; |
| 3674 | struct cma_multicast *mc = multicast->context; | 3670 | struct cma_multicast *mc = multicast->context; |
| 3675 | struct rdma_cm_event event; | 3671 | struct rdma_cm_event event; |
| 3676 | int ret; | 3672 | int ret = 0; |
| 3677 | 3673 | ||
| 3678 | id_priv = mc->id_priv; | 3674 | id_priv = mc->id_priv; |
| 3679 | if (cma_disable_callback(id_priv, RDMA_CM_ADDR_BOUND) && | 3675 | mutex_lock(&id_priv->handler_mutex); |
| 3680 | cma_disable_callback(id_priv, RDMA_CM_ADDR_RESOLVED)) | 3676 | if (id_priv->state != RDMA_CM_ADDR_BOUND && |
| 3681 | return 0; | 3677 | id_priv->state != RDMA_CM_ADDR_RESOLVED) |
| 3678 | goto out; | ||
| 3682 | 3679 | ||
| 3683 | if (!status) | 3680 | if (!status) |
| 3684 | status = cma_set_qkey(id_priv, be32_to_cpu(multicast->rec.qkey)); | 3681 | status = cma_set_qkey(id_priv, be32_to_cpu(multicast->rec.qkey)); |
| @@ -3720,6 +3717,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) · 35 unmodified lines | |||
| 3720 | return 0; | 3717 | return 0; |
| 3721 | } | 3718 | } |
| 3722 | 3719 | ||
| 3720 | out: | ||
| 3723 | mutex_unlock(&id_priv->handler_mutex); | 3721 | mutex_unlock(&id_priv->handler_mutex); |
| 3724 | return 0; | 3722 | return 0; |
| 3725 | } | 3723 | } |
| @@ -3878,12 +3876,12 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, · 152 unmodified lines | |||
| 3878 | gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - | 3876 | gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num - |
| 3879 | rdma_start_port(id_priv->cma_dev->device)]; | 3877 | rdma_start_port(id_priv->cma_dev->device)]; |
| 3880 | if (addr->sa_family == AF_INET) { | 3878 | if (addr->sa_family == AF_INET) { |
| 3881 | if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) | 3879 | if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { |
| 3880 | mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT; | ||
| 3882 | err = cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid, | 3881 | err = cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid, |
| 3883 | true); | 3882 | true); |
| 3884 | if (!err) { | 3883 | if (!err) |
| 3885 | mc->igmp_joined = true; | 3884 | mc->igmp_joined = true; |
| 3886 | mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT; | ||
| 3887 | } | 3885 | } |
| 3888 | } else { | 3886 | } else { |
| 3889 | if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) | 3887 | if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) |
| @@ -1747,7 +1747,7 @@ static int create_qp(struct ib_uverbs_file *file, · 1746 unmodified lines | |||
| 1747 | struct ib_srq *srq = NULL; | 1747 | struct ib_srq *srq = NULL; |
| 1748 | struct ib_qp *qp; | 1748 | struct ib_qp *qp; |
| 1749 | char *buf; | 1749 | char *buf; |
| 1750 | struct ib_qp_init_attr attr; | 1750 | struct ib_qp_init_attr attr = {}; |
| 1751 | struct ib_uverbs_ex_create_qp_resp resp; | 1751 | struct ib_uverbs_ex_create_qp_resp resp; |
| 1752 | int ret; | 1752 | int ret; |
| 1753 | 1753 | ||
| @@ -511,12 +511,16 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, · 510 unmodified lines | |||
| 511 | ah_attr->grh.dgid = sgid; | 511 | ah_attr->grh.dgid = sgid; |
| 512 | 512 | ||
| 513 | if (!rdma_cap_eth_ah(device, port_num)) { | 513 | if (!rdma_cap_eth_ah(device, port_num)) { |
| 514 | ret = ib_find_cached_gid_by_port(device, &dgid, | 514 | if (dgid.global.interface_id != cpu_to_be64(IB_SA_WELL_KNOWN_GUID)) { |
| 515 | IB_GID_TYPE_IB, | 515 | ret = ib_find_cached_gid_by_port(device, &dgid, |
| 516 | port_num, NULL, | 516 | IB_GID_TYPE_IB, |
| 517 | &gid_index); | 517 | port_num, NULL, |
| 518 | if (ret) | 518 | &gid_index); |
| 519 | return ret; | 519 | if (ret) |
| 520 | return ret; | ||
| 521 | } else { | ||
| 522 | gid_index = 0; | ||
| 523 | } | ||
| 520 | } | 524 | } |
| 521 | 525 | ||
| 522 | ah_attr->grh.sgid_index = (u8) gid_index; | 526 | ah_attr->grh.sgid_index = (u8) gid_index; |
| @@ -1037,7 +1037,7 @@ static void dc_shutdown(struct hfi1_devdata *); · 1036 unmodified lines | |||
| 1037 | static void dc_start(struct hfi1_devdata *); | 1037 | static void dc_start(struct hfi1_devdata *); |
| 1038 | static int qos_rmt_entries(struct hfi1_devdata *dd, unsigned int *mp, | 1038 | static int qos_rmt_entries(struct hfi1_devdata *dd, unsigned int *mp, |
| 1039 | unsigned int *np); | 1039 | unsigned int *np); |
| 1040 | static void remove_full_mgmt_pkey(struct hfi1_pportdata *ppd); | 1040 | static void clear_full_mgmt_pkey(struct hfi1_pportdata *ppd); |
| 1041 | 1041 | ||
| 1042 | /* | 1042 | /* |
| 1043 | * Error interrupt table entry. This is used as input to the interrupt | 1043 | * Error interrupt table entry. This is used as input to the interrupt |
| @@ -6962,8 +6962,6 @@ void handle_link_down(struct work_struct *work) · 5918 unmodified lines | |||
| 6962 | } | 6962 | } |
| 6963 | 6963 | ||
| 6964 | reset_neighbor_info(ppd); | 6964 | reset_neighbor_info(ppd); |
| 6965 | if (ppd->mgmt_allowed) | ||
| 6966 | remove_full_mgmt_pkey(ppd); | ||
| 6967 | 6965 | ||
| 6968 | /* disable the port */ | 6966 | /* disable the port */ |
| 6969 | clear_rcvctrl(ppd->dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK); | 6967 | clear_rcvctrl(ppd->dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK); |
| @@ -7070,12 +7068,16 @@ static void add_full_mgmt_pkey(struct hfi1_pportdata *ppd) · 100 unmodified lines | |||
| 7070 | __func__, ppd->pkeys[2], FULL_MGMT_P_KEY); | 7068 | __func__, ppd->pkeys[2], FULL_MGMT_P_KEY); |
| 7071 | ppd->pkeys[2] = FULL_MGMT_P_KEY; | 7069 | ppd->pkeys[2] = FULL_MGMT_P_KEY; |
| 7072 | (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); | 7070 | (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); |
| 7071 | hfi1_event_pkey_change(ppd->dd, ppd->port); | ||
| 7073 | } | 7072 | } |
| 7074 | 7073 | ||
| 7075 | static void remove_full_mgmt_pkey(struct hfi1_pportdata *ppd) | 7074 | static void clear_full_mgmt_pkey(struct hfi1_pportdata *ppd) |
| 7076 | { | 7075 | { |
| 7077 | ppd->pkeys[2] = 0; | 7076 | if (ppd->pkeys[2] != 0) { |
| 7078 | (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); | 7077 | ppd->pkeys[2] = 0; |
| 7078 | (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); | ||
| 7079 | hfi1_event_pkey_change(ppd->dd, ppd->port); | ||
| 7080 | } | ||
| 7079 | } | 7081 | } |
| 7080 | 7082 | ||
| 7081 | /* | 7083 | /* |
| @@ -9168,6 +9170,13 @@ int start_link(struct hfi1_pportdata *ppd) · 2086 unmodified lines | |||
| 9168 | return 0; | 9170 | return 0; |
| 9169 | } | 9171 | } |
| 9170 | 9172 | ||
| 9173 | /* | ||
| 9174 | * FULL_MGMT_P_KEY is cleared from the pkey table, so that the | ||
| 9175 | * pkey table can be configured properly if the HFI unit is connected | ||
| 9176 | * to switch port with MgmtAllowed=NO | ||
| 9177 | */ | ||
| 9178 | clear_full_mgmt_pkey(ppd); | ||
| 9179 | |||
| 9171 | return set_link_state(ppd, HLS_DN_POLL); | 9180 | return set_link_state(ppd, HLS_DN_POLL); |
| 9172 | } | 9181 | } |
| 9173 | 9182 | ||
| @@ -9777,7 +9786,7 @@ static void set_send_length(struct hfi1_pportdata *ppd) · 603 unmodified lines | |||
| 9777 | u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2) | 9786 | u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2) |
| 9778 | & SEND_LEN_CHECK1_LEN_VL15_MASK) << | 9787 | & SEND_LEN_CHECK1_LEN_VL15_MASK) << |
| 9779 | SEND_LEN_CHECK1_LEN_VL15_SHIFT; | 9788 | SEND_LEN_CHECK1_LEN_VL15_SHIFT; |
| 9780 | int i; | 9789 | int i, j; |
| 9781 | u32 thres; | 9790 | u32 thres; |
| 9782 | 9791 | ||
| 9783 | for (i = 0; i < ppd->vls_supported; i++) { | 9792 | for (i = 0; i < ppd->vls_supported; i++) { |
| @@ -9801,7 +9810,10 @@ static void set_send_length(struct hfi1_pportdata *ppd) · 17 unmodified lines | |||
| 9801 | sc_mtu_to_threshold(dd->vld[i].sc, | 9810 | sc_mtu_to_threshold(dd->vld[i].sc, |
| 9802 | dd->vld[i].mtu, | 9811 | dd->vld[i].mtu, |
| 9803 | dd->rcd[0]->rcvhdrqentsize)); | 9812 | dd->rcd[0]->rcvhdrqentsize)); |
| 9804 | sc_set_cr_threshold(dd->vld[i].sc, thres); | 9813 | for (j = 0; j < INIT_SC_PER_VL; j++) |
| 9814 | sc_set_cr_threshold( | ||
| 9815 | pio_select_send_context_vl(dd, j, i), | ||
| 9816 | thres); | ||
| 9805 | } | 9817 | } |
| 9806 | thres = min(sc_percent_to_threshold(dd->vld[15].sc, 50), | 9818 | thres = min(sc_percent_to_threshold(dd->vld[15].sc, 50), |
| 9807 | sc_mtu_to_threshold(dd->vld[15].sc, | 9819 | sc_mtu_to_threshold(dd->vld[15].sc, |
| @@ -203,6 +203,9 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd, · 202 unmodified lines | |||
| 203 | 203 | ||
| 204 | switch (cmd) { | 204 | switch (cmd) { |
| 205 | case HFI1_IOCTL_ASSIGN_CTXT: | 205 | case HFI1_IOCTL_ASSIGN_CTXT: |
| 206 | if (uctxt) | ||
| 207 | return -EINVAL; | ||
| 208 | |||
| 206 | if (copy_from_user(&uinfo, | 209 | if (copy_from_user(&uinfo, |
| 207 | (struct hfi1_user_info __user *)arg, | 210 | (struct hfi1_user_info __user *)arg, |
| 208 | sizeof(uinfo))) | 211 | sizeof(uinfo))) |
| @@ -1383,7 +1383,7 @@ static void postinit_cleanup(struct hfi1_devdata *dd) · 1382 unmodified lines | |||
| 1383 | static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1383 | static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 1384 | { | 1384 | { |
| 1385 | int ret = 0, j, pidx, initfail; | 1385 | int ret = 0, j, pidx, initfail; |
| 1386 | struct hfi1_devdata *dd = NULL; | 1386 | struct hfi1_devdata *dd = ERR_PTR(-EINVAL); |
| 1387 | struct hfi1_pportdata *ppd; | 1387 | struct hfi1_pportdata *ppd; |
| 1388 | 1388 | ||
| 1389 | /* First, lock the non-writable module parameters */ | 1389 | /* First, lock the non-writable module parameters */ |
| @@ -78,6 +78,16 @@ static inline void clear_opa_smp_data(struct opa_smp *smp) · 77 unmodified lines | |||
| 78 | memset(data, 0, size); | 78 | memset(data, 0, size); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void hfi1_event_pkey_change(struct hfi1_devdata *dd, u8 port) | ||
| 82 | { | ||
| 83 | struct ib_event event; | ||
| 84 | |||
| 85 | event.event = IB_EVENT_PKEY_CHANGE; | ||
| 86 | event.device = &dd->verbs_dev.rdi.ibdev; | ||
| 87 | event.element.port_num = port; | ||
| 88 | ib_dispatch_event(&event); | ||
| 89 | } | ||
| 90 | |||
| 81 | static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) | 91 | static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) |
| 82 | { | 92 | { |
| 83 | struct ib_mad_send_buf *send_buf; | 93 | struct ib_mad_send_buf *send_buf; |
| @@ -1418,15 +1428,10 @@ static int set_pkeys(struct hfi1_devdata *dd, u8 port, u16 *pkeys) · 1334 unmodified lines | |||
| 1418 | } | 1428 | } |
| 1419 | 1429 | ||
| 1420 | if (changed) { | 1430 | if (changed) { |
| 1421 | struct ib_event event; | ||
| 1422 | |||
| 1423 | (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); | 1431 | (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); |
| 1424 | 1432 | hfi1_event_pkey_change(dd, port); | |
| 1425 | event.event = IB_EVENT_PKEY_CHANGE; | ||
| 1426 | event.device = &dd->verbs_dev.rdi.ibdev; | ||
| 1427 | event.element.port_num = port; | ||
| 1428 | ib_dispatch_event(&event); | ||
| 1429 | } | 1433 | } |
| 1434 | |||
| 1430 | return 0; | 1435 | return 0; |
| 1431 | } | 1436 | } |
| 1432 | 1437 | ||
| @@ -434,4 +434,6 @@ struct sc2vlnt { · 433 unmodified lines | |||
| 434 | COUNTER_MASK(1, 3) | \ | 434 | COUNTER_MASK(1, 3) | \ |
| 435 | COUNTER_MASK(1, 4)) | 435 | COUNTER_MASK(1, 4)) |
| 436 | 436 | ||
| 437 | void hfi1_event_pkey_change(struct hfi1_devdata *dd, u8 port); | ||
| 438 | |||
| 437 | #endif /* _HFI1_MAD_H */ | 439 | #endif /* _HFI1_MAD_H */ |
| @@ -995,7 +995,7 @@ static void sc_wait_for_packet_egress(struct send_context *sc, int pause) · 994 unmodified lines | |||
| 995 | /* counter is reset if occupancy count changes */ | 995 | /* counter is reset if occupancy count changes */ |
| 996 | if (reg != reg_prev) | 996 | if (reg != reg_prev) |
| 997 | loop = 0; | 997 | loop = 0; |
| 998 | if (loop > 500) { | 998 | if (loop > 50000) { |
| 999 | /* timed out - bounce the link */ | 999 | /* timed out - bounce the link */ |
| 1000 | dd_dev_err(dd, | 1000 | dd_dev_err(dd, |
| 1001 | "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u, bouncing link\n", | 1001 | "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u, bouncing link\n", |
| @@ -1797,6 +1797,21 @@ static void pio_map_rcu_callback(struct rcu_head *list) · 795 unmodified lines | |||
| 1797 | pio_map_free(m); | 1797 | pio_map_free(m); |
| 1798 | } | 1798 | } |
| 1799 | 1799 | ||
| 1800 | /* | ||
| 1801 | * Set credit return threshold for the kernel send context | ||
| 1802 | */ | ||
| 1803 | static void set_threshold(struct hfi1_devdata *dd, int scontext, int i) | ||
| 1804 | { | ||
| 1805 | u32 thres; | ||
| 1806 | |||
| 1807 | thres = min(sc_percent_to_threshold(dd->kernel_send_context[scontext], | ||
| 1808 | 50), | ||
| 1809 | sc_mtu_to_threshold(dd->kernel_send_context[scontext], | ||
| 1810 | dd->vld[i].mtu, | ||
| 1811 | dd->rcd[0]->rcvhdrqentsize)); | ||
| 1812 | sc_set_cr_threshold(dd->kernel_send_context[scontext], thres); | ||
| 1813 | } | ||
| 1814 | |||
| 1800 | /* | 1815 | /* |
| 1801 | * pio_map_init - called when #vls change | 1816 | * pio_map_init - called when #vls change |
| 1802 | * @dd: hfi1_devdata | 1817 | * @dd: hfi1_devdata |
| @@ -1872,11 +1887,16 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts) · 69 unmodified lines | |||
| 1872 | if (!newmap->map[i]) | 1887 | if (!newmap->map[i]) |
| 1873 | goto bail; | 1888 | goto bail; |
| 1874 | newmap->map[i]->mask = (1 << ilog2(sz)) - 1; | 1889 | newmap->map[i]->mask = (1 << ilog2(sz)) - 1; |
| 1875 | /* assign send contexts */ | 1890 | /* |
| 1891 | * assign send contexts and | ||
| 1892 | * adjust credit return threshold | ||
| 1893 | */ | ||
| 1876 | for (j = 0; j < sz; j++) { | 1894 | for (j = 0; j < sz; j++) { |
| 1877 | if (dd->kernel_send_context[scontext]) | 1895 | if (dd->kernel_send_context[scontext]) { |
| 1878 | newmap->map[i]->ksc[j] = | 1896 | newmap->map[i]->ksc[j] = |
| 1879 | dd->kernel_send_context[scontext]; | 1897 | dd->kernel_send_context[scontext]; |
| 1898 | set_threshold(dd, scontext, i); | ||
| 1899 | } | ||
| 1880 | if (++scontext >= first_scontext + | 1900 | if (++scontext >= first_scontext + |
| 1881 | vl_scontexts[i]) | 1901 | vl_scontexts[i]) |
| 1882 | /* wrap back to first send context */ | 1902 | /* wrap back to first send context */ |
| @@ -579,7 +579,8 @@ int qsfp_dump(struct hfi1_pportdata *ppd, char *buf, int len) · 578 unmodified lines | |||
| 579 | 579 | ||
| 580 | if (ppd->qsfp_info.cache_valid) { | 580 | if (ppd->qsfp_info.cache_valid) { |
| 581 | if (QSFP_IS_CU(cache[QSFP_MOD_TECH_OFFS])) | 581 | if (QSFP_IS_CU(cache[QSFP_MOD_TECH_OFFS])) |
| 582 | sprintf(lenstr, "%dM ", cache[QSFP_MOD_LEN_OFFS]); | 582 | snprintf(lenstr, sizeof(lenstr), "%dM ", |
| 583 | cache[QSFP_MOD_LEN_OFFS]); | ||
| 583 | 584 | ||
| 584 | power_byte = cache[QSFP_MOD_PWR_OFFS]; | 585 | power_byte = cache[QSFP_MOD_PWR_OFFS]; |
| 585 | sofar += scnprintf(buf + sofar, len - sofar, "PWR:%.3sW\n", | 586 | sofar += scnprintf(buf + sofar, len - sofar, "PWR:%.3sW\n", |
| @@ -92,11 +92,10 @@ void hfi1_put_txreq(struct verbs_txreq *tx) · 91 unmodified lines | |||
| 92 | 92 | ||
| 93 | struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, | 93 | struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, |
| 94 | struct rvt_qp *qp) | 94 | struct rvt_qp *qp) |
| 95 | __must_hold(&qp->s_lock) | ||
| 95 | { | 96 | { |
| 96 | struct verbs_txreq *tx = ERR_PTR(-EBUSY); | 97 | struct verbs_txreq *tx = ERR_PTR(-EBUSY); |
| 97 | unsigned long flags; | ||
| 98 | 98 | ||
| 99 | spin_lock_irqsave(&qp->s_lock, flags); | ||
| 100 | write_seqlock(&dev->iowait_lock); | 99 | write_seqlock(&dev->iowait_lock); |
| 101 | if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) { | 100 | if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) { |
| 102 | struct hfi1_qp_priv *priv; | 101 | struct hfi1_qp_priv *priv; |
| @@ -116,7 +115,6 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, · 13 unmodified lines | |||
| 116 | } | 115 | } |
| 117 | out: | 116 | out: |
| 118 | write_sequnlock(&dev->iowait_lock); | 117 | write_sequnlock(&dev->iowait_lock); |
| 119 | spin_unlock_irqrestore(&qp->s_lock, flags); | ||
| 120 | return tx; | 118 | return tx; |
| 121 | } | 119 | } |
| 122 | 120 | ||
| @@ -73,6 +73,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, · 72 unmodified lines | |||
| 73 | 73 | ||
| 74 | static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev, | 74 | static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev, |
| 75 | struct rvt_qp *qp) | 75 | struct rvt_qp *qp) |
| 76 | __must_hold(&qp->slock) | ||
| 76 | { | 77 | { |
| 77 | struct verbs_txreq *tx; | 78 | struct verbs_txreq *tx; |
| 78 | struct hfi1_qp_priv *priv = qp->priv; | 79 | struct hfi1_qp_priv *priv = qp->priv; |
| @@ -113,6 +113,8 @@ · 112 unmodified lines | |||
| 113 | 113 | ||
| 114 | #define IW_HMC_OBJ_TYPE_NUM ARRAY_SIZE(iw_hmc_obj_types) | 114 | #define IW_HMC_OBJ_TYPE_NUM ARRAY_SIZE(iw_hmc_obj_types) |
| 115 | #define IW_CFG_FPM_QP_COUNT 32768 | 115 | #define IW_CFG_FPM_QP_COUNT 32768 |
| 116 | #define I40IW_MAX_PAGES_PER_FMR 512 | ||
| 117 | #define I40IW_MIN_PAGES_PER_FMR 1 | ||
| 116 | 118 | ||
| 117 | #define I40IW_MTU_TO_MSS 40 | 119 | #define I40IW_MTU_TO_MSS 40 |
| 118 | #define I40IW_DEFAULT_MSS 1460 | 120 | #define I40IW_DEFAULT_MSS 1460 |
| @@ -79,6 +79,7 @@ static int i40iw_query_device(struct ib_device *ibdev, · 78 unmodified lines | |||
| 79 | props->max_qp_init_rd_atom = props->max_qp_rd_atom; | 79 | props->max_qp_init_rd_atom = props->max_qp_rd_atom; |
| 80 | props->atomic_cap = IB_ATOMIC_NONE; | 80 | props->atomic_cap = IB_ATOMIC_NONE; |
| 81 | props->max_map_per_fmr = 1; | 81 | props->max_map_per_fmr = 1; |
| 82 | props->max_fast_reg_page_list_len = I40IW_MAX_PAGES_PER_FMR; | ||
| 82 | return 0; | 83 | return 0; |
| 83 | } | 84 | } |
| 84 | 85 | ||
| @@ -1527,7 +1528,7 @@ static struct ib_mr *i40iw_alloc_mr(struct ib_pd *pd, · 1442 unmodified lines | |||
| 1527 | mutex_lock(&iwdev->pbl_mutex); | 1528 | mutex_lock(&iwdev->pbl_mutex); |
| 1528 | status = i40iw_get_pble(&iwdev->sc_dev, iwdev->pble_rsrc, palloc, iwmr->page_cnt); | 1529 | status = i40iw_get_pble(&iwdev->sc_dev, iwdev->pble_rsrc, palloc, iwmr->page_cnt); |
| 1529 | mutex_unlock(&iwdev->pbl_mutex); | 1530 | mutex_unlock(&iwdev->pbl_mutex); |
| 1530 | if (!status) | 1531 | if (status) |
| 1531 | goto err1; | 1532 | goto err1; |
| 1532 | 1533 | ||
| 1533 | if (palloc->level != I40IW_LEVEL_1) | 1534 | if (palloc->level != I40IW_LEVEL_1) |
| @@ -2149,6 +2150,7 @@ static int i40iw_post_send(struct ib_qp *ibqp, · 615 unmodified lines | |||
| 2149 | struct i40iw_sc_dev *dev = &iwqp->iwdev->sc_dev; | 2150 | struct i40iw_sc_dev *dev = &iwqp->iwdev->sc_dev; |
| 2150 | struct i40iw_fast_reg_stag_info info; | 2151 | struct i40iw_fast_reg_stag_info info; |
| 2151 | 2152 | ||
| 2153 | memset(&info, 0, sizeof(info)); | ||
| 2152 | info.access_rights = I40IW_ACCESS_FLAGS_LOCALREAD; | 2154 | info.access_rights = I40IW_ACCESS_FLAGS_LOCALREAD; |
| 2153 | info.access_rights |= i40iw_get_user_access(flags); | 2155 | info.access_rights |= i40iw_get_user_access(flags); |
| 2154 | info.stag_key = reg_wr(ib_wr)->key & 0xff; | 2156 | info.stag_key = reg_wr(ib_wr)->key & 0xff; |
| @@ -2158,10 +2160,14 @@ static int i40iw_post_send(struct ib_qp *ibqp, · 3 unmodified lines | |||
| 2158 | info.addr_type = I40IW_ADDR_TYPE_VA_BASED; | 2160 | info.addr_type = I40IW_ADDR_TYPE_VA_BASED; |
| 2159 | info.va = (void *)(uintptr_t)iwmr->ibmr.iova; | 2161 | info.va = (void *)(uintptr_t)iwmr->ibmr.iova; |
| 2160 | info.total_len = iwmr->ibmr.length; | 2162 | info.total_len = iwmr->ibmr.length; |
| 2163 | info.reg_addr_pa = *(u64 *)palloc->level1.addr; | ||
| 2161 | info.first_pm_pbl_index = palloc->level1.idx; | 2164 | info.first_pm_pbl_index = palloc->level1.idx; |
| 2162 | info.local_fence = ib_wr->send_flags & IB_SEND_FENCE; | 2165 | info.local_fence = ib_wr->send_flags & IB_SEND_FENCE; |
| 2163 | info.signaled = ib_wr->send_flags & IB_SEND_SIGNALED; | 2166 | info.signaled = ib_wr->send_flags & IB_SEND_SIGNALED; |
| 2164 | 2167 | ||
| 2168 | if (iwmr->npages > I40IW_MIN_PAGES_PER_FMR) | ||
| 2169 | info.chunk_size = 1; | ||
| 2170 | |||
| 2165 | if (page_shift == 21) | 2171 | if (page_shift == 21) |
| 2166 | info.page_size = 1; /* 2M page */ | 2172 | info.page_size = 1; /* 2M page */ |
| 2167 | 2173 | ||
| @@ -2327,13 +2333,16 @@ static int i40iw_req_notify_cq(struct ib_cq *ibcq, · 159 unmodified lines | |||
| 2327 | { | 2333 | { |
| 2328 | struct i40iw_cq *iwcq; | 2334 | struct i40iw_cq *iwcq; |
| 2329 | struct i40iw_cq_uk *ukcq; | 2335 | struct i40iw_cq_uk *ukcq; |
| 2330 | enum i40iw_completion_notify cq_notify = IW_CQ_COMPL_SOLICITED; | 2336 | unsigned long flags; |
| 2337 | enum i40iw_completion_notify cq_notify = IW_CQ_COMPL_EVENT; | ||
| 2331 | 2338 | ||
| 2332 | iwcq = (struct i40iw_cq *)ibcq; | 2339 | iwcq = (struct i40iw_cq *)ibcq; |
| 2333 | ukcq = &iwcq->sc_cq.cq_uk; | 2340 | ukcq = &iwcq->sc_cq.cq_uk; |
| 2334 | if (notify_flags == IB_CQ_NEXT_COMP) | 2341 | if (notify_flags == IB_CQ_SOLICITED) |
| 2335 | cq_notify = IW_CQ_COMPL_EVENT; | 2342 | cq_notify = IW_CQ_COMPL_SOLICITED; |
| 2343 | spin_lock_irqsave(&iwcq->lock, flags); | ||
| 2336 | ukcq->ops.iw_cq_request_notification(ukcq, cq_notify); | 2344 | ukcq->ops.iw_cq_request_notification(ukcq, cq_notify); |
| 2345 | spin_unlock_irqrestore(&iwcq->lock, flags); | ||
| 2337 | return 0; | 2346 | return 0; |
| 2338 | } | 2347 | } |
| 2339 | 2348 | ||
| @@ -47,6 +47,7 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, · 46 unmodified lines | |||
| 47 | 47 | ||
| 48 | ah->av.ib.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24)); | 48 | ah->av.ib.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24)); |
| 49 | ah->av.ib.g_slid = ah_attr->src_path_bits; | 49 | ah->av.ib.g_slid = ah_attr->src_path_bits; |
| 50 | ah->av.ib.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); | ||
| 50 | if (ah_attr->ah_flags & IB_AH_GRH) { | 51 | if (ah_attr->ah_flags & IB_AH_GRH) { |
| 51 | ah->av.ib.g_slid |= 0x80; | 52 | ah->av.ib.g_slid |= 0x80; |
| 52 | ah->av.ib.gid_index = ah_attr->grh.sgid_index; | 53 | ah->av.ib.gid_index = ah_attr->grh.sgid_index; |
| @@ -64,7 +65,6 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, · 11 unmodified lines | |||
| 64 | !(1 << ah->av.ib.stat_rate & dev->caps.stat_rate_support)) | 65 | !(1 << ah->av.ib.stat_rate & dev->caps.stat_rate_support)) |
| 65 | --ah->av.ib.stat_rate; | 66 | --ah->av.ib.stat_rate; |
| 66 | } | 67 | } |
| 67 | ah->av.ib.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); | ||
| 68 | 68 | ||
| 69 | return &ah->ibah; | 69 | return &ah->ibah; |
| 70 | } | 70 | } |
| @@ -527,7 +527,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, · 526 unmodified lines | |||
| 527 | tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1); | 527 | tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1); |
| 528 | spin_unlock(&tun_qp->tx_lock); | 528 | spin_unlock(&tun_qp->tx_lock); |
| 529 | if (ret) | 529 | if (ret) |
| 530 | goto out; | 530 | goto end; |
| 531 | 531 | ||
| 532 | tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr); | 532 | tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr); |
| 533 | if (tun_qp->tx_ring[tun_tx_ix].ah) | 533 | if (tun_qp->tx_ring[tun_tx_ix].ah) |
| @@ -596,9 +596,15 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, · 62 unmodified lines | |||
| 596 | wr.wr.send_flags = IB_SEND_SIGNALED; | 596 | wr.wr.send_flags = IB_SEND_SIGNALED; |
| 597 | 597 | ||
| 598 | ret = ib_post_send(src_qp, &wr.wr, &bad_wr); | 598 | ret = ib_post_send(src_qp, &wr.wr, &bad_wr); |
| 599 | out: | 599 | if (!ret) |
| 600 | if (ret) | 600 | return 0; |
| 601 | ib_destroy_ah(ah); | 601 | out: |
| 602 | spin_lock(&tun_qp->tx_lock); | ||
| 603 | tun_qp->tx_ix_tail++; | ||
| 604 | spin_unlock(&tun_qp->tx_lock); | ||
| 605 | tun_qp->tx_ring[tun_tx_ix].ah = NULL; | ||
| 606 | end: | ||
| 607 | ib_destroy_ah(ah); | ||
| 602 | return ret; | 608 | return ret; |
| 603 | } | 609 | } |
| 604 | 610 | ||
| @@ -1326,9 +1332,15 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, · 721 unmodified lines | |||
| 1326 | 1332 | ||
| 1327 | 1333 | ||
| 1328 | ret = ib_post_send(send_qp, &wr.wr, &bad_wr); | 1334 | ret = ib_post_send(send_qp, &wr.wr, &bad_wr); |
| 1335 | if (!ret) | ||
| 1336 | return 0; | ||
| 1337 | |||
| 1338 | spin_lock(&sqp->tx_lock); | ||
| 1339 | sqp->tx_ix_tail++; | ||
| 1340 | spin_unlock(&sqp->tx_lock); | ||
| 1341 | sqp->tx_ring[wire_tx_ix].ah = NULL; | ||
| 1329 | out: | 1342 | out: |
| 1330 | if (ret) | 1343 | ib_destroy_ah(ah); |
| 1331 | ib_destroy_ah(ah); | ||
| 1332 | return ret; | 1344 | return ret; |
| 1333 | } | 1345 | } |
| 1334 | 1346 | ||
| @@ -1704,6 +1704,9 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 1703 unmodified lines | |||
| 1704 | struct mlx4_dev *dev = (to_mdev(qp->device))->dev; | 1704 | struct mlx4_dev *dev = (to_mdev(qp->device))->dev; |
| 1705 | int is_bonded = mlx4_is_bonded(dev); | 1705 | int is_bonded = mlx4_is_bonded(dev); |
| 1706 | 1706 | ||
| 1707 | if (flow_attr->port < 1 || flow_attr->port > qp->device->phys_port_cnt) | ||
| 1708 | return ERR_PTR(-EINVAL); | ||
| 1709 | |||
| 1707 | if ((flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) && | 1710 | if ((flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) && |
| 1708 | (flow_attr->type != IB_FLOW_ATTR_NORMAL)) | 1711 | (flow_attr->type != IB_FLOW_ATTR_NORMAL)) |
| 1709 | return ERR_PTR(-EOPNOTSUPP); | 1712 | return ERR_PTR(-EOPNOTSUPP); |
| @@ -139,7 +139,7 @@ struct mlx4_ib_mr { · 138 unmodified lines | |||
| 139 | u32 max_pages; | 139 | u32 max_pages; |
| 140 | struct mlx4_mr mmr; | 140 | struct mlx4_mr mmr; |
| 141 | struct ib_umem *umem; | 141 | struct ib_umem *umem; |
| 142 | void *pages_alloc; | 142 | size_t page_map_size; |
| 143 | }; | 143 | }; |
| 144 | 144 | ||
| 145 | struct mlx4_ib_mw { | 145 | struct mlx4_ib_mw { |
| @@ -277,20 +277,23 @@ mlx4_alloc_priv_pages(struct ib_device *device, · 276 unmodified lines | |||
| 277 | struct mlx4_ib_mr *mr, | 277 | struct mlx4_ib_mr *mr, |
| 278 | int max_pages) | 278 | int max_pages) |
| 279 | { | 279 | { |
| 280 | int size = max_pages * sizeof(u64); | ||
| 281 | int add_size; | ||
| 282 | int ret; | 280 | int ret; |
| 283 | 281 | ||
| 284 | add_size = max_t(int, MLX4_MR_PAGES_ALIGN - ARCH_KMALLOC_MINALIGN, 0); | 282 | /* Ensure that size is aligned to DMA cacheline |
| 283 | * requirements. | ||
| 284 | * max_pages is limited to MLX4_MAX_FAST_REG_PAGES | ||
| 285 | * so page_map_size will never cross PAGE_SIZE. | ||
| 286 | */ | ||
| 287 | mr->page_map_size = roundup(max_pages * sizeof(u64), | ||
| 288 | MLX4_MR_PAGES_ALIGN); | ||
| 285 | 289 | ||
| 286 | mr->pages_alloc = kzalloc(size + add_size, GFP_KERNEL); | 290 | /* Prevent cross page boundary allocation. */ |
| 287 | if (!mr->pages_alloc) | 291 | mr->pages = (__be64 *)get_zeroed_page(GFP_KERNEL); |
| 292 | if (!mr->pages) | ||
| 288 | return -ENOMEM; | 293 | return -ENOMEM; |
| 289 | 294 | ||
| 290 | mr->pages = PTR_ALIGN(mr->pages_alloc, MLX4_MR_PAGES_ALIGN); | ||
| 291 | |||
| 292 | mr->page_map = dma_map_single(device->dma_device, mr->pages, | 295 | mr->page_map = dma_map_single(device->dma_device, mr->pages, |
| 293 | size, DMA_TO_DEVICE); | 296 | mr->page_map_size, DMA_TO_DEVICE); |
| 294 | 297 | ||
| 295 | if (dma_mapping_error(device->dma_device, mr->page_map)) { | 298 | if (dma_mapping_error(device->dma_device, mr->page_map)) { |
| 296 | ret = -ENOMEM; | 299 | ret = -ENOMEM; |
| @@ -298,9 +301,9 @@ mlx4_alloc_priv_pages(struct ib_device *device, · 1 unmodified line | |||
| 298 | } | 301 | } |
| 299 | 302 | ||
| 300 | return 0; | 303 | return 0; |
| 301 | err: | ||
| 302 | kfree(mr->pages_alloc); | ||
| 303 | 304 | ||
| 305 | err: | ||
| 306 | free_page((unsigned long)mr->pages); | ||
| 304 | return ret; | 307 | return ret; |
| 305 | } | 308 | } |
| 306 | 309 | ||
| @@ -309,11 +312,10 @@ mlx4_free_priv_pages(struct mlx4_ib_mr *mr) · 2 unmodified lines | |||
| 309 | { | 312 | { |
| 310 | if (mr->pages) { | 313 | if (mr->pages) { |
| 311 | struct ib_device *device = mr->ibmr.device; | 314 | struct ib_device *device = mr->ibmr.device; |
| 312 | int size = mr->max_pages * sizeof(u64); | ||
| 313 | 315 | ||
| 314 | dma_unmap_single(device->dma_device, mr->page_map, | 316 | dma_unmap_single(device->dma_device, mr->page_map, |
| 315 | size, DMA_TO_DEVICE); | 317 | mr->page_map_size, DMA_TO_DEVICE); |
| 316 | kfree(mr->pages_alloc); | 318 | free_page((unsigned long)mr->pages); |
| 317 | mr->pages = NULL; | 319 | mr->pages = NULL; |
| 318 | } | 320 | } |
| 319 | } | 321 | } |
| @@ -537,14 +539,12 @@ int mlx4_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, · 217 unmodified lines | |||
| 537 | mr->npages = 0; | 539 | mr->npages = 0; |
| 538 | 540 | ||
| 539 | ib_dma_sync_single_for_cpu(ibmr->device, mr->page_map, | 541 | ib_dma_sync_single_for_cpu(ibmr->device, mr->page_map, |
| 540 | sizeof(u64) * mr->max_pages, | 542 | mr->page_map_size, DMA_TO_DEVICE); |
| 541 | DMA_TO_DEVICE); | ||
| 542 | 543 | ||
| 543 | rc = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, mlx4_set_page); | 544 | rc = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, mlx4_set_page); |
| 544 | 545 | ||
| 545 | ib_dma_sync_single_for_device(ibmr->device, mr->page_map, | 546 | ib_dma_sync_single_for_device(ibmr->device, mr->page_map, |
| 546 | sizeof(u64) * mr->max_pages, | 547 | mr->page_map_size, DMA_TO_DEVICE); |
| 547 | DMA_TO_DEVICE); | ||
| 548 | 548 | ||
| 549 | return rc; | 549 | return rc; |
| 550 | } | 550 | } |
| @@ -362,7 +362,7 @@ static int send_wqe_overhead(enum mlx4_ib_qp_type type, u32 flags) · 361 unmodified lines | |||
| 362 | sizeof (struct mlx4_wqe_raddr_seg); | 362 | sizeof (struct mlx4_wqe_raddr_seg); |
| 363 | case MLX4_IB_QPT_RC: | 363 | case MLX4_IB_QPT_RC: |
| 364 | return sizeof (struct mlx4_wqe_ctrl_seg) + | 364 | return sizeof (struct mlx4_wqe_ctrl_seg) + |
| 365 | sizeof (struct mlx4_wqe_atomic_seg) + | 365 | sizeof (struct mlx4_wqe_masked_atomic_seg) + |
| 366 | sizeof (struct mlx4_wqe_raddr_seg); | 366 | sizeof (struct mlx4_wqe_raddr_seg); |
| 367 | case MLX4_IB_QPT_SMI: | 367 | case MLX4_IB_QPT_SMI: |
| 368 | case MLX4_IB_QPT_GSI: | 368 | case MLX4_IB_QPT_GSI: |
| @@ -1191,8 +1191,10 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd, · 822 unmodified lines | |||
| 1191 | { | 1191 | { |
| 1192 | err = create_qp_common(to_mdev(pd->device), pd, init_attr, | 1192 | err = create_qp_common(to_mdev(pd->device), pd, init_attr, |
| 1193 | udata, 0, &qp, gfp); | 1193 | udata, 0, &qp, gfp); |
| 1194 | if (err) | 1194 | if (err) { |
| 1195 | kfree(qp); | ||
| 1195 | return ERR_PTR(err); | 1196 | return ERR_PTR(err); |
| 1197 | } | ||
| 1196 | 1198 | ||
| 1197 | qp->ibqp.qp_num = qp->mqp.qpn; | 1199 | qp->ibqp.qp_num = qp->mqp.qpn; |
| 1198 | qp->xrcdn = xrcdn; | 1200 | qp->xrcdn = xrcdn; |
| @@ -121,7 +121,7 @@ static void pma_cnt_ext_assign(struct ib_pma_portcounters_ext *pma_cnt_ext, · 120 unmodified lines | |||
| 121 | pma_cnt_ext->port_xmit_data = | 121 | pma_cnt_ext->port_xmit_data = |
| 122 | cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.octets, | 122 | cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.octets, |
| 123 | transmitted_ib_multicast.octets) >> 2); | 123 | transmitted_ib_multicast.octets) >> 2); |
| 124 | pma_cnt_ext->port_xmit_data = | 124 | pma_cnt_ext->port_rcv_data = |
| 125 | cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.octets, | 125 | cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.octets, |
| 126 | received_ib_multicast.octets) >> 2); | 126 | received_ib_multicast.octets) >> 2); |
| 127 | pma_cnt_ext->port_xmit_packets = | 127 | pma_cnt_ext->port_xmit_packets = |
| @@ -3332,10 +3332,11 @@ static u8 get_fence(u8 fence, struct ib_send_wr *wr) · 3331 unmodified lines | |||
| 3332 | return MLX5_FENCE_MODE_SMALL_AND_FENCE; | 3332 | return MLX5_FENCE_MODE_SMALL_AND_FENCE; |
| 3333 | else | 3333 | else |
| 3334 | return fence; | 3334 | return fence; |
| 3335 | 3335 | } else if (unlikely(wr->send_flags & IB_SEND_FENCE)) { | |
| 3336 | } else { | 3336 | return MLX5_FENCE_MODE_FENCE; |
| 3337 | return 0; | ||
| 3338 | } | 3337 | } |
| 3338 | |||
| 3339 | return 0; | ||
| 3339 | } | 3340 | } |
| 3340 | 3341 | ||
| 3341 | static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, | 3342 | static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, |
| @@ -2178,6 +2178,11 @@ static ssize_t qib_write(struct file *fp, const char __user *data, · 2177 unmodified lines | |||
| 2178 | 2178 | ||
| 2179 | switch (cmd.type) { | 2179 | switch (cmd.type) { |
| 2180 | case QIB_CMD_ASSIGN_CTXT: | 2180 | case QIB_CMD_ASSIGN_CTXT: |
| 2181 | if (rcd) { | ||
| 2182 | ret = -EINVAL; | ||
| 2183 | goto bail; | ||
| 2184 | } | ||
| 2185 | |||
| 2181 | ret = qib_assign_ctxt(fp, &cmd.cmd.user_info); | 2186 | ret = qib_assign_ctxt(fp, &cmd.cmd.user_info); |
| 2182 | if (ret) | 2187 | if (ret) |
| 2183 | goto bail; | 2188 | goto bail; |
| @@ -369,8 +369,8 @@ static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, · 368 unmodified lines | |||
| 369 | /* wrap to first map page, invert bit 0 */ | 369 | /* wrap to first map page, invert bit 0 */ |
| 370 | offset = qpt->incr | ((offset & 1) ^ 1); | 370 | offset = qpt->incr | ((offset & 1) ^ 1); |
| 371 | } | 371 | } |
| 372 | /* there can be no bits at shift and below */ | 372 | /* there can be no set bits in low-order QoS bits */ |
| 373 | WARN_ON(offset & (rdi->dparms.qos_shift - 1)); | 373 | WARN_ON(offset & (BIT(rdi->dparms.qos_shift) - 1)); |
| 374 | qpn = mk_qpn(qpt, map, offset); | 374 | qpn = mk_qpn(qpt, map, offset); |
| 375 | } | 375 | } |
| 376 | 376 | ||
| @@ -576,12 +576,6 @@ static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp, · 199 unmodified lines | |||
| 576 | qp->s_ssn = 1; | 576 | qp->s_ssn = 1; |
| 577 | qp->s_lsn = 0; | 577 | qp->s_lsn = 0; |
| 578 | qp->s_mig_state = IB_MIG_MIGRATED; | 578 | qp->s_mig_state = IB_MIG_MIGRATED; |
| 579 | if (qp->s_ack_queue) | ||
| 580 | memset( | ||
| 581 | qp->s_ack_queue, | ||
| 582 | 0, | ||
| 583 | rvt_max_atomic(rdi) * | ||
| 584 | sizeof(*qp->s_ack_queue)); | ||
| 585 | qp->r_head_ack_queue = 0; | 579 | qp->r_head_ack_queue = 0; |
| 586 | qp->s_tail_ack_queue = 0; | 580 | qp->s_tail_ack_queue = 0; |
| 587 | qp->s_num_rd_atomic = 0; | 581 | qp->s_num_rd_atomic = 0; |
| @@ -705,8 +699,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, · 117 unmodified lines | |||
| 705 | * initialization that is needed. | 699 | * initialization that is needed. |
| 706 | */ | 700 | */ |
| 707 | priv = rdi->driver_f.qp_priv_alloc(rdi, qp, gfp); | 701 | priv = rdi->driver_f.qp_priv_alloc(rdi, qp, gfp); |
| 708 | if (!priv) | 702 | if (IS_ERR(priv)) { |
| 703 | ret = priv; | ||
| 709 | goto bail_qp; | 704 | goto bail_qp; |
| 705 | } | ||
| 710 | qp->priv = priv; | 706 | qp->priv = priv; |
| 711 | qp->timeout_jiffies = | 707 | qp->timeout_jiffies = |
| 712 | usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / | 708 | usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / |
| @@ -501,9 +501,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb) · 500 unmodified lines | |||
| 501 | !rdi->driver_f.quiesce_qp || | 501 | !rdi->driver_f.quiesce_qp || |
| 502 | !rdi->driver_f.notify_error_qp || | 502 | !rdi->driver_f.notify_error_qp || |
| 503 | !rdi->driver_f.mtu_from_qp || | 503 | !rdi->driver_f.mtu_from_qp || |
| 504 | !rdi->driver_f.mtu_to_path_mtu || | 504 | !rdi->driver_f.mtu_to_path_mtu) |
| 505 | !rdi->driver_f.shut_down_port || | ||
| 506 | !rdi->driver_f.cap_mask_chg) | ||
| 507 | return -EINVAL; | 505 | return -EINVAL; |
| 508 | break; | 506 | break; |
| 509 | 507 | ||
| @@ -1638,8 +1638,7 @@ retry: · 1637 unmodified lines | |||
| 1638 | */ | 1638 | */ |
| 1639 | qp_init->cap.max_send_wr = srp_sq_size / 2; | 1639 | qp_init->cap.max_send_wr = srp_sq_size / 2; |
| 1640 | qp_init->cap.max_rdma_ctxs = srp_sq_size / 2; | 1640 | qp_init->cap.max_rdma_ctxs = srp_sq_size / 2; |
| 1641 | qp_init->cap.max_send_sge = max(sdev->device->attrs.max_sge_rd, | 1641 | qp_init->cap.max_send_sge = SRPT_DEF_SG_PER_WQE; |
| 1642 | sdev->device->attrs.max_sge); | ||
| 1643 | qp_init->port_num = ch->sport->port; | 1642 | qp_init->port_num = ch->sport->port; |
| 1644 | 1643 | ||
| 1645 | ch->qp = ib_create_qp(sdev->pd, qp_init); | 1644 | ch->qp = ib_create_qp(sdev->pd, qp_init); |
| @@ -106,6 +106,7 @@ enum { · 105 unmodified lines | |||
| 106 | SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2, | 106 | SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2, |
| 107 | 107 | ||
| 108 | SRPT_DEF_SG_TABLESIZE = 128, | 108 | SRPT_DEF_SG_TABLESIZE = 128, |
| 109 | SRPT_DEF_SG_PER_WQE = 16, | ||
| 109 | 110 | ||
| 110 | MIN_SRPT_SQ_SIZE = 16, | 111 | MIN_SRPT_SQ_SIZE = 16, |
| 111 | DEF_SRPT_SQ_SIZE = 4096, | 112 | DEF_SRPT_SQ_SIZE = 4096, |
| @@ -172,6 +172,7 @@ enum { · 171 unmodified lines | |||
| 172 | enum { | 172 | enum { |
| 173 | MLX5_FENCE_MODE_NONE = 0 << 5, | 173 | MLX5_FENCE_MODE_NONE = 0 << 5, |
| 174 | MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5, | 174 | MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5, |
| 175 | MLX5_FENCE_MODE_FENCE = 2 << 5, | ||
| 175 | MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5, | 176 | MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5, |
| 176 | MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5, | 177 | MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5, |
| 177 | }; | 178 | }; |
| @@ -203,7 +203,9 @@ struct rvt_driver_provided { · 202 unmodified lines | |||
| 203 | 203 | ||
| 204 | /* | 204 | /* |
| 205 | * Allocate a private queue pair data structure for driver specific | 205 | * Allocate a private queue pair data structure for driver specific |
| 206 | * information which is opaque to rdmavt. | 206 | * information which is opaque to rdmavt. Errors are returned via |
| 207 | * ERR_PTR(err). The driver is free to return NULL or a valid | ||
| 208 | * pointer. | ||
| 207 | */ | 209 | */ |
| 208 | void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp, | 210 | void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp, |
| 209 | gfp_t gfp); | 211 | gfp_t gfp); |