* [PATCH 0/2] crypto: marvell - Remove custom swap function in favor of built-in sort swap
@ 2024-08-11 6:28 Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 1/2] crypto: octeontx " Kuan-Wei Chiu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kuan-Wei Chiu @ 2024-08-11 6:28 UTC (permalink / raw)
To: bbrezillon, arno, schalla
Cc: herbert, davem, jserv, linux-crypto, linux-kernel, Kuan-Wei Chiu
The custom swap function used in octeontx/octeontx2 driver do not
perform any special operations and can be replaced with the built-in
swap function of sort. This change not only reduces code size but also
improves efficiency, especially in scenarios where CONFIG_RETPOLINE is
enabled, as it makes indirect function calls more expensive.
By using the built-in swap, we avoid these costly indirect function
calls, leading to better performance.
Kuan-Wei Chiu (2):
crypto: octeontx - Remove custom swap function in favor of built-in
sort swap
crypto: octeontx2 - Remove custom swap functions in favor of built-in
sort swap
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c | 12 ++----------
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c | 10 +---------
2 files changed, 3 insertions(+), 19 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] crypto: octeontx - Remove custom swap function in favor of built-in sort swap
2024-08-11 6:28 [PATCH 0/2] crypto: marvell - Remove custom swap function in favor of built-in sort swap Kuan-Wei Chiu
@ 2024-08-11 6:28 ` Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 2/2] crypto: octeontx2 - Remove custom swap functions " Kuan-Wei Chiu
2024-08-17 7:09 ` [PATCH 0/2] crypto: marvell - Remove custom swap function " Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Kuan-Wei Chiu @ 2024-08-11 6:28 UTC (permalink / raw)
To: bbrezillon, arno, schalla
Cc: herbert, davem, jserv, linux-crypto, linux-kernel, Kuan-Wei Chiu
The custom swap function used in octeontx driver do not perform any
special operations and can be replaced with the built-in swap function
of sort. This change not only reduces code size but also improves
efficiency, especially in scenarios where CONFIG_RETPOLINE is enabled,
as it makes indirect function calls more expensive.
By using the built-in swap, we avoid these costly indirect function
calls, leading to better performance.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
Note: Build test only.
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
index 3c5d577d8f0d..e53c79fe6342 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
@@ -1613,14 +1613,6 @@ static int compare_func(const void *lptr, const void *rptr)
return 0;
}
-static void swap_func(void *lptr, void *rptr, int size)
-{
- struct cpt_device_desc *ldesc = (struct cpt_device_desc *) lptr;
- struct cpt_device_desc *rdesc = (struct cpt_device_desc *) rptr;
-
- swap(*ldesc, *rdesc);
-}
-
int otx_cpt_crypto_init(struct pci_dev *pdev, struct module *mod,
enum otx_cptpf_type pf_type,
enum otx_cptvf_type engine_type,
@@ -1655,7 +1647,7 @@ int otx_cpt_crypto_init(struct pci_dev *pdev, struct module *mod,
is_crypto_registered = true;
}
sort(se_devices.desc, count, sizeof(struct cpt_device_desc),
- compare_func, swap_func);
+ compare_func, NULL);
break;
case OTX_CPT_AE_TYPES:
@@ -1670,7 +1662,7 @@ int otx_cpt_crypto_init(struct pci_dev *pdev, struct module *mod,
ae_devices.desc[count++].dev = pdev;
atomic_inc(&ae_devices.count);
sort(ae_devices.desc, count, sizeof(struct cpt_device_desc),
- compare_func, swap_func);
+ compare_func, NULL);
break;
default:
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] crypto: octeontx2 - Remove custom swap functions in favor of built-in sort swap
2024-08-11 6:28 [PATCH 0/2] crypto: marvell - Remove custom swap function in favor of built-in sort swap Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 1/2] crypto: octeontx " Kuan-Wei Chiu
@ 2024-08-11 6:28 ` Kuan-Wei Chiu
2024-08-17 7:09 ` [PATCH 0/2] crypto: marvell - Remove custom swap function " Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Kuan-Wei Chiu @ 2024-08-11 6:28 UTC (permalink / raw)
To: bbrezillon, arno, schalla
Cc: herbert, davem, jserv, linux-crypto, linux-kernel, Kuan-Wei Chiu
The custom swap functions used in octeontx2 driver do not perform any
special operations and can be replaced with the built-in swap function
of sort. This change not only reduces code size but also improves
efficiency, especially in scenarios where CONFIG_RETPOLINE is enabled,
as it makes indirect function calls more expensive.
By using the built-in swap, we avoid these costly indirect function
calls, leading to better performance.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
Note: Build test only.
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
index 1604fc58dc13..ff7cc8c13e73 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
@@ -1702,14 +1702,6 @@ static int compare_func(const void *lptr, const void *rptr)
return 0;
}
-static void swap_func(void *lptr, void *rptr, int size)
-{
- struct cpt_device_desc *ldesc = lptr;
- struct cpt_device_desc *rdesc = rptr;
-
- swap(*ldesc, *rdesc);
-}
-
int otx2_cpt_crypto_init(struct pci_dev *pdev, struct module *mod,
int num_queues, int num_devices)
{
@@ -1739,7 +1731,7 @@ int otx2_cpt_crypto_init(struct pci_dev *pdev, struct module *mod,
is_crypto_registered = true;
}
sort(se_devices.desc, count, sizeof(struct cpt_device_desc),
- compare_func, swap_func);
+ compare_func, NULL);
unlock:
mutex_unlock(&mutex);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] crypto: marvell - Remove custom swap function in favor of built-in sort swap
2024-08-11 6:28 [PATCH 0/2] crypto: marvell - Remove custom swap function in favor of built-in sort swap Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 1/2] crypto: octeontx " Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 2/2] crypto: octeontx2 - Remove custom swap functions " Kuan-Wei Chiu
@ 2024-08-17 7:09 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2024-08-17 7:09 UTC (permalink / raw)
To: Kuan-Wei Chiu
Cc: bbrezillon, arno, schalla, davem, jserv, linux-crypto,
linux-kernel
On Sun, Aug 11, 2024 at 02:28:15PM +0800, Kuan-Wei Chiu wrote:
> The custom swap function used in octeontx/octeontx2 driver do not
> perform any special operations and can be replaced with the built-in
> swap function of sort. This change not only reduces code size but also
> improves efficiency, especially in scenarios where CONFIG_RETPOLINE is
> enabled, as it makes indirect function calls more expensive.
>
> By using the built-in swap, we avoid these costly indirect function
> calls, leading to better performance.
>
> Kuan-Wei Chiu (2):
> crypto: octeontx - Remove custom swap function in favor of built-in
> sort swap
> crypto: octeontx2 - Remove custom swap functions in favor of built-in
> sort swap
>
> drivers/crypto/marvell/octeontx/otx_cptvf_algs.c | 12 ++----------
> drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c | 10 +---------
> 2 files changed, 3 insertions(+), 19 deletions(-)
>
> --
> 2.34.1
All applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-17 7:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-11 6:28 [PATCH 0/2] crypto: marvell - Remove custom swap function in favor of built-in sort swap Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 1/2] crypto: octeontx " Kuan-Wei Chiu
2024-08-11 6:28 ` [PATCH 2/2] crypto: octeontx2 - Remove custom swap functions " Kuan-Wei Chiu
2024-08-17 7:09 ` [PATCH 0/2] crypto: marvell - Remove custom swap function " Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).