aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_common.c
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2014-11-12 22:06:19 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-12-06 07:46:45 -0500
commit5fb11d761082c6dc5c7b46ad46af33ca7f518584 (patch)
tree05b25ff4b73551d6e3a7cb0cd88681e78b0d3a3d /drivers/net/ethernet/intel/i40e/i40e_common.c
parentbaf732773502c59421af401e5256f5b453f70fa5 (diff)
i40e: get pf_id from HW rather than PCI function
Getting the pf_id from the function number was a good place to start, but when the PF was setup in passthru mode, the PCI bus/device/function was virtualized and the number in the VM is different from the number in the bare metal. This caused HW configuration issues when the wrong pf_id was used to set up the HMC and other structures. The PF_FUNC_RID register has the real bus/device/function information as configured by the BIOS, so use that for a better number. This works in NPAR mode as well. Change-ID: I65e3dd6c97594890c2bad566b83cc670b1dae534 Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: Greg Rose <gregory.v.rose@intel.com> Acked-by: Kevin Scott <kevin.c.scott@intel.com> Tested-by: Jim Young <jamesx.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_common.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index ec63bcb46e83..3d741ee99a2c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -550,7 +550,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
550i40e_status i40e_init_shared_code(struct i40e_hw *hw) 550i40e_status i40e_init_shared_code(struct i40e_hw *hw)
551{ 551{
552 i40e_status status = 0; 552 i40e_status status = 0;
553 u32 reg; 553 u32 port, ari, func_rid;
554 554
555 i40e_set_mac_type(hw); 555 i40e_set_mac_type(hw);
556 556
@@ -563,18 +563,17 @@ i40e_status i40e_init_shared_code(struct i40e_hw *hw)
563 563
564 hw->phy.get_link_info = true; 564 hw->phy.get_link_info = true;
565 565
566 /* Determine port number */ 566 /* Determine port number and PF number*/
567 reg = rd32(hw, I40E_PFGEN_PORTNUM); 567 port = (rd32(hw, I40E_PFGEN_PORTNUM) & I40E_PFGEN_PORTNUM_PORT_NUM_MASK)
568 reg = ((reg & I40E_PFGEN_PORTNUM_PORT_NUM_MASK) >> 568 >> I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT;
569 I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT); 569 hw->port = (u8)port;
570 hw->port = (u8)reg; 570 ari = (rd32(hw, I40E_GLPCI_CAPSUP) & I40E_GLPCI_CAPSUP_ARI_EN_MASK) >>
571 571 I40E_GLPCI_CAPSUP_ARI_EN_SHIFT;
572 /* Determine the PF number based on the PCI fn */ 572 func_rid = rd32(hw, I40E_PF_FUNC_RID);
573 reg = rd32(hw, I40E_GLPCI_CAPSUP); 573 if (ari)
574 if (reg & I40E_GLPCI_CAPSUP_ARI_EN_MASK) 574 hw->pf_id = (u8)(func_rid & 0xff);
575 hw->pf_id = (u8)((hw->bus.device << 3) | hw->bus.func);
576 else 575 else
577 hw->pf_id = (u8)hw->bus.func; 576 hw->pf_id = (u8)(func_rid & 0x7);
578 577
579 status = i40e_init_nvm(hw); 578 status = i40e_init_nvm(hw);
580 return status; 579 return status;