• Asbjørn Sloth Tønnesen's avatar
    flow_offload: add encapsulation control flag helpers · b48a1540
    Asbjørn Sloth Tønnesen authored
    This patch adds two new helper functions:
      flow_rule_is_supp_enc_control_flags()
      flow_rule_has_enc_control_flags()
    
    They are intended to be used for validating encapsulation control
    flags, and compliment the similar helpers without "enc_" in the name.
    
    The only difference is that they have their own error message,
    to make it obvious if an unsupported flag error is related to
    FLOW_DISSECTOR_KEY_CONTROL or FLOW_DISSECTOR_KEY_ENC_CONTROL.
    
    flow_rule_has_enc_control_flags() is for drivers supporting
    FLOW_DISSECTOR_KEY_ENC_CONTROL, but not supporting any
    encapsulation control flags.
    (Currently all 4 drivers fits this category)
    
    flow_rule_is_supp_enc_control_flags() is currently only used
    for the above helper, but should also be used by drivers once
    they implement at least one encapsulation control flag.
    
    There is AFAICT currently no need for an "enc_" variant of
    flow_rule_match_has_control_flags(), as all drivers currently
    supporting FLOW_DISSECTOR_KEY_ENC_CONTROL, are already calling
    flow_rule_match_enc_control() directly.
    
    Only compile tested.
    Signed-off-by: default avatarAsbjørn Sloth Tønnesen <ast@fiberby.net>
    Reviewed-by: default avatarDavide Caratti <dcaratti@redhat.com>
    Link: https://lore.kernel.org/r/20240609173358.193178-2-ast@fiberby.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    b48a1540
flow_offload.h 20.2 KB