Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2066088imm; Fri, 7 Sep 2018 10:15:59 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbul5yyq2LQ15af4e1B4rpWlbF9MXE9p3sjhAGoGd+JoB4KaZ70RrE7PGKXiAs9tLeZOxsZ X-Received: by 2002:a17:902:6808:: with SMTP id h8-v6mr9086168plk.27.1536340559630; Fri, 07 Sep 2018 10:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536340559; cv=none; d=google.com; s=arc-20160816; b=xs8C3Nb32eP723IYptN+8if5wniyjWBU72eIj6e+7KGB9QbJs/XDznys6mOPPb1cjV UxCqnp7bThszexFJVlGVuG41O3BoC56u1h4JQXDXCf55UUebEZsukbDZG1q1L8155dZR etlFVED0/gjHdGn+TrTUNdatYpiibZNxdAbrhgpLWVXeU8vCMm46QS+6qgEhg+wx8ghJ +OH8T4lK8YGo/VYU/gLPxyO461N6CI52t5N882spBIqmgCdr8Q/WKsEYeWPG0iJ/2+KF NnFJk51Aeo5SBcEcfo8HLxyhuKbMMHjyupRSROaE7ZWDkC8lWL7nlLgfY3gQPXFkBGX9 KSSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=rcKyuj0E8lMiW6WdTvUY7icYyAyNsyWGLScmkrBll4o=; b=e7gWGh56wucvfGM9g/5L1YiQCyPCSpXOM9j7BB8fyquAQdkInLFQwRXl91KLerEeZj 0pb6OIKXtxbJggDBPdULCLgsxU8xtXHwWaLbN/zFMd9ujuwscCs619pY23zhGlD0XSnO OrUrW6Jm63pSIIlFQCmOSRQWu1WXEyY1pTGPuLDGHqKOMb1BTl3dAZurPwWZew6RE0Sh Avf4E3RRGL0+o14loeOZfYe8qt2FNyj9f8YBt8P9xIJ5E8B5Q5l4vcR119t9EXkZk3ZR 5cPb1fKgnP3PQBFYndYppNH2V70DvIOz8uErwQQTEJO2PmeZqTkjqyZU5Ns1Dm/q1t5v oDAw== ARC-Authentication-Results: i=1; mx.google.com; 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 90-v6si8616192pla.466.2018.09.07.10.15.42; Fri, 07 Sep 2018 10:15:59 -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; 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 S1726681AbeIGV4S convert rfc822-to-8bit (ORCPT + 99 others); Fri, 7 Sep 2018 17:56:18 -0400 Received: from mx01.hxt-semitech.com ([223.203.96.7]:52666 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726583AbeIGV4S (ORCPT ); Fri, 7 Sep 2018 17:56:18 -0400 X-ASG-Debug-ID: 1536340459-093b7e54e612050001-xx1T2L Received: from HXTBJIDCEMVIW02.hxtcorp.net ([10.128.0.15]) by barracuda.hxt-semitech.com with ESMTP id s0THDWXe4NXTpzsn (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Sat, 08 Sep 2018 01:14:19 +0800 (CST) X-Barracuda-Envelope-From: dongsheng.wang@hxt-semitech.com Received: from HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) by HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 8 Sep 2018 01:14:22 +0800 Received: from HXTBJIDCEMVIW02.hxtcorp.net ([fe80::3e:f4ff:7927:a6f6]) by HXTBJIDCEMVIW02.hxtcorp.net ([fe80::3e:f4ff:7927:a6f6%12]) with mapi id 15.00.1395.000; Sat, 8 Sep 2018 01:14:22 +0800 From: "Wang, Dongsheng" To: Sergei Shtylyov , "jeffrey.t.kirsher@intel.com" CC: "jacob.e.keller@intel.com" , "davem@davemloft.net" , "intel-wired-lan@lists.osuosl.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/2] net: ethernet: i40evf: fix underlying build error Thread-Topic: [PATCH v3 2/2] net: ethernet: i40evf: fix underlying build error X-ASG-Orig-Subj: Re: [PATCH v3 2/2] net: ethernet: i40evf: fix underlying build error Thread-Index: AQHURpyuUEMtiCDf+EGRwpahWdajkw== Date: Fri, 7 Sep 2018 17:14:22 +0000 Message-ID: <548f5b78369047b584b30b04ffed1794@HXTBJIDCEMVIW02.hxtcorp.net> References: <1536319175-3660-1-git-send-email-dongsheng.wang@hxt-semitech.com> <1536319175-3660-3-git-send-email-dongsheng.wang@hxt-semitech.com> <59fd149c-bacc-c39c-b0d8-a4fb9366f26a@cogentembedded.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [192.168.50.12] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Barracuda-Connect: UNKNOWN[10.128.0.15] X-Barracuda-Start-Time: 1536340459 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA384 X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.4987 1.0000 0.0000 X-Barracuda-Spam-Score: -0.00 X-Barracuda-Spam-Status: No, SCORE=-0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=ISO2022JP_CHARSET X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.57077 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- -0.00 ISO2022JP_CHARSET ISO-2022-JP message Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/7/2018 11:33 PM, Sergei Shtylyov wrote: > On 09/07/2018 02:19 PM, Wang Dongsheng wrote: > >> Can't have non-inline function in a header file. >> There is a risk of "Multiple definition" from cross-including. >> >> Tested on: x86_64, make ARCH=i386 >> >> Modules section .text: >> i40e: 00019380 <__i40e_add_stat_strings>: >> i40evf: 00006b00 <__i40e_add_stat_strings>: >> >> Buildin section .text: >> i40e: c351ca60 <__i40e_add_stat_strings>: >> i40evf: c354f2c0 <__i40e_add_stat_strings>: >> >> Signed-off-by: Wang Dongsheng >> --- >> V3: add static >> --- >> .../intel/i40evf/i40e_ethtool_stats.h | 23 +----------------- >> .../ethernet/intel/i40evf/i40evf_ethtool.c | 24 +++++++++++++++++++ >> 2 files changed, 25 insertions(+), 22 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/i40evf/i40e_ethtool_stats.h b/drivers/net/ethernet/intel/i40evf/i40e_ethtool_stats.h >> index 60b595dd8c39..62ab67a77753 100644 >> --- a/drivers/net/ethernet/intel/i40evf/i40e_ethtool_stats.h >> +++ b/drivers/net/ethernet/intel/i40evf/i40e_ethtool_stats.h >> @@ -181,29 +181,8 @@ i40evf_add_queue_stats(u64 **data, struct i40e_ring *ring) >> *data += size; >> } >> >> -/** >> - * __i40e_add_stat_strings - copy stat strings into ethtool buffer >> - * @p: ethtool supplied buffer >> - * @stats: stat definitions array >> - * @size: size of the stats array >> - * >> - * Format and copy the strings described by stats into the buffer pointed at >> - * by p. >> - **/ >> static void __i40e_add_stat_strings(u8 **p, const struct i40e_stats stats[], > There's no point to keeping *static* function in the header file (unless it's > also *inline*). Yes, we need it for now. Because there is a copy file at i40e dir, and a "Multiple definition" will show up when we buildin i40e&i40evf and remove this *static* . Cause the header file is only used in ethtool.c so we can keep this static, and another option is not touch this header. As I replied to Jacob's email earlier, we can do without touch i40evf at all. Because this header is only for one and not included in another. Cheers, Dongsheng >> - const unsigned int size, ...) >> -{ >> - unsigned int i; >> - >> - for (i = 0; i < size; i++) { >> - va_list args; >> - >> - va_start(args, size); >> - vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args); >> - *p += ETH_GSTRING_LEN; >> - va_end(args); >> - } >> -} >> + const unsigned int size, ...); >> >> /** >> * 40e_add_stat_strings - copy stat strings into ethtool buffer > [...] > > MBR, Sergei >