Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751033AbdHLIcx (ORCPT ); Sat, 12 Aug 2017 04:32:53 -0400 Received: from mail-bl2nam02on0115.outbound.protection.outlook.com ([104.47.38.115]:27008 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750778AbdHLIcv (ORCPT ); Sat, 12 Aug 2017 04:32:51 -0400 From: Long Li To: Stefan Metzmacher , Steve French , "linux-cifs@vger.kernel.org" , "samba-technical@lists.samba.org" , "linux-kernel@vger.kernel.org" Subject: RE: [[PATCH v1] 02/37] [CIFS] SMBD: Add structure for SMBD transport Thread-Topic: [[PATCH v1] 02/37] [CIFS] SMBD: Add structure for SMBD transport Thread-Index: AQHTC8ujB24zac3NZEiE9YSsVOxDeKJ6D8MAgAZYRbA= Date: Sat, 12 Aug 2017 08:32:48 +0000 Message-ID: References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> <1501704648-20159-3-git-send-email-longli@exchange.microsoft.com> <9632c208-d6a5-2c47-b583-274d046d97bd@samba.org> In-Reply-To: <9632c208-d6a5-2c47-b583-274d046d97bd@samba.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=longli@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-08-12T01:32:47.3134887-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [2001:4898:80e8:5::735] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR21MB0512;6:TakBBAwgdeVFdCmTj3zzqjPha0rZyqTVJyZyrTjm6Zvy2JQLxqvMtSWsQKlmyM/NAiTOSsamoYPVt0u7FtSXWeFFNyRTF7o9L2ud8dC5rol/O8HOCD3h1i6duxYT/svBHKlKj3pX1ZzfGnW0wLmB8Qf9YWxw5kZLykFXkgwWGgK9p+n06/zN9mCIIVqYQCTo9ajTZkvWzeJyYdXCQl4RM2wUPHzBpa45w8N/NUZbIIx4J0lSnk1wlM44whHr5utXIi+YS2s0mFBXNct4dlR6Xt/T3R6R1Wl0RpRT1V6NVnK1Pc/cajBXukaiPS0POT5P0AhDIyin1SVXSYNPaNe+hw==;5:kCTm7NtqwJ1m4GV5bWSdecToNUG8TBhk9Cofmg1ZoaXQIRzosqqmtvpZGTBDOyb1nVWmwZD5vPa24Cfv4FepB8wJ7hk9TklQ6xXTK0I1Z86orlZncJtVdKxvy/ReJRY2YAeFYtWpzOTFybMohypXyw==;24:iroT2pBkvrkO3svtfkXMq061NcDOXwW1OwcjrPCht0TgSumqfF1zmCCjjOg5NFAIK8FmjrqrFO94bTR8kUQjmRipJbhrivWNtdwi+VbBhMg=;7:5sMBhi2W/0nkP1F65U2SooiHOmCUM/MrwwMw7q01cKwE7CBELvCdgvAag6DjBQwOS5n57raj0g3KUNWQVnwS9ZZo2bgs+ZQ+2uH4+4vGA5/EcpzNVSKCKA30GWwwHgRu3y/dxX0kpLfyTPk4DVmeTgjGeS2Ehao3FtCN8BcPfL9HAhBuPlVBex2uLvhssluo4wYDyR3idjOUq4u4G8fLjOMM1NJnvB5vJbDp5GroNxM= x-ms-office365-filtering-correlation-id: 3dd0a4aa-234b-40b4-6095-08d4e15cb6d9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603140)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:MWHPR21MB0512; x-ms-traffictypediagnostic: MWHPR21MB0512: x-exchange-antispam-report-test: UriScan:(158342451672863)(89211679590171)(9452136761055); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR21MB0512;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR21MB0512; x-forefront-prvs: 039735BC4E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(47760400005)(51884002)(199003)(189002)(377454003)(13464003)(25786009)(229853002)(7736002)(3280700002)(8990500004)(6506006)(478600001)(10290500003)(189998001)(9686003)(99286003)(6436002)(8936002)(77096006)(53936002)(33656002)(2906002)(97736004)(345774005)(14454004)(305945005)(2950100002)(10090500001)(2501003)(3660700001)(5005710100001)(7696004)(106356001)(81166006)(2201001)(68736007)(81156014)(8676002)(5660300001)(53546010)(102836003)(6116002)(74316002)(105586002)(54356999)(76176999)(50986999)(2900100001)(6246003)(86612001)(86362001)(55016002)(101416001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR21MB0512;H:MWHPR21MB0190.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; authentication-results: spf=none (sender IP is ) smtp.mailfrom=longli@microsoft.com; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2017 08:32:48.5460 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0512 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v7C8Wwqj012416 Content-Length: 3610 Lines: 88 > -----Original Message----- > From: Stefan Metzmacher [mailto:metze@samba.org] > Sent: Monday, August 7, 2017 11:58 PM > To: Steve French ; linux-cifs@vger.kernel.org; samba- > technical@lists.samba.org; linux-kernel@vger.kernel.org > Cc: Long Li > Subject: Re: [[PATCH v1] 02/37] [CIFS] SMBD: Add structure for SMBD > transport > > Hi Li, > > thanks for providing this patchset, I guess it will be a huge win to have > SMBDirect support for the kernel client! > > > Define a new structure for SMBD transport. This stucture will have all > > the information on the transport, and it will be stored in the current SMB > session. > ... > > +/* > > + * The context for the SMBDirect transport > > + * Everything related to the transport is here. It has several > logical parts > > + * 1. RDMA related structures > > + * 2. SMBDirect connection parameters > > + * 3. Reassembly queue for data receive path > > + * 4. mempools for allocating packets */ struct cifs_rdma_info { > > + struct TCP_Server_Info *server_info; > > + > > + // for debug purposes > > + unsigned int count_receive_buffer; > > + unsigned int count_get_receive_buffer; > > + unsigned int count_put_receive_buffer; > > + unsigned int count_send_empty; > > +}; > > +#endif > > > > It seems that the new transport is tied to it's caller regarding structures and > naming conventions. > > I think it would be better to strictly separate them, as I'd like to use the > SMBDirect transport also from the userspace for the client side e.g. in > Samba's '[lib]smbclient', but also in Samba's server side code 'smbd'. Thank you for reviewing the patch set. I think it is possible to separate the common code that implements the SMBDirect transport. There are some challenges to reuse the same code for both kernel and user spaces. 1. Kernel mode RDMA verbs are similar but different to user-mode ones. 2. Some RDMA features (e.g Fast Registration Work Request) are not available in user-mode. 3. Locking and synchronization mechanism is different 4. Memory management is different. 5. Process creation/scheduling and data sharing between processes are different, and there is no user-mode code running in interrupt/softirq. Those needs to be abstracted through a layer, the rest of the code can be shared. I can work on this after patch set is reviewed. > > Would it be possible to isolate this in > smb_direct.c and smb_direct.h while using > smb_direct_* prefixes for structures and functions? Also avoiding the usage > of other headers from fs/cifs/*.h, expect for something generic like nterr.h. Sure I will make naming changes and clean up the header files. > > I guess 'struct cifs_rdma_info' would then be 'struct smb_direct_connection'. > And it won't have a reference to struct TCP_Server_Info. I will look for ways to remove reference to struct TCP_Server_Info . The reason why it has a reference to TCP_Server_Info is that: TCP_Server_Info represents a transport connection, although it also has many other TCP related code. SMBD needs to get to this connection TCP_Server_Info and set the transport status on shutdown (and maybe other situations). Long > > It the strict layering is too much change, I'd at least like to have the name > changes. > > This should relatively easy to do by using somthing like > > git format-patch --stdout -37 > before > > cat before | sed \ > -e 's!struct cifs_rdma_info!struct smb_direct_connection!g' \ -e > 's!cifsrdma\.h!smb_direct.h!g' \ -e 's!cifsrdma\.c!smb_direct.c!g' \ > > after > > git reset --hard HEAD~37 > git am after > > metze