Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbdHBUSH (ORCPT ); Wed, 2 Aug 2017 16:18:07 -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 x-originating-ip: 107.180.71.197 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2069 Lines: 72 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; -- 2.7.4