Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932194AbbHFS22 (ORCPT ); Thu, 6 Aug 2015 14:28:28 -0400 Received: from mail-by2on0144.outbound.protection.outlook.com ([207.46.100.144]:3474 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755403AbbHFS20 convert rfc822-to-8bit (ORCPT ); Thu, 6 Aug 2015 14:28:26 -0400 X-Greylist: delayed 1428 seconds by postgrey-1.27 at vger.kernel.org; Thu, 06 Aug 2015 14:28:26 EDT From: KY Srinivasan To: Dexuan Cui , David Miller CC: "olaf@aepfle.de" , "gregkh@linuxfoundation.org" , "jasowang@redhat.com" , "driverdev-devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , "stephen@networkplumber.org" , "stefanha@redhat.com" , "netdev@vger.kernel.org" , "apw@canonical.com" , "pebolle@tiscali.nl" , "dan.carpenter@oracle.com" Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection Thread-Topic: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection Thread-Index: AQHQySYA0uct0gwuXkmYXf1OOklk/J3zCQiAgADHUQCACqUcgIAA4QWw Date: Thu, 6 Aug 2015 18:28:18 +0000 Message-ID: References: <1438086911-19384-1-git-send-email-decui@microsoft.com> <20150729.152651.331017965932467028.davem@davemloft.net> <115a97288d1e4c239fcbaab28298c552@SIXPR30MB031.064d.mgd.msft.net> In-Reply-To: <115a97288d1e4c239fcbaab28298c552@SIXPR30MB031.064d.mgd.msft.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=kys@microsoft.com; x-originating-ip: [2001:4898:80e8::163] x-microsoft-exchange-diagnostics: 1;SN1PR0301MB1663;5:q+e2g5E2uQkJA7kpUQ9xCUF72Kw/RFsQkxHADwYn77BwiKflTApcwheWyYd2MvAUpqpYIG7iDxusfV2f43mUhCh1X0ybqfir1aypas0+x8kZiMdOdeX8gXTIwvgSQ3SZPY3m7AvhSVIYHDid3BOPGA==;24:dU798SxuHN7e6QV/3ABi9isuTx0nTEjL5MoyMLmwmlvf1TlG9kwzjA+MO3XOFdnKGP+GgP/kwVqprOXjaxsAY1LLcogLhy1zzibZiFZQrU0=;20:DyoWZZMIDRCKhTaBpLTezFHwjpItF4INB7riEG67yzwULCpqSsdDdg7BPMDaQtc9Z4VAaitJQs2134TjURgauA== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1663; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(108003899814671); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401001)(5005006)(3002001);SRVR:SN1PR0301MB1663;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1663; x-forefront-prvs: 06607E485E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(199003)(377454003)(13464003)(164054003)(35754003)(106116001)(5002640100001)(92566002)(2561002)(105586002)(2950100001)(86612001)(77096005)(5003600100002)(86362001)(46102003)(99286002)(2900100001)(40100003)(54356999)(5001960100002)(68736005)(106356001)(122556002)(76176999)(33656002)(1511001)(101416001)(5001830100001)(2656002)(5001860100001)(77156002)(62966003)(81156007)(189998001)(50986999)(5001770100001)(10090500001)(97736004)(5005710100001)(87936001)(19580405001)(10290500002)(10400500002)(4001540100001)(93886004)(76576001)(2421001)(102836002)(64706001)(19580395003)(74316001)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR0301MB1663;H:SN1PR0301MB1662.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2015 18:28:18.8524 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1663 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4491 Lines: 115 > -----Original Message----- > From: Dexuan Cui > Sent: Wednesday, August 5, 2015 9:54 PM > To: David Miller ; KY Srinivasan > > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > stephen@networkplumber.org; stefanha@redhat.com; > netdev@vger.kernel.org; apw@canonical.com; pebolle@tiscali.nl; > dan.carpenter@oracle.com > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks > to process hvsock connection > > > From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On > Behalf > > Of Dexuan Cui > > Sent: Thursday, July 30, 2015 18:20 > > To: David Miller ; KY Srinivasan > > > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > > stephen@networkplumber.org; stefanha@redhat.com; > netdev@vger.kernel.org; > > apw@canonical.com; pebolle@tiscali.nl; dan.carpenter@oracle.com > > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register > callbacks to > > process hvsock connection > > > > > From: David Miller > > > Sent: Thursday, July 30, 2015 6:27 > > > > > > From: Dexuan Cui > > > Date: Tue, 28 Jul 2015 05:35:11 -0700 > > > > > > > With the 2 APIs supplied by the VMBus driver, the coming net/hvsock > driver > > > > can register 2 callbacks and can know when a new hvsock connection is > > > > offered by the host, and when a hvsock connection is being closed by > the > > > > host. > > > > > > > This is an extremely terrible interface. > > > > > > It's an opaque hook that allows on registry, and it's solve purpose > > > is to allow a backdoor call into a foreign driver in another module. > > > > > > These are exactly the things we try to avoid. > > > > Hi David, > > Thanks a lot for your reviewing and the suggestion! > > > > > Why not create a real abstraction where clients register an object, > > > that can be contained as a sub-member inside of their own driver > > > private, that provides the callback registry mechanism. > > Hi David, > Can you please have a look at my below questions? > > I like your idea of a real abstraction. Your answer would definitely > help me to implement that correctly. > > > Please pardon me for my inexperience. > > Can you please be a bit more specific? > > I guess maybe you're referencing a common design pattern in the driver > > code, so an example in some existing driver would be the best. :-) > > > > "clients register an object " -- > > does the "clients" mean the hvsock driver? > > and the "object" means the 2 callbacks? > > > > IMHO, here the vmbus driver has to synchronously pass the 2 events > > to the hvsock driver, so a "backdoor call into the hvsock driver" is > > inevitable anyway? > > > > e.g., in the path vmbus_process_offer() -> hvsock_process_offer(), the > > return value of the latter is important to the former, because on error > > the former needs to clean up some internal states of the vmbus driver > (that > > is, the "goto err_deq_chan"). > > > > > > > That way you can register multiple clients, do things like allow > > > AF_PACKET capturing of vmbus traffic, etc. > > > > I thought AF_PACKET can only capture IP packetsor Ethernet frames. > > Can it be used to capture AF_UNIX packet? > > If yes, I suppose we can consider making it work for AF_HYPERV too, > > if people ask for that. > > Dexuan, The notion of a channel on Hyper-V has been mapped to a device on Linux and the mechanism we have had of notifying the driver of the creation of the channel was through registering this device with the kernel (vmbus_device_create). The first exception to this was when we introduced multi-channel support that broke the assumption of this one to one mapping between the channel and Linux device. In the case of the sub-channels, we handled the driver notification issue via the sub-channel callback that the driver registers at the point of opening the channel. Perhaps we could make the sub-channel handling mechanism more generic to handle the case of VMSOCK as well? Regards, K. Y > > -- Dexuan > > Thanks, > -- Dexuan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/