@@ -2027,33 +2027,55 @@ static int modify_qp(struct ib_uverbs_file *file,
2027
2027
2028
2028
if ((cmd -> base .attr_mask & IB_QP_CUR_STATE &&
2029
2029
cmd -> base .cur_qp_state > IB_QPS_ERR ) ||
2030
- cmd -> base .qp_state > IB_QPS_ERR ) {
2030
+ (cmd -> base .attr_mask & IB_QP_STATE &&
2031
+ cmd -> base .qp_state > IB_QPS_ERR )) {
2031
2032
ret = - EINVAL ;
2032
2033
goto release_qp ;
2033
2034
}
2034
2035
2035
- attr -> qp_state = cmd -> base .qp_state ;
2036
- attr -> cur_qp_state = cmd -> base .cur_qp_state ;
2037
- attr -> path_mtu = cmd -> base .path_mtu ;
2038
- attr -> path_mig_state = cmd -> base .path_mig_state ;
2039
- attr -> qkey = cmd -> base .qkey ;
2040
- attr -> rq_psn = cmd -> base .rq_psn ;
2041
- attr -> sq_psn = cmd -> base .sq_psn ;
2042
- attr -> dest_qp_num = cmd -> base .dest_qp_num ;
2043
- attr -> qp_access_flags = cmd -> base .qp_access_flags ;
2044
- attr -> pkey_index = cmd -> base .pkey_index ;
2045
- attr -> alt_pkey_index = cmd -> base .alt_pkey_index ;
2046
- attr -> en_sqd_async_notify = cmd -> base .en_sqd_async_notify ;
2047
- attr -> max_rd_atomic = cmd -> base .max_rd_atomic ;
2048
- attr -> max_dest_rd_atomic = cmd -> base .max_dest_rd_atomic ;
2049
- attr -> min_rnr_timer = cmd -> base .min_rnr_timer ;
2050
- attr -> port_num = cmd -> base .port_num ;
2051
- attr -> timeout = cmd -> base .timeout ;
2052
- attr -> retry_cnt = cmd -> base .retry_cnt ;
2053
- attr -> rnr_retry = cmd -> base .rnr_retry ;
2054
- attr -> alt_port_num = cmd -> base .alt_port_num ;
2055
- attr -> alt_timeout = cmd -> base .alt_timeout ;
2056
- attr -> rate_limit = cmd -> rate_limit ;
2036
+ if (cmd -> base .attr_mask & IB_QP_STATE )
2037
+ attr -> qp_state = cmd -> base .qp_state ;
2038
+ if (cmd -> base .attr_mask & IB_QP_CUR_STATE )
2039
+ attr -> cur_qp_state = cmd -> base .cur_qp_state ;
2040
+ if (cmd -> base .attr_mask & IB_QP_PATH_MTU )
2041
+ attr -> path_mtu = cmd -> base .path_mtu ;
2042
+ if (cmd -> base .attr_mask & IB_QP_PATH_MIG_STATE )
2043
+ attr -> path_mig_state = cmd -> base .path_mig_state ;
2044
+ if (cmd -> base .attr_mask & IB_QP_QKEY )
2045
+ attr -> qkey = cmd -> base .qkey ;
2046
+ if (cmd -> base .attr_mask & IB_QP_RQ_PSN )
2047
+ attr -> rq_psn = cmd -> base .rq_psn ;
2048
+ if (cmd -> base .attr_mask & IB_QP_SQ_PSN )
2049
+ attr -> sq_psn = cmd -> base .sq_psn ;
2050
+ if (cmd -> base .attr_mask & IB_QP_DEST_QPN )
2051
+ attr -> dest_qp_num = cmd -> base .dest_qp_num ;
2052
+ if (cmd -> base .attr_mask & IB_QP_ACCESS_FLAGS )
2053
+ attr -> qp_access_flags = cmd -> base .qp_access_flags ;
2054
+ if (cmd -> base .attr_mask & IB_QP_PKEY_INDEX )
2055
+ attr -> pkey_index = cmd -> base .pkey_index ;
2056
+ if (cmd -> base .attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY )
2057
+ attr -> en_sqd_async_notify = cmd -> base .en_sqd_async_notify ;
2058
+ if (cmd -> base .attr_mask & IB_QP_MAX_QP_RD_ATOMIC )
2059
+ attr -> max_rd_atomic = cmd -> base .max_rd_atomic ;
2060
+ if (cmd -> base .attr_mask & IB_QP_MAX_DEST_RD_ATOMIC )
2061
+ attr -> max_dest_rd_atomic = cmd -> base .max_dest_rd_atomic ;
2062
+ if (cmd -> base .attr_mask & IB_QP_MIN_RNR_TIMER )
2063
+ attr -> min_rnr_timer = cmd -> base .min_rnr_timer ;
2064
+ if (cmd -> base .attr_mask & IB_QP_PORT )
2065
+ attr -> port_num = cmd -> base .port_num ;
2066
+ if (cmd -> base .attr_mask & IB_QP_TIMEOUT )
2067
+ attr -> timeout = cmd -> base .timeout ;
2068
+ if (cmd -> base .attr_mask & IB_QP_RETRY_CNT )
2069
+ attr -> retry_cnt = cmd -> base .retry_cnt ;
2070
+ if (cmd -> base .attr_mask & IB_QP_RNR_RETRY )
2071
+ attr -> rnr_retry = cmd -> base .rnr_retry ;
2072
+ if (cmd -> base .attr_mask & IB_QP_ALT_PATH ) {
2073
+ attr -> alt_port_num = cmd -> base .alt_port_num ;
2074
+ attr -> alt_timeout = cmd -> base .alt_timeout ;
2075
+ attr -> alt_pkey_index = cmd -> base .alt_pkey_index ;
2076
+ }
2077
+ if (cmd -> base .attr_mask & IB_QP_RATE_LIMIT )
2078
+ attr -> rate_limit = cmd -> rate_limit ;
2057
2079
2058
2080
if (cmd -> base .attr_mask & IB_QP_AV )
2059
2081
copy_ah_attr_from_uverbs (qp -> device , & attr -> ah_attr ,
0 commit comments