octeon: native driver for Marvell Octeon SoC
[vpp.git] / src / plugins / dev_octeon / common.h
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright (c) 2023 Cisco Systems, Inc.
3  */
4
5 #ifndef _OCT_COMMON_H_
6 #define _OCT_COMMON_H_
7
8 #include <vppinfra/clib.h>
9 #include <vppinfra/format.h>
10 #include <vnet/vnet.h>
11 #include <vnet/dev/dev.h>
12 #include <base/roc_api.h>
13
14 static_always_inline u32
15 oct_aura_free_all_buffers (vlib_main_t *vm, u64 aura_handle, u16 hdr_off)
16 {
17   u32 n = 0;
18   u64 iova;
19
20   while ((iova = roc_npa_aura_op_alloc (aura_handle, 0)))
21     {
22       vlib_buffer_t *b = (void *) iova + hdr_off;
23       vlib_buffer_free_one (vm, vlib_get_buffer_index (vm, b));
24       n++;
25     }
26   return n;
27 }
28
29 #endif /* _OCT_COMMON_H_ */