[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180906180316.GB26997@lunn.ch>
Date: Thu, 6 Sep 2018 20:03:16 +0200
From: Andrew Lunn <andrew@...n.ch>
To: "Keller, Jacob E" <jacob.e.keller@...el.com>
Cc: "Wang, Dongsheng" <dongsheng.wang@...-semitech.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"sergei.shtylyov@...entembedded.com"
<sergei.shtylyov@...entembedded.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] net: ethernet: i40e: fix build error
> I'm more worried about how it interacts with modules. For example,
> we could have i40e and i40evf share some code, but then wouldn't one
> of them become dependent on the other? i.e. you'd have to load i40e
> in order to successfully load i40evf? Or you'd have to have some
> sort of common glue module which you load first, and then load i40e
> and i40evf after? This also creates some interactions with
> out-of-tree modules which make it difficult. It would be nice if we
> could share the code in some way that still resulted in allowing
> each module to be separate...
You have a few options here.
1) A library module, containing shared code. Use EXPORT_SYMBOL_GPL()
in the library module, and the kernel runtime linker will link the
calls into the library. Also, modprobe will ensure the library module
is loaded first, before the driver module.
2) Build time sharing of code. Place the shared code into a .o file,
and link it to both modules.
There is nothing particularly difficult here, this all done lots of
times within the kernel. Just look around and see how others do it.
Andrew
Powered by blists - more mailing lists