netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] liquidio: Fix an issue with multiple switchdev enable disables
@ 2017-11-03 19:17 Felix Manlunas
  2017-11-04  0:18 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Manlunas @ 2017-11-03 19:17 UTC (permalink / raw)
  To: davem
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	vijaya.guvva

From: Vijaya Mohan Guvva <vijaya.guvva@cavium.com>

Return success if the same dispatch function is being registered for
a given opcode and subcode, there by allow multiple switchdev enable
and disables.

Signed-off-by: Vijaya Mohan Guvva <vijaya.guvva@cavium.com>
Signed-off-by: Satanand Burla <satananda.burla@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
 drivers/net/ethernet/cavium/liquidio/octeon_device.c | 4 ++++
 drivers/net/ethernet/cavium/liquidio/octeon_droq.c   | 4 ++--
 drivers/net/ethernet/cavium/liquidio/octeon_droq.h   | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
index e4aa339..2c615ab 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
@@ -1180,6 +1180,10 @@ void octeon_delete_dispatch_list(struct octeon_device *oct)
 		spin_unlock_bh(&oct->dispatch.lock);
 
 	} else {
+		if (pfn == fn &&
+		    octeon_get_dispatch_arg(oct, opcode, subcode) == fn_arg)
+			return 0;
+
 		dev_err(&oct->pci_dev->dev,
 			"Found previously registered dispatch fn for opcode/subcode: %x/%x\n",
 			opcode, subcode);
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
index 9372d4c..3461d65 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_droq.c
@@ -52,8 +52,8 @@ struct __dispatch {
  *  @return  Failure: NULL
  *
  */
-static inline void *octeon_get_dispatch_arg(struct octeon_device *octeon_dev,
-					    u16 opcode, u16 subcode)
+void *octeon_get_dispatch_arg(struct octeon_device *octeon_dev,
+			      u16 opcode, u16 subcode)
 {
 	int idx;
 	struct list_head *dispatch;
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_droq.h b/drivers/net/ethernet/cavium/liquidio/octeon_droq.h
index f91bc84..815a9f5 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_droq.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_droq.h
@@ -400,6 +400,9 @@ int octeon_register_dispatch_fn(struct octeon_device *oct,
 				u16 subcode,
 				octeon_dispatch_fn_t fn, void *fn_arg);
 
+void *octeon_get_dispatch_arg(struct octeon_device *oct,
+			      u16 opcode, u16 subcode);
+
 void octeon_droq_print_stats(void);
 
 u32 octeon_droq_check_hw_for_pkts(struct octeon_droq *droq);
-- 
1.8.3.1

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

* Re: [PATCH net-next] liquidio: Fix an issue with multiple switchdev enable disables
  2017-11-03 19:17 [PATCH net-next] liquidio: Fix an issue with multiple switchdev enable disables Felix Manlunas
@ 2017-11-04  0:18 ` David Miller
  2017-11-06 23:36   ` Guvva, Vijaya
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2017-11-04  0:18 UTC (permalink / raw)
  To: felix.manlunas
  Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
	vijaya.guvva

From: Felix Manlunas <felix.manlunas@cavium.com>
Date: Fri, 3 Nov 2017 12:17:44 -0700

> From: Vijaya Mohan Guvva <vijaya.guvva@cavium.com>
> 
> Return success if the same dispatch function is being registered for
> a given opcode and subcode, there by allow multiple switchdev enable
> and disables.
> 
> Signed-off-by: Vijaya Mohan Guvva <vijaya.guvva@cavium.com>
> Signed-off-by: Satanand Burla <satananda.burla@cavium.com>
> Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>

Applied, thanks.

But I do have a question, are you properly reference counting these
dispatch function objects?  I can't see how you can properly handle
multiple enable/disable otherwise.

Thank you.

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

* RE: [PATCH net-next] liquidio: Fix an issue with multiple switchdev enable disables
  2017-11-04  0:18 ` David Miller
@ 2017-11-06 23:36   ` Guvva, Vijaya
  0 siblings, 0 replies; 3+ messages in thread
From: Guvva, Vijaya @ 2017-11-06 23:36 UTC (permalink / raw)
  To: David Miller, Manlunas, Felix
  Cc: netdev@vger.kernel.org, Vatsavayi, Raghu, Chickles, Derek,
	Burla, Satananda

>Applied, thanks.
>
>But I do have a question, are you properly reference counting these dispatch
>function objects?  I can't see how you can properly handle multiple
>enable/disable otherwise.
>
LiquidIO doesn't reference count dispatch function as no two LiquidIO components
registers for the same opcode/subcode combination and every physical function
will have its own dispatch functions list.
Right now, we don't have an implementation to unregister dispatch functions selectively,
which we supposed to do for switchdev disable. So, we allow multiple switchdev
enable/disables (in a sequence) by not failing the registration for opcode/subcode if the
new dispatch functions matches with the old one.

We will submit implementation for unregistering dispatch function in future patch.

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

end of thread, other threads:[~2017-11-06 23:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 19:17 [PATCH net-next] liquidio: Fix an issue with multiple switchdev enable disables Felix Manlunas
2017-11-04  0:18 ` David Miller
2017-11-06 23:36   ` Guvva, Vijaya

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).