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

Commit 5d6fa099 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'qlcnic'



Himanshu Madhani says:

====================
qlcnic: ethtool enhancements and code cleanup.

This patch series contains

o updates to ethtool for pause settings and enhance
  register dump to display mask and ring indices.
o cleanup in DCB code and remove redundant eSwitch enablement command.
o fixed firmware dump collection logic to skip unknown entries.

Changes from v3 -> v4
o Dropped patch for Tx queue validation to be submitted in net.

Changes from v2 -> v3

o Updated patch to print informational messages as per Joe Perches's comment.

Changes from v1 -> v2

o Dropped patch to register device if adapter is in FAILED state for more rework.
o Updated patch to display ring indices via ethtool per Ben Hutchings's comment.
o Update patch for DCB cleanup per Stephen Hemminger's comment.

Please apply to net-next.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 28be6e07 60b4a1f3
Loading
Loading
Loading
Loading
+3 −98
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@

#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 3
#define _QLCNIC_LINUX_SUBVERSION 50
#define QLCNIC_LINUX_VERSIONID  "5.3.50"
#define _QLCNIC_LINUX_SUBVERSION 51
#define QLCNIC_LINUX_VERSIONID  "5.3.51"
#define QLCNIC_DRV_IDC_VER  0x01
#define QLCNIC_DRIVER_VERSION  ((_QLCNIC_LINUX_MAJOR << 16) |\
		 (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
@@ -961,8 +961,6 @@ struct qlcnic_ipaddr {
#define __QLCNIC_SRIOV_CAPABLE		11
#define __QLCNIC_MBX_POLL_ENABLE	12
#define __QLCNIC_DIAG_MODE		13
#define __QLCNIC_DCB_STATE		14
#define __QLCNIC_DCB_IN_AEN		15

#define QLCNIC_INTERRUPT_TEST		1
#define QLCNIC_LOOPBACK_TEST		2
@@ -1199,6 +1197,7 @@ struct qlcnic_npar_info {
	u8	promisc_mode;
	u8	offload_flags;
	u8      pci_func;
	u8      mac[ETH_ALEN];
};

struct qlcnic_eswitch {
@@ -2115,98 +2114,4 @@ static inline bool qlcnic_sriov_vf_check(struct qlcnic_adapter *adapter)

	return status;
}

static inline int qlcnic_dcb_get_hw_capability(struct qlcnic_adapter *adapter)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->get_hw_capability)
		return dcb->ops->get_hw_capability(adapter);

	return 0;
}

static inline void qlcnic_dcb_free(struct qlcnic_adapter *adapter)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->free)
		dcb->ops->free(adapter);
}

static inline int qlcnic_dcb_attach(struct qlcnic_adapter *adapter)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->attach)
		return dcb->ops->attach(adapter);

	return 0;
}

static inline int
qlcnic_dcb_query_hw_capability(struct qlcnic_adapter *adapter, char *buf)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->query_hw_capability)
		return dcb->ops->query_hw_capability(adapter, buf);

	return 0;
}

static inline void qlcnic_dcb_get_info(struct qlcnic_adapter *adapter)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->get_info)
		dcb->ops->get_info(adapter);
}

static inline int
qlcnic_dcb_query_cee_param(struct qlcnic_adapter *adapter, char *buf, u8 type)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->query_cee_param)
		return dcb->ops->query_cee_param(adapter, buf, type);

	return 0;
}

static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_adapter *adapter)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->get_cee_cfg)
		return dcb->ops->get_cee_cfg(adapter);

	return 0;
}

static inline void
qlcnic_dcb_register_aen(struct qlcnic_adapter *adapter, u8 flag)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->register_aen)
		dcb->ops->register_aen(adapter, flag);
}

static inline void qlcnic_dcb_handle_aen(struct qlcnic_adapter *adapter,
					 void *msg)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->handle_aen)
		dcb->ops->handle_aen(adapter, msg);
}

static inline void qlcnic_dcb_init_dcbnl_ops(struct qlcnic_adapter *adapter)
{
	struct qlcnic_dcb *dcb = adapter->dcb;

	if (dcb && dcb->ops->init_dcbnl_ops)
		dcb->ops->init_dcbnl_ops(adapter);
}
#endif				/* __QLCNIC_H_ */
+20 −20
Original line number Diff line number Diff line
@@ -902,7 +902,7 @@ void __qlcnic_83xx_process_aen(struct qlcnic_adapter *adapter)
			 QLCNIC_MBX_RSP(event[0]));
		break;
	case QLCNIC_MBX_DCBX_CONFIG_CHANGE_EVENT:
		qlcnic_dcb_handle_aen(adapter, (void *)&event[1]);
		qlcnic_dcb_aen_handler(adapter->dcb, (void *)&event[1]);
		break;
	default:
		dev_dbg(&adapter->pdev->dev, "Unsupported AEN:0x%x.\n",
@@ -2321,19 +2321,7 @@ int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *adapter,
			i++;
			memcpy(pci_info->mac + sizeof(u32), &cmd.rsp.arg[i], 2);
			i = i + 3;
			if (ahw->op_mode == QLCNIC_MGMT_FUNC)
				dev_info(dev, "id = %d active = %d type = %d\n"
					 "\tport = %d min bw = %d max bw = %d\n"
					 "\tmac_addr =  %pM\n", pci_info->id,
					 pci_info->active, pci_info->type,
					 pci_info->default_port,
					 pci_info->tx_min_bw,
					 pci_info->tx_max_bw, pci_info->mac);
		}
		if (ahw->op_mode == QLCNIC_MGMT_FUNC)
			dev_info(dev, "Max functions = %d, active functions = %d\n",
				 ahw->max_pci_func, ahw->act_pci_func);

		}
	} else {
		dev_err(dev, "Failed to get PCI Info, error = %d\n", err);
		err = -EIO;
@@ -3279,12 +3267,12 @@ int qlcnic_83xx_reg_test(struct qlcnic_adapter *adapter)
	return 0;
}

