rawdev: pass the device id as parameter to selftest
When running self-tests, the driver needs to know the device on which to run the tests, so we need to take the device ID as parameter. Only the skeleton driver is providing this selftest capability right now, so we can easily update it for this change. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
parent
88a81bcecb
commit
863fd2930b
@ -583,6 +583,8 @@ skeleton_rawdev_create(const char *name,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = rawdev->dev_id; /* return the rawdev id of new device */
|
||||
|
||||
rawdev->dev_ops = &skeleton_rawdev_ops;
|
||||
rawdev->device = &vdev->device;
|
||||
|
||||
@ -720,19 +722,19 @@ skeleton_rawdev_probe(struct rte_vdev_device *vdev)
|
||||
/* In case of invalid argument, selftest != 1; ignore other values */
|
||||
|
||||
ret = skeleton_rawdev_create(name, vdev, rte_socket_id());
|
||||
if (!ret) {
|
||||
if (ret >= 0) {
|
||||
/* In case command line argument for 'selftest' was passed;
|
||||
* if invalid arguments were passed, execution continues but
|
||||
* without selftest.
|
||||
*/
|
||||
if (selftest == 1)
|
||||
test_rawdev_skeldev();
|
||||
test_rawdev_skeldev(ret);
|
||||
}
|
||||
|
||||
/* Device instance created; Second instance not possible */
|
||||
skeldev_init_once = 1;
|
||||
|
||||
return ret;
|
||||
return ret < 0 ? ret : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -131,6 +131,6 @@ skeleton_rawdev_get_priv(const struct rte_rawdev *rawdev)
|
||||
return rawdev->dev_private;
|
||||
}
|
||||
|
||||
int test_rawdev_skeldev(void);
|
||||
int test_rawdev_skeldev(uint16_t dev_id);
|
||||
|
||||
#endif /* __SKELETON_RAWDEV_H__ */
|
||||
|
@ -426,8 +426,9 @@ static void skeldev_test_run(int (*setup)(void),
|
||||
}
|
||||
|
||||
int
|
||||
test_rawdev_skeldev(void)
|
||||
test_rawdev_skeldev(uint16_t dev_id)
|
||||
{
|
||||
test_dev_id = dev_id;
|
||||
testsuite_setup();
|
||||
|
||||
SKELDEV_TEST_RUN(NULL, NULL, test_rawdev_count);
|
||||
|
@ -378,7 +378,7 @@ rte_rawdev_selftest(uint16_t dev_id)
|
||||
struct rte_rawdev *dev = &rte_rawdevs[dev_id];
|
||||
|
||||
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
|
||||
return (*dev->dev_ops->dev_selftest)();
|
||||
return (*dev->dev_ops->dev_selftest)(dev_id);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -499,7 +499,7 @@ typedef int (*rawdev_firmware_unload_t)(struct rte_rawdev *dev);
|
||||
* @return
|
||||
* Return 0 on success
|
||||
*/
|
||||
typedef int (*rawdev_selftest_t)(void);
|
||||
typedef int (*rawdev_selftest_t)(uint16_t dev_id);
|
||||
|
||||
/** Rawdevice operations function pointer table */
|
||||
struct rte_rawdev_ops {
|
||||
|
Loading…
x
Reference in New Issue
Block a user