[Bug 263091] [genet] genet interface is not able to transmit/receive packet after the interface is marked "down" then marked "up"

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 06 Apr 2022 14:05:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263091

            Bug ID: 263091
           Summary: [genet] genet interface is not able to
                    transmit/receive packet after the interface is marked
                    "down" then marked "up"
           Product: Base System
           Version: CURRENT
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jiahali@blackberry.com

Overview
--------

The genet interface is not able transmit/receive any packets after the genet
interface is marked "down"
firstly then marked "up".

The reason is that the implementation genet driver code will reset the genet
interface but not change the runtime flag of genet driver. Therefore, when
"ifconfig genet up" command is used, the genet driver cannot be re-initialized
again. Moreover, the initialization of genet driver is to enbale the driver's
DMA and interrupts, which is not enbale the genet driver being reset when genet
is marked down.

Steps to Reproduce
------------------

1. Config a static IP address to both of the host's interface and the genet
interface

In the DUT(Device Under Test), with genet interface and Freebsd running, side

root@generic:~ # ifconfig genet0 192.168.3.129 netmask 255.255.255.0
root@generic:~ # ifconfig genet0
genet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       
options=68000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        ether dc:a6:32:bf:f4:e6
        inet 192.168.3.129 netmask 0xffffff00 broadcast 192.168.3.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>


In the host computer with direct Ethernet cable connection to the DUT

$ sudo ifconfig enp0s31f6 192.168.3.2
$ ifconfig enp0s31f6
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.2  netmask 255.255.255.0  broadcast 192.168.3.255
        ether 8c:8c:aa:c1:2b:c3  txqueuelen 1000  (Ethernet)
        RX packets 384  bytes 37406 (37.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5674  bytes 1175798 (1.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xae380000-ae3a0000

2. Host's interface and genet interface can transmit/receive packet to/from
each other

In the DUT

root@generic:~ # ping 192.168.3.2
PING 192.168.3.2 (192.168.3.2): 56 data bytes
64 bytes from 192.168.3.2: icmp_seq=0 ttl=64 time=0.445 ms
64 bytes from 192.168.3.2: icmp_seq=1 ttl=64 time=0.321 ms
64 bytes from 192.168.3.2: icmp_seq=2 ttl=64 time=0.361 ms
^C
--- 192.168.3.2 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.321/0.376/0.445/0.051 ms

In the host

$ ping 192.168.3.129
PING 192.168.3.129 (192.168.3.129) 56(84) bytes of data.
64 bytes from 192.168.3.129: icmp_seq=1 ttl=64 time=0.242 ms
64 bytes from 192.168.3.129: icmp_seq=2 ttl=64 time=0.233 ms
64 bytes from 192.168.3.129: icmp_seq=3 ttl=64 time=0.180 ms
^C
--- 192.168.3.129 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2049ms
rtt min/avg/max/mdev = 0.180/0.218/0.242/0.027 ms

3. Mark the genet interface "down", then mark the interface "up"

root@generic:~ # ifconfig genet0 down
root@generic:~ # ifconfig genet0
genet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       
options=68000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        ether dc:a6:32:bf:f4:e6
        inet 192.168.3.129 netmask 0xffffff00 broadcast 192.168.3.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
root@generic:~ # ifconfig genet0 up
root@generic:~ # ifconfig genet0 
genet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       
options=68000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        ether dc:a6:32:bf:f4:e6
        inet 192.168.3.129 netmask 0xffffff00 broadcast 192.168.3.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Actual Results
--------------

1. Genet interface is not able to transmit/receive any packet

In the DUT

root@generic:~ # ping 192.168.3.2
PING 192.168.3.2 (192.168.3.2): 56 data bytes
^C
--- 192.168.3.2 ping statistics ---
4 packets transmitted, 0 packets received, 100.0% packet loss

In the host

$ ping 192.168.3.129
PING 192.168.3.129 (192.168.3.129) 56(84) bytes of data.
From 192.168.3.2 icmp_seq=9 Destination Host Unreachable
From 192.168.3.2 icmp_seq=10 Destination Host Unreachable
From 192.168.3.2 icmp_seq=11 Destination Host Unreachable
^C
--- 192.168.3.129 ping statistics ---
13 packets transmitted, 0 received, +3 errors, 100% packet loss, time 12280ms
pipe 4

Expected Results
----------------
The "ifconfig genet0 up" can re-enable the genet inerface after the genet
interface is marked as "down". The data communication between the genet and the
host should be recovered when the interface is re-enbale.

Build Date & Hardware
---------------------
root@generic:~ # uname -a
FreeBSD generic 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n254105-d53927b0bae:
Thu Mar 31 09:26:32 UTC 2022    
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64

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