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

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

qlcnic: Support SR-IOV enable and disable



o Add QLCNIC_SRIOV to Kconfig.
o Provide PCI sysfs hooks to enable and disable SR-IOV.
o Allow enabling only when CONFIG_QLCNIC_SRIOV is defined.
o qlcnic_sriov_pf.c has all the PF related SR-IOV
  functionality.
o qlcnic_sriov_common.c has VF functionality and SR-IOV
  functionality which is common between VF and PF.
o qlcnic_sriov.h is a common header file for SR-IOV defines.

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 c23343cf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -35,6 +35,16 @@ config QLCNIC
	  This driver supports QLogic QLE8240 and QLE8242 Converged Ethernet
	  devices.

config QLCNIC_SRIOV
	bool "QLOGIC QLCNIC 83XX family SR-IOV Support"
	depends on QLCNIC && PCI_IOV
	default y
	---help---
	  This configuration parameter enables Single Root Input Output
	  Virtualization support for QLE83XX Converged Ethernet devices.
	  This allows for virtual function acceleration in virtualized
	  environments.

config QLGE
	tristate "QLogic QLGE 10Gb Ethernet Driver Support"
	depends on PCI
+3 −1
Original line number Diff line number Diff line
@@ -8,4 +8,6 @@ qlcnic-y := qlcnic_hw.o qlcnic_main.o qlcnic_init.o \
	qlcnic_ethtool.o qlcnic_ctx.o qlcnic_io.o \
	qlcnic_sysfs.o qlcnic_minidump.o qlcnic_83xx_hw.o \
	qlcnic_83xx_init.o qlcnic_83xx_vnic.o \
	qlcnic_minidump.o
	qlcnic_minidump.o qlcnic_sriov_common.o

qlcnic-$(CONFIG_QLCNIC_SRIOV) += qlcnic_sriov_pf.o
+18 −2
Original line number Diff line number Diff line
@@ -449,6 +449,7 @@ struct qlcnic_hardware_context {
	struct qlc_83xx_idc idc;
	struct qlc_83xx_fw_info fw_info;
	struct qlcnic_intrpt_config *intr_tbl;
	struct qlcnic_sriov *sriov;
	u32 *reg_tbl;
	u32 *ext_reg_tbl;
	u32 mbox_aen[QLC_83XX_MBX_AEN_CNT];
@@ -915,6 +916,8 @@ struct qlcnic_ipaddr {
#define __QLCNIC_DIAG_RES_ALLOC		6
#define __QLCNIC_LED_ENABLE		7
#define __QLCNIC_ELB_INPROGRESS		8
#define __QLCNIC_SRIOV_ENABLE		10
#define __QLCNIC_SRIOV_CAPABLE		11

#define QLCNIC_INTERRUPT_TEST		1
#define QLCNIC_LOOPBACK_TEST		2
@@ -1051,7 +1054,11 @@ struct qlcnic_info_le {
	u8      total_pf;
	u8      total_rss_engines;
	__le16  max_vports;
	u8      reserved2[64];
	__le16	linkstate_reg_offset;
	__le16	bit_offsets;
	__le16  max_local_ipv6_addrs;
	__le16  max_remote_ipv6_addrs;
	u8	reserved2[56];
} __packed;

struct qlcnic_info {
@@ -1083,6 +1090,10 @@ struct qlcnic_info {
	u8      total_pf;
	u8      total_rss_engines;
	u16	max_vports;
	u16	linkstate_reg_offset;
	u16	bit_offsets;
	u16	max_local_ipv6_addrs;
	u16	max_remote_ipv6_addrs;
};

struct qlcnic_pci_info_le {
@@ -1511,6 +1522,7 @@ int qlcnic_reset_npar_config(struct qlcnic_adapter *);
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);
/*
 * QLOGIC Board information
 */
@@ -1843,5 +1855,9 @@ static inline bool qlcnic_83xx_check(struct qlcnic_adapter *adapter)
	return (device == PCI_DEVICE_ID_QLOGIC_QLE834X) ? true : false;
}

static inline bool qlcnic_sriov_pf_check(struct qlcnic_adapter *adapter)
{
	return (adapter->ahw->op_mode == QLCNIC_SRIOV_PF_FUNC) ? true : false;
}

#endif				/* __QLCNIC_H_ */
+4 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ static const struct qlcnic_mailbox_metadata qlcnic_83xx_mbx_tbl[] = {
	{QLCNIC_CMD_SET_LED_CONFIG, 5, 1},
	{QLCNIC_CMD_GET_LED_CONFIG, 1, 5},
	{QLCNIC_CMD_ADD_RCV_RINGS, 130, 26},
	{QLCNIC_CMD_CONFIG_VPORT, 4, 4},
};

static const u32 qlcnic_83xx_ext_reg_tbl[] = {
@@ -775,6 +776,9 @@ void qlcnic_83xx_check_vf(struct qlcnic_adapter *adapter,
			 ahw->fw_hal_version);
		adapter->nic_ops = &qlcnic_vf_ops;
	} else {
		if (pci_find_ext_capability(adapter->pdev,
					    PCI_EXT_CAP_ID_SRIOV))
			set_bit(__QLCNIC_SRIOV_CAPABLE, &adapter->state);
		adapter->nic_ops = &qlcnic_83xx_ops;
	}
}
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ struct qlc_83xx_idc {
#define QLC_83XX_GET_FW_LRO_MSS_CAPABILITY(val)	(val & 0x20000)
#define QLC_83XX_VIRTUAL_NIC_MODE			0xFF
#define QLC_83XX_DEFAULT_MODE				0x0
#define QLC_83XX_SRIOV_MODE				0x1
#define QLCNIC_BRDTYPE_83XX_10G			0x0083

#define QLC_83XX_FLASH_SPI_STATUS		0x2808E010
Loading