OSDN Git Service

igc: Refactor igc_rar_set_index()
authorAndre Guedes <andre.guedes@intel.com>
Wed, 1 Apr 2020 21:36:45 +0000 (14:36 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sun, 19 Apr 2020 18:55:51 +0000 (11:55 -0700)
commit424045bec085575fe4818428e6a68dac7cca48f3
treece59442e0d01f6d61ea2971ee1142cd91b985625
parentec00f1090735259151568f6b74d19c3230d65787
igc: Refactor igc_rar_set_index()

Current igc_rar_set_index() implementation is a bit convoluted so this
patch does some code refactoring to improve it.

The helper igc_rar_set_index() is about writing MAC filter settings into
hardware registers. Logic such as address validation belongs to
functions upper in the call chain such as igc_set_mac() and
igc_add_mac_filter(). So this patch moves the is_valid_ether_addr() call
to igc_add_mac_filter(). No need to touch igc_set_mac() since it already
checks it.

The variables 'rar_low' and 'rar_high' represent the value in registers
RAL and RAH so we rename them to 'ral' and 'rah', respectively, to
match the registers names.

To make it explicit, filter settings are passed as arguments to the
function instead of reading them from adapter->mac_table "under the
hood". Also, the function was renamed to igc_set_mac_filter_hw to make
it more clear what it does.

Finally, the patch removes some wrfl() calls and comments not needed.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/igc/igc_main.c