Re: [PATCH for-next 1/8] RDMA/erdma: Probe the erdma RoCEv2 device

Leon Romanovsky
2024-12-04T14:03:12Z

On Tue, Nov 26, 2024 at 02:59:07PM +0800, Boshi Yu wrote:
> Currently, the erdma driver supports both the iWARP and RoCEv2 protocols.
> The erdma driver reads the ERDMA_REGS_DEV_PROTO_REG register to identify
> the protocol used by the erdma device. Since each protocol requires
> different ib_device_ops, we introduce the erdma_device_ops_iwarp and
> erdma_device_ops_rocev2 for iWARP and RoCEv2 protocols, respectively.
>
> Signed-off-by: Boshi Yu <boshiyu@linux.alibaba.com>
> Reviewed-by: Cheng Xu <chengyou@linux.alibaba.com>
> ---
> drivers/infiniband/hw/erdma/Kconfig | 2 +-
> drivers/infiniband/hw/erdma/erdma.h | 3 +-
> drivers/infiniband/hw/erdma/erdma_hw.h | 7 ++++
> drivers/infiniband/hw/erdma/erdma_main.c | 47 ++++++++++++++++++-----
> drivers/infiniband/hw/erdma/erdma_verbs.c | 16 +++++++-
> drivers/infiniband/hw/erdma/erdma_verbs.h | 12 ++++++
> 6 files changed, 75 insertions(+), 12 deletions(-)

<...>

> +++ b/drivers/infiniband/hw/erdma/erdma_main.c
> @@ -172,6 +172,12 @@ static int erdma_device_init(struct erdma_dev *dev, struct pci_dev *pdev)
> {
> int ret;
>
> + dev->proto = erdma_reg_read32(dev, ERDMA_REGS_DEV_PROTO_REG);
> + if (!erdma_device_iwarp(dev) && !erdma_device_rocev2(dev)) {

Why do you need this check? Your old driver which supports only iwarp
doesn't have this check, so why did you suddenly need it for roce?

> + dev_err(&pdev->dev, "Unsupported protocol: %d\n", dev->proto);
> + return -ENODEV;
> + }
> +

Thanks