{
struct ib_pd *pd = mr->pd;
struct ib_dm *dm = mr->dm;
+ struct ib_sig_attrs *sig_attrs = mr->sig_attrs;
int ret;
rdma_restrack_del(&mr->res);
atomic_dec(&pd->usecnt);
if (dm)
atomic_dec(&dm->usecnt);
+ kfree(sig_attrs);
}
return ret;
mr->res.type = RDMA_RESTRACK_MR;
rdma_restrack_kadd(&mr->res);
mr->type = mr_type;
+ mr->sig_attrs = NULL;
}
return mr;
u32 max_num_meta_sg)
{
struct ib_mr *mr;
+ struct ib_sig_attrs *sig_attrs;
if (!pd->device->ops.alloc_mr_integrity ||
!pd->device->ops.map_mr_sg_pi)
if (!max_num_meta_sg)
return ERR_PTR(-EINVAL);
+ sig_attrs = kzalloc(sizeof(struct ib_sig_attrs), GFP_KERNEL);
+ if (!sig_attrs)
+ return ERR_PTR(-ENOMEM);
+
mr = pd->device->ops.alloc_mr_integrity(pd, max_num_data_sg,
max_num_meta_sg);
- if (IS_ERR(mr))
+ if (IS_ERR(mr)) {
+ kfree(sig_attrs);
return mr;
+ }
mr->device = pd->device;
mr->pd = pd;
mr->res.type = RDMA_RESTRACK_MR;
rdma_restrack_kadd(&mr->res);
mr->type = IB_MR_TYPE_INTEGRITY;
+ mr->sig_attrs = sig_attrs;
return mr;
}
* @check_mask: bitmask for signature byte check (8 bytes)
* @mem: memory domain layout descriptor.
* @wire: wire domain layout descriptor.
+ * @meta_length: metadata length
*/
struct ib_sig_attrs {
u8 check_mask;
struct ib_sig_domain mem;
struct ib_sig_domain wire;
+ int meta_length;
};
enum ib_sig_err_type {