Changes from v1:
Fixes for the comments Hans and Alon made. Mainly for patch 3:

* use do_flow_control flag, instead of ~0 for infinite tokens
* avoid code duplication in spice_char_device_send_to_client_tokens_set/add
* fix bug in num_self_token counting when the cur_write_buf was associated with
  a client that was destroyed.
* moved the recursion tracking in read_from_device to the device state, instead 
of using 
  a static variable
* fix ref counting for the char device state
* add some asserts
* removed a routine that wasn't used: spice_char_device_client_num_tokens_get

----------------------------
Hi,

This patch series extends SpiceCharDeviceState to manage the character devices 
flow control:
wakeup and reading from the device; writing to the device; start/stop the 
device; server/client tokens
management, including partial support for multiple clients.
The agent, spicevmc, and smartcard, were modified to use SpiceCharDeviceState.

Functional differences from the previous implementation:
(1) Api for starting and stopping the device: when the device is stopped, 
incoming messages from the client are kept in the
server till the device is started (or migrated - not implemented yet).
(2) vdagent: not ignoring tokens received from the client; generalize token 
management for multiple clients.
(3) smartcard, spicevmc: 
    (a) support partial writes; while this might not be necessary for usbredir, 
it may be required for future devices.
    (b) smartcard and spicevmc channels can be easily extended to support 
tokening.

The patches serve also as a preliminary work for supporting seamless migration 
by:
(1) having start/stop api: we need to stop writing to the guest when savevm 
starts
(2) having write queues for all character devices and not just the agent:
    we need to save data that reached the server after the guest was stopped.
(3) having tokens support: in addition to the ongoing flow control it provides,
    it also allows us to set an upper limit to the amount of data we might need 
to migrate.

The series also contain some bug fixes.

Regards,
Yonit.

Yonit Halperin (14):
  smartcard: fix calc of remaining data size when reading more than one
    msg from the device
  smartcard: fix an error message
  char_device: Introducing shared flow control code for char devices.
  agent: Fix tokens handling in main_channel
  agent: remove save/restore migration data code
  agent: employ SpiceCharDeviceState for managing reading from the
    device
  agent: use SpiceCharDeviceWriteBuffer for agent data from the client
  agent: employ SpiceCharDeviceState for writing to the device
  spicevmc: employ SpiceCharDeviceState for managing reading from the
    guest device
  spicevmc: use SpiceCharDeviceState for writing to the guest device
  smartcard: use SpiceCharDeviceState for managing reading from the
    device
  smartcard: creating SmartCardChannelClient type
  smartcard: use SpiceCharDeviceState for writing to the guest device
  char_device: move SpiceCharDeviceState from the header

 server/Makefile.am    |    1 +
 server/char_device.c  |  775 +++++++++++++++++++++++++++++++++++++++++++++
 server/char_device.h  |  183 +++++++++++-
 server/main_channel.c |   94 +++----
 server/main_channel.h |    6 +-
 server/reds.c         |  842 ++++++++++++++++++-------------------------------
 server/reds.h         |    5 +-
 server/smartcard.c    |  367 ++++++++++++++++------
 server/smartcard.h    |    6 +-
 server/spicevmc.c     |  193 ++++++++----
 10 files changed, 1713 insertions(+), 759 deletions(-)
 create mode 100644 server/char_device.c

-- 
1.7.7.6

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to