From patchwork Wed Aug 2 20:10:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9877621 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 E7E1E60360 for ; Wed, 2 Aug 2017 20:21:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8F2A286BB for ; Wed, 2 Aug 2017 20:21:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBC61287C2; Wed, 2 Aug 2017 20:21:58 +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 7660E286BB for ; Wed, 2 Aug 2017 20:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753374AbdHBUSD (ORCPT ); Wed, 2 Aug 2017 16:18:03 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:50816 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752985AbdHBUMZ (ORCPT ); Wed, 2 Aug 2017 16:12:25 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id czzDdALTpP2LIczzDdEdpt; Wed, 02 Aug 2017 13:11:23 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dczzD-0005Gc-LM; Wed, 02 Aug 2017 13:11:19 -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] 09/37] [CIFS] SMBD: Add SMBD request and cache Date: Wed, 2 Aug 2017 13:10:20 -0700 Message-Id: <1501704648-20159-10-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: MS4wfGduCUkJf2BUYUUpOCHsBXfUc79VqQ9Ios+E1oIjNsgHeXnyjXVjcQsiyImEmwb55ekvE4YkwD7IhrnKkuK2k39BphzAYxx4GP0moqiQCXJ4kd6hs6EV nXdsIHZOrDu6TQXx/hnFNpQHUhrKv514ehmz4SyC1sTLjqwlW4bhGdH/HuWMeLRGw6atwhqUmdc84pmLU+SA52X9Kgvc+PKER+DoZXVAIayBoAkE/Jaakeiq t0f3JRMrXkj18EW0Ovi8OdXRL7lHYkp46l6+3QEQ+SQOh/z6AK+Q0KMKBoslvXi4jytmRazwBbAcFyvC0YFkkh897uRiu3H4KR2+2i6wktM= 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 SMBD request. Unlike SMBD response, SMBD request doesn't use pre-allocated buffers. Data payload is passed from upper layer provided data buffers. SMBD requests are allocated through per-channel mempool. Signed-off-by: Long Li --- fs/cifs/cifsrdma.c | 12 ++++++++++++ fs/cifs/cifsrdma.h | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/fs/cifs/cifsrdma.c b/fs/cifs/cifsrdma.c index b3e43b1..9610897 100644 --- a/fs/cifs/cifsrdma.c +++ b/fs/cifs/cifsrdma.c @@ -459,6 +459,18 @@ struct cifs_rdma_info* cifs_create_rdma_session( log_rdma_event("rdma_connect connected\n"); + sprintf(cache_name, "cifs_smbd_request_%p", info); + info->request_cache = + kmem_cache_create( + cache_name, + sizeof(struct cifs_rdma_request) + + sizeof(struct smbd_data_transfer), + 0, SLAB_HWCACHE_ALIGN, NULL); + + info->request_mempool = + mempool_create(info->send_credit_target, mempool_alloc_slab, + mempool_free_slab, info->request_cache); + sprintf(cache_name, "cifs_smbd_response_%p", info); info->response_cache = kmem_cache_create( diff --git a/fs/cifs/cifsrdma.h b/fs/cifs/cifsrdma.h index ed0ff54..e925aa4 100644 --- a/fs/cifs/cifsrdma.h +++ b/fs/cifs/cifsrdma.h @@ -62,6 +62,10 @@ struct cifs_rdma_info { struct list_head receive_queue; spinlock_t receive_queue_lock; + // request pool for RDMA send + struct kmem_cache *request_cache; + mempool_t *request_mempool; + // response pool for RDMA receive struct kmem_cache *response_cache; mempool_t *response_mempool; @@ -93,6 +97,21 @@ struct smbd_data_transfer { char buffer[0]; } __packed; +// The context for a SMBD request +struct cifs_rdma_request { + struct cifs_rdma_info *info; + + // completion queue entry + struct ib_cqe cqe; + + // the SGE entries for this packet + struct ib_sge *sge; + int num_sge; + + // SMBD packet header follows this structure + char packet[0]; +}; + // The context for a SMBD response struct cifs_rdma_response { struct cifs_rdma_info *info;