• Jeroen de Borst's avatar
    gve: Add flow steering adminq commands · 57718b60
    Jeroen de Borst authored
    Add new adminq commands for the driver to configure and query flow rules
    that are stored in the device. Flow steering rules are assigned with a
    location that determines the relative order of the rules.
    
    Flow rules can run up to an order of millions. In such cases, storing
    a full copy of the rules in the driver to prepare for the ethtool query
    is infeasible while querying them from the device is better. That needs
    to be optimized too so that we don't send a lot of adminq commands. The
    solution here is to store a limited number of rules/rule ids in the
    driver in a cache. Use dma_pool to allocate 4k bytes which lets device
    write at most 46 flow rules(4096/88) or 1024 rule ids(4096/4) at a time.
    
    For configuring flow rules, there are 3 sub-commands:
    - ADD which adds a rule at the location supplied
    - DEL which deletes the rule at the location supplied
    - RESET which clears all currently active rules in the device
    
    For querying flow rules, there are also 3 sub-commands:
    - QUERY_RULES corresponds to ETHTOOL_GRXCLSRULE. It fills the rules in
      the allocated cache after querying the device
    - QUERY_RULES_IDS corresponds to ETHTOOL_GRXCLSRLALL. It fills the
      rule_ids in the allocated cache after querying the device
    - QUERY_RULES_STATS corresponds to ETHTOOL_GRXCLSRLCNT. It queries the
      device's current flow rule number and the supported max flow rule
      limit
    Signed-off-by: default avatarJeroen de Borst <jeroendb@google.com>
    Co-developed-by: default avatarZiwei Xiao <ziweixiao@google.com>
    Signed-off-by: default avatarZiwei Xiao <ziweixiao@google.com>
    Reviewed-by: default avatarPraveen Kaligineedi <pkaligineedi@google.com>
    Reviewed-by: default avatarHarshitha Ramamurthy <hramamurthy@google.com>
    Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
    Link: https://patch.msgid.link/20240625001232.1476315-5-ziweixiao@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    57718b60
gve_adminq.c 40.5 KB