TSG-14938 TFE支持新控制报文格式; 调整代码结构

This commit is contained in:
wangmenglan
2023-04-28 16:18:32 +08:00
parent 8a7c196c20
commit 8de8ec1c5f
22 changed files with 16372 additions and 1069 deletions

View File

@@ -143,4 +143,23 @@ int tap_get_mtu(const char *eth)
close(sockfd);
return ifr.ifr_mtu;
}
int tap_set_rps(const char *eth, int thread_index, const char *rps_mask)
{
char file[1024] = {0};
snprintf(file, sizeof(file), "/sys/class/net/%s/queues/rx-%d/rps_cpus", eth, thread_index);
FILE *fp = fopen(file, "w");
if (fp == NULL)
{
TFE_LOG_ERROR(g_default_logger, "unable to set rps on %s, file %s, %s", eth, file, strerror(errno));
return -1;
}
fwrite(rps_mask, strlen(rps_mask), 1, fp);
TFE_LOG_DEBUG(g_default_logger, "set rps '%s' to %s", rps_mask, file);
fclose(fp);
return 0;
}