Commit Graph

449 Commits

Author SHA1 Message Date
Avi Kivity
42bc73a25d dpdk: initialize _tx_burst_idx
Should fix random segfault.
2015-01-29 11:18:54 +02:00
Asias He
0ab01d06ac tcp: Rework segment arrival handling
Follow RFC793 section "SEGMENT ARRIVES".

There are 4 major cases:

1) If the state is CLOSED
2) If the state is LISTEN
3) If the state is SYN-SENT
4) If the state is other state

Note:

- This change is significant (more than 10 pages in RFC793 describing
  this segment arrival handling).
- More test is needed. Good news is, so far, tcp_server(ping/txtx/rxrx)
  tests and httpd work fine.
2015-01-29 10:59:31 +02:00
Gleb Natapov
ada48a5213 net: use iterators to iterate over circular_buffer in dpdk 2015-01-28 13:49:09 +02:00
Gleb Natapov
7a92efe8d1 core: add local engine accessor function
Do not use thread local engine variable directly, but use accessor
instead.
2015-01-27 14:46:49 +02:00
Avi Kivity
d0ec99317d net: move some device and qp methods out-of-line 2015-01-22 09:44:44 +02:00
Avi Kivity
5678a0995e net: use a redirection table to forward packets to proxy queues
Build a 128-entry redirection table to select which cpu services which
packet, when we have more cores than queues (and thus need to dispatch
internally).

Add a --hw-queue-weight to control the relative weight of the hardware queue.
With a weight of 0, the core that services the hardware queue will not
process any packets; with a weight of 1 (default) it will process an equal
share of packets, compared to proxy queues.
2015-01-22 09:36:04 +02:00
Asias He
71ac2b5b24 tcp: Rename tcp::send()
Unlike tcp::tcb::send() and tcp::connection::send() which send tcp
packets associated with tcb, tcp::send() only send packets associated
without tcb. We have a bunch of send() functions, rename it to make the
code more readable.
2015-01-21 13:22:40 +02:00
Asias He
917247455c tcp: Use set_exception instead of set_value to notify user on rst 2015-01-21 11:20:06 +02:00
Asias He
8ce7cfd64b tcp: Fix listener port
It is supposed to zero the origin's port.
2015-01-21 11:20:05 +02:00
Asias He
0c09a6bd7a tcp: Return a future for tcp::connect() 2015-01-21 16:20:39 +08:00
Asias He
d6d7e6cb47 tcp: Support syn fin retransmit and timeout
Tested with tcp_server + client.go using iptables dropping <SYN,ACK> or
<FIN,ACK> on client side.

I verified that the SYN or FIN packet is retransmitted and the
connection is closed after N (currently 5) retries.
2015-01-21 16:20:39 +08:00
Asias He
602c7c9c98 tcp: Free packets to be sent on RST 2015-01-21 16:20:39 +08:00
Asias He
56f8ba3303 tcp: Clear more when tear down a connection 2015-01-19 13:32:53 +02:00
Gleb Natapov
23b9605fc4 net: fix virtio bulk sending
Zero net_hdr_mrg for each packet, otherwise wrong flags may be used.
2015-01-18 16:23:01 +02:00
Gleb Natapov
4920f309e8 net: fix dpdk bulk sending
_tx_burst_idx may be zero, but _tx_burst still holds packets from the top
of circular_buffer, so avoid refilling in this case.
2015-01-18 16:23:00 +02:00
Vlad Zolotarov
b8185d5afe DPDK: Set rss_bits to correct value if reta_size is not available
rss_bits should be equal to the number of bits HW used in its RSS calculation.
Use dev_info.max_rx_queues if dev_info.reta_size is not available.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-01-18 12:37:19 +02:00
Gleb Natapov
1ef2808750 reactor: return proper value from pollers
Currently most of them return true no matter if any work was actually
done. Fix it to return true only if poll did any work.
2015-01-18 12:37:05 +02:00
Takuya ASADA
bbe4d3b7d6 net: implemented SO_REUSEPORT support on UDP
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-15 17:38:06 +02:00
Asias He
f004db89cf tcp: Make tcp_option get_size and fill more readable 2015-01-15 10:31:46 +02:00
Takuya ASADA
16705be1f4 Distribute incomming connection by kernel using SO_REUSEPORT
With SO_REUSEPORT, we can bind() & accept() on each thread, kernel will dispatch incomming connections.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-13 20:04:32 +09:00
Vlad Zolotarov
585f6452b9 DPDK: Properly handle the case when RSS info is not available (e.g. VF case)
- Adjust the asserts.
 - Add an assert in the place where we should not get if RSS info is not provided.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2015-01-12 18:45:48 +02:00
Gleb Natapov
f11e1f31d6 net: cleanup ipv4 code that is no longer used 2015-01-12 17:40:29 +02:00
Gleb Natapov
19ced3da4c net: fix dhcp to use use udp socket to send packets
No need for ad-hoc code to create udp packets.
2015-01-12 17:39:07 +02:00
Gleb Natapov
9c229d449a net: remove unused ipv4_l4::send() function
After previous patches this one is no longer used.
2015-01-12 17:38:44 +02:00
Gleb Natapov
d10575aea5 net: add tcp packet queue for non tcb packets
Some packets generated by tcp do not belong to any connection. Currently
such packets are pushed to ipv4 directly. This patch adds a packet queue
for ipv4 to poll them from and limits amount of memory those packets can
consume.
2015-01-12 17:35:35 +02:00
Gleb Natapov
fda06cd81f net: continue network stack inversion into icmp
Poll icmp from ipv4 instead of pushing packets from icmp to ipv4. Also
limit how much memory outstanding icmp packets can consume.
2015-01-12 17:34:19 +02:00
Gleb Natapov
6da00ab956 net: continue network stack inversion into udp
Poll udp channels from ipv4 instead of pushing packets from udp to ipv4
2015-01-12 17:34:10 +02:00
Avi Kivity
94ffb2c948 net: add missing includes to byteorder.hh 2015-01-12 14:11:56 +02:00
Gleb Natapov
bef054f8c8 net: rename udp_v4 to ipv4_udp for consistency with other l4 protocols 2015-01-11 12:29:05 +02:00
Gleb Natapov
32b42af49f net: register l3 poller for tcp connections
This patch change tcp to register a poller so that l3 can poll tcp for
a packet instead of pushing packets from tcp to ipv4. This pushes
networking tx path inversion a little bit closer to an application.
2015-01-11 10:48:32 +02:00
Gleb Natapov
d5c309c74e net: provide poller registration API between l3 and l4
Both push and pull methods will be supported between l3 and l4 after
this patch.
2015-01-11 10:17:48 +02:00
Gleb Natapov
2b340b80ce net: unfuturize packet fragmentation
Since sending of a single packet does not involve futures anymore we can
simplify this code.
2015-01-11 10:17:48 +02:00
Avi Kivity
4c59fe6436 xen: ensure _xenstore member is initialized early enough
Thanks clang.
2015-01-08 18:44:23 +02:00
Avi Kivity
062f621aa0 net: wrap toeplitz hash initializer in more braces
Nagging by clang.
2015-01-08 18:43:49 +02:00
Gleb Natapov
13c1324d45 net: provide some statistics via collectd
Provide batching and overall send/received packet stats.
2015-01-08 17:41:26 +02:00
Gleb Natapov
51fb18aba0 net: remove unused variable from virtio 2015-01-08 16:45:01 +02:00
Gleb Natapov
b824790798 net: move udp_v4 from network_stack into ipv4 class
ipv4 class manages tcp and icmp, but for some reason udp is managed by
network_stack. Fix this and make all L4 protocol handling to be the same.
2015-01-08 11:33:19 +02:00
Takuya ASADA
e9e1ed7977 Implement TCP client on native-stack 2015-01-08 01:26:36 +09:00
Takuya ASADA
7b3b9e5a46 Implement TCP client on posix-stack
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-08 01:26:36 +09:00
Takuya ASADA
b9a2541c7e Add reactor::connect(), client_socket definition and network stack stub code
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-08 01:26:36 +09:00
Takuya ASADA
2118fe5a09 Add l4connid::hash() 2015-01-08 01:26:36 +09:00
Takuya ASADA
9c2ca3d6b6 return correct option size when new SYN packet sending
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-08 01:26:36 +09:00
Takuya ASADA
ff39f8c93e Initialize _snd.initial/next on tcb constructor 2015-01-07 23:48:41 +09:00
Gleb Natapov
8d4e6b832a net: implement bulk sending interface for dpdk 2015-01-06 15:24:10 +02:00
Gleb Natapov
aae617f9f5 net: revert whatever is left from "virtio: batch transmitted packets" commit.
Revert remains of commit 503f1bf4 since there is no need to batch
packets inside virtio any more. Upper layer does it already.
2015-01-06 15:24:10 +02:00
Gleb Natapov
72324f02e2 net: implement bulk sending interface for virtio 2015-01-06 15:24:10 +02:00
Gleb Natapov
77bd21c387 net: implement bulk sending interface for proxy queue
Take advantage of the bulk interface to send several packets simultaneity
with one submit_to() to remote cpu.
2015-01-06 15:24:10 +02:00
Gleb Natapov
c98bdf5137 net: limit native udp send buffer size
Currently udp sender my send whenever it has data and if it does
this faster than packets can be transmitted we will run out of memory.
This patch limits how much outstanding data each native udp channel may
have.
2015-01-06 15:24:10 +02:00
Gleb Natapov
0fd014fc35 net: add add completion callback between l3 and l4
L4 will provide the callback to be called by L3 after the packet is
handled to lower layers for transmission. L4 will know that it can queue
more data from user at this point. The patch also change send function
that can no longer block to return void instead of future<>.
2015-01-06 15:24:10 +02:00
Gleb Natapov
e80fa4af7d net: drop top level 'remaining' from ipv4::send()
It is not needed.
2015-01-06 15:24:10 +02:00