]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/log
pvdrivers/win/xenvif.git
8 years agoMake sure transmitter DPC does not try to unmask non-existent evtchn staging-8.1 8.1.0
Paul Durrant [Fri, 6 May 2016 08:51:30 +0000 (09:51 +0100)]
Make sure transmitter DPC does not try to unmask non-existent evtchn

In the case where the backend does not support split event channels (one
for RX and one for TX) then the transmitter code in XENVIF does not open
the combined channel; it is handled by the receiver code. So, the
transmitter DPC should not make any attempt to unmask the event channel at
the end of processing.

This patch adds the necessary check for FrontendIsSplit before doing the
unmask and also removes an unnecessary check for FrontendIsSplit in the
transmitter ring enable function.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reported-by: Eytan Heidingsfeld <eytanh@gmail.com>
Tested-by: Eytan Heidingsfeld <eytanh@gmail.com>
9 years agoAvoid ASSERTion failure on VIF plug
Paul Durrant [Wed, 23 Mar 2016 14:06:27 +0000 (14:06 +0000)]
Avoid ASSERTion failure on VIF plug

If the backend is not fast enough then it's possible that the frontend
code sees the backend in state Initialising rather than InitWait. This
causes an ASSERT to be hit.
This patch simply whitelists the Initialising state to avoid the problem.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoPrevent VIF from being incorrectly considered offline...
Paul Durrant [Wed, 23 Mar 2016 11:50:35 +0000 (11:50 +0000)]
Prevent VIF from being incorrectly considered offline...

...one resume from suspend.

My previous reversion of 765b7a6a exposed the original reason the
reverted patch.

On resume from suspend, the backend will have been re-created by the
toolstack and hence the frontend detects it as being offline. This
causes the frontend to request ejection of the disk (thinking that
the reason for the backend going offline is because the VIF is being
unplugged).

This patch works around this problem by introducing an early suspend
callback to note that the frontend has actually gone offline, which
will prevent the ejection from being requested.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRemove erroneous code to re-acquire backend path on resume
Paul Durrant [Tue, 22 Mar 2016 11:29:37 +0000 (11:29 +0000)]
Remove erroneous code to re-acquire backend path on resume

Commit 765b7a6a added code to release and re-acquire the backend
path (and domid) on resume from suspend. That code falsely
assumes that the frontend is not in a closed state at the time.
It's also not clear why it was added in the first place so
this patch removes it again, as it causes a BSOD when the
frontend is in the closed state.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoDynamic multicast control 8.1.0-rc13
Paul Durrant [Thu, 21 Jan 2016 09:23:27 +0000 (09:23 +0000)]
Dynamic multicast control

Only use the multicast control feature of the backend if it supported
"feature-dynamic-multicast-control" otherwise attempts to enable the 'all
multicast' filter level in XENVIF will have no effect and the NDISTest 6.5
MultiCast Address test will fail.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoMake transmitter code the canonical place where multicast control...
Paul Durrant [Wed, 20 Jan 2016 17:36:01 +0000 (17:36 +0000)]
Make transmitter code the canonical place where multicast control...

...feature is handled

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix memory leak in error path
Paul Durrant [Thu, 28 Jan 2016 14:40:49 +0000 (14:40 +0000)]
Fix memory leak in error path

If a malformed large packet is received then it is possible that a packet
structure is leaked on the error path.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoCancel pending timers when rings are disabled
Paul Durrant [Thu, 28 Jan 2016 14:35:53 +0000 (14:35 +0000)]
Cancel pending timers when rings are disabled

No new timers can be scheduled once rings are disabled but if the rings are
both disconnected and destroyed within the next 100us then it's possible
that the DPC might hit some unitialized data so make sure pending timers
are cancelled.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAdd DPC watchdog avoidance to receiver and transmitter poll
Paul Durrant [Mon, 25 Jan 2016 10:24:49 +0000 (10:24 +0000)]
Add DPC watchdog avoidance to receiver and transmitter poll

