• Jakub Kicinski's avatar
    nfp: support long reads and writes with the cpp helpers · 8b3d5a47
    Jakub Kicinski authored
    nfp_cpp_{read,write}() helpers perform device memory mapping (setting
    the PCIe -> NOC translation BARs) and accessing it.  They, however,
    currently implicitly expect that the length of entire operation will
    fit in one BAR translation window.  There is a number of 16MB windows
    available, and we don't really need to access such large areas today.
    
    If the user, however, manages to trick the driver into making a big
    mapping (e.g. by providing a huge fake FW file), the driver will
    print a warning saying "No suitable BAR found for request" and a
    stack trace - which most users find concerning.
    
    To be future-proof and not scare users with warnings, make the
    nfp_cpp_{read,write}() helpers do accesses chunk by chunk if the area
    size is large.  Set the notion of "large" to 2MB, which is the size
    of the smallest BAR window.
    Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8b3d5a47
nfp_cppcore.c 34.8 KB