svn commit: r308194 - in head/sys/dev/hyperv: include vmbus

2016-11-01 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Nov  2 05:41:23 2016
New Revision: 308194
URL: https://svnweb.freebsd.org/changeset/base/308194

Log:
  hyperv: GC unused functions.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8406

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/include/vmbus.h
  head/sys/dev/hyperv/vmbus/vmbus_chan.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hWed Nov  2 05:13:27 2016
(r308193)
+++ head/sys/dev/hyperv/include/hyperv.hWed Nov  2 05:41:23 2016
(r308194)
@@ -44,15 +44,4 @@ struct hyperv_guid {
 
 inthyperv_guid2str(const struct hyperv_guid *, char *, size_t);
 
-/**
- * @brief Get physical address from virtual
- */
-static inline unsigned long
-hv_get_phys_addr(void *virt)
-{
-   unsigned long ret;
-   ret = (vtophys(virt) | ((vm_offset_t) virt & PAGE_MASK));
-   return (ret);
-}
-
 #endif  /* _HYPERV_H_ */

Modified: head/sys/dev/hyperv/include/vmbus.h
==
--- head/sys/dev/hyperv/include/vmbus.h Wed Nov  2 05:13:27 2016
(r308193)
+++ head/sys/dev/hyperv/include/vmbus.h Wed Nov  2 05:41:23 2016
(r308194)
@@ -146,8 +146,6 @@ int vmbus_chan_gpadl_disconnect(struct 
 
 void   vmbus_chan_cpu_set(struct vmbus_channel *chan, int cpu);
 void   vmbus_chan_cpu_rr(struct vmbus_channel *chan);
-struct vmbus_channel *
-   vmbus_chan_cpu2chan(struct vmbus_channel *chan, int cpu);
 void   vmbus_chan_set_readbatch(struct vmbus_channel *chan, bool on);
 
 struct vmbus_channel **

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Nov  2 05:13:27 2016
(r308193)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Nov  2 05:41:23 2016
(r308194)
@@ -1534,65 +1534,6 @@ vmbus_chan_destroy_all(struct vmbus_soft
}
 }
 
-/*
- * The channel whose vcpu binding is closest to the currect vcpu will
- * be selected.
- * If no multi-channel, always select primary channel.
- */
-struct vmbus_channel *
-vmbus_chan_cpu2chan(struct vmbus_channel *prichan, int cpu)
-{
-   struct vmbus_channel *sel, *chan;
-   uint32_t vcpu, sel_dist;
-
-   KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpuid %d", cpu));
-   if (TAILQ_EMPTY(>ch_subchans))
-   return prichan;
-
-   vcpu = VMBUS_PCPU_GET(prichan->ch_vmbus, vcpuid, cpu);
-
-#define CHAN_VCPU_DIST(ch, vcpu)   \
-   (((ch)->ch_vcpuid > (vcpu)) ?   \
-((ch)->ch_vcpuid - (vcpu)) : ((vcpu) - (ch)->ch_vcpuid))
-
-#define CHAN_SELECT(ch)\
-do {   \
-   sel = ch;   \
-   sel_dist = CHAN_VCPU_DIST(ch, vcpu);\
-} while (0)
-
-   CHAN_SELECT(prichan);
-
-   mtx_lock(>ch_subchan_lock);
-   TAILQ_FOREACH(chan, >ch_subchans, ch_sublink) {
-   uint32_t dist;
-
-   KASSERT(chan->ch_stflags & VMBUS_CHAN_ST_OPENED,
-   ("chan%u is not opened", chan->ch_id));
-
-   if (chan->ch_vcpuid == vcpu) {
-   /* Exact match; done */
-   CHAN_SELECT(chan);
-   break;
-   }
-
-   dist = CHAN_VCPU_DIST(chan, vcpu);
-   if (sel_dist <= dist) {
-   /* Far or same distance; skip */
-   continue;
-   }
-
-   /* Select the closer channel. */
-   CHAN_SELECT(chan);
-   }
-   mtx_unlock(>ch_subchan_lock);
-
-#undef CHAN_SELECT
-#undef CHAN_VCPU_DIST
-
-   return sel;
-}
-
 struct vmbus_channel **
 vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308190 - head/sys/powerpc/include

2016-11-01 Thread Justin Hibbits
Author: jhibbits
Date: Wed Nov  2 03:07:01 2016
New Revision: 308190
URL: https://svnweb.freebsd.org/changeset/base/308190

Log:
  Add P1022 and compatible SVR IDs
  
  The eSDHC driver requires these IDs.  Missed in r308188.

Modified:
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Wed Nov  2 01:27:20 2016
(r308189)
+++ head/sys/powerpc/include/spr.h  Wed Nov  2 03:07:01 2016
(r308190)
@@ -698,8 +698,12 @@
 #define  SVR_MPC8572E0x80e8
 #define  SVR_P1011   0x80e5
 #define  SVR_P1011E  0x80ed
+#define  SVR_P1013   0x80e7
+#define  SVR_P1013E  0x80ef
 #define  SVR_P1020   0x80e4
 #define  SVR_P1020E  0x80ec
+#define  SVR_P1022   0x80e6
+#define  SVR_P1022E  0x80ee
 #define  SVR_P2010   0x80e3
 #define  SVR_P2010E  0x80eb
 #define  SVR_P2020   0x80e2
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308189 - head/sys/dev/atkbdc

2016-11-01 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Nov  2 01:27:20 2016
New Revision: 308189
URL: https://svnweb.freebsd.org/changeset/base/308189

Log:
  [psm] Fix choosing wrong mode for synaptic device + trackpoint
  
  With guest trackpoint present trackpoint probing switched synaptics
  device to absolute mode with different protocol instead of keeping it
  in relative mode.
  
  PR:   213757
  Submitted by: Vladimir Kondratyev 
  MFC after:1 week

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==
--- head/sys/dev/atkbdc/psm.c   Wed Nov  2 00:57:04 2016(r308188)
+++ head/sys/dev/atkbdc/psm.c   Wed Nov  2 01:27:20 2016(r308189)
@@ -1062,27 +1062,15 @@ doopen(struct psm_softc *sc, int command
 */
if (sc->hw.model == MOUSE_MODEL_GENERIC) {
if (tap_enabled > 0) {
-   /*
-* Enable tap & drag gestures. We use a Mode Byte
-* and clear the DisGest bit (see §2.5 of Synaptics
-* TouchPad Interfacing Guide).
-*/
VLOG(2, (LOG_DEBUG,
"psm%d: enable tap and drag gestures\n",
sc->unit));
-   mouse_ext_command(sc->kbdc, 0x00);
-   set_mouse_sampling_rate(sc->kbdc, 20);
+   synaptics_set_mode(sc, synaptics_preferred_mode(sc));
} else if (tap_enabled == 0) {
-   /*
-* Disable tap & drag gestures. We use a Mode Byte
-* and set the DisGest bit (see §2.5 of Synaptics
-* TouchPad Interfacing Guide).
-*/
VLOG(2, (LOG_DEBUG,
"psm%d: disable tap and drag gestures\n",
sc->unit));
-   mouse_ext_command(sc->kbdc, 0x04);
-   set_mouse_sampling_rate(sc->kbdc, 20);
+   synaptics_set_mode(sc, synaptics_preferred_mode(sc));
}
}
 
@@ -5364,6 +5352,24 @@ static int
 synaptics_preferred_mode(struct psm_softc *sc) {
int mode_byte;
 
+   /* Check if we are in relative mode */
+   if (sc->hw.model != MOUSE_MODEL_SYNAPTICS) {
+   if (tap_enabled == 0)
+   /*
+* Disable tap & drag gestures. We use a Mode Byte
+* and set the DisGest bit (see §2.5 of Synaptics
+* TouchPad Interfacing Guide).
+*/
+   return (0x04);
+   else
+   /*
+* Enable tap & drag gestures. We use a Mode Byte
+* and clear the DisGest bit (see §2.5 of Synaptics
+* TouchPad Interfacing Guide).
+*/
+   return (0x00);
+   }
+
mode_byte = 0xc4;
 
/* request wmode where available */
@@ -5382,10 +5388,10 @@ synaptics_set_mode(struct psm_softc *sc,
 
/*
 * Enable advanced gestures mode if supported and we are not entering
-* passthrough mode.
+* passthrough or relative mode.
 */
if ((sc->synhw.capAdvancedGestures || sc->synhw.capReportsV) &&
-   !(mode_byte & (1 << 5))) {
+   sc->hw.model == MOUSE_MODEL_SYNAPTICS && !(mode_byte & (1 << 5))) {
mouse_ext_command(sc->kbdc, 3);
set_mouse_sampling_rate(sc->kbdc, 0xc8);
}
@@ -5698,6 +5704,9 @@ enable_synaptics(struct psm_softc *sc, e
if (!synaptics_support)
return (FALSE);
 
+   /* Set mouse type just now for synaptics_set_mode() */
+   sc->hw.model = MOUSE_MODEL_SYNAPTICS;
+
synaptics_set_mode(sc, synaptics_preferred_mode(sc));
 
if (trackpoint_support && synhw.capPassthrough) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r308188 - in head/sys: conf dev/sdhci powerpc/mpc85xx

2016-11-01 Thread Justin Hibbits
Author: jhibbits
Date: Wed Nov  2 00:57:04 2016
New Revision: 308188
URL: https://svnweb.freebsd.org/changeset/base/308188

Log:
  Merge i.MX and PowerPC SDHCI drivers
  
  Summary:
  i.MX5 and PowerPC use a very similar eSDHC controller, which is also
  similar to the uSDHC controller used by i.MX6.  The imx_sdhci driver works
  almost completely with PowerPC, with some minor tweaks.
  
  There is one caveat with this: reset currently does not work on PowerPC, so 
has
  been #ifdef'd out until this can be tracked down and fixed.  If resets are 
done
  the controller will timeout all data transactions.  Without a reset, it 
appears
  to work just fine.
  
  This is part 3, following up r308186 and r308187.
  
  Test Plan:
  This has been tested on a PowerPC QorIQ P1022 board.  It has not been
  tested on i.MX, but no regressions are expected.
  
  Reviewed By: imp
  Differential Revision: https://reviews.freebsd.org/D8407

Deleted:
  head/sys/powerpc/mpc85xx/fsl_sdhc.c
  head/sys/powerpc/mpc85xx/fsl_sdhc.h
Modified:
  head/sys/conf/files.powerpc
  head/sys/dev/sdhci/fsl_sdhci.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Nov  2 00:54:39 2016(r308187)
+++ head/sys/conf/files.powerpc Wed Nov  2 00:57:04 2016(r308188)
@@ -63,6 +63,7 @@ dev/ofw/ofw_subr.coptionalaim powerpc
 dev/powermac_nvram/powermac_nvram.c optional   powermac_nvram powermac
 dev/quicc/quicc_bfe_fdt.c  optionalquicc mpc85xx
 dev/scc/scc_bfe_macio.coptionalscc powermac
+dev/sdhci/fsl_sdhci.c  optionalmpc85xx sdhci
 dev/sec/sec.c  optionalsec mpc85xx
 dev/sound/macio/aoa.c  optionalsnd_davbus | snd_ai2s powermac
 dev/sound/macio/davbus.c   optionalsnd_davbus powermac
@@ -137,7 +138,6 @@ powerpc/mpc85xx/atpic.c optionalmpc85x
 powerpc/mpc85xx/ds1553_bus_fdt.c   optionalds1553 fdt
 powerpc/mpc85xx/ds1553_core.c  optionalds1553
 powerpc/mpc85xx/fsl_diu.c  optionalmpc85xx diu
-powerpc/mpc85xx/fsl_sdhc.c optionalmpc85xx sdhc
 powerpc/mpc85xx/i2c.c  optionaliicbus fdt
 powerpc/mpc85xx/isa.c  optionalmpc85xx isa
 powerpc/mpc85xx/lbc.c  optionalmpc85xx

Modified: head/sys/dev/sdhci/fsl_sdhci.c
==
--- head/sys/dev/sdhci/fsl_sdhci.c  Wed Nov  2 00:54:39 2016
(r308187)
+++ head/sys/dev/sdhci/fsl_sdhci.c  Wed Nov  2 00:57:04 2016
(r308188)
@@ -28,7 +28,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * SDHCI driver glue for Freescale i.MX SoC family.
+ * SDHCI driver glue for Freescale i.MX SoC and QorIQ families.
  *
  * This supports both eSDHC (earlier SoCs) and uSDHC (more recent SoCs).
  */
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -52,9 +53,11 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#ifdef __arm__
 #include 
 
 #include 
+#endif
 
 #include 
 #include 
@@ -146,7 +149,6 @@ struct fsl_sdhci_softc {
 #define SDHC_PROT_CDSS (1 << 7)
 
 #defineSDHC_SYS_CTRL   0x2c
-#defineSDHC_INT_STATUS 0x30
 
 /*
  * The clock enable bits exist in different registers for ESDHC vs USDHC, but
@@ -169,6 +171,7 @@ static struct ofw_compat_data compat_dat
{"fsl,imx6sl-usdhc",HWTYPE_USDHC},
{"fsl,imx53-esdhc", HWTYPE_ESDHC},
{"fsl,imx51-esdhc", HWTYPE_ESDHC},
+   {"fsl,esdhc",   HWTYPE_ESDHC},
{NULL,  HWTYPE_NONE},
 };
 
@@ -397,6 +400,11 @@ fsl_sdhci_write_1(device_t dev, struct s
if (off == SDHCI_POWER_CONTROL) {
return;
}
+#ifdef __powerpc__
+   /* XXX Reset doesn't seem to work as expected.  Do nothing for now. */
+   if (off == SDHCI_SOFTWARE_RESET)
+   return;
+#endif
 
val32 = RD4(sc, off & ~3);
val32 &= ~(0xff << (off & 3) * 8);
@@ -531,17 +539,20 @@ fsl_sdhc_get_clock(struct fsl_sdhci_soft
val |= SDHCI_CLOCK_INT_STABLE;
 
/*
-* On ESDHC hardware the card bus clock enable is in the usual sdhci
-* register but it's a different bit, so transcribe it (note the
+* On i.MX ESDHC hardware the card bus clock enable is in the usual
+* sdhci register but it's a different bit, so transcribe it (note the
 * difference between standard SDHCI_ and Freescale SDHC_ prefixes
-* here). On USDHC hardware there is a force-on bit, but no force-off
-* for the card bus clock (the hardware runs the clock when transfers
-* are active no matter what), so we always say the clock is on.
+* here). On USDHC and QorIQ ESDHC hardware there is a force-on bit, but
+* no force-off for 

svn commit: r308187 - head/sys/dev/sdhci

2016-11-01 Thread Justin Hibbits
Author: jhibbits
Date: Wed Nov  2 00:54:39 2016
New Revision: 308187
URL: https://svnweb.freebsd.org/changeset/base/308187

Log:
  Toggle card insert/remove interrupt enable bits on events
  
  Some controllers (namely Freescale's eSDHC, tested) will continue to assert
  the card removed or card insert interrupts even after being handled.  To work
  around this, disable watching the interrupt that just occurred until the
  opposite interrupt is triggered.
  
  Linux has a similar change in its driver to address the same problem.

Modified:
  head/sys/dev/sdhci/sdhci.c

Modified: head/sys/dev/sdhci/sdhci.c
==
--- head/sys/dev/sdhci/sdhci.c  Wed Nov  2 00:51:09 2016(r308186)
+++ head/sys/dev/sdhci/sdhci.c  Wed Nov  2 00:54:39 2016(r308187)
@@ -1309,7 +1309,7 @@ sdhci_acmd_irq(struct sdhci_slot *slot)
 void
 sdhci_generic_intr(struct sdhci_slot *slot)
 {
-   uint32_t intmask;
+   uint32_t intmask, present;

SDHCI_LOCK(slot);
/* Read slot interrupt status. */
@@ -1323,6 +1323,13 @@ sdhci_generic_intr(struct sdhci_slot *sl
 
/* Handle card presence interrupts. */
if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
+   present = RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT;
+   slot->intmask &=
+   ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE);
+   slot->intmask |= present ? SDHCI_INT_CARD_REMOVE :
+   SDHCI_INT_CARD_INSERT;
+   WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
+   WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
WR4(slot, SDHCI_INT_STATUS, intmask & 
(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE));
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308186 - in head/sys: arm/freescale/imx dev/sdhci

2016-11-01 Thread Justin Hibbits
Author: jhibbits
Date: Wed Nov  2 00:51:09 2016
New Revision: 308186
URL: https://svnweb.freebsd.org/changeset/base/308186

Log:
  Move imx_sdhci driver over to a dev/sdhci in preparation for QorIQ support.
  
  Freescale uses eSDHC in both i.MX (ARM) and QorIQ (PowerPC), with slight
  differences.  This is part one in unifying the drivers.
  
  Reviewed by:  imp

Added:
  head/sys/dev/sdhci/fsl_sdhci.c
 - copied, changed from r308185, head/sys/arm/freescale/imx/imx_sdhci.c
Deleted:
  head/sys/arm/freescale/imx/imx_sdhci.c
Modified:
  head/sys/arm/freescale/imx/files.imx5
  head/sys/arm/freescale/imx/files.imx6

Modified: head/sys/arm/freescale/imx/files.imx5
==
--- head/sys/arm/freescale/imx/files.imx5   Tue Nov  1 22:47:58 2016
(r308185)
+++ head/sys/arm/freescale/imx/files.imx5   Wed Nov  2 00:51:09 2016
(r308186)
@@ -32,7 +32,7 @@ arm/freescale/imx/imx51_ccm.c standard
 dev/ata/chipsets/ata-fsl.c optional imxata
 
 # SDHCI/MMC
-arm/freescale/imx/imx_sdhci.c  optional sdhci
+dev/sdhci/fsl_sdhci.c  optional sdhci
 
 # USB OH3 controller (1 OTG, 3 EHCI)
 arm/freescale/imx/imx_nop_usbphy.c optional ehci

Modified: head/sys/arm/freescale/imx/files.imx6
==
--- head/sys/arm/freescale/imx/files.imx6   Tue Nov  1 22:47:58 2016
(r308185)
+++ head/sys/arm/freescale/imx/files.imx6   Wed Nov  2 00:51:09 2016
(r308186)
@@ -32,7 +32,7 @@ arm/freescale/imx/imx6_ipu.c  optionalv
 #
 # Optional devices.
 #
-arm/freescale/imx/imx_sdhci.c  optional sdhci
+dev/sdhci/fsl_sdhci.c  optional sdhci
 
 arm/freescale/imx/imx_wdog.c   optional imxwdt
 

Copied and modified: head/sys/dev/sdhci/fsl_sdhci.c (from r308185, 
head/sys/arm/freescale/imx/imx_sdhci.c)
==
--- head/sys/arm/freescale/imx/imx_sdhci.c  Tue Nov  1 22:47:58 2016
(r308185, copy source)
+++ head/sys/dev/sdhci/fsl_sdhci.c  Wed Nov  2 00:51:09 2016
(r308186)
@@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "sdhci_if.h"
 
-struct imx_sdhci_softc {
+struct fsl_sdhci_softc {
device_tdev;
struct resource *   mem_res;
struct resource *   irq_res;
@@ -88,8 +88,8 @@ struct imx_sdhci_softc {
 #defineR1BFIX_AC12 2   /* Wait for busy after auto command 12. 
*/
 
 #defineHWTYPE_NONE 0   /* Hardware not recognized/supported. */
-#defineHWTYPE_ESDHC1   /* imx5x and earlier. */
-#defineHWTYPE_USDHC2   /* imx6. */
+#defineHWTYPE_ESDHC1   /* fsl5x and earlier. */
+#defineHWTYPE_USDHC2   /* fsl6. */
 
 /*
  * Freescale-specific registers, or in some cases the layout of bits within the
@@ -172,28 +172,28 @@ static struct ofw_compat_data compat_dat
{NULL,  HWTYPE_NONE},
 };
 
-static uint16_t imx_sdhc_get_clock(struct imx_sdhci_softc *sc);
-static void imx_sdhc_set_clock(struct imx_sdhci_softc *sc, uint16_t val);
-static void imx_sdhci_r1bfix_func(void *arg);
+static uint16_t fsl_sdhc_get_clock(struct fsl_sdhci_softc *sc);
+static void fsl_sdhc_set_clock(struct fsl_sdhci_softc *sc, uint16_t val);
+static void fsl_sdhci_r1bfix_func(void *arg);
 
 static inline uint32_t
-RD4(struct imx_sdhci_softc *sc, bus_size_t off)
+RD4(struct fsl_sdhci_softc *sc, bus_size_t off)
 {
 
return (bus_read_4(sc->mem_res, off));
 }
 
 static inline void
-WR4(struct imx_sdhci_softc *sc, bus_size_t off, uint32_t val)
+WR4(struct fsl_sdhci_softc *sc, bus_size_t off, uint32_t val)
 {
 
bus_write_4(sc->mem_res, off, val);
 }
 
 static uint8_t
-imx_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off)
+fsl_sdhci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off)
 {
-   struct imx_sdhci_softc *sc = device_get_softc(dev);
+   struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32, wrk32;
 
/*
@@ -246,9 +246,9 @@ imx_sdhci_read_1(device_t dev, struct sd
 }
 
 static uint16_t
-imx_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off)
+fsl_sdhci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off)
 {
-   struct imx_sdhci_softc *sc = device_get_softc(dev);
+   struct fsl_sdhci_softc *sc = device_get_softc(dev);
uint32_t val32;
 
if (sc->hwtype == HWTYPE_USDHC) {
@@ -297,16 +297,16 @@ imx_sdhci_read_2(device_t dev, struct sd
 * hardware type, complex enough to have their own function.
 */
if (off == SDHCI_CLOCK_CONTROL) {
-   return (imx_sdhc_get_clock(sc));
+   return (fsl_sdhc_get_clock(sc));
}
 
return ((RD4(sc, off & ~3) >> (off & 3) * 8) & 0x);
 }
 
 

Re: svn commit: r308181 - in head: . share/mk

2016-11-01 Thread Dimitry Andric
On 01 Nov 2016, at 22:27, Jonathan Anderson  wrote:
> 
> Author: jonathan
> Date: Tue Nov  1 21:27:42 2016
> New Revision: 308181
> URL: https://svnweb.freebsd.org/changeset/base/308181
> 
> Log:
>  Add rules to build LLVM IR binaries and libraries.
> 
>  Running `make libfoo.ll` or `make libfoo.bc` within a library directory
>  will now give us an LLVM IR version of the library, and `make foo.full.ll`
>  or `make foo.full.bc` will give us an IR version of a binary.

Please note, I reverted r307823 (which changed the suffixes from .bco
and .llo to .bc and .ll) in r308003, since it caused a number of ports
failures.  These ports were already using .ll as a suffix for C++ lex
scripts.


> Modified: head/share/mk/bsd.lib.mk
> ==
> --- head/share/mk/bsd.lib.mk  Tue Nov  1 21:08:37 2016(r308180)
> +++ head/share/mk/bsd.lib.mk  Tue Nov  1 21:27:42 2016(r308181)
> @@ -78,7 +78,7 @@ CTFFLAGS+= -g
> 
> # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
> # .pico used for PIC object files
> -.SUFFIXES: .out .o .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
> +.SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l 
> .ln

So here, please use .bco and .llo.


> @@ -199,6 +199,18 @@ lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS}
>   ${RANLIB} ${RANLIBFLAGS} ${.TARGET}
> .endif
> 
> +.if defined(LLVM_LINK)
> +BCOBJS=  ${OBJS:.o=.bco} ${STATICOBJS:.o=.bco}
> +LLOBJS=  ${OBJS:.o=.llo} ${STATICOBJS:.o=.llo}

But apparently you already used those suffixes here.


> Modified: head/share/mk/bsd.prog.mk
> ==
> --- head/share/mk/bsd.prog.mk Tue Nov  1 21:08:37 2016(r308180)
> +++ head/share/mk/bsd.prog.mk Tue Nov  1 21:27:42 2016(r308181)
> @@ -4,7 +4,7 @@
> .include 
> .include 
> 
> -.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
> +.SUFFIXES: .out .o .bc .c .cc .cpp .cxx .C .m .y .l .ll .ln .s .S .asm

But not here, these should also be changed.  Sorry for any confusion.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r308185 - head/sys/dev/iwm

2016-11-01 Thread Imre Vadász
Author: ivadasz
Date: Tue Nov  1 22:47:58 2016
New Revision: 308185
URL: https://svnweb.freebsd.org/changeset/base/308185

Log:
  [iwm] Set full-offload scan flag. Fixes fw panic when already associated.
  
  * Starting a scan from wpa_supplicant or via ifconfig while associated,
should no longer cause firmware panics or abort early.
  
  Tested:
  
  * AC7260, STA mode
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8412

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Tue Nov  1 22:40:25 2016(r308184)
+++ head/sys/dev/iwm/if_iwm.c   Tue Nov  1 22:47:58 2016(r308185)
@@ -5879,6 +5879,8 @@ iwm_attach(device_t dev)
IEEE80211_C_SHPREAMBLE  /* short preamble supported */
 // IEEE80211_C_BGSCAN  /* capable of bg scanning */
;
+   /* Advertise full-offload scanning */
+   ic->ic_flags_ext = IEEE80211_FEXT_SCAN_OFFLOAD;
for (i = 0; i < nitems(sc->sc_phyctxt); i++) {
sc->sc_phyctxt[i].id = i;
sc->sc_phyctxt[i].color = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308183 - head/sys/dev/iwm

2016-11-01 Thread Imre Vadász
Author: ivadasz
Date: Tue Nov  1 22:38:26 2016
New Revision: 308183
URL: https://svnweb.freebsd.org/changeset/base/308183

Log:
  [iwm] Get rid of SYNC_RESP_STRUCT and SYNC_RESP_PTR macros.
  
  * SYNC_RESP_STRUCT and SYNC_RESP_PTR originate from the OpenBSD version of
iwm, and they weren't serving any real purpose in the FreeBSD port.
  
  * We just do a single bus_dmamap_sync for syncing the complete received frame,
instead of explicitly bus_dmamap_sync-ing subranges of the frame like in
the OpenBSD iwm code.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D7939

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Tue Nov  1 22:03:36 2016(r308182)
+++ head/sys/dev/iwm/if_iwm.c   Tue Nov  1 22:38:26 2016(r308183)
@@ -5071,18 +5071,6 @@ iwm_nic_error(struct iwm_softc *sc)
 }
 #endif
 
-#define SYNC_RESP_STRUCT(_var_, _pkt_) \
-do {   \
-   bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);\
-   _var_ = (void *)((_pkt_)+1);\
-} while (/*CONSTCOND*/0)
-
-#define SYNC_RESP_PTR(_ptr_, _len_, _pkt_) \
-do {   \
-   bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTREAD);\
-   _ptr_ = (void *)((_pkt_)+1);\
-} while (/*CONSTCOND*/0)
-
 #define ADVANCE_RXQ(sc) (sc->rxq.cur = (sc->rxq.cur + 1) % IWM_RX_RING_COUNT);
 
 /*
@@ -5105,12 +5093,12 @@ iwm_notif_intr(struct iwm_softc *sc)
 */
while (sc->rxq.cur != hw) {
struct iwm_rx_ring *ring = >rxq;
-   struct iwm_rx_data *data = >rxq.data[sc->rxq.cur];
+   struct iwm_rx_data *data = >data[ring->cur];
struct iwm_rx_packet *pkt;
struct iwm_cmd_response *cresp;
int qid, idx, code;
 
-   bus_dmamap_sync(sc->rxq.data_dmat, data->map,
+   bus_dmamap_sync(ring->data_dmat, data->map,
BUS_DMASYNC_POSTREAD);
pkt = mtod(data->m, struct iwm_rx_packet *);
 
@@ -5120,7 +5108,7 @@ iwm_notif_intr(struct iwm_softc *sc)
code = IWM_WIDE_ID(pkt->hdr.flags, pkt->hdr.code);
IWM_DPRINTF(sc, IWM_DEBUG_INTR,
"rx packet qid=%d idx=%d type=%x %d %d\n",
-   pkt->hdr.qid & ~0x80, pkt->hdr.idx, code, sc->rxq.cur, hw);
+   pkt->hdr.qid & ~0x80, pkt->hdr.idx, code, ring->cur, hw);
 
/*
 * randomly get these from the firmware, no idea why.
@@ -5152,7 +5140,7 @@ iwm_notif_intr(struct iwm_softc *sc)
/* XXX look at mac_id to determine interface ID */
struct ieee80211vap *vap = TAILQ_FIRST(>ic_vaps);
 
-   SYNC_RESP_STRUCT(resp, pkt);
+   resp = (void *)pkt->data;
missed = le32toh(resp->consec_missed_beacons);
 
IWM_DPRINTF(sc, IWM_DEBUG_BEACON | IWM_DEBUG_STATE,
@@ -5192,7 +5180,7 @@ iwm_notif_intr(struct iwm_softc *sc)
struct iwm_mvm_alive_resp_v3 *resp3;
 
if (iwm_rx_packet_payload_len(pkt) == sizeof(*resp1)) {
-   SYNC_RESP_STRUCT(resp1, pkt);
+   resp1 = (void *)pkt->data;
sc->sc_uc.uc_error_event_table
= le32toh(resp1->error_event_table_ptr);
sc->sc_uc.uc_log_event_table
@@ -5205,7 +5193,7 @@ iwm_notif_intr(struct iwm_softc *sc)
}
 
if (iwm_rx_packet_payload_len(pkt) == sizeof(*resp2)) {
-   SYNC_RESP_STRUCT(resp2, pkt);
+   resp2 = (void *)pkt->data;
sc->sc_uc.uc_error_event_table
= le32toh(resp2->error_event_table_ptr);
sc->sc_uc.uc_log_event_table
@@ -5220,7 +5208,7 @@ iwm_notif_intr(struct iwm_softc *sc)
}
 
if (iwm_rx_packet_payload_len(pkt) == sizeof(*resp3)) {
-   SYNC_RESP_STRUCT(resp3, pkt);
+   resp3 = (void *)pkt->data;
sc->sc_uc.uc_error_event_table
= le32toh(resp3->error_event_table_ptr);
sc->sc_uc.uc_log_event_table
@@ -5240,7 +5228,7 @@ iwm_notif_intr(struct iwm_softc *sc)
 
case IWM_CALIB_RES_NOTIF_PHY_DB: {
struct 

svn commit: r308182 - head/sbin/ifconfig

2016-11-01 Thread Gavin Atkinson
Author: gavin
Date: Tue Nov  1 22:03:36 2016
New Revision: 308182
URL: https://svnweb.freebsd.org/changeset/base/308182

Log:
  Remove MATCHOUI macro, unused since r197980.

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cTue Nov  1 21:27:42 2016
(r308181)
+++ head/sbin/ifconfig/ifieee80211.cTue Nov  1 22:03:36 2016
(r308182)
@@ -2716,11 +2716,6 @@ printathie(const char *tag, const u_int8
 static void
 printmeshconf(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
 {
-#define MATCHOUI(field, oui, string)   \
-do {   \
-   if (memcmp(field, oui, 4) == 0) \
-   printf("%s", string);   \
-} while (0)
 
printf("%s", tag);
if (verbose) {
@@ -2754,7 +2749,6 @@ do {  
\
printf(" FORM:0x%x CAPS:0x%x>", mconf->conf_form,
mconf->conf_cap);
}
-#undef MATCHOUI
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308181 - in head: . share/mk

2016-11-01 Thread Jonathan Anderson
Author: jonathan
Date: Tue Nov  1 21:27:42 2016
New Revision: 308181
URL: https://svnweb.freebsd.org/changeset/base/308181

Log:
  Add rules to build LLVM IR binaries and libraries.
  
  Running `make libfoo.ll` or `make libfoo.bc` within a library directory
  will now give us an LLVM IR version of the library, and `make foo.full.ll`
  or `make foo.full.bc` will give us an IR version of a binary.
  
  As part of this change, we add an LLVM_LINK variable to sys.mk that can be
  specified/overridden using an external toolchain.
  
  Reviewed by:  bdrewery, brooks
  Approved by:  rwatson (mentor)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8388

Modified:
  head/Makefile.inc1
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.prog.mk
  head/share/mk/sys.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Nov  1 21:08:37 2016(r308180)
+++ head/Makefile.inc1  Tue Nov  1 21:27:42 2016(r308181)
@@ -543,8 +543,8 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METAL
 
 CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \
CPP="${XCPP} ${XCFLAGS}" \
-   AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
-   OBJCOPY="${XOBJCOPY}" \
+   AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \
+   NM=${XNM} OBJCOPY="${XOBJCOPY}" \
RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \
SIZE="${XSIZE}"
 

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkTue Nov  1 21:08:37 2016(r308180)
+++ head/share/mk/bsd.lib.mkTue Nov  1 21:27:42 2016(r308181)
@@ -78,7 +78,7 @@ CTFFLAGS+= -g
 
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
 # .pico used for PIC object files
-.SUFFIXES: .out .o .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
+.SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l 
.ln
 
 .if !defined(PICFLAG)
 .if ${MACHINE_CPUARCH} == "sparc64"
@@ -199,6 +199,18 @@ lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS}
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
 .endif
 
+.if defined(LLVM_LINK)
+BCOBJS=${OBJS:.o=.bco} ${STATICOBJS:.o=.bco}
+LLOBJS=${OBJS:.o=.llo} ${STATICOBJS:.o=.llo}
+CLEANFILES+=   ${BCOBJS} ${LLOBJS}
+
+lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS}
+   ${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
+
+lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS}
+   ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS}
+.endif
+
 .if defined(SHLIB_NAME) || \
 defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
 SOBJS+=${OBJS:.o=.pico}

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Tue Nov  1 21:08:37 2016(r308180)
+++ head/share/mk/bsd.prog.mk   Tue Nov  1 21:27:42 2016(r308181)
@@ -4,7 +4,7 @@
 .include 
 .include 
 
-.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm
+.SUFFIXES: .out .o .bc .c .cc .cpp .cxx .C .m .y .l .ll .ln .s .S .asm
 
 # XXX The use of COPTS in modern makefiles is discouraged.
 .if defined(COPTS)
@@ -147,6 +147,19 @@ ${PROGNAME}.debug: ${PROG_FULL}
${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET}
 .endif
 
+.if defined(LLVM_LINK)
+# LLVM bitcode / textual IR representations of the program
+BCOBJS=${OBJS:.o=.bco}
+LLOBJS=${OBJS:.o=.llo}
+
+${PROG_FULL}.bc: ${BCOBJS}
+   ${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
+
+${PROG_FULL}.ll: ${LLOBJS}
+   ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS}
+
+.endif # defined(LLVM_LINK)
+
 .if${MK_MAN} != "no" && !defined(MAN) && \
!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \
!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \
@@ -166,14 +179,14 @@ all: all-man
 .endif
 
 .if defined(PROG)
-CLEANFILES+= ${PROG}
+CLEANFILES+= ${PROG} ${PROG}.bc ${PROG}.ll
 .if ${MK_DEBUG_FILES} != "no"
-CLEANFILES+=   ${PROG_FULL} ${PROGNAME}.debug
+CLEANFILES+= ${PROG_FULL} ${PROG_FULL}.bc ${PROGNAME}.debug ${PROG_FULL}.ll
 .endif
 .endif
 
 .if defined(OBJS)
-CLEANFILES+= ${OBJS}
+CLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS}
 .endif
 
 .include 

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkTue Nov  1 21:08:37 2016(r308180)
+++ head/share/mk/sys.mkTue Nov  1 21:27:42 2016(r308181)
@@ -231,6 +231,8 @@ LINTLIBFLAGS?=  -cghapbxu -C ${LIB}
 MAKE   ?=  make
 
 .if !defined(%POSIX)
+LLVM_LINK  ?=  llvm-link
+
 LORDER ?=  lorder
 
 NM ?=  nm
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To 

svn commit: r308180 - in head/sys/netinet: . cc

2016-11-01 Thread Hiren Panchasara
Author: hiren
Date: Tue Nov  1 21:08:37 2016
New Revision: 308180
URL: https://svnweb.freebsd.org/changeset/base/308180

Log:
  Set slow start threshold more accurately on loss to be flightsize/2 instead of
  cwnd/2 as recommended by RFC5681. (spotted by mmacy at nextbsd dot org)
  
  Restore pre-r307901 behavior of aligning ssthresh/cwnd on mss boundary. 
(spotted
  by slawa at zxy dot spb dot ru)
  
  Tested by:dim, Slawa 
  MFC after:1 month
  X-MFC with:   r307901
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D8349

Modified:
  head/sys/netinet/cc/cc_cdg.c
  head/sys/netinet/cc/cc_chd.c
  head/sys/netinet/cc/cc_dctcp.c
  head/sys/netinet/cc/cc_htcp.c
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/cc/cc_cdg.c
==
--- head/sys/netinet/cc/cc_cdg.cTue Nov  1 19:18:54 2016
(r308179)
+++ head/sys/netinet/cc/cc_cdg.cTue Nov  1 21:08:37 2016
(r308180)
@@ -474,7 +474,9 @@ cdg_cong_signal(struct cc_var *ccv, uint
ENTER_RECOVERY(CCV(ccv, t_flags));
break;
case CC_RTO:
-   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
+   CCV(ccv, snd_ssthresh) =
+   max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2)
+   * mss;
CCV(ccv, snd_cwnd) = mss;
break;
default:

Modified: head/sys/netinet/cc/cc_chd.c
==
--- head/sys/netinet/cc/cc_chd.cTue Nov  1 19:18:54 2016
(r308179)
+++ head/sys/netinet/cc/cc_chd.cTue Nov  1 21:08:37 2016
(r308180)
@@ -330,13 +330,11 @@ chd_cong_signal(struct cc_var *ccv, uint
struct ertt *e_t;
struct chd *chd_data;
int qdly;
-   uint32_t cwin;
u_int mss;
 
e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
chd_data = ccv->cc_data;
qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
-   cwin = CCV(ccv, snd_cwnd);
mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
@@ -378,7 +376,9 @@ chd_cong_signal(struct cc_var *ccv, uint
ENTER_FASTRECOVERY(CCV(ccv, t_flags));
break;
case CC_RTO:
-   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
+   CCV(ccv, snd_ssthresh) =
+   max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2)
+   * mss;
CCV(ccv, snd_cwnd) = mss;
break;
 

Modified: head/sys/netinet/cc/cc_dctcp.c
==
--- head/sys/netinet/cc/cc_dctcp.c  Tue Nov  1 19:18:54 2016
(r308179)
+++ head/sys/netinet/cc/cc_dctcp.c  Tue Nov  1 21:08:37 2016
(r308180)
@@ -230,19 +230,21 @@ static void
 dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
 {
struct dctcp *dctcp_data;
-   uint32_t cwin;
+   uint32_t cwin, ssthresh_on_loss;
u_int mss;
 
dctcp_data = ccv->cc_data;
cwin = CCV(ccv, snd_cwnd);
mss = CCV(ccv, t_maxseg);
+   ssthresh_on_loss =
+   max((CCV(ccv, snd_max) - CCV(ccv, snd_una)) / 2 / mss, 2)
+   * mss;
 
switch (type) {
case CC_NDUPACK:
if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
-   CCV(ccv, snd_ssthresh) = mss *
-   max(cwin / 2 / mss, 2);
+   CCV(ccv, snd_ssthresh) = ssthresh_on_loss;
dctcp_data->num_cong_events++;
} else {
/* cwnd has already updated as congestion
@@ -250,8 +252,7 @@ dctcp_cong_signal(struct cc_var *ccv, ui
 * snd_cwnd_prev and recalculate snd_ssthresh
 */
cwin = CCV(ccv, snd_cwnd_prev);
-   CCV(ccv, snd_ssthresh) =
-   max(cwin / 2 / mss, 2) * mss;
+   CCV(ccv, snd_ssthresh) = ssthresh_on_loss;
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
@@ -265,8 +266,7 @@ dctcp_cong_signal(struct cc_var *ccv, ui
if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
if (V_dctcp_slowstart &&
dctcp_data->num_cong_events++ == 0) {
-   CCV(ccv, snd_ssthresh) =
-   mss * max(cwin / 2 / mss, 2);
+   CCV(ccv, snd_ssthresh) = ssthresh_on_loss;
dctcp_data->alpha = 

Re: svn commit: r308139 - in head: etc/mtree usr.sbin/cron/cron usr.sbin/cron/lib

2016-11-01 Thread Renato Botelho
> On 31 Oct 2016, at 16:20, Baptiste Daroussin  wrote:
> 
> Author: bapt
> Date: Mon Oct 31 18:20:12 2016
> New Revision: 308139
> URL: https://svnweb.freebsd.org/changeset/base/308139
> 
> Log:
>  cron(8): add support for /etc/cron.d and /usr/local/etc/cron.d
> 
>  For automation tools it is way easier to maintain files in directories rather
>  than modifying /etc/crontab.
> 
>  The files in those directories are in the same format as /etc/crontab


Thank you!

--
Renato Botelho

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308179 - head/sys/dev/ioat

2016-11-01 Thread Conrad E. Meyer
Author: cem
Date: Tue Nov  1 19:18:54 2016
New Revision: 308179
URL: https://svnweb.freebsd.org/changeset/base/308179

Log:
  ioat(4): Allocate contiguous descriptors
  
  This allows us to make strong assertions about descriptor address
  validity.  Additionally, future generations of the ioat(4) hardware will
  require contiguous descriptors.
  
  Reviewed by:  markj
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Nov  1 19:18:52 2016(r308178)
+++ head/sys/dev/ioat/ioat.cTue Nov  1 19:18:54 2016(r308179)
@@ -81,13 +81,11 @@ static void ioat_process_events(struct i
 static inline uint32_t ioat_get_active(struct ioat_softc *ioat);
 static inline uint32_t ioat_get_ring_space(struct ioat_softc *ioat);
 static void ioat_free_ring(struct ioat_softc *, uint32_t size,
-struct ioat_descriptor **);
-static void ioat_free_ring_entry(struct ioat_softc *ioat,
-struct ioat_descriptor *desc);
-static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *,
-int mflags);
+struct ioat_descriptor *);
 static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags);
-static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat,
+static union ioat_hw_descriptor *ioat_get_descriptor(struct ioat_softc *,
+uint32_t index);
+static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *,
 uint32_t index);
 static void ioat_halted_debug(struct ioat_softc *, uint32_t);
 static void ioat_poll_timer_callback(void *arg);
@@ -349,7 +347,12 @@ ioat_detach(device_t device)
bus_dma_tag_destroy(ioat->comp_update_tag);
}
 
-   bus_dma_tag_destroy(ioat->hw_desc_tag);
+   if (ioat->hw_desc_ring != NULL) {
+   bus_dmamap_unload(ioat->hw_desc_tag, ioat->hw_desc_map);
+   bus_dmamem_free(ioat->hw_desc_tag, ioat->hw_desc_ring,
+   ioat->hw_desc_map);
+   bus_dma_tag_destroy(ioat->hw_desc_tag);
+   }
 
return (0);
 }
@@ -383,8 +386,8 @@ ioat_start_channel(struct ioat_softc *io
 
/* Submit 'NULL' operation manually to avoid quiescing flag */
desc = ioat_get_ring_entry(ioat, ioat->head);
+   hw_desc = _get_descriptor(ioat, ioat->head)->dma;
dmadesc = >bus_dmadesc;
-   hw_desc = desc->u.dma;
 
dmadesc->callback_fn = NULL;
dmadesc->callback_arg = NULL;
@@ -421,9 +424,10 @@ static int
 ioat3_attach(device_t device)
 {
struct ioat_softc *ioat;
-   struct ioat_descriptor **ring;
-   struct ioat_descriptor *next;
+   struct ioat_descriptor *ring;
struct ioat_dma_hw_descriptor *dma_hw_desc;
+   void *hw_desc;
+   size_t ringsz;
int i, num_descriptors;
int error;
uint8_t xfercap;
@@ -478,36 +482,41 @@ ioat3_attach(device_t device)
return (error);
 
ioat->ring_size_order = g_ioat_ring_order;
-
num_descriptors = 1 << ioat->ring_size_order;
+   ringsz = sizeof(struct ioat_dma_hw_descriptor) * num_descriptors;
 
-   bus_dma_tag_create(bus_get_dma_tag(ioat->device), 0x40, 0x0,
-   BUS_SPACE_MAXADDR_40BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-   sizeof(struct ioat_dma_hw_descriptor), 1,
-   sizeof(struct ioat_dma_hw_descriptor), 0, NULL, NULL,
-   >hw_desc_tag);
+   error = bus_dma_tag_create(bus_get_dma_tag(ioat->device),
+   2 * 1024 * 1024, 0x0, BUS_SPACE_MAXADDR_40BIT, BUS_SPACE_MAXADDR,
+   NULL, NULL, ringsz, 1, ringsz, 0, NULL, NULL, >hw_desc_tag);
+   if (error != 0)
+   return (error);
+
+   error = bus_dmamem_alloc(ioat->hw_desc_tag, _desc,
+   BUS_DMA_ZERO | BUS_DMA_WAITOK, >hw_desc_map);
+   if (error != 0)
+   return (error);
+
+   error = bus_dmamap_load(ioat->hw_desc_tag, ioat->hw_desc_map, hw_desc,
+   ringsz, ioat_dmamap_cb, >hw_desc_bus_addr, BUS_DMA_WAITOK);
+   if (error)
+   return (error);
+
+   ioat->hw_desc_ring = hw_desc;
 
ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT,
M_ZERO | M_WAITOK);
 
ring = ioat->ring;
for (i = 0; i < num_descriptors; i++) {
-   ring[i] = ioat_alloc_ring_entry(ioat, M_WAITOK);
-   if (ring[i] == NULL)
-   return (ENOMEM);
-
-   ring[i]->id = i;
+   memset([i].bus_dmadesc, 0, sizeof(ring[i].bus_dmadesc));
+   ring[i].id = i;
}
 
-   for (i = 0; i < num_descriptors - 1; i++) {
-   next = ring[i + 1];
-   dma_hw_desc = ring[i]->u.dma;
-
-   dma_hw_desc->next = next->hw_desc_bus_addr;
+   for (i = 0; i < num_descriptors; i++) {
+   dma_hw_desc = >hw_desc_ring[i].dma;
+ 

svn commit: r308178 - head/sys/dev/ioat

2016-11-01 Thread Conrad E. Meyer
Author: cem
Date: Tue Nov  1 19:18:52 2016
New Revision: 308178
URL: https://svnweb.freebsd.org/changeset/base/308178

Log:
  ioat(4): Simplify by removing dynamic scaling
  
  This paves the way for a contiguous descriptor array.
  
  A contiguous descriptor array has the benefit that we can make strong
  assertions about whether an address is a valid descriptor or not.  The
  other benefit is that future generations of I/OAT hardware will require
  a contiguous descriptor array anyway.  The downside is that after system
  boot, big chunks of contiguous memory is much harder to find.  So
  dynamic scaling after boot is basically impossible.
  
  Reviewed by:  markj
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cTue Nov  1 19:18:16 2016(r308177)
+++ head/sys/dev/ioat/ioat.cTue Nov  1 19:18:52 2016(r308178)
@@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$");
 #defineBUS_SPACE_MAXADDR_40BIT 0xFFULL
 #endif
 #defineIOAT_REFLK  (>submit_lock)
-#defineIOAT_SHRINK_PERIOD  (10 * hz)
 
 static int ioat_probe(device_t device);
 static int ioat_attach(device_t device);
@@ -90,15 +89,8 @@ static struct ioat_descriptor *ioat_allo
 static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags);
 static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat,
 uint32_t index);
-static struct ioat_descriptor **ioat_prealloc_ring(struct ioat_softc *,
-uint32_t size, boolean_t need_dscr, int mflags);
-static int ring_grow(struct ioat_softc *, uint32_t oldorder,
-struct ioat_descriptor **);
-static int ring_shrink(struct ioat_softc *, uint32_t oldorder,
-struct ioat_descriptor **);
 static void ioat_halted_debug(struct ioat_softc *, uint32_t);
 static void ioat_poll_timer_callback(void *arg);
-static void ioat_shrink_timer_callback(void *arg);
 static void dump_descriptor(void *hw_desc);
 static void ioat_submit_single(struct ioat_softc *ioat);
 static void ioat_comp_update_map(void *arg, bus_dma_segment_t *seg, int nseg,
@@ -135,6 +127,10 @@ int g_ioat_debug_level = 0;
 SYSCTL_INT(_hw_ioat, OID_AUTO, debug_level, CTLFLAG_RWTUN, _ioat_debug_level,
 0, "Set log level (0-3) for ioat(4). Higher is more verbose.");
 
+unsigned g_ioat_ring_order = 13;
+SYSCTL_UINT(_hw_ioat, OID_AUTO, ring_order, CTLFLAG_RDTUN, _ioat_ring_order,
+0, "Set IOAT ring order.  (1 << this) == ring size.");
+
 /*
  * OS <-> Driver interface structures
  */
@@ -336,7 +332,6 @@ ioat_detach(device_t device)
 
ioat_teardown_intr(ioat);
callout_drain(>poll_timer);
-   callout_drain(>shrink_timer);
 
pci_disable_busmaster(device);
 
@@ -453,7 +448,6 @@ ioat3_attach(device_t device)
mtx_init(>submit_lock, "ioat_submit", NULL, MTX_DEF);
mtx_init(>cleanup_lock, "ioat_cleanup", NULL, MTX_DEF);
callout_init(>poll_timer, 1);
-   callout_init(>shrink_timer, 1);
TASK_INIT(>reset_task, 0, ioat_reset_hw_task, ioat);
 
/* Establish lock order for Witness */
@@ -462,7 +456,6 @@ ioat3_attach(device_t device)
mtx_unlock(>cleanup_lock);
mtx_unlock(>submit_lock);
 
-   ioat->is_resize_pending = FALSE;
ioat->is_submitter_processing = FALSE;
ioat->is_completion_pending = FALSE;
ioat->is_reset_pending = FALSE;
@@ -484,7 +477,7 @@ ioat3_attach(device_t device)
if (error != 0)
return (error);
 
-   ioat->ring_size_order = IOAT_MIN_ORDER;
+   ioat->ring_size_order = g_ioat_ring_order;
 
num_descriptors = 1 << ioat->ring_size_order;
 
@@ -725,8 +718,6 @@ out:
pending = (ioat_get_active(ioat) != 0);
if (!pending && ioat->is_completion_pending) {
ioat->is_completion_pending = FALSE;
-   callout_reset(>shrink_timer, IOAT_SHRINK_PERIOD,
-   ioat_shrink_timer_callback, ioat);
callout_stop(>poll_timer);
}
mtx_unlock(>submit_lock);
@@ -781,8 +772,6 @@ out:
 
if (ioat->is_completion_pending) {
ioat->is_completion_pending = FALSE;
-   callout_reset(>shrink_timer, IOAT_SHRINK_PERIOD,
-   ioat_shrink_timer_callback, ioat);
callout_stop(>poll_timer);
}
 
@@ -964,7 +953,6 @@ ioat_release(bus_dmaengine_t dmaengine)
ioat->is_completion_pending = TRUE;
callout_reset(>poll_timer, 1, ioat_poll_timer_callback,
ioat);
-   callout_stop(>shrink_timer);
}
mtx_unlock(>submit_lock);
 }
@@ -1402,8 +1390,6 @@ ioat_free_ring_entry(struct ioat_softc *
 static int
 ioat_reserve_space(struct ioat_softc *ioat, uint32_t num_descs, int mflags)
 {
-   

svn commit: r308177 - head/tests/sys/kern

2016-11-01 Thread Conrad E. Meyer
Author: cem
Date: Tue Nov  1 19:18:16 2016
New Revision: 308177
URL: https://svnweb.freebsd.org/changeset/base/308177

Log:
  Add test case for >65535 segment coredumps
  
  A long-belated follow-up to r303099.
  
  With feedback from:   jmmv, ngie
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D7264

Added:
  head/tests/sys/kern/coredump_phnum_helper.c   (contents, props changed)
  head/tests/sys/kern/coredump_phnum_test.sh   (contents, props changed)
Modified:
  head/tests/sys/kern/Makefile

Modified: head/tests/sys/kern/Makefile
==
--- head/tests/sys/kern/MakefileTue Nov  1 18:42:44 2016
(r308176)
+++ head/tests/sys/kern/MakefileTue Nov  1 19:18:16 2016
(r308177)
@@ -14,6 +14,11 @@ ATF_TESTS_C+=unix_passfd_test
 TEST_METADATA.unix_seqpacket_test+=timeout="15"
 ATF_TESTS_C+=  waitpid_nohang
 
+ATF_TESTS_SH+= coredump_phnum_test
+
+BINDIR=${TESTSDIR}
+PROGS+=coredump_phnum_helper
+
 LIBADD.ptrace_test+=   pthread
 LIBADD.unix_seqpacket_test+=   pthread
 

Added: head/tests/sys/kern/coredump_phnum_helper.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/kern/coredump_phnum_helper.c Tue Nov  1 19:18:16 2016
(r308177)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016, Conrad Meyer
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/*
+ * This program is intended to create a bunch of segment mappings, then dump
+ * core.
+ */
+int
+main(int argc __unused, char **argv __unused)
+{
+   void *v;
+   unsigned i;
+
+   for (i = 0; i < UINT16_MAX + 1000; i++) {
+   /*
+* Alternate protections; otherwise the kernel will just extend
+* the adjacent same-protection previous mapping.
+*/
+   v = mmap(NULL, PAGE_SIZE,
+   (((i % 2) == 0) ? PROT_READ : 0) | PROT_WRITE,
+   MAP_ANON | MAP_PRIVATE, -1, 0);
+   if (v == MAP_FAILED)
+   err(1, "mmap");
+   }
+
+   /* Dump core. */
+   abort();
+}

Added: head/tests/sys/kern/coredump_phnum_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/kern/coredump_phnum_test.sh  Tue Nov  1 19:18:16 2016
(r308177)
@@ -0,0 +1,90 @@
+#
+#  Copyright (c) 2016 Dell EMC Isilon
+#  All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#  1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions, and the following disclaimer,
+# without modification.
+#  2. Redistributions in binary form must reproduce at minimum a disclaimer
+# substantially similar to the "NO WARRANTY" disclaimer below
+# ("Disclaimer") and any redistribution must be conditioned upon
+# including a substantially similar Disclaimer requirement for further
+# binary redistribution.
+#
+#  NO WARRANTY
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 

svn commit: r308176 - head/sys/netpfil/ipfw

2016-11-01 Thread Luiz Otavio O Souza
Author: loos
Date: Tue Nov  1 18:42:44 2016
New Revision: 308176
URL: https://svnweb.freebsd.org/changeset/base/308176

Log:
  Stop abusing from struct ifnet presence to determine the packet direction
  for dummynet, use the correct argument for that, remove the false coment
  about the presence of struct ifnet.
  
  Fixes the input match of dummynet l2 rules.
  
  Obtained from:pfSense
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/netpfil/ipfw/ip_fw_pfil.c

Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c
==
--- head/sys/netpfil/ipfw/ip_fw_pfil.c  Tue Nov  1 18:18:09 2016
(r308175)
+++ head/sys/netpfil/ipfw/ip_fw_pfil.c  Tue Nov  1 18:42:44 2016
(r308176)
@@ -303,11 +303,9 @@ again:
 
 /*
  * ipfw processing for ethernet packets (in and out).
- * Inteface is NULL from ether_demux, and ifp from
- * ether_output_frame.
  */
 int
-ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *dst, int dir,
+ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir,
 struct inpcb *inp)
 {
struct ether_header *eh;
@@ -348,7 +346,7 @@ ipfw_check_frame(void *arg, struct mbuf 
m_adj(m, ETHER_HDR_LEN);/* strip ethernet header */
 
args.m = m; /* the packet we are looking at */
-   args.oif = dir == PFIL_OUT ? dst: NULL; /* destination, if any  */
+   args.oif = dir == PFIL_OUT ? ifp: NULL; /* destination, if any  */
args.next_hop = NULL;   /* we do not support forward yet*/
args.next_hop6 = NULL;  /* we do not support forward yet*/
args.eh = _eh; /* MAC header for bridged/MAC packets   */
@@ -383,14 +381,13 @@ ipfw_check_frame(void *arg, struct mbuf 
 
case IP_FW_DUMMYNET:
ret = EACCES;
-   int dir;
 
if (ip_dn_io_ptr == NULL)
break; /* i.e. drop */
 
*m0 = NULL;
-   dir = PROTO_LAYER2 | (dst ? DIR_OUT : DIR_IN);
-   ip_dn_io_ptr(, dir, );
+   dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT;
+   ip_dn_io_ptr(, dir | PROTO_LAYER2, );
return 0;
 
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308175 - head/libexec/ftpd

2016-11-01 Thread Kurt Lidl
Author: lidl
Date: Tue Nov  1 18:18:09 2016
New Revision: 308175
URL: https://svnweb.freebsd.org/changeset/base/308175

Log:
  Revisit blacklistd support in ftpd
  
  Enhance blacklistd support to not log anything by default,
  unless blacklistd support is enabled on the command line.
  Document new flag in man page, cleanup patches to be less
  intrusive in code.
  
  Reported by:  Rick Adams
  Reviewed by:  cem, emaste
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8374

Modified:
  head/libexec/ftpd/blacklist.c
  head/libexec/ftpd/blacklist_client.h
  head/libexec/ftpd/ftpd.8
  head/libexec/ftpd/ftpd.c

Modified: head/libexec/ftpd/blacklist.c
==
--- head/libexec/ftpd/blacklist.c   Tue Nov  1 17:11:10 2016
(r308174)
+++ head/libexec/ftpd/blacklist.c   Tue Nov  1 18:18:09 2016
(r308175)
@@ -37,16 +37,20 @@
 #include 
 
 static struct blacklist *blstate;
+extern int use_blacklist;
 
 void
 blacklist_init(void)
 {
-   blstate = blacklist_open();
+
+   if (use_blacklist)
+   blstate = blacklist_open();
 }
 
 void
 blacklist_notify(int action, int fd, char *msg)
 {
+
if (blstate == NULL)
return;
(void)blacklist_r(blstate, action, fd, msg);

Modified: head/libexec/ftpd/blacklist_client.h
==
--- head/libexec/ftpd/blacklist_client.hTue Nov  1 17:11:10 2016
(r308174)
+++ head/libexec/ftpd/blacklist_client.hTue Nov  1 18:18:09 2016
(r308175)
@@ -28,5 +28,26 @@
 
 /* $FreeBSD$ */
 
-void blacklist_notify(int, int, char *);
+#ifndef BLACKLIST_CLIENT_H
+#define BLACKLIST_CLIENT_H
+
+enum {
+   BLACKLIST_AUTH_OK = 0,
+   BLACKLIST_AUTH_FAIL
+};
+
+#ifdef USE_BLACKLIST
 void blacklist_init(void);
+void blacklist_notify(int, int, char *);
+
+#define BLACKLIST_INIT() blacklist_init()
+#define BLACKLIST_NOTIFY(x, y, z) blacklist_notify(x, y, z)
+
+#else
+
+#define BLACKLIST_INIT()
+#define BLACKLIST_NOTIFY(x, y, z)
+
+#endif
+
+#endif /* BLACKLIST_CLIENT_H */

Modified: head/libexec/ftpd/ftpd.8
==
--- head/libexec/ftpd/ftpd.8Tue Nov  1 17:11:10 2016(r308174)
+++ head/libexec/ftpd/ftpd.8Tue Nov  1 18:18:09 2016(r308175)
@@ -36,7 +36,7 @@
 .Nd Internet File Transfer Protocol server
 .Sh SYNOPSIS
 .Nm
-.Op Fl 468ADdEhMmOoRrSUvW
+.Op Fl 468ABDdEhMmOoRrSUvW
 .Op Fl l Op Fl l
 .Op Fl a Ar address
 .Op Fl P Ar port
@@ -95,6 +95,14 @@ When
 .Fl D
 is specified, accept connections only on the specified
 .Ar address .
+.It Fl B
+With this option set,
+.Nm
+sends authentication success and failure messages to the
+.Xr blacklistd 8
+daemon.  If this option is not specified, no communcation with the
+.Xr blacklistd 8
+daemon is attempted.
 .It Fl D
 With this option set,
 .Nm

Modified: head/libexec/ftpd/ftpd.c
==
--- head/libexec/ftpd/ftpd.cTue Nov  1 17:11:10 2016(r308174)
+++ head/libexec/ftpd/ftpd.cTue Nov  1 18:18:09 2016(r308175)
@@ -144,6 +144,7 @@ int noretr = 0; /* RETR command is disa
 intnoguestretr = 0;/* RETR command is disabled for anon users. */
 intnoguestmkd = 0; /* MKD command is disabled for anon users. */
 intnoguestmod = 1; /* anon users may not modify existing files. */
+intuse_blacklist = 0;
 
 off_t  file_size;
 off_t  byte_count;
@@ -305,7 +306,7 @@ main(int argc, char *argv[], char **envp
openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
 
while ((ch = getopt(argc, argv,
-   "468a:AdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) {
+   "468a:ABdDEhlmMoOp:P:rRSt:T:u:UvW")) != -1) {
switch (ch) {
case '4':
family = (family == AF_INET6) ? AF_UNSPEC : AF_INET;
@@ -327,6 +328,14 @@ main(int argc, char *argv[], char **envp
anon_only = 1;
break;
 
+   case 'B':
+#ifdef USE_BLACKLIST
+   use_blacklist = 1;
+#else
+   syslog(LOG_WARNING, "not compiled with USE_BLACKLIST 
support");
+#endif
+   break;
+
case 'd':
ftpdebug++;
break;
@@ -644,9 +653,7 @@ gotchild:
reply(220, "%s FTP server (%s) ready.", hostname, version);
else
reply(220, "FTP server ready.");
-#ifdef USE_BLACKLIST
-   blacklist_init();
-#endif
+   BLACKLIST_INIT();
for (;;)
(void) yyparse();
/* NOTREACHED */
@@ -1422,9 +1429,7 @@ skip:
 */
if (rval) {

svn commit: r308174 - head/sys/vm

2016-11-01 Thread Alan Cox
Author: alc
Date: Tue Nov  1 17:11:10 2016
New Revision: 308174
URL: https://svnweb.freebsd.org/changeset/base/308174

Log:
  Move and revise a comment about the relation between the object's paging-
  in-progress count and the vnode.  Prior to r188331, we always acquired
  the vnode lock before incrementing the object's paging-in-progress count.
  Now, we increment it before attempting to acquire the vnode lock with
  LK_NOWAIT, but we never sleep acquiring the vnode lock while we have the
  count incremented.
  
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Tue Nov  1 16:03:31 2016(r308173)
+++ head/sys/vm/vm_fault.c  Tue Nov  1 17:11:10 2016(r308174)
@@ -420,8 +420,7 @@ fast_failed:
 * they will stay around as well.
 *
 * Bump the paging-in-progress count to prevent size changes (e.g. 
-* truncation operations) during I/O.  This must be done after
-* obtaining the vnode lock in order to avoid possible deadlocks.
+* truncation operations) during I/O.
 */
vm_object_reference_locked(fs.first_object);
vm_object_pip_add(fs.first_object, 1);
@@ -647,7 +646,13 @@ readrest:
 
if (locked != LK_EXCLUSIVE)
locked = LK_SHARED;
-   /* Do not sleep for vnode lock while fs.m is 
busy */
+
+   /*
+* We must not sleep acquiring the vnode lock
+* while we have the page exclusive busied or
+* the object's paging-in-progress count
+* incremented.  Otherwise, we could deadlock.
+*/
error = vget(vp, locked | LK_CANRECURSE |
LK_NOWAIT, curthread);
if (error != 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308173 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-11-01 Thread Alexander Motin
Author: mav
Date: Tue Nov  1 16:03:31 2016
New Revision: 308173
URL: https://svnweb.freebsd.org/changeset/base/308173

Log:
  Fix ZIL records ordering when ZVOL opened both with and without FSYNC.
  
  Before this an earlier writes to a ZVOL opened without FSYNC could get to
  ZIL after later writes to the same ZVOL opened with FSYNC.  Fix this by
  replicating functionality of ZPL (zv_sync_cnt equivalent to z_sync_cnt),
  marking all log records sync if anybody opened the ZVOL with FSYNC.
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h   Tue Nov 
 1 15:11:10 2016(r308172)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h   Tue Nov 
 1 16:03:31 2016(r308173)
@@ -405,6 +405,7 @@ extern itx_t*zil_itx_create(uint64_t tx
 extern voidzil_itx_destroy(itx_t *itx);
 extern voidzil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
 
+extern voidzil_async_to_sync(zilog_t *zilog, uint64_t oid);
 extern voidzil_commit(zilog_t *zilog, uint64_t oid);
 
 extern int zil_vdev_offline(const char *osname, void *txarg);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Tue Nov  1 
15:11:10 2016(r308172)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c   Tue Nov  1 
16:03:31 2016(r308173)
@@ -90,8 +90,6 @@ SYSCTL_INT(_vfs_zfs_trim, OID_AUTO, enab
 
 static kmem_cache_t *zil_lwb_cache;
 
-static void zil_async_to_sync(zilog_t *zilog, uint64_t foid);
-
 #defineLWB_EMPTY(lwb) ((BP_GET_LSIZE(>lwb_blk) - \
 sizeof (zil_chain_t)) == (lwb->lwb_sz - lwb->lwb_nused))
 
@@ -1421,7 +1419,7 @@ zil_get_commit_list(zilog_t *zilog)
 /*
  * Move the async itxs for a specified object to commit into sync lists.
  */
-static void
+void
 zil_async_to_sync(zilog_t *zilog, uint64_t foid)
 {
uint64_t otxg, txg;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Tue Nov  1 
15:11:10 2016(r308172)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Tue Nov  1 
16:03:31 2016(r308173)
@@ -169,6 +169,7 @@ typedef struct zvol_state {
uint32_tzv_open_count[OTYPCNT]; /* open counts */
 #endif
uint32_tzv_total_opens; /* total open count */
+   uint32_tzv_sync_cnt;/* synchronous open count */
zilog_t *zv_zilog;  /* ZIL handle */
list_t  zv_extents; /* List of extents for dump */
znode_t zv_znode;   /* for range locking */
@@ -1441,7 +1442,9 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_
BP_ZERO(>lr_blkptr);
 
itx->itx_private = zv;
-   itx->itx_sync = sync;
+
+   if (!sync && (zv->zv_sync_cnt == 0))
+   itx->itx_sync = B_FALSE;
 
zil_itx_assign(zilog, itx, tx);
 
@@ -2083,7 +2086,7 @@ zvol_log_truncate(zvol_state_t *zv, dmu_
lr->lr_offset = off;
lr->lr_length = len;
 
-   itx->itx_sync = sync;
+   itx->itx_sync = (sync || zv->zv_sync_cnt != 0);
zil_itx_assign(zilog, itx, tx);
 }
 
@@ -3075,6 +3078,11 @@ zvol_d_open(struct cdev *dev, int flags,
 #endif
 
zv->zv_total_opens++;
+   if (flags & (FSYNC | FDSYNC)) {
+   zv->zv_sync_cnt++;
+   if (zv->zv_sync_cnt == 1)
+   zil_async_to_sync(zv->zv_zilog, ZVOL_OBJ);
+   }
mutex_exit(_state_lock);
return (err);
 out:
@@ -3105,6 +3113,8 @@ zvol_d_close(struct cdev *dev, int flags
 * You may get multiple opens, but only one close.
 */
zv->zv_total_opens--;
+   if (flags & (FSYNC | FDSYNC))
+   zv->zv_sync_cnt--;
 
if (zv->zv_total_opens == 0)
zvol_last_close(zv);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308172 - head/lib/msun/ld80

2016-11-01 Thread Ed Maste
Author: emaste
Date: Tue Nov  1 15:11:10 2016
New Revision: 308172
URL: https://svnweb.freebsd.org/changeset/base/308172

Log:
  libm: add braces around initialization of subobjects
  
  This cleans up a warning when building libm at higher WARNS levels and
  makes the intent more clear. By the C standard the values are assigned
  to subobject members in order so this change introduces no functional
  change. (6.7.9 20)
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8333

Modified:
  head/lib/msun/ld80/k_expl.h
  head/lib/msun/ld80/s_logl.c

Modified: head/lib/msun/ld80/k_expl.h
==
--- head/lib/msun/ld80/k_expl.h Tue Nov  1 14:50:32 2016(r308171)
+++ head/lib/msun/ld80/k_expl.h Tue Nov  1 15:11:10 2016(r308172)
@@ -75,140 +75,140 @@ static const struct {
double  hi;
double  lo;
 } tbl[INTERVALS] = {
-   0x1p+0, 0x0p+0,
+   { 0x1p+0, 0x0p+0 },
/*
 * XXX hi is rounded down, and the formatting is not quite normal.
 * But I rather like both.  The 0x1.*p format is good for 4N+1
 * mantissa bits.  Rounding down makes the lo terms positive,
 * so that the columnar formatting can be simpler.
 */
-   0x1.0163da9fb3335p+0, 0x1.b61299ab8cdb7p-54,
-   0x1.02c9a3e778060p+0, 0x1.dcdef95949ef4p-53,
-   0x1.04315e86e7f84p+0, 0x1.7ae71f3441b49p-53,
-   0x1.059b0d3158574p+0, 0x1.d73e2a475b465p-55,
-   0x1.0706b29ddf6ddp+0, 0x1.8db880753b0f6p-53,
-   0x1.0874518759bc8p+0, 0x1.186be4bb284ffp-57,
-   0x1.09e3ecac6f383p+0, 0x1.1487818316136p-54,
-   0x1.0b5586cf9890fp+0, 0x1.8a62e4adc610bp-54,
-   0x1.0cc922b7247f7p+0, 0x1.01edc16e24f71p-54,
-   0x1.0e3ec32d3d1a2p+0, 0x1.03a1727c57b53p-59,
-   0x1.0fb66affed31ap+0, 0x1.e464123bb1428p-53,
-   0x1.11301d0125b50p+0, 0x1.49d77e35db263p-53,
-   0x1.12abdc06c31cbp+0, 0x1.f72575a649ad2p-53,
-   0x1.1429aaea92ddfp+0, 0x1.66820328764b1p-53,
-   0x1.15a98c8a58e51p+0, 0x1.2406ab9eeab0ap-55,
-   0x1.172b83c7d517ap+0, 0x1.b9bef918a1d63p-53,
-   0x1.18af9388c8de9p+0, 0x1.777ee1734784ap-53,
-   0x1.1a35beb6fcb75p+0, 0x1.e5b4c7b4968e4p-55,
-   0x1.1bbe084045cd3p+0, 0x1.3563ce56884fcp-53,
-   0x1.1d4873168b9aap+0, 0x1.e016e00a2643cp-54,
-   0x1.1ed5022fcd91cp+0, 0x1.71033fec2243ap-53,
-   0x1.2063b88628cd6p+0, 0x1.dc775814a8495p-55,
-   0x1.21f49917ddc96p+0, 0x1.2a97e9494a5eep-55,
-   0x1.2387a6e756238p+0, 0x1.9b07eb6c70573p-54,
-   0x1.251ce4fb2a63fp+0, 0x1.ac155bef4f4a4p-55,
-   0x1.26b4565e27cddp+0, 0x1.2bd339940e9d9p-55,
-   0x1.284dfe1f56380p+0, 0x1.2d9e2b9e07941p-53,
-   0x1.29e9df51fdee1p+0, 0x1.612e8afad1255p-55,
-   0x1.2b87fd0dad98fp+0, 0x1.fbbd48ca71f95p-53,
-   0x1.2d285a6e4030bp+0, 0x1.0024754db41d5p-54,
-   0x1.2ecafa93e2f56p+0, 0x1.1ca0f45d52383p-56,
-   0x1.306fe0a31b715p+0, 0x1.6f46ad23182e4p-55,
-   0x1.32170fc4cd831p+0, 0x1.a9ce78e18047cp-55,
-   0x1.33c08b26416ffp+0, 0x1.32721843659a6p-54,
-   0x1.356c55f929ff0p+0, 0x1.928c468ec6e76p-53,
-   0x1.371a7373aa9cap+0, 0x1.4e28aa05e8a8fp-53,
-   0x1.38cae6d05d865p+0, 0x1.0b53961b37da2p-53,
-   0x1.3a7db34e59ff6p+0, 0x1.d43792533c144p-53,
-   0x1.3c32dc313a8e4p+0, 0x1.08003e4516b1ep-53,
-   0x1.3dea64c123422p+0, 0x1.ada0911f09ebcp-55,
-   0x1.3fa4504ac801bp+0, 0x1.417ee03548306p-53,
-   0x1.4160a21f72e29p+0, 0x1.f0864b71e7b6cp-53,
-   0x1.431f5d950a896p+0, 0x1.b8e088728219ap-53,
-   0x1.44e086061892dp+0, 0x1.89b7a04ef80d0p-59,
-   0x1.46a41ed1d0057p+0, 0x1.c944bd1648a76p-54,
-   0x1.486a2b5c13cd0p+0, 0x1.3c1a3b69062f0p-56,
-   0x1.4a32af0d7d3dep+0, 0x1.9cb62f3d1be56p-54,
-   0x1.4bfdad5362a27p+0, 0x1.d4397afec42e2p-56,
-   0x1.4dcb299fddd0dp+0, 0x1.8ecdbbc6a7833p-54,
-   0x1.4f9b2769d2ca6p+0, 0x1.5a67b16d3540ep-53,
-   0x1.516daa2cf6641p+0, 0x1.8225ea5909b04p-53,
-   0x1.5342b569d4f81p+0, 0x1.be1507893b0d5p-53,
-   0x1.551a4ca5d920ep+0, 0x1.8a5d8c4048699p-53,
-   0x1.56f4736b527dap+0, 0x1.9bb2c011d93adp-54,
-   0x1.58d12d497c7fdp+0, 0x1.295e15b9a1de8p-55,
-   0x1.5ab07dd485429p+0, 0x1.6324c054647adp-54,
-   0x1.5c9268a5946b7p+0, 0x1.c4b1b816986a2p-60,
-   0x1.5e76f15ad2148p+0, 0x1.ba6f93080e65ep-54,
-   0x1.605e1b976dc08p+0, 0x1.60edeb25490dcp-53,
-   0x1.6247eb03a5584p+0, 0x1.63e1f40dfa5b5p-53,
-   0x1.6434634ccc31fp+0, 0x1.8edf0e2989db3p-53,
-   0x1.6623882552224p+0, 0x1.224fb3c5371e6p-53,
-   0x1.68155d44ca973p+0, 0x1.038ae44f73e65p-57,
-   0x1.6a09e667f3bccp+0, 0x1.21165f626cdd5p-53,
-   0x1.6c012750bdabep+0, 0x1.daed533001e9ep-53,
-   0x1.6dfb23c651a2ep+0, 0x1.e441c597c3775p-53,
-   0x1.6ff7df9519483p+0, 0x1.9f0fc369e7c42p-53,
-   0x1.71f75e8ec5f73p+0, 0x1.ba46e1e5de15ap-53,
-   0x1.73f9a48a58173p+0, 

svn commit: r308171 - head/release/arm64

2016-11-01 Thread Ed Maste
Author: emaste
Date: Tue Nov  1 14:50:32 2016
New Revision: 308171
URL: https://svnweb.freebsd.org/changeset/base/308171

Log:
  arm64 make-memstick.sh: use 'set -e' to abort if any step fails
  
  Also remove the now-redundant error handling that was only for makefs.
  
  This script was run on an older FreeBSD host that lacked efi-on-mbr
  support in makefs. A warning was emitted on the console (from makefs)
  but the script continued running and exited with 0.
  
  Reviewed by:  gjb
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/arm64/make-memstick.sh

Modified: head/release/arm64/make-memstick.sh
==
--- head/release/arm64/make-memstick.sh Tue Nov  1 13:54:44 2016
(r308170)
+++ head/release/arm64/make-memstick.sh Tue Nov  1 14:50:32 2016
(r308171)
@@ -10,6 +10,8 @@
 # $FreeBSD$
 #
 
+set -e
+
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 export PATH
 
@@ -31,10 +33,6 @@ fi
 echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab
 echo 'root_rw_mount="NO"' > ${1}/etc/rc.conf.local
 makefs -B little -o label=FreeBSD_Install ${2}.part ${1}
-if [ $? -ne 0 ]; then
-   echo "makefs failed"
-   exit 1
-fi
 rm ${1}/etc/fstab
 rm ${1}/etc/rc.conf.local
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308170 - head/lib/libc/locale

2016-11-01 Thread Ruslan Bukin
Author: br
Date: Tue Nov  1 13:54:44 2016
New Revision: 308170
URL: https://svnweb.freebsd.org/changeset/base/308170

Log:
  Locale fix for endian big (EB) machines.
  
  We have locale files generated on EL machines (e.g. during cross-build
  on amd64 host), but then we are using them on EB machines (e.g. MIPS64EB),
  so proceed byte-swap if necessary.
  
  All the libc tests passed successfully, including Russian collation.
  
  Tested by:br@, Hongyan Xia 
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D8281

Added:
  head/lib/libc/locale/endian.h   (contents, props changed)
Modified:
  head/lib/libc/locale/collate.c
  head/lib/libc/locale/rune.c

Modified: head/lib/libc/locale/collate.c
==
--- head/lib/libc/locale/collate.c  Tue Nov  1 12:47:19 2016
(r308169)
+++ head/lib/libc/locale/collate.c  Tue Nov  1 13:54:44 2016
(r308170)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "un-namespace.h"
 
+#include "endian.h"
 #include "collate.h"
 #include "setlocale.h"
 #include "ldpart.h"
@@ -160,7 +161,7 @@ __collate_load_tables_l(const char *enco
 
if ((info->directive_count < 1) ||
(info->directive_count >= COLL_WEIGHTS_MAX) ||
-   ((chains = info->chain_count) < 0)) {
+   ((chains = BSWAP(info->chain_count)) < 0)) {
(void) munmap(map, sbuf.st_size);
errno = EINVAL;
return (_LDP_ERROR);
@@ -168,9 +169,9 @@ __collate_load_tables_l(const char *enco
 
i = (sizeof (collate_char_t) * (UCHAR_MAX + 1)) +
(sizeof (collate_chain_t) * chains) +
-   (sizeof (collate_large_t) * info->large_count);
+   (sizeof (collate_large_t) * BSWAP(info->large_count));
for (z = 0; z < info->directive_count; z++) {
-   i += sizeof (collate_subst_t) * info->subst_count[z];
+   i += sizeof (collate_subst_t) * BSWAP(info->subst_count[z]);
}
if (i != (sbuf.st_size - (TMP - map))) {
(void) munmap(map, sbuf.st_size);
@@ -183,9 +184,9 @@ __collate_load_tables_l(const char *enco
TMP += sizeof (collate_char_t) * (UCHAR_MAX + 1);
 
for (z = 0; z < info->directive_count; z++) {
-   if (info->subst_count[z] > 0) {
+   if (BSWAP(info->subst_count[z]) > 0) {
table->subst_table[z] = (void *)TMP;
-   TMP += info->subst_count[z] * sizeof (collate_subst_t);
+   TMP += BSWAP(info->subst_count[z]) * sizeof 
(collate_subst_t);
} else {
table->subst_table[z] = NULL;
}
@@ -196,7 +197,7 @@ __collate_load_tables_l(const char *enco
TMP += chains * sizeof (collate_chain_t);
} else
table->chain_pri_table = NULL;
-   if (info->large_count > 0)
+   if (BSWAP(info->large_count) > 0)
table->large_pri_table = (void *)TMP;
else
table->large_pri_table = NULL;
@@ -209,7 +210,7 @@ static const int32_t *
 substsearch(struct xlocale_collate *table, const wchar_t key, int pass)
 {
const collate_subst_t *p;
-   int n = table->info->subst_count[pass];
+   int n = BSWAP(table->info->subst_count[pass]);
 
if (n == 0)
return (NULL);
@@ -221,7 +222,8 @@ substsearch(struct xlocale_collate *tabl
return (NULL);
 
p = table->subst_table[pass] + (key & ~COLLATE_SUBST_PRIORITY);
-   assert(p->key == key);
+   assert(BSWAP(p->key) == key);
+
return (p->pri);
 }
 
@@ -229,7 +231,7 @@ static collate_chain_t *
 chainsearch(struct xlocale_collate *table, const wchar_t *key, int *len)
 {
int low = 0;
-   int high = table->info->chain_count - 1;;
+   int high = BSWAP(table->info->chain_count) - 1;
int next, compar, l;
collate_chain_t *p;
collate_chain_t *tab = table->chain_pri_table;
@@ -240,7 +242,7 @@ chainsearch(struct xlocale_collate *tabl
while (low <= high) {
next = (low + high) / 2;
p = tab + next;
-   compar = *key - *p->str;
+   compar = *key - le16toh(*p->str);
if (compar == 0) {
l = wcsnlen(p->str, COLLATE_STR_LEN);
compar = wcsncmp(key, p->str, l);
@@ -261,7 +263,7 @@ static collate_large_t *
 largesearch(struct xlocale_collate *table, const wchar_t key)
 {
int low = 0;
-   int high = table->info->large_count - 1;
+   int high = BSWAP(table->info->large_count) - 1;
int next, compar;
collate_large_t *p;
collate_large_t *tab = table->large_pri_table;
@@ -272,7 +274,7 @@ largesearch(struct xlocale_collate *tabl
while (low <= high) {
next = (low + high) / 2;
  

Re: svn commit: r308026 - in head/sys: kern sys ufs/ffs

2016-11-01 Thread Konstantin Belousov
On Mon, Oct 31, 2016 at 05:02:46PM -0700, Gleb Smirnoff wrote:
>   Hi,
> 
> On Fri, Oct 28, 2016 at 11:43:59AM +, Konstantin Belousov wrote:
> K> Author: kib
> K> Date: Fri Oct 28 11:43:59 2016
> K> New Revision: 308026
> K> URL: https://svnweb.freebsd.org/changeset/base/308026
> K> 
> K> Log:
> K>   Generalize UFS buffer pager to allow it serving other filesystems
> K>   which also use buffer cache.
> K>   
> K>   Most important addition to the code is the handling of filesystems
> K>   where the block size is less than the machine page size, which might
> K>   require reading several buffers to validate single page.
> K>   
> K>   Tested by:   pho
> K>   Sponsored by:The FreeBSD Foundation
> K>   MFC after:   2 weeks
> K> 
> K> Modified:
> K>   head/sys/kern/vfs_bio.c
> K>   head/sys/sys/buf.h
> K>   head/sys/ufs/ffs/ffs_vnops.c
> K> 
> K> Modified: head/sys/kern/vfs_bio.c
> K> 
> ==
> K> --- head/sys/kern/vfs_bio.cFri Oct 28 11:35:06 2016
> (r308025)
> K> +++ head/sys/kern/vfs_bio.cFri Oct 28 11:43:59 2016
> (r308026)
> K> @@ -75,9 +75,10 @@ __FBSDID("$FreeBSD$");
> K>  #include 
> K>  #include 
> K>  #include 
> K> -#include 
> K> -#include 
> K>  #include 
> K> +#include 
> K> +#include 
> K> +#include 
> K>  #include 
> K>  #include 
> K>  #include 
> K> @@ -4636,6 +4637,161 @@ bdata2bio(struct buf *bp, struct bio *bi
> K>}
> K>  }
> K>  
> K> +static int buf_pager_relbuf;
> K> +SYSCTL_INT(_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN,
> K> +_pager_relbuf, 0,
> K> +"Make buffer pager release buffers after reading");
> K> +
> K> +/*
> K> + * The buffer pager.  It uses buffer reads to validate pages.
> K> + *
> K> + * In contrast to the generic local pager from vm/vnode_pager.c, this
> K> + * pager correctly and easily handles volumes where the underlying
> K> + * device block size is greater than the machine page size.  The
> K> + * buffer cache transparently extends the requested page run to be
> K> + * aligned at the block boundary, and does the necessary bogus page
> K> + * replacements in the addends to avoid obliterating already valid
> K> + * pages.
> K> + *
> K> + * The only non-trivial issue is that the exclusive busy state for
> K> + * pages, which is assumed by the vm_pager_getpages() interface, is
> K> + * incompatible with the VMIO buffer cache's desire to share-busy the
> K> + * pages.  This function performs a trivial downgrade of the pages'
> K> + * state before reading buffers, and a less trivial upgrade from the
> K> + * shared-busy to excl-busy state after the read.
> 
> IMHO, should be noted that the pager ignores requested rbehind and rahead
> values, and does the rbehind and rahead sizes that he prefers.
Pager interface considers the ahead/behind pages' page-in as unsignificant,
in particular because the pages can be recycled or invalidated during the
pager operation, when pager drops the object lock.

More important, this pager de-facto uses the optimal filesystem-depended
aligned io size due to its structure, comparing with the bmap pager.
For this reason, I consider additional attempts to follow optional
upper-level hints not very useful.  Measurements show no difference in
the real workload times, and marginal improvements for microbenchmarks
(5% scale).

I might do something more aggressive when upper-level specified rahead is
(significantly) above the natural block size limit, like using breadn()
instead of bread().  Practice suggests that this would not help or even
be a pessimisation due to higher buf cache trashing.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308169 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-11-01 Thread Alexander Motin
Author: mav
Date: Tue Nov  1 12:47:19 2016
New Revision: 308169
URL: https://svnweb.freebsd.org/changeset/base/308169

Log:
  Pass to zvol_log_truncate() same sync values as to zvol_log_write().
  
  Surplus marking of TX_TRUNCATE records as sync could result in putting them
  into ZIL before previous writes if ones were async.
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Tue Nov  1 
08:30:06 2016(r308168)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Tue Nov  1 
12:47:19 2016(r308169)
@@ -1674,7 +1674,7 @@ zvol_strategy(struct bio *bp)
if (error != 0) {
dmu_tx_abort(tx);
} else {
-   zvol_log_truncate(zv, tx, off, resid, B_TRUE);
+   zvol_log_truncate(zv, tx, off, resid, sync);
dmu_tx_commit(tx);
error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ,
off, resid);
@@ -3118,9 +3118,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cm
 {
zvol_state_t *zv;
rl_t *rl;
-   off_t offset, length, chunk;
+   off_t offset, length;
int i, error;
-   u_int u;
+   boolean_t sync;
 
zv = dev->si_drv2;
 
@@ -3158,15 +3158,17 @@ zvol_d_ioctl(struct cdev *dev, u_long cm
dmu_tx_t *tx = dmu_tx_create(zv->zv_objset);
error = dmu_tx_assign(tx, TXG_WAIT);
if (error != 0) {
+   sync = FALSE;
dmu_tx_abort(tx);
} else {
-   zvol_log_truncate(zv, tx, offset, length, B_TRUE);
+   sync = (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS);
+   zvol_log_truncate(zv, tx, offset, length, sync);
dmu_tx_commit(tx);
error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ,
offset, length);
}
zfs_range_unlock(rl);
-   if (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS)
+   if (sync)
zil_commit(zv->zv_zilog, ZVOL_OBJ);
break;
case DIOCGSTRIPESIZE:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308168 - head/sys/dev/hyperv/vmbus

2016-11-01 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Nov  1 08:30:06 2016
New Revision: 308168
URL: https://svnweb.freebsd.org/changeset/base/308168

Log:
  hyperv/vmbus: Avoid extra header copy.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8395

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Tue Nov  1 08:20:33 2016
(r308167)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Tue Nov  1 08:30:06 2016
(r308168)
@@ -926,28 +926,28 @@ vmbus_chan_recv(struct vmbus_channel *ch
 
 int
 vmbus_chan_recv_pkt(struct vmbus_channel *chan,
-struct vmbus_chanpkt_hdr *pkt0, int *pktlen0)
+struct vmbus_chanpkt_hdr *pkt, int *pktlen0)
 {
-   struct vmbus_chanpkt_hdr pkt;
-   int error, pktlen;
+   int error, pktlen, pkt_hlen;
 
-   error = vmbus_rxbr_peek(>ch_rxbr, , sizeof(pkt));
+   pkt_hlen = sizeof(*pkt);
+   error = vmbus_rxbr_peek(>ch_rxbr, pkt, pkt_hlen);
if (error)
return (error);
 
-   if (__predict_false(pkt.cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) {
-   vmbus_chan_printf(chan, "invalid hlen %u\n", pkt.cph_hlen);
+   if (__predict_false(pkt->cph_hlen < VMBUS_CHANPKT_HLEN_MIN)) {
+   vmbus_chan_printf(chan, "invalid hlen %u\n", pkt->cph_hlen);
/* XXX this channel is dead actually. */
return (EIO);
}
-   if (__predict_false(pkt.cph_hlen > pkt.cph_tlen)) {
+   if (__predict_false(pkt->cph_hlen > pkt->cph_tlen)) {
vmbus_chan_printf(chan, "invalid hlen %u and tlen %u\n",
-   pkt.cph_hlen, pkt.cph_tlen);
+   pkt->cph_hlen, pkt->cph_tlen);
/* XXX this channel is dead actually. */
return (EIO);
}
 
-   pktlen = VMBUS_CHANPKT_GETLEN(pkt.cph_tlen);
+   pktlen = VMBUS_CHANPKT_GETLEN(pkt->cph_tlen);
if (*pktlen0 < pktlen) {
/* Return the size of this packet. */
*pktlen0 = pktlen;
@@ -955,8 +955,12 @@ vmbus_chan_recv_pkt(struct vmbus_channel
}
*pktlen0 = pktlen;
 
-   /* Include packet header */
-   error = vmbus_rxbr_read(>ch_rxbr, pkt0, pktlen, 0);
+   /*
+* Skip the fixed-size packet header, which has been filled
+* by the above vmbus_rxbr_peek().
+*/
+   error = vmbus_rxbr_read(>ch_rxbr, pkt + 1,
+   pktlen - pkt_hlen, pkt_hlen);
KASSERT(!error, ("vmbus_rxbr_read failed"));
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308167 - head/sys/dev/hyperv/netvsc

2016-11-01 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Nov  1 08:20:33 2016
New Revision: 308167
URL: https://svnweb.freebsd.org/changeset/base/308167

Log:
  hyperv/hn: Directly fill chimney sending buffer for small packets.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8394

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 07:41:26 2016
(r308166)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 08:20:33 2016
(r308167)
@@ -1394,15 +1394,28 @@ hn_encap(struct hn_tx_ring *txr, struct 
struct mbuf *m_head = *m_head0;
struct rndis_packet_msg *pkt;
uint32_t *pi_data;
+   void *chim = NULL;
int pktlen;
 
-   /*
-* extension points to the area reserved for the
-* rndis_filter_packet, which is placed just after
-* the netvsc_packet (and rppi struct, if present;
-* length is updated later).
-*/
pkt = txd->rndis_pkt;
+   if (m_head->m_pkthdr.len + HN_RNDIS_PKT_LEN < txr->hn_chim_size) {
+   /*
+* This packet is small enough to fit into a chimney sending
+* buffer.  Try allocating one chimney sending buffer now.
+*/
+   txr->hn_tx_chimney_tried++;
+   txd->chim_index = hn_chim_alloc(txr->hn_sc);
+   if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) {
+   chim = txr->hn_sc->hn_chim +
+   (txd->chim_index * txr->hn_sc->hn_chim_szmax);
+   /*
+* Directly fill the chimney sending buffer w/ the
+* RNDIS packet message.
+*/
+   pkt = chim;
+   }
+   }
+
pkt->rm_type = REMOTE_NDIS_PACKET_MSG;
pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len;
pkt->rm_dataoffset = sizeof(*pkt);
@@ -1475,26 +1488,25 @@ hn_encap(struct hn_tx_ring *txr, struct 
pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset);
 
/*
-* Chimney send, if the packet could fit into one chimney buffer.
+* Fast path: Chimney sending.
 */
-   if (pkt->rm_len < txr->hn_chim_size) {
-   txr->hn_tx_chimney_tried++;
-   txd->chim_index = hn_chim_alloc(txr->hn_sc);
-   if (txd->chim_index != HN_NVS_CHIM_IDX_INVALID) {
-   uint8_t *dest = txr->hn_sc->hn_chim +
-   (txd->chim_index * txr->hn_sc->hn_chim_szmax);
-
-   memcpy(dest, pkt, pktlen);
-   dest += pktlen;
-   m_copydata(m_head, 0, m_head->m_pkthdr.len, dest);
-
-   txd->chim_size = pkt->rm_len;
-   txr->hn_gpa_cnt = 0;
-   txr->hn_tx_chimney++;
-   txr->hn_sendpkt = hn_txpkt_chim;
-   goto done;
-   }
-   }
+   if (chim != NULL) {
+   KASSERT(txd->chim_index != HN_NVS_CHIM_IDX_INVALID,
+   ("chimney buffer is not used"));
+   KASSERT(pkt == chim, ("RNDIS pkt not in chimney buffer"));
+
+   m_copydata(m_head, 0, m_head->m_pkthdr.len,
+   ((uint8_t *)chim) + pktlen);
+
+   txd->chim_size = pkt->rm_len;
+   txr->hn_gpa_cnt = 0;
+   txr->hn_tx_chimney++;
+   txr->hn_sendpkt = hn_txpkt_chim;
+   goto done;
+   }
+   KASSERT(txd->chim_index == HN_NVS_CHIM_IDX_INVALID,
+   ("chimney buffer is used"));
+   KASSERT(pkt == txd->rndis_pkt, ("RNDIS pkt not in txdesc"));
 
error = hn_txdesc_dmamap_load(txr, txd, _head, segs, );
if (error) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308166 - head/sys/dev/hyperv/netvsc

2016-11-01 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Nov  1 07:41:26 2016
New Revision: 308166
URL: https://svnweb.freebsd.org/changeset/base/308166

Log:
  hyperv/hn: Move TSO packet fixup to an earlier place for if_transmit.
  
  While TSO packet header may be still cache-hot.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8393

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 07:15:39 2016
(r308165)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 07:41:26 2016
(r308166)
@@ -547,6 +547,80 @@ hn_chim_free(struct hn_softc *sc, uint32
atomic_clear_long(>hn_chim_bmap[idx], mask);
 }
 
+#if defined(INET6) || defined(INET)
+/*
+ * NOTE: If this function failed, the m_head would be freed.
+ */
+static __inline struct mbuf *
+hn_tso_fixup(struct mbuf *m_head)
+{
+   struct ether_vlan_header *evl;
+   struct tcphdr *th;
+   int ehlen;
+
+   KASSERT(M_WRITABLE(m_head), ("TSO mbuf not writable"));
+
+#define PULLUP_HDR(m, len) \
+do {   \
+   if (__predict_false((m)->m_len < (len))) {  \
+   (m) = m_pullup((m), (len)); \
+   if ((m) == NULL)\
+   return (NULL);  \
+   }   \
+} while (0)
+
+   PULLUP_HDR(m_head, sizeof(*evl));
+   evl = mtod(m_head, struct ether_vlan_header *);
+   if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN))
+   ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
+   else
+   ehlen = ETHER_HDR_LEN;
+
+#ifdef INET
+   if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) {
+   struct ip *ip;
+   int iphlen;
+
+   PULLUP_HDR(m_head, ehlen + sizeof(*ip));
+   ip = mtodo(m_head, ehlen);
+   iphlen = ip->ip_hl << 2;
+
+   PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th));
+   th = mtodo(m_head, ehlen + iphlen);
+
+   ip->ip_len = 0;
+   ip->ip_sum = 0;
+   th->th_sum = in_pseudo(ip->ip_src.s_addr,
+   ip->ip_dst.s_addr, htons(IPPROTO_TCP));
+   }
+#endif
+#if defined(INET6) && defined(INET)
+   else
+#endif
+#ifdef INET6
+   {
+   struct ip6_hdr *ip6;
+
+   PULLUP_HDR(m_head, ehlen + sizeof(*ip6));
+   ip6 = mtodo(m_head, ehlen);
+   if (ip6->ip6_nxt != IPPROTO_TCP) {
+   m_freem(m_head);
+   return (NULL);
+   }
+
+   PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th));
+   th = mtodo(m_head, ehlen + sizeof(*ip6));
+
+   ip6->ip6_plen = 0;
+   th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0);
+   }
+#endif
+   return (m_head);
+
+#undef PULLUP_HDR
+}
+#endif /* INET6 || INET */
+
 static int
 hn_set_rxfilter(struct hn_softc *sc)
 {
@@ -1358,32 +1432,10 @@ hn_encap(struct hn_tx_ring *txr, struct 
 
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) {
 #if defined(INET6) || defined(INET)
-   struct ether_vlan_header *eh;
-   int ether_len;
-
-   /*
-* XXX need m_pullup and use mtodo
-*/
-   eh = mtod(m_head, struct ether_vlan_header*);
-   if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN))
-   ether_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
-   else
-   ether_len = ETHER_HDR_LEN;
-
pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
NDIS_LSO2_INFO_SIZE, NDIS_PKTINFO_TYPE_LSO);
 #ifdef INET
if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) {
-   struct ip *ip =
-   (struct ip *)(m_head->m_data + ether_len);
-   unsigned long iph_len = ip->ip_hl << 2;
-   struct tcphdr *th =
-   (struct tcphdr *)((caddr_t)ip + iph_len);
-
-   ip->ip_len = 0;
-   ip->ip_sum = 0;
-   th->th_sum = in_pseudo(ip->ip_src.s_addr,
-   ip->ip_dst.s_addr, htons(IPPROTO_TCP));
*pi_data = NDIS_LSO2_INFO_MAKEIPV4(0,
m_head->m_pkthdr.tso_segsz);
}
@@ -1393,12 +1445,6 @@ hn_encap(struct hn_tx_ring *txr, struct 
 #endif
 #ifdef INET6
{
-   struct ip6_hdr *ip6 = (struct ip6_hdr *)
-   (m_head->m_data + ether_len);
-   struct tcphdr *th = (struct tcphdr *)(ip6 + 1);
-
-   

svn commit: r308165 - head/sys/dev/usb/input

2016-11-01 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov  1 07:15:39 2016
New Revision: 308165
URL: https://svnweb.freebsd.org/changeset/base/308165

Log:
  Make sure the virtual T-axis buttons generate button release event(s)
  for continuous tilting.
  
  PR:   213957
  MFC after:3 days

Modified:
  head/sys/dev/usb/input/ums.c

Modified: head/sys/dev/usb/input/ums.c
==
--- head/sys/dev/usb/input/ums.cTue Nov  1 07:10:43 2016
(r308164)
+++ head/sys/dev/usb/input/ums.cTue Nov  1 07:15:39 2016
(r308165)
@@ -330,10 +330,13 @@ ums_intr_callback(struct usb_xfer *xfer,
dx, dy, dz, dt, dw, buttons);
 
/* translate T-axis into button presses until further */
-   if (dt > 0)
+   if (dt > 0) {
+   ums_put_queue(sc, 0, 0, 0, 0, buttons);
buttons |= 1UL << 5;
-   else if (dt < 0)
+   } else if (dt < 0) {
+   ums_put_queue(sc, 0, 0, 0, 0, buttons);
buttons |= 1UL << 6;
+   }
 
sc->sc_status.button = buttons;
sc->sc_status.dx += dx;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r308163 - in head/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc

2016-11-01 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Nov  1 06:54:25 2016
New Revision: 308163
URL: https://svnweb.freebsd.org/changeset/base/308163

Log:
  hyperv/hn: Rename cleaned up file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8390

Added:
  head/sys/dev/hyperv/netvsc/if_hn.c
 - copied unchanged from r308162, 
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Deleted:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/netvsc/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Nov  1 04:44:11 2016(r308162)
+++ head/sys/conf/files.amd64   Tue Nov  1 06:54:25 2016(r308163)
@@ -293,7 +293,7 @@ dev/hwpmc/hwpmc_tsc.c   optionalhwpmc
 dev/hwpmc/hwpmc_x86.c  optionalhwpmc
 dev/hyperv/netvsc/hn_nvs.c optionalhyperv
 dev/hyperv/netvsc/hn_rndis.c   optionalhyperv
-dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  optionalhyperv
+dev/hyperv/netvsc/if_hn.c  optionalhyperv
 dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv
 dev/hyperv/utilities/hv_heartbeat.coptionalhyperv
 dev/hyperv/utilities/hv_kvp.c  optionalhyperv

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Nov  1 04:44:11 2016(r308162)
+++ head/sys/conf/files.i386Tue Nov  1 06:54:25 2016(r308163)
@@ -250,7 +250,7 @@ dev/hwpmc/hwpmc_tsc.c   optional hwpmc
 dev/hwpmc/hwpmc_x86.c  optional hwpmc
 dev/hyperv/netvsc/hn_nvs.c optionalhyperv
 dev/hyperv/netvsc/hn_rndis.c   optionalhyperv
-dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  optionalhyperv
+dev/hyperv/netvsc/if_hn.c  optionalhyperv
 dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv
 dev/hyperv/utilities/hv_heartbeat.coptionalhyperv
 dev/hyperv/utilities/hv_kvp.c  optionalhyperv

Copied: head/sys/dev/hyperv/netvsc/if_hn.c (from r308162, 
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 06:54:25 2016
(r308163, copy of r308162, head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c)
@@ -0,0 +1,4658 @@
+/*-
+ * Copyright (c) 2010-2012 Citrix Inc.
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2012 NetApp Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*-
+ * Copyright (c) 2004-2006 Kip Macy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 

svn commit: r308164 - head/sys/dev/hyperv/netvsc

2016-11-01 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Nov  1 07:10:43 2016
New Revision: 308164
URL: https://svnweb.freebsd.org/changeset/base/308164

Log:
  hyperv/hn: Regroup if_start related functions.
  
  And put them under HN_IFSTART_SUPPORT, which is by default on until
  we whack the if_start related bits from base system.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8392

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 06:54:25 2016
(r308163)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Tue Nov  1 07:10:43 2016
(r308164)
@@ -108,6 +108,8 @@ __FBSDID("$FreeBSD$");
 
 #include "vmbus_if.h"
 
+#define HN_IFSTART_SUPPORT
+
 #define HN_RING_CNT_DEF_MAX8
 
 /* YYY should get it from the underlying channel */
@@ -209,7 +211,9 @@ static void hn_chan_callback(struct vm
 
 static voidhn_init(void *);
 static int hn_ioctl(struct ifnet *, u_long, caddr_t);
+#ifdef HN_IFSTART_SUPPORT
 static voidhn_start(struct ifnet *);
+#endif
 static int hn_transmit(struct ifnet *, struct mbuf *);
 static voidhn_xmit_qflush(struct ifnet *);
 static int hn_ifmedia_upd(struct ifnet *);
@@ -323,10 +327,12 @@ static inthn_xmit(struct 
hn_tx_ring *
 static voidhn_xmit_taskfunc(void *, int);
 static voidhn_xmit_txeof(struct hn_tx_ring *);
 static voidhn_xmit_txeof_taskfunc(void *, int);
+#ifdef HN_IFSTART_SUPPORT
 static int hn_start_locked(struct hn_tx_ring *, int);
 static voidhn_start_taskfunc(void *, int);
 static voidhn_start_txeof(struct hn_tx_ring *);
 static voidhn_start_txeof_taskfunc(void *, int);
+#endif
 
 SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
 "Hyper-V network interface");
@@ -394,10 +400,12 @@ static inthn_bind_tx_taskq = -1;
 SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN,
 _bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu");
 
+#ifdef HN_IFSTART_SUPPORT
 /* Use ifnet.if_start instead of ifnet.if_transmit */
 static int hn_use_if_start = 0;
 SYSCTL_INT(_hw_hn, OID_AUTO, use_if_start, CTLFLAG_RDTUN,
 _use_if_start, 0, "Use if_start TX method");
+#endif
 
 /* # of channels to use */
 static int hn_chan_cnt = 0;
@@ -773,10 +781,12 @@ hn_attach(device_t dev)
tx_ring_cnt = hn_tx_ring_cnt;
if (tx_ring_cnt <= 0 || tx_ring_cnt > ring_cnt)
tx_ring_cnt = ring_cnt;
+#ifdef HN_IFSTART_SUPPORT
if (hn_use_if_start) {
/* ifnet.if_start only needs one TX ring. */
tx_ring_cnt = 1;
}
+#endif
 
/*
 * Set the leader CPU for channels.
@@ -872,6 +882,7 @@ hn_attach(device_t dev)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = hn_ioctl;
ifp->if_init = hn_init;
+#ifdef HN_IFSTART_SUPPORT
if (hn_use_if_start) {
int qdepth = hn_get_txswq_depth(>hn_tx_ring[0]);
 
@@ -879,7 +890,9 @@ hn_attach(device_t dev)
IFQ_SET_MAXLEN(>if_snd, qdepth);
ifp->if_snd.ifq_drv_maxlen = qdepth - 1;
IFQ_SET_READY(>if_snd);
-   } else {
+   } else
+#endif
+   {
ifp->if_transmit = hn_transmit;
ifp->if_qflush = hn_xmit_qflush;
}
@@ -1508,7 +1521,10 @@ again:
if (!error) {
ETHER_BPF_MTAP(ifp, txd->m);
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
-   if (!hn_use_if_start) {
+#ifdef HN_IFSTART_SUPPORT
+   if (!hn_use_if_start)
+#endif
+   {
if_inc_counter(ifp, IFCOUNTER_OBYTES,
txd->m->m_pkthdr.len);
if (txd->m->m_flags & M_MCAST)
@@ -1558,71 +1574,6 @@ again:
 }
 
 /*
- * Start a transmit of one or more packets
- */
-static int
-hn_start_locked(struct hn_tx_ring *txr, int len)
-{
-   struct hn_softc *sc = txr->hn_sc;
-   struct ifnet *ifp = sc->hn_ifp;
-
-   KASSERT(hn_use_if_start,
-   ("hn_start_locked is called, when if_start is disabled"));
-   KASSERT(txr == >hn_tx_ring[0], ("not the first TX ring"));
-   mtx_assert(>hn_tx_lock, MA_OWNED);
-
-   if (__predict_false(txr->hn_suspended))
-   return 0;
-
-   if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
-   IFF_DRV_RUNNING)
-   return 0;
-
-   while (!IFQ_DRV_IS_EMPTY(>if_snd)) {
-   struct hn_txdesc *txd;
-   struct mbuf *m_head;
-