Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755352AbbG3KUZ (ORCPT ); Thu, 30 Jul 2015 06:20:25 -0400 Received: from mail-bl2on0115.outbound.protection.outlook.com ([65.55.169.115]:61728 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754659AbbG3KUX convert rfc822-to-8bit (ORCPT ); Thu, 30 Jul 2015 06:20:23 -0400 Authentication-Results: spf=pass (sender IP is 206.191.229.116) smtp.mailfrom=microsoft.com; davemloft.net; dkim=none (message not signed) header.d=none; From: Dexuan Cui To: David Miller , KY Srinivasan CC: "gregkh@linuxfoundation.org" , "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" , "pebolle@tiscali.nl" , "stefanha@redhat.com" , "vkuznets@redhat.com" , "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: AQHQyk2vp4eFpUHUkUGmpaGSjS0WOJ3zwGiQ Date: Thu, 30 Jul 2015 10:20:14 +0000 Message-ID: References: <1438086911-19384-1-git-send-email-decui@microsoft.com> <20150729.152651.331017965932467028.davem@davemloft.net> In-Reply-To: <20150729.152651.331017965932467028.davem@davemloft.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.58.4] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD035;1:Je/nha42xW0JKdXz5DTgB6fWsqjoQfCDhdD/fuqGKTx4rv4cssdAp+tYbbb6+OghJNZS/gaxmoOMNe0tPAdBT6mGdPp9KJZJz4+16ZAd5KO3Td7HfYVuw9ekSjkotaYgPC2Htd6PNgBnI+VB4/z8vTLE7LpwYA0Js13t9pt2gq9RZp7+TedB7Tl5GN4MjKiMCXQLedn6+HiGnKuyFNNRwJif7wxEHid70UzF/oBG4Phi5Y08SfNYdGZIKm89QOz1UGY0CWAWHYI54eQfUtYR0w== X-Forefront-Antispam-Report: CIP:206.191.229.116;CTRY:US;IPV:CAL;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(438002)(164054003)(189002)(199003)(4001450100002)(66066001)(6806004)(46102003)(50466002)(92566002)(47776003)(5003600100002)(108616004)(2561002)(62966003)(46406003)(77156002)(33646002)(106116001)(189998001)(106466001)(2900100001)(2950100001)(86146001)(2656002)(10090500001)(86362001)(24736003)(16796002)(50986999)(5001960100002)(97756001)(5001770100001)(23726002)(102836002)(76176999)(87936001)(54356999);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0301MB1251;H:064-smtp-out.microsoft.com;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1251;2:/iX+kDTv6wVf+rH6LIJWhUIo1AXEDaBMc3o4+vekP4Le1MlNTowaEpLHa8ZkedO7;3:jmtEchjNUhHyz1MWw3p2Ifo8bCFhGzbymIauyCPIrzlDmw2tqFitQBemtNvF6F0YDwAAEC4WKfzjwxPBLK2tovhCpMpugMn7VJakpJtMX7/4O1kOHQkxDK3vIOVVRyu93vztPFuuW/iOitCpZW1cxPX7X9ux8KfDS+8WgTu4UrRImFefrUUdQPNHvrnZz0M5WRza7d20BAMamEuh8VT7GemgQ8LNqWQQ1quhAizR3ShOa2LMsloJgWycTYqONpN/;25:Lc/4FcrnmuShmYXzTl88fPrW3pJac64HSVoj6cR1YYfUIYAr7AgWGbxf8aYaMudB+VaeQRFDEKjVE2Orj2RJQAUhIi2vfsJUP1X624Mw6kymHJgMKc4/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BBs9TasIGQLuclFx X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401001)(5005006)(3002001);SRVR:BN3PR0301MB1251;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB1251; X-Forefront-PRVS: 06530126A4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR0301MB1251;23:iQWN7NWQ1ew4g9/w10LdelWoiRFzuT+a91fJ9Vg?= =?us-ascii?Q?bFp/7EOIT0fQd9rzGushTt2ykunqQyXCcnPklJEmkoXRfRqhTV24Mu9VSakI?= =?us-ascii?Q?mpC49fChaaALwoQGJW/tFL/gBs3V/P8+c1JvoytDrSPkoW9limQEtpO290R6?= =?us-ascii?Q?Jx+voiSD1s6M5aj4uIc9h8DqRYIXoSjFQZC2ibEtM28k0QSa8Yb4bzJJerDX?= =?us-ascii?Q?LioHm3pMgfq+E7vcV8rcXr9SDmMA4Ak37YhgMlp7cag8O7ZVDrebKr9OHU7/?= =?us-ascii?Q?za0GTlbUomIXJxLe7mjkiublqFj649ttjhumbe2XyLGw3y6H3D42hapbSKkL?= =?us-ascii?Q?bFMdEhc9BzbCI5dIjNDYyQ+QSJPIo6SUoOg9ydyr5ULpOxM1oUM+bK9IdjJ1?= =?us-ascii?Q?dhMc0F9r41QJBXXtxygPDFuMFJkGY8ErcgKEJ5+rptBlrIrFLcZiJAQPySAV?= =?us-ascii?Q?KRBgsO0ttf2u5r0dzNOZ3AQJtujXd1Oo21Ygpf4J1vXHxzw7GcnZ8WuIM4n5?= =?us-ascii?Q?NqPjAT+jWpWve08qe6WDN723HCOmLdXYduW0sC4lBaa300XSfRm9V2Wm95SO?= =?us-ascii?Q?4PO3o95pDL4cSVEvOhZOeuE9K+P8Hxu1lJVtcqvRPwZ/Z6HJQJ1U5LYEMMMa?= =?us-ascii?Q?eqgBYz30lffMWtR8zJDzmww5ZMkHV9+eADe9sITZJBSugenqs0nyYknc+RsN?= =?us-ascii?Q?184m2XD/q/xGJSh+/2H1GBueMZ8/yeUzbjJaIjx6bts0RGkz02A8yWcARd7A?= =?us-ascii?Q?o3cfTwNEsqbhjiZ/l6pba/qnqK23+6hLgdTHwlkForkt5EodNCg5MjRMMhFL?= =?us-ascii?Q?zHZCiKZBdXulYlECHN4sQrHfayYw5D7x2J3YdnJZrET/3FaUzDjO9JqdiNTe?= =?us-ascii?Q?BuI1kx+v6qP4GIgm0rEWEzxzM/JzjQS1eDoi+JU1TfdbBsNSUWnC6aKL0HJ8?= =?us-ascii?Q?5sFD13tQvxzWCvkkUQ2AlsG+nAdO/hp+i1vPUT5aXzG17pbHas7Z4snGMzii?= =?us-ascii?Q?0JU+ZLLGd2scVcL7hEm1+kZtgeS48/UJQwh2/ezI7Gu88SYRqupUtAv3iOaf?= =?us-ascii?Q?GTPwacIk=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR0301MB1251;5:+YvJ23dE+ZTQlO5Pq9ILesh4XU0Ak8ASLS7o2lrBNhY7IhcZQge+5C/I56tfrppL2HWG4CnElATBJTl2dveHUSOFPFnkU98MvA+79Jr2A4ZfqbDO99ZoBAZeOEsqfzfO0kcDAMsPSdCzpvVssd4GAA==;24:Di0xx3IbUWqIurEtmBxJ5JL4TnUvi3rzr3qGtx9f1gfkWZ4ePp8Th2mvemtbXnHPdbZGwQGRnoqCyAZePc2RG9h9eBssCno/ycK8sGIB+kw=;20:IYU4sU48Uk685Tx1MRu0bvBGk5lbUMqQIhJWpI7wt63RIcsFGM6W/00PUwjM86w0SaPch/768tkAeebmKzGWFQ== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2015 10:20:19.7078 (UTC) X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;Ip=[206.191.229.116];Helo=[064-smtp-out.microsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1251 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2187 Lines: 59 > 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. 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 packets or 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. 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/