• Andre Guedes's avatar
    igc: Refactor igc_ethtool_update_nfc_rule() · 36fa2152
    Andre Guedes authored
    Current implementation of igc_ethtool_update_nfc_rule() is a bit
    convoluted since it handles too many things: rule lookup, deletion
    and addition. This patch breaks it into three functions so we simplify
    the code and improve code reuse.
    
    Code related to rule lookup is refactored out to a new function called
    igc_get_nfc_rule().
    
    Code related to rule addition is refactored out to a new function called
    igc_add_nfc_rule(). This function enables the rule in hardware and adds
    it to the adapter's list.
    
    Code related to rule deletion is refactored out to a new function called
    igc_del_nfc_rule(). This function disables the rule in hardware, removes
    it from adapter's list, and deletes it.
    
    As a byproduct of this refactoring, igc_enable_nfc_rule() and
    igc_disable_nfc_rule() are moved to igc_main.c since they are not used
    in igc_ethtool.c anymore, and igc_restore_nfc_rules() and igc_nfc_rule_
    exit() are moved around to avoid forward declaration.
    
    Also, since this patch already touches igc_ethtool_get_nfc_rule(), it
    takes the opportunity to remove the 'match_flags' check. Empty flags
    are not allowed to be added so no need to check that.
    Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
    Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    36fa2152
igc_main.c 144 KB