Skip to content

Commit 91c1420

Browse files
nicolas-chautrumcoquelin
authored andcommitted
bbdev: add new function to dump debug information
This provides a new API to dump more debug information related to the status on a given bbdev queue. Some of this information is visible at bbdev level. This also provides a new option dev op, to print more information at the lower PMD level. This helps user to troubleshoot issues related to previous operations provided into a queue causing possible hard-to-debug negative scenarios. Signed-off-by: Nicolas Chautru <[email protected]> Acked-by: Hemant Agrawal <[email protected]> Reviewed-by: Maxime Coquelin <[email protected]>
1 parent de6e472 commit 91c1420

File tree

4 files changed

+278
-1
lines changed

4 files changed

+278
-1
lines changed

lib/bbdev/rte_bbdev.c

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,3 +1190,216 @@ rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
11901190
rte_bbdev_log(ERR, "Invalid enqueue status");
11911191
return NULL;
11921192
}
1193+
1194+
1195+
int
1196+
rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_id, FILE *f)
1197+
{
1198+
struct rte_bbdev_queue_data *q_data;
1199+
struct rte_bbdev_stats *stats;
1200+
uint16_t i;
1201+
struct rte_bbdev *dev = get_dev(dev_id);
1202+
1203+
VALID_DEV_OR_RET_ERR(dev, dev_id);
1204+
VALID_QUEUE_OR_RET_ERR(queue_id, dev);
1205+
VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
1206+
VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_ops_dump, dev_id);
1207+
1208+
q_data = &dev->data->queues[queue_id];
1209+
1210+
if (f == NULL)
1211+
return -EINVAL;
1212+
1213+
fprintf(f, "Dump of operations on %s queue %d\n",
1214+
dev->data->name, queue_id);
1215+
fprintf(f, " Last Enqueue Status %s\n",
1216+
rte_bbdev_enqueue_status_str(q_data->enqueue_status));
1217+
for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++)
1218+
if (q_data->queue_stats.enqueue_status_count[i] > 0)
1219+
fprintf(f, " Enqueue Status Counters %s %" PRIu64 "\n",
1220+
rte_bbdev_enqueue_status_str(i),
1221+
q_data->queue_stats.enqueue_status_count[i]);
1222+
stats = &dev->data->queues[queue_id].queue_stats;
1223+
1224+
fprintf(f, " Enqueue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
1225+
stats->enqueued_count, stats->enqueue_warn_count,
1226+
stats->enqueue_err_count);
1227+
fprintf(f, " Dequeue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
1228+
stats->dequeued_count, stats->dequeue_warn_count,
1229+
stats->dequeue_err_count);
1230+
1231+
return dev->dev_ops->queue_ops_dump(dev, queue_id, f);
1232+
}
1233+
1234+
char *
1235+
rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len)
1236+
{
1237+
static char partial[1024];
1238+
struct rte_bbdev_dec_op *op_dec;
1239+
struct rte_bbdev_enc_op *op_enc;
1240+
struct rte_bbdev_fft_op *op_fft;
1241+
struct rte_bbdev_mldts_op *op_mldts;
1242+
1243+
rte_iova_t add0 = 0, add1 = 0, add2 = 0, add3 = 0, add4 = 0;
1244+
1245+
if (op == NULL) {
1246+
snprintf(str, len, "Invalid Operation pointer\n");
1247+
return str;
1248+
}
1249+
1250+
if (op_type == RTE_BBDEV_OP_LDPC_DEC) {
1251+
op_dec = op;
1252+
if (op_dec->ldpc_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1253+
snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
1254+
op_dec->ldpc_dec.tb_params.c,
1255+
op_dec->ldpc_dec.tb_params.cab,
1256+
op_dec->ldpc_dec.tb_params.ea,
1257+
op_dec->ldpc_dec.tb_params.eb,
1258+
op_dec->ldpc_dec.tb_params.r);
1259+
else
1260+
snprintf(partial, sizeof(partial), "E %d", op_dec->ldpc_dec.cb_params.e);
1261+
if (op_dec->ldpc_dec.input.data != NULL)
1262+
add0 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.input.data, 0);
1263+
if (op_dec->ldpc_dec.hard_output.data != NULL)
1264+
add1 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.hard_output.data, 0);
1265+
if (op_dec->ldpc_dec.soft_output.data != NULL)
1266+
add2 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.soft_output.data, 0);
1267+
if (op_dec->ldpc_dec.harq_combined_input.data != NULL)
1268+
add3 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_input.data,
1269+
0);
1270+
if (op_dec->ldpc_dec.harq_combined_output.data != NULL)
1271+
add4 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_output.data,
1272+
0);
1273+
snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d qm %d F %d Rv %d It %d It %d "
1274+
"HARQin %d in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " hi %" PRIx64 " "
1275+
"ho %" PRIx64 " %s\n",
1276+
op_dec->ldpc_dec.op_flags, op_dec->status,
1277+
op_dec->ldpc_dec.basegraph, op_dec->ldpc_dec.z_c,
1278+
op_dec->ldpc_dec.n_cb, op_dec->ldpc_dec.q_m,
1279+
op_dec->ldpc_dec.n_filler, op_dec->ldpc_dec.rv_index,
1280+
op_dec->ldpc_dec.iter_max, op_dec->ldpc_dec.iter_count,
1281+
op_dec->ldpc_dec.harq_combined_input.length,
1282+
add0, add1, add2, add3, add4, partial);
1283+
} else if (op_type == RTE_BBDEV_OP_TURBO_DEC) {
1284+
op_dec = op;
1285+
if (op_dec->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1286+
snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d K %d",
1287+
op_dec->turbo_dec.tb_params.c,
1288+
op_dec->turbo_dec.tb_params.cab,
1289+
op_dec->turbo_dec.tb_params.ea,
1290+
op_dec->turbo_dec.tb_params.eb,
1291+
op_dec->turbo_dec.tb_params.r,
1292+
op_dec->turbo_dec.tb_params.k_neg);
1293+
else
1294+
snprintf(partial, sizeof(partial), "E %d K %d",
1295+
op_dec->turbo_dec.cb_params.e,
1296+
op_dec->turbo_dec.cb_params.k);
1297+
if (op_dec->turbo_dec.input.data != NULL)
1298+
add0 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.input.data, 0);
1299+
if (op_dec->turbo_dec.hard_output.data != NULL)
1300+
add1 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.hard_output.data, 0);
1301+
if (op_dec->turbo_dec.soft_output.data != NULL)
1302+
add2 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.soft_output.data, 0);
1303+
snprintf(str, len, "op %x st %x CBM %d Iter %d map %d Rv %d ext %d "
1304+
"in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " %s\n",
1305+
op_dec->turbo_dec.op_flags, op_dec->status,
1306+
op_dec->turbo_dec.code_block_mode,
1307+
op_dec->turbo_dec.iter_max, op_dec->turbo_dec.num_maps,
1308+
op_dec->turbo_dec.rv_index, op_dec->turbo_dec.ext_scale,
1309+
add0, add1, add2, partial);
1310+
} else if (op_type == RTE_BBDEV_OP_LDPC_ENC) {
1311+
op_enc = op;
1312+
if (op_enc->ldpc_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1313+
snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
1314+
op_enc->ldpc_enc.tb_params.c,
1315+
op_enc->ldpc_enc.tb_params.cab,
1316+
op_enc->ldpc_enc.tb_params.ea,
1317+
op_enc->ldpc_enc.tb_params.eb,
1318+
op_enc->ldpc_enc.tb_params.r);
1319+
else
1320+
snprintf(partial, sizeof(partial), "E %d",
1321+
op_enc->ldpc_enc.cb_params.e);
1322+
if (op_enc->ldpc_enc.input.data != NULL)
1323+
add0 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.input.data, 0);
1324+
if (op_enc->ldpc_enc.output.data != NULL)
1325+
add1 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.output.data, 0);
1326+
snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d q_m %d F %d Rv %d "
1327+
"in %" PRIx64 " out %" PRIx64 " %s\n",
1328+
op_enc->ldpc_enc.op_flags, op_enc->status,
1329+
op_enc->ldpc_enc.basegraph, op_enc->ldpc_enc.z_c,
1330+
op_enc->ldpc_enc.n_cb, op_enc->ldpc_enc.q_m,
1331+
op_enc->ldpc_enc.n_filler, op_enc->ldpc_enc.rv_index,
1332+
add0, add1, partial);
1333+
} else if (op_type == RTE_BBDEV_OP_TURBO_ENC) {
1334+
op_enc = op;
1335+
if (op_enc->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
1336+
snprintf(partial, sizeof(partial),
1337+
"C %d Cab %d Ea %d Eb %d r %d K %d Ncb %d",
1338+
op_enc->turbo_enc.tb_params.c,
1339+
op_enc->turbo_enc.tb_params.cab,
1340+
op_enc->turbo_enc.tb_params.ea,
1341+
op_enc->turbo_enc.tb_params.eb,
1342+
op_enc->turbo_enc.tb_params.r,
1343+
op_enc->turbo_enc.tb_params.k_neg,
1344+
op_enc->turbo_enc.tb_params.ncb_neg);
1345+
else
1346+
snprintf(partial, sizeof(partial), "E %d K %d",
1347+
op_enc->turbo_enc.cb_params.e,
1348+
op_enc->turbo_enc.cb_params.k);
1349+
if (op_enc->turbo_enc.input.data != NULL)
1350+
add0 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.input.data, 0);
1351+
if (op_enc->turbo_enc.output.data != NULL)
1352+
add1 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.output.data, 0);
1353+
snprintf(str, len, "op %x st %x CBM %d Rv %d In %" PRIx64 " Out %" PRIx64 " %s\n",
1354+
op_enc->turbo_enc.op_flags, op_enc->status,
1355+
op_enc->turbo_enc.code_block_mode, op_enc->turbo_enc.rv_index,
1356+
add0, add1, partial);
1357+
} else if (op_type == RTE_BBDEV_OP_FFT) {
1358+
op_fft = op;
1359+
if (op_fft->fft.base_input.data != NULL)
1360+
add0 = rte_pktmbuf_iova_offset(op_fft->fft.base_input.data, 0);
1361+
if (op_fft->fft.base_output.data != NULL)
1362+
add1 = rte_pktmbuf_iova_offset(op_fft->fft.base_output.data, 0);
1363+
if (op_fft->fft.dewindowing_input.data != NULL)
1364+
add2 = rte_pktmbuf_iova_offset(op_fft->fft.dewindowing_input.data, 0);
1365+
if (op_fft->fft.power_meas_output.data != NULL)
1366+
add3 = rte_pktmbuf_iova_offset(op_fft->fft.power_meas_output.data, 0);
1367+
snprintf(str, len, "op %x st %x in %d inl %d out %d outl %d cs %x ants %d "
1368+
"idft %d dft %d cst %d ish %d dsh %d ncs %d pwsh %d fp16 %d fr %d "
1369+
"outde %d in %" PRIx64 " out %" PRIx64 " dw %" PRIx64 " "
1370+
"pm %" PRIx64 "\n",
1371+
op_fft->fft.op_flags, op_fft->status,
1372+
op_fft->fft.input_sequence_size, op_fft->fft.input_leading_padding,
1373+
op_fft->fft.output_sequence_size,
1374+
op_fft->fft.output_leading_depadding,
1375+
op_fft->fft.cs_bitmap, op_fft->fft.num_antennas_log2,
1376+
op_fft->fft.idft_log2, op_fft->fft.dft_log2,
1377+
op_fft->fft.cs_time_adjustment,
1378+
op_fft->fft.idft_shift, op_fft->fft.dft_shift,
1379+
op_fft->fft.ncs_reciprocal, op_fft->fft.power_shift,
1380+
op_fft->fft.fp16_exp_adjust, op_fft->fft.freq_resample_mode,
1381+
op_fft->fft.output_depadded_size, add0, add1, add2, add3);
1382+
} else if (op_type == RTE_BBDEV_OP_MLDTS) {
1383+
op_mldts = op;
1384+
if (op_mldts->mldts.qhy_input.data != NULL)
1385+
add0 = rte_pktmbuf_iova_offset(op_mldts->mldts.qhy_input.data, 0);
1386+
if (op_mldts->mldts.r_input.data != NULL)
1387+
add1 = rte_pktmbuf_iova_offset(op_mldts->mldts.r_input.data, 0);
1388+
if (op_mldts->mldts.output.data != NULL)
1389+
add2 = rte_pktmbuf_iova_offset(op_mldts->mldts.output.data, 0);
1390+
snprintf(str, len,
1391+
"op %x st %x rbs %d lay %d rrep %d crep%d qm %d %d %d %d "
1392+
"qhy %" PRIx64 " r %" PRIx64 " out %" PRIx64 "\n",
1393+
op_mldts->mldts.op_flags, op_mldts->status,
1394+
op_mldts->mldts.num_rbs, op_mldts->mldts.num_layers,
1395+
op_mldts->mldts.r_rep, op_mldts->mldts.c_rep,
1396+
op_mldts->mldts.q_m[0], op_mldts->mldts.q_m[1],
1397+
op_mldts->mldts.q_m[2], op_mldts->mldts.q_m[3],
1398+
add0, add1, add2);
1399+
1400+
} else {
1401+
snprintf(str, len, "Invalid Operation type %d\n", op_type);
1402+
}
1403+
1404+
return str;
1405+
}

