On 29 January 2015 at 12:18, Savolainen, Petri (NSN - FI/Espoo) <[email protected]> wrote: > Hi, > > Reviewed-by: Petri Savolainen <[email protected]> > > API changes are OK and can be merged today. > > > Two things should be fixed then on top of that. > > 1) odp_hw_random_get() > > This could be renamed to e.g. odp_rand() and moved out from crypto header > (odp_misc.h ?) > > size_t odp_rand(uint8_t *buf, size_t len, odp_bool_t use_entropy); > > Should it return number of bytes written, instead of output param *len? And I just used this call as a model for odp_cpumask_to_str() and odp_pktio_mac_addr()... I think we should look at all of these calls together. They are very similar and should follow the same model for specifying output buffer size, indicating success or error and returning the number of bytes written or the minimum required buffer size. Discussing each function in separation will only continue the current chaotic situation.
The call needs to be able to return error as well and we by convention use -1 (or any negative value) for that. This forces the function to have a signed return type. Which may or may not mix well with the normally unsigned buffer size parameter. We could use ssize_t (or int) for both output buffer size and return value though. Perhaps you should read my email on this subject: http://lists.linaro.org/pipermail/lng-odp/2015-January/008235.html > > > 2) > Correct sequences to free a compl event needs to be specified more clearly. > There seems to be only one right now? > > compl = odp_crypto_compl_from_event(ev); > > odp_crypto_compl_result(compl, &result); > odp_crypto_compl_free(compl); > > if(result.pkt != ODP_PACKET_INVALID) > odp_packet_free(result.pkt) > > > > Simple free call would result memory leak because the result packet would not > be freed: > > compl = odp_crypto_compl_from_event(ev); > odp_crypto_compl_free(compl); > > > >> + >> +/** >> + * Release crypto completion event >> + * >> + * @param completion_event Completion event we are done accessing > > e.g. > @note User needs to free the potential result packet. This call frees the > completion event only. > >> + */ >> +void >> +odp_crypto_compl_free(odp_crypto_compl_t completion_event); > > > > > -Petri > > > > _______________________________________________ > lng-odp mailing list > [email protected] > http://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
