MCPcopy Index your code
hub / github.com/F-Stack/f-stack / eth_dev_offload_names

Function eth_dev_offload_names

dpdk/lib/ethdev/rte_ethdev.c:1095–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1093}
1094
1095static char *
1096eth_dev_offload_names(uint64_t bitmask, char *buf, size_t size,
1097 const char *(*offload_name)(uint64_t))
1098{
1099 unsigned int pos = 0;
1100 int ret;
1101
1102 /* There should be at least enough space to handle those cases */
1103 RTE_ASSERT(size >= sizeof("none") && size >= sizeof("..."));
1104
1105 if (bitmask == 0) {
1106 ret = snprintf(&buf[pos], size - pos, "none");
1107 if (ret < 0 || pos + ret >= size)
1108 ret = 0;
1109 pos += ret;
1110 goto out;
1111 }
1112
1113 while (bitmask != 0) {
1114 uint64_t offload = RTE_BIT64(rte_ctz64(bitmask));
1115 const char *name = offload_name(offload);
1116
1117 ret = snprintf(&buf[pos], size - pos, "%s,", name);
1118 if (ret < 0 || pos + ret >= size) {
1119 if (pos + sizeof("...") >= size)
1120 pos = size - sizeof("...");
1121 ret = snprintf(&buf[pos], size - pos, "...");
1122 if (ret > 0 && pos + ret < size)
1123 pos += ret;
1124 goto out;
1125 }
1126
1127 pos += ret;
1128 bitmask &= ~offload;
1129 }
1130
1131 /* Eliminate trailing comma */
1132 pos--;
1133out:
1134 buf[pos] = '\0';
1135 return buf;
1136}
1137
1138const char *
1139rte_eth_dev_capability_name(uint64_t capability)

Callers 1

rte_eth_dev_configureFunction · 0.85

Calls 2

snprintfFunction · 0.85
rte_ctz64Function · 0.85

Tested by

no test coverage detected