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);
......
...@@ -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