MCPcopy Create free account
hub / github.com/F-Stack/f-stack / save_dump_file

Function save_dump_file

dpdk/drivers/net/mlx5/mlx5_flow.c:10322–10364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10320}
10321
10322int
10323save_dump_file(const uint8_t *data, uint32_t size,
10324 uint32_t type, uint64_t id, void *arg, FILE *file)
10325{
10326 char line[BUF_SIZE];
10327 uint32_t out = 0;
10328 uint32_t k;
10329 uint32_t actions_num;
10330 struct rte_flow_query_count *count;
10331
10332 memset(line, 0, BUF_SIZE);
10333 switch (type) {
10334 case DR_DUMP_REC_TYPE_PMD_MODIFY_HDR:
10335 actions_num = *(uint32_t *)(arg);
10336 out += snprintf(line + out, BUF_SIZE - out, "%d,0x%" PRIx64 ",%d,",
10337 type, id, actions_num);
10338 break;
10339 case DR_DUMP_REC_TYPE_PMD_PKT_REFORMAT:
10340 out += snprintf(line + out, BUF_SIZE - out, "%d,0x%" PRIx64 ",",
10341 type, id);
10342 break;
10343 case DR_DUMP_REC_TYPE_PMD_COUNTER:
10344 count = (struct rte_flow_query_count *)arg;
10345 fprintf(file,
10346 "%d,0x%" PRIx64 ",%" PRIu64 ",%" PRIu64 "\n",
10347 type, id, count->hits, count->bytes);
10348 return 0;
10349 default:
10350 return -1;
10351 }
10352
10353 for (k = 0; k < size; k++) {
10354 /* Make sure we do not overrun the line buffer length. */
10355 if (out >= BUF_SIZE - 4) {
10356 line[out] = '\0';
10357 break;
10358 }
10359 out += snprintf(line + out, BUF_SIZE - out, "%02x",
10360 (data[k]) & 0xff);
10361 }
10362 fprintf(file, "%s\n", line);
10363 return 0;
10364}
10365
10366int
10367mlx5_flow_query_counter(struct rte_eth_dev *dev, struct rte_flow *flow,

Callers 2

mlx5_flow_dev_dump_ipoolFunction · 0.85

Calls 2

memsetFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected