Under driver verifier with low resources simulation the
attempt to access NIC configuration may fail, important
fields of the context are not initialized correctly
causing driver verifier BSOD on attempt to allocate
zero bytes from memory. Fail initialization if the NIC
configuration is not accessible.
Signed-off-by: Yuri Benditovich <[email protected]>
Read-write lock is created with MiniportContext=NULL because
this happens in the constructor when this field in adapter
context is not populated yet. Pass miniport context as parameter
to the constructor of adapter object and propagate it to the
RSSParameters member.
Signed-off-by: Yuri Benditovich <[email protected]>
Global value of max RX buffers, shared among queues, is
bad idea. It is especially bad when memory allocation
during queue initialization may fail, for example in case
of driver running under driver verifier. Changing the
global field to per-queue field.
Signed-off-by: Yuri Benditovich <[email protected]>
Currently the driver always assume the maximim packet size
is ~64K as it is compiled with RSC support. The initial
reason was that if the RSC is disabled by admin (registry
value of the driver), it can be turned on by command, i.e.
without disable-enable. However this depends also on host
features. If the host does not support the GUEST_TSOx,
RSC will be reported to the OS as not supported but the
buffers are still huge without any reason.
(In such case the powershell reports IPv4 and IPv6 operational
state as Off even if the RSC keywords are enabled).
The commit moves the decision to initialization time - if the
RSC is not supported, the buffers are sized accoring to MTU.
The memory consumption is lower 16 times.
Signed-off-by: Yuri Benditovich <[email protected]>
https://issues.redhat.com/browse/RHEL-19814
Do not allocate redundant memory, use full 4K+ pages when
needed, tail of the data (usually small) allocate together
with header/indirect block and make this block smaller than
4K when possible. This reduces 10% of all the shared memory
allocated for RX buffers. For non-RSC configuration it is
possible to reduce much more (for future).
Signed-off-by: Yuri Benditovich <[email protected]>
Split the decisions about size of shared buffers for RXQ and
allocation of shared memories. Create optimal layout of RX shared
buffers before creation of queues; allocate the memories according
the layout. Initially optimized layout is desabled and we create
the "legacy" layout, fully compatible with what was done before.
This commit contains only creation of the layout, it is not yet
applied when allocating RX buffer's memories.
Signed-off-by: Yuri Benditovich <[email protected]>
Fixes: https://issues.redhat.com/browse/RHEL-32200
Supporting poll mode flows is very complicated in
case the driver acts as protocol driver above VF
device, so the driver will ignore the poll mode setting
in case it works in standby mode. If the VF driver does
not use the poll mode everything will work the same way
as in Win10. If the VF driver uses poll mode it reports
incoming packets from its poll mode handler already and
the NetKVM just indicates the packets up.
Signed-off-by: Yuri Benditovich <[email protected]>
Main thing is always understand what is the source of the
notification/trigger, this may be, for example TX, RX, RSS
Signed-off-by: Yuri Benditovich <[email protected]>
The packets might be stuck in send queue or in waiting list.
The recovery is simple - trigger TX processing of completed
and pending packets. Can be called from any external place,
for example from CheckForHang handler.
Signed-off-by: Yuri Benditovich <[email protected]>
This provides simple way to build the driver with minimal
modification and enable poll mode on any NDIS 6.85+,
for engineering testing purposes.
Signed-off-by: Yuri Benditovich <[email protected]>
There is no clear techical reason why the maximal size of
large UDP packet should be different from one of large TCP
packet. But currently (kernel mainstream, current kernel 6.9
and all earlier kernels) kernel defines UDP_MAX_SEGMENTS as 64.
Minimal MSS in Windows is 536, so we report maximal size of
UDP packet as 64 * 536, such a way we'll never get from OS
UDP packets that can't be transmitted.
Signed-off-by: Yuri Benditovich <[email protected]>
https://issues.redhat.com/browse/RHEL-17932
Win11 driver supports poll mode when runs on server 2025
(runtime NDIS version 6.89)
On earlier versions Win11 driver contains *NdisPoll keyword
but this keyword does not make any behavioral change.
Signed-off-by: Yuri Benditovich <[email protected]>
In case we determine that the packet should be delivered
on from the different RSS queue than current one - we
trigger respective poll handler (if any) instead of queue DPC.
Signed-off-by: Yuri Benditovich <[email protected]>
If poll mode is fully enabled we do not trigger DPC for
RX and TX interrupts, we trigger respective poll handler instead.
Signed-off-by: Yuri Benditovich <[email protected]>
This procedure will be called from poll handler, it retrieves
packets from RX virtqueue (if any) and gets NBLs from RSS queue
instead of indicate them to NDIS.
Signed-off-by: Yuri Benditovich <[email protected]>
In existing build the (un)registration is implemented as
a stub procedure. To start function we need the define
PARANDIS_SUPPORT_POLL.
Signed-off-by: Yuri Benditovich <[email protected]>
This additional getter allows to query current NDIS version
of the OS regardless whether we compile the driver for such version
or not. For example: the driver is built for NDIS 6.85, it runs on
Server 2025 (NDIS 6.89 or higher), effective version will be 6.85
but in the code we are able to check whether the OS supports 6.89.
Signed-off-by: Yuri Benditovich <[email protected]>
Split tx,rx and rss statistics
Add property for [initial] configuration data
Make reset of statistics selective and explicit
Add metrics for:
- minimal number of rx buffers
- indications with 'resource' flag
- amount of allocated shared memory
Signed-off-by: Yuri Benditovich <[email protected]>
Implemented a workaround for rx packet loss encountered with TCP_NODELAY. By default,
this feature is turned off to minimize the impact on CPU performance and network bandwidth.
To activate the feature, go to the network card properties and set the MinRxBufferPercent
to a value above 0. A good starting point is to set MinRxBufferPercent to 25% and then monitor
for any packet loss. If packet loss continues, incrementally adjust the value to 50%, then 75%,
and if necessary, up to the maximum of 100%.
In extreme cases, it may be required to not only adjust the MinRxBufferPercent but also to increase
the number of queues and the size of each queue (queue_size).
It is important to note that this feature is only applicable to rx packet loss.
For more details, see [this thread](https://github.com/virtio-win/kvm-guest-drivers-windows/issues/1012).
Signed-off-by: junjiehua <[email protected]>
This commit updates the CNB::BindToDescriptor method signature, changing
the return type from a boolean to the newly introduced NBMappingStatus
enum. The updated method now returns one of the following statuses:
NBMappingStatus::SUCCESS
NBMappingStatus::NO_RESOURCE
NBMappingStatus::FAILURE
This change allows for more detailed reporting of the binding operation
outcome, enabling the caller to distinguish between different failure
reasons beyond the previous binary success/failure indication. The
NBMappingStatus enum provides a clearer, more expressive way to handle
the results of the binding process.
Signed-off-by: Zhang JianMing <[email protected]>
This commit introduces the CopyFromMdlChain function to the CNB class. The function is responsible for copying data from a Memory Descriptor List (MDL) chain to a specified destination buffer. A special focus has been given to ensuring the function handles the traversal of the MDL chain correctly, updating the Source MDL pointer and the Offset within the current MDL as it progresses through the chain.
Signed-off-by: Zhang JianMing <[email protected]>
This commit introduces the MAX_FRAGMENTS_IN_ONE_NB macro, which
defines the maximum number of fragments in a single NET_BUFFER. It
is used to constrain the SGTableCapacity value, ensuring it does
not exceed the meaningful limit set by MAX_FRAGMENTS_IN_ONE_NB.
Signed-off-by: Zhang JianMing <[email protected]>
This commit introduces extra pages within the TXManager module,
which are intended to support the copy mechanism that will be
implemented in subsequent updates. The addition of these pages lays
the groundwork for the new functionality and ensures that the
TXManager is prepared for the enhancements.
Signed-off-by: Zhang JianMing <[email protected]>
https://issues.redhat.com/browse/RHEL-20575
Currently the driver get RX descriptor from the rx virtQ,
analyses it (L2/L3), calculates hash and delivers to the
proper RSS queue. Later it extract the packet from the RSS
queue and checks whether it passes RX filters.
Now we move the filtering to the earliest stage - just after
basic analysis.
Note that in case of vhost there are no receive filters
configured by the host and typically the host does not work
in promiscuous mode, so it is redundant to calculate the hash
and trigger the RSS queue for packets that should be dropped.
Signed-off-by: Yuri Benditovich <[email protected]>