lib/bbdev/rte_bbdev.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,53 @@ rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
10621062
const char*
10631063
rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status);
10641064

1065+
/**
1066+
* Dump operations info from device to a file.
1067+
* This API is used for debugging provided input operations, not a dataplane API.
1068+
*
1069+
* @param dev_id
1070+
* The device identifier.
1071+
*
1072+
* @param queue_index
1073+
* Index of queue.
1074+
*
1075+
* @param file
1076+
* A pointer to a file for output.
1077+
*
1078+
* @returns
1079+
* - 0 on success
1080+
* - ENOTSUP if interrupts are not supported by the identified device
1081+
* - negative value on failure - as returned from PMD
1082+
*
1083+
*/
1084+
__rte_experimental
1085+
int
1086+
rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_index, FILE *file);
1087+
1088+
1089+
/**
1090+
* String of parameters related to the parameters of an operation of a given type.
1091+
*
1092+
* @param op
1093+
* Pointer to an operation.
1094+
*
1095+
* @param op_type
1096+
* Operation type enum.
1097+
*
1098+
* @param str
1099+
* String being describing the operations.
1100+
*
1101+
* @param len
1102+
* Size of the string buffer.
1103+
*
1104+
* @returns
1105+
* String describing the provided operation.
1106+
*
1107+
*/
1108+
__rte_experimental
1109+
char *
1110+
rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len);
1111+
10651112
#ifdef __cplusplus
10661113
}
10671114
#endif

