diff mbox series

[for-next,v7,12/12] RDMA/erdma: Add driver to kernel build environment

Message ID 20220421071747.1892-13-chengyou@linux.alibaba.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series Elastic RDMA Adapter (ERDMA) driver | expand

Commit Message

Cheng Xu April 21, 2022, 7:17 a.m. UTC
Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
---
 MAINTAINERS                          |  8 ++++++++
 drivers/infiniband/Kconfig           |  1 +
 drivers/infiniband/hw/Makefile       |  1 +
 drivers/infiniband/hw/erdma/Kconfig  | 12 ++++++++++++
 drivers/infiniband/hw/erdma/Makefile |  4 ++++
 5 files changed, 26 insertions(+)
 create mode 100644 drivers/infiniband/hw/erdma/Kconfig
 create mode 100644 drivers/infiniband/hw/erdma/Makefile

Comments

Jason Gunthorpe May 10, 2022, 1:18 p.m. UTC | #1
On Thu, Apr 21, 2022 at 03:17:47PM +0800, Cheng Xu wrote:
> Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
> index 33d3ce9c888e..cc6a7ff88ff3 100644
> +++ b/drivers/infiniband/Kconfig
> @@ -92,6 +92,7 @@ source "drivers/infiniband/hw/hns/Kconfig"
>  source "drivers/infiniband/hw/bnxt_re/Kconfig"
>  source "drivers/infiniband/hw/hfi1/Kconfig"
>  source "drivers/infiniband/hw/qedr/Kconfig"
> +source "drivers/infiniband/hw/erdma/Kconfig"
>  source "drivers/infiniband/sw/rdmavt/Kconfig"
>  source "drivers/infiniband/sw/rxe/Kconfig"
>  source "drivers/infiniband/sw/siw/Kconfig"

keep sorted

> diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile
> index fba0b3be903e..6b3a88046125 100644
> +++ b/drivers/infiniband/hw/Makefile
> @@ -13,3 +13,4 @@ obj-$(CONFIG_INFINIBAND_HFI1)		+= hfi1/
>  obj-$(CONFIG_INFINIBAND_HNS)		+= hns/
>  obj-$(CONFIG_INFINIBAND_QEDR)		+= qedr/
>  obj-$(CONFIG_INFINIBAND_BNXT_RE)	+= bnxt_re/
> +obj-$(CONFIG_INFINIBAND_ERDMA)		+= erdma/
> diff --git a/drivers/infiniband/hw/erdma/Kconfig b/drivers/infiniband/hw/erdma/Kconfig
> new file mode 100644
> index 000000000000..c90f2be1ea63
> +++ b/drivers/infiniband/hw/erdma/Kconfig
> @@ -0,0 +1,12 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +config INFINIBAND_ERDMA
> +	tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
> +	depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN

Why !CPU_BIG_ENDIAN? That is usually not OK.

Did you run sparse on this?

Jason
Cheng Xu May 16, 2022, 3:40 a.m. UTC | #2
On 5/10/22 9:18 PM, Jason Gunthorpe wrote:
> On Thu, Apr 21, 2022 at 03:17:47PM +0800, Cheng Xu wrote:
>> Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
>> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
>> index 33d3ce9c888e..cc6a7ff88ff3 100644
>> +++ b/drivers/infiniband/Kconfig
>> @@ -92,6 +92,7 @@ source "drivers/infiniband/hw/hns/Kconfig"
>>   source "drivers/infiniband/hw/bnxt_re/Kconfig"
>>   source "drivers/infiniband/hw/hfi1/Kconfig"
>>   source "drivers/infiniband/hw/qedr/Kconfig"
>> +source "drivers/infiniband/hw/erdma/Kconfig"
>>   source "drivers/infiniband/sw/rdmavt/Kconfig"
>>   source "drivers/infiniband/sw/rxe/Kconfig"
>>   source "drivers/infiniband/sw/siw/Kconfig"
> 
> keep sorted
> 