int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
inline int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
{
	return (ARRAY_SIZE(qlcnic_83xx_ext_reg_tbl) *
		sizeof(adapter->ahw->ext_reg_tbl)) +
		(ARRAY_SIZE(qlcnic_83xx_reg_tbl) +
		sizeof(adapter->ahw->reg_tbl));
		sizeof(*adapter->ahw->ext_reg_tbl)) +
		(ARRAY_SIZE(qlcnic_83xx_reg_tbl) *
		sizeof(*adapter->ahw->reg_tbl));
}

int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff)
@@ -3381,10 +3369,21 @@ void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *adapter,
	}
	config = ahw->port_config;
	if (config & QLC_83XX_CFG_STD_PAUSE) {
		if (config & QLC_83XX_CFG_STD_TX_PAUSE)
		switch (MSW(config)) {
		case QLC_83XX_TX_PAUSE:
			pause->tx_pause = 1;
		if (config & QLC_83XX_CFG_STD_RX_PAUSE)
			break;
		case QLC_83XX_RX_PAUSE:
			pause->rx_pause = 1;
			break;
		case QLC_83XX_TX_RX_PAUSE:
		default:
			/* Backward compatibility for existing
			 * flash definitions
			 */
			pause->tx_pause = 1;
			pause->rx_pause = 1;
		}
	}

	if (QLC_83XX_AUTONEG(config))
@@ -3427,7 +3426,8 @@ int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter,
		ahw->port_config &= ~QLC_83XX_CFG_STD_RX_PAUSE;
		ahw->port_config |= QLC_83XX_CFG_STD_TX_PAUSE;
	} else if (!pause->rx_pause && !pause->tx_pause) {
		ahw->port_config &= ~QLC_83XX_CFG_STD_TX_RX_PAUSE;
		ahw->port_config &= ~(QLC_83XX_CFG_STD_TX_RX_PAUSE |
				      QLC_83XX_CFG_STD_PAUSE);
	}
	status = qlcnic_83xx_set_port_config(adapter);
	if (status) {
+4 −1
Original line number Diff line number Diff line
@@ -363,6 +363,9 @@ enum qlcnic_83xx_states {
#define QLC_83XX_LINK_EEE(data)		((data) & BIT_13)
#define QLC_83XX_DCBX(data)			(((data) >> 28) & 7)
#define QLC_83XX_AUTONEG(data)			((data) & BIT_15)
#define QLC_83XX_TX_PAUSE			0x10
#define QLC_83XX_RX_PAUSE			0x20
#define QLC_83XX_TX_RX_PAUSE			0x30
#define QLC_83XX_CFG_STD_PAUSE			(1 << 5)
#define QLC_83XX_CFG_STD_TX_PAUSE		(1 << 20)
#define QLC_83XX_CFG_STD_RX_PAUSE		(2 << 20)
@@ -626,7 +629,7 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *);
int qlcnic_83xx_get_vnic_vport_info(struct qlcnic_adapter *,
				    struct qlcnic_info *, u8);
int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *);
int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *, int);
int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *, int, int *);

void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *);
void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data);
+17 −3
Original line number Diff line number Diff line
@@ -636,7 +636,7 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter)
	if (adapter->portnum == 0)
		qlcnic_set_drv_version(adapter);

	qlcnic_dcb_get_info(adapter);
	qlcnic_dcb_get_info(adapter->dcb);
	qlcnic_83xx_idc_attach_driver(adapter);

	return 0;
@@ -818,6 +818,7 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter)
	struct qlcnic_hardware_context *ahw = adapter->ahw;
	struct qlcnic_mailbox *mbx = ahw->mailbox;
	int ret = 0;
	u32 owner;
	u32 val;

	/* Perform NIC configuration based ready state entry actions */
