crypto/qat: fix memzone creation to use a fixed size string
PATCH 1/1 crypto/qat: fix memzone creation to use a fixed size string
Remove the dependency on dev->driver->pci_drv.name when creating the memzone for the qat hardware queues. The pci_drv.name may grow too large for RTE_MEMZONE_NAMESIZE.
--- drivers/crypto/qat/qat_qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_qp.c +1 -1
@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,* Allocate a memzone for the queue - create a unique name. */ snprintf (queue->memz_name,sizeof (queue->memz_name),"%s_%s_%d_%d_%d" , - dev->driver->pci_drv.name,"qp_mem" , dev->data->dev_id, +"qat_pmd" ,"qp_mem" , dev->data->dev_id, queue->hw_bundle_number, queue->hw_queue_number); qp_mz =queue_dma_zone_reserve (queue->memz_name, queue_size_bytes, socket_id);
Signature · 1 line
2.1.0
Quoted 3 lines · John Griffin
Remove the dependency on
dev->driver->pci_drv.namewhen creating the memzone for the qat hardware queues. The pci_drv.name may grow too large forRTE_MEMZONE_NAMESIZE.
Will the "may grow too large" cause any issues? If so, state it here. If not, marking this patch as a "fix" patch doesn't make sense to me then.
Quoted 13 lines
Fixes 1703e94ac5ce ("qat: add driver for QuickAssist devices")Signed-off-by John Griffin <[email protected]>--- drivers/crypto/qat/qat_qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/crypto/qat/qat_qp.c +0
-0
drivers/crypto/qat/qat_qp.c qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue, · line 303
Quoted 5 lines
drivers/crypto/qat/qat_qp.c +1
-1@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,* Allocate a memzone for the queue - create a unique name. */ snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d", - dev->driver->pci_drv.name, "qp_mem", dev->data->dev_id, + "qat_pmd", "qp_mem", dev->data->dev_id,
Besides that, why not putting "qat_pmd" and "qp_mem" inside the format string?
--yliu
Hi Liu,
Comments embedded.
Rgds,
John.
Quoted 7 lines · Yuanhan Liu
Quoted 3 lines · John Griffin
Remove the dependency on
dev->driver->pci_drv.namewhen creating the memzone for the qat hardware queues. The pci_drv.name may grow too large forRTE_MEMZONE_NAMESIZE.Will the "may grow too large" cause any issues? If so, state it here. If not, marking this patch as a "fix" patch doesn't make sense to me then.
We discovered this when applying a future patch (2141c21966) and it exposed this issue.
Problem is we create a memzone per hardware queue pair and if the memzone name is too large, then this code will not produce a unique name and two qps will end using the same memzone.
In retrospect, I'll wait for Pablo to apply that future patch and then re-base a v2.
Quoted 9 lines
Quoted 9 lines
Fixes 1703e94ac5ce ("qat: add driver for QuickAssist devices")Signed-off-by John Griffin <[email protected]>--- drivers/crypto/qat/qat_qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/crypto/qat/qat_qp.c qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue, · line 303
Quoted 10 lines
drivers/crypto/qat/qat_qp.c +1
-1@@ -300,7 +300,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue,* Allocate a memzone for the queue - create a unique name. */ snprintf(queue->memz_name, sizeof(queue->memz_name), "%s_%s_%d_%d_%d", - dev->driver->pci_drv.name, "qp_mem", dev->data->dev_id, + "qat_pmd", "qp_mem", dev->data->dev_id,Besides that, why not putting "
qat_pmd" and "qp_mem" inside the format string?
Fair point will send in the v2.
Quoted 3 lines
--yliu
Quoted 12 lines · John Griffin
Hi Liu,
Comments embedded.Rgds,
John.Quoted 5 lines · Yuanhan Liu
Quoted 3 lines · John Griffin
Remove the dependency on
dev->driver->pci_drv.namewhen creating the memzone for the qat hardware queues. The pci_drv.name may grow too large forRTE_MEMZONE_NAMESIZE.
Quoted 7 lines
Quoted 2 lines
Will the "may grow too large" cause any issues? If so, state it here. If not, marking this patch as a "fix" patch doesn't make sense to me then.
We discovered this when applying a future patch (
2141c21966) and it exposed this issue.
Problem is we create a memzone per hardware queue pair and if the memzone name is too large, then this code will not produce a unique name and two qps will end using the same memzone.
Thanks for the info, and I think you should put it in the commit log: it helps people to really know what might go wrong without this fix.
--yliu
Quoted 21 lines · Yuanhan Liu
Quoted 12 lines · John Griffin
Hi Liu,
Comments embedded.Rgds,
John.Quoted 5 lines · Yuanhan Liu
Quoted 3 lines · John Griffin
Remove the dependency on
dev->driver->pci_drv.namewhen creating the memzone for the qat hardware queues. The pci_drv.name may grow too large forRTE_MEMZONE_NAMESIZE.Quoted 7 lines
Quoted 2 lines
Will the "may grow too large" cause any issues? If so, state it here. If not, marking this patch as a "fix" patch doesn't make sense to me then.
We discovered this when applying a future patch (
2141c21966) and it exposed this issue.
Problem is we create a memzone per hardware queue pair and if the memzone name is too large, then this code will not produce a unique name and two qps will end using the same memzone.
Quoted 5 lines
Thanks for the info, and I think you should put it in the commit log: it helps people to really know what might go wrong without this fix.
--yliu
No problem. Yes will add to the v2.
Rgds,
John.