aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/dev/types.h
blob: 24799ac8138e26dbd401899bc5fe1dae1ff67948 (plain)
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
63
64
65
66
67
/* SPDX-License-Identifier: Apache-2.0
 * Copyright (c) 2023 Cisco Systems, Inc.
 */

#ifndef _VNET_DEV_TYPES_H_
#define _VNET_DEV_TYPES_H_

#include <vppinfra/types.h>
#include <vnet/dev/errors.h>

typedef char vnet_dev_device_id_t[48];
typedef char vnet_dev_if_name_t[32];
typedef char vnet_dev_driver_name_t[16];
typedef char vnet_dev_bus_name_t[8];
typedef u16 vnet_dev_port_id_t;
typedef struct vnet_dev vnet_dev_t;
typedef struct vnet_dev_port vnet_dev_port_t;
typedef struct vnet_dev_rx_queue vnet_dev_rx_queue_t;
typedef struct vnet_dev_tx_queue vnet_dev_tx_queue_t;

typedef enum
{
  VNET_DEV_MINUS_OK = 0,
#define _(n, d) VNET_DEV_ERR_MINUS_##n,
  foreach_vnet_dev_rv_type
#undef _
} vnet_dev_minus_rv_t;

typedef enum
{
  VNET_DEV_OK = 0,
#define _(n, d) VNET_DEV_ERR_##n = -(VNET_DEV_ERR_MINUS_##n),
  foreach_vnet_dev_rv_type
#undef _
} vnet_dev_rv_t;

/* do not change bit assignments - API dependency */
#define foreach_vnet_dev_flag _ (0, NO_STATS, "don't poll device stats")

typedef union
{
  enum
  {
#define _(b, n, d) VNET_DEV_F_##n = 1ull << (b),
    foreach_vnet_dev_flag
#undef _
  } e;
  u32 n;
} vnet_dev_flags_t;

/* do not change bit assignments - API dependency */
#define foreach_vnet_dev_port_flag                                            \
  _ (0, INTERRUPT_MODE, "enable interrupt mode")                              \
  _ (1, CONSISTENT_QP, "consistent queue pairs")

typedef union
{
  enum
  {
#define _(b, n, d) VNET_DEV_PORT_F_##n = 1ull << (b),
    foreach_vnet_dev_port_flag
#undef _
  } e;
  u32 n;
} vnet_dev_port_flags_t;

#endif /* _VNET_DEV_TYPES_H_ */