ena.c (a6b55ee6be15a41792839095d19b589e25d0f7f7) | ena.c (b9e80b5280b75f2c641d680245df44b8ff26a7b0) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2015-2021 Amazon.com, Inc. or its affiliates. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 3465 unchanged lines hidden (view full) --- 3474 3475 ena_log(adapter->pdev, INFO, 3476 "Device reset completed successfully, Driver info: %s\n", 3477 ena_version); 3478 } 3479 ENA_LOCK_UNLOCK(); 3480} 3481 | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2015-2021 Amazon.com, Inc. or its affiliates. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 3465 unchanged lines hidden (view full) --- 3474 3475 ena_log(adapter->pdev, INFO, 3476 "Device reset completed successfully, Driver info: %s\n", 3477 ena_version); 3478 } 3479 ENA_LOCK_UNLOCK(); 3480} 3481 |
3482static void 3483ena_free_stats(struct ena_adapter *adapter) 3484{ 3485 ena_free_counters((counter_u64_t *)&adapter->hw_stats, 3486 sizeof(struct ena_hw_stats)); 3487 ena_free_counters((counter_u64_t *)&adapter->dev_stats, 3488 sizeof(struct ena_stats_dev)); 3489 3490} |
|
3482/** 3483 * ena_attach - Device Initialization Routine 3484 * @pdev: device information struct 3485 * 3486 * Returns 0 on success, otherwise on failure. 3487 * 3488 * ena_attach initializes an adapter identified by a device structure. 3489 * The OS initialization, configuring of the adapter private structure, --- 161 unchanged lines hidden (view full) --- 3651 goto err_io_free; 3652 } 3653 /* By default all of allocated MSIX vectors are actively used */ 3654 adapter->num_io_queues = adapter->msix_vecs - ENA_ADMIN_MSIX_VEC; 3655 3656 /* initialize rings basic information */ 3657 ena_init_io_rings(adapter); 3658 | 3491/** 3492 * ena_attach - Device Initialization Routine 3493 * @pdev: device information struct 3494 * 3495 * Returns 0 on success, otherwise on failure. 3496 * 3497 * ena_attach initializes an adapter identified by a device structure. 3498 * The OS initialization, configuring of the adapter private structure, --- 161 unchanged lines hidden (view full) --- 3660 goto err_io_free; 3661 } 3662 /* By default all of allocated MSIX vectors are actively used */ 3663 adapter->num_io_queues = adapter->msix_vecs - ENA_ADMIN_MSIX_VEC; 3664 3665 /* initialize rings basic information */ 3666 ena_init_io_rings(adapter); 3667 |
3668 /* Initialize statistics */ 3669 ena_alloc_counters((counter_u64_t *)&adapter->dev_stats, 3670 sizeof(struct ena_stats_dev)); 3671 ena_alloc_counters((counter_u64_t *)&adapter->hw_stats, 3672 sizeof(struct ena_hw_stats)); 3673 ena_sysctl_add_nodes(adapter); 3674 |
|
3659 /* setup network interface */ 3660 rc = ena_setup_ifnet(pdev, adapter, &get_feat_ctx); 3661 if (unlikely(rc != 0)) { 3662 ena_log(pdev, ERR, "Error with network interface setup\n"); 3663 goto err_msix_free; 3664 } 3665 3666 /* Initialize reset task queue */ --- 5 unchanged lines hidden (view full) --- 3672 3673 /* Initialize metrics task queue */ 3674 TASK_INIT(&adapter->metrics_task, 0, ena_metrics_task, adapter); 3675 adapter->metrics_tq = taskqueue_create("ena_metrics_enqueue", 3676 M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &adapter->metrics_tq); 3677 taskqueue_start_threads(&adapter->metrics_tq, 1, PI_NET, "%s metricsq", 3678 device_get_nameunit(adapter->pdev)); 3679 | 3675 /* setup network interface */ 3676 rc = ena_setup_ifnet(pdev, adapter, &get_feat_ctx); 3677 if (unlikely(rc != 0)) { 3678 ena_log(pdev, ERR, "Error with network interface setup\n"); 3679 goto err_msix_free; 3680 } 3681 3682 /* Initialize reset task queue */ --- 5 unchanged lines hidden (view full) --- 3688 3689 /* Initialize metrics task queue */ 3690 TASK_INIT(&adapter->metrics_task, 0, ena_metrics_task, adapter); 3691 adapter->metrics_tq = taskqueue_create("ena_metrics_enqueue", 3692 M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &adapter->metrics_tq); 3693 taskqueue_start_threads(&adapter->metrics_tq, 1, PI_NET, "%s metricsq", 3694 device_get_nameunit(adapter->pdev)); 3695 |
3680 /* Initialize statistics */ 3681 ena_alloc_counters((counter_u64_t *)&adapter->dev_stats, 3682 sizeof(struct ena_stats_dev)); 3683 ena_alloc_counters((counter_u64_t *)&adapter->hw_stats, 3684 sizeof(struct ena_hw_stats)); 3685 ena_sysctl_add_nodes(adapter); 3686 | |
3687#ifdef DEV_NETMAP 3688 rc = ena_netmap_attach(adapter); 3689 if (rc != 0) { 3690 ena_log(pdev, ERR, "netmap attach failed: %d\n", rc); 3691 goto err_detach; 3692 } 3693#endif /* DEV_NETMAP */ 3694 --- 6 unchanged lines hidden (view full) --- 3701 3702 return (0); 3703 3704#ifdef DEV_NETMAP 3705err_detach: 3706 ether_ifdetach(adapter->ifp); 3707#endif /* DEV_NETMAP */ 3708err_msix_free: | 3696#ifdef DEV_NETMAP 3697 rc = ena_netmap_attach(adapter); 3698 if (rc != 0) { 3699 ena_log(pdev, ERR, "netmap attach failed: %d\n", rc); 3700 goto err_detach; 3701 } 3702#endif /* DEV_NETMAP */ 3703 --- 6 unchanged lines hidden (view full) --- 3710 3711 return (0); 3712 3713#ifdef DEV_NETMAP 3714err_detach: 3715 ether_ifdetach(adapter->ifp); 3716#endif /* DEV_NETMAP */ 3717err_msix_free: |
3718 ena_free_stats(adapter); |
|
3709 ena_com_dev_reset(adapter->ena_dev, ENA_REGS_RESET_INIT_ERR); 3710 ena_free_mgmnt_irq(adapter); 3711 ena_disable_msix(adapter); 3712err_io_free: 3713 ena_free_all_io_rings_resources(adapter); 3714 ena_free_rx_dma_tag(adapter); 3715err_tx_tag_free: 3716 ena_free_tx_dma_tag(adapter); --- 56 unchanged lines hidden (view full) --- 3773 /* Restore unregistered sysctl queue nodes. */ 3774 ena_sysctl_update_queue_node_nb(adapter, adapter->num_io_queues, 3775 adapter->max_num_io_queues); 3776 3777#ifdef DEV_NETMAP 3778 netmap_detach(adapter->ifp); 3779#endif /* DEV_NETMAP */ 3780 | 3719 ena_com_dev_reset(adapter->ena_dev, ENA_REGS_RESET_INIT_ERR); 3720 ena_free_mgmnt_irq(adapter); 3721 ena_disable_msix(adapter); 3722err_io_free: 3723 ena_free_all_io_rings_resources(adapter); 3724 ena_free_rx_dma_tag(adapter); 3725err_tx_tag_free: 3726 ena_free_tx_dma_tag(adapter); --- 56 unchanged lines hidden (view full) --- 3783 /* Restore unregistered sysctl queue nodes. */ 3784 ena_sysctl_update_queue_node_nb(adapter, adapter->num_io_queues, 3785 adapter->max_num_io_queues); 3786 3787#ifdef DEV_NETMAP 3788 netmap_detach(adapter->ifp); 3789#endif /* DEV_NETMAP */ 3790 |
3781 ena_free_counters((counter_u64_t *)&adapter->hw_stats, 3782 sizeof(struct ena_hw_stats)); 3783 ena_free_counters((counter_u64_t *)&adapter->dev_stats, 3784 sizeof(struct ena_stats_dev)); | 3791 ena_free_stats(adapter); |
3785 3786 rc = ena_free_rx_dma_tag(adapter); 3787 if (unlikely(rc != 0)) 3788 ena_log(adapter->pdev, WARN, 3789 "Unmapped RX DMA tag associations\n"); 3790 3791 rc = ena_free_tx_dma_tag(adapter); 3792 if (unlikely(rc != 0)) --- 142 unchanged lines hidden --- | 3792 3793 rc = ena_free_rx_dma_tag(adapter); 3794 if (unlikely(rc != 0)) 3795 ena_log(adapter->pdev, WARN, 3796 "Unmapped RX DMA tag associations\n"); 3797 3798 rc = ena_free_tx_dma_tag(adapter); 3799 if (unlikely(rc != 0)) --- 142 unchanged lines hidden --- |