event/dlb2: add v2.5 create sched domain
[dpdk.git] / drivers / event / dlb2 / pf / dlb2_main.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2020 Intel Corporation
3  */
4
5 #include <stdint.h>
6 #include <stdbool.h>
7 #include <stdio.h>
8 #include <errno.h>
9 #include <assert.h>
10 #include <unistd.h>
11 #include <string.h>
12
13 #include <rte_malloc.h>
14 #include <rte_errno.h>
15
16 #define DLB2_USE_NEW_HEADERS /* TEMPORARY FOR MERGE */
17
18 #include "base/dlb2_regs_new.h"
19 #include "base/dlb2_hw_types_new.h"
20 #include "base/dlb2_resource_new.h"
21 #include "base/dlb2_osdep.h"
22 #include "dlb2_main.h"
23 #include "../dlb2_user.h"
24 #include "../dlb2_priv.h"
25 #include "../dlb2_iface.h"
26 #include "../dlb2_inline_fns.h"
27
28 #define PF_ID_ZERO 0    /* PF ONLY! */
29 #define NO_OWNER_VF 0   /* PF ONLY! */
30 #define NOT_VF_REQ false /* PF ONLY! */
31
32 #define DLB2_PCI_CAP_POINTER 0x34
33 #define DLB2_PCI_CAP_NEXT(hdr) (((hdr) >> 8) & 0xFC)
34 #define DLB2_PCI_CAP_ID(hdr) ((hdr) & 0xFF)
35
36 #define DLB2_PCI_LNKCTL 16
37 #define DLB2_PCI_SLTCTL 24
38 #define DLB2_PCI_RTCTL 28
39 #define DLB2_PCI_EXP_DEVCTL2 40
40 #define DLB2_PCI_LNKCTL2 48
41 #define DLB2_PCI_SLTCTL2 56
42 #define DLB2_PCI_CMD 4
43 #define DLB2_PCI_EXP_DEVSTA 10
44 #define DLB2_PCI_EXP_DEVSTA_TRPND 0x20
45 #define DLB2_PCI_EXP_DEVCTL_BCR_FLR 0x8000
46
47 #define DLB2_PCI_CAP_ID_EXP       0x10
48 #define DLB2_PCI_CAP_ID_MSIX      0x11
49 #define DLB2_PCI_EXT_CAP_ID_PRI   0x13
50 #define DLB2_PCI_EXT_CAP_ID_ACS   0xD
51
52 #define DLB2_PCI_PRI_CTRL_ENABLE         0x1
53 #define DLB2_PCI_PRI_ALLOC_REQ           0xC
54 #define DLB2_PCI_PRI_CTRL                0x4
55 #define DLB2_PCI_MSIX_FLAGS              0x2
56 #define DLB2_PCI_MSIX_FLAGS_ENABLE       0x8000
57 #define DLB2_PCI_MSIX_FLAGS_MASKALL      0x4000
58 #define DLB2_PCI_ERR_ROOT_STATUS         0x30
59 #define DLB2_PCI_ERR_COR_STATUS          0x10
60 #define DLB2_PCI_ERR_UNCOR_STATUS        0x4
61 #define DLB2_PCI_COMMAND_INTX_DISABLE    0x400
62 #define DLB2_PCI_ACS_CAP                 0x4
63 #define DLB2_PCI_ACS_CTRL                0x6
64 #define DLB2_PCI_ACS_SV                  0x1
65 #define DLB2_PCI_ACS_RR                  0x4
66 #define DLB2_PCI_ACS_CR                  0x8
67 #define DLB2_PCI_ACS_UF                  0x10
68 #define DLB2_PCI_ACS_EC                  0x20
69
70 static int dlb2_pci_find_capability(struct rte_pci_device *pdev, uint32_t id)
71 {
72         uint8_t pos;
73         int ret;
74         uint16_t hdr;
75
76         ret = rte_pci_read_config(pdev, &pos, 1, DLB2_PCI_CAP_POINTER);
77         pos &= 0xFC;
78
79         if (ret != 1)
80                 return -1;
81
82         while (pos > 0x3F) {
83                 ret = rte_pci_read_config(pdev, &hdr, 2, pos);
84                 if (ret != 2)
85                         return -1;
86
87                 if (DLB2_PCI_CAP_ID(hdr) == id)
88                         return pos;
89
90                 if (DLB2_PCI_CAP_ID(hdr) == 0xFF)
91                         return -1;
92
93                 pos = DLB2_PCI_CAP_NEXT(hdr);
94         }
95
96         return -1;
97 }
98
99 static int
100 dlb2_pf_init_driver_state(struct dlb2_dev *dlb2_dev)
101 {
102         rte_spinlock_init(&dlb2_dev->resource_mutex);
103
104         return 0;
105 }
106
107 static void dlb2_pf_enable_pm(struct dlb2_dev *dlb2_dev)
108 {
109         int version;
110         version = DLB2_HW_DEVICE_FROM_PCI_ID(dlb2_dev->pdev);
111
112         dlb2_clr_pmcsr_disable(&dlb2_dev->hw, version);
113 }
114
115 #define DLB2_READY_RETRY_LIMIT 1000
116 static int dlb2_pf_wait_for_device_ready(struct dlb2_dev *dlb2_dev,
117                                          int dlb_version)
118 {
119         u32 retries = 0;
120
121         /* Allow at least 1s for the device to become active after power-on */
122         for (retries = 0; retries < DLB2_READY_RETRY_LIMIT; retries++) {
123                 u32 idle_val;
124                 u32 idle_dlb_func_idle;
125                 u32 pm_st_val;
126                 u32 pm_st_pmsm;
127                 u32 addr;
128
129                 addr = DLB2_CM_CFG_PM_STATUS(dlb_version);
130                 pm_st_val = DLB2_CSR_RD(&dlb2_dev->hw, addr);
131                 addr = DLB2_CM_CFG_DIAGNOSTIC_IDLE_STATUS(dlb_version);
132                 idle_val = DLB2_CSR_RD(&dlb2_dev->hw, addr);
133                 idle_dlb_func_idle = idle_val &
134                         DLB2_CM_CFG_DIAGNOSTIC_IDLE_STATUS_DLB_FUNC_IDLE;
135                 pm_st_pmsm = pm_st_val & DLB2_CM_CFG_PM_STATUS_PMSM;
136                 if (pm_st_pmsm && idle_dlb_func_idle)
137                         break;
138
139                 rte_delay_ms(1);
140         };
141
142         if (retries == DLB2_READY_RETRY_LIMIT) {
143                 DLB2_LOG_ERR("[%s()] wait for device ready timed out\n",
144                        __func__);
145                 return -1;
146         }
147
148         return 0;
149 }
150
151 struct dlb2_dev *
152 dlb2_probe(struct rte_pci_device *pdev)
153 {
154         struct dlb2_dev *dlb2_dev;
155         int ret = 0;
156         int dlb_version = 0;
157
158         DLB2_INFO(dlb2_dev, "probe\n");
159
160         dlb2_dev = rte_malloc("DLB2_PF", sizeof(struct dlb2_dev),
161                               RTE_CACHE_LINE_SIZE);
162
163         if (dlb2_dev == NULL) {
164                 ret = -ENOMEM;
165                 goto dlb2_dev_malloc_fail;
166         }
167
168         dlb_version = DLB2_HW_DEVICE_FROM_PCI_ID(pdev);
169
170         /* PCI Bus driver has already mapped bar space into process.
171          * Save off our IO register and FUNC addresses.
172          */
173
174         /* BAR 0 */
175         if (pdev->mem_resource[0].addr == NULL) {
176                 DLB2_ERR(dlb2_dev, "probe: BAR 0 addr (csr_kva) is NULL\n");
177                 ret = -EINVAL;
178                 goto pci_mmap_bad_addr;
179         }
180         dlb2_dev->hw.func_kva = (void *)(uintptr_t)pdev->mem_resource[0].addr;
181         dlb2_dev->hw.func_phys_addr = pdev->mem_resource[0].phys_addr;
182
183         DLB2_INFO(dlb2_dev, "DLB2 FUNC VA=%p, PA=%p, len=%p\n",
184                   (void *)dlb2_dev->hw.func_kva,
185                   (void *)dlb2_dev->hw.func_phys_addr,
186                   (void *)(pdev->mem_resource[0].len));
187
188         /* BAR 2 */
189         if (pdev->mem_resource[2].addr == NULL) {
190                 DLB2_ERR(dlb2_dev, "probe: BAR 2 addr (func_kva) is NULL\n");
191                 ret = -EINVAL;
192                 goto pci_mmap_bad_addr;
193         }
194         dlb2_dev->hw.csr_kva = (void *)(uintptr_t)pdev->mem_resource[2].addr;
195         dlb2_dev->hw.csr_phys_addr = pdev->mem_resource[2].phys_addr;
196
197         DLB2_INFO(dlb2_dev, "DLB2 CSR VA=%p, PA=%p, len=%p\n",
198                   (void *)dlb2_dev->hw.csr_kva,
199                   (void *)dlb2_dev->hw.csr_phys_addr,
200                   (void *)(pdev->mem_resource[2].len));
201
202         dlb2_dev->pdev = pdev;
203
204         /* PM enable must be done before any other MMIO accesses, and this
205          * setting is persistent across device reset.
206          */
207         dlb2_pf_enable_pm(dlb2_dev);
208
209         ret = dlb2_pf_wait_for_device_ready(dlb2_dev, dlb_version);
210         if (ret)
211                 goto wait_for_device_ready_fail;
212
213         ret = dlb2_pf_reset(dlb2_dev);
214         if (ret)
215                 goto dlb2_reset_fail;
216
217         ret = dlb2_pf_init_driver_state(dlb2_dev);
218         if (ret)
219                 goto init_driver_state_fail;
220
221         ret = dlb2_resource_init(&dlb2_dev->hw, dlb_version);
222         if (ret)
223                 goto resource_init_fail;
224
225         return dlb2_dev;
226
227 resource_init_fail:
228         dlb2_resource_free(&dlb2_dev->hw);
229 init_driver_state_fail:
230 dlb2_reset_fail:
231 pci_mmap_bad_addr:
232 wait_for_device_ready_fail:
233         rte_free(dlb2_dev);
234 dlb2_dev_malloc_fail:
235         rte_errno = ret;
236         return NULL;
237 }
238
239 int
240 dlb2_pf_reset(struct dlb2_dev *dlb2_dev)
241 {
242         int ret = 0;
243         int i = 0;
244         uint32_t dword[16];
245         uint16_t cmd;
246         off_t off;
247
248         uint16_t dev_ctl_word;
249         uint16_t dev_ctl2_word;
250         uint16_t lnk_word;
251         uint16_t lnk_word2;
252         uint16_t slt_word;
253         uint16_t slt_word2;
254         uint16_t rt_ctl_word;
255         uint32_t pri_reqs_dword;
256         uint16_t pri_ctrl_word;
257
258         int pcie_cap_offset;
259         int pri_cap_offset;
260         int msix_cap_offset;
261         int err_cap_offset;
262         int acs_cap_offset;
263         int wait_count;
264
265         uint16_t devsta_busy_word;
266         uint16_t devctl_word;
267
268         struct rte_pci_device *pdev = dlb2_dev->pdev;
269
270         /* Save PCI config state */
271
272         for (i = 0; i < 16; i++) {
273                 if (rte_pci_read_config(pdev, &dword[i], 4, i * 4) != 4)
274                         return ret;
275         }
276
277         pcie_cap_offset = dlb2_pci_find_capability(pdev, DLB2_PCI_CAP_ID_EXP);
278
279         if (pcie_cap_offset < 0) {
280                 DLB2_LOG_ERR("[%s()] failed to find the pcie capability\n",
281                        __func__);
282                 return pcie_cap_offset;
283         }
284
285         off = pcie_cap_offset + RTE_PCI_EXP_DEVCTL;
286         if (rte_pci_read_config(pdev, &dev_ctl_word, 2, off) != 2)
287                 dev_ctl_word = 0;
288
289         off = pcie_cap_offset + DLB2_PCI_LNKCTL;
290         if (rte_pci_read_config(pdev, &lnk_word, 2, off) != 2)
291                 lnk_word = 0;
292
293         off = pcie_cap_offset + DLB2_PCI_SLTCTL;
294         if (rte_pci_read_config(pdev, &slt_word, 2, off) != 2)
295                 slt_word = 0;
296
297         off = pcie_cap_offset + DLB2_PCI_RTCTL;
298         if (rte_pci_read_config(pdev, &rt_ctl_word, 2, off) != 2)
299                 rt_ctl_word = 0;
300
301         off = pcie_cap_offset + DLB2_PCI_EXP_DEVCTL2;
302         if (rte_pci_read_config(pdev, &dev_ctl2_word, 2, off) != 2)
303                 dev_ctl2_word = 0;
304
305         off = pcie_cap_offset + DLB2_PCI_LNKCTL2;
306         if (rte_pci_read_config(pdev, &lnk_word2, 2, off) != 2)
307                 lnk_word2 = 0;
308
309         off = pcie_cap_offset + DLB2_PCI_SLTCTL2;
310         if (rte_pci_read_config(pdev, &slt_word2, 2, off) != 2)
311                 slt_word2 = 0;
312
313         off = DLB2_PCI_EXT_CAP_ID_PRI;
314         pri_cap_offset = rte_pci_find_ext_capability(pdev, off);
315
316         if (pri_cap_offset >= 0) {
317                 off = pri_cap_offset + DLB2_PCI_PRI_ALLOC_REQ;
318                 if (rte_pci_read_config(pdev, &pri_reqs_dword, 4, off) != 4)
319                         pri_reqs_dword = 0;
320         }
321
322         /* clear the PCI command register before issuing the FLR */
323
324         off = DLB2_PCI_CMD;
325         cmd = 0;
326         if (rte_pci_write_config(pdev, &cmd, 2, off) != 2) {
327                 DLB2_LOG_ERR("[%s()] failed to write the pci command\n",
328                        __func__);
329                 return ret;
330         }
331
332         /* issue the FLR */
333         for (wait_count = 0; wait_count < 4; wait_count++) {
334                 int sleep_time;
335
336                 off = pcie_cap_offset + DLB2_PCI_EXP_DEVSTA;
337                 ret = rte_pci_read_config(pdev, &devsta_busy_word, 2, off);
338                 if (ret != 2) {
339                         DLB2_LOG_ERR("[%s()] failed to read the pci device status\n",
340                                __func__);
341                         return ret;
342                 }
343
344                 if (!(devsta_busy_word & DLB2_PCI_EXP_DEVSTA_TRPND))
345                         break;
346
347                 sleep_time = (1 << (wait_count)) * 100;
348                 rte_delay_ms(sleep_time);
349         }
350
351         if (wait_count == 4) {
352                 DLB2_LOG_ERR("[%s()] wait for pci pending transactions timed out\n",
353                        __func__);
354                 return -1;
355         }
356
357         off = pcie_cap_offset + RTE_PCI_EXP_DEVCTL;
358         ret = rte_pci_read_config(pdev, &devctl_word, 2, off);
359         if (ret != 2) {
360                 DLB2_LOG_ERR("[%s()] failed to read the pcie device control\n",
361                        __func__);
362                 return ret;
363         }
364
365         devctl_word |= DLB2_PCI_EXP_DEVCTL_BCR_FLR;
366
367         ret = rte_pci_write_config(pdev, &devctl_word, 2, off);
368         if (ret != 2) {
369                 DLB2_LOG_ERR("[%s()] failed to write the pcie device control\n",
370                        __func__);
371                 return ret;
372         }
373
374         rte_delay_ms(100);
375
376         /* Restore PCI config state */
377
378         if (pcie_cap_offset >= 0) {
379                 off = pcie_cap_offset + RTE_PCI_EXP_DEVCTL;
380                 ret = rte_pci_write_config(pdev, &dev_ctl_word, 2, off);
381                 if (ret != 2) {
382                         DLB2_LOG_ERR("[%s()] failed to write the pcie device control at offset %d\n",
383                                 __func__, (int)off);
384                         return ret;
385                 }
386
387                 off = pcie_cap_offset + DLB2_PCI_LNKCTL;
388                 ret = rte_pci_write_config(pdev, &lnk_word, 2, off);
389                 if (ret != 2) {
390                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
391                                 __func__, (int)off);
392                         return ret;
393                 }
394
395                 off = pcie_cap_offset + DLB2_PCI_SLTCTL;
396                 ret = rte_pci_write_config(pdev, &slt_word, 2, off);
397                 if (ret != 2) {
398                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
399                                 __func__, (int)off);
400                         return ret;
401                 }
402
403                 off = pcie_cap_offset + DLB2_PCI_RTCTL;
404                 ret = rte_pci_write_config(pdev, &rt_ctl_word, 2, off);
405                 if (ret != 2) {
406                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
407                                 __func__, (int)off);
408                         return ret;
409                 }
410
411                 off = pcie_cap_offset + DLB2_PCI_EXP_DEVCTL2;
412                 ret = rte_pci_write_config(pdev, &dev_ctl2_word, 2, off);
413                 if (ret != 2) {
414                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
415                                 __func__, (int)off);
416                         return ret;
417                 }
418
419                 off = pcie_cap_offset + DLB2_PCI_LNKCTL2;
420                 ret = rte_pci_write_config(pdev, &lnk_word2, 2, off);
421                 if (ret != 2) {
422                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
423                                 __func__, (int)off);
424                         return ret;
425                 }
426
427                 off = pcie_cap_offset + DLB2_PCI_SLTCTL2;
428                 ret = rte_pci_write_config(pdev, &slt_word2, 2, off);
429                 if (ret != 2) {
430                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
431                                 __func__, (int)off);
432                         return ret;
433                 }
434         }
435
436         if (pri_cap_offset >= 0) {
437                 pri_ctrl_word = DLB2_PCI_PRI_CTRL_ENABLE;
438
439                 off = pri_cap_offset + DLB2_PCI_PRI_ALLOC_REQ;
440                 ret = rte_pci_write_config(pdev, &pri_reqs_dword, 4, off);
441                 if (ret != 4) {
442                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
443                                 __func__, (int)off);
444                         return ret;
445                 }
446
447                 off = pri_cap_offset + DLB2_PCI_PRI_CTRL;
448                 ret = rte_pci_write_config(pdev, &pri_ctrl_word, 2, off);
449                 if (ret != 2) {
450                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
451                                 __func__, (int)off);
452                         return ret;
453                 }
454         }
455
456         off = RTE_PCI_EXT_CAP_ID_ERR;
457         err_cap_offset = rte_pci_find_ext_capability(pdev, off);
458
459         if (err_cap_offset >= 0) {
460                 uint32_t tmp;
461
462                 off = err_cap_offset + DLB2_PCI_ERR_ROOT_STATUS;
463                 if (rte_pci_read_config(pdev, &tmp, 4, off) != 4)
464                         tmp = 0;
465
466                 ret = rte_pci_write_config(pdev, &tmp, 4, off);
467                 if (ret != 4) {
468                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
469                                 __func__, (int)off);
470                         return ret;
471                 }
472
473                 off = err_cap_offset + DLB2_PCI_ERR_COR_STATUS;
474                 if (rte_pci_read_config(pdev, &tmp, 4, off) != 4)
475                         tmp = 0;
476
477                 ret = rte_pci_write_config(pdev, &tmp, 4, off);
478                 if (ret != 4) {
479                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
480                                 __func__, (int)off);
481                         return ret;
482                 }
483
484                 off = err_cap_offset + DLB2_PCI_ERR_UNCOR_STATUS;
485                 if (rte_pci_read_config(pdev, &tmp, 4, off) != 4)
486                         tmp = 0;
487
488                 ret = rte_pci_write_config(pdev, &tmp, 4, off);
489                 if (ret != 4) {
490                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
491                                 __func__, (int)off);
492                         return ret;
493                 }
494         }
495
496         for (i = 16; i > 0; i--) {
497                 off = (i - 1) * 4;
498                 ret = rte_pci_write_config(pdev, &dword[i - 1], 4, off);
499                 if (ret != 4) {
500                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
501                                 __func__, (int)off);
502                         return ret;
503                 }
504         }
505
506         off = DLB2_PCI_CMD;
507         if (rte_pci_read_config(pdev, &cmd, 2, off) == 2) {
508                 cmd &= ~DLB2_PCI_COMMAND_INTX_DISABLE;
509                 if (rte_pci_write_config(pdev, &cmd, 2, off) != 2) {
510                         DLB2_LOG_ERR("[%s()] failed to write the pci command\n",
511                                __func__);
512                         return ret;
513                 }
514         }
515
516         msix_cap_offset = dlb2_pci_find_capability(pdev,
517                                                    DLB2_PCI_CAP_ID_MSIX);
518         if (msix_cap_offset >= 0) {
519                 off = msix_cap_offset + DLB2_PCI_MSIX_FLAGS;
520                 if (rte_pci_read_config(pdev, &cmd, 2, off) == 2) {
521                         cmd |= DLB2_PCI_MSIX_FLAGS_ENABLE;
522                         cmd |= DLB2_PCI_MSIX_FLAGS_MASKALL;
523                         if (rte_pci_write_config(pdev, &cmd, 2, off) != 2) {
524                                 DLB2_LOG_ERR("[%s()] failed to write msix flags\n",
525                                        __func__);
526                                 return ret;
527                         }
528                 }
529
530                 off = msix_cap_offset + DLB2_PCI_MSIX_FLAGS;
531                 if (rte_pci_read_config(pdev, &cmd, 2, off) == 2) {
532                         cmd &= ~DLB2_PCI_MSIX_FLAGS_MASKALL;
533                         if (rte_pci_write_config(pdev, &cmd, 2, off) != 2) {
534                                 DLB2_LOG_ERR("[%s()] failed to write msix flags\n",
535                                        __func__);
536                                 return ret;
537                         }
538                 }
539         }
540
541         off = DLB2_PCI_EXT_CAP_ID_ACS;
542         acs_cap_offset = rte_pci_find_ext_capability(pdev, off);
543
544         if (acs_cap_offset >= 0) {
545                 uint16_t acs_cap, acs_ctrl, acs_mask;
546                 off = acs_cap_offset + DLB2_PCI_ACS_CAP;
547                 if (rte_pci_read_config(pdev, &acs_cap, 2, off) != 2)
548                         acs_cap = 0;
549
550                 off = acs_cap_offset + DLB2_PCI_ACS_CTRL;
551                 if (rte_pci_read_config(pdev, &acs_ctrl, 2, off) != 2)
552                         acs_ctrl = 0;
553
554                 acs_mask = DLB2_PCI_ACS_SV | DLB2_PCI_ACS_RR;
555                 acs_mask |= (DLB2_PCI_ACS_CR | DLB2_PCI_ACS_UF);
556                 acs_ctrl |= (acs_cap & acs_mask);
557
558                 ret = rte_pci_write_config(pdev, &acs_ctrl, 2, off);
559                 if (ret != 2) {
560                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
561                                 __func__, (int)off);
562                         return ret;
563                 }
564
565                 off = acs_cap_offset + DLB2_PCI_ACS_CTRL;
566                 if (rte_pci_read_config(pdev, &acs_ctrl, 2, off) != 2)
567                         acs_ctrl = 0;
568
569                 acs_mask = DLB2_PCI_ACS_RR | DLB2_PCI_ACS_CR;
570                 acs_mask |= DLB2_PCI_ACS_EC;
571                 acs_ctrl &= ~acs_mask;
572
573                 off = acs_cap_offset + DLB2_PCI_ACS_CTRL;
574                 ret = rte_pci_write_config(pdev, &acs_ctrl, 2, off);
575                 if (ret != 2) {
576                         DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
577                                 __func__, (int)off);
578                         return ret;
579                 }
580         }
581
582         return 0;
583 }
584
585 int
586 dlb2_pf_create_sched_domain(struct dlb2_hw *hw,
587                             struct dlb2_create_sched_domain_args *args,
588                             struct dlb2_cmd_response *resp)
589 {
590         return dlb2_hw_create_sched_domain(hw, args, resp, NOT_VF_REQ,
591                                            PF_ID_ZERO);
592 }
593
594 int
595 dlb2_pf_reset_domain(struct dlb2_hw *hw, u32 id)
596 {
597         return dlb2_reset_domain(hw, id, NOT_VF_REQ, PF_ID_ZERO);
598 }
599
600 int
601 dlb2_pf_create_ldb_queue(struct dlb2_hw *hw,
602                          u32 id,
603                          struct dlb2_create_ldb_queue_args *args,
604                          struct dlb2_cmd_response *resp)
605 {
606         return dlb2_hw_create_ldb_queue(hw, id, args, resp, NOT_VF_REQ,
607                                         PF_ID_ZERO);
608 }
609
610 int
611 dlb2_pf_create_ldb_port(struct dlb2_hw *hw,
612                         u32 id,
613                         struct dlb2_create_ldb_port_args *args,
614                         uintptr_t cq_dma_base,
615                         struct dlb2_cmd_response *resp)
616 {
617         return dlb2_hw_create_ldb_port(hw, id, args,
618                                        cq_dma_base,
619                                        resp,
620                                        NOT_VF_REQ,
621                                        PF_ID_ZERO);
622 }
623
624 int
625 dlb2_pf_create_dir_port(struct dlb2_hw *hw,
626                         u32 id,
627                         struct dlb2_create_dir_port_args *args,
628                         uintptr_t cq_dma_base,
629                         struct dlb2_cmd_response *resp)
630 {
631         return dlb2_hw_create_dir_port(hw, id, args,
632                                        cq_dma_base,
633                                        resp,
634                                        NOT_VF_REQ,
635                                        PF_ID_ZERO);
636 }
637
638 int
639 dlb2_pf_create_dir_queue(struct dlb2_hw *hw,
640                          u32 id,
641                          struct dlb2_create_dir_queue_args *args,
642                          struct dlb2_cmd_response *resp)
643 {
644         return dlb2_hw_create_dir_queue(hw, id, args, resp, NOT_VF_REQ,
645                                         PF_ID_ZERO);
646 }
647
648 int
649 dlb2_pf_start_domain(struct dlb2_hw *hw,
650                      u32 id,
651                      struct dlb2_start_domain_args *args,
652                      struct dlb2_cmd_response *resp)
653 {
654         return dlb2_hw_start_domain(hw, id, args, resp, NOT_VF_REQ,
655                                     PF_ID_ZERO);
656 }