lib/bbdev/rte_bbdev_pmd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ typedef int (*rte_bbdev_queue_intr_enable_t)(struct rte_bbdev *dev,
133133
typedef int (*rte_bbdev_queue_intr_disable_t)(struct rte_bbdev *dev,
134134
uint16_t queue_id);
135135

136+
/*
137+
* @internal
138+
* Function to dump previous operations on a queue of a device.
139+
*/
140+
typedef int (*rte_bbdev_queue_ops_dump_t)(struct rte_bbdev *dev,
141+
uint16_t queue_id, FILE *file);
142+
136143
/**
137144
* Operations implemented by drivers. Fields marked as "Required" must be
138145
* provided by a driver for a device to have basic functionality. "Optional"
@@ -170,6 +177,8 @@ struct rte_bbdev_ops {
170177
rte_bbdev_queue_intr_enable_t queue_intr_enable;
171178
/** Disable queue interrupt. Optional */
172179
rte_bbdev_queue_intr_disable_t queue_intr_disable;
180+
/** Dump operations on the queue. Optional */
181+
rte_bbdev_queue_ops_dump_t queue_ops_dump;
173182
};
174183

175184
/**

lib/bbdev/version.map

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,12 @@ DPDK_25 {
3232
rte_bbdev_stop;
3333

3434
local: *;
35-
};
35+
};
36+
37+
EXPERIMENTAL {
38+
global:
39+
40+
# added in 24.11
41+
rte_bbdev_queue_ops_dump;
42+
rte_bbdev_ops_param_string;
43+
};

0 commit comments

Comments
 (0)