diff --git a/tests/src/st20_test.cpp b/tests/src/st20_test.cpp index 7af3a8bf0..574b96966 100644 --- a/tests/src/st20_test.cpp +++ b/tests/src/st20_test.cpp @@ -902,8 +902,12 @@ static void st20_rx_fps_test(enum st20_type type[], enum st_fps fps[], int width ops_tx.name = "st20_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -968,8 +972,12 @@ static void st20_rx_fps_test(enum st20_type type[], enum st_fps fps[], int width ops_rx.name = "st20_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -1333,6 +1341,9 @@ static void st20_rx_update_src_test(enum st20_type type, int tx_sessions, else if (1 == i) memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], MTL_IP_ADDR_LEN); + else if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); else memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], MTL_IP_ADDR_LEN); @@ -1373,8 +1384,12 @@ static void st20_rx_update_src_test(enum st20_type type, int tx_sessions, ops_rx.name = "st20_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -1861,8 +1876,12 @@ static void st20_rx_digest_test(enum st20_type tx_type[], enum st20_type rx_type ops_tx.name = "st20_digest_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); if (hdr_split) @@ -1949,8 +1968,12 @@ static void st20_rx_digest_test(enum st20_type tx_type[], enum st20_type rx_type ops_rx.name = "st20_digest_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); if (hdr_split) @@ -2762,8 +2785,12 @@ static void st20_rx_meta_test(enum st_fps fps[], int width[], int height[], ops_tx.name = "st20_meta_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -2797,8 +2824,12 @@ static void st20_rx_meta_test(enum st_fps fps[], int width[], int height[], ops_rx.name = "st20_meta_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -2936,8 +2967,12 @@ static void st20_rx_after_start_test(enum st20_type type[], enum st_fps fps[], ops_tx.name = "st20_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -2974,8 +3009,12 @@ static void st20_rx_after_start_test(enum st20_type type[], enum st_fps fps[], ops_rx.name = "st20_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3148,8 +3187,12 @@ static void st20_rx_uframe_test(enum st20_type rx_type[], enum st20_packing pack ops_tx.name = "st20_uframe_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3219,8 +3262,12 @@ static void st20_rx_uframe_test(enum st20_type rx_type[], enum st20_packing pack ops_rx.name = "st20_uframe_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3425,8 +3472,12 @@ static void st20_rx_detect_test(enum st20_type tx_type[], enum st20_type rx_type ops_tx.name = "st20_detect_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3510,8 +3561,12 @@ static void st20_rx_detect_test(enum st20_type tx_type[], enum st20_type rx_type ops_rx.name = "st20_detect_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3729,8 +3784,12 @@ static void st20_rx_dump_test(enum st20_type type[], enum st_fps fps[], int widt ops_tx.name = "st20_dump_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3768,8 +3827,12 @@ static void st20_rx_dump_test(enum st20_type type[], enum st_fps fps[], int widt ops_rx.name = "st20_dump_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -3941,8 +4004,12 @@ static void st20_tx_ext_frame_rx_digest_test(enum st20_packing packing[], ops_tx.name = "st20_ext_frame_digest_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -4049,8 +4116,12 @@ static void st20_tx_ext_frame_rx_digest_test(enum st20_packing packing[], ops_rx.name = "st20_ext_frame_digest_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -4278,8 +4349,12 @@ static void st20_tx_user_pacing_test(int width[], int height[], enum st20_fmt fm ops_tx.name = "st20_timestamp_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -4336,8 +4411,12 @@ static void st20_tx_user_pacing_test(int width[], int height[], enum st20_fmt fm ops_rx.name = "st20_timestamp_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -4481,8 +4560,12 @@ static void st20_linesize_digest_test(enum st20_packing packing[], enum st_fps f ops_tx.name = "st20_linesize_digest_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; @@ -4603,8 +4686,12 @@ static void st20_linesize_digest_test(enum st20_packing packing[], enum st_fps f ops_rx.name = "st20_linesize_digest_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 10000 + i * 2; diff --git a/tests/src/st20p_test.cpp b/tests/src/st20p_test.cpp index 33d7206f2..ccf9df88c 100644 --- a/tests/src/st20p_test.cpp +++ b/tests/src/st20p_test.cpp @@ -739,8 +739,12 @@ static void st20p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_tx.name = "st20p_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.port.num_port = 1; - memcpy(ops_tx.port.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.port.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.port.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.port.udp_port[MTL_SESSION_PORT_P] = ST20P_TEST_UDP_PORT + i * 2; @@ -960,8 +964,12 @@ static void st20p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_rx.name = "st20p_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.port.num_port = 1; - memcpy(ops_rx.port.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.port.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.port.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.port.udp_port[MTL_SESSION_PORT_P] = ST20P_TEST_UDP_PORT + i * 2; diff --git a/tests/src/st22_test.cpp b/tests/src/st22_test.cpp index 7225ff92f..43fefa3cd 100644 --- a/tests/src/st22_test.cpp +++ b/tests/src/st22_test.cpp @@ -400,8 +400,12 @@ static void st22_rx_fps_test(enum st22_type type[], enum st_fps fps[], int width ops_tx.name = "st22_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -454,8 +458,12 @@ static void st22_rx_fps_test(enum st22_type type[], enum st_fps fps[], int width ops_rx.name = "st22_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -607,6 +615,9 @@ static void st22_rx_update_src_test(int tx_sessions, enum st_test_level level) { else if (1 == i) memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], MTL_IP_ADDR_LEN); + else if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); else memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], MTL_IP_ADDR_LEN); @@ -656,8 +667,12 @@ static void st22_rx_update_src_test(int tx_sessions, enum st_test_level level) { ops_rx.name = "st22_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -832,8 +847,12 @@ static void st22_rx_after_start_test(enum st_fps fps[], int width[], int height[ ops_tx.name = "st22_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -881,8 +900,12 @@ static void st22_rx_after_start_test(enum st_fps fps[], int width[], int height[ ops_rx.name = "st22_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -999,8 +1022,12 @@ static void st22_rx_dump_test(enum st_fps fps[], int width[], int height[], ops_tx.name = "st22_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -1048,8 +1075,12 @@ static void st22_rx_dump_test(enum st_fps fps[], int width[], int height[], ops_rx.name = "st22_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -1226,8 +1257,12 @@ static void st22_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_tx.name = "st22_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -1291,8 +1326,12 @@ static void st22_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_rx.name = "st22_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -1443,8 +1482,12 @@ static void st22_tx_user_pacing_test(int width[], int height[], int pkt_data_len ops_tx.name = "st22_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; @@ -1488,8 +1531,12 @@ static void st22_tx_user_pacing_test(int width[], int height[], int pkt_data_len ops_rx.name = "st22_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 15000 + i * 2; diff --git a/tests/src/st22p_test.cpp b/tests/src/st22p_test.cpp index 7865774ab..7661c7091 100644 --- a/tests/src/st22p_test.cpp +++ b/tests/src/st22p_test.cpp @@ -827,8 +827,12 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_tx.name = "st22p_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.port.num_port = 1; - memcpy(ops_tx.port.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.port.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.port.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.port.udp_port[MTL_SESSION_PORT_P] = ST22P_TEST_UDP_PORT + i * 2; @@ -1006,8 +1010,12 @@ static void st22p_rx_digest_test(enum st_fps fps[], int width[], int height[], ops_rx.name = "st22p_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.port.num_port = 1; - memcpy(ops_rx.port.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.port.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.port.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.port.udp_port[MTL_SESSION_PORT_P] = ST22P_TEST_UDP_PORT + i * 2; diff --git a/tests/src/st30_test.cpp b/tests/src/st30_test.cpp index 7df473fef..6e3645aed 100644 --- a/tests/src/st30_test.cpp +++ b/tests/src/st30_test.cpp @@ -442,8 +442,12 @@ static void st30_rx_fps_test(enum st30_type type[], enum st30_sampling sample[], ops_tx.name = "st30_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; @@ -504,8 +508,12 @@ static void st30_rx_fps_test(enum st30_type type[], enum st30_sampling sample[], ops_rx.name = "st30_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; @@ -841,6 +849,9 @@ static void st30_rx_update_src_test(enum st30_type type, int tx_sessions, else if (1 == i) memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], MTL_IP_ADDR_LEN); + else if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); else memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], MTL_IP_ADDR_LEN); @@ -883,8 +894,12 @@ static void st30_rx_update_src_test(enum st30_type type, int tx_sessions, ops_rx.name = "st30_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; @@ -1127,8 +1142,12 @@ static void st30_rx_meta_test(enum st30_fmt fmt[], enum st30_sampling sampling[] ops_tx.name = "st30_meta_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; @@ -1172,8 +1191,12 @@ static void st30_rx_meta_test(enum st30_fmt fmt[], enum st30_sampling sampling[] ops_rx.name = "st30_meta_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; @@ -1310,8 +1333,12 @@ static void st30_create_after_start_test(enum st30_type type[], ops_tx.name = "st30_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; @@ -1351,8 +1378,12 @@ static void st30_create_after_start_test(enum st30_type type[], ops_rx.name = "st30_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 20000 + i * 2; diff --git a/tests/src/st40_test.cpp b/tests/src/st40_test.cpp index 25c47e8ff..b4b98b322 100644 --- a/tests/src/st40_test.cpp +++ b/tests/src/st40_test.cpp @@ -496,8 +496,12 @@ static void st40_rx_fps_test(enum st40_type type[], enum st_fps fps[], ops_tx.name = "st40_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 30000 + i * 2; @@ -552,8 +556,12 @@ static void st40_rx_fps_test(enum st40_type type[], enum st_fps fps[], ops_rx.name = "st40_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 30000 + i * 2; @@ -779,6 +787,9 @@ static void st40_rx_update_src_test(enum st40_type type, int tx_sessions, else if (1 == i) memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], MTL_IP_ADDR_LEN); + else if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); else memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], MTL_IP_ADDR_LEN); @@ -818,8 +829,12 @@ static void st40_rx_update_src_test(enum st40_type type, int tx_sessions, ops_rx.name = "st40_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_2], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 30000 + i * 2; @@ -1017,8 +1032,12 @@ static void st40_after_start_test(enum st40_type type[], enum st_fps fps[], int ops_tx.name = "st40_test"; ops_tx.priv = test_ctx_tx[i]; ops_tx.num_port = 1; - memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_tx.dip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_R], + MTL_IP_ADDR_LEN); snprintf(ops_tx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_P]); ops_tx.udp_port[MTL_SESSION_PORT_P] = 30000 + i * 2; @@ -1055,8 +1074,12 @@ static void st40_after_start_test(enum st40_type type[], enum st_fps fps[], int ops_rx.name = "st40_test"; ops_rx.priv = test_ctx_rx[i]; ops_rx.num_port = 1; - memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], - MTL_IP_ADDR_LEN); + if (ctx->mcast_only) + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->mcast_ip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); + else + memcpy(ops_rx.ip_addr[MTL_SESSION_PORT_P], ctx->para.sip_addr[MTL_PORT_P], + MTL_IP_ADDR_LEN); snprintf(ops_rx.port[MTL_SESSION_PORT_P], MTL_PORT_MAX_LEN, "%s", ctx->para.port[MTL_PORT_R]); ops_rx.udp_port[MTL_SESSION_PORT_P] = 30000 + i * 2; diff --git a/tests/src/tests.cpp b/tests/src/tests.cpp index 0db0d770c..31fd28bbb 100644 --- a/tests/src/tests.cpp +++ b/tests/src/tests.cpp @@ -45,6 +45,7 @@ enum test_args_cmd { TEST_ARG_IOVA_MODE, TEST_ARG_MULTI_SRC_PORT, TEST_ARG_DHCP, + TEST_ARG_MCAST_ONLY, }; static struct option test_args_options[] = { @@ -82,6 +83,7 @@ static struct option test_args_options[] = { {"iova_mode", required_argument, 0, TEST_ARG_IOVA_MODE}, {"multi_src_port", no_argument, 0, TEST_ARG_MULTI_SRC_PORT}, {"dhcp", no_argument, 0, TEST_ARG_DHCP}, + {"mcast_only", no_argument, 0, TEST_ARG_MCAST_ONLY}, {0, 0, 0, 0}}; @@ -275,6 +277,9 @@ static int test_parse_args(struct st_tests_context* ctx, struct mtl_init_params* p->net_proto[port] = MTL_PROTO_DHCP; ctx->dhcp = true; break; + case TEST_ARG_MCAST_ONLY: + ctx->mcast_only = true; + break; default: break; } @@ -310,6 +315,14 @@ static void test_random_ip(struct st_tests_context* ctx) { r_ip[1] = p_ip[1]; r_ip[2] = p_ip[2]; r_ip[3] = p_ip[3] + 1; + + if (ctx->mcast_only) { + r_ip = ctx->mcast_ip_addr[MTL_PORT_2]; + r_ip[0] = p_ip[0]; + r_ip[1] = p_ip[1]; + r_ip[2] = p_ip[2]; + r_ip[3] = p_ip[3] + 2; + } } static uint64_t test_ptp_from_real_time(void* priv) { diff --git a/tests/src/tests.h b/tests/src/tests.h index 52dc78af9..0b91cd2d4 100644 --- a/tests/src/tests.h +++ b/tests/src/tests.h @@ -93,6 +93,7 @@ struct st_tests_context { enum st_test_level level; bool hdr_split; bool dhcp; + bool mcast_only; enum mtl_iova_mode iova; enum mtl_rss_mode rss_mode; bool same_dual_port;