Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 1GbE Intel Wired LAN Driver Updates 2016-02-15 This series contains updates to igb only. Shota Suzuki cleans up unnecessary flag setting for 82576 in igb_set_flag_queue_pairs() since the default block already sets IGB_FLAG_QUEUE_PAIRS to the correct value anyways, so the e1000_82576 code block is not necessary and we can simply fall through. Then fixes an issue where IGB_FLAG_QUEUE_PAIRS can now be set by using "ethtool -L" option but is never cleared unless the driver is reloaded, so clear the queue pairing if the pairing becomes unnecessary as a result of "ethtool -L". Mitch fixes the igbvf from giving up if it fails to get the hardware mailbox lock. This can happen when the PF-VF communication channel is heavily loaded and causes complete communications failure between the PF and VF drivers, so add a counter and a delay so that the driver will now retry ten times before giving up on getting the mailbox lock. The remaining patches in the series are from Alex Duyck, starting with the cleaning up code that sets the MAC address. Then refactors the VFTA and VLVF configuration, to simplify and update to similar setups in the ixgbe driver. Fixed an issue were VLANs headers size was being added to the value programmed into the RLPML registers, yet these registers already take into account the size of the VLAN headers when determining the maximum packet length, so we can drop the code that adds the size to the RLPML registers. Cleaned up the configuration of the VF port based VLAN configuration. Also fixed the igb driver so that we can fully support SR-IOV or the recently added NTUPLE filtering while allowing support for VLAN promiscuous mode. Also added the ability to use the bridge utility to add a FDB entry for the PF to an igb port. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
31d035a0d3
|
@ -34,6 +34,7 @@
|
|||
#include "e1000_mac.h"
|
||||
#include "e1000_82575.h"
|
||||
#include "e1000_i210.h"
|
||||
#include "igb.h"
|
||||
|
||||
static s32 igb_get_invariants_82575(struct e1000_hw *);
|
||||
static s32 igb_acquire_phy_82575(struct e1000_hw *);
|
||||
|
@ -71,6 +72,32 @@ static s32 igb_update_nvm_checksum_i350(struct e1000_hw *hw);
|
|||
static const u16 e1000_82580_rxpbs_table[] = {
|
||||
36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140 };
|
||||
|
||||
/* Due to a hw errata, if the host tries to configure the VFTA register
|
||||
* while performing queries from the BMC or DMA, then the VFTA in some
|
||||
* cases won't be written.
|
||||
*/
|
||||
|
||||
/**
|
||||
* igb_write_vfta_i350 - Write value to VLAN filter table
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: register offset in VLAN filter table
|
||||
* @value: register value written to VLAN filter table
|
||||
*
|
||||
* Writes value at the given offset in the register array which stores
|
||||
* the VLAN filter table.
|
||||
**/
|
||||
static void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)
|
||||
{
|
||||
struct igb_adapter *adapter = hw->back;
|
||||
int i;
|
||||
|
||||
for (i = 10; i--;)
|
||||
array_wr32(E1000_VFTA, offset, value);
|
||||
|
||||
wrfl();
|
||||
adapter->shadow_vfta[offset] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_sgmii_uses_mdio_82575 - Determine if I2C pins are for external MDIO
|
||||
* @hw: pointer to the HW structure
|
||||
|
@ -398,6 +425,8 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw)
|
|||
|
||||
/* Set mta register count */
|
||||
mac->mta_reg_count = 128;
|
||||
/* Set uta register count */
|
||||
mac->uta_reg_count = (hw->mac.type == e1000_82575) ? 0 : 128;
|
||||
/* Set rar entry count */
|
||||
switch (mac->type) {
|
||||
case e1000_82576:
|
||||
|
@ -429,6 +458,11 @@ static s32 igb_init_mac_params_82575(struct e1000_hw *hw)
|
|||
mac->ops.release_swfw_sync = igb_release_swfw_sync_82575;
|
||||
}
|
||||
|
||||
if ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))
|
||||
mac->ops.write_vfta = igb_write_vfta_i350;
|
||||
else
|
||||
mac->ops.write_vfta = igb_write_vfta;
|
||||
|
||||
/* Set if part includes ASF firmware */
|
||||
mac->asf_firmware_present = true;
|
||||
/* Set if manageability features are enabled. */
|
||||
|
@ -1517,10 +1551,7 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
|
|||
|
||||
/* Disabling VLAN filtering */
|
||||
hw_dbg("Initializing the IEEE VLAN\n");
|
||||
if ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))
|
||||
igb_clear_vfta_i350(hw);
|
||||
else
|
||||
igb_clear_vfta(hw);
|
||||
igb_clear_vfta(hw);
|
||||
|
||||
/* Setup the receive address */
|
||||
igb_init_rx_addrs(hw, rar_count);
|
||||
|
|
|
@ -356,7 +356,8 @@
|
|||
/* Ethertype field values */
|
||||
#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */
|
||||
|
||||
#define MAX_JUMBO_FRAME_SIZE 0x3F00
|
||||
/* As per the EAS the maximum supported size is 9.5KB (9728 bytes) */
|
||||
#define MAX_JUMBO_FRAME_SIZE 0x2600
|
||||
|
||||
/* PBA constants */
|
||||
#define E1000_PBA_34K 0x0022
|
||||
|
|
|
@ -325,7 +325,7 @@ struct e1000_mac_operations {
|
|||
s32 (*get_thermal_sensor_data)(struct e1000_hw *);
|
||||
s32 (*init_thermal_sensor_thresh)(struct e1000_hw *);
|
||||
#endif
|
||||
|
||||
void (*write_vfta)(struct e1000_hw *, u32, u32);
|
||||
};
|
||||
|
||||
struct e1000_phy_operations {
|
||||
|
|
|
@ -92,10 +92,8 @@ void igb_clear_vfta(struct e1000_hw *hw)
|
|||
{
|
||||
u32 offset;
|
||||
|
||||
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
|
||||
array_wr32(E1000_VFTA, offset, 0);
|
||||
wrfl();
|
||||
}
|
||||
for (offset = E1000_VLAN_FILTER_TBL_SIZE; offset--;)
|
||||
hw->mac.ops.write_vfta(hw, offset, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,54 +105,14 @@ void igb_clear_vfta(struct e1000_hw *hw)
|
|||
* Writes value at the given offset in the register array which stores
|
||||
* the VLAN filter table.
|
||||
**/
|
||||
static void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
|
||||
void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
|
||||
{
|
||||
struct igb_adapter *adapter = hw->back;
|
||||
|
||||
array_wr32(E1000_VFTA, offset, value);
|
||||
wrfl();
|
||||
}
|
||||
|
||||
/* Due to a hw errata, if the host tries to configure the VFTA register
|
||||
* while performing queries from the BMC or DMA, then the VFTA in some
|
||||
* cases won't be written.
|
||||
*/
|
||||
|
||||
/**
|
||||
* igb_clear_vfta_i350 - Clear VLAN filter table
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Clears the register array which contains the VLAN filter table by
|
||||
* setting all the values to 0.
|
||||
**/
|
||||
void igb_clear_vfta_i350(struct e1000_hw *hw)
|
||||
{
|
||||
u32 offset;
|
||||
int i;
|
||||
|
||||
for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
|
||||
for (i = 0; i < 10; i++)
|
||||
array_wr32(E1000_VFTA, offset, 0);
|
||||
|
||||
wrfl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_write_vfta_i350 - Write value to VLAN filter table
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: register offset in VLAN filter table
|
||||
* @value: register value written to VLAN filter table
|
||||
*
|
||||
* Writes value at the given offset in the register array which stores
|
||||
* the VLAN filter table.
|
||||
**/
|
||||
static void igb_write_vfta_i350(struct e1000_hw *hw, u32 offset, u32 value)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
array_wr32(E1000_VFTA, offset, value);
|
||||
|
||||
wrfl();
|
||||
adapter->shadow_vfta[offset] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,41 +140,156 @@ void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count)
|
|||
hw->mac.ops.rar_set(hw, mac_addr, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_find_vlvf_slot - find the VLAN id or the first empty slot
|
||||
* @hw: pointer to hardware structure
|
||||
* @vlan: VLAN id to write to VLAN filter
|
||||
* @vlvf_bypass: skip VLVF if no match is found
|
||||
*
|
||||
* return the VLVF index where this VLAN id should be placed
|
||||
*
|
||||
**/
|
||||
static s32 igb_find_vlvf_slot(struct e1000_hw *hw, u32 vlan, bool vlvf_bypass)
|
||||
{
|
||||
s32 regindex, first_empty_slot;
|
||||
u32 bits;
|
||||
|
||||
/* short cut the special case */
|
||||
if (vlan == 0)
|
||||
return 0;
|
||||
|
||||
/* if vlvf_bypass is set we don't want to use an empty slot, we
|
||||
* will simply bypass the VLVF if there are no entries present in the
|
||||
* VLVF that contain our VLAN
|
||||
*/
|
||||
first_empty_slot = vlvf_bypass ? -E1000_ERR_NO_SPACE : 0;
|
||||
|
||||
/* Search for the VLAN id in the VLVF entries. Save off the first empty
|
||||
* slot found along the way.
|
||||
*
|
||||
* pre-decrement loop covering (IXGBE_VLVF_ENTRIES - 1) .. 1
|
||||
*/
|
||||
for (regindex = E1000_VLVF_ARRAY_SIZE; --regindex > 0;) {
|
||||
bits = rd32(E1000_VLVF(regindex)) & E1000_VLVF_VLANID_MASK;
|
||||
if (bits == vlan)
|
||||
return regindex;
|
||||
if (!first_empty_slot && !bits)
|
||||
first_empty_slot = regindex;
|
||||
}
|
||||
|
||||
return first_empty_slot ? : -E1000_ERR_NO_SPACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_vfta_set - enable or disable vlan in VLAN filter table
|
||||
* @hw: pointer to the HW structure
|
||||
* @vid: VLAN id to add or remove
|
||||
* @add: if true add filter, if false remove
|
||||
* @vlan: VLAN id to add or remove
|
||||
* @vind: VMDq output index that maps queue to VLAN id
|
||||
* @vlan_on: if true add filter, if false remove
|
||||
*
|
||||
* Sets or clears a bit in the VLAN filter table array based on VLAN id
|
||||
* and if we are adding or removing the filter
|
||||
**/
|
||||
s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add)
|
||||
s32 igb_vfta_set(struct e1000_hw *hw, u32 vlan, u32 vind,
|
||||
bool vlan_on, bool vlvf_bypass)
|
||||
{
|
||||
u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK;
|
||||
u32 mask = 1 << (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
|
||||
u32 vfta;
|
||||
struct igb_adapter *adapter = hw->back;
|
||||
s32 ret_val = 0;
|
||||
u32 regidx, vfta_delta, vfta, bits;
|
||||
s32 vlvf_index;
|
||||
|
||||
vfta = adapter->shadow_vfta[index];
|
||||
if ((vlan > 4095) || (vind > 7))
|
||||
return -E1000_ERR_PARAM;
|
||||
|
||||
/* bit was set/cleared before we started */
|
||||
if ((!!(vfta & mask)) == add) {
|
||||
ret_val = -E1000_ERR_CONFIG;
|
||||
} else {
|
||||
if (add)
|
||||
vfta |= mask;
|
||||
else
|
||||
vfta &= ~mask;
|
||||
/* this is a 2 part operation - first the VFTA, then the
|
||||
* VLVF and VLVFB if VT Mode is set
|
||||
* We don't write the VFTA until we know the VLVF part succeeded.
|
||||
*/
|
||||
|
||||
/* Part 1
|
||||
* The VFTA is a bitstring made up of 128 32-bit registers
|
||||
* that enable the particular VLAN id, much like the MTA:
|
||||
* bits[11-5]: which register
|
||||
* bits[4-0]: which bit in the register
|
||||
*/
|
||||
regidx = vlan / 32;
|
||||
vfta_delta = 1 << (vlan % 32);
|
||||
vfta = adapter->shadow_vfta[regidx];
|
||||
|
||||
/* vfta_delta represents the difference between the current value
|
||||
* of vfta and the value we want in the register. Since the diff
|
||||
* is an XOR mask we can just update vfta using an XOR.
|
||||
*/
|
||||
vfta_delta &= vlan_on ? ~vfta : vfta;
|
||||
vfta ^= vfta_delta;
|
||||
|
||||
/* Part 2
|
||||
* If VT Mode is set
|
||||
* Either vlan_on
|
||||
* make sure the VLAN is in VLVF
|
||||
* set the vind bit in the matching VLVFB
|
||||
* Or !vlan_on
|
||||
* clear the pool bit and possibly the vind
|
||||
*/
|
||||
if (!adapter->vfs_allocated_count)
|
||||
goto vfta_update;
|
||||
|
||||
vlvf_index = igb_find_vlvf_slot(hw, vlan, vlvf_bypass);
|
||||
if (vlvf_index < 0) {
|
||||
if (vlvf_bypass)
|
||||
goto vfta_update;
|
||||
return vlvf_index;
|
||||
}
|
||||
if ((hw->mac.type == e1000_i350) || (hw->mac.type == e1000_i354))
|
||||
igb_write_vfta_i350(hw, index, vfta);
|
||||
else
|
||||
igb_write_vfta(hw, index, vfta);
|
||||
adapter->shadow_vfta[index] = vfta;
|
||||
|
||||
return ret_val;
|
||||
bits = rd32(E1000_VLVF(vlvf_index));
|
||||
|
||||
/* set the pool bit */
|
||||
bits |= 1 << (E1000_VLVF_POOLSEL_SHIFT + vind);
|
||||
if (vlan_on)
|
||||
goto vlvf_update;
|
||||
|
||||
/* clear the pool bit */
|
||||
bits ^= 1 << (E1000_VLVF_POOLSEL_SHIFT + vind);
|
||||
|
||||
if (!(bits & E1000_VLVF_POOLSEL_MASK)) {
|
||||
/* Clear VFTA first, then disable VLVF. Otherwise
|
||||
* we run the risk of stray packets leaking into
|
||||
* the PF via the default pool
|
||||
*/
|
||||
if (vfta_delta)
|
||||
hw->mac.ops.write_vfta(hw, regidx, vfta);
|
||||
|
||||
/* disable VLVF and clear remaining bit from pool */
|
||||
wr32(E1000_VLVF(vlvf_index), 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If there are still bits set in the VLVFB registers
|
||||
* for the VLAN ID indicated we need to see if the
|
||||
* caller is requesting that we clear the VFTA entry bit.
|
||||
* If the caller has requested that we clear the VFTA
|
||||
* entry bit but there are still pools/VFs using this VLAN
|
||||
* ID entry then ignore the request. We're not worried
|
||||
* about the case where we're turning the VFTA VLAN ID
|
||||
* entry bit on, only when requested to turn it off as
|
||||
* there may be multiple pools and/or VFs using the
|
||||
* VLAN ID entry. In that case we cannot clear the
|
||||
* VFTA bit until all pools/VFs using that VLAN ID have also
|
||||
* been cleared. This will be indicated by "bits" being
|
||||
* zero.
|
||||
*/
|
||||
vfta_delta = 0;
|
||||
|
||||
vlvf_update:
|
||||
/* record pool change and enable VLAN ID if not already enabled */
|
||||
wr32(E1000_VLVF(vlvf_index), bits | vlan | E1000_VLVF_VLANID_ENABLE);
|
||||
|
||||
vfta_update:
|
||||
/* bit was set/cleared before we started */
|
||||
if (vfta_delta)
|
||||
hw->mac.ops.write_vfta(hw, regidx, vfta);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,8 +56,9 @@ s32 igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
|
|||
|
||||
void igb_clear_hw_cntrs_base(struct e1000_hw *hw);
|
||||
void igb_clear_vfta(struct e1000_hw *hw);
|
||||
void igb_clear_vfta_i350(struct e1000_hw *hw);
|
||||
s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add);
|
||||
void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
|
||||
s32 igb_vfta_set(struct e1000_hw *hw, u32 vid, u32 vind,
|
||||
bool vlan_on, bool vlvf_bypass);
|
||||
void igb_config_collision_dist(struct e1000_hw *hw);
|
||||
void igb_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
|
||||
void igb_mta_set(struct e1000_hw *hw, u32 hash_value);
|
||||
|
|
|
@ -322,14 +322,20 @@ static s32 igb_obtain_mbx_lock_pf(struct e1000_hw *hw, u16 vf_number)
|
|||
{
|
||||
s32 ret_val = -E1000_ERR_MBX;
|
||||
u32 p2v_mailbox;
|
||||
int count = 10;
|
||||
|
||||
/* Take ownership of the buffer */
|
||||
wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
|
||||
do {
|
||||
/* Take ownership of the buffer */
|
||||
wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
|
||||
|
||||
/* reserve mailbox for vf use */
|
||||
p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
|
||||
if (p2v_mailbox & E1000_P2VMAILBOX_PFU)
|
||||
ret_val = 0;
|
||||
/* reserve mailbox for vf use */
|
||||
p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
|
||||
if (p2v_mailbox & E1000_P2VMAILBOX_PFU) {
|
||||
ret_val = 0;
|
||||
break;
|
||||
}
|
||||
udelay(1000);
|
||||
} while (count-- > 0);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ struct vf_data_storage {
|
|||
unsigned char vf_mac_addresses[ETH_ALEN];
|
||||
u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
|
||||
u16 num_vf_mc_hashes;
|
||||
u16 vlans_enabled;
|
||||
u32 flags;
|
||||
unsigned long last_nack;
|
||||
u16 pf_vlan; /* When set, guest VLAN config not allowed. */
|
||||
|
@ -482,6 +481,7 @@ struct igb_adapter {
|
|||
#define IGB_FLAG_MAS_ENABLE (1 << 12)
|
||||
#define IGB_FLAG_HAS_MSIX (1 << 13)
|
||||
#define IGB_FLAG_EEE (1 << 14)
|
||||
#define IGB_FLAG_VLAN_PROMISC BIT(15)
|
||||
|
||||
/* Media Auto Sense */
|
||||
#define IGB_MAS_ENABLE_0 0X0001
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -234,13 +234,19 @@ static s32 e1000_check_for_rst_vf(struct e1000_hw *hw)
|
|||
static s32 e1000_obtain_mbx_lock_vf(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val = -E1000_ERR_MBX;
|
||||
int count = 10;
|
||||
|
||||
/* Take ownership of the buffer */
|
||||
ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
|
||||
do {
|
||||
/* Take ownership of the buffer */
|
||||
ew32(V2PMAILBOX(0), E1000_V2PMAILBOX_VFU);
|
||||
|
||||
/* reserve mailbox for VF use */
|
||||
if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU)
|
||||
ret_val = E1000_SUCCESS;
|
||||
/* reserve mailbox for VF use */
|
||||
if (e1000_read_v2p_mailbox(hw) & E1000_V2PMAILBOX_VFU) {
|
||||
ret_val = 0;
|
||||
break;
|
||||
}
|
||||
udelay(1000);
|
||||
} while (count-- > 0);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue