From patchwork Tue Oct 30 06:45:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10660501 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3EB814E2 for ; Tue, 30 Oct 2018 06:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C807A288F3 for ; Tue, 30 Oct 2018 06:45:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB2B929A29; Tue, 30 Oct 2018 06:45:59 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 3CEE7288F3 for ; Tue, 30 Oct 2018 06:45:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726154AbeJ3PiL (ORCPT ); Tue, 30 Oct 2018 11:38:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37574 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbeJ3PiL (ORCPT ); Tue, 30 Oct 2018 11:38:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 722C1307D84F; Tue, 30 Oct 2018 06:45:58 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15B061974E; Tue, 30 Oct 2018 06:45:56 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 1/2] complib/cl_dispatcher.c: fix typo and delete one incorrect comment Date: Tue, 30 Oct 2018 14:45:52 +0800 Message-Id: <20181030064553.527-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 30 Oct 2018 06:45:58 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Honggang Li Signed-off-by: Honggang Li --- complib/cl_dispatcher.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/complib/cl_dispatcher.c b/complib/cl_dispatcher.c index 1255c830..5e8c85ab 100644 --- a/complib/cl_dispatcher.c +++ b/complib/cl_dispatcher.c @@ -85,7 +85,7 @@ void __cl_disp_worker(IN void *context) p_msg = (cl_disp_msg_t *) cl_qlist_remove_head(&p_disp->msg_fifo); - /* we track the tim ethe last message spent in the queue */ + /* we track the time the last message spent in the queue */ p_disp->last_msg_queue_time_us = cl_get_time_stamp() - p_msg->in_time; @@ -279,7 +279,6 @@ void cl_disp_unregister(IN const cl_disp_reg_handle_t handle) cl_spinlock_acquire(&p_disp->lock); /* Remove the registrant from the list. */ cl_qlist_remove_item(&p_disp->reg_list, (cl_list_item_t *) p_reg); - /* Return the registration info to the pool */ free(p_reg); cl_spinlock_release(&p_disp->lock); From patchwork Tue Oct 30 06:45:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10660503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B8B814E2 for ; Tue, 30 Oct 2018 06:46:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38C1B288F3 for ; Tue, 30 Oct 2018 06:46:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CB6D29A29; Tue, 30 Oct 2018 06:46:04 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 B6A7B288F3 for ; Tue, 30 Oct 2018 06:46:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726158AbeJ3PiQ (ORCPT ); Tue, 30 Oct 2018 11:38:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43722 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbeJ3PiP (ORCPT ); Tue, 30 Oct 2018 11:38:15 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4BEDC049582; Tue, 30 Oct 2018 06:46:02 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 582003DA7; Tue, 30 Oct 2018 06:46:01 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 2/2] cl_dispatcher.h: Improve comments Date: Tue, 30 Oct 2018 14:45:53 +0800 Message-Id: <20181030064553.527-2-honli@redhat.com> In-Reply-To: <20181030064553.527-1-honli@redhat.com> References: <20181030064553.527-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 30 Oct 2018 06:46:02 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Honggang Li - Keep the order of comments in line with corresponding fields - Add comment for fields which do not have comments - Delete comments for non-existing fields - Miscellaneous fixes Signed-off-by: Honggang Li --- include/complib/cl_dispatcher.h | 53 +++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/include/complib/cl_dispatcher.h b/include/complib/cl_dispatcher.h index a5b4a289..3efe12ea 100644 --- a/include/complib/cl_dispatcher.h +++ b/include/complib/cl_dispatcher.h @@ -77,7 +77,7 @@ BEGIN_C_DECLS * cl_disp_construct, cl_disp_init, cl_disp_shutdown, cl_disp_destroy * * Manipulation: -* cl_disp_post, cl_disp_reset, cl_disp_wait_on +* cl_disp_post, cl_disp_register, cl_disp_unregister *********/ /****s* Component Library: Dispatcher/cl_disp_msgid_t * NAME @@ -220,29 +220,26 @@ typedef struct _cl_dispatcher { } cl_dispatcher_t; /* * FIELDS +* lock +* Spinlock to guard internal structures. +* * reg_vec * Vector of registration info objects. Indexed by message msg_id. * -* lock -* Spinlock to guard internal structures. +* reg_list +* List of registration info objects. +* +* worker_threads +* Thread pool of worker threads to dispose of posted messages. * * msg_fifo * FIFO of messages being processed by the Dispatcher. New * messages are posted to the tail of the FIFO. Worker threads * pull messages from the front. * -* worker_threads -* Thread pool of worker threads to dispose of posted messages. -* * msg_pool * Pool of message objects to be processed through the FIFO. * -* reg_count -* Count of the number of registrants. -* -* state -* Indicates the state of the object. -* * last_msg_queue_time_us * The time that the last message spent in the Q in usec * @@ -272,23 +269,17 @@ typedef struct _cl_disp_reg_info { } cl_disp_reg_info_t; /* * FIELDS +* list_item +* List linkage. Must be first element in the structure!! +* * pfn_rcv_callback * Client's message receive callback. * * context * Client's context for message receive callback. * -* rcv_thread_count -* Number of threads currently in the receive callback. -* -* msg_done_thread_count -* Number of threads currently in the message done callback. -* -* state -* State of this registration object. -* DISP_REGSTATE_INIT: initialized and inactive -* DISP_REGSTATE_ACTIVE: in active use -* DISP_REGSTATE_UNREGPEND: unregistration is pending +* ref_cnt +* Reference count. * * msg_id * Dispatcher message msg_id value for this registration object. @@ -325,16 +316,16 @@ typedef struct _cl_disp_msg { * item * List & Pool linkage. Must be first element in the structure!! * -* msg_id -* The message's numberic ID value. -* * p_data * Pointer to the data payload for this message. The payload * is opaque to the Dispatcher. * -* p_reg_info +* p_src_reg * Pointer to the registration info of the sender. * +* p_dest_reg +* Pointer to the registration info of the recipient. +* * pfn_xmt_callback * Client's message done callback. * @@ -597,7 +588,7 @@ cl_disp_post(IN const cl_disp_reg_handle_t handle, * cl_disp_get_queue_status * * DESCRIPTION -* This function posts a message to a Dispatcher object. +* This function gets queue status of a Dispatcher object. * * SYNOPSIS */ @@ -610,13 +601,13 @@ cl_disp_get_queue_status(IN const cl_disp_reg_handle_t handle, * handle * [in] cl_disp_reg_handle_t value return by cl_disp_register. * +* p_num_queued_msgs +* [out] number of messages in the queue +* * p_last_msg_queue_time_ms * [out] pointer to a variable to hold the time the last popped up message * spent in the queue * -* p_num_queued_msgs -* [out] number of messages in the queue -* * RETURN VALUE * Thr time the last popped up message stayed in the queue, in msec *