On Fri, Jul 17, 2015 at 7:45 AM, Nicolas Morey-Chaisemartin <
[email protected]> wrote:

> This adds a fast case when trying to map a buffer within the first segment,
> which is always the case for non jumbo frames in the current linux-generic
>  implementation.
>
> This shows a sligh performance gain (mesure with pktio_perf).
> Before:
> Maximum packet rate: 1108398 PPS (388 Mbps)
> Maximum packet rate: 1116210 PPS (391 Mbps)
> Maximum packet rate: 1207031 PPS (423 Mbps)
> Maximum packet rate: 1121093 PPS (393 Mbps)
> Maximum packet rate: 1194335 PPS (419 Mbps)
>
> After:
> Maximum packet rate: 1331054 PPS (467 Mbps)
> Maximum packet rate: 1172851 PPS (411 Mbps)
> Maximum packet rate: 1156250 PPS (405 Mbps)
> Maximum packet rate: 1228515 PPS (431 Mbps)
> Maximum packet rate: 1314453 PPS (461 Mbps)
>
> Signed-off-by: Nicolas Morey-Chaisemartin <[email protected]>
>

Reviewed-by: Bill Fischofer <[email protected]>


> ---
>  platform/linux-generic/include/odp_buffer_inlines.h | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_buffer_inlines.h
> b/platform/linux-generic/include/odp_buffer_inlines.h
> index 74af38b..7e3633d 100644
> --- a/platform/linux-generic/include/odp_buffer_inlines.h
> +++ b/platform/linux-generic/include/odp_buffer_inlines.h
> @@ -122,9 +122,16 @@ static inline void *buffer_map(odp_buffer_hdr_t *buf,
>                                uint32_t *seglen,
>                                uint32_t limit)
>  {
> -       int seg_index  = offset / buf->segsize;
> -       int seg_offset = offset % buf->segsize;
> +       int seg_index;
> +       int seg_offset;
>
> +       if (odp_likely(offset < buf->segsize)) {
> +               seg_index = 0;
> +               seg_offset = offset;
> +       } else {
> +               seg_index  = offset / buf->segsize;
> +               seg_offset = offset % buf->segsize;
> +       }
>         if (seglen != NULL) {
>                 uint32_t buf_left = limit - offset;
>                 *seglen = seg_offset + buf_left <= buf->segsize ?
> --
> 2.4.5.3.g4915f6f
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to