Lines Matching defs:ndev

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