2017-04-01 16:59:11

by Haren Myneni

[permalink] [raw]
Subject: [PATCH 1/5] crypto/nx: Rename nx842_powernv_function as icswx function

[PATCH 1/5] crypto/nx: Rename nx842_powernv_function as icswx function

nx842_powernv_function is points to nx842_icswx_function and
will be point to VAS function which will be added later for
P9 NX support.

Signed-off-by: Haren Myneni <[email protected]>
---
drivers/crypto/nx/nx-842-powernv.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c
index 3abb045..125f1dc 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -47,14 +47,22 @@ struct nx842_workmem {

struct nx842_coproc {
unsigned int chip_id;
- unsigned int ct;
- unsigned int ci;
+ union {
+ struct {
+ unsigned int ct;
+ unsigned int ci;
+ } icswx;
+ };
struct list_head list;
};

/* no cpu hotplug on powernv, so this list never changes after init */
static LIST_HEAD(nx842_coprocs);
-static unsigned int nx842_ct;
+static unsigned int nx842_ct; /* use with icswx function */
+
+static int (*nx842_powernv_function)(const unsigned char *in,
+ unsigned int inlen, unsigned char *out,
+ unsigned int *outlenp, void *workmem, int fc);

/**
* setup_indirect_dde - Setup an indirect DDE
@@ -355,7 +363,7 @@ static int wait_for_csb(struct nx842_workmem *wmem,
}

/**
- * nx842_powernv_function - compress/decompress data using the 842 algorithm
+ * nx842_icswx_function - compress/decompress data using the 842 algorithm
*
* (De)compression provided by the NX842 coprocessor on IBM PowerNV systems.
* This compresses or decompresses the provided input buffer into the provided
@@ -385,7 +393,7 @@ static int wait_for_csb(struct nx842_workmem *wmem,
* -ETIMEDOUT hardware did not complete operation in reasonable time
* -EINTR operation was aborted
*/
-static int nx842_powernv_function(const unsigned char *in, unsigned int inlen,
+static int nx842_icswx_function(const unsigned char *in, unsigned int inlen,
unsigned char *out, unsigned int *outlenp,
void *workmem, int fc)
{
@@ -554,8 +562,8 @@ static int __init nx842_powernv_probe(struct device_node *dn)
return -ENOMEM;

coproc->chip_id = chip_id;
- coproc->ct = ct;
- coproc->ci = ci;
+ coproc->icswx.ct = ct;
+ coproc->icswx.ci = ci;
INIT_LIST_HEAD(&coproc->list);
list_add(&coproc->list, &nx842_coprocs);

@@ -625,6 +633,8 @@ static __init int nx842_powernv_init(void)
if (!nx842_ct)
return -ENODEV;

+ nx842_powernv_function = nx842_icswx_function;
+
ret = crypto_register_alg(&nx842_powernv_alg);
if (ret) {
struct nx842_coproc *coproc, *n;
--
1.8.3.1


2017-04-04 11:11:51

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 1/5] crypto/nx: Rename nx842_powernv_function as icswx function

Haren Myneni <[email protected]> writes:

> [PATCH 1/5] crypto/nx: Rename nx842_powernv_function as icswx function
>
> nx842_powernv_function is points to nx842_icswx_function and
> will be point to VAS function which will be added later for
> P9 NX support.

I know it's nit-picking but can you give it a better name while you're
there.

I was thinking it should be called "send" or something, but it actually
synchronously sends and waits for a request.

So perhaps just nx842_exec(), for "execute a request", and then you can
have nx842_exec_icswx() and nx842_exec_vas().

cheers

2017-04-05 03:32:20

by Haren Myneni

[permalink] [raw]
Subject: Re: [PATCH 1/5] crypto/nx: Rename nx842_powernv_function as icswx function

On 04/04/2017 04:11 AM, Michael Ellerman wrote:
> Haren Myneni <[email protected]> writes:
>
>> [PATCH 1/5] crypto/nx: Rename nx842_powernv_function as icswx function
>>
>> nx842_powernv_function is points to nx842_icswx_function and
>> will be point to VAS function which will be added later for
>> P9 NX support.
>
> I know it's nit-picking but can you give it a better name while you're
> there.
>
> I was thinking it should be called "send" or something, but it actually
> synchronously sends and waits for a request.
>
> So perhaps just nx842_exec(), for "execute a request", and then you can
> have nx842_exec_icswx() and nx842_exec_vas().
>
> cheers
>

Michael,

Thanks for review,

nx842_powernv_function() was used before, So just renamed similar to this name. But I will make changes in the next version.

Haren