From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 795DFA0548 for ; Tue, 18 May 2021 06:14:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A1654003E; Tue, 18 May 2021 06:14:55 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2086.outbound.protection.outlook.com [40.107.93.86]) by mails.dpdk.org (Postfix) with ESMTP id F0BBE4003E for ; Tue, 18 May 2021 06:14:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BCUvRHx6SYg7RCtM7a0YOf65XNqY1U3QrHuZdnA+xlclXsy5nqHVgOTW0PtFNVCewA+5Ymwi6xXEELbJH5w88IfGfW5FhZg3EPYgvaiufc/9Wtapo7iXtA5jXeZxwFjI7dHHtN+RYzLwhZIGkpFk1kS/FJE7fUGi9/39cXjCYRwPB/OUqzj9PECrMNzg/sfATwvJKA2WzsHVlDYqJVV1nIBPyr9lalj0Ti3yw0+GLpJGD4kpKpPaHaxPgKFajoqayShhF8AOojUSynvldxM3CDXqT6mNrgUTY1Q1PebULXheeqPlxCkfM1qZG6wK2edJEvImaoschomW4VLQOs5SdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rsgD1J89GrQ2y+k98DiMJTUZSBCbnl7EVwkcBKtUvZU=; b=D3MF+nvMJ8I597bWtRnOjtlSry59/FVx/unKBrUkL81YpXvh2OnEDw4nDap4yJOqE8IHqA47zvN6chh1EdLk0/f/8YOHB2GqFtMjGtiL1veZGXr4KRRCkCh3o7v0j34d0EW5bw75GWqliZTumNbQcXJfb3fY9gFVYOQ2tjzuCJYib2rVTDFmrD762VxyZCrbL1N4gyvxaXX+Tnaz2oeSDANXohKOARUnA/bUGyEg91Qcg3iSS6oFaY/wVrl9pQsy21kfGi/73m2I+vSwPSHKCIAEGCtUm2j7v+wvX9Uq8YwZcVHp3FxWRbLBWPZqSLSfVkh5q5DJvZCS5ga9LJO7qQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rsgD1J89GrQ2y+k98DiMJTUZSBCbnl7EVwkcBKtUvZU=; b=b+3R7e6zYWXbqyqYC35LoFFStPPRCHmIyihwq0v0bqQQVmTQVGjydG7GZOZ7xeRpTWS0CHjYznj2LUd0G2f0ON4XdxrMPUPzguO9hOcjIXWBfVHik2qqNfEbZvSpex5qYfhFdNQ5yTuHQOa35EtqgdZY7p9UhTGwf0aQ70+3GRDYelE+7JtfDyjhw8K5v0HIMcFK4HnXsZpwsmKQOPP00WS7TzbBU9ZiDnV3cxfVZ6dIj7GwEVcD/wjNHwY43srQx71qbWrHoyBoiq1UTBGVp/sMn8L4wo+rT8yJvTN/tZGrjTxfVKUm5AT9u461qT+akFiHhREYVYsgEyBrfqc/7g== Received: from BY5PR12MB4324.namprd12.prod.outlook.com (2603:10b6:a03:209::10) by BY5PR12MB4904.namprd12.prod.outlook.com (2603:10b6:a03:1d3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.30; Tue, 18 May 2021 04:14:51 +0000 Received: from BY5PR12MB4324.namprd12.prod.outlook.com ([fe80::b919:53f4:6757:331c]) by BY5PR12MB4324.namprd12.prod.outlook.com ([fe80::b919:53f4:6757:331c%6]) with mapi id 15.20.4129.032; Tue, 18 May 2021 04:14:51 +0000 From: "Xueming(Steven) Li" To: "Min Hu (Connor)" , "stable@dpdk.org" CC: "ferruh.yigit@intel.com" Thread-Topic: [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of mailbox Thread-Index: AQHXSyOpoR45u+BPfE6AjiDmyFXrjarooltQ Date: Tue, 18 May 2021 04:14:51 +0000 Message-ID: References: <1621259445-5182-1-git-send-email-humin29@huawei.com> In-Reply-To: <1621259445-5182-1-git-send-email-humin29@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [180.174.128.225] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0858c534-f802-4d72-5dd3-08d919b37bc4 x-ms-traffictypediagnostic: BY5PR12MB4904: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1186; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yLHvDlsZYn6dFP+5P4OizeApEFD8t6geNKfQjwdi2rkASzy8BESfcT7fzVRvKKqei/N2VQdTAhOtGzak3X5hDobiXJ64GJXgR5Jf8GYxS1kK0FyTDw+7hgrXkUV4Vnef/4NHt+Jl2izk4W5P2Uzt0V1X+78jQnAu0ScbTFa8zdYDBcta+wPixpvONDCwYdxTk/UzuzDMeDyd7sFrNmyUtCmI/KQaKpJRbZAjLn4zlXPdOsKbxExNXP3gmrw/UNALzoMBF5K30HE6n2LoVaji9qL1rjCHWHMhIYDWmvv8YOOMqwHQn03Ks1GmjAOcof9gw9xZU2bjeSKPIrmBtseLf2z4LXE8cOl+tqU2NZupq94hlNsg4m7RPDrY0k7cu2dkelsORg3dKodKB9nRuL/sG6YgUcPkVKaUXNWpaaF8ey74+nxT1sJ798Ca0XbsQ4cisnKo4Kbsp+X7utnTy0AiPHFhr8suGKAjJIUy9YqXH9RvUn+xx83bEZM9kP/2m6ZkN0rNhsQ1L02Xclexyn8rQIVAoAY5Ci25A+SrP9rAn/WMxFX6mWsMs+rIW1mq3nlTaZQDrNwqBR6ts19/CmnTFg+DQ1VBe3jtwEdljTDQSyU= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4324.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(122000001)(38100700002)(4326008)(30864003)(7696005)(5660300002)(33656002)(186003)(52536014)(8936002)(8676002)(83380400001)(53546011)(316002)(15650500001)(71200400001)(86362001)(76116006)(66946007)(2906002)(66476007)(26005)(64756008)(55016002)(110136005)(66446008)(478600001)(9686003)(6506007)(66556008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?weDvUIPpk+L0gDNvpzWSqzaqJPiCeI7bfe+BxQFsLQhnnt18BKDiDxRVksXb?= =?us-ascii?Q?7IFJ/J0SctmiK3BGWJSfDsM2Iw1euL12tz18RjLHYFRHTooX4MGLOPGUdWO/?= =?us-ascii?Q?Lt6WU4VXJEWqENBkxT83lcPNEhFyyhM0KOcMClbs5cD7iv1e1B+iGrd0iSqm?= =?us-ascii?Q?Zv/A6gQa4UBBf3RLvHdFpX6Gwk3tDkksWqmq4ongLY+8MOUQmSjAIdj2jfFG?= =?us-ascii?Q?JTb6QIrRrAJjYAFuSIgSAoR/R5Z6qlGoPosfda80plfl9iYWxTo4itIYMHj/?= =?us-ascii?Q?IVXkeAOReJMCX2VZpNNchvi1R0tj9w6VmGDwGIOPxaYyEu/kJ1OMnw2WSxZc?= =?us-ascii?Q?VUj84MZqP4fxH9RTbwkjuZBiu2UWKVwKpk4AZVcm6InZx8Xf9MjO+FFyF4YJ?= =?us-ascii?Q?m+CJriLMpctVNr9A9wjpEGHOfXvwPoKxicDLptHnlhfwkUyYFNdSpkkuOvbI?= =?us-ascii?Q?Auk0qcVdad9s31U7AjnD1uBDwsS2WY+/ql8r94hl2k4lgW9JVEBh4c8iFYJp?= =?us-ascii?Q?OGaMoh/lvDMgG4DN6HQ6IwC0V5xK+lRYziakUrlBXVBVKDJEdLliAUEub1Uv?= =?us-ascii?Q?Sdx2/czDwQ/vXfcS+wZPdPLTdzMC9+mO4ug3p0h1ZRwx2t2VboUJCYZZq7HW?= =?us-ascii?Q?K2iA5p/lTnCnJaiTAQIqz+PzysaUkD9kDcNsOjxCfpKVQCbL2D1LeBHq9NMc?= =?us-ascii?Q?UyPdLWBvJNlOXGCJX3pE9yG+xs7jYZYV76h6naGZAQPpEh5wHqmGH5r6rcH6?= =?us-ascii?Q?qbtFvYnE1LmAcnah6rhKt2g78Nj45CuN8yBm5feKx3qdtQ+LdwgLiBEvCQUN?= =?us-ascii?Q?bAOgtvW2l31yfQIf2ROeXW+cCujdYQgUPRDAY1LBeL9JLVVlWJlb8M+qUF0W?= =?us-ascii?Q?psue+foKSMtajn+/vbpZhYdtHY2H/LUt07KQr7CP8UbUMa+ozze0VilQRUdp?= =?us-ascii?Q?X8/023Kfa+S2D4zmq86jmT8gf4jWRyDt3y1c6nxTi+gRc4hCUmPcldkXt6Zu?= =?us-ascii?Q?D6lJe4waWf/1uf06epSPbbr/9Uy8qlxwiWhbyhSnGbZ/PbzKPQ7ILw9jk1ZN?= =?us-ascii?Q?rs04KoyV7Uvj3cF5hDqnu13frf5sNHktAVbI8i8cB0n41bnY8zgziULBt5Pd?= =?us-ascii?Q?Sot/CL3MFqxDQf6EBjD7TItDWyT3cYm1SwNaCxN7PaIGM0vOM3fLyNQAqqY0?= =?us-ascii?Q?ut9r54xHbRotYQ6G+jQH2KygSg1VG6EIBqdEAF2AcOI7fIz5/gejasQnstp8?= =?us-ascii?Q?ti8BZ5Z8ujF64QpvISAya6wkOFV/r6zIu1VUvXlV3YHgvvZ3Q7E6/LJPslbA?= =?us-ascii?Q?xwHBoQjuOA/A8/PY7HDUiWgw?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4324.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0858c534-f802-4d72-5dd3-08d919b37bc4 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 May 2021 04:14:51.3344 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NlfXUVSsJEJhbgIUAvRn5A/1P3kHXrU8Pg/jynt4YUTxoREJLbtto+O/e8FHpXz3FkyWo2DsSojanK7kOZ5PcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4904 Subject: Re: [dpdk-stable] [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of mailbox X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Thanks, merged. > -----Original Message----- > From: Min Hu (Connor) > Sent: Monday, May 17, 2021 9:51 PM > To: stable@dpdk.org > Cc: ferruh.yigit@intel.com; Xueming(Steven) Li > Subject: [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of = mailbox >=20 > From: Chengwen Feng >=20 > [ upstream commit c8dec72de00039f367c1a8cd1f40378d04cf3e8f ] >=20 > Currently, the mailbox synchronous communication between VF and PF use th= e following fields to maintain communication: > 1. Req_msg_data which was combined by message code and subcode, used to > match request and response. > 2. Head which means the number of requests successfully sent by VF. > 3. Tail which means the number of responses successfully received by VF. > 4. Lost which means the number of requests which are timeout. >=20 > There may possible mismatches of the following situation: > 1. VF sends message A with code=3D1 subcode=3D1. > Then head=3D1, tail=3D0, lost=3D0. > 2. PF was blocked about 500ms when processing the message A. > 3. VF will detect message A timeout because it can't get the response wit= hin 500ms. > Then head=3D1, tail=3D0, lost=3D1. > 4. VF sends message B with code=3D1 subcode=3D1 which equal message A. > Then head=3D2, tail=3D0, lost=3D1. > 5. PF processes the first message A and send the response message to VF. > 6. VF will update tail field to 1, but the lost field will remain > unchanged because the code/subcode equal message B's, so driver will > return success because now the head(2) equals tail(1) plus lost(1). > This will lead to mismatch of request and response. >=20 > To fix the above bug, we use the following scheme: > 1. The message sent from VF was labelled with match_id which was a > unique 16-bit non-zero value. > 2. The response sent from PF will label with match_id which got from the > request. > 3. The VF uses the match_id to match request and response message. >=20 > This scheme depends on the PF driver, if the PF driver don't support then= VF will uses the original scheme. >=20 > Fixes: 463e748964f5 ("net/hns3: support mailbox") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chengwen Feng > Signed-off-by: Min Hu (Connor) > --- > drivers/net/hns3/hns3_mbx.c | 120 +++++++++++++++++++++++++++++++++++---= ------ > drivers/net/hns3/hns3_mbx.h | 20 +++++++- > 2 files changed, 114 insertions(+), 26 deletions(-) >=20 > diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c in= dex 975a60b..79ac16a 100644 > --- a/drivers/net/hns3/hns3_mbx.c > +++ b/drivers/net/hns3/hns3_mbx.c > @@ -40,14 +40,32 @@ hns3_resp_to_errno(uint16_t resp_code) > return -EIO; > } >=20 > +static void > +hns3_mbx_proc_timeout(struct hns3_hw *hw, uint16_t code, uint16_t > +subcode) { > + if (hw->mbx_resp.matching_scheme =3D=3D > + HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL) { > + hw->mbx_resp.lost++; > + hns3_err(hw, > + "VF could not get mbx(%u,%u) head(%u) tail(%u) " > + "lost(%u) from PF", > + code, subcode, hw->mbx_resp.head, hw->mbx_resp.tail, > + hw->mbx_resp.lost); > + return; > + } > + > + hns3_err(hw, "VF could not get mbx(%u,%u) from PF", code, subcode); } > + > static int > -hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, > +hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode, > uint8_t *resp_data, uint16_t resp_len) { > #define HNS3_MAX_RETRY_MS 500 > #define HNS3_WAIT_RESP_US 100 > struct hns3_adapter *hns =3D HNS3_DEV_HW_TO_ADAPTER(hw); > struct hns3_mbx_resp_status *mbx_resp; > + bool received; > uint64_t now; > uint64_t end; >=20 > @@ -59,8 +77,7 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, u= int16_t code1, >=20 > now =3D get_timeofday_ms(); > end =3D now + HNS3_MAX_RETRY_MS; > - while ((hw->mbx_resp.head !=3D hw->mbx_resp.tail + hw->mbx_resp.lost) &= & > - (now < end)) { > + while (now < end) { > if (rte_atomic16_read(&hw->reset.disable_cmd)) { > hns3_err(hw, "Don't wait for mbx respone because of " > "disable_cmd"); > @@ -77,16 +94,20 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0,= uint16_t code1, > hns3_dev_handle_mbx_msg(hw); > rte_delay_us(HNS3_WAIT_RESP_US); >=20 > + if (hw->mbx_resp.matching_scheme =3D=3D > + HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL) > + received =3D (hw->mbx_resp.head =3D=3D > + hw->mbx_resp.tail + hw->mbx_resp.lost); > + else > + received =3D hw->mbx_resp.received_match_resp; > + if (received) > + break; > + > now =3D get_timeofday_ms(); > } > hw->mbx_resp.req_msg_data =3D 0; > if (now >=3D end) { > - hw->mbx_resp.lost++; > - hns3_err(hw, > - "VF could not get mbx(%u,%u) head(%u) tail(%u) " > - "lost(%u) from PF", > - code0, code1, hw->mbx_resp.head, hw->mbx_resp.tail, > - hw->mbx_resp.lost); > + hns3_mbx_proc_timeout(hw, code, subcode); > return -ETIME; > } > rte_io_rmb(); > @@ -101,6 +122,29 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0= , uint16_t code1, > return 0; > } >=20 > +static void > +hns3_mbx_prepare_resp(struct hns3_hw *hw, uint16_t code, uint16_t > +subcode) { > + /* > + * Init both matching scheme fields because we may not know the exact > + * scheme will be used when in the initial phase. > + * > + * Also, there are OK to init both matching scheme fields even though > + * we get the exact scheme which is used. > + */ > + hw->mbx_resp.req_msg_data =3D (uint32_t)code << 16 | subcode; > + hw->mbx_resp.head++; > + > + /* Update match_id and ensure the value of match_id is not zero */ > + hw->mbx_resp.match_id++; > + if (hw->mbx_resp.match_id =3D=3D 0) > + hw->mbx_resp.match_id =3D 1; > + hw->mbx_resp.received_match_resp =3D false; > + > + hw->mbx_resp.resp_status =3D 0; > + memset(hw->mbx_resp.additional_info, 0, HNS3_MBX_MAX_RESP_DATA_SIZE); > +} > + > int > hns3_send_mbx_msg(struct hns3_hw *hw, uint16_t code, uint16_t subcode, > const uint8_t *msg_data, uint8_t msg_len, bool need_resp, @@ -138,8 = +182,8 @@ hns3_send_mbx_msg(struct > hns3_hw *hw, uint16_t code, uint16_t subcode, > if (need_resp) { > req->mbx_need_resp |=3D HNS3_MBX_NEED_RESP_BIT; > rte_spinlock_lock(&hw->mbx_resp.lock); > - hw->mbx_resp.req_msg_data =3D (uint32_t)code << 16 | subcode; > - hw->mbx_resp.head++; > + hns3_mbx_prepare_resp(hw, code, subcode); > + req->match_id =3D hw->mbx_resp.match_id; > ret =3D hns3_cmd_send(hw, &desc, 1); > if (ret) { > rte_spinlock_unlock(&hw->mbx_resp.lock); > @@ -251,6 +295,46 @@ hns3_update_resp_position(struct hns3_hw *hw, uint32= _t resp_msg) } >=20 > static void > +hns3_handle_mbx_response(struct hns3_hw *hw, struct > +hns3_mbx_pf_to_vf_cmd *req) { > + struct hns3_mbx_resp_status *resp =3D &hw->mbx_resp; > + uint32_t msg_data; > + > + if (req->match_id !=3D 0) { > + /* > + * If match_id is not zero, it means PF support copy request's > + * match_id to its response. So VF could use the match_id > + * to match the request. > + */ > + if (resp->matching_scheme !=3D > + HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID) { > + resp->matching_scheme =3D > + HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID; > + hns3_info(hw, "detect mailbox support match id!"); > + } > + if (req->match_id =3D=3D resp->match_id) { > + resp->resp_status =3D hns3_resp_to_errno(req->msg[3]); > + memcpy(resp->additional_info, &req->msg[4], > + HNS3_MBX_MAX_RESP_DATA_SIZE); > + rte_io_wmb(); > + resp->received_match_resp =3D true; > + } > + return; > + } > + > + /* > + * If the below instructions can be executed, it means PF does not > + * support copy request's match_id to its response. So VF follows the > + * original scheme to process. > + */ > + resp->resp_status =3D hns3_resp_to_errno(req->msg[3]); > + memcpy(resp->additional_info, &req->msg[4], > + HNS3_MBX_MAX_RESP_DATA_SIZE); > + msg_data =3D (uint32_t)req->msg[1] << 16 | req->msg[2]; > + hns3_update_resp_position(hw, msg_data); } > + > +static void > hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code) { > switch (link_fail_code) { > @@ -326,16 +410,12 @@ hns3_handle_promisc_info(struct hns3_hw *hw, uint16= _t promisc_en) void > hns3_dev_handle_mbx_msg(struct hns3_hw *hw) { > - struct hns3_mbx_resp_status *resp =3D &hw->mbx_resp; > struct hns3_cmq_ring *crq =3D &hw->cmq.crq; > struct hns3_mbx_pf_to_vf_cmd *req; > struct hns3_cmd_desc *desc; > - uint32_t msg_data; > uint16_t *msg_q; > uint8_t opcode; > uint16_t flag; > - uint8_t *temp; > - int i; > rte_spinlock_lock(&hw->cmq.crq.lock); >=20 > while (!hns3_cmd_crq_empty(hw)) { > @@ -361,15 +441,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) >=20 > switch (opcode) { > case HNS3_MBX_PF_VF_RESP: > - resp->resp_status =3D hns3_resp_to_errno(req->msg[3]); > - > - temp =3D (uint8_t *)&req->msg[4]; > - for (i =3D 0; i < HNS3_MBX_MAX_RESP_DATA_SIZE; i++) { > - resp->additional_info[i] =3D *temp; > - temp++; > - } > - msg_data =3D (uint32_t)req->msg[1] << 16 | req->msg[2]; > - hns3_update_resp_position(hw, msg_data); > + hns3_handle_mbx_response(hw, req); > break; > case HNS3_MBX_LINK_STAT_CHANGE: > case HNS3_MBX_ASSERTING_RESET: > diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h in= dex 7f7ade1..8a9d7ba 100644 > --- a/drivers/net/hns3/hns3_mbx.h > +++ b/drivers/net/hns3/hns3_mbx.h > @@ -83,12 +83,26 @@ enum hns3_mbx_link_fail_subcode { > #define HNS3_MBX_RING_MAP_BASIC_MSG_NUM 3 > #define HNS3_MBX_RING_NODE_VARIABLE_NUM 3 >=20 > +enum { > + HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL =3D 0, > + HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID > +}; > + > struct hns3_mbx_resp_status { > rte_spinlock_t lock; /* protects against contending sync cmd resp */ > + > + uint8_t matching_scheme; > + > + /* The following fields used in the matching scheme for original */ > uint32_t req_msg_data; > uint32_t head; > uint32_t tail; > uint32_t lost; > + > + /* The following fields used in the matching scheme for match_id */ > + uint16_t match_id; > + bool received_match_resp; > + > int resp_status; > uint8_t additional_info[HNS3_MBX_MAX_RESP_DATA_SIZE]; > }; > @@ -106,7 +120,8 @@ struct hns3_mbx_vf_to_pf_cmd { > uint8_t mbx_need_resp; > uint8_t rsv1; > uint8_t msg_len; > - uint8_t rsv2[3]; > + uint8_t rsv2; > + uint16_t match_id; > uint8_t msg[HNS3_MBX_MAX_MSG_SIZE]; > }; >=20 > @@ -114,7 +129,8 @@ struct hns3_mbx_pf_to_vf_cmd { > uint8_t dest_vfid; > uint8_t rsv[3]; > uint8_t msg_len; > - uint8_t rsv1[3]; > + uint8_t rsv1; > + uint16_t match_id; > uint16_t msg[8]; > }; >=20 > -- > 2.7.4