OK, I thought the order follows the rule: "comes first, appears first",
so I add our drivers to the tail of "drivers/infiniband/hw/..."

Since the current list is not sorted, and if it should be, I will fix
this in next version.

>> diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile
>> index fba0b3be903e..6b3a88046125 100644
>> +++ b/drivers/infiniband/hw/Makefile
>> @@ -13,3 +13,4 @@ obj-$(CONFIG_INFINIBAND_HFI1)		+= hfi1/
>>   obj-$(CONFIG_INFINIBAND_HNS)		+= hns/
>>   obj-$(CONFIG_INFINIBAND_QEDR)		+= qedr/
>>   obj-$(CONFIG_INFINIBAND_BNXT_RE)	+= bnxt_re/
>> +obj-$(CONFIG_INFINIBAND_ERDMA)		+= erdma/
>> diff --git a/drivers/infiniband/hw/erdma/Kconfig b/drivers/infiniband/hw/erdma/Kconfig
>> new file mode 100644
>> index 000000000000..c90f2be1ea63
>> +++ b/drivers/infiniband/hw/erdma/Kconfig
>> @@ -0,0 +1,12 @@
>> +# SPDX-License-Identifier: GPL-2.0-only
>> +config INFINIBAND_ERDMA
>> +	tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
>> +	depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
> 
> Why !CPU_BIG_ENDIAN? That is usually not OK.

we want use !CPU_BIG_ENDIAN to disable the erdma compilation on big
endian machine, because we only have little endian machines, and
don't support big endian machines. I have no idea why it is usually not
OK, could you explain it any more?

Thanks

> Did you run sparse on this?
> 

No, I will check this. I think this may be OK, because EFA also use
!CPU_BIG_ENDIAN in the same way.

Thanks,
Cheng Xu

> Jason
Cheng Xu May 16, 2022, 7:11 a.m. UTC | #3
On 5/16/22 11:40 AM, Cheng Xu wrote:
> 
> 
> On 5/10/22 9:18 PM, Jason Gunthorpe wrote:
>> On Thu, Apr 21, 2022 at 03:17:47PM +0800, Cheng Xu wrote:
>>> Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
>>> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
>>> index 33d3ce9c888e..cc6a7ff88ff3 100644
>>> +++ b/drivers/infiniband/Kconfig
>>> @@ -92,6 +92,7 @@ source "drivers/infiniband/hw/hns/Kconfig"
>>>   source "drivers/infiniband/hw/bnxt_re/Kconfig"
>>>   source "drivers/infiniband/hw/hfi1/Kconfig"
>>>   source "drivers/infiniband/hw/qedr/Kconfig"
>>> +source "drivers/infiniband/hw/erdma/Kconfig"
>>>   source "drivers/infiniband/sw/rdmavt/Kconfig"
>>>   source "drivers/infiniband/sw/rxe/Kconfig"
>>>   source "drivers/infiniband/sw/siw/Kconfig"
>>
>> keep sorted
>>
> 
> OK, I thought the order follows the rule: "comes first, appears first",
> so I add our drivers to the tail of "drivers/infiniband/hw/..."
> 
> Since the current list is not sorted, and if it should be, I will fix
> this in next version.
> 
>>> diff --git a/drivers/infiniband/hw/Makefile 
>>> b/drivers/infiniband/hw/Makefile
>>> index fba0b3be903e..6b3a88046125 100644
>>> +++ b/drivers/infiniband/hw/Makefile
>>> @@ -13,3 +13,4 @@ obj-$(CONFIG_INFINIBAND_HFI1)        += hfi1/
>>>   obj-$(CONFIG_INFINIBAND_HNS)        += hns/
>>>   obj-$(CONFIG_INFINIBAND_QEDR)        += qedr/
>>>   obj-$(CONFIG_INFINIBAND_BNXT_RE)    += bnxt_re/
>>> +obj-$(CONFIG_INFINIBAND_ERDMA)        += erdma/
>>> diff --git a/drivers/infiniband/hw/erdma/Kconfig 
>>> b/drivers/infiniband/hw/erdma/Kconfig
>>> new file mode 100644
>>> index 000000000000..c90f2be1ea63
>>> +++ b/drivers/infiniband/hw/erdma/Kconfig
>>> @@ -0,0 +1,12 @@
>>> +# SPDX-License-Identifier: GPL-2.0-only
>>> +config INFINIBAND_ERDMA
>>> +    tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
>>> +    depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
>>
>> Why !CPU_BIG_ENDIAN? That is usually not OK.
> 
> we want use !CPU_BIG_ENDIAN to disable the erdma compilation on big
> endian machine, because we only have little endian machines, and
> don't support big endian machines. I have no idea why it is usually not
> OK, could you explain it any more?
> 
> Thanks
> 
>> Did you run sparse on this?
>>
> 
> No, I will check this. I think this may be OK, because EFA also use
> !CPU_BIG_ENDIAN in the same way.
> 

