Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2104946yba; Thu, 25 Apr 2019 10:41:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJA+wfglLqpzReBfzc3gpr2ROkARG5bHj1Lrq+LkjYGy3FIQ4Zyc1PrKqTDAqZRM+CWRTZ X-Received: by 2002:a62:2e02:: with SMTP id u2mr4548636pfu.1.1556214077788; Thu, 25 Apr 2019 10:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556214077; cv=none; d=google.com; s=arc-20160816; b=LGzC9TvppqL6sWu2P8B3hnQqkcvkmqnvKvYI9IuJswC80uq2i74oEvNzPErVqRYdjj VhP9UPHbkIApKahgLrw/OonTgAIrrhfxYHNBGGQsWj7Fp9uR6aYT6pnIv3ysVKFnW/ft xD6196zbSw/4pEtnaa+3jfeGLif2dLnhZZMzhKtqyIEhnbUyECP3ksbz0mAKdRnECgrg qTDPuFea2LhCnVtI5OPwJUZ32xFbj4Kahfo4WUI2+Nr57mUtS4sisXg7k3EpnPuChIHi 07Pk/1/7Mq1qbFlaP6w4Y2XK/h7LIwOd8zPB1aP8WHA4IBs6rf6JHY4HZiDTbKQGAm7c 0Zvw== 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; bh=9eZkgL3o8s8l3Ek+jI321Gq8AfuG6KZ9w2du79yEfcs=; b=cT9DnAAscZdv0tfgIV49A9DKQfNBpwCXe7ivtrIR5+hRb4pspdORyFwHBes5jZb58o aqfStJNKZvQS/sM0GpME541MP7G7bzuTdVi5k49GauUO9cL9vkdrDcsUs7nbb303klLz OK4B42SJ88Y0qkRTNCCLq3KF/6x2YE6g0PKL0RcZQbqhViVeZs8aYjXkdECk+kjBGfXi nKnuVdyrcVgoU+xlXV08WCNilRBvHl284lkWPnlm+s84nteEQU0rlhzKle1iXSQTfK2G 0VceWDMVfocLHTso1qbCZbGwb+gPyorRp8V5eeQYTrL0pIAM0IjpPRPcGKY1dMWea3VL EneQ== 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 b61si22946198plb.22.2019.04.25.10.41.02; Thu, 25 Apr 2019 10:41:17 -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 S2387938AbfDYMoo (ORCPT + 99 others); Thu, 25 Apr 2019 08:44:44 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6697 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731420AbfDYMoS (ORCPT ); Thu, 25 Apr 2019 08:44:18 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 4D801C9D683CF5B5B4DF; Thu, 25 Apr 2019 20:44:14 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Thu, 25 Apr 2019 20:44:04 +0800 From: Huazhong Tan To: CC: , , , , , , Huazhong Tan , Peng Li Subject: [PATCH V3 net-next 06/11] net: hns3: use a reserved byte to identify need_resp flag Date: Thu, 25 Apr 2019 20:42:50 +0800 Message-ID: <1556196175-65389-7-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556196175-65389-1-git-send-email-tanhuazhong@huawei.com> References: <1556196175-65389-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] 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 uses a reserved byte in the hclge_mbx_vf_to_pf_cmd to save the need_resp flag, so when PF received the mailbox, it can use it to decise whether send a response to VF. For hclge_set_vf_uc_mac_addr(), it should use mbx_need_resp flag to decide whether send response to VF. Signed-off-by: Huazhong Tan Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 5 ++++- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 7 +++---- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h index 8b6191f..83e19c6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h @@ -84,12 +84,15 @@ struct hclgevf_mbx_resp_status { struct hclge_mbx_vf_to_pf_cmd { u8 rsv; u8 mbx_src_vfid; /* Auto filled by IMP */ - u8 rsv1[2]; + u8 mbx_need_resp; + u8 rsv1[1]; u8 msg_len; u8 rsv2[3]; u8 msg[HCLGE_MBX_MAX_MSG_SIZE]; }; +#define HCLGE_MBX_NEED_RESP_BIT BIT(0) + struct hclge_mbx_pf_to_vf_cmd { u8 dest_vfid; u8 rsv[3]; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index 24386bd..fe48c56 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -212,8 +212,7 @@ static int hclge_set_vf_promisc_mode(struct hclge_vport *vport, } static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport, - struct hclge_mbx_vf_to_pf_cmd *mbx_req, - bool gen_resp) + struct hclge_mbx_vf_to_pf_cmd *mbx_req) { const u8 *mac_addr = (const u8 *)(&mbx_req->msg[2]); struct hclge_dev *hdev = vport->back; @@ -249,7 +248,7 @@ static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport, return -EIO; } - if (gen_resp) + if (mbx_req->mbx_need_resp & HCLGE_MBX_NEED_RESP_BIT) hclge_gen_resp_to_vf(vport, mbx_req, status, NULL, 0); return 0; @@ -597,7 +596,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, true); + ret = hclge_set_vf_uc_mac_addr(vport, req); 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_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index 3c22639..30f2e93 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -98,6 +98,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, u16 code, u16 subcode, } hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_VF_TO_PF, false); + req->mbx_need_resp |= need_resp ? HCLGE_MBX_NEED_RESP_BIT : + ~HCLGE_MBX_NEED_RESP_BIT; req->msg[0] = code; req->msg[1] = subcode; memcpy(&req->msg[2], msg_data, msg_len); -- 2.7.4