Paul Durrant [Fri, 10 Jul 2015 10:56:25 +0000 (11:56 +0100)]
Lookup active network interfaces by index rather than LUID
The frontend address lookup code was failing to check whether the interface
it was querying was actually active, and also using LUID is kind of overkill
when we could just use index.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 8 Jul 2015 13:10:53 +0000 (14:10 +0100)]
Avoid PDO namespace conflicts...
...by encoding the driver major version in the upper byte of the
revision.
This clearly implies that any future change in the driver major version
will start a new PDO namespace, but that it almost certainly the correct
thing to do in that case.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 8 Jul 2015 13:02:02 +0000 (14:02 +0100)]
Update bindings
Refresh the interface headers (just suspend_interface.h in this case) and
add the XENBUS major version into the top byte of the revision, since this
is now used to avoid namespace conflicts.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 7 Jul 2015 14:21:38 +0000 (15:21 +0100)]
Add functions to backup and restore network settings
In PdoStartDevice(), if an aliasing emulated device is found in the MIB
interface table, back up its network settings to a private area under the
the PDO software key before requesting reboot.
In a later boot, if the emulated device has been unplugged, restore the
network settings from the private area to the PDO such that it will start
with the same configuration as the emulated device it has replaced.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 8 Jul 2015 10:53:42 +0000 (11:53 +0100)]
Stop synthesizing the NET_LUID
From Windows 10 the lifetime of the registry keys used to synthesize the
PDO's NET_LUID has changed. Instead of using a synthesized NET_LUID, look it
up in the MIB interface table (keyed by the permanent physical address)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 8 Jul 2015 10:16:13 +0000 (11:16 +0100)]
Move reboot request code into driver.c
It doesn't really belong in pdo.c
Also this patch adds a check in PdoStartDevice() to fail if a reboot has
already been requested. This is because Windows 10 apparently has a couple
of goes at starting the PDO even after it failed to start the first time
(because we requested a reboot).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 7 Jul 2015 13:42:46 +0000 (14:42 +0100)]
Only open the PDO software key once
There are currently two functions where the PDO software key is opened and
closed: __PdoSetCurrentAddress() and __PdoSetLuid(). Both of these
functions are called from PdoStartDevice() so it's more efficient to open
the software key there and pass it as an argument to the aforementioned
functions.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 7 Jul 2015 13:56:17 +0000 (14:56 +0100)]
Add a type argument to the RegistryEnumerateValues() callback...
...and pass ANSI_STRINGs rather than PCHARs.
Also fix both RegistryEnumerateSubKeys() and RegistryEnumerateValues() to
not clobber their own buffer sizes when calling ZwEnumerateKey() or
ZwEnumerateValueKey() respectively.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 7 Jul 2015 10:44:53 +0000 (11:44 +0100)]
Remove use of 'Addresses' subkey
XENVIF writes the permanent address of each vif into a subkey under its
service key. This is done to allow XENNET's co-installer to copy network
settings from any emulated device that currently has that address.
As of Windows 10, this functionality cannot be provided by a co-installer
and so this subkey has become useless. Hence this patch removes its use.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 2 Jul 2015 10:31:29 +0000 (11:31 +0100)]
Remove erroneous use of transmitter DPC
If the backend does not support split event channels then the transmitter
DPC should not be used, and it contains an assertion to that effect.
The ring enable function, however, unconditionally queues the DPC leading
to an assertion failure. This patch makes sure the DPC is only queued if
the backend does indeed support split event channels.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 8 May 2015 14:40:50 +0000 (15:40 +0100)]
Release and re-acquire backend on resume
When resuming from suspend, any previously cached backend domid and path are
invalid. The frontend code should therefore release and re-acquire those
values before attempting to manipulate vif state.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 16 Apr 2015 11:45:57 +0000 (12:45 +0100)]
Re-work frontend xenbus state handling code
Any time the xenbus state transitions through XenbusStateClosed (6) then
it's possible for the toolstack to tear down the vif, regardless of whether
the state transition was initialiated by the backend going offline or the
frontend being disabled at the same time the backend happens to go offline.
It's important, therefore, that the frontend code allows for this and
always requests PDO ejection if the backend does go away (even if a new
immediately appears).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 15 Apr 2015 15:10:08 +0000 (16:10 +0100)]
Allow PdoResume() to fail
At the moment FrontendResume() can fail, but PdoResume() cannot and hence
the error status is ignored. This is problematic because it is not safe to
call FrontendSuspend() if FrontendResume() did not complete successfully.
This patch, therefore, wires through the failure of FrontendResume() into
PdoResume() and on into FdoAddPhysicalDeviceObject().
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 1 Apr 2015 14:32:54 +0000 (15:32 +0100)]
Log a message to note that when a receiver is waiting for packets
Before the receiver object in the frontend can be shut down, the Windows
network stack must return all buffers passed up. The code therefore
waits for this to happen during the VIF Disable method. Add logging to
note that the wait is occuring as it can take a significant amount of time.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 1 Apr 2015 14:28:29 +0000 (15:28 +0100)]
Ping the transmitter backend when trying to disable
Any transmit requests which have been pushed to the backend must be
responded to before the frontend shuts down, otherwise the frontend
cannot safely tear down the shared ring structures. Whilst waiting
for the backend to respond, send events to make sure it is awake.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 24 Mar 2015 17:50:53 +0000 (17:50 +0000)]
Fix a couple of ASSERT failures
The multi-processor-group patch introduced a new statistics array in
the Frontend object. Unfortunately, whilst the array is correctly freed
on object destruction, the pointer is not NULL-ed out so the IsZeroMemory
check fails. This patch adss the ncessary lines to NULL the array pointer.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 24 Mar 2015 12:18:59 +0000 (12:18 +0000)]
Add the 'NeedReboot' flag back in
Older versions of the code used to set a 'NeedReboot' registry value if
the PDO failed to start because the corresponding emulated device was
found to be still present. The value was set directly in the service key
which is non-volatile and thus the value would persist after reboot.
This patch adds code to again set a 'NeedReboot' value, but this time it
is in a volatile 'Status' key under the service key so that it does not
persist. This value can then be used by the XENNET co-installer to
determine whether it should request a reboot during postinstall
processing.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 20 Mar 2015 12:01:47 +0000 (12:01 +0000)]
Make XENVIF processor group aware
Processor groups have been around for a long time in Windows and
contnuing to ignore them becomes ever more painful when trying to
pass the HCK multiple processor group device test. This patch, therefore,
modifies all the code that uses the non-group-aware kernel calls to use
the newer group aware calls.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
This brings the headers into line with XENBUS. There's no reliance on a
post-4.5.0 change in XENVIF but the re-structuring in the headers done
after 4.5.0 does mean change is necessary and we may as well take the pain
sooner rather than later.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 13 Mar 2015 16:00:16 +0000 (16:00 +0000)]
Disambiguate transmitter packet caches
When a VM has multiple VIFs then it is not currently possible to tell
which transmitter packet cache applies to which VIF. This patch adds
the VIF path into the cache name to disambiguate.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 5 Mar 2015 09:56:38 +0000 (09:56 +0000)]
Fix memory leak
Verifier discovered a memory leak on shutdown of XENVIF. This is because
the per-ring path used for talking to multi-queue aware backends is not
freed in the case where there is only one queue. This patch simply removes
that check as it is incorrect.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 4 Mar 2015 10:04:58 +0000 (10:04 +0000)]
Fix WHQL induced BSODs
The PNP Rebalance Fail Restart Device test causes BSODs due to incorrect
PnP state assumptions about the FDO. This patch fixes these problems
allowing the test to pass.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 27 Feb 2015 17:47:04 +0000 (17:47 +0000)]
Release lower bus interface before passing removal IRP to PDO
If the PDO is surprised removed then the FDO tries to retain its
reference to the PDO's bus interface byond its destruction. This will
cause an assertion failure in checked builds of XENBUS and may cause
memory corruption.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 26 Jan 2015 16:15:24 +0000 (16:15 +0000)]
Fix type mismatch
The size of PWCHAR and the size of ULONG are the same for 32-bit
installations so this bug only affects 64-bit installations, but the
symptom is a crash on PDO destruction due to a corrupted heap.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Mon, 19 Jan 2015 16:23:39 +0000 (16:23 +0000)]
Use correct location when multi-queues are not used.
When the backend does not support multi-queues, or the frontend has
explicitly disallowed multi-queues, the frontend needs to write
event-channel and ring-references to the non-queued (old) locations,
not under device/vif/<id>/queue-<index>
Paul Durrant [Mon, 12 Jan 2015 17:35:43 +0000 (17:35 +0000)]
Reflect interface versions in PDO description
For convenience add a string containing the latest versions of all the
interfaces exported by the driver into the PDO description. This can be
seen in Device Manager as the 'Bus reported device description' detail.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Thu, 18 Dec 2014 14:28:22 +0000 (14:28 +0000)]
Update to VIF Interface v2
Renames XENVIF_TRANSMITTER_PACKET to XENVIF_TRANSMITTER_PACKET_V1 and
adds XENVIF_TRANSMITTER_PACKET_V2 for future patches.
VIF v2 will be implemented in another patch.
Signed-off-by: Owen Smith <owen.smith@citrix.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Thu, 18 Dec 2014 14:28:21 +0000 (14:28 +0000)]
Remove notifier object
Fold event channels into transmitter/receiver ring objects.
Receiver ring object takes over single event channel case and passes
notifications to transmitter object, tagged with ring index (so that
only the specified ring is executed).
Split notifications are handled independently by each ring object.
Signed-off-by: Owen Smith <owen.smith@citrix.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Thu, 18 Dec 2014 14:28:18 +0000 (14:28 +0000)]
Make interface exposure explicit
Add pass-through query for XenBus's Cache interface and
account for interface versions when determining the revision(s).
Do not pass through any other queries, as the revision is not
accounted for.
Paul Durrant [Fri, 19 Dec 2014 11:59:05 +0000 (11:59 +0000)]
Squash buffer overlow error messages in transmit
Occasionally packets are too fragmented to fit into the maximum number of
requests allowed by the netif protocol. In this case the packet preparation
function will fail with STATUS_BUFFER_OVERFLOW and the alternative copy-
coalesce prepation function will be called. These error messages are
therefore un-interesting (since the number of packets directly granted vs.
those that were copied is available in the statistics dump initiated by the
debug VIRQ).
This patch squashes the error messages to avoid filling logs.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 7 Nov 2014 16:46:24 +0000 (16:46 +0000)]
Avoid incorrecly extending checksum accumulator
It was noticed that checksums were occasionally being incorrectly verified.
The reason for this turned out to be that the value passed to
ChecksumVerify as a USHORT was being extended to ULONG prior to being
inverted, thus leaving bits 16-31 set and thus an overflow from the lower
bits was not being correctly folded.
Signed-off-by: Ben Chalmers <ben.chalmers@citrix.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 22 Sep 2014 11:02:44 +0000 (12:02 +0100)]
Cope with unexpected initial backend states
If the OS is booted via iSCSI, then the backend will already be in the
Connected state when the xenvif driver loads. The backend is stable
in this state, so __FrontendPrepare() eventually times out waiting for
the backend state to change.
Fix by leading the backend through the Closing and Closed states if we
find it initially in the Connected (or Closing) states.
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Forward ported.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 14 Aug 2014 10:34:22 +0000 (11:34 +0100)]
Update branding
Remove the use of the 'XenServer' product name except where it is
still appropriate.
Remove use of 'Citrix' from all places except source file
copyrights.
Allow company and product name to be set at build time.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 14 Aug 2014 10:12:36 +0000 (11:12 +0100)]
Implement new API version scheme
This patch changes the way APIs work in an incompatible way. (See README.md
for details).
The patch also includes a *lot* of code tidying and movement and as such
is not really suitable for review as a patch; the resulting code should
itself be reviewed.
Given the scale of the change, the major version number has been revised to
8 and other version numbers reset to zero.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Ben Chalmers [Thu, 31 Jul 2014 07:43:43 +0000 (08:43 +0100)]
Merge pull request #34 from pauldu/ca-140184
[CA-140184]
Revert previous commits that add use of XENBUS's CACHE interface to XENVIF (and then modify cache lifecycle to avoid a crash during hibernation).
The reversions undid a couple of other fixes which are re-applied by the third patch.
> Change Cache lifecycle to match ring lifecycle.
> Ensure caches are destroyed when device transitions to D3 to prevent
> assertion failure in xenbus.
>
> Signed-off-by: Owen Smith <owen.smith@citrix.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 28 May 2014 16:56:06 +0000 (17:56 +0100)]
Avoid duplicate entries in the IP address table
Duplicates are useless and actually cause problems overflowing xenstore's
quota. Also, we should not bother looking at the MIB address table unless
the frontend is CONNECTED or ENABLED since our NetLuid is not necessarily
valid unless we are in one of those states.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>