I use the command 'make C=2' as the document says to check the code, It
seems ok, except some warnings. I reviewed and checked the warnings in
erdma part. Fix them or not fix, is all OK for functionality. Is
cleaning the warnings necessary for upstream? If so, I will work on it.

Thanks
Cheng Xu

> Thanks,
> Cheng Xu
> 
>> Jason
Cheng Xu May 16, 2022, 10:07 a.m. UTC | #4
On 5/16/22 3:11 PM, Cheng Xu wrote:
> 
> 
> On 5/16/22 11:40 AM, Cheng Xu wrote:
>>
>>
>> On 5/10/22 9:18 PM, Jason Gunthorpe wrote:
>>> On Thu, Apr 21, 2022 at 03:17:47PM +0800, Cheng Xu wrote:
>>>> Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
>>>> diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
>>>> index 33d3ce9c888e..cc6a7ff88ff3 100644
>>>> +++ b/drivers/infiniband/Kconfig
>>>> @@ -92,6 +92,7 @@ source "drivers/infiniband/hw/hns/Kconfig"
>>>>   source "drivers/infiniband/hw/bnxt_re/Kconfig"
>>>>   source "drivers/infiniband/hw/hfi1/Kconfig"
>>>>   source "drivers/infiniband/hw/qedr/Kconfig"
>>>> +source "drivers/infiniband/hw/erdma/Kconfig"
>>>>   source "drivers/infiniband/sw/rdmavt/Kconfig"
>>>>   source "drivers/infiniband/sw/rxe/Kconfig"
>>>>   source "drivers/infiniband/sw/siw/Kconfig"
>>>
>>> keep sorted
>>>
>>
>> OK, I thought the order follows the rule: "comes first, appears first",
>> so I add our drivers to the tail of "drivers/infiniband/hw/..."
>>
>> Since the current list is not sorted, and if it should be, I will fix
>> this in next version.
>>
>>>> diff --git a/drivers/infiniband/hw/Makefile 
>>>> b/drivers/infiniband/hw/Makefile
>>>> index fba0b3be903e..6b3a88046125 100644
>>>> +++ b/drivers/infiniband/hw/Makefile
>>>> @@ -13,3 +13,4 @@ obj-$(CONFIG_INFINIBAND_HFI1)        += hfi1/
>>>>   obj-$(CONFIG_INFINIBAND_HNS)        += hns/
>>>>   obj-$(CONFIG_INFINIBAND_QEDR)        += qedr/
>>>>   obj-$(CONFIG_INFINIBAND_BNXT_RE)    += bnxt_re/
>>>> +obj-$(CONFIG_INFINIBAND_ERDMA)        += erdma/
>>>> diff --git a/drivers/infiniband/hw/erdma/Kconfig 
>>>> b/drivers/infiniband/hw/erdma/Kconfig
>>>> new file mode 100644
>>>> index 000000000000..c90f2be1ea63
>>>> +++ b/drivers/infiniband/hw/erdma/Kconfig
>>>> @@ -0,0 +1,12 @@
>>>> +# SPDX-License-Identifier: GPL-2.0-only
>>>> +config INFINIBAND_ERDMA
>>>> +    tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
>>>> +    depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
>>>
>>> Why !CPU_BIG_ENDIAN? That is usually not OK.
>>
>> we want use !CPU_BIG_ENDIAN to disable the erdma compilation on big
>> endian machine, because we only have little endian machines, and
>> don't support big endian machines. I have no idea why it is usually not
>> OK, could you explain it any more?
>>
>> Thanks
>>
>>> Did you run sparse on this?
>>>
>>
>> No, I will check this. I think this may be OK, because EFA also use
>> !CPU_BIG_ENDIAN in the same way.
>>
> 
> ...... Is
> cleaning the warnings necessary for upstream? If so, I will work on it.

