Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates

This series contains updates to i40e only.

Jacob provides a i40e patch to get 1588 work correctly by separating
TSYNVALID and TSYNINDX fields in the receive descriptor.

Jesse provides several i40e patches, first to correct the checking
of the multi-bit state.  The hash is reported correctly in the RSS
field if and only if the filter status is 3.  Other values of the
filter status mean different things and we should not depend on a
bitwise result.  Then provides a patch to enable a couple of
workarounds based on revision ID that allow the driver to work
more fully on early hardware.

Shannon provides several i40e patches as well.  First sets the media
type in the hardware structure based on the external connection type.
Then provides a patch to only setup the rings that will be used.  Lastly
provides a fix where the TESTING state was still set when exiting the
ethtool diagnostics.

Kevin Scott provides one i40e patch to add a new flag to the i40e_add_veb()
which allows the driver to request the hardware to filter on layer 2
parameters.

Anjali provides four i40e patches, first refactors the reset code in
order to re-size queues and vectors while the interface is still up.
Then provides a patch to enable all PCTYPEs expect FCoE for RSS.  Adds
a message to notify the user of how many VFs are initialized on each
port.  Lastly adds a new variable to track the number of PF instances,
this is a global counter on purpose so that each PF loaded has a
unique ID.

Catherine bumps the driver version.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Dec 10, 2013
2 parents 42cd36a + 93cd765 commit fbec370
Show file tree
Hide file tree
Showing 8 changed files with 316 additions and 107 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#define I40E_BASE_VSI_SEID 512
#define I40E_BASE_VEB_SEID 288
#define I40E_MAX_VEB 16
#define I40E_MAX_NPAR_QPS 32

#define I40E_MAX_NUM_DESCRIPTORS 4096
#define I40E_MAX_REGISTER 0x0038FFFF
Expand Down Expand Up @@ -275,6 +276,8 @@ struct i40e_pf {
struct dentry *i40e_dbg_pf;
#endif /* CONFIG_DEBUG_FS */

u16 instance; /* A unique number per i40e_pf instance in the system */

/* sr-iov config info */
struct i40e_vf *vf;
int num_alloc_vfs; /* actual number of VFs allocated */
Expand Down
77 changes: 71 additions & 6 deletions drivers/net/ethernet/intel/i40e/i40e_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,54 @@ i40e_status i40e_validate_mac_addr(u8 *mac_addr)
return status;
}

/**
* i40e_get_media_type - Gets media type
* @hw: pointer to the hardware structure
**/
static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)
{
enum i40e_media_type media;

switch (hw->phy.link_info.phy_type) {
case I40E_PHY_TYPE_10GBASE_SR:
case I40E_PHY_TYPE_10GBASE_LR:
case I40E_PHY_TYPE_40GBASE_SR4:
case I40E_PHY_TYPE_40GBASE_LR4:
media = I40E_MEDIA_TYPE_FIBER;
break;
case I40E_PHY_TYPE_100BASE_TX:
case I40E_PHY_TYPE_1000BASE_T:
case I40E_PHY_TYPE_10GBASE_T:
media = I40E_MEDIA_TYPE_BASET;
break;
case I40E_PHY_TYPE_10GBASE_CR1_CU:
case I40E_PHY_TYPE_40GBASE_CR4_CU:
case I40E_PHY_TYPE_10GBASE_CR1:
case I40E_PHY_TYPE_40GBASE_CR4:
case I40E_PHY_TYPE_10GBASE_SFPP_CU:
media = I40E_MEDIA_TYPE_DA;
break;
case I40E_PHY_TYPE_1000BASE_KX:
case I40E_PHY_TYPE_10GBASE_KX4:
case I40E_PHY_TYPE_10GBASE_KR:
case I40E_PHY_TYPE_40GBASE_KR4:
media = I40E_MEDIA_TYPE_BACKPLANE;
break;
case I40E_PHY_TYPE_SGMII:
case I40E_PHY_TYPE_XAUI:
case I40E_PHY_TYPE_XFI:
case I40E_PHY_TYPE_XLAUI:
case I40E_PHY_TYPE_XLPPI:
default:
media = I40E_MEDIA_TYPE_UNKNOWN;
break;
}

return media;
}

