On 27-Jun-19 11:40 AM, Bruce Richardson wrote:
Add the create/destroy driver functions so that we can actually allocate
a rawdev and destroy it when done. No rawdev API functions are actually
implemented at this point.

Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
---

<snip>

  ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
  {
-       RTE_SET_USED(name);
-       RTE_SET_USED(dev);
+       static const struct rte_rawdev_ops ioat_rawdev_ops = {
+       };
+
+       struct rte_rawdev *rawdev = NULL;
+       struct rte_ioat_rawdev *ioat = NULL;
+       int ret = 0;
+       int retry = 0;
+
+       if (!name) {
+               IOAT_PMD_ERR("Invalid name of the device!");
+               ret = -EINVAL;
+               goto cleanup;
+       }

Is checking `dev` not necessary here?

+
+       /* Allocate device structure */
+       rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct rte_ioat_rawdev),
+                                        dev->device.numa_node);
+       if (rawdev == NULL) {
+               IOAT_PMD_ERR("Unable to allocate raw device");
+               ret = -EINVAL;
+               goto cleanup;

EINVAL is supposed to be used to indicate invalid arguments. Inability to allocate is not an "invalid arguments" condition. Does rte_rawdev_pmd_allocate() set its own errno value? If so, perhaps it would be worth passing it on? If not, perhaps -ENOMEM would be a better return value?

--
Thanks,
Anatoly

Reply via email to