• John Hurley's avatar
    nfp: flower: fix stats id allocation · 39f14c00
    John Hurley authored
    As flower rules are added, they are given a stats ID based on the number
    of rules that can be supported in firmware. Only after the initial
    allocation of all available IDs does the driver begin to reuse those that
    have been released.
    
    The initial allocation of IDs was modified to account for multiple memory
    units on the offloaded device. However, this introduced a bug whereby the
    counter that controls the IDs could be decremented before the ID was
    assigned (where it is further decremented). This means that the stats ID
    could be assigned as -1/0xfffffff which is out of range.
    
    Fix this by only decrementing the main counter after the current ID has
    been assigned.
    
    Fixes: 467322e2 ("nfp: flower: support multiple memory units for filter offloads")
    Signed-off-by: default avatarJohn Hurley <john.hurley@netronome.com>
    Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    39f14c00
metadata.c 15.1 KB