Re: [PATCH] iw_cxgb4: add INFINIBAND_ADDR_TRANS dependency

From: Arnd Bergmann
Date: Wed May 30 2018 - 18:41:02 EST


On Thu, May 31, 2018 at 12:29 AM, Steve Wise
<swise@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> On 5/30/2018 5:25 PM, Jason Gunthorpe wrote:
>> On Wed, May 30, 2018 at 05:10:35PM -0500, Steve Wise wrote:
>>>
>>> On 5/30/2018 5:04 PM, Jason Gunthorpe wrote:
>>>> On Wed, May 30, 2018 at 11:58:18PM +0200, Arnd Bergmann wrote:
>>>>> The newly added fill_res_ep_entry function fails to link if
>>>>> CONFIG_INFINIBAND_ADDR_TRANS is not set:
>>>>>
>>>>> drivers/infiniband/hw/cxgb4/restrack.o: In function `fill_res_ep_entry':
>>>>> restrack.c:(.text+0x3cc): undefined reference to `rdma_res_to_id'
>>>>> restrack.c:(.text+0x3d0): undefined reference to `rdma_iw_cm_id'
>>>>>
>>>>> This adds a Kconfig dependency for the driver.
>>>>>
>>>>> Fixes: 116aeb887371 ("iw_cxgb4: provide detailed provider-specific CM_ID information")
>>>>> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>>>>> drivers/infiniband/hw/cxgb4/Kconfig | 1 +
>>>>> 1 file changed, 1 insertion(+)
>>>> Oh, I think we need to solve this with maybe a header fill null stub
>>>> instead..
>>>>
>>>> We don't want to disable drivers just because a user interface is
>>>> disabled.
>>>>
>>> Why does CONFIG_INFINIBAND_ADDR_TRANS disable building rdma_cm.ko? That
>>> is not correct.
>> That seems like a reasonable thing to do..
> rdma_ucm.ko is for usermode users, rdma_cm.ko is for kernel users, and
> is required for iwarp drivers. It seems rdma_cm.ko is not being
> compiled if ADDR_TRANS is not set.
>
>
>> But why does it break the compile? Those functions are in cma.c...
>>
>> Jason
>
> Indeed, why. :)
>
> Perhaps this line is wrong in drivers/infiniband/core/Makefile:
>
> infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := rdma_cm.o
>
> I don't understand the rules in that Makefile.

You need to look at these three lines:

infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := rdma_cm.o

obj-$(CONFIG_INFINIBAND) += ib_core.o ib_cm.o iw_cm.o \
$(infiniband-y)

rdma_cm-y := cma.o

cma.o is built into rdma_cm.ko if both CONFIG_INFINIBAND_ADDR_TRANS
and CONFIG_INFINIBAND are enabled. The first line is just another
syntax for writing

ifdef CONFIG_INFINIBAND_ADDR_TRANS
obj-$(CONFIG_INFINIBAND) += rdma_cm.o
endif

Arnd