Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199AbdHNTyo (ORCPT ); Mon, 14 Aug 2017 15:54:44 -0400 Received: from mail-cys01nam02on0113.outbound.protection.outlook.com ([104.47.37.113]:59904 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751575AbdHNTym (ORCPT ); Mon, 14 Aug 2017 15:54:42 -0400 From: Tom Talpey To: Long Li , Steve French , "linux-cifs@vger.kernel.org" , "samba-technical@lists.samba.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" Subject: RE: [[PATCH v1] 05/37] [CIFS] SMBD: Implement API for upper layer to create SMBD transport and establish RDMA connection Thread-Topic: [[PATCH v1] 05/37] [CIFS] SMBD: Implement API for upper layer to create SMBD transport and establish RDMA connection Thread-Index: AQHTC80pk7POpLIvaEGJXMsYMQZKdqKET+mw Date: Mon, 14 Aug 2017 19:54:38 +0000 Message-ID: References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> <1501704648-20159-6-git-send-email-longli@exchange.microsoft.com> In-Reply-To: <1501704648-20159-6-git-send-email-longli@exchange.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [24.218.182.144] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR21MB0696;6:rD8AHsq9aD2WexceYVLKvif6iZw99Ji54MYCmhgb/vN3yFYQwldPLJfO/WA/sfTOrPNEIeBJL858IMf+WrOr9OY1Xhi9tyvcYmjtnPKPXpeVeCHEVYZqd1BGBrIVWg2MBno79dtqupDOsyT9s2TnQG2lPbhWLF6Y+Jpr9NkpnaU1p59Jc2e82mCzvsUKQMvNgmBDcfN6DLjGWL7go68W8nLKqg52CwX+bYYrf8sITP56/baPXqu5nsroXL13aYc15z6awL71gj+wjHhI61v9AzNtkgcsgErKZm4BzfWygqcC0LFdzGepJeD2YyB69vvH4hKN/OYCGwkQqFMwQE/WWw==;5:SNchMV5hcUDDBJ9FzJO/1D2zm03F4FFGeW5HObQXDU5TUeyqX9j1hQDfOWmvsoaElmIxbG80mpK3ZpuJIm4kHDRzSmUUeT3zmpJO8bdawJDGrGEsof7qsy1WyQ+Ee1EtKqPp9nEMxQBfxrHvVbY/Sg==;24:3Q9cgZGmPUYCZHXMKUO6diDt9efl9nce7f2t1nIkkV8jzVzeUC+gPf6G0pqBCVREoFYNTGmTHRMItqHpj5p8AK5S9enc0ZkwFL/RqVCBMyo=;7:cf0yagcpH9zQFH/GwLBIMvCBSq+ljAnjP0iG40G8xD3O1sszfVUavqwPTYUdEeoU+Dwo84o9imYf9eFHb9K7wxBivx1/dPASvJ/Il3tuV3M4W5g+QX7kB7BDYqKmEmlcEwQI5DGKXej0iFPbuCYL4m0vqvJJYAax9F8n/5n/2k7YoS5JQr+AsFAKHhVU2ntd4XPIz43T3xxrKJPsOjixNdEGDEexeTuTLbPmF6cET98= x-ms-office365-filtering-correlation-id: 39c136ae-18ee-4456-9159-08d4e34e4c54 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603142)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR21MB0696; x-ms-traffictypediagnostic: CY4PR21MB0696: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ttalpey@microsoft.com; x-exchange-antispam-report-test: UriScan:(158342451672863)(89211679590171)(9452136761055)(21532816269658)(211171220733660); 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)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR21MB0696;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR21MB0696; x-forefront-prvs: 039975700A x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(47760400005)(377454003)(13464003)(51344004)(189002)(199003)(77096006)(53546010)(10090500001)(189998001)(6116002)(102836003)(81156014)(81166006)(3846002)(55016002)(8936002)(99286003)(66066001)(76176999)(54356999)(50986999)(2906002)(6506006)(2201001)(25786009)(5660300001)(7696004)(2501003)(74316002)(97736004)(478600001)(14454004)(10290500003)(5005710100001)(8990500004)(33656002)(86612001)(229853002)(7736002)(2950100002)(305945005)(2900100001)(53936002)(86362001)(3660700001)(8676002)(3280700002)(6436002)(6246003)(106356001)(9686003)(105586002)(101416001)(68736007)(1511001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0696;H:CY4PR21MB0182.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Aug 2017 19:54:39.0053 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0696 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 quoted-printable to 8bit by nfs id v7EJspwL031565 Content-Length: 5420 Lines: 148 > -----Original Message----- > From: linux-cifs-owner@vger.kernel.org [mailto:linux-cifs- > owner@vger.kernel.org] On Behalf Of Long Li > Sent: Wednesday, August 2, 2017 4:10 PM > To: Steve French ; linux-cifs@vger.kernel.org; samba- > technical@lists.samba.org; linux-kernel@vger.kernel.org > Cc: Long Li > Subject: [[PATCH v1] 05/37] [CIFS] SMBD: Implement API for upper layer to > create SMBD transport and establish RDMA connection > > From: Long Li > > Implement the code for connecting to SMBD server. The client and server are > connected using RC Queue Pair over RDMA API, which suppports Infiniband, > RoCE and iWARP. Upper layer code can call cifs_create_rdma_session to > establish a SMBD RDMA connection. > > +/* Upcall from RDMA CM */ > +static int cifs_rdma_conn_upcall( > + struct rdma_cm_id *id, struct rdma_cm_event *event) > +{ > + struct cifs_rdma_info *info = id->context; > + > + log_rdma_event("event=%d status=%d\n", event->event, event->status); > + > + switch (event->event) { > + case RDMA_CM_EVENT_ADDR_RESOLVED: > + case RDMA_CM_EVENT_ROUTE_RESOLVED: > + info->ri_rc = 0; > + complete(&info->ri_done); > + break; > + > + case RDMA_CM_EVENT_ADDR_ERROR: > + info->ri_rc = -EHOSTUNREACH; > + complete(&info->ri_done); > + break; > + > + case RDMA_CM_EVENT_ROUTE_ERROR: > + info->ri_rc = -ENETUNREACH; > + complete(&info->ri_done); > + break; > + > + case RDMA_CM_EVENT_ESTABLISHED: > + case RDMA_CM_EVENT_CONNECT_ERROR: > + case RDMA_CM_EVENT_UNREACHABLE: > + case RDMA_CM_EVENT_REJECTED: > + case RDMA_CM_EVENT_DEVICE_REMOVAL: > + log_rdma_event("connected event=%d\n", event->event); > + info->connect_state = event->event; > + break; > + > + case RDMA_CM_EVENT_DISCONNECTED: > + break; > + > + default: > + break; > + } > + > + return 0; > +} This code looks a lot like the connection stuff in the NFS/RDMA RPC transport. Does your code have the same needs? If so, you might consider moving this to a common RDMA handler. > +/* Upcall from RDMA QP */ > +static void > +cifs_rdma_qp_async_error_upcall(struct ib_event *event, void *context) > +{ > + struct cifs_rdma_info *info = context; > + log_rdma_event("%s on device %s info %p\n", > + ib_event_msg(event->event), event->device->name, info); > + > + switch (event->event) > + { > + case IB_EVENT_CQ_ERR: > + case IB_EVENT_QP_FATAL: > + case IB_EVENT_QP_REQ_ERR: > + case IB_EVENT_QP_ACCESS_ERR: > + > + default: > + break; > + } > +} Ditto. But, what's up with the empty switch(event->event) processing? > +static struct rdma_cm_id* cifs_rdma_create_id( > + struct cifs_rdma_info *info, struct sockaddr *dstaddr) > +{ ... > + log_rdma_event("connecting to IP %pI4 port %d\n", > + &addr_in->sin_addr, ntohs(addr_in->sin_port)); >... and then... > + if (dstaddr->sa_family == AF_INET6) > + sport = &((struct sockaddr_in6 *)dstaddr)->sin6_port; > + else > + sport = &((struct sockaddr_in *)dstaddr)->sin_port; > + > + *sport = htons(445); ...and > +out: > + // try port number 5445 if port 445 doesn't work > + if (*sport == htons(445)) { > + *sport = htons(5445); > + goto try_again; > + } Suggest rearranging the log_rdma_event() call to reflect reality. The IANA-assigned port for SMB Direct is 5445, and port 445 will be listening on TCP. Should you really be probing that port before 5445? I suggest not doing so unconditionally. > +struct cifs_rdma_info* cifs_create_rdma_session( > + struct TCP_Server_Info *server, struct sockaddr *dstaddr) > +{ > ... > + int max_pending = receive_credit_max + send_credit_target; >... > + if (max_pending > info->id->device->attrs.max_cqe || > + max_pending > info->id->device->attrs.max_qp_wr) { > + log_rdma_event("consider lowering receive_credit_max and " > + "send_credit_target. Possible CQE overrun, device " > + "reporting max_cpe %d max_qp_wr %d\n", > + info->id->device->attrs.max_cqe, > + info->id->device->attrs.max_qp_wr); > + goto out2; > + } I don't understand this. Why are you directing both Receive and Send completions to the same CQ, won't that make it very hard to manage completions and their interrupts? Also, what device(s) have you seen trigger this log? CQ's are generally allowed to be quite large. > + conn_param.responder_resources = 32; > + if (info->id->device->attrs.max_qp_rd_atom < 32) > + conn_param.responder_resources = > + info->id->device->attrs.max_qp_rd_atom; > + conn_param.retry_count = 6; > + conn_param.rnr_retry_count = 6; > + conn_param.flow_control = 0; These choices warrant explanation. 32 responder resources is on the large side for most datacenter networks. And because of SMB Direct's credits, why is RNR_retry not simply zero?