Commit Graph

529 Commits

Author SHA1 Message Date
Avi Kivity
66451d5a9c tcp: fix assertion failure on connection reset
The connection reset code posted an exception on the _data_received promise
to break a waiter (if any), but left the optional<promise<>> engaged.  This
caused the connection destructor to attempt to post a new exception on the
same promise, which is not legal.

Fix by disengaging the optional promise, and give the same treatment to
_all_data_acked_promise.
2015-07-13 19:07:35 +03:00
Takuya ASADA
15d009d39e udp: auto close on destruction of channel
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-07-05 11:30:08 +03:00
Avi Kivity
8dc71b7b8b net: wire up connected_socket shutdown methods and expose to user 2015-06-16 12:02:32 +03:00
Avi Kivity
e59c7d9f1f net: provide shutdown methods for the native tcp stack 2015-06-16 12:02:32 +03:00
Avi Kivity
74e9a897b7 net: add shutdown methods for posix connected_socket
We can simply ask the kernel to shutdown for us, and it will propagate
exceptions to callers.
2015-06-16 12:02:31 +03:00
Avi Kivity
661d459fff net: wire up server_socket shutdown method and expose to callers 2015-06-16 12:02:30 +03:00
Avi Kivity
587013a611 net: add shutdown() method to tcp listener 2015-06-16 11:54:44 +03:00
Avi Kivity
9f7e31494c posix stack: add methods to shut down a listening socket
Anyone waiting on accept() will receive an exception.
2015-06-16 11:53:30 +03:00
Avi Kivity
b5b1fa730b dpdk: compatibility with dpdk 2.1 2015-06-11 11:12:07 +03:00
Asias He
88e7dcfa86 Remove redundant const in static constexpr const
From http://en.cppreference.com/w/cpp/language/constexpr:

   A constexpr specifier used in an object declaration implies const.

However, We can not change from
   static constexpr const char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";
to
   static constexpr char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";

The compiler complains:

   In file included from json/formatter.cc:22:0:
   json/formatter.hh:132:42: error: deprecated conversion from string
   constant to ‘char*’ [-Werror=write-strings]
        static constexpr char* TIME_FORMAT = "%a %b %d %I:%M:%S %Z %Y";

Since, unlike const, constexpr does not modify a type. It just applies
to an object (or function), and incidentally implies const to the
top-level type.
2015-05-25 11:57:19 +03:00
Gleb Natapov
f77d3bbf52 net: extend connect() API to allow to bind to specific local address/port 2015-05-20 17:10:00 +03:00
Gleb Natapov
ddf2167949 net: add new contractor for ipv4_addr
The one that takes IP as a string and port as a number.
2015-05-20 11:38:32 +03:00
Calle Wilund
ad5feda8ae Collectd: Fix registration/deregistration and reg. anchor managment
Obviously, I was sleeping or something when I wrote the reg/unreg code, since
using copy semantics for anchors is equivalent with double unregistrations.
Luckily, unregister was broken as well, so counters did stay active. Which
however broke things once actual non-persistent counters were added. Doh.

* Anchors must be non-copyable
* Above makes creating std::vector<registration> from initializer list
tricky, so added helper type "registrations" which inherits vector<reg>
but constructs from initializer_list<type_instance_id>, avoiding illegal
copying.
* Both register and unregister were broken (map semantics does not overwrite
on insert, only [] or iterator operation).
* Modified the various registration callsites to use registrations and move
semantics.
2015-05-12 11:30:44 +02:00
Vlad Zolotarov
78cf7a2c06 DPDK: qp_stats: change rx errors instance to if_rx_errors
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-21 18:49:25 +03:00
Vlad Zolotarov
3aa3dd77a3 DPDK: update an qp_stats.rx.bad.no_mem counter
Update it and register it for collectd reporting

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-21 18:49:25 +03:00
Vlad Zolotarov
35199f5353 net: Add a qp_stats.rx.bad.no_mem counter
Add a new statistics counter for packets dropped due to allocation failure.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-21 18:49:25 +03:00
Vlad Zolotarov
e9a59e5f8d DPDK: drop incoming packets if allocation fails in the copy-flow
Ensure the "detaching" of rte_mbuf from the received data in the copy path.
This patch completes the above in case the allocation of the buffer to
copy the newly arrived data to has failed.

In the above case we prefer to drop the arrived packet instead of consuming
the rte_mbuf from the Rx ring's mempool.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-21 18:39:24 +03:00
Asias He
5194517473 tcp: Use std::system_error
Make it consistent with native stack.
2015-04-20 18:05:37 +03:00
Avi Kivity
905f47628e Merge branch 'dpdk_cleanups-v1' of github.com:cloudius-systems/seastar-dev
Get rid of #ifdef HAVE_OSV where possible, from Vlad.

Reviewed-by: Takuya ASADA<syuu@cloudius-systems.com>
2015-04-20 11:58:29 +03:00
Vlad Zolotarov
ea7bdc65c0 tcp: properly calculate the payload length for TSO decision
Fixes issue #41

Packet doesn't have neither L2 nor L3 headers in the tcp::output_one(),
therefore comparing p.len() to MSS + L2_HDR + L3_HDR + L4_HDR when
payload size is greater than (MSS - L2_HDR - L3_HDR) gives the wrong
negative decision in regard to whether to send this frame as an TSO frame.

Fix the above by comparing the MSS to actual payload size.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Reviewed-by: Asias He <asias@cloudius-systems.com>
2015-04-20 08:46:36 +03:00
Vlad Zolotarov
b0321a98ae DPDK: Set default_txconf.txq_flags according to port HW capabilities
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-19 20:17:10 +03:00
Vlad Zolotarov
14d36b8b40 DPDK: Check if changing of HW FC is supported by device and don't halt if not.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-19 20:14:14 +03:00
Takuya ASADA
d41de86d3b dpdk: skip hw flow control when OSv, since virtio PMD doesn't supported hw flow control functions
This is not really HAVE_OSV but virtio-net, may need to change 'if (nic == virtio)' later, if we want to support virtio-net on Linux/SR-IOV on OSv.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-04-19 10:33:40 +03:00
Takuya ASADA
1aa1529545 dpdk: Add ETH_TXQ_FLAGS_NOOFFLOADS when HAVE_OSV, since virtio PMD requires the flag
This is not really HAVE_OSV but virtio-net, may need to change 'if (nic == virtio)' later, if we want to support virtio-net on Linux/SR-IOV on OSv.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-04-19 10:33:39 +03:00
Takuya ASADA
00049ea9c7 Fix compile errors with OSv
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-04-19 10:33:32 +03:00
Vlad Zolotarov
934c6ace46 DPDK: Add Ethernet HW Flow Control feature
Add an option to enable/disable sending and respecting PAUSE frames as defined in
802.3x and 802.3z specifications. We will configure the Link level PAUSEs
(as opposed to PFC).

In simple words Ethernel Flow Control relies on sending/receiving PAUSE (XOFF) MAC frames that
indicate the sender that receiver's buffer is almost full. The idea is to avoid receive buffer overflow. When
receiver's buffer is being freed it will send XON frame to indicate to the sender that it may
transmit again.

   - Added DPDK-specific command option to toggle the feature.
   - Sending PAUSEs is enabled by default.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-16 16:58:16 +03:00
Vlad Zolotarov
1aad5d48c7 DPDK: Register Port statistics
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:34:27 +03:00
Vlad Zolotarov
539efcebc2 DPDK: added port_stats: struct and collection
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
7c692c499c net stats: Register backend specific collectd counters
Error counters are backend-specific thus we will register them separately
for each specific backend.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
671c57e5b9 xenfront: update network statistics
- Add xenfront_qp private member to fron_ring class.
   - Update network statistics.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
da02b240ef xenfront: Fix: initialize the "bunch" variable
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
a33994924f xenfront: make front_ring<T>::process_ring() return void
This function was always returning a ready future, so I made it
return void and changed the callers to explicitly return ready future.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
80bad5273a virtio: update network statistics
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
10cad8a87a DPDK: update network statistics
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
de9bad074b DPDK: rework the tx_buf methods interface
Rework the tx_buf class methods to accept dpdp_qp instead of tx_factory
and dpdk_device.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:57 +03:00
Vlad Zolotarov
0028959968 net: separated qp stats into a separate struct
- Moved all qp stats into a separate class: qp_stats.
   - Moved the stats update function into the new stats class.
   - Add the _stats_plugin_name property to net::qp class:
     default value is "network".

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 20:32:48 +03:00
Vlad Zolotarov
1ceaa13543 virtio: Disable/enable LRO according to "--lro" parameter
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 19:44:15 +03:00
Vlad Zolotarov
553e1a5e75 DPDK: Add LRO support
- Added LRO ON/OFF native stack command line parameter.
   - Implemented handling the reception of a clustered packet:
      - Without hugetlbfs: allocate a single buffer to contain the whole
        packet's data and copy its contents into it. If the allocation failed - build
        the "packet" directly from the cluster.
      - With hugetlbfs: create a packet from cluster mbuf's data buffers.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>

