igc: Refactor ethertype filtering code
authorAndre Guedes <andre.guedes@intel.com>
Tue, 7 Apr 2020 21:07:10 +0000 (14:07 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 19 May 2020 22:46:35 +0000 (15:46 -0700)
commitaa7ca7266fc49966844ac1f868085a49092b9b5d
tree53c3a554e6b0af687f8b3d4f27af0ef9a98aa7e9
parentb4d48d96eaec9bff4139dcbeb9590869fc765aa9
igc: Refactor ethertype filtering code

The whole ethertype filtering code is implemented in igc_ethtool.c and
mixes logic from ethtool and core parts. This patch refactors it so core
logic is moved to igc_main.c, aligning the ethertype filtering code
organization with the rest of the filtering code from the driver (MAC
address and VLAN priority).

Besides moving code to igc_main.c, this patch also does some minor
improvements to the code. Below are some highlights.

In case all filters are already in use and the user tries to add another
filter, we return -ENOSPC instead of -EINVAL so a more meaningful error
code is provided. This also aligns with the behavior implemented in MAC
address filtering code.

With this code refactoring, 'etype_bitmap' array in struct igc_adapter
and 'etype_reg_index' in struct igc_nfc_filter are not needed anymore
and are removed.

Log messages are added to help debugging the ethertype filtering code.

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.h
drivers/net/ethernet/intel/igc/igc_ethtool.c
drivers/net/ethernet/intel/igc/igc_main.c