Under HCK MPE testing it's possible for both receiver and transmitter
polling loops to run long enough to hit the DPC watchdog. This patch
avoids the problem by terminating the polling loops after a 'batch'
(currently 1/4 of the ring) and then checking the remaining time before the
watchdog fires. If the remaining time is still more than half the total
time then another poll is done, otherwise a timer is scheduled to complete
the work.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAvoid evaluating assertion expressions in free builds
Paul Durrant [Fri, 22 Jan 2016 14:41:36 +0000 (14:41 +0000)]
Avoid evaluating assertion expressions in free builds

The evaluations are pointless and the warnings generated by not evaluating
can be squashed with a couple of #pragmas.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAvoid falling foul of stupid registry values
Paul Durrant [Fri, 22 Jan 2016 14:40:11 +0000 (14:40 +0000)]
Avoid falling foul of stupid registry values

Without this patch mistakenly setting 'FrontendMaxQueues' to 0 in the
registry will cause an unobvious BSOD.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix DPC accounting
Paul Durrant [Fri, 22 Jan 2016 13:57:58 +0000 (13:57 +0000)]
Fix DPC accounting

The DPC count is not zeroed when the event count is zeroed leading to some
odd looking stats. Also the DPC count should really be incremented by the
DPC itself to ensure serialization.

While in the neighbourhood, the ring notify functions in transmitter and
receiver look a little superfluous; they can easily be folded directly
into the DPC if the receiver code triggers the transmmitter DPC in the case
of a combined event channel.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix WHQL InvalidPackets test 8.1.0-rc12
Paul Durrant [Tue, 19 Jan 2016 16:31:44 +0000 (16:31 +0000)]
Fix WHQL InvalidPackets test

Because the transmit code now parses packets before queueing (for the
purposes of maybe needing to hash) the operation can fail of the headers
are invalid. The WHQL test does not expect this to happen.

This patch ignores the parse failure but instead fails the packet when it
is de-queued but only if absolutely no header (i.e. even the ethernet
header) could be parsed. This seems to be enough to keep the test happy.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoStop using prefix GSO
Paul Durrant [Wed, 7 Oct 2015 08:54:03 +0000 (09:54 +0100)]
Stop using prefix GSO

Since acknowledging that the netif response id is meaningless in the code,
we no longer need to use the prefix flavour of GSO.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoCentralize compatibility code
Paul Durrant [Tue, 15 Dec 2015 14:26:55 +0000 (14:26 +0000)]
Centralize compatibility code

This patch moves the code that maintains compatibility with older
VIF interface versions into the vif.c module, rather than having it
distributed amongst vif.c, transmitter.c and receiver.c.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUpdate VIF interface to version 5 8.1.0-rc11
Paul Durrant [Mon, 4 Jan 2016 13:09:14 +0000 (13:09 +0000)]
Update VIF interface to version 5

Unfortunately VIF interface version 4 suffers from a shutdown race with
the TransmitterQueuePacket method. If a call to this races with the Disable
method then a NULL callback function pointer can be invoked.
This patch fixes the race by having TransmitterQueuePacket return a status
code to indicate whether a packet has been queued (rather than invoking the
completion callback if it has not), but this necessitates a interface change
so the VIF interface version is also updated to 5 and a new PDO revision is
added.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRe-synchrinize registry.c with XENBUS 8.1.0-rc10
Paul Durrant [Thu, 10 Dec 2015 11:24:08 +0000 (11:24 +0000)]
Re-synchrinize registry.c with XENBUS

The registry code in XENBUS has some fixes that are not present in the
XENVIF copy, so import the updated code from XENBUS.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRe-synchronize util.h with XENBUS and use __toupper()
Paul Durrant [Thu, 10 Dec 2015 11:17:05 +0000 (11:17 +0000)]
Re-synchronize util.h with XENBUS and use __toupper()