@@ -846,6 +847,10 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter)
			clear_bit(QLC_83XX_MBX_READY, &mbx->status);
			set_bit(__QLCNIC_RESETTING, &adapter->state);
			qlcnic_83xx_idc_enter_need_reset_state(adapter, 1);
		}  else {
			owner = qlcnic_83xx_idc_find_reset_owner_id(adapter);
			if (ahw->pci_func == owner)
				qlcnic_dump_fw(adapter);
		}
		return -EIO;
	}
@@ -1058,6 +1063,12 @@ void qlcnic_83xx_idc_poll_dev_state(struct work_struct *work)
	adapter->ahw->idc.prev_state = adapter->ahw->idc.curr_state;
	qlcnic_83xx_periodic_tasks(adapter);

	/* Do not reschedule if firmaware is in hanged state and auto
	 * recovery is disabled
	 */
	if ((adapter->flags & QLCNIC_FW_HANG) && !qlcnic_auto_fw_reset)
		return;

	/* Re-schedule the function */
	if (test_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status))
		qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state,
@@ -2163,6 +2174,7 @@ static int qlcnic_83xx_get_fw_info(struct qlcnic_adapter *adapter)
int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac)
{
	struct qlcnic_hardware_context *ahw = adapter->ahw;
	struct qlcnic_dcb *dcb;
	int err = 0;

	ahw->msix_supported = !!qlcnic_use_msi_x;
@@ -2220,8 +2232,10 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac)
	if (err)
		goto disable_mbx_intr;

	if (adapter->dcb && qlcnic_dcb_attach(adapter))
		qlcnic_clear_dcb_ops(adapter);
	dcb = adapter->dcb;

	if (dcb && qlcnic_dcb_attach(dcb))
		qlcnic_clear_dcb_ops(dcb);

	/* Periodically monitor device status */
	qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work);
+24 −23
Original line number Diff line number Diff line
@@ -94,13 +94,29 @@ qlcnic_83xx_config_vnic_buff_descriptors(struct qlcnic_adapter *adapter)
 **/
static int qlcnic_83xx_init_mgmt_vnic(struct qlcnic_adapter *adapter)
{
	int err = -EIO;
	struct qlcnic_hardware_context *ahw = adapter->ahw;
	struct device *dev = &adapter->pdev->dev;
	struct qlcnic_npar_info *npar;
	int i, err = -EIO;

	qlcnic_83xx_get_minidump_template(adapter);

	if (!(adapter->flags & QLCNIC_ADAPTER_INITIALIZED)) {
		if (qlcnic_init_pci_info(adapter))
			return err;

		npar = adapter->npars;

		for (i = 0; i < ahw->act_pci_func; i++, npar++) {
			dev_info(dev, "id:%d active:%d type:%d port:%d min_bw:%d max_bw:%d mac_addr:%pM\n",
				 npar->pci_func, npar->active, npar->type,
				 npar->phy_port, npar->min_bw, npar->max_bw,
				 npar->mac);
		}

		dev_info(dev, "Max functions = %d, active functions = %d\n",
			 ahw->max_pci_func, ahw->act_pci_func);

		if (qlcnic_83xx_set_vnic_opmode(adapter))
			return err;

@@ -115,12 +131,12 @@ static int qlcnic_83xx_init_mgmt_vnic(struct qlcnic_adapter *adapter)
		return err;

	qlcnic_83xx_config_vnic_buff_descriptors(adapter);
	adapter->ahw->msix_supported = !!qlcnic_use_msi_x;
	ahw->msix_supported = qlcnic_use_msi_x ? 1 : 0;
	adapter->flags |= QLCNIC_ADAPTER_INITIALIZED;
	qlcnic_83xx_enable_vnic_mode(adapter, 1);

	dev_info(&adapter->pdev->dev, "HAL Version: %d, Management function\n",
		 adapter->ahw->fw_hal_version);
	dev_info(dev, "HAL Version: %d, Management function\n",
		 ahw->fw_hal_version);

	return 0;
}
@@ -240,7 +256,7 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter)
	return 0;
}

static int qlcnic_83xx_get_eswitch_port_info(struct qlcnic_adapter *adapter,
int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *adapter,
					int func, int *port_id)
{
	struct qlcnic_info nic_info;
@@ -257,23 +273,8 @@ static int qlcnic_83xx_get_eswitch_port_info(struct qlcnic_adapter *adapter,
	else
		err = -EIO;

	return err;
}

int qlcnic_83xx_enable_port_eswitch(struct qlcnic_adapter *adapter, int func)
{
	int id, err = 0;

	err = qlcnic_83xx_get_eswitch_port_info(adapter, func, &id);
	if (err)
		return err;

	if (!(adapter->eswitch[id].flags & QLCNIC_SWITCH_ENABLE)) {
		if (!qlcnic_enable_eswitch(adapter, id, 1))
			adapter->eswitch[id].flags |= QLCNIC_SWITCH_ENABLE;
		else
			err = -EIO;
	}
	if (!err)
		adapter->eswitch[*port_id].flags |= QLCNIC_SWITCH_ENABLE;

	return err;
}
Loading