bnad.c (ad24d6f04d8d279cb739fb5267487fe94c6b9ab3) | bnad.c (ecc467896d977f4f1a6dfee77652aab117ebfb73) |
---|---|
1/* 2 * Linux network driver for QLogic BR-series Converged Network Adapter. 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License (GPL) Version 2 as 6 * published by the Free Software Foundation 7 * 8 * This program is distributed in the hope that it will be useful, but --- 932 unchanged lines hidden (view full) --- 941 if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) 942 BNAD_UPDATE_CTR(bnad, cee_toggle); 943 clear_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags); 944 } 945 946 if (link_up) { 947 if (!netif_carrier_ok(bnad->netdev)) { 948 uint tx_id, tcb_id; | 1/* 2 * Linux network driver for QLogic BR-series Converged Network Adapter. 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License (GPL) Version 2 as 6 * published by the Free Software Foundation 7 * 8 * This program is distributed in the hope that it will be useful, but --- 932 unchanged lines hidden (view full) --- 941 if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) 942 BNAD_UPDATE_CTR(bnad, cee_toggle); 943 clear_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags); 944 } 945 946 if (link_up) { 947 if (!netif_carrier_ok(bnad->netdev)) { 948 uint tx_id, tcb_id; |
949 printk(KERN_WARNING "bna: %s link up\n", 950 bnad->netdev->name); | 949 netdev_info(bnad->netdev, "link up\n"); |
951 netif_carrier_on(bnad->netdev); 952 BNAD_UPDATE_CTR(bnad, link_toggle); 953 for (tx_id = 0; tx_id < bnad->num_tx; tx_id++) { 954 for (tcb_id = 0; tcb_id < bnad->num_txq_per_tx; 955 tcb_id++) { 956 struct bna_tcb *tcb = 957 bnad->tx_info[tx_id].tcb[tcb_id]; 958 u32 txq_id; 959 if (!tcb) 960 continue; 961 962 txq_id = tcb->id; 963 964 if (test_bit(BNAD_TXQ_TX_STARTED, 965 &tcb->flags)) { 966 /* 967 * Force an immediate 968 * Transmit Schedule */ | 950 netif_carrier_on(bnad->netdev); 951 BNAD_UPDATE_CTR(bnad, link_toggle); 952 for (tx_id = 0; tx_id < bnad->num_tx; tx_id++) { 953 for (tcb_id = 0; tcb_id < bnad->num_txq_per_tx; 954 tcb_id++) { 955 struct bna_tcb *tcb = 956 bnad->tx_info[tx_id].tcb[tcb_id]; 957 u32 txq_id; 958 if (!tcb) 959 continue; 960 961 txq_id = tcb->id; 962 963 if (test_bit(BNAD_TXQ_TX_STARTED, 964 &tcb->flags)) { 965 /* 966 * Force an immediate 967 * Transmit Schedule */ |
969 printk(KERN_INFO "bna: %s %d " 970 "TXQ_STARTED\n", 971 bnad->netdev->name, 972 txq_id); | |
973 netif_wake_subqueue( 974 bnad->netdev, 975 txq_id); 976 BNAD_UPDATE_CTR(bnad, 977 netif_queue_wakeup); 978 } else { 979 netif_stop_subqueue( 980 bnad->netdev, 981 txq_id); 982 BNAD_UPDATE_CTR(bnad, 983 netif_queue_stop); 984 } 985 } 986 } 987 } 988 } else { 989 if (netif_carrier_ok(bnad->netdev)) { | 968 netif_wake_subqueue( 969 bnad->netdev, 970 txq_id); 971 BNAD_UPDATE_CTR(bnad, 972 netif_queue_wakeup); 973 } else { 974 netif_stop_subqueue( 975 bnad->netdev, 976 txq_id); 977 BNAD_UPDATE_CTR(bnad, 978 netif_queue_stop); 979 } 980 } 981 } 982 } 983 } else { 984 if (netif_carrier_ok(bnad->netdev)) { |
990 printk(KERN_WARNING "bna: %s link down\n", 991 bnad->netdev->name); | 985 netdev_info(bnad->netdev, "link down\n"); |
992 netif_carrier_off(bnad->netdev); 993 BNAD_UPDATE_CTR(bnad, link_toggle); 994 } 995 } 996} 997 998static void 999bnad_cb_tx_disabled(void *arg, struct bna_tx *tx) --- 53 unchanged lines hidden (view full) --- 1053 1054 for (i = 0; i < BNAD_MAX_TXQ_PER_TX; i++) { 1055 tcb = tx_info->tcb[i]; 1056 if (!tcb) 1057 continue; 1058 txq_id = tcb->id; 1059 clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags); 1060 netif_stop_subqueue(bnad->netdev, txq_id); | 986 netif_carrier_off(bnad->netdev); 987 BNAD_UPDATE_CTR(bnad, link_toggle); 988 } 989 } 990} 991 992static void 993bnad_cb_tx_disabled(void *arg, struct bna_tx *tx) --- 53 unchanged lines hidden (view full) --- 1047 1048 for (i = 0; i < BNAD_MAX_TXQ_PER_TX; i++) { 1049 tcb = tx_info->tcb[i]; 1050 if (!tcb) 1051 continue; 1052 txq_id = tcb->id; 1053 clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags); 1054 netif_stop_subqueue(bnad->netdev, txq_id); |
1061 printk(KERN_INFO "bna: %s %d TXQ_STOPPED\n", 1062 bnad->netdev->name, txq_id); | |
1063 } 1064} 1065 1066static void 1067bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) 1068{ 1069 struct bnad_tx_info *tx_info = (struct bnad_tx_info *)tx->priv; 1070 struct bna_tcb *tcb; --- 6 unchanged lines hidden (view full) --- 1077 continue; 1078 txq_id = tcb->id; 1079 1080 BUG_ON(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags)); 1081 set_bit(BNAD_TXQ_TX_STARTED, &tcb->flags); 1082 BUG_ON(*(tcb->hw_consumer_index) != 0); 1083 1084 if (netif_carrier_ok(bnad->netdev)) { | 1055 } 1056} 1057 1058static void 1059bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) 1060{ 1061 struct bnad_tx_info *tx_info = (struct bnad_tx_info *)tx->priv; 1062 struct bna_tcb *tcb; --- 6 unchanged lines hidden (view full) --- 1069 continue; 1070 txq_id = tcb->id; 1071 1072 BUG_ON(test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags)); 1073 set_bit(BNAD_TXQ_TX_STARTED, &tcb->flags); 1074 BUG_ON(*(tcb->hw_consumer_index) != 0); 1075 1076 if (netif_carrier_ok(bnad->netdev)) { |
1085 printk(KERN_INFO "bna: %s %d TXQ_STARTED\n", 1086 bnad->netdev->name, txq_id); | |
1087 netif_wake_subqueue(bnad->netdev, txq_id); 1088 BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); 1089 } 1090 } 1091 1092 /* 1093 * Workaround for first ioceth enable failure & we 1094 * get a 0 MAC address. We try to get the MAC address --- 1036 unchanged lines hidden (view full) --- 2131 BNAD_FRAME_SIZE(bnad->netdev->mtu), NULL); 2132 spin_unlock_irqrestore(&bnad->bna_lock, flags); 2133 2134 for (rx_id = 0; rx_id < bnad->num_rx; rx_id++) { 2135 count++; 2136 current_err = bnad_setup_rx(bnad, rx_id); 2137 if (current_err && !err) { 2138 err = current_err; | 1077 netif_wake_subqueue(bnad->netdev, txq_id); 1078 BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); 1079 } 1080 } 1081 1082 /* 1083 * Workaround for first ioceth enable failure & we 1084 * get a 0 MAC address. We try to get the MAC address --- 1036 unchanged lines hidden (view full) --- 2121 BNAD_FRAME_SIZE(bnad->netdev->mtu), NULL); 2122 spin_unlock_irqrestore(&bnad->bna_lock, flags); 2123 2124 for (rx_id = 0; rx_id < bnad->num_rx; rx_id++) { 2125 count++; 2126 current_err = bnad_setup_rx(bnad, rx_id); 2127 if (current_err && !err) { 2128 err = current_err; |
2139 pr_err("RXQ:%u setup failed\n", rx_id); | 2129 netdev_err(netdev, "RXQ:%u setup failed\n", rx_id); |
2140 } 2141 } 2142 2143 /* restore rx configuration */ 2144 if (bnad->rx_info[0].rx && !err) { 2145 bnad_restore_vlans(bnad, 0); 2146 bnad_enable_default_bcast(bnad); 2147 spin_lock_irqsave(&bnad->bna_lock, flags); --- 519 unchanged lines hidden (view full) --- 2667 for (i = 0; i < bnad->msix_num; i++) 2668 bnad->msix_table[i].entry = i; 2669 2670 ret = pci_enable_msix_range(bnad->pcidev, bnad->msix_table, 2671 1, bnad->msix_num); 2672 if (ret < 0) { 2673 goto intx_mode; 2674 } else if (ret < bnad->msix_num) { | 2130 } 2131 } 2132 2133 /* restore rx configuration */ 2134 if (bnad->rx_info[0].rx && !err) { 2135 bnad_restore_vlans(bnad, 0); 2136 bnad_enable_default_bcast(bnad); 2137 spin_lock_irqsave(&bnad->bna_lock, flags); --- 519 unchanged lines hidden (view full) --- 2657 for (i = 0; i < bnad->msix_num; i++) 2658 bnad->msix_table[i].entry = i; 2659 2660 ret = pci_enable_msix_range(bnad->pcidev, bnad->msix_table, 2661 1, bnad->msix_num); 2662 if (ret < 0) { 2663 goto intx_mode; 2664 } else if (ret < bnad->msix_num) { |
2675 pr_warn("BNA: %d MSI-X vectors allocated < %d requested\n", 2676 ret, bnad->msix_num); | 2665 dev_warn(&bnad->pcidev->dev, 2666 "%d MSI-X vectors allocated < %d requested\n", 2667 ret, bnad->msix_num); |
2677 2678 spin_lock_irqsave(&bnad->bna_lock, flags); 2679 /* ret = #of vectors that we got */ 2680 bnad_q_num_adjust(bnad, (ret - BNAD_MAILBOX_MSIX_VECTORS) / 2, 2681 (ret - BNAD_MAILBOX_MSIX_VECTORS) / 2); 2682 spin_unlock_irqrestore(&bnad->bna_lock, flags); 2683 2684 bnad->msix_num = BNAD_NUM_TXQ + BNAD_NUM_RXP + --- 5 unchanged lines hidden (view full) --- 2690 } 2691 } 2692 2693 pci_intx(bnad->pcidev, 0); 2694 2695 return; 2696 2697intx_mode: | 2668 2669 spin_lock_irqsave(&bnad->bna_lock, flags); 2670 /* ret = #of vectors that we got */ 2671 bnad_q_num_adjust(bnad, (ret - BNAD_MAILBOX_MSIX_VECTORS) / 2, 2672 (ret - BNAD_MAILBOX_MSIX_VECTORS) / 2); 2673 spin_unlock_irqrestore(&bnad->bna_lock, flags); 2674 2675 bnad->msix_num = BNAD_NUM_TXQ + BNAD_NUM_RXP + --- 5 unchanged lines hidden (view full) --- 2681 } 2682 } 2683 2684 pci_intx(bnad->pcidev, 0); 2685 2686 return; 2687 2688intx_mode: |
2698 pr_warn("BNA: MSI-X enable failed - operating in INTx mode\n"); | 2689 dev_warn(&bnad->pcidev->dev, 2690 "MSI-X enable failed - operating in INTx mode\n"); |
2699 2700 kfree(bnad->msix_table); 2701 bnad->msix_table = NULL; 2702 bnad->msix_num = 0; 2703 spin_lock_irqsave(&bnad->bna_lock, flags); 2704 bnad->cfg_flags &= ~BNAD_CF_MSIX; 2705 bnad_q_num_init(bnad); 2706 spin_unlock_irqrestore(&bnad->bna_lock, flags); --- 770 unchanged lines hidden (view full) --- 3477 bnad->pcidev = pdev; 3478 bnad->mmio_start = pci_resource_start(pdev, 0); 3479 bnad->mmio_len = pci_resource_len(pdev, 0); 3480 bnad->bar0 = ioremap_nocache(bnad->mmio_start, bnad->mmio_len); 3481 if (!bnad->bar0) { 3482 dev_err(&pdev->dev, "ioremap for bar0 failed\n"); 3483 return -ENOMEM; 3484 } | 2691 2692 kfree(bnad->msix_table); 2693 bnad->msix_table = NULL; 2694 bnad->msix_num = 0; 2695 spin_lock_irqsave(&bnad->bna_lock, flags); 2696 bnad->cfg_flags &= ~BNAD_CF_MSIX; 2697 bnad_q_num_init(bnad); 2698 spin_unlock_irqrestore(&bnad->bna_lock, flags); --- 770 unchanged lines hidden (view full) --- 3469 bnad->pcidev = pdev; 3470 bnad->mmio_start = pci_resource_start(pdev, 0); 3471 bnad->mmio_len = pci_resource_len(pdev, 0); 3472 bnad->bar0 = ioremap_nocache(bnad->mmio_start, bnad->mmio_len); 3473 if (!bnad->bar0) { 3474 dev_err(&pdev->dev, "ioremap for bar0 failed\n"); 3475 return -ENOMEM; 3476 } |
3485 pr_info("bar0 mapped to %p, len %llu\n", bnad->bar0, 3486 (unsigned long long) bnad->mmio_len); | 3477 dev_info(&pdev->dev, "bar0 mapped to %p, len %llu\n", bnad->bar0, 3478 (unsigned long long) bnad->mmio_len); |
3487 3488 spin_lock_irqsave(&bnad->bna_lock, flags); 3489 if (!bnad_msix_disable) 3490 bnad->cfg_flags = BNAD_CF_MSIX; 3491 3492 bnad->cfg_flags |= BNAD_CF_DIM_ENABLED; 3493 3494 bnad_q_num_init(bnad); --- 104 unchanged lines hidden (view full) --- 3599 bool using_dac; 3600 int err; 3601 struct bnad *bnad; 3602 struct bna *bna; 3603 struct net_device *netdev; 3604 struct bfa_pcidev pcidev_info; 3605 unsigned long flags; 3606 | 3479 3480 spin_lock_irqsave(&bnad->bna_lock, flags); 3481 if (!bnad_msix_disable) 3482 bnad->cfg_flags = BNAD_CF_MSIX; 3483 3484 bnad->cfg_flags |= BNAD_CF_DIM_ENABLED; 3485 3486 bnad_q_num_init(bnad); --- 104 unchanged lines hidden (view full) --- 3591 bool using_dac; 3592 int err; 3593 struct bnad *bnad; 3594 struct bna *bna; 3595 struct net_device *netdev; 3596 struct bfa_pcidev pcidev_info; 3597 unsigned long flags; 3598 |
3607 pr_info("bnad_pci_probe : (0x%p, 0x%p) PCI Func : (%d)\n", 3608 pdev, pcidev_id, PCI_FUNC(pdev->devfn)); 3609 | |
3610 mutex_lock(&bnad_fwimg_mutex); 3611 if (!cna_get_firmware_buf(pdev)) { 3612 mutex_unlock(&bnad_fwimg_mutex); | 3599 mutex_lock(&bnad_fwimg_mutex); 3600 if (!cna_get_firmware_buf(pdev)) { 3601 mutex_unlock(&bnad_fwimg_mutex); |
3613 pr_warn("Failed to load Firmware Image!\n"); | 3602 dev_err(&pdev->dev, "failed to load firmware image!\n"); |
3614 return -ENODEV; 3615 } 3616 mutex_unlock(&bnad_fwimg_mutex); 3617 3618 /* 3619 * Allocates sizeof(struct net_device + struct bnad) 3620 * bnad = netdev->priv 3621 */ --- 76 unchanged lines hidden (view full) --- 3698 3699 /* 3700 * Start the chip 3701 * If the call back comes with error, we bail out. 3702 * This is a catastrophic error. 3703 */ 3704 err = bnad_ioceth_enable(bnad); 3705 if (err) { | 3603 return -ENODEV; 3604 } 3605 mutex_unlock(&bnad_fwimg_mutex); 3606 3607 /* 3608 * Allocates sizeof(struct net_device + struct bnad) 3609 * bnad = netdev->priv 3610 */ --- 76 unchanged lines hidden (view full) --- 3687 3688 /* 3689 * Start the chip 3690 * If the call back comes with error, we bail out. 3691 * This is a catastrophic error. 3692 */ 3693 err = bnad_ioceth_enable(bnad); 3694 if (err) { |
3706 pr_err("BNA: Initialization failed err=%d\n", 3707 err); | 3695 dev_err(&pdev->dev, "initialization failed err=%d\n", err); |
3708 goto probe_success; 3709 } 3710 3711 spin_lock_irqsave(&bnad->bna_lock, flags); 3712 if (bna_num_txq_set(bna, BNAD_NUM_TXQ + 1) || 3713 bna_num_rxp_set(bna, BNAD_NUM_RXP + 1)) { 3714 bnad_q_num_adjust(bnad, bna_attr(bna)->num_txq - 1, 3715 bna_attr(bna)->num_rxp - 1); --- 25 unchanged lines hidden (view full) --- 3741 bnad_set_netdev_perm_addr(bnad); 3742 spin_unlock_irqrestore(&bnad->bna_lock, flags); 3743 3744 mutex_unlock(&bnad->conf_mutex); 3745 3746 /* Finally, reguister with net_device layer */ 3747 err = register_netdev(netdev); 3748 if (err) { | 3696 goto probe_success; 3697 } 3698 3699 spin_lock_irqsave(&bnad->bna_lock, flags); 3700 if (bna_num_txq_set(bna, BNAD_NUM_TXQ + 1) || 3701 bna_num_rxp_set(bna, BNAD_NUM_RXP + 1)) { 3702 bnad_q_num_adjust(bnad, bna_attr(bna)->num_txq - 1, 3703 bna_attr(bna)->num_rxp - 1); --- 25 unchanged lines hidden (view full) --- 3729 bnad_set_netdev_perm_addr(bnad); 3730 spin_unlock_irqrestore(&bnad->bna_lock, flags); 3731 3732 mutex_unlock(&bnad->conf_mutex); 3733 3734 /* Finally, reguister with net_device layer */ 3735 err = register_netdev(netdev); 3736 if (err) { |
3749 pr_err("BNA : Registering with netdev failed\n"); | 3737 dev_err(&pdev->dev, "registering net device failed\n"); |
3750 goto probe_uninit; 3751 } 3752 set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags); 3753 3754 return 0; 3755 3756probe_success: 3757 mutex_unlock(&bnad->conf_mutex); --- 35 unchanged lines hidden (view full) --- 3793 struct net_device *netdev = pci_get_drvdata(pdev); 3794 struct bnad *bnad; 3795 struct bna *bna; 3796 unsigned long flags; 3797 3798 if (!netdev) 3799 return; 3800 | 3738 goto probe_uninit; 3739 } 3740 set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags); 3741 3742 return 0; 3743 3744probe_success: 3745 mutex_unlock(&bnad->conf_mutex); --- 35 unchanged lines hidden (view full) --- 3781 struct net_device *netdev = pci_get_drvdata(pdev); 3782 struct bnad *bnad; 3783 struct bna *bna; 3784 unsigned long flags; 3785 3786 if (!netdev) 3787 return; 3788 |
3801 pr_info("%s bnad_pci_remove\n", netdev->name); | |
3802 bnad = netdev_priv(netdev); 3803 bna = &bnad->bna; 3804 3805 if (test_and_clear_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags)) 3806 unregister_netdev(netdev); 3807 3808 mutex_lock(&bnad->conf_mutex); 3809 bnad_ioceth_disable(bnad); --- 44 unchanged lines hidden (view full) --- 3854 .remove = bnad_pci_remove, 3855}; 3856 3857static int __init 3858bnad_module_init(void) 3859{ 3860 int err; 3861 | 3789 bnad = netdev_priv(netdev); 3790 bna = &bnad->bna; 3791 3792 if (test_and_clear_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags)) 3793 unregister_netdev(netdev); 3794 3795 mutex_lock(&bnad->conf_mutex); 3796 bnad_ioceth_disable(bnad); --- 44 unchanged lines hidden (view full) --- 3841 .remove = bnad_pci_remove, 3842}; 3843 3844static int __init 3845bnad_module_init(void) 3846{ 3847 int err; 3848 |
3862 pr_info("QLogic BR-series 10G Ethernet driver - version: %s\n", 3863 BNAD_VERSION); | 3849 pr_info("bna: QLogic BR-series 10G Ethernet driver - version: %s\n", 3850 BNAD_VERSION); |
3864 3865 bfa_nw_ioc_auto_recover(bnad_ioc_auto_recover); 3866 3867 err = pci_register_driver(&bnad_pci_driver); 3868 if (err < 0) { | 3851 3852 bfa_nw_ioc_auto_recover(bnad_ioc_auto_recover); 3853 3854 err = pci_register_driver(&bnad_pci_driver); 3855 if (err < 0) { |
3869 pr_err("bna : PCI registration failed in module init " 3870 "(%d)\n", err); | 3856 pr_err("bna: PCI driver registration failed err=%d\n", err); |
3871 return err; 3872 } 3873 3874 return 0; 3875} 3876 3877static void __exit 3878bnad_module_exit(void) --- 14 unchanged lines hidden --- | 3857 return err; 3858 } 3859 3860 return 0; 3861} 3862 3863static void __exit 3864bnad_module_exit(void) --- 14 unchanged lines hidden --- |