On 6/4/2019 10:38 AM, Christoph Hellwig wrote:
int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
{
- dereg_mr(to_mdev(ibmr->device), to_mmr(ibmr));
+ struct mlx5_ib_mr *mmr = to_mmr(ibmr);
+
+ if (ibmr->type == IB_MR_TYPE_INTEGRITY)
+ dereg_mr(to_mdev(mmr->pi_mr->ibmr.device), mmr->pi_mr);
+
+ dereg_mr(to_mdev(ibmr->device), mmr);
Just curious: how could the device for the PI MR be different? In other
words, why can't this just be:
The device is not different but we need to do both dereg_mr(mdev,
mmr->pi_mr) and dereg_mr(mdev, mmr).
struct mlx5_ib_mr *mmr = to_mmr(ibmr);
if (ibmr->type == IB_MR_TYPE_INTEGRITY)
mmr = mmr->pi_mr;
dereg_mr(to_mdev(ibmr->device), mmr);