From owner-svn-src-all@freebsd.org Tue Apr 9 14:29:35 2019 Return-Path: <owner-svn-src-all@freebsd.org> Delivered-To: svn-src-all@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 9B03715825C7; Tue, 9 Apr 2019 14:29:35 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 160EA8F5CC; Tue, 9 Apr 2019 14:29:34 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward104p.mail.yandex.net (Yandex) with ESMTP id EDAF84B00ED0; Tue, 9 Apr 2019 17:29:30 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id cCXQSLdB5G-TUmWLPRr; Tue, 09 Apr 2019 17:29:30 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1554820170; bh=VkSPis6YyAFevls/NAAS9v8JsCoRYrcSPSBrko44Hxs=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=amKpDgM/2g8A10yvZkXXxpvW3ZRxQam5wAbpYnUQfw9IEuN8fMq10nd/fIXy/gioQ ZghTApGVOxNBlSds58dHRsCCX6sI/hFQiYGvXZV7h2h+jDrPvAs9bKBs1ASrtn/dBt YGJKgioRuQngchKbQH4jhTMgfJTUOAOGZGHT6aZA= Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kF7TwJKW3K-TUNS4NtQ; Tue, 09 Apr 2019 17:29:30 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: Re: svn commit: r346052 - head/sys/dev/usb/net To: Ganbold Tsagaankhuu <ganbold@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201904091354.x39Ds9e6070857@repo.freebsd.org> From: "Andrey V. Elsukov" <bu7cher@yandex.ru> Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=bu7cher@yandex.ru; prefer-encrypt=mutual; keydata= mQENBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAG0JUFuZHJleSBWLiBFbHN1a292IDxidTdjaGVyQHlhbmRleC5ydT6JATgEEwECACIFAkwB F1kCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEAHF6gQQyKF6qmYIAI6ekfm1VA4T vqankI1ISE6ku4jV7UlpIQlEbE7/8n3Zd6teJ+pGOQhN5qk8QE7utdPdbktAzi+x7LIJVzUw 4TywZLXGrkP7VKYkfg6oyCGyzITghefQeJtr2TN4hYCkzPWpylkue8MtmqfZv/6royqwTbN+ +E09FQNvTgRUYJYTeQ1qOsxNRycwvw3dr2rOfuxShbzaHBB1pBIjGrMg8fC5pd65ACH5zuFV A0CoTNGMDrEZSfBkTW604UUHFFXeCoC3dwDZRKOWJ3GmMXns65Ai5YkA63BSHEE1Qle3VBhd cG1w0CB5FBV3pB27UVnf0jEbysrDqW4qN7XMRFSWNAy5AQ0ETAEXWQEIAJ2p6l9LBoqdH/0J PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+ LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAYkBHwQYAQIACQUCTAEXWQIbDAAK CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: <7e6208ff-9c9e-9a08-1f67-15e3506758aa@yandex.ru> Date: Tue, 9 Apr 2019 17:26:53 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <201904091354.x39Ds9e6070857@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zlwWwCAqsNAa7i8b9cDATykK3gTzVffv8" X-Rspamd-Queue-Id: 160EA8F5CC X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" <svn-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/> List-Post: <mailto:svn-src-all@freebsd.org> List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 09 Apr 2019 14:29:35 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --zlwWwCAqsNAa7i8b9cDATykK3gTzVffv8 Content-Type: multipart/mixed; boundary="W7PYkrAMnbxKAvbPNjDV1e9OvSuqOtvnk"; protected-headers="v1" From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: Ganbold Tsagaankhuu <ganbold@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <7e6208ff-9c9e-9a08-1f67-15e3506758aa@yandex.ru> Subject: Re: svn commit: r346052 - head/sys/dev/usb/net References: <201904091354.x39Ds9e6070857@repo.freebsd.org> In-Reply-To: <201904091354.x39Ds9e6070857@repo.freebsd.org> --W7PYkrAMnbxKAvbPNjDV1e9OvSuqOtvnk Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 09.04.2019 16:54, Ganbold Tsagaankhuu wrote: > Author: ganbold > Date: Tue Apr 9 13:54:08 2019 > New Revision: 346052 > URL: https://svnweb.freebsd.org/changeset/base/346052 >=20 > Log: > In some cases like NanoPI R1, its second USB ethernet > RTL8152 (chip version URE_CHIP_VER_4C10) doesn't > have hardwired MAC address, in other words, it is all zeros. > This commit fixes it by setting random MAC address > when MAC address is all zeros. > =20 > - if (sc->sc_chip & URE_CHIP_VER_4C00) > + if ((sc->sc_chip & URE_CHIP_VER_4C00) || > + (sc->sc_chip & URE_CHIP_VER_4C10)) > ure_read_mem(sc, URE_PLA_IDR, URE_MCU_TYPE_PLA, > ue->ue_eaddr, 8); > else > ure_read_mem(sc, URE_PLA_BACKUP, URE_MCU_TYPE_PLA, > ue->ue_eaddr, 8); > + > + if (ETHER_IS_ZERO(sc->sc_ue.ue_eaddr)) { > + device_printf(sc->sc_ue.ue_dev, "MAC assigned randomly\n"); > + arc4rand(sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN, 0); > + sc->sc_ue.ue_eaddr[0] &=3D ~0x01; /* unicast */ > + sc->sc_ue.ue_eaddr[0] |=3D 0x02; /* locally administered */ > + } > } Hi, there is ether_fakeaddr() function that is used for such purpose. Maybe is it better to use it? Look at this commit: https://svnweb.freebsd.org/base?view=3Drevision&revision=3D345139 --=20 WBR, Andrey V. Elsukov --W7PYkrAMnbxKAvbPNjDV1e9OvSuqOtvnk-- --zlwWwCAqsNAa7i8b9cDATykK3gTzVffv8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlysq60ACgkQAcXqBBDI oXrjJQgAsMs+O0i+GpxyN0Su5I3NnYvIrqKB2qStO3hXVUiDDqu56oVCCR4b1Vlh VrVyEG6VxUi2zN4nwlALNLJHvp3ujTML7ZYJmKXVrf7OiZewiDczOpBQkU1ZVpEP NSHCWxjBAaIK42Kv48sYqfNOc5+6QA7g87Hs8vHJASDEl/6bHi9rT+eUC2F9jnkk WXwzgLHDA3sX7nuJfRD/LhPvfw2m2LAPuqYxHRKGwTKBGi0IsvM0zXyN4DzHPtgf T+yZlEBm9PYuyRUxZAavVreinlKUL6rvzW7C7C/pKnnuabZ3rE13F1U2WHmYsDgW 0fn72S1ei+qusXAyDy0RK/WNPHZAcA== =8ZiJ -----END PGP SIGNATURE----- --zlwWwCAqsNAa7i8b9cDATykK3gTzVffv8--