Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8468331 authored by Rajesh Borundia's avatar Rajesh Borundia Committed by David S. Miller
Browse files

qlcnic: SR-IOV VF probe



o Add PCI device entry for VF.
o Add HW operations for VF.

Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
Signed-off-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarRajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 02feda17
Loading
Loading
Loading
Loading
+29 −6
Original line number Diff line number Diff line
@@ -1523,6 +1523,9 @@ int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *);
void qlcnic_add_lb_filter(struct qlcnic_adapter *, struct sk_buff *, int,
			  __le16);
int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter);
int qlcnic_read_mac_addr(struct qlcnic_adapter *);
int qlcnic_setup_netdev(struct qlcnic_adapter *, struct net_device *, int);

/*
 * QLOGIC Board information
 */
@@ -1647,7 +1650,10 @@ static inline int qlcnic_alloc_mbx_args(struct qlcnic_cmd_args *mbx,
static inline int qlcnic_issue_cmd(struct qlcnic_adapter *adapter,
				   struct qlcnic_cmd_args *cmd)
{
	if (adapter->ahw->hw_ops->mbx_cmd)
		return adapter->ahw->hw_ops->mbx_cmd(adapter, cmd);

	return -EIO;
}

static inline void qlcnic_get_func_no(struct qlcnic_adapter *adapter)
@@ -1667,11 +1673,13 @@ static inline void qlcnic_api_unlock(struct qlcnic_adapter *adapter)

static inline void qlcnic_add_sysfs(struct qlcnic_adapter *adapter)
{
	if (adapter->ahw->hw_ops->add_sysfs)
		adapter->ahw->hw_ops->add_sysfs(adapter);
}

static inline void qlcnic_remove_sysfs(struct qlcnic_adapter *adapter)
{
	if (adapter->ahw->hw_ops->remove_sysfs)
		adapter->ahw->hw_ops->remove_sysfs(adapter);
}

@@ -1790,11 +1798,13 @@ static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter,
					    u32 key)
{
	if (adapter->nic_ops->request_reset)
		adapter->nic_ops->request_reset(adapter, key);
}

static inline void qlcnic_cancel_idc_work(struct qlcnic_adapter *adapter)
{
	if (adapter->nic_ops->cancel_idc_work)
		adapter->nic_ops->cancel_idc_work(adapter);
}

@@ -1842,7 +1852,9 @@ extern const struct ethtool_ops qlcnic_ethtool_failed_ops;
	} while (0)

#define PCI_DEVICE_ID_QLOGIC_QLE834X    0x8030
#define PCI_DEVICE_ID_QLOGIC_VF_QLE834X	0x8430
#define PCI_DEVICE_ID_QLOGIC_QLE824X	0x8020

static inline bool qlcnic_82xx_check(struct qlcnic_adapter *adapter)
{
	unsigned short device = adapter->pdev->device;
@@ -1852,7 +1864,12 @@ static inline bool qlcnic_82xx_check(struct qlcnic_adapter *adapter)
static inline bool qlcnic_83xx_check(struct qlcnic_adapter *adapter)
{
	unsigned short device = adapter->pdev->device;
	return (device == PCI_DEVICE_ID_QLOGIC_QLE834X) ? true : false;
	bool status;

	status = ((device == PCI_DEVICE_ID_QLOGIC_QLE834X) ||
		  (device == PCI_DEVICE_ID_QLOGIC_VF_QLE834X)) ? true : false;

	return status;
}

static inline bool qlcnic_sriov_pf_check(struct qlcnic_adapter *adapter)
@@ -1860,4 +1877,10 @@ static inline bool qlcnic_sriov_pf_check(struct qlcnic_adapter *adapter)
	return (adapter->ahw->op_mode == QLCNIC_SRIOV_PF_FUNC) ? true : false;
}

static inline bool qlcnic_sriov_vf_check(struct qlcnic_adapter *adapter)
{
	unsigned short device = adapter->pdev->device;

	return (device == PCI_DEVICE_ID_QLOGIC_VF_QLE834X) ? true : false;
}
#endif				/* __QLCNIC_H_ */
+16 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */

#include "qlcnic.h"
#include "qlcnic_sriov.h"
#include <linux/if_vlan.h>
#include <linux/ipv6.h>
#include <linux/ethtool.h>
@@ -212,7 +213,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = {
	{QLCNIC_CMD_CONFIG_VPORT, 4, 4},
};

