From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 36C08A04C8;
	Sat, 19 Sep 2020 12:47:43 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 5FDF21C2B8;
	Sat, 19 Sep 2020 12:47:34 +0200 (CEST)
Received: from m12-13.163.com (m12-13.163.com [220.181.12.13])
 by dpdk.org (Postfix) with ESMTP id CB03B1C206
 for <dev@dpdk.org>; Sat, 19 Sep 2020 12:47:32 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
 s=s110527; h=From:Subject:Date:Message-Id; bh=vivlAkYnlXYA/IB3C2
 IJd9xh0RuR1KTtWChekN4zkrY=; b=UmA+NWEiYrtI6k01X6r2gxymbr+AhXvDo9
 0cTqeFuO4AyMAShoSm2XMVUa6Cz2VSAmWNmUDixxkN+aTBrsMJ11SK0a26slBu2C
 a9TmGHSJ/46e4AAeYO0gRxd53UB+v6/jWM6FitHPtZ6n28Q8qZhkve/6ieGPKcKj
 Xh0r/fRqM=
Received: from localhost.localdomain (unknown [65.49.108.226])
 by smtp9 (Coremail) with SMTP id DcCowAB3fIit4WVfEoCpHA--.12337S4;
 Sat, 19 Sep 2020 18:47:30 +0800 (CST)
From: "Wei Hu (Xavier)" <xavier_huwei@163.com>
To: dev@dpdk.org
Cc: xavier.huwei@huawei.com
Date: Sat, 19 Sep 2020 18:47:04 +0800
Message-Id: <20200919104708.58451-3-xavier_huwei@163.com>
X-Mailer: git-send-email 2.9.5
In-Reply-To: <20200919104708.58451-1-xavier_huwei@163.com>
References: <20200818120254.72792-1-huwei013@chinasoftinc.com>
 <20200919104708.58451-1-xavier_huwei@163.com>
X-CM-TRANSID: DcCowAB3fIit4WVfEoCpHA--.12337S4
X-Coremail-Antispam: 1Uf129KBjvJXoW7Cry3JF4rZF43uw13WrW7urg_yoW8KFW3pF
 s3G3W8trWkJ3WfuF15Aa10kr4rWrs3JFsYvrWfGw4UAF13tryj9rWxK3sFqr1xGr97G345
 ZrZ29F9Ivrn8GFUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jwVyxUUUUU=
X-Originating-IP: [65.49.108.226]
X-CM-SenderInfo: 50dyxv5ubk34lhl6il2tof0z/xtbBZxqko1et0OWcjQACsm
Subject: [dpdk-dev] [PATCH v3 2/6] app/testpmd: fix VLAN offload
	configuration when config fail
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Chengchang Tang <tangchengchang@huawei.com>

When failing to configure VLAN offloads after the port was started, there
is no need to update the port configuration. Currently, when user
configure an unsupported VLAN offloads and fails, and then restart the
port, it will fails since the configuration has been refreshed.

This patch makes the function return directly insead of refreshing the
configuration when execution fails.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test-pmd/config.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 2bdec25..4e33208 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -3390,9 +3390,11 @@ vlan_extend_set(portid_t port_id, int on)
 	}
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-	if (diag < 0)
+	if (diag < 0) {
 		printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
 	       "diag=%d\n", port_id, on, diag);
+		return;
+	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3417,9 +3419,11 @@ rx_vlan_strip_set(portid_t port_id, int on)
 	}
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-	if (diag < 0)
+	if (diag < 0) {
 		printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
 	       "diag=%d\n", port_id, on, diag);
+		return;
+	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3458,9 +3462,11 @@ rx_vlan_filter_set(portid_t port_id, int on)
 	}
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-	if (diag < 0)
+	if (diag < 0) {
 		printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
 	       "diag=%d\n", port_id, on, diag);
+		return;
+	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
@@ -3485,9 +3491,11 @@ rx_vlan_qinq_strip_set(portid_t port_id, int on)
 	}
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
-	if (diag < 0)
+	if (diag < 0) {
 		printf("%s(port_pi=%d, on=%d) failed "
 	       "diag=%d\n", __func__, port_id, on, diag);
+		return;
+	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
 }
 
-- 
2.9.5