From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0058.outbound.protection.outlook.com [104.47.42.58]) by dpdk.org (Postfix) with ESMTP id DD510726F for ; Thu, 11 Jan 2018 12:18:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pTjhWqlaxm2ci09jPTc9Q7/laS9x+NbtSu69pIGVadM=; b=ha5j7gN/+elX9eFP01H3uQZbPNkLKVpB6r2LJI5hxlCRFsus6Kr3coLeISfAS0jkfbqPxjbQWwensLBSunV1UEgH8/UdgOniN90MZLL+CUyPEHnvc1V0liSXsWfVlI3rvTL95Ghe6d79iuHMPRv8CS3T6q4g8yD9rUqZcmfWoWw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT (111.93.218.67) by BN6PR07MB3458.namprd07.prod.outlook.com (10.161.153.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Thu, 11 Jan 2018 11:18:39 +0000 Date: Thu, 11 Jan 2018 16:48:31 +0530 From: Pavan Nikhilesh To: Erik Gabriel Carrillo , jerin.jacob@caviumnetworks.com, nipun.gupta@nxp.com, hemant.agrawal@nxp.com Cc: dev@dpdk.org Message-ID: <20180111111830.dkedtc7uqwxt64y7@Pavan-LT> References: <1512158458-22661-1-git-send-email-erik.g.carrillo@intel.com> <1515630074-29020-1-git-send-email-erik.g.carrillo@intel.com> <1515630074-29020-6-git-send-email-erik.g.carrillo@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1515630074-29020-6-git-send-email-erik.g.carrillo@intel.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR2201CA0095.namprd22.prod.outlook.com (10.174.103.48) To BN6PR07MB3458.namprd07.prod.outlook.com (10.161.153.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13e4732a-886f-4f63-9bf3-08d558e5124f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020065)(4652020)(5600026)(4604075)(4534095)(4602075)(4627191)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:BN6PR07MB3458; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3458; 3:K2o/6OXp4ki8gIQslgX8wQRSCCXENhKUTaiHI88DhxdgcmPcZkiv66UmIMhNrKJdcwxLmEfOU30sffIpl/fblotL0M0D5UPuK9G0E3rDxkxOqF91knBXwCU5+utsgayvkPTOSiFKD8WUxt9awD2/ZhakwAAwcyw1xiOrE8okFLforqT0dOUhLcWBMYwo8YwUDOxGIDbGYPNwc1vyOn9dO02syj1Fhch7xxHeYaMXsb5oQXtGfC9AvOuhGneqK3q3; 25:jlEX24wFHEEMC77ZoJS9+5VNrUA4v3Efuv5FAnZ+4rUammABmGXboPYxFmQ1TllJYfd/78ejQbon+uxvqvEU9iDPLc08Qj6yyGmONgkZRxsYzE8c9bu24QigDoLWFKe3IS9thWFOVWQvZPnAzhIQeLpZqPI8wJUWqum9khnhZp6MHWMd6o2r6h2SdksEn/OsKQNQWjg/+c6tgjMBnn5RWvGK8+uja2jLBTYk4npg23ZFHJDp6mAAbNJKYF5DKI9tnciEFw6J/6CFFx2dm/BPRu/MaURS1Otc0DKTCvN1LDBDTZlCVvQvxZ8RvQCo9DgULPEaEU8+DGmfZK37ilW+rA==; 31:V8TTf+gN1oOhMRlGsTb8739G9gQ3drrhD+gxIl6HGFpaSiPb5tZmmxGlFfjG44I1GNLf14H0LEMsMvCT1hoT/sulHxEDMOw2Xc+fRC16NxRpKv3kq88aSP1i+S5mChWpm7hEQZp7Dg0YVWQ5UefHAVftX2v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4pHyydtudJmWUQBJK4BjhKNlfY X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501134)(10201501046)(3002001)(93006095)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:BN6PR07MB3458; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN6PR07MB3458; X-Forefront-PRVS: 0549E6FD50 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(366004)(346002)(396003)(376002)(39380400002)(24454002)(189003)(199004)(16586007)(72206003)(53936002)(478600001)(81156014)(8676002)(42882006)(2906002)(2950100002)(50466002)(8936002)(229853002)(33896004)(68736007)(6496006)(81166006)(8656006)(52116002)(47776003)(386003)(55016002)(6666003)(76176011)(9686003)(4326008)(66066001)(97736004)(6116002)(33716001)(5660300001)(6246003)(59450400001)(105586002)(106356001)(305945005)(58126008)(23726003)(7736002)(1076002)(25786009)(3846002)(316002)(83506002)(16526018)(5009440100003)(107986001)(42262002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3458; H:Pavan-LT; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR07MB3458; 23:NX1z39w6cRbIWMnVW//KvZjAsdcYFCceyRO2B8rPX?= =?us-ascii?Q?912E6qssQ7kWHmDf0oCRWwwIkCKf12I8WyFn0SJnJpYjnP5l3Rq2gG5WzI79?= =?us-ascii?Q?fYL6a1gr39YBhitosgXmlVAPhrWOBnQq/PDG1ImkvdeI0eWenn9sL/1cYIzc?= =?us-ascii?Q?gtGnq1K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Pwc4ymfO/Ombv6zPILEXBDW98MDQS/ujvT7pyZXNQirSiDMz72RfBn80V0PQIz0=; 7:zZG8EP0U1p5e/WMwHVuXgStzgwLaeFghsOIChkNuqwwwHK3JkrXBq9S8mRdZNBXF+GuVnux8WiPpQ2LOvxs5ULfcx9lW68JlfGRDbJBQms1FzWrD3ua/rXuFEW6LUw+N1O/pP2cLfKhIBSElvfpvwa6VhUEfWalczoQr41hWclkDrCoXH+0lgtZOmKaTCedZkZWXTx7Vnj1iJXx3v/TdUvNyvIJntQOZ8HsIQt6jDBhpLtjD1tOa3SbByobShNWi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2018 11:18:39.8411 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13e4732a-886f-4f63-9bf3-08d558e5124f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3458 Subject: Re: [dpdk-dev] [PATCH v6 05/23] eventtimer: add adapter allocation definitions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 11:18:44 -0000 On Wed, Jan 10, 2018 at 06:20:56PM -0600, Erik Gabriel Carrillo wrote: > Add definitions for the functions that allocate and deallocate adapter > instances in the default software implementation. > > Signed-off-by: Erik Gabriel Carrillo > --- > lib/Makefile | 2 +- > lib/librte_eventdev/Makefile | 2 +- > lib/librte_eventdev/rte_event_timer_adapter.c | 138 +++++++++++++++++++++++++- > lib/librte_eventdev/rte_event_timer_adapter.h | 2 +- > 4 files changed, 139 insertions(+), 5 deletions(-) > > diff --git a/lib/Makefile b/lib/Makefile > index 4202702..4c53f8c 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -29,7 +29,7 @@ DEPDIRS-librte_security := librte_eal librte_mempool librte_ring librte_mbuf > DEPDIRS-librte_security += librte_ether > DEPDIRS-librte_security += librte_cryptodev > DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += librte_eventdev > -DEPDIRS-librte_eventdev := librte_eal librte_ring librte_ether librte_hash > +DEPDIRS-librte_eventdev := librte_eal librte_ring librte_ether librte_hash librte_mempool > DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost > DEPDIRS-librte_vhost := librte_eal librte_mempool librte_mbuf librte_ether > DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash > diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile > index 8f11a79..e68f888 100644 > --- a/lib/librte_eventdev/Makefile > +++ b/lib/librte_eventdev/Makefile > @@ -13,7 +13,7 @@ LIBABIVER := 3 > # build flags > CFLAGS += -O3 > CFLAGS += $(WERROR_FLAGS) > -LDLIBS += -lrte_eal -lrte_ring -lrte_ethdev -lrte_hash > +LDLIBS += -lrte_eal -lrte_ring -lrte_ethdev -lrte_hash -lrte_mempool > > # library source files > SRCS-y += rte_eventdev.c > diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c > index 540be95..9c4ba1c 100644 > --- a/lib/librte_eventdev/rte_event_timer_adapter.c > +++ b/lib/librte_eventdev/rte_event_timer_adapter.c > @@ -31,11 +31,17 @@ > */ > > #include > +#include > > #include > #include > #include > #include > +#include > +#include > +#include > +#include > +#include > > #include "rte_eventdev.h" > #include "rte_eventdev_pmd.h" > @@ -163,6 +169,11 @@ rte_event_timer_adapter_create_ext( > > adapter_id = conf->timer_adapter_id; > > + if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) { > + rte_errno = -EINVAL; > + return NULL; > + } > + > /* Check adapter ID not already allocated */ > adapter = &adapters[adapter_id]; > if (adapter->allocated) { > @@ -412,18 +423,141 @@ rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter, > * Software event timer adapter ops definitions > */ > > +struct rte_event_timer_adapter_sw_data { > + /* Number of outstanding timers managed by event adapter. */ > + int nb_armed_evtims; > + /* Identifier of service executing timer management logic. */ > + uint32_t service_id; > + /* Ring containing messages to arm or cancel event timers */ > + struct rte_ring *msg_ring; > + /* Mempool containing msg objects */ > + struct rte_mempool *msg_pool; > + /* Mempool containing timer objects */ > + struct rte_mempool *tim_pool; > +}; Don't use rte_ prefix for internal data. > + > +enum msg_type {MSG_TYPE_ARM, MSG_TYPE_CANCEL}; > + > +struct msg { > + enum msg_type type; > + struct rte_event_timer *evtim; > +}; > + > +static int > +sw_event_timer_adapter_service_func(void *arg) > +{ > + RTE_SET_USED(arg); > + return 0; > +} > + > static int > sw_event_timer_adapter_init(struct rte_event_timer_adapter *adapter) > { > - RTE_SET_USED(adapter); > + int ret; > + struct rte_event_timer_adapter_sw_data *sw_data; > + uint64_t nb_timers; > + > + char pool_name[RTE_RING_NAMESIZE]; > + snprintf(pool_name, RTE_RING_NAMESIZE, "sw_evtim_adap_msg_pool_%"PRIu8, > + adapter->data->id); > + sw_data->msg_pool = rte_mempool_create(pool_name, nb_timers, > + sizeof(struct msg), 32, 0, NULL, > + NULL, NULL, NULL, > + adapter->data->socket_id, 0); > + if (sw_data->msg_pool == NULL) { > + rte_errno = ENOMEM; > + return -1; > + } > + > + snprintf(pool_name, RTE_RING_NAMESIZE, "sw_evtim_adap_tim_pool_%"PRIu8, > + adapter->data->id); > + sw_data->tim_pool = rte_mempool_create(pool_name, nb_timers, > + sizeof(struct rte_timer), 32, 0, > + NULL, NULL, NULL, NULL, > + adapter->data->socket_id, 0); > + if (sw_data->tim_pool == NULL) { > + printf("Could not allocate tim mempool\n"); > + return -1; > + } Any specific reason for having seperate mempool for msg and timers? You could have a internal structure as a wrapper for both. > + > + /* Register a service component */ > + memset(&service, 0, sizeof(service)); > + snprintf(service.name, RTE_SERVICE_NAME_MAX, > + "sw_evimer_adap_svc_%"PRIu8, adapter->data->id); > + service.socket_id = adapter->data->socket_id; > + service.callback = sw_event_timer_adapter_service_func; > + service.callback_userdata = adapter; > + ret = rte_service_component_register(&service, &sw_data->service_id); > + if (ret < 0) > + return ret; > > return 0; > } > > -#define RTE_EVENT_TIMER_ADAPTER_NUM_MAX 64 > +#define RTE_EVENT_TIMER_ADAPTER_NUM_MAX 32 Any specific reason for this change? maybe make it compile-time configurable > > /** > * @warning > -- > 2.6.4 >