A recent patch introduced __tolower() and __toupper() into util.h as
replacements for tolower() and toupper() respectively as the latter do
a hidden conversion to Unicode which make then unsafe at any IRQL other
than PASSIVE_LEVEL.
This patch imports util.h from XENBUS and fixes other code to be compatible.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix SDV build 8.1.0-rc9
Paul Durrant [Fri, 4 Dec 2015 14:28:30 +0000 (14:28 +0000)]
Fix SDV build

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoIntroduce VIF interface version 4 8.1.0-rc8
Paul Durrant [Fri, 4 Dec 2015 11:04:41 +0000 (11:04 +0000)]
Introduce VIF interface version 4

This greatly simplifies the interface with XENNET by queuing single packets
on both the transmit and receive side, negating the need for a shared packet
structures and bringing static hash calculation into XENVIF.
Crucially this also means that XENNET no longer needs to use the
XENBUS_CACHE interface which allows it to be patched to avoid the race
introduced by commit 026aa32c "Make sure XENBUS interfaces are released when
going into S4".

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoStop caching MaxQueues, NumQueues and Split in Transmitter and Receiver
Paul Durrant [Fri, 4 Dec 2015 09:52:05 +0000 (09:52 +0000)]
Stop caching MaxQueues, NumQueues and Split in Transmitter and Receiver

Just call the Frontend accessor when the values are required.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoMove check for split event channels into Frontend module
Paul Durrant [Fri, 4 Dec 2015 09:12:21 +0000 (09:12 +0000)]
Move check for split event channels into Frontend module

Reduce code duplication and efficiency a little by checking the xenstore
key once in Frontend and then providing a function with Transmitter and
Receiver can use to grab the value.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRemove version 1 of the XENVIF_VIF interface
Paul Durrant [Tue, 15 Sep 2015 09:35:38 +0000 (10:35 +0100)]
Remove version 1 of the XENVIF_VIF interface

The revision has been gone from the PDO for a long time so version 1 of
the interface has been technically dead for a while. This patch cleans up
the code.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoCosmetic change to vif_interface.h
Paul Durrant [Mon, 14 Sep 2015 15:16:39 +0000 (16:16 +0100)]
Cosmetic change to vif_interface.h

This does not affect the size, layout or semantics of anything so no
need to bump the version number.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAdd code to set receive side backfill size
Paul Durrant [Wed, 29 Jul 2015 15:19:15 +0000 (16:19 +0100)]
Add code to set receive side backfill size

The NDIS header/data-split feature requires that the first data
MDL in a NET_BUFFER has sufficient headroom to take a copy of the
entire header MDL just in case something up the stack can't cope
with the split.
To this end NDIS specifies a 'backfill size' which must be
reserved. This patch implements support for that by copying and
adjusting the first data MDL if necessary.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoMake sure XENBUS interfaces are released when going into S4
Paul Durrant [Thu, 3 Dec 2015 12:23:27 +0000 (12:23 +0000)]
Make sure XENBUS interfaces are released when going into S4

Because a transition into and out of S4 means a new domain is built, it's
crucial that all XENBUS interfaces are released (so that things like
event channels, grant tables and the xenstore ring get re-constructed).

This patch fixes code paths where this was not being done.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUpdate interfaces again 8.1.0-rc7
Paul Durrant [Fri, 27 Nov 2015 15:14:30 +0000 (15:14 +0000)]
Update interfaces again

For some reason the last sync did not work properly.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUpdate interfaces 8.1.0-rc6
Paul Durrant [Fri, 27 Nov 2015 15:07:53 +0000 (15:07 +0000)]
Update interfaces

The staging-8.1 seems to have missed interface updates in XENBUS. This patch
rectifies the problem.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAdd XENBUS_STORE and XENBUS_SUSPEND interfaces to exported set 8.1.0-rc5
Paul Durrant [Tue, 24 Nov 2015 14:25:16 +0000 (14:25 +0000)]
Add XENBUS_STORE and XENBUS_SUSPEND interfaces to exported set

To advertise driver distribution information to xenstore XENNET needs to
make use of the XENBUS_STORE and XENBUS_SUSPEND interfaces. As XENVIF is
XENNET's parent driver, it must export them. Adding them to the exported
set also requires update of the PDO revision number.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Import updated store_interface.h from XENBUS and revised commit comment.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoPublish network information to xenstore using documented paths
Paul Durrant [Thu, 12 Nov 2015 14:57:49 +0000 (14:57 +0000)]
Publish network information to xenstore using documented paths

My recent patch series to Xen added documented paths for advertising vif
hotplug capability and paths for publishing network interface information
(name, IP addresses, etc.).

This patch modifies XENVIF to make use of those new paths.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUse multicast control if the backend supports it.
Paul Durrant [Fri, 14 Aug 2015 12:28:42 +0000 (13:28 +0100)]
Use multicast control if the backend supports it.

This required a bit of re-work in the transmitter code since using multicast
control necessitates sending dummy transmit requests with special extra
info fragments. As a knock-on I also re-worked the way the IP address table
is maintained, removing bits that were in the transmitter code into the
general frontend code.

Re-work was also required in the mac code since it is also necessary to
track addition and removal of individual multicast addresses, rather than
just handling a table update.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoPublish distribution information to xenstore
Paul Durrant [Tue, 24 Nov 2015 13:40:30 +0000 (13:40 +0000)]
Publish distribution information to xenstore

My recent patch series to Xen added a documented path and format for
publishing information about PV driver distributions to xenstore.

This patch adds code to populate the documented path (should it exist)
with information about the XENVIF driver package.

Suggested-by: Owen Smith <owen.smith@citrix.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAdd a registry override to veto driver installations 8.1.0-rc4
Paul Durrant [Thu, 22 Oct 2015 14:46:09 +0000 (15:46 +0100)]
Add a registry override to veto driver installations

There are certain cases where a local installer package may wish to
prevent Windows Update installations of drivers. This can be achieved by
having the co-installer check for a registry value and fail it's pre-install
phase if the value is present.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoChange coinstaller log level to TXTLOG_WARNING
Paul Durrant [Thu, 22 Oct 2015 14:41:25 +0000 (15:41 +0100)]
Change coinstaller log level to TXTLOG_WARNING

Windows 10 does not enable logging of TXTLOG_DETAILS in setupapi.dev.log by
default, so use TXTLOG_WARNING to make sure the messages appear.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix error path in transmitter header preparation 8.1.0-rc3
Paul Durrant [Tue, 22 Sep 2015 15:24:50 +0000 (16:24 +0100)]
Fix error path in transmitter header preparation

The wrong value was being checked for NULL after allocation of a fragment.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoCope with zero-length binary values in the registry
Paul Durrant [Tue, 15 Sep 2015 14:25:53 +0000 (15:25 +0100)]
Cope with zero-length binary values in the registry

It appears that it is legitimate for the registry to contain zero-length
binary values, so the registry access code needs to cope with them and
the settings copy code needs to allow for them too.

Reported-by: Rafal Wojdyla <omeg@invisiblethingslab.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoParameterize vendor prefix and PCI device id 8.1.0-rc2
Paul Durrant [Wed, 9 Sep 2015 08:26:22 +0000 (09:26 +0100)]
Parameterize vendor prefix and PCI device id

The XenServer PV vendor prefix ('XS') and PCI device (C000) are still
hard-coded into the XENVIF package. These need to be stripped out and
replaced by values that can be customized at build time. This patch does
that.

The patch also reverts to building version.h and customizing xenvif.inf
directly in build.py.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoDon't treat a missing Driver key as a hard failure
Paul Durrant [Tue, 8 Sep 2015 13:44:17 +0000 (14:44 +0100)]
Don't treat a missing Driver key as a hard failure

