Received: by 10.223.185.111 with SMTP id b44csp1004971wrg; Fri, 9 Mar 2018 18:59:50 -0800 (PST) X-Google-Smtp-Source: AG47ELsqk9xVMXanbKwQ6FPnrm1KIqms4iU3ILjOMFZfbG5fllxTJE5rgZkmSVtlCPqbTJIvgHHF X-Received: by 10.98.34.75 with SMTP id i72mr644477pfi.165.1520650789925; Fri, 09 Mar 2018 18:59:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520650789; cv=none; d=google.com; s=arc-20160816; b=h47H1FC0EK6Xm1ieR00vzWcfl4iKrLXC2cbvHlRJ9dh84IK4hYNaf3y5QHDKvHlE58 TIY+Vp76+Ug86CNL0e8Q+3c7L29hSjZ3aosY08EiRlZi0fAcOiI8gG6JT8d+f2uDtj1T MTFuono+3oYX7sUEN0OgIwWJ28iVCVxme0Rrh5V1agPA0/XtPFlXgLctQkZitg4BIdjr tUQKav+JjJTv1WxvdLvZxMllhvpfEiIpdVvX1saqakcJx4RVDt0ou8C8sYTz90OsfzuG mPDI41JFJgEj3j1XdI48cFfawklXT7+SG+lmc4V+ntR3ilLZAizwAiZQGGhVsuUWAxMO Tzkw== 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=AKm4ePDfqPbwHSEtUPnBVNk6YcjbYKfxXHwrufyb5Nk=; b=GSB0aZ/eu38z9vXWC20V1d6jWEnoA2crckwyRVuPnONHKQe7eju6l4HUA6+jdGw9Vr Ij9pxaPz34lJ1r0DQJs/NUbr+y4UwZPpIQgpTQjWPRhEyGCil18cpXdEP8d0FRmfenk0 0q9Gc+nkXGKC3p4mwYNLegRcJpjcz2HW/8QKAf3yttKntYs8AIET+nuXmO5sXAuDtzaU YKgDLgUzFvoZNbjxAB8VyZWIeYGYT8htcVjJUAD+GFuBaUIXHjxIVIhUYNW4vMQTbyIY 7YySnNrVav9Tlv4y2tLrX7AlR3e/n86AnRQGKjIORtulxz1Nj/CHAIHU7DGyLHeMLbqR j3Pg== 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 c14si1897660pfn.313.2018.03.09.18.59.35; Fri, 09 Mar 2018 18:59:49 -0800 (PST) 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 S932857AbeCJC5l (ORCPT + 99 others); Fri, 9 Mar 2018 21:57:41 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6227 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751881AbeCJC5j (ORCPT ); Fri, 9 Mar 2018 21:57:39 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7923136FED7E7; Sat, 10 Mar 2018 10:57:26 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Sat, 10 Mar 2018 10:57:18 +0800 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 12/12] net: hns3: add result checking for VF when modify unicast mac address Date: Sat, 10 Mar 2018 11:29:33 +0800 Message-ID: <1520652573-75644-13-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520652573-75644-1-git-send-email-lipeng321@huawei.com> References: <1520652573-75644-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] 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 VF changes unicast mac address by sending mailbox msg to PF, then PF completes the mac address modification. It may fail when the target uc mac address is already in the mac_vlan table. VF should be aware of it by reading the message result. Signed-off-by: Jian Shen Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index e3e4ded..4a49a6b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -365,7 +365,7 @@ void hclge_mbx_handler(struct hclge_dev *hdev) ret); break; case HCLGE_MBX_SET_UNICAST: - ret = hclge_set_vf_uc_mac_addr(vport, req, false); + ret = hclge_set_vf_uc_mac_addr(vport, req, true); if (ret) dev_err(&hdev->pdev->dev, "PF fail(%d) to set VF UC MAC Addr\n", diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 6c240d6..2337025 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -744,7 +744,7 @@ static int hclgevf_set_mac_addr(struct hnae3_handle *handle, void *p, status = hclgevf_send_mbx_msg(hdev, HCLGE_MBX_SET_UNICAST, subcode, msg_data, ETH_ALEN * 2, - false, NULL, 0); + true, NULL, 0); if (!status) ether_addr_copy(hdev->hw.mac.mac_addr, new_mac_addr); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index 18283ef..9768f71 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -54,6 +54,10 @@ static int hclgevf_get_mbx_resp(struct hclgevf_dev *hdev, u16 code0, u16 code1, mbx_resp = &hdev->mbx_resp; r_code0 = (u16)(mbx_resp->origin_mbx_msg >> 16); r_code1 = (u16)(mbx_resp->origin_mbx_msg & 0xff); + + if (mbx_resp->resp_status) + return mbx_resp->resp_status; + if (resp_data) memcpy(resp_data, &mbx_resp->additional_info[0], resp_len); -- 2.9.3