From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8FA09A046B for ; Tue, 23 Jul 2019 05:01:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6AD3A1BECB; Tue, 23 Jul 2019 05:01:15 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5059E1BECB for ; Tue, 23 Jul 2019 05:01:13 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 20:01:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,297,1559545200"; d="scan'208";a="320869521" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 22 Jul 2019 20:01:12 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 22 Jul 2019 20:01:11 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 22 Jul 2019 20:01:10 -0700 Received: from shsmsx106.ccr.corp.intel.com ([169.254.10.240]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0439.000; Tue, 23 Jul 2019 11:01:09 +0800 From: "Wang, Xiao W" To: Yongseok Koh , Lu Qiuwen , "Zhang, Qi Z" CC: dpdk stable Thread-Topic: [dpdk-stable] [PATCH 17.11] net/fm10k: fix segment fault at calling fm10k_stats_get() Thread-Index: AQHVI3ftkjqS/DlYcEWnMp9xK/jwA6bXoHuAgAAabjA= Date: Tue, 23 Jul 2019 03:01:08 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmMxM2FjYmItZWQ3MC00ZGFjLWE4YmUtMzQ1NmJkYmE5YTRjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibVphc2tSUnUzMGI2K3VCUUVhOGdCMjVNTXhWNTdFWVFUbDdYbUVsV2RMZUJobDBLOE9lRksrNzRJSW80clwvNlgifQ== dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH 17.11] net/fm10k: fix segment fault at calling fm10k_stats_get() X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Qiuwen, > -----Original Message----- > From: Yongseok Koh [mailto:yskoh@mellanox.com] > Sent: Tuesday, July 23, 2019 9:13 AM > To: Lu Qiuwen ; Zhang, Qi Z ; > Wang, Xiao W > Cc: dpdk stable > Subject: Re: [dpdk-stable] [PATCH 17.11] net/fm10k: fix segment fault at > calling fm10k_stats_get() >=20 > Hi, >=20 > Copying maintainers of fm10k for their review. > I'll merge it as soon as it is acked. >=20 >=20 > Thanks, > Yongseok >=20 > > On Jun 15, 2019, at 5:43 AM, Lu Qiuwen wrote: > > > > From 01ca235ebb510d68efe37a81b434c07bd335fc61 Mon Sep 17 00:00:00 > 2001 > > From: Lu Qiuwen > > Date: Sat, 15 Jun 2019 14:28:01 +0800 > > Subject: [PATCH] net/fm10k: fix segment fault at calling fm10k_stats_ge= t() > > from secondary process. > > > > The function pointers in fm10k_stats_get() which setup from primary > process, when secondary process call these function pointers, a segment > fault will happend. > > > > Signed-off-by: Lu Qiuwen > > --- > > drivers/net/fm10k/base/fm10k_api.c | 20 ++++++++++++++++---- > > drivers/net/fm10k/base/fm10k_pf.c | 4 ++-- > > drivers/net/fm10k/base/fm10k_pf.h | 8 ++++++++ > > drivers/net/fm10k/base/fm10k_vf.c | 4 ++-- > > drivers/net/fm10k/base/fm10k_vf.h | 6 ++++++ > > 5 files changed, 34 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/net/fm10k/base/fm10k_api.c > b/drivers/net/fm10k/base/fm10k_api.c > > index c49d20dfb..e7b2fe710 100644 > > --- a/drivers/net/fm10k/base/fm10k_api.c > > +++ b/drivers/net/fm10k/base/fm10k_api.c > > @@ -234,8 +234,14 @@ s32 fm10k_read_mac_addr(struct fm10k_hw *hw) > > * */ > > void fm10k_update_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats > *stats) > > { > > - if (hw->mac.ops.update_hw_stats) > > - hw->mac.ops.update_hw_stats(hw, stats); > > + switch (hw->mac.type) { > > + case fm10k_mac_pf: > > + return fm10k_update_hw_stats_pf(hw, stats); > > + case fm10k_mac_vf: > > + return fm10k_update_hw_stats_vf(hw, stats); > > + default: > > + break; > > + } > > } > > > > /** > > @@ -246,8 +252,14 @@ void fm10k_update_hw_stats(struct fm10k_hw > *hw, struct fm10k_hw_stats *stats) > > * */ > > void fm10k_rebind_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats > *stats) > > { > > - if (hw->mac.ops.rebind_hw_stats) > > - hw->mac.ops.rebind_hw_stats(hw, stats); > > + switch (hw->mac.type) { > > + case fm10k_mac_pf: > > + return fm10k_rebind_hw_stats_pf(hw, stats); > > + case fm10k_mac_vf: > > + return fm10k_rebind_hw_stats_vf(hw, stats); > > + default: > > + break; > > + } > > } > > > > /** > > diff --git a/drivers/net/fm10k/base/fm10k_pf.c > b/drivers/net/fm10k/base/fm10k_pf.c > > index db5f4912f..f5b6a9e2e 100644 > > --- a/drivers/net/fm10k/base/fm10k_pf.c > > +++ b/drivers/net/fm10k/base/fm10k_pf.c > > @@ -1511,7 +1511,7 @@ const struct fm10k_msg_data > fm10k_iov_msg_data_pf[] =3D { > > * This function collects and aggregates global and per queue hardware > > * statistics. > > **/ > > -STATIC void fm10k_update_hw_stats_pf(struct fm10k_hw *hw, > > +void fm10k_update_hw_stats_pf(struct fm10k_hw *hw, > > struct fm10k_hw_stats *stats) > > { > > u32 timeout, ur, ca, um, xec, vlan_drop, loopback_drop, > nodesc_drop; > > @@ -1584,7 +1584,7 @@ STATIC void fm10k_update_hw_stats_pf(struct > fm10k_hw *hw, > > * This function resets the base for global and per queue hardware > > * statistics. > > **/ > > -STATIC void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw, > > +void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw, > > struct fm10k_hw_stats *stats) > > { > > DEBUGFUNC("fm10k_rebind_hw_stats_pf"); > > diff --git a/drivers/net/fm10k/base/fm10k_pf.h > b/drivers/net/fm10k/base/fm10k_pf.h > > index ca125c273..207942788 100644 > > --- a/drivers/net/fm10k/base/fm10k_pf.h > > +++ b/drivers/net/fm10k/base/fm10k_pf.h > > @@ -184,4 +184,12 @@ extern const struct fm10k_msg_data > fm10k_iov_msg_data_pf[]; > > #endif > > > > s32 fm10k_init_ops_pf(struct fm10k_hw *hw); > > + > > +void fm10k_update_hw_stats_pf(struct fm10k_hw *hw, > > + struct fm10k_hw_stats *stats); > > + > > +void fm10k_rebind_hw_stats_pf(struct fm10k_hw *hw, > > + struct fm10k_hw_stats *stats); > > + > > + Above 2 empty lines should be removed. Do not introduce extra empty line. > > #endif /* _FM10K_PF_H */ > > diff --git a/drivers/net/fm10k/base/fm10k_vf.c > b/drivers/net/fm10k/base/fm10k_vf.c > > index bd449773a..2f4b5f5d2 100644 > > --- a/drivers/net/fm10k/base/fm10k_vf.c > > +++ b/drivers/net/fm10k/base/fm10k_vf.c > > @@ -526,7 +526,7 @@ const struct fm10k_tlv_attr fm10k_1588_msg_attr[] > =3D { > > * > > * This function collects and aggregates per queue hardware statistics= . > > **/ > > -STATIC void fm10k_update_hw_stats_vf(struct fm10k_hw *hw, > > +void fm10k_update_hw_stats_vf(struct fm10k_hw *hw, > > struct fm10k_hw_stats *stats) > > { > > DEBUGFUNC("fm10k_update_hw_stats_vf"); > > @@ -541,7 +541,7 @@ STATIC void fm10k_update_hw_stats_vf(struct > fm10k_hw *hw, > > * > > * This function resets the base for queue hardware statistics. > > **/ > > -STATIC void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw, > > +void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw, > > struct fm10k_hw_stats *stats) > > { > > DEBUGFUNC("fm10k_rebind_hw_stats_vf"); > > diff --git a/drivers/net/fm10k/base/fm10k_vf.h > b/drivers/net/fm10k/base/fm10k_vf.h > > index 116c56fcc..e433e8a94 100644 > > --- a/drivers/net/fm10k/base/fm10k_vf.h > > +++ b/drivers/net/fm10k/base/fm10k_vf.h > > @@ -89,4 +89,10 @@ extern const struct fm10k_tlv_attr > fm10k_1588_msg_attr[]; > > FM10K_MSG_HANDLER(FM10K_VF_MSG_ID_1588, > fm10k_1588_msg_attr, func) > > > > s32 fm10k_init_ops_vf(struct fm10k_hw *hw); > > + > > +void fm10k_update_hw_stats_vf(struct fm10k_hw *hw, > > + struct fm10k_hw_stats *stats); > > +void fm10k_rebind_hw_stats_vf(struct fm10k_hw *hw, > > + struct fm10k_hw_stats *stats); > > + Idem. > > #endif /* _FM10K_VF_H */ > > -- > > 2.20.1.windows.1 > > > > I agree with what this patch fixes, ideally the "ops" basically should not = be included in the shared data. Anyway, this patch is a quick fix. Besides,= this patch should also go to dev@dpdk.org. Please address above minor issu= es and make a new version. Thanks, Xiao