When looking to see whether an incumbent child driver will patch the
PDO names created by the new version of XENVIF, ignore any cases where
we find that the Driver key referenced in the Device key is actually
missing.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoStop manipulating the old unplug value in the co-installer... 8.1.0-rc1
Paul Durrant [Thu, 3 Sep 2015 17:11:11 +0000 (18:11 +0100)]
Stop manipulating the old unplug value in the co-installer...

...and take the new ClearUnplugRequest() code from the XENVBD co-installer
instead.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAvoid holding a reference to the UNLPLUG interface
Paul Durrant [Thu, 3 Sep 2015 16:41:30 +0000 (17:41 +0100)]
Avoid holding a reference to the UNLPLUG interface

If the system goes into S3 or S4 then currently the reference will still be
held. This is not problematic for this interface but it is not desirable to
hold references in this circumstance and for other interfaces it can lead
to bugchecks.

This patch adds a function, PdoRequestUnplug(), which only acquires the
interface as needed and then makes use of that.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoDon't NULL out fragment in pending array __TransmitterRingFakeResponses()
Paul Durrant [Thu, 3 Sep 2015 09:27:09 +0000 (10:27 +0100)]
Don't NULL out fragment in pending array __TransmitterRingFakeResponses()

It is completion of the response in TransmitterRingPoll() that should NULL
out the entry in the array. Doing so causes the assertion at
transmitter.c:2111 to fire in a debug build and a page fault in a non-debug
build.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix SDV build
Paul Durrant [Fri, 7 Aug 2015 13:10:29 +0000 (14:10 +0100)]
Fix SDV build

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRegistry string value types cannot be inferred
Paul Durrant [Thu, 6 Aug 2015 14:58:14 +0000 (15:58 +0100)]
Registry string value types cannot be inferred

Following a similar fix in XENBUS this patch adds an explicit Type parameter
to RegistryUpdateSzValue(). It also adds a similar parameter to
RegistryQuerySzValue() so that code querying a string value can find out
what type it is.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix potential NULL-pointer dereference...
Paul Durrant [Wed, 5 Aug 2015 12:01:30 +0000 (13:01 +0100)]
Fix potential NULL-pointer dereference...

...in parsing SystemStartOptions.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUse prefix matching for IPv6 address copy code
Paul Durrant [Wed, 5 Aug 2015 11:48:58 +0000 (12:48 +0100)]
Use prefix matching for IPv6 address copy code

...and also fix registry path and add support for similar IPv4 address
copying.

Windows puts static IP address values in some oddly named and located
registry keys. The key names are just GUIDs and the only useful part of
the values names (that allows use to find them) is that they prefix
match the interface LUID rendered as a 16 digit hex string.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoApply PnP fixes analogous to those recently made in XENBUS
Paul Durrant [Wed, 5 Aug 2015 09:29:31 +0000 (10:29 +0100)]
Apply PnP fixes analogous to those recently made in XENBUS

Code inspection in XENBUS highlighted some issues with the PnP code. The
same issues need to be fixed in XENVIF.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUpdate docs and set version to 8.1.0
Paul Durrant [Fri, 24 Jul 2015 11:50:24 +0000 (12:50 +0100)]
Update docs and set version to 8.1.0

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoDon't trust the integrity of the shared rings after migration
Paul Durrant [Thu, 23 Jul 2015 16:20:25 +0000 (17:20 +0100)]
Don't trust the integrity of the shared rings after migration

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoDon't mess with DbgPrint filters
Paul Durrant [Thu, 23 Jul 2015 11:15:19 +0000 (12:15 +0100)]
Don't mess with DbgPrint filters

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoMove friendly name setting into driver
Paul Durrant [Wed, 22 Jul 2015 15:47:51 +0000 (16:47 +0100)]
Move friendly name setting into driver

XENVIF can set the friendly name of each PDO during start device processing
which removes the need for the XENNET co-installer to handle this.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix co-installer compatibility check
Paul Durrant [Wed, 22 Jul 2015 15:47:01 +0000 (16:47 +0100)]
Fix co-installer compatibility check

