|
@@ -1434,7 +1434,7 @@ struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
|
|
|
* the "safe" variants of any list iterators, e.g. list_for_each_entry_safe()
|
|
|
* instead of list_for_each_entry().
|
|
|
**/
|
|
|
-static void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f)
|
|
|
+void __i40e_del_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f)
|
|
|
{
|
|
|
if (!f)
|
|
|
return;
|
|
@@ -1477,18 +1477,19 @@ void i40e_del_filter(struct i40e_vsi *vsi, const u8 *macaddr, s16 vlan)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * i40e_put_mac_in_vlan - Make macvlan filters from macaddrs and vlans
|
|
|
+ * i40e_add_mac_filter - Add a MAC filter for all active VLANs
|
|
|
* @vsi: the VSI to be searched
|
|
|
* @macaddr: the mac address to be filtered
|
|
|
*
|
|
|
- * Goes through all the macvlan filters and adds a macvlan filter for each
|
|
|
+ * If we're not in VLAN mode, just add the filter to I40E_VLAN_ANY. Otherwise,
|
|
|
+ * go through all the macvlan filters and add a macvlan filter for each
|
|
|
* unique vlan that already exists. If a PVID has been assigned, instead only
|
|
|
* add the macaddr to that VLAN.
|
|
|
*
|
|
|
* Returns last filter added on success, else NULL
|
|
|
**/
|
|
|
-struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,
|
|
|
- const u8 *macaddr)
|
|
|
+struct i40e_mac_filter *i40e_add_mac_filter(struct i40e_vsi *vsi,
|
|
|
+ const u8 *macaddr)
|
|
|
{
|
|
|
struct i40e_mac_filter *f, *add = NULL;
|
|
|
struct hlist_node *h;
|
|
@@ -1498,6 +1499,9 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,
|
|
|
return i40e_add_filter(vsi, macaddr,
|
|
|
le16_to_cpu(vsi->info.pvid));
|
|
|
|
|
|
+ if (!i40e_is_vsi_in_vlan(vsi))
|
|
|
+ return i40e_add_filter(vsi, macaddr, I40E_VLAN_ANY);
|
|
|
+
|
|
|
hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist) {
|
|
|
if (f->state == I40E_FILTER_REMOVE)
|
|
|
continue;
|
|
@@ -1510,15 +1514,16 @@ struct i40e_mac_filter *i40e_put_mac_in_vlan(struct i40e_vsi *vsi,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * i40e_del_mac_all_vlan - Remove a MAC filter from all VLANS
|
|
|
+ * i40e_del_mac_filter - Remove a MAC filter from all VLANs
|
|
|
* @vsi: the VSI to be searched
|
|
|
* @macaddr: the mac address to be removed
|
|
|
*
|
|
|
- * Removes a given MAC address from a VSI, regardless of VLAN
|
|
|
+ * Removes a given MAC address from a VSI regardless of what VLAN it has been
|
|
|
+ * associated with.
|
|
|
*
|
|
|
* Returns 0 for success, or error
|
|
|
**/
|
|
|
-int i40e_del_mac_all_vlan(struct i40e_vsi *vsi, const u8 *macaddr)
|
|
|
+int i40e_del_mac_filter(struct i40e_vsi *vsi, const u8 *macaddr)
|
|
|
{
|
|
|
struct i40e_mac_filter *f;
|
|
|
struct hlist_node *h;
|
|
@@ -1579,8 +1584,8 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
|
|
|
netdev_info(netdev, "set new mac address %pM\n", addr->sa_data);
|
|
|
|
|
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
|
|
- i40e_del_mac_all_vlan(vsi, netdev->dev_addr);
|
|
|
- i40e_put_mac_in_vlan(vsi, addr->sa_data);
|
|
|
+ i40e_del_mac_filter(vsi, netdev->dev_addr);
|
|
|
+ i40e_add_mac_filter(vsi, addr->sa_data);
|
|
|
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
|
|
ether_addr_copy(netdev->dev_addr, addr->sa_data);
|
|
|
if (vsi->type == I40E_VSI_MAIN) {
|
|
@@ -1756,14 +1761,8 @@ static int i40e_addr_sync(struct net_device *netdev, const u8 *addr)
|
|
|
{
|
|
|
struct i40e_netdev_priv *np = netdev_priv(netdev);
|
|
|
struct i40e_vsi *vsi = np->vsi;
|
|
|
- struct i40e_mac_filter *f;
|
|
|
|
|
|
- if (i40e_is_vsi_in_vlan(vsi))
|
|
|
- f = i40e_put_mac_in_vlan(vsi, addr);
|
|
|
- else
|
|
|
- f = i40e_add_filter(vsi, addr, I40E_VLAN_ANY);
|
|
|
-
|
|
|
- if (f)
|
|
|
+ if (i40e_add_mac_filter(vsi, addr))
|
|
|
return 0;
|
|
|
else
|
|
|
return -ENOMEM;
|
|
@@ -1782,10 +1781,7 @@ static int i40e_addr_unsync(struct net_device *netdev, const u8 *addr)
|
|
|
struct i40e_netdev_priv *np = netdev_priv(netdev);
|
|
|
struct i40e_vsi *vsi = np->vsi;
|
|
|
|
|
|
- if (i40e_is_vsi_in_vlan(vsi))
|
|
|
- i40e_del_mac_all_vlan(vsi, addr);
|
|
|
- else
|
|
|
- i40e_del_filter(vsi, addr, I40E_VLAN_ANY);
|
|
|
+ i40e_del_mac_filter(vsi, addr);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -2568,12 +2564,15 @@ int i40e_add_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)
|
|
|
/**
|
|
|
* i40e_vsi_add_vlan - Add VSI membership for given VLAN
|
|
|
* @vsi: the VSI being configured
|
|
|
- * @vid: VLAN id to be added (0 = untagged only , -1 = any)
|
|
|
+ * @vid: VLAN id to be added
|
|
|
**/
|
|
|
-int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid)
|
|
|
+int i40e_vsi_add_vlan(struct i40e_vsi *vsi, u16 vid)
|
|
|
{
|
|
|
int err;
|
|
|
|
|
|
+ if (!vid || vsi->info.pvid)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
/* Locked once because all functions invoked below iterates list*/
|
|
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
|
|
err = i40e_add_vlan_all_mac(vsi, vid);
|
|
@@ -2616,10 +2615,13 @@ void i40e_rm_vlan_all_mac(struct i40e_vsi *vsi, s16 vid)
|
|
|
/**
|
|
|
* i40e_vsi_kill_vlan - Remove VSI membership for given VLAN
|
|
|
* @vsi: the VSI being configured
|
|
|
- * @vid: VLAN id to be removed (0 = untagged only , -1 = any)
|
|
|
+ * @vid: VLAN id to be removed
|
|
|
**/
|
|
|
-void i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid)
|
|
|
+void i40e_vsi_kill_vlan(struct i40e_vsi *vsi, u16 vid)
|
|
|
{
|
|
|
+ if (!vid || vsi->info.pvid)
|
|
|
+ return;
|
|
|
+
|
|
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
|
|
i40e_rm_vlan_all_mac(vsi, vid);
|
|
|
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
|
@@ -3266,7 +3268,7 @@ static void i40e_vsi_configure_msix(struct i40e_vsi *vsi)
|
|
|
wr32(hw, I40E_PFINT_ITRN(I40E_TX_ITR, vector - 1),
|
|
|
q_vector->tx.itr);
|
|
|
wr32(hw, I40E_PFINT_RATEN(vector - 1),
|
|
|
- INTRL_USEC_TO_REG(vsi->int_rate_limit));
|
|
|
+ i40e_intrl_usec_to_reg(vsi->int_rate_limit));
|
|
|
|
|
|
/* Linked list for the queuepairs assigned to this vector */
|
|
|
wr32(hw, I40E_PFINT_LNKLSTN(vector - 1), qp);
|
|
@@ -8682,7 +8684,7 @@ static int i40e_sw_init(struct i40e_pf *pf)
|
|
|
pf->hw.func_caps.fd_filters_best_effort;
|
|
|
}
|
|
|
|
|
|
- if (i40e_is_mac_710(&pf->hw) &&
|
|
|
+ if ((pf->hw.mac.type == I40E_MAC_XL710) &&
|
|
|
(((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
|
|
|
(pf->hw.aq.fw_maj_ver < 4))) {
|
|
|
pf->flags |= I40E_FLAG_RESTART_AUTONEG;
|
|
@@ -8691,13 +8693,13 @@ static int i40e_sw_init(struct i40e_pf *pf)
|
|
|
}
|
|
|
|
|
|
/* Disable FW LLDP if FW < v4.3 */
|
|
|
- if (i40e_is_mac_710(&pf->hw) &&
|
|
|
+ if ((pf->hw.mac.type == I40E_MAC_XL710) &&
|
|
|
(((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 3)) ||
|
|
|
(pf->hw.aq.fw_maj_ver < 4)))
|
|
|
pf->flags |= I40E_FLAG_STOP_FW_LLDP;
|
|
|
|
|
|
/* Use the FW Set LLDP MIB API if FW > v4.40 */
|
|
|
- if (i40e_is_mac_710(&pf->hw) &&
|
|
|
+ if ((pf->hw.mac.type == I40E_MAC_XL710) &&
|
|
|
(((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver >= 40)) ||
|
|
|
(pf->hw.aq.fw_maj_ver >= 5)))
|
|
|
pf->flags |= I40E_FLAG_USE_SET_LLDP_MIB;
|
|
@@ -9339,7 +9341,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
|
|
|
*/
|
|
|
i40e_rm_default_mac_filter(vsi, mac_addr);
|
|
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
|
|
- i40e_add_filter(vsi, mac_addr, I40E_VLAN_ANY);
|
|
|
+ i40e_add_mac_filter(vsi, mac_addr);
|
|
|
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
|
|
} else {
|
|
|
/* relate the VSI_VMDQ name to the VSI_MAIN name */
|
|
@@ -9348,7 +9350,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
|
|
|
random_ether_addr(mac_addr);
|
|
|
|
|
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
|
|
- i40e_add_filter(vsi, mac_addr, I40E_VLAN_ANY);
|
|
|
+ i40e_add_mac_filter(vsi, mac_addr);
|
|
|
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
|
|
}
|
|
|
|
|
@@ -9367,7 +9369,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
|
|
|
*/
|
|
|
eth_broadcast_addr(broadcast);
|
|
|
spin_lock_bh(&vsi->mac_filter_hash_lock);
|
|
|
- i40e_add_filter(vsi, broadcast, I40E_VLAN_ANY);
|
|
|
+ i40e_add_mac_filter(vsi, broadcast);
|
|
|
spin_unlock_bh(&vsi->mac_filter_hash_lock);
|
|
|
|
|
|
ether_addr_copy(netdev->dev_addr, mac_addr);
|