Lines Matching refs:bnad
74 bnad_cq_cleanup(struct bnad *bnad, struct bna_ccb *ccb) in bnad_cq_cleanup() argument
90 bnad_tx_buff_unmap(struct bnad *bnad, in bnad_tx_buff_unmap() argument
104 dma_unmap_single(&bnad->pcidev->dev, in bnad_tx_buff_unmap()
119 dma_unmap_page(&bnad->pcidev->dev, in bnad_tx_buff_unmap()
138 bnad_txq_cleanup(struct bnad *bnad, struct bna_tcb *tcb) in bnad_txq_cleanup() argument
148 bnad_tx_buff_unmap(bnad, unmap_q, tcb->q_depth, i); in bnad_txq_cleanup()
160 bnad_txcmpl_process(struct bnad *bnad, struct bna_tcb *tcb) in bnad_txcmpl_process() argument
191 cons = bnad_tx_buff_unmap(bnad, unmap_q, q_depth, cons); in bnad_txcmpl_process()
205 bnad_tx_complete(struct bnad *bnad, struct bna_tcb *tcb) in bnad_tx_complete() argument
207 struct net_device *netdev = bnad->netdev; in bnad_tx_complete()
213 sent = bnad_txcmpl_process(bnad, tcb); in bnad_tx_complete()
221 BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); in bnad_tx_complete()
240 struct bnad *bnad = tcb->bnad; in bnad_msix_tx() local
242 bnad_tx_complete(bnad, tcb); in bnad_msix_tx()
248 bnad_rxq_alloc_uninit(struct bnad *bnad, struct bna_rcb *rcb) in bnad_rxq_alloc_uninit() argument
260 bnad_rxq_alloc_init(struct bnad *bnad, struct bna_rcb *rcb) in bnad_rxq_alloc_init() argument
265 bnad_rxq_alloc_uninit(bnad, rcb); in bnad_rxq_alloc_init()
293 bnad_rxq_cleanup_page(struct bnad *bnad, struct bnad_rx_unmap *unmap) in bnad_rxq_cleanup_page() argument
298 dma_unmap_page(&bnad->pcidev->dev, in bnad_rxq_cleanup_page()
308 bnad_rxq_cleanup_skb(struct bnad *bnad, struct bnad_rx_unmap *unmap) in bnad_rxq_cleanup_skb() argument
313 dma_unmap_single(&bnad->pcidev->dev, in bnad_rxq_cleanup_skb()
323 bnad_rxq_cleanup(struct bnad *bnad, struct bna_rcb *rcb) in bnad_rxq_cleanup() argument
332 bnad_rxq_cleanup_skb(bnad, unmap); in bnad_rxq_cleanup()
334 bnad_rxq_cleanup_page(bnad, unmap); in bnad_rxq_cleanup()
336 bnad_rxq_alloc_uninit(bnad, rcb); in bnad_rxq_cleanup()
340 bnad_rxq_refill_page(struct bnad *bnad, struct bna_rcb *rcb, u32 nalloc) in bnad_rxq_refill_page() argument
371 BNAD_UPDATE_CTR(bnad, rxbuf_alloc_failed); in bnad_rxq_refill_page()
376 dma_addr = dma_map_page(&bnad->pcidev->dev, page, page_offset, in bnad_rxq_refill_page()
378 if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { in bnad_rxq_refill_page()
380 BNAD_UPDATE_CTR(bnad, rxbuf_map_failed); in bnad_rxq_refill_page()
414 bnad_rxq_refill_skb(struct bnad *bnad, struct bna_rcb *rcb, u32 nalloc) in bnad_rxq_refill_skb() argument
431 skb = netdev_alloc_skb_ip_align(bnad->netdev, buff_sz); in bnad_rxq_refill_skb()
434 BNAD_UPDATE_CTR(bnad, rxbuf_alloc_failed); in bnad_rxq_refill_skb()
439 dma_addr = dma_map_single(&bnad->pcidev->dev, skb->data, in bnad_rxq_refill_skb()
441 if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { in bnad_rxq_refill_skb()
443 BNAD_UPDATE_CTR(bnad, rxbuf_map_failed); in bnad_rxq_refill_skb()
470 bnad_rxq_post(struct bnad *bnad, struct bna_rcb *rcb) in bnad_rxq_post() argument
480 bnad_rxq_refill_skb(bnad, rcb, to_alloc); in bnad_rxq_post()
482 bnad_rxq_refill_page(bnad, rcb, to_alloc); in bnad_rxq_post()
500 bnad_cq_drop_packet(struct bnad *bnad, struct bna_rcb *rcb, in bnad_cq_drop_packet() argument
513 bnad_rxq_cleanup_skb(bnad, unmap); in bnad_cq_drop_packet()
515 bnad_rxq_cleanup_page(bnad, unmap); in bnad_cq_drop_packet()
523 struct bnad *bnad; in bnad_cq_setup_skb_frags() local
534 bnad = rcb->bnad; in bnad_cq_setup_skb_frags()
548 dma_unmap_page(&bnad->pcidev->dev, in bnad_cq_setup_skb_frags()
571 bnad_cq_setup_skb(struct bnad *bnad, struct sk_buff *skb, in bnad_cq_setup_skb() argument
576 dma_unmap_single(&bnad->pcidev->dev, in bnad_cq_setup_skb()
581 skb->protocol = eth_type_trans(skb, bnad->netdev); in bnad_cq_setup_skb()
588 bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) in bnad_cq_process() argument
601 prefetch(bnad->netdev); in bnad_cq_process()
684 bnad_cq_drop_packet(bnad, rcb, sop_ci, nvecs); in bnad_cq_process()
691 bnad_cq_setup_skb(bnad, skb, unmap, len); in bnad_cq_process()
702 ((bnad->netdev->features & NETIF_F_RXCSUM) && in bnad_cq_process()
712 (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) in bnad_cq_process()
733 bnad_rxq_post(bnad, ccb->rcb[0]); in bnad_cq_process()
735 bnad_rxq_post(bnad, ccb->rcb[1]); in bnad_cq_process()
741 bnad_netif_rx_schedule_poll(struct bnad *bnad, struct bna_ccb *ccb) in bnad_netif_rx_schedule_poll() argument
760 bnad_netif_rx_schedule_poll(ccb->bnad, ccb); in bnad_msix_rx()
774 struct bnad *bnad = (struct bnad *)data; in bnad_msix_mbox_handler() local
776 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_msix_mbox_handler()
777 if (unlikely(test_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags))) { in bnad_msix_mbox_handler()
778 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_msix_mbox_handler()
782 bna_intr_status_get(&bnad->bna, intr_status); in bnad_msix_mbox_handler()
784 if (BNA_IS_MBOX_ERR_INTR(&bnad->bna, intr_status)) in bnad_msix_mbox_handler()
785 bna_mbox_handler(&bnad->bna, intr_status); in bnad_msix_mbox_handler()
787 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_msix_mbox_handler()
798 struct bnad *bnad = (struct bnad *)data; in bnad_isr() local
803 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_isr()
804 if (unlikely(test_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags))) { in bnad_isr()
805 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_isr()
809 bna_intr_status_get(&bnad->bna, intr_status); in bnad_isr()
812 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_isr()
816 if (BNA_IS_MBOX_ERR_INTR(&bnad->bna, intr_status)) in bnad_isr()
817 bna_mbox_handler(&bnad->bna, intr_status); in bnad_isr()
819 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_isr()
826 for (i = 0; i < bnad->num_tx; i++) { in bnad_isr()
827 for (j = 0; j < bnad->num_txq_per_tx; j++) { in bnad_isr()
828 tcb = bnad->tx_info[i].tcb[j]; in bnad_isr()
830 bnad_tx_complete(bnad, bnad->tx_info[i].tcb[j]); in bnad_isr()
834 for (i = 0; i < bnad->num_rx; i++) { in bnad_isr()
835 rx_info = &bnad->rx_info[i]; in bnad_isr()
838 for (j = 0; j < bnad->num_rxp_per_rx; j++) { in bnad_isr()
841 bnad_netif_rx_schedule_poll(bnad, in bnad_isr()
853 bnad_enable_mbox_irq(struct bnad *bnad) in bnad_enable_mbox_irq() argument
855 clear_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags); in bnad_enable_mbox_irq()
857 BNAD_UPDATE_CTR(bnad, mbox_intr_enabled); in bnad_enable_mbox_irq()
865 bnad_disable_mbox_irq(struct bnad *bnad) in bnad_disable_mbox_irq() argument
867 set_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags); in bnad_disable_mbox_irq()
869 BNAD_UPDATE_CTR(bnad, mbox_intr_disabled); in bnad_disable_mbox_irq()
873 bnad_set_netdev_perm_addr(struct bnad *bnad) in bnad_set_netdev_perm_addr() argument
875 struct net_device *netdev = bnad->netdev; in bnad_set_netdev_perm_addr()
877 ether_addr_copy(netdev->perm_addr, bnad->perm_addr); in bnad_set_netdev_perm_addr()
879 eth_hw_addr_set(netdev, bnad->perm_addr); in bnad_set_netdev_perm_addr()
886 bnad_cb_mbox_intr_enable(struct bnad *bnad) in bnad_cb_mbox_intr_enable() argument
888 bnad_enable_mbox_irq(bnad); in bnad_cb_mbox_intr_enable()
892 bnad_cb_mbox_intr_disable(struct bnad *bnad) in bnad_cb_mbox_intr_disable() argument
894 bnad_disable_mbox_irq(bnad); in bnad_cb_mbox_intr_disable()
898 bnad_cb_ioceth_ready(struct bnad *bnad) in bnad_cb_ioceth_ready() argument
900 bnad->bnad_completions.ioc_comp_status = BNA_CB_SUCCESS; in bnad_cb_ioceth_ready()
901 complete(&bnad->bnad_completions.ioc_comp); in bnad_cb_ioceth_ready()
905 bnad_cb_ioceth_failed(struct bnad *bnad) in bnad_cb_ioceth_failed() argument
907 bnad->bnad_completions.ioc_comp_status = BNA_CB_FAIL; in bnad_cb_ioceth_failed()
908 complete(&bnad->bnad_completions.ioc_comp); in bnad_cb_ioceth_failed()
912 bnad_cb_ioceth_disabled(struct bnad *bnad) in bnad_cb_ioceth_disabled() argument
914 bnad->bnad_completions.ioc_comp_status = BNA_CB_SUCCESS; in bnad_cb_ioceth_disabled()
915 complete(&bnad->bnad_completions.ioc_comp); in bnad_cb_ioceth_disabled()
921 struct bnad *bnad = (struct bnad *)arg; in bnad_cb_enet_disabled() local
923 netif_carrier_off(bnad->netdev); in bnad_cb_enet_disabled()
924 complete(&bnad->bnad_completions.enet_comp); in bnad_cb_enet_disabled()
928 bnad_cb_ethport_link_status(struct bnad *bnad, in bnad_cb_ethport_link_status() argument
936 if (!test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) in bnad_cb_ethport_link_status()
937 BNAD_UPDATE_CTR(bnad, cee_toggle); in bnad_cb_ethport_link_status()
938 set_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags); in bnad_cb_ethport_link_status()
940 if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) in bnad_cb_ethport_link_status()
941 BNAD_UPDATE_CTR(bnad, cee_toggle); in bnad_cb_ethport_link_status()
942 clear_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags); in bnad_cb_ethport_link_status()
946 if (!netif_carrier_ok(bnad->netdev)) { in bnad_cb_ethport_link_status()
948 netdev_info(bnad->netdev, "link up\n"); in bnad_cb_ethport_link_status()
949 netif_carrier_on(bnad->netdev); in bnad_cb_ethport_link_status()
950 BNAD_UPDATE_CTR(bnad, link_toggle); in bnad_cb_ethport_link_status()
951 for (tx_id = 0; tx_id < bnad->num_tx; tx_id++) { in bnad_cb_ethport_link_status()
952 for (tcb_id = 0; tcb_id < bnad->num_txq_per_tx; in bnad_cb_ethport_link_status()
955 bnad->tx_info[tx_id].tcb[tcb_id]; in bnad_cb_ethport_link_status()
968 bnad->netdev, in bnad_cb_ethport_link_status()
970 BNAD_UPDATE_CTR(bnad, in bnad_cb_ethport_link_status()
974 bnad->netdev, in bnad_cb_ethport_link_status()
976 BNAD_UPDATE_CTR(bnad, in bnad_cb_ethport_link_status()
983 if (netif_carrier_ok(bnad->netdev)) { in bnad_cb_ethport_link_status()
984 netdev_info(bnad->netdev, "link down\n"); in bnad_cb_ethport_link_status()
985 netif_carrier_off(bnad->netdev); in bnad_cb_ethport_link_status()
986 BNAD_UPDATE_CTR(bnad, link_toggle); in bnad_cb_ethport_link_status()
994 struct bnad *bnad = (struct bnad *)arg; in bnad_cb_tx_disabled() local
996 complete(&bnad->bnad_completions.tx_comp); in bnad_cb_tx_disabled()
1000 bnad_cb_tcb_setup(struct bnad *bnad, struct bna_tcb *tcb) in bnad_cb_tcb_setup() argument
1010 bnad_cb_tcb_destroy(struct bnad *bnad, struct bna_tcb *tcb) in bnad_cb_tcb_destroy() argument
1020 bnad_cb_ccb_setup(struct bnad *bnad, struct bna_ccb *ccb) in bnad_cb_ccb_setup() argument
1030 bnad_cb_ccb_destroy(struct bnad *bnad, struct bna_ccb *ccb) in bnad_cb_ccb_destroy() argument
1039 bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) in bnad_cb_tx_stall() argument
1052 netif_stop_subqueue(bnad->netdev, txq_id); in bnad_cb_tx_stall()
1057 bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) in bnad_cb_tx_resume() argument
1074 if (netif_carrier_ok(bnad->netdev)) { in bnad_cb_tx_resume()
1075 netif_wake_subqueue(bnad->netdev, txq_id); in bnad_cb_tx_resume()
1076 BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); in bnad_cb_tx_resume()
1085 if (is_zero_ether_addr(bnad->perm_addr)) { in bnad_cb_tx_resume()
1086 bna_enet_perm_mac_get(&bnad->bna.enet, bnad->perm_addr); in bnad_cb_tx_resume()
1087 bnad_set_netdev_perm_addr(bnad); in bnad_cb_tx_resume()
1099 struct bnad *bnad = NULL; in bnad_tx_cleanup() local
1109 bnad = tcb->bnad; in bnad_tx_cleanup()
1116 bnad_txq_cleanup(bnad, tcb); in bnad_tx_cleanup()
1123 queue_delayed_work(bnad->work_q, &tx_info->tx_cleanup_work, in bnad_tx_cleanup()
1128 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_tx_cleanup()
1130 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_tx_cleanup()
1134 bnad_cb_tx_cleanup(struct bnad *bnad, struct bna_tx *tx) in bnad_cb_tx_cleanup() argument
1146 queue_delayed_work(bnad->work_q, &tx_info->tx_cleanup_work, 0); in bnad_cb_tx_cleanup()
1150 bnad_cb_rx_stall(struct bnad *bnad, struct bna_rx *rx) in bnad_cb_rx_stall() argument
1179 struct bnad *bnad = NULL; in bnad_rx_cleanup() local
1189 bnad = rx_ctrl->ccb->bnad; in bnad_rx_cleanup()
1197 bnad_cq_cleanup(bnad, rx_ctrl->ccb); in bnad_rx_cleanup()
1198 bnad_rxq_cleanup(bnad, rx_ctrl->ccb->rcb[0]); in bnad_rx_cleanup()
1200 bnad_rxq_cleanup(bnad, rx_ctrl->ccb->rcb[1]); in bnad_rx_cleanup()
1203 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_rx_cleanup()
1205 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_rx_cleanup()
1209 bnad_cb_rx_cleanup(struct bnad *bnad, struct bna_rx *rx) in bnad_cb_rx_cleanup() argument
1228 queue_work(bnad->work_q, &rx_info->rx_cleanup_work); in bnad_cb_rx_cleanup()
1232 bnad_cb_rx_post(struct bnad *bnad, struct bna_rx *rx) in bnad_cb_rx_post() argument
1253 bnad_rxq_alloc_init(bnad, rcb); in bnad_cb_rx_post()
1256 bnad_rxq_post(bnad, rcb); in bnad_cb_rx_post()
1264 struct bnad *bnad = (struct bnad *)arg; in bnad_cb_rx_disabled() local
1266 complete(&bnad->bnad_completions.rx_comp); in bnad_cb_rx_disabled()
1270 bnad_cb_rx_mcast_add(struct bnad *bnad, struct bna_rx *rx) in bnad_cb_rx_mcast_add() argument
1272 bnad->bnad_completions.mcast_comp_status = BNA_CB_SUCCESS; in bnad_cb_rx_mcast_add()
1273 complete(&bnad->bnad_completions.mcast_comp); in bnad_cb_rx_mcast_add()
1277 bnad_cb_stats_get(struct bnad *bnad, enum bna_cb_status status, in bnad_cb_stats_get() argument
1281 BNAD_UPDATE_CTR(bnad, hw_stats_updates); in bnad_cb_stats_get()
1283 if (!netif_running(bnad->netdev) || in bnad_cb_stats_get()
1284 !test_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) in bnad_cb_stats_get()
1287 mod_timer(&bnad->stats_timer, in bnad_cb_stats_get()
1292 bnad_cb_enet_mtu_set(struct bnad *bnad) in bnad_cb_enet_mtu_set() argument
1294 bnad->bnad_completions.mtu_comp_status = BNA_CB_SUCCESS; in bnad_cb_enet_mtu_set()
1295 complete(&bnad->bnad_completions.mtu_comp); in bnad_cb_enet_mtu_set()
1311 bnad_mem_free(struct bnad *bnad, in bnad_mem_free() argument
1325 dma_free_coherent(&bnad->pcidev->dev, in bnad_mem_free()
1337 bnad_mem_alloc(struct bnad *bnad, in bnad_mem_alloc() argument
1357 dma_alloc_coherent(&bnad->pcidev->dev, in bnad_mem_alloc()
1379 bnad_mem_free(bnad, mem_info); in bnad_mem_alloc()
1385 bnad_mbox_irq_free(struct bnad *bnad) in bnad_mbox_irq_free() argument
1390 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_mbox_irq_free()
1391 bnad_disable_mbox_irq(bnad); in bnad_mbox_irq_free()
1392 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_mbox_irq_free()
1394 irq = BNAD_GET_MBOX_IRQ(bnad); in bnad_mbox_irq_free()
1395 free_irq(irq, bnad); in bnad_mbox_irq_free()
1404 bnad_mbox_irq_alloc(struct bnad *bnad) in bnad_mbox_irq_alloc() argument
1411 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_mbox_irq_alloc()
1412 if (bnad->cfg_flags & BNAD_CF_MSIX) { in bnad_mbox_irq_alloc()
1414 irq = bnad->msix_table[BNAD_MAILBOX_MSIX_INDEX].vector; in bnad_mbox_irq_alloc()
1418 irq = bnad->pcidev->irq; in bnad_mbox_irq_alloc()
1422 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_mbox_irq_alloc()
1423 sprintf(bnad->mbox_irq_name, "%s", BNAD_NAME); in bnad_mbox_irq_alloc()
1429 set_bit(BNAD_RF_MBOX_IRQ_DISABLED, &bnad->run_flags); in bnad_mbox_irq_alloc()
1431 BNAD_UPDATE_CTR(bnad, mbox_intr_disabled); in bnad_mbox_irq_alloc()
1434 bnad->mbox_irq_name, bnad); in bnad_mbox_irq_alloc()
1440 bnad_txrx_irq_free(struct bnad *bnad, struct bna_intr_info *intr_info) in bnad_txrx_irq_free() argument
1448 bnad_txrx_irq_alloc(struct bnad *bnad, enum bnad_intr_source src, in bnad_txrx_irq_alloc() argument
1455 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_txrx_irq_alloc()
1456 cfg_flags = bnad->cfg_flags; in bnad_txrx_irq_alloc()
1457 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_txrx_irq_alloc()
1474 (bnad->num_tx * bnad->num_txq_per_tx) + in bnad_txrx_irq_alloc()
1510 bnad_tx_msix_unregister(struct bnad *bnad, struct bnad_tx_info *tx_info, in bnad_tx_msix_unregister() argument
1521 free_irq(bnad->msix_table[vector_num].vector, tx_info->tcb[i]); in bnad_tx_msix_unregister()
1529 bnad_tx_msix_register(struct bnad *bnad, struct bnad_tx_info *tx_info, in bnad_tx_msix_register() argument
1539 bnad->netdev->name, in bnad_tx_msix_register()
1541 err = request_irq(bnad->msix_table[vector_num].vector, in bnad_tx_msix_register()
1553 bnad_tx_msix_unregister(bnad, tx_info, (i - 1)); in bnad_tx_msix_register()
1561 bnad_rx_msix_unregister(struct bnad *bnad, struct bnad_rx_info *rx_info, in bnad_rx_msix_unregister() argument
1572 free_irq(bnad->msix_table[vector_num].vector, in bnad_rx_msix_unregister()
1581 bnad_rx_msix_register(struct bnad *bnad, struct bnad_rx_info *rx_info, in bnad_rx_msix_register() argument
1591 "%s CQ %d", bnad->netdev->name, in bnad_rx_msix_register()
1593 err = request_irq(bnad->msix_table[vector_num].vector, in bnad_rx_msix_register()
1605 bnad_rx_msix_unregister(bnad, rx_info, (i - 1)); in bnad_rx_msix_register()
1611 bnad_tx_res_free(struct bnad *bnad, struct bna_res_info *res_info) in bnad_tx_res_free() argument
1617 bnad_mem_free(bnad, &res_info[i].res_u.mem_info); in bnad_tx_res_free()
1619 bnad_txrx_irq_free(bnad, &res_info[i].res_u.intr_info); in bnad_tx_res_free()
1625 bnad_tx_res_alloc(struct bnad *bnad, struct bna_res_info *res_info, in bnad_tx_res_alloc() argument
1632 err = bnad_mem_alloc(bnad, in bnad_tx_res_alloc()
1635 err = bnad_txrx_irq_alloc(bnad, BNAD_INTR_TX, tx_id, in bnad_tx_res_alloc()
1643 bnad_tx_res_free(bnad, res_info); in bnad_tx_res_alloc()
1649 bnad_rx_res_free(struct bnad *bnad, struct bna_res_info *res_info) in bnad_rx_res_free() argument
1655 bnad_mem_free(bnad, &res_info[i].res_u.mem_info); in bnad_rx_res_free()
1657 bnad_txrx_irq_free(bnad, &res_info[i].res_u.intr_info); in bnad_rx_res_free()
1663 bnad_rx_res_alloc(struct bnad *bnad, struct bna_res_info *res_info, in bnad_rx_res_alloc() argument
1671 err = bnad_mem_alloc(bnad, in bnad_rx_res_alloc()
1674 err = bnad_txrx_irq_alloc(bnad, BNAD_INTR_RX, rx_id, in bnad_rx_res_alloc()
1682 bnad_rx_res_free(bnad, res_info); in bnad_rx_res_alloc()
1691 struct bnad *bnad = timer_container_of(bnad, t, in bnad_ioc_timeout() local
1695 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_ioc_timeout()
1696 bfa_nw_ioc_timeout(&bnad->bna.ioceth.ioc); in bnad_ioc_timeout()
1697 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_ioc_timeout()
1703 struct bnad *bnad = timer_container_of(bnad, t, in bnad_ioc_hb_check() local
1707 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_ioc_hb_check()
1708 bfa_nw_ioc_hb_check(&bnad->bna.ioceth.ioc); in bnad_ioc_hb_check()
1709 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_ioc_hb_check()
1715 struct bnad *bnad = timer_container_of(bnad, t, in bnad_iocpf_timeout() local
1719 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_iocpf_timeout()
1720 bfa_nw_iocpf_timeout(&bnad->bna.ioceth.ioc); in bnad_iocpf_timeout()
1721 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_iocpf_timeout()
1727 struct bnad *bnad = timer_container_of(bnad, t, in bnad_iocpf_sem_timeout() local
1731 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_iocpf_sem_timeout()
1732 bfa_nw_iocpf_sem_timeout(&bnad->bna.ioceth.ioc); in bnad_iocpf_sem_timeout()
1733 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_iocpf_sem_timeout()
1750 struct bnad *bnad = timer_container_of(bnad, t, dim_timer); in bnad_dim_timeout() local
1756 if (!netif_carrier_ok(bnad->netdev)) in bnad_dim_timeout()
1759 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_dim_timeout()
1760 for (i = 0; i < bnad->num_rx; i++) { in bnad_dim_timeout()
1761 rx_info = &bnad->rx_info[i]; in bnad_dim_timeout()
1764 for (j = 0; j < bnad->num_rxp_per_rx; j++) { in bnad_dim_timeout()
1773 if (test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) in bnad_dim_timeout()
1774 mod_timer(&bnad->dim_timer, in bnad_dim_timeout()
1776 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_dim_timeout()
1783 struct bnad *bnad = timer_container_of(bnad, t, stats_timer); in bnad_stats_timeout() local
1786 if (!netif_running(bnad->netdev) || in bnad_stats_timeout()
1787 !test_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) in bnad_stats_timeout()
1790 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_stats_timeout()
1791 bna_hw_stats_get(&bnad->bna); in bnad_stats_timeout()
1792 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_stats_timeout()
1800 bnad_dim_timer_start(struct bnad *bnad) in bnad_dim_timer_start() argument
1802 if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED && in bnad_dim_timer_start()
1803 !test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) { in bnad_dim_timer_start()
1804 timer_setup(&bnad->dim_timer, bnad_dim_timeout, 0); in bnad_dim_timer_start()
1805 set_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags); in bnad_dim_timer_start()
1806 mod_timer(&bnad->dim_timer, in bnad_dim_timer_start()
1816 bnad_stats_timer_start(struct bnad *bnad) in bnad_stats_timer_start() argument
1820 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_stats_timer_start()
1821 if (!test_and_set_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) { in bnad_stats_timer_start()
1822 timer_setup(&bnad->stats_timer, bnad_stats_timeout, 0); in bnad_stats_timer_start()
1823 mod_timer(&bnad->stats_timer, in bnad_stats_timer_start()
1826 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_stats_timer_start()
1834 bnad_stats_timer_stop(struct bnad *bnad) in bnad_stats_timer_stop() argument
1839 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_stats_timer_stop()
1840 if (test_and_clear_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) in bnad_stats_timer_stop()
1842 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_stats_timer_stop()
1844 timer_delete_sync(&bnad->stats_timer); in bnad_stats_timer_stop()
1866 struct bnad *bnad = rx_ctrl->bnad; in bnad_napi_poll_rx() local
1871 if (!netif_carrier_ok(bnad->netdev)) in bnad_napi_poll_rx()
1874 rcvd = bnad_cq_process(bnad, rx_ctrl->ccb, budget); in bnad_napi_poll_rx()
1890 bnad_napi_add(struct bnad *bnad, u32 rx_id) in bnad_napi_add() argument
1896 for (i = 0; i < bnad->num_rxp_per_rx; i++) { in bnad_napi_add()
1897 rx_ctrl = &bnad->rx_info[rx_id].rx_ctrl[i]; in bnad_napi_add()
1898 netif_napi_add(bnad->netdev, &rx_ctrl->napi, in bnad_napi_add()
1904 bnad_napi_delete(struct bnad *bnad, u32 rx_id) in bnad_napi_delete() argument
1909 for (i = 0; i < bnad->num_rxp_per_rx; i++) in bnad_napi_delete()
1910 netif_napi_del(&bnad->rx_info[rx_id].rx_ctrl[i].napi); in bnad_napi_delete()
1915 bnad_destroy_tx(struct bnad *bnad, u32 tx_id) in bnad_destroy_tx() argument
1917 struct bnad_tx_info *tx_info = &bnad->tx_info[tx_id]; in bnad_destroy_tx()
1918 struct bna_res_info *res_info = &bnad->tx_res_info[tx_id].res_info[0]; in bnad_destroy_tx()
1924 init_completion(&bnad->bnad_completions.tx_comp); in bnad_destroy_tx()
1925 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_destroy_tx()
1927 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_destroy_tx()
1928 wait_for_completion(&bnad->bnad_completions.tx_comp); in bnad_destroy_tx()
1931 bnad_tx_msix_unregister(bnad, tx_info, in bnad_destroy_tx()
1932 bnad->num_txq_per_tx); in bnad_destroy_tx()
1934 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_destroy_tx()
1936 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_destroy_tx()
1941 bnad_tx_res_free(bnad, res_info); in bnad_destroy_tx()
1946 bnad_setup_tx(struct bnad *bnad, u32 tx_id) in bnad_setup_tx() argument
1949 struct bnad_tx_info *tx_info = &bnad->tx_info[tx_id]; in bnad_setup_tx()
1950 struct bna_res_info *res_info = &bnad->tx_res_info[tx_id].res_info[0]; in bnad_setup_tx()
1953 struct bna_tx_config *tx_config = &bnad->tx_config[tx_id]; in bnad_setup_tx()
1968 tx_config->num_txq = bnad->num_txq_per_tx; in bnad_setup_tx()
1969 tx_config->txq_depth = bnad->txq_depth; in bnad_setup_tx()
1971 tx_config->coalescing_timeo = bnad->tx_coalescing_timeo; in bnad_setup_tx()
1974 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_tx()
1975 bna_tx_res_req(bnad->num_txq_per_tx, in bnad_setup_tx()
1976 bnad->txq_depth, res_info); in bnad_setup_tx()
1977 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_tx()
1981 bnad->num_txq_per_tx, (sizeof(struct bnad_tx_unmap) * in bnad_setup_tx()
1982 bnad->txq_depth)); in bnad_setup_tx()
1985 err = bnad_tx_res_alloc(bnad, res_info, tx_id); in bnad_setup_tx()
1990 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_tx()
1991 tx = bna_tx_create(&bnad->bna, bnad, tx_config, &tx_cbfn, res_info, in bnad_setup_tx()
1993 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_tx()
2004 err = bnad_tx_msix_register(bnad, tx_info, in bnad_setup_tx()
2005 tx_id, bnad->num_txq_per_tx); in bnad_setup_tx()
2010 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_tx()
2012 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_tx()
2017 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_tx()
2019 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_tx()
2023 bnad_tx_res_free(bnad, res_info); in bnad_setup_tx()
2030 bnad_init_rx_config(struct bnad *bnad, struct bna_rx_config *rx_config) in bnad_init_rx_config() argument
2034 rx_config->num_paths = bnad->num_rxp_per_rx; in bnad_init_rx_config()
2035 rx_config->coalescing_timeo = bnad->rx_coalescing_timeo; in bnad_init_rx_config()
2037 if (bnad->num_rxp_per_rx > 1) { in bnad_init_rx_config()
2045 bnad->num_rxp_per_rx - 1; in bnad_init_rx_config()
2054 rx_config->frame_size = BNAD_FRAME_SIZE(bnad->netdev->mtu); in bnad_init_rx_config()
2064 if (BNAD_PCI_DEV_IS_CAT2(bnad) && in bnad_init_rx_config()
2073 rx_config->q0_depth = bnad->rxq_depth * rx_config->q0_num_vecs; in bnad_init_rx_config()
2078 rx_config->q0_depth = bnad->rxq_depth; in bnad_init_rx_config()
2083 rx_config->q1_depth = bnad->rxq_depth; in bnad_init_rx_config()
2088 (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) ? in bnad_init_rx_config()
2093 bnad_rx_ctrl_init(struct bnad *bnad, u32 rx_id) in bnad_rx_ctrl_init() argument
2095 struct bnad_rx_info *rx_info = &bnad->rx_info[rx_id]; in bnad_rx_ctrl_init()
2098 for (i = 0; i < bnad->num_rxp_per_rx; i++) in bnad_rx_ctrl_init()
2099 rx_info->rx_ctrl[i].bnad = bnad; in bnad_rx_ctrl_init()
2104 bnad_reinit_rx(struct bnad *bnad) in bnad_reinit_rx() argument
2106 struct net_device *netdev = bnad->netdev; in bnad_reinit_rx()
2112 for (rx_id = 0; rx_id < bnad->num_rx; rx_id++) { in bnad_reinit_rx()
2113 if (!bnad->rx_info[rx_id].rx) in bnad_reinit_rx()
2115 bnad_destroy_rx(bnad, rx_id); in bnad_reinit_rx()
2118 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_reinit_rx()
2119 bna_enet_mtu_set(&bnad->bna.enet, in bnad_reinit_rx()
2120 BNAD_FRAME_SIZE(bnad->netdev->mtu), NULL); in bnad_reinit_rx()
2121 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_reinit_rx()
2123 for (rx_id = 0; rx_id < bnad->num_rx; rx_id++) { in bnad_reinit_rx()
2125 current_err = bnad_setup_rx(bnad, rx_id); in bnad_reinit_rx()
2133 if (bnad->rx_info[0].rx && !err) { in bnad_reinit_rx()
2134 bnad_restore_vlans(bnad, 0); in bnad_reinit_rx()
2135 bnad_enable_default_bcast(bnad); in bnad_reinit_rx()
2136 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_reinit_rx()
2137 bnad_mac_addr_set_locked(bnad, netdev->dev_addr); in bnad_reinit_rx()
2138 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_reinit_rx()
2147 bnad_destroy_rx(struct bnad *bnad, u32 rx_id) in bnad_destroy_rx() argument
2149 struct bnad_rx_info *rx_info = &bnad->rx_info[rx_id]; in bnad_destroy_rx()
2150 struct bna_rx_config *rx_config = &bnad->rx_config[rx_id]; in bnad_destroy_rx()
2151 struct bna_res_info *res_info = &bnad->rx_res_info[rx_id].res_info[0]; in bnad_destroy_rx()
2159 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_destroy_rx()
2160 if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED && in bnad_destroy_rx()
2161 test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) { in bnad_destroy_rx()
2162 clear_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags); in bnad_destroy_rx()
2165 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_destroy_rx()
2167 timer_delete_sync(&bnad->dim_timer); in bnad_destroy_rx()
2170 init_completion(&bnad->bnad_completions.rx_comp); in bnad_destroy_rx()
2171 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_destroy_rx()
2173 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_destroy_rx()
2174 wait_for_completion(&bnad->bnad_completions.rx_comp); in bnad_destroy_rx()
2177 bnad_rx_msix_unregister(bnad, rx_info, rx_config->num_paths); in bnad_destroy_rx()
2179 bnad_napi_delete(bnad, rx_id); in bnad_destroy_rx()
2181 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_destroy_rx()
2186 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_destroy_rx()
2188 bnad_rx_res_free(bnad, res_info); in bnad_destroy_rx()
2193 bnad_setup_rx(struct bnad *bnad, u32 rx_id) in bnad_setup_rx() argument
2196 struct bnad_rx_info *rx_info = &bnad->rx_info[rx_id]; in bnad_setup_rx()
2197 struct bna_res_info *res_info = &bnad->rx_res_info[rx_id].res_info[0]; in bnad_setup_rx()
2200 struct bna_rx_config *rx_config = &bnad->rx_config[rx_id]; in bnad_setup_rx()
2216 bnad_init_rx_config(bnad, rx_config); in bnad_setup_rx()
2219 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_rx()
2221 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_rx()
2238 err = bnad_rx_res_alloc(bnad, res_info, rx_id); in bnad_setup_rx()
2242 bnad_rx_ctrl_init(bnad, rx_id); in bnad_setup_rx()
2245 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_rx()
2246 rx = bna_rx_create(&bnad->bna, bnad, rx_config, &rx_cbfn, res_info, in bnad_setup_rx()
2250 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_rx()
2254 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_rx()
2262 bnad_napi_add(bnad, rx_id); in bnad_setup_rx()
2266 err = bnad_rx_msix_register(bnad, rx_info, rx_id, in bnad_setup_rx()
2272 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_setup_rx()
2275 if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED) in bnad_setup_rx()
2276 bna_rx_dim_reconfig(&bnad->bna, bna_napi_dim_vector); in bnad_setup_rx()
2282 bnad_dim_timer_start(bnad); in bnad_setup_rx()
2286 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_setup_rx()
2291 bnad_destroy_rx(bnad, rx_id); in bnad_setup_rx()
2297 bnad_tx_coalescing_timeo_set(struct bnad *bnad) in bnad_tx_coalescing_timeo_set() argument
2301 tx_info = &bnad->tx_info[0]; in bnad_tx_coalescing_timeo_set()
2305 bna_tx_coalescing_timeo_set(tx_info->tx, bnad->tx_coalescing_timeo); in bnad_tx_coalescing_timeo_set()
2310 bnad_rx_coalescing_timeo_set(struct bnad *bnad) in bnad_rx_coalescing_timeo_set() argument
2315 for (i = 0; i < bnad->num_rx; i++) { in bnad_rx_coalescing_timeo_set()
2316 rx_info = &bnad->rx_info[i]; in bnad_rx_coalescing_timeo_set()
2320 bnad->rx_coalescing_timeo); in bnad_rx_coalescing_timeo_set()
2328 bnad_mac_addr_set_locked(struct bnad *bnad, const u8 *mac_addr) in bnad_mac_addr_set_locked() argument
2336 if (!bnad->rx_info[0].rx) in bnad_mac_addr_set_locked()
2339 ret = bna_rx_ucast_set(bnad->rx_info[0].rx, mac_addr); in bnad_mac_addr_set_locked()
2348 bnad_enable_default_bcast(struct bnad *bnad) in bnad_enable_default_bcast() argument
2350 struct bnad_rx_info *rx_info = &bnad->rx_info[0]; in bnad_enable_default_bcast()
2354 init_completion(&bnad->bnad_completions.mcast_comp); in bnad_enable_default_bcast()
2356 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_enable_default_bcast()
2359 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_enable_default_bcast()
2362 wait_for_completion(&bnad->bnad_completions.mcast_comp); in bnad_enable_default_bcast()
2366 if (bnad->bnad_completions.mcast_comp_status != BNA_CB_SUCCESS) in bnad_enable_default_bcast()
2374 bnad_restore_vlans(struct bnad *bnad, u32 rx_id) in bnad_restore_vlans() argument
2379 for_each_set_bit(vid, bnad->active_vlans, VLAN_N_VID) { in bnad_restore_vlans()
2380 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_restore_vlans()
2381 bna_rx_vlan_add(bnad->rx_info[rx_id].rx, vid); in bnad_restore_vlans()
2382 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_restore_vlans()
2388 bnad_netdev_qstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats) in bnad_netdev_qstats_fill() argument
2392 for (i = 0; i < bnad->num_rx; i++) { in bnad_netdev_qstats_fill()
2393 for (j = 0; j < bnad->num_rxp_per_rx; j++) { in bnad_netdev_qstats_fill()
2394 if (bnad->rx_info[i].rx_ctrl[j].ccb) { in bnad_netdev_qstats_fill()
2395 stats->rx_packets += bnad->rx_info[i]. in bnad_netdev_qstats_fill()
2397 stats->rx_bytes += bnad->rx_info[i]. in bnad_netdev_qstats_fill()
2399 if (bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1] && in bnad_netdev_qstats_fill()
2400 bnad->rx_info[i].rx_ctrl[j].ccb-> in bnad_netdev_qstats_fill()
2403 bnad->rx_info[i].rx_ctrl[j]. in bnad_netdev_qstats_fill()
2406 bnad->rx_info[i].rx_ctrl[j]. in bnad_netdev_qstats_fill()
2412 for (i = 0; i < bnad->num_tx; i++) { in bnad_netdev_qstats_fill()
2413 for (j = 0; j < bnad->num_txq_per_tx; j++) { in bnad_netdev_qstats_fill()
2414 if (bnad->tx_info[i].tcb[j]) { in bnad_netdev_qstats_fill()
2416 bnad->tx_info[i].tcb[j]->txq->tx_packets; in bnad_netdev_qstats_fill()
2418 bnad->tx_info[i].tcb[j]->txq->tx_bytes; in bnad_netdev_qstats_fill()
2428 bnad_netdev_hwstats_fill(struct bnad *bnad, struct rtnl_link_stats64 *stats) in bnad_netdev_hwstats_fill() argument
2434 mac_stats = &bnad->stats.bna_stats->hw_stats.mac_stats; in bnad_netdev_hwstats_fill()
2453 bmap = bna_rx_rid_mask(&bnad->bna); in bnad_netdev_hwstats_fill()
2457 bnad->stats.bna_stats-> in bnad_netdev_hwstats_fill()
2466 bnad_mbox_irq_sync(struct bnad *bnad) in bnad_mbox_irq_sync() argument
2471 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_mbox_irq_sync()
2472 if (bnad->cfg_flags & BNAD_CF_MSIX) in bnad_mbox_irq_sync()
2473 irq = bnad->msix_table[BNAD_MAILBOX_MSIX_INDEX].vector; in bnad_mbox_irq_sync()
2475 irq = bnad->pcidev->irq; in bnad_mbox_irq_sync()
2476 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_mbox_irq_sync()
2483 bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb) in bnad_tso_prepare() argument
2489 BNAD_UPDATE_CTR(bnad, tso_err); in bnad_tso_prepare()
2507 BNAD_UPDATE_CTR(bnad, tso4); in bnad_tso_prepare()
2510 BNAD_UPDATE_CTR(bnad, tso6); in bnad_tso_prepare()
2522 bnad_q_num_init(struct bnad *bnad) in bnad_q_num_init() argument
2529 if (!(bnad->cfg_flags & BNAD_CF_MSIX)) in bnad_q_num_init()
2532 bnad->num_rx = 1; in bnad_q_num_init()
2533 bnad->num_tx = 1; in bnad_q_num_init()
2534 bnad->num_rxp_per_rx = rxps; in bnad_q_num_init()
2535 bnad->num_txq_per_tx = BNAD_TXQ_NUM; in bnad_q_num_init()
2545 bnad_q_num_adjust(struct bnad *bnad, int msix_vectors, int temp) in bnad_q_num_adjust() argument
2547 bnad->num_txq_per_tx = 1; in bnad_q_num_adjust()
2548 if ((msix_vectors >= (bnad->num_tx * bnad->num_txq_per_tx) + in bnad_q_num_adjust()
2550 (bnad->cfg_flags & BNAD_CF_MSIX)) { in bnad_q_num_adjust()
2551 bnad->num_rxp_per_rx = msix_vectors - in bnad_q_num_adjust()
2552 (bnad->num_tx * bnad->num_txq_per_tx) - in bnad_q_num_adjust()
2555 bnad->num_rxp_per_rx = 1; in bnad_q_num_adjust()
2560 bnad_ioceth_disable(struct bnad *bnad) in bnad_ioceth_disable() argument
2565 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_ioceth_disable()
2566 init_completion(&bnad->bnad_completions.ioc_comp); in bnad_ioceth_disable()
2567 bna_ioceth_disable(&bnad->bna.ioceth, BNA_HARD_CLEANUP); in bnad_ioceth_disable()
2568 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_ioceth_disable()
2570 wait_for_completion_timeout(&bnad->bnad_completions.ioc_comp, in bnad_ioceth_disable()
2573 err = bnad->bnad_completions.ioc_comp_status; in bnad_ioceth_disable()
2578 bnad_ioceth_enable(struct bnad *bnad) in bnad_ioceth_enable() argument
2583 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_ioceth_enable()
2584 init_completion(&bnad->bnad_completions.ioc_comp); in bnad_ioceth_enable()
2585 bnad->bnad_completions.ioc_comp_status = BNA_CB_WAITING; in bnad_ioceth_enable()
2586 bna_ioceth_enable(&bnad->bna.ioceth); in bnad_ioceth_enable()
2587 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_ioceth_enable()
2589 wait_for_completion_timeout(&bnad->bnad_completions.ioc_comp, in bnad_ioceth_enable()
2592 err = bnad->bnad_completions.ioc_comp_status; in bnad_ioceth_enable()
2599 bnad_res_free(struct bnad *bnad, struct bna_res_info *res_info, in bnad_res_free() argument
2605 bnad_mem_free(bnad, &res_info[i].res_u.mem_info); in bnad_res_free()
2610 bnad_res_alloc(struct bnad *bnad, struct bna_res_info *res_info, in bnad_res_alloc() argument
2616 err = bnad_mem_alloc(bnad, &res_info[i].res_u.mem_info); in bnad_res_alloc()
2623 bnad_res_free(bnad, res_info, res_val_max); in bnad_res_alloc()
2629 bnad_enable_msix(struct bnad *bnad) in bnad_enable_msix() argument
2634 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_enable_msix()
2635 if (!(bnad->cfg_flags & BNAD_CF_MSIX)) { in bnad_enable_msix()
2636 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_enable_msix()
2639 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_enable_msix()
2641 if (bnad->msix_table) in bnad_enable_msix()
2644 bnad->msix_table = in bnad_enable_msix()
2645 kcalloc(bnad->msix_num, sizeof(struct msix_entry), GFP_KERNEL); in bnad_enable_msix()
2647 if (!bnad->msix_table) in bnad_enable_msix()
2650 for (i = 0; i < bnad->msix_num; i++) in bnad_enable_msix()
2651 bnad->msix_table[i].entry = i; in bnad_enable_msix()
2653 ret = pci_enable_msix_range(bnad->pcidev, bnad->msix_table, in bnad_enable_msix()
2654 1, bnad->msix_num); in bnad_enable_msix()
2657 } else if (ret < bnad->msix_num) { in bnad_enable_msix()
2658 dev_warn(&bnad->pcidev->dev, in bnad_enable_msix()
2660 ret, bnad->msix_num); in bnad_enable_msix()
2662 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_enable_msix()
2664 bnad_q_num_adjust(bnad, (ret - BNAD_MAILBOX_MSIX_VECTORS) / 2, in bnad_enable_msix()
2666 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_enable_msix()
2668 bnad->msix_num = BNAD_NUM_TXQ + BNAD_NUM_RXP + in bnad_enable_msix()
2671 if (bnad->msix_num > ret) { in bnad_enable_msix()
2672 pci_disable_msix(bnad->pcidev); in bnad_enable_msix()
2677 pci_intx(bnad->pcidev, 0); in bnad_enable_msix()
2682 dev_warn(&bnad->pcidev->dev, in bnad_enable_msix()
2685 kfree(bnad->msix_table); in bnad_enable_msix()
2686 bnad->msix_table = NULL; in bnad_enable_msix()
2687 bnad->msix_num = 0; in bnad_enable_msix()
2688 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_enable_msix()
2689 bnad->cfg_flags &= ~BNAD_CF_MSIX; in bnad_enable_msix()
2690 bnad_q_num_init(bnad); in bnad_enable_msix()
2691 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_enable_msix()
2695 bnad_disable_msix(struct bnad *bnad) in bnad_disable_msix() argument
2700 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_disable_msix()
2701 cfg_flags = bnad->cfg_flags; in bnad_disable_msix()
2702 if (bnad->cfg_flags & BNAD_CF_MSIX) in bnad_disable_msix()
2703 bnad->cfg_flags &= ~BNAD_CF_MSIX; in bnad_disable_msix()
2704 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_disable_msix()
2707 pci_disable_msix(bnad->pcidev); in bnad_disable_msix()
2708 kfree(bnad->msix_table); in bnad_disable_msix()
2709 bnad->msix_table = NULL; in bnad_disable_msix()
2718 struct bnad *bnad = netdev_priv(netdev); in bnad_open() local
2722 mutex_lock(&bnad->conf_mutex); in bnad_open()
2725 err = bnad_setup_tx(bnad, 0); in bnad_open()
2730 err = bnad_setup_rx(bnad, 0); in bnad_open()
2738 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_open()
2739 bna_enet_mtu_set(&bnad->bna.enet, in bnad_open()
2740 BNAD_FRAME_SIZE(bnad->netdev->mtu), NULL); in bnad_open()
2741 bna_enet_pause_config(&bnad->bna.enet, &pause_config); in bnad_open()
2742 bna_enet_enable(&bnad->bna.enet); in bnad_open()
2743 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_open()
2746 bnad_enable_default_bcast(bnad); in bnad_open()
2749 bnad_restore_vlans(bnad, 0); in bnad_open()
2752 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_open()
2753 bnad_mac_addr_set_locked(bnad, netdev->dev_addr); in bnad_open()
2754 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_open()
2757 bnad_stats_timer_start(bnad); in bnad_open()
2759 mutex_unlock(&bnad->conf_mutex); in bnad_open()
2764 bnad_destroy_tx(bnad, 0); in bnad_open()
2767 mutex_unlock(&bnad->conf_mutex); in bnad_open()
2774 struct bnad *bnad = netdev_priv(netdev); in bnad_stop() local
2777 mutex_lock(&bnad->conf_mutex); in bnad_stop()
2780 bnad_stats_timer_stop(bnad); in bnad_stop()
2782 init_completion(&bnad->bnad_completions.enet_comp); in bnad_stop()
2784 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_stop()
2785 bna_enet_disable(&bnad->bna.enet, BNA_HARD_CLEANUP, in bnad_stop()
2787 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_stop()
2789 wait_for_completion(&bnad->bnad_completions.enet_comp); in bnad_stop()
2791 bnad_destroy_tx(bnad, 0); in bnad_stop()
2792 bnad_destroy_rx(bnad, 0); in bnad_stop()
2795 bnad_mbox_irq_sync(bnad); in bnad_stop()
2797 mutex_unlock(&bnad->conf_mutex); in bnad_stop()
2805 bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb, in bnad_txq_wi_prepare() argument
2816 if (test_bit(BNAD_RF_CEE_RUNNING, &bnad->run_flags)) { in bnad_txq_wi_prepare()
2825 if (unlikely(gso_size > bnad->netdev->mtu)) { in bnad_txq_wi_prepare()
2826 BNAD_UPDATE_CTR(bnad, tx_skb_mss_too_long); in bnad_txq_wi_prepare()
2832 BNAD_UPDATE_CTR(bnad, tx_skb_tso_too_short); in bnad_txq_wi_prepare()
2838 if (bnad_tso_prepare(bnad, skb)) { in bnad_txq_wi_prepare()
2839 BNAD_UPDATE_CTR(bnad, tx_skb_tso_prepare); in bnad_txq_wi_prepare()
2851 if (unlikely(skb->len > (bnad->netdev->mtu + VLAN_ETH_HLEN))) { in bnad_txq_wi_prepare()
2852 BNAD_UPDATE_CTR(bnad, tx_skb_non_tso_too_long); in bnad_txq_wi_prepare()
2874 BNAD_UPDATE_CTR(bnad, tcpcsum_offload); in bnad_txq_wi_prepare()
2878 BNAD_UPDATE_CTR(bnad, tx_skb_tcp_hdr); in bnad_txq_wi_prepare()
2887 BNAD_UPDATE_CTR(bnad, udpcsum_offload); in bnad_txq_wi_prepare()
2891 BNAD_UPDATE_CTR(bnad, tx_skb_udp_hdr); in bnad_txq_wi_prepare()
2896 BNAD_UPDATE_CTR(bnad, tx_skb_csum_err); in bnad_txq_wi_prepare()
2916 struct bnad *bnad = netdev_priv(netdev); in bnad_start_xmit() local
2932 BNAD_UPDATE_CTR(bnad, tx_skb_too_short); in bnad_start_xmit()
2937 BNAD_UPDATE_CTR(bnad, tx_skb_headlen_zero); in bnad_start_xmit()
2942 BNAD_UPDATE_CTR(bnad, tx_skb_headlen_zero); in bnad_start_xmit()
2946 tcb = bnad->tx_info[0].tcb[txq_id]; in bnad_start_xmit()
2954 BNAD_UPDATE_CTR(bnad, tx_skb_stopping); in bnad_start_xmit()
2967 BNAD_UPDATE_CTR(bnad, tx_skb_max_vectors); in bnad_start_xmit()
2976 sent = bnad_txcmpl_process(bnad, tcb); in bnad_start_xmit()
2983 BNAD_UPDATE_CTR(bnad, netif_queue_stop); in bnad_start_xmit()
2993 BNAD_UPDATE_CTR(bnad, netif_queue_stop); in bnad_start_xmit()
2997 BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); in bnad_start_xmit()
3005 if (bnad_txq_wi_prepare(bnad, tcb, skb, txqent)) { in bnad_start_xmit()
3017 dma_addr = dma_map_single(&bnad->pcidev->dev, skb->data, in bnad_start_xmit()
3019 if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { in bnad_start_xmit()
3021 BNAD_UPDATE_CTR(bnad, tx_skb_map_failed); in bnad_start_xmit()
3035 bnad_tx_buff_unmap(bnad, unmap_q, q_depth, in bnad_start_xmit()
3038 BNAD_UPDATE_CTR(bnad, tx_skb_frag_zero); in bnad_start_xmit()
3053 dma_addr = skb_frag_dma_map(&bnad->pcidev->dev, frag, in bnad_start_xmit()
3055 if (dma_mapping_error(&bnad->pcidev->dev, dma_addr)) { in bnad_start_xmit()
3057 bnad_tx_buff_unmap(bnad, unmap_q, q_depth, in bnad_start_xmit()
3060 BNAD_UPDATE_CTR(bnad, tx_skb_map_failed); in bnad_start_xmit()
3074 bnad_tx_buff_unmap(bnad, unmap_q, q_depth, tcb->producer_index); in bnad_start_xmit()
3076 BNAD_UPDATE_CTR(bnad, tx_skb_len_mismatch); in bnad_start_xmit()
3102 struct bnad *bnad = netdev_priv(netdev); in bnad_get_stats64() local
3105 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_get_stats64()
3107 bnad_netdev_qstats_fill(bnad, stats); in bnad_get_stats64()
3108 bnad_netdev_hwstats_fill(bnad, stats); in bnad_get_stats64()
3110 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_get_stats64()
3114 bnad_set_rx_ucast_fltr(struct bnad *bnad) in bnad_set_rx_ucast_fltr() argument
3116 struct net_device *netdev = bnad->netdev; in bnad_set_rx_ucast_fltr()
3123 if (netdev_uc_empty(bnad->netdev)) { in bnad_set_rx_ucast_fltr()
3124 bna_rx_ucast_listset(bnad->rx_info[0].rx, 0, NULL); in bnad_set_rx_ucast_fltr()
3128 if (uc_count > bna_attr(&bnad->bna)->num_ucmac) in bnad_set_rx_ucast_fltr()
3141 ret = bna_rx_ucast_listset(bnad->rx_info[0].rx, entry, mac_list); in bnad_set_rx_ucast_fltr()
3151 bnad->cfg_flags |= BNAD_CF_DEFAULT; in bnad_set_rx_ucast_fltr()
3152 bna_rx_ucast_listset(bnad->rx_info[0].rx, 0, NULL); in bnad_set_rx_ucast_fltr()
3156 bnad_set_rx_mcast_fltr(struct bnad *bnad) in bnad_set_rx_mcast_fltr() argument
3158 struct net_device *netdev = bnad->netdev; in bnad_set_rx_mcast_fltr()
3169 if (mc_count > bna_attr(&bnad->bna)->num_mcmac) in bnad_set_rx_mcast_fltr()
3181 ret = bna_rx_mcast_listset(bnad->rx_info[0].rx, mc_count + 1, mac_list); in bnad_set_rx_mcast_fltr()
3190 bnad->cfg_flags |= BNAD_CF_ALLMULTI; in bnad_set_rx_mcast_fltr()
3191 bna_rx_mcast_delall(bnad->rx_info[0].rx); in bnad_set_rx_mcast_fltr()
3197 struct bnad *bnad = netdev_priv(netdev); in bnad_set_rx_mode() local
3201 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_set_rx_mode()
3203 if (bnad->rx_info[0].rx == NULL) { in bnad_set_rx_mode()
3204 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_set_rx_mode()
3209 bnad->cfg_flags &= ~(BNAD_CF_PROMISC | BNAD_CF_DEFAULT | in bnad_set_rx_mode()
3215 bnad->cfg_flags |= BNAD_CF_PROMISC; in bnad_set_rx_mode()
3217 bnad_set_rx_mcast_fltr(bnad); in bnad_set_rx_mode()
3219 if (bnad->cfg_flags & BNAD_CF_ALLMULTI) in bnad_set_rx_mode()
3222 bnad_set_rx_ucast_fltr(bnad); in bnad_set_rx_mode()
3224 if (bnad->cfg_flags & BNAD_CF_DEFAULT) in bnad_set_rx_mode()
3230 bna_rx_mode_set(bnad->rx_info[0].rx, new_mode, mode_mask); in bnad_set_rx_mode()
3232 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_set_rx_mode()
3244 struct bnad *bnad = netdev_priv(netdev); in bnad_set_mac_address() local
3248 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_set_mac_address()
3250 err = bnad_mac_addr_set_locked(bnad, sa->sa_data); in bnad_set_mac_address()
3254 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_set_mac_address()
3260 bnad_mtu_set(struct bnad *bnad, int frame_size) in bnad_mtu_set() argument
3264 init_completion(&bnad->bnad_completions.mtu_comp); in bnad_mtu_set()
3266 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_mtu_set()
3267 bna_enet_mtu_set(&bnad->bna.enet, frame_size, bnad_cb_enet_mtu_set); in bnad_mtu_set()
3268 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_mtu_set()
3270 wait_for_completion(&bnad->bnad_completions.mtu_comp); in bnad_mtu_set()
3272 return bnad->bnad_completions.mtu_comp_status; in bnad_mtu_set()
3279 struct bnad *bnad = netdev_priv(netdev); in bnad_change_mtu() local
3282 mutex_lock(&bnad->conf_mutex); in bnad_change_mtu()
3291 if (BNAD_PCI_DEV_IS_CAT2(bnad) && in bnad_change_mtu()
3292 netif_running(bnad->netdev)) { in bnad_change_mtu()
3296 bnad_reinit_rx(bnad); in bnad_change_mtu()
3299 err = bnad_mtu_set(bnad, new_frame); in bnad_change_mtu()
3303 mutex_unlock(&bnad->conf_mutex); in bnad_change_mtu()
3310 struct bnad *bnad = netdev_priv(netdev); in bnad_vlan_rx_add_vid() local
3313 if (!bnad->rx_info[0].rx) in bnad_vlan_rx_add_vid()
3316 mutex_lock(&bnad->conf_mutex); in bnad_vlan_rx_add_vid()
3318 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_vlan_rx_add_vid()
3319 bna_rx_vlan_add(bnad->rx_info[0].rx, vid); in bnad_vlan_rx_add_vid()
3320 set_bit(vid, bnad->active_vlans); in bnad_vlan_rx_add_vid()
3321 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_vlan_rx_add_vid()
3323 mutex_unlock(&bnad->conf_mutex); in bnad_vlan_rx_add_vid()
3331 struct bnad *bnad = netdev_priv(netdev); in bnad_vlan_rx_kill_vid() local
3334 if (!bnad->rx_info[0].rx) in bnad_vlan_rx_kill_vid()
3337 mutex_lock(&bnad->conf_mutex); in bnad_vlan_rx_kill_vid()
3339 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_vlan_rx_kill_vid()
3340 clear_bit(vid, bnad->active_vlans); in bnad_vlan_rx_kill_vid()
3341 bna_rx_vlan_del(bnad->rx_info[0].rx, vid); in bnad_vlan_rx_kill_vid()
3342 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_vlan_rx_kill_vid()
3344 mutex_unlock(&bnad->conf_mutex); in bnad_vlan_rx_kill_vid()
3351 struct bnad *bnad = netdev_priv(dev); in bnad_set_features() local
3357 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_set_features()
3360 bna_rx_vlan_strip_enable(bnad->rx_info[0].rx); in bnad_set_features()
3362 bna_rx_vlan_strip_disable(bnad->rx_info[0].rx); in bnad_set_features()
3364 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_set_features()
3374 struct bnad *bnad = netdev_priv(netdev); in bnad_netpoll() local
3380 if (!(bnad->cfg_flags & BNAD_CF_MSIX)) { in bnad_netpoll()
3381 bna_intx_disable(&bnad->bna, curr_mask); in bnad_netpoll()
3382 bnad_isr(bnad->pcidev->irq, netdev); in bnad_netpoll()
3383 bna_intx_enable(&bnad->bna, curr_mask); in bnad_netpoll()
3391 for (i = 0; i < bnad->num_rx; i++) { in bnad_netpoll()
3392 rx_info = &bnad->rx_info[i]; in bnad_netpoll()
3395 for (j = 0; j < bnad->num_rxp_per_rx; j++) { in bnad_netpoll()
3398 bnad_netif_rx_schedule_poll(bnad, in bnad_netpoll()
3424 bnad_netdev_init(struct bnad *bnad) in bnad_netdev_init() argument
3426 struct net_device *netdev = bnad->netdev; in bnad_netdev_init()
3440 netdev->mem_start = bnad->mmio_start; in bnad_netdev_init()
3441 netdev->mem_end = bnad->mmio_start + bnad->mmio_len - 1; in bnad_netdev_init()
3458 bnad_init(struct bnad *bnad, in bnad_init() argument
3466 bnad->netdev = netdev; in bnad_init()
3467 bnad->pcidev = pdev; in bnad_init()
3468 bnad->mmio_start = pci_resource_start(pdev, 0); in bnad_init()
3469 bnad->mmio_len = pci_resource_len(pdev, 0); in bnad_init()
3470 bnad->bar0 = ioremap(bnad->mmio_start, bnad->mmio_len); in bnad_init()
3471 if (!bnad->bar0) { in bnad_init()
3475 dev_info(&pdev->dev, "bar0 mapped to %p, len %llu\n", bnad->bar0, in bnad_init()
3476 (unsigned long long) bnad->mmio_len); in bnad_init()
3478 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_init()
3480 bnad->cfg_flags = BNAD_CF_MSIX; in bnad_init()
3482 bnad->cfg_flags |= BNAD_CF_DIM_ENABLED; in bnad_init()
3484 bnad_q_num_init(bnad); in bnad_init()
3485 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_init()
3487 bnad->msix_num = (bnad->num_tx * bnad->num_txq_per_tx) + in bnad_init()
3488 (bnad->num_rx * bnad->num_rxp_per_rx) + in bnad_init()
3491 bnad->txq_depth = BNAD_TXQ_DEPTH; in bnad_init()
3492 bnad->rxq_depth = BNAD_RXQ_DEPTH; in bnad_init()
3494 bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO; in bnad_init()
3495 bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO; in bnad_init()
3497 sprintf(bnad->wq_name, "%s_wq_%d", BNAD_NAME, bnad->id); in bnad_init()
3498 bnad->work_q = create_singlethread_workqueue(bnad->wq_name); in bnad_init()
3499 if (!bnad->work_q) { in bnad_init()
3500 iounmap(bnad->bar0); in bnad_init()
3513 bnad_uninit(struct bnad *bnad) in bnad_uninit() argument
3515 if (bnad->work_q) { in bnad_uninit()
3516 destroy_workqueue(bnad->work_q); in bnad_uninit()
3517 bnad->work_q = NULL; in bnad_uninit()
3520 if (bnad->bar0) in bnad_uninit()
3521 iounmap(bnad->bar0); in bnad_uninit()
3531 bnad_lock_init(struct bnad *bnad) in bnad_lock_init() argument
3533 spin_lock_init(&bnad->bna_lock); in bnad_lock_init()
3534 mutex_init(&bnad->conf_mutex); in bnad_lock_init()
3538 bnad_lock_uninit(struct bnad *bnad) in bnad_lock_uninit() argument
3540 mutex_destroy(&bnad->conf_mutex); in bnad_lock_uninit()
3545 bnad_pci_init(struct bnad *bnad, struct pci_dev *pdev) in bnad_pci_init() argument
3581 struct bnad *bnad; in bnad_pci_probe() local
3599 netdev = alloc_etherdev(sizeof(struct bnad)); in bnad_pci_probe()
3604 bnad = netdev_priv(netdev); in bnad_pci_probe()
3605 bnad_lock_init(bnad); in bnad_pci_probe()
3606 bnad->id = atomic_inc_return(&bna_id) - 1; in bnad_pci_probe()
3608 mutex_lock(&bnad->conf_mutex); in bnad_pci_probe()
3610 err = bnad_pci_init(bnad, pdev); in bnad_pci_probe()
3618 err = bnad_init(bnad, pdev, netdev); in bnad_pci_probe()
3623 bnad_netdev_init(bnad); in bnad_pci_probe()
3630 bnad_debugfs_init(bnad); in bnad_pci_probe()
3633 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3634 bna_res_req(&bnad->res_info[0]); in bnad_pci_probe()
3635 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3638 err = bnad_res_alloc(bnad, &bnad->res_info[0], BNA_RES_T_MAX); in bnad_pci_probe()
3642 bna = &bnad->bna; in bnad_pci_probe()
3645 pcidev_info.pci_slot = PCI_SLOT(bnad->pcidev->devfn); in bnad_pci_probe()
3646 pcidev_info.pci_func = PCI_FUNC(bnad->pcidev->devfn); in bnad_pci_probe()
3647 pcidev_info.device_id = bnad->pcidev->device; in bnad_pci_probe()
3648 pcidev_info.pci_bar_kva = bnad->bar0; in bnad_pci_probe()
3650 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3651 bna_init(bna, bnad, &pcidev_info, &bnad->res_info[0]); in bnad_pci_probe()
3652 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3654 bnad->stats.bna_stats = &bna->stats; in bnad_pci_probe()
3656 bnad_enable_msix(bnad); in bnad_pci_probe()
3657 err = bnad_mbox_irq_alloc(bnad); in bnad_pci_probe()
3662 timer_setup(&bnad->bna.ioceth.ioc.ioc_timer, bnad_ioc_timeout, 0); in bnad_pci_probe()
3663 timer_setup(&bnad->bna.ioceth.ioc.hb_timer, bnad_ioc_hb_check, 0); in bnad_pci_probe()
3664 timer_setup(&bnad->bna.ioceth.ioc.iocpf_timer, bnad_iocpf_timeout, 0); in bnad_pci_probe()
3665 timer_setup(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout, in bnad_pci_probe()
3673 err = bnad_ioceth_enable(bnad); in bnad_pci_probe()
3679 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3682 bnad_q_num_adjust(bnad, bna_attr(bna)->num_txq - 1, in bnad_pci_probe()
3688 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3692 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3693 bna_mod_res_req(&bnad->bna, &bnad->mod_res_info[0]); in bnad_pci_probe()
3694 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3696 err = bnad_res_alloc(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX); in bnad_pci_probe()
3702 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3703 bna_mod_init(&bnad->bna, &bnad->mod_res_info[0]); in bnad_pci_probe()
3704 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3707 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3708 bna_enet_perm_mac_get(&bna->enet, bnad->perm_addr); in bnad_pci_probe()
3709 bnad_set_netdev_perm_addr(bnad); in bnad_pci_probe()
3710 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3712 mutex_unlock(&bnad->conf_mutex); in bnad_pci_probe()
3720 set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags); in bnad_pci_probe()
3725 mutex_unlock(&bnad->conf_mutex); in bnad_pci_probe()
3729 mutex_lock(&bnad->conf_mutex); in bnad_pci_probe()
3730 bnad_res_free(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX); in bnad_pci_probe()
3732 bnad_ioceth_disable(bnad); in bnad_pci_probe()
3733 timer_delete_sync(&bnad->bna.ioceth.ioc.ioc_timer); in bnad_pci_probe()
3734 timer_delete_sync(&bnad->bna.ioceth.ioc.sem_timer); in bnad_pci_probe()
3735 timer_delete_sync(&bnad->bna.ioceth.ioc.hb_timer); in bnad_pci_probe()
3736 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_probe()
3738 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_probe()
3739 bnad_mbox_irq_free(bnad); in bnad_pci_probe()
3740 bnad_disable_msix(bnad); in bnad_pci_probe()
3742 bnad_res_free(bnad, &bnad->res_info[0], BNA_RES_T_MAX); in bnad_pci_probe()
3745 kfree(bnad->regdata); in bnad_pci_probe()
3746 bnad_debugfs_uninit(bnad); in bnad_pci_probe()
3747 bnad_uninit(bnad); in bnad_pci_probe()
3751 mutex_unlock(&bnad->conf_mutex); in bnad_pci_probe()
3752 bnad_lock_uninit(bnad); in bnad_pci_probe()
3761 struct bnad *bnad; in bnad_pci_remove() local
3768 bnad = netdev_priv(netdev); in bnad_pci_remove()
3769 bna = &bnad->bna; in bnad_pci_remove()
3771 if (test_and_clear_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags)) in bnad_pci_remove()
3774 mutex_lock(&bnad->conf_mutex); in bnad_pci_remove()
3775 bnad_ioceth_disable(bnad); in bnad_pci_remove()
3776 timer_delete_sync(&bnad->bna.ioceth.ioc.ioc_timer); in bnad_pci_remove()
3777 timer_delete_sync(&bnad->bna.ioceth.ioc.sem_timer); in bnad_pci_remove()
3778 timer_delete_sync(&bnad->bna.ioceth.ioc.hb_timer); in bnad_pci_remove()
3779 spin_lock_irqsave(&bnad->bna_lock, flags); in bnad_pci_remove()
3781 spin_unlock_irqrestore(&bnad->bna_lock, flags); in bnad_pci_remove()
3783 bnad_res_free(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX); in bnad_pci_remove()
3784 bnad_res_free(bnad, &bnad->res_info[0], BNA_RES_T_MAX); in bnad_pci_remove()
3785 bnad_mbox_irq_free(bnad); in bnad_pci_remove()
3786 bnad_disable_msix(bnad); in bnad_pci_remove()
3788 mutex_unlock(&bnad->conf_mutex); in bnad_pci_remove()
3789 bnad_lock_uninit(bnad); in bnad_pci_remove()
3791 kfree(bnad->regdata); in bnad_pci_remove()
3792 bnad_debugfs_uninit(bnad); in bnad_pci_remove()
3793 bnad_uninit(bnad); in bnad_pci_remove()