Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4563840pja; Thu, 21 Nov 2019 21:57:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyrfAmMpCuL3yPixsicvxVoNNkvzCqOiKFmOKoDlQSjY4NX6ppBknYsRadQApfGbrha0Aoh X-Received: by 2002:a17:906:4899:: with SMTP id v25mr19617068ejq.235.1574402236713; Thu, 21 Nov 2019 21:57:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574402236; cv=none; d=google.com; s=arc-20160816; b=05tgfUJtd5P7fwruggO4R+xvnh3JLsr5IxDBNcUhc6ZArRfaOtX6GmtTtivONC2kYp J7S1p6hzZxIOjbed9XVLou+K+5y8zjOj7qjiovLTEF2B4mvL1lRZCmfEh7ngAeVYo4/5 e3bmqcqiXFYNS/kbtvgJFOmdW6wkWUbE2wtlTb00NPo0zyX1Ohk5gFzhUNXAmSEi9me6 Lg6pC12NmBrHvriHMESqiaOavA4PV+SrmZiBDVXcS+zrKerfjq0tY5j0YdhGCzmeOTee C6I2XQKuQrtMWC6YiLqJRRniAidyETcc+Nt312FzDU/T4LXOoVIrTBiM3lwYLyr4rzfN lLMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YeQfA9CTIjYjZJtJBvx6a9ZhEAXYoJN/JfiwVHiFIz4=; b=d3NBcVSnz1h4AnEtTB+WONfdB1POZTQZLKGo3UBcF2k5CpZ1q4tGPUMaL8w/LZILwW QgfN73RlqK9h+pm/OS2QT+Ld8lZJNFvwCaOEB9HoUTvU9x0Qr+49aQGM1xg+oKc77nR1 w1vU8j0VPjHKCI3+nI3Q/ZdkIhLFvhO8QoGD3t4bKQEfOsKEHUQ+MIVNLDlCLAPSrL/c Piar/Z9wKS4G5kyZvFh0bKjwmhZaobsY294UeQ+FAVBm3gOGh/MP1/RFEGd7FjgaIBJK zqniaqR7vHaCnjU+irdlq1ZqejB2o00RvSiR1lOOffCQHu6bT18OWp/l0/ArJsCCRuZ6 H1XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BtPUkv5v; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ga20si3508857ejb.14.2019.11.21.21.56.51; Thu, 21 Nov 2019 21:57:16 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=BtPUkv5v; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728791AbfKVFym (ORCPT + 99 others); Fri, 22 Nov 2019 00:54:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:59038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728766AbfKVFxE (ORCPT ); Fri, 22 Nov 2019 00:53:04 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B390F2068F; Fri, 22 Nov 2019 05:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401983; bh=lwe9ZwYIqGLbnxUhHCr7toIMXnpr2DN+CvP5jajKOk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtPUkv5voXmVraSsbnA/0YfqHYMt+8Jj3BIF4mLy4442rJEj6CpMCkGlvgqde/vRk MtSV6R8qpOS0eRgn4OK+FogB4JgO63SgRPO0Mj+F7fN5EQViRr+lgyPn9WnwkNqeVe lcEYdyACy+K3LQMHrxxKULTy0njpt5IfUbmo+s2w= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peng Li , Huazhong Tan , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 202/219] net: hns3: fix an issue for hclgevf_ae_get_hdev Date: Fri, 22 Nov 2019 00:48:53 -0500 Message-Id: <20191122054911.1750-194-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li [ Upstream commit eed9535f9f716a532ec0c5d6cc7a48584acdf435 ] HNS3 VF driver support NIC and Roce, hdev stores NIC handle and Roce handle, should use correct parameter for container_of. Signed-off-by: Peng Li Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 5570fb5dc2eb4..f6a579220ec18 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -26,7 +26,12 @@ MODULE_DEVICE_TABLE(pci, ae_algovf_pci_tbl); static inline struct hclgevf_dev *hclgevf_ae_get_hdev( struct hnae3_handle *handle) { - return container_of(handle, struct hclgevf_dev, nic); + if (!handle->client) + return container_of(handle, struct hclgevf_dev, nic); + else if (handle->client->type == HNAE3_CLIENT_ROCE) + return container_of(handle, struct hclgevf_dev, roce); + else + return container_of(handle, struct hclgevf_dev, nic); } static int hclgevf_tqps_update_stats(struct hnae3_handle *handle) -- 2.20.1