Please ignore this, it seems easy to clean the warnings, I will fix
them any way.

Thanks,
Cheng Xu
Jason Gunthorpe May 16, 2022, 2:13 p.m. UTC | #5
On Mon, May 16, 2022 at 11:40:46AM +0800, Cheng Xu wrote:

> > > diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile
> > > index fba0b3be903e..6b3a88046125 100644
> > > +++ b/drivers/infiniband/hw/Makefile
> > > @@ -13,3 +13,4 @@ obj-$(CONFIG_INFINIBAND_HFI1)		+= hfi1/
> > >   obj-$(CONFIG_INFINIBAND_HNS)		+= hns/
> > >   obj-$(CONFIG_INFINIBAND_QEDR)		+= qedr/
> > >   obj-$(CONFIG_INFINIBAND_BNXT_RE)	+= bnxt_re/
> > > +obj-$(CONFIG_INFINIBAND_ERDMA)		+= erdma/
> > > diff --git a/drivers/infiniband/hw/erdma/Kconfig b/drivers/infiniband/hw/erdma/Kconfig
> > > new file mode 100644
> > > index 000000000000..c90f2be1ea63
> > > +++ b/drivers/infiniband/hw/erdma/Kconfig
> > > @@ -0,0 +1,12 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only
> > > +config INFINIBAND_ERDMA
> > > +	tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
> > > +	depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
> > 
> > Why !CPU_BIG_ENDIAN? That is usually not OK.
> 
> we want use !CPU_BIG_ENDIAN to disable the erdma compilation on big
> endian machine

Do not copy this

> because we only have little endian machines, and don't support big
> endian machines. I have no idea why it is usually not OK, could you
> explain it any more?

It is considered bad coding practice in the kernel. Write the required endian
swaps.

Jason
Cheng Xu May 16, 2022, 2:41 p.m. UTC | #6
On 5/16/22 10:13 PM, Jason Gunthorpe wrote:
> On Mon, May 16, 2022 at 11:40:46AM +0800, Cheng Xu wrote:
> 
>>>> diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile
>>>> index fba0b3be903e..6b3a88046125 100644
>>>> +++ b/drivers/infiniband/hw/Makefile
>>>> @@ -13,3 +13,4 @@ obj-$(CONFIG_INFINIBAND_HFI1)		+= hfi1/
>>>>    obj-$(CONFIG_INFINIBAND_HNS)		+= hns/
>>>>    obj-$(CONFIG_INFINIBAND_QEDR)		+= qedr/
>>>>    obj-$(CONFIG_INFINIBAND_BNXT_RE)	+= bnxt_re/
>>>> +obj-$(CONFIG_INFINIBAND_ERDMA)		+= erdma/
>>>> diff --git a/drivers/infiniband/hw/erdma/Kconfig b/drivers/infiniband/hw/erdma/Kconfig
>>>> new file mode 100644
>>>> index 000000000000..c90f2be1ea63
>>>> +++ b/drivers/infiniband/hw/erdma/Kconfig
>>>> @@ -0,0 +1,12 @@
>>>> +# SPDX-License-Identifier: GPL-2.0-only
>>>> +config INFINIBAND_ERDMA
>>>> +	tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
>>>> +	depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
>>>
>>> Why !CPU_BIG_ENDIAN? That is usually not OK.
>>
>> we want use !CPU_BIG_ENDIAN to disable the erdma compilation on big
>> endian machine
> 
> Do not copy this
> 
>> because we only have little endian machines, and don't support big
>> endian machines. I have no idea why it is usually not OK, could you
>> explain it any more?
> 
> It is considered bad coding practice in the kernel. Write the required endian
> swaps.

