[vbox-dev] [External] : Re: [PATCH] Fix for bug #21516

Alexander Eichner alexander.eichner at oracle.com
Mon Aug 14 16:09:49 GMT 2023


Hello Peter,

below is the patch used to fix the issue.

Regards,
Alexander Eichner

Index: trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
===================================================================
--- a/trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
+++ b/trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
@@ -53,4 +53,5 @@
#include <VBox/version.h>
#include <VBox/log.h>
+#include <VBox/pci.h>


@@ -210,6 +211,4 @@

#define PCI_DEVICE_ID_VIRTIONET_HOST               0x1000      /**< VirtIO transitional device ID for network card  */
-#define PCI_CLASS_BASE_NETWORK_CONTROLLER          0x0200      /**< PCI Network device class                        */
-#define PCI_CLASS_SUB_NET_ETHERNET_CONTROLLER      0x00        /**< PCI NET Controller subclass                     */
#define PCI_CLASS_PROG_UNSPECIFIED                 0x00        /**< Programming interface. N/A.                     */
#define VIRTIONET_PCI_CLASS                        0x01        /**< Base class Mass Storage?                        */
@@ -3516,6 +3515,6 @@
    VIRTIOPCIPARAMS VirtioPciParams;
    VirtioPciParams.uDeviceId                      = PCI_DEVICE_ID_VIRTIONET_HOST;
-    VirtioPciParams.uClassBase                     = PCI_CLASS_BASE_NETWORK_CONTROLLER;
-    VirtioPciParams.uClassSub                      = PCI_CLASS_SUB_NET_ETHERNET_CONTROLLER;
+    VirtioPciParams.uClassBase                     = VBOX_PCI_CLASS_NETWORK;
+    VirtioPciParams.uClassSub                      = VBOX_PCI_SUB_NETWORK_ETHERNET;
    VirtioPciParams.uClassProg                     = PCI_CLASS_PROG_UNSPECIFIED;
    VirtioPciParams.uSubsystemId                   = DEVICE_PCI_NETWORK_SUBSYSTEM;  /* VirtIO 1.0 allows PCI Device ID here */

> On 14.08.2023 18:07, Peter Palúch <peter.paluch.sk at gmail.com> wrote:
> 
> Hello Alexander,
> 
> Many thanks for the information!
> 
> If I may ask - can you share more details on how you fixed this issue? Also, has your fix been only merged recently? 7.0.10 did not yet contain it.
> 
> Best regards,
> Peter
> 
> po 14. 8. 2023 o 17:05 Alexander Eichner <alexander.eichner at oracle.com> napísal(a):
> Hi Peter, 
> 
> Thanks for the patch. We fixed the issue internally, albeit a bit differently.
> 
> Regards,
> Alexander Eichner
> 
>> On 11.08.2023 23:36, Peter Palúch via vbox-dev <vbox-dev at virtualbox.org> wrote:
>> 
>> Greetings,
>> 
>> Attaching a patch fixing the bug #21516 (Cisco CSR 1000v and 8000v does not recognize interfaces).
>> 
>> It turns out that in src/VBox/Devices/Network/DevVirtioNet.cpp, the macro PCI_CLASS_BASE_NETWORK_CONTROLLER was set to 0x0200 (0x02 =PCI Network Device Class ID, 0x00 = Ethernet subclass). However, this macro is passed to another macro, PDMPciDevSetClassBase, that expects uint8_t as the PCI device class value. This has caused the virtio-net PCI adapter to be reported with the PCI class/subclass 0x0000, confusing some host operating systems.
>> 
>> The fix is trivial - set PCI_CLASS_BASE_NETWORK_CONTROLLER to 0x02 instead of 0x0200.
>> 
>> Please consider integrating this fix at your earliest convenience.
>> 
>> Thank you!
>> 
>> Best regards,
>> Peter
>> <virtionet-21516.patch>_______________________________________________
>> vbox-dev mailing list
>> vbox-dev at virtualbox.org
>> https://www.virtualbox.org/mailman/listinfo/vbox-dev
> 



More information about the vbox-dev mailing list