Lines Matching refs:ndev
35 struct nitrox_device *ndev; member
39 static inline u64 pf2vf_read_mbox(struct nitrox_device *ndev, int ring) in pf2vf_read_mbox() argument
44 return nitrox_read_csr(ndev, reg_addr); in pf2vf_read_mbox()
47 static inline void pf2vf_write_mbox(struct nitrox_device *ndev, u64 value, in pf2vf_write_mbox() argument
53 nitrox_write_csr(ndev, reg_addr, value); in pf2vf_write_mbox()
56 static void pf2vf_send_response(struct nitrox_device *ndev, in pf2vf_send_response() argument
65 msg.data = ndev->mode; in pf2vf_send_response()
72 msg.id.chipid = ndev->idx; in pf2vf_send_response()
96 pf2vf_write_mbox(ndev, msg.value, vfdev->ring); in pf2vf_send_response()
107 struct nitrox_device *ndev = pf2vf_resp->ndev; in pf2vf_resp_handler() local
112 pf2vf_send_response(ndev, vfdev); in pf2vf_resp_handler()
122 void nitrox_pf2vf_mbox_handler(struct nitrox_device *ndev) in nitrox_pf2vf_mbox_handler() argument
133 value = nitrox_read_csr(ndev, reg_addr); in nitrox_pf2vf_mbox_handler()
137 vfno = RING_TO_VFNO(i, ndev->iov.max_vf_queues); in nitrox_pf2vf_mbox_handler()
138 vfdev = ndev->iov.vfdev + vfno; in nitrox_pf2vf_mbox_handler()
141 vfdev->msg.value = pf2vf_read_mbox(ndev, vfdev->ring); in nitrox_pf2vf_mbox_handler()
147 pfwork->ndev = ndev; in nitrox_pf2vf_mbox_handler()
149 queue_work(ndev->iov.pf2vf_wq, &pfwork->pf2vf_resp); in nitrox_pf2vf_mbox_handler()
151 nitrox_write_csr(ndev, reg_addr, BIT_ULL(i)); in nitrox_pf2vf_mbox_handler()
156 value = nitrox_read_csr(ndev, reg_addr); in nitrox_pf2vf_mbox_handler()
160 vfno = RING_TO_VFNO(i + 64, ndev->iov.max_vf_queues); in nitrox_pf2vf_mbox_handler()
161 vfdev = ndev->iov.vfdev + vfno; in nitrox_pf2vf_mbox_handler()
164 vfdev->msg.value = pf2vf_read_mbox(ndev, vfdev->ring); in nitrox_pf2vf_mbox_handler()
171 pfwork->ndev = ndev; in nitrox_pf2vf_mbox_handler()
173 queue_work(ndev->iov.pf2vf_wq, &pfwork->pf2vf_resp); in nitrox_pf2vf_mbox_handler()
175 nitrox_write_csr(ndev, reg_addr, BIT_ULL(i)); in nitrox_pf2vf_mbox_handler()
179 int nitrox_mbox_init(struct nitrox_device *ndev) in nitrox_mbox_init() argument
184 ndev->iov.vfdev = kcalloc(ndev->iov.num_vfs, in nitrox_mbox_init()
186 if (!ndev->iov.vfdev) in nitrox_mbox_init()
189 for (i = 0; i < ndev->iov.num_vfs; i++) { in nitrox_mbox_init()
190 vfdev = ndev->iov.vfdev + i; in nitrox_mbox_init()
195 ndev->iov.pf2vf_wq = alloc_workqueue("nitrox_pf2vf", 0, 0); in nitrox_mbox_init()
196 if (!ndev->iov.pf2vf_wq) { in nitrox_mbox_init()
197 kfree(ndev->iov.vfdev); in nitrox_mbox_init()
198 ndev->iov.vfdev = NULL; in nitrox_mbox_init()
202 enable_pf2vf_mbox_interrupts(ndev); in nitrox_mbox_init()
207 void nitrox_mbox_cleanup(struct nitrox_device *ndev) in nitrox_mbox_cleanup() argument
210 disable_pf2vf_mbox_interrupts(ndev); in nitrox_mbox_cleanup()
212 if (ndev->iov.pf2vf_wq) in nitrox_mbox_cleanup()
213 destroy_workqueue(ndev->iov.pf2vf_wq); in nitrox_mbox_cleanup()
215 kfree(ndev->iov.vfdev); in nitrox_mbox_cleanup()
216 ndev->iov.pf2vf_wq = NULL; in nitrox_mbox_cleanup()
217 ndev->iov.vfdev = NULL; in nitrox_mbox_cleanup()