10b71caecb
Currently with the rawdev API there is no way to check that the structure passed in via the dev_private pointer in the dev_info structure is of the correct type - it's just checked that it is non-NULL. Adding in the length of the expected structure provides a measure of typechecking, and can also be used for ABI compatibility in future, since ABI changes involving structs almost always involve a change in size. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Rosen Xu <rosen.xu@intel.com> Acked-by: Rosen Xu <rosen.xu@intel.com> Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright 2017 NXP
|
|
*/
|
|
#include <rte_common.h>
|
|
#include <rte_mbuf.h>
|
|
#include <rte_malloc.h>
|
|
#include <rte_memcpy.h>
|
|
#include <rte_dev.h>
|
|
#include <rte_rawdev.h>
|
|
#include <rte_bus_vdev.h>
|
|
|
|
#include "test.h"
|
|
|
|
static int
|
|
test_rawdev_selftest_impl(const char *pmd, const char *opts)
|
|
{
|
|
rte_vdev_init(pmd, opts);
|
|
return rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
|
|
}
|
|
|
|
static int
|
|
test_rawdev_selftest_skeleton(void)
|
|
{
|
|
return test_rawdev_selftest_impl("rawdev_skeleton", "");
|
|
}
|
|
|
|
REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
|
|
|
|
static int
|
|
test_rawdev_selftest_ioat(void)
|
|
{
|
|
const int count = rte_rawdev_count();
|
|
int i;
|
|
|
|
for (i = 0; i < count; i++) {
|
|
struct rte_rawdev_info info = { .dev_private = NULL };
|
|
if (rte_rawdev_info_get(i, &info, 0) == 0 &&
|
|
strstr(info.driver_name, "ioat") != NULL)
|
|
return rte_rawdev_selftest(i) == 0 ?
|
|
TEST_SUCCESS : TEST_FAILED;
|
|
}
|
|
|
|
printf("No IOAT rawdev found, skipping tests\n");
|
|
return TEST_SKIPPED;
|
|
}
|
|
|
|
REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
|