From patchwork Wed Aug 2 20:10:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9877639 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C5E5D60360 for ; Wed, 2 Aug 2017 20:24:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B67FA28607 for ; Wed, 2 Aug 2017 20:24:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6D98287C2; Wed, 2 Aug 2017 20:24:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45D2528607 for ; Wed, 2 Aug 2017 20:24:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752858AbdHBUMT (ORCPT ); Wed, 2 Aug 2017 16:12:19 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:47956 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752804AbdHBUMR (ORCPT ); Wed, 2 Aug 2017 16:12:17 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id czzAd3W4E80gSczzAdCUaT; Wed, 02 Aug 2017 13:11:16 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dczzA-0005GI-MO; Wed, 02 Aug 2017 13:11:16 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [[PATCH v1] 06/37] [CIFS] SMBD: Add definition and cache for SMBD response Date: Wed, 2 Aug 2017 13:10:17 -0700 Message-Id: <1501704648-20159-7-git-send-email-longli@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfAjv+3AHuKj3otEHw8bjUsZmW7mZN2mg3JC9rX3+Fq0BciDGpYEcnnmYNvSzLqAniBaKG3OxnOVCmTZP7IBJjYbY5DiDfwq/SK69bW4d0La7bkwzMfum oX5BhZ5DREnbesdHtImNQNXhdkbk/F61J4tEO9nqgLUUQzt68cSP0xE1YsR+5H9kNmcBOeotyyHGng4hYQ5Cmq9Be7rwN6XclwS9saaX6ROiZSW0+mNCxqld pXXQT1MKxx0kIX2m5beJ5nuhoJ9gAtKIKUm+0Xer4yuEKVgXbf0SgupD3fPcjYIUlXrYTptzR6keLT9XendekBAAbfjM7ZTAF6Kv9cUuCDs= Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li Define the data structure for receiving a SMBD response. SMBD responses are allocated through a per-channel mempool. For each server initiated response message, the SMB client must post a SMBD response to the local hardware. Signed-off-by: Long Li --- fs/cifs/cifsrdma.c | 13 +++++++++++++ fs/cifs/cifsrdma.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/fs/cifs/cifsrdma.c b/fs/cifs/cifsrdma.c index b18fb79..1636304 100644 --- a/fs/cifs/cifsrdma.c +++ b/fs/cifs/cifsrdma.c @@ -287,6 +287,7 @@ struct cifs_rdma_info* cifs_create_rdma_session( struct cifs_rdma_info *info; struct rdma_conn_param conn_param; struct ib_qp_init_attr qp_attr; + char cache_name[80]; int max_pending = receive_credit_max + send_credit_target; info = kzalloc(sizeof(struct cifs_rdma_info), GFP_KERNEL); @@ -370,6 +371,18 @@ struct cifs_rdma_info* cifs_create_rdma_session( goto out2; log_rdma_event("rdma_connect connected\n"); + + sprintf(cache_name, "cifs_smbd_response_%p", info); + info->response_cache = + kmem_cache_create( + cache_name, + sizeof(struct cifs_rdma_response) + + info->max_receive_size, + 0, SLAB_HWCACHE_ALIGN, NULL); + + info->response_mempool = + mempool_create(info->receive_credit_max, mempool_alloc_slab, + mempool_free_slab, info->response_cache); out2: rdma_destroy_id(info->id); diff --git a/fs/cifs/cifsrdma.h b/fs/cifs/cifsrdma.h index 71ea380..41ae61a 100644 --- a/fs/cifs/cifsrdma.h +++ b/fs/cifs/cifsrdma.h @@ -59,6 +59,10 @@ struct cifs_rdma_info { atomic_t receive_credits; atomic_t receive_credit_target; + // response pool for RDMA receive + struct kmem_cache *response_cache; + mempool_t *response_mempool; + // for debug purposes unsigned int count_receive_buffer; unsigned int count_get_receive_buffer; @@ -66,6 +70,33 @@ struct cifs_rdma_info { unsigned int count_send_empty; }; +enum smbd_message_type { + SMBD_NEGOTIATE_RESP, + SMBD_TRANSFER_DATA, +}; + +// The context for a SMBD response +struct cifs_rdma_response { + struct cifs_rdma_info *info; + + // completion queue entry + struct ib_cqe cqe; + + // the SGE entry for the packet + struct ib_sge sge; + + enum smbd_message_type type; + + // link to receive queue or reassembly queue + struct list_head list; + + // indicate if this is the 1st packet of a payload + bool first_segment; + + // SMBD packet header and payload follows this structure + char packet[0]; +}; + // Create a SMBDirect session struct cifs_rdma_info* cifs_create_rdma_session( struct TCP_Server_Info *server, struct sockaddr *dstaddr);