Commit Graph
42 Commits
Author SHA1 Message Date
Yuri Benditovich 84609ae0de netkvm: support of VF statistics
Currently in the statistics reported by the netkvm adapter does
not include the packets transmitted via VF and received from VF.
The commit fixes it: it maintains the VF statistics and on each call
adds the difference of first call it saves the statistics of VF,
on further calls if updates netkvm statistics.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 7ce3833594 netkvm: move SET_LINK IOCTL to separate procedure
Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 0e44fb5aa6 netkvm: external management of binding states
The protocol part (VF binding) is changed to change it's state
when required to do so by the protocol service.
Only VF removal changes the state of binding/netkvm adapter
without external request.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 4c4c84eff0 netkvm: fix RX packets counting in the protocol implementation
If the bound VF adapter reports a packet with RESOURCES flag
the protocol handler must never return it and also NDIS never
returns it, the VF driver retains the ownership. Fix the
counting for such packets. We can see sometimes such packets
at least with I350 VF.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich 333aa33cc2 netkvm: fix memory leak in case of rejected binding
When the OS tries to bind the netkvm adapter to VIOPROT
the driver rejects the binding, but a memory leak happens.
Current commit solves it.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Yuri Benditovich ba6d0f6eae netkvm: add control device to the driver
Control device lifecycle follows one of failover protocol, i.e.
created with first virtio-net device and deleted with the
removal of the last one. User-mode component can use device
IO controls to access it.

Signed-off-by: Yuri Benditovich <[email protected]>
2023-07-02 12:57:58 +03:00
Kostiantyn Kostiuk e169859ae5 NetKVM: Use 'enum class' instead of 'enum' (CA warning 26812)
Update _tagPARANDIS_RSS_MODE enum.

Signed-off-by: Kostiantyn Kostiuk <[email protected]>
2021-09-19 09:40:30 +03:00
Kostiantyn Kostiuk a5a72476c5 NetKVM: Use 'enum class' instead of 'enum' (CA warning 26812)
Update NotifyEvent enum

Signed-off-by: Kostiantyn Kostiuk <[email protected]>
2021-09-19 09:40:30 +03:00
Viktor Prutyanov 2148fb1604 NetKVM: fix uninitialized variables (CA)
Signed-off-by: Viktor Prutyanov <[email protected]>
2021-09-12 09:10:39 +03:00
Viktor Prutyanov 90bc6b5c3a NetKVM: add status check (CA)
Signed-off-by: Viktor Prutyanov <[email protected]>
2021-09-12 09:04:22 +03:00
Viktor Prutyanov 95dcb7216b NetKVM: fix possible 'Nbl' NULL pointer usage (CA)
Protect NdisSendNetBufferLists from passing Nbl == NULL.

Signed-off-by: Viktor Prutyanov <[email protected]>
2021-09-12 09:04:22 +03:00
Yuri Benditovich 2c6d460c64 netkvm: add 100 ms delay before link up on VF attach
On 2012r2/Win8.1 there is additional pause-restart after
the adapter is bound. So the adapter may complete first DHCP
packets with error if we try send them when the VF is paused.

Signed-off-by: Yuri Benditovich <[email protected]>
2021-04-01 15:11:46 +03:00
Yuri Benditovich f0863c1290 netkvm: fix 'level' parameter for WPP macro
For correct WPP macro expansion we need to place the first
parameter into parentheses or define it as local variable.

Signed-off-by: Yuri Benditovich <[email protected]>
2021-04-01 15:11:46 +03:00
Yuri Benditovich e8d8decb27 netkvm: for failover virtio-net suppress link-up until VF bound
If the device reports standby feature but the protocol is not
installed yet or VF not present suppress the link-up indication
until the VF comes first time. After that the link-up follows
link status of the device until the driver is disabled.
Set packet filter (effectively enable the RX from the VF) after
the link-up is indicated.

Signed-off-by: Yuri Benditovich <[email protected]>
2021-04-01 15:11:46 +03:00
Yuri Benditovich c508a21e67 netkvm: suppress the RX upon binding to VF
Suppress the RX activity of VF until the VF is attached
to the NETKVM adapter

Signed-off-by: Yuri Benditovich <[email protected]>
2021-04-01 15:11:46 +03:00
Yuri Benditovich c9cedfef67 netkvm: run VF queries after successful open
Signed-off-by: Yuri Benditovich <[email protected]>
2021-04-01 15:11:46 +03:00
Yuri Benditovich 2612a23f60 netkvm: reject binding attempt to netkvm
https://bugzilla.redhat.com/show_bug.cgi?id=1925916
Currently the notify object prevents binding of vioprot
to virtio adapter only at installation time and only
due to the fact that virtio adapter is not in the list
of supported adapter. It is still possible to enable
this binding manually and this will cause infinite
recursion of oids or sent packets.
Add detection of such case and prevent the binding.

Signed-off-by: Yuri Benditovich <[email protected]>
2021-02-09 10:59:59 +02:00
Yuri Benditovich 29e549280b netkvm: do not assume the binding exists for known MAC
https://bugzilla.redhat.com/show_bug.cgi?id=1924994

When the netkvm adapter is added it is possible that the
entry with the same MAC already exists.
It might be entry from another adapter that was removed
but still did not finish the removal flow. It might be even
another adapter with duplicated MAC address (which is wrong
but not fatal). So we need to create an entry for each
adapter and never notify the binding if one does not exist.

