patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] ethdev: avoid unregistering a non-allocated callback
@ 2021-07-13 13:17 Thomas Monjalon
  2021-07-13 13:21 ` Andrew Rybchenko
  2021-07-13 13:42 ` Matan Azrad
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-07-13 13:17 UTC (permalink / raw)
  To: dev; +Cc: stable, Ferruh Yigit, Andrew Rybchenko, Matan Azrad

When registering a new event callback, if allocation fails,
there is no need for unregistering the callback,
because it is not registered.

Fixes: 9ec0b3869d8d ("ethdev: allow event registration for all ports")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/ethdev/rte_ethdev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 9d95cd11e1..1731854628 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -4649,8 +4649,6 @@ rte_eth_dev_callback_register(uint16_t port_id,
 						  user_cb, next);
 			} else {
 				rte_spinlock_unlock(&eth_dev_cb_lock);
-				rte_eth_dev_callback_unregister(port_id, event,
-								cb_fn, cb_arg);
 				return -ENOMEM;
 			}
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] ethdev: avoid unregistering a non-allocated callback
  2021-07-13 13:17 [dpdk-stable] [PATCH] ethdev: avoid unregistering a non-allocated callback Thomas Monjalon
@ 2021-07-13 13:21 ` Andrew Rybchenko
  2021-07-13 13:42 ` Matan Azrad
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Rybchenko @ 2021-07-13 13:21 UTC (permalink / raw)
  To: Thomas Monjalon, dev; +Cc: stable, Ferruh Yigit, Matan Azrad

On 7/13/21 4:17 PM, Thomas Monjalon wrote:
> When registering a new event callback, if allocation fails,
> there is no need for unregistering the callback,
> because it is not registered.
> 
> Fixes: 9ec0b3869d8d ("ethdev: allow event registration for all ports")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] ethdev: avoid unregistering a non-allocated callback
  2021-07-13 13:17 [dpdk-stable] [PATCH] ethdev: avoid unregistering a non-allocated callback Thomas Monjalon
  2021-07-13 13:21 ` Andrew Rybchenko
@ 2021-07-13 13:42 ` Matan Azrad
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2021-07-13 13:42 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, dev; +Cc: stable, Ferruh Yigit, Andrew Rybchenko

Hi Thomas

From: Thomas Monjalon
> When registering a new event callback, if allocation fails, there is no need for
> unregistering the callback, because it is not registered.
> 
> Fixes: 9ec0b3869d8d ("ethdev: allow event registration for all ports")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  lib/ethdev/rte_ethdev.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index
> 9d95cd11e1..1731854628 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -4649,8 +4649,6 @@ rte_eth_dev_callback_register(uint16_t port_id,
>                                                   user_cb, next);
>                         } else {
>                                 rte_spinlock_unlock(&eth_dev_cb_lock);
> -                               rte_eth_dev_callback_unregister(port_id, event,
> -                                                               cb_fn, cb_arg);

Please pay attention to the case of port_id=RTE_ETH_ALL where the user wants to register the event for all the ports.

In this case, when a failure happens for one of the ports, this unregister call cleans the callback from all the ports.   


>                                 return -ENOMEM;
>                         }
> 
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-13 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 13:17 [dpdk-stable] [PATCH] ethdev: avoid unregistering a non-allocated callback Thomas Monjalon
2021-07-13 13:21 ` Andrew Rybchenko
2021-07-13 13:42 ` Matan Azrad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).