diff options
| author | Kurt Kanzenbach <[email protected]> | 2021-06-29 04:43:31 +0000 |
|---|---|---|
| committer | Tony Nguyen <[email protected]> | 2021-07-16 21:08:03 +0000 |
| commit | 73744262210c4560efb2d89385c6219739d16bbd (patch) | |
| tree | 1b0f2fad38c59aa9c62056a01f040d6bd20b2539 /drivers/net/ethernet/intel/igc/igc_ethtool.c | |
| parent | igc: Allow for Flex Filters to be installed (diff) | |
| download | kernel-73744262210c4560efb2d89385c6219739d16bbd.tar.gz kernel-73744262210c4560efb2d89385c6219739d16bbd.zip | |
igc: Make flex filter more flexible
Currently flex filters are only used for filters containing user data.
However, it makes sense to utilize them also for filters having
multiple conditions, because that's not supported by the driver at the
moment. Add it.
Signed-off-by: Kurt Kanzenbach <[email protected]>
Reviewed-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Vinicius Costa Gomes <[email protected]>
Tested-by: Dvora Fuxbrumer <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc_ethtool.c')
| -rw-r--r-- | drivers/net/ethernet/intel/igc/igc_ethtool.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 5a7b27b2a95c..d3e84416248e 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1222,19 +1222,29 @@ static void igc_ethtool_init_nfc_rule(struct igc_nfc_rule *rule, fsp->h_u.ether_spec.h_dest); } + /* VLAN etype matching */ + if ((fsp->flow_type & FLOW_EXT) && fsp->h_ext.vlan_etype) { + rule->filter.vlan_etype = fsp->h_ext.vlan_etype; + rule->filter.match_flags |= IGC_FILTER_FLAG_VLAN_ETYPE; + } + /* Check for user defined data */ if ((fsp->flow_type & FLOW_EXT) && (fsp->h_ext.data[0] || fsp->h_ext.data[1])) { rule->filter.match_flags |= IGC_FILTER_FLAG_USER_DATA; memcpy(rule->filter.user_data, fsp->h_ext.data, sizeof(fsp->h_ext.data)); memcpy(rule->filter.user_mask, fsp->m_ext.data, sizeof(fsp->m_ext.data)); - - /* VLAN etype matching is only valid using flex filter */ - if ((fsp->flow_type & FLOW_EXT) && fsp->h_ext.vlan_etype) { - rule->filter.vlan_etype = fsp->h_ext.vlan_etype; - rule->filter.match_flags |= IGC_FILTER_FLAG_VLAN_ETYPE; - } } + + /* When multiple filter options or user data or vlan etype is set, use a + * flex filter. + */ + if ((rule->filter.match_flags & IGC_FILTER_FLAG_USER_DATA) || + (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) || + (rule->filter.match_flags & (rule->filter.match_flags - 1))) + rule->flex = true; + else + rule->flex = false; } /** @@ -1264,11 +1274,6 @@ static int igc_ethtool_check_nfc_rule(struct igc_adapter *adapter, return -EINVAL; } - if (flags & (flags - 1)) { - netdev_dbg(dev, "Rule with multiple matches not supported\n"); - return -EOPNOTSUPP; - } - list_for_each_entry(tmp, &adapter->nfc_rule_list, list) { if (!memcmp(&rule->filter, &tmp->filter, sizeof(rule->filter)) && |
