diff mbox series

linux-user: Add ETHTOOL ioctl

Message ID 9272ff58-82a7-d687-8a33-05796c643b5b@borea.si (mailing list archive)
State New, archived
Headers show
Series linux-user: Add ETHTOOL ioctl | expand

Commit Message

Matevz Langus Jan. 5, 2021, 7:24 p.m. UTC
Handling of ETHTOOL ioctl was not implemented.

Signed-off-by: Matevz Langus <matevz.langus@borea.si>
---
  linux-user/ioctls.h       | 1 +
  linux-user/syscall_defs.h | 1 +
  2 files changed, 2 insertions(+)


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

Comments

Laurent Vivier Jan. 5, 2021, 7:40 p.m. UTC | #1
Hi Matevz,

Le 05/01/2021 à 20:24, Matevz Langus a écrit :
> Handling of ETHTOOL ioctl was not implemented.
> 
> Signed-off-by: Matevz Langus <matevz.langus@borea.si>
> ---
>  linux-user/ioctls.h       | 1 +
>  linux-user/syscall_defs.h | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 661b5daa9f..3e5c220199 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -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)))
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index a00bfc2647..d9301fecc9 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -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/20201218214142.3673709-1-scw@google.com/

Thanks,
Laurent
Matevz Langus Jan. 5, 2021, 8:07 p.m. UTC | #2
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
Laurent Vivier Jan. 6, 2021, 12:59 p.m. UTC | #3
Le 05/01/2021 à 21:07, Matevz Langus a écrit :
> Hi Laurent,

Hi Matevz,

> 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.

> 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.

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

Yes, please, do.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 661b5daa9f..3e5c220199 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -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)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index a00bfc2647..d9301fecc9 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -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            */