#define I40E_PF_RESET_WAIT_COUNT_A0 200
#define I40E_PF_RESET_WAIT_COUNT 10
/**
* i40e_pf_reset - Reset the PF
* @hw: pointer to the hardware structure
Expand All @@ -275,7 +323,7 @@ i40e_status i40e_validate_mac_addr(u8 *mac_addr)
**/
i40e_status i40e_pf_reset(struct i40e_hw *hw)
{
u32 wait_cnt = 0;
u32 cnt = 0;
u32 reg = 0;
u32 grst_del;

Expand All @@ -285,7 +333,7 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw)
*/
grst_del = rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK
>> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT;
for (wait_cnt = 0; wait_cnt < grst_del + 2; wait_cnt++) {
for (cnt = 0; cnt < grst_del + 2; cnt++) {
reg = rd32(hw, I40E_GLGEN_RSTAT);
if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK))
break;
Expand All @@ -306,11 +354,15 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw)
/* If there was a Global Reset in progress when we got here,
* we don't need to do the PF Reset
*/
if (!wait_cnt) {
if (!cnt) {
if (hw->revision_id == 0)
cnt = I40E_PF_RESET_WAIT_COUNT_A0;
else
cnt = I40E_PF_RESET_WAIT_COUNT;
reg = rd32(hw, I40E_PFGEN_CTRL);
wr32(hw, I40E_PFGEN_CTRL,
(reg | I40E_PFGEN_CTRL_PFSWR_MASK));
for (wait_cnt = 0; wait_cnt < 10; wait_cnt++) {
for (; cnt; cnt--) {
reg = rd32(hw, I40E_PFGEN_CTRL);
if (!(reg & I40E_PFGEN_CTRL_PFSWR_MASK))
break;
Expand Down Expand Up @@ -339,7 +391,13 @@ void i40e_clear_pxe_mode(struct i40e_hw *hw)

/* Clear single descriptor fetch/write-back mode */
reg = rd32(hw, I40E_GLLAN_RCTL_0);
wr32(hw, I40E_GLLAN_RCTL_0, (reg | I40E_GLLAN_RCTL_0_PXE_MODE_MASK));

if (hw->revision_id == 0) {
/* As a work around clear PXE_MODE instead of setting it */
wr32(hw, I40E_GLLAN_RCTL_0, (reg & (~I40E_GLLAN_RCTL_0_PXE_MODE_MASK)));
} else {
wr32(hw, I40E_GLLAN_RCTL_0, (reg | I40E_GLLAN_RCTL_0_PXE_MODE_MASK));
}
}

/**
Expand Down Expand Up @@ -499,6 +557,7 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,

/* update link status */
hw_link_info->phy_type = (enum i40e_aq_phy_type)resp->phy_type;
hw->phy.media_type = i40e_get_media_type(hw);
hw_link_info->link_speed = (enum i40e_aq_link_speed)resp->link_speed;
hw_link_info->link_info = resp->link_info;
hw_link_info->an_info = resp->an_info;
Expand Down Expand Up @@ -877,6 +936,7 @@ bool i40e_get_link_status(struct i40e_hw *hw)
* @downlink_seid: the VSI SEID
* @enabled_tc: bitmap of TCs to be enabled
* @default_port: true for default port VSI, false for control port
* @enable_l2_filtering: true to add L2 filter table rules to regular forwarding rules for cloud support
* @veb_seid: pointer to where to put the resulting VEB SEID
* @cmd_details: pointer to command details structure or NULL
*
Expand All @@ -885,7 +945,8 @@ bool i40e_get_link_status(struct i40e_hw *hw)
**/
i40e_status i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
u16 downlink_seid, u8 enabled_tc,
bool default_port, u16 *veb_seid,
bool default_port, bool enable_l2_filtering,
u16 *veb_seid,
struct i40e_asq_cmd_details *cmd_details)
{
struct i40e_aq_desc desc;
Expand All @@ -911,6 +972,10 @@ i40e_status i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
veb_flags |= I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT;
else
veb_flags |= I40E_AQC_ADD_VEB_PORT_TYPE_DATA;

if (enable_l2_filtering)
veb_flags |= I40E_AQC_ADD_VEB_ENABLE_L2_FILTER;

cmd->veb_flags = cpu_to_le16(veb_flags);

status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
Expand Down
66 changes: 37 additions & 29 deletions drivers/net/ethernet/intel/i40e/i40e_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ static int i40e_get_settings(struct net_device *netdev,
ecmd->supported |= SUPPORTED_TP;
ecmd->advertising |= ADVERTISED_TP;
ecmd->port = PORT_TP;
} else if (hw->phy.media_type == I40E_MEDIA_TYPE_DA) {
ecmd->supported |= SUPPORTED_FIBRE;
ecmd->advertising |= ADVERTISED_FIBRE;
ecmd->port = PORT_DA;
} else {
ecmd->supported |= SUPPORTED_FIBRE;
ecmd->advertising |= ADVERTISED_FIBRE;
Expand Down Expand Up @@ -702,8 +706,12 @@ static int i40e_get_ts_info(struct net_device *dev,
return ethtool_op_get_ts_info(dev, info);
}

static int i40e_link_test(struct i40e_pf *pf, u64 *data)
static int i40e_link_test(struct net_device *netdev, u64 *data)
{
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back;

netdev_info(netdev, "link test\n");
if (i40e_get_link_status(&pf->hw))
*data = 0;
else
Expand All @@ -712,30 +720,36 @@ static int i40e_link_test(struct i40e_pf *pf, u64 *data)
return *data;
}

static int i40e_reg_test(struct i40e_pf *pf, u64 *data)
static int i40e_reg_test(struct net_device *netdev, u64 *data)
{
i40e_status ret;
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back;

ret = i40e_diag_reg_test(&pf->hw);
*data = ret;
netdev_info(netdev, "register test\n");
*data = i40e_diag_reg_test(&pf->hw);

return ret;
i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
return *data;
}

static int i40e_eeprom_test(struct i40e_pf *pf, u64 *data)
static int i40e_eeprom_test(struct net_device *netdev, u64 *data)
{
i40e_status ret;
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back;

ret = i40e_diag_eeprom_test(&pf->hw);
*data = ret;
netdev_info(netdev, "eeprom test\n");
*data = i40e_diag_eeprom_test(&pf->hw);

return ret;
return *data;
}

static int i40e_intr_test(struct i40e_pf *pf, u64 *data)
static int i40e_intr_test(struct net_device *netdev, u64 *data)
{
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back;
u16 swc_old = pf->sw_int_count;

netdev_info(netdev, "interrupt test\n");
wr32(&pf->hw, I40E_PFINT_DYN_CTL0,
(I40E_PFINT_DYN_CTL0_INTENA_MASK |
I40E_PFINT_DYN_CTL0_SWINT_TRIG_MASK));
Expand All @@ -745,8 +759,9 @@ static int i40e_intr_test(struct i40e_pf *pf, u64 *data)
return *data;
}

static int i40e_loopback_test(struct i40e_pf *pf, u64 *data)
static int i40e_loopback_test(struct net_device *netdev, u64 *data)
{
netdev_info(netdev, "loopback test not implemented\n");
*data = 0;

return *data;
Expand All @@ -767,43 +782,36 @@ static void i40e_diag_test(struct net_device *netdev,
/* Link test performed before hardware reset
* so autoneg doesn't interfere with test result
*/
netdev_info(netdev, "link test starting\n");
if (i40e_link_test(pf, &data[I40E_ETH_TEST_LINK]))
if (i40e_link_test(netdev, &data[I40E_ETH_TEST_LINK]))
eth_test->flags |= ETH_TEST_FL_FAILED;

netdev_info(netdev, "register test starting\n");
if (i40e_reg_test(pf, &data[I40E_ETH_TEST_REG]))
if (i40e_reg_test(netdev, &data[I40E_ETH_TEST_REG]))
eth_test->flags |= ETH_TEST_FL_FAILED;

i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
netdev_info(netdev, "eeprom test starting\n");
if (i40e_eeprom_test(pf, &data[I40E_ETH_TEST_EEPROM]))
if (i40e_eeprom_test(netdev, &data[I40E_ETH_TEST_EEPROM]))
eth_test->flags |= ETH_TEST_FL_FAILED;

i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
netdev_info(netdev, "interrupt test starting\n");
if (i40e_intr_test(pf, &data[I40E_ETH_TEST_INTR]))
if (i40e_intr_test(netdev, &data[I40E_ETH_TEST_INTR]))
eth_test->flags |= ETH_TEST_FL_FAILED;

i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
netdev_info(netdev, "loopback test starting\n");
if (i40e_loopback_test(pf, &data[I40E_ETH_TEST_LOOPBACK]))
if (i40e_loopback_test(netdev, &data[I40E_ETH_TEST_LOOPBACK]))
eth_test->flags |= ETH_TEST_FL_FAILED;

} else {
netdev_info(netdev, "online test starting\n");
/* Online tests */
if (i40e_link_test(pf, &data[I40E_ETH_TEST_LINK]))
if (i40e_link_test(netdev, &data[I40E_ETH_TEST_LINK]))
eth_test->flags |= ETH_TEST_FL_FAILED;

/* Offline only tests, not run in online; pass by default */
data[I40E_ETH_TEST_REG] = 0;
data[I40E_ETH_TEST_EEPROM] = 0;
data[I40E_ETH_TEST_INTR] = 0;
data[I40E_ETH_TEST_LOOPBACK] = 0;

clear_bit(__I40E_TESTING, &pf->state);
}
clear_bit(__I40E_TESTING, &pf->state);

netdev_info(netdev, "testing finished\n");
}

static void i40e_get_wol(struct net_device *netdev,
Expand Down
Loading

0 comments on commit fbec370

Please sign in to comment.