| 889 | } |
| 890 | |
| 891 | int |
| 892 | sfc_ev_qinit(struct sfc_adapter *sa, |
| 893 | enum sfc_evq_type type, unsigned int type_index, |
| 894 | unsigned int entries, int socket_id, struct sfc_evq **evqp) |
| 895 | { |
| 896 | struct sfc_evq *evq; |
| 897 | int rc; |
| 898 | |
| 899 | sfc_log_init(sa, "type=%s type_index=%u", |
| 900 | sfc_evq_type2str(type), type_index); |
| 901 | |
| 902 | SFC_ASSERT(rte_is_power_of_2(entries)); |
| 903 | |
| 904 | rc = ENOMEM; |
| 905 | evq = rte_zmalloc_socket("sfc-evq", sizeof(*evq), RTE_CACHE_LINE_SIZE, |
| 906 | socket_id); |
| 907 | if (evq == NULL) |
| 908 | goto fail_evq_alloc; |
| 909 | |
| 910 | evq->sa = sa; |
| 911 | evq->type = type; |
| 912 | evq->entries = entries; |
| 913 | |
| 914 | /* Allocate DMA space */ |
| 915 | rc = sfc_dma_alloc(sa, sfc_evq_type2str(type), type_index, |
| 916 | EFX_NIC_DMA_ADDR_EVENT_RING, |
| 917 | efx_evq_size(sa->nic, evq->entries, sa->evq_flags), |
| 918 | socket_id, &evq->mem); |
| 919 | if (rc != 0) |
| 920 | goto fail_dma_alloc; |
| 921 | |
| 922 | evq->init_state = SFC_EVQ_INITIALIZED; |
| 923 | |
| 924 | sa->evq_count++; |
| 925 | |
| 926 | *evqp = evq; |
| 927 | |
| 928 | return 0; |
| 929 | |
| 930 | fail_dma_alloc: |
| 931 | rte_free(evq); |
| 932 | |
| 933 | fail_evq_alloc: |
| 934 | |
| 935 | sfc_log_init(sa, "failed %d", rc); |
| 936 | return rc; |
| 937 | } |
| 938 | |
| 939 | void |
| 940 | sfc_ev_qfini(struct sfc_evq *evq) |
no test coverage detected