Sat Mar 21 06:54:43 2020 UTC ()
KNF


(skrll)
diff -r1.38 -r1.39 src/sys/dev/usb/if_ure.c

cvs diff -r1.38 -r1.39 src/sys/dev/usb/if_ure.c (expand / switch to unified diff)

--- src/sys/dev/usb/if_ure.c 2020/03/15 23:04:51 1.38
+++ src/sys/dev/usb/if_ure.c 2020/03/21 06:54:43 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_ure.c,v 1.38 2020/03/15 23:04:51 thorpej Exp $ */ 1/* $NetBSD: if_ure.c,v 1.39 2020/03/21 06:54:43 skrll Exp $ */
2/* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */ 2/* $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org> 5 * Copyright (c) 2015-2016 Kevin Lo <kevlo@FreeBSD.org>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30/* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */ 30/* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.38 2020/03/15 23:04:51 thorpej Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.39 2020/03/21 06:54:43 skrll Exp $");
34 34
35#ifdef _KERNEL_OPT 35#ifdef _KERNEL_OPT
36#include "opt_usb.h" 36#include "opt_usb.h"
37#include "opt_inet.h" 37#include "opt_inet.h"
38#endif 38#endif
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/cprng.h> 41#include <sys/cprng.h>
42 42
43#include <net/route.h> 43#include <net/route.h>
44 44
45#include <dev/usb/usbnet.h> 45#include <dev/usb/usbnet.h>
46 46
@@ -952,27 +952,27 @@ ure_attach(device_t parent, device_t sel @@ -952,27 +952,27 @@ ure_attach(device_t parent, device_t sel
952 ure_read_mem(un, URE_PLA_BACKUP, URE_MCU_TYPE_PLA, eaddr, 952 ure_read_mem(un, URE_PLA_BACKUP, URE_MCU_TYPE_PLA, eaddr,
953 sizeof(eaddr)); 953 sizeof(eaddr));
954 usbnet_unlock_core(un); 954 usbnet_unlock_core(un);
955 if (ETHER_IS_ZERO(eaddr)) { 955 if (ETHER_IS_ZERO(eaddr)) {
956 maclo = 0x00f2 | (cprng_strong32() & 0xffff0000); 956 maclo = 0x00f2 | (cprng_strong32() & 0xffff0000);
957 machi = cprng_strong32() & 0xffff; 957 machi = cprng_strong32() & 0xffff;
958 eaddr[0] = maclo & 0xff; 958 eaddr[0] = maclo & 0xff;
959 eaddr[1] = (maclo >> 8) & 0xff; 959 eaddr[1] = (maclo >> 8) & 0xff;
960 eaddr[2] = (maclo >> 16) & 0xff; 960 eaddr[2] = (maclo >> 16) & 0xff;
961 eaddr[3] = (maclo >> 24) & 0xff; 961 eaddr[3] = (maclo >> 24) & 0xff;
962 eaddr[4] = machi & 0xff; 962 eaddr[4] = machi & 0xff;
963 eaddr[5] = (machi >> 8) & 0xff; 963 eaddr[5] = (machi >> 8) & 0xff;
964 } 964 }
965 memcpy(un->un_eaddr, eaddr, sizeof un->un_eaddr); 965 memcpy(un->un_eaddr, eaddr, sizeof(un->un_eaddr));
966 966
967 struct ifnet *ifp = usbnet_ifp(un); 967 struct ifnet *ifp = usbnet_ifp(un);
968 968
969 /* 969 /*
970 * We don't support TSOv4 and v6 for now, that are required to 970 * We don't support TSOv4 and v6 for now, that are required to
971 * be handled in software for some cases. 971 * be handled in software for some cases.
972 */ 972 */
973 ifp->if_capabilities = IFCAP_CSUM_IPv4_Tx | 973 ifp->if_capabilities = IFCAP_CSUM_IPv4_Tx |
974 IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_UDPv4_Tx; 974 IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_UDPv4_Tx;
975#ifdef INET6 975#ifdef INET6
976 ifp->if_capabilities |= IFCAP_CSUM_TCPv6_Tx | IFCAP_CSUM_UDPv6_Tx; 976 ifp->if_capabilities |= IFCAP_CSUM_TCPv6_Tx | IFCAP_CSUM_UDPv6_Tx;
977#endif 977#endif
978 if (un->un_flags & ~URE_FLAG_VER_4C00) { 978 if (un->un_flags & ~URE_FLAG_VER_4C00) {