1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2013-2018 Linaro Limited
* Copyright (c) 2021-2022 Nokia
*/
#include <odp/api/align.h>
#include <odp/api/buffer.h>
#include <odp/api/plat/buffer_inline_types.h>
#include <odp_buffer_internal.h>
#include <odp_debug_internal.h>
#include <odp_pool_internal.h>
#include <odp_string_internal.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#include <odp/visibility_begin.h>
/* Buffer header field offsets for inline functions */
const _odp_buffer_inline_offset_t _odp_buffer_inline_offset ODP_ALIGNED_CACHE = {
.uarea_addr = offsetof(odp_buffer_hdr_t, uarea_addr)
};
#include <odp/visibility_end.h>
void odp_buffer_print(odp_buffer_t buf)
{
odp_buffer_hdr_t *hdr;
pool_t *pool;
int len = 0;
int max_len = 512;
int n = max_len - 1;
char str[max_len];
if (!odp_buffer_is_valid(buf)) {
_ODP_ERR("Buffer is not valid.\n");
return;
}
hdr = _odp_buf_hdr(buf);
pool = _odp_pool_entry(hdr->event_hdr.pool);
len += _odp_snprint(&str[len], n - len, "Buffer\n------\n");
len += _odp_snprint(&str[len], n - len, " handle 0x%" PRIx64 "\n",
odp_buffer_to_u64(buf));
len += _odp_snprint(&str[len], n - len, " pool index %u\n", pool->pool_idx);
len += _odp_snprint(&str[len], n - len, " buffer index %u\n", hdr->event_hdr.index);
len += _odp_snprint(&str[len], n - len, " addr %p\n", odp_buffer_addr(buf));
len += _odp_snprint(&str[len], n - len, " size %u\n", odp_buffer_size(buf));
len += _odp_snprint(&str[len], n - len, " user area %p\n", hdr->uarea_addr);
str[len] = 0;
_ODP_PRINT("%s\n", str);
}
uint64_t odp_buffer_to_u64(odp_buffer_t hdl)
{
return _odp_pri(hdl);
}
|