Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1029830imm; Thu, 6 Sep 2018 14:10:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbLtql/fP5hd0iNsSuJqllhUlgDpJoKD4qbu4Ki8vJ2ttreh2Xkk/xn+8yctEB+I3UKYXDH X-Received: by 2002:a63:cc04:: with SMTP id x4-v6mr4762928pgf.33.1536268226870; Thu, 06 Sep 2018 14:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536268226; cv=none; d=google.com; s=arc-20160816; b=j/1KFoKjj1jigHvpxoWNypsw/BoBwxmtb8PTkFvZbq/n47OUurD7WFWPNSHXar8vVJ NLSymZgp05fCUqULBVUmvfuOAbWLoqLFedbyX/zgcvBCdQtWMNs717rso4CKXXhWpWvb WixTUEr+vaHkobSQG7L5Fk+A/Itz3xAbNQh5pBWEL2EyOCm+qDNvTgj7X+jzryHDQQsi vz7V9TCmyvL0SkI77IVJBWuankUsiapeZDvj6vL1aBJLwDdjVSeKnHJ7vVt47vSPAxiJ ecq6eAlySatxMXx78ptb3H0pKOCu8kKathJ0J8jzVngQX/M8tKvsOTAZMShPcMlPIivp mjZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ge5TW+ZMx9HjdcAB40z9G6IVDb/Sj5hlTRcBTOugR3w=; b=YGi7gUHeEs8/oHZFbf8LRf/5QScFaFaC9rNW3tpStybIwYyVw86IzWiFoRaWT+bwTp xHrM2Syz6XEbppVXq0FI0CxcYSysrBKQzSglTDZrcW6MDqFPSsTAkuJ8UgAN5OBnzH5z SHdF8MBMN4zvaP8MpI2TiI1uRp+GuDJEos91Dcgmyk0Xlxx/5BcuElzTATFfc2ADS9jz 9OMEKJkdMvad1O5yd30cn6JYNZjXKiFleL6Z4GFEvzU4oRcI7ZOte9WYqgYy9ntPgHMM YOGJyjY1q3BxEjaEuYBjVspzAbEkGQvoz2XCeYE5Q3RwY2WfRutxv2Kr0IMUdvyoI1uk kFIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2V8Zo+M8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8-v6si5773962pgk.600.2018.09.06.14.10.08; Thu, 06 Sep 2018 14:10:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=2V8Zo+M8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730273AbeIFWkI (ORCPT + 99 others); Thu, 6 Sep 2018 18:40:08 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:54912 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727850AbeIFWkI (ORCPT ); Thu, 6 Sep 2018 18:40:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Ge5TW+ZMx9HjdcAB40z9G6IVDb/Sj5hlTRcBTOugR3w=; b=2V8Zo+M83hBPQHliQbzoAjHHL1kor4OQZ6XfGtVnVJP1G03VFCJbLw6xq2K48ElWUSk0YorW4C5sbF3T7uuZZuTtgQwsVp6ZFWI/6w+OJbvOrDUGfKS/3sj8fkzQpqYVUmHDwrqTIwmJ+5GryE1KfheJ9si3dlP9szP+Pti0nI0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1fxyce-0007mp-A4; Thu, 06 Sep 2018 20:03:16 +0200 Date: Thu, 6 Sep 2018 20:03:16 +0200 From: Andrew Lunn To: "Keller, Jacob E" Cc: "Wang, Dongsheng" , "Kirsher, Jeffrey T" , "sergei.shtylyov@cogentembedded.com" , "davem@davemloft.net" , "intel-wired-lan@lists.osuosl.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 1/2] net: ethernet: i40e: fix build error Message-ID: <20180906180316.GB26997@lunn.ch> References: <1536114430-21356-1-git-send-email-dongsheng.wang@hxt-semitech.com> <02874ECE860811409154E81DA85FBB5884C78D88@ORSMSX115.amr.corp.intel.com> <02874ECE860811409154E81DA85FBB5884C7AC01@ORSMSX115.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02874ECE860811409154E81DA85FBB5884C7AC01@ORSMSX115.amr.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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