RE: [Patch v4 12/12] RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Ajay Sharma <sharmaajay@xxxxxxxxxxxxx>
> Sent: Tuesday, July 12, 2022 9:33 PM
> >  ...
> > +	switch (mr_params->mr_type) {
> > +	case GDMA_MR_TYPE_GVA:
> > +		req.mr_type = GDMA_MR_TYPE_GVA;
> > +		req.gva.dma_region_handle = mr_params->gva.dma_region_handle;
> > +		req.gva.virtual_address = mr_params->gva.virtual_address;
> > +		req.gva.access_flags = mr_params->gva.access_flags;
> > +		break;
> > +
> > +	case GDMA_MR_TYPE_GPA:
> > +		req.mr_type = GDMA_MR_TYPE_GPA;
> > +		req.gpa.access_flags = mr_params->gpa.access_flags;
> > +		break;
> > +
> > +	case GDMA_MR_TYPE_FMR:
> > +		req.mr_type = GDMA_MR_TYPE_FMR;
> > +		req.fmr.page_size = mr_params->fmr.page_size;
> > +		req.fmr.reserved_pte_count = mr_params->fmr.reserved_pte_count;
> > +		break;
> > +
> > +	default:
> > +		ibdev_dbg(&dev->ib_dev,
> > +			  "invalid param (GDMA_MR_TYPE) passed, type %d\n",
> > +			  req.mr_type);
> 
> Here req.mr_type is always 0.
> We should remove the 3 above lines of "req.mr_type = ...", and add a line
> "req.mr_type = mr_params->mr_type;" before the "switch" line..
> 
> No, That's incorrect. The mr_type is being explicitly set here to control what
> regions get exposed to the user and kernel. GPA and FMR are never exposed to
> user. So we cannot assign req.mr_type = mr_params->mr_type.

I'm not following you. I meant the below change, which should have no
functional change, right? In the "default:" branch , we just "goto error;", so
there is no functional change either.

--- drivers/infiniband/hw/mana/main.c.orig
+++ drivers/infiniband/hw/mana/main.c
@@ -394,21 +394,19 @@
                             sizeof(resp));
        req.pd_handle = mr_params->pd_handle;

+       req.mr_type = mr_params->mr_type;
        switch (mr_params->mr_type) {
        case GDMA_MR_TYPE_GVA:
-               req.mr_type = GDMA_MR_TYPE_GVA;
                req.gva.dma_region_handle = mr_params->gva.dma_region_handle;
                req.gva.virtual_address = mr_params->gva.virtual_address;
                req.gva.access_flags = mr_params->gva.access_flags;
                break;

        case GDMA_MR_TYPE_GPA:
-               req.mr_type = GDMA_MR_TYPE_GPA;
                req.gpa.access_flags = mr_params->gpa.access_flags;
                break;

        case GDMA_MR_TYPE_FMR:
-               req.mr_type = GDMA_MR_TYPE_FMR;
                req.fmr.page_size = mr_params->fmr.page_size;
                req.fmr.reserved_pte_count = mr_params->fmr.reserved_pte_count;
                break;




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux