TAS
TCP Acceleration as an OS Service
Data Structures | Macros | Enumerations | Functions
Libtas-ll

Application library for TAS lowlevel interface. More...

Data Structures

struct  flextcp_context
 
struct  flextcp_listener
 
struct  flextcp_connection
 
struct  flextcp_event
 

Macros

#define FLEXTCP_MAX_CONTEXTS   32
 
#define FLEXTCP_MAX_FTCPCORES   16
 
#define FLEXTCP_LISTEN_REUSEPORT   0x1
 

Enumerations

enum  flextcp_event_type {
  FLEXTCP_EV_LISTEN_OPEN, FLEXTCP_EV_LISTEN_NEWCONN, FLEXTCP_EV_LISTEN_ACCEPT, FLEXTCP_EV_CONN_OPEN,
  FLEXTCP_EV_CONN_CLOSED, FLEXTCP_EV_CONN_RECEIVED, FLEXTCP_EV_CONN_SENDBUF, FLEXTCP_EV_CONN_RXCLOSED,
  FLEXTCP_EV_CONN_TXCLOSED, FLEXTCP_EV_CONN_MOVED
}
 

Functions

int flextcp_init (void)
 
int flextcp_context_create (struct flextcp_context *ctx)
 
int flextcp_context_poll (struct flextcp_context *ctx, int num, struct flextcp_event *events)
 
int flextcp_context_waitfd (struct flextcp_context *ctx)
 
int flextcp_context_canwait (struct flextcp_context *ctx)
 
void flextcp_context_waitclear (struct flextcp_context *ctx)
 
int flextcp_context_wait (struct flextcp_context *ctx, int timeout_ms)
 
int flextcp_listen_open (struct flextcp_context *ctx, struct flextcp_listener *lst, uint16_t port, uint32_t backlog, uint32_t flags)
 
int flextcp_listen_accept (struct flextcp_context *ctx, struct flextcp_listener *lst, struct flextcp_connection *conn)
 
int flextcp_connection_open (struct flextcp_context *ctx, struct flextcp_connection *conn, uint32_t dst_ip, uint16_t dst_port)
 
int flextcp_connection_close (struct flextcp_context *ctx, struct flextcp_connection *conn)
 
int flextcp_connection_rx_done (struct flextcp_context *ctx, struct flextcp_connection *conn, size_t len)
 
ssize_t flextcp_connection_tx_alloc (struct flextcp_connection *conn, size_t len, void **buf)
 
ssize_t flextcp_connection_tx_alloc2 (struct flextcp_connection *conn, size_t len, void **buf_1, size_t *len_1, void **buf_2)
 
int flextcp_connection_tx_send (struct flextcp_context *ctx, struct flextcp_connection *conn, size_t len)
 
int flextcp_connection_tx_close (struct flextcp_context *ctx, struct flextcp_connection *conn)
 
int flextcp_connection_tx_possible (struct flextcp_context *ctx, struct flextcp_connection *conn)
 
int flextcp_connection_move (struct flextcp_context *ctx, struct flextcp_connection *conn)
 

Detailed Description

Application library for TAS lowlevel interface.

Enumeration Type Documentation

◆ flextcp_event_type

Types of events that can occur in flextcp contexts

Enumerator
FLEXTCP_EV_LISTEN_OPEN 

flextcp_listen_open() result.

FLEXTCP_EV_LISTEN_NEWCONN 

New connection on listening socket arrived.

FLEXTCP_EV_LISTEN_ACCEPT 

Accept operation completed

FLEXTCP_EV_CONN_OPEN 

flextcp_connection_open() result

FLEXTCP_EV_CONN_CLOSED 

Connection was closed

FLEXTCP_EV_CONN_RECEIVED 

Data arrived on connection

FLEXTCP_EV_CONN_SENDBUF 

More send buffer available

FLEXTCP_EV_CONN_RXCLOSED 

Receive stream closed

FLEXTCP_EV_CONN_TXCLOSED 

transmit stream closed

FLEXTCP_EV_CONN_MOVED 

Connection moved to new context

Definition at line 145 of file tas_ll.h.

Function Documentation

◆ flextcp_connection_close()

int flextcp_connection_close ( struct flextcp_context ctx,
struct flextcp_connection conn 
)

Close a connection (asynchronous).

Definition at line 161 of file conn.c.

◆ flextcp_connection_move()

int flextcp_connection_move ( struct flextcp_context ctx,
struct flextcp_connection conn 
)

Move connection to specfied context

Definition at line 397 of file conn.c.

References CONN_CLOSED, flextcp_connection::txb_allocated, and flextcp_connection::txb_sent.

◆ flextcp_connection_open()

int flextcp_connection_open ( struct flextcp_context ctx,
struct flextcp_connection conn,
uint32_t  dst_ip,
uint16_t  dst_port 
)

Open a connection (asynchronous).

