]> git.baikalelectronics.ru Git - kernel.git/commitdiff
liquidio: Fix an issue with multiple switchdev enable disables
authorVijaya Mohan Guvva <vijaya.guvva@cavium.com>
Fri, 3 Nov 2017 19:17:44 +0000 (12:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 Nov 2017 00:17:29 +0000 (09:17 +0900)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/octeon_device.c
drivers/net/ethernet/cavium/liquidio/octeon_droq.c
drivers/net/ethernet/cavium/liquidio/octeon_droq.h

index e4aa3395a57811c35c81eb4933695bcfe94418a0..2c615ab09e6480bbba4e81f5a8777eaedc997e15 100644 (file)
@@ -1180,6 +1180,10 @@ octeon_register_dispatch_fn(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);
index 9372d4ce995400de3e853ae3d7c29b437c44f463..3461d65ff4ebd93d11a7ad041258d658fb814a50 100644 (file)
@@ -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;
index f91bc84d171984cda866e76cd7bd9ce69b9c1a8f..815a9f56fd595f1099c231a7b976891bfeaede13 100644 (file)
@@ -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);