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

Function dump_regs

dpdk/app/proc-info/main.c:1700–1777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1698}
1699
1700static void
1701dump_regs(char *file_prefix)
1702{
1703#define MAX_FILE_NAME_SZ (MAX_LONG_OPT_SZ + 10)
1704 char file_name[MAX_FILE_NAME_SZ];
1705 struct rte_dev_reg_info reg_info;
1706 struct rte_eth_dev_info dev_info;
1707 unsigned char *buf_data;
1708 size_t buf_size;
1709 FILE *fp_regs;
1710 uint16_t i;
1711 int ret;
1712
1713 snprintf(bdr_str, MAX_STRING_LEN, " dump - Port REG");
1714 STATS_BDR_STR(10, bdr_str);
1715
1716 RTE_ETH_FOREACH_DEV(i) {
1717 /* Skip if port is not in mask */
1718 if ((enabled_port_mask & (1ul << i)) == 0)
1719 continue;
1720
1721 snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
1722 STATS_BDR_STR(5, bdr_str);
1723
1724 ret = rte_eth_dev_info_get(i, &dev_info);
1725 if (ret) {
1726 printf("Error getting device info: %d\n", ret);
1727 continue;
1728 }
1729
1730 memset(&reg_info, 0, sizeof(reg_info));
1731 ret = rte_eth_dev_get_reg_info(i, &reg_info);
1732 if (ret) {
1733 printf("Error getting device reg info: %d\n", ret);
1734 continue;
1735 }
1736
1737 buf_size = reg_info.length * reg_info.width;
1738 buf_data = malloc(buf_size);
1739 if (buf_data == NULL) {
1740 printf("Error allocating %zu bytes buffer\n", buf_size);
1741 continue;
1742 }
1743
1744 reg_info.data = buf_data;
1745 reg_info.length = 0;
1746 ret = rte_eth_dev_get_reg_info(i, &reg_info);
1747 if (ret) {
1748 printf("Error getting regs from device: %d\n", ret);
1749 free(buf_data);
1750 continue;
1751 }
1752
1753 snprintf(file_name, MAX_FILE_NAME_SZ, "%s-port%u",
1754 file_prefix, i);
1755 fp_regs = fopen(file_name, "wb");
1756 if (fp_regs == NULL) {
1757 printf("Error during opening '%s' for writing: %s\n",

Callers 1

mainFunction · 0.85

Calls 8

snprintfFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
memsetFunction · 0.85
rte_eth_dev_get_reg_infoFunction · 0.85
mallocFunction · 0.85
rte_dev_nameFunction · 0.85
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected