From patchwork Mon Nov 30 18:45:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 57469 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1668350lbb; Mon, 30 Nov 2015 10:45:31 -0800 (PST) X-Received: by 10.140.247.86 with SMTP id s83mr31547754qhc.39.1448909131604; Mon, 30 Nov 2015 10:45:31 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f11si13649375qga.87.2015.11.30.10.45.31; Mon, 30 Nov 2015 10:45:31 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 0A52E61CC7; Mon, 30 Nov 2015 18:45:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 05D1961C6A; Mon, 30 Nov 2015 18:45:20 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 61F2D61C6C; Mon, 30 Nov 2015 18:45:17 +0000 (UTC) Received: from mail-ob0-f176.google.com (mail-ob0-f176.google.com [209.85.214.176]) by lists.linaro.org (Postfix) with ESMTPS id 8371461998 for ; Mon, 30 Nov 2015 18:45:15 +0000 (UTC) Received: by obbbj7 with SMTP id bj7so134599590obb.1 for ; Mon, 30 Nov 2015 10:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=hUqIkmZpvtxBKNfAmzs12OfcWXROOoWqDL0BjaNokMU=; b=wwcX4OBuM3+JUc4o8rvXXb3hcP89Ljd1TXkph0PtzcK2YGTKTRgLcSDdBQB11e//LM Z3+4NGZhXOWRk9hsMPAANgAubiM5x1sETqkAfUV8bD2E1lPpjA8+lAJ9V3NG9Dif05Ao jr4kNgOLJEDDds1GEkM9wKBY1p89FeEVN/VKzXQws9c4FRKTpxp+I5p+t+QFsNFBBp13 ArwZKpGeuM2Alrl3XRv5WOtQcIiymwJk1Z1gb3/gWQAHMxOxc9fYP49HUxMfaeRYWTW/ 3GnirAvjyD3Qy019deXxuFwdjyCfjMjkpgNHgP2vTLZhrI2dvPXYVjPfOF2H/fekXTFB J4pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hUqIkmZpvtxBKNfAmzs12OfcWXROOoWqDL0BjaNokMU=; b=Wx2XnGB9eCVtjz+H3o/2JyH8VBYobCdcTzJ79pw4Ga9VnW6SSP0gsIL+Itx+nL/R1X l+gWtjcGXcZeWVXbb79pBWsXEv0fx5WTCNMaCERLiWnVJ+IBiRXCvmCU5JpP51tOPpFJ E66DEkzBejE+fA1qlfdh9W7d92DssC2K4saMT9/0hOGFZfMP3AI2KpjjcZiUA0qjottK SeKKN6OwKze1EnlSoAKQ1xgAewoK5sL1ArlkOR6mExqVopPvz2in3Jl6yZ3TU3SfpMX8 ZAZiFPgUU+Rimfjryb/Z4BzMjSwJFtnQhJDexFd4ekqTTPq8wS+FqsVFiJxkFzlUDR/Y FleA== X-Gm-Message-State: ALoCoQkHlyxsLa8qnoFFVBvdsd9fjDrrrUuVvd6O3toWeA4ZPMxJbf0HW3aAr1OJVYrrRJrehm18 X-Received: by 10.60.17.1 with SMTP id k1mr29275240oed.4.1448909114996; Mon, 30 Nov 2015 10:45:14 -0800 (PST) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id c20sm22023736oig.4.2015.11.30.10.45.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Nov 2015 10:45:14 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 30 Nov 2015 12:45:09 -0600 Message-Id: <1448909109-2721-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] linux-generic: tm: use intermediate casts to avoid strict warnings X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Bill Fischofer Reviewed-by: Mike Holmes --- .../include/odp_traffic_mngr_internal.h | 15 +++--- platform/linux-generic/odp_name_table.c | 58 ++++++++++++---------- platform/linux-generic/odp_pkt_queue.c | 12 ++--- platform/linux-generic/odp_sorted_list.c | 16 +++--- platform/linux-generic/odp_timer_wheel.c | 18 +++---- platform/linux-generic/odp_traffic_mngr.c | 4 +- 6 files changed, 67 insertions(+), 56 deletions(-) diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h b/platform/linux-generic/include/odp_traffic_mngr_internal.h index c2d5cf4..e48e213 100644 --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h @@ -48,8 +48,8 @@ typedef struct stat file_stat_t; /* Macros to convert handles to internal pointers and vice versa. */ -#define MAKE_ODP_TM_HANDLE(tm_system) ((odp_tm_t)tm_system) -#define GET_TM_SYSTEM(odp_tm) ((tm_system_t *)odp_tm) +#define MAKE_ODP_TM_HANDLE(tm_system) ((odp_tm_t)(uintptr_t)tm_system) +#define GET_TM_SYSTEM(odp_tm) ((tm_system_t *)(uintptr_t)odp_tm) #define MAKE_PROFILE_HANDLE(profile_kind, tbl_idx) \ (((profile_kind & 0xF) << 28) | ((tbl_idx + 1) & 0xFFFFFFF)) @@ -59,11 +59,14 @@ typedef struct stat file_stat_t; #define GET_TBL_IDX(profile_handle) ((profile_handle & 0xFFFFFFF) - 1) -#define MAKE_ODP_TM_NODE(tm_node_obj) ((odp_tm_node_t)(tm_node_obj)) -#define GET_TM_NODE_OBJ(odp_tm_node) ((tm_node_obj_t *)(odp_tm_node)) +#define MAKE_ODP_TM_NODE(tm_node_obj) ((odp_tm_node_t)(uintptr_t)(tm_node_obj)) +#define GET_TM_NODE_OBJ(odp_tm_node) \ + ((tm_node_obj_t *)(uintptr_t)(odp_tm_node)) -#define MAKE_ODP_TM_QUEUE(tm_queue_obj) ((odp_tm_queue_t)(tm_queue_obj)) -#define GET_TM_QUEUE_OBJ(odp_tm_queue) ((tm_queue_obj_t *)(odp_tm_queue)) +#define MAKE_ODP_TM_QUEUE(tm_queue_obj) \ + ((odp_tm_queue_t)(uintptr_t)(tm_queue_obj)) +#define GET_TM_QUEUE_OBJ(odp_tm_queue) \ + ((tm_queue_obj_t *)(uintptr_t)(odp_tm_queue)) typedef uint64_t tm_handle_t; diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c index 10ce099..10a760e 100644 --- a/platform/linux-generic/odp_name_table.c +++ b/platform/linux-generic/odp_name_table.c @@ -567,7 +567,7 @@ static hash_tbl_entry_t make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry, uint32_t new_entry_cnt; new_entry_cnt = MIN(entry_cnt + 1, 0x3F); - hash_tbl_entry = (hash_tbl_entry_t)name_tbl_entry; + hash_tbl_entry = (hash_tbl_entry_t)(uintptr_t)name_tbl_entry; hash_tbl_entry &= ~0x3F; hash_tbl_entry |= new_entry_cnt; return hash_tbl_entry; @@ -584,18 +584,18 @@ static name_tbl_entry_t *name_hash_tbl_lookup(uint32_t hash_value) if (hash_tbl_entry == 0) return NULL; else if ((hash_tbl_entry & 0x3F) != 0) - return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); /* This hash_tbl_entry references a secondary hash table, so get * some more hash_value bits and index that table. */ hash_idx = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1); - secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry; + secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry; hash_tbl_entry = secondary_hash->hash_entries[hash_idx]; if (hash_tbl_entry == 0) return NULL; else if ((hash_tbl_entry & 0x3F) != 0) - return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); /* Yet again, this hash_tbl_entry references a secondary hash table, * so get some more hash_value bits and index that table. We only @@ -604,12 +604,12 @@ static name_tbl_entry_t *name_hash_tbl_lookup(uint32_t hash_value) * returning NULL. */ hash_idx = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1); - secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry; + secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry; hash_tbl_entry = secondary_hash->hash_entries[hash_idx]; if (hash_tbl_entry == 0) return NULL; else if ((hash_tbl_entry & 0x3F) != 0) - return (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + return (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); return NULL; } @@ -655,7 +655,8 @@ static hash_tbl_entry_t secondary_hash_add(name_tbl_entry_t *name_tbl_entry, hash_tbl_entry = secondary_hash->hash_entries[hash_idx]; entry_cnt = hash_tbl_entry & 0x3F; - first_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + first_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); name_tbl_entry->next_entry = first_entry; new_hash_tbl_entry = @@ -666,7 +667,7 @@ static hash_tbl_entry_t secondary_hash_add(name_tbl_entry_t *name_tbl_entry, } /* secondary_hash_dump(secondary_hash); */ - return (hash_tbl_entry_t)secondary_hash; + return (hash_tbl_entry_t)(uintptr_t)secondary_hash; } static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl, @@ -693,11 +694,11 @@ static hash_tbl_entry_t hash_tbl_remove(secondary_hash_tbl_t *hash_tbl, * new entry onto the front of it. */ head_entry = (name_tbl_entry_t *) - (hash_tbl_entry & ~0x3F); + (uintptr_t)(hash_tbl_entry & ~0x3F); tail_entry = head_entry; } else { secondary_hash = (secondary_hash_tbl_t *) - hash_tbl_entry; + (uintptr_t)hash_tbl_entry; check_secondary_hash(secondary_hash); if (level == 1) break; @@ -758,7 +759,8 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add, /* This primary hash table entry points to a name_tbl_entry_t * linked list, so add this new entry onto the front of it. */ - name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + name_tbl_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); entry_to_add->next_entry = name_tbl_entry; hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt); name_hash_tbl.hash_entries[primary_hash_idx] = hash_tbl_entry; @@ -783,7 +785,7 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add, * some more hash_value bits and index that table. */ hash_idx = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1); - secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry; + secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry; check_secondary_hash(secondary_hash); hash_tbl_entry = secondary_hash->hash_entries[hash_idx]; entry_cnt = hash_tbl_entry & 0x3F; @@ -799,7 +801,8 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add, * name_tbl_entry_t linked list, so add this new entry onto * the front of it. */ - name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + name_tbl_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); entry_to_add->next_entry = name_tbl_entry; hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt); secondary_hash->hash_entries[hash_idx] = hash_tbl_entry; @@ -827,7 +830,7 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add, * signal failure by returning -1. */ hash_idx = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1); - secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry; + secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry; check_secondary_hash(secondary_hash); hash_tbl_entry = secondary_hash->hash_entries[hash_idx]; entry_cnt = hash_tbl_entry & 0x3F; @@ -846,7 +849,8 @@ static int name_hash_tbl_add(name_tbl_entry_t *entry_to_add, * linked list, we never add another hash table, so we don't * need to update any secondary table counts. */ - name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + name_tbl_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); entry_to_add->next_entry = name_tbl_entry; hash_tbl_entry = make_hash_tbl_entry(entry_to_add, entry_cnt); secondary_hash->hash_entries[hash_idx] = hash_tbl_entry; @@ -875,7 +879,8 @@ static int name_tbl_entry_list_remove(hash_tbl_entry_t *hash_entry_ptr, * deleted. */ if (!prev_entry) { - hash_tbl_entry = (hash_tbl_entry_t)next_entry; + hash_tbl_entry = + (hash_tbl_entry_t)(uintptr_t)next_entry; hash_tbl_entry &= ~0x3F; hash_tbl_entry |= entry_cnt; *hash_entry_ptr = hash_tbl_entry; @@ -922,7 +927,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete, /* This primary hash table entry points to a name_tbl_entry_t * linked list, so remove entry from this linked list. */ - name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + name_tbl_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry, entry_to_delete, entry_cnt); tbn = (*hash_entry_ptr) & ~0x3F; @@ -940,7 +946,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete, * some more hash_value bits and index that table. */ hash_idx = (hash_value >> 16) & (SECONDARY_HASH_TBL_SIZE - 1); - secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry; + secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry; check_secondary_hash(secondary_hash); hash_entry_ptr = &secondary_hash->hash_entries[hash_idx]; hash_tbl_entry = *hash_entry_ptr; @@ -955,7 +961,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete, * name_tbl_entry_t linked list, so try to remove * entry_to_delete from this linked list. */ - name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + name_tbl_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry, entry_to_delete, entry_cnt); tbn = (*hash_entry_ptr) & ~0x3F; @@ -988,7 +995,7 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete, * signal failure by returning -1. */ hash_idx = (hash_value >> 24) & (SECONDARY_HASH_TBL_SIZE - 1); - secondary_hash = (secondary_hash_tbl_t *)hash_tbl_entry; + secondary_hash = (secondary_hash_tbl_t *)(uintptr_t)hash_tbl_entry; check_secondary_hash(secondary_hash); hash_entry_ptr = &secondary_hash->hash_entries[hash_idx]; hash_tbl_entry = *hash_entry_ptr; @@ -1003,7 +1010,8 @@ static int name_hash_tbl_delete(name_tbl_entry_t *entry_to_delete, * name_tbl_entry_t linked list, so try to remove * entry_to_delete from this linked list. */ - name_tbl_entry = (name_tbl_entry_t *)(hash_tbl_entry & ~0x3F); + name_tbl_entry = + (name_tbl_entry_t *)(uintptr_t)(hash_tbl_entry & ~0x3F); rc = name_tbl_entry_list_remove(hash_entry_ptr, name_tbl_entry, entry_to_delete, entry_cnt); tbn = (*hash_entry_ptr) & ~0x3F; @@ -1172,7 +1180,7 @@ static uint32_t level2_hash_histo(secondary_hash_tbl_t *hash_tbl, collisions = 0; } else { name_tbl_entry = (name_tbl_entry_t *) - (hash_tbl_entry & ~0x3F); + (uintptr_t)(hash_tbl_entry & ~0x3F); collisions = linked_list_len(name_tbl_entry); } @@ -1199,11 +1207,11 @@ static uint32_t level1_hash_histo(secondary_hash_tbl_t *hash_tbl, collisions = 0; } else if ((hash_tbl_entry & 0x3F) != 0) { name_tbl_entry = (name_tbl_entry_t *) - (hash_tbl_entry & ~0x3F); + (uintptr_t)(hash_tbl_entry & ~0x3F); collisions = linked_list_len(name_tbl_entry); } else { secondary_hash = (secondary_hash_tbl_t *) - hash_tbl_entry; + (uintptr_t)hash_tbl_entry; collisions = level2_hash_histo(secondary_hash, level2_histo); } @@ -1232,7 +1240,7 @@ static void secondary_hash_histo_print(void) * hash table */ secondary_hash = (secondary_hash_tbl_t *) - hash_tbl_entry; + (uintptr_t)hash_tbl_entry; level1_hash_histo(secondary_hash, level1_histo, level2_histo); } diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c index 45508eb..88520b1 100644 --- a/platform/linux-generic/odp_pkt_queue.c +++ b/platform/linux-generic/odp_pkt_queue.c @@ -215,7 +215,7 @@ _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t max_num_queues, pool->min_free_list_size = pool->free_list_size; pool->peak_free_list_size = pool->free_list_size; - return (_odp_int_queue_pool_t)pool; + return (_odp_int_queue_pool_t)(uintptr_t)pool; } _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool) @@ -223,7 +223,7 @@ _odp_int_pkt_queue_t _odp_pkt_queue_create(_odp_int_queue_pool_t queue_pool) queue_pool_t *pool; uint32_t queue_num; - pool = (queue_pool_t *)queue_pool; + pool = (queue_pool_t *)(uintptr_t)queue_pool; queue_num = pool->next_queue_num++; if (pool->max_queue_num < queue_num) return _ODP_INT_PKT_QUEUE_INVALID; @@ -239,7 +239,7 @@ int _odp_pkt_queue_append(_odp_int_queue_pool_t queue_pool, uint32_t queue_num, first_blk_idx, tail_blk_idx, new_tail_blk_idx; uint32_t idx; - pool = (queue_pool_t *)queue_pool; + pool = (queue_pool_t *)(uintptr_t)queue_pool; queue_num = (uint32_t)pkt_queue; if ((queue_num == 0) || (pool->max_queue_num < queue_num)) return -2; @@ -296,7 +296,7 @@ int _odp_pkt_queue_remove(_odp_int_queue_pool_t queue_pool, queue_blk_t *first_blk, *second_blk; uint32_t queue_num, first_blk_idx, next_blk_idx, idx; - pool = (queue_pool_t *)queue_pool; + pool = (queue_pool_t *)(uintptr_t)queue_pool; queue_num = (uint32_t)pkt_queue; if ((queue_num == 0) || (pool->max_queue_num < queue_num)) return -2; @@ -347,7 +347,7 @@ void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool) { queue_pool_t *pool; - pool = (queue_pool_t *)queue_pool; + pool = (queue_pool_t *)(uintptr_t)queue_pool; ODP_DBG("pkt_queue_stats - queue_pool=0x%lX\n", queue_pool); ODP_DBG(" max_queue_num=%u max_queued_pkts=%u next_queue_num=%u\n", pool->max_queue_num, pool->max_queued_pkts, @@ -367,7 +367,7 @@ void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool) queue_pool_t *pool; uint32_t idx; - pool = (queue_pool_t *)queue_pool; + pool = (queue_pool_t *)(uintptr_t)queue_pool; for (idx = 0; idx < 16; idx++) { queue_region_desc = &pool->queue_region_descs[idx]; if (queue_region_desc->queue_blks) diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c index 221754d..5811266 100644 --- a/platform/linux-generic/odp_sorted_list.c +++ b/platform/linux-generic/odp_sorted_list.c @@ -56,7 +56,7 @@ _odp_int_sorted_pool_t _odp_sorted_pool_create(uint32_t max_sorted_lists) list_descs = malloc(malloc_len); memset(list_descs, 0, malloc_len); pool->list_descs = list_descs; - return (_odp_int_sorted_pool_t)pool; + return (_odp_int_sorted_pool_t)(uintptr_t)pool; } _odp_int_sorted_list_t @@ -66,7 +66,7 @@ _odp_sorted_list_create(_odp_int_sorted_pool_t sorted_pool, sorted_pool_t *pool; uint32_t list_idx; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; list_idx = pool->next_list_idx++; return (_odp_int_sorted_list_t)list_idx; } @@ -81,7 +81,7 @@ int _odp_sorted_list_insert(_odp_int_sorted_pool_t sorted_pool, sorted_pool_t *pool; uint32_t list_idx; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; list_idx = (uint32_t)sorted_list; if ((pool->next_list_idx <= list_idx) || (pool->max_sorted_lists <= list_idx)) @@ -125,7 +125,7 @@ int _odp_sorted_list_find(_odp_int_sorted_pool_t sorted_pool, sorted_pool_t *pool; uint32_t list_idx; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; list_idx = (uint32_t)sorted_list; if ((pool->next_list_idx <= list_idx) || (pool->max_sorted_lists <= list_idx)) @@ -161,7 +161,7 @@ int _odp_sorted_list_delete(_odp_int_sorted_pool_t sorted_pool, sorted_pool_t *pool; uint32_t list_idx; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; list_idx = (uint32_t)sorted_list; if ((pool->next_list_idx <= list_idx) || (pool->max_sorted_lists <= list_idx)) @@ -207,7 +207,7 @@ int _odp_sorted_list_remove(_odp_int_sorted_pool_t sorted_pool, sorted_pool_t *pool; uint32_t list_idx; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; list_idx = (uint32_t)sorted_list; if ((pool->next_list_idx <= list_idx) || (pool->max_sorted_lists <= list_idx)) @@ -237,7 +237,7 @@ void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool) { sorted_pool_t *pool; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; ODP_DBG("sorted_pool=0x%lX\n", sorted_pool); ODP_DBG(" max_sorted_lists=%u next_list_idx=%u\n", pool->max_sorted_lists, pool->next_list_idx); @@ -253,7 +253,7 @@ void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool) sorted_pool_t *pool; uint32_t list_idx; - pool = (sorted_pool_t *)sorted_pool; + pool = (sorted_pool_t *)(uintptr_t)sorted_pool; list_descs = pool->list_descs; for (list_idx = 0; list_idx < pool->next_list_idx; list_idx++) { diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index bcab01b..21be3ef 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -748,7 +748,7 @@ _odp_timer_wheel_t _odp_timer_wheel_create(uint32_t max_concurrent_timers, free_list_add(timer_wheels, max_concurrent_timers / 4); timer_wheels->min_free_list_size = timer_wheels->free_list_size; timer_wheels->peak_free_list_size = timer_wheels->free_list_size; - return (_odp_timer_wheel_t)timer_wheels; + return (_odp_timer_wheel_t)(uintptr_t)timer_wheels; } uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel, @@ -759,7 +759,7 @@ uint32_t _odp_timer_wheel_curr_time_update(_odp_timer_wheel_t timer_wheel, uint32_t desc_idx; int rc; - timer_wheels = (timer_wheels_t *)timer_wheel; + timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; new_current_ticks = current_time >> CYCLES_TO_TICKS_SHIFT; elapsed_ticks = new_current_ticks - timer_wheels->current_ticks; if (elapsed_ticks == 0) @@ -787,13 +787,13 @@ int _odp_timer_wheel_insert(_odp_timer_wheel_t timer_wheel, uint64_t user_data, wakeup_ticks; int rc; - user_data = (uint64_t)user_ptr; + user_data = (uint64_t)(uintptr_t)user_ptr; if (user_data == 0) return -4; /* user_data cannot be 0! */ else if ((user_data & 0x3) != 0) return -5; /* user_data ptr must be at least 4-byte aligned. */ - timer_wheels = (timer_wheels_t *)timer_wheel; + timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; wakeup_ticks = (wakeup_time >> CYCLES_TO_TICKS_SHIFT) + 1; if (wakeup_time <= timer_wheels->current_ticks) return -6; @@ -828,21 +828,21 @@ void *_odp_timer_wheel_next_expired(_odp_timer_wheel_t timer_wheel) int rc; /* Remove the head of the timer wheel. */ - timer_wheels = (timer_wheels_t *)timer_wheel; + timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; rc = expired_timers_remove(timer_wheels, &user_data); if (rc <= 0) return NULL; user_data &= ~0x3; timer_wheels->total_timer_removes++; - return (void *)user_data; + return (void *)(uintptr_t)user_data; } uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel) { timer_wheels_t *timer_wheels; - timer_wheels = (timer_wheels_t *)timer_wheel; + timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; return timer_wheels->total_timer_inserts - timer_wheels->total_timer_removes; } @@ -862,7 +862,7 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) expired_ring_t *expired_ring; uint32_t wheel_idx; - timer_wheels = (timer_wheels_t *)timer_wheel; + timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; expired_ring = timer_wheels->expired_timers_ring; ODP_DBG("_odp_int_timer_wheel_stats current_ticks=%lu\n", @@ -894,7 +894,7 @@ void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel) timer_wheels_t *timer_wheels; expired_ring_t *expired_ring; - timer_wheels = (timer_wheels_t *)timer_wheel; + timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; expired_ring = timer_wheels->expired_timers_ring; /* First free all of the block_of_timer_blks @TODO */ diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 88e0ada..6179568 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -658,7 +658,7 @@ static int tm_delay_pkt(tm_system_t *tm_system, tm_shaper_obj_t *shaper_obj, timer_context = (((uint64_t)tm_queue_obj->timer_seq) << 32) | (((uint64_t)tm_queue_obj->queue_num) << 4); _odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel, - wakeup_time, (void *)timer_context); + wakeup_time, (void *)(uintptr_t)timer_context); tm_queue_obj->timer_reason = UNDELAY_PKT; tm_queue_obj->timer_shaper = shaper_obj; @@ -1680,7 +1680,7 @@ static int tm_process_expired_timers(tm_system_t *tm_system, if (!ptr) return work_done; - timer_context = (uint64_t)ptr; + timer_context = (uint64_t)(uintptr_t)ptr; queue_num = (timer_context & 0xFFFFFFFF) >> 4; timer_seq = timer_context >> 32; tm_queue_obj = tm_system->queue_num_tbl[queue_num];