net/enic: avoid extra unlock when setting MTU in enic

Message ID tencent_349DCE470CE9C87F1F8D508878C438F2DC0A@qq.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/enic: avoid extra unlock when setting MTU in enic |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Weiguo Li Nov. 1, 2023, 7:28 a.m. UTC
  The 'set_mtu_done' goto statement is being executed in a context
where the 'mtu_lock' has not been previously locked.

To avoid the extra unlocking operation, replace the goto statement
with a return statement.

Fixes: c3e09182bcd6 ("net/enic: support scatter Rx in MTU update")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 .mailmap                     | 2 +-
 drivers/net/enic/enic_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Nov. 1, 2023, 7:55 p.m. UTC | #1
On 11/1/2023 7:28 AM, Weiguo Li wrote:
> The 'set_mtu_done' goto statement is being executed in a context
> where the 'mtu_lock' has not been previously locked.
> 
> To avoid the extra unlocking operation, replace the goto statement
> with a return statement.
> 
> Fixes: c3e09182bcd6 ("net/enic: support scatter Rx in MTU update")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
>

<...>

>
> diff --git a/.mailmap b/.mailmap
> index 3f5bab26a8..b4f0ae26b8 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -1500,7 +1500,7 @@ Waterman Cao <waterman.cao@intel.com>
>  Weichun Chen <weichunx.chen@intel.com>
>  Wei Dai <wei.dai@intel.com>
>  Weifeng Li <liweifeng96@126.com>
> -Weiguo Li <liwg06@foxmail.com>
> +Weiguo Li <liwg06@foxmail.com> <liweiguo@xencore.cn>
>

As this patch signed-off with new email address, I assume intention is
to make it default address, so I will update accordingly while merging.


Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>

Applied to dpdk-next-net/main, thanks.
  
John Daley (johndale) Nov. 2, 2023, 1:25 a.m. UTC | #2
Reviewed-by: John Daley <johndale@cisco.com>

Thanks,
John

From: Weiguo Li <liwg06@foxmail.com>
Date: Wednesday, November 1, 2023 at 12:28 AM
To: John Daley (johndale) <johndale@cisco.com>
Cc: dev@dpdk.org <dev@dpdk.org>, stable@dpdk.org <stable@dpdk.org>, Weiguo Li <liweiguo@xencore.cn>
Subject: [PATCH] net/enic: avoid extra unlock when setting MTU in enic
The 'set_mtu_done' goto statement is being executed in a context
where the 'mtu_lock' has not been previously locked.

To avoid the extra unlocking operation, replace the goto statement
with a return statement.

Fixes: c3e09182bcd6 ("net/enic: support scatter Rx in MTU update")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 .mailmap                     | 2 +-
 drivers/net/enic/enic_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index 3f5bab26a8..b4f0ae26b8 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1500,7 +1500,7 @@ Waterman Cao <waterman.cao@intel.com>
 Weichun Chen <weichunx.chen@intel.com>
 Wei Dai <wei.dai@intel.com>
 Weifeng Li <liweifeng96@126.com>
-Weiguo Li <liwg06@foxmail.com>
+Weiguo Li <liwg06@foxmail.com> <liweiguo@xencore.cn>
 Wei Huang <wei.huang@intel.com>
 Wei Hu <weh@microsoft.com>
 Wei Hu (Xavier) <xavier.huwei@huawei.com>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 19a99a82c5..a6aaa760ca 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1639,7 +1639,7 @@ int enic_set_mtu(struct enic *enic, uint16_t new_mtu)
          * packet length.
          */
         if (!eth_dev->data->dev_started)
-               goto set_mtu_done;
+               return rc;

         /*
          * The device has started, re-do RQs on the fly. In the process, we
--
2.34.1
  

Patch

diff --git a/.mailmap b/.mailmap
index 3f5bab26a8..b4f0ae26b8 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1500,7 +1500,7 @@  Waterman Cao <waterman.cao@intel.com>
 Weichun Chen <weichunx.chen@intel.com>
 Wei Dai <wei.dai@intel.com>
 Weifeng Li <liweifeng96@126.com>
-Weiguo Li <liwg06@foxmail.com>
+Weiguo Li <liwg06@foxmail.com> <liweiguo@xencore.cn>
 Wei Huang <wei.huang@intel.com>
 Wei Hu <weh@microsoft.com>
 Wei Hu (Xavier) <xavier.huwei@huawei.com>
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 19a99a82c5..a6aaa760ca 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1639,7 +1639,7 @@  int enic_set_mtu(struct enic *enic, uint16_t new_mtu)
 	 * packet length.
 	 */
 	if (!eth_dev->data->dev_started)
-		goto set_mtu_done;
+		return rc;
 
 	/*
 	 * The device has started, re-do RQs on the fly. In the process, we