From patchwork Fri Nov 2 02:53:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10664897 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 2D4833E9D for ; Fri, 2 Nov 2018 02:53:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B6C72B8AC for ; Fri, 2 Nov 2018 02:53:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F8692BB4A; Fri, 2 Nov 2018 02:53:34 +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 3F9442B8AC for ; Fri, 2 Nov 2018 02:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726059AbeKBL66 (ORCPT ); Fri, 2 Nov 2018 07:58:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeKBL66 (ORCPT ); Fri, 2 Nov 2018 07:58:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5AACD3002C82; Fri, 2 Nov 2018 02:53:27 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE4845D6A6; Fri, 2 Nov 2018 02:53:25 +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_event_wheel.h improve comment documentation Date: Fri, 2 Nov 2018 10:53:20 +0800 Message-Id: <20181102025321.25429-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 02 Nov 2018 02:53:27 +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 --- include/complib/cl_event_wheel.h | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/include/complib/cl_event_wheel.h b/include/complib/cl_event_wheel.h index 48833532..836a8a33 100644 --- a/include/complib/cl_event_wheel.h +++ b/include/complib/cl_event_wheel.h @@ -137,7 +137,6 @@ typedef uint64_t typedef struct _cl_event_wheel { cl_spinlock_t lock; cl_spinlock_t *p_external_lock; - cl_qmap_t events_map; boolean_t closing; cl_qlist_t events_wheel; @@ -215,7 +214,7 @@ typedef struct _cl_event_wheel_reg_info { * Client's context for event-aged callback. * * p_event_wheel -* Pointer to this event wheel object +* Pointer to parent event wheel object * * SEE ALSO *********/ @@ -225,7 +224,7 @@ typedef struct _cl_event_wheel_reg_info { * cl_event_wheel_construct * * DESCRIPTION -* This function constructs a Event_Wheel object. +* This function constructs an Event_Wheel object. * * SYNOPSIS */ @@ -233,13 +232,13 @@ void cl_event_wheel_construct(IN cl_event_wheel_t * const p_event_wheel); /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * RETURN VALUE * This function does not return a value. * * NOTES -* Allows calling cl_event_wheel_init and cl_event_wheel_destroy. +* Allows calling cl_event_wheel_destroy. * * SEE ALSO * Event_Wheel, cl_event_wheel_init, cl_event_wheel_destroy @@ -250,7 +249,7 @@ void cl_event_wheel_construct(IN cl_event_wheel_t * const p_event_wheel); * cl_event_wheel_init * * DESCRIPTION -* This function initializes a Event_Wheel object. +* This function initializes an Event_Wheel object. * * SYNOPSIS */ @@ -260,7 +259,7 @@ cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel); /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * RETURN VALUE * CL_SUCCESS if the operation is successful. @@ -270,12 +269,12 @@ cl_event_wheel_init(IN cl_event_wheel_t * const p_event_wheel); * *********/ -/****f* Component Library: Event_Wheel/cl_event_wheel_init +/****f* Component Library: Event_Wheel/cl_event_wheel_init_ex * NAME -* cl_event_wheel_init +* cl_event_wheel_init_ex * * DESCRIPTION -* This function initializes a Event_Wheel object. +* This function initializes an Event_Wheel object with an external spinlock * * SYNOPSIS */ @@ -286,7 +285,7 @@ cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel, /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * p_external_lock * [in] Reference to external spinlock to guard internal structures @@ -305,7 +304,7 @@ cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel, * cl_event_wheel_destroy * * DESCRIPTION -* This function destroys a Event_Wheel object. +* This function destroys an Event_Wheel object. * * SYNOPSIS */ @@ -313,7 +312,7 @@ void cl_event_wheel_destroy(IN cl_event_wheel_t * const p_event_wheel); /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * RETURN VALUE * This function does not return a value. @@ -339,7 +338,7 @@ void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel); /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * RETURN VALUE * This function does not return a value. @@ -357,7 +356,7 @@ void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel); * cl_event_wheel_reg * * DESCRIPTION -* This function registers a client with a Event_Wheel object. +* This function registers a client with an Event_Wheel object. * * SYNOPSIS */ @@ -370,7 +369,7 @@ cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel, /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * key * [in] The specifc Key by which events are registered. @@ -387,7 +386,7 @@ cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel, * function. * * RETURN VALUE -* On success a Event_Wheel CL_SUCCESS or CL_ERROR otherwise. +* On success an Event_Wheel CL_SUCCESS or CL_ERROR otherwise. * * SEE ALSO * Event_Wheel, cl_event_wheel_unreg @@ -398,7 +397,7 @@ cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel, * cl_event_wheel_unreg * * DESCRIPTION -* This function unregisters a client event from a Event_Wheel. +* This function unregisters a client event from an Event_Wheel. * * SYNOPSIS */ @@ -408,7 +407,7 @@ cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel, /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * key * [in] The key used for registering the event @@ -440,7 +439,7 @@ cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel, /* * PARAMETERS * p_event_wheel -* [in] Pointer to a Event_Wheel. +* [in] Pointer to an Event_Wheel. * * key * [in] The key used for registering the event From patchwork Fri Nov 2 02:53:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10664895 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 8779B13B5 for ; Fri, 2 Nov 2018 02:53:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 663792B8EC for ; Fri, 2 Nov 2018 02:53:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55F442BD5B; Fri, 2 Nov 2018 02:53:33 +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 603522B8EC for ; Fri, 2 Nov 2018 02:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726218AbeKBL7C (ORCPT ); Fri, 2 Nov 2018 07:59:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeKBL7B (ORCPT ); Fri, 2 Nov 2018 07:59:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CD543086254; Fri, 2 Nov 2018 02:53:31 +0000 (UTC) Received: from lhg.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id C46125D6A6; Fri, 2 Nov 2018 02:53:29 +0000 (UTC) From: Honggang LI To: hal@dev.mellanox.co.il Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 2/2] complib/cl_event_wheel.c minor update for the sample test program Date: Fri, 2 Nov 2018 10:53:21 +0800 Message-Id: <20181102025321.25429-2-honli@redhat.com> In-Reply-To: <20181102025321.25429-1-honli@redhat.com> References: <20181102025321.25429-1-honli@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 02 Nov 2018 02:53:31 +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_event_wheel.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/complib/cl_event_wheel.c b/complib/cl_event_wheel.c index 27443f66..21e1f4ee 100644 --- a/complib/cl_event_wheel.c +++ b/complib/cl_event_wheel.c @@ -457,6 +457,7 @@ uint32_t cl_event_wheel_num_regs(IN cl_event_wheel_t * const p_event_wheel, } #ifdef __CL_EVENT_WHEEL_TEST__ +#include /* sleep() */ /* Dump out the complete state of the event wheel */ void __cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel) @@ -511,14 +512,10 @@ static uint64_t __test_event_aging(uint64_t key, uint32_t num_regs, void *contex int main() { cl_event_wheel_t event_wheel; - /* uint64_t key; */ /* init complib */ complib_init(); - /* construct */ - cl_event_wheel_construct(&event_wheel); - /* init */ cl_event_wheel_init(&event_wheel); @@ -534,7 +531,7 @@ int main() "The Second Aging Event"); cl_event_wheel_reg(&event_wheel, 3, /* key */ - cl_get_time_stamp() + 3500000, /* 3 sec lifetime */ + cl_get_time_stamp() + 3500000, /* 3.5 sec lifetime */ __test_event_aging, /* cb */ "The Third Aging Event"); @@ -542,7 +539,7 @@ int main() sleep(2); cl_event_wheel_reg(&event_wheel, 2, /* key */ - cl_get_time_stamp() + 8000000, /* 3 sec lifetime */ + cl_get_time_stamp() + 8000000, /* 8 sec lifetime */ __test_event_aging, /* cb */ "The Second Aging Event Moved");