Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752960AbdHBUMV (ORCPT ); Wed, 2 Aug 2017 16:12:21 -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 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] 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2666 Lines: 92 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); -- 2.7.4