From patchwork Fri Apr 23 08:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92061 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D24CA0548; Fri, 23 Apr 2021 10:13:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63C9D4067E; Fri, 23 Apr 2021 10:13:07 +0200 (CEST) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id CDE754014F for ; Fri, 23 Apr 2021 10:13:05 +0200 (CEST) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FRRnM6qXTzlZHC; Fri, 23 Apr 2021 16:11:03 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Fri, 23 Apr 2021 16:12:30 +0800 From: "Min Hu (Connor)" To: CC: , Date: Fri, 23 Apr 2021 16:12:42 +0800 Message-ID: <1619165562-50959-1-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] kni: check code of allmulticast mode switch X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng Some drivers may return errcode when switch allmulticast mode, so it's necessary to check the return code. Fixes: b34801d1aa2e ("kni: support allmulticast mode set") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) Acked-by: Ferruh Yigit --- lib/kni/rte_kni.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c index 9dae6a8..aa9b5b7 100644 --- a/lib/kni/rte_kni.c +++ b/lib/kni/rte_kni.c @@ -514,6 +514,8 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on) static int kni_config_allmulticast(uint16_t port_id, uint8_t to_on) { + int ret; + if (!rte_eth_dev_is_valid_port(port_id)) { RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id); return -EINVAL; @@ -523,11 +525,16 @@ kni_config_allmulticast(uint16_t port_id, uint8_t to_on) port_id, to_on); if (to_on) - rte_eth_allmulticast_enable(port_id); + ret = rte_eth_allmulticast_enable(port_id); else - rte_eth_allmulticast_disable(port_id); + ret = rte_eth_allmulticast_disable(port_id); + if (ret != 0) + RTE_LOG(ERR, KNI, + "Failed to %s allmulticast mode for port %u: %s\n", + to_on ? "enable" : "disable", port_id, + rte_strerror(-ret)); - return 0; + return ret; } int