[Bug 264253] hyperv: ifconfig media autoselect on FreeBSD 13.0 displays error: ifconfig: SIOCSIFMEDIA (media): Operation not supported

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 02 Mar 2024 21:14:02 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264253

Mark Peek <mp@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mp@FreeBSD.org

--- Comment #6 from Mark Peek <mp@FreeBSD.org> ---
I see the same error across 10.4, 13.0, and 15-current

10.4
====
# uname -a
FreeBSD fbsd10 10.4-RELEASE FreeBSD 10.4-RELEASE #0 r324094: Fri Sep 29
01:45:44 UTC 2017     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC
 amd64
# ifconfig -mv hn0
hn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8051b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,LRO,LINKSTATE>
       
capabilities=48071b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,TSO6,LRO,LINKSTATE,TXCSUM_IPV6>
        ether 00:15:5d:0a:28:00
        hwaddr 00:15:5d:0a:28:00
        inet6 fe80::215:5dff:fe0a:2800%hn0 prefixlen 64 scopeid 0x2
        inet6 2601:601:4000:c4de:215:5dff:fe0a:2800 prefixlen 64 autoconf
        inet6 fd50:d9bc:e952:6040:215:5dff:fe0a:2800 prefixlen 64 detached
autoconf
        inet 10.1.10.215 netmask 0xffffff00 broadcast 10.1.10.255
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        supported media:
                media autoselect
# ifconfig hn0 media autoselect
ifconfig: SIOCSIFMEDIA (media): Operation not supported

13.0
====
# uname -a
FreeBSD bsd13 13.0-RELEASE FreeBSD 13.0-RELEASE #0
releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021    
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
# ifconfig -mv hn0
hn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8051b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,LRO,LINKSTATE>
       
capabilities=48071b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,TSO6,LRO,LINKSTATE,TXCSUM_IPV6>
        ether 00:15:5d:0a:28:01
        inet 10.1.10.139 netmask 0xffffff00 broadcast 10.1.10.255
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        supported media:
                media autoselect
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
# ifconfig hn0 media autoselect
ifconfig: SIOCSIFMEDIA (media): Operation not supported

15-current
==========
# uname -a
FreeBSD FreeBSD-current 15.0-CURRENT FreeBSD 15.0-CURRENT #0
main-n268454-9097284b98be: Thu Feb 22 03:00:34 UTC 2024    
root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
# ifconfig -mv hn0
hn0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0
mtu 1500
        options=8051b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,LRO,LINKSTATE>
       
capabilities=48071b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,TSO6,LRO,LINKSTATE,TXCSUM_IPV6>
        ether 00:15:5d:0a:28:02
        inet 10.1.10.125 netmask 0xffffff00 broadcast 10.1.10.255
        inet6 fe80::215:5dff:fe0a:2802%hn0 prefixlen 64 scopeid 0x2
        inet6 2601:601:4000:c4de:215:5dff:fe0a:2802 prefixlen 64 autoconf
pltime 14400 vltime 86400
        inet6 fd50:d9bc:e952:6040:215:5dff:fe0a:2802 prefixlen 64 detached
autoconf pltime 1800 vltime 1800
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        supported media:
                media autoselect
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        drivername: hn0
# ifconfig hn0 media autoselect
ifconfig: SIOCSIFMEDIA (media): Operation not supported


This is not surprising since the hn_ifmedia_upd() callback is the same and
returns EOPNOTSUPP. The code for 10.4 is here:
https://github.com/freebsd/freebsd-src/blob/releng/10.4/sys/dev/hyperv/netvsc/if_hn.c#L1008

Since the only media supported is autoselect, it seems reasonable to just
return 0 from hn_ifmedia_upd() instead of EOPNOTSUPP. Patched on 15-current,
this results in no error for "autoselect" and will error for unregistered media
types.

# ifconfig hn0 media autoselect
# ifconfig hn0 media 100baseT
ifconfig: SIOCSIFMEDIA (media): Device not configured

An early review D4611 did have hn_ifmedia_upd() return 0 but was abandoned. A
subsequent review D4852 has this function returning EOPNOTSUPP.

Allowing selection of the current (and only) registered media type seems
reasonable rather than throwing an error. I'm going to try contacting a couple
of the contributors to the reviews to see if they agree.

-- 
You are receiving this mail because:
You are the assignee for the bug.