Get it. Thanks.

Cheng Xu
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index fd768d43e048..7aa57ef45a27 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -732,6 +732,14 @@  S:	Maintained
 F:	Documentation/i2c/busses/i2c-ali1563.rst
 F:	drivers/i2c/busses/i2c-ali1563.c
 
+ALIBABA ELASTIC RDMA DRIVER
+M:	Cheng Xu <chengyou@linux.alibaba.com>
+M:	Kai Shen <kaishen@linux.alibaba.com>
+L:	linux-rdma@vger.kernel.org
+S:	Supported
+F:	drivers/infiniband/hw/erdma
+F:	include/uapi/rdma/erdma-abi.h
+
 ALIENWARE WMI DRIVER
 L:	Dell.Client.Kernel@dell.com
 S:	Maintained
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index 33d3ce9c888e..cc6a7ff88ff3 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -92,6 +92,7 @@  source "drivers/infiniband/hw/hns/Kconfig"
 source "drivers/infiniband/hw/bnxt_re/Kconfig"
 source "drivers/infiniband/hw/hfi1/Kconfig"
 source "drivers/infiniband/hw/qedr/Kconfig"
+source "drivers/infiniband/hw/erdma/Kconfig"
 source "drivers/infiniband/sw/rdmavt/Kconfig"
 source "drivers/infiniband/sw/rxe/Kconfig"
 source "drivers/infiniband/sw/siw/Kconfig"
diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile
index fba0b3be903e..6b3a88046125 100644
--- a/drivers/infiniband/hw/Makefile
+++ b/drivers/infiniband/hw/Makefile
@@ -13,3 +13,4 @@  obj-$(CONFIG_INFINIBAND_HFI1)		+= hfi1/
 obj-$(CONFIG_INFINIBAND_HNS)		+= hns/
 obj-$(CONFIG_INFINIBAND_QEDR)		+= qedr/
 obj-$(CONFIG_INFINIBAND_BNXT_RE)	+= bnxt_re/
+obj-$(CONFIG_INFINIBAND_ERDMA)		+= erdma/
diff --git a/drivers/infiniband/hw/erdma/Kconfig b/drivers/infiniband/hw/erdma/Kconfig
new file mode 100644
index 000000000000..c90f2be1ea63
--- /dev/null
+++ b/drivers/infiniband/hw/erdma/Kconfig
@@ -0,0 +1,12 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+config INFINIBAND_ERDMA
+	tristate "Alibaba Elastic RDMA Adapter (ERDMA) support"
+	depends on PCI_MSI && 64BIT && !CPU_BIG_ENDIAN
+	depends on INFINIBAND_ADDR_TRANS
+	depends on INFINIBAND_USER_ACCESS
+	help
+	  This is a RDMA/iWarp driver for Alibaba Elastic RDMA Adapter(ERDMA),
+	  which supports RDMA features in Alibaba cloud environment.
+
+	  To compile this driver as module, choose M here. The module will be
+	  called erdma.
diff --git a/drivers/infiniband/hw/erdma/Makefile b/drivers/infiniband/hw/erdma/Makefile
new file mode 100644
index 000000000000..51d2ef91905a
--- /dev/null
+++ b/drivers/infiniband/hw/erdma/Makefile
@@ -0,0 +1,4 @@ 
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_INFINIBAND_ERDMA) := erdma.o
+
+erdma-y := erdma_cm.o erdma_main.o erdma_cmdq.o erdma_cq.o erdma_verbs.o erdma_qp.o erdma_eq.o