From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933874AbcAZIIq (ORCPT ); Tue, 26 Jan 2016 03:08:46 -0500 Received: from p3plsmtps2ded04.prod.phx3.secureserver.net ([208.109.80.198]:36292 "EHLO p3plsmtps2ded04.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932734AbcAZIIm (ORCPT ); Tue, 26 Jan 2016 03:08:42 -0500 x-originating-ip: 72.167.245.219 From: Dexuan Cui To: gregkh@linuxfoundation.org, davem@davemloft.net, stephen@networkplumber.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, driverdev-devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, kys@microsoft.com, vkuznets@redhat.com Cc: pebolle@tiscali.nl, stefanha@redhat.com, dan.carpenter@oracle.com Subject: [PATCH V6 6/8] Drivers: hv: vmbus: add a per-channel rescind callback Date: Tue, 26 Jan 2016 01:45:01 -0800 Message-Id: <1453801501-3431-1-git-send-email-decui@microsoft.com> X-Mailer: git-send-email 1.7.4.1 X-CMAE-Envelope: MS4wfOqxaztOMFcHZZKWSO0l/5Nb3jjYCsGSrVW8NDKcPsbxMSK+/S1Xa81zMSQUJWHpnS3rQx3YjKjiyDXnPjTyICzzfm4xblH51qFuvHjNSNSzegWlp/Tb 3YiCxzTyDbI2AcGEUOcumt5rlvHZ2anQcN2VZ9apF/jR6yfinNqVLSPGEZOWEtINGR9+Zui7k37uuLQgbGkwnYCYfEk9LvaU8Cb20qjX+PM0Oq5ZgUF1b5sy 4N61EPSTYxudZHlcLR3zI6GCK5SYUhtd2Me5jbr9oQ0ArpqrUIpALnLstU8udxW0dhZBXcJklXcx7i23UOWGXHGv+P0XLVynBAdNsvTuiEBp3Neu7t0HypJt bvCXo3naFVthD7/N+Sm6L2BLnOoDDX7nm2nubxxtgrdo02VpCdrEIkNl1YQnf21IgIC+jWqBmOgUPj12VnXMRDGsdeBteJ7EXrw+tRqwQWIWErzZp9GN2E5F kWtkE1NQn2hcuvyAYE4fQDwemFcygOMcYVbK97nom2vkayjhYx4tYjPxdClk4LXIm2mE5m1rPKMtJaD8Hv7l9Uf7rCdCh6zohy9yG6lNfXM38WziKqOTnZUY 1lPetRXr0uf3IS6tYCFj+UIqjW1WnFbjh/HVAwoP1qdkBA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will be used by the coming hv_sock driver. Signed-off-by: Dexuan Cui --- drivers/hv/channel_mgmt.c | 11 +++++++++++ include/linux/hyperv.h | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 4611b50..b782944 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -608,6 +608,10 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) spin_unlock_irqrestore(&channel->lock, flags); if (channel->device_obj) { + if (channel->chn_rescind_callback) { + channel->chn_rescind_callback(channel); + return; + } /* * We will have to unregister this device from the * driver core. @@ -977,3 +981,10 @@ bool vmbus_are_subchannels_present(struct vmbus_channel *primary) return ret; } EXPORT_SYMBOL_GPL(vmbus_are_subchannels_present); + +void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel, + void (*chn_rescind_cb)(struct vmbus_channel *)) +{ + channel->chn_rescind_callback = chn_rescind_cb; +} +EXPORT_SYMBOL_GPL(vmbus_set_chn_rescind_callback); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 5587711..ff89d4c 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -740,6 +740,12 @@ struct vmbus_channel { void (*sc_creation_callback)(struct vmbus_channel *new_sc); /* + * Channel rescind callback. Some channels (the hvsock ones), need to + * register a callback which is invoked in vmbus_onoffer_rescind(). + */ + void (*chn_rescind_callback)(struct vmbus_channel *channel); + + /* * The spinlock to protect the structure. It is being used to protect * test-and-set access to various attributes of the structure as well * as all sc_list operations. @@ -825,6 +831,9 @@ int vmbus_request_offers(void); void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel, void (*sc_cr_cb)(struct vmbus_channel *new_sc)); +void vmbus_set_chn_rescind_callback(struct vmbus_channel *channel, + void (*chn_rescind_cb)(struct vmbus_channel *)); + /* * Retrieve the (sub) channel on which to send an outgoing request. * When a primary channel has multiple sub-channels, we choose a -- 2.1.0