Skip to content

Commit

Permalink
liquidio: Fix an issue with multiple switchdev enable disables
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Satanand Burla <[email protected]>
Signed-off-by: Felix Manlunas <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
vguvva authored and davem330 committed Nov 4, 2017
1 parent de4cc8b commit bf53458
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/octeon_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/cavium/liquidio/octeon_droq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/octeon_droq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bf53458

Please sign in to comment.