aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@intel.com>2018-04-10 13:49:56 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-04-25 13:53:22 -0400
commitbae51fefe2ac6ec2fe27f9d041aa3be87cae85af (patch)
treef19e46c8fa7199d92bfc4631c9233066f2f38975
parent872f923c5b38226a0c6825487742098b1968d463 (diff)
igb: Enable nfc filters to specify MAC addresses
This allows igb_add_filter()/igb_erase_filter() to work on filters that include MAC addresses (both source and destination). For now, this only exposes the functionality, the next commit glues ethtool into this. Later in this series, these APIs are used to allow offloading of cls_flower filters. Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h4
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c28
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index c71845a450f7..0eac1df499f8 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -442,6 +442,8 @@ struct hwmon_buff {
442enum igb_filter_match_flags { 442enum igb_filter_match_flags {
443 IGB_FILTER_FLAG_ETHER_TYPE = 0x1, 443 IGB_FILTER_FLAG_ETHER_TYPE = 0x1,
444 IGB_FILTER_FLAG_VLAN_TCI = 0x2, 444 IGB_FILTER_FLAG_VLAN_TCI = 0x2,
445 IGB_FILTER_FLAG_SRC_MAC_ADDR = 0x4,
446 IGB_FILTER_FLAG_DST_MAC_ADDR = 0x8,
445}; 447};
446 448
447#define IGB_MAX_RXNFC_FILTERS 16 449#define IGB_MAX_RXNFC_FILTERS 16
@@ -456,6 +458,8 @@ struct igb_nfc_input {
456 u8 match_flags; 458 u8 match_flags;
457 __be16 etype; 459 __be16 etype;
458 __be16 vlan_tci; 460 __be16 vlan_tci;
461 u8 src_addr[ETH_ALEN];
462 u8 dst_addr[ETH_ALEN];
459}; 463};
460 464
461struct igb_nfc_filter { 465struct igb_nfc_filter {
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 5975d432836f..31b2960a7869 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2776,6 +2776,25 @@ int igb_add_filter(struct igb_adapter *adapter, struct igb_nfc_filter *input)
2776 return err; 2776 return err;
2777 } 2777 }
2778 2778
2779 if (input->filter.match_flags & IGB_FILTER_FLAG_DST_MAC_ADDR) {
2780 err = igb_add_mac_steering_filter(adapter,
2781 input->filter.dst_addr,
2782 input->action, 0);
2783 err = min_t(int, err, 0);
2784 if (err)
2785 return err;
2786 }
2787
2788 if (input->filter.match_flags & IGB_FILTER_FLAG_SRC_MAC_ADDR) {
2789 err = igb_add_mac_steering_filter(adapter,
2790 input->filter.src_addr,
2791 input->action,
2792 IGB_MAC_STATE_SRC_ADDR);
2793 err = min_t(int, err, 0);
2794 if (err)
2795 return err;
2796 }
2797
2779 if (input->filter.match_flags & IGB_FILTER_FLAG_VLAN_TCI) 2798 if (input->filter.match_flags & IGB_FILTER_FLAG_VLAN_TCI)
2780 err = igb_rxnfc_write_vlan_prio_filter(adapter, input); 2799 err = igb_rxnfc_write_vlan_prio_filter(adapter, input);
2781 2800
@@ -2824,6 +2843,15 @@ int igb_erase_filter(struct igb_adapter *adapter, struct igb_nfc_filter *input)
2824 igb_clear_vlan_prio_filter(adapter, 2843 igb_clear_vlan_prio_filter(adapter,
2825 ntohs(input->filter.vlan_tci)); 2844 ntohs(input->filter.vlan_tci));
2826 2845
2846 if (input->filter.match_flags & IGB_FILTER_FLAG_SRC_MAC_ADDR)
2847 igb_del_mac_steering_filter(adapter, input->filter.src_addr,
2848 input->action,
2849 IGB_MAC_STATE_SRC_ADDR);
2850
2851 if (input->filter.match_flags & IGB_FILTER_FLAG_DST_MAC_ADDR)
2852 igb_del_mac_steering_filter(adapter, input->filter.dst_addr,
2853 input->action, 0);
2854
2827 return 0; 2855 return 0;
2828} 2856}
2829 2857