New in v3:
   - Use RTE_ETHDEV_HAS_LRO_SUPPORT defined in rte_ethdev.h instead of
     RTE_ETHDEV_LRO_SUPPORT defined in config/common_linuxapp.

New in v2:
   - dpdk_qp<false>::from_mbuf_lro(): Free the cluster after copying
     to the allocated buffer.
   - Some style cleanups.
2015-04-14 19:44:05 +03:00
Vlad Zolotarov
8fb948e1b2 DPDK: Use for() loop in dpdk_qp::refill_one_cluster()
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 15:41:01 +03:00
Vlad Zolotarov
af3e2e08ee DPDK: Always enable HW CRC stripping
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-04-14 11:29:34 +03:00
Nadav Har'El
2c78fcdc4e clean up byteorder.hh
byteorder.hh's "net::packed<T>" subclassed the basic unaligned<T> and
added a "adjust_endianess" method. This was completely unnecessary:
While ntoh's generic implementation indeed uses that method, we also
have a specialized overload for ntoh(packed<T>), so the generic
implementation would never be used for packed<T> anyway!

So for net::packed<T> we don't need anything more than unaligned<T>,
and can just make it an alias.

As a bonus, the "hton" function will now work also on unaligned<T>
(such as the result of the convenient unaligned_cast<>), not just on
net::packed<T>.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-04-08 18:41:48 +03:00
Gleb Natapov
7f90c314da net: provide const versions of socket_address functions 2015-03-22 16:16:05 +02:00
Nadav Har'El
d1601b46f2 net: implement net::packed<> in terms of unaligned<>
The previous patch moved most of the functionality of net::packed<>
into a new template unaligned<> (in core/unaligned.hh). So in this
patch we implement net::packed<> in terms of unaligned<>. The former
is basically the same as the latter, with the addition of the
"adjust_endianness" feature that the networking code expects.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-15 15:45:14 +02:00
Vlad Zolotarov
e7e58d446c DPDK: Explicitly set Rx mempool mbuf_data_room_size
This value is passed as an opaque parameter of the rte_pktmbuf_pool_init().
It should equal to a buffer size + RTE_PKTMBUF_HEADROOM.
The default value is 2K + RTE_PKTMBUF_HEADROOM.
PMD is using this value minus RTE_PKTMBUF_HEADROOM for configuring the Rx
data buffers' size when it configures the Rx HW ring.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-03-05 18:39:17 +02:00
Tomasz Grabiec
83963b23d3 Replace rescue() usages with then_wrapped()
They are pretty much the same. This change removes rescue().
2015-03-04 17:34:59 +01:00
Asias He
55a43eb5f9 tcp: Improve retransmit
Do not store the tcp header in unacked queue. When partial ack of a
segment happens, trim off the acked part of a segment. When retransmits,
recalculate the tcp header and retransmit only the unacked part.
2015-03-02 12:36:47 +02:00
Avi Kivity
3aaac55a7a tcp: fix bad checksum on RST packets
We neglected to set offload_info::needs_csum on reset packets, resuling in
them being ignored by the recipient.  Symptoms include connection attempts
to closed ports (seastar = passive end) hanging instead the active end
understanding the port is closed.
2015-03-01 18:45:35 +02:00
Avi Kivity
27913013b1 virtio: tighten rx packets for debug mode
Allocate exactly the available fragment size in order to catch buffer
overflows.

We get similar behaviour in dpdk, since without huge pages, it must copy
the packet into a newly allocated buffer.
2015-03-01 16:42:07 +02:00
Avi Kivity
cefe6a9b3e tcp: fix option parsing
Two bugs:
  1. get_header<type>(offset) was used with size given as the offset
  2. opt_end failed to account for the mandatory tcp header, and thus was
     20 bytes to large, resulting in overflow.
2015-03-01 15:26:46 +02:00
Tomasz Grabiec
1fadd7d608 net: Move ipv4_addr constructor to the source file
boost::join() provided by boost/algorithm/string.hpp conflicts with
boost::join() from boost/range/join.hpp. It looks like a boost issue
but let's not pollute the namespace unnecesssarily.

Regarding the change in configure.py, it looks like scollectd.cc is
part of the 'core' package, but it needs 'net/api.hh', so I added
'net/net.cc' to core.
2015-02-26 17:34:27 +02:00