Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Nov 2016 07:01:52 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r308719 - in stable/11/sys/boot: arm/uboot common mips/uboot powerpc/kboot powerpc/ofw powerpc/ps3 sparc64/loader
Message-ID:  <201611160701.uAG71qWI001301@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Nov 16 07:01:52 2016
New Revision: 308719
URL: https://svnweb.freebsd.org/changeset/base/308719

Log:
  MFC r307238:
  
  Stop closing the network device when netbooting for loaders using the common
  dev_net.c code.
  
  The NETIF_OPEN_CLOSE_ONCE flag was added in r201932 to prevent that behaviour
  on some architectures (sparc64 and powerpc64) the default was left to always
  open and close the device for each open and close of a file by the loader
  because it was necessary for u-boot on arm.
  
  Since it has been added, the flag was turned on for every arches including the
  u-boot loader for arm.
  
  This also fixes netbooting on RPi3 (tested by gonzo@)
  
  For the loader.efi it greatly speeds up netbooting
  
  Reviewed by:	emaste, gonzo, tsoome
  Approved by:	gonzo
  MFC after:	1 month
  Sponsored by:	Gandi.net
  Differential Revision:	https://reviews.freebsd.org/D8230

Modified:
  stable/11/sys/boot/arm/uboot/Makefile
  stable/11/sys/boot/common/dev_net.c
  stable/11/sys/boot/mips/uboot/Makefile
  stable/11/sys/boot/powerpc/kboot/Makefile
  stable/11/sys/boot/powerpc/ofw/Makefile
  stable/11/sys/boot/powerpc/ps3/Makefile
  stable/11/sys/boot/sparc64/loader/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/boot/arm/uboot/Makefile
==============================================================================
--- stable/11/sys/boot/arm/uboot/Makefile	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/arm/uboot/Makefile	Wed Nov 16 07:01:52 2016	(r308719)
@@ -77,8 +77,6 @@ LIBUBOOT_FDT=	${.OBJDIR}/../../uboot/fdt
 LIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
 .endif
 
-CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
-
 .if ${MK_FORTH} != "no"
 # Enable BootForth
 BOOT_FORTH=	yes

Modified: stable/11/sys/boot/common/dev_net.c
==============================================================================
--- stable/11/sys/boot/common/dev_net.c	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/common/dev_net.c	Wed Nov 16 07:01:52 2016	(r308719)
@@ -120,11 +120,9 @@ net_open(struct open_file *f, ...)
 	devname = va_arg(args, char*);
 	va_end(args);
 
-#ifdef	NETIF_OPEN_CLOSE_ONCE
 	/* Before opening another interface, close the previous one first. */
 	if (netdev_sock >= 0 && strcmp(devname, netdev_name) != 0)
 		net_cleanup();
-#endif
 
 	/* On first open, do netif open, mount, etc. */
 	if (netdev_opens == 0) {
@@ -198,21 +196,6 @@ net_close(struct open_file *f)
 
 	f->f_devdata = NULL;
 
-#ifndef	NETIF_OPEN_CLOSE_ONCE
-	/* Extra close call? */
-	if (netdev_opens <= 0)
-		return (0);
-	netdev_opens--;
-	/* Not last close? */
-	if (netdev_opens > 0)
-		return (0);
-	/* On last close, do netif close, etc. */
-#ifdef	NETIF_DEBUG
-	if (debug)
-		printf("net_close: calling net_cleanup()\n");
-#endif
-	net_cleanup();
-#endif
 	return (0);
 }
 

Modified: stable/11/sys/boot/mips/uboot/Makefile
==============================================================================
--- stable/11/sys/boot/mips/uboot/Makefile	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/mips/uboot/Makefile	Wed Nov 16 07:01:52 2016	(r308719)
@@ -81,8 +81,6 @@ LIBUBOOT_FDT=	${.OBJDIR}/../../uboot/fdt
 LIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
 .endif
 
-CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
-
 .if ${MK_FORTH} != "no"
 # Enable BootForth
 BOOT_FORTH=	yes

Modified: stable/11/sys/boot/powerpc/kboot/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/kboot/Makefile	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/powerpc/kboot/Makefile	Wed Nov 16 07:01:52 2016	(r308719)
@@ -68,10 +68,7 @@ CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../..
 LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .endif
 
-# Avoid the open-close-dance for every file access as some firmwares perform
-# an auto-negotiation on every open of the network interface and thus causes
-# netbooting to take horribly long.
-CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE -mcpu=powerpc64
+CFLAGS+=	-mcpu=powerpc64
 
 # Always add MI sources
 .PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern

Modified: stable/11/sys/boot/powerpc/ofw/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/ofw/Makefile	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/powerpc/ofw/Makefile	Wed Nov 16 07:01:52 2016	(r308719)
@@ -67,11 +67,6 @@ CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../..
 LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .endif
 
-# Avoid the open-close-dance for every file access as some firmwares perform
-# an auto-negotiation on every open of the network interface and thus causes
-# netbooting to take horribly long.
-CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
-
 # Always add MI sources
 .PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
 .include	"${.CURDIR}/../../common/Makefile.inc"

Modified: stable/11/sys/boot/powerpc/ps3/Makefile
==============================================================================
--- stable/11/sys/boot/powerpc/ps3/Makefile	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/powerpc/ps3/Makefile	Wed Nov 16 07:01:52 2016	(r308719)
@@ -68,10 +68,7 @@ CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../..
 LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .endif
 
-# Avoid the open-close-dance for every file access as some firmwares perform
-# an auto-negotiation on every open of the network interface and thus causes
-# netbooting to take horribly long.
-CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE -mcpu=powerpc64
+CFLAGS+=	-mcpu=powerpc64
 
 # Always add MI sources
 .PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern

Modified: stable/11/sys/boot/sparc64/loader/Makefile
==============================================================================
--- stable/11/sys/boot/sparc64/loader/Makefile	Wed Nov 16 05:24:42 2016	(r308718)
+++ stable/11/sys/boot/sparc64/loader/Makefile	Wed Nov 16 07:01:52 2016	(r308719)
@@ -69,10 +69,6 @@ LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .include	"${.CURDIR}/../../common/Makefile.inc"
 CFLAGS+=	-I${.CURDIR}/../../common
 CFLAGS+=	-I.
-# Avoid the open-close-dance for every file access as some firmwares perform
-# an auto-negotiation on every open of the network interface and thus causes
-# netbooting to take horribly long.
-CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
 
 CLEANFILES+=	vers.c loader.help
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611160701.uAG71qWI001301>