From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752343AbcLCSk1 (ORCPT ); Sat, 3 Dec 2016 13:40:27 -0500 Received: from p3plsmtps2ded03.prod.phx3.secureserver.net ([208.109.80.60]:34872 "EHLO p3plsmtps2ded03.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbcLCSjq (ORCPT ); Sat, 3 Dec 2016 13:39:46 -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 Cc: Haiyang Zhang , "K. Y. Srinivasan" Subject: [PATCH V2 15/15] hyperv: Add a function to detect if the device is a vmbus dev Date: Sat, 3 Dec 2016 12:34:42 -0800 Message-Id: <1480797282-10126-15-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1480797282-10126-1-git-send-email-kys@exchange.microsoft.com> References: <1480797239-10085-1-git-send-email-kys@exchange.microsoft.com> <1480797282-10126-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfFjUKTXKFyszlb4JSGAg3PcKN1RhRvbUQGSUwp9lKiu1dYC0XJS1mUTD3q2Y+3/yBddrn1JLlw2eh8yhfXGTRGfjXSDd0nQJW0xi6UY1Ev1wKG8bPdcY G7ahRjaMJmsfURmBe/AbYirFpdZIgcwUWEUssf0SqFl11ocdxqkm/sp0TPwhQLYqOARrj08agsonYbFNKdWA5sCDBnBWGbGz27Zbsm7pU+QRmlwkgcRwPVXa hM11F7N/3N6IkjuTflPRTpR2Zz/QV76GWSReuZgjQKlAdystY7HqwyovuF5fwpOcihosrtGrtJlw23y89Sybi4XpfVbWgIRsAaXul7JmmDttY9v7lr6yB0Zn D6N93lARkPFNBo9gMYU7R6cTb3UcPTSf87jwbk0krOo3bB1m9t8eE4A+5zkCwJ/lwnoCYv29dIuRvcx/lVhA3+w/OeXx/NqZM45V/eZiRJ3YuI/1hpyGe31n WZPil2WUgOsFO+0ZPxBkztBTTJYFUzSIntbYtA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 565bdd1..fe96f1e 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -846,6 +846,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 1d0ebe9..918c15b 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