From 8a433297282662460a951882c80b5b0d5a8d88cf Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 21 Jan 2020 19:44:33 +0800 Subject: [PATCH] app/testpmd: fix uninitialized members when setting PFC Only a part of members in the local structure variable named pfc_conf are initialized in the function named cmd_priority_flow_ctrl_set_parsed when typing "set pfc_ctrl..." command, and others are random values. However, those uninitialized members may cause failure. This patch adds clearing zero operation before calling the API named rte_eth_dev_priority_flow_ctrl_set API with pfc_conf as the input parameter. Fixes: 9b53e542e9e1 ("app/testpmd: add priority flow control") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) Signed-off-by: Xuan Li Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 06672fd04e..de7a695d74 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -7089,6 +7089,7 @@ cmd_priority_flow_ctrl_set_parsed(void *parsed_result, {RTE_FC_NONE, RTE_FC_TX_PAUSE}, {RTE_FC_RX_PAUSE, RTE_FC_FULL} }; + memset(&pfc_conf, 0, sizeof(struct rte_eth_pfc_conf)); rx_fc_enable = (!strncmp(res->rx_pfc_mode, "on",2)) ? 1 : 0; tx_fc_enable = (!strncmp(res->tx_pfc_mode, "on",2)) ? 1 : 0; pfc_conf.fc.mode = rx_tx_onoff_2_pfc_mode[rx_fc_enable][tx_fc_enable]; -- 2.20.1