Skip to content

Commit

Permalink
be2net: avoid disabling sriov while VFs are assigned
Browse files Browse the repository at this point in the history
Calling pci_disable_sriov() while VFs are assigned to VMs causes
kernel panic. This patch uses PCI_DEV_FLAGS_ASSIGNED bit state of the
VF's pci_dev to avoid this. Also, the unconditional function reset cmd
issued on a PF probe can delete the VF configuration for the
previously enabled VFs. A scratchpad register is now used to issue a
function reset only when needed (i.e., in a crash dump scenario.)

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sathya Perla authored and David S. Miller committed May 11, 2012
1 parent d301e32 commit 39f1d94
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 89 deletions.
22 changes: 11 additions & 11 deletions drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ struct be_vf_cfg {
u32 tx_rate;
};

enum vf_state {
ENABLED = 0,
ASSIGNED = 1
};

#define BE_FLAGS_LINK_STATUS_INIT 1
#define BE_FLAGS_WORKER_SCHEDULED (1 << 3)
#define BE_UC_PMAC_COUNT 30
Expand Down Expand Up @@ -403,8 +408,9 @@ struct be_adapter {
u32 flash_status;
struct completion flash_compl;

u32 num_vfs;
u8 is_virtfn;
u32 num_vfs; /* Number of VFs provisioned by PF driver */
u32 dev_num_vfs; /* Number of VFs supported by HW */
u8 virtfn;
struct be_vf_cfg *vf_cfg;
bool be3_native;
u32 sli_family;
Expand All @@ -417,8 +423,10 @@ struct be_adapter {
u32 uc_macs; /* Count of secondary UC MAC programmed */
};

#define be_physfn(adapter) (!adapter->is_virtfn)
#define be_physfn(adapter) (!adapter->virtfn)
#define sriov_enabled(adapter) (adapter->num_vfs > 0)
#define sriov_want(adapter) (adapter->dev_num_vfs && num_vfs && \
be_physfn(adapter))
#define for_all_vfs(adapter, vf_cfg, i) \
for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
i++, vf_cfg++)
Expand Down Expand Up @@ -547,14 +555,6 @@ static inline u8 is_udp_pkt(struct sk_buff *skb)
return val;
}

static inline void be_check_sriov_fn_type(struct be_adapter *adapter)
{
u32 sli_intf;

pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
adapter->is_virtfn = (sli_intf & SLI_INTF_FT_MASK) ? 1 : 0;
}

static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
{
u32 addr;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/emulex/benet/be_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

#define SLI_PORT_CONTROL_IP_MASK 0x08000000

#define PCICFG_CUST_SCRATCHPAD_CSR 0x1EC

/********* Memory BAR register ************/
#define PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET 0xfc
/* Host Interrupt Enable, if set interrupts are enabled although "PCI Interrupt
Expand Down
Loading

0 comments on commit 39f1d94

Please sign in to comment.