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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/* SPDX-License-Identifier: Apache-2.0
* Copyright (c) 2023 Cisco Systems, Inc.
*/
#ifndef _PP2_H_
#define _PP2_H_
#include <vppinfra/clib.h>
#include <vppinfra/error_bootstrap.h>
#include <vppinfra/format.h>
#include <vnet/vnet.h>
#include <vnet/dev/dev.h>
#define MVCONF_DBG_LEVEL 0
#define MVCONF_PP2_BPOOL_COOKIE_SIZE 32
#define MVCONF_PP2_BPOOL_DMA_ADDR_SIZE 64
#define MVCONF_DMA_PHYS_ADDR_T_SIZE 64
#define MVCONF_SYS_DMA_UIO
#define MVCONF_TYPES_PUBLIC
#define MVCONF_DMA_PHYS_ADDR_T_PUBLIC
#include "mv_std.h"
#include "env/mv_sys_dma.h"
#include "drivers/mv_pp2.h"
#include <drivers/mv_pp2_bpool.h>
#include <drivers/mv_pp2_ppio.h>
#define MVPP2_NUM_HIFS 9
#define MVPP2_NUM_BPOOLS 16
#define MVPP2_MAX_THREADS 4
#define MRVL_PP2_BUFF_BATCH_SZ 32
typedef struct
{
u8 pp_id;
struct pp2_hif *hif[MVPP2_NUM_HIFS];
struct
{
struct pp2_bpool *bpool;
struct buff_release_entry bre[MRVL_PP2_BUFF_BATCH_SZ];
} thread[MVPP2_NUM_BPOOLS];
} mvpp2_device_t;
typedef struct
{
u8 is_enabled : 1;
u8 is_dsa : 1;
struct pp2_ppio *ppio;
u8 ppio_id;
struct pp2_ppio_link_info last_link_info;
} mvpp2_port_t;
typedef struct
{
u16 next;
u16 n_enq;
u32 *buffers;
} mvpp2_txq_t;
typedef struct
{
} mvpp2_rxq_t;
typedef struct
{
struct pp2_ppio_desc desc;
vnet_dev_rx_queue_t *rxq;
} mvpp2_rx_trace_t;
/* counters.c */
void mvpp2_port_add_counters (vlib_main_t *, vnet_dev_port_t *);
void mvpp2_port_clear_counters (vlib_main_t *, vnet_dev_port_t *);
void mvpp2_rxq_clear_counters (vlib_main_t *, vnet_dev_rx_queue_t *);
void mvpp2_txq_clear_counters (vlib_main_t *, vnet_dev_tx_queue_t *);
vnet_dev_rv_t mvpp2_port_get_stats (vlib_main_t *, vnet_dev_port_t *);
/* format.c */
format_function_t format_pp2_ppio_link_info;
format_function_t format_mvpp2_port_status;
format_function_t format_mvpp2_dev_info;
format_function_t format_mvpp2_rx_trace;
format_function_t format_mvpp2_rx_desc;
/* port.c */
vnet_dev_port_op_t mvpp2_port_init;
vnet_dev_port_op_no_rv_t mvpp2_port_deinit;
vnet_dev_port_op_t mvpp2_port_start;
vnet_dev_port_op_no_rv_t mvpp2_port_stop;
vnet_dev_rv_t mvpp2_port_cfg_change (vlib_main_t *, vnet_dev_port_t *,
vnet_dev_port_cfg_change_req_t *);
vnet_dev_rv_t
mvpp2_port_cfg_change_validate (vlib_main_t *, vnet_dev_port_t *,
vnet_dev_port_cfg_change_req_t *);
/* queue.c */
vnet_dev_tx_queue_op_t mvpp2_txq_alloc;
vnet_dev_tx_queue_op_no_rv_t mvpp2_txq_free;
/* inline funcs */
#define log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, mvpp2_log.class, "%U" f, \
format_vnet_dev_log, (dev), \
clib_string_skip_prefix (__func__, "mvpp2_"), ##__VA_ARGS__)
#define log_info(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_INFO, mvpp2_log.class, "%U" f, \
format_vnet_dev_log, (dev), 0, ##__VA_ARGS__)
#define log_notice(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_NOTICE, mvpp2_log.class, "%U" f, \
format_vnet_dev_log, (dev), 0, ##__VA_ARGS__)
#define log_warn(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_WARNING, mvpp2_log.class, "%U" f, \
format_vnet_dev_log, (dev), 0, ##__VA_ARGS__)
#define log_err(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_ERR, mvpp2_log.class, "%U" f, format_vnet_dev_log, \
(dev), 0, ##__VA_ARGS__)
#define foreach_mvpp2_tx_node_counter \
_ (NO_FREE_SLOTS, no_free_slots, ERROR, "no free tx slots") \
_ (PPIO_SEND, ppio_semd, ERROR, "pp2_ppio_send errors") \
_ (PPIO_GET_NUM_OUTQ_DONE, ppio_get_num_outq_done, ERROR, \
"pp2_ppio_get_num_outq_done errors")
typedef enum
{
#define _(f, n, s, d) MVPP2_TX_NODE_CTR_##f,
foreach_mvpp2_tx_node_counter
#undef _
} mvpp2_tx_node_counter_t;
#define foreach_mvpp2_rx_node_counter \
_ (PPIO_RECV, ppio_recv, ERROR, "pp2_ppio_recv error") \
_ (BPOOL_GET_NUM_BUFFS, bpool_get_num_bufs, ERROR, \
"pp2_bpool_get_num_buffs error") \
_ (BPOOL_PUT_BUFFS, bpool_put_buffs, ERROR, "pp2_bpool_put_buffs error") \
_ (BUFFER_ALLOC, buffer_alloc, ERROR, "buffer alloc error") \
_ (MAC_CE, mac_ce, ERROR, "MAC error (CRC error)") \
_ (MAC_OR, mac_or, ERROR, "overrun error") \
_ (MAC_RSVD, mac_rsvd, ERROR, "unknown MAC error") \
_ (MAC_RE, mac_re, ERROR, "resource error") \
_ (IP_HDR, ip_hdr, ERROR, "ip4 header error")
typedef enum
{
#define _(f, n, s, d) MVPP2_RX_NODE_CTR_##f,
foreach_mvpp2_rx_node_counter
#undef _
} mvpp2_rx_node_counter_t;
#endif /* _PP2_H_ */
|