Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecosystem/ffmpeg_plugin: add pmd type support #528

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions ecosystem/ffmpeg_plugin/kahawai_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ mtl_handle kahawai_init(char* port, char* local_addr, int enc_session_cnt,
param.num_ports = 1;

snprintf(param.port[MTL_PORT_P], MTL_PORT_MAX_LEN, "%s", port);
param.pmd[MTL_PORT_P] = mtl_pmd_by_port_name(param.port[MTL_PORT_P]);

if (NULL == local_addr) {
av_log(NULL, AV_LOG_ERROR, "Invalid local IP address\n");
return NULL;
} else if (sscanf(local_addr, "%hhu.%hhu.%hhu.%hhu", &param.sip_addr[MTL_PORT_P][0],
&param.sip_addr[MTL_PORT_P][1], &param.sip_addr[MTL_PORT_P][2],
&param.sip_addr[MTL_PORT_P][3]) != MTL_IP_ADDR_LEN) {
av_log(NULL, AV_LOG_ERROR, "Failed to parse local IP address: %s\n", local_addr);
return NULL;
if (param.pmd[MTL_PORT_P] == MTL_PMD_DPDK_USER) {
/* check ip for dpdk based pmd */
if (NULL == local_addr) {
av_log(NULL, AV_LOG_ERROR, "Invalid local IP address\n");
return NULL;
} else if (sscanf(local_addr, "%hhu.%hhu.%hhu.%hhu", &param.sip_addr[MTL_PORT_P][0],
&param.sip_addr[MTL_PORT_P][1], &param.sip_addr[MTL_PORT_P][2],
&param.sip_addr[MTL_PORT_P][3]) != MTL_IP_ADDR_LEN) {
av_log(NULL, AV_LOG_ERROR, "Failed to parse local IP address: %s\n", local_addr);
return NULL;
}
}

if (enc_session_cnt > 0) {
Expand Down
3 changes: 2 additions & 1 deletion include/mtl_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ struct mtl_init_params {
* Static(default) or DHCP(please make sure you have a DHCP server inside LAN)
*/
enum mtl_net_proto net_proto[MTL_PORT_MAX];
/** Mandatory. dpdk user pmd(default) or af_xdp */
/** Mandatory. dpdk user pmd(default) or af_xdp. Use mtl_pmd_by_port_name helper to get
* PMD type */
enum mtl_pmd_type pmd[MTL_PORT_MAX];
/**
* Mandatory. Max NIC tx queues requested the lib to support.
Expand Down
4 changes: 4 additions & 0 deletions lib/src/mt_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ int mt_socket_get_numa(const char* if_name) {

fclose(file);
dbg("%s, numa_node %d for %s\n", __func__, numa_node, if_name);
if (SOCKET_ID_ANY == numa_node) {
numa_node = 0;
info("%s, direct soc_id from SOCKET_ID_ANY to 0 for %s\n", __func__, if_name);
}
return numa_node;
}

Expand Down