test/dma: run tests as per configured pmd
Subsystems (2)
cover test/dma: run tests as per configured pmd
This series enables dmadev tests to run as per configured PMDs, similar to other subsystem like cryptodev.
Gowrishankar Muthukrishnan (4):
dmadev: add function to get list of device identifiers test/dma: run tests according to PMD dma/cnxk: update PCI driver name
test/dma: enable cnxk tests
app/test/meson.build | 8 ++- app/test/test_dmadev.c | 96 ++++++++++++++++++++++++++-------- drivers/dma/cnxk/cnxk_dmadev.c | 8 +-- lib/dmadev/rte_dmadev.c | 20 +++++++ lib/dmadev/rte_dmadev.h | 21 ++++++++ lib/dmadev/version.map | 1 + 6 files changed, 128 insertions(+), 26 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/4 dmadev: add function to get list of device identifiers
Add a function to get list of device identifiers for a given driver name.
--- lib/dmadev/rte_dmadev.c | 20 ++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 21 +++++++++++++++++++++ lib/dmadev/version.map | 1 + 3 files changed, 42 insertions(+)
lib/dmadev/rte_dmadev.c +20 -0
@@ -388,6 +388,26 @@ rte_dma_get_dev_id_by_name(const char *name)return dev->data->dev_id; } +uint8_t +rte_dma_get_dev_list_by_driver (const char *name,int16_t *devs,uint8_t nb_devs) +{ +uint8_t i, count =0 ; + +if (name ==NULL ) +return count; + +for (i =0 ; i < dma_devices_max && count < nb_devs; i++) { +if (rte_dma_devices[i].state ==RTE_DMA_DEV_UNUSED ) +continue ; + +if (strncmp (rte_dma_devices[i].device->driver->name, + name,strlen (name) +1 ) ==0 ) + devs[count++] = i; + } + +return count; +} +bool rte_dma_is_valid (int16_t dev_id) {
lib/dmadev/rte_dmadev.h +21 -0
@@ -191,6 +191,27 @@ int rte_dma_dev_max(size_t dev_max);__rte_experimental int rte_dma_get_dev_id_by_name(const char *name); +/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice. +* +* Get the list of device identifiers for the DMA driver. +* +* @param name +* DMA driver name. +* @param devs +* Output devices identifiers. +* @param nb_devs +* Maximal number of devices. +* +* @return +* Returns number of device identifiers. +*/ +__rte_experimental +uint8_t rte_dma_get_dev_list_by_driver(const char *name, +int16_t *devs, +uint8_t nb_devs); +/** * @warning * @b EXPERIMENTAL: this API may change without prior notice.
lib/dmadev/version.map +1 -0
@@ -7,6 +7,7 @@ EXPERIMENTAL { rte_dma_dev_max; rte_dma_dump; rte_dma_get_dev_id_by_name; + rte_dma_get_dev_list_by_driver; rte_dma_info_get; rte_dma_is_valid; rte_dma_next_dev;
Signature · 1 line
2.25.1
Re: [PATCH 1/4] dmadev: add function to get list of device identifiers
Hi Gowrishankar,
This could create a help function in test, just like:
func() {
RTE_DMA_FOREACH_DEV(i) {
rte_dma_info_get(i, &dev_info);
if (strncmp(dev_info->dev_name, xxx)
...
}
}If some application (not test) should pick some specific device, I suggest add more general API, e.g.
typedef int (*rte_dma_filter_fn)(struct rte_dma_info *dev_info, void *param); uint16_t
rte_dma_get_devs_by_filter(rte_dma_filter_fn fn, void *param, uint16_t *dev_ids, uint16_t nb_ids) {
RTE_DMA_FOREACH_DEV(i) {
rte_dma_info_get(i, &dev_info);
if (fn(&dev_info, param) == 0) {
// add to out list
}
}
}So we could filter special name-prefix/capability/multi-vchans
Thanks.
Quoted 86 lines · Gowrishankar Muthukrishnan
Add a function to get list of device identifiers for a given driver name.
Signed-off-by Gowrishankar Muthukrishnan <[email protected]>--- lib/dmadev/rte_dmadev.c | 20 ++++++++++++++++++++ lib/dmadev/rte_dmadev.h | 21 +++++++++++++++++++++ lib/dmadev/version.map | 1 + 3 files changed, 42 insertions(+)lib/dmadev/rte_dmadev.c +20
-0@@ -388,6 +388,26 @@ rte_dma_get_dev_id_by_name(const char *name)return dev->data->dev_id; } +uint8_t +rte_dma_get_dev_list_by_driver (const char *name,int16_t *devs,uint8_t nb_devs) +{ +uint8_t i, count =0 ; + +if (name ==NULL ) +return count; + +for (i =0 ; i < dma_devices_max && count < nb_devs; i++) { +if (rte_dma_devices[i].state ==RTE_DMA_DEV_UNUSED ) +continue ; + +if (strncmp (rte_dma_devices[i].device->driver->name, + name,strlen (name) +1 ) ==0 ) + devs[count++] = i; + } + +return count; +} +bool rte_dma_is_valid (int16_t dev_id) {lib/dmadev/rte_dmadev.h +21
-0@@ -191,6 +191,27 @@ int rte_dma_dev_max(size_t dev_max);__rte_experimental int rte_dma_get_dev_id_by_name(const char *name); +/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice. +* +* Get the list of device identifiers for the DMA driver. +* +* @param name +* DMA driver name. +* @param devs +* Output devices identifiers. +* @param nb_devs +* Maximal number of devices. +* +* @return +* Returns number of device identifiers. +*/ +__rte_experimental +uint8_t rte_dma_get_dev_list_by_driver(const char *name, +int16_t *devs, +uint8_t nb_devs); +/** * @warning * @b EXPERIMENTAL: this API may change without prior notice. lib/dmadev/version.map +1
-0@@ -7,6 +7,7 @@ EXPERIMENTAL { rte_dma_dev_max; rte_dma_dump; rte_dma_get_dev_id_by_name; + rte_dma_get_dev_list_by_driver; rte_dma_info_get; rte_dma_is_valid; rte_dma_next_dev;
PATCH 2/4 test/dma: run tests according to PMD
In reply to Gowrishankar MuthukrishnanRun tests according to PMD configured.
--- app/test/meson.build | 7 +++- app/test/test_dmadev.c | 87 +++++++++++++++++++++++++++++++----------- 2 files changed, 71 insertions(+), 23 deletions(-)
app/test/meson.build +6 -1
@@ -319,7 +319,12 @@ driver_test_names = [ 'cryptodev_sw_snow3g_autotest', 'cryptodev_sw_zuc_autotest', 'cryptodev_uadk_autotest', - 'dmadev_autotest', + 'dmadev_dpaa_autotest', + 'dmadev_dpaa2_autotest', + 'dmadev_hisilicon_autotest', + 'dmadev_idxd_autotest', + 'dmadev_ioat_autotest', + 'dmadev_skeleton_autotest', ] dump_test_names = []
app/test/test_dmadev.c +65 -22
105 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 3/4 dma/cnxk: update PCI driver name
In reply to Gowrishankar MuthukrishnanFollow PCI driver naming convention standard across drivers.
--- drivers/dma/cnxk/cnxk_dmadev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/dma/cnxk/cnxk_dmadev.c +5 -3
@@ -17,6 +17,8 @@#include <roc_api.h> #include <cnxk_dmadev.h> +#define PCI_DRIVER_NAME dma_cnxk +static int cnxk_dmadev_info_get (const struct rte_dma_dev *dev,struct rte_dma_info *dev_info,uint32_t size)
@@ -719,6 +721,6 @@ static struct rte_pci_driver cnxk_dmadev = { .remove = cnxk_dmadev_remove, }; -RTE_PMD_REGISTER_PCI (cnxk_dmadev_pci_driver, cnxk_dmadev); -RTE_PMD_REGISTER_PCI_TABLE (cnxk_dmadev_pci_driver, cnxk_dma_pci_map); -RTE_PMD_REGISTER_KMOD_DEP (cnxk_dmadev_pci_driver,"vfio-pci" ); +RTE_PMD_REGISTER_PCI (PCI_DRIVER_NAME , cnxk_dmadev); +RTE_PMD_REGISTER_PCI_TABLE (PCI_DRIVER_NAME , cnxk_dma_pci_map); +RTE_PMD_REGISTER_KMOD_DEP (PCI_DRIVER_NAME ,"vfio-pci" );
Signature · 1 line
2.25.1
PATCH 4/4 test/dma: enable cnxk tests
In reply to Gowrishankar MuthukrishnanEnable DMA tests for CNXK driver.
--- app/test/meson.build | 1 + app/test/test_dmadev.c | 9 +++++++++ 2 files changed, 10 insertions(+)
app/test/meson.build +1 -0
@@ -319,6 +319,7 @@ driver_test_names = [ 'cryptodev_sw_snow3g_autotest', 'cryptodev_sw_zuc_autotest', 'cryptodev_uadk_autotest', + 'dmadev_cnxk_autotest', 'dmadev_dpaa_autotest', 'dmadev_dpaa2_autotest', 'dmadev_hisilicon_autotest',
app/test/test_dmadev.c +9 -0
@@ -1099,9 +1099,18 @@ test_ioat_dma(void)return test_dma (pmd); } +static int +test_cnxk_dma (void ) +{ +const char *pmd ="dma_cnxk" ; + +return test_dma (pmd); +} +REGISTER_TEST_COMMAND (dmadev_skeleton_autotest, test_skeleton_dma);REGISTER_TEST_COMMAND (dmadev_dpaa_autotest, test_dpaa_dma);REGISTER_TEST_COMMAND (dmadev_dpaa2_autotest, test_dpaa2_dma);REGISTER_TEST_COMMAND (dmadev_hisilicon_autotest, test_hisilicon_dma);REGISTER_TEST_COMMAND (dmadev_idxd_autotest, test_idxd_dma);REGISTER_TEST_COMMAND (dmadev_ioat_autotest, test_ioat_dma); +REGISTER_TEST_COMMAND (dmadev_cnxk_autotest, test_cnxk_dma);
Signature · 1 line
2.25.1