rds_ring = &recv_ctx->rds_rings[i];
reg = le32_to_cpu(prsp_rds[i].host_producer_crb);
- if (adapter->fw_hal_version == QLCNIC_FW_BASE)
- rds_ring->crb_rcv_producer = qlcnic_get_ioaddr(adapter,
- QLCNIC_REG(reg - 0x200));
- else
- rds_ring->crb_rcv_producer = adapter->ahw.pci_base0 +
- reg;
+ rds_ring->crb_rcv_producer = adapter->ahw.pci_base0 + reg;
}
prsp_sds = ((struct qlcnic_cardrsp_sds_ring *)
reg = le32_to_cpu(prsp_sds[i].host_consumer_crb);
reg2 = le32_to_cpu(prsp_sds[i].interrupt_crb);
- if (adapter->fw_hal_version == QLCNIC_FW_BASE) {
- sds_ring->crb_sts_consumer = qlcnic_get_ioaddr(adapter,
- QLCNIC_REG(reg - 0x200));
- sds_ring->crb_intr_mask = qlcnic_get_ioaddr(adapter,
- QLCNIC_REG(reg2 - 0x200));
- } else {
- sds_ring->crb_sts_consumer = adapter->ahw.pci_base0 +
- reg;
- sds_ring->crb_intr_mask = adapter->ahw.pci_base0 + reg2;
- }
+ sds_ring->crb_sts_consumer = adapter->ahw.pci_base0 + reg;
+ sds_ring->crb_intr_mask = adapter->ahw.pci_base0 + reg2;
}
recv_ctx->state = le32_to_cpu(prsp->host_ctx_state);
if (err == QLCNIC_RCODE_SUCCESS) {
temp = le32_to_cpu(prsp->cds_ring.host_producer_crb);
- if (adapter->fw_hal_version == QLCNIC_FW_BASE)
- tx_ring->crb_cmd_producer = qlcnic_get_ioaddr(adapter,
- QLCNIC_REG(temp - 0x200));
- else
- tx_ring->crb_cmd_producer = adapter->ahw.pci_base0 +
- temp;
+ tx_ring->crb_cmd_producer = adapter->ahw.pci_base0 + temp;
adapter->tx_context_id =
le16_to_cpu(prsp->context_id);
}
/* Get info of a NIC partition */
-int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, u8 func_id)
+int qlcnic_get_nic_info(struct qlcnic_adapter *adapter,
+ struct qlcnic_info *npar_info, u8 func_id)
{
int err;
dma_addr_t nic_dma_t;
QLCNIC_CDRP_CMD_GET_NIC_INFO);
if (err == QLCNIC_RCODE_SUCCESS) {
- adapter->physical_port = le16_to_cpu(nic_info->phys_port);
- adapter->switch_mode = le16_to_cpu(nic_info->switch_mode);
- adapter->max_tx_ques = le16_to_cpu(nic_info->max_tx_ques);
- adapter->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques);
- adapter->min_tx_bw = le16_to_cpu(nic_info->min_tx_bw);
- adapter->max_tx_bw = le16_to_cpu(nic_info->max_tx_bw);
- adapter->max_mtu = le16_to_cpu(nic_info->max_mtu);
- adapter->capabilities = le32_to_cpu(nic_info->capabilities);
- adapter->max_mac_filters = nic_info->max_mac_filters;
-
- if (adapter->capabilities & BIT_6)
- adapter->flags |= QLCNIC_ESWITCH_ENABLED;
- else
- adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
+ npar_info->pci_func = le16_to_cpu(nic_info->pci_func);
+ npar_info->op_mode = le16_to_cpu(nic_info->op_mode);
+ npar_info->phys_port = le16_to_cpu(nic_info->phys_port);
+ npar_info->switch_mode = le16_to_cpu(nic_info->switch_mode);
+ npar_info->max_tx_ques = le16_to_cpu(nic_info->max_tx_ques);
+ npar_info->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques);
+ npar_info->min_tx_bw = le16_to_cpu(nic_info->min_tx_bw);
+ npar_info->max_tx_bw = le16_to_cpu(nic_info->max_tx_bw);
+ npar_info->capabilities = le32_to_cpu(nic_info->capabilities);
+ npar_info->max_mtu = le16_to_cpu(nic_info->max_mtu);
dev_info(&adapter->pdev->dev,
"phy port: %d switch_mode: %d,\n"
"\tmax_tx_q: %d max_rx_q: %d min_tx_bw: 0x%x,\n"
"\tmax_tx_bw: 0x%x max_mtu:0x%x, capabilities: 0x%x\n",
- adapter->physical_port, adapter->switch_mode,
- adapter->max_tx_ques, adapter->max_rx_ques,
- adapter->min_tx_bw, adapter->max_tx_bw,
- adapter->max_mtu, adapter->capabilities);
+ npar_info->phys_port, npar_info->switch_mode,
+ npar_info->max_tx_ques, npar_info->max_rx_ques,
+ npar_info->min_tx_bw, npar_info->max_tx_bw,
+ npar_info->max_mtu, npar_info->capabilities);
} else {
dev_err(&adapter->pdev->dev,
"Failed to get nic info%d\n", err);
int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic)
{
int err = -EIO;
- u32 func_state;
dma_addr_t nic_dma_t;
void *nic_info_addr;
struct qlcnic_info *nic_info;
if (adapter->op_mode != QLCNIC_MGMT_FUNC)
return err;
- if (qlcnic_api_lock(adapter))
- return err;
-
- func_state = QLCRD32(adapter, QLCNIC_CRB_DEV_REF_COUNT);
- if (QLC_DEV_CHECK_ACTIVE(func_state, nic->pci_func)) {
- qlcnic_api_unlock(adapter);
- return err;
- }
-
- qlcnic_api_unlock(adapter);
-
nic_info_addr = pci_alloc_consistent(adapter->pdev, nic_size,
&nic_dma_t);
if (!nic_info_addr)
adapter->fw_hal_version,
MSD(nic_dma_t),
LSD(nic_dma_t),
- nic_size,
+ ((nic->pci_func << 16) | nic_size),
QLCNIC_CDRP_CMD_SET_NIC_INFO);
if (err != QLCNIC_RCODE_SUCCESS) {
}
/* Get PCI Info of a partition */
-int qlcnic_get_pci_info(struct qlcnic_adapter *adapter)
+int qlcnic_get_pci_info(struct qlcnic_adapter *adapter,
+ struct qlcnic_pci_info *pci_info)
{
int err = 0, i;
dma_addr_t pci_info_dma_t;
return -ENOMEM;
memset(pci_info_addr, 0, pci_size);
- if (!adapter->npars)
- adapter->npars = kzalloc(pci_size, GFP_KERNEL);
- if (!adapter->npars) {
- err = -ENOMEM;
- goto err_npar;
- }
-
- if (!adapter->eswitch)
- adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
- QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
- if (!adapter->eswitch) {
- err = -ENOMEM;
- goto err_eswitch;
- }
-
npar = (struct qlcnic_pci_info *) pci_info_addr;
err = qlcnic_issue_cmd(adapter,
adapter->ahw.pci_func,
QLCNIC_CDRP_CMD_GET_PCI_INFO);
if (err == QLCNIC_RCODE_SUCCESS) {
- for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++) {
- adapter->npars[i].id = le32_to_cpu(npar->id);
- adapter->npars[i].active = le32_to_cpu(npar->active);
- adapter->npars[i].type = le32_to_cpu(npar->type);
- adapter->npars[i].default_port =
+ for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++, npar++, pci_info++) {
+ pci_info->id = le32_to_cpu(npar->id);
+ pci_info->active = le32_to_cpu(npar->active);
+ pci_info->type = le32_to_cpu(npar->type);
+ pci_info->default_port =
le32_to_cpu(npar->default_port);
- adapter->npars[i].tx_min_bw =
+ pci_info->tx_min_bw =
le32_to_cpu(npar->tx_min_bw);
- adapter->npars[i].tx_max_bw =
+ pci_info->tx_max_bw =
le32_to_cpu(npar->tx_max_bw);
- memcpy(adapter->npars[i].mac, npar->mac, ETH_ALEN);
+ memcpy(pci_info->mac, npar->mac, ETH_ALEN);
}
} else {
dev_err(&adapter->pdev->dev,
"Failed to get PCI Info%d\n", err);
- kfree(adapter->npars);
err = -EIO;
}
- goto err_npar;
-
-err_eswitch:
- kfree(adapter->npars);
- adapter->npars = NULL;
-err_npar:
pci_free_consistent(adapter->pdev, pci_size, pci_info_addr,
pci_info_dma_t);
return err;
if (err != QLCNIC_RCODE_SUCCESS) {
dev_err(&adapter->pdev->dev,
"Failed to configure eswitch port%d\n", eswitch->port);
- eswitch->flags |= QLCNIC_SWITCH_ENABLE;
} else {
- eswitch->flags &= ~QLCNIC_SWITCH_ENABLE;
dev_info(&adapter->pdev->dev,
"Configured eSwitch for port %d\n", eswitch->port);
}