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/tle_tcp.h | 72 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 12 deletions(-) (limited to 'lib/libtle_l4p/tle_tcp.h') diff --git a/lib/libtle_l4p/tle_tcp.h b/lib/libtle_l4p/tle_tcp.h index 9086658..b0cbda6 100644 --- a/lib/libtle_l4p/tle_tcp.h +++ b/lib/libtle_l4p/tle_tcp.h @@ -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: @@ -119,6 +119,16 @@ int tle_tcp_stream_get_addr(const struct tle_stream *s, struct tle_tcp_stream_addr *addr); +/** + * Get current TCP maximum segment size + * @param ts + * Stream to retrieve MSS information from. + * @return + * Maximum segment size in bytes, if successful. + * Negative on failure. + */ +int tle_tcp_stream_get_mss(const struct tle_stream *ts); + /** * Client mode connect API. */ @@ -257,6 +267,28 @@ uint32_t tle_tcp_stream_update_cfg(struct tle_stream *ts[], uint16_t tle_tcp_stream_recv(struct tle_stream *s, struct rte_mbuf *pkt[], uint16_t num); +/** + * Reads iovcnt buffers from the for given TCP stream. + * Note that the stream has to be in connected state. + * Data ordering is preserved. + * Buffers are processed in array order. + * This means that the function will comppletely fill iov[0] + * before proceeding to iov[1], and so on. + * If there is insufficient data, then not all buffers pointed to by iov + * may be filled. + * @param ts + * TCP stream to receive data from. + * @param iov + * Points to an array of iovec structures. + * @param iovcnt + * Number of elements in the *iov* array. + * @return + * On success, number of bytes read in the stream receive buffer. + * In case of error, returns -1 and error code will be set in rte_errno. + */ +ssize_t tle_tcp_stream_readv(struct tle_stream *ts, const struct iovec *iov, + int iovcnt); + /** * Consume and queue up to *num* packets, that will be sent eventually * by tle_tcp_tx_bulk(). @@ -281,13 +313,39 @@ uint16_t tle_tcp_stream_recv(struct tle_stream *s, struct rte_mbuf *pkt[], * number of packets successfully queued in the stream send buffer. * In case of error, error code can be set in rte_errno. * Possible rte_errno errors include: - * - EAGAIN - operation can be perfomed right now + * - EAGAIN - operation can't be perfomed right now * (most likely close() was perfomed on that stream allready). * - ENOTCONN - the stream is not connected. */ uint16_t tle_tcp_stream_send(struct tle_stream *s, struct rte_mbuf *pkt[], uint16_t num); +/** + * Writes iovcnt buffers of data described by iov to the for given TCP stream. + * Note that the stream has to be in connected state. + * Data ordering is preserved. + * Buffers are processed in array order. + * This means that the function will write out the entire contents of iov[0] + * before proceeding to iov[1], and so on. + * If there is insufficient space in stream send buffer, + * then not all buffers pointed to by iov may be written out. + * @param ts + * TCP stream to send data to. + * @param iov + * Points to an array of iovec structures. + * @param iovcnt + * Number of elements in the *iov* array. + * @return + * On success, number of bytes written to the stream send buffer. + * In case of error, returns -1 and error code will be set in rte_errno. + * - EAGAIN - operation can't be perfomed right now + * (most likely close() was perfomed on that stream allready). + * - ENOTCONN - the stream is not connected. + * - ENOMEM - not enough internal buffer (mbuf) to store user provided data. + */ +ssize_t tle_tcp_stream_writev(struct tle_stream *ts, struct rte_mempool *mp, + const struct iovec *iov, int iovcnt); + /** * Back End (BE) API. * BE API functions are not multi-thread safe. @@ -362,16 +420,6 @@ uint16_t tle_tcp_tx_bulk(struct tle_dev *dev, struct rte_mbuf *pkt[], */ int tle_tcp_process(struct tle_ctx *ctx, uint32_t num); -/** - * Get current TCP maximum segment size - * @param stream - * Stream to get MSS from. - * @return - * Maximum segment size in bytes, if successful. - * Negative on failure. - */ -int tle_tcp_stream_get_mss(const struct tle_stream * const stream); - #ifdef __cplusplus } #endif -- cgit 1.2.3-korg