static const u32 qlcnic_83xx_ext_reg_tbl[] = {
const u32 qlcnic_83xx_ext_reg_tbl[] = {
	0x38CC,		/* Global Reset */
	0x38F0,		/* Wildcard */
	0x38FC,		/* Informant */
@@ -258,7 +259,7 @@ static const u32 qlcnic_83xx_ext_reg_tbl[] = {
	0x34A4,		/* QLC_83XX_ASIC_TEMP */
};

static const u32 qlcnic_83xx_reg_tbl[] = {
const u32 qlcnic_83xx_reg_tbl[] = {
	0x34A8,		/* PEG_HALT_STAT1 */
	0x34AC,		/* PEG_HALT_STAT2 */
	0x34B0,		/* FW_HEARTBEAT */
@@ -415,8 +416,11 @@ int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter, u8 num_intr)
		return err;
	if (adapter->flags & QLCNIC_MSIX_ENABLED)
		num_msix = adapter->ahw->num_msix;
	else
	else {
		if (qlcnic_sriov_vf_check(adapter))
			return -EINVAL;
		num_msix = 1;
	}
	/* setup interrupt mapping table for fw */
	ahw->intr_tbl = vzalloc(num_msix *
				sizeof(struct qlcnic_intrpt_config));
@@ -649,7 +653,7 @@ int qlcnic_83xx_setup_mbx_intr(struct qlcnic_adapter *adapter)
void qlcnic_83xx_get_func_no(struct qlcnic_adapter *adapter)
{
	u32 val = QLCRDX(adapter->ahw, QLCNIC_INFORMANT);
	adapter->ahw->pci_func = val & 0xf;
	adapter->ahw->pci_func = (val >> 24) & 0xff;
}

int qlcnic_83xx_cam_lock(struct qlcnic_adapter *adapter)
@@ -761,6 +765,11 @@ void qlcnic_83xx_check_vf(struct qlcnic_adapter *adapter,
	ahw->fw_hal_version = 2;
	qlcnic_get_func_no(adapter);

	if (qlcnic_sriov_vf_check(adapter)) {
		qlcnic_sriov_vf_set_ops(adapter);
		return;
	}

	/* Determine function privilege level */
	op_mode = QLCRDX(adapter->ahw, QLC_83XX_DRV_OP_MODE);
	if (op_mode == QLC_83XX_DEFAULT_OPMODE)
@@ -1487,6 +1496,9 @@ void qlcnic_83xx_register_nic_idc_func(struct qlcnic_adapter *adapter,
	struct qlcnic_cmd_args cmd;
	int status;

	if (qlcnic_sriov_vf_check(adapter))
		return;

	if (enable) {
		qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_INIT_NIC_FUNC);
		cmd.req.arg[1] = BIT_0 | BIT_31;
+1 −1
Original line number Diff line number Diff line
@@ -419,7 +419,7 @@ int qlcnic_83xx_read_flash_descriptor_table(struct qlcnic_adapter *);
int qlcnic_83xx_flash_read32(struct qlcnic_adapter *, u32, u8 *, int);
int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *,
				      u32, u8 *, int);
int qlcnic_83xx_init(struct qlcnic_adapter *);
int qlcnic_83xx_init(struct qlcnic_adapter *, int);
int qlcnic_83xx_idc_ready_state_entry(struct qlcnic_adapter *);
int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev);
void qlcnic_83xx_idc_poll_dev_state(struct work_struct *);
+5 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 * See LICENSE.qlcnic for copyright and licensing details.
 */

#include "qlcnic_sriov.h"
#include "qlcnic.h"
#include "qlcnic_hw.h"

@@ -2045,10 +2046,13 @@ static void qlcnic_83xx_clear_function_resources(struct qlcnic_adapter *adapter)
	}
}

int qlcnic_83xx_init(struct qlcnic_adapter *adapter)
int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac)
{
	struct qlcnic_hardware_context *ahw = adapter->ahw;

	if (qlcnic_sriov_vf_check(adapter))
		return qlcnic_sriov_vf_init(adapter, pci_using_dac);

	if (qlcnic_83xx_check_hw_status(adapter))
		return -EIO;

+2 −1
Original line number Diff line number Diff line
@@ -715,7 +715,8 @@ enum {
	QLCNIC_PRIV_FUNC	= 1,
	QLCNIC_NON_PRIV_FUNC	= 2,
	QLCNIC_SRIOV_PF_FUNC	= 3,
	QLCNIC_UNKNOWN_FUNC_MODE = 4
	QLCNIC_SRIOV_VF_FUNC	= 4,
	QLCNIC_UNKNOWN_FUNC_MODE = 5
};

enum {
Loading