]> git.baikalelectronics.ru Git - kernel.git/commit
nfp: flower: fix cb_ident duplicate in indirect block register
authorJohn Hurley <john.hurley@netronome.com>
Tue, 18 Dec 2018 03:18:39 +0000 (19:18 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Dec 2018 07:34:12 +0000 (23:34 -0800)
commited4a306a4e339310d8c6323ba63ff93b6b35b1e0
treea48142f90ec4ffa6aa0beaa12d3dfa6027cfea22
parentcf2157d5f2c7e48b90169c50d543724d1a2d97ae
nfp: flower: fix cb_ident duplicate in indirect block register

Previously the identifier used for indirect block callback registry and
for block rule cb registry (when done via indirect blocks) was the pointer
to the netdev we were interested in receiving updates on. This worked fine
if a single app existed that registered one callback per netdev of
interest. However, if multiple cards are in place and, in turn, multiple
apps, then each app may register the same callback with the same
identifier to both the netdev's indirect block cb list and to a block's cb
list. This can lead to EEXIST errors and/or incorrect cb deletions.

Prevent this conflict by using the app pointer as the identifier for
netdev indirect block cb registry, allowing each app to register a unique
callback per netdev. For block cb registry, the same app may register
multiple cbs to the same block if using TC shared blocks. Instead of the
app, use the pointer to the allocated cb_priv data as the identifier here.
This means that there can be a unique block callback for each app/netdev
combo.

Fixes: 149f49c827e6 ("nfp: flower: offload tunnel decap rules via indirect TC blocks")
Reported-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/offload.c