Skip to content

Commit

Permalink
qlcnic: Remove obsolete code
Browse files Browse the repository at this point in the history
Current driver uses FW API version 2 and thus code corresponding to FW API
version 1 has become obsolete. Clean up this from the driver.

Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Anirban Chakraborty authored and David S. Miller committed Jun 29, 2010
1 parent 51f932c commit 45918e2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 57 deletions.
26 changes: 4 additions & 22 deletions drivers/net/qlcnic/qlcnic_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
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 *)
Expand All @@ -241,16 +236,8 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter)
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);
Expand Down Expand Up @@ -352,12 +339,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter)

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);
Expand Down
6 changes: 0 additions & 6 deletions drivers/net/qlcnic/qlcnic_hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,6 @@ enum {
QLCNIC_NON_PRIV_FUNC = 2
};

/* FW HAL api version */
enum {
QLCNIC_FW_BASE = 1,
QLCNIC_FW_NPAR = 2
};

#define QLC_DEV_DRV_DEFAULT 0x11111111

#define LSB(x) ((uint8_t)(x))
Expand Down
16 changes: 7 additions & 9 deletions drivers/net/qlcnic/qlcnic_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,16 +548,14 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
int timeo;
u32 val;

if (adapter->fw_hal_version == QLCNIC_FW_BASE) {
val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
val = QLC_DEV_GET_DRV(val, adapter->portnum);
if ((val & 0x3) != QLCNIC_TYPE_NIC) {
dev_err(&adapter->pdev->dev,
"Not an Ethernet NIC func=%u\n", val);
return -EIO;
}
adapter->physical_port = (val >> 2);
val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
val = QLC_DEV_GET_DRV(val, adapter->portnum);
if ((val & 0x3) != QLCNIC_TYPE_NIC) {
dev_err(&adapter->pdev->dev,
"Not an Ethernet NIC func=%u\n", val);
return -EIO;
}
adapter->physical_port = (val >> 2);
if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
timeo = 30;

Expand Down
22 changes: 2 additions & 20 deletions drivers/net/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,6 @@ static const struct net_device_ops qlcnic_netdev_ops = {
};

static struct qlcnic_nic_template qlcnic_ops = {
.get_mac_addr = qlcnic_get_mac_addr,
.config_bridged_mode = qlcnic_config_bridged_mode,
.config_led = qlcnic_config_led,
.set_ilb_mode = qlcnic_set_ilb_mode,
.clear_ilb_mode = qlcnic_clear_ilb_mode,
.start_firmware = qlcnic_start_firmware
};

static struct qlcnic_nic_template qlcnic_pf_ops = {
.get_mac_addr = qlcnic_get_mac_address,
.config_bridged_mode = qlcnic_config_bridged_mode,
.config_led = qlcnic_config_led,
Expand Down Expand Up @@ -534,15 +525,6 @@ qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)

/* Determine FW API version */
adapter->fw_hal_version = readl(adapter->ahw.pci_base0 + QLCNIC_FW_API);
if (adapter->fw_hal_version == ~0) {
adapter->nic_ops = &qlcnic_ops;
adapter->fw_hal_version = QLCNIC_FW_BASE;
adapter->ahw.pci_func = PCI_FUNC(adapter->pdev->devfn);
adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
dev_info(&adapter->pdev->dev,
"FW does not support nic partion\n");
return adapter->fw_hal_version;
}

/* Find PCI function number */
pci_read_config_dword(adapter->pdev, QLCNIC_MSIX_TABLE_OFFSET, &func);
Expand All @@ -569,7 +551,7 @@ qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)
switch (priv_level) {
case QLCNIC_MGMT_FUNC:
adapter->op_mode = QLCNIC_MGMT_FUNC;
adapter->nic_ops = &qlcnic_pf_ops;
adapter->nic_ops = &qlcnic_ops;
qlcnic_get_pci_info(adapter);
/* Set privilege level for other functions */
qlcnic_set_function_modes(adapter);
Expand All @@ -582,7 +564,7 @@ qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)
dev_info(&adapter->pdev->dev,
"HAL Version: %d, Privileged function\n",
adapter->fw_hal_version);
adapter->nic_ops = &qlcnic_pf_ops;
adapter->nic_ops = &qlcnic_ops;
break;
case QLCNIC_NON_PRIV_FUNC:
adapter->op_mode = QLCNIC_NON_PRIV_FUNC;
Expand Down

0 comments on commit 45918e2

Please sign in to comment.