svn commit: r365402 - head/sys/dev/usb/controller

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:53:29 2020
New Revision: 365402
URL: https://svnweb.freebsd.org/changeset/base/365402

Log:
  musb/allwinner: add support for configuring phy as well as device mode
  
  At least on Orange Pi PC Plus even the host mode does not work without
  enabling the phy and setting it to the host mode.
  
  The driver will now parse dr_mode property and will try to configure
  itself and the phy accordingly.
  OTG mode is not supported yet, so it is treated as the device / peripheral
  mode.
  
  The phy is enabled -- powered on -- only for the host mode.
  
  The device mode requires support from a phy driver, e.g., aw_usbphy on
  Allwinner platform.
  aw_usbphy does not support the device mode, so it cannnot work yet.
  
  MFC after:6 weeks

Modified:
  head/sys/dev/usb/controller/musb_otg_allwinner.c

Modified: head/sys/dev/usb/controller/musb_otg_allwinner.c
==
--- head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:49:07 
2020(r365401)
+++ head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:53:29 
2020(r365402)
@@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
 
 #ifdef __arm__
 #include 
@@ -121,6 +123,7 @@ struct awusbdrd_softc {
struct resource *res[2];
clk_t   clk;
hwreset_t   reset;
+   phy_t   phy;
struct bus_spacebs;
int flags;
 };
@@ -382,7 +385,10 @@ awusbdrd_probe(device_t dev)
 static int
 awusbdrd_attach(device_t dev)
 {
+   char usb_mode[24];
struct awusbdrd_softc *sc;
+   uint8_t musb_mode;
+   int phy_mode;
int error;
 
sc = device_get_softc(dev);
@@ -392,6 +398,31 @@ awusbdrd_attach(device_t dev)
if (error != 0)
return (error);
 
+   musb_mode = MUSB2_HOST_MODE;/* default */
+   phy_mode = PHY_USB_MODE_HOST;
+   if (OF_getprop(ofw_bus_get_node(dev), "dr_mode",
+   &usb_mode, sizeof(usb_mode)) > 0) {
+   usb_mode[sizeof(usb_mode) - 1] = 0;
+   if (strcasecmp(usb_mode, "host") == 0) {
+   musb_mode = MUSB2_HOST_MODE;
+   phy_mode = PHY_USB_MODE_HOST;
+   } else if (strcasecmp(usb_mode, "peripheral") == 0) {
+   musb_mode = MUSB2_DEVICE_MODE;
+   phy_mode = PHY_USB_MODE_DEVICE;
+   } else if (strcasecmp(usb_mode, "otg") == 0) {
+   /*
+* XXX phy has PHY_USB_MODE_OTG, but MUSB does not have
+* it.  It's not clear how to propagate mode changes
+* from phy layer (that detects them) to MUSB.
+*/
+   musb_mode = MUSB2_DEVICE_MODE;
+   phy_mode = PHY_USB_MODE_DEVICE;
+   } else {
+   device_printf(dev, "Invalid FDT dr_mode: %s\n",
+   usb_mode);
+   }
+   }
+
/* AHB gate clock is required */
error = clk_get_by_ofw_index(dev, 0, 0, &sc->clk);
if (error != 0)
@@ -415,6 +446,24 @@ awusbdrd_attach(device_t dev)
}
}
 
+   /* XXX not sure if this is universally needed. */
+   (void)phy_get_by_ofw_name(dev, 0, "usb", &sc->phy);
+   if (sc->phy != NULL) {
+   device_printf(dev, "setting phy mode %d\n", phy_mode);
+   if (musb_mode == MUSB2_HOST_MODE) {
+   error = phy_enable(sc->phy);
+   if (error != 0) {
+   device_printf(dev, "Could not enable phy\n");
+   goto fail;
+   }
+   }
+   error = phy_usb_set_mode(sc->phy, phy_mode);
+   if (error != 0) {
+   device_printf(dev, "Could not set phy mode\n");
+   goto fail;
+   }
+   }
+
sc->sc.sc_bus.parent = dev;
sc->sc.sc_bus.devices = sc->sc.sc_devices;
sc->sc.sc_bus.devices_max = MUSB2_MAX_DEVICES;
@@ -457,7 +506,7 @@ awusbdrd_attach(device_t dev)
device_set_ivars(sc->sc.sc_bus.bdev, &sc->sc.sc_bus);
sc->sc.sc_id = 0;
sc->sc.sc_platform_data = sc;
-   sc->sc.sc_mode = MUSB2_HOST_MODE;   /* XXX HOST vs DEVICE mode */
+   sc->sc.sc_mode = musb_mode;
if (ofw_bus_is_compatible(dev, "allwinner,sun8i-h3-musb")) {
sc->sc.sc_ep_cfg = musbotg_ep_allwinner_h3;
sc->sc.sc_ep_max = DRD_EP_MAX_H3;
@@ -497,8 +546,15 @@ awusbdrd_attach(device_t dev)
return (0);
 
 fail:
-   if (sc->reset != NULL)
+   if (sc->phy != NULL) {
+   if (musb_mode == MUSB2_HOST_MODE)
+   (void)phy_disable(sc->phy);
+  

svn commit: r365401 - head/sys/dev/usb/controller

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:49:07 2020
New Revision: 365401
URL: https://svnweb.freebsd.org/changeset/base/365401

Log:
  musb/allwinner: add H3 support
  
  MFC after:6 weeks

Modified:
  head/sys/dev/usb/controller/musb_otg_allwinner.c

Modified: head/sys/dev/usb/controller/musb_otg_allwinner.c
==
--- head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:48:08 
2020(r365400)
+++ head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:49:07 
2020(r365401)
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #defineDRD_EP_MAX  5
+#defineDRD_EP_MAX_H3   4
 
 #defineMUSB2_REG_AWIN_VEND00x0043
 #defineVEND0_PIO_MODE  0
@@ -89,12 +90,13 @@ static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-musb",   AWUSB_OKAY },
{ "allwinner,sun6i-a31-musb",   AWUSB_OKAY },
{ "allwinner,sun8i-a33-musb",   AWUSB_OKAY | AWUSB_NO_CONFDATA },
+   { "allwinner,sun8i-h3-musb",AWUSB_OKAY | AWUSB_NO_CONFDATA },
{ NULL, 0 }
 };
 
 static const struct musb_otg_ep_cfg musbotg_ep_allwinner[] = {
{
-   .ep_end = 5,
+   .ep_end = DRD_EP_MAX,
.ep_fifosz_shift = 9,
.ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512,
},
@@ -103,6 +105,17 @@ static const struct musb_otg_ep_cfg musbotg_ep_allwinn
},
 };
 
+static const struct musb_otg_ep_cfg musbotg_ep_allwinner_h3[] = {
+   {
+   .ep_end = DRD_EP_MAX_H3,
+   .ep_fifosz_shift = 9,
+   .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512,
+   },
+   {
+   .ep_end = -1,
+   },
+};
+
 struct awusbdrd_softc {
struct musbotg_softcsc;
struct resource *res[2];
@@ -445,8 +458,13 @@ awusbdrd_attach(device_t dev)
sc->sc.sc_id = 0;
sc->sc.sc_platform_data = sc;
sc->sc.sc_mode = MUSB2_HOST_MODE;   /* XXX HOST vs DEVICE mode */
-   sc->sc.sc_ep_max = DRD_EP_MAX;
-   sc->sc.sc_ep_cfg = musbotg_ep_allwinner;
+   if (ofw_bus_is_compatible(dev, "allwinner,sun8i-h3-musb")) {
+   sc->sc.sc_ep_cfg = musbotg_ep_allwinner_h3;
+   sc->sc.sc_ep_max = DRD_EP_MAX_H3;
+   } else {
+   sc->sc.sc_ep_cfg = musbotg_ep_allwinner;
+   sc->sc.sc_ep_max = DRD_EP_MAX;
+   }
 
error = bus_setup_intr(dev, sc->res[1], INTR_MPSAFE | INTR_TYPE_BIO,
NULL, awusbdrd_intr, sc, &sc->sc.sc_intr_hdl);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365400 - head/sys/dev/usb/controller

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:48:08 2020
New Revision: 365400
URL: https://svnweb.freebsd.org/changeset/base/365400

Log:
  musb/allwinner: apply register filter in awusbdrd_bs_r_2() as well
  
  Otherwise, I get this panic:
  panic: awusbdrd_reg: Invalid register 0x342
  
  It looks that musb code both writes and reads at least MUSB2_REG_TXDBDIS.
  
  MFC after:5 weeks
  X-MFC after:  r365399

Modified:
  head/sys/dev/usb/controller/musb_otg_allwinner.c

Modified: head/sys/dev/usb/controller/musb_otg_allwinner.c
==
--- head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:44:24 
2020(r365399)
+++ head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:48:08 
2020(r365400)
@@ -259,6 +259,8 @@ awusbdrd_bs_r_2(awusb_bs_tag t, bus_space_handle_t h, 
 {
const struct bus_space *bs = t;
 
+   if (awusbdrd_filt(o) != 0)
+   return (0);
return bus_space_read_2(bs_parent_space(bs), h, awusbdrd_reg(o));
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365399 - head/sys/dev/usb/controller

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:44:24 2020
New Revision: 365399
URL: https://svnweb.freebsd.org/changeset/base/365399

Log:
  fixup r365398: add a missed file with all the new Allwinner musb_otg code
  
  Obtained from:andrew
  MFC after:5 weeks
  X-MFC with:   r365398

Added:
  head/sys/dev/usb/controller/musb_otg_allwinner.c   (contents, props changed)

Added: head/sys/dev/usb/controller/musb_otg_allwinner.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/controller/musb_otg_allwinner.cMon Sep  7 06:44:24 
2020(r365399)
@@ -0,0 +1,543 @@
+/*-
+ * Copyright (c) 2016 Jared McNeill 
+ * Copyright (c) 2018 Andrew Turner 
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 ``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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Allwinner USB Dual-Role Device (DRD) controller
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef __arm__
+#include 
+#include 
+#endif
+
+#defineDRD_EP_MAX  5
+
+#defineMUSB2_REG_AWIN_VEND00x0043
+#defineVEND0_PIO_MODE  0
+
+#if defined(__arm__)
+#definebs_parent_space(bs) ((bs)->bs_parent)
+typedef bus_space_tag_tawusb_bs_tag;
+#elif defined(__aarch64__)
+#definebs_parent_space(bs) (bs)
+typedef void * awusb_bs_tag;
+#endif
+
+#defineAWUSB_OKAY  0x01
+#defineAWUSB_NO_CONFDATA   0x02
+static struct ofw_compat_data compat_data[] = {
+   { "allwinner,sun4i-a10-musb",   AWUSB_OKAY },
+   { "allwinner,sun6i-a31-musb",   AWUSB_OKAY },
+   { "allwinner,sun8i-a33-musb",   AWUSB_OKAY | AWUSB_NO_CONFDATA },
+   { NULL, 0 }
+};
+
+static const struct musb_otg_ep_cfg musbotg_ep_allwinner[] = {
+   {
+   .ep_end = 5,
+   .ep_fifosz_shift = 9,
+   .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512,
+   },
+   {
+   .ep_end = -1,
+   },
+};
+
+struct awusbdrd_softc {
+   struct musbotg_softcsc;
+   struct resource *res[2];
+   clk_t   clk;
+   hwreset_t   reset;
+   struct bus_spacebs;
+   int flags;
+};
+
+static struct resource_spec awusbdrd_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+#defineREMAPFLAG   0x8000
+#defineREGDECL(a, b)   [(a)] = ((b) | REMAPFLAG)
+
+/* Allwinner USB DRD register mappings */
+static const uint16_t awusbdrd_regmap[] = {
+   REGDECL(MUSB2_REG_EPFIFO(0),0x),
+   REGDECL(MUSB2_REG_EPFIFO(1),0x0004),
+   REGDECL(MUSB2_REG_EPFIFO(2),0x0008),
+   REGDECL(MUSB2_REG_EPFIFO(3),0x000c),
+   REGDECL(MUSB2_REG_EPFIFO(4),0x0010),
+   REGDECL(MUSB2_REG_EPFIFO(5),0x0014),
+   REGDECL(MUSB2_REG_POWER,0x0040),
+   REGDECL(MUSB2_REG_DEVCTL,   0x0041),
+   REGDECL(MUSB2_REG_EPINDEX,  0x0042),
+   REGDECL(MUSB2_REG_INTTX,0x0044),
+   REGDECL(MUSB2_REG_INTRX,0x0046),
+   REGDECL(MUSB2_REG_INTTXE,   0x0048),
+   REGDECL(MUSB2_REG_INTRXE,   0x004a),
+   REGDECL

svn commit: r365398 - in head/sys: arm/allwinner arm64/conf conf

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:39:00 2020
New Revision: 365398
URL: https://svnweb.freebsd.org/changeset/base/365398

Log:
  Allwinner USB DRD support (musb_otg)
  
  Allwinner USB DRD is based on the Mentor USB OTG controller, with a
  different register layout and a few missing registers.
  
  The code is by Andrew Turner (andrew).
  
  Reviewed by:  hselasky, manu
  Obtained from:andrew
  MFC after:5 weeks
  Differential Revision: https://reviews.freebsd.org/D5881

Modified:
  head/sys/arm/allwinner/aw_usbphy.c
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm/allwinner/aw_usbphy.c
==
--- head/sys/arm/allwinner/aw_usbphy.c  Mon Sep  7 06:32:03 2020
(r365397)
+++ head/sys/arm/allwinner/aw_usbphy.c  Mon Sep  7 06:39:00 2020
(r365398)
@@ -169,6 +169,18 @@ DEFINE_CLASS_1(awusbphy_phynode, awusbphy_phynode_clas
 #defineCLR4(res, o, m) WR4(res, o, RD4(res, o) & ~(m))
 #defineSET4(res, o, m) WR4(res, o, RD4(res, o) | (m))
 
+#definePHY_CSR 0x00
+#define ID_PULLUP_EN   (1 << 17)
+#define DPDM_PULLUP_EN (1 << 16)
+#define FORCE_ID   (0x3 << 14)
+#define FORCE_ID_SHIFT 14
+#define FORCE_ID_LOW   2
+#define FORCE_VBUS_VALID   (0x3 << 12)
+#define FORCE_VBUS_VALID_SHIFT 12
+#define FORCE_VBUS_VALID_HIGH  3
+#define VBUS_CHANGE_DET(1 << 6)
+#define ID_CHANGE_DET  (1 << 5)
+#define DPDM_CHANGE_DET(1 << 4)
 #defineOTG_PHY_CFG 0x20
 #define OTG_PHY_ROUTE_OTG  (1 << 0)
 #definePMU_IRQ_ENABLE  0x00
@@ -214,6 +226,7 @@ awusbphy_init(device_t dev)
struct awusbphy_softc *sc;
phandle_t node;
char pname[20];
+   uint32_t val;
int error, off, rid;
regulator_t reg;
hwreset_t rst;
@@ -288,6 +301,16 @@ awusbphy_init(device_t dev)
return (ENXIO);
}
}
+
+   /* Enable OTG PHY for host mode */
+   val = bus_read_4(sc->phy_ctrl, PHY_CSR);
+   val &= ~(VBUS_CHANGE_DET | ID_CHANGE_DET | DPDM_CHANGE_DET);
+   val |= (ID_PULLUP_EN | DPDM_PULLUP_EN);
+   val &= ~FORCE_ID;
+   val |= (FORCE_ID_LOW << FORCE_ID_SHIFT);
+   val &= ~FORCE_VBUS_VALID;
+   val |= (FORCE_VBUS_VALID_HIGH << FORCE_VBUS_VALID_SHIFT);
+   bus_write_4(sc->phy_ctrl, PHY_CSR, val);
 
return (0);
 }

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Mon Sep  7 06:32:03 2020
(r365397)
+++ head/sys/arm/allwinner/files.allwinner  Mon Sep  7 06:39:00 2020
(r365398)
@@ -27,6 +27,7 @@ dev/usb/controller/generic_ohci.c optionalohci
 dev/usb/controller/generic_usb_if.moptionalohci
 dev/usb/controller/generic_ehci.c  optionalehci
 dev/usb/controller/generic_ehci_fdt.c  optionalehci
+dev/usb/controller/musb_otg_allwinner.coptionalmusb
 arm/allwinner/aw_sid.c optionalaw_sid
 arm/allwinner/aw_thermal.c optionalaw_thermal
 arm/allwinner/aw_cir.c optionalaw_cir evdev

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Mon Sep  7 06:32:03 2020(r365397)
+++ head/sys/arm64/conf/GENERIC Mon Sep  7 06:39:00 2020(r365398)
@@ -222,6 +222,7 @@ device  aw_usbphy   # Allwinner USB 
PHY
 device rk_usb2phy  # Rockchip USB2PHY
 device rk_typec_phy# Rockchip TypeC PHY
 device dwcotg  # DWC OTG controller
+device musb# Mentor Graphics USB OTG controller
 device ohci# OHCI USB interface
 device ehci# EHCI USB interface (USB 2.0)
 device ehci_mv # Marvell EHCI USB interface

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Mon Sep  7 06:32:03 2020(r365397)
+++ head/sys/conf/files.arm64   Mon Sep  7 06:39:00 2020(r365398)
@@ -339,6 +339,7 @@ dev/usb/controller/generic_ehci_acpi.c optional ehci a
 dev/usb/controller/generic_ehci_fdt.c optional ehci fdt
 dev/usb/controller/generic_ohci.c optional ohci fdt
 dev/usb/controller/generic_usb_if.m optional   ohci fdt
+dev/usb/controller/musb_otg_allwinner.coptional musb fdt 
soc_allwinner_a64
 dev/usb/controller/usb_nop_xceiv.c optional fdt ext_resources
 dev/usb/controller/generic_xhci.c  optionalxhci
 dev/us

svn commit: r365397 - head/sys/dev/iicbus/twsi

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:32:03 2020
New Revision: 365397
URL: https://svnweb.freebsd.org/changeset/base/365397

Log:
  twsi: some variants clear interrupt flag by writing 0, others by writing 1
  
  Make that distinction more explicit and regular in the code.
  The difference in behavior is documented in the respective datasheets.
  
  Previously, the code handled the distinction by writing the control
  register multiple times where at least one write was zero and another
  was one.
  
  This can be considered a follow-up to r363021.
  
  Reviewed by:  manu
  MFC after:4 weeks
  Differential Revision: https://reviews.freebsd.org/D26308

Modified:
  head/sys/dev/iicbus/twsi/a10_twsi.c
  head/sys/dev/iicbus/twsi/twsi.c
  head/sys/dev/iicbus/twsi/twsi.h

Modified: head/sys/dev/iicbus/twsi/a10_twsi.c
==
--- head/sys/dev/iicbus/twsi/a10_twsi.c Mon Sep  7 06:29:41 2020
(r365396)
+++ head/sys/dev/iicbus/twsi/a10_twsi.c Mon Sep  7 06:32:03 2020
(r365397)
@@ -122,6 +122,10 @@ a10_twsi_attach(device_t dev)
sc->reg_soft_reset = TWI_SRST;
 
sc->need_ack = true;
+
+   if (ofw_bus_is_compatible(dev, "allwinner,sun6i-a31-i2c") ||
+   ofw_bus_is_compatible(dev, "allwinner,sun6i-a83t-i2c"))
+   sc->iflag_w1c = true;
return (twsi_attach(dev));
 }
 

Modified: head/sys/dev/iicbus/twsi/twsi.c
==
--- head/sys/dev/iicbus/twsi/twsi.c Mon Sep  7 06:29:41 2020
(r365396)
+++ head/sys/dev/iicbus/twsi/twsi.c Mon Sep  7 06:32:03 2020
(r365397)
@@ -147,7 +147,11 @@ twsi_clear_iflg(struct twsi_softc *sc)
 {
 
DELAY(1000);
-   twsi_control_clear(sc, TWSI_CONTROL_IFLG);
+   /* There are two ways of clearing IFLAG. */
+   if (sc->iflag_w1c)
+   twsi_control_set(sc, TWSI_CONTROL_IFLG);
+   else
+   twsi_control_clear(sc, TWSI_CONTROL_IFLG);
DELAY(1000);
 }
 
@@ -667,13 +671,11 @@ twsi_intr(void *arg)
}
debugf(sc->dev, "Refresh reg_control\n");
 
-   /* 
-* Fix silicon bug on > Allwinner A20 by doing a read and writing
-* again to the control register
+   /*
+* Newer Allwinner chips clear IFLG after writing 1 to it.
 */
-   status = TWSI_READ(sc, sc->reg_status);
-   TWSI_WRITE(sc, sc->reg_control,
- sc->control_val | TWSI_CONTROL_IFLG);
+   TWSI_WRITE(sc, sc->reg_control, sc->control_val |
+   (sc->iflag_w1c ? TWSI_CONTROL_IFLG : 0));
 
debugf(sc->dev, "Done with interrupts\n\n");
if (transfer_done == 1) {

Modified: head/sys/dev/iicbus/twsi/twsi.h
==
--- head/sys/dev/iicbus/twsi/twsi.h Mon Sep  7 06:29:41 2020
(r365396)
+++ head/sys/dev/iicbus/twsi/twsi.h Mon Sep  7 06:32:03 2020
(r365397)
@@ -66,6 +66,7 @@ struct twsi_softc {
int error;
uint32_tcontrol_val;
boolneed_ack;
+   booliflag_w1c;
 
bus_size_t  reg_data;
bus_size_t  reg_slave_addr;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365396 - head/sys/dev/iicbus/twsi

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:29:41 2020
New Revision: 365396
URL: https://svnweb.freebsd.org/changeset/base/365396

Log:
  twsi: use tsleep instead of pause for better responsiveness
  
  wakeup() does not have any effect on pause(), so if a transfer was
  not finished by the time of the first check, then the thread
  would sleep full 30 ms.
  
  To do: protect the transfer and interrupt code with the mutex,
  switch from tsleep from msleep
  
  Reviewed by:  manu
  MFC after:3 weeks
  Differential Revision: https://reviews.freebsd.org/D26309

Modified:
  head/sys/dev/iicbus/twsi/twsi.c

Modified: head/sys/dev/iicbus/twsi/twsi.c
==
--- head/sys/dev/iicbus/twsi/twsi.c Mon Sep  7 06:27:18 2020
(r365395)
+++ head/sys/dev/iicbus/twsi/twsi.c Mon Sep  7 06:29:41 2020
(r365396)
@@ -510,7 +510,7 @@ twsi_transfer(device_t dev, struct iic_msg *msgs, uint
sc->control_val &= ~TWSI_CONTROL_ACK;
TWSI_WRITE(sc, sc->reg_control, sc->control_val | TWSI_CONTROL_START);
while (sc->error == 0 && sc->transfer != 0) {
-   pause_sbt("twsi", SBT_1MS * 30, SBT_1MS, 0);
+   tsleep_sbt(sc, 0, "twsi", SBT_1MS * 30, SBT_1MS, 0);
}
debugf(sc->dev, "pause finish\n");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365395 - in head/sys: arm/allwinner/clkng dev/extres/clk

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:27:18 2020
New Revision: 365395
URL: https://svnweb.freebsd.org/changeset/base/365395

Log:
  aw_clk_nm: fix incorrect use of abs()
  
  abs() takes a (signed) int as input.
  Instead, it was used with unsigned 64-bit integers.
  
  So, add and use a new helper function to calculate a difference between
  two uint64_t-s.
  
  Reviewed by:  manu
  MFC after:2 weeks
  Differential Revision: https://reviews.freebsd.org/D26307

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nm.c
  head/sys/dev/extres/clk/clk.h

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==
--- head/sys/arm/allwinner/clkng/aw_clk_nm.cMon Sep  7 06:22:30 2020
(r365394)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.cMon Sep  7 06:27:18 2020
(r365395)
@@ -153,7 +153,8 @@ aw_clk_nm_find_best(struct aw_clk_nm_sc *sc, uint64_t 
for (m = min_m; m <= max_m; ) {
for (n = min_n; n <= max_n; ) {
cur = fparent / n / m;
-   if (abs(*fout - cur) < abs(*fout - best)) {
+   if (clk_freq_diff(*fout, cur) <
+   clk_freq_diff(*fout, best)) {
best = cur;
*factor_n = n;
*factor_m = m;
@@ -196,7 +197,8 @@ aw_clk_nm_set_freq(struct clknode *clk, uint64_t fpare
clknode_get_freq(p_clk, &fparent);
 
cur = aw_clk_nm_find_best(sc, fparent, fout, &n, &m);
-   if (abs((*fout - cur)) < abs((*fout - best))) {
+   if (clk_freq_diff(*fout, cur) <
+   clk_freq_diff(*fout, best)) {
best = cur;
best_parent = p_idx;
best_n = n;

Modified: head/sys/dev/extres/clk/clk.h
==
--- head/sys/dev/extres/clk/clk.h   Mon Sep  7 06:22:30 2020
(r365394)
+++ head/sys/dev/extres/clk/clk.h   Mon Sep  7 06:27:18 2020
(r365395)
@@ -135,6 +135,12 @@ int clk_get_parent(clk_t clk, clk_t *parent);
 int clk_set_parent_by_clk(clk_t clk, clk_t parent);
 const char *clk_get_name(clk_t clk);
 
+static inline uint64_t
+clk_freq_diff(uint64_t x, uint64_t y)
+{
+   return (x >= y ? x - y : y - x);
+}
+
 #ifdef FDT
 int clk_set_assigned(device_t dev, phandle_t node);
 int clk_get_by_ofw_index(device_t dev, phandle_t node, int idx, clk_t *clk);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365394 - stable/12/sys/arm/allwinner

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:22:30 2020
New Revision: 365394
URL: https://svnweb.freebsd.org/changeset/base/365394

Log:
  MFC r364149: aw_cir: in pulse encoding actual length is one greater than value

Modified:
  stable/12/sys/arm/allwinner/aw_cir.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/allwinner/aw_cir.c
==
--- stable/12/sys/arm/allwinner/aw_cir.cMon Sep  7 06:21:01 2020
(r365393)
+++ stable/12/sys/arm/allwinner/aw_cir.cMon Sep  7 06:22:30 2020
(r365394)
@@ -202,9 +202,9 @@ aw_ir_read_data(struct aw_ir_softc *sc)
 static unsigned long
 aw_ir_decode_packets(struct aw_ir_softc *sc)
 {
-   unsigned long len, code;
-   unsigned char val, last;
+   unsigned int len, code;
unsigned int active_delay;
+   unsigned char val, last;
int i, bitcount;
 
if (bootverbose)
@@ -215,11 +215,11 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
(AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1);
len = active_delay;
if (bootverbose)
-   device_printf(sc->dev, "Initial len: %ld\n", len);
+   device_printf(sc->dev, "Initial len: %d\n", len);
for (i = 0;  i < sc->dcnt; i++) {
val = sc->buf[i];
if (val & VAL_MASK)
-   len += val & PERIOD_MASK;
+   len += (val & PERIOD_MASK) + 1;
else {
if (len > AW_IR_L1_MIN)
break;
@@ -227,7 +227,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
}
}
if (bootverbose)
-   device_printf(sc->dev, "len = %ld\n", len);
+   device_printf(sc->dev, "len = %d\n", len);
if ((val & VAL_MASK) || (len <= AW_IR_L1_MIN)) {
if (bootverbose)
device_printf(sc->dev, "Bit separator error\n");
@@ -243,7 +243,7 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
break;
len = 0;
} else
-   len += val & PERIOD_MASK;
+   len += (val & PERIOD_MASK) + 1;
}
if ((!(val & VAL_MASK)) || (len <= AW_IR_L0_MIN)) {
if (bootverbose)
@@ -260,23 +260,25 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
val = sc->buf[i];
if (last) {
if (val & VAL_MASK)
-   len += val & PERIOD_MASK;
+   len += (val & PERIOD_MASK) + 1;
else {
if (len > AW_IR_PMAX) {
if (bootverbose)
device_printf(sc->dev,
-   "Pulse error\n");
+   "Pulse error, len=%d\n",
+   len);
goto error_code;
}
last = 0;
-   len = val & PERIOD_MASK;
+   len = (val & PERIOD_MASK) + 1;
}
} else {
if (val & VAL_MASK) {
if (len > AW_IR_DMAX) {
if (bootverbose)
device_printf(sc->dev,
-   "Distant error\n");
+   "Distance error, len=%d\n",
+   len);
goto error_code;
} else {
if (len > AW_IR_DMID) {
@@ -288,9 +290,9 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
break;  /* Finish decoding */
}
last = 1;
-   len = val & PERIOD_MASK;
+   len = (val & PERIOD_MASK) + 1;
} else
-   len += val & PERIOD_MASK;
+   len += (val & PERIOD_MASK) + 1;
}
}
return (code);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365393 - stable/12/sys/arm/allwinner

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:21:01 2020
New Revision: 365393
URL: https://svnweb.freebsd.org/changeset/base/365393

Log:
  MFC r364148: aw_cir: lower activation threshold to support NECx protocol

Modified:
  stable/12/sys/arm/allwinner/aw_cir.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/allwinner/aw_cir.c
==
--- stable/12/sys/arm/allwinner/aw_cir.cMon Sep  7 06:14:42 2020
(r365392)
+++ stable/12/sys/arm/allwinner/aw_cir.cMon Sep  7 06:21:01 2020
(r365393)
@@ -126,8 +126,10 @@ __FBSDID("$FreeBSD$");
 #defineAW_IR_DMAX  53
 
 /* Active Thresholds */
-#defineAW_IR_ACTIVE_T  ((0 & 0xff) << 16)
-#defineAW_IR_ACTIVE_T_C((1 & 0xff) << 23)
+#defineAW_IR_ACTIVE_T_VAL  AW_IR_L1_MIN
+#defineAW_IR_ACTIVE_T  (((AW_IR_ACTIVE_T_VAL - 1) & 
0xff) << 16)
+#defineAW_IR_ACTIVE_T_C_VAL0
+#defineAW_IR_ACTIVE_T_C((AW_IR_ACTIVE_T_C_VAL & 0xff) 
<< 23)
 
 /* Code masks */
 #defineCODE_MASK   0x00ff00ff
@@ -209,9 +211,9 @@ aw_ir_decode_packets(struct aw_ir_softc *sc)
device_printf(sc->dev, "sc->dcnt = %d\n", sc->dcnt);
 
/* Find Lead 1 (bit separator) */
-   active_delay = (AW_IR_ACTIVE_T + 1) * (AW_IR_ACTIVE_T_C != 0 ? 128 : 1);
-   len = 0;
-   len += (active_delay >> 1);
+   active_delay = AW_IR_ACTIVE_T_VAL *
+   (AW_IR_ACTIVE_T_C_VAL != 0 ? 128 : 1);
+   len = active_delay;
if (bootverbose)
device_printf(sc->dev, "Initial len: %ld\n", len);
for (i = 0;  i < sc->dcnt; i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365392 - stable/12/sys/dev/gpio

2020-09-06 Thread Andriy Gapon
Author: avg
Date: Mon Sep  7 06:14:42 2020
New Revision: 365392
URL: https://svnweb.freebsd.org/changeset/base/365392

Log:
  MFC r364145: gpiokeys: add evdev support
  
  Only linux,code is supported as it maps 1:1 to evdev key codes.
  No reverse mapping for freebsd,code yet.

Modified:
  stable/12/sys/dev/gpio/gpiokeys.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/gpio/gpiokeys.c
==
--- stable/12/sys/dev/gpio/gpiokeys.c   Sun Sep  6 20:32:13 2020
(r365391)
+++ stable/12/sys/dev/gpio/gpiokeys.c   Mon Sep  7 06:14:42 2020
(r365392)
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_platform.h"
 #include "opt_kbd.h"
+#include "opt_evdev.h"
 
 #include 
 #include 
@@ -56,6 +57,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef EVDEV_SUPPORT
+#include 
+#include 
+#endif
+
 #defineKBD_DRIVER_NAME "gpiokeys"
 
 #defineGPIOKEYS_LOCK(_sc)  mtx_lock(&(_sc)->sc_mtx)
@@ -99,6 +105,9 @@ struct gpiokey
struct resource *irq_res;
void*intr_hl;
struct mtx  mtx;
+#ifdef EVDEV_SUPPORT
+   uint32_tevcode;
+#endif
uint32_tkeycode;
int autorepeat;
struct callout  debounce_callout;
@@ -115,6 +124,9 @@ struct gpiokeys_softc
struct gpiokey  *sc_keys;
int sc_total_keys;
 
+#ifdef EVDEV_SUPPORT
+   struct evdev_dev*sc_evdev;
+#endif
keyboard_t  sc_kbd;
keymap_tsc_keymap;
accentmap_t sc_accmap;
@@ -171,26 +183,34 @@ gpiokeys_put_key(struct gpiokeys_softc *sc, uint32_t k
 }
 
 static void
-gpiokeys_key_event(struct gpiokeys_softc *sc, uint16_t keycode, int pressed)
+gpiokeys_key_event(struct gpiokeys_softc *sc, struct gpiokey *key, int pressed)
 {
-   uint32_t key;
+   uint32_t code;
 
-
-   key = keycode & SCAN_KEYCODE_MASK;
-
-   if (!pressed)
-   key |= KEY_RELEASE;
-
GPIOKEYS_LOCK(sc);
-   if (keycode & SCAN_PREFIX_E0)
-   gpiokeys_put_key(sc, 0xe0);
-   else if (keycode & SCAN_PREFIX_E1)
-   gpiokeys_put_key(sc, 0xe1);
+#ifdef EVDEV_SUPPORT
+   if (key->evcode != GPIOKEY_NONE &&
+   (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD) != 0) {
+   evdev_push_key(sc->sc_evdev, key->evcode, pressed);
+   evdev_sync(sc->sc_evdev);
+   }
+#endif
+   if (key->keycode != GPIOKEY_NONE) {
+   code = key->keycode & SCAN_KEYCODE_MASK;
+   if (!pressed)
+   code |= KEY_RELEASE;
 
-   gpiokeys_put_key(sc, key);
+   if (key->keycode & SCAN_PREFIX_E0)
+   gpiokeys_put_key(sc, 0xe0);
+   else if (key->keycode & SCAN_PREFIX_E1)
+   gpiokeys_put_key(sc, 0xe1);
+
+   gpiokeys_put_key(sc, code);
+   }
GPIOKEYS_UNLOCK(sc);
 
-   gpiokeys_event_keyinput(sc);
+   if (key->keycode != GPIOKEY_NONE)
+   gpiokeys_event_keyinput(sc);
 }
 
 static void
@@ -200,11 +220,8 @@ gpiokey_autorepeat(void *arg)
 
key = arg;
 
-   if (key->keycode == GPIOKEY_NONE)
-   return;
+   gpiokeys_key_event(key->parent_sc, key, 1);
 
-   gpiokeys_key_event(key->parent_sc, key->keycode, 1);
-
callout_reset(&key->repeat_callout, key->repeat,
gpiokey_autorepeat, key);
 }
@@ -217,12 +234,9 @@ gpiokey_debounced_intr(void *arg)
 
key = arg;
 
-   if (key->keycode == GPIOKEY_NONE)
-   return;
-
gpio_pin_is_active(key->pin, &active);
if (active) {
-   gpiokeys_key_event(key->parent_sc, key->keycode, 1);
+   gpiokeys_key_event(key->parent_sc, key, 1);
if (key->autorepeat) {
callout_reset(&key->repeat_callout, key->repeat_delay,
gpiokey_autorepeat, key);
@@ -232,7 +246,7 @@ gpiokey_debounced_intr(void *arg)
if (key->autorepeat &&
callout_pending(&key->repeat_callout))
callout_stop(&key->repeat_callout);
-   gpiokeys_key_event(key->parent_sc, key->keycode, 0);
+   gpiokeys_key_event(key->parent_sc, key, 0);
}
 }
 
@@ -301,6 +315,10 @@ gpiokeys_attach_key(struct gpiokeys_softc *sc, phandle
if (key->keycode == GPIOKEY_NONE)
device_printf(sc->sc_dev, "<%s> failed to map 
linux,code value 0x%x\n",
key_name, code);
+#ifdef EVDEV_SUPPORT
+   key->evcode = code;
+   evdev_support_key(sc->sc_evdev, code);
+#endif
}
else
device_printf(sc->sc_dev, "<%s> no linux,code or freebsd,code 
property\n",
@@ -365,7 +383,6 @@ gpiokeys_detach_key(struct gpi

Re: svn commit: r364637 - head/sys/kern

2020-09-06 Thread Jessica Clarke
On 6 Sep 2020, at 21:46, Alan Somers  wrote:
> 
> On Mon, Aug 24, 2020 at 3:01 AM Mateusz Guzik  wrote:
> Author: mjg
> Date: Mon Aug 24 09:00:57 2020
> New Revision: 364637
> URL: https://svnweb.freebsd.org/changeset/base/364637
> 
> Log:
>   cache: lockless reverse lookup
> 
>   This enables fully scalable operation for getcwd and significantly improves
>   realpath.
> 
>   For example:
>   PATH_CUSTOM=/usr/src ./getcwd_processes -t 104
>   before:  1550851
>   after: 380135380
> 
>   Tested by:pho
> 
> Modified:
>   head/sys/kern/vfs_cache.c
> 
> Modified: head/sys/kern/vfs_cache.c
> ==
> --- head/sys/kern/vfs_cache.c   Mon Aug 24 09:00:07 2020(r364636)
> +++ head/sys/kern/vfs_cache.c   Mon Aug 24 09:00:57 2020(r364637)
> @@ -477,6 +485,8 @@ STATNODE_COUNTER(shrinking_skipped,
>  static void cache_zap_locked(struct namecache *ncp);
>  static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf,
>  char **freebuf, size_t *buflen);
> +static int vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char 
> *buf,
> +char **retbuf, size_t *buflen, bool slash_prefixed, size_t addend);
>  static int vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf,
>  char **retbuf, size_t *buflen);
>  static int vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, char *buf,
> @@ -2476,9 +2486,17 @@ vn_getcwd(char *buf, char **retbuf, size_t *buflen)
> 
> What does the "smr" stand for?

Safe Memory Reclamation (see sys/sys/smr.h and sys/kern/subr_smr.c).

Jess

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


Re: svn commit: r364637 - head/sys/kern

2020-09-06 Thread Alan Somers
On Mon, Aug 24, 2020 at 3:01 AM Mateusz Guzik  wrote:

> Author: mjg
> Date: Mon Aug 24 09:00:57 2020
> New Revision: 364637
> URL: https://svnweb.freebsd.org/changeset/base/364637
>
> Log:
>   cache: lockless reverse lookup
>
>   This enables fully scalable operation for getcwd and significantly
> improves
>   realpath.
>
>   For example:
>   PATH_CUSTOM=/usr/src ./getcwd_processes -t 104
>   before:  1550851
>   after: 380135380
>
>   Tested by:pho
>
> Modified:
>   head/sys/kern/vfs_cache.c
>
> Modified: head/sys/kern/vfs_cache.c
>
> ==
> --- head/sys/kern/vfs_cache.c   Mon Aug 24 09:00:07 2020(r364636)
> +++ head/sys/kern/vfs_cache.c   Mon Aug 24 09:00:57 2020(r364637)
> @@ -477,6 +485,8 @@ STATNODE_COUNTER(shrinking_skipped,
>  static void cache_zap_locked(struct namecache *ncp);
>  static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf,
>  char **freebuf, size_t *buflen);
> +static int vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char
> *buf,
> +char **retbuf, size_t *buflen, bool slash_prefixed, size_t addend);
>  static int vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char
> *buf,
>  char **retbuf, size_t *buflen);
>  static int vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, char
> *buf,
> @@ -2476,9 +2486,17 @@ vn_getcwd(char *buf, char **retbuf, size_t *buflen)
>

What does the "smr" stand for?
-Alan
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365391 - head/share/man/man5

2020-09-06 Thread Alan Somers
Author: asomers
Date: Sun Sep  6 20:32:13 2020
New Revision: 365391
URL: https://svnweb.freebsd.org/changeset/base/365391

Log:
  nsswitch.conf(5): recommend placing cache after files
  
  When cache precedes files, and nscd is configured to allow negative caching,
  commands like "pw groupadd" can fail. The sequence of events looks like:
  
  1. A command like pkg(8) looks up the group, and finds it absent.
  2. pkg invokes pw(8) to add the group
  3. pkg queries the group, but nscd says it doesn't exist, since it has a
 negative cache entry for that group.
  
  See also: 
https://lists.freebsd.org/pipermail/freebsd-current/2012-January/031595.html
  
  Reviewed by:  bcr (manpages)
  MFC after:1 week
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D26184

Modified:
  head/share/man/man5/nsswitch.conf.5

Modified: head/share/man/man5/nsswitch.conf.5
==
--- head/share/man/man5/nsswitch.conf.5 Sun Sep  6 20:03:13 2020
(r365390)
+++ head/share/man/man5/nsswitch.conf.5 Sun Sep  6 20:32:13 2020
(r365391)
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 10, 2018
+.Dd September 6, 2020
 .Dt NSSWITCH.CONF 5
 .Os
 .Sh NAME
@@ -224,20 +224,24 @@ and continue on anything else (i.e,
 .Ss Cache
 You can enable caching for the particular database by specifying
 .Dq cache
-as the first source in the
+in the
 .Nm
 file.
+It should come after
+.Dq files ,
+but before remote sources like
+.Dq nis .
 You should also enable caching for this database in
 .Xr nscd.conf 5 .
-If for the particular query
+If for a particular query
 .Dq cache
-source returns success, no further sources are queried.
+source returns success, then no further sources are queried.
 On the other hand, if there are no previously cached data, the
 query result will be placed into the cache right after
 all other sources are processed.
-Note, that
+Note that
 .Dq cache
-requires
+requires the
 .Xr nscd 8
 daemon to be running.
 .Ss Compat mode: +/- syntax
@@ -321,15 +325,16 @@ resides in
 .Pa /etc .
 .El
 .Sh EXAMPLES
-To lookup hosts in cache, then in
+To lookup hosts in
 .Pa /etc/hosts
+, then in cache,
 and then from the DNS, and lookup user information from
 .Tn NIS
 then files, use:
 .Pp
 .Bl -tag -width passwd: -compact
 .It hosts:
-cache files dns
+files cache dns
 .It passwd:
 nis [notfound=return] files
 .It group:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365390 - stable/12/sys/dev/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  6 20:03:13 2020
New Revision: 365390
URL: https://svnweb.freebsd.org/changeset/base/365390

Log:
  MFC r364098 by lwhsu:
  
  Fix armv{6,7} build after r364088
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/dev/dwc/if_dwc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/dwc/if_dwc.c
==
--- stable/12/sys/dev/dwc/if_dwc.c  Sun Sep  6 19:25:31 2020
(r365389)
+++ stable/12/sys/dev/dwc/if_dwc.c  Sun Sep  6 20:03:13 2020
(r365390)
@@ -1220,7 +1220,8 @@ dwc_clock_init(device_t dev)
}
if (bootverbose) {
clk_get_freq(clk, &freq);
-   device_printf(dev, "MAC clock(%s) freq: %ld\n",  
clk_get_name(clk), freq);
+   device_printf(dev, "MAC clock(%s) freq: %jd\n",
+   clk_get_name(clk), (intmax_t)freq);
}
}
else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r364098 - head/sys/dev/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Li-Wen Hsu (lw...@freebsd.org) wrote:
> Author: lwhsu
> Date: Tue Aug 11 05:17:10 2020
> New Revision: 364098
> URL: https://svnweb.freebsd.org/changeset/base/364098
> 
> Log:
>   Fix armv{6,7} build after r364088
>   
>   Sponsored by:   The FreeBSD Foundation

I overlooked this change when it was committed. Thanks for fixing and
sorry for the breakage.

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


svn commit: r365389 - head/sys/crypto/via

2020-09-06 Thread Alan Somers
Author: asomers
Date: Sun Sep  6 19:25:31 2020
New Revision: 365389
URL: https://svnweb.freebsd.org/changeset/base/365389

Log:
  padlock(4): fix instapanics with geli authentication
  
  cryptodev_process implementations are supposed to return 0
  
  PR:   247986
  Submitted by: jhb
  MFC after:1 week

Modified:
  head/sys/crypto/via/padlock.c

Modified: head/sys/crypto/via/padlock.c
==
--- head/sys/crypto/via/padlock.c   Sun Sep  6 19:03:19 2020
(r365388)
+++ head/sys/crypto/via/padlock.c   Sun Sep  6 19:25:31 2020
(r365389)
@@ -275,7 +275,7 @@ out:
 #endif
crp->crp_etype = error;
crypto_done(crp);
-   return (error);
+   return (0);
 }
 
 static device_method_t padlock_methods[] = {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365388 - in stable/12/sys: arm64/rockchip dev/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  6 19:03:19 2020
New Revision: 365388
URL: https://svnweb.freebsd.org/changeset/base/365388

Log:
  MFC r362736, r364088
  
  r362736:
  Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC
  
  For 1000Mb mode to work reliably TX/RX delays need to be configured
  between the TX/RX clock and the respective signals on the PHY
  to compensate for differing trace lengths on the PCB.
  
  Reviewed by:  manu
  
  r364088:
  Improve Rockchip's integration of if_dwc
  
  - Do not rely on U-Boot for clocks configuration, enable and set frequencies
  in the driver's attach method.
  - Adjust MAC settings according to detected linespeed on RK3399 and RK3328.
  - Add support for RMII PHY mode on RK3328.
  
  Reviewed by:  manu
  Differential Revision:https://reviews.freebsd.org/D26006

Modified:
  stable/12/sys/arm64/rockchip/if_dwc_rk.c
  stable/12/sys/dev/dwc/if_dwc.c
  stable/12/sys/dev/dwc/if_dwc.h
  stable/12/sys/dev/dwc/if_dwc_if.m
  stable/12/sys/dev/dwc/if_dwcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/rockchip/if_dwc_rk.c
==
--- stable/12/sys/arm64/rockchip/if_dwc_rk.cSun Sep  6 18:48:50 2020
(r365387)
+++ stable/12/sys/arm64/rockchip/if_dwc_rk.cSun Sep  6 19:03:19 2020
(r365388)
@@ -24,7 +24,7 @@
  * 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.
- */
+*/
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -34,91 +34,350 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
-
 #include 
 
+#include "if_dwc_if.h"
 #include "syscon_if.h"
 
-#include "if_dwc_if.h"
-
 #defineRK3328_GRF_MAC_CON0 0x0900
-#define RK3328_GRF_MAC_CON0_TX_MASK0x7F
-#define RK3328_GRF_MAC_CON0_TX_SHIFT   0
-#define RK3328_GRF_MAC_CON0_RX_MASK0x7F
-#define RK3328_GRF_MAC_CON0_RX_SHIFT   7
+#define MAC_CON0_GMAC2IO_TX_DL_CFG_MASK0x7F
+#define MAC_CON0_GMAC2IO_TX_DL_CFG_SHIFT   0
+#define MAC_CON0_GMAC2IO_RX_DL_CFG_MASK0x7F
+#define MAC_CON0_GMAC2IO_RX_DL_CFG_SHIFT   7
 
 #defineRK3328_GRF_MAC_CON1 0x0904
+#define MAC_CON1_GMAC2IO_GMAC_TXCLK_DLY_ENA(1 << 0)
+#define MAC_CON1_GMAC2IO_GMAC_RXCLK_DLY_ENA(1 << 1)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_MASK (3 << 11)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_125  (0 << 11)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_25   (3 << 11)
+#define MAC_CON1_GMAC2IO_GMII_CLK_SEL_2_5  (2 << 11)
+#define MAC_CON1_GMAC2IO_RMII_MODE_MASK(1 << 9)
+#define MAC_CON1_GMAC2IO_RMII_MODE (1 << 9)
+#define MAC_CON1_GMAC2IO_INTF_SEL_MASK (7 << 4)
+#define MAC_CON1_GMAC2IO_INTF_RMII (4 << 4)
+#define MAC_CON1_GMAC2IO_INTF_RGMII(1 << 4)
+#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_MASK (1 << 7)
+#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_25   (1 << 7)
+#define MAC_CON1_GMAC2IO_RMII_CLK_SEL_2_5  (0 << 7)
+#define MAC_CON1_GMAC2IO_MAC_SPEED_MASK(1 << 2)
+#define MAC_CON1_GMAC2IO_MAC_SPEED_100 (1 << 2)
+#define MAC_CON1_GMAC2IO_MAC_SPEED_10  (0 << 2)
 #defineRK3328_GRF_MAC_CON2 0x0908
 #defineRK3328_GRF_MACPHY_CON0  0x0B00
+#define MACPHY_CON0_CLK_50M_MASK   (1 << 14)
+#define MACPHY_CON0_CLK_50M(1 << 14)
+#define MACPHY_CON0_RMII_MODE_MASK (3 << 6)
+#define MACPHY_CON0_RMII_MODE  (1 << 6)
 #defineRK3328_GRF_MACPHY_CON1  0x0B04
+#define MACPHY_CON1_RMII_MODE_MASK (1 << 9)
+#define MACPHY_CON1_RMII_MODE  (1 << 9)
 #defineRK3328_GRF_MACPHY_CON2  0x0B08
 #defineRK3328_GRF_MACPHY_CON3  0x0B0C
 #defineRK3328_GRF_MACPHY_STATUS0x0B10
 
+#defineRK3399_GRF_SOC_CON5 0xc214
+#define SOC_CON5_GMAC_CLK_SEL_MASK (3 << 4)
+#define SOC_CON5_GMAC_CLK_SEL_125  (0 << 4)
+#define SOC_CON5_GMAC_CLK_SEL_25   (3 << 4)
+#define SOC_CON5_GMAC_CLK_SEL_2_5  (2 << 4)
+#defineRK3399_GRF_SOC_CON6 0xc218
+#define SOC_CON6_GMAC_TXCLK_DLY_ENA(1 << 7)
+#define SOC_CON6_TX_DL_CFG_MASK0x7F
+#define SOC_CON6_TX_DL_CFG_SHIFT   0
+#define SOC_CON6_RX_DL_CFG_MASK0x7F
+#define SOC_CON6_GMAC_RXCLK_DLY_ENA(1 << 15)
+#define  

svn commit: r365387 - in stable/12/sys: arm/allwinner arm/amlogic/aml8726 arm64/rockchip dev/altera/dwc dev/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  6 18:48:50 2020
New Revision: 365387
URL: https://svnweb.freebsd.org/changeset/base/365387

Log:
  MFC r360467, r362399, r362405, r362415
  
  r360467 by mmel:
  Fix style(9). Strip write only variables.
  Not a functional change.
  
  r362399 by mmel:
  Use naming nomenclature used in DesignWare TRM.
  Use naming nomenclature used in DesignWare TRM.
  This driver was written by using Altera (now Intel) documentation for Arria
  FPGA manual. Unfortunately this manual used very different (and in some cases
  opposite naming) for registers and descriptor fields. Unfortunately,
  this makes future expansion extremely hard.
  
  Should not been functional change.
  
  r362405 by mmel:
  Finish renaming in if_dwc.
  By using DWC TRM terminology, normal descriptor format should be named
  extended and alternate descriptor format should be named normal.
  
  Should not been functional change.
  
  r362415 by mmel:
  Improve if_dwc:
   - refactorize packet receive path. Make sure that we don't leak mbufs
 and/or that we don't create holes in RX descriptor ring
   - slightly simplify handling with TX descriptors

Modified:
  stable/12/sys/arm/allwinner/aw_if_dwc.c
  stable/12/sys/arm/amlogic/aml8726/aml8726_if_dwc.c
  stable/12/sys/arm64/rockchip/if_dwc_rk.c
  stable/12/sys/dev/altera/dwc/if_dwc_socfpga.c
  stable/12/sys/dev/dwc/if_dwc.c
  stable/12/sys/dev/dwc/if_dwc.h
  stable/12/sys/dev/dwc/if_dwc_if.m
  stable/12/sys/dev/dwc/if_dwcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/allwinner/aw_if_dwc.c
==
--- stable/12/sys/arm/allwinner/aw_if_dwc.c Sun Sep  6 18:27:36 2020
(r365386)
+++ stable/12/sys/arm/allwinner/aw_if_dwc.c Sun Sep  6 18:48:50 2020
(r365387)
@@ -114,7 +114,7 @@ static int
 a20_if_dwc_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC_ALT_DESC);
+   return (DWC_GMAC_NORMAL_DESC);
 }
 
 static int

Modified: stable/12/sys/arm/amlogic/aml8726/aml8726_if_dwc.c
==
--- stable/12/sys/arm/amlogic/aml8726/aml8726_if_dwc.c  Sun Sep  6 18:27:36 
2020(r365386)
+++ stable/12/sys/arm/amlogic/aml8726/aml8726_if_dwc.c  Sun Sep  6 18:48:50 
2020(r365387)
@@ -66,7 +66,7 @@ static int
 aml8726_if_dwc_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC_ALT_DESC);
+   return (DWC_GMAC_NORMAL_DESC);
 }
 
 static int

Modified: stable/12/sys/arm64/rockchip/if_dwc_rk.c
==
--- stable/12/sys/arm64/rockchip/if_dwc_rk.cSun Sep  6 18:27:36 2020
(r365386)
+++ stable/12/sys/arm64/rockchip/if_dwc_rk.cSun Sep  6 18:48:50 2020
(r365387)
@@ -161,7 +161,7 @@ static int
 if_dwc_rk_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC_ALT_DESC);
+   return (DWC_GMAC_NORMAL_DESC);
 }
 
 static int

Modified: stable/12/sys/dev/altera/dwc/if_dwc_socfpga.c
==
--- stable/12/sys/dev/altera/dwc/if_dwc_socfpga.c   Sun Sep  6 18:27:36 
2020(r365386)
+++ stable/12/sys/dev/altera/dwc/if_dwc_socfpga.c   Sun Sep  6 18:48:50 
2020(r365387)
@@ -74,7 +74,7 @@ static int
 if_dwc_socfpga_mac_type(device_t dev)
 {
 
-   return (DWC_GMAC);
+   return (DWC_GMAC_EXT_DESC);
 }
 
 static int

Modified: stable/12/sys/dev/dwc/if_dwc.c
==
--- stable/12/sys/dev/dwc/if_dwc.c  Sun Sep  6 18:27:36 2020
(r365386)
+++ stable/12/sys/dev/dwc/if_dwc.c  Sun Sep  6 18:48:50 2020
(r365387)
@@ -93,46 +93,113 @@ __FBSDID("$FreeBSD$");
 #defineDWC_ASSERT_LOCKED(sc)   mtx_assert(&(sc)->mtx, MA_OWNED)
 #defineDWC_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, 
MA_NOTOWNED)
 
-#defineDDESC_TDES0_OWN (1U << 31)
-#defineDDESC_TDES0_TXINT   (1U << 30)
-#defineDDESC_TDES0_TXLAST  (1U << 29)
-#defineDDESC_TDES0_TXFIRST (1U << 28)
-#defineDDESC_TDES0_TXCRCDIS(1U << 27)
-#defineDDESC_TDES0_TXRINGEND   (1U << 21)
-#defineDDESC_TDES0_TXCHAIN (1U << 20)
+/* TX descriptors - TDESC0 is almost unified */
+#defineTDESC0_OWN  (1U << 31)
+#defineTDESC0_IHE  (1U << 16)  /* IP Header Error */
+#defineTDESC0_ES   (1U << 15)  /* Error Summary */
+#defineTDESC0_JT   (1U << 14)  /* Jabber Timeout */
+#defineTDESC0_FF   (1U << 13)  /* Frame Flushed */
+#defineTDESC0_PCE  (1U << 12)  /* Payload Checksum 
Error */
+#defineTDESC0_LOC  (1U << 11)  /* Loss of Carrier */
+#defineTDESC0_NC

Re: svn commit: r365378 - head/usr.sbin/traceroute6

2020-09-06 Thread Alexey Dokuchaev
On Sun, Sep 06, 2020 at 08:32:46PM +0200, Oliver Pinter wrote:
> On Sunday, September 6, 2020, Mariusz Zaborski  wrote:
> > New Revision: 365378
> > URL: https://svnweb.freebsd.org/changeset/base/365378
> >
> > Log:
> >   traceroute6: capsicumize it
> >
> > ...
> > @@ -13,6 +13,10 @@
> >  # A PARTICULAR PURPOSE.
> >  # $FreeBSD$
> >
> > +.include 
> > +
> > +.include 
> 
> Dup

1) It's usually a good idea to read all svn-mail in your inbox before
replying to a particular commit, the problem could already be fixed;

2) Please don't overquote, i.e. do *not* include the rest of the diff
if you only wanted to comment on the first lines it.

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


Re: svn commit: r365378 - head/usr.sbin/traceroute6

2020-09-06 Thread Oliver Pinter
On Sunday, September 6, 2020, Mariusz Zaborski  wrote:

> Author: oshogbo
> Date: Sun Sep  6 14:04:02 2020
> New Revision: 365378
> URL: https://svnweb.freebsd.org/changeset/base/365378
>
> Log:
>   traceroute6: capsicumize it
>
>   Submitted by: Shubh Gupta 
>   Sponsored by: Google (GSOC 2020)
>   Differential Revision:https://reviews.freebsd.org/D25604
>
> Modified:
>   head/usr.sbin/traceroute6/Makefile
>   head/usr.sbin/traceroute6/traceroute6.c
>
> Modified: head/usr.sbin/traceroute6/Makefile
> 
> ==
> --- head/usr.sbin/traceroute6/Makefile  Sun Sep  6 11:29:06 2020
> (r365377)
> +++ head/usr.sbin/traceroute6/Makefile  Sun Sep  6 14:04:02 2020
> (r365378)
> @@ -13,6 +13,10 @@
>  # A PARTICULAR PURPOSE.
>  # $FreeBSD$
>
> +.include 
> +
> +.include 


Dup


> +
>  TRACEROUTE_DISTDIR?= ${SRCTOP}/contrib/traceroute
>  .PATH: ${TRACEROUTE_DISTDIR}
>
> @@ -26,7 +30,13 @@ BINMODE= 4555
>  CFLAGS+= -DIPSEC -DHAVE_POLL
>  CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
>
> -LIBADD=ipsec
> +.if ${MK_CASPER} != "no"
> +LIBADD+=   casper
> +LIBADD+=   cap_dns
> +CFLAGS+=   -DWITH_CASPER
> +.endif
> +
> +LIBADD+=   ipsec
>
>  .include 
>
>
> Modified: head/usr.sbin/traceroute6/traceroute6.c
> 
> ==
> --- head/usr.sbin/traceroute6/traceroute6.c Sun Sep  6 11:29:06 2020
>   (r365377)
> +++ head/usr.sbin/traceroute6/traceroute6.c Sun Sep  6 14:04:02 2020
>   (r365378)
> @@ -249,6 +249,7 @@ static const char rcsid[] =
>   */
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -260,6 +261,10 @@ static const char rcsid[] =
>
>  #include 
>
> +#include 
> +#include 
> +#include 
> +
>  #include 
>  #include 
>  #include 
> @@ -289,11 +294,6 @@ static const char rcsid[] =
>
>  #defineMAXPACKET   65535   /* max ip packet size */
>
> -#ifndef HAVE_GETIPNODEBYNAME
> -#define getipnodebyname(x, y, z, u)gethostbyname2((x), (y))
> -#define freehostent(x)
> -#endif
> -
>  static u_char  packet[512];/* last inbound (icmp) packet */
>  static char*outpacket; /* last output packet */
>
> @@ -304,6 +304,7 @@ int setpolicy(int so, char *policy);
>  #endif
>  void   send_probe(int, u_long);
>  void   *get_uphdr(struct ip6_hdr *, u_char *);
> +void   capdns_open(void);
>  intget_hoplim(struct msghdr *);
>  double deltaT(struct timeval *, struct timeval *);
>  const char *pr_type(int);
> @@ -312,6 +313,8 @@ voidprint(struct msghdr *, int);
>  const char *inetname(struct sockaddr *);
>  u_int32_t sctp_crc32c(void *, u_int32_t);
>  u_int16_t in_cksum(u_int16_t *addr, int);
> +u_int16_t udp_cksum(struct sockaddr_in6 *, struct sockaddr_in6 *,
> +void *, u_int32_t);
>  u_int16_t tcp_chksum(struct sockaddr_in6 *, struct sockaddr_in6 *,
>  void *, u_int32_t);
>  void   usage(void);
> @@ -335,6 +338,8 @@ static struct cmsghdr *cmsg;
>  static char *source = NULL;
>  static char *hostname;
>
> +static cap_channel_t *capdns;
> +
>  static u_long nprobes = 3;
>  static u_long first_hop = 1;
>  static u_long max_hops = 30;
> @@ -368,7 +373,10 @@ main(int argc, char *argv[])
> char ipsec_inpolicy[] = "in bypass";
> char ipsec_outpolicy[] = "out bypass";
>  #endif
> +   cap_rights_t rights;
>
> +   capdns_open();
> +
> /*
>  * Receive ICMP
>  */
> @@ -429,6 +437,7 @@ main(int argc, char *argv[])
> }
> break;
> case 'g':
> +   /* XXX use after capability mode is entered */
> hp = getipnodebyname(optarg, AF_INET6, 0,
> &h_errno);
> if (hp == NULL) {
> fprintf(stderr,
> @@ -560,8 +569,8 @@ main(int argc, char *argv[])
> sndsock = rcvsock;
> break;
> case IPPROTO_UDP:
> -   if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
> -   perror("socket(SOCK_DGRAM)");
> +   if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_UDP)) <
> 0) {
> +   perror("socket(SOCK_RAW)");
> exit(5);
> }
> break;
> @@ -606,7 +615,9 @@ main(int argc, char *argv[])
> hints.ai_socktype = SOCK_RAW;
> hints.ai_protocol = IPPROTO_ICMPV6;
> hints.ai_flags = AI_CANONNAME;
> -   error = getaddrinfo(*argv, NULL, &hints, &res);
> +
> +   error = cap_getaddrinfo(capdns, *argv, NULL, &hints, &res);
> +
> if (error) {
> fprintf(stderr,
> "traceroute6: %s\n", gai_strerror(error));
> @@ -624,7 +635,7 @@ main(int argc, char *argv[])
> exit(1);
> }
> if (res->ai_next) {
> -   if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
> 

svn commit: r365386 - stable/12/sys/dev/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  6 18:27:36 2020
New Revision: 365386
URL: https://svnweb.freebsd.org/changeset/base/365386

Log:
  MFC r353843 by glebius:
  
  Convert to if_foreach_llmaddr() KPI.

Modified:
  stable/12/sys/dev/dwc/if_dwc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/dwc/if_dwc.c
==
--- stable/12/sys/dev/dwc/if_dwc.c  Sun Sep  6 18:25:50 2020
(r365385)
+++ stable/12/sys/dev/dwc/if_dwc.c  Sun Sep  6 18:27:36 2020
(r365386)
@@ -581,13 +581,37 @@ bitreverse(uint8_t x)
return (nibbletab[x & 0xf] << 4) | nibbletab[x >> 4];
 }
 
+struct dwc_hash_maddr_ctx {
+   struct dwc_softc *sc;
+   uint32_t hash[8];
+};
+
+static u_int
+dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+   struct dwc_hash_maddr_ctx *ctx = arg;
+   uint32_t crc, hashbit, hashreg;
+   uint8_t val;
+
+   crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN);
+   /* Take lower 8 bits and reverse it */
+   val = bitreverse(~crc & 0xff);
+   if (ctx->sc->mactype == DWC_GMAC_ALT_DESC)
+   val >>= 2; /* Only need lower 6 bits */
+   hashreg = (val >> 5);
+   hashbit = (val & 31);
+   ctx->hash[hashreg] |= (1 << hashbit);
+
+   return (1);
+}
+
 static void
 dwc_setup_rxfilter(struct dwc_softc *sc)
 {
-   struct ifmultiaddr *ifma;
+   struct dwc_hash_maddr_ctx ctx;
struct ifnet *ifp;
-   uint8_t *eaddr, val;
-   uint32_t crc, ffval, hashbit, hashreg, hi, lo, hash[8];
+   uint8_t *eaddr;
+   uint32_t ffval, hi, lo;
int nhash, i;
 
DWC_ASSERT_LOCKED(sc);
@@ -601,27 +625,13 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
if ((ifp->if_flags & IFF_ALLMULTI) != 0) {
ffval = (FRAME_FILTER_PM);
for (i = 0; i < nhash; i++)
-   hash[i] = ~0;
+   ctx.hash[i] = ~0;
} else {
ffval = (FRAME_FILTER_HMC);
for (i = 0; i < nhash; i++)
-   hash[i] = 0;
-   if_maddr_rlock(ifp);
-   CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
-   if (ifma->ifma_addr->sa_family != AF_LINK)
-   continue;
-   crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
-   ifma->ifma_addr), ETHER_ADDR_LEN);
-
-   /* Take lower 8 bits and reverse it */
-   val = bitreverse(~crc & 0xff);
-   if (sc->mactype == DWC_GMAC_ALT_DESC)
-   val >>= nhash; /* Only need lower 6 bits */
-   hashreg = (val >> 5);
-   hashbit = (val & 31);
-   hash[hashreg] |= (1 << hashbit);
-   }
-   if_maddr_runlock(ifp);
+   ctx.hash[i] = 0;
+   ctx.sc = sc;
+   if_foreach_llmaddr(ifp, dwc_hash_maddr, &ctx);
}
 
/*
@@ -641,11 +651,11 @@ dwc_setup_rxfilter(struct dwc_softc *sc)
WRITE4(sc, MAC_ADDRESS_HIGH(0), hi);
WRITE4(sc, MAC_FRAME_FILTER, ffval);
if (sc->mactype == DWC_GMAC_ALT_DESC) {
-   WRITE4(sc, GMAC_MAC_HTLOW, hash[0]);
-   WRITE4(sc, GMAC_MAC_HTHIGH, hash[1]);
+   WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]);
+   WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]);
} else {
for (i = 0; i < nhash; i++)
-   WRITE4(sc, HASH_TABLE_REG(i), hash[i]);
+   WRITE4(sc, HASH_TABLE_REG(i), ctx.hash[i]);
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365385 - in stable/12/sys: arm64/conf conf dev/altera/dwc

2020-09-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  6 18:25:50 2020
New Revision: 365385
URL: https://svnweb.freebsd.org/changeset/base/365385

Log:
  MFC r350418 by br:
  
  Add glue driver for Altera SOCFPGA Ethernet MAC (EMAC) found in
  Terasic DE10-Pro (an Intel Stratix 10 GX/SX FPGA Development Kit).
  
  The Altera EMAC is an instance of Synopsys DesignWare Gigabit MAC.
  
  This driver sets correct clock range for MDIO interface on Intel Stratix 10
  platform.
  
  This is required due to lack of support for clock manager device for
  this platform that could tell us the clock frequency value for ethernet
  clock domain.
  
  Sponsored by: DARPA, AFRL

Added:
  stable/12/sys/dev/altera/dwc/
 - copied from r350418, head/sys/dev/altera/dwc/
Modified:
  stable/12/sys/arm64/conf/GENERIC
  stable/12/sys/conf/files.arm64
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/conf/GENERIC
==
--- stable/12/sys/arm64/conf/GENERICSun Sep  6 18:20:25 2020
(r365384)
+++ stable/12/sys/arm64/conf/GENERICSun Sep  6 18:25:50 2020
(r365385)
@@ -146,6 +146,7 @@ device  smc # SMSC LAN91C111
 device vnic# Cavium ThunderX NIC
 device al_eth  # Annapurna Alpine Ethernet NIC
 device dwc_rk  # Rockchip Designware
+device dwc_socfpga # Altera SOCFPGA Ethernet MAC
 
 # Block devices
 device ahci

Modified: stable/12/sys/conf/files.arm64
==
--- stable/12/sys/conf/files.arm64  Sun Sep  6 18:20:25 2020
(r365384)
+++ stable/12/sys/conf/files.arm64  Sun Sep  6 18:25:50 2020
(r365385)
@@ -214,6 +214,7 @@ dev/acpica/acpi_pci_link.c  optionalacpi pci
 dev/acpica/acpi_pcib.c optionalacpi pci
 dev/acpica/acpi_pxm.c  optionalacpi
 dev/ahci/ahci_generic.coptionalahci
+dev/altera/dwc/if_dwc_socfpga.coptionalfdt dwc_socfpga
 dev/axgbe/if_axgbe.c   optionalaxgbe
 dev/axgbe/xgbe-desc.c  optionalaxgbe
 dev/axgbe/xgbe-dev.c   optionalaxgbe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365384 - stable/12/sys/net

2020-09-06 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Sep  6 18:20:25 2020
New Revision: 365384
URL: https://svnweb.freebsd.org/changeset/base/365384

Log:
  MFC r353419:
  
  Provide new KPI for network drivers to access lists of interface
  addresses.  The KPI doesn't reveal neither how addresses are stored,
  how the access to them is synchronized, neither reveal struct ifaddr
  and struct ifmaddr.
  
  Reviewed by:  gallatin, erj, hselasky, philip, stevek
  Differential Revision:https://reviews.freebsd.org/D21943

Modified:
  stable/12/sys/net/if.c
  stable/12/sys/net/if_var.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if.c
==
--- stable/12/sys/net/if.c  Sun Sep  6 17:40:35 2020(r365383)
+++ stable/12/sys/net/if.c  Sun Sep  6 18:20:25 2020(r365384)
@@ -4313,6 +4313,53 @@ if_getmtu_family(if_t ifp, int family)
return (((struct ifnet *)ifp)->if_mtu);
 }
 
+/*
+ * Methods for drivers to access interface unicast and multicast
+ * link level addresses.  Driver shall not know 'struct ifaddr' neither
+ * 'struct ifmultiaddr'.
+ */
+u_int
+if_foreach_lladdr(if_t ifp, iflladdr_cb_t cb, void *cb_arg)
+{
+   struct ifaddr *ifa;
+   u_int count;
+
+   MPASS(cb);
+
+   count = 0;
+   IF_ADDR_RLOCK(ifp);
+   CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+   if (ifa->ifa_addr->sa_family != AF_LINK)
+   continue;
+   count += (*cb)(cb_arg, (struct sockaddr_dl *)ifa->ifa_addr,
+   count);
+   }
+   IF_ADDR_RUNLOCK(ifp);
+
+   return (count);
+}
+
+u_int
+if_foreach_llmaddr(if_t ifp, iflladdr_cb_t cb, void *cb_arg)
+{
+   struct ifmultiaddr *ifma;
+   u_int count;
+
+   MPASS(cb);
+
+   count = 0;
+   IF_ADDR_RLOCK(ifp);
+   CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+   if (ifma->ifma_addr->sa_family != AF_LINK)
+   continue;
+   count += (*cb)(cb_arg, (struct sockaddr_dl *)ifma->ifma_addr,
+   count);
+   }
+   IF_ADDR_RUNLOCK(ifp);
+
+   return (count);
+}
+
 int
 if_setsoftc(if_t ifp, void *softc)
 {

Modified: stable/12/sys/net/if_var.h
==
--- stable/12/sys/net/if_var.h  Sun Sep  6 17:40:35 2020(r365383)
+++ stable/12/sys/net/if_var.h  Sun Sep  6 18:20:25 2020(r365384)
@@ -735,11 +735,20 @@ void if_bpfmtap(if_t ifp, struct mbuf *m);
 void if_etherbpfmtap(if_t ifp, struct mbuf *m);
 void if_vlancap(if_t ifp);
 
-int if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max);
-int if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max);
+/*
+ * Traversing through interface address lists.
+ */
+struct sockaddr_dl;
+typedef u_int iflladdr_cb_t(void *, struct sockaddr_dl *, u_int);
+u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *);
+u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *);
 int if_multiaddr_count(if_t ifp, int max);
 
+/* Obsoleted multicast management functions. */
+int if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max);
+int if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max);
 int if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr 
*, int), void *arg);
+
 int if_getamcount(if_t ifp);
 struct ifaddr * if_getifaddr(if_t ifp);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365383 - in stable/12: share/man/man9 sys/compat/linuxkpi/common/include/linux sys/kern sys/sys sys/vm

2020-09-06 Thread Vladimir Kondratyev
Author: wulf
Date: Sun Sep  6 17:40:35 2020
New Revision: 365383
URL: https://svnweb.freebsd.org/changeset/base/365383

Log:
  MFC r364964: LinuxKPI: Implement ksize() function.
  
  In Linux, ksize() gets the actual amount of memory allocated for a given
  object. This commit adds malloc_usable_size() to FreeBSD KPI which does
  the same. It also maps LinuxKPI ksize() to newly created function.
  
  ksize() function is used by drm-kmod.
  
  Reviewed by:  hselasky, kib
  Differential Revision:https://reviews.freebsd.org/D26215

Modified:
  stable/12/share/man/man9/malloc.9
  stable/12/sys/compat/linuxkpi/common/include/linux/slab.h
  stable/12/sys/kern/kern_malloc.c
  stable/12/sys/sys/malloc.h
  stable/12/sys/vm/memguard.c
  stable/12/sys/vm/memguard.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man9/malloc.9
==
--- stable/12/share/man/man9/malloc.9   Sun Sep  6 15:44:09 2020
(r365382)
+++ stable/12/share/man/man9/malloc.9   Sun Sep  6 17:40:35 2020
(r365383)
@@ -29,7 +29,7 @@
 .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
 .\" $FreeBSD$
 .\"
-.Dd October 30, 2018
+.Dd August 28, 2020
 .Dt MALLOC 9
 .Os
 .Sh NAME
@@ -53,6 +53,8 @@
 .Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags"
 .Ft void *
 .Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags"
+.Ft size_t
+.Fn malloc_usable_size "const void *addr"
 .Fn MALLOC_DECLARE type
 .In sys/param.h
 .In sys/malloc.h
@@ -138,6 +140,13 @@ function is identical to
 .Fn realloc
 except that it
 will free the passed pointer when the requested memory cannot be allocated.
+.Pp
+The
+.Fn malloc_usable_size
+function returns the usable size of the allocation pointed to by
+.Fa addr .
+The return value may be larger than the size that was requested during
+allocation.
 .Pp
 Unlike its standard C library counterpart
 .Pq Xr malloc 3 ,

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/slab.h   Sun Sep  6 
15:44:09 2020(r365382)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/slab.h   Sun Sep  6 
17:40:35 2020(r365383)
@@ -154,6 +154,12 @@ kfree(const void *ptr)
free(__DECONST(void *, ptr), M_KMALLOC);
 }
 
+static inline size_t
+ksize(const void *ptr)
+{
+   return (malloc_usable_size(ptr));
+}
+
 extern struct linux_kmem_cache *linux_kmem_cache_create(const char *name,
 size_t size, size_t align, unsigned flags, linux_kmem_ctor_t *ctor);
 

Modified: stable/12/sys/kern/kern_malloc.c
==
--- stable/12/sys/kern/kern_malloc.cSun Sep  6 15:44:09 2020
(r365382)
+++ stable/12/sys/kern/kern_malloc.cSun Sep  6 17:40:35 2020
(r365383)
@@ -867,6 +867,41 @@ reallocf(void *addr, size_t size, struct malloc_type *
return (mem);
 }
 
+/*
+ * malloc_usable_size: returns the usable size of the allocation.
+ */
+size_t
+malloc_usable_size(const void *addr)
+{
+#ifndef DEBUG_REDZONE
+   uma_slab_t slab;
+#endif
+   u_long size;
+
+   if (addr == NULL)
+   return (0);
+
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(__DECONST(void *, addr)))
+   return (memguard_get_req_size(addr));
+#endif
+
+#ifdef DEBUG_REDZONE
+   size = redzone_get_size(__DECONST(void *, addr));
+#else
+   slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK));
+   if (slab == NULL)
+   panic("malloc_usable_size: address %p(%p) is not allocated.\n",
+   addr, (void *)((u_long)addr & (~UMA_SLAB_MASK)));
+
+   if (!(slab->us_flags & UMA_SLAB_MALLOC))
+   size = slab->us_keg->uk_size;
+   else
+   size = slab->us_size;
+#endif
+   return (size);
+}
+
 #ifndef __sparc64__
 CTASSERT(VM_KMEM_SIZE_SCALE >= 1);
 #endif

Modified: stable/12/sys/sys/malloc.h
==
--- stable/12/sys/sys/malloc.h  Sun Sep  6 15:44:09 2020(r365382)
+++ stable/12/sys/sys/malloc.h  Sun Sep  6 17:40:35 2020(r365383)
@@ -244,6 +244,7 @@ voidmalloc_type_allocated(struct malloc_type *type, 
u
 void   malloc_type_freed(struct malloc_type *type, unsigned long size);
 void   malloc_type_list(malloc_type_list_func_t *, void *);
 void   malloc_uninit(void *);
+size_t malloc_usable_size(const void *);
 void   *realloc(void *addr, size_t size, struct malloc_type *type, int flags)
__result_use_check __alloc_size(2);
 void   *reallocf(void *addr, size_t size, struct malloc_type *type, int flags)

Modified: stable/12/sys/vm/memguard.c
==
--- stable/12/sys/vm/memguard.c S

svn commit: r365382 - head/usr.sbin/traceroute6

2020-09-06 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Sep  6 15:44:09 2020
New Revision: 365382
URL: https://svnweb.freebsd.org/changeset/base/365382

Log:
  Remove duplicated line.
  
  Reported by:  lwhsu

Modified:
  head/usr.sbin/traceroute6/Makefile

Modified: head/usr.sbin/traceroute6/Makefile
==
--- head/usr.sbin/traceroute6/Makefile  Sun Sep  6 14:41:35 2020
(r365381)
+++ head/usr.sbin/traceroute6/Makefile  Sun Sep  6 15:44:09 2020
(r365382)
@@ -15,8 +15,6 @@
 
 .include 
 
-.include 
-
 TRACEROUTE_DISTDIR?= ${SRCTOP}/contrib/traceroute
 .PATH: ${TRACEROUTE_DISTDIR}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365381 - in stable/12/sys: contrib/ena-com contrib/ena-com/ena_defs dev/ena

2020-09-06 Thread Marcin Wojtas
Author: mw
Date: Sun Sep  6 14:41:35 2020
New Revision: 365381
URL: https://svnweb.freebsd.org/changeset/base/365381

Log:
  MFC: Merge ENA v2.2.0 driver
  
  r361530 Update ENA driver version to v2.2.0
  r361529 Refactor ena_tx_map_mbuf() function
  r361528 Fix double-free bug within ena_detach()
  r361527 Allow disabling meta caching for ENA Tx path
  r361526 Create ENA IO queues with optional backoff
  r361525 Add sysctl node for ENA IO queues number adjustment
  r361524 Fix assumptions about number of IO queues in the ENA
  r361523 Rework ENA Tx buffer ring size reconfiguration
  r361521 Rework ENA Rx queue size configuration
  r361518 Improve indentation in ena_up() and ena_down()
  r361517 Expose argument names for non static ENA driver functions
  r361516 Use single global lock in the ENA driver
  r361515 Add trigger reset function in the ENA driver
  r361514 Provide ENA driver version in a sysctl node
  r361513 Remove unused argument from static function in ena.c
  r361512 Enable Tx drops reporting in the ENA driver
  r361511 Adjust ENA driver to the new HAL
  r358289 Rework and simplify Tx DMA mapping in ENA
  
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  stable/12/sys/contrib/ena-com/ena_com.c
  stable/12/sys/contrib/ena-com/ena_com.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_admin_defs.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_common_defs.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_eth_io_defs.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_gen_info.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_regs_defs.h
  stable/12/sys/contrib/ena-com/ena_eth_com.c
  stable/12/sys/contrib/ena-com/ena_eth_com.h
  stable/12/sys/contrib/ena-com/ena_plat.h
  stable/12/sys/dev/ena/ena.c
  stable/12/sys/dev/ena/ena.h
  stable/12/sys/dev/ena/ena_datapath.c
  stable/12/sys/dev/ena/ena_datapath.h
  stable/12/sys/dev/ena/ena_netmap.c
  stable/12/sys/dev/ena/ena_netmap.h
  stable/12/sys/dev/ena/ena_sysctl.c
  stable/12/sys/dev/ena/ena_sysctl.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/contrib/ena-com/ena_com.c
==
--- stable/12/sys/contrib/ena-com/ena_com.c Sun Sep  6 14:23:31 2020
(r365380)
+++ stable/12/sys/contrib/ena-com/ena_com.c Sun Sep  6 14:41:35 2020
(r365381)
@@ -1,7 +1,7 @@
 /*-
  * BSD LICENSE
  *
- * Copyright (c) 2015-2019 Amazon.com, Inc. or its affiliates.
+ * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -70,8 +70,10 @@
 
 #define ENA_REGS_ADMIN_INTR_MASK 1
 
-#define ENA_POLL_MS5
+#define ENA_MIN_POLL_US 100
 
+#define ENA_MAX_POLL_US 5000
+
 /*/
 /*/
 /*/
@@ -99,7 +101,7 @@ struct ena_com_stats_ctx {
struct ena_admin_acq_get_stats_resp get_resp;
 };
 
-static inline int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
+static int ena_com_mem_addr_set(struct ena_com_dev *ena_dev,
   struct ena_common_mem_addr *ena_addr,
   dma_addr_t addr)
 {
@@ -200,7 +202,7 @@ static int ena_com_admin_init_aenq(struct ena_com_dev 
return 0;
 }
 
-static inline void comp_ctxt_release(struct ena_com_admin_queue *queue,
+static void comp_ctxt_release(struct ena_com_admin_queue *queue,
 struct ena_comp_ctx *comp_ctx)
 {
comp_ctx->occupied = false;
@@ -216,6 +218,11 @@ static struct ena_comp_ctx *get_comp_ctxt(struct ena_c
return NULL;
}
 
+   if (unlikely(!queue->comp_ctx)) {
+   ena_trc_err("Completion context is NULL\n");
+   return NULL;
+   }
+
if (unlikely(queue->comp_ctx[command_id].occupied && capture)) {
ena_trc_err("Completion context is occupied\n");
return NULL;
@@ -289,7 +296,7 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd
return comp_ctx;
 }
 
-static inline int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
+static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *queue)
 {
size_t size = queue->q_depth * sizeof(struct ena_comp_ctx);
struct ena_comp_ctx *comp_ctx;
@@ -409,6 +416,8 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_
   0x0, io_sq->llq_info.desc_list_entry_size);
io_sq->llq_buf_ctrl.descs_left_in_line =
io_sq->llq_info.descs_num_before_header;
+   io_sq->disable_meta_caching =
+   io_sq->llq_info.disable_meta_caching;
 
if (io_sq->llq_info.max_entries_in_tx_burst > 0)
io_sq

svn commit: r365380 - in stable/12/sys: conf contrib/ena-com dev/ena modules/ena

2020-09-06 Thread Marcin Wojtas
Author: mw
Date: Sun Sep  6 14:23:31 2020
New Revision: 365380
URL: https://svnweb.freebsd.org/changeset/base/365380

Log:
  MFC: ENA netmap support and bug fixes
  
  r363638 Fix ENA build when integrated into kernel
  r354242 Make valdiate_rx_req_id static inline because it uses other static
  r354225 Update ENA version to v2.1.0
  r354224 Add support for ENA NETMAP partial initialization
  r354223 Add support for ENA NETMAP Tx
  r354222 Add support for ENA NETMAP Rx
  r354221 Introduce NETMAP support in ENA
  r354220 Split Rx/Tx from initialization code in ENA driver
  r354219 Fix ENA keep-alive timeout due to prolonged reset
  r354218 Add WC support for arm64 in the ENA driver
  
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Added:
  stable/12/sys/dev/ena/ena_datapath.c
 - copied, changed from r354225, head/sys/dev/ena/ena_datapath.c
  stable/12/sys/dev/ena/ena_datapath.h
 - copied unchanged from r354225, head/sys/dev/ena/ena_datapath.h
  stable/12/sys/dev/ena/ena_netmap.c
 - copied unchanged from r354225, head/sys/dev/ena/ena_netmap.c
  stable/12/sys/dev/ena/ena_netmap.h
 - copied unchanged from r354225, head/sys/dev/ena/ena_netmap.h
Modified:
  stable/12/sys/conf/files
  stable/12/sys/contrib/ena-com/ena_plat.h
  stable/12/sys/dev/ena/ena.c
  stable/12/sys/dev/ena/ena.h
  stable/12/sys/modules/ena/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesSun Sep  6 14:13:51 2020(r365379)
+++ stable/12/sys/conf/filesSun Sep  6 14:23:31 2020(r365380)
@@ -1707,6 +1707,10 @@ dev/e1000/e1000_osdep.c  optional em \
 dev/et/if_et.c optional et
 dev/ena/ena.c  optional ena \
compile-with "${NORMAL_C} -I$S/contrib"
+dev/ena/ena_datapath.c optional ena \
+   compile-with "${NORMAL_C} -I$S/contrib"
+dev/ena/ena_netmap.c   optional ena \
+   compile-with "${NORMAL_C} -I$S/contrib"
 dev/ena/ena_sysctl.c   optional ena \
compile-with "${NORMAL_C} -I$S/contrib"
 contrib/ena-com/ena_com.c  optional ena

Modified: stable/12/sys/contrib/ena-com/ena_plat.h
==
--- stable/12/sys/contrib/ena-com/ena_plat.hSun Sep  6 14:13:51 2020
(r365379)
+++ stable/12/sys/contrib/ena-com/ena_plat.hSun Sep  6 14:23:31 2020
(r365380)
@@ -103,6 +103,7 @@ extern struct ena_bus_space ebs;
 #define ENA_RSC(1 << 6) /* Goes with TXPTH or RXPTH, free/alloc res. */
 #define ENA_IOQ(1 << 7) /* Detailed info about IO queues.*/
 #define ENA_ADMQ   (1 << 8) /* Detailed info about admin queue.  */
+#define ENA_NETMAP (1 << 9) /* Detailed info about netmap.   */
 
 extern int ena_log_level;
 

Modified: stable/12/sys/dev/ena/ena.c
==
--- stable/12/sys/dev/ena/ena.c Sun Sep  6 14:13:51 2020(r365379)
+++ stable/12/sys/dev/ena/ena.c Sun Sep  6 14:23:31 2020(r365380)
@@ -81,9 +81,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include "ena_datapath.h"
 #include "ena.h"
 #include "ena_sysctl.h"
 
+#ifdef DEV_NETMAP
+#include "ena_netmap.h"
+#endif /* DEV_NETMAP */
+
 /*
  *  Function prototypes
  */
@@ -103,11 +108,11 @@ static intena_setup_tx_dma_tag(struct ena_adapter 
*);
 static int ena_free_tx_dma_tag(struct ena_adapter *);
 static int ena_setup_rx_dma_tag(struct ena_adapter *);
 static int ena_free_rx_dma_tag(struct ena_adapter *);
+static voidena_release_all_tx_dmamap(struct ena_ring *);
 static int ena_setup_tx_resources(struct ena_adapter *, int);
 static voidena_free_tx_resources(struct ena_adapter *, int);
 static int ena_setup_all_tx_resources(struct ena_adapter *);
 static voidena_free_all_tx_resources(struct ena_adapter *);
-static inline int validate_rx_req_id(struct ena_ring *, uint16_t);
 static int ena_setup_rx_resources(struct ena_adapter *, unsigned int);
 static voidena_free_rx_resources(struct ena_adapter *, unsigned int);
 static int ena_setup_all_rx_resources(struct ena_adapter *);
@@ -116,7 +121,6 @@ static inline int ena_alloc_rx_mbuf(struct ena_adapter
 struct ena_rx_buffer *);
 static voidena_free_rx_mbuf(struct ena_adapter *, struct ena_ring *,
 struct ena_rx_buffer *);
-static int ena_refill_rx_bufs(struct ena_ring *, uint32_t);
 static voidena_free_rx_bufs(struct ena_adapter *, unsigned int);
 static voidena_refill_all_rx_bufs(struct ena_adapter *);
 static voidena_free_all_rx_bufs(struct ena_adapter *);
@@ -126,16 +130,6 @@ static voidena_destroy_all_tx_queues(struct 
ena_adapt
 static voide

svn commit: r365379 - in stable/12: share/man/man4 sys/contrib/ena-com sys/contrib/ena-com/ena_defs sys/dev/ena sys/modules/ena

2020-09-06 Thread Marcin Wojtas
Author: mw
Date: Sun Sep  6 14:13:51 2020
New Revision: 365379
URL: https://svnweb.freebsd.org/changeset/base/365379

Log:
  MFC: Merge ENA v2.0.0 driver
  
  r348416 Update ENA version to v2.0.0
  r348414 Fix ENA manual issues
  r348413 Improve ENA reset handling
  r348412 Fix NULL pointer dereference in ena_up()
  r348411 Unify new line characters in the ENA driver
  r348410 Fix Tx offloads for fragmented pkt headers in ENA
  r348409 Split ENA reset routine into restore and destroy stages
  r348408 Use bitfield for storing global ENA device states
  r348407 Fix error handling when ENA reset fails
  r348406 Fill bdf field of the host_info structure in ENA
  r348405 Add additional doorbells on ENA Tx path
  r348404 Limit maximum size of Rx refill threshold in ENA
  r348403 Add support for the LLQv2 and WC in ENA
  r348402 Lock optimization in ENA
  r348401 Add tuneable drbr ring size and hw queues depth for ENA
  r348400 Fix error in validate_tx_req_id() in ENA
  r348399 Change attach order to prevent crash upon failure in ENA
  r348398 Change order of ifp release on ENA detach
  r348397 Check for number of MSI-x upon partial allocation in ENA
  r348396 Set error value when allocation of IO irq fails in ENA
  r348395 Set vaddr and paddr as NULL when DMA alloc fails in ENA
  r348394 Fix DMA synchronization in the ENA driver Tx and Rx paths
  r348393 Check for missing MSI-x and Tx completions in ENA
  r348392 Fill number of CPUs field on ENA host_info structure
  r348391 Print ENA Tx error conditionally
  r348390 Trigger reset in ENA if there are too many Rx descriptors
  r348389 Remove RSS support in ENA
  r348388 Add notification AENQ handler for ENA
  r348387 Print information when ENA admin error occurs
  r348386 Do not specify active media type in ENA
  r348385 Adjust ENA driver to the new ena-com
  
  Obtained from: Semihalf
  Sponsored by:  Amazon, Inc.

Modified:
  stable/12/share/man/man4/ena.4
  stable/12/sys/contrib/ena-com/ena_com.c
  stable/12/sys/contrib/ena-com/ena_com.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_admin_defs.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_common_defs.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_eth_io_defs.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_gen_info.h
  stable/12/sys/contrib/ena-com/ena_defs/ena_regs_defs.h
  stable/12/sys/contrib/ena-com/ena_eth_com.c
  stable/12/sys/contrib/ena-com/ena_eth_com.h
  stable/12/sys/contrib/ena-com/ena_plat.h
  stable/12/sys/dev/ena/ena.c
  stable/12/sys/dev/ena/ena.h
  stable/12/sys/dev/ena/ena_sysctl.c
  stable/12/sys/dev/ena/ena_sysctl.h
  stable/12/sys/modules/ena/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/ena.4
==
--- stable/12/share/man/man4/ena.4  Sun Sep  6 14:04:02 2020
(r365378)
+++ stable/12/share/man/man4/ena.4  Sun Sep  6 14:13:51 2020
(r365379)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 04, 2017
+.Dd August 16, 2017
 .Dt ENA 4
 .Os
 .Sh NAME
@@ -35,7 +35,7 @@
 .Nd "FreeBSD kernel driver for Elastic Network Adapter (ENA) family"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
-place the following line in your
+place the following line in the
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device ena"
@@ -59,8 +59,9 @@ The driver supports a range of ENA devices, is link-sp
 (i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has
 a negotiated and extendable feature set.
 .Pp
-Some ENA devices support SR-IOV. This driver is used for both the
-SR-IOV Physical Function (PF) and Virtual Function (VF) devices.
+Some ENA devices support SR-IOV.
+This driver is used for both the SR-IOV Physical Function (PF) and Virtual
+Function (VF) devices.
 .Pp
 The ENA devices enable high speed and low overhead network traffic
 processing by providing multiple Tx/Rx queue pairs (the maximum number
@@ -82,8 +83,8 @@ to recover in a manner transparent to the application,
 debug logs.
 .Pp
 Some of the ENA devices support a working mode called Low-latency
-Queue (LLQ), which saves several more microseconds. This feature will
-be implemented for driver in future releases.
+Queue (LLQ), which saves several more microseconds.
+This feature will be implemented for driver in future releases.
 .Sh HARDWARE
 Supported PCI vendor ID/device IDs:
 .Pp
@@ -105,19 +106,23 @@ Supported PCI vendor ID/device IDs:
 Error occurred during initialization of the mmio register read request.
 .It ena%d: Can not reset device
 .Pp
-Device could not be reset; device may not be responding or is already
-during reset.
+Device could not be reset.
+.br
+Device may not be responding or is already during reset.
 .It ena%d: device version is too low
 .Pp
-Version of the controller is too low and it is not supported by the driver.
+Version of the controller is too old and it is not supported by the driver.
 .It ena%d: Invalid dma width value %d
 .Pp
-The control

svn commit: r365378 - head/usr.sbin/traceroute6

2020-09-06 Thread Mariusz Zaborski
Author: oshogbo
Date: Sun Sep  6 14:04:02 2020
New Revision: 365378
URL: https://svnweb.freebsd.org/changeset/base/365378

Log:
  traceroute6: capsicumize it
  
  Submitted by: Shubh Gupta 
  Sponsored by: Google (GSOC 2020)
  Differential Revision:https://reviews.freebsd.org/D25604

Modified:
  head/usr.sbin/traceroute6/Makefile
  head/usr.sbin/traceroute6/traceroute6.c

Modified: head/usr.sbin/traceroute6/Makefile
==
--- head/usr.sbin/traceroute6/Makefile  Sun Sep  6 11:29:06 2020
(r365377)
+++ head/usr.sbin/traceroute6/Makefile  Sun Sep  6 14:04:02 2020
(r365378)
@@ -13,6 +13,10 @@
 # A PARTICULAR PURPOSE.
 # $FreeBSD$
 
+.include 
+
+.include 
+
 TRACEROUTE_DISTDIR?= ${SRCTOP}/contrib/traceroute
 .PATH: ${TRACEROUTE_DISTDIR}
 
@@ -26,7 +30,13 @@ BINMODE= 4555
 CFLAGS+= -DIPSEC -DHAVE_POLL
 CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
 
-LIBADD=ipsec
+.if ${MK_CASPER} != "no"
+LIBADD+=   casper
+LIBADD+=   cap_dns
+CFLAGS+=   -DWITH_CASPER
+.endif
+
+LIBADD+=   ipsec
 
 .include 
 

Modified: head/usr.sbin/traceroute6/traceroute6.c
==
--- head/usr.sbin/traceroute6/traceroute6.c Sun Sep  6 11:29:06 2020
(r365377)
+++ head/usr.sbin/traceroute6/traceroute6.c Sun Sep  6 14:04:02 2020
(r365378)
@@ -249,6 +249,7 @@ static const char rcsid[] =
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -260,6 +261,10 @@ static const char rcsid[] =
 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -289,11 +294,6 @@ static const char rcsid[] =
 
 #defineMAXPACKET   65535   /* max ip packet size */
 
-#ifndef HAVE_GETIPNODEBYNAME
-#define getipnodebyname(x, y, z, u)gethostbyname2((x), (y))
-#define freehostent(x)
-#endif
-
 static u_char  packet[512];/* last inbound (icmp) packet */
 static char*outpacket; /* last output packet */
 
@@ -304,6 +304,7 @@ int setpolicy(int so, char *policy);
 #endif
 void   send_probe(int, u_long);
 void   *get_uphdr(struct ip6_hdr *, u_char *);
+void   capdns_open(void);
 intget_hoplim(struct msghdr *);
 double deltaT(struct timeval *, struct timeval *);
 const char *pr_type(int);
@@ -312,6 +313,8 @@ voidprint(struct msghdr *, int);
 const char *inetname(struct sockaddr *);
 u_int32_t sctp_crc32c(void *, u_int32_t);
 u_int16_t in_cksum(u_int16_t *addr, int);
+u_int16_t udp_cksum(struct sockaddr_in6 *, struct sockaddr_in6 *,
+void *, u_int32_t);
 u_int16_t tcp_chksum(struct sockaddr_in6 *, struct sockaddr_in6 *,
 void *, u_int32_t);
 void   usage(void);
@@ -335,6 +338,8 @@ static struct cmsghdr *cmsg;
 static char *source = NULL;
 static char *hostname;
 
+static cap_channel_t *capdns;
+
 static u_long nprobes = 3;
 static u_long first_hop = 1;
 static u_long max_hops = 30;
@@ -368,7 +373,10 @@ main(int argc, char *argv[])
char ipsec_inpolicy[] = "in bypass";
char ipsec_outpolicy[] = "out bypass";
 #endif
+   cap_rights_t rights;
 
+   capdns_open();
+
/*
 * Receive ICMP
 */
@@ -429,6 +437,7 @@ main(int argc, char *argv[])
}
break;
case 'g':
+   /* XXX use after capability mode is entered */
hp = getipnodebyname(optarg, AF_INET6, 0, &h_errno);
if (hp == NULL) {
fprintf(stderr,
@@ -560,8 +569,8 @@ main(int argc, char *argv[])
sndsock = rcvsock;
break;
case IPPROTO_UDP:
-   if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
-   perror("socket(SOCK_DGRAM)");
+   if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_UDP)) < 0) {
+   perror("socket(SOCK_RAW)");
exit(5);
}
break;
@@ -606,7 +615,9 @@ main(int argc, char *argv[])
hints.ai_socktype = SOCK_RAW;
hints.ai_protocol = IPPROTO_ICMPV6;
hints.ai_flags = AI_CANONNAME;
-   error = getaddrinfo(*argv, NULL, &hints, &res);
+
+   error = cap_getaddrinfo(capdns, *argv, NULL, &hints, &res);
+
if (error) {
fprintf(stderr,
"traceroute6: %s\n", gai_strerror(error));
@@ -624,7 +635,7 @@ main(int argc, char *argv[])
exit(1);
}
if (res->ai_next) {
-   if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
+   if (cap_getnameinfo(capdns, res->ai_addr, res->ai_addrlen, hbuf,
sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "?", sizeof(hbuf));
fprintf(stderr, "traceroute6: Warning: %s has multiple "
@@ -803,7 +814,7 @@ main(int argc, char *argv[])
 

svn commit: r365377 - stable/12/sys/dev/drm2

2020-09-06 Thread Niclas Zeising
Author: zeising (doc,ports committer)
Date: Sun Sep  6 11:29:06 2020
New Revision: 365377
URL: https://svnweb.freebsd.org/changeset/base/365377

Log:
  MFC: r364737, r365264 and r365287
  
  Together, these three revisions improve the drm2 (aka legacy drm or
  drm-legacy) drivers to point towards graphics/drm-kmod where relevant, and
  to remove references to graphics/drm-legacy-kmd as that is being deprecated.
  Since part of the drm2 drivers are still used on arm, arm is currently
  excluded from the deprecation message.
  
  Approved by:  imp, manu (implicit, MFC)

Modified:
  stable/12/sys/dev/drm2/drm_os_freebsd.c
  stable/12/sys/dev/drm2/drm_os_freebsd.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/drm2/drm_os_freebsd.c
==
--- stable/12/sys/dev/drm2/drm_os_freebsd.c Sun Sep  6 11:23:58 2020
(r365376)
+++ stable/12/sys/dev/drm2/drm_os_freebsd.c Sun Sep  6 11:29:06 2020
(r365377)
@@ -126,7 +126,9 @@ drm_probe_helper(device_t kdev, const drm_pci_id_list_
device_get_nameunit(kdev), id_entry->name);
device_set_desc(kdev, id_entry->name);
}
+#if !defined(__arm__)
DRM_OBSOLETE(kdev);
+#endif
return (-BUS_PROBE_GENERIC);
}
 

Modified: stable/12/sys/dev/drm2/drm_os_freebsd.h
==
--- stable/12/sys/dev/drm2/drm_os_freebsd.h Sun Sep  6 11:23:58 2020
(r365376)
+++ stable/12/sys/dev/drm2/drm_os_freebsd.h Sun Sep  6 11:29:06 2020
(r365377)
@@ -154,19 +154,21 @@ typedef void  irqreturn_t;
*(volatile u_int64_t *)(((vm_offset_t)(map)->handle) +  \
(vm_offset_t)(offset)) = htole64(val)
 
-#ifdef amd64
-#define DRM_PORT "graphics/drm-kmod"
+#if !defined(__arm__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || 
defined(__aarch64__)
+#define DRM_MSG "This code is deprecated.  Install the graphics/drm-kmod pkg\n"
 #else
-#define DRM_PORT "graphics/drm-legacy-kmod"
+#define DRM_MSG "This code is deprecated."
 #endif
 
 #define DRM_OBSOLETE(dev)  
\
 do {   
\
device_printf(dev, 
"===\n"); \
-   device_printf(dev, "This code is obsolete abandonware. Install the " 
DRM_PORT " pkg\n"); \
+   device_printf(dev, DRM_MSG);
\
device_printf(dev, 
"===\n"); \
gone_in_dev(dev, 13, "drm2 drivers");   
\
 } while (0)
+#endif /* __arm__ */
 
 /* DRM_READMEMORYBARRIER() prevents reordering of reads.
  * DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365376 - stable/12/sys/dev/drm

2020-09-06 Thread Niclas Zeising
Author: zeising (doc,ports committer)
Date: Sun Sep  6 11:23:58 2020
New Revision: 365376
URL: https://svnweb.freebsd.org/changeset/base/365376

Log:
  drm: Update deprecation message
  
  Update the deprecation message in the drm1 (aka legacy drm or drm-legacy)
  drivers to not point towards the drm-legacy-kmod port, as that is being
  deprecated.
  
  This is a direct commit to stable/12 since the drm1 code has been removed
  from 13 already.
  
  Reviewed by:  imp
  Approved by:  imp
  Differential Revision:https://reviews.freebsd.org/D26175

Modified:
  stable/12/sys/dev/drm/drm.h

Modified: stable/12/sys/dev/drm/drm.h
==
--- stable/12/sys/dev/drm/drm.h Sun Sep  6 10:23:13 2020(r365375)
+++ stable/12/sys/dev/drm/drm.h Sun Sep  6 11:23:58 2020(r365376)
@@ -1145,12 +1145,10 @@ typedef struct drm_mm_init_arg drm_mm_init_arg_t;
 typedef enum drm_bo_type drm_bo_type_t;
 #endif
 
-#define DRM_PORT "graphics/drm-legacy-kmod"
-
 #define DRM_OBSOLETE(dev)  
\
 do {   
\
device_printf(dev, 
"===\n"); \
-   device_printf(dev, "This code is obsolete abandonware. Install the " 
DRM_PORT " pkg\n"); \
+   device_printf(dev, "This code is deprecated.\n"); \
device_printf(dev, 
"===\n"); \
gone_in_dev(dev, 13, "drm drivers");
\
 } while (0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365375 - in stable/11: share/man/man4 sys/conf sys/dev/sume sys/modules sys/modules/sume

2020-09-06 Thread Marko Zec
Author: zec
Date: Sun Sep  6 10:23:13 2020
New Revision: 365375
URL: https://svnweb.freebsd.org/changeset/base/365375

Log:
  MFC r364973:
  
  Driver for 4x10Gb Ethernet reference NIC FPGA design for NetFPGA SUME
  development board.
  
  Submitted by: Denis Salopek 
  Reviewed by:  zec, bz (src); rgrimes, bcr (manpages)
  Sponsored by: Google Summer of Code 2020
  Differential Revision: https://reviews.freebsd.org/D26074

Added:
  stable/11/share/man/man4/sume.4
 - copied unchanged from r364973, head/share/man/man4/sume.4
  stable/11/sys/dev/sume/
 - copied from r364973, head/sys/dev/sume/
  stable/11/sys/modules/sume/
 - copied from r364973, head/sys/modules/sume/
Modified:
  stable/11/share/man/man4/Makefile
  stable/11/sys/conf/files.amd64
  stable/11/sys/modules/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/Makefile
==
--- stable/11/share/man/man4/Makefile   Sun Sep  6 10:18:59 2020
(r365374)
+++ stable/11/share/man/man4/Makefile   Sun Sep  6 10:23:13 2020
(r365375)
@@ -533,6 +533,7 @@ MAN=aac.4 \
stf.4 \
stg.4 \
stge.4 \
+   ${_sume.4} \
sym.4 \
syncache.4 \
syncer.4 \
@@ -884,12 +885,14 @@ _qlxgbe.4=qlxgbe.4
 _qlnxe.4=  qlnxe.4
 _sfxge.4=  sfxge.4
 _smartpqi.4=   smartpqi.4
+_sume.4=   sume.4
 
 MLINKS+=qlxge.4 if_qlxge.4
 MLINKS+=qlxgb.4 if_qlxgb.4
 MLINKS+=qlxgbe.4 if_qlxgbe.4
 MLINKS+=qlnxe.4 if_qlnxe.4
 MLINKS+=sfxge.4 if_sfxge.4
+MLINKS+=sume.4 if_sume.4
 
 .if ${MK_BHYVE} != "no"
 _bhyve.4=  bhyve.4

Copied: stable/11/share/man/man4/sume.4 (from r364973, 
head/share/man/man4/sume.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/man/man4/sume.4 Sun Sep  6 10:23:13 2020
(r365375, copy of r364973, head/share/man/man4/sume.4)
@@ -0,0 +1,98 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+.\"
+.\" Copyright (c) 2020 Denis Salopek
+.\"
+.\" 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 OWNER 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$
+.\"
+.Dd August 30, 2020
+.Dt SUME 4
+.Os
+.Sh NAME
+.Nm sume
+.Nd "NetFPGA SUME 4x10Gb Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sume"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place
+the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sume_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for NetFPGA SUME Virtex-7 FPGA Development Board
+with the reference NIC bitstream loaded onto it.
+The HDL design for the reference NIC project uses the RIFFA based DMA
+engine to communicate with the host machine over PCIe.
+Every packet is transmitted to / from the board via a single DMA
+transaction, taking up to two or three interrupts per one transaction
+which yields low performance.
+.Pp
+There is no support for Jumbo frames as the hardware is capable of
+dealing only with frames with maximum size of 1514 bytes.
+The hardware does not support multicast filtering, provides no checksums,
+and offers no other offloading.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netgraph 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+The Linux
+.Nm
+driver was originally written by
+.An -nosplit
+.An Bjoern A. Zeeb .
+The
+.Fx version and this manual page were written by
+.An Denis Salopek
+as a GSoC project.
+More information about the project can be 

svn commit: r365374 - in stable/12: share/man/man4 sys/conf sys/dev/sume sys/modules sys/modules/sume

2020-09-06 Thread Marko Zec
Author: zec
Date: Sun Sep  6 10:18:59 2020
New Revision: 365374
URL: https://svnweb.freebsd.org/changeset/base/365374

Log:
  MFC r364973:
  
  Driver for 4x10Gb Ethernet reference NIC FPGA design for NetFPGA SUME
  development board.
  
  Submitted by: Denis Salopek 
  Reviewed by: zec, bz (src); rgrimes, bcr (manpages)
  Sponsored by: Google Summer of Code 2020
  Differential Revision: https://reviews.freebsd.org/D26074

Added:
  stable/12/share/man/man4/sume.4
 - copied unchanged from r364973, head/share/man/man4/sume.4
  stable/12/sys/dev/sume/
 - copied from r364973, head/sys/dev/sume/
  stable/12/sys/modules/sume/
 - copied from r364973, head/sys/modules/sume/
Modified:
  stable/12/share/man/man4/Makefile
  stable/12/sys/conf/files.amd64
  stable/12/sys/modules/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/Makefile
==
--- stable/12/share/man/man4/Makefile   Sun Sep  6 09:08:06 2020
(r365373)
+++ stable/12/share/man/man4/Makefile   Sun Sep  6 10:18:59 2020
(r365374)
@@ -532,6 +532,7 @@ MAN=aac.4 \
stf.4 \
stg.4 \
stge.4 \
+   ${_sume.4} \
${_superio.4} \
sym.4 \
syncache.4 \
@@ -881,12 +882,14 @@ _qlxgbe.4=qlxgbe.4
 _qlnxe.4=  qlnxe.4
 _sfxge.4=  sfxge.4
 _smartpqi.4=   smartpqi.4
+_sume.4=   sume.4
 
 MLINKS+=qlxge.4 if_qlxge.4
 MLINKS+=qlxgb.4 if_qlxgb.4
 MLINKS+=qlxgbe.4 if_qlxgbe.4
 MLINKS+=qlnxe.4 if_qlnxe.4
 MLINKS+=sfxge.4 if_sfxge.4
+MLINKS+=sume.4 if_sume.4
 
 .if ${MK_BHYVE} != "no"
 _bhyve.4=  bhyve.4

Copied: stable/12/share/man/man4/sume.4 (from r364973, 
head/share/man/man4/sume.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man4/sume.4 Sun Sep  6 10:18:59 2020
(r365374, copy of r364973, head/share/man/man4/sume.4)
@@ -0,0 +1,98 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+.\"
+.\" Copyright (c) 2020 Denis Salopek
+.\"
+.\" 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 OWNER 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$
+.\"
+.Dd August 30, 2020
+.Dt SUME 4
+.Os
+.Sh NAME
+.Nm sume
+.Nd "NetFPGA SUME 4x10Gb Ethernet driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel, place the following lines
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device sume"
+.Ed
+.Pp
+Alternatively, to load the driver as a module at boot time, place
+the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_sume_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for NetFPGA SUME Virtex-7 FPGA Development Board
+with the reference NIC bitstream loaded onto it.
+The HDL design for the reference NIC project uses the RIFFA based DMA
+engine to communicate with the host machine over PCIe.
+Every packet is transmitted to / from the board via a single DMA
+transaction, taking up to two or three interrupts per one transaction
+which yields low performance.
+.Pp
+There is no support for Jumbo frames as the hardware is capable of
+dealing only with frames with maximum size of 1514 bytes.
+The hardware does not support multicast filtering, provides no checksums,
+and offers no other offloading.
+.Sh SEE ALSO
+.Xr arp 4 ,
+.Xr netgraph 4 ,
+.Xr netintro 4 ,
+.Xr ng_ether 4 ,
+.Xr vlan 4 ,
+.Xr ifconfig 8
+.Sh AUTHORS
+The Linux
+.Nm
+driver was originally written by
+.An -nosplit
+.An Bjoern A. Zeeb .
+The
+.Fx version and this manual page were written by
+.An Denis Salopek
+as a GSoC project.
+More information about the project can

svn commit: r365373 - in head: lib/libc/stdlib/jemalloc tools/build/options

2020-09-06 Thread Dimitry Andric
Author: dim
Date: Sun Sep  6 09:08:06 2020
New Revision: 365373
URL: https://svnweb.freebsd.org/changeset/base/365373

Log:
  Follow-up r365371 by removing sentences which indicate the state of the
  MK_MALLOC_PRODUCTION option on -CURRENT.
  
  Also, for the sake of backwards compatibility, support the old way of
  enabling 'production malloc', e.g. by adding a define in make.conf(5).
  
  MFC after:1 week
  X-MFC-With:   r365371

Modified:
  head/lib/libc/stdlib/jemalloc/Makefile.inc
  head/tools/build/options/WITHOUT_MALLOC_PRODUCTION
  head/tools/build/options/WITH_MALLOC_PRODUCTION

Modified: head/lib/libc/stdlib/jemalloc/Makefile.inc
==
--- head/lib/libc/stdlib/jemalloc/Makefile.inc  Sun Sep  6 00:36:51 2020
(r365372)
+++ head/lib/libc/stdlib/jemalloc/Makefile.inc  Sun Sep  6 09:08:06 2020
(r365373)
@@ -45,6 +45,6 @@ MLINKS+= \
jemalloc.3 nallocx.3 \
jemalloc.3 malloc.conf.5
 
-.if ${MK_MALLOC_PRODUCTION} != "no"
+.if ${MK_MALLOC_PRODUCTION} != "no" || defined(MALLOC_PRODUCTION)
 CFLAGS+=   -DMALLOC_PRODUCTION
 .endif

Modified: head/tools/build/options/WITHOUT_MALLOC_PRODUCTION
==
--- head/tools/build/options/WITHOUT_MALLOC_PRODUCTION  Sun Sep  6 00:36:51 
2020(r365372)
+++ head/tools/build/options/WITHOUT_MALLOC_PRODUCTION  Sun Sep  6 09:08:06 
2020(r365373)
@@ -2,4 +2,3 @@
 Set to enable assertions and statistics gathering in
 .Xr malloc 3 .
 It also defaults the A and J runtime options to on.
-Enabled by default on -CURRENT.

Modified: head/tools/build/options/WITH_MALLOC_PRODUCTION
==
--- head/tools/build/options/WITH_MALLOC_PRODUCTION Sun Sep  6 00:36:51 
2020(r365372)
+++ head/tools/build/options/WITH_MALLOC_PRODUCTION Sun Sep  6 09:08:06 
2020(r365373)
@@ -2,4 +2,3 @@
 Set to disable assertions and statistics gathering in
 .Xr malloc 3 .
 It also defaults the A and J runtime options to off.
-Disabled by default on -CURRENT.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r365071 - in head/sys: net net/altq net/route net80211 netgraph netgraph/atm netgraph/atm/ccatm netgraph/atm/sscfu netgraph/atm/sscop netgraph/atm/uni netgraph/bluetooth/common netgrap

2020-09-06 Thread Ed Maste
On Fri, 4 Sep 2020 at 23:11, Kevin Bowling  wrote:
>
> An arbitrary formater may leave a
> little bit of annoyance to each person's taste, but that is a tiny
> drop in the bucket compared to never having to discuss and especially
> correct (which may /seem/ helpful but is pretty offputting to
> newcomers).

As an experiment I ran clang-format over an arbitrary file
(vtfontcvt.c) and put the results in
https://reviews.freebsd.org/D26340

Relative to the original file there are a few style(9) items that have
been fixed, a few that have been broken, and some that are arguably
worse but really indifferent.

Fixed:
- *_FOREACH now has a space before (, equivalent to for (;;)
- header sorting
- space between sizeof and ( removed
- indentation of an if body
- unwrapped function call that fits on one line

Broken:
- indentation of if / for conditions that span 2 or more lines

Indifferent:
- lose lined-up struct members or comments
- space vs tab after #define
- newlines before quoted function arguments
- function argument wrapping (see write_glyph_buf)
- leading indentation and args-per-line (print_font_info)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r365071 - in head/sys: net net/altq net/route net80211 netgraph netgraph/atm netgraph/atm/ccatm netgraph/atm/sscfu netgraph/atm/sscop netgraph/atm/uni netgraph/bluetooth/common netgrap

2020-09-06 Thread Warner Losh
On Sat, Sep 5, 2020 at 1:42 PM Ed Maste  wrote:

> On Fri, 4 Sep 2020 at 23:11, Kevin Bowling 
> wrote:
> >
> > An arbitrary formater may leave a
> > little bit of annoyance to each person's taste, but that is a tiny
> > drop in the bucket compared to never having to discuss and especially
> > correct (which may /seem/ helpful but is pretty offputting to
> > newcomers).
>
> As an experiment I ran clang-format over an arbitrary file
> (vtfontcvt.c) and put the results in
> https://reviews.freebsd.org/D26340
>
> Relative to the original file there are a few style(9) items that have
> been fixed, a few that have been broken, and some that are arguably
> worse but really indifferent.
>
> Fixed:
> - *_FOREACH now has a space before (, equivalent to for (;;)
>

Except pretty much everywhere we don't have a space there...


> - header sorting
> - space between sizeof and ( removed
> - indentation of an if body
> - unwrapped function call that fits on one line
>
> Broken:
> - indentation of if / for conditions that span 2 or more lines
>
broke all alignment of variables and comments that were done.
broke all err() calls to wrap too much
broke purposely outdented code in statistics function
extra headers still included.


>
> Indifferent:
> - lose lined-up struct members or comments
>

This will cause a huge amount of churn, and is a needless change. It makes
things harder to read. Though this alignment style has been slowly waining
after being popular early on...

The comments moving is a bigger problem for the worse.


> - space vs tab after #define
> - newlines before quoted function arguments
>

Also a problem since it introduces more verticality.


> - function argument wrapping (see write_glyph_buf)
> - leading indentation and args-per-line (print_font_info)
>

An interesting experiment, but there's far more worse after than before.
The rearranging of carefully aligned elements is an especially galling
change for some people (myself included).

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