Definition at line 123 of file conn.c.

◆ flextcp_connection_rx_done()

int flextcp_connection_rx_done ( struct flextcp_context ctx,
struct flextcp_connection conn,
size_t  len 
)

Receive processing for `len' bytes done.

Definition at line 223 of file conn.c.

References flextcp_connection::rxb_bump, and flextcp_connection::rxb_used.

◆ flextcp_connection_tx_alloc()

ssize_t flextcp_connection_tx_alloc ( struct flextcp_connection conn,
size_t  len,
void **  buf 
)

Allocate transmit buffer for `len' bytes, returns number of bytes allocated.

NOTE: short allocs can occur if buffer wraps around

Definition at line 242 of file conn.c.

References flextcp_connection::txb_allocated, and flextcp_connection::txb_head.

◆ flextcp_connection_tx_alloc2()

ssize_t flextcp_connection_tx_alloc2 ( struct flextcp_connection conn,
size_t  len,
void **  buf_1,
size_t *  len_1,
void **  buf_2 
)

Allocate transmit buffer for `len' bytes, returns number of bytes allocated. May be split across two buffers, in case of wrap around.

Definition at line 277 of file conn.c.

References flextcp_connection::txb_allocated, and flextcp_connection::txb_head.

◆ flextcp_connection_tx_close()

int flextcp_connection_tx_close ( struct flextcp_context ctx,
struct flextcp_connection conn 
)

Send previously allocated bytes in transmit buffer

Definition at line 337 of file conn.c.

References flextcp_connection::txb_bump, flextcp_connection::txb_head, and flextcp_connection::txb_sent.

◆ flextcp_connection_tx_possible()

int flextcp_connection_tx_possible ( struct flextcp_context ctx,
struct flextcp_connection conn 
)

Make sure there is room in the context send queue (not send buffer)

Returns 0 if transmit is possible, -1 otherwise.

Definition at line 386 of file conn.c.

◆ flextcp_connection_tx_send()

int flextcp_connection_tx_send ( struct flextcp_context ctx,
struct flextcp_connection conn,
size_t  len 
)

Send previously allocated bytes in transmit buffer

Definition at line 314 of file conn.c.

References flextcp_connection::txb_allocated, flextcp_connection::txb_bump, flextcp_connection::txb_head, and flextcp_connection::txb_sent.

◆ flextcp_context_canwait()

int flextcp_context_canwait ( struct flextcp_context ctx)

Indicates whether the caller is allowed to block on the wait file descriptor on this context after this call returns.

Returns
0 if wait is allowed, -1 otherwise.

Definition at line 930 of file init.c.

References flexnic_info::poll_cycle_app.

Referenced by flextcp_context_wait().

◆ flextcp_context_create()

int flextcp_context_create ( struct flextcp_context ctx)

Create a flextcp context.

Definition at line 90 of file init.c.

◆ flextcp_context_poll()

int flextcp_context_poll ( struct flextcp_context ctx,
int  num,
struct flextcp_event events 
)

◆ flextcp_context_wait()

int flextcp_context_wait ( struct flextcp_context ctx,
int  timeout_ms 
)

Waits for events for up to timeout_ms milliseconds. Is not guaranteed to block, but only does so when flextcp_context_canwait returns 0.

Returns
0 if we waited, -1 otherwise.

Definition at line 995 of file init.c.

References flextcp_context_canwait(), and flextcp_context_waitclear().

◆ flextcp_context_waitclear()

void flextcp_context_waitclear ( struct flextcp_context ctx)

Clear events off of waitfd after waking up. Does not process any events any events, just reads the count off the internal eventfd.

Returns
0 on success, -1 otherwise

Definition at line 979 of file init.c.

Referenced by flextcp_context_wait().

◆ flextcp_context_waitfd()

int flextcp_context_waitfd ( struct flextcp_context ctx)

Get file descriptor for waiting on events in this context. Note that blocking is only allowed after flextcp_context_canwait indicates this. After waking up, canwait has to be called again before blocking again.

Returns
file descriptor for waiting on. Remains constant during lifetime of context. <0 on error.

Definition at line 925 of file init.c.

◆ flextcp_init()

int flextcp_init ( void  )

Initializes global flextcp state, must only be called once.

Returns
0 on success, < 0 on failure

Definition at line 75 of file init.c.

◆ flextcp_listen_accept()

int flextcp_listen_accept ( struct flextcp_context ctx,
struct flextcp_listener lst,
struct flextcp_connection conn 
)

Accept connections on a listening socket (asynchronous). This can be called more than once to register multiple connection handles.

Definition at line 89 of file conn.c.

◆ flextcp_listen_open()

int flextcp_listen_open ( struct flextcp_context ctx,
struct flextcp_listener lst,
uint16_t  port,
uint32_t  backlog,
uint32_t  flags 
)

Open a listening socket (asynchronous).

Definition at line 41 of file conn.c.