crypto/ccp: moving vdev to PCI driver
Subsystems (2)
PATCH v4 1/1 crypto/ccp: moving vdev to PCI driver
From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
develped for Enable IOMMU in vdev.
--- drivers/crypto/ccp/ccp_dev.c | 66 +------------ drivers/crypto/ccp/ccp_dev.h | 3 +- drivers/crypto/ccp/rte_ccp_pmd.c | 158 +++++++------------------------ 3 files changed, 41 insertions(+), 186 deletions(-)
drivers/crypto/ccp/ccp_dev.c +5 -61
@@ -650,73 +650,17 @@ is_ccp_device(const char *dirname, }static int -ccp_probe_device (const char *dirname,uint16_t domain, -uint8_t bus,uint8_t devid, -uint8_t function,int ccp_type) +ccp_probe_device (int ccp_type,struct rte_pci_device *pci_dev) {struct ccp_device *ccp_dev =NULL ; -struct rte_pci_device *pci; -char filename[PATH_MAX ]; -unsigned long tmp;int uio_fd =-1 ; ccp_dev =rte_zmalloc ("ccp_device" ,sizeof (*ccp_dev),RTE_CACHE_LINE_SIZE );if (ccp_dev ==NULL ) goto fail; - pci = &(ccp_dev->pci); - - pci->addr.domain = domain; - pci->addr.bus = bus; - pci->addr.devid = devid; - pci->addr.function = function; - -/* get vendor id */ -snprintf (filename,sizeof (filename),"%s/vendor" , dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.vendor_id = (uint16_t )tmp; - -/* get device id */ -snprintf (filename,sizeof (filename),"%s/device" , dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.device_id = (uint16_t )tmp; - -/* get subsystem_vendor id */ -snprintf (filename,sizeof (filename),"%s/subsystem_vendor" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.subsystem_vendor_id = (uint16_t )tmp; - -/* get subsystem_device id */ -snprintf (filename,sizeof (filename),"%s/subsystem_device" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.subsystem_device_id = (uint16_t )tmp; - -/* get class_id */ -snprintf (filename,sizeof (filename),"%s/class" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; -/* the least 24 bits are valid: class, subclass, program interface */ - pci->id.class_id = (uint32_t )tmp &RTE_CLASS_ANY_ID ; - -/* parse resources */ -snprintf (filename,sizeof (filename),"%s/resource" , dirname); -if (ccp_pci_parse_sysfs_resource (filename, pci) <0 ) - goto fail; -if (iommu_mode ==2 ) - pci->kdrv =RTE_PCI_KDRV_VFIO ; -else if (iommu_mode ==0 ) - pci->kdrv =RTE_PCI_KDRV_IGB_UIO ; -else if (iommu_mode ==1 ) - pci->kdrv =RTE_PCI_KDRV_UIO_GENERIC ; -rte_pci_map_device (pci); + ccp_dev->pci = *pci_dev;/* device is valid, add in list */ if (ccp_add_device (ccp_dev, ccp_type)) {
@@ -735,7 +679,8 @@ ccp_probe_device(const char *dirname, uint16_t domain, }int -ccp_probe_devices (const struct rte_pci_id *ccp_id) +ccp_probe_devices (struct rte_pci_device *pci_dev, +const struct rte_pci_id *ccp_id) {int dev_cnt =0 ;int ccp_type =0 ;
@@ -767,8 +712,7 @@ ccp_probe_devices(const struct rte_pci_id *ccp_id)if (is_ccp_device (dirname, ccp_id, &ccp_type)) {printf ("CCP : Detected CCP device with ID = 0x%x\n" , ccp_id[ccp_type].device_id); - ret =ccp_probe_device (dirname, domain, bus, devid, - function, ccp_type); + ret =ccp_probe_device (ccp_type, pci_dev);if (ret ==0 ) dev_cnt++; }
drivers/crypto/ccp/ccp_dev.h +2 -1
@@ -473,7 +473,8 @@ int ccp_dev_start(struct rte_cryptodev *dev);* @param ccp_id rte_pci_id list for supported CCP devices * @return no. of successfully initialized CCP devices */ -int ccp_probe_devices (const struct rte_pci_id *ccp_id); +int ccp_probe_devices (struct rte_pci_device *pci_dev, +const struct rte_pci_id *ccp_id);/** * allocate a ccp command queue
drivers/crypto/ccp/rte_ccp_pmd.c +34 -124
248 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 7 lines · On Fri, Jul 16, 2021 at 2:03 PM <[email protected]> wrote:
From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
develped for Enable IOMMU in vdev.Signed-off-by Amaranath Somalapuram <[email protected]>
Title does not follow DPDK convention.
https://doc.dpdk.org/guides/contributing/patches.html#commit-messages-subject-line
Commitlog has typos.
Please maintain a changelog to track changes between revisions.
https://doc.dpdk.org/guides/contributing/patches.html#creating-patches
We are already at v4 just for trivial checks.
It is easy to setup a github fork to at least pass github Actions checks. Check your patch _before_ sending to the mailing list, the contributing guide also contains hints for this.
Thanks.
Signature · 1 line
David Marchand
PATCH v5 1/1 crypto/ccp: moving vdev to PCI driver
In reply to [email protected]From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
develped for Enable IOMMU in vdev.
--- drivers/crypto/ccp/ccp_dev.c | 66 +------------ drivers/crypto/ccp/ccp_dev.h | 3 +- drivers/crypto/ccp/rte_ccp_pmd.c | 163 +++++++------------------------ 3 files changed, 44 insertions(+), 188 deletions(-)
drivers/crypto/ccp/ccp_dev.c +5 -61
@@ -650,73 +650,17 @@ is_ccp_device(const char *dirname, }static int -ccp_probe_device (const char *dirname,uint16_t domain, -uint8_t bus,uint8_t devid, -uint8_t function,int ccp_type) +ccp_probe_device (int ccp_type,struct rte_pci_device *pci_dev) {struct ccp_device *ccp_dev =NULL ; -struct rte_pci_device *pci; -char filename[PATH_MAX ]; -unsigned long tmp;int uio_fd =-1 ; ccp_dev =rte_zmalloc ("ccp_device" ,sizeof (*ccp_dev),RTE_CACHE_LINE_SIZE );if (ccp_dev ==NULL ) goto fail; - pci = &(ccp_dev->pci); - - pci->addr.domain = domain; - pci->addr.bus = bus; - pci->addr.devid = devid; - pci->addr.function = function; - -/* get vendor id */ -snprintf (filename,sizeof (filename),"%s/vendor" , dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.vendor_id = (uint16_t )tmp; - -/* get device id */ -snprintf (filename,sizeof (filename),"%s/device" , dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.device_id = (uint16_t )tmp; - -/* get subsystem_vendor id */ -snprintf (filename,sizeof (filename),"%s/subsystem_vendor" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.subsystem_vendor_id = (uint16_t )tmp; - -/* get subsystem_device id */ -snprintf (filename,sizeof (filename),"%s/subsystem_device" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.subsystem_device_id = (uint16_t )tmp; - -/* get class_id */ -snprintf (filename,sizeof (filename),"%s/class" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; -/* the least 24 bits are valid: class, subclass, program interface */ - pci->id.class_id = (uint32_t )tmp &RTE_CLASS_ANY_ID ; - -/* parse resources */ -snprintf (filename,sizeof (filename),"%s/resource" , dirname); -if (ccp_pci_parse_sysfs_resource (filename, pci) <0 ) - goto fail; -if (iommu_mode ==2 ) - pci->kdrv =RTE_PCI_KDRV_VFIO ; -else if (iommu_mode ==0 ) - pci->kdrv =RTE_PCI_KDRV_IGB_UIO ; -else if (iommu_mode ==1 ) - pci->kdrv =RTE_PCI_KDRV_UIO_GENERIC ; -rte_pci_map_device (pci); + ccp_dev->pci = *pci_dev;/* device is valid, add in list */ if (ccp_add_device (ccp_dev, ccp_type)) {
@@ -735,7 +679,8 @@ ccp_probe_device(const char *dirname, uint16_t domain, }int -ccp_probe_devices (const struct rte_pci_id *ccp_id) +ccp_probe_devices (struct rte_pci_device *pci_dev, +const struct rte_pci_id *ccp_id) {int dev_cnt =0 ;int ccp_type =0 ;
@@ -767,8 +712,7 @@ ccp_probe_devices(const struct rte_pci_id *ccp_id)if (is_ccp_device (dirname, ccp_id, &ccp_type)) {printf ("CCP : Detected CCP device with ID = 0x%x\n" , ccp_id[ccp_type].device_id); - ret =ccp_probe_device (dirname, domain, bus, devid, - function, ccp_type); + ret =ccp_probe_device (ccp_type, pci_dev);if (ret ==0 ) dev_cnt++; }
drivers/crypto/ccp/ccp_dev.h +2 -1
@@ -473,7 +473,8 @@ int ccp_dev_start(struct rte_cryptodev *dev);* @param ccp_id rte_pci_id list for supported CCP devices * @return no. of successfully initialized CCP devices */ -int ccp_probe_devices (const struct rte_pci_id *ccp_id); +int ccp_probe_devices (struct rte_pci_device *pci_dev, +const struct rte_pci_id *ccp_id);/** * allocate a ccp command queue
drivers/crypto/ccp/rte_ccp_pmd.c +37 -126
252 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 7 lines
From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
develped for Enable IOMMU in vdev.Signed-off-by: Amaranath Somalapuram
<[email protected]>
I believe v5 is sent without any change.
And you should supersede the previous version in patchworks.
Please address the comments from David on v4.
- changelog missing from v1->v5
- check typos in patch description.
- check guidelines suggested by David.
PATCH v6 1/1 crypto/ccp: move device from vdev to PCI
In reply to [email protected]From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
developed for enable IOMMU in vdev.
---
V6:
- Address the following comments from Akhil and David:
- Spellcheck, Title, Changelog
V5:
- Fix x86_64-native-linuxapp-clang compilation fix in other function
V4:
- x86_64-native-linuxapp-clang compilation fix created after changing pointer to array
V3:
- No changes. Ignore this patch
V2:
- No changes. Ignore this patch
--- drivers/crypto/ccp/ccp_dev.c | 66 +------------ drivers/crypto/ccp/ccp_dev.h | 3 +- drivers/crypto/ccp/rte_ccp_pmd.c | 163 +++++++------------------------ 3 files changed, 44 insertions(+), 188 deletions(-)
drivers/crypto/ccp/ccp_dev.c +5 -61
@@ -650,73 +650,17 @@ is_ccp_device(const char *dirname, }static int -ccp_probe_device (const char *dirname,uint16_t domain, -uint8_t bus,uint8_t devid, -uint8_t function,int ccp_type) +ccp_probe_device (int ccp_type,struct rte_pci_device *pci_dev) {struct ccp_device *ccp_dev =NULL ; -struct rte_pci_device *pci; -char filename[PATH_MAX ]; -unsigned long tmp;int uio_fd =-1 ; ccp_dev =rte_zmalloc ("ccp_device" ,sizeof (*ccp_dev),RTE_CACHE_LINE_SIZE );if (ccp_dev ==NULL ) goto fail; - pci = &(ccp_dev->pci); - - pci->addr.domain = domain; - pci->addr.bus = bus; - pci->addr.devid = devid; - pci->addr.function = function; - -/* get vendor id */ -snprintf (filename,sizeof (filename),"%s/vendor" , dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.vendor_id = (uint16_t )tmp; - -/* get device id */ -snprintf (filename,sizeof (filename),"%s/device" , dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.device_id = (uint16_t )tmp; - -/* get subsystem_vendor id */ -snprintf (filename,sizeof (filename),"%s/subsystem_vendor" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.subsystem_vendor_id = (uint16_t )tmp; - -/* get subsystem_device id */ -snprintf (filename,sizeof (filename),"%s/subsystem_device" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; - pci->id.subsystem_device_id = (uint16_t )tmp; - -/* get class_id */ -snprintf (filename,sizeof (filename),"%s/class" , - dirname); -if (ccp_pci_parse_sysfs_value (filename, &tmp) <0 ) - goto fail; -/* the least 24 bits are valid: class, subclass, program interface */ - pci->id.class_id = (uint32_t )tmp &RTE_CLASS_ANY_ID ; - -/* parse resources */ -snprintf (filename,sizeof (filename),"%s/resource" , dirname); -if (ccp_pci_parse_sysfs_resource (filename, pci) <0 ) - goto fail; -if (iommu_mode ==2 ) - pci->kdrv =RTE_PCI_KDRV_VFIO ; -else if (iommu_mode ==0 ) - pci->kdrv =RTE_PCI_KDRV_IGB_UIO ; -else if (iommu_mode ==1 ) - pci->kdrv =RTE_PCI_KDRV_UIO_GENERIC ; -rte_pci_map_device (pci); + ccp_dev->pci = *pci_dev;/* device is valid, add in list */ if (ccp_add_device (ccp_dev, ccp_type)) {
@@ -735,7 +679,8 @@ ccp_probe_device(const char *dirname, uint16_t domain, }int -ccp_probe_devices (const struct rte_pci_id *ccp_id) +ccp_probe_devices (struct rte_pci_device *pci_dev, +const struct rte_pci_id *ccp_id) {int dev_cnt =0 ;int ccp_type =0 ;
@@ -767,8 +712,7 @@ ccp_probe_devices(const struct rte_pci_id *ccp_id)if (is_ccp_device (dirname, ccp_id, &ccp_type)) {printf ("CCP : Detected CCP device with ID = 0x%x\n" , ccp_id[ccp_type].device_id); - ret =ccp_probe_device (dirname, domain, bus, devid, - function, ccp_type); + ret =ccp_probe_device (ccp_type, pci_dev);if (ret ==0 ) dev_cnt++; }
drivers/crypto/ccp/ccp_dev.h +2 -1
@@ -473,7 +473,8 @@ int ccp_dev_start(struct rte_cryptodev *dev);* @param ccp_id rte_pci_id list for supported CCP devices * @return no. of successfully initialized CCP devices */ -int ccp_probe_devices (const struct rte_pci_id *ccp_id); +int ccp_probe_devices (struct rte_pci_device *pci_dev, +const struct rte_pci_id *ccp_id);/** * allocate a ccp command queue
drivers/crypto/ccp/rte_ccp_pmd.c +37 -126
252 lines not on this page · raw message
Signature · 1 line
2.25.1
Akhil Goyal
AppliedRe: [dpdk-dev] [EXT] [PATCH v6] crypto/ccp: move device from vdev to PCI
Quoted 5 lines
From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
developed for enable IOMMU in vdev.
Quoted 7 lines
Signed-off-by: Amaranath Somalapuram <[email protected]>
---
V6:
- Address the following comments from Akhil and David:
- Spellcheck, Title, Changelog
Applied to dpdk-next-crypto
Re: [dpdk-dev] [PATCH v6] crypto/ccp: move device from vdev to PCI
In reply to [email protected]Hello Sunil,
Quoted 7 lines · On Mon, Jul 26, 2021 at 11:09 AM <[email protected]> wrote:
From: Amaranath Somalapuram <[email protected]>
drop all the code duplicating the PCI bus driver
developed for enable IOMMU in vdev.Signed-off-by Amaranath Somalapuram <[email protected]>
Looking back in history, this patch converted crypto/ccp to a PCI driver, but the associated doc is still about vdev.
https://doc.dpdk.org/guides/cryptodevs/ccp.html#initialization
And I also noticed some remnants, like:
drivers/crypto/ccp/meson.build:deps += 'bus_vdev' drivers/crypto/ccp/rte_ccp_pmd.c:#include <bus_vdev_driver.h>drivers/crypto/ccp/rte_ccp_pmd.c: CCP_LOG_ERR("failed to
create cryptodev vdev");
Can you send fixes?
Thanks.
Signature · 1 line
David Marchand