Skip to contentSkip to conversation

linux-user: Add ETHTOOL ioctl

PATCH In review Matevz Langus 2 participants 4 messages Jan 5, 2021 – Jan 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Add ETHTOOL ioctl

Handling of ETHTOOL ioctl was not implemented.

---
 linux-user/ioctls.h       | 1 +
 linux-user/syscall_defs.h | 1 +

 2 files changed, 2 insertions(+)
linux-user/ioctls.h +0 -0
index 661b5daa9f..3e5c220199 100644
@@ -362,6 +362,7 @@

   IOCTL(SIOCSIFHWADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCGIFTXQLEN, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) IOCTL(SIOCSIFTXQLEN, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) +  IOCTL(SIOCETHTOOL, IOC_R | IOC_W, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq))) IOCTL(SIOCGIFMETRIC, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) IOCTL(SIOCSIFMETRIC, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) IOCTL(SIOCGIFMTU, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))

linux-user/syscall_defs.h +0 -0
index a00bfc2647..d9301fecc9 100644
@@ -903,6 +903,7 @@ struct target_rtc_pll_info {
 

 #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */ #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */ +#define TARGET_SIOCETHTOOL     0x8946          /* Ethtool interface            */

 /* ARP cache control calls. */
 #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */

Signature · 1 line
2.24.3 (Apple Git-128)
#1 lore raw

Hi Matevz,

Le 05/01/2021 à 20:24, Matevz Langus a écrit :

Quoted 25 lines

Handling of ETHTOOL ioctl was not implemented.

---
 linux-user/ioctls.h       | 1 +
 linux-user/syscall_defs.h | 1 +

 2 files changed, 2 insertions(+)
linux-user/ioctls.h +1 -0
index 661b5daa9f..3e5c220199 100644
@@ -362,6 +362,7 @@
    IOCTL(SIOCSIFHWADDR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
    IOCTL(SIOCGIFTXQLEN, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
    IOCTL(SIOCSIFTXQLEN, IOC_W, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
+  IOCTL(SIOCETHTOOL, IOC_R | IOC_W, MK_PTR(MK_STRUCT(STRUCT_ptr_ifreq)))
    IOCTL(SIOCGIFMETRIC, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
    IOCTL(SIOCSIFMETRIC, IOC_W, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
    IOCTL(SIOCGIFMTU, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
linux-user/syscall_defs.h +0 -0
index a00bfc2647..d9301fecc9 100644

linux-user/syscall_defs.h struct target_rtc_pll_info { · line 909

Quoted 7 lines
linux-user/syscall_defs.h +1 -0
@@ -903,6 +903,7 @@ struct target_rtc_pll_info {
 
  #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
  #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
+#define TARGET_SIOCETHTOOL     0x8946          /* Ethtool interface            */
 
  /* ARP cache control calls. */
  #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */

Thank you for your patch but the solution is more complex.

Shu-Chun has already sent a patch last month to address the problem:

https://patchew.org/QEMU/[email protected]/

Thanks,
Laurent

#2 lore raw

Hi Laurent,

I know it must be more complex, but it worked for our case so I wanted to share it anyway as we did not find support for this in latest git, but forgot to check mailing list.

With this small patch + some others in Linux kernel we were able to execute Intel XL710 network adapter NVM Update utility (nvmupdate64e) which is x86_64 only binary on aarch64 Linux platform and upgrade NIC firmware. At least we can try if this works OK with Shu-Chun's patch as well.

regards,
Matevz

#3 lore raw

Le 05/01/2021 à 21:07, Matevz Langus a écrit :

Quoted 1 line

Hi Laurent,

Hi Matevz,

Quoted 2 lines

I know it must be more complex, but it worked for our case so I wanted to share it anyway as we did not find support for this in latest git, but forgot to check mailing list.

This kind of patch only works if endianness and word size are the same between the host and the guest.

Quoted 3 lines

With this small patch + some others in Linux kernel we were able to execute Intel XL710 network adapter NVM Update utility (nvmupdate64e) which is x86_64 only binary on aarch64 Linux platform and upgrade NIC firmware.

Thank you to have shared your work and this information with the community :)

This kind of work is very useful.

Quoted 1 line

At least we can try if this works OK with Shu-Chun's patch as well.

Yes, please, do.

Thanks,
Laurent