Skip to content

Commit fbec370

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/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 <[email protected]>
2 parents 42cd36a + 93cd765 commit fbec370

File tree

8 files changed

+316
-107
lines changed

8 files changed

+316
-107
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#define I40E_BASE_VSI_SEID 512
6262
#define I40E_BASE_VEB_SEID 288
6363
#define I40E_MAX_VEB 16
64+
#define I40E_MAX_NPAR_QPS 32
6465

6566
#define I40E_MAX_NUM_DESCRIPTORS 4096
6667
#define I40E_MAX_REGISTER 0x0038FFFF
@@ -275,6 +276,8 @@ struct i40e_pf {
275276
struct dentry *i40e_dbg_pf;
276277
#endif /* CONFIG_DEBUG_FS */
277278

279+
u16 instance; /* A unique number per i40e_pf instance in the system */
280+
278281
/* sr-iov config info */
279282
struct i40e_vf *vf;
280283
int num_alloc_vfs; /* actual number of VFs allocated */

drivers/net/ethernet/intel/i40e/i40e_common.c

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,54 @@ i40e_status i40e_validate_mac_addr(u8 *mac_addr)
266266
return status;
267267
}
268268

269+
/**
270+
* i40e_get_media_type - Gets media type
271+
* @hw: pointer to the hardware structure
272+
**/
273+
static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)
274+
{
275+
enum i40e_media_type media;
276+
277+
switch (hw->phy.link_info.phy_type) {
278+
case I40E_PHY_TYPE_10GBASE_SR:
279+
case I40E_PHY_TYPE_10GBASE_LR:
280+
case I40E_PHY_TYPE_40GBASE_SR4:
281+
case I40E_PHY_TYPE_40GBASE_LR4:
282+
media = I40E_MEDIA_TYPE_FIBER;
283+
break;
284+
case I40E_PHY_TYPE_100BASE_TX:
285+
case I40E_PHY_TYPE_1000BASE_T:
286+
case I40E_PHY_TYPE_10GBASE_T:
287+
media = I40E_MEDIA_TYPE_BASET;
288+
break;
289+
case I40E_PHY_TYPE_10GBASE_CR1_CU:
290+
case I40E_PHY_TYPE_40GBASE_CR4_CU:
291+
case I40E_PHY_TYPE_10GBASE_CR1:
292+
case I40E_PHY_TYPE_40GBASE_CR4:
293+
case I40E_PHY_TYPE_10GBASE_SFPP_CU:
294+
media = I40E_MEDIA_TYPE_DA;
295+
break;
296+
case I40E_PHY_TYPE_1000BASE_KX:
297+
case I40E_PHY_TYPE_10GBASE_KX4:
298+
case I40E_PHY_TYPE_10GBASE_KR:
299+
case I40E_PHY_TYPE_40GBASE_KR4:
300+
media = I40E_MEDIA_TYPE_BACKPLANE;
301+
break;
302+
case I40E_PHY_TYPE_SGMII:
303+
case I40E_PHY_TYPE_XAUI:
304+
case I40E_PHY_TYPE_XFI:
305+
case I40E_PHY_TYPE_XLAUI:
306+
case I40E_PHY_TYPE_XLPPI:
307+
default:
308+
media = I40E_MEDIA_TYPE_UNKNOWN;
309+
break;
310+
}
311+
312+
return media;
313+
}
314+
315+
#define I40E_PF_RESET_WAIT_COUNT_A0 200
316+
#define I40E_PF_RESET_WAIT_COUNT 10
269317
/**
270318
* i40e_pf_reset - Reset the PF
271319
* @hw: pointer to the hardware structure
@@ -275,7 +323,7 @@ i40e_status i40e_validate_mac_addr(u8 *mac_addr)
275323
**/
276324
i40e_status i40e_pf_reset(struct i40e_hw *hw)
277325
{
278-
u32 wait_cnt = 0;
326+
u32 cnt = 0;
279327
u32 reg = 0;
280328
u32 grst_del;
281329

@@ -285,7 +333,7 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw)
285333
*/
286334
grst_del = rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK
287335
>> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT;
288-
for (wait_cnt = 0; wait_cnt < grst_del + 2; wait_cnt++) {
336+
for (cnt = 0; cnt < grst_del + 2; cnt++) {
289337
reg = rd32(hw, I40E_GLGEN_RSTAT);
290338
if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK))
291339
break;
@@ -306,11 +354,15 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw)
306354
/* If there was a Global Reset in progress when we got here,
307355
* we don't need to do the PF Reset
308356
*/
309-
if (!wait_cnt) {
357+
if (!cnt) {
358+
if (hw->revision_id == 0)
359+
cnt = I40E_PF_RESET_WAIT_COUNT_A0;
360+
else
361+
cnt = I40E_PF_RESET_WAIT_COUNT;
310362
reg = rd32(hw, I40E_PFGEN_CTRL);
311363
wr32(hw, I40E_PFGEN_CTRL,
312364
(reg | I40E_PFGEN_CTRL_PFSWR_MASK));
313-
for (wait_cnt = 0; wait_cnt < 10; wait_cnt++) {
365+
for (; cnt; cnt--) {
314366
reg = rd32(hw, I40E_PFGEN_CTRL);
315367
if (!(reg & I40E_PFGEN_CTRL_PFSWR_MASK))
316368
break;
@@ -339,7 +391,13 @@ void i40e_clear_pxe_mode(struct i40e_hw *hw)
339391

340392
/* Clear single descriptor fetch/write-back mode */
341393
reg = rd32(hw, I40E_GLLAN_RCTL_0);
342-
wr32(hw, I40E_GLLAN_RCTL_0, (reg | I40E_GLLAN_RCTL_0_PXE_MODE_MASK));
394+
395+
if (hw->revision_id == 0) {
396+
/* As a work around clear PXE_MODE instead of setting it */
397+
wr32(hw, I40E_GLLAN_RCTL_0, (reg & (~I40E_GLLAN_RCTL_0_PXE_MODE_MASK)));
398+
} else {
399+
wr32(hw, I40E_GLLAN_RCTL_0, (reg | I40E_GLLAN_RCTL_0_PXE_MODE_MASK));
400+
}
343401
}
344402

345403
/**
@@ -499,6 +557,7 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw,
499557

500558
/* update link status */
501559
hw_link_info->phy_type = (enum i40e_aq_phy_type)resp->phy_type;
560+
hw->phy.media_type = i40e_get_media_type(hw);
502561
hw_link_info->link_speed = (enum i40e_aq_link_speed)resp->link_speed;
503562
hw_link_info->link_info = resp->link_info;
504563
hw_link_info->an_info = resp->an_info;
@@ -877,6 +936,7 @@ bool i40e_get_link_status(struct i40e_hw *hw)
877936
* @downlink_seid: the VSI SEID
878937
* @enabled_tc: bitmap of TCs to be enabled
879938
* @default_port: true for default port VSI, false for control port
939+
* @enable_l2_filtering: true to add L2 filter table rules to regular forwarding rules for cloud support
880940
* @veb_seid: pointer to where to put the resulting VEB SEID
881941
* @cmd_details: pointer to command details structure or NULL
882942
*
@@ -885,7 +945,8 @@ bool i40e_get_link_status(struct i40e_hw *hw)
885945
**/
886946
i40e_status i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
887947
u16 downlink_seid, u8 enabled_tc,
888-
bool default_port, u16 *veb_seid,
948+
bool default_port, bool enable_l2_filtering,
949+
u16 *veb_seid,
889950
struct i40e_asq_cmd_details *cmd_details)
890951
{
891952
struct i40e_aq_desc desc;
@@ -911,6 +972,10 @@ i40e_status i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
911972
veb_flags |= I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT;
912973
else
913974
veb_flags |= I40E_AQC_ADD_VEB_PORT_TYPE_DATA;
975+
976+
if (enable_l2_filtering)
977+
veb_flags |= I40E_AQC_ADD_VEB_ENABLE_L2_FILTER;
978+
914979
cmd->veb_flags = cpu_to_le16(veb_flags);
915980

916981
status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ static int i40e_get_settings(struct net_device *netdev,
211211
ecmd->supported |= SUPPORTED_TP;
212212
ecmd->advertising |= ADVERTISED_TP;
213213
ecmd->port = PORT_TP;
214+
} else if (hw->phy.media_type == I40E_MEDIA_TYPE_DA) {
215+
ecmd->supported |= SUPPORTED_FIBRE;
216+
ecmd->advertising |= ADVERTISED_FIBRE;
217+
ecmd->port = PORT_DA;
214218
} else {
215219
ecmd->supported |= SUPPORTED_FIBRE;
216220
ecmd->advertising |= ADVERTISED_FIBRE;
@@ -702,8 +706,12 @@ static int i40e_get_ts_info(struct net_device *dev,
702706
return ethtool_op_get_ts_info(dev, info);
703707
}
704708

705-
static int i40e_link_test(struct i40e_pf *pf, u64 *data)
709+
static int i40e_link_test(struct net_device *netdev, u64 *data)
706710
{
711+
struct i40e_netdev_priv *np = netdev_priv(netdev);
712+
struct i40e_pf *pf = np->vsi->back;
713+
714+
netdev_info(netdev, "link test\n");
707715
if (i40e_get_link_status(&pf->hw))
708716
*data = 0;
709717
else
@@ -712,30 +720,36 @@ static int i40e_link_test(struct i40e_pf *pf, u64 *data)
712720
return *data;
713721
}
714722

715-
static int i40e_reg_test(struct i40e_pf *pf, u64 *data)
723+
static int i40e_reg_test(struct net_device *netdev, u64 *data)
716724
{
717-
i40e_status ret;
725+
struct i40e_netdev_priv *np = netdev_priv(netdev);
726+
struct i40e_pf *pf = np->vsi->back;
718727

719-
ret = i40e_diag_reg_test(&pf->hw);
720-
*data = ret;
728+
netdev_info(netdev, "register test\n");
729+
*data = i40e_diag_reg_test(&pf->hw);
721730

722-
return ret;
731+
i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED));
732+
return *data;
723733
}
724734

725-
static int i40e_eeprom_test(struct i40e_pf *pf, u64 *data)
735+
static int i40e_eeprom_test(struct net_device *netdev, u64 *data)
726736
{
727-
i40e_status ret;
737+
struct i40e_netdev_priv *np = netdev_priv(netdev);
738+
struct i40e_pf *pf = np->vsi->back;
728739

729-
ret = i40e_diag_eeprom_test(&pf->hw);
730-
*data = ret;
740+
netdev_info(netdev, "eeprom test\n");
741+
*data = i40e_diag_eeprom_test(&pf->hw);
731742

732-
return ret;
743+
return *data;
733744
}
734745

735-
static int i40e_intr_test(struct i40e_pf *pf, u64 *data)
746+
static int i40e_intr_test(struct net_device *netdev, u64 *data)
736747
{
748+
struct i40e_netdev_priv *np = netdev_priv(netdev);
749+
struct i40e_pf *pf = np->vsi->back;
737750
u16 swc_old = pf->sw_int_count;
738751

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

748-
static int i40e_loopback_test(struct i40e_pf *pf, u64 *data)
762+
static int i40e_loopback_test(struct net_device *netdev, u64 *data)
749763
{
764+
netdev_info(netdev, "loopback test not implemented\n");
750765
*data = 0;
751766

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

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

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

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

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

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

799806
/* Offline only tests, not run in online; pass by default */
800807
data[I40E_ETH_TEST_REG] = 0;
801808
data[I40E_ETH_TEST_EEPROM] = 0;
802809
data[I40E_ETH_TEST_INTR] = 0;
803810
data[I40E_ETH_TEST_LOOPBACK] = 0;
804-
805-
clear_bit(__I40E_TESTING, &pf->state);
806811
}
812+
clear_bit(__I40E_TESTING, &pf->state);
813+
814+
netdev_info(netdev, "testing finished\n");
807815
}
808816

809817
static void i40e_get_wol(struct net_device *netdev,

0 commit comments

Comments
 (0)