Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932747AbcLHGij (ORCPT ); Thu, 8 Dec 2016 01:38:39 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:54768 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932221AbcLHGid (ORCPT ); Thu, 8 Dec 2016 01:38:33 -0500 x-originating-ip: 72.167.245.219 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, bjorn.helgaas@gmail.com Cc: Haiyang Zhang , "K. Y. Srinivasan" Subject: [PATCH 2/3] hyperv: Add a function to detect if the device is a vmbus dev Date: Thu, 8 Dec 2016 00:33:42 -0800 Message-Id: <1481186023-30429-2-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1481186023-30429-1-git-send-email-kys@exchange.microsoft.com> References: <1481185988-30383-1-git-send-email-kys@exchange.microsoft.com> <1481186023-30429-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfH06jp0HHWNT0P+FFgwTi+ak3NK5plWt0dG1dSRsQpZEfMk3OMXnk4FhYOCdbgVG9HNf7E25/OdOXXJO+PZxP2pj2LRX8xvFamVABg/xJL5PeyrtGSVP hTplxhxXatPwpGEKfFp0jrGNhDfBaz4n8k8kKJkoaQI+8CwfQAZ5zTmSHT7+2/we5lxmnPr9rxk0hPx7lDeVxRn8/1wo+lva4QjbO9dvrJhPLNSsVgW03cwE CbPAZQZLH9sTwiW0zyEmfYEUIuGs/ZSe4Bba42zU6HrXQKZS1tgw+ShqnvqQoK7hA8ZYobvWDesen0VZySSC58VfbgEhQ1Cb31Vkak5Aud9z1zKJF+vxWsI0 CUXxvdLVNjCYT9FNVCkqSEV0ATDw0NghULuyPCRl9K9t5MkOzJmTZxGv4eJToIA5gglhM7ODU9PDfbkZT1agDdOP99DWXb2aKqcdmSj5CsE7C93zSkc9MFSR 7KJMfqxxP0ZqhLm53O4b8JjB3JsObB6JaW1vsc1F5hD5uBDyh5SQel/REVE= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1703 Lines: 53 From: Haiyang Zhang On Hyper-V, every VF interface has a corresponding synthetic interface managed by netvsc that share the same MAC address. netvsc registers for netdev events to manage this association. Currently we use the MAC address to manage this association but going forward, we want to use a serial number that the host publishes. To do this we need functionality similar to dev_is_pci() for the vmbus devices. Implement such a function. This function will be used in subsequent patches to netvsc and in the interest of eliminating cross tree dependencies, this patch is being submitted first. Signed-off-by: Haiyang Zhang Signed-off-by: K. Y. Srinivasan --- drivers/hv/vmbus_drv.c | 6 ++++++ include/linux/hyperv.h | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 230c62e..64c40f3 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -845,6 +845,12 @@ struct onmessage_work_context { struct hv_message msg; }; +bool dev_is_vmbus(struct device *dev) +{ + return dev->bus == &hv_bus; +} +EXPORT_SYMBOL_GPL(dev_is_vmbus); + static void vmbus_onmessage_work(struct work_struct *work) { struct onmessage_work_context *ctx; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index ff6cd3e..2abb1bf 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -947,6 +947,8 @@ static inline void clear_low_latency_mode(struct vmbus_channel *c) c->low_latency = false; } +bool dev_is_vmbus(struct device *dev); + void vmbus_onmessage(void *context); int vmbus_request_offers(void); -- 1.7.4.1