Skip to contentSkip to conversation

How is the backlog supposed to be used?

QUESTION Steffen Trumtrar 2 participants 2 messages Dec 1, 2014 – Dec 11, 2014 Crypto API

lore
Share & tools
lore
#0 lore raw

Hi all!

I have a question regarding the use of the backlog in a driver using the crypto API.
In my driver ("crypto: sahara - SHA support") I had a problem with using the backlog when I am using more than one thread to enqueue the requests and have a queue depth of 1. What happens is, that I run into the backlog and then complete the request twice, if I do it like all the other drivers. Random example:

	backlog = crypto_get_backlog(&sdcp->queue[chan]);
	arq = crypto_dequeue_request(&sdcp->queue[chan]);

	if (backlog)
		backlog->complete(backlog, -EINPROGRESS);

Everything works fine if I do not complete the request from the backlog, but instead complete the request when it is due.
Alternative: make the queue deeper like some drivers have it. If the queue is deeper than I have threads, it works, because the requests never get onto the backlog.
So, how is the queue intended to be used? What is a correct max_depth? Do I need to complete the requests from the backlog or not?

Thanks,
Steffen

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#1 lore raw
Quoted 7 lines · Steffen Trumtrar

Everything works fine if I do not complete the request from the backlog, but instead complete the request when it is due.
Alternative: make the queue deeper like some drivers have it. If the queue is deeper than I have threads, it works, because the requests never get onto the backlog.
So, how is the queue intended to be used? What is a correct max_depth?

The queue depth is up to the driver to determine.

Quoted 1 line

Do I need to complete the requests from the backlog or not?

Completing the backlog with EINPROGRESS is meant to indicate to the caller of the crypto API that we're now open to more requests.

What crypto API user were you using to test this?

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt