From 7e18fa1bf263822c46d7431a911b41d6377d5f69 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Thu, 27 Jul 2017 12:00:57 +0100 Subject: - Introduce tle_tcp_stream_readv() and tle_tcp_stream_writev(). - Introduce flags for tle_ctx_param. - Introduce TLE_CTX_FLAG_ST - indicates that given ctx will be used by single thread only. - Introduce new parameters for tcp context: timewait - allows user to configure max timeout in TCP_TIMEWAIT state. icw - allows user to specify desired initial congestion window for new connections. -Few optimisations: cache tx.ol_flags inside tle destination. calcualte and cache inside ctx cycles_to_ms shift value. reorder restoring SYN opts and filling TCB a bit. Change-Id: Ie05087783b3b7f1e4ce99d3555bc5bd098f83fe0 Signed-off-by: Konstantin Ananyev Signed-off-by: Mohammad Abdul Awal --- lib/libtle_l4p/ctx.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/libtle_l4p/ctx.c') diff --git a/lib/libtle_l4p/ctx.c b/lib/libtle_l4p/ctx.c index 6eb33eb..910fc88 100644 --- a/lib/libtle_l4p/ctx.c +++ b/lib/libtle_l4p/ctx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Intel Corporation. + * Copyright (c) 2016-2017 Intel Corporation. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -77,6 +78,7 @@ tle_ctx_create(const struct tle_ctx_param *ctx_prm) { struct tle_ctx *ctx; size_t sz; + uint64_t ms; uint32_t i; int32_t rc; @@ -95,6 +97,10 @@ tle_ctx_create(const struct tle_ctx_param *ctx_prm) return NULL; } + /* caclulate closest shift to convert from cycles to ms (approximate) */ + ms = (rte_get_tsc_hz() + MS_PER_S - 1) / MS_PER_S; + ctx->cycles_ms_shift = sizeof(ms) * CHAR_BIT - __builtin_clzll(ms) - 1; + ctx->prm = *ctx_prm; rc = tle_stream_ops[ctx_prm->proto].init_streams(ctx); @@ -195,6 +201,7 @@ struct tle_dev * tle_add_dev(struct tle_ctx *ctx, const struct tle_dev_param *dev_prm) { int32_t rc; + uint32_t df; struct tle_dev *dev; if (ctx == NULL || dev_prm == NULL || check_dev_prm(dev_prm) != 0) { @@ -247,7 +254,9 @@ tle_add_dev(struct tle_ctx *ctx, const struct tle_dev_param *dev_prm) } /* setup TX data. */ - tle_dring_reset(&dev->tx.dr); + df = ((ctx->prm.flags & TLE_CTX_FLAG_ST) == 0) ? 0 : + RING_F_SP_ENQ | RING_F_SC_DEQ; + tle_dring_reset(&dev->tx.dr, df); if ((dev_prm->tx_offload & DEV_TX_OFFLOAD_UDP_CKSUM) != 0 && ctx->prm.proto == TLE_PROTO_UDP) { -- cgit 1.2.3-korg