dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* Appropriate DPDK data structures for TCP sockets
@ 2015-02-22  0:38 Matthew Hall
       [not found] ` <3ABAA9DB-3F71-44D4-9C46-22933F9F30F0-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Matthew Hall @ 2015-02-22  0:38 UTC (permalink / raw)
  To: <dev-VfR2kkLFssw@public.gmane.org>

Hello fellow stack hackers :) ,

I'm working on a simple server-side implementation of TCP on DPDK.

For this to work I need a good data structure to store some sockets.

The lookup key is like this:

struct ss_flow_key_s {
    uint8_t  sip[IPV6_ALEN];
    uint8_t  dip[IPV6_ALEN];
    uint16_t sport;
    uint16_t dport;
    uint8_t  protocol;
} __attribute__((packed));

typedef struct ss_flow_key_s ss_flow_key_t;

The socket itself is like this:

enum ss_tcp_state_e {
    SS_TCP_CLOSED   = 0, SS_TCP_LISTEN   = 1, SS_TCP_SYN_TX   = 2,
    SS_TCP_SYN_RX   = 3, SS_TCP_OPEN     = 4, SS_TCP_UNKNOWN  = -1,
};

typedef enum ss_tcp_state_e ss_tcp_state_t;

// RFC 793, RFC 1122
struct ss_tcp_socket_s {
    ss_flow_key_t  key;
    uint32_t id;
    rte_spinlock_t lock;

    ss_tcp_state_t state;

    uint32_t ticks_last;
    uint16_t rx_buf_offset;
    uint16_t mss;
    uint64_t rx_failures;
    uint8_t  rx_data[L4_TCP_WINDOW_SIZE * 2];
} __rte_cache_aligned;

So far I was using rte_hash, but it's single writer multi reader, which is eventually going to need some more complicated locking and probably run kind of slow. Also, I need some timer functions to delete dead sockets and so forth, and rte_hash doesn't have any iteration API.

So then I was trying to figure out if I needed to use a linked list for the iteration or if there is some other API I should use instead like rte_table_*. However the documentation of rte_table is kind of confusing so I wasn't sure if that was the right choice either.

Any advice?

Thanks,
Matthew.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-13  6:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22  0:38 Appropriate DPDK data structures for TCP sockets Matthew Hall
     [not found] ` <3ABAA9DB-3F71-44D4-9C46-22933F9F30F0-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
2015-02-23  0:02   ` Stephen Hemminger
2015-02-23  4:50     ` Matthew Hall
     [not found]       ` <F543F60F-083D-4018-8387-062EAF8319D1-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
2015-02-23 14:48         ` Matt Laswell
     [not found]           ` <CA+GnqApB+nEQXD1TssOotXX+sV8DZ5aoDwQnEv9CoUhqwSckFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-23 21:16             ` Matthew Hall
     [not found]               ` <20150223211645.GB20766-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
2015-02-23 21:51                 ` Avi Kivity
     [not found]                   ` <54EBA0F2.6040409-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org>
2015-03-13  6:41                     ` Matthew Hall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).