File: roc_utils.c

package info (click to toggle)
dpdk 25.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 127,892 kB
  • sloc: ansic: 2,358,479; python: 16,426; sh: 4,474; makefile: 1,713; awk: 70
file content (264 lines) | stat: -rw-r--r-- 6,407 bytes parent folder | download | duplicates (2)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(C) 2021 Marvell.
 */

#include "roc_api.h"
#include "roc_priv.h"

const char *
roc_error_msg_get(int errorcode)
{
	const char *err_msg;

	switch (errorcode) {
	case NIX_AF_ERR_PARAM:
	case NIX_ERR_PARAM:
	case NPA_ERR_PARAM:
	case NPC_ERR_PARAM:
	case SSO_ERR_PARAM:
	case MCS_ERR_PARAM:
	case RVU_ERR_PARAM:
	case UTIL_ERR_PARAM:
		err_msg = "Invalid parameter";
		break;
	case NIX_ERR_NO_MEM:
	case NPC_ERR_NO_MEM:
	case RVU_ERR_NO_MEM:
		err_msg = "Out of memory";
		break;
	case NIX_ERR_INVALID_RANGE:
	case NPC_ERR_INVALID_RANGE:
		err_msg = "Range is not supported";
		break;
	case NIX_ERR_INTERNAL:
	case NPC_ERR_INTERNAL:
		err_msg = "Internal error";
		break;
	case NIX_ERR_OP_NOTSUP:
		err_msg = "Operation not supported";
		break;
	case NIX_ERR_HW_NOTSUP:
	case MCS_ERR_HW_NOTSUP:
		err_msg = "Hardware does not support";
		break;
	case NIX_ERR_QUEUE_INVALID_RANGE:
		err_msg = "Invalid Queue range";
		break;
	case NIX_ERR_AQ_READ_FAILED:
		err_msg = "AQ read failed";
		break;
	case NIX_ERR_AQ_WRITE_FAILED:
		err_msg = "AQ write failed";
		break;
	case NIX_ERR_TM_LEAF_NODE_GET:
		err_msg = "TM leaf node get failed";
		break;
	case NIX_ERR_TM_INVALID_LVL:
		err_msg = "TM node level invalid";
		break;
	case NIX_ERR_TM_INVALID_PRIO:
		err_msg = "TM node priority invalid";
		break;
	case NIX_ERR_TM_INVALID_PARENT:
		err_msg = "TM parent id invalid";
		break;
	case NIX_ERR_TM_NODE_EXISTS:
		err_msg = "TM Node Exists";
		break;
	case NIX_ERR_TM_INVALID_NODE:
		err_msg = "TM node id invalid";
		break;
	case NIX_ERR_TM_INVALID_SHAPER_PROFILE:
		err_msg = "TM shaper profile invalid";
		break;
	case NIX_ERR_TM_PKT_MODE_MISMATCH:
		err_msg = "shaper profile pkt mode mismatch";
		break;
	case NIX_ERR_TM_WEIGHT_EXCEED:
		err_msg = "TM DWRR weight exceeded";
		break;
	case NIX_ERR_TM_CHILD_EXISTS:
		err_msg = "TM node children exists";
		break;
	case NIX_ERR_TM_INVALID_PEAK_SZ:
		err_msg = "TM peak size invalid";
		break;
	case NIX_ERR_TM_INVALID_PEAK_RATE:
		err_msg = "TM peak rate invalid";
		break;
	case NIX_ERR_TM_INVALID_COMMIT_SZ:
		err_msg = "TM commit size invalid";
		break;
	case NIX_ERR_TM_INVALID_COMMIT_RATE:
		err_msg = "TM commit rate invalid";
		break;
	case NIX_ERR_TM_SHAPER_PROFILE_IN_USE:
		err_msg = "TM shaper profile in use";
		break;
	case NIX_ERR_TM_SHAPER_PROFILE_EXISTS:
		err_msg = "TM shaper profile exists";
		break;
	case NIX_ERR_TM_SHAPER_PKT_LEN_ADJUST:
		err_msg = "length adjust invalid";
		break;
	case NIX_ERR_TM_INVALID_TREE:
		err_msg = "TM tree invalid";
		break;
	case NIX_ERR_TM_PARENT_PRIO_UPDATE:
		err_msg = "TM node parent and prio update failed";
		break;
	case NIX_ERR_TM_PRIO_EXCEEDED:
		err_msg = "TM node priority exceeded";
		break;
	case NIX_ERR_TM_PRIO_ORDER:
		err_msg = "TM node priority not in order";
		break;
	case NIX_ERR_TM_MULTIPLE_RR_GROUPS:
		err_msg = "TM multiple rr groups";
		break;
	case NIX_ERR_TM_SQ_UPDATE_FAIL:
		err_msg = "TM SQ update failed";
		break;
	case NIX_ERR_NDC_SYNC:
		err_msg = "NDC Sync failed";
		break;
	case NPC_ERR_INVALID_SPEC:
		err_msg = "NPC invalid spec";
		break;
	case NPC_ERR_INVALID_MASK:
		err_msg = "NPC invalid mask";
		break;
	case NPC_ERR_INVALID_KEX:
		err_msg = "NPC invalid key";
		break;
	case NPC_ERR_INVALID_SIZE:
		err_msg = "NPC invalid key size";
		break;
	case NPC_ERR_ACTION_NOTSUP:
		err_msg = "NPC action not supported";
		break;
	case NPC_ERR_PATTERN_NOTSUP:
		err_msg = "NPC pattern not supported";
		break;
	case NPC_ERR_MCAM_ALLOC:
		err_msg = "MCAM entry alloc failed";
		break;
	case NPA_ERR_ALLOC:
		err_msg = "NPA alloc failed";
		break;
	case NPA_ERR_INVALID_BLOCK_SZ:
		err_msg = "NPA invalid block size";
		break;
	case NPA_ERR_AURA_ID_ALLOC:
		err_msg = "NPA aura id alloc failed";
		break;
	case NPA_ERR_AURA_POOL_INIT:
		err_msg = "NPA aura pool init failed";
		break;
	case NPA_ERR_AURA_POOL_FINI:
		err_msg = "NPA aura pool fini failed";
		break;
	case NPA_ERR_BASE_INVALID:
		err_msg = "NPA invalid base";
		break;
	case NPA_ERR_DEVICE_NOT_BOUNDED:
		err_msg = "NPA device is not bounded";
		break;
	case NIX_AF_ERR_AQ_FULL:
		err_msg = "AQ full";
		break;
	case NIX_AF_ERR_AQ_ENQUEUE:
		err_msg = "AQ enqueue failed";
		break;
	case NIX_AF_ERR_AF_LF_INVALID:
		err_msg = "Invalid NIX LF";
		break;
	case NIX_AF_ERR_AF_LF_ALLOC:
		err_msg = "NIX LF alloc failed";
		break;
	case NIX_AF_ERR_TLX_INVALID:
		err_msg = "Invalid NIX TLX";
		break;
	case NIX_AF_ERR_TLX_ALLOC_FAIL:
		err_msg = "NIX TLX alloc failed";
		break;
	case NIX_AF_ERR_RSS_SIZE_INVALID:
		err_msg = "Invalid RSS size";
		break;
	case NIX_AF_ERR_RSS_GRPS_INVALID:
		err_msg = "Invalid RSS groups";
		break;
	case NIX_AF_ERR_FRS_INVALID:
		err_msg = "Invalid frame size";
		break;
	case NIX_AF_ERR_RX_LINK_INVALID:
		err_msg = "Invalid Rx link";
		break;
	case NIX_AF_INVAL_TXSCHQ_CFG:
		err_msg = "Invalid Tx scheduling config";
		break;
	case NIX_AF_SMQ_FLUSH_FAILED:
		err_msg = "SMQ flush failed";
		break;
	case NIX_AF_ERR_LF_RESET:
		err_msg = "NIX LF reset failed";
		break;
	case NIX_AF_ERR_MARK_CFG_FAIL:
		err_msg = "Marking config failed";
		break;
	case NIX_AF_ERR_LSO_CFG_FAIL:
		err_msg = "LSO config failed";
		break;
	case NIX_AF_INVAL_NPA_PF_FUNC:
		err_msg = "Invalid NPA pf_func";
		break;
	case NIX_AF_INVAL_SSO_PF_FUNC:
		err_msg = "Invalid SSO pf_func";
		break;
	case NIX_AF_ERR_TX_VTAG_NOSPC:
		err_msg = "No space for Tx VTAG";
		break;
	case NIX_AF_ERR_RX_VTAG_INUSE:
		err_msg = "Rx VTAG is in use";
		break;
	case NIX_AF_ERR_PTP_CONFIG_FAIL:
		err_msg = "PTP config failed";
		break;
	case SSO_ERR_DEVICE_NOT_BOUNDED:
		err_msg = "SSO pf/vf not found";
		break;
	case MCS_ERR_DEVICE_NOT_FOUND:
		err_msg = "MCS device not found";
		break;
	case UTIL_ERR_FS:
		err_msg = "file operation failed";
		break;
	case UTIL_ERR_INVALID_MODEL:
		err_msg = "Invalid RoC model";
		break;
	case NIX_AF_ERR_RSS_NOSPC_FIELD:
		err_msg = "No space or unsupported fields";
		break;
	case NIX_AF_ERR_RSS_NOSPC_ALGO:
		err_msg = "No space to add new flow hash algo";
		break;
	default:
		/**
		 * Handle general error (as defined in linux errno.h)
		 */
		if (abs(errorcode) < 300)
			err_msg = strerror(abs(errorcode));
		else
			err_msg = "Unknown error code";
		break;
	}

	return err_msg;
}

void
roc_clk_freq_get(uint16_t *rclk_freq, uint16_t *sclk_freq)
{
	*rclk_freq = dev_rclk_freq;
	*sclk_freq = dev_sclk_freq;
}