diff options
author | Gangfeng Huang <gangfeng.huang@ni.com> | 2016-07-06 08:22:55 +0300 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2016-08-19 08:27:48 +0300 |
commit | 64c75d41ace516b7e4f0f187f91282aa43a51b38 (patch) | |
tree | c21b79ff1f7a52789221d114453fed52d286310b /drivers/net/ethernet/intel/igb/igb.h | |
parent | 0e71def252815d732f86d11d87d63f7186d9d3be (diff) | |
download | linux-64c75d41ace516b7e4f0f187f91282aa43a51b38.tar.xz |
igb: support RX flow classification by ethertype
This patch is meant to allow for RX network flow classification to insert
and remove ethertype filter by ethtool
Example:
Add an ethertype filter:
$ ethtool -N eth0 flow-type ether proto 0x88F8 action 2
Show all filters:
$ ethtool -n eth0
4 RX rings available
Total 1 rules
Filter: 15
Flow Type: Raw Ethernet
Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
Ethertype: 0x88F8 mask: 0x0
Action: Direct to queue 2
Delete the filter by location:
$ ethtool -N delete 15
Signed-off-by: Ruhao Gao <ruhao.gao@ni.com>
Signed-off-by: Gangfeng Huang <gangfeng.huang@ni.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb.h')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index 37f82ca91141..5c5075819bac 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h @@ -350,13 +350,24 @@ struct hwmon_buff { }; #endif +/* The number of L2 ether-type filter registers, Index 3 is reserved + * for PTP 1588 timestamp + */ +#define MAX_ETYPE_FILTER (4 - 1) +/* ETQF filter list: one static filter per filter consumer. This is + * to avoid filter collisions later. Add new filters here!! + * + * Current filters: Filter 3 + */ +#define IGB_ETQF_FILTER_1588 3 + #define IGB_N_EXTTS 2 #define IGB_N_PEROUT 2 #define IGB_N_SDP 4 #define IGB_RETA_SIZE 128 enum igb_filter_match_flags { - IGB_FILTER_FLAG_NONE = 0x0, + IGB_FILTER_FLAG_ETHER_TYPE = 0x1, }; #define IGB_MAX_RXNFC_FILTERS 16 @@ -364,14 +375,17 @@ enum igb_filter_match_flags { /* RX network flow classification data structure */ struct igb_nfc_input { /* Byte layout in order, all values with MSB first: - * match_flags - 1 byte - */ + * match_flags - 1 byte + * etype - 2 bytes + */ u8 match_flags; + __be16 etype; }; struct igb_nfc_filter { struct hlist_node nfc_node; struct igb_nfc_input filter; + u16 etype_reg_index; u16 sw_idx; u16 action; }; @@ -500,6 +514,7 @@ struct igb_adapter { unsigned int nfc_filter_count; /* lock for RX network flow classification filter */ spinlock_t nfc_lock; + bool etype_bitmap[MAX_ETYPE_FILTER]; }; /* flags controlling PTP/1588 function */ |