From patchwork Fri Jul 6 10:27:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 141285 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2944997ljj; Fri, 6 Jul 2018 03:29:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeqTCJQeGkRCbD5HDLhOuyWEohadIn6cNthPy4wkv5GwK8N5h6yvYj/BV8G2oLguAX6rB1t X-Received: by 2002:a17:902:7606:: with SMTP id k6-v6mr9628525pll.56.1530872965469; Fri, 06 Jul 2018 03:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530872965; cv=none; d=google.com; s=arc-20160816; b=QYC7Prxz0OQzgMDkFJwWzM+XeiQxIS0Kd2jS2VMmCJiZmS7y07t5lugweroQbQeE0M PuUs9vAcJdwOIoNMQZgI6oFLjnNTPoH9yMeAF8pKCF0qMzXkkQ9Uhq7hrqi9BMEZu6Q/ 3tGCRIC4XfcKVZBYFX1K5ONMZAqZo8WdWWuBFER4dH23zQS3Q0W7dmwaov906eojUupv VBRcAuTO2lPbZJ+F2C3CxTmPz3yilbkw7Ti8kVIZHIH5x3kIVlqYZkQ/6YXD2wMSS/K+ jxnR5kvv6p+7YwLzliJpWKHz0UWDp1QKRSfbxU8ZI5JUCGQhF66Dzz07M628vPdrp6KT 8EfA== 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 y23-v6si7793590pgk.427.2018.07.06.03.29.25; Fri, 06 Jul 2018 03:29:25 -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 S932603AbeGFK3W (ORCPT + 30 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 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(-) -- 2.7.4 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++;