Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3669323pxb; Tue, 19 Apr 2022 07:36:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu8lE9PpbDveVUDpj156BRDVrUQkZKcQkndL3xWvsZ72ujtxQDPTG3rci8pB6ty3qEgDvt X-Received: by 2002:a17:907:7f88:b0:6ef:e068:f5aa with SMTP id qk8-20020a1709077f8800b006efe068f5aamr2860156ejc.238.1650379006272; Tue, 19 Apr 2022 07:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650379006; cv=none; d=google.com; s=arc-20160816; b=A1sEC72M05Gim6xJ2BVjorB32EXs2rl3c7ZF7YtT22ERrbVyjf1syYkCpgsuAIc8pI 8ZR2Xj/QRs90KAJEchXpEVyfEXwjXqm3qJZHyF6+FmDepsajSNeOLukixd0dsCGYoKOr wlTjDo64IdnHFlrgRQ80nRSQMmqNDHsTAXKYl69L3fGMvoH0nNaB9t18fnPQVPbitvKR xD0rg2k1QCEiWAgMftOuvET/uE07aYR7xPS7gQZ8KjMXVJqUAboZdtfgv4iiMyieWLts +TYgSEipEaOAmkJTtE0PCMdzP/QjhPk8vOQI9M/un6aS4LuA1iHNN9UyOSnIsWKibJxs hppw== 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=Kc5dg4worlDrZrF270bbMkPadocYhbpnO+0uWh3wcm7I9t+nLCbGZIXpqV0S4+fb4f Nqol9pQN+4KznC0vvEk3MLAyrU2B7iHwbo18cyWrVd9XWIQoevjzT/0MoiOEj1FH+0P+ ZMUKL8tRwMcwIjFCIn0qy6o7t/956AeQktB1iebwi5xpn6l0A9aXFsM/jWMS7iQq/+a4 Uo3kdYa6v9+r6Jvq31ZLia5yCTwe8rD+5EzD4b7ZmTxbfXtM+b8az7tR58pqbJV5VVdJ 7wAgwam0ouwEf4XxgSbzlDinG0J5BIi6Yj5F4IF6r0faylDbFftd8BaEy0h/B3rnVLyb YGKA== 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 dt3-20020a170907728300b006e8701e7d69si9609360ejc.85.2022.04.19.07.36.22; Tue, 19 Apr 2022 07:36:46 -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 S1348067AbiDSDf5 (ORCPT + 99 others); Mon, 18 Apr 2022 23:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347615AbiDSDfl (ORCPT ); Mon, 18 Apr 2022 23:35:41 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF9C2BB0D; Mon, 18 Apr 2022 20:32:55 -0700 (PDT) Received: from kwepemi500009.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kj8Sw0XnCzFqNk; Tue, 19 Apr 2022 11:30:24 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by kwepemi500009.china.huawei.com (7.221.188.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 19 Apr 2022 11:32:53 +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; Tue, 19 Apr 2022 11:32:53 +0800 From: Guangbin Huang To: , CC: , , , , Subject: [PATCH V2 net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg Date: Tue, 19 Apr 2022 11:27:03 +0800 Message-ID: <20220419032709.15408-4-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220419032709.15408-1-huangguangbin2@huawei.com> References: <20220419032709.15408-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: dggems703-chm.china.huawei.com (10.3.19.180) 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