diff mbox series

kni: check code of allmulticast mode switch

Message ID 1619165562-50959-1-git-send-email-humin29@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series kni: check code of allmulticast mode switch | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

humin (Q) April 23, 2021, 8:12 a.m. UTC
From: Chengwen Feng <fengchengwen@huawei.com>

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 <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 lib/kni/rte_kni.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Thomas Monjalon June 24, 2021, 7:45 a.m. UTC | #1
Waiting for review

23/04/2021 10:12, Min Hu (Connor):
> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> 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 <fengchengwen@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
>  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;
>  }
Ferruh Yigit June 24, 2021, 11:33 a.m. UTC | #2
On 4/23/2021 9:12 AM, Min Hu (Connor) wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> 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 <fengchengwen@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Thomas Monjalon Nov. 8, 2021, 10:56 a.m. UTC | #3
24/06/2021 13:33, Ferruh Yigit:
> On 4/23/2021 9:12 AM, Min Hu (Connor) wrote:
> > From: Chengwen Feng <fengchengwen@huawei.com>
> > 
> > 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 <fengchengwen@huawei.com>
> > Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks.
Sorry for the delay, it has been forgotten.
diff mbox series

Patch

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