aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/qlcnic/qlcnic.h2
-rw-r--r--drivers/net/qlcnic/qlcnic_ctx.c5
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c82
3 files changed, 37 insertions, 52 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 02db363f20cd..eb1bdb222ca3 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -891,7 +891,7 @@ struct qlcnic_mac_req {
891#define QLCNIC_LRO_ENABLED 0x08 891#define QLCNIC_LRO_ENABLED 0x08
892#define QLCNIC_BRIDGE_ENABLED 0X10 892#define QLCNIC_BRIDGE_ENABLED 0X10
893#define QLCNIC_DIAG_ENABLED 0x20 893#define QLCNIC_DIAG_ENABLED 0x20
894#define QLCNIC_NPAR_ENABLED 0x40 894#define QLCNIC_ESWITCH_ENABLED 0x40
895#define QLCNIC_IS_MSI_FAMILY(adapter) \ 895#define QLCNIC_IS_MSI_FAMILY(adapter) \
896 ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) 896 ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
897 897
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c
index 1e1dc58cddca..42feb23dec1d 100644
--- a/drivers/net/qlcnic/qlcnic_ctx.c
+++ b/drivers/net/qlcnic/qlcnic_ctx.c
@@ -637,6 +637,11 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, u8 func_id)
637 adapter->capabilities = le32_to_cpu(nic_info->capabilities); 637 adapter->capabilities = le32_to_cpu(nic_info->capabilities);
638 adapter->max_mac_filters = nic_info->max_mac_filters; 638 adapter->max_mac_filters = nic_info->max_mac_filters;
639 639
640 if (adapter->capabilities & BIT_6)
641 adapter->flags |= QLCNIC_ESWITCH_ENABLED;
642 else
643 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
644
640 dev_info(&adapter->pdev->dev, 645 dev_info(&adapter->pdev->dev,
641 "phy port: %d switch_mode: %d,\n" 646 "phy port: %d switch_mode: %d,\n"
642 "\tmax_tx_q: %d max_rx_q: %d min_tx_bw: 0x%x,\n" 647 "\tmax_tx_q: %d max_rx_q: %d min_tx_bw: 0x%x,\n"
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 99371bcaa547..128a0a72a234 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -502,39 +502,28 @@ qlcnic_set_function_modes(struct qlcnic_adapter *adapter)
502 if (QLC_DEV_CLR_REF_CNT(ref_count, adapter->ahw.pci_func)) 502 if (QLC_DEV_CLR_REF_CNT(ref_count, adapter->ahw.pci_func))
503 goto err_npar; 503 goto err_npar;
504 504
505 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { 505 if (qlcnic_config_npars) {
506 id = adapter->npars[i].id; 506 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
507 if (adapter->npars[i].type != QLCNIC_TYPE_NIC || 507 id = adapter->npars[i].id;
508 id == adapter->ahw.pci_func) 508 if (adapter->npars[i].type != QLCNIC_TYPE_NIC ||
509 continue; 509 id == adapter->ahw.pci_func)
510 data |= (qlcnic_config_npars & QLC_DEV_SET_DRV(0xf, id)); 510 continue;
511 data |= (qlcnic_config_npars &
512 QLC_DEV_SET_DRV(0xf, id));
513 }
514 } else {
515 data = readl(priv_op);
516 data = (data & ~QLC_DEV_SET_DRV(0xf, adapter->ahw.pci_func)) |
517 (QLC_DEV_SET_DRV(QLCNIC_MGMT_FUNC,
518 adapter->ahw.pci_func));
511 } 519 }
512 writel(data, priv_op); 520 writel(data, priv_op);
513
514err_npar: 521err_npar:
515 qlcnic_api_unlock(adapter); 522 qlcnic_api_unlock(adapter);
516err_lock: 523err_lock:
517 return ret; 524 return ret;
518} 525}
519 526
520static u8
521qlcnic_set_mgmt_driver(struct qlcnic_adapter *adapter)
522{
523 u8 i, ret = 0;
524
525 if (qlcnic_get_pci_info(adapter))
526 return ret;
527 /* Set the eswitch */
528 for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) {
529 if (!qlcnic_get_eswitch_capabilities(adapter, i,
530 &adapter->eswitch[i])) {
531 ret++;
532 qlcnic_toggle_eswitch(adapter, i, ret);
533 }
534 }
535 return ret;
536}
537
538static u32 527static u32
539qlcnic_get_driver_mode(struct qlcnic_adapter *adapter) 528qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)
540{ 529{
@@ -550,6 +539,7 @@ qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)
550 adapter->nic_ops = &qlcnic_ops; 539 adapter->nic_ops = &qlcnic_ops;
551 adapter->fw_hal_version = QLCNIC_FW_BASE; 540 adapter->fw_hal_version = QLCNIC_FW_BASE;
552 adapter->ahw.pci_func = PCI_FUNC(adapter->pdev->devfn); 541 adapter->ahw.pci_func = PCI_FUNC(adapter->pdev->devfn);
542 adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
553 dev_info(&adapter->pdev->dev, 543 dev_info(&adapter->pdev->dev,
554 "FW does not support nic partion\n"); 544 "FW does not support nic partion\n");
555 return adapter->fw_hal_version; 545 return adapter->fw_hal_version;
@@ -562,29 +552,28 @@ qlcnic_get_driver_mode(struct qlcnic_adapter *adapter)
562 func = (func - msix_base)/QLCNIC_MSIX_TBL_PGSIZE; 552 func = (func - msix_base)/QLCNIC_MSIX_TBL_PGSIZE;
563 adapter->ahw.pci_func = func; 553 adapter->ahw.pci_func = func;
564 554
555 qlcnic_get_nic_info(adapter, adapter->ahw.pci_func);
556
557 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) {
558 adapter->nic_ops = &qlcnic_ops;
559 return adapter->fw_hal_version;
560 }
561
565 /* Determine function privilege level */ 562 /* Determine function privilege level */
566 priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE; 563 priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE;
567 op_mode = readl(priv_op); 564 op_mode = readl(priv_op);
568 if (op_mode == QLC_DEV_DRV_DEFAULT) { 565 if (op_mode == QLC_DEV_DRV_DEFAULT)
569 priv_level = QLCNIC_MGMT_FUNC; 566 priv_level = QLCNIC_MGMT_FUNC;
570 if (qlcnic_api_lock(adapter)) 567 else
571 return 0;
572 op_mode = (op_mode & ~QLC_DEV_SET_DRV(0xf, func)) |
573 (QLC_DEV_SET_DRV(QLCNIC_MGMT_FUNC, func));
574 writel(op_mode, priv_op);
575 qlcnic_api_unlock(adapter);
576
577 } else
578 priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func); 568 priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func);
579 569
580 switch (priv_level) { 570 switch (priv_level) {
581 case QLCNIC_MGMT_FUNC: 571 case QLCNIC_MGMT_FUNC:
582 adapter->op_mode = QLCNIC_MGMT_FUNC; 572 adapter->op_mode = QLCNIC_MGMT_FUNC;
583 adapter->nic_ops = &qlcnic_pf_ops; 573 adapter->nic_ops = &qlcnic_pf_ops;
574 qlcnic_get_pci_info(adapter);
584 /* Set privilege level for other functions */ 575 /* Set privilege level for other functions */
585 if (qlcnic_config_npars) 576 qlcnic_set_function_modes(adapter);
586 qlcnic_set_function_modes(adapter);
587 qlcnic_dev_set_npar_ready(adapter);
588 dev_info(&adapter->pdev->dev, 577 dev_info(&adapter->pdev->dev,
589 "HAL Version: %d, Management function\n", 578 "HAL Version: %d, Management function\n",
590 adapter->fw_hal_version); 579 adapter->fw_hal_version);
@@ -716,11 +705,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
716 dev_info(&pdev->dev, "firmware v%d.%d.%d\n", 705 dev_info(&pdev->dev, "firmware v%d.%d.%d\n",
717 fw_major, fw_minor, fw_build); 706 fw_major, fw_minor, fw_build);
718 707
719 if (adapter->fw_hal_version == QLCNIC_FW_NPAR)
720 qlcnic_get_nic_info(adapter, adapter->ahw.pci_func);
721 else
722 adapter->capabilities = QLCRD32(adapter, CRB_FW_CAPABILITIES_1);
723
724 adapter->flags &= ~QLCNIC_LRO_ENABLED; 708 adapter->flags &= ~QLCNIC_LRO_ENABLED;
725 709
726 if (adapter->ahw.port_type == QLCNIC_XGBE) { 710 if (adapter->ahw.port_type == QLCNIC_XGBE) {
@@ -731,6 +715,8 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
731 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; 715 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G;
732 } 716 }
733 717
718 qlcnic_get_nic_info(adapter, adapter->ahw.pci_func);
719
734 adapter->msix_supported = !!use_msi_x; 720 adapter->msix_supported = !!use_msi_x;
735 adapter->rss_supported = !!use_msi_x; 721 adapter->rss_supported = !!use_msi_x;
736 722
@@ -797,13 +783,11 @@ wait_init:
797 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY); 783 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY);
798 qlcnic_idc_debug_info(adapter, 1); 784 qlcnic_idc_debug_info(adapter, 1);
799 785
800 qlcnic_dev_set_npar_ready(adapter);
801
802 qlcnic_check_options(adapter); 786 qlcnic_check_options(adapter);
803 787
804 if (adapter->fw_hal_version != QLCNIC_FW_BASE && 788 if (adapter->flags & QLCNIC_ESWITCH_ENABLED &&
805 adapter->op_mode == QLCNIC_MGMT_FUNC) 789 adapter->op_mode != QLCNIC_NON_PRIV_FUNC)
806 qlcnic_set_mgmt_driver(adapter); 790 qlcnic_dev_set_npar_ready(adapter);
807 791
808 adapter->need_fw_reset = 0; 792 adapter->need_fw_reset = 0;
809 793
@@ -2449,10 +2433,6 @@ qlcnic_dev_set_npar_ready(struct qlcnic_adapter *adapter)
2449{ 2433{
2450 u32 state; 2434 u32 state;
2451 2435
2452 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC ||
2453 adapter->fw_hal_version == QLCNIC_FW_BASE)
2454 return;
2455
2456 if (qlcnic_api_lock(adapter)) 2436 if (qlcnic_api_lock(adapter))
2457 return; 2437 return;
2458 2438