It was using the wrong enumerator name.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoUse new unplug mechanism
Paul Durrant [Fri, 17 Jul 2015 15:43:32 +0000 (16:43 +0100)]
Use new unplug mechanism

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRemove interface subscriber checks from the co-installer...
Paul Durrant [Thu, 16 Jul 2015 16:01:26 +0000 (17:01 +0100)]
Remove interface subscriber checks from the co-installer...

...and replace with a scan of child driver software keys to check that
the revision number in the MatchingDeviceId value is supported.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoApply new PDO revision numbering policy
Paul Durrant [Thu, 16 Jul 2015 10:48:37 +0000 (11:48 +0100)]
Apply new PDO revision numbering policy

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRemove PDO Luid field
Paul Durrant [Tue, 14 Jul 2015 15:50:05 +0000 (16:50 +0100)]
Remove PDO Luid field

It's not used any more.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoFix potential buffer overflow
Paul Durrant [Tue, 14 Jul 2015 10:55:57 +0000 (11:55 +0100)]
Fix potential buffer overflow

The buffer allocation in FdoQueryDeviceRelations() is completely bogus. Fix
it.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoNote lack of IPv6 addresses in the log
Paul Durrant [Tue, 14 Jul 2015 10:41:02 +0000 (11:41 +0100)]
Note lack of IPv6 addresses in the log

When we are copying settings, say whether we found any IPv6 address.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRemove test for HardwareInterface in FrontendGetInterfaceIndex()
Paul Durrant [Tue, 14 Jul 2015 10:33:50 +0000 (11:33 +0100)]
Remove test for HardwareInterface in FrontendGetInterfaceIndex()

Apparently no interface in the mib table on Windows Server 2008 SP2 is
a hardware interface, even if it has (virtual) hardware.

Also add a missing \n to a trace statement.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoModify Trace() macro to keep SDV happy
Paul Durrant [Fri, 10 Jul 2015 12:25:49 +0000 (13:25 +0100)]
Modify Trace() macro to keep SDV happy

SDV's free build of the driver was getting upset when arguments to
trace were evaluated but not used.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoLookup active network interfaces by index rather than LUID
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>
9 years agoFix memory leak
Paul Durrant [Wed, 8 Jul 2015 13:44:07 +0000 (14:44 +0100)]
Fix memory leak

...detected by SDV.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAvoid PDO namespace conflicts...
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>
9 years agoUpdate bindings
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>
9 years agoAdd functions to backup and restore network settings
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>
9 years agoStop synthesizing the NET_LUID
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>
9 years agoMove reboot request code into driver.c
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>
9 years agoOnly open the PDO software key once
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>
9 years agoInfer REG_SZ or REG_MULTI_SZ type in RegistryUpdateSzValue()
Paul Durrant [Tue, 7 Jul 2015 14:03:12 +0000 (15:03 +0100)]
Infer REG_SZ or REG_MULTI_SZ type in RegistryUpdateSzValue()

The argument is a pointer to an array of ANSI_STRINGs in both cases so the
type can easily be inferred from the length of the array.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoAdd a type argument to the RegistryEnumerateValues() callback...
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>
9 years agoAdd functions to query and update binary values in the registry
Paul Durrant [Tue, 7 Jul 2015 13:52:18 +0000 (14:52 +0100)]
Add functions to query and update binary values in the registry

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
9 years agoRemove use of 'Addresses' subkey
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>
9 years agoRemove erroneous use of transmitter DPC
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>
9 years agoDispense with long PDO descriptions
Paul Durrant [Wed, 1 Jul 2015 16:32:51 +0000 (17:32 +0100)]
Dispense with long PDO descriptions

Windows does not present them well and they are somewhat ugly. The relation-
ship between interface versions and PDO revision is now simply logged.

