From owner-freebsd-hackers@freebsd.org Wed Apr 11 22:14:48 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D5C4F9610A for ; Wed, 11 Apr 2018 22:14:48 +0000 (UTC) (envelope-from dieterbsd@gmail.com) Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A27C66F99C for ; Wed, 11 Apr 2018 22:14:47 +0000 (UTC) (envelope-from dieterbsd@gmail.com) Received: by mail-io0-x241.google.com with SMTP id h10so989957iob.2 for ; Wed, 11 Apr 2018 15:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=k1anTZ9oFnBbWNlFMAaIZHsxPHj4x2kxX10mq1RGrtA=; b=cDu6h2Kh3Hx1iWdr763MBK69Xy5XJL4LaSbOvMDf4Ua65YBRvFR0VbmNx/aguZC36J fb+5/Gb6sOni4S+RhnxkTPDnPLFe8NdpRrSp0MbL4UJEsZdYWsF4sM2w8V3fhHcKwEhQ 8Qk/lZ2l0mFNLOWHTtUk2xOnfkw7vBH2jEQAoRGNHOua0uCsw6vEDHs/9MnVd6L+lVsh OADOSsZPBadZiWdY986wFajDTzRw9+HWNxdj9kLTsbbaxNmpfcDUeJ7N7Bn3bv3IB0tO EdigV3Hb4MtzV9tNBeLd2uJ0FCiVLSfQc4ek9izu4f3V5Jo8Z/NxR9I7Xe0dYADqlbpM BfQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=k1anTZ9oFnBbWNlFMAaIZHsxPHj4x2kxX10mq1RGrtA=; b=sds8BUlTSplOrPHClsxP4PF7pjP09n1iCUVwPfg1UXoYDAoPHse0EWh7A3r55tv9bC gKA+BtA4TeADCHobblw+9iLn9jTL7TyyzFgkQ7BnRO4RZsVQonE9N9DazuZi6ZQDUyRZ cGLwVSZcvYyufUM56w0oB3joG9yxC794nENTDx1/NZq793FMSbd3A+61TTldyFZNm6RP pbqx7gKioYOMIyY9gNqJvF3JRubXPMtuEEBRAnzi3wxZsh9nmdTUEMtjuxZU6LNRwXcD KOHv459Bh4DVQ4vBWrTLl251YmaGifsd9yMAmWzi19OK4SuJ/LhxP0w/zAeTjHB0Lr8z e1OQ== X-Gm-Message-State: ALQs6tBHUop8RENgwabj5tUGb9Yqv69C53I5hUfkH6aAHjjiYd2Uxtvq 4FmpodcNM/ElmD04Jsax1IvoyTzZ+wqGXqhDbiY= X-Google-Smtp-Source: AIpwx49y+bMIZ6lP/llOovnhDWmwxicLIeD3qD3qKct+jLmPHJBZAYi1hfpMMaGFRobiSzx4D532nHy+KHKZytKeAjc= X-Received: by 10.107.138.141 with SMTP id c13mr6960608ioj.0.1523484886941; Wed, 11 Apr 2018 15:14:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.192.242.173 with HTTP; Wed, 11 Apr 2018 15:14:46 -0700 (PDT) From: Dieter BSD Date: Wed, 11 Apr 2018 15:14:46 -0700 Message-ID: Subject: Re: Realtek re(4) driver To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2018 22:14:48 -0000 One problem I see with the Realtek Ethernet and the stock FreeBSD device driver is occasional pauses in Ethernet traffic. Observe with: netstat -w 1 -I re2 With reasonably decent network software and TCP, this is only a minor problem. However with buggy network software (like a "black box" with closed source firmware and maybe a transmit buffer that is *way* too small, and/or true real time requirements), and/or with a brain dead protocol like UDP, you can lose data. So I decided to try and find a way to demonstrate the problem using only 2 normal computers running FreeBSD, one with Realtek Ethernet. The easy way seemed to be to transfer a large file using UDP and look for errors. On machine with Realtek Ethernet: nc -4nul 55555 > /var/tmp/big_file_copied_via_udp On some other machine: nc -4u machine_with_realtek 55555 < big_file If you don't like 55555, pick another port number. ;-) I first tried a 2.9 GB file, which worked ok a few times, then I tried a 28 GB file and the copy was smaller than the original. Tried it a couple more times and also got different sizes which were smaller than the original. Then transferred it twice with tcp, getting the correct size both times, and the two copies passed cmp(1). original: 28132560000 bytes udp copy 1: 28131929216 (smaller) udp copy 2: 28132523136 (smaller) udp copy 3: 28132537472 (smaller) tcp copy 1: 28132560000 (correct) tcp copy 2: 28132560000 (correct) Ran time(1) on nc (using tcp): real 5m56.591s -> 78,893,073 B/s Next, transfer the opposite direction, with Realtek transmitting and non-Realtek receiving. Transferred with tcp, got the correct file size, and the copy passed cmp(1) against the original file. Attempts to transfer using udp seem to run into some sort of flow control problem, the nc processes hang. Sometimes a small amount of data gets through. Both machines are amd64 with ECC memory RTL8111F and stock FreeBSD 10.4 re(4) The other machine has nfe(4) running FreeBSD 8.2 re0@pci0:4:0:0: class=0x020000 card=0x012310ec chip=0x816810ec rev=0x07 hdr=0x00 re1@pci0:5:0:0: class=0x020000 card=0x012310ec chip=0x816810ec rev=0x07 hdr=0x00 re2@pci0:12:0:0: class=0x020000 card=0xe0001458 chip=0x816810ec rev=0x0c hdr=0x00 re0: re0: Chip rev. 0x2c800000 re1: re1: Chip rev. 0x2c800000 re2: re2: Chip rev. 0x4c000000 ================================================= Steven writes: >> http://12244.wpc.azureedge.net/8012244/drivers/rtdrivers/cn/nic/0007-rtl_bsd_drv_v194.01.tgz Gary writes: > This is the old if_rl driver by Bill Paul from 1998. Hard to > believe it's really superior to the newer version, which is also > based on later code from Bill Paul. The URL worked for me (using wget). 96,127 bytes. Thank you, Steven! tar tvzf 0007-rtl_bsd_drv_v194.01.tgz drwxrwxrwx 0 0 0 0 Dec 26 2016 rtl_bsd_drv_v194.01/ -rwxrwxrwx 0 0 0 1186892 Aug 29 2017 rtl_bsd_drv_v194.01/if_re.c -rwxrwxrwx 0 0 0 37071 Aug 25 2017 rtl_bsd_drv_v194.01/if_rereg.h -rwxrwxrwx 0 0 0 200 Jun 14 2016 rtl_bsd_drv_v194.01/Makefile -rwxrwxrwx 0 0 0 3172 Jan 3 2017 rtl_bsd_drv_v194.01/Readme.txt Huh? What is this about 1998? Looks like 2017-08-29 to me. The files are newer than FreeBSD 10.3's sources: -r--r--r-- 1 root wheel 111335 Mar 24 2016 re/if_re.c However, I have RTL8111E on UD5 mainboard, and 2x RTL8111F on PCIe card. The FreeBSD sources attempt to support these, but the Realtek sources do not mention these revisions, which seems odd when it is 1.5 years newer. # grep -i 8111e re/* rtl_bsd_drv_v194.01/* re/if_re.c: { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K}, re/if_re.c: { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K}, re/if_re.c: { RL_HWREV_8168EP, RL_8169, "8168EP/8111EP", RL_JUMBO_MTU_9K}, # grep -i 8111f re/* rtl_bsd_drv_v194.01/* re/if_re.c: { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, Which leaves me wondering if the Reaktek code supports the chips I have or not. Readme.txt says > for FreeBSD v4.x/5.x/6.x/7.x/8.x/9.x No mention of 10 or newer, which, again, seems odd when it is 1.5 years newer than 10.3. May or may not be a problem.