RE: [PATCH 16/18] net: hns3: fix mixed module-builtin object

From: Salil Mehta
Date: Thu Nov 24 2022 - 04:58:47 EST


Hi Alexander,

> From: Alexander Lobakin <alobakin@xxxxxxxxxxx>
> Sent: Wednesday, November 23, 2022 10:08 PM
> To: Salil Mehta <salil.mehta@xxxxxxxxxx>
>
> From: Salil Mehta <salil.mehta@xxxxxxxxxx>
> Date: Tue, 22 Nov 2022 12:39:04 +0000
>
> > Hi Alexander,
> >
> > > From: Alexander Lobakin <alobakin@xxxxx>
> > > Sent: Saturday, November 19, 2022 11:10 PM
> > > To: linux-kbuild@xxxxxxxxxxxxxxx
>
> [...]
>
> > > diff --git a/drivers/net/ethernet/hisilicon/Kconfig
> > > b/drivers/net/ethernet/hisilicon/Kconfig
> > > index 3312e1d93c3b..9d2be93d0378 100644
> > > --- a/drivers/net/ethernet/hisilicon/Kconfig
> > > +++ b/drivers/net/ethernet/hisilicon/Kconfig
> > > @@ -100,11 +100,15 @@ config HNS3
> > >
> > > if HNS3
> > >
> > > +config HNS3_HCLGE_COMMON
> > > + tristate
> > > +
> >
> >
> > This change does not looks right to me. We do not intend to expose these
>
> ...does not looks right to me -- because? The "wrong" line?


Agreed. Not very helpful. Sorry about that :(


> > common files via kconfig and as a separate module. I would need time to
> > address this in a different way.
>
> I'm curious how 40 Kb of shared code can be addressed differently :D
> This Kconfig opt is hidden, it can only be selected by some other
> symbol -- in this case, by the PF and VF HCLGE options. Nothing gets
> exposed in a way it shouldn't be.


There is a discussion to unify the VF and PF HCLGE driver for HNS3.
This is to reduce the overhead of adding/maintaining features in
both of the drivers.


> Lemme guess, some cross-OS "shared code" in the OOT nobody in the
> upstream cares about (for good), how familiar :D IIRC ZSTD folks
> also weren't happy at first.


We have HNAE interfacing layer above HCLGE, if any such out-of-tree
code maintains the sanctity of that interface then there should not be
an issue at HCLGE. These functions are never going to get directly
used by such out-of-tree code. This is by design.


> > Please do not merge this change into the mainline!
> >
> >
> > Thanks
> > Salil
> >
> >
> >
> > > config HNS3_HCLGE
> > > tristate "Hisilicon HNS3 HCLGE Acceleration Engine & Compatibility
> > > Layer Support"
> > > default m
> > > depends on PCI_MSI
> > > depends on PTP_1588_CLOCK_OPTIONAL
> > > + select HNS3_HCLGE_COMMON
>
> [...]
>
> > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> > > b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> > > index 987271da6e9b..39a7ab51be31 100644
> > > --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> > > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> > > @@ -13133,6 +13133,8 @@ static void __exit hclge_exit(void)
> > > module_init(hclge_init);
> > > module_exit(hclge_exit);
> > >
> > > +MODULE_IMPORT_NS(HNS3_HCLGE_COMMON);
> >
> >
> > No, we don't want this.
>
> I can export the common functions globally, without a namespace
> if you prefer ._.


I was wondering if we could detect below condition in the Makefile
itself and not depend upon separate namespace?

"With CONFIG_HNS3_HCLGE=y and CONFIG_HNS3_HCLGEVF=m "


Thanks
Salil.