Commit 97700bc8 authored by Andre Guedes's avatar Andre Guedes Committed by Jeff Kirsher

igc: Align terms used in NFC support code

The Network Flow Classification (NFC) support code from IGC driver uses
terms such as 'rule', 'filter', 'entry', 'input' interchangeably when
referring to NFC rules, making it harder to follow the code. This patch
renames IGC's internal APIs, structs, and variables so we stick with the
term 'rule' since this is the term used in ethtool APIs. It also removes
some not applicable comments along the way. No functionality is changed
by this patch.
Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 7df76bd1
...@@ -187,12 +187,12 @@ struct igc_adapter { ...@@ -187,12 +187,12 @@ struct igc_adapter {
u32 rss_queues; u32 rss_queues;
u32 rss_indir_tbl_init; u32 rss_indir_tbl_init;
/* RX network flow classification support */ /* Any access to elements in nfc_rule_list is protected by the
struct hlist_head nfc_filter_list; * nfc_rule_lock.
unsigned int nfc_filter_count; */
spinlock_t nfc_rule_lock;
/* lock for RX network flow classification filter */ struct hlist_head nfc_rule_list;
spinlock_t nfc_lock; unsigned int nfc_rule_count;
u8 rss_indir_tbl[IGC_RETA_SIZE]; u8 rss_indir_tbl[IGC_RETA_SIZE];
...@@ -453,7 +453,7 @@ enum igc_filter_match_flags { ...@@ -453,7 +453,7 @@ enum igc_filter_match_flags {
}; };
/* RX network flow classification data structure */ /* RX network flow classification data structure */
struct igc_nfc_input { struct igc_nfc_filter {
/* Byte layout in order, all values with MSB first: /* Byte layout in order, all values with MSB first:
* match_flags - 1 byte * match_flags - 1 byte
* etype - 2 bytes * etype - 2 bytes
...@@ -466,14 +466,14 @@ struct igc_nfc_input { ...@@ -466,14 +466,14 @@ struct igc_nfc_input {
u8 dst_addr[ETH_ALEN]; u8 dst_addr[ETH_ALEN];
}; };
struct igc_nfc_filter { struct igc_nfc_rule {
struct hlist_node nfc_node; struct hlist_node nfc_node;
struct igc_nfc_input filter; struct igc_nfc_filter filter;
u16 sw_idx; u16 sw_idx;
u16 action; u16 action;
}; };
#define IGC_MAX_RXNFC_FILTERS 16 #define IGC_MAX_RXNFC_RULES 16
/* igc_desc_unused - calculate if we have unused descriptors */ /* igc_desc_unused - calculate if we have unused descriptors */
static inline u16 igc_desc_unused(const struct igc_ring *ring) static inline u16 igc_desc_unused(const struct igc_ring *ring)
...@@ -549,12 +549,11 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data) ...@@ -549,12 +549,11 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
return 0; return 0;
} }
/* forward declaration */
void igc_reinit_locked(struct igc_adapter *); void igc_reinit_locked(struct igc_adapter *);
int igc_add_filter(struct igc_adapter *adapter, int igc_enable_nfc_rule(struct igc_adapter *adapter,
struct igc_nfc_filter *input); const struct igc_nfc_rule *rule);
int igc_erase_filter(struct igc_adapter *adapter, int igc_disable_nfc_rule(struct igc_adapter *adapter,
struct igc_nfc_filter *input); const struct igc_nfc_rule *rule);
void igc_ptp_init(struct igc_adapter *adapter); void igc_ptp_init(struct igc_adapter *adapter);
void igc_ptp_reset(struct igc_adapter *adapter); void igc_ptp_reset(struct igc_adapter *adapter);
......
...@@ -931,16 +931,15 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev, ...@@ -931,16 +931,15 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev,
} }
#define ETHER_TYPE_FULL_MASK ((__force __be16)~0) #define ETHER_TYPE_FULL_MASK ((__force __be16)~0)
static int igc_ethtool_get_nfc_entry(struct igc_adapter *adapter, static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter,
struct ethtool_rxnfc *cmd) struct ethtool_rxnfc *cmd)
{ {
struct ethtool_rx_flow_spec *fsp = &cmd->fs; struct ethtool_rx_flow_spec *fsp = &cmd->fs;
struct igc_nfc_filter *rule = NULL; struct igc_nfc_rule *rule = NULL;
/* report total rule count */ cmd->data = IGC_MAX_RXNFC_RULES;
cmd->data = IGC_MAX_RXNFC_FILTERS;
hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) { hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {
if (fsp->location <= rule->sw_idx) if (fsp->location <= rule->sw_idx)
break; break;
} }
...@@ -980,17 +979,16 @@ static int igc_ethtool_get_nfc_entry(struct igc_adapter *adapter, ...@@ -980,17 +979,16 @@ static int igc_ethtool_get_nfc_entry(struct igc_adapter *adapter,
return 0; return 0;
} }
static int igc_ethtool_get_nfc_all(struct igc_adapter *adapter, static int igc_ethtool_get_nfc_rules(struct igc_adapter *adapter,
struct ethtool_rxnfc *cmd, struct ethtool_rxnfc *cmd,
u32 *rule_locs) u32 *rule_locs)
{ {
struct igc_nfc_filter *rule; struct igc_nfc_rule *rule;
int cnt = 0; int cnt = 0;
/* report total rule count */ cmd->data = IGC_MAX_RXNFC_RULES;
cmd->data = IGC_MAX_RXNFC_FILTERS;
hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) { hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {
if (cnt == cmd->rule_cnt) if (cnt == cmd->rule_cnt)
return -EMSGSIZE; return -EMSGSIZE;
rule_locs[cnt] = rule->sw_idx; rule_locs[cnt] = rule->sw_idx;
...@@ -1062,12 +1060,12 @@ static int igc_ethtool_get_rxnfc(struct net_device *dev, ...@@ -1062,12 +1060,12 @@ static int igc_ethtool_get_rxnfc(struct net_device *dev,
cmd->data = adapter->num_rx_queues; cmd->data = adapter->num_rx_queues;
return 0; return 0;
case ETHTOOL_GRXCLSRLCNT: case ETHTOOL_GRXCLSRLCNT:
cmd->rule_cnt = adapter->nfc_filter_count; cmd->rule_cnt = adapter->nfc_rule_count;
return 0; return 0;
case ETHTOOL_GRXCLSRULE: case ETHTOOL_GRXCLSRULE:
return igc_ethtool_get_nfc_entry(adapter, cmd); return igc_ethtool_get_nfc_rule(adapter, cmd);
case ETHTOOL_GRXCLSRLALL: case ETHTOOL_GRXCLSRLALL:
return igc_ethtool_get_nfc_all(adapter, cmd, rule_locs); return igc_ethtool_get_nfc_rules(adapter, cmd, rule_locs);
case ETHTOOL_GRXFH: case ETHTOOL_GRXFH:
return igc_ethtool_get_rss_hash_opts(adapter, cmd); return igc_ethtool_get_rss_hash_opts(adapter, cmd);
default: default:
...@@ -1179,38 +1177,37 @@ static int igc_ethtool_set_rss_hash_opt(struct igc_adapter *adapter, ...@@ -1179,38 +1177,37 @@ static int igc_ethtool_set_rss_hash_opt(struct igc_adapter *adapter,
return 0; return 0;
} }
int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input) int igc_enable_nfc_rule(struct igc_adapter *adapter,
const struct igc_nfc_rule *rule)
{ {
int err = -EINVAL; int err = -EINVAL;
if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) { if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
u16 etype = ntohs(input->filter.etype); u16 etype = ntohs(rule->filter.etype);
err = igc_add_etype_filter(adapter, etype, input->action); err = igc_add_etype_filter(adapter, etype, rule->action);
if (err) if (err)
return err; return err;
} }
if (input->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) { if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) {
err = igc_add_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC, err = igc_add_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC,
input->filter.src_addr, rule->filter.src_addr, rule->action);
input->action);
if (err) if (err)
return err; return err;
} }
if (input->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) { if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) {
err = igc_add_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST, err = igc_add_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST,
input->filter.dst_addr, rule->filter.dst_addr, rule->action);
input->action);
if (err) if (err)
return err; return err;
} }
if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) { if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) >> int prio = (ntohs(rule->filter.vlan_tci) & VLAN_PRIO_MASK) >>
VLAN_PRIO_SHIFT; VLAN_PRIO_SHIFT;
err = igc_add_vlan_prio_filter(adapter, prio, input->action); err = igc_add_vlan_prio_filter(adapter, prio, rule->action);
if (err) if (err)
return err; return err;
} }
...@@ -1218,42 +1215,43 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input) ...@@ -1218,42 +1215,43 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
return 0; return 0;
} }
int igc_erase_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input) int igc_disable_nfc_rule(struct igc_adapter *adapter,
const struct igc_nfc_rule *rule)
{ {
if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) { if (rule->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
u16 etype = ntohs(input->filter.etype); u16 etype = ntohs(rule->filter.etype);
igc_del_etype_filter(adapter, etype); igc_del_etype_filter(adapter, etype);
} }
if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) { if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) >> int prio = (ntohs(rule->filter.vlan_tci) & VLAN_PRIO_MASK) >>
VLAN_PRIO_SHIFT; VLAN_PRIO_SHIFT;
igc_del_vlan_prio_filter(adapter, prio); igc_del_vlan_prio_filter(adapter, prio);
} }
if (input->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) if (rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR)
igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC, igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_SRC,
input->filter.src_addr); rule->filter.src_addr);
if (input->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR)
igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST, igc_del_mac_filter(adapter, IGC_MAC_FILTER_TYPE_DST,
input->filter.dst_addr); rule->filter.dst_addr);
return 0; return 0;
} }
static int igc_ethtool_update_nfc_entry(struct igc_adapter *adapter, static int igc_ethtool_update_nfc_rule(struct igc_adapter *adapter,
struct igc_nfc_filter *input, struct igc_nfc_rule *input,
u16 sw_idx) u16 sw_idx)
{ {
struct igc_nfc_filter *rule, *parent; struct igc_nfc_rule *rule, *parent;
int err = -EINVAL; int err = -EINVAL;
parent = NULL; parent = NULL;
rule = NULL; rule = NULL;
hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) { hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {
/* hash found, or no matching entry */ /* hash found, or no matching entry */
if (rule->sw_idx >= sw_idx) if (rule->sw_idx >= sw_idx)
break; break;
...@@ -1263,11 +1261,11 @@ static int igc_ethtool_update_nfc_entry(struct igc_adapter *adapter, ...@@ -1263,11 +1261,11 @@ static int igc_ethtool_update_nfc_entry(struct igc_adapter *adapter,
/* if there is an old rule occupying our place remove it */ /* if there is an old rule occupying our place remove it */
if (rule && rule->sw_idx == sw_idx) { if (rule && rule->sw_idx == sw_idx) {
if (!input) if (!input)
err = igc_erase_filter(adapter, rule); err = igc_disable_nfc_rule(adapter, rule);
hlist_del(&rule->nfc_node); hlist_del(&rule->nfc_node);
kfree(rule); kfree(rule);
adapter->nfc_filter_count--; adapter->nfc_rule_count--;
} }
/* If no input this was a delete, err should be 0 if a rule was /* If no input this was a delete, err should be 0 if a rule was
...@@ -1283,21 +1281,21 @@ static int igc_ethtool_update_nfc_entry(struct igc_adapter *adapter, ...@@ -1283,21 +1281,21 @@ static int igc_ethtool_update_nfc_entry(struct igc_adapter *adapter,
if (parent) if (parent)
hlist_add_behind(&input->nfc_node, &parent->nfc_node); hlist_add_behind(&input->nfc_node, &parent->nfc_node);
else else
hlist_add_head(&input->nfc_node, &adapter->nfc_filter_list); hlist_add_head(&input->nfc_node, &adapter->nfc_rule_list);
/* update counts */ /* update counts */
adapter->nfc_filter_count++; adapter->nfc_rule_count++;
return 0; return 0;
} }
static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter, static int igc_ethtool_add_nfc_rule(struct igc_adapter *adapter,
struct ethtool_rxnfc *cmd) struct ethtool_rxnfc *cmd)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct ethtool_rx_flow_spec *fsp = struct ethtool_rx_flow_spec *fsp =
(struct ethtool_rx_flow_spec *)&cmd->fs; (struct ethtool_rx_flow_spec *)&cmd->fs;
struct igc_nfc_filter *input, *rule; struct igc_nfc_rule *rule, *tmp;
int err = 0; int err = 0;
if (!(netdev->hw_features & NETIF_F_NTUPLE)) if (!(netdev->hw_features & NETIF_F_NTUPLE))
...@@ -1314,7 +1312,7 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter, ...@@ -1314,7 +1312,7 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter,
} }
/* Don't allow indexes to exist outside of available space */ /* Don't allow indexes to exist outside of available space */
if (fsp->location >= IGC_MAX_RXNFC_FILTERS) { if (fsp->location >= IGC_MAX_RXNFC_RULES) {
netdev_err(netdev, "Location out of range\n"); netdev_err(netdev, "Location out of range\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1322,32 +1320,32 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter, ...@@ -1322,32 +1320,32 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter,
if ((fsp->flow_type & ~FLOW_EXT) != ETHER_FLOW) if ((fsp->flow_type & ~FLOW_EXT) != ETHER_FLOW)
return -EINVAL; return -EINVAL;
input = kzalloc(sizeof(*input), GFP_KERNEL); rule = kzalloc(sizeof(*rule), GFP_KERNEL);
if (!input) if (!rule)
return -ENOMEM; return -ENOMEM;
if (fsp->m_u.ether_spec.h_proto == ETHER_TYPE_FULL_MASK) { if (fsp->m_u.ether_spec.h_proto == ETHER_TYPE_FULL_MASK) {
input->filter.etype = fsp->h_u.ether_spec.h_proto; rule->filter.etype = fsp->h_u.ether_spec.h_proto;
input->filter.match_flags = IGC_FILTER_FLAG_ETHER_TYPE; rule->filter.match_flags = IGC_FILTER_FLAG_ETHER_TYPE;
} }
/* Both source and destination address filters only support the full /* Both source and destination address filters only support the full
* mask. * mask.
*/ */
if (is_broadcast_ether_addr(fsp->m_u.ether_spec.h_source)) { if (is_broadcast_ether_addr(fsp->m_u.ether_spec.h_source)) {
input->filter.match_flags |= IGC_FILTER_FLAG_SRC_MAC_ADDR; rule->filter.match_flags |= IGC_FILTER_FLAG_SRC_MAC_ADDR;
ether_addr_copy(input->filter.src_addr, ether_addr_copy(rule->filter.src_addr,
fsp->h_u.ether_spec.h_source); fsp->h_u.ether_spec.h_source);
} }
if (is_broadcast_ether_addr(fsp->m_u.ether_spec.h_dest)) { if (is_broadcast_ether_addr(fsp->m_u.ether_spec.h_dest)) {
input->filter.match_flags |= IGC_FILTER_FLAG_DST_MAC_ADDR; rule->filter.match_flags |= IGC_FILTER_FLAG_DST_MAC_ADDR;
ether_addr_copy(input->filter.dst_addr, ether_addr_copy(rule->filter.dst_addr,
fsp->h_u.ether_spec.h_dest); fsp->h_u.ether_spec.h_dest);
} }
if (input->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR && if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR &&
input->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) { rule->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) {
netdev_dbg(netdev, "Filters with both dst and src are not supported\n"); netdev_dbg(netdev, "Filters with both dst and src are not supported\n");
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto err_out; goto err_out;
...@@ -1359,18 +1357,18 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter, ...@@ -1359,18 +1357,18 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter,
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto err_out; goto err_out;
} }
input->filter.vlan_tci = fsp->h_ext.vlan_tci; rule->filter.vlan_tci = fsp->h_ext.vlan_tci;
input->filter.match_flags |= IGC_FILTER_FLAG_VLAN_TCI; rule->filter.match_flags |= IGC_FILTER_FLAG_VLAN_TCI;
} }
input->action = fsp->ring_cookie; rule->action = fsp->ring_cookie;
input->sw_idx = fsp->location; rule->sw_idx = fsp->location;
spin_lock(&adapter->nfc_lock); spin_lock(&adapter->nfc_rule_lock);
hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) { hlist_for_each_entry(tmp, &adapter->nfc_rule_list, nfc_node) {
if (!memcmp(&input->filter, &rule->filter, if (!memcmp(&rule->filter, &tmp->filter,
sizeof(input->filter))) { sizeof(rule->filter))) {
err = -EEXIST; err = -EEXIST;
netdev_err(netdev, netdev_err(netdev,
"ethtool: this filter is already set\n"); "ethtool: this filter is already set\n");
...@@ -1378,32 +1376,32 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter, ...@@ -1378,32 +1376,32 @@ static int igc_ethtool_add_nfc_entry(struct igc_adapter *adapter,
} }
} }
err = igc_add_filter(adapter, input); err = igc_enable_nfc_rule(adapter, rule);
if (err) if (err)
goto err_out_w_lock; goto err_out_w_lock;
igc_ethtool_update_nfc_entry(adapter, input, input->sw_idx); igc_ethtool_update_nfc_rule(adapter, rule, rule->sw_idx);
spin_unlock(&adapter->nfc_lock); spin_unlock(&adapter->nfc_rule_lock);
return 0; return 0;
err_out_w_lock: err_out_w_lock:
spin_unlock(&adapter->nfc_lock); spin_unlock(&adapter->nfc_rule_lock);
err_out: err_out:
kfree(input); kfree(rule);
return err; return err;
} }
static int igc_ethtool_del_nfc_entry(struct igc_adapter *adapter, static int igc_ethtool_del_nfc_rule(struct igc_adapter *adapter,
struct ethtool_rxnfc *cmd) struct ethtool_rxnfc *cmd)
{ {
struct ethtool_rx_flow_spec *fsp = struct ethtool_rx_flow_spec *fsp =
(struct ethtool_rx_flow_spec *)&cmd->fs; (struct ethtool_rx_flow_spec *)&cmd->fs;
int err; int err;
spin_lock(&adapter->nfc_lock); spin_lock(&adapter->nfc_rule_lock);
err = igc_ethtool_update_nfc_entry(adapter, NULL, fsp->location); err = igc_ethtool_update_nfc_rule(adapter, NULL, fsp->location);
spin_unlock(&adapter->nfc_lock); spin_unlock(&adapter->nfc_rule_lock);
return err; return err;
} }
...@@ -1417,9 +1415,9 @@ static int igc_ethtool_set_rxnfc(struct net_device *dev, ...@@ -1417,9 +1415,9 @@ static int igc_ethtool_set_rxnfc(struct net_device *dev,
case ETHTOOL_SRXFH: case ETHTOOL_SRXFH:
return igc_ethtool_set_rss_hash_opt(adapter, cmd); return igc_ethtool_set_rss_hash_opt(adapter, cmd);
case ETHTOOL_SRXCLSRLINS: case ETHTOOL_SRXCLSRLINS:
return igc_ethtool_add_nfc_entry(adapter, cmd); return igc_ethtool_add_nfc_rule(adapter, cmd);
case ETHTOOL_SRXCLSRLDEL: case ETHTOOL_SRXCLSRLDEL:
return igc_ethtool_del_nfc_entry(adapter, cmd); return igc_ethtool_del_nfc_rule(adapter, cmd);
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -2174,16 +2174,16 @@ static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget) ...@@ -2174,16 +2174,16 @@ static bool igc_clean_tx_irq(struct igc_q_vector *q_vector, int napi_budget)
return !!budget; return !!budget;
} }
static void igc_nfc_filter_restore(struct igc_adapter *adapter) static void igc_restore_nfc_rules(struct igc_adapter *adapter)
{ {
struct igc_nfc_filter *rule; struct igc_nfc_rule *rule;
spin_lock(&adapter->nfc_lock); spin_lock(&adapter->nfc_rule_lock);
hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node)
igc_add_filter(adapter, rule); igc_enable_nfc_rule(adapter, rule);
spin_unlock(&adapter->nfc_lock); spin_unlock(&adapter->nfc_rule_lock);
} }
static int igc_find_mac_filter(struct igc_adapter *adapter, static int igc_find_mac_filter(struct igc_adapter *adapter,
...@@ -2537,7 +2537,7 @@ static void igc_configure(struct igc_adapter *adapter) ...@@ -2537,7 +2537,7 @@ static void igc_configure(struct igc_adapter *adapter)
igc_setup_rctl(adapter); igc_setup_rctl(adapter);
igc_set_default_mac_filter(adapter); igc_set_default_mac_filter(adapter);
igc_nfc_filter_restore(adapter); igc_restore_nfc_rules(adapter);
igc_configure_tx(adapter); igc_configure_tx(adapter);
igc_configure_rx(adapter); igc_configure_rx(adapter);
...@@ -3424,7 +3424,7 @@ static int igc_sw_init(struct igc_adapter *adapter) ...@@ -3424,7 +3424,7 @@ static int igc_sw_init(struct igc_adapter *adapter)
VLAN_HLEN; VLAN_HLEN;
adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
spin_lock_init(&adapter->nfc_lock); spin_lock_init(&adapter->nfc_rule_lock);
spin_lock_init(&adapter->stats64_lock); spin_lock_init(&adapter->stats64_lock);
/* Assume MSI-X interrupts, will be checked during IRQ allocation */ /* Assume MSI-X interrupts, will be checked during IRQ allocation */
adapter->flags |= IGC_FLAG_HAS_MSIX; adapter->flags |= IGC_FLAG_HAS_MSIX;
...@@ -3651,16 +3651,16 @@ void igc_update_stats(struct igc_adapter *adapter) ...@@ -3651,16 +3651,16 @@ void igc_update_stats(struct igc_adapter *adapter)
adapter->stats.mgpdc += rd32(IGC_MGTPDC); adapter->stats.mgpdc += rd32(IGC_MGTPDC);
} }
static void igc_nfc_filter_exit(struct igc_adapter *adapter) static void igc_nfc_rule_exit(struct igc_adapter *adapter)
{ {
struct igc_nfc_filter *rule; struct igc_nfc_rule *rule;
spin_lock(&adapter->nfc_lock); spin_lock(&adapter->nfc_rule_lock);
hlist_for_each_entry(rule, &adapter->nfc_filter_list, nfc_node) hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node)
igc_erase_filter(adapter, rule); igc_disable_nfc_rule(adapter, rule);
spin_unlock(&adapter->nfc_lock); spin_unlock(&adapter->nfc_rule_lock);
} }
/** /**
...@@ -3681,7 +3681,7 @@ void igc_down(struct igc_adapter *adapter) ...@@ -3681,7 +3681,7 @@ void igc_down(struct igc_adapter *adapter)
wr32(IGC_RCTL, rctl & ~IGC_RCTL_EN); wr32(IGC_RCTL, rctl & ~IGC_RCTL_EN);
/* flush and sleep below */ /* flush and sleep below */
igc_nfc_filter_exit(adapter); igc_nfc_rule_exit(adapter);
/* set trans_start so we don't get spurious watchdogs during reset */ /* set trans_start so we don't get spurious watchdogs during reset */
netif_trans_update(netdev); netif_trans_update(netdev);
...@@ -3833,17 +3833,17 @@ static int igc_set_features(struct net_device *netdev, ...@@ -3833,17 +3833,17 @@ static int igc_set_features(struct net_device *netdev,
if (!(features & NETIF_F_NTUPLE)) { if (!(features & NETIF_F_NTUPLE)) {
struct hlist_node *node2; struct hlist_node *node2;
struct igc_nfc_filter *rule; struct igc_nfc_rule *rule;
spin_lock(&adapter->nfc_lock); spin_lock(&adapter->nfc_rule_lock);
hlist_for_each_entry_safe(rule, node2, hlist_for_each_entry_safe(rule, node2,
&adapter->nfc_filter_list, nfc_node) { &adapter->nfc_rule_list, nfc_node) {
igc_erase_filter(adapter, rule); igc_disable_nfc_rule(adapter, rule);
hlist_del(&rule->nfc_node); hlist_del(&rule->nfc_node);
kfree(rule); kfree(rule);
} }
spin_unlock(&adapter->nfc_lock); spin_unlock(&adapter->nfc_rule_lock);
adapter->nfc_filter_count = 0; adapter->nfc_rule_count = 0;
} }
netdev->features = features; netdev->features = features;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment