Commit Graph

9 Commits

Author SHA1 Message Date
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
Asias He
c03e356873 net: Improve packet::linearize
Free the original memory earlier if copied all of them.
2014-12-09 09:59:43 +02:00
Avi Kivity
d5675c32a7 net: add ostream support for packet
print your packets with

   print("got packet: %s\n", p);

!
2014-10-28 11:01:37 +02:00
Gleb Natapov
c8ffffa557 Add packet::free_on_cpu() function
Some packets are processed by a cpu other than the one that allocates it
and its fragments. free_on_cpu() function should be called on a cpu that
does processing and it returns a packet that is deletable by the current
cpu. It is done by copying packet/packet::impl to locally allocated one
and adding new deleter that runs old deleter on original cpu.
2014-10-07 11:04:01 +03:00
Avi Kivity
75f07adb69 packet: store header data inside packet itself
Instead of using internal_deleter, which is unwieldy, store the
header data inside packet::impl which we're allocating anyway.

This adds some complication when we need to reallocate impl (if
the number of fragments overflows), but usually saves two allocations:
one for the internal_deleter and one for the data itself.
2014-09-23 18:02:18 +03:00
Avi Kivity
2f103a8558 packet: reduce allocations for the fragment array
Instead of having an std::vector<> manage the fragment array,
allocate it at the end of the impl struct and manage it manually.

The result isn't pretty but it does remove an allocation.
2014-09-17 11:31:22 +03:00
Avi Kivity
48ba89f060 packet: optimize move()ing packets around
Move all data fields into an 'impl' struct (pimpl idiom) so that move()ing
a packet becomes very cheap.  The downside is that we need an extra
allocation, but we can later recover that by placing the fragment array
in the same structure.

Even with the extra allocation, performance is up ~10%.
2014-09-16 15:50:35 +03:00
Avi Kivity
37c90fe54e net: make packet data members private
This will assist in future refactoring.
2014-09-16 11:24:13 +03:00
Avi Kivity
812ac77d2f net: spit out packet class into its own files 2014-09-16 10:13:09 +03:00