Signed-off-by: Yuri Benditovich <[email protected]>
2021-02-08 11:52:00 +02:00
Yuri Benditovich 4a3db608a0 netkvm: add printout of VF PnpId on attach for diagnostics
Signed-off-by: Yuri Benditovich <[email protected]>
2020-11-02 11:11:23 +02:00
Yuri Benditovich 71f2b44e71 netkvm: add trace on VF link transition
Signed-off-by: Yuri Benditovich <[email protected]>
2020-11-02 11:11:23 +02:00
Yuri Benditovich 42a7680ab2 netkvm: fix completion of internal ARP packets by SRIOV
https://bugzilla.redhat.com/show_bug.cgi?id=1830754
We need to filter out all the internal (announcement) packets
from the NBL chain returned by SRIOV adapter. We use
NBL->MiniportReserved[0] to hold the object to deallocate.
This is OK until we pass the packet to another adapter that
can override this field. So we maintain the list of all the
internal NBLs with their original MiniportReserved before
we pass them to SRIOV. On completion we recognize internal
NBLs and restore MiniportReserved field and then pass them to
the owner (CGuestAnnouncePackets).

Signed-off-by: Yuri Benditovich <[email protected]>
2020-11-02 11:11:23 +02:00
Yuri Benditovich 5d7ce9c724 netkvm: better detection of VF's RSC capability
On offload status indication originated by VF miniport we
can improve our guess of VF miniport NDIS revision and use
it to configure RSC.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich b9310779bd netkvm: propagate offload settings to the VF
Do it the same way as we do for RSS and encapsulation:
apply miniport settings to the VF after the respective
OID executed by NETKVM miniport.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich 993e37e706 netkvm: print VF offloads on status indication
At binding time and on each change of current offloads
the VF indicates current state of offloads. This provides
a good visibility of current settings and also of NDIS
revision the VF driver supports.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich 273a57f1e3 netkvm: propagate offload encapsulation to VF
Due to possible NO_CHANGE we propagate current setting
to the VF and not an original OID.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich 4c1a31331c metkvm: propagate miniport RSS setting to the VF
Send RSS set OID to the VF on any change of RSS settings
according to current settings of the miniport on adapter
attach (initially) and later on any change of RSS settings.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich 155a53cccc netkvm: introduce procedure to set VF RSS
The procedure configures VF RSS according to current RSS
settings of the miniport taking in account the capabilities
of the VF.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich aac044e622 netkvm: dereference protocol in any corner case
The protocol must be dereferenced also in case the OID
request was not spawned due to any reason.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich c65222db66 netkvm: provide more info on VF OID completion
Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich 72a94950cd netkvm: improve guess for VF miniport version
Use macro that only bumps the miniport version.
Any feature from higher protocol bumps the version.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich 32b90048c6 netkvm: query for current VF offload configuration
When the VF is bound add a query for current TCP offloads.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-08-20 17:33:04 +03:00
Yuri Benditovich b5089f0602 netkvm: solve code analysis warnings
Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich f1aaabe3c1 netkvm: optional unregistration of protocol
Add parameter to ParaNdis_ProtocolUnregisterAdapter to make
optional the unregistration of protocol on removal of the
last adapter. In 'Halt' flow we need to unregister the protocol
when there are no more adapters. In future we'll add flow
when we need to keep the protocol registered.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich e2ffc1d229 netkvm: pass original return flags to VF adapter
If the VF driver uses this information it might be
helpful for it to optimize the RX return flow.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich 2c4c214c7d netkvm: add printouts of mac addresses
Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich 2f8279563b netkvm: minimize impact of teaming support on performance
In case the teaming support is not relevant (which is
the case on most of setups), we'd like to minimize to
performance loss due to the fact that we need to check
presense of the teaming on each packet transmit or
packet return. For that we prepare two possibilities:
1) use indication that there is at least one adapter bound
   to the protocol.
2) use acked 'standby' feature
Currently first option is used.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich 2b1ead2ad3 netkvm: implement adapter attach in 2 steps
When the adapter is found, OnAdapterFound checks the compatibility
of two adapters and if ok sets m_BoundAdapter.
If the VFIO adapter is in operational state, it also calls
OnAdapterAttached to start state machines and set m_Started.
Otherwise: later when the protocol binding receives state
indication that the VFIO adapter entered operational state
it spawns work item which finally calls OnAdapterAttached.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich 504ae45254 netkvm: introduce work item to finish adapter attach
This is preparation patch, this work item will be spawned
when VFIO adapter enters its operational state.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich c817475a45 netkvm: split OnAdapterAttach procedure
OnAdapterAttach is splitted to:
OnAdapterFound sets m_BoundAdapter
OnAdapterAttached sets m_Started flag and starts state
machines of packets redirection.

Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich 368135b0ac netkvm: collect SRIOV adapter info when binding to it
Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich 80cdd34f92 netkvm: reduce verbosity of the protocol part
Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00
Yuri Benditovich bb4899ec46 netkvm: initial implementation of teaming protocol driver
Signed-off-by: Annie Li <[email protected]>
Signed-off-by: Yuri Benditovich <[email protected]>
2020-07-07 17:53:39 +03:00