Owen Smith [Wed, 13 Nov 2019 15:43:54 +0000 (15:43 +0000)]
Reduce xenstore churn
Only write the complete changes to the xenstore MAC address table. There
is no need to write the complete table for each addition or removal,
when additions and removals are processed in a single update.
Pushes the responsibility for writing the MAC table to
FrontendSetMulticastAddresses() once all changes are made, instead of
for each call to MacAddMulticastAddress() or MacRemoveMulticastAddress()
Owen Smith [Fri, 14 Jun 2019 16:16:20 +0000 (17:16 +0100)]
Add PowerShell build scripts, version.vcxproj
Based on the sequence of commits to xenbus, add powershell scripts to
build the solution using the EWDK
version.vcxproj generates versioned files (version.h and xenvif.inf) using
scripts/genfiles.ps1
Strips duplicated functionality from build.py to produce consistant
builds between python and powershell.
Paul Durrant [Fri, 31 May 2019 09:53:45 +0000 (10:53 +0100)]
Stop lying about the lock state when calling into XENBUS_CACHE
Various cache access that used to be under protection of the reciver ring
lock are no longer subject to that lock, and thus the 'Locked' parameter
passed to the Get/Put methods needs to be FALSE rather than TRUE.
This bug was not spotted under recent changes applied to the implementation
of XENBUS_CACHE, which removed use of atomic bit operations.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 17:16:58 +0000 (17:16 +0000)]
Allow advertised 'wire' speed to be overridden by a registry value...
...and change the default to 100G.
This patch adds code to check for a new 'MacSpeed' XENVIF parameter
(sampled at initialization time), defaulting to a wire speed of 100G if
it is not present (rather than the 1G default prior to this patch).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 15:51:31 +0000 (15:51 +0000)]
Add a xenstore watch for the "speed" key...
...and allow the value to specify units.
The 'wire' speed advertised by XENNET to the Windows network stack can be
controlled by the value of a "speed" key in the xenstore frontend area.
Values of this key are currently interpreted as decimal gigabits-per-second.
This patch sets a watch on the key (meaning changes to it now take
immediate effect) and allows units to be specified: 'G/g' for gigabits-per-
second, 'M/m' for megabits-per-second, and 'K/k' for kilobit-per-second.
Thus, for example, '100M' means 100 megabits-per-second. If no unit is
specified then the value is assumed to be in gigabits-per-second, as before.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 14:16:40 +0000 (14:16 +0000)]
Set packet transmit completion information outside of ring lock
There is no need to hold the ring lock to update the packet transmit
completion information, or update the frontend statistics. This patch
creates a new __TransmitterSetCompletionInfo() function and calls this
just before returning each packet to XENNET, after the ring lock has been
dropped.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 11:49:06 +0000 (11:49 +0000)]
Don't force event channel unmasking
The effect of efbe65aa "Make use of possible XENBUS_EVTCHN Unmask failure"
was lost when the poller subsystem was reverted. This patch re-instates
equivalent functionality.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 11:42:47 +0000 (11:42 +0000)]
Get rid of the 'Retry' exit from the ring poll routines
This was supposed to allow better interleaving of receive and transmit
polling, but this does not really seem to help so it really only makes
the code more complex than it needs to be.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 11:34:39 +0000 (11:34 +0000)]
Re-instate 264bde12 "Introduce a threaded DPC into the receiver code"
This patch re-works 264bde12 such that it apply (after reversion of the
poller subsystem), including re-naming the unqualified 'Dpc' and 'Dpcs'
fields in the receiver and transmitter ring structures to 'PollDpc' and
'PollDpcs' to disambiguate them from the new threaded 'QueueDpc' and
associated 'QueueDpcs' counter.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 2 Nov 2018 11:09:11 +0000 (11:09 +0000)]
Remove KTIMERS from transmit and receive paths (again)
Even though the poller subsystem has been reverted, these still need to
go away as they do not adequately serve the purpose for which they were
added: DPC watchdog avoidance.
A subsequent patch will re-instate the threaded DPC in the receiver to
avoid the DPC watchdog.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 1 Nov 2018 14:14:38 +0000 (14:14 +0000)]
Revert complete poller subsystem
It seems to have a bad effect on performance that various attempts at
improvement just don't seem to be able fix, so this patch just gets rid
of the whole thing.
This patch reverts the following commits:
264bde12 "Introduce a threaded DPC into the receiver code" 129ad516 "Stop using a threaded DPC in the poller" 5932938b "Don't bump the receiver event counter if the poller is going to retry" 16002b8f "poller: fix event channels when backends do not support multi-queue" bc722edd "Don't use KTIMERs in receive path" dfaa68cc "Don't affinitize timer DPC" eac9a95a "Move the Receiver and Transmitter event and DPC processing..." 40be5c12 "Add the boilerplate for a new Poller sub-system"
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 1 Nov 2018 16:43:32 +0000 (16:43 +0000)]
Revert "Replace uses of MmAllocatePagesForMdlEx in __AllocatePage"
This reverts commit 4f85d004. This patch was put in place to work around
a bug in Windows but seems to have a serious negative effect on
performance. The bug in Windows has since been fixed so the patch can now
be reverted to recover performance.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 1 Nov 2018 14:59:10 +0000 (14:59 +0000)]
Revert reversion of "Deferring transmit completion causes...
... MPE_Ethernet test failures""
This reverts commit 0f91d01d as it is very detrimental to performance. It
appears that deferring transmit completion events roughly halves TCP
throughput.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 18 Sep 2018 13:48:49 +0000 (14:48 +0100)]
Introduce a threaded DPC into the receiver code
To avoid problems with DPC timeouts move the majority of the receiver's
work, and interaction with the network stack, into a threaded DPC. This
leaves the poll entry point (called from the now non-threaded poller DPC)
to simply service responses and build a local packet queue that is then
drained by the threaded DPC.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 18 Sep 2018 13:30:21 +0000 (14:30 +0100)]
Use a reader/writer lock in the mac module
Each receiver thread needs to call MacApplyFilters() but the implementation
uses a normal kernel spin lock and hence the threads will all contend the
lock. Switch the mac code to use a reader/writer lock so that
MacApplyFilters() can acquire the lock as a reader and thus avoid causing
the contention.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 18 Sep 2018 13:24:15 +0000 (14:24 +0100)]
Make sure event counter is updated before finish receiver ring poll
There was a flaw in commit 5932938b "Don't bump the receiver event counter
if the poller is going to retry" in that it is possible to drop out of
poll without ever updating the event counter (if one attempt requests a
retry and the next attempt finds nothing to do). This patch fixes the
issue by using the RING_FINAL_CHECK_FOR_RESPONSES macro to update the
event counter, which checks for a race with new responses.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 18 Sep 2018 13:18:14 +0000 (14:18 +0100)]
Stop using a threaded DPC in the poller
The threaded DPC was introduced by commit bc722edd "Don't use KTIMERs in
receive path" but it appears to have too much of an impact on performance.
This patch reverts the poller to a normal DPC but does not introduce any
DPC timeout mitigation. That will be done by a subsequent patch.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Fri, 24 Aug 2018 16:46:43 +0000 (17:46 +0100)]
Conditionally package DPInst
Since DPInst.exe is not shipped with the Windows Driver Kit 10, an
environment variable must point to local copies. Make the inclusion of
DPInst conditional on DPINST_REDIST being defined and that path
existing. This simplifies building packages which do not require DPInst
for installation, and removes a required step to create a working build.
Paul Durrant [Mon, 6 Aug 2018 12:11:39 +0000 (13:11 +0100)]
Don't bump the receiver event counter if the poller is going to retry
There is little point in bumping rsp_event (to trigger a new event from
the backend) if the poller is going to retry, so we can save modifying the
shared ring in this case.
This patch also adds extra debug code to the poller to make sure it never
exits from the main loop until either there are no retries pending or
the instance has been disabled.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
CL emits a warning about every place that will get spectre mitigation
when compiled with /Qspectre. Even if this option is already used. This
breaks the build if warnings are treated as errors.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Also disable the same warning in the co-installer build.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Ben Chalmers [Tue, 10 Jul 2018 10:09:59 +0000 (11:09 +0100)]
Replace uses of MmAllocatePagesForMdlEx in __AllocatePage
Windows appears to have an edge case bug in which zeroing
memory using MmAllocatePAgesForMdlEx (which in Win 10 1803
happens even if you specify MM_DONT_ZERO_ALLOCATION) can cause
a BSOD 139 1e.
This commit uses MmAllocateContinguousMemorySpecifyCache
to allocate memory instead, then builds and Mdl to wrap
it up.
__AllocatePages is left unchanged (as we don't want
to allocate multiple contiguous pages). This issue
has not been seen outside of xenvif calls to
__AllocatePage and we expect a fix to the underlying
Windows problem in the near future
Chris Patterson [Wed, 21 Feb 2018 09:54:57 +0000 (09:54 +0000)]
poller: fix event channels when backends do not support multi-queue
The event channels for rx & tx are written to a multi-queue formatted
path even when multiple queues are not supported. This results in a hung
VM with the following logs:
XENBUS|EvtchnWait: TIMED OUT: Count = 00000001 Channel->Count = 00000000
...
This can be reproduced by having a Linux VM network backend with 1 vCPU.
If FrontendGetNumQueues() is 1 and multiple queues are not supported,
the following paths are used for the poller event channel:
device/vif/1/queue-0/event-channel-[rx|tx]
However, the proper xenstore path in this case is:
device/vif/1/event-channel-[rx|tx]
PollerInstanceInitialize() sets its path using FrontendFormatPath(),
which assumes a multi-queue path layout. This is done in a fashion
similar to the transmitter and receiver rings. However, the tx/rx rings
check for the mutually supported number of queues to determine the
actual path written to xenstore, using FrontendGetNumQueues(). See
__TransmitterRingStoreWrite() and __ReceiverRingStoreWrite(). This patch
adds a similar procedure for the poller to write to the appropriate path
in xenstore.
Paul Durrant [Fri, 26 Jan 2018 15:08:15 +0000 (15:08 +0000)]
Don't use KTIMERs in receive path
They appear to always defer by at least one timer tick, which is about 16ms
by default... just too long.
Instead, to avoid DPC watchdog issues in the MPE_Ethernet test, use a
threaded DPC. This is a real-time thread that can be pre-empted by normal
DPCs but not by standard system threads.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 24 Jan 2018 14:40:53 +0000 (14:40 +0000)]
Fix NDISTest6.5 CheckConnectivity and others
Commit e5e64b57 "Don't try to __FreePages() with local copy of MDL"
introduced subtle breakage into the receive path.
Prior to this patch, for the MDLs embedded in receiver packets, it was
always true that Mdl->MappedSystemVa == Mdl->StartVa + Mdl->ByteOffset.
However, after the commit, Mdl->StartVa was left as NULL in the assumption
that Mdl->MappedSystemVa would always be used to access the buffer. Sadly
this appears not to always be the case and in fact, wdm.h carries this
comment:
// Notice that while in the context of the subject thread, the base virtual
// address of a buffer mapped by an MDL may be referenced using the
// following:
//
// Mdl->StartVa | Mdl->ByteOffset
//
So the the previous setting of StartVa is indeed documented, and clearly
something in the network tests is relying on it.
This patch modifies the MDL allocator code in util.h to alwasy set StartVa,
and modifies the receiver code to carry this field forward into the
embedded MDLs. It also removes some code duplication in ReceiverPacketCtor()
and __ReceiverRingPutPacket().
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 20 Oct 2017 17:14:28 +0000 (18:14 +0100)]
Make use of possible XENBUS_EVTCHN Unmask failure
Bump up to the latest version of XENBUS_EVTCHN and specify the option
to Unmask that allows it to fail. In this circumstance it is possible to
avoid dropping out of the DPC and thus avoid a context switch and re-queue.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 18 Oct 2017 14:02:52 +0000 (15:02 +0100)]
Move the Receiver and Transmitter event and DPC processing...
...into the new Poller sub-system.
For efficiency it is desirable to have a single DPC handle both Receiver
and Transmitter polling, even if there are separate event channels for
the shared rings.
This patch moves all the basic event and DPC code into the Poller
subsystem, which calls back into the Transmitter and Receiver sub-systems
(to poll the shared rings) from its single per-CPU DPC.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 16 Oct 2017 10:20:17 +0000 (11:20 +0100)]
Add the boilerplate for a new Poller sub-system
The intention is that the separate Receiver and Transmitter event and DPC
handling be combined into a single sub-system. This patch lays the ground-
work for that to be done.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 8 May 2017 16:10:48 +0000 (17:10 +0100)]
Reboot request keys should be volatile
When a driver makes a reboot request it should use a volatile registry key.
The monitor service will explicitly remove the key prior to reboot but,
if the reboot is initiated in some other way and the key is non-volatile,
the monitor service will then needlessly prompt for a second reboot.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 10 Jan 2017 16:53:08 +0000 (16:53 +0000)]
Don't use Packet->Offset when stripping VLAN tags
The WHQL tests have always been buggy when dealing with packet data that
is offset into the NET_BUFFER MDL chain. Instead, adjust the MappedSystemVa
of the initial MDL.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 10 Jan 2017 10:29:53 +0000 (10:29 +0000)]
Don't try to __FreePages() with local copy of MDL
The XENVIF_RECEIVER_PACKET structure contains an embedded MDL so that
multi-fragment packets can be properly chained together. However this
structure should not be passed to __FreePages() as:
a) It appears to create problems with system PTE tracking
b) It results in memory corruption now that __FreePages() calls
ExFreePool()
This patch therefore extends the packet structure with a pointer to the
original system MDL such that it can be passed to __FreePages() when the
packet destructor is called.
The patch also bypasses some calls to MmGetSystemAddressForMdlSafe() since
we can ASSERT that the MDL is already mapped to a system address.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 15 Dec 2016 14:00:42 +0000 (14:00 +0000)]
Remove unnecessary complexity from the controller frontend
The controller ring is driven much like the store ring in XENBUS for
request/response but, unlike the store ring, there are no asynchronous
events (like watches) so we really don't need a DPC and an asynchronous
poll, or a watchdog.
This patch removes that code, and also shortens the poll timeout when
waiting for a response since use of XENBUS_EVTCHN(...Wait...) is
inherently racey.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 14 Dec 2016 15:52:52 +0000 (15:52 +0000)]
Fixes for VS2015/WDK10 build
The package build was not working correctly and caused the overall build
to fail.
At least part of the reason for this is that Microsoft, in their infinite
wisdom, have removed the DIFx redist from WDK10. This patch makes use of
a new environment variable 'DPINST_REDIST' to find the copy of dpinst.exe
to package such that this can be pointed at an older WDK or alternative
location where dpinst.exe can be found.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 12 Dec 2016 16:31:50 +0000 (16:31 +0000)]
Add support for building under VS2015/WDK10
Moving to the new toolchain also threw up a few new warnings, which this
patch either fixes or squashes. Also, SDV appears to be fragile in new
ways (and whinge about some new things) so there are fixes for that too.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 7 Nov 2016 11:35:09 +0000 (11:35 +0000)]
Provide registry override for disabling RSS
For diagnostic purposes it is useful to be able to simulate the situation
where XENVIF does not support RSS (because the backend does not support
it).
This patch adds code to check a REG_DWORD value called
'FrontendDisableToeplitz' and will not allow the Toeplitz hash algorithm
to be configured if the value is non-zero. This prevents XENNET from
advertizing the RSS capability to the network stack.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 4 Nov 2016 16:15:09 +0000 (16:15 +0000)]
Add more diagnostic messages
Log a message at start and end of both transmitter and receiver
ring enable and disable functions. Testing has thrown up some hangs
that appear to be in one of these functions.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 4 Nov 2016 15:13:25 +0000 (15:13 +0000)]
Add registry override to disable multicast control
The patch adds a registry parameter 'TransmitterDisableMulticastControl'.
This is a REG_DWORD which, if set to a non-zero value, will prevent
XENVIF from using the dynamic-multicast-control feature of the backend.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 4 Nov 2016 10:51:54 +0000 (10:51 +0000)]
Always select queue using the packet hash algorithm
There may be a mismatch between the configured receive hash algorithm
and the actual algorithm present in a transmit-side packet.
E.g. Toeplitz may be configured but a transmitted packet may have no
hash information.
It makes no sense to use a hash mapping table configured for a Toeplitz
hash if the packet hash is not Toeplitz, therefore the code should pass
the actual packet hash algorithm into the FrontendGetQueue(). This patch
makes the that change.
Suggested-by: Owen Smith <owen.smith@citrite.net>
This patch also makes sure we cannot attempt to indirect through a zero-
sized mapping table (thereby incurring a divide-by-zero exception).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 3 Nov 2016 09:48:23 +0000 (09:48 +0000)]
Change where transmitter packet cache is created
The transmitter packet cache suffers from a similar issue as the
receiver packet cache did before commit 0dda5aa8 "Partially revert
commit ab655bb1...". If the VM goes through a suspend/resume cycle
with queued transmits then the cache would be torn down before all
objects had been freed, leading to ASSERTion failures in checked
builds and memory corruption in free builds.
This patch moves creation of the packet cache from the 'connect'
phase to the 'initialization' phase to avoid this problem.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 2 Nov 2016 12:02:37 +0000 (12:02 +0000)]
Log how many packets are aborted
When the transmitter rings are shut down, packets in the queues are
aborted. This patch adds a log line saying how many packets were
aborted in each queue.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 2 Nov 2016 11:51:54 +0000 (11:51 +0000)]
Add an extra transmitter ring poll
If we are trying to post fragments into the ring and find it full then
do a single poll to try to free up the space, rather than bailing and
waiting for the DPC to run.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Not all interfaces need to be released (since they don't all depend on
Xen) and crucially the receiver packet caches CANNOT be destroyed (and
hence the CACHE interface CANNOT be released) because there may be packets
outstanding in the stack... not necessarily in an S4 transtion, but
across a suspend/resume (which involves the same frontend state
transitions).
This patch also increases the log level of a couple of messages
emitted during frontend state transtions from 'trace' to 'info'.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 3 Oct 2016 14:10:38 +0000 (15:10 +0100)]
Incorporate revision ids from staging-8.1
Since it should be possible to upgrade from an 8.1 version of XENVIF
to an 8.2 version, at least the release revision of the 8.1 version
(0x0800000A) should be present in the 8.2 revision table, otherwise
driver upgrade will be vetoed by the co-installer if an 8.1 XENNET
is bound.
This patch incorporates all missing 8.1 revision ids.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Mon, 3 Oct 2016 12:03:37 +0000 (13:03 +0100)]
Avoid possible NULL pointer dereference
If the packet cache is exhausted and unable to allocate more items, fail
before attempting to use the pointer. Moves the check to after
attempting to get a packet cache item.
Signed-off-by: Owen Smith <owen.smith@citrix.com>
Slight re-structuring of the error check.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Ben Chalmers [Wed, 28 Sep 2016 15:05:34 +0000 (16:05 +0100)]
Remove watchdog affinitisation on Windows 2008
Despite the presence of a compatability library, the
Windows 2008 calls to affinitise the watchdog thread
to a particular processor group are leading to lockups.
So detect if we are running on a version prior to
Windows 7 (or 2008 R2), and don't try to affinitise if
we are.
Signed-off-by: Ben Chalmers <ben.chalmers@citrix.com>
Paul Durrant [Wed, 21 Sep 2016 12:46:14 +0000 (13:46 +0100)]
Fix a couple of issues picked up by Windows 10 verifier
- It's possible for MmAllocatePagesForMdlEx() not to satisfy the
full allocation request, but not fail. Thus AllocatePage() should
check that the completed allocation actually matches what it
asks for.
- RegistryCreateKey() has a memory leak.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
The ASSERTion fix in this commit was wrong and lead to NIC unplugs being
missed. This fix simply makes sure the PDO flag is set to FALSE to
avoid tripping over the zero-memory ASSERTion later on in PdoDestroy().
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Tue, 20 Sep 2016 17:06:14 +0000 (18:06 +0100)]
Step through hardware revision list in reverse order
Windows treats the HardwareID list as a decending order of specialization
where the first entry is the most specific, and last entry is least
specific. This can lead to install issues when the newer driver has a
less-specific HardwareID, as the older ("more-specific") HardwareID is
used for the match. Reordering the HardwareID list, so that the newest
revision is first, will stop Windows selecting the wrong driver package
to install.
Signed-off-by: Owen Smith <owen.smith@citrix.com>
Re-factored slightly for code consistency.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 20 Sep 2016 16:43:27 +0000 (17:43 +0100)]
Add statistics for checksum validation
For the transmit side this also entails added code to perform checksum
validation. However, since this may affect performance, validation is
only performed if the registry parameter TransmitterValidateChecksums
(REG_DWORD) is present and set a non-zero value.
Since the index values of the statistics used by XENNET are left
unchanged by this patch, there is no need to bump the XENVIF_VIF
interface version.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 20 Sep 2016 13:15:06 +0000 (14:15 +0100)]
Pass the receive queue index to XENNET
Update the XENVIF_VIF interface to version 8 to include an extra 'Index'
parameter to the XENVIF_RECEIVER_QUEUE_PACKET callback. This means
XENNET no longer has to use current CPU to decide which queue is which.
This patch also fixes a couple of ASSERTion failures seen in debugging.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 8 Sep 2016 10:09:17 +0000 (11:09 +0100)]
Don't restore settings from emulated device more than once
If, for some reason, the VM boots with emulated networking then network
settings will be saved from the emulated network device. Then, when the
VM reboots with PV networking, those settings are restored to the PV
network device regardless of whether it was freshly installed or has
been around for some time.
This patch makes sure that settings are restored only to a freshly
installed PV device.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 7 Sep 2016 15:25:52 +0000 (16:25 +0100)]
Revert all settings stealing patches
Windows has completely defeated me. There appears to be no way to
duplicate the stack binding of the emulated device without that binding
being removed if XENNET is un-installed, despite clearing all the
relevant registry keys in the DIF_REMOVE pre-process phase.
So, this patch reverts the code back to using the settings copy
mechanism employed in the 8.1 source.
Paul Durrant [Mon, 15 Aug 2016 13:06:30 +0000 (14:06 +0100)]
Add batching support
If a NET_BUFFER_LIST comprising multiple NET_BUFFERs is handled by XENNET
then this will result in multiple calls to VifTransmitterQueuePacket().
There is no need to attempt to process the transmit queue after every single
one of these calls, it suffices to just do it after the last of them. Hence
this patch adds an extra argument such that XENNET can notify XENVIF when
the last call of a batch is made.
Similarly on the receive side, it is useful notify XENNET when the last of
a batch of calls to the XENVIF_RECEIVER_QUEUE_PACKET callback is made, since
XENNET can then batch received packet indications to the NDIS stack.
These changes are made in XENVIF_VIF_INTERACE version 7.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 11 Aug 2016 10:03:42 +0000 (11:03 +0100)]
Advertise MAC address information in the registry
Because XENNET's co-installer is again taking responsibility for messing
with network settings it needs to be able to figure out which VIF instance
corresponds to which emulated device, and the only way it can do that is
by MAC address.
This patch therefore restores the old 'Addresses' subkey under XENVIF's
service key and populates it with REG_SZ values named with PDO names and
containing hex encoded ':' separated MAC address octets.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 10 Aug 2016 12:51:22 +0000 (13:51 +0100)]
Remove settings code
Unfortunately, after extensive testing of different scenarios, it seems to
be impossible to properly steal and restore network stack bindings from
within the XENVIF driver. Windows has already sampled some of the values
we need to modify and thus we cannot successfully modify them.
It appears the only way we can successfully use settings from an emulated
device is to do what the settings code was attempting to do, but do it
in XENNET's co-installer during the pre-install and pre-removal phases.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>