From patchwork Tue Sep 19 16:17:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113041 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5107166qgf; Tue, 19 Sep 2017 09:20:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDcsd+8Ud4p5JQtJmk8h5AFn0UYwMib5Ge//T5IjTgJgR6Yn2+x2YpT1dw77ukbVTgrzIQ9 X-Received: by 10.101.88.142 with SMTP id d14mr1811059pgu.36.1505838024354; Tue, 19 Sep 2017 09:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505838024; cv=none; d=google.com; s=arc-20160816; b=LDQlH7Is8t66FmdIIiz8P4jtg+3IiHye7Y9XgeTa6DQZRHEbnofmO2aNqlxtFAW8uM uHXecJWWqu4dwThuVKw5pG30aXE7I+LgIAWKRQgvW24ktzquG0mM3uKfc7bdXF7vCmNZ Mlm3POYjUJxPGZSF7GXykR7LYA20sw3yaVdIlflr5Ppuv9SNsCy3IDU4rtizeGSZsYLR vQxXrkhW5kS330M+eXHymIIpT0EC0mDcrrQj9BYtygp5GJTNSwspXsqzUOMJH0DmiTJq HuYGob6sPeufaoiONUll90bJ+uKP5hE/6T4TggA4knEF52/BVtz6ViaqFM0Jh6yU9SQe /NXA== 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=/RDVVwM3aTM9Gax2/P4T07GX+NieQ3pjPzZNIfe0M5s=; b=sfMH+gYKkR+0pj5otlLZtzsF55Cy3k6d9AOzNp03NAiKdB0GCRI1iduZZYEDUSbW4P uvbQsMt/PD6+hbFM8L+vwCh69IeLMuU4ZhmtFsS4KU8O4MXQqApq7OErve3oKZBwKDPx wnJbEQ4x/GtWCYxDkMiNHt0TDn86M+lAO4X43SpkXDiiDYDdnhKMxj/V1nto1SX3YZvx oguRneGEzxs8udwIt/p1y1hQ/6M53NeH20aj167PEuQ3FHLo8HLYP4bkxWXDJKjb12Mx 6BOXjVmIDKVrLcNdr75Dowg3ICy4gLjxN38/pWz76Vjq5mlxM+eVL41B2fVpahY38kvv CgHw== 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 g16si6767890pli.684.2017.09.19.09.20.24; Tue, 19 Sep 2017 09:20:24 -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 S1751789AbdISQUW (ORCPT + 26 others); Tue, 19 Sep 2017 12:20:22 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6495 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbdISQSH (ORCPT ); Tue, 19 Sep 2017 12:18:07 -0400 Received: from 172.30.72.59 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHO40834; Wed, 20 Sep 2017 00:18:02 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:17:53 +0800 From: Salil Mehta To: CC: , , , , , , , Subject: [PATCH V2 net 1/7] net: hns3: Fixes initialization of phy address from firmware Date: Tue, 19 Sep 2017 17:17:10 +0100 Message-ID: <20170919161716.92680-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.59C1433B.00FB, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 07123636b4c444578d769fb82f10c33d Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lipeng Default phy address of every port is 0. Therefore, phy address for each port need to be fetched from firmware and device initialized with fetched non-default phy address. Fixes: 6427264ef330 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Lipeng Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 1 + 1 file changed, 1 insertion(+) -- 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 bb45365..db4e07d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1066,6 +1066,7 @@ static int hclge_configure(struct hclge_dev *hdev) for (i = 0; i < ETH_ALEN; i++) hdev->hw.mac.mac_addr[i] = cfg.mac_addr[i]; hdev->hw.mac.media_type = cfg.media_type; + hdev->hw.mac.phy_addr = cfg.phy_addr; hdev->num_desc = cfg.tqp_desc_num; hdev->tm_info.num_pg = 1; hdev->tm_info.num_tc = cfg.tc_num; From patchwork Tue Sep 19 16:17:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113040 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5106520qgf; Tue, 19 Sep 2017 09:19:47 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB7rpF2rVDyp1A02rxQOMjer6bbtg36TW+bsywWgMDKWPye5JDbee01ZOHrt9AyHhi0r4jO X-Received: by 10.101.93.65 with SMTP id e1mr1856638pgt.150.1505837987352; Tue, 19 Sep 2017 09:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505837987; cv=none; d=google.com; s=arc-20160816; b=ksmGf2xyfsXTRotnxMci3vLJnCadN1a8QTPg6axmRT4xZv+mP605WW6pcJ9ZALWdHv B95dhfDutrgN3ZI3f4Chs4vH3f73+OUUK2mUdOo7lzJuSdg6P+Y3fX8k2uKK4oSCpH/O ChNfsE2iHG+KzaZzSFCxvFQyX/HLOYq4Fyy5t6e0q0jGk1z1Mss0frUX5IvFud7OLAO5 UJTWg32Pyhfn2tDQ37RzA/76pRoOlCG80XKFx682iMAq0Vc+yJZ0F1b3t1/NMBcCh/g5 TCD6wUx4D+f9e/Bq665uE1X/NTgk8bB7JuatAAip5R91fDoRqivbFLP0zSyOhQvjEX7O mB0Q== 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=SZ/QI8nZxpZeYU6YsmPo5O1H801I3QufMicJfqU12s4=; b=rIOu/QqDkbCOEiJLIoa500b4QqfbX8PIYFNiLMn4vAvFj8kJJmsEpu532OlUctaKyg xY35AsMHaKerxvK2cJ4eRJtoFQhpYCrvAJ+sYaaldYs9AmBWMFsK23+Nx0M7lVc+Aqp7 EZKU7KyIUy9MQJHRDyM8qvuPkGdFZ0Mj5aqdtwGk9xUBL68EMxd36t3fInwBuPPl4GXV y4M4dP+6n0TuqJL59hlI6+s6SKyu5WyYbg5MGY5UeSnuWg+L9XnLrnSqCCfdDlLZ3Pgd b40H8pzqFCiB1Tsf7iaD6O3LXgTS7XOGOiy2iKdv+Bm76z5NkYCXzPfOfCtFHlNJ/Ek+ a4cg== 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 g16si6767890pli.684.2017.09.19.09.19.47; Tue, 19 Sep 2017 09:19:47 -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 S1751876AbdISQSO (ORCPT + 26 others); Tue, 19 Sep 2017 12:18:14 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6516 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823AbdISQSK (ORCPT ); Tue, 19 Sep 2017 12:18:10 -0400 Received: from 172.30.72.58 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHQ42777; Wed, 20 Sep 2017 00:18:07 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:17:56 +0800 From: Salil Mehta To: CC: , , , , , , , Subject: [PATCH V2 net 2/7] net: hns3: Fixes the command used to unmap ring from vector Date: Tue, 19 Sep 2017 17:17:11 +0100 Message-ID: <20170919161716.92680-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.59C1433F.021C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9f5bea2a9474651a55669a91d34c8dd1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lipeng This patch fixes the IMP command being used to unmap the vector from the corresponding ring. Fixes: 6427264ef330 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Lipeng Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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 db4e07d..e324bc6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2779,7 +2779,7 @@ static int hclge_unmap_ring_from_vector( } i = 0; hclge_cmd_setup_basic_desc(&desc, - HCLGE_OPC_ADD_RING_TO_VECTOR, + HCLGE_OPC_DEL_RING_TO_VECTOR, false); req->int_vector_id = vector_id; } From patchwork Tue Sep 19 16:17:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113035 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5105039qgf; Tue, 19 Sep 2017 09:18:18 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBNoVgCe1jtaXnhH4qBHyC9k7R7DyDXdNzVXhVe6cY7QRdw6HFKFs36oy261pEOPBuQobIB X-Received: by 10.99.181.23 with SMTP id y23mr1811153pge.191.1505837898501; Tue, 19 Sep 2017 09:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505837898; cv=none; d=google.com; s=arc-20160816; b=K1uCIp3FVR7mb78aXr2jRHOoyLws83AYnR12nNdhieMwfo/+RWSB4h7hwgNLYtIEeZ ULYihkJMa1f8Vopw8nnIPY1DcNapuB0VMNTZB37Y+cRag47hDditM3UqJQKvuzjMAKC/ 8BUCr8ENq5WfUN9b1mAGXlUvJVBvkU801u0GD10hW4JpcZDm5WINXI77MUrsHK6tLdqt 5snIMGx6NLIqWRhWgfjUY6Dl2xEEqMzxETLAuwuvVk2F51lOtKl3w0PC3JLC07r1CHEO OuVRP2GbanNPSoAhKIZ7v51+atoItH6Xd/PLJr/kS1c5WBus0qvRRKgcJfiM5rgzuYBj EyWg== 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=dQEjcOz6V3pY5xeot9SaT6AXGgyD6apLKDm5qZ14t9Y=; b=NAlj7MlYB4XepdnaE+7LerHkUaSx+lCIrjG2JEq7ma8XJScOx8wDimg8wZZtpD+rKI BY9Rw5T0UisDboHudzv7ccmNm0p6TMjKfX1m+PkjAL5SAX5eudRHteBmrXu2HqZlEvhv c02DZkWSOPvuTuMiGmPLCQr419LhHLlzyi8DJ17onIuiIye73WHlYBxc/qogdZCrQ9WY hyD0ugiY0PaMm2ryqrB6P6whIOIBBDtQ2Xyvmv9jtrcvN5eCm4MJWOfj1l989v5q7BpQ ta9XtNx+efpXFJikkeDFyznFM2yN/n8mlWzS5Bqgfxyq1nv5v0WWxJCfrRG45a8hiY0S Av6g== 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 k12si1668132pgq.184.2017.09.19.09.18.18; Tue, 19 Sep 2017 09:18:18 -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 S1751902AbdISQSQ (ORCPT + 26 others); Tue, 19 Sep 2017 12:18:16 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6517 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751834AbdISQSK (ORCPT ); Tue, 19 Sep 2017 12:18:10 -0400 Received: from 172.30.72.58 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHQ42779; Wed, 20 Sep 2017 00:18:07 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:17:59 +0800 From: Salil Mehta To: CC: , , , , , , , , Mingguang Qu Subject: [PATCH V2 net 3/7] net: hns3: Fixes ring-to-vector map-and-unmap command Date: Tue, 19 Sep 2017 17:17:12 +0100 Message-ID: <20170919161716.92680-4-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.59C14340.000A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cc1faf1a8e085ef5ecd50cc19cf54816 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lipeng This patch fixes the vector-to-ring map and unmap command and adds INT_GL(for, Gap Limiting Interrupts) and VF id to it as required by the hardware interface. Fixes: 6427264ef330 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Lipeng Signed-off-by: Mingguang Qu Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 8 ++++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index 91ae013..c2b613b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -238,7 +238,7 @@ struct hclge_tqp_map { u8 rsv[18]; }; -#define HCLGE_VECTOR_ELEMENTS_PER_CMD 11 +#define HCLGE_VECTOR_ELEMENTS_PER_CMD 10 enum hclge_int_type { HCLGE_INT_TX, @@ -252,8 +252,12 @@ struct hclge_ctrl_vector_chain { #define HCLGE_INT_TYPE_S 0 #define HCLGE_INT_TYPE_M 0x3 #define HCLGE_TQP_ID_S 2 -#define HCLGE_TQP_ID_M (0x3fff << HCLGE_TQP_ID_S) +#define HCLGE_TQP_ID_M (0x7ff << HCLGE_TQP_ID_S) +#define HCLGE_INT_GL_IDX_S 13 +#define HCLGE_INT_GL_IDX_M (0x3 << HCLGE_INT_GL_IDX_S) __le16 tqp_type_and_id[HCLGE_VECTOR_ELEMENTS_PER_CMD]; + u8 vfid; + u8 rsv; }; #define HCLGE_TC_NUM 8 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index e324bc6..eafd9c6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2680,7 +2680,11 @@ int hclge_map_vport_ring_to_vector(struct hclge_vport *vport, int vector_id, hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); hnae_set_field(req->tqp_type_and_id[i], HCLGE_TQP_ID_M, HCLGE_TQP_ID_S, node->tqp_index); + hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_GL_IDX_M, + HCLGE_INT_GL_IDX_S, + hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); req->tqp_type_and_id[i] = cpu_to_le16(req->tqp_type_and_id[i]); + req->vfid = vport->vport_id; if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) { req->int_cause_num = HCLGE_VECTOR_ELEMENTS_PER_CMD; @@ -2764,8 +2768,12 @@ static int hclge_unmap_ring_from_vector( hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); hnae_set_field(req->tqp_type_and_id[i], HCLGE_TQP_ID_M, HCLGE_TQP_ID_S, node->tqp_index); + hnae_set_field(req->tqp_type_and_id[i], HCLGE_INT_GL_IDX_M, + HCLGE_INT_GL_IDX_S, + hnae_get_bit(node->flag, HNAE3_RING_TYPE_B)); req->tqp_type_and_id[i] = cpu_to_le16(req->tqp_type_and_id[i]); + req->vfid = vport->vport_id; if (++i >= HCLGE_VECTOR_ELEMENTS_PER_CMD) { req->int_cause_num = HCLGE_VECTOR_ELEMENTS_PER_CMD; From patchwork Tue Sep 19 16:17:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113036 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5105131qgf; Tue, 19 Sep 2017 09:18:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCBCkMvpSvplROnG5TZyPduJ8revD7Pzunh8kwKjoaKbJGFNGQyIy2okgLfYWHOkYihlKBM X-Received: by 10.84.129.7 with SMTP id 7mr1795765plb.40.1505837903900; Tue, 19 Sep 2017 09:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505837903; cv=none; d=google.com; s=arc-20160816; b=MOCBkbmlm5JtdCM9YYoeRVYZCq3KQ0KyfYb9YxsgtMjxT+DavsQCKsI1i/OSMje12o d55FIN1gqHI34629A1+iGrxtKYBTtf7HSuboaRt4SpumzlOp4OpM5PWsKJpA85x288fU rlsUVdfC9XNevaL4GnkYTebylJGky4487Qsa6g8yFo6XM6eJnH6z69Y1GslVB/eiBOi+ ILMVo3o2PVld4ozd8Jyp2lpohwGGvmx+Iuw5UB79zX08HfriJCSggDFAwlub1hPYKiQK ZswrBuGq9TsHjq1nJph1zuVOExTXEWUvneqA7/boTS7Ub87CGLq5FZrjmu/F7MTMQS8I l84g== 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=dDivSL0S2NUaeLKIYgOMS5Ge0Nyf8SjCpb6v/qlWZVg=; b=qaEyjf7Dc5Wi0tvk19fsrGHdo3mGUNKDUSdvdBCGZZRLT3/mq352I3Bh+KMg5XPyOZ ruGqDxTqjms6h7mdF/eOZGTXpBQYmgXnwxGRx/gJK1rTzC/9PexEGD/RPrp67DNS11QW APw1NtMR+EIkL82/ynFsuePToEG17Z3L1iO2jpENb4mhZd7Hq4CzLy3QtcTOZ6JrAwIc CamVuC4psm+ju0xflu6s/T3X++1i8+e8uTZBduwwiNbhAyTIyGmMWL4CSDi+ht6XanoR mINRzwBnZ0pyLFbgFeHuBSVosDMV7XMuGL6wfg/AFTrBT5O8SbTuriJGlK8RLaHAMOqh GjWw== 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 k12si1668132pgq.184.2017.09.19.09.18.23; Tue, 19 Sep 2017 09:18:23 -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 S1751929AbdISQSV (ORCPT + 26 others); Tue, 19 Sep 2017 12:18:21 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6496 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751868AbdISQSQ (ORCPT ); Tue, 19 Sep 2017 12:18:16 -0400 Received: from 172.30.72.60 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.60]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHO40855; Wed, 20 Sep 2017 00:18:12 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:18:02 +0800 From: Salil Mehta To: CC: , , , , , , , Subject: [PATCH V2 net 4/7] net: hns3: Fixes the initialization of MAC address in hardware Date: Tue, 19 Sep 2017 17:17:13 +0100 Message-ID: <20170919161716.92680-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59C14344.01A7, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6f3075af8b9ff4e951bacf1caef2c997 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lipeng This patch fixes the initialization of MAC address, fetched from HNS3 firmware i.e. when it is not randomly generated, to the HNS3 hardware. Fixes: ca60906d2795 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Lipeng Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c index 1c3e294..4d68d6e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c @@ -2705,10 +2705,11 @@ static void hns3_init_mac_addr(struct net_device *netdev) eth_hw_addr_random(netdev); dev_warn(priv->dev, "using random MAC address %pM\n", netdev->dev_addr); - /* Also copy this new MAC address into hdev */ - if (h->ae_algo->ops->set_mac_addr) - h->ae_algo->ops->set_mac_addr(h, netdev->dev_addr); } + + if (h->ae_algo->ops->set_mac_addr) + h->ae_algo->ops->set_mac_addr(h, netdev->dev_addr); + } static void hns3_nic_set_priv_ops(struct net_device *netdev) From patchwork Tue Sep 19 16:17:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113039 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5106104qgf; Tue, 19 Sep 2017 09:19:21 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCY1myq2zCU9AsepA54tpQT6UgIpK0Womn64Xknb9vtrmT6Cb9UT+BjExbliOmZCSR5hD+2 X-Received: by 10.99.121.141 with SMTP id u135mr1787764pgc.86.1505837961781; Tue, 19 Sep 2017 09:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505837961; cv=none; d=google.com; s=arc-20160816; b=aum4fotZA99yAf5ffcVCFAAJoZENAqzM56K+TbsAbqqnSOB/0YgaaLCfe28YhT4Z24 Se2vXoeEtNhtTJ9nl8K9JZnLSJ68XaFNJDpsBfKNauU/i6TtWzlH5xJS5dBVxAntE9V1 zIBUVNQokEqAU4EAk4oZSA+HTO7aboDEgmonmnYeVGEhibQ8KaZxpsbKA6MhZlMNsH7i V/3Ecx7foVGv/O0S8N/Q+yHA4WU43uAn8d9TUGpPrPJSyvPF8qhwC56eXjXkTWDl56u1 rTW+GHyeHo07dXMnXkHGb46iQK7UE1+wwQ/Vho8eCaQy+es/aBuQLI9ly98h8qOVTY+A HCLg== 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=ZZtT3JMX7UAwWgTLPVphRdEPNSRY2YE7IzzTMpcIMXg=; b=eiBaUr6nY6du4LE4wN9aGSP+1m7M/Ty/OzBDyaL3eme3ac+BPh5ePtV1OhbYtx55IQ z3kWqJMQGar8X/wcvuB6SVTgj6rhVMTmgATIZJlVMiaVQmllXQORP2WVD/a9PBLcBS4W eMw60d1WQTSbvq50KvppyggGXKHjQobxG+VoEmpKAdNMQIejTQ+E3CEvYf4b0/62zYXW 71FaL1TNoeLxNtR7Vg8+phUqi/bMcmYYdj/5OWPRTGQ7+3AG0QDwv4rvl800V0ITcVdq Q7Euhxm0FgDlBqgO2xL8gmZXSMU05FN8l7v7wus+3cRV8QIsum6koGwixmQv4WCtJ7dX OKBQ== 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 t61si6878541plb.199.2017.09.19.09.19.21; Tue, 19 Sep 2017 09:19:21 -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 S1751970AbdISQTU (ORCPT + 26 others); Tue, 19 Sep 2017 12:19:20 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6497 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdISQSP (ORCPT ); Tue, 19 Sep 2017 12:18:15 -0400 Received: from 172.30.72.60 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.60]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHO40858; Wed, 20 Sep 2017 00:18:12 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:18:05 +0800 From: Salil Mehta To: CC: , , , , , , , Subject: [PATCH V2 net 5/7] net: hns3: Fixes the ether address copy with appropriate API Date: Tue, 19 Sep 2017 17:17:14 +0100 Message-ID: <20170919161716.92680-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.59C14345.00D8, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c57fef28641f6e05564b259c5880046f Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch replaces the ethernet address copy instance with more appropriate ether_addr_copy() function. Fixes: 6427264ef330 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 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 eafd9c6..8e172af 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -1063,8 +1063,7 @@ static int hclge_configure(struct hclge_dev *hdev) hdev->base_tqp_pid = 0; hdev->rss_size_max = 1; hdev->rx_buf_len = cfg.rx_buf_len; - for (i = 0; i < ETH_ALEN; i++) - hdev->hw.mac.mac_addr[i] = cfg.mac_addr[i]; + ether_addr_copy(hdev->hw.mac.mac_addr, cfg.mac_addr); hdev->hw.mac.media_type = cfg.media_type; hdev->hw.mac.phy_addr = cfg.phy_addr; hdev->num_desc = cfg.tqp_desc_num; From patchwork Tue Sep 19 16:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113038 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5105557qgf; Tue, 19 Sep 2017 09:18:47 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAOwjvOogUUaYArh9VPnsxnXdHx+zOYSp0RsN5Ru+IEpFLfR7PtKJYymk2aV0/kHJa4GDz4 X-Received: by 10.84.235.203 with SMTP id m11mr1736313plt.28.1505837927903; Tue, 19 Sep 2017 09:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505837927; cv=none; d=google.com; s=arc-20160816; b=o0C+KPyLPyl9X+hL834bOLnaG9jv7uWshDlPL9OIC8pqoSBGwvO/r680XGA3xdFiMA bptxRRUDk0PpfSGiRuFKKMkurNF1jj4z6Y04UvUGPUwwZ+0zuS6TBW6qT5geH+nTa5VF XC0OwYmw61MgvODssEvCliiFFELMgpI7WS40X9cql1ETYsG7V7PoFBU/Rs9vDLgGVWMu HgVOj9r/3mDqAM2yJa2R1pMvzzV40HZwW0ycrMN+24Fb4nZrw4bSFIPFASCLb3DjaNg0 AYu2skqJop9cncpQzety49FeZN3Q9WTrIxSD6UA+PwdAxnJbLks+l8guOTcR+8UtDh/V QNPA== 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=y38JFdDYwI75XDPoEQkOAAohLivfBRc+pcCldok1Up8=; b=b69X2k48lOgrQoabMpttm+BjeXELXRYMBXp5kJZuLOZE5GpCE16wD45YMPOL1E7sZA SDSqabV94viYDm0xC5QYrOBOGt7y3AzzuInSp9FT9bfcPsA7KaCkx52pV2GDd8Ab2/uI kuPuWf1pMneGsys71zZXdCCHMmEhqlgb8Xn+zGOj6GsV0DWaQCDRGbzVL9+YrWFGzKN1 Nbz2tvOnjd+QGwUTEp+mLs6drU/zOQmldRZsCbTf7ABW4y9pRbhHu/H94kHiDxt/2ykc 71Zs6o+gKUn7dKbcYc5GNH4T5GSf5AFP6HwqmZp0hVtdYMgGCRjK+rRjW/Lev5Jpi3A8 sM0A== 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 o16si1543288pfi.582.2017.09.19.09.18.47; Tue, 19 Sep 2017 09:18:47 -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 S1751966AbdISQSo (ORCPT + 26 others); Tue, 19 Sep 2017 12:18:44 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6498 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751669AbdISQSU (ORCPT ); Tue, 19 Sep 2017 12:18:20 -0400 Received: from 172.30.72.59 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHO40867; Wed, 20 Sep 2017 00:18:17 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:18:08 +0800 From: Salil Mehta To: CC: , , , , , , , , Mingguang Qu Subject: [PATCH V2 net 6/7] net: hns3: Fixes the default VLAN-id of PF Date: Tue, 19 Sep 2017 17:17:15 +0100 Message-ID: <20170919161716.92680-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59C1434A.0037, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 09cd0021600638663c90c5e7fde4c014 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lipeng When there is no vlan id in the packets, hardware will treat the vlan id as 0 and look for the mac_vlan table. This patch set the default vlan id of PF as 0. Without this config, it will fail when look for mac_vlan table, and hardware will drop packets. Fixes: 6427264ef330 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Mingguang Qu Signed-off-by: Lipeng Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 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 8e172af..74008ef 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3673,6 +3673,7 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) { #define HCLGE_VLAN_TYPE_VF_TABLE 0 #define HCLGE_VLAN_TYPE_PORT_TABLE 1 + struct hnae3_handle *handle; int ret; ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_VLAN_TYPE_VF_TABLE, @@ -3682,8 +3683,11 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_VLAN_TYPE_PORT_TABLE, true); + if (ret) + return ret; - return ret; + handle = &hdev->vport[0].nic; + return hclge_set_port_vlan_filter(handle, htons(ETH_P_8021Q), 0, false); } static int hclge_set_mtu(struct hnae3_handle *handle, int new_mtu) From patchwork Tue Sep 19 16:17:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 113037 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5105199qgf; Tue, 19 Sep 2017 09:18:28 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBhBsC1cgAUS+CM8U0giIz5MWbzkODbowIf6Y6E3GyZPClrXWoYWoaT1psHGNhALLhRU6Bd X-Received: by 10.98.112.138 with SMTP id l132mr1804182pfc.71.1505837908116; Tue, 19 Sep 2017 09:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505837908; cv=none; d=google.com; s=arc-20160816; b=lsRFpP1gYige7uNAt6byShqZU4m6A4EskMvcFzx/Gfv3j5LcEnBub5JxeRqbBu5xt+ rbosa4Ecce3rToVOZ0h4X1BO1kFkJakEIxe38OAk2O/m6gEZPI6gVq1gd4YHl6xeLQRa WIHO09sThHKxba9BRO5JI04A7enN8TaLJSwZaX4SEvaO0B2iARbRZDVCtoFgOURm4aTh 9bYX9nLUkdikS3fpUXSYvMCkPomVPhhgwEPPyU69fcepof1qp20G+rMWXoz8TdiUCUnN rLE13dsf9itPFPZgA/XR2XMWbFN3ErBx1+7fkL4bXGWc6X2VAitpSqHrMe3fJmCB5hOG OqKA== 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=NnKDUfmcJ51Xaz2dwdJSoPWheXpG6ot8RGpPkYg5pJI=; b=RN89ZQ2OFQTgJdW3A4Yjks4er6bNxrlZOxAW+f9wMbyOhZzbtokRuTJigue3x/K8DN 1yCVjZhTucZHjp5/KmH52md2gyqZ53g2Omh+fHvhh8W/SXkpSN2QZbnv2RkxDJZNFmOG Auas0lpwmRtKodjTURy9xcXYBxAtmiaazNjcv0DGWo6VkkoYZS3OeuxQM25gqgd5YNx4 xl0HXBwumyJZ+uJ8j/+053dgy4834BYuPqvUu/7mHiXVR8nOnxStQNIyKfdN0eQQnhPp 0X4KfasU1TiOyl3v7qq3HpPCIaBxmJxpdYWNgkPHbh4eB9PZsSxfkpTrlx68Dvv9DrdO XxQQ== 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 o16si1543288pfi.582.2017.09.19.09.18.27; Tue, 19 Sep 2017 09:18:28 -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 S1751959AbdISQSY (ORCPT + 26 others); Tue, 19 Sep 2017 12:18:24 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6499 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751903AbdISQSV (ORCPT ); Tue, 19 Sep 2017 12:18:21 -0400 Received: from 172.30.72.59 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DHO40868; Wed, 20 Sep 2017 00:18:18 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.203.181.154) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 20 Sep 2017 00:18:11 +0800 From: Salil Mehta To: CC: , , , , , , , Subject: [PATCH V2 net 7/7] net: hns3: Fixes the premature exit of loop when matching clients Date: Tue, 19 Sep 2017 17:17:16 +0100 Message-ID: <20170919161716.92680-8-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20170919161716.92680-1-salil.mehta@huawei.com> References: <20170919161716.92680-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.181.154] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.59C1434A.0118, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 05a096c747ebff15824aa32be7bd6476 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lipeng When register/unregister ae_dev, ae_dev should match all client in the client_list. Enet and roce can co-exists together so we should continue checking for enet and roce presence together. So break should not be there. Above caused problems in loading and unloading of modules. Fixes: 38eddd126772 ("net: hns3: Add support of the HNAE3 framework") Signed-off-by: Lipeng Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.c | 43 ++++++----------------------- 1 file changed, 9 insertions(+), 34 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c index 59efbd6..5bcb223 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c @@ -37,20 +37,15 @@ static bool hnae3_client_match(enum hnae3_client_type client_type, } static int hnae3_match_n_instantiate(struct hnae3_client *client, - struct hnae3_ae_dev *ae_dev, - bool is_reg, bool *matched) + struct hnae3_ae_dev *ae_dev, bool is_reg) { int ret; - *matched = false; - /* check if this client matches the type of ae_dev */ if (!(hnae3_client_match(client->type, ae_dev->dev_type) && hnae_get_bit(ae_dev->flag, HNAE3_DEV_INITED_B))) { return 0; } - /* there is a match of client and dev */ - *matched = true; /* now, (un-)instantiate client by calling lower layer */ if (is_reg) { @@ -69,7 +64,6 @@ int hnae3_register_client(struct hnae3_client *client) { struct hnae3_client *client_tmp; struct hnae3_ae_dev *ae_dev; - bool matched; int ret = 0; mutex_lock(&hnae3_common_lock); @@ -86,7 +80,7 @@ int hnae3_register_client(struct hnae3_client *client) /* if the client could not be initialized on current port, for * any error reasons, move on to next available port */ - ret = hnae3_match_n_instantiate(client, ae_dev, true, &matched); + ret = hnae3_match_n_instantiate(client, ae_dev, true); if (ret) dev_err(&ae_dev->pdev->dev, "match and instantiation failed for port\n"); @@ -102,12 +96,11 @@ EXPORT_SYMBOL(hnae3_register_client); void hnae3_unregister_client(struct hnae3_client *client) { struct hnae3_ae_dev *ae_dev; - bool matched; mutex_lock(&hnae3_common_lock); /* un-initialize the client on every matched port */ list_for_each_entry(ae_dev, &hnae3_ae_dev_list, node) { - hnae3_match_n_instantiate(client, ae_dev, false, &matched); + hnae3_match_n_instantiate(client, ae_dev, false); } list_del(&client->node); @@ -124,7 +117,6 @@ int hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo) const struct pci_device_id *id; struct hnae3_ae_dev *ae_dev; struct hnae3_client *client; - bool matched; int ret = 0; mutex_lock(&hnae3_common_lock); @@ -151,13 +143,10 @@ int hnae3_register_ae_algo(struct hnae3_ae_algo *ae_algo) * initialize the figure out client instance */ list_for_each_entry(client, &hnae3_client_list, node) { - ret = hnae3_match_n_instantiate(client, ae_dev, true, - &matched); + ret = hnae3_match_n_instantiate(client, ae_dev, true); if (ret) dev_err(&ae_dev->pdev->dev, "match and instantiation failed\n"); - if (matched) - break; } } @@ -175,7 +164,6 @@ void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo) const struct pci_device_id *id; struct hnae3_ae_dev *ae_dev; struct hnae3_client *client; - bool matched; mutex_lock(&hnae3_common_lock); /* Check if there are matched ae_dev */ @@ -187,12 +175,8 @@ void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo) /* check the client list for the match with this ae_dev type and * un-initialize the figure out client instance */ - list_for_each_entry(client, &hnae3_client_list, node) { - hnae3_match_n_instantiate(client, ae_dev, false, - &matched); - if (matched) - break; - } + list_for_each_entry(client, &hnae3_client_list, node) + hnae3_match_n_instantiate(client, ae_dev, false); ae_algo->ops->uninit_ae_dev(ae_dev); hnae_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0); @@ -212,7 +196,6 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev) const struct pci_device_id *id; struct hnae3_ae_algo *ae_algo; struct hnae3_client *client; - bool matched; int ret = 0; mutex_lock(&hnae3_common_lock); @@ -246,13 +229,10 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev) * initialize the figure out client instance */ list_for_each_entry(client, &hnae3_client_list, node) { - ret = hnae3_match_n_instantiate(client, ae_dev, true, - &matched); + ret = hnae3_match_n_instantiate(client, ae_dev, true); if (ret) dev_err(&ae_dev->pdev->dev, "match and instantiation failed\n"); - if (matched) - break; } out_err: @@ -270,7 +250,6 @@ void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev) const struct pci_device_id *id; struct hnae3_ae_algo *ae_algo; struct hnae3_client *client; - bool matched; mutex_lock(&hnae3_common_lock); /* Check if there are matched ae_algo */ @@ -279,12 +258,8 @@ void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev) if (!id) continue; - list_for_each_entry(client, &hnae3_client_list, node) { - hnae3_match_n_instantiate(client, ae_dev, false, - &matched); - if (matched) - break; - } + list_for_each_entry(client, &hnae3_client_list, node) + hnae3_match_n_instantiate(client, ae_dev, false); ae_algo->ops->uninit_ae_dev(ae_dev); hnae_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0);