aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_init.c
diff options
context:
space:
mode:
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>2010-06-01 07:28:51 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-02 05:24:03 -0400
commit2e9d722db6617ed10204bfa9cd60552620592a43 (patch)
treeda905f18459e55a8cb534d757f5b14a3e9da73d5 /drivers/net/qlcnic/qlcnic_init.c
parentdd8f61d7ff92eb8a4626565ca37b209b3a8a9ce2 (diff)
qlcnic: NIC Partitioning - Add basic infrastructure support
Following changes have been added to enable the adapter to work in NIC partitioning mode where multiple PCI functions of an adapter port can be configured to work as NIC functions. The first function that is enumerated on the PCI bus assumes the role of management function which, besides being able to do all the NIC functionality, can configure other NIC partitions. Other NIC functions can be configured as privileged or non privileged functions. Privileged function can not configure other NIC functions but can do all the NIC functionality including any firmware initialization, chip reset etc. Non privileged functions can do only basic IO. For chip reset etc, it depends on the privilege or management function. 1. Added code to determine PCI function number independent of kernel API. 2. Added Driver - FW version 2.0 support. 3. Changed producer and consumer register offset calculation. 4. Added management and privileged operation modes for npar functions. A module parameter has been added to control it. 5. Added support for configuring the eswitch in the adapter. Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_init.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 71a4e664ad76..635c99022f06 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -520,17 +520,16 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
520 int timeo; 520 int timeo;
521 u32 val; 521 u32 val;
522 522
523 val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO); 523 if (adapter->fw_hal_version == QLCNIC_FW_BASE) {
524 val = (val >> (adapter->portnum * 4)) & 0xf; 524 val = QLCRD32(adapter, QLCNIC_CRB_DEV_PARTITION_INFO);
525 525 val = QLC_DEV_GET_DRV(val, adapter->portnum);
526 if ((val & 0x3) != 1) { 526 if ((val & 0x3) != QLCNIC_TYPE_NIC) {
527 dev_err(&adapter->pdev->dev, "Not an Ethernet NIC func=%u\n", 527 dev_err(&adapter->pdev->dev,
528 val); 528 "Not an Ethernet NIC func=%u\n", val);
529 return -EIO; 529 return -EIO;
530 }
531 adapter->physical_port = (val >> 2);
530 } 532 }
531
532 adapter->physical_port = (val >> 2);
533
534 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo)) 533 if (qlcnic_rom_fast_read(adapter, QLCNIC_ROM_DEV_INIT_TIMEOUT, &timeo))
535 timeo = 30; 534 timeo = 30;
536 535
@@ -1701,3 +1700,24 @@ qlcnic_process_rcv_ring_diag(struct qlcnic_host_sds_ring *sds_ring)
1701 sds_ring->consumer = consumer; 1700 sds_ring->consumer = consumer;
1702 writel(consumer, sds_ring->crb_sts_consumer); 1701 writel(consumer, sds_ring->crb_sts_consumer);
1703} 1702}
1703
1704void
1705qlcnic_fetch_mac(struct qlcnic_adapter *adapter, u32 off1, u32 off2,
1706 u8 alt_mac, u8 *mac)
1707{
1708 u32 mac_low, mac_high;
1709 int i;
1710
1711 mac_low = QLCRD32(adapter, off1);
1712 mac_high = QLCRD32(adapter, off2);
1713
1714 if (alt_mac) {
1715 mac_low |= (mac_low >> 16) | (mac_high << 16);
1716 mac_high >>= 16;
1717 }
1718
1719 for (i = 0; i < 2; i++)
1720 mac[i] = (u8)(mac_high >> ((1 - i) * 8));
1721 for (i = 2; i < 6; i++)
1722 mac[i] = (u8)(mac_low >> ((5 - i) * 8));
1723}