spin_lock(&adapter->nfc_rule_lock);
- hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {
+ list_for_each_entry(rule, &adapter->nfc_rule_list, list) {
if (fsp->location <= rule->location)
break;
}
spin_lock(&adapter->nfc_rule_lock);
- hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {
+ list_for_each_entry(rule, &adapter->nfc_rule_list, list) {
if (cnt == cmd->rule_cnt) {
spin_unlock(&adapter->nfc_rule_lock);
return -EMSGSIZE;
parent = NULL;
rule = NULL;
- hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node) {
+ list_for_each_entry(rule, &adapter->nfc_rule_list, list) {
/* hash found, or no matching entry */
if (rule->location >= location)
break;
if (rule && rule->location == location) {
err = igc_disable_nfc_rule(adapter, rule);
- hlist_del(&rule->nfc_node);
+ list_del(&rule->list);
kfree(rule);
adapter->nfc_rule_count--;
}
if (!input)
return err;
- /* add filter to the list */
- if (parent)
- hlist_add_behind(&input->nfc_node, &parent->nfc_node);
- else
- hlist_add_head(&input->nfc_node, &adapter->nfc_rule_list);
+ list_add(&input->list, parent ? &parent->list :
+ &adapter->nfc_rule_list);
/* update counts */
adapter->nfc_rule_count++;
static void igc_ethtool_init_nfc_rule(struct igc_nfc_rule *rule,
const struct ethtool_rx_flow_spec *fsp)
{
- INIT_HLIST_NODE(&rule->nfc_node);
+ INIT_LIST_HEAD(&rule->list);
rule->action = fsp->ring_cookie;
rule->location = fsp->location;
return -EOPNOTSUPP;
}
- hlist_for_each_entry(tmp, &adapter->nfc_rule_list, nfc_node) {
+ list_for_each_entry(tmp, &adapter->nfc_rule_list, list) {
if (!memcmp(&rule->filter, &tmp->filter,
sizeof(rule->filter))) {
netdev_dbg(dev, "Rule already exists\n");
spin_lock(&adapter->nfc_rule_lock);
- hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node)
+ list_for_each_entry_reverse(rule, &adapter->nfc_rule_list, list)
igc_enable_nfc_rule(adapter, rule);
spin_unlock(&adapter->nfc_rule_lock);
adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
spin_lock_init(&adapter->nfc_rule_lock);
+ INIT_LIST_HEAD(&adapter->nfc_rule_list);
+ adapter->nfc_rule_count = 0;
+
spin_lock_init(&adapter->stats64_lock);
/* Assume MSI-X interrupts, will be checked during IRQ allocation */
adapter->flags |= IGC_FLAG_HAS_MSIX;
spin_lock(&adapter->nfc_rule_lock);
- hlist_for_each_entry(rule, &adapter->nfc_rule_list, nfc_node)
+ list_for_each_entry(rule, &adapter->nfc_rule_list, list)
igc_disable_nfc_rule(adapter, rule);
spin_unlock(&adapter->nfc_rule_lock);
return 0;
if (!(features & NETIF_F_NTUPLE)) {
- struct hlist_node *node2;
- struct igc_nfc_rule *rule;
+ struct igc_nfc_rule *rule, *tmp;
spin_lock(&adapter->nfc_rule_lock);
- hlist_for_each_entry_safe(rule, node2,
- &adapter->nfc_rule_list, nfc_node) {
+ list_for_each_entry_safe(rule, tmp,
+ &adapter->nfc_rule_list, list) {
igc_disable_nfc_rule(adapter, rule);
- hlist_del(&rule->nfc_node);
+ list_del(&rule->list);
kfree(rule);
}
spin_unlock(&adapter->nfc_rule_lock);