Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1617948imm; Fri, 6 Jul 2018 03:30:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd7XTOpo9jR7yqqeKdr9erCU+4pFqqfYFIrr5qc3EOu/IyejIgyZ9Zyf0YWovWNjGXadfCN X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr9746511pla.52.1530873029446; Fri, 06 Jul 2018 03:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530873029; cv=none; d=google.com; s=arc-20160816; b=n53JAK7es5pAtY84u+CbmJlAf/6y/9bbUJ37tM3DEXkepn4gjxeQqUkM97CmixBg7n baGRvrYd32MHSc94GXLSxEScCzHKeuA/rZ//YglqlncFt0dPEeKRs68m0cdmvOFKg+HP g63or8ZSJO/H359mTFCGvc4tG14smhFyAOi28lupWtSToYckIzv/T4ETxuRSvAZ7VzuD SAQcjbX635P4XIb5eI8JVZcAFNF+h6uCCkkiOKMaUDrTFNLVkNgkhEG2R8cZGe8KiPkf hY39bgOjJE4WdUGwCgSwR4LAZAhBmx7NcsUhriNfmVYBRHbJTZpUf/NRzDVhQPBGoIhI zUhA== 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=kYOWaJ7ruQIUBIDNNhMhnAZOFopMK8CEOt8DvfMjKLA=; b=SSjP9ZCAzT0o9MF54xoTDxr1tzwUc1s7m7VCgh7g5AYMG3vDadR2XUDtwsB4T+njpg HKUwY3Guwz7RJ5qNpzLyLDzuDZcdTJ/Ub4ZssC896a8j5jt4twDMwAEEi/P83LgTGG0Z n7Qlmv5wogpXxfOiKIgkxE0zKxzlbUDgYU+ljwivSofEWrDGOwgYOd8nxpwLbT6Alko0 hthfeVMs2E62hdIjbdvzFDMM8IaXEzkcV7MdGF6gDhLZb4lWdjx+rhNbN1RuAA6vFS4D 4UHgYSWkTX05kUfaB4hk9SVXRmAJZrf52zD6w0I0vL/dkqvP0TGWYKeq8W5Xdy8ree7a oarQ== 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 q28-v6si890653pgm.362.2018.07.06.03.30.14; Fri, 06 Jul 2018 03:30:29 -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 S932584AbeGFK3W (ORCPT + 99 others); Fri, 6 Jul 2018 06:29:22 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9160 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932310AbeGFK3T (ORCPT ); Fri, 6 Jul 2018 06:29:19 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 855D3DEFA62C6; Fri, 6 Jul 2018 18:29:05 +0800 (CST) Received: from S00293818-DELL1.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Fri, 6 Jul 2018 18:29:01 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 05/10] net: hns3: Fix for mailbox message truncated problem Date: Fri, 6 Jul 2018 11:27:59 +0100 Message-ID: <20180706102804.196-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180706102804.196-1-salil.mehta@huawei.com> References: <20180706102804.196-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fuyun Liang The payload of mailbox message is 16 byte and the value of HCLGE_MBX_MAX_ARQ_MSG_SIZE is 8. A message truncated problem will happen when mailbox message is converted to ARQ message. This patch replaces HCLGE_MBX_MAX_ARQ_MSG_SIZE with the size of ARQ message in hclgevf_mbx_handler to fix this problem. Fixes: b11a0bb231f3 ("net: hns3: Add mailbox support to VF driver") Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index 173ca27..e9d5a4f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -208,7 +208,8 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev) /* tail the async message in arq */ msg_q = hdev->arq.msg_q[hdev->arq.tail]; - memcpy(&msg_q[0], req->msg, HCLGE_MBX_MAX_ARQ_MSG_SIZE); + memcpy(&msg_q[0], req->msg, + HCLGE_MBX_MAX_ARQ_MSG_SIZE * sizeof(u16)); hclge_mbx_tail_ptr_move_arq(hdev->arq); hdev->arq.count++; -- 2.7.4