Commit Graph

16 Commits

Author SHA1 Message Date
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
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
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
Avi Kivity
87f63f7b90 shared_ptr: rename to lw_shared_ptr (for light-weight)
The current shared_ptr implementation is efficient, but does not support
polymorphic types.

Rename it in order to make room for a polymorphic shared_ptr.
2015-01-04 22:38:49 +02:00
Gleb Natapov
7ac3ba901c net: rework packet forwarding logic
Instead of forward() deciding packet destination make it collect input
for RSS hash function depending on packet type. After data is collected
use toeplitz hash function to calculate packet's destination.
2014-12-16 10:53:41 +02:00
Nadav Har'El
3d874892a7 dpdk: enable transmit-side checksumming offload
This patch uses the NIC's capability to calculate in hardware the IP, TCP
and UDP checksums on outgoing packets, instead of us doing this on the
sending CPU. This can save us quite a bit of calculations (especially for
the TCP/UDP checksum of full-sized packets), and avoid cache-polution on
the CPU when sending cold data.

On my setup this patch improves the performance of a single-cpu memcached
by 6%. Together with the recent patch for receive-side checksum offloading,
the total improvement  is 10%.

This patch is somewhat complicated by the fact we have so many different
combinations of checksum-offloading capabilities; While virtio can only
offload layer-4 checksumming (tcp/udp), dpdk lets us offload both ip and
layer-4 checksum. Moreover, some packets are just IP but not TCP/UDP
(e.g., ICMP), and some packets are not even IP (e.g., ARP), so this
patch modifies a few of the hardware-features flags and the per-packet
offload-information flags to fit our new needs.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-10 18:05:02 +02:00
Asias He
88a1a37a88 ip: Support IP fragmentation in TX path
Tested with UDP sending large datagrams with ufo off.
2014-11-30 10:16:38 +02:00
Gleb Natapov
2a56c52fcb net: distribute udp packets according to address pair 2014-11-09 18:17:54 +02:00
Gleb Natapov
d698811bdd fix smp broadcast packet handling
Some packets, like arp replies, are broadcast to all cpus for handling,
but only packet structure is copied for each cpu, the actual packet data
is the same for all of them. Currently networking stack mangles a
packet data during its travel up the stack while doing ntoh()
translations which cannot obviously work for broadcaster packets. This
patches fixes the code to not modify packet data while doing ntoh(), but
do it in a stack allocated copy of a data instead.
2014-11-06 10:30:30 +02:00
Avi Kivity
7a1f84a556 reactor: replace references to reactor::_id by its accessor cpu_id() 2014-11-01 17:34:43 +02:00
Tomasz Grabiec
c5b7bbf37f net: udp: do not use packet data in native_datagram's methods
It's too easy to shoot yourself in the foot when trying to call
get_src() after packet data was moved.

Reported-by: Asias He <asias@cloudius-systems.com>
2014-10-30 12:40:15 +02:00
Asias He
5cf3f200c5 net: Introduce ip_protocol_num
We use this in all the places where the ip protocol number is used.
2014-10-13 11:37:56 +08:00
Asias He
05c72b0808 net: UDP checksum offload and UPD fragmentation offload 2014-10-13 11:37:56 +08:00
Gleb Natapov
4e7d8a8506 Introduce packet classification mechanism
Classifier returns what cpu a packets should be processed on. It may
return special broadcast identifier. The patch includes classifier for
tcp, udp and arp. Arp classifier broadcasts arp reply to all cpus. Default
classifier does not forward packet.
2014-10-07 11:03:57 +03:00
Tomasz Grabiec
ba49d24b01 net: add support for UDPv4 in native and posix stack 2014-10-06 18:34:40 +02:00