]> Pileus Git - ~andy/linux/blobdiff - drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
qlcnic: Support for 16 virtual NIC functions.
[~andy/linux] / drivers / net / ethernet / qlogic / qlcnic / qlcnic_83xx_vnic.c
index 0248a4c2f5dd15fb1f12827b90bf1af0b1e73ba1..474320a5f0c15aeac1956b6d528cbc5c5a2f0566 100644 (file)
@@ -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->total_nic_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->total_nic_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,8 +256,8 @@ 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 func, int *port_id)
+int qlcnic_83xx_set_port_eswitch_status(struct qlcnic_adapter *adapter,
+                                       int func, int *port_id)
 {
        struct qlcnic_info nic_info;
        int err = 0;
@@ -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;
 }