From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E868FA00E6 for ; Sat, 15 Jun 2019 14:43:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B61411C3DD; Sat, 15 Jun 2019 14:43:18 +0200 (CEST) Received: from cstnet.cn (smtp17.cstnet.cn [159.226.251.17]) by dpdk.org (Postfix) with ESMTP id 060B41C3DD for ; Sat, 15 Jun 2019 14:43:16 +0200 (CEST) Received: from DESKTOP-S1AP1MR.local (unknown [202.43.148.188]) by APP-09 (Coremail) with SMTP id swCowAAHF17j5wRdhWSYAQ--.13456S2; Sat, 15 Jun 2019 20:43:15 +0800 (CST) Date: Sat, 15 Jun 2019 20:43:14 +0800 From: Lu Qiuwen CC: luqiuwen@iie.ac.cn; To: stable@dpdk.org Message-ID: X-Mailer: TortoiseGit MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-CM-TRANSID: swCowAAHF17j5wRdhWSYAQ--.13456S2 X-Coremail-Antispam: 1UD129KBjvJXoW3XF1Utw43ZF1xGFyrCw48Zwb_yoW7XF4xpF 1xZ347Cr47Xw4xJw17trWxC34Yvw13J34UKa43Aa4ruF4qqrZYqrs8tay2yFyUAr98Cr1f Zw45ArykG39Yva7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvC14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r1j 6r4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr 1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0264kExVAv wVAq07x20xylc2xSY4AK67AK6ryUMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r 1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CE b7AF67AKxVWUXVWUAwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0x vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Zr0_Wr1UMIIF 0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2Kf nxnUUI43ZEXa7sRiSoGDUUUUU== X-Originating-IP: [202.43.148.188] X-CM-SenderInfo: 5oxtx3xzhqqx1lhotugofq/ Subject: [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" >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_get() 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[] = { * 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); + + #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[] = { * * 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); + #endif /* _FM10K_VF_H */ -- 2.20.1.windows.1