]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/drivers/net/bnxt/bnxt_irq.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2018 Broadcom
8 #include <rte_malloc.h>
13 #include "bnxt_ring.h"
14 #include "hsi_struct_def_dpdk.h"
20 static void bnxt_int_handler(void *param
)
22 struct rte_eth_dev
*eth_dev
= (struct rte_eth_dev
*)param
;
23 struct bnxt
*bp
= (struct bnxt
*)eth_dev
->data
->dev_private
;
24 struct bnxt_cp_ring_info
*cpr
= bp
->def_cp_ring
;
25 struct cmpl_base
*cmp
;
32 raw_cons
= cpr
->cp_raw_cons
;
34 if (!cpr
|| !cpr
->cp_ring_struct
)
37 cons
= RING_CMP(cpr
->cp_ring_struct
, raw_cons
);
38 cmp
= &cpr
->cp_desc_ring
[cons
];
40 if (!CMP_VALID(cmp
, raw_cons
, cpr
->cp_ring_struct
))
43 bnxt_event_hwrm_resp_handler(bp
, cmp
);
44 raw_cons
= NEXT_RAW_CMP(raw_cons
);
47 cpr
->cp_raw_cons
= raw_cons
;
48 B_CP_DB_REARM(cpr
, cpr
->cp_raw_cons
);
51 void bnxt_free_int(struct bnxt
*bp
)
58 rte_intr_disable(&bp
->pdev
->intr_handle
);
59 rte_intr_callback_unregister(&bp
->pdev
->intr_handle
,
64 rte_free((void *)bp
->irq_tbl
);
69 void bnxt_disable_int(struct bnxt
*bp
)
71 struct bnxt_cp_ring_info
*cpr
= bp
->def_cp_ring
;
73 /* Only the default completion ring */
74 if (cpr
!= NULL
&& cpr
->cp_doorbell
!= NULL
)
78 void bnxt_enable_int(struct bnxt
*bp
)
80 struct bnxt_cp_ring_info
*cpr
= bp
->def_cp_ring
;
82 /* Only the default completion ring */
83 if (cpr
!= NULL
&& cpr
->cp_doorbell
!= NULL
)
87 int bnxt_setup_int(struct bnxt
*bp
)
90 const int len
= sizeof(bp
->irq_tbl
[0].name
);
93 /* DPDK host only supports 1 MSI-X vector */
95 bp
->irq_tbl
= rte_calloc("bnxt_irq_tbl", total_vecs
,
96 sizeof(struct bnxt_irq
), 0);
98 for (i
= 0; i
< total_vecs
; i
++) {
99 bp
->irq_tbl
[i
].vector
= i
;
100 snprintf(bp
->irq_tbl
[i
].name
, len
,
101 "%s-%d", bp
->eth_dev
->device
->name
, i
);
102 bp
->irq_tbl
[i
].handler
= bnxt_int_handler
;
111 PMD_DRV_LOG(ERR
, "bnxt_irq_tbl setup failed\n");
115 int bnxt_request_int(struct bnxt
*bp
)
119 struct bnxt_irq
*irq
= bp
->irq_tbl
;
121 rte_intr_callback_register(&bp
->pdev
->intr_handle
, irq
->handler
,
122 (void *)bp
->eth_dev
);
123 rte_intr_enable(&bp
->pdev
->intr_handle
);