Also this patch applies appropriate limits to the HardwareIDs and
CompatibleIDs.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoRelease and re-acquire backend on resume
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>
10 years agoFix Trace statement
Paul Durrant [Tue, 21 Apr 2015 12:32:15 +0000 (13:32 +0100)]
Fix Trace statement

This can cause a crash in checked builds

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoRe-work frontend xenbus state handling code
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>
10 years agoDemote the link Info message to a Trace
Paul Durrant [Thu, 16 Apr 2015 11:56:48 +0000 (12:56 +0100)]
Demote the link Info message to a Trace

It doesn't really need to go into the log

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoRemove excessive force-inlining from the frontend module
Paul Durrant [Wed, 15 Apr 2015 15:30:19 +0000 (16:30 +0100)]
Remove excessive force-inlining from the frontend module

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoAllow PdoResume() to fail
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>
10 years agoRemove excessive force-inlining from co-installer
Paul Durrant [Wed, 1 Apr 2015 16:17:35 +0000 (17:17 +0100)]
Remove excessive force-inlining from co-installer

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoLog a message to note that when a receiver is waiting for packets
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>
10 years agoPing the transmitter backend when trying to disable
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>
10 years agoFix a couple of ASSERT failures
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>
10 years agoAdd the 'NeedReboot' flag back in
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>
10 years agoFix typos and type problems in previous patch
Paul Durrant [Tue, 24 Mar 2015 10:03:09 +0000 (10:03 +0000)]
Fix typos and type problems in previous patch

Also add some extra trace statements that proved useful in debugging

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoMake XENVIF processor group aware
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>
10 years agoFix various bits of (largely autogen) stupidity in vcxproj files
Paul Durrant [Fri, 20 Mar 2015 11:48:30 +0000 (11:48 +0000)]
Fix various bits of (largely autogen) stupidity in vcxproj files

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoUpdate headers to xen.git:f919dbc0583797d1c5c09da815518084ce77eb81
Paul Durrant [Fri, 20 Mar 2015 11:20:24 +0000 (11:20 +0000)]
Update headers to xen.git:f919dbc0583797d1c5c09da815518084ce77eb81

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>
10 years agoFix line endings
Paul Durrant [Fri, 20 Mar 2015 10:01:28 +0000 (10:01 +0000)]
Fix line endings

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoMove util.h from include to src/xenvif
Paul Durrant [Fri, 20 Mar 2015 09:59:07 +0000 (09:59 +0000)]
Move util.h from include to src/xenvif

It should be co-located with headers such as assert.h and names.h

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoDisambiguate transmitter packet caches
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>
10 years agoSet script file execute permissions
Paul Durrant [Thu, 12 Mar 2015 11:29:26 +0000 (11:29 +0000)]
Set script file execute permissions

The lack of execute persmission causes clones done using cygwin git to
leave scripts in a non-executable state.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoGet rid of Granter abstraction
Paul Durrant [Mon, 9 Mar 2015 15:02:09 +0000 (15:02 +0000)]
Get rid of Granter abstraction

Since the addition of GNTTAB Caches in XENBUS, the Granter abstraction in
XENVIF has been fairly pointless. This patch finally gets rid of it.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoFix memory leak
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>
10 years agoFix WHQL induced BSODs
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>
10 years agoFix VS2013 SDV failures
Paul Durrant [Mon, 2 Mar 2015 15:45:24 +0000 (15:45 +0000)]
Fix VS2013 SDV failures

The code in registry.c needs the same prefast suppression as it does in
XENBUS.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoRelease lower bus interface before passing removal IRP to PDO
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>
10 years agoUpdate to EVTCHN version 3
Paul Durrant [Tue, 3 Feb 2015 14:02:02 +0000 (14:02 +0000)]
Update to EVTCHN version 3

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoA single queue to the backend should imply and index of 0
Paul Durrant [Tue, 3 Feb 2015 10:20:55 +0000 (10:20 +0000)]
A single queue to the backend should imply and index of 0

There is no need to test for both so change the extra test into an
assertion.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
10 years agoFix type mismatch
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>