From patchwork Sat May 19 15:53:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136394 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2545643lji; Sat, 19 May 2018 08:54:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpO/01dpOUOKN5dNGD5bFZJMQ2a6QYRECTKTq+8HvvHRVolaUMx0/2raJapeWEDpS7LNy8w X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr14059120plh.291.1526745277439; Sat, 19 May 2018 08:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745277; cv=none; d=google.com; s=arc-20160816; b=j/Zpu0J1IOIF/jZCrB/Co0qE0IEnBdEk0eINkcy6hpSbpQSLvm+tYRyHiQ0yOwOdaq 8Q23RsJw1D6M+QuGtukQpZf+9qXOEikMaeuSf0Nx7QujMZimEe1nheOgPKpoR94yhvdJ QU1wCBDkvFd6wt18hD1vFVDxd7yjop2IZHi0crbQfTExMaJP9CpaYa6vXNNpDeff2BBG cjkmoP8xx5aF8ObhDdw8sW5YNFLofvKU53enKBh3+t2cl5X3EdiFt/khXKf0qZ71pid2 3AyTtMdQ2yCZRjRqkOPIB8o2P9O5oHkkY0XQj1+pFkA7Y4mqhyX41Ci5k4IPZASdGiGv 8bjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Bf8lxCJGX9OXdb0TLD2v4lZAa0ElcQWiV7T8HgQlLUE=; b=raOqlUS6qqRlxOqjcku7pXEc9PjutgxuqR3/c633dcHjn072ifiajx3Nre1GM/mzV+ l9wDSKnLUPXzDskYMfP4EDwQgEHD9d6nlC708UtNBthCd9FPpEdfq3NxNZk5OKw38Hin v21/20eDkFJC1dwtMy1vXkZRSOHauKupngGBm68np9lGjEbOMIY3WIfaatY1w9wX6D51 PnkweZDnGjf4DBCgPsc5+fv4PPqb/5rXIXHpnbLQogYNBxEdosARP2t1d9qtp9a27ftY Y/vETgKpHJ9NUXFk+xZ/UrSLRhgZl524WTk2B3zIPTapCmheak4ZD1uWSa5x8b98PtEy JkHA== 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 c11-v6si9332082pll.102.2018.05.19.08.54.37; Sat, 19 May 2018 08:54:37 -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 S1752530AbeESPyb (ORCPT + 29 others); Sat, 19 May 2018 11:54:31 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59934 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752344AbeESPy1 (ORCPT ); Sat, 19 May 2018 11:54:27 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4DDB3F9D57A1C; Sat, 19 May 2018 23:54:24 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:18 +0800 From: Salil Mehta To: CC: , , , , , , , Fengguang Wu Subject: [PATCH net-next 1/9] net: hns3: Fixes error reported by Kbuild and internal review Date: Sat, 19 May 2018 16:53:15 +0100 Message-ID: <20180519155323.68960-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes the error reported by Intel's kbuild and fixes a return value in one of the legs, caught during review of the original patch sent by kbuild. Fixes: fdb793670a00 ("net: hns3: Add support of .sriov_configure in HNS3 driver") Signed-off-by: Fengguang Wu Signed-off-by: Salil Mehta --- Patch V1: 1. Fixes the errors reported by kbuild - using its fix Link: https://lkml.org/lkml/2018/5/16/894 2. Places a necessary missed return value of num_vfs figured out while reviewing kbuild patch. --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index e85ff38..e75c652 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1579,7 +1579,7 @@ static void hns3_remove(struct pci_dev *pdev) * Enable or change the number of VFs. Called when the user updates the number * of VFs in sysfs. **/ -int hns3_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) +static int hns3_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) { int ret; @@ -1592,6 +1592,8 @@ int hns3_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) ret = pci_enable_sriov(pdev, num_vfs); if (ret) dev_err(&pdev->dev, "SRIOV enable failed %d\n", ret); + else + return num_vfs; } else if (!pci_vfs_assigned(pdev)) { pci_disable_sriov(pdev); } else { From patchwork Sat May 19 15:53:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136397 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2545883lji; Sat, 19 May 2018 08:54:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZow2nf/tDBKRU/ibnij+opaeY4B+TtmkqiXr4O22UFBJ7PWa3aXZlw4K0VXnEUYad9LkDjJ X-Received: by 2002:a17:902:548f:: with SMTP id e15-v6mr14399295pli.314.1526745298485; Sat, 19 May 2018 08:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745298; cv=none; d=google.com; s=arc-20160816; b=U7PMpEQRni8EMEqxYFKJ/QJ2hxH/GnOiL+t6LhP0hkYkthfBz0/zN4106cyPH+nNjq gpM+zCf2ZcJG0iZMOu66XqYgFBcFSnnRGbCEPQm1Qn9fJuvPRHJG+r+6VGzL1H+SKajM kr2A+DYblI3QFQ/H3sQ6u8S71ddMMo8KSdIW1+kmocBbgiHB7PF6qRQWCJwDffJuVbbi kFZszm8xqjjGqKeqTElpV836nDvSSUhS9Kb3XkFxpnyIMp4A+GE3DWLpXTAKJxpI+gMi KaGe8g29GoyYzC4RsZimJGLDpuOm3RmTPci4rFvTOPXlio+4rDGfcu05CByZNHZ1a2QF to9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=CvQQmDLPuqj6MPTcEx9w1L/5iQ+g3akovBVf4iWrZGQ=; b=SXtKBXpYU0zHJr/OuSrFd9Uuw3Nl0psNu4QOQM+0bSBRrY1OODkt3rgxfA8SVIs6je 0DowZO6BdXidDS4KYQQQB8vc+w6FoKuH0qXc3yK5tI8EGXJvhYBcJH0EdLxgqOI14m1X c9vhdwQ9g7OtbuzuMFjts7g0PDlnV1HBlbPoa2kZR1tnyjE0RR4UzDyw5iN1/zsVwBwA NOq7LyYwI6khkWUJJgTDxL7p/78gqgm7T5TfubZRo0Wo7VAMQncFaUDk7IqFf5YK0Ozs vhKkd505np/PRf+OIyLRQp5Yi6Ivh1bNZN5mk6i8VyeNo6xO3otpQioqxv2Pa1/kaJBm pSYQ== 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 b7-v6si7851720pgq.585.2018.05.19.08.54.58; Sat, 19 May 2018 08:54:58 -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 S1752611AbeESPy4 (ORCPT + 29 others); Sat, 19 May 2018 11:54:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7688 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752489AbeESPyv (ORCPT ); Sat, 19 May 2018 11:54:51 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 270CAC4F9131D; Sat, 19 May 2018 23:54:28 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:20 +0800 From: Salil Mehta To: CC: , , , , , , Subject: [PATCH net-next 2/9] net: hns3: Fixes API to fetch ethernet header length with kernel default Date: Sat, 19 May 2018 16:53:16 +0100 Message-ID: <20180519155323.68960-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li During the RX leg driver needs to fetch the ethernet header length from the RX'ed Buffer Descriptor. Currently, proprietary version hns3_nic_get_headlen is being used to fetch the header length which uses l234info present in the Buffer Descriptor which might not be valid for the first Buffer Descriptor if the packet is spanning across multiple descriptors. Kernel default eth_get_headlen API does the job correctly. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Peng Li Reviewed-by: Yisen Zhuang Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 104 +----------------------- 1 file changed, 2 insertions(+), 102 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index e75c652..66cbb66 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1954,106 +1954,6 @@ hns3_nic_alloc_rx_buffers(struct hns3_enet_ring *ring, int cleand_count) writel_relaxed(i, ring->tqp->io_base + HNS3_RING_RX_RING_HEAD_REG); } -/* hns3_nic_get_headlen - determine size of header for LRO/GRO - * @data: pointer to the start of the headers - * @max: total length of section to find headers in - * - * This function is meant to determine the length of headers that will - * be recognized by hardware for LRO, GRO, and RSC offloads. The main - * motivation of doing this is to only perform one pull for IPv4 TCP - * packets so that we can do basic things like calculating the gso_size - * based on the average data per packet. - */ -static unsigned int hns3_nic_get_headlen(unsigned char *data, u32 flag, - unsigned int max_size) -{ - unsigned char *network; - u8 hlen; - - /* This should never happen, but better safe than sorry */ - if (max_size < ETH_HLEN) - return max_size; - - /* Initialize network frame pointer */ - network = data; - - /* Set first protocol and move network header forward */ - network += ETH_HLEN; - - /* Handle any vlan tag if present */ - if (hnae_get_field(flag, HNS3_RXD_VLAN_M, HNS3_RXD_VLAN_S) - == HNS3_RX_FLAG_VLAN_PRESENT) { - if ((typeof(max_size))(network - data) > (max_size - VLAN_HLEN)) - return max_size; - - network += VLAN_HLEN; - } - - /* Handle L3 protocols */ - if (hnae_get_field(flag, HNS3_RXD_L3ID_M, HNS3_RXD_L3ID_S) - == HNS3_RX_FLAG_L3ID_IPV4) { - if ((typeof(max_size))(network - data) > - (max_size - sizeof(struct iphdr))) - return max_size; - - /* Access ihl as a u8 to avoid unaligned access on ia64 */ - hlen = (network[0] & 0x0F) << 2; - - /* Verify hlen meets minimum size requirements */ - if (hlen < sizeof(struct iphdr)) - return network - data; - - /* Record next protocol if header is present */ - } else if (hnae_get_field(flag, HNS3_RXD_L3ID_M, HNS3_RXD_L3ID_S) - == HNS3_RX_FLAG_L3ID_IPV6) { - if ((typeof(max_size))(network - data) > - (max_size - sizeof(struct ipv6hdr))) - return max_size; - - /* Record next protocol */ - hlen = sizeof(struct ipv6hdr); - } else { - return network - data; - } - - /* Relocate pointer to start of L4 header */ - network += hlen; - - /* Finally sort out TCP/UDP */ - if (hnae_get_field(flag, HNS3_RXD_L4ID_M, HNS3_RXD_L4ID_S) - == HNS3_RX_FLAG_L4ID_TCP) { - if ((typeof(max_size))(network - data) > - (max_size - sizeof(struct tcphdr))) - return max_size; - - /* Access doff as a u8 to avoid unaligned access on ia64 */ - hlen = (network[12] & 0xF0) >> 2; - - /* Verify hlen meets minimum size requirements */ - if (hlen < sizeof(struct tcphdr)) - return network - data; - - network += hlen; - } else if (hnae_get_field(flag, HNS3_RXD_L4ID_M, HNS3_RXD_L4ID_S) - == HNS3_RX_FLAG_L4ID_UDP) { - if ((typeof(max_size))(network - data) > - (max_size - sizeof(struct udphdr))) - return max_size; - - network += sizeof(struct udphdr); - } - - /* If everything has gone correctly network should be the - * data section of the packet and will be the end of the header. - * If not then it probably represents the end of the last recognized - * header. - */ - if ((typeof(max_size))(network - data) < max_size) - return network - data; - else - return max_size; -} - static void hns3_nic_reuse_page(struct sk_buff *skb, int i, struct hns3_enet_ring *ring, int pull_len, struct hns3_desc_cb *desc_cb) @@ -2253,8 +2153,8 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, ring->stats.seg_pkt_cnt++; u64_stats_update_end(&ring->syncp); - pull_len = hns3_nic_get_headlen(va, l234info, - HNS3_RX_HEAD_SIZE); + pull_len = eth_get_headlen(va, HNS3_RX_HEAD_SIZE); + memcpy(__skb_put(skb, pull_len), va, ALIGN(pull_len, sizeof(long))); From patchwork Sat May 19 15:53:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136403 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2547737lji; Sat, 19 May 2018 08:57:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpdPTRGKEKNmZhxPTX2GqZwP2shxV3K18iUUv5cdDaSKG+5bkYZSVEHtui39/bBxb8QVDht X-Received: by 2002:a17:902:903:: with SMTP id 3-v6mr14095939plm.377.1526745442390; Sat, 19 May 2018 08:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745442; cv=none; d=google.com; s=arc-20160816; b=YAkDJCxcwr6x5uAizlw7ZKyEP1qyasqWPuQCknwRQcr3qqVYHdOKKXFopvVjtt/9jM 1HexTUPB7PM/ScUhIBMFj3ZYROStYdU7cOK7b7O1B4gsB0bAFyhzGwxSqcnVJ/fYyS8S y1uLzD3k8mixrrY7z/kjh3SbwimgKVB0V3l34QduwtxlUvPMyO8P3tE9cj4YLRTLKIjY QOD9kkAxpV/lz2k3bEPVcVTF/uWjrC7VqT9SwW9O+1VyGaUUsgw2C5eqkwkwG13zbHvE czzu6uPUDUyHruGwY4yC3KA3qvtAkwK97A7ZgJ8zQ4WrSCJOLSHuMle0y9Cjl6fQPUTO A/ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=aN+V9qpc3CE4GQQYvGkbNkEeTneL+gRBqyCMHYmdYZE=; b=du+BLIRJVYo+0VNqjfM6GRY6RdATsR5g2jsr76cHHVPtq1D/NkzbUINSsdBLlL+9oE 0kuF0ug+oVLFccLMLNqAeYKhUiCgbHTqSsRjJTy52Vrpv7rBlpdzuL/XKmLdkvaFJyyb 3anM7Jl1U7jNjr+X7ji+IBQ+QoAyHLOozcL+uX4/VzlLCd0ALyoOLhqd7rdovXnuURHi AZC4faqZ/GKae4zFOrSqscn50N4suhYVLHCUA5fSlQHIJvw4uuSyqqbE3L3AL3W4m0TE GY4qZOkIxIyepxwv0oJcnt1+TEDigZNkfbhMnqZoP7A7BflJ8raFJYnrhTXnT7GrnPKS irhw== 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 o12-v6si10100931pfd.199.2018.05.19.08.57.22; Sat, 19 May 2018 08:57:22 -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 S1752711AbeESP5U (ORCPT + 29 others); Sat, 19 May 2018 11:57:20 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7689 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752537AbeESPyn (ORCPT ); Sat, 19 May 2018 11:54:43 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 364A4B564B2FA; Sat, 19 May 2018 23:54:28 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:23 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 3/9] net: hns3: cleanup of return values in hclge_init_client_instance() Date: Sat, 19 May 2018 16:53:17 +0100 Message-ID: <20180519155323.68960-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen Removes the goto and directly returns in case of errors as part of the cleanup. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 46435c8..46e030c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5297,7 +5297,7 @@ static int hclge_init_client_instance(struct hnae3_client *client, vport->nic.client = client; ret = client->ops->init_instance(&vport->nic); if (ret) - goto err; + return ret; if (hdev->roce_client && hnae3_dev_roce_supported(hdev)) { @@ -5305,11 +5305,11 @@ static int hclge_init_client_instance(struct hnae3_client *client, ret = hclge_init_roce_base_info(vport); if (ret) - goto err; + return ret; ret = rc->ops->init_instance(&vport->roce); if (ret) - goto err; + return ret; } break; @@ -5319,7 +5319,7 @@ static int hclge_init_client_instance(struct hnae3_client *client, ret = client->ops->init_instance(&vport->nic); if (ret) - goto err; + return ret; break; case HNAE3_CLIENT_ROCE: @@ -5331,18 +5331,16 @@ static int hclge_init_client_instance(struct hnae3_client *client, if (hdev->roce_client && hdev->nic_client) { ret = hclge_init_roce_base_info(vport); if (ret) - goto err; + return ret; ret = client->ops->init_instance(&vport->roce); if (ret) - goto err; + return ret; } } } return 0; -err: - return ret; } static void hclge_uninit_client_instance(struct hnae3_client *client, From patchwork Sat May 19 15:53:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136396 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2545798lji; Sat, 19 May 2018 08:54:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpy5oMHoHrl3GBPdiZGp48ld7eeg980t7HyPhVWc94QCcwlD7i96cIM77vOpcVuZ8Fu1hOe X-Received: by 2002:a63:7043:: with SMTP id a3-v6mr10801073pgn.206.1526745290097; Sat, 19 May 2018 08:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745290; cv=none; d=google.com; s=arc-20160816; b=uMUqumTndY9jJw7HGnmX9yk7Apnx6uiLnR+218yj7yHrs2CRh/GvVq+04kZWXDQQl6 Ik0Yc27bVnUntxwi4wfnSQ6ZB+lG2eeYX2senNmjyqhnhdUjFkVXTm1ZBHTdwFMNzQVY taotV4veODpmDh7YEHpIDJyGMANrqVTqydgxQt6SbxVhEOsgXZ4bbf5uAlhFNEEK6TTu fe3urUrk8t9fyaeHNO0Ku81Q8pUcFr6bcyKsoFcLOE/RfHk5PGa2OU+j2r0+rhkXyu/b nW91AU11htlQHERDL+C0KMLCkGldauwyLhVDihN+spVWhi+Bfrgo/hl86HRu4WwJcvHU BTIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=BbXwrwd8dig00aJgJ8wmUb6bxqX70p4BY0SuCGKyA/A=; b=v4MQ/jO21ozM2crHPbEpD0g6NDik8ZR/M2TT+D1PaxwSayR8SloSibWiO1kHFnI/YL 54E8djpqopsO4AO/6+nzbme7vuywU1ZTXHektjr4z5IYt738Gne9Jcs1fcVP/zY89QMV 4BG9HlvydO+1pffNttwJr4kCKBL1uiRj9aPkczxwd3TlF1KA7AVGcwGFmTmcJVWyGGcR QA1T5TM/JMNYE6gtrSOJB8WOse9TAX1OZgJ2sIhaHj0hCAdM+cbZcJjjOv3BNWO7iKlE sKowY2ensM8pxM+oWmsep6rGPmlW7Vs7JfIvJatqJntJl7J1Nxj03t/8gQyXFxsuBVlY AoXw== 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 b7-v6si7851720pgq.585.2018.05.19.08.54.49; Sat, 19 May 2018 08:54:50 -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 S1752579AbeESPyr (ORCPT + 29 others); Sat, 19 May 2018 11:54:47 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:39213 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752489AbeESPyj (ORCPT ); Sat, 19 May 2018 11:54:39 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1FA4E917D112; Sat, 19 May 2018 23:54:33 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:26 +0800 From: Salil Mehta To: CC: , , , , , , , Xi Wang Subject: [PATCH net-next 4/9] net: hns3: Fix the missing client list node initialization Date: Sat, 19 May 2018 16:53:18 +0100 Message-ID: <20180519155323.68960-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xi Wang This patch fixes the missing initialization of the client list node in the hnae3_register_client() function. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Xi Wang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 66cbb66..701ae5e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3509,6 +3509,8 @@ static int __init hns3_init_module(void) client.ops = &client_ops; + INIT_LIST_HEAD(&client.node); + ret = hnae3_register_client(&client); if (ret) return ret; From patchwork Sat May 19 15:53:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136398 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2545951lji; Sat, 19 May 2018 08:55:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo9KWM8UT+NKuxzzqWCUamhjAkKc+RcziUOpFGJjA4geKa6cn5JusE4Wz8wDDFKspaf2+zz X-Received: by 2002:a63:b107:: with SMTP id r7-v6mr2895113pgf.167.1526745303718; Sat, 19 May 2018 08:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745303; cv=none; d=google.com; s=arc-20160816; b=BMl2qLldHBfGzZeLFUZXLp0H3Nv7VNqOUK7YKGWYM7Xrq0dbabfSRlV5AsSNXnW8eQ jNb4E5PgG10b7VcBIi08ZfSmaD4E4QGLMzSYnrymJiaEsX685AMEnNh1/J70snQ+Obd9 oUYuSAwfwC1CtAYakaP9sRf25pfhc3Jw0dX9isYuhcCZqvzT2Db6e2Q2oBA3+joBzBSb 0ttyyixvVtambidEccXzDMXWGxNuKJ8Jkrn+8fIqs16+mSx/3qWn8XQ5xLDF+6CmjNSm 8XbX0AQGLofwTdPxXLN5oaECbvN2AacUs/mQAZ+izwC4sagLNBNeg18KnPdKjudgpVMg PGvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=4IXAskoDb9LShS6f89w9gJ96PZf5B94tm/6jkpIZCkk=; b=dupSf4/5XeRPfbX/uUl7fPZqVkwZqqp57s0sQ00YZuFtJg32RH3V3xJdh4nr1vguf3 PZwkKy/oVAmBElASnLzyVrjVHRCVCFplc8K72RZNwc8cRzWtjDKCFk4nK4VWVqMGXemc kG9mjspuF9F+HFRoJEarrikRvujVg9fqI7TmzaO9FHzm0nGhP6ioqdgusH/NGwkketJc uS4weYAJb3mW9lRt5sCqKGDiQi0iUxDp0XNglrNgLj3sbb2IAI4KRyj6uY2qbdigNPMS AbYO/9PIjRXaRoSx2TAIeeSPAb99B5H863bLMjtGxHPmSPRCUJSdB6x8EH9ogZhIiFme J1eg== 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 bd8-v6si9231723plb.559.2018.05.19.08.55.03; Sat, 19 May 2018 08:55:03 -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 S1752657AbeESPzA (ORCPT + 29 others); Sat, 19 May 2018 11:55:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7708 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752586AbeESPy4 (ORCPT ); Sat, 19 May 2018 11:54:56 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A3147C8C1983A; Sat, 19 May 2018 23:54:37 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:32 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan Subject: [PATCH net-next 6/9] net: hns3: Use enums instead of magic number in hclge_is_special_opcode Date: Sat, 19 May 2018 16:53:20 +0100 Message-ID: <20180519155323.68960-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan This patch does bit of a clean-up by using already defined enums for certain values in function hclge_is_special_opcode(). Below enums from have been used as replacements for magic values: enum hclge_opcode_type{ HCLGE_OPC_STATS_64_BIT = 0x0030, HCLGE_OPC_STATS_32_BIT = 0x0031, HCLGE_OPC_STATS_MAC = 0x0032, }; Signed-off-by: Huazhong Tan Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c index fab7068..59fb0eb 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -190,7 +190,11 @@ static int hclge_cmd_csq_done(struct hclge_hw *hw) static bool hclge_is_special_opcode(u16 opcode) { - u16 spec_opcode[3] = {0x0030, 0x0031, 0x0032}; + /* these commands have several descriptors, + * and use the first one to save opcode and return value + */ + u16 spec_opcode[3] = {HCLGE_OPC_STATS_64_BIT, + HCLGE_OPC_STATS_32_BIT, HCLGE_OPC_STATS_MAC}; int i; for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) { From patchwork Sat May 19 15:53:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136401 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2546590lji; Sat, 19 May 2018 08:55:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpqjjKpg3AzK17F0wK1rPuzo9VHpJ7PTW3A6UOxJy+xQFiKRHgCma+r84uxL7ohbM23k37W X-Received: by 2002:a17:902:a702:: with SMTP id w2-v6mr13742460plq.8.1526745355993; Sat, 19 May 2018 08:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745355; cv=none; d=google.com; s=arc-20160816; b=wbUH0z3S8j7IoYsN5SDvzz1ZMpNuq+aEmq7l/yQ9D/MNiHsl75wl35LY/F9hPhMMeN sbTZj3LZ6dBu2UmSN1+VdlRorh8yZnXqLJUjM6I8wgrl9bWg5PWeyD54/08V5ubSaMFG DKhLviu9VAeJfs8NXRFD5/zYCxD2K06cA4EjzYVsLUPkFrmVQds26G+y/fnx0V9jjWj2 Bh5gaO2zyUbtPyfS7gQJDJj9LZ5fmoHcF1g87JX1g8a15uidoTXzm9krCFbVe9YA3uXS 7YEO4ov9eL90c2A5oZmzznM8Jt8tEJTalmEdzZtAyJDJIeYYP8MpX9eeXYViirpGEZ54 gFLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=lqMiYOV+rUU3c2fI4SulG11NzR7MLyJkS2RG+pQ4Y+k=; b=fKJcMBJNsY4ms07Omnvao19kHP7HMxv0G6y6uj4mdTnnL7oGMcd38d2H/IOVCXUsQj ue/j2nTDl524JoTi0TBjaf6fg1V42CagVaNliQnns5MC7V4kbjQucLAdxMuR8krzM2q+ ALVNvv/o5YhhclqJk0U+cq8Z7FtXqYJ4AY5AabwUYzN0AV+izN4klZAtnzTiS6MdB6jQ mXHf5fyCRmRQCxE6O4FSkrRDgpa+JLrPlEhZh/pwG4Ybn+f91MUjF7CLA+XZteBqgIHC 7FdeThy7zrNmPFhBxFRpCObL/CO+ZmLFklNMLquXTpJkf8M90+fKXyQIaMuwp/zanJjT mdrQ== 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 g125-v6si7680294pgc.568.2018.05.19.08.55.55; Sat, 19 May 2018 08:55:55 -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 S1752701AbeESPzh (ORCPT + 29 others); Sat, 19 May 2018 11:55:37 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8124 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752623AbeESPy6 (ORCPT ); Sat, 19 May 2018 11:54:58 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 57AC9F2E94419; Sat, 19 May 2018 23:54:43 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:35 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 7/9] net: hns3: Fix for netdev not running problem after calling net_stop and net_open Date: Sat, 19 May 2018 16:53:21 +0100 Message-ID: <20180519155323.68960-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fuyun Liang The link status update function is called by timer every second. But net_stop and net_open may be called with very short intervals. The link status update function can not detect the link state has changed. It causes the netdev not running problem. This patch fixes it by updating the link state in ae_stop function. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 46e030c..2f0bbb6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3793,6 +3793,9 @@ static void hclge_ae_stop(struct hnae3_handle *handle) /* reset tqp stats */ hclge_reset_tqp_stats(handle); + del_timer_sync(&hdev->service_timer); + cancel_work_sync(&hdev->service_task); + hclge_update_link_status(hdev); } static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport, From patchwork Sat May 19 15:53:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136402 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2547205lji; Sat, 19 May 2018 08:56:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpMXgN7sLJ+epnuCwxeNWbW2kUwfvv7SwiFlu1kyb8ENr0frWnBcvIPy8PL41hMAVVL6BU9 X-Received: by 2002:a17:902:5709:: with SMTP id k9-v6mr13654289pli.165.1526745404893; Sat, 19 May 2018 08:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745404; cv=none; d=google.com; s=arc-20160816; b=qCpdAzZMmbaeujMz6u3AqXJ6P2G2Z7KDbg/1R4AigcbchRm1BaMQLbMfb7eE7cxjr9 I0on7isfgEX+2qBRlSZK2R+NbT3L/t+Gx8Ll7EYRNmSMoNlcV3411KqUCd2wGzckd4el TSLkLRCh241VXbQU5gEtb0ZD2x0OcsStoTdHM6LH/dL9BOojqMWyb0iE68V93C/DIb2v cVvkgMCzaF6L7Isbiy34ZRubVoJHjvAiTQDnxEtxPTwcD2dHkrbFu9e4Q87Px2/Uutho +7cH/zheyKtweBKV2Tlpqvri3OOocwfB+194MxCdW/TjphuyUS5WzyeRI7rSFf/5zZFt JB+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=XN/0xCFqmsf92t5w+o5rZl6QR1FQ+BIZ+zzJ7Tk7Xno=; b=Ro8KT+4cizcVHY7sYaeD91tQd9+hk+LHMf4UJMW3oZfUxUon+u/k3MD8CPKQaTWZ8l 8uW2H+36vNLDWusdXQ/LU0Aa4PiS8gsSc/Vl2fKRqfvKyglQPkXROcBFNChj+214S4kW s1MebUCT4Cejj+esWufn0P9nzTd53yIP/a8Eq/xqZMHxQ2UcIYmSpMKmApkjv6aDOYV7 TL2461TvK1KtRjF+xndZT2O3Op85UW1RRP4nopEJF1Iy4TeYAZdvA8Nz5uXBsxl0sMnW jY91i+aDNmaPdaH2QvqI4mlINYXwiw8PFJYmWnG3/cr7gDhYb5VBrv757+8fhhNPnyQK Xa4Q== 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 o12-v6si10100931pfd.199.2018.05.19.08.56.44; Sat, 19 May 2018 08:56:44 -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 S1752721AbeESP4m (ORCPT + 29 others); Sat, 19 May 2018 11:56:42 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:39243 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752584AbeESPyz (ORCPT ); Sat, 19 May 2018 11:54:55 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 50AF7E2462413; Sat, 19 May 2018 23:54:48 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:40 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 9/9] net: hns3: Fix for CMDQ and Misc. interrupt init order problem Date: Sat, 19 May 2018 16:53:23 +0100 Message-ID: <20180519155323.68960-10-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin When vf module is loading, the cmd queue initialization should happen before misc interrupt initialization, otherwise the misc interrupt handle will cause using uninitialized cmd queue problem. There is also the same issue when vf module is unloading. This patch fixes it by adjusting the location of some function. Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index f1f4a17..2b0e329 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1634,6 +1634,10 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) hclgevf_state_init(hdev); + ret = hclgevf_cmd_init(hdev); + if (ret) + goto err_cmd_init; + ret = hclgevf_misc_irq_init(hdev); if (ret) { dev_err(&pdev->dev, "failed(%d) to init Misc IRQ(vector0)\n", @@ -1641,10 +1645,6 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) goto err_misc_irq_init; } - ret = hclgevf_cmd_init(hdev); - if (ret) - goto err_cmd_init; - ret = hclgevf_configure(hdev); if (ret) { dev_err(&pdev->dev, "failed(%d) to fetch configuration\n", ret); @@ -1692,10 +1692,10 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) return 0; err_config: - hclgevf_cmd_uninit(hdev); -err_cmd_init: hclgevf_misc_irq_uninit(hdev); err_misc_irq_init: + hclgevf_cmd_uninit(hdev); +err_cmd_init: hclgevf_state_uninit(hdev); hclgevf_uninit_msi(hdev); err_irq_init: @@ -1705,9 +1705,9 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev) static void hclgevf_uninit_hdev(struct hclgevf_dev *hdev) { - hclgevf_cmd_uninit(hdev); - hclgevf_misc_irq_uninit(hdev); hclgevf_state_uninit(hdev); + hclgevf_misc_irq_uninit(hdev); + hclgevf_cmd_uninit(hdev); hclgevf_uninit_msi(hdev); hclgevf_pci_uninit(hdev); }