@@ -3133,6 +3133,21 @@ static int modify_raw_packet_tx_affinity(struct mlx5_core_dev *dev,
3133
3133
return err ;
3134
3134
}
3135
3135
3136
+ static void mlx5_set_path_udp_sport (struct mlx5_qp_path * path ,
3137
+ const struct rdma_ah_attr * ah ,
3138
+ u32 lqpn , u32 rqpn )
3139
+
3140
+ {
3141
+ u32 fl = ah -> grh .flow_label ;
3142
+ u16 sport ;
3143
+
3144
+ if (!fl )
3145
+ fl = rdma_calc_flow_label (lqpn , rqpn );
3146
+
3147
+ sport = rdma_flow_label_to_udp_sport (fl );
3148
+ path -> udp_sport = cpu_to_be16 (sport );
3149
+ }
3150
+
3136
3151
static int mlx5_set_path (struct mlx5_ib_dev * dev , struct mlx5_ib_qp * qp ,
3137
3152
const struct rdma_ah_attr * ah ,
3138
3153
struct mlx5_qp_path * path , u8 port , int attr_mask ,
@@ -3164,12 +3179,15 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
3164
3179
return - EINVAL ;
3165
3180
3166
3181
memcpy (path -> rmac , ah -> roce .dmac , sizeof (ah -> roce .dmac ));
3167
- if (qp -> ibqp .qp_type == IB_QPT_RC ||
3168
- qp -> ibqp .qp_type == IB_QPT_UC ||
3169
- qp -> ibqp .qp_type == IB_QPT_XRC_INI ||
3170
- qp -> ibqp .qp_type == IB_QPT_XRC_TGT )
3171
- path -> udp_sport =
3172
- mlx5_get_roce_udp_sport (dev , ah -> grh .sgid_attr );
3182
+ if ((qp -> ibqp .qp_type == IB_QPT_RC ||
3183
+ qp -> ibqp .qp_type == IB_QPT_UC ||
3184
+ qp -> ibqp .qp_type == IB_QPT_XRC_INI ||
3185
+ qp -> ibqp .qp_type == IB_QPT_XRC_TGT ) &&
3186
+ (grh -> sgid_attr -> gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP ) &&
3187
+ (attr_mask & IB_QP_DEST_QPN ))
3188
+ mlx5_set_path_udp_sport (path , ah ,
3189
+ qp -> ibqp .qp_num ,
3190
+ attr -> dest_qp_num );
3173
3191
path -> dci_cfi_prio_sl = (sl & 0x7 ) << 4 ;
3174
3192
gid_type = ah -> grh .sgid_attr -> gid_type ;
3175
3193
if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP )
0 commit comments