Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1850127pxb; Sun, 17 Apr 2022 00:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3FG83dJ6KKlVjGsZDTKLb2b93bRhdguavgjOcgCAiEK53y/oH0CPiWpbqMNVLpTEqyrTt X-Received: by 2002:a05:6402:4391:b0:419:2f2d:a1da with SMTP id o17-20020a056402439100b004192f2da1damr6945875edc.298.1650181975847; Sun, 17 Apr 2022 00:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650181975; cv=none; d=google.com; s=arc-20160816; b=mFiQXlCKxaUULCaFsj6fkEQZdiUMMYJg0HrPP7MLTVjcRS1ZeKfyipxecDP8VqNH3i T9afbAlKvfJyAGEOzoKpAoK6Ux0oIW0yiHKTIZENLSKInswuW5hoT9UYPld/NDNz7ouf SgClS3Xic65vIRUqE7sxx9W8ysdJm+LO1902JD3dAsmLI02G2viZ6T+P0X/sqUL6hCEF HFnFE6+Pd4Pqeg251LazG1bJrWNbIAYRp5hRiNXg5ICwr39HwswCeCTsxxRRM1w7uHko EYkpnA1LAdiWzNcjzsqKsMLsZjZzURoHAh5kWdN/UmFNzLMgi/DRBy2ixgwW8lwD6tKC ja4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SkCH5QxjXQtZQB41DaD4HfMRqiabN4bNawzDGemUFIM=; b=b40kpuuo5GcrwNyC6XqXZI/AjFb/Ob7yhsi8f5mR4Mr09yZhKRBNdwmd0i2YNzAoxK HBhtuwDDD0BFcXgXFCAwAXFn852/afcij6xEff17ZazMxngdep/JhKVv0k+CdpMBorVY Fa/adOPmLPCCHe5bjNU/NApFOOMKWog112uqLNajk2jYW6TgEUOEcKHwcpL/ywHL/Dcr x5y7DLhzb7bT/YHlyazTUwiD0DqXlh3g7piw6ojqyVdpCzqx3onRYN4Irik5A3r+CfH3 nwDxPfO9XyfaXJjraBDhPlrZsjUIDSX+/VMbpJcmmXimF50X1TRqH1GHjVQDLLTmr3xx JdCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c14-20020a50d64e000000b0041d72e519e6si3850424edj.629.2022.04.17.00.52.08; Sun, 17 Apr 2022 00:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231181AbiDPJWi (ORCPT + 99 others); Sat, 16 Apr 2022 05:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbiDPJWA (ORCPT ); Sat, 16 Apr 2022 05:22:00 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E760B49CA5; Sat, 16 Apr 2022 02:19:27 -0700 (PDT) Received: from kwepemi500022.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KgSM01KVkzQwRN; Sat, 16 Apr 2022 17:19:24 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by kwepemi500022.china.huawei.com (7.221.188.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 16 Apr 2022 17:19:26 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 16 Apr 2022 17:19:25 +0800 From: Guangbin Huang To: , CC: , , , , Subject: [PATCH net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg Date: Sat, 16 Apr 2022 17:13:37 +0800 Message-ID: <20220416091343.35817-4-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220416091343.35817-1-huangguangbin2@huawei.com> References: <20220416091343.35817-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen The struct hclge_pf_to_vf_msg is used for mailbox message from PF to VF, including both response and request. But its definition can only indicate respone, which makes the message data copy in function hclge_send_mbx_msg() unreadable. So refine it by edding a general message definition into it. Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 17 +++++++++++++---- .../ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h index b668df6193be..8c7fadf2b734 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h @@ -135,10 +135,19 @@ struct hclge_vf_to_pf_msg { struct hclge_pf_to_vf_msg { u16 code; - u16 vf_mbx_msg_code; - u16 vf_mbx_msg_subcode; - u16 resp_status; - u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE]; + union { + /* used for mbx response */ + struct { + u16 vf_mbx_msg_code; + u16 vf_mbx_msg_subcode; + u16 resp_status; + u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE]; + }; + /* used for general mbx */ + struct { + u8 msg_data[HCLGE_MBX_MAX_MSG_SIZE]; + }; + }; }; struct hclge_mbx_vf_to_pf_cmd { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index 6799d16de34b..76d0f17d6be3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -102,7 +102,7 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len, resp_pf_to_vf->msg_len = msg_len; resp_pf_to_vf->msg.code = mbx_opcode; - memcpy(&resp_pf_to_vf->msg.vf_mbx_msg_code, msg, msg_len); + memcpy(resp_pf_to_vf->msg.msg_data, msg, msg_len); trace_hclge_pf_mbx_send(hdev, resp_pf_to_vf); -- 2.33.0