Re: svn commit: r301166 - in head: etc etc/ppp libexec/dma/dmagent share/mk usr.sbin/ppp

2016-06-02 Thread Bryan Drewery
On 6/1/2016 1:44 PM, Glen Barber wrote:
> Author: gjb
> Date: Wed Jun  1 20:44:28 2016
> New Revision: 301166
> URL: https://svnweb.freebsd.org/changeset/base/301166
> 
> Log:
>   Revert r301137 and r301163, and implement a correct fix
>   for the CONFS issue with dma.conf and ppp.conf.

Thanks!

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r301181 - in head/sys: conf dev/ath modules/ath

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 00:51:36 2016
New Revision: 301181
URL: https://svnweb.freebsd.org/changeset/base/301181

Log:
  [ath] commit initial bluetooth coexistence support for the MCI NICs.
  
  This is the initial framework to call into the MCI HAL routines and drive
  the basic state engine.
  
  The MCI bluetooth coex model uses a command channel between wlan and
  bluetooth, rather than a 2-wire or 3-wire signaling protocol to control 
things.
  This means the wlan and bluetooth chip exchange a lot more information and
  signaling, even at the per-packet level.  The NICs in question can share
  the input LNA and output PA on the die, so they absolutely can't stomp
  on each other in a silly fashion.  It also allows for the bluetooth side
  to signal when profiles come and go, so the driver can take appropriate
  control.  There's also the possibility of dynamic bluetooth/wlan duty cycle
  control which I haven't yet really played with.
  
  It configures things up with a static "wlan wins everything" coexistence,
  configures up the available 2GHz channel map for bluetooth, sets a static
  duty cycle for bluetooth/wifi traffic priority and drives the basics needed to
  keep the MCI HAL code happy.
  
  It doesn't do any actual coexistence except to default to "wlan wins 
everything",
  which at least demonstrates that things do indeed work.  Bluetooth inquiry 
frames
  still trump wifi (including beacons), so that demonstrates things really do
  indeed seem to work.
  
  Tested:
  
  * AR9462 (WB222), STA mode + bt
  * QCA9565 (WB335), STA mode + bt
  
  TODO:
  
  * .. the rest of coexistence.  yes, bluetooth, not people.  That stuff's hard.
  * It doesn't do the initial BT side calibration, which requires a WLAN chip
reset.  I'll fix up the reset path a bit more first before I enable that.
  * The 1-ant and 2-ant configuration bits aren't being set correctly in
if_ath_btcoex.c - I'll dig into that and fix it in a subsequent commit.
  * It's not enabled by default for WB222/WB225 even though I believe it now
can be - I'll chase that up in a subsequent commit.
  
  Obtained from:Qualcomm Atheros, Linux ath9k

Added:
  head/sys/dev/ath/if_ath_btcoex_mci.c   (contents, props changed)
  head/sys/dev/ath/if_ath_btcoex_mci.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_btcoex.c
  head/sys/dev/ath/if_ath_btcoex.h
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h
  head/sys/modules/ath/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jun  2 00:42:15 2016(r301180)
+++ head/sys/conf/files Thu Jun  2 00:51:36 2016(r301181)
@@ -765,6 +765,8 @@ dev/ath/if_ath_beacon.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_btcoex.coptional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
+dev/ath/if_ath_btcoex_mci.coptional ath \
+   compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_debug.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_descdma.c   optional ath \

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Thu Jun  2 00:42:15 2016(r301180)
+++ head/sys/dev/ath/if_ath.c   Thu Jun  2 00:51:36 2016(r301181)
@@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -475,6 +476,10 @@ ath_setup_hal_config(struct ath_softc *s
if (sc->sc_pci_devinfo & ATH_PCI_AR9565_2ANT)
device_printf(sc->sc_dev, "WB335 2-ANT card detected\n");
 
+   if (sc->sc_pci_devinfo & ATH_PCI_BT_ANT_DIV)
+   device_printf(sc->sc_dev,
+   "Bluetooth Antenna Diversity card detected\n");
+
if (sc->sc_pci_devinfo & ATH_PCI_KILLER)
device_printf(sc->sc_dev, "Killer Wireless card detected\n");
 
@@ -2254,6 +2259,9 @@ ath_intr(void *arg)
device_printf(sc->sc_dev, "%s: TSFOOR\n", __func__);
sc->sc_syncbeacon = 1;
}
+   if (status & HAL_INT_MCI) {
+   ath_btcoex_mci_intr(sc);
+   }
}
ATH_PCU_LOCK(sc);
sc->sc_intr_cnt--;
@@ -2549,6 +2557,12 @@ ath_init(struct ath_softc *sc)
sc->sc_imask |= HAL_INT_RXEOL;
 
/*
+* Enable MCI interrupt for MCI devices.
+*/
+   if (sc->sc_btcoex_mci)
+   sc->sc_imask |= HAL_INT_MCI;
+
+   /*
 * Enable MIB interrupts when there are hardware phy counters.
 * Note we only do this (at the moment) for station mode.
 */

Modified: head/sys/dev/ath/if_ath_btcoex.c
=

svn commit: r301186 - head/sys/dev/ath

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 04:25:54 2016
New Revision: 301186
URL: https://svnweb.freebsd.org/changeset/base/301186

Log:
  [ath] correctly shift the QCA9565 LNA config into the mci config variable.
  
  Tested:
  
  * QCA9565, STA + BT mode

Modified:
  head/sys/dev/ath/if_ath_btcoex.c

Modified: head/sys/dev/ath/if_ath_btcoex.c
==
--- head/sys/dev/ath/if_ath_btcoex.cThu Jun  2 03:16:02 2016
(r301185)
+++ head/sys/dev/ath/if_ath_btcoex.cThu Jun  2 04:25:54 2016
(r301186)
@@ -299,9 +299,13 @@ ath_btcoex_cfg_wb335b(struct ath_softc *
 * HAL correctly!
 */
if (sc->sc_pci_devinfo & ATH_PCI_AR9565_1ANT) {
-   flags |= ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED;
+   flags &= ~ATH_MCI_CONFIG_ANT_ARCH;
+   flags |= ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED <<
+   ATH_MCI_CONFIG_ANT_ARCH_S;
} else if (sc->sc_pci_devinfo & ATH_PCI_AR9565_2ANT) {
-   flags |= ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_NON_SHARED;
+   flags &= ~ATH_MCI_CONFIG_ANT_ARCH;
+   flags |= ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_NON_SHARED <<
+   ATH_MCI_CONFIG_ANT_ARCH_S;
}
 
if (sc->sc_pci_devinfo & ATH_PCI_BT_ANT_DIV) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301196 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 11:12:11 2016
New Revision: 301196
URL: https://svnweb.freebsd.org/changeset/base/301196

Log:
  xen-netfront: fix receiving TSO packets
  
  Currently FreeBSD is not properly fetching the TSO information from the Xen
  PV ring, and thus the received packets didn't have all the necessary
  information, like the segment size or even the TSO flag set.
  
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 07:45:01 2016
(r301195)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:12:11 2016
(r301196)
@@ -1253,6 +1253,13 @@ xn_rxeof(struct netfront_rxq *rxq)
| CSUM_PSEUDO_HDR);
m->m_pkthdr.csum_data = 0x;
}
+   if ((rx->flags & NETRXF_extra_info) != 0 &&
+   (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type ==
+   XEN_NETIF_EXTRA_TYPE_GSO)) {
+   m->m_pkthdr.tso_segsz =
+   extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].u.gso.size;
+   m->m_pkthdr.csum_flags |= CSUM_TSO;
+   }
 
rxq->stats.rx_packets++;
rxq->stats.rx_bytes += m->m_pkthdr.len;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301207 - head/etc/rc.d

2016-06-02 Thread Alan Somers
Author: asomers
Date: Thu Jun  2 15:31:24 2016
New Revision: 301207
URL: https://svnweb.freebsd.org/changeset/base/301207

Log:
  Fix exit status of "service routing start  "
  
  etc/rc.d/routing
Ignore the exit status of options_{inet,inet6,atm}. It's
meaningless.
  
  Reviewed by:  hrs
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D6687

Modified:
  head/etc/rc.d/routing

Modified: head/etc/rc.d/routing
==
--- head/etc/rc.d/routing   Thu Jun  2 15:30:58 2016(r301206)
+++ head/etc/rc.d/routing   Thu Jun  2 15:31:24 2016(r301207)
@@ -90,18 +90,23 @@ routing_stop()
 
 setroutes()
 {
+   local _ret
+   _ret=0
case $1 in
static)
static_$2 add $3
+   _ret=$?
;;
options)
options_$2
;;
doall)
static_$2 add $3
+   _ret=$?
options_$2
;;
esac
+   return $_ret
 }
 
 routing_stop_inet()
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301172 - head/contrib/blacklist

2016-06-02 Thread Kurt Lidl
Author: lidl
Date: Wed Jun  1 22:04:10 2016
New Revision: 301172
URL: https://svnweb.freebsd.org/changeset/base/301172

Log:
  Import NetBSD's blacklist source from vendor tree
  
  This import includes The basic blacklist library and utility programs,
  to add a system-wide packet filtering notification mechanism to
  FreeBSD.
  
  The rational behind the daemon was given by Christos Zoulas in a
  presentation at vBSDcon 2015: https://youtu.be/fuuf8G28mjs
  
  Reviewed by:  rpaulo
  Approved by:  rpaulo
  Obtained from:NetBSD
  Relnotes: YES
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5912

Added:
  head/contrib/blacklist/
 - copied from r301170, vendor/NetBSD/blacklist/dist/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301185 - head/sbin/ifconfig

2016-06-02 Thread Allan Jude
Author: allanjude
Date: Thu Jun  2 03:16:02 2016
New Revision: 301185
URL: https://svnweb.freebsd.org/changeset/base/301185

Log:
  Address feedback from hrs@ re: r301059 (ifconfig subnet mask)
  
  - Use NI_MAXHOST to size buffers for getnameinfo()
  - remove non-standard 'full' inet6 address printing
  - remove 'no scope' option
  - use strchr(3) to optimize replacing separator character in lladdrs
  
  Reviewed by:  gnn, jhb
  Differential Revision:https://reviews.freebsd.org/D2856

Modified:
  head/sbin/ifconfig/af_inet.c
  head/sbin/ifconfig/af_inet6.c
  head/sbin/ifconfig/af_link.c
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifconfig.c

Modified: head/sbin/ifconfig/af_inet.c
==
--- head/sbin/ifconfig/af_inet.cThu Jun  2 02:39:40 2016
(r301184)
+++ head/sbin/ifconfig/af_inet.cThu Jun  2 03:16:02 2016
(r301185)
@@ -54,7 +54,7 @@ static const char rcsid[] =
 
 static struct in_aliasreq in_addreq;
 static struct ifreq in_ridreq;
-static char addr_buf[MAXHOSTNAMELEN *2 + 1];   /*for getnameinfo()*/
+static char addr_buf[NI_MAXHOST];  /*for getnameinfo()*/
 extern char *f_inet, *f_addr;
 
 static void

Modified: head/sbin/ifconfig/af_inet6.c
==
--- head/sbin/ifconfig/af_inet6.c   Thu Jun  2 02:39:40 2016
(r301184)
+++ head/sbin/ifconfig/af_inet6.c   Thu Jun  2 03:16:02 2016
(r301185)
@@ -65,13 +65,13 @@ static  int ip6lifetime;
 static int prefix(void *, int);
 static char *sec2str(time_t);
 static int explicit_prefix = 0;
-extern char *f_inet6, *f_addr, *f_scope;
+extern char *f_inet6, *f_addr;
 
 extern void setnd6flags(const char *, int, int, const struct afswtch *);
 extern void setnd6defif(const char *, int, int, const struct afswtch *);
 extern void nd6_status(int);
 
-static char addr_buf[MAXHOSTNAMELEN *2 + 1];   /*for getnameinfo()*/
+static char addr_buf[NI_MAXHOST];  /*for getnameinfo()*/
 
 static void
 setifprefixlen(const char *addr, int dummy __unused, int s,
@@ -173,10 +173,9 @@ in6_status(int s __unused, const struct 
struct in6_ifreq ifr6;
int s6;
u_int32_t flags6;
-   const u_int16_t *a;
struct in6_addrlifetime lifetime;
struct timespec now;
-   int error, n_flags, i;
+   int error, n_flags;
 
clock_gettime(CLOCK_MONOTONIC_FAST, &now);
 
@@ -208,30 +207,19 @@ in6_status(int s __unused, const struct 
lifetime = ifr6.ifr_ifru.ifru_lifetime;
close(s6);
 
-   if (f_addr != NULL && strcmp(f_addr, "full") == 0) {
-   a = (const u_int16_t *)&sin->sin6_addr;
-   printf("\tinet6 ");
-   for (i = 0; i < 8; i++) {
-   printf("%04hx", ntohs(*(a + i)));
-   if (i < 7)
-   printf(":");
-   }
-   } else {
-   if (f_addr != NULL && strcmp(f_addr, "fqdn") == 0)
-   n_flags = 0;
-   else if (f_addr != NULL && strcmp(f_addr, "host") == 0)
-   n_flags = NI_NOFQDN;
-   else
-   n_flags = NI_NUMERICHOST;
-   error = getnameinfo((struct sockaddr *)sin, sin->sin6_len,
-   addr_buf, sizeof(addr_buf), NULL, 0,
-   n_flags);
-   if (error != 0 ||
-   (f_scope != NULL && strcmp(f_scope, "none") == 0))
-   inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf,
- sizeof(addr_buf));
-   printf("\tinet6 %s", addr_buf);
-   }
+   if (f_addr != NULL && strcmp(f_addr, "fqdn") == 0)
+   n_flags = 0;
+   else if (f_addr != NULL && strcmp(f_addr, "host") == 0)
+   n_flags = NI_NOFQDN;
+   else
+   n_flags = NI_NUMERICHOST;
+   error = getnameinfo((struct sockaddr *)sin, sin->sin6_len,
+   addr_buf, sizeof(addr_buf), NULL, 0,
+   n_flags);
+   if (error != 0)
+   inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf,
+ sizeof(addr_buf));
+   printf("\tinet6 %s", addr_buf);
 
if (ifa->ifa_flags & IFF_POINTOPOINT) {
sin = (struct sockaddr_in6 *)ifa->ifa_dstaddr;
@@ -280,8 +268,7 @@ in6_status(int s __unused, const struct 
if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
printf("prefer_source ");
 
-   if ((f_scope == NULL || strcmp(f_scope, "none") != 0) &&
-   ((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
+   if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
printf("scopeid 0x%x ",
((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id);
 

Modified: head/sbin/ifconfig/af_link.c

svn commit: r301208 - head/sys/kern

2016-06-02 Thread Mateusz Guzik
Author: mjg
Date: Thu Jun  2 15:52:34 2016
New Revision: 301208
URL: https://svnweb.freebsd.org/changeset/base/301208

Log:
  taskqueue: plug a leak in _taskqueue_create
  
  While here make some style fixes and postpone the sprintf so that it is
  only done when the function can no longer fail.
  
  CID:  1356041

Modified:
  head/sys/kern/subr_taskqueue.c

Modified: head/sys/kern/subr_taskqueue.c
==
--- head/sys/kern/subr_taskqueue.c  Thu Jun  2 15:31:24 2016
(r301207)
+++ head/sys/kern/subr_taskqueue.c  Thu Jun  2 15:52:34 2016
(r301208)
@@ -130,14 +130,16 @@ _taskqueue_create(const char *name, int 
char *tq_name;
 
tq_name = malloc(TASKQUEUE_NAMELEN, M_TASKQUEUE, mflags | M_ZERO);
-   if (!tq_name)
+   if (tq_name == NULL)
return (NULL);
 
-   snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue");
-
queue = malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags | M_ZERO);
-   if (!queue)
+   if (queue == NULL) {
+   free(tq_name, M_TASKQUEUE);
return (NULL);
+   }
+
+   snprintf(tq_name, TASKQUEUE_NAMELEN, "%s", (name) ? name : "taskqueue");
 
STAILQ_INIT(&queue->tq_queue);
TAILQ_INIT(&queue->tq_active);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 04:54:56 2016
New Revision: 301190
URL: https://svnweb.freebsd.org/changeset/base/301190

Log:
  [iwm] Clean up iwm(4) scanning logic a bit.
  
  Submitted by: Imre Vadasz 
  Obtained from:DragonflyBSD 8f3ffab9136e33263d424275ec28f57ad2096437

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

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Jun  2 04:53:28 2016(r301189)
+++ head/sys/dev/iwm/if_iwm.c   Thu Jun  2 04:54:56 2016(r301190)
@@ -3642,7 +3642,8 @@ iwm_endscan_cb(void *arg, int pending)
done = 0;
if ((error = iwm_mvm_scan_request(sc,
IEEE80211_CHAN_5GHZ, 0, NULL, 0)) != 0) {
-   device_printf(sc->sc_dev, "could not initiate scan\n");
+   device_printf(sc->sc_dev,
+   "could not initiate 5 GHz scan\n");
done = 1;
}
} else {
@@ -4883,9 +4884,10 @@ iwm_scan_start(struct ieee80211com *ic)
IWM_LOCK(sc);
error = iwm_mvm_scan_request(sc, IEEE80211_CHAN_2GHZ, 0, NULL, 0);
if (error) {
-   device_printf(sc->sc_dev, "could not initiate scan\n");
+   device_printf(sc->sc_dev, "could not initiate 2 GHz scan\n");
IWM_UNLOCK(sc);
ieee80211_cancel_scan(vap);
+   sc->sc_scanband = 0;
} else {
iwm_led_blink_start(sc);
IWM_UNLOCK(sc);

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Thu Jun  2 04:53:28 2016
(r301189)
+++ head/sys/dev/iwm/if_iwm_scan.c  Thu Jun  2 04:54:56 2016
(r301190)
@@ -443,7 +443,6 @@ iwm_mvm_scan_request(struct iwm_softc *s
 * to allocate the time events. Warn on it, but maybe we
 * should try to send the command again with different params.
 */
-   sc->sc_scanband = 0;
ret = EIO;
}
return ret;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301188 - in head/sys: conf modules/iwm

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 04:42:45 2016
New Revision: 301188
URL: https://svnweb.freebsd.org/changeset/base/301188

Log:
  [iwm] add if_iwm_led.c into the build.

Modified:
  head/sys/conf/files
  head/sys/modules/iwm/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jun  2 04:42:28 2016(r301187)
+++ head/sys/conf/files Thu Jun  2 04:42:45 2016(r301188)
@@ -1704,6 +1704,7 @@ iwi_monitor.fwoptional iwimonitorfw |
clean   "iwi_monitor.fw"
 dev/iwm/if_iwm.c   optional iwm
 dev/iwm/if_iwm_binding.c   optional iwm
+dev/iwm/if_iwm_led.c   optional iwm
 dev/iwm/if_iwm_mac_ctxt.c  optional iwm
 dev/iwm/if_iwm_pcie_trans.coptional iwm
 dev/iwm/if_iwm_phy_ctxt.c  optional iwm

Modified: head/sys/modules/iwm/Makefile
==
--- head/sys/modules/iwm/Makefile   Thu Jun  2 04:42:28 2016
(r301187)
+++ head/sys/modules/iwm/Makefile   Thu Jun  2 04:42:45 2016
(r301188)
@@ -6,7 +6,7 @@ KMOD=   if_iwm
 # Main driver
 SRCS=  if_iwm.c if_iwm_binding.c if_iwm_util.c if_iwm_phy_db.c
 SRCS+= if_iwm_mac_ctxt.c if_iwm_phy_ctxt.c if_iwm_time_event.c
-SRCS+= if_iwm_power.c if_iwm_scan.c
+SRCS+= if_iwm_power.c if_iwm_scan.c if_iwm_led.c
 # bus layer
 SRCS+= if_iwm_pcie_trans.c
 SRCS+= device_if.h bus_if.h pci_if.h opt_wlan.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 04:53:28 2016
New Revision: 301189
URL: https://svnweb.freebsd.org/changeset/base/301189

Log:
  [iwm] Use IWM_MAX_CMD_PAYLOAD_SIZE to improve command length checks.
  
Taken-From: OpenBSD (parts of if_iwm.c r1.57 and if_iwmreg.h r1.10)
  
  Obtained from:DragonflyBSD b70c1eaad06257c5c7f4d8110d21642ebec14f42

Modified:
  head/sys/dev/iwm/if_iwm_util.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm_util.c
==
--- head/sys/dev/iwm/if_iwm_util.c  Thu Jun  2 04:42:45 2016
(r301188)
+++ head/sys/dev/iwm/if_iwm_util.c  Thu Jun  2 04:53:28 2016
(r301189)
@@ -224,7 +224,10 @@ iwm_send_cmd(struct iwm_softc *sc, struc
"large command paylen=%u len0=%u\n",
paylen, hcmd->len[0]);
/* Command is too large */
-   if (sizeof(cmd->hdr) + paylen > IWM_RBUF_SIZE) {
+   if (paylen > IWM_MAX_CMD_PAYLOAD_SIZE) {
+   device_printf(sc->sc_dev,
+   "firmware command too long (%zd bytes)\n",
+   paylen + sizeof(cmd->hdr));
error = EINVAL;
goto out;
}
@@ -269,7 +272,7 @@ iwm_send_cmd(struct iwm_softc *sc, struc
(unsigned long) (hcmd->len[0] + hcmd->len[1] + sizeof(cmd->hdr)),
async ? " (async)" : "");
 
-   if (hcmd->len[0] > sizeof(cmd->data)) {
+   if (paylen > sizeof(cmd->data)) {
bus_dmamap_sync(ring->data_dmat, data->map,
BUS_DMASYNC_PREWRITE);
} else {

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Jun  2 04:42:45 2016
(r301188)
+++ head/sys/dev/iwm/if_iwmreg.hThu Jun  2 04:53:28 2016
(r301189)
@@ -5243,6 +5243,7 @@ enum iwm_power_scheme {
 };
 
 #define IWM_DEF_CMD_PAYLOAD_SIZE 320
+#define IWM_MAX_CMD_PAYLOAD_SIZE ((4096 - 4) - sizeof(struct iwm_cmd_header))
 #define IWM_CMD_FAILED_MSK 0x40
 
 struct iwm_device_cmd {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 06:22:59 2016
New Revision: 301193
URL: https://svnweb.freebsd.org/changeset/base/301193

Log:
  [iwm] valid_{tx,rx}_ant from radio_cfg is only needed for 8000 family.
  
  * The "if (!data->valid_tx_ant || !data->valid_rx_ant) {" check was getting
triggered with a 3165 chipset.
  
  Submitted by: Imre Vadasz 
  Obtained from:DragonflyBSD 3655dfb6fc311fc83e5ce8370dd91b4cd4a37991

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

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Jun  2 05:43:16 2016(r301192)
+++ head/sys/dev/iwm/if_iwm.c   Thu Jun  2 06:22:59 2016(r301193)
@@ -1764,22 +1764,12 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
data->radio_cfg_step = IWM_NVM_RF_CFG_STEP_MSK(radio_cfg);
data->radio_cfg_dash = IWM_NVM_RF_CFG_DASH_MSK(radio_cfg);
data->radio_cfg_pnum = IWM_NVM_RF_CFG_PNUM_MSK(radio_cfg);
-   data->valid_tx_ant = IWM_NVM_RF_CFG_TX_ANT_MSK(radio_cfg);
-   data->valid_rx_ant = IWM_NVM_RF_CFG_RX_ANT_MSK(radio_cfg);
 
sku = le16_to_cpup(nvm_sw + IWM_SKU);
data->sku_cap_band_24GHz_enable = sku & IWM_NVM_SKU_CAP_BAND_24GHZ;
data->sku_cap_band_52GHz_enable = sku & IWM_NVM_SKU_CAP_BAND_52GHZ;
data->sku_cap_11n_enable = 0;
 
-   if (!data->valid_tx_ant || !data->valid_rx_ant) {
-   device_printf(sc->sc_dev,
-   "%s: invalid antennas (0x%x, 0x%x)\n",
-   __func__, data->valid_tx_ant,
-   data->valid_rx_ant);
-   return EINVAL;
-   }
-
data->n_hw_addrs = le16_to_cpup(nvm_sw + IWM_N_HW_ADDRS);
 
data->xtal_calib[0] = *(nvm_calib + IWM_XTAL_CALIB);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301194 - head/sys/xen

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 07:43:02 2016
New Revision: 301194
URL: https://svnweb.freebsd.org/changeset/base/301194

Log:
  xen: add missing #define in include guard.
  
  Submitted by: Akshay Jaggi 
  Reviewed by:  royger

Modified:
  head/sys/xen/gnttab.h

Modified: head/sys/xen/gnttab.h
==
--- head/sys/xen/gnttab.h   Thu Jun  2 06:22:59 2016(r301193)
+++ head/sys/xen/gnttab.h   Thu Jun  2 07:43:02 2016(r301194)
@@ -35,6 +35,7 @@
  */
 
 #ifndef __ASM_GNTTAB_H__
+#define __ASM_GNTTAB_H__
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
On Thu, Jun 02, 2016 at 01:19:56PM +0200, Hans Petter Selasky wrote:
> On 06/02/16 13:14, Roger Pau Monné wrote:
> > +   callout_reset(&rxq->rx_refill, hz/10, 
> > xn_alloc_rx_buffers_callout,
> > +   rxq);
> 
> Maybe use callout_reset_curcpu() to take advantage of callout's SMP
> capabilities ?

Yes, that's fine. But what's the benefit of it? I don't really care whether 
the callout is run on the current CPU or not. Is callout_reset_curcpu 
cheaper than callout_reset?

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


Re: svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Hans Petter Selasky

On 06/02/16 14:54, Roger Pau Monné wrote:

On Thu, Jun 02, 2016 at 01:19:56PM +0200, Hans Petter Selasky wrote:

On 06/02/16 13:14, Roger Pau Monné wrote:

+   callout_reset(&rxq->rx_refill, hz/10, 
xn_alloc_rx_buffers_callout,
+   rxq);


Maybe use callout_reset_curcpu() to take advantage of callout's SMP
capabilities ?


Yes, that's fine. But what's the benefit of it? I don't really care whether
the callout is run on the current CPU or not. Is callout_reset_curcpu
cheaper than callout_reset?



Hi,

It is maybe not cheaper, but it will distribute the load of the 
xn_alloc_rx_buffers_callout() callback, to the current CPU calling 
callout_reset_curcpu(). Else xn_alloc_rx_buffers_callout() will always 
be called from callback thread zero.


--HPS

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


Re: svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
On Thu, Jun 02, 2016 at 11:14:26AM +, Roger Pau Monné wrote:
> Author: royger
> Date: Thu Jun  2 11:14:26 2016
> New Revision: 301197
> URL: https://svnweb.freebsd.org/changeset/base/301197
> 
> Log:
>   xen-netfront: always keep the Rx ring full of requests
>   
>   This is based on Linux commit 1f3c2eba1e2d866ef99bb9b10ade4096e3d7607c from
>   David Vrabel:
>   
>   A full Rx ring only requires 1 MiB of memory.  This is not enough memory
>   that it is useful to dynamically scale the number of Rx requests in the ring
>   based on traffic rates, because:
>   
>   a) Even the full 1 MiB is a tiny fraction of a typically modern Linux
>  VM (for example, the AWS micro instance still has 1 GiB of memory).
>   
>   b) Netfront would have used up to 1 MiB already even with moderate
>  data rates (there was no adjustment of target based on memory
>  pressure).
>   
>   c) Small VMs are going to typically have one VCPU and hence only one
>  queue.
>   
>   Keeping the ring full of Rx requests handles bursty traffic better than
>   trying to converge on an optimal number of requests to keep filled.
>   
>   Reviewed by:Wei Liu 
>   Sponsored by:   Citrix Systems R&D

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


svn commit: r301199 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 11:18:02 2016
New Revision: 301199
URL: https://svnweb.freebsd.org/changeset/base/301199

Log:
  xen-netfront: fix two hotplug related issues
  
  This patch fixes two issues seen on hot-unplug. The first one is a panic
  caused by calling ether_ifdetach after freeing the internal netfront queue
  structures. ether_ifdetach will call xn_qflush, and this needs to be done
  before freeing the queues. This prevents the following panic:
  
  Fatal trap 9: general protection fault while in kernel mode
  cpuid = 2; apic id = 04
  instruction pointer   = 0x20:0x80b1687f
  stack pointer = 0x28:0xfe009239e770
  frame pointer = 0x28:0xfe009239e780
  code segment  = base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
  processor eflags  = interrupt enabled, resume, IOPL = 0
  current process   = 0 (thread taskq)
  [ thread pid 0 tid 100015 ]
  Stopped at  strlen+0x1f:movq(%rcx),%rax
  db> bt
  Tracing pid 0 tid 100015 td 0xf800038a6000
  strlen() at strlen+0x1f/frame 0xfe009239e780
  kvprintf() at kvprintf+0xfa0/frame 0xfe009239e890
  vsnprintf() at vsnprintf+0x31/frame 0xfe009239e8b0
  kassert_panic() at kassert_panic+0x5a/frame 0xfe009239e920
  __mtx_lock_flags() at __mtx_lock_flags+0x164/frame 0xfe009239e970
  xn_qflush() at xn_qflush+0x59/frame 0xfe009239e9b0
  if_detach() at if_detach+0x17e/frame 0xfe009239ea10
  netif_free() at netif_free+0x97/frame 0xfe009239ea30
  netfront_detach() at netfront_detach+0x11/frame 0xfe009239ea40
  [...]
  
  Another panic can be triggered by hot-plugging a NIC:
  
  Fatal trap 18: integer divide fault while in kernel mode
  cpuid = 0; apic id = 00
  instruction pointer   = 0x20:0x80902203
  stack pointer = 0x28:0xfe00508d3660
  frame pointer = 0x28:0xfe00508d36a0
  code segment  = base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
  processor eflags  = interrupt enabled, resume, IOPL = 0
  current process   = 2960 (ifconfig)
  [ thread pid 2960 tid 100088 ]
  Stopped at  xn_txq_mq_start+0x33:   divl%esi,%eax
  db> bt
  Tracing pid 2960 tid 100088 td 0xf8000850aa00
  xn_txq_mq_start() at xn_txq_mq_start+0x33/frame 0xfe00508d36a0
  ether_output() at ether_output+0x570/frame 0xfe00508d3720
  arprequest() at arprequest+0x433/frame 0xfe00508d3820
  arp_ifinit() at arp_ifinit+0x49/frame 0xfe00508d3850
  xn_ioctl() at xn_ioctl+0x1a2/frame 0xfe00508d3890
  in_control() at in_control+0x882/frame 0xfe00508d3910
  ifioctl() at ifioctl+0xda1/frame 0xfe00508d39a0
  kern_ioctl() at kern_ioctl+0x246/frame 0xfe00508d3a00
  sys_ioctl() at sys_ioctl+0x171/frame 0xfe00508d3ae0
  amd64_syscall() at amd64_syscall+0x2db/frame 0xfe00508d3bf0
  Xfast_syscall() at Xfast_syscall+0xfb/frame 0xfe00508d3bf0
  --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x8011e185a, rsp =
  0x7fffe478, rbp = 0x7fffe4c0 ---
  
  This is caused by marking the driver as active before it's fully
  initialized, and thus calling xn_txq_mq_start with num_queues set to 0.
  
  Reviewed by:  Wei Liu 
  Sponsored by: Citrix Systems R&D
  Differential revision:https://reviews.freebsd.org/D6646

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:16:35 2016
(r301198)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:18:02 2016
(r301199)
@@ -1704,7 +1704,7 @@ xn_ifinit_locked(struct netfront_info *n
 
ifp = np->xn_ifp;
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+   if (ifp->if_drv_flags & IFF_DRV_RUNNING || !netfront_carrier_ok(np))
return;
 
xn_stop(np);
@@ -2088,6 +2088,8 @@ xn_txq_mq_start(struct ifnet *ifp, struc
np = ifp->if_softc;
npairs = np->num_queues;
 
+   KASSERT(npairs != 0, ("called with 0 available queues"));
+
/* check if flowid is set */
if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE)
i = m->m_pkthdr.flowid % npairs;
@@ -2202,9 +2204,9 @@ netif_free(struct netfront_info *np)
xn_stop(np);
XN_UNLOCK(np);
netif_disconnect_backend(np);
+   ether_ifdetach(np->xn_ifp);
free(np->rxq, M_DEVBUF);
free(np->txq, M_DEVBUF);
-   ether_ifdetach(np->xn_ifp);
if_free(np->xn_ifp);
np->xn_ifp = NULL;
ifmedia_removeall(&np->sc_media);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301171 - head/lib/libc/sys

2016-06-02 Thread Jilles Tjoelker
Author: jilles
Date: Wed Jun  1 21:58:13 2016
New Revision: 301171
URL: https://svnweb.freebsd.org/changeset/base/301171

Log:
  thr_*(2): Add xrefs to what libthr implements using each syscall.
  
  Add text to thr_exit(2) and thr_new(2) discouraging their use in
  applications since calling these in a process with libthr loaded will
  confuse libthr and is likely to cause hangs or crashes.
  
  The thr_kill2(2) call is not used by libthr and may be useful in special
  applications.
  
  The other calls can be used in applications but it should not be necessary.

Modified:
  head/lib/libc/sys/thr_exit.2
  head/lib/libc/sys/thr_kill.2
  head/lib/libc/sys/thr_new.2
  head/lib/libc/sys/thr_self.2
  head/lib/libc/sys/thr_set_name.2

Modified: head/lib/libc/sys/thr_exit.2
==
--- head/lib/libc/sys/thr_exit.2Wed Jun  1 21:52:12 2016
(r301170)
+++ head/lib/libc/sys/thr_exit.2Wed Jun  1 21:58:13 2016
(r301171)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2016
+.Dd June 1, 2016
 .Dt THR_EXIT 2
 .Os
 .Sh NAME
@@ -41,6 +41,13 @@
 .Ft void
 .Fn thr_exit "long *state"
 .Sh DESCRIPTION
+.Bf -symbolic
+This function is intended for implementing threading.
+Normal applications should call
+.Xr pthread_exit 3
+instead.
+.Ef
+.Pp
 The
 .Fn thr_exit
 system call terminates the current kernel-scheduled thread.
@@ -70,7 +77,8 @@ last one in the process.
 .Xr thr_new 2 ,
 .Xr thr_self 2 ,
 .Xr thr_set_name 2 ,
-.Xr _umtx_op 2
+.Xr _umtx_op 2 ,
+.Xr pthread_exit 3
 .Sh STANDARDS
 The
 .Fn thr_exit

Modified: head/lib/libc/sys/thr_kill.2
==
--- head/lib/libc/sys/thr_kill.2Wed Jun  1 21:52:12 2016
(r301170)
+++ head/lib/libc/sys/thr_kill.2Wed Jun  1 21:58:13 2016
(r301171)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2016
+.Dd June 1, 2016
 .Dt THR_kill 2
 .Os
 .Sh NAME
@@ -112,11 +112,13 @@ The current process does not have suffic
 send a signal to the specified process.
 .El
 .Sh SEE ALSO
+.Xr kill 2 ,
 .Xr thr_exit 2 ,
 .Xr thr_new 2 ,
 .Xr thr_self 2 ,
 .Xr thr_set_name 2 ,
 .Xr _umtx_op 2 ,
+.Xr pthread_kill 3 ,
 .Xr signal 3
 .Sh STANDARDS
 The

Modified: head/lib/libc/sys/thr_new.2
==
--- head/lib/libc/sys/thr_new.2 Wed Jun  1 21:52:12 2016(r301170)
+++ head/lib/libc/sys/thr_new.2 Wed Jun  1 21:58:13 2016(r301171)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2016
+.Dd June 1, 2016
 .Dt THR_NEW 2
 .Os
 .Sh NAME
@@ -41,6 +41,13 @@
 .Ft int
 .Fn thr_new "struct thr_param *param" "int param_size"
 .Sh DESCRIPTION
+.Bf -symbolic
+This function is intended for implementing threading.
+Normal applications should call
+.Xr pthread_create 3
+instead.
+.Ef
+.Pp
 The
 .Fn thr_new
 system call creates a new kernel-scheduled thread of execution in the context
@@ -220,7 +227,8 @@ No kernel memory to allocate for the new
 .Xr thr_kill2 2 ,
 .Xr thr_self 2 ,
 .Xr thr_set_name 2 ,
-.Xr _umtx_op 2
+.Xr _umtx_op 2 ,
+.Xr pthread_create 3
 .Sh STANDARDS
 The
 .Fn thr_new

Modified: head/lib/libc/sys/thr_self.2
==
--- head/lib/libc/sys/thr_self.2Wed Jun  1 21:52:12 2016
(r301170)
+++ head/lib/libc/sys/thr_self.2Wed Jun  1 21:58:13 2016
(r301171)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2016
+.Dd June 1, 2016
 .Dt THR_SELF 2
 .Os
 .Sh NAME
@@ -76,7 +76,9 @@ argument is not valid.
 .Xr thr_kill2 2 ,
 .Xr thr_new 2 ,
 .Xr thr_set_name 2 ,
-.Xr _umtx_op 2
+.Xr _umtx_op 2 ,
+.Xr pthread_getthreadid_np 3 ,
+.Xr pthread_self 3
 .Sh STANDARDS
 The
 .Fn thr_self

Modified: head/lib/libc/sys/thr_set_name.2
==
--- head/lib/libc/sys/thr_set_name.2Wed Jun  1 21:52:12 2016
(r301170)
+++ head/lib/libc/sys/thr_set_name.2Wed Jun  1 21:58:13 2016
(r301171)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2016
+.Dd June 1, 2016
 .Dt THR_SET_NAME 2
 .Os
 .Sh NAME
@@ -87,6 +87,7 @@ does not exist in the current process.
 .Xr thr_new 2 ,
 .Xr thr_self 2 ,
 .Xr _umtx_op 2 ,
+.Xr pthread_set_name_np 3 ,
 .Xr ddb 4 ,
 .Xr ktr 9
 .Sh STANDARDS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301179 - head/share/misc

2016-06-02 Thread Landon J. Fuller
Author: landonf
Date: Wed Jun  1 23:20:32 2016
New Revision: 301179
URL: https://svnweb.freebsd.org/changeset/base/301179

Log:
  Add myself as src commiter.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D6686

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Wed Jun  1 22:39:15 2016
(r301178)
+++ head/share/misc/committers-src.dot  Wed Jun  1 23:20:32 2016
(r301179)
@@ -218,6 +218,7 @@ kevlo [label="Kevin Lo\nke...@freebsd.or
 kib [label="Konstantin Belousov\n...@freebsd.org\n2006/06/03"]
 kmacy [label="Kip Macy\nkm...@freebsd.org\n2005/06/01"]
 kp [label="Kristof Provost\n...@freebsd.org\n2015/03/22"]
+landonf [label="Landon Fuller\nland...@freebsd.org\n2016/05/31"]
 le [label="Lukas Ertl\n...@freebsd.org\n2004/02/02"]
 lidl [label="Kurt Lidl\nl...@freebsd.org\n2015/10/21"]
 loos [label="Luiz Otavio O Souza\nl...@freebsd.org\n2013/07/03"]
@@ -346,6 +347,7 @@ day1 -> dg
 
 adrian -> avos
 adrian -> jmcneill
+adrian -> landonf
 adrian -> lidl
 adrian -> loos
 adrian -> monthadar
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301173 - head/sys/geom/mirror

2016-06-02 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jun  1 22:11:54 2016
New Revision: 301173
URL: https://svnweb.freebsd.org/changeset/base/301173

Log:
  When we are in panic, always go the asynchronous path in g_mirror_destroy(),
  otherwise the system will hang.
  
  This is a temporarily least intrusive crutch to get certain panicing systems
  dumping. The proper fix should question is g_mirror_destroy() should be called
  on a panicing system at all.
  
  Discussed with:   mav

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Wed Jun  1 22:04:10 2016
(r301172)
+++ head/sys/geom/mirror/g_mirror.c Wed Jun  1 22:11:54 2016
(r301173)
@@ -2989,7 +2989,8 @@ g_mirror_destroy(struct g_mirror_softc *
sx_assert(&sc->sc_lock, SX_XLOCKED);
 
pp = sc->sc_provider;
-   if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) {
+   if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0 ||
+   SCHEDULER_STOPPED())) {
switch (how) {
case G_MIRROR_DESTROY_SOFT:
G_MIRROR_DEBUG(1,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301174 - head/sys/cddl/contrib/opensolaris/uts/common/sys

2016-06-02 Thread Alan Somers
Author: asomers
Date: Wed Jun  1 22:21:42 2016
New Revision: 301174
URL: https://svnweb.freebsd.org/changeset/base/301174

Log:
  Improve the English in a comment
  
  sys/cddl/contrib/opensolaris/uts/common/sys/acl.h:
Improve the english in a comment.  No functional changes
  
  Submitted by: gibbs
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h  Wed Jun  1 
22:11:54 2016(r301173)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h  Wed Jun  1 
22:21:42 2016(r301174)
@@ -35,8 +35,8 @@
 
 #if defined(_KERNEL)
 /*
- * When compiling OpenSolaris kernel code, this file is getting
- * included instead of FreeBSD one.  Pull the original sys/acl.h as well.
+ * When compiling OpenSolaris kernel code, this file is included instead of the
+ * FreeBSD one.  Include the original sys/acl.h as well.
  */
 #undef _SYS_ACL_H
 #include_next 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301177 - head/share/man/man9

2016-06-02 Thread Mark Johnston
Author: markj
Date: Wed Jun  1 22:34:21 2016
New Revision: 301177
URL: https://svnweb.freebsd.org/changeset/base/301177

Log:
  Remove the BUGS entry in memguard's man page.
  
  UMA refcounting is gone as of r296243, so this bug no longer exists. In
  particular, it's now possible to guard mbuf clusters with memguard.

Modified:
  head/share/man/man9/memguard.9

Modified: head/share/man/man9/memguard.9
==
--- head/share/man/man9/memguard.9  Wed Jun  1 22:31:35 2016
(r301176)
+++ head/share/man/man9/memguard.9  Wed Jun  1 22:34:21 2016
(r301177)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 21, 2014
+.Dd June 1, 2016
 .Dt MEMGUARD 9
 .Os
 .Sh NAME
@@ -204,17 +204,3 @@ Additions have been made by
 and
 .An Gleb Smirnoff Aq Mt gleb...@freebsd.org
 to both the implementation and the documentation.
-.Sh BUGS
-It is not possible to guard allocations that really expect themselves to be
-allocated from
-.Xr uma 9 ,
-utilizing additional interfaces apart from
-.Fn uma_zalloc
-and
-.Fn uma_free ,
-for example
-.Fn uma_find_refcnt .
-For the moment of writing only
-.Xr mbuf 9
-cluster zones belong to that kind of allocations.
-Attempt to guard them would lead to kernel panic.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301176 - head/sys/vm

2016-06-02 Thread Mark Johnston
Author: markj
Date: Wed Jun  1 22:31:35 2016
New Revision: 301176
URL: https://svnweb.freebsd.org/changeset/base/301176

Log:
  Fix memguard(9) in kernels with INVARIANTS enabled.
  
  With r284861, UMA zones use the trash ctor and dtor by default. This is
  incompatible with memguard, which frees the backing page when the item
  is freed. Modify the UMA debug functions to be no-ops if the item was
  allocated from memguard. This also fixes constructors such as
  mb_ctor_pack(), which invokes the trash ctor in addition to performing
  some initialization.
  
  Reviewed by:  glebius
  MFC after:3 weeks
  Differential Revision:https://reviews.freebsd.org/D6562

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/uma_dbg.c

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Wed Jun  1 22:31:13 2016(r301175)
+++ head/sys/vm/uma_core.c  Wed Jun  1 22:31:35 2016(r301176)
@@ -2112,16 +2112,10 @@ uma_zalloc_arg(uma_zone_t zone, void *ud
if (memguard_cmp_zone(zone)) {
item = memguard_alloc(zone->uz_size, flags);
if (item != NULL) {
-   /*
-* Avoid conflict with the use-after-free
-* protecting infrastructure from INVARIANTS.
-*/
if (zone->uz_init != NULL &&
-   zone->uz_init != mtrash_init &&
zone->uz_init(item, zone->uz_size, flags) != 0)
return (NULL);
if (zone->uz_ctor != NULL &&
-   zone->uz_ctor != mtrash_ctor &&
zone->uz_ctor(item, zone->uz_size, udata,
flags) != 0) {
zone->uz_fini(item, zone->uz_size);
@@ -2655,9 +2649,9 @@ uma_zfree_arg(uma_zone_t zone, void *ite
 return;
 #ifdef DEBUG_MEMGUARD
if (is_memguard_addr(item)) {
-   if (zone->uz_dtor != NULL && zone->uz_dtor != mtrash_dtor)
+   if (zone->uz_dtor != NULL)
zone->uz_dtor(item, zone->uz_size, udata);
-   if (zone->uz_fini != NULL && zone->uz_fini != mtrash_fini)
+   if (zone->uz_fini != NULL)
zone->uz_fini(item, zone->uz_size);
memguard_free(item);
return;

Modified: head/sys/vm/uma_dbg.c
==
--- head/sys/vm/uma_dbg.c   Wed Jun  1 22:31:13 2016(r301175)
+++ head/sys/vm/uma_dbg.c   Wed Jun  1 22:31:35 2016(r301176)
@@ -33,6 +33,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_vm.h"
+
 #include 
 #include 
 #include 
@@ -49,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 static const uint32_t uma_junk = 0xdeadc0de;
 
@@ -57,7 +60,6 @@ static const uint32_t uma_junk = 0xdeadc
  * prior to subsequent reallocation.
  *
  * Complies with standard ctor arg/return
- *
  */
 int
 trash_ctor(void *mem, int size, void *arg, int flags)
@@ -65,6 +67,11 @@ trash_ctor(void *mem, int size, void *ar
int cnt;
uint32_t *p;
 
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(mem))
+   return (0);
+#endif
+
cnt = size / sizeof(uma_junk);
 
for (p = mem; cnt > 0; cnt--, p++)
@@ -93,6 +100,11 @@ trash_dtor(void *mem, int size, void *ar
int cnt;
uint32_t *p;
 
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(mem))
+   return;
+#endif
+
cnt = size / sizeof(uma_junk);
 
for (p = mem; cnt > 0; cnt--, p++)
@@ -131,6 +143,11 @@ mtrash_ctor(void *mem, int size, void *a
uint32_t *p = mem;
int cnt;
 
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(mem))
+   return (0);
+#endif
+
size -= sizeof(struct malloc_type *);
ksp = (struct malloc_type **)mem;
ksp += size / sizeof(struct malloc_type *);
@@ -158,6 +175,11 @@ mtrash_dtor(void *mem, int size, void *a
int cnt;
uint32_t *p;
 
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(mem))
+   return;
+#endif
+
size -= sizeof(struct malloc_type *);
cnt = size / sizeof(uma_junk);
 
@@ -176,6 +198,11 @@ mtrash_init(void *mem, int size, int fla
 {
struct malloc_type **ksp;
 
+#ifdef DEBUG_MEMGUARD
+   if (is_memguard_addr(mem))
+   return (0);
+#endif
+
mtrash_dtor(mem, size, NULL);
 
ksp = (struct malloc_type **)mem;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301180 - head/sbin/ipfw

2016-06-02 Thread Don Lewis
Author: truckman
Date: Thu Jun  2 00:42:15 2016
New Revision: 301180
URL: https://svnweb.freebsd.org/changeset/base/301180

Log:
  Belatedly bump .Dd date for Dummynet AQM import in r300779.

Modified:
  head/sbin/ipfw/ipfw.8

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Wed Jun  1 23:20:32 2016(r301179)
+++ head/sbin/ipfw/ipfw.8   Thu Jun  2 00:42:15 2016(r301180)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 13, 2015
+.Dd May 26, 2016
 .Dt IPFW 8
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301182 - head/sys/dev/ath

2016-06-02 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jun  2 01:59:41 2016
New Revision: 301182
URL: https://svnweb.freebsd.org/changeset/base/301182

Log:
  Fix kernel build.  Improper definition location of a variable.

Modified:
  head/sys/dev/ath/if_ath_btcoex_mci.c

Modified: head/sys/dev/ath/if_ath_btcoex_mci.c
==
--- head/sys/dev/ath/if_ath_btcoex_mci.cThu Jun  2 00:51:36 2016
(r301181)
+++ head/sys/dev/ath/if_ath_btcoex_mci.cThu Jun  2 01:59:41 2016
(r301182)
@@ -436,6 +436,7 @@ ath_btcoex_mci_intr(struct ath_softc *sc
uint32_t offset, subtype, opcode;
uint32_t *pGpm;
uint32_t more_data = HAL_MCI_GPM_MORE;
+   int8_t value_dbm;
bool skip_gpm = false;
 
DPRINTF(sc, ATH_DEBUG_BTCOEX, "%s: called\n", __func__);
@@ -607,7 +608,7 @@ ath_btcoex_mci_intr(struct ath_softc *sc
DPRINTF(sc, ATH_DEBUG_BTCOEX, "(MCI) LNA_INFO\n");
}
if (mciIntRxMsg & HAL_MCI_INTERRUPT_RX_MSG_CONT_INFO) {
-   int8_t value_dbm = ath_hal_btcoex_mci_state(sc->sc_ah,
+   value_dbm = ath_hal_btcoex_mci_state(sc->sc_ah,
HAL_MCI_STATE_CONT_RSSI_POWER, NULL);
 
mciIntRxMsg &= ~HAL_MCI_INTERRUPT_RX_MSG_CONT_INFO;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 05:00:52 2016
New Revision: 301191
URL: https://svnweb.freebsd.org/changeset/base/301191

Log:
  [iwm] Add bit-polling in Rx-DMA init code path.
  
  Taken-From: OpenBSD (if_iwm.c r1.80)
  
  Submitted by: Imre Vadasz 
  Obtained from:DragonflyBSD ed35558754288911048cb607e57c688273ebd8d4

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

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Jun  2 04:54:56 2016(r301190)
+++ head/sys/dev/iwm/if_iwm.c   Thu Jun  2 05:00:52 2016(r301191)
@@ -225,6 +225,7 @@ static void iwm_free_kw(struct iwm_softc
 static int iwm_alloc_ict(struct iwm_softc *);
 static voidiwm_free_ict(struct iwm_softc *);
 static int iwm_alloc_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
+static voidiwm_disable_rx_dma(struct iwm_softc *);
 static voidiwm_reset_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
 static voidiwm_free_rx_ring(struct iwm_softc *, struct iwm_rx_ring *);
 static int iwm_alloc_tx_ring(struct iwm_softc *, struct iwm_tx_ring *,
@@ -881,7 +882,7 @@ fail:   iwm_free_rx_ring(sc, ring);
 }
 
 static void
-iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
+iwm_disable_rx_dma(struct iwm_softc *sc)
 {
 
/* XXX print out if we can't lock the NIC? */
@@ -890,6 +891,11 @@ iwm_reset_rx_ring(struct iwm_softc *sc, 
(void) iwm_pcie_rx_stop(sc);
iwm_nic_unlock(sc);
}
+}
+
+static void
+iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
+{
/* Reset the ring state */
ring->cur = 0;
memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat));
@@ -1152,6 +1158,7 @@ iwm_stop_device(struct iwm_softc *sc)
}
iwm_nic_unlock(sc);
}
+   iwm_disable_rx_dma(sc);
 
/* Stop RX ring. */
iwm_reset_rx_ring(sc, &sc->rxq);
@@ -1241,7 +1248,7 @@ iwm_nic_rx_init(struct iwm_softc *sc)
memset(sc->rxq.stat, 0, sizeof(*sc->rxq.stat));
 
/* stop DMA */
-   IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
+   iwm_disable_rx_dma(sc);
IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_RBDCB_WPTR, 0);
IWM_WRITE(sc, IWM_FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ, 0);
IWM_WRITE(sc, IWM_FH_RSCSR_CHNL0_RDPTR, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 05:43:16 2016
New Revision: 301192
URL: https://svnweb.freebsd.org/changeset/base/301192

Log:
  [iwm] Fix several nitpicks in iwm(4).
  
  Move some declarations to if_iwmreg.h.
  Remove iwm_fw_alive(); just call iwm_post_alive() directly.
  Simplify iwm_mvm_add_sta().
  Return timeout error from iwm_apm_init().
  Print a message when init (i.e. boot) firmware fails to load.
  Remove some commented-out code which wouldn't compile anyway.
  Move iwm_mvm_tx_fifo to if_iwmreg.h to match better where Linux puts it.
  
  Taken-From: OpenBSD (if_iwm.c r1.80 and if_iwmreg.h r1.11)
  
  Submitted by:  Imre Vadasz 
  Obtained from:DragonflyBSD 29fcb331e5620ae145a6ab9cdda830e22fff626a

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_pcie_trans.c
  head/sys/dev/iwm/if_iwm_phy_db.h
  head/sys/dev/iwm/if_iwm_power.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Jun  2 05:00:52 2016(r301191)
+++ head/sys/dev/iwm/if_iwm.c   Thu Jun  2 05:43:16 2016(r301192)
@@ -265,7 +265,6 @@ static int  iwm_firmware_load_chunk(struc
 const uint8_t *, uint32_t);
 static int iwm_load_firmware(struct iwm_softc *, enum iwm_ucode_type);
 static int iwm_start_fw(struct iwm_softc *, enum iwm_ucode_type);
-static int iwm_fw_alive(struct iwm_softc *, uint32_t);
 static int iwm_send_tx_ant_cfg(struct iwm_softc *, uint8_t);
 static int iwm_send_phy_cfg_cmd(struct iwm_softc *);
 static int iwm_mvm_load_ucode_wait_alive(struct iwm_softc *,
@@ -1353,14 +1352,6 @@ iwm_nic_init(struct iwm_softc *sc)
return 0;
 }
 
-enum iwm_mvm_tx_fifo {
-   IWM_MVM_TX_FIFO_BK = 0,
-   IWM_MVM_TX_FIFO_BE,
-   IWM_MVM_TX_FIFO_VI,
-   IWM_MVM_TX_FIFO_VO,
-   IWM_MVM_TX_FIFO_MCAST = 5,
-};
-
 const uint8_t iwm_mvm_ac_to_tx_fifo[] = {
IWM_MVM_TX_FIFO_VO,
IWM_MVM_TX_FIFO_VI,
@@ -2005,12 +1996,6 @@ iwm_start_fw(struct iwm_softc *sc, enum 
 }
 
 static int
-iwm_fw_alive(struct iwm_softc *sc, uint32_t sched_base)
-{
-   return iwm_post_alive(sc);
-}
-
-static int
 iwm_send_tx_ant_cfg(struct iwm_softc *sc, uint8_t valid_tx_ant)
 {
struct iwm_tx_ant_cfg_cmd tx_ant_cmd = {
@@ -2058,7 +2043,7 @@ iwm_mvm_load_ucode_wait_alive(struct iwm
return error;
}
 
-   return iwm_fw_alive(sc, sc->sched_base);
+   return iwm_post_alive(sc);
 }
 
 /*
@@ -2082,8 +2067,10 @@ iwm_run_init_mvm_ucode(struct iwm_softc 
 
sc->sc_init_complete = 0;
if ((error = iwm_mvm_load_ucode_wait_alive(sc,
-   IWM_UCODE_TYPE_INIT)) != 0)
+   IWM_UCODE_TYPE_INIT)) != 0) {
+   device_printf(sc->sc_dev, "failed to load init firmware\n");
return error;
+   }
 
if (justnvm) {
if ((error = iwm_nvm_init(sc)) != 0) {
@@ -3022,13 +3009,7 @@ iwm_mvm_sta_send_to_fw(struct iwm_softc 
 static int
 iwm_mvm_add_sta(struct iwm_softc *sc, struct iwm_node *in)
 {
-   int ret;
-
-   ret = iwm_mvm_sta_send_to_fw(sc, in, 0);
-   if (ret)
-   return ret;
-
-   return 0;
+   return iwm_mvm_sta_send_to_fw(sc, in, 0);
 }
 
 static int

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cThu Jun  2 05:00:52 2016
(r301191)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cThu Jun  2 05:43:16 2016
(r301192)
@@ -363,6 +363,8 @@ iwm_prepare_card_hw(struct iwm_softc *sc
if (iwm_set_hw_ready(sc))
goto out;
 
+   DELAY(100);
+
/* If HW is not ready, prepare the conditions to check again */
IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG,
IWM_CSR_HW_IF_CONFIG_REG_PREPARE);
@@ -456,7 +458,7 @@ iwm_apm_init(struct iwm_softc *sc)
IWM_CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000)) {
device_printf(sc->sc_dev,
"timeout waiting for clock stabilization\n");
-
+   error = ETIMEDOUT;
goto out;
}
 

Modified: head/sys/dev/iwm/if_iwm_phy_db.h
==
--- head/sys/dev/iwm/if_iwm_phy_db.hThu Jun  2 05:00:52 2016
(r301191)
+++ head/sys/dev/iwm/if_iwm_phy_db.hThu Jun  2 05:43:16 2016
(r301192)
@@ -106,41 +106,6 @@
 #ifndef__IF_IWM_PHY_DB_H__
 #define__IF_IWM_PHY_DB_H__
 
-enum iwm_phy_db_section_type {
-   IWM_PHY_DB_CFG = 1,
-   IWM_PHY_DB_CALIB_NCH,
-   IWM_PHY_DB_UNUSED,
-   IWM_PHY_DB_CALIB_CHG_PAPD,
-   IWM_PHY_DB_CALIB_CHG_TXP,
-   IWM_PHY_DB_MAX
-};
-
-#define IWM_PHY_DB_CMD 0x6c /* TEMP API - The actual is 0x8c */
-
-/*
- * phy db - configure operational

svn commit: r301195 - head/sys/xen

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 07:45:01 2016
New Revision: 301195
URL: https://svnweb.freebsd.org/changeset/base/301195

Log:
  xen: rewrite Xen error translation
  
  Using the public Xen error code header.
  
  Submitted by: Akshay Jaggi 
  Reviewed by:  royger

Modified:
  head/sys/xen/error.h

Modified: head/sys/xen/error.h
==
--- head/sys/xen/error.hThu Jun  2 07:43:02 2016(r301194)
+++ head/sys/xen/error.hThu Jun  2 07:45:01 2016(r301195)
@@ -29,130 +29,7 @@
 #ifndef __XEN_ERROR_H__
 #define __XEN_ERROR_H__
 
-/* List of Xen error codes */
-#defineXEN_EPERM1  /* Operation not permitted */
-#defineXEN_ENOENT   2  /* No such file or directory */
-#defineXEN_ESRCH3  /* No such process */
-#defineXEN_EINTR4  /* Interrupted system call */
-#defineXEN_EIO  5  /* I/O error */
-#defineXEN_ENXIO6  /* No such device or address */
-#defineXEN_E2BIG7  /* Arg list too long */
-#defineXEN_ENOEXEC  8  /* Exec format error */
-#defineXEN_EBADF9  /* Bad file number */
-#defineXEN_ECHILD  10  /* No child processes */
-#defineXEN_EAGAIN  11  /* Try again */
-#defineXEN_ENOMEM  12  /* Out of memory */
-#defineXEN_EACCES  13  /* Permission denied */
-#defineXEN_EFAULT  14  /* Bad address */
-#defineXEN_ENOTBLK 15  /* Block device required */
-#defineXEN_EBUSY   16  /* Device or resource busy */
-#defineXEN_EEXIST  17  /* File exists */
-#defineXEN_EXDEV   18  /* Cross-device link */
-#defineXEN_ENODEV  19  /* No such device */
-#defineXEN_ENOTDIR 20  /* Not a directory */
-#defineXEN_EISDIR  21  /* Is a directory */
-#defineXEN_EINVAL  22  /* Invalid argument */
-#defineXEN_ENFILE  23  /* File table overflow */
-#defineXEN_EMFILE  24  /* Too many open files */
-#defineXEN_ENOTTY  25  /* Not a typewriter */
-#defineXEN_ETXTBSY 26  /* Text file busy */
-#defineXEN_EFBIG   27  /* File too large */
-#defineXEN_ENOSPC  28  /* No space left on device */
-#defineXEN_ESPIPE  29  /* Illegal seek */
-#defineXEN_EROFS   30  /* Read-only file system */
-#defineXEN_EMLINK  31  /* Too many links */
-#defineXEN_EPIPE   32  /* Broken pipe */
-#defineXEN_EDOM33  /* Math argument out of domain 
of func */
-#defineXEN_ERANGE  34  /* Math result not 
representable */
-#defineXEN_EDEADLK 35  /* Resource deadlock would 
occur */
-#defineXEN_ENAMETOOLONG36  /* File name too long */
-#defineXEN_ENOLCK  37  /* No record locks available */
-#defineXEN_ENOSYS  38  /* Function not implemented */
-#defineXEN_ENOTEMPTY   39  /* Directory not empty */
-#defineXEN_ELOOP   40  /* Too many symbolic links 
encountered */
-#defineXEN_ENOMSG  42  /* No message of desired type */
-#defineXEN_EIDRM   43  /* Identifier removed */
-#defineXEN_ECHRNG  44  /* Channel number out of range 
*/
-#defineXEN_EL2NSYNC45  /* Level 2 not synchronized */
-#defineXEN_EL3HLT  46  /* Level 3 halted */
-#defineXEN_EL3RST  47  /* Level 3 reset */
-#defineXEN_ELNRNG  48  /* Link number out of range */
-#defineXEN_EUNATCH 49  /* Protocol driver not attached 
*/
-#defineXEN_ENOCSI  50  /* No CSI structure available */
-#defineXEN_EL2HLT  51  /* Level 2 halted */
-#defineXEN_EBADE   52  /* Invalid exchange */
-#defineXEN_EBADR   53  /* Invalid request descriptor */
-#defineXEN_EXFULL  54  /* Exchange full */
-#defineXEN_ENOANO  55  /* No anode */
-#defineXEN_EBADRQC 56  /* Invalid request code */
-#defineXEN_EBADSLT 57  /* Invalid slot */
-#defineXEN_EBFONT  59  /* Bad font file format */
-#defineXEN_ENOSTR  60  /* Device not a stream */
-#defineXEN_ENODATA 61  /

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

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Thu Jun  2 04:42:28 2016
New Revision: 301187
URL: https://svnweb.freebsd.org/changeset/base/301187

Log:
  [iwm] add LED blinking for iwm hardware that supports it.
  
  Submitted by: Imre Vadasz 
  Obtained from:DragonflyBSD, Linux iwlwifi/mvm

Added:
  head/sys/dev/iwm/if_iwm_led.c   (contents, props changed)
  head/sys/dev/iwm/if_iwm_led.h   (contents, props changed)
Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Jun  2 04:25:54 2016(r301186)
+++ head/sys/dev/iwm/if_iwm.c   Thu Jun  2 04:42:28 2016(r301187)
@@ -163,6 +163,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 const uint8_t iwm_nvm_channels[] = {
/* 2.4 GHz */
@@ -3515,6 +3516,10 @@ iwm_newstate(struct ieee80211vap *vap, e
ieee80211_state_name[nstate]);
IEEE80211_UNLOCK(ic);
IWM_LOCK(sc);
+
+   if (vap->iv_state == IEEE80211_S_SCAN && nstate != vap->iv_state)
+   iwm_led_blink_stop(sc);
+
/* disable beacon filtering if we're hopping out of RUN */
if (vap->iv_state == IEEE80211_S_RUN && nstate != vap->iv_state) {
iwm_mvm_disable_beacon_filter(sc);
@@ -3829,6 +3834,7 @@ iwm_stop(struct iwm_softc *sc)
sc->sc_flags |= IWM_FLAG_STOPPED;
sc->sc_generation++;
sc->sc_scanband = 0;
+   iwm_led_blink_stop(sc);
sc->sc_tx_timer = 0;
iwm_stop_device(sc);
 }
@@ -4600,6 +4606,7 @@ iwm_attach(device_t dev)
IWM_LOCK_INIT(sc);
mbufq_init(&sc->sc_snd, ifqmaxlen);
callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0);
+   callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0);
TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc);
sc->sc_tq = taskqueue_create("iwm_taskq", M_WAITOK,
 taskqueue_thread_enqueue, &sc->sc_tq);
@@ -4879,13 +4886,23 @@ iwm_scan_start(struct ieee80211com *ic)
device_printf(sc->sc_dev, "could not initiate scan\n");
IWM_UNLOCK(sc);
ieee80211_cancel_scan(vap);
-   } else
+   } else {
+   iwm_led_blink_start(sc);
IWM_UNLOCK(sc);
+   }
 }
 
 static void
 iwm_scan_end(struct ieee80211com *ic)
 {
+   struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+   struct iwm_softc *sc = ic->ic_softc;
+
+   IWM_LOCK(sc);
+   iwm_led_blink_stop(sc);
+   if (vap->iv_state == IEEE80211_S_RUN)
+   iwm_mvm_led_enable(sc);
+   IWM_UNLOCK(sc);
 }
 
 static void
@@ -4982,6 +4999,7 @@ iwm_detach_local(struct iwm_softc *sc, i
taskqueue_drain_all(sc->sc_tq);
taskqueue_free(sc->sc_tq);
}
+   callout_drain(&sc->sc_led_blink_to);
callout_drain(&sc->sc_watchdog_to);
iwm_stop_device(sc);
if (do_net80211)

Added: head/sys/dev/iwm/if_iwm_led.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iwm/if_iwm_led.c   Thu Jun  2 04:42:28 2016
(r301187)
@@ -0,0 +1,182 @@
+/* $OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $ */
+
+/*
+ * Copyright (c) 2014 genua mbh 
+ * Copyright (c) 2014 Fixup Software Ltd.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*-
+ * Based on BSD-licensed source modules in the Linux iwlwifi driver,
+ * which were used as the reference documentation for this implementation.
+ *
+ * Driver version we are currently based off of is
+ * Linux 3.14.3 (tag id a2df521e42b1d9a23f620ac79dbfe8655a8391dd)
+ *
+ ***
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is dist

Re: svn commit: r301071 - head/sys/sys

2016-06-02 Thread Bruce Evans

On Wed, 1 Jun 2016, Konstantin Belousov wrote:


On Wed, Jun 01, 2016 at 05:44:47PM +0200, Ed Schouten wrote:

 ...

 - In our implementation, struct sigevent::sigev_notify_attributes has
   type "void *" instead of "pthread_attr_t *". My guess is that this was
   done to prevent pulling in the pthread types, but this can easily be
   avoided by using the underlying structure types.


Not easily, since the tags of the underlying struct types are in the
application namespace, at least up to POSIX 2001.


Yeah, it's quite unfortunate that we use structure types starting with
'pthread'. They should have had leading underscores. But in my opinion
that's not a problem specific to this change; it's a problem with our
pthread implementation in general.


+#include 


Indeed.  The problem became larger in r146824 when these types started
to be declared unconditionally in .

Another bug in sys/_pthreadtypes.h is that it says that the prefixes
pthread_ and PTHREAD_ are reserved for use in header symbols.  Actually,
they are only reserved for use in .  This shouldn't be documented
in the general header.  The non-broken parts of general header depend on
symbols ending with _t being reserved, not on this.


This gives the following pollution (which breaks almost everything since
 includes this header:
- struct tag names pthread*
- struct member names state and mutex


Yes. It would have made so much more sense if a header like
 would have defined all pthread types as __pthread_t,
__pthread_mutex_t, etc. That way there would have been a way to expose
just pthread_t and pthread_attr_t without pulling in the rest.

No, it wouldn't.


Putting everything in sys/_types.h (or machine/_types.h) is convenient,
and it avoids proliferation of headers, but it gives a different bloat
problem: every header ends up declaring every type, but with an spelling
in the implementation namespace.  Then the number of types almost doubles
when you declare only almost all types again in the application namespace.


Replace the typedefs with the forward-struct names by the void *.
The only other change would be the libthr, where some casts might
be needed.

Use void * directly in signal.h if possible.


Pointers to incomplete structures give more type safety than void *.
Except for the problem with struct tags, just using them is best.  Unlike
for typedefs, we don't need a 5-line ifdef for every use to avoid
redeclaratiion errors.

sys/signal.h seems to use a pthread type just once.  This type can be
declared as 'struct pthread_attr *'.

Actually, signal.h already used the correct method, except this was
obfuscated using a private typedef (__pthread_t), and at some point
when POSIX apparently started explicitly requiring  to
declare pthread_t,  was polluted to match.

We use ifdefs to a fault to minimise the scope of typedefs like size_t.
Not doing this for the pthread types is inconsistent.  For POSIX headers,
it is easiest to declare all typedefs *_t in all headers.  This may
actually be more efficient by avoiding 1 layer of indirect typedefs like
__size_t and 2-3 layers of header convolutions and ifdefs.  The
indirections and convolutuons are still technically needed for non-POSIX
headers.

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


svn commit: r301200 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 11:19:16 2016
New Revision: 301200
URL: https://svnweb.freebsd.org/changeset/base/301200

Log:
  xen-netfront: release grant references used for the shared rings
  
  Just calling gnttab_end_foreign_access_ref doesn't free the references,
  instead call gnttab_end_foreign_access with a NULL page argument in order to
  have the grant references freed. The code that maps the ring
  (xenbus_map_ring) already uses gnttab_grant_foreign_access which takes care
  of allocating a grant reference.
  
  Reviewed by:  Wei Liu 
  Sponsored by: Citrix Systems R&D
  Differential revision:https://reviews.freebsd.org/D6608

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:18:02 2016
(r301199)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:19:16 2016
(r301200)
@@ -663,7 +663,7 @@ disconnect_rxq(struct netfront_rxq *rxq)
 
xn_release_rx_bufs(rxq);
gnttab_free_grant_references(rxq->gref_head);
-   gnttab_end_foreign_access_ref(rxq->ring_ref);
+   gnttab_end_foreign_access(rxq->ring_ref, NULL);
/*
 * No split event channel support at the moment, handle will
 * be unbound in tx. So no need to call xen_intr_unbind here,
@@ -765,7 +765,7 @@ disconnect_txq(struct netfront_txq *txq)
 
xn_release_tx_bufs(txq);
gnttab_free_grant_references(txq->gref_head);
-   gnttab_end_foreign_access_ref(txq->ring_ref);
+   gnttab_end_foreign_access(txq->ring_ref, NULL);
xen_intr_unbind(&txq->xen_intr_handle);
 }
 
@@ -877,7 +877,7 @@ fail_bind_port:
 fail_start_thread:
buf_ring_free(txq->br, M_DEVBUF);
taskqueue_free(txq->tq);
-   gnttab_end_foreign_access_ref(txq->ring_ref);
+   gnttab_end_foreign_access(txq->ring_ref, NULL);
 fail_grant_ring:
gnttab_free_grant_references(txq->gref_head);
free(txq->ring.sring, M_DEVBUF);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 11:14:26 2016
New Revision: 301197
URL: https://svnweb.freebsd.org/changeset/base/301197

Log:
  xen-netfront: always keep the Rx ring full of requests
  
  This is based on Linux commit 1f3c2eba1e2d866ef99bb9b10ade4096e3d7607c from
  David Vrabel:
  
  A full Rx ring only requires 1 MiB of memory.  This is not enough memory
  that it is useful to dynamically scale the number of Rx requests in the ring
  based on traffic rates, because:
  
  a) Even the full 1 MiB is a tiny fraction of a typically modern Linux
 VM (for example, the AWS micro instance still has 1 GiB of memory).
  
  b) Netfront would have used up to 1 MiB already even with moderate
 data rates (there was no adjustment of target based on memory
 pressure).
  
  c) Small VMs are going to typically have one VCPU and hence only one
 queue.
  
  Keeping the ring full of Rx requests handles bursty traffic better than
  trying to converge on an optimal number of requests to keep filled.
  
  Reviewed by:  Wei Liu 
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:12:11 2016
(r301196)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:14:26 2016
(r301197)
@@ -77,6 +77,8 @@ __FBSDID("$FreeBSD$");
 #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE)
 #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE)
 
+#define NET_RX_SLOTS_MIN (XEN_NETIF_NR_SLOTS_MIN + 1)
+
 /*
  * Should the driver do LRO on the RX end
  *  this can be toggled on the fly, but the
@@ -114,6 +116,7 @@ struct netfront_rx_info;
 static void xn_txeof(struct netfront_txq *);
 static void xn_rxeof(struct netfront_rxq *);
 static void xn_alloc_rx_buffers(struct netfront_rxq *);
+static void xn_alloc_rx_buffers_callout(void *arg);
 
 static void xn_release_rx_bufs(struct netfront_rxq *);
 static void xn_release_tx_bufs(struct netfront_txq *);
@@ -182,16 +185,14 @@ struct netfront_rxq {
grant_ref_t grant_ref[NET_TX_RING_SIZE + 1];
 
struct mbuf *mbufs[NET_RX_RING_SIZE + 1];
-   struct mbufqbatch;  /* batch queue */
-   int target;
-
-   xen_pfn_t   pfn_array[NET_RX_RING_SIZE];
 
struct lro_ctrl lro;
 
struct taskqueue*tq;
struct task intrtask;
 
+   struct callout  rx_refill;
+
struct xn_rx_stats  stats;
 };
 
@@ -233,12 +234,6 @@ struct netfront_info {
u_int   carrier;
u_int   maxfrags;
 
-   /* Receive-ring batched refills. */
-#define RX_MIN_TARGET 32
-#define RX_MAX_TARGET NET_RX_RING_SIZE
-   int rx_min_target;
-   int rx_max_target;
-
device_txbdev;
uint8_t mac[ETHER_ADDR_LEN];
 
@@ -687,6 +682,7 @@ static void
 destroy_rxq(struct netfront_rxq *rxq)
 {
 
+   callout_drain(&rxq->rx_refill);
free(rxq->ring.sring, M_DEVBUF);
taskqueue_drain_all(rxq->tq);
taskqueue_free(rxq->tq);
@@ -721,7 +717,6 @@ setup_rxqs(device_t dev, struct netfront
 
rxq->id = q;
rxq->info = info;
-   rxq->target = RX_MIN_TARGET;
rxq->ring_ref = GRANT_REF_INVALID;
rxq->ring.sring = NULL;
snprintf(rxq->name, XN_QUEUE_NAME_LEN, "xnrx_%u", q);
@@ -733,11 +728,9 @@ setup_rxqs(device_t dev, struct netfront
rxq->grant_ref[i] = GRANT_REF_INVALID;
}
 
-   mbufq_init(&rxq->batch, INT_MAX);
-
/* Start resources allocation */
 
-   if (gnttab_alloc_grant_references(RX_MAX_TARGET,
+   if (gnttab_alloc_grant_references(NET_RX_RING_SIZE,
&rxq->gref_head) != 0) {
device_printf(dev, "allocating rx gref");
error = ENOMEM;
@@ -760,6 +753,8 @@ setup_rxqs(device_t dev, struct netfront
rxq->tq = taskqueue_create_fast(rxq->name, M_WAITOK,
taskqueue_thread_enqueue, &rxq->tq);
 
+   callout_init(&rxq->rx_refill, 1);
+
error = taskqueue_start_threads(&rxq->tq, 1, PI_NET,
"%s rxq %d", device_get_nameunit(dev), rxq->id);
if (error != 0) {
@@ -1058,119 +1053,88 @@ xn_release_tx_bufs(struct netfront_txq *
}
 }
 
-static void
-xn_alloc_rx_buffers(struct netfront_rxq *rxq)
+static struct mbuf *
+xn_alloc_one_rx_buffer(struct netfront_rxq *rxq)
 {
-   struct netfront_info *np = rxq->info;
-   int otherend_id = xenbus_get_otherend_id(np->xbdev);
-   unsigned short id;
-   struct mbuf *m_new;
-

svn commit: r301198 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 11:16:35 2016
New Revision: 301198
URL: https://svnweb.freebsd.org/changeset/base/301198

Log:
  xen-netfront: switch to using an interrupt handler
  
  In order to use custom taskqueues we would have to mask the interrupt, which
  is basically what is already done for an interrupt handler, or else we risk
  loosing interrupts. This switches netfront to the same interrupt handling
  that was done before multiqueue support was added.
  
  Reviewed by:  Wei Liu 
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:14:26 2016
(r301197)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:16:35 2016
(r301198)
@@ -121,9 +121,9 @@ static void xn_alloc_rx_buffers_callout(
 static void xn_release_rx_bufs(struct netfront_rxq *);
 static void xn_release_tx_bufs(struct netfront_txq *);
 
-static void xn_rxq_intr(void *);
-static void xn_txq_intr(void *);
-static int  xn_intr(void *);
+static void xn_rxq_intr(struct netfront_rxq *);
+static void xn_txq_intr(struct netfront_txq *);
+static void xn_intr(void *);
 static inline int xn_count_frags(struct mbuf *m);
 static int xn_assemble_tx_request(struct netfront_txq *, struct mbuf *);
 static int xn_ioctl(struct ifnet *, u_long, caddr_t);
@@ -188,9 +188,6 @@ struct netfront_rxq {
 
struct lro_ctrl lro;
 
-   struct taskqueue*tq;
-   struct task intrtask;
-
struct callout  rx_refill;
 
struct xn_rx_stats  stats;
@@ -214,7 +211,6 @@ struct netfront_txq {
struct buf_ring *br;
 
struct taskqueue*tq;
-   struct task intrtask;
struct task defrtask;
 
boolfull;
@@ -621,9 +617,8 @@ talk_to_backend(device_t dev, struct net
 }
 
 static void
-xn_rxq_tq_intr(void *xrxq, int pending)
+xn_rxq_intr(struct netfront_rxq *rxq)
 {
-   struct netfront_rxq *rxq = xrxq;
 
XN_RX_LOCK(rxq);
xn_rxeof(rxq);
@@ -642,9 +637,8 @@ xn_txq_start(struct netfront_txq *txq)
 }
 
 static void
-xn_txq_tq_intr(void *xtxq, int pending)
+xn_txq_intr(struct netfront_txq *txq)
 {
-   struct netfront_txq *txq = xtxq;
 
XN_TX_LOCK(txq);
if (RING_HAS_UNCONSUMED_RESPONSES(&txq->ring))
@@ -684,8 +678,6 @@ destroy_rxq(struct netfront_rxq *rxq)
 
callout_drain(&rxq->rx_refill);
free(rxq->ring.sring, M_DEVBUF);
-   taskqueue_drain_all(rxq->tq);
-   taskqueue_free(rxq->tq);
 }
 
 static void
@@ -749,27 +741,11 @@ setup_rxqs(device_t dev, struct netfront
goto fail_grant_ring;
}
 
-   TASK_INIT(&rxq->intrtask, 0, xn_rxq_tq_intr, rxq);
-   rxq->tq = taskqueue_create_fast(rxq->name, M_WAITOK,
-   taskqueue_thread_enqueue, &rxq->tq);
-
callout_init(&rxq->rx_refill, 1);
-
-   error = taskqueue_start_threads(&rxq->tq, 1, PI_NET,
-   "%s rxq %d", device_get_nameunit(dev), rxq->id);
-   if (error != 0) {
-   device_printf(dev, "failed to start rx taskq %d\n",
-   rxq->id);
-   goto fail_start_thread;
-   }
}
 
return (0);
 
-fail_start_thread:
-   gnttab_end_foreign_access_ref(rxq->ring_ref);
-   taskqueue_drain_all(rxq->tq);
-   taskqueue_free(rxq->tq);
 fail_grant_ring:
gnttab_free_grant_references(rxq->gref_head);
free(rxq->ring.sring, M_DEVBUF);
@@ -871,9 +847,8 @@ setup_txqs(device_t dev, struct netfront
txq->br = buf_ring_alloc(NET_TX_RING_SIZE, M_DEVBUF,
M_WAITOK, &txq->lock);
TASK_INIT(&txq->defrtask, 0, xn_txq_tq_deferred, txq);
-   TASK_INIT(&txq->intrtask, 0, xn_txq_tq_intr, txq);
 
-   txq->tq = taskqueue_create_fast(txq->name, M_WAITOK,
+   txq->tq = taskqueue_create(txq->name, M_WAITOK,
taskqueue_thread_enqueue, &txq->tq);
 
error = taskqueue_start_threads(&txq->tq, 1, PI_NET,
@@ -885,10 +860,9 @@ setup_txqs(device_t dev, struct netfront
}
 
error = xen_intr_alloc_and_bind_local_port(dev,
-   xenbus_get_otherend_id(dev), xn_intr, /* handler */ 
NULL,
-   &info->txq[q],
-   INTR_TYPE_NET | INTR_MPSAFE | INTR_ENTROPY,
-   &txq->xen_intr_handle);
+   xenbus_get_otherend_id(dev), /* filter */ NULL, xn_intr,
+   &info->txq[q], INTR_TYPE_NET | INTR_MPSAFE | INTR_ENTROPY,
+   &txq->xen_intr_handle);
 
if (error != 0) {
device_printf(dev

Re: svn commit: r301198 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
On Thu, Jun 02, 2016 at 11:16:36AM +, Roger Pau Monné wrote:
> Author: royger
> Date: Thu Jun  2 11:16:35 2016
> New Revision: 301198
> URL: https://svnweb.freebsd.org/changeset/base/301198
> 
> Log:
>   xen-netfront: switch to using an interrupt handler
>   
>   In order to use custom taskqueues we would have to mask the interrupt, which
>   is basically what is already done for an interrupt handler, or else we risk
>   loosing interrupts. This switches netfront to the same interrupt handling
>   that was done before multiqueue support was added.
>   
>   Reviewed by:Wei Liu 
>   Sponsored by:   Citrix Systems R&D

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


svn commit: r301203 - head/sys/dev/mrsas

2016-06-02 Thread Kashyap D Desai
Author: kadesai
Date: Thu Jun  2 12:26:55 2016
New Revision: 301203
URL: https://svnweb.freebsd.org/changeset/base/301203

Log:
  Added support for Avago/Broadcom Cutlass(12 Gbps- 16 port count) controllers.
  
  Submitted by:   Sumit Saxena 
  Reviewed by:Kashyap Desai 
  MFC after:  3 days
  Sponsored by:   AVAGO/BROADCOM Limited

Modified:
  head/sys/dev/mrsas/mrsas.c
  head/sys/dev/mrsas/mrsas.h
  head/sys/dev/mrsas/mrsas_cam.c
  head/sys/dev/mrsas/mrsas_fp.c

Modified: head/sys/dev/mrsas/mrsas.c
==
--- head/sys/dev/mrsas/mrsas.c  Thu Jun  2 12:01:58 2016(r301202)
+++ head/sys/dev/mrsas/mrsas.c  Thu Jun  2 12:26:55 2016(r301203)
@@ -188,6 +188,8 @@ MRSAS_CTLR_ID device_table[] = {
{0x1000, MRSAS_FURY, 0x, 0x, "AVAGO Fury SAS Controller"},
{0x1000, MRSAS_INTRUDER, 0x, 0x, "AVAGO Intruder SAS 
Controller"},
{0x1000, MRSAS_INTRUDER_24, 0x, 0x, "AVAGO Intruder_24 SAS 
Controller"},
+   {0x1000, MRSAS_CUTLASS_52, 0x, 0x, "AVAGO Cutlass_52 SAS 
Controller"},
+   {0x1000, MRSAS_CUTLASS_53, 0x, 0x, "AVAGO Cutlass_53 SAS 
Controller"},
{0, 0, 0, 0, NULL}
 };
 
@@ -1630,7 +1632,9 @@ mrsas_complete_cmd(struct mrsas_softc *s
if ((sc->device_id == MRSAS_INVADER) ||
(sc->device_id == MRSAS_FURY) ||
(sc->device_id == MRSAS_INTRUDER) ||
-   (sc->device_id == MRSAS_INTRUDER_24))
+   (sc->device_id == MRSAS_INTRUDER_24) ||
+   (sc->device_id == MRSAS_CUTLASS_52) ||
+   (sc->device_id == MRSAS_CUTLASS_53))
mrsas_write_reg(sc, 
sc->msix_reg_offset[MSIxIndex / 8],
((MSIxIndex & 0x7) << 24) |
sc->last_reply_idx[MSIxIndex]);
@@ -1654,7 +1658,9 @@ mrsas_complete_cmd(struct mrsas_softc *s
if ((sc->device_id == MRSAS_INVADER) ||
(sc->device_id == MRSAS_FURY) ||
(sc->device_id == MRSAS_INTRUDER) ||
-   (sc->device_id == MRSAS_INTRUDER_24)) {
+   (sc->device_id == MRSAS_INTRUDER_24) ||
+   (sc->device_id == MRSAS_CUTLASS_52) ||
+   (sc->device_id == MRSAS_CUTLASS_53)) {
mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex / 8],
((MSIxIndex & 0x7) << 24) |
sc->last_reply_idx[MSIxIndex]);
@@ -2455,7 +2461,9 @@ mrsas_ioc_init(struct mrsas_softc *sc)
if ((sc->device_id == MRSAS_INVADER) ||
(sc->device_id == MRSAS_FURY) ||
(sc->device_id == MRSAS_INTRUDER) ||
-   (sc->device_id == MRSAS_INTRUDER_24)) {
+   (sc->device_id == MRSAS_INTRUDER_24) ||
+   (sc->device_id == MRSAS_CUTLASS_52) ||
+   (sc->device_id == MRSAS_CUTLASS_53)) {
init_frame->driver_operations.
mfi_capabilities.support_additional_msix = 1;
}
@@ -3491,7 +3499,9 @@ mrsas_build_mptmfi_passthru(struct mrsas
if ((sc->device_id == MRSAS_INVADER) ||
(sc->device_id == MRSAS_FURY) ||
(sc->device_id == MRSAS_INTRUDER) ||
-   (sc->device_id == MRSAS_INTRUDER_24)) {
+   (sc->device_id == MRSAS_INTRUDER_24) ||
+   (sc->device_id == MRSAS_CUTLASS_52) ||
+   (sc->device_id == MRSAS_CUTLASS_53)) {
pMpi25IeeeSgeChain64_t sgl_ptr_end = 
(pMpi25IeeeSgeChain64_t)&io_req->SGL;
 
sgl_ptr_end += sc->max_sge_in_main_msg - 1;

Modified: head/sys/dev/mrsas/mrsas.h
==
--- head/sys/dev/mrsas/mrsas.h  Thu Jun  2 12:01:58 2016(r301202)
+++ head/sys/dev/mrsas/mrsas.h  Thu Jun  2 12:26:55 2016(r301203)
@@ -82,6 +82,8 @@ __FBSDID("$FreeBSD$");
 #defineMRSAS_FURY  0x005f
 #defineMRSAS_INTRUDER  0x00ce
 #defineMRSAS_INTRUDER_24   0x00cf
+#defineMRSAS_CUTLASS_520x0052
+#defineMRSAS_CUTLASS_530x0053
 #defineMRSAS_PCI_BAR0  0x10
 #defineMRSAS_PCI_BAR1  0x14
 #defineMRSAS_PCI_BAR2  0x1C

Modified: head/sys/dev/mrsas/mrsas_cam.c
==
--- head/sys/dev/mrsas/mrsas_cam.c  Thu Jun  2 12:01:58 2016
(r301202)
+++ head/sys/dev/mrsas/mrsas_cam.c  Thu Jun  2 12:26:55 2016
(r301203)
@@ -880,7 +880,9 @@ mrsas_setup_io(struct mrsas_softc *sc, s
if ((sc->device_id == MRSAS_INVADER) ||
(sc->device_id == MRSAS_FURY) ||
(sc->devic

svn commit: r301201 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 11:21:00 2016
New Revision: 301201
URL: https://svnweb.freebsd.org/changeset/base/301201

Log:
  xen-netfront: perform an interface reset when changing options
  
  The PV backend will only pick the new options when the interface is detached
  and reattached again, so perform a full reset when changing options. This is
  very fast, and should not be noticeable by the user.
  
  Reviewed by:  Wei Liu 
  Sponsored by: Citrix Systems R&D
  Differential revision:https://reviews.freebsd.org/D6658

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:19:16 2016
(r301200)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 11:21:00 2016
(r301201)
@@ -237,7 +237,7 @@ struct netfront_info {
 
struct ifmedia  sc_media;
 
-   boolxn_resume;
+   boolxn_reset;
 };
 
 struct netfront_rx_info {
@@ -458,7 +458,6 @@ netfront_resume(device_t dev)
 {
struct netfront_info *info = device_get_softc(dev);
 
-   info->xn_resume = true;
netif_disconnect_backend(info);
return (0);
 }
@@ -590,10 +589,19 @@ talk_to_backend(device_t dev, struct net
message = "writing feature-sg";
goto abort_transaction;
}
-   err = xs_printf(xst, node, "feature-gso-tcpv4", "%d", 1);
-   if (err != 0) {
-   message = "writing feature-gso-tcpv4";
-   goto abort_transaction;
+   if ((info->xn_ifp->if_capenable & IFCAP_LRO) != 0) {
+   err = xs_printf(xst, node, "feature-gso-tcpv4", "%d", 1);
+   if (err != 0) {
+   message = "writing feature-gso-tcpv4";
+   goto abort_transaction;
+   }
+   }
+   if ((info->xn_ifp->if_capenable & IFCAP_RXCSUM) == 0) {
+   err = xs_printf(xst, node, "feature-no-csum-offload", "%d", 1);
+   if (err != 0) {
+   message = "writing feature-no-csum-offload";
+   goto abort_transaction;
+   }
}
 
err = xs_transaction_end(xst, 0);
@@ -960,7 +968,6 @@ netfront_backend_changed(device_t dev, X
case XenbusStateInitialising:
case XenbusStateInitialised:
case XenbusStateUnknown:
-   case XenbusStateClosed:
case XenbusStateReconfigured:
case XenbusStateReconfiguring:
break;
@@ -974,6 +981,13 @@ netfront_backend_changed(device_t dev, X
case XenbusStateClosing:
xenbus_set_state(dev, XenbusStateClosed);
break;
+   case XenbusStateClosed:
+   if (sc->xn_reset) {
+   netif_disconnect_backend(sc);
+   xenbus_set_state(dev, XenbusStateInitialising);
+   sc->xn_reset = false;
+   }
+   break;
case XenbusStateConnected:
 #ifdef INET
netfront_send_fake_arp(dev, sc);
@@ -1739,11 +1753,14 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, 
 {
struct netfront_info *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *) data;
+   device_t dev;
 #ifdef INET
struct ifaddr *ifa = (struct ifaddr *)data;
 #endif
-
int mask, error = 0;
+
+   dev = sc->xbdev;
+
switch(cmd) {
case SIOCSIFADDR:
 #ifdef INET
@@ -1820,6 +1837,31 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, 
ifp->if_capenable ^= IFCAP_LRO;
 
}
+   /*
+* We must reset the interface so the backend picks up the
+* new features.
+*/
+   XN_LOCK(sc);
+   netfront_carrier_off(sc);
+   sc->xn_reset = true;
+   /*
+* NB: the pending packet queue is not flushed, since
+* the interface should still support the old options.
+*/
+   XN_UNLOCK(sc);
+   /*
+* Delete the xenstore nodes that export features.
+*
+* NB: There's a xenbus state called
+* "XenbusStateReconfiguring", which is what we should set
+* here. Sadly none of the backends know how to handle it,
+* and simply disconnect from the frontend, so we will just
+* switch back to XenbusStateInitialising in order to force
+* a reconnection.
+*/
+   xs_rm(XST_NIL, xenbus_get_node(dev), "feature-gso-tcpv4");
+   xs_rm(XST_NIL, xenbus_get_node(dev), "feature-no-csum-offload");
+   xenbus_set_state(dev, XenbusStateClosing);
break;
case SIOCADDMULTI:
case SIOCDELMULTI:

svn commit: r301205 - head/sys/riscv/riscv

2016-06-02 Thread Ruslan Bukin
Author: br
Date: Thu Jun  2 15:14:40 2016
New Revision: 301205
URL: https://svnweb.freebsd.org/changeset/base/301205

Log:
  Fix typos.

Modified:
  head/sys/riscv/riscv/elf_machdep.c

Modified: head/sys/riscv/riscv/elf_machdep.c
==
--- head/sys/riscv/riscv/elf_machdep.c  Thu Jun  2 14:25:10 2016
(r301204)
+++ head/sys/riscv/riscv/elf_machdep.c  Thu Jun  2 15:14:40 2016
(r301205)
@@ -1,7 +1,7 @@
 /*-
  * Copyright 1996-1998 John D. Polstra.
  * Copyright (c) 2015 Ruslan Bukin 
- * Copyright (c) 2016 Yukishige SHibata 
+ * Copyright (c) 2016 Yukishige Shibata 
  * All rights reserved.
  *
  * Portions of this software were developed by SRI International and the
@@ -132,7 +132,7 @@ SYSCTL_INT(_kern, OID_AUTO, debug_kld,
 
 struct type2str_ent {
int type;
-   const char* str;
+   const char *str;
 };
 
 void
@@ -203,28 +203,28 @@ insert_imm(uint32_t insn, uint32_t imm, 
 }
 
 /*
- * The RISCV ISA is designed so that all of immediate value is
- * sign-extened.
+ * The RISC-V ISA is designed so that all of immediate values are
+ * sign-extended.
  * An immediate value is sometimes generated at runtime by adding
  * 12bit sign integer and 20bit signed integer. This requests 20bit
  * immediate value to be ajusted if the MSB of the 12bit immediate
- * value is asserted (sign extened value is treated as negative value).
+ * value is asserted (sign-extended value is treated as negative value).
  *
  * For example, 0x123800 can be calculated by adding upper 20 bit of
- * 0x124000 and signed-extended 12bit immediate whose bit pattern is
- * 0x800 as follows;
+ * 0x124000 and sign-extended 12bit immediate whose bit pattern is
+ * 0x800 as follows:
  *   0x123800
  * = 0x123000 + 0x800
  * = (0x123000 + 0x1000) + (-0x1000 + 0x800)
  * = (0x123000 + 0x1000) + (0xff...ff800)
- * = 0x124000+ sign-exntend(0x800)
+ * = 0x124000+ sign-extention(0x800)
  */
 static uint32_t
 calc_hi20_imm(uint32_t value)
 {
/*
 * There is the arithmetical hack that can remove conditional
-* statement. But I implement it in straghtforward way.
+* statement. But I implement it in straightforward way.
 */
if ((value & 0x800) != 0)
value += 0x1000;
@@ -246,7 +246,7 @@ static const struct type2str_ent t2s[] =
{ R_RISCV_LO12_S,   "R_RISCV_LO12_S"},
 };
 
-static const char*
+static const char *
 reloctype_to_str(int type)
 {
int i;
@@ -373,7 +373,7 @@ elf_reloc_internal(linker_file_t lf, Elf
return -1;
val = addr - (Elf_Addr)where;
if ((val <= -(1UL << 32) || (1UL << 32) <= val)) {
-   printf("kldload:%s: huge offset against 
R_RISCV_CALL\n");
+   printf("kldload: huge offset against R_RISCV_CALL\n");
return -1;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301206 - head/sys/dev/usb/net

2016-06-02 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jun  2 15:30:58 2016
New Revision: 301206
URL: https://svnweb.freebsd.org/changeset/base/301206

Log:
  usb/uhso: Don't bail out on first USB error.
  
  CID:  1305680
  Submitted by: hselasky
  MFC after:3 days

Modified:
  head/sys/dev/usb/net/uhso.c

Modified: head/sys/dev/usb/net/uhso.c
==
--- head/sys/dev/usb/net/uhso.c Thu Jun  2 15:14:40 2016(r301205)
+++ head/sys/dev/usb/net/uhso.c Thu Jun  2 15:30:58 2016(r301206)
@@ -1225,6 +1225,7 @@ uhso_mux_write_callback(struct usb_xfer 
ht->ht_muxport);
/* FALLTHROUGH */
case USB_ST_SETUP:
+tr_setup:
pc = usbd_xfer_get_frame(xfer, 1);
if (ucom_get_data(&sc->sc_ucom[ht->ht_muxport], pc,
0, 32, &actlen)) {
@@ -1255,7 +1256,8 @@ uhso_mux_write_callback(struct usb_xfer 
UHSO_DPRINTF(0, "error: %s\n", usbd_errstr(error));
if (error == USB_ERR_CANCELLED)
break;
-   break;
+   usbd_xfer_set_stall(xfer);
+   goto tr_setup;
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Hans Petter Selasky

On 06/02/16 16:28, Roger Pau Monné wrote:

Thanks for the clarification. I did get the impression that callout_reset
already distributed the callbacks across the number of available CPUs, maybe
the man page should be expanded to explain this?


Hi,

It makes sense that callout_reset() should distribute callouts by 
default, though I can imagine that that there are applications which 
depend on a strict callback order for timeouts.


+1

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


Re: svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
On Thu, Jun 02, 2016 at 03:01:03PM +0200, Hans Petter Selasky wrote:
> On 06/02/16 14:54, Roger Pau Monné wrote:
> > On Thu, Jun 02, 2016 at 01:19:56PM +0200, Hans Petter Selasky wrote:
> > > On 06/02/16 13:14, Roger Pau Monné wrote:
> > > > +   callout_reset(&rxq->rx_refill, hz/10, 
> > > > xn_alloc_rx_buffers_callout,
> > > > +   rxq);
> > > 
> > > Maybe use callout_reset_curcpu() to take advantage of callout's SMP
> > > capabilities ?
> > 
> > Yes, that's fine. But what's the benefit of it? I don't really care whether
> > the callout is run on the current CPU or not. Is callout_reset_curcpu
> > cheaper than callout_reset?
> > 
> 
> Hi,
> 
> It is maybe not cheaper, but it will distribute the load of the
> xn_alloc_rx_buffers_callout() callback, to the current CPU calling
> callout_reset_curcpu(). Else xn_alloc_rx_buffers_callout() will always be
> called from callback thread zero.

Thanks for the clarification. I did get the impression that callout_reset 
already distributed the callbacks across the number of available CPUs, maybe 
the man page should be expanded to explain this?

I've committed the change as r301204.

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


svn commit: r301204 - head/sys/dev/xen/netfront

2016-06-02 Thread Roger Pau Monné
Author: royger
Date: Thu Jun  2 14:25:10 2016
New Revision: 301204
URL: https://svnweb.freebsd.org/changeset/base/301204

Log:
  xen-netfront: use callout_reset_curcpu instead of callout_reset
  
  This should help distribute the load of the callbacks.
  
  Suggested by: hps
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cThu Jun  2 12:26:55 2016
(r301203)
+++ head/sys/dev/xen/netfront/netfront.cThu Jun  2 14:25:10 2016
(r301204)
@@ -1101,8 +1101,8 @@ xn_alloc_rx_buffers(struct netfront_rxq 
 
/* Not enough requests? Try again later. */
if (req_prod - rxq->ring.rsp_cons < NET_RX_SLOTS_MIN) {
-   callout_reset(&rxq->rx_refill, hz/10, 
xn_alloc_rx_buffers_callout,
-   rxq);
+   callout_reset_curcpu(&rxq->rx_refill, hz/10,
+   xn_alloc_rx_buffers_callout, rxq);
return;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301197 - head/sys/dev/xen/netfront

2016-06-02 Thread Hans Petter Selasky

On 06/02/16 13:14, Roger Pau Monné wrote:

+   callout_reset(&rxq->rx_refill, hz/10, 
xn_alloc_rx_buffers_callout,
+   rxq);


Maybe use callout_reset_curcpu() to take advantage of callout's SMP 
capabilities ?


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

svn commit: r301202 - head/sys/dev/usb/wlan

2016-06-02 Thread Andriy Voskoboinyk
Author: avos
Date: Thu Jun  2 12:01:58 2016
New Revision: 301202
URL: https://svnweb.freebsd.org/changeset/base/301202

Log:
  urtw: fix unused variable assignments.
  
  Append CWmax and retry limitation to tp->maxretry instead of rewriting it
  (will restore pre-r198194 behavior).
  
  Noticed by:   pfg, hps
  
  Reported by:  Coverity
  CID:  1304937, 1304920

Modified:
  head/sys/dev/usb/wlan/if_urtw.c

Modified: head/sys/dev/usb/wlan/if_urtw.c
==
--- head/sys/dev/usb/wlan/if_urtw.c Thu Jun  2 11:21:00 2016
(r301201)
+++ head/sys/dev/usb/wlan/if_urtw.c Thu Jun  2 12:01:58 2016
(r301202)
@@ -1789,8 +1789,8 @@ urtw_tx_start(struct urtw_softc *sc, str
flags |= (urtw_rate2rtl(11) & 0xf) << 
URTW_TX_FLAG_RTSRATE_SHIFT;
tx->flag = htole32(flags);
tx->retry = 3;  /* CW minimum  */
-   tx->retry = 7 << 4; /* CW maximum  */
-   tx->retry = URTW_TX_MAXRETRY << 8;  /* retry limitation  */
+   tx->retry |= 7 << 4;/* CW maximum  */
+   tx->retry |= URTW_TX_MAXRETRY << 8; /* retry limitation  */
m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1));
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301210 - head/sys/vm

2016-06-02 Thread Mark Johnston
Author: markj
Date: Thu Jun  2 16:58:47 2016
New Revision: 301210
URL: https://svnweb.freebsd.org/changeset/base/301210

Log:
  Don't preserve the page's object linkage in vm_page_insert_after().
  
  Per the KASSERT at the beginning of the function, we expect that the page
  does not belong to any object, so its object and pindex fields are
  meaningless. Reset them in the rare case that vm_radix_insert() fails.
  
  Reviewed by:  kib
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D6669

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Jun  2 16:40:09 2016(r301209)
+++ head/sys/vm/vm_page.c   Thu Jun  2 16:58:47 2016(r301210)
@@ -1112,8 +1112,6 @@ static int
 vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex,
 vm_page_t mpred)
 {
-   vm_pindex_t sidx;
-   vm_object_t sobj;
vm_page_t msucc;
 
VM_OBJECT_ASSERT_WLOCKED(object);
@@ -1134,8 +1132,6 @@ vm_page_insert_after(vm_page_t m, vm_obj
/*
 * Record the object/offset pair in this page
 */
-   sobj = m->object;
-   sidx = m->pindex;
m->object = object;
m->pindex = pindex;
 
@@ -1143,8 +1139,8 @@ vm_page_insert_after(vm_page_t m, vm_obj
 * Now link into the object's ordered list of backed pages.
 */
if (vm_radix_insert(&object->rtree, m)) {
-   m->object = sobj;
-   m->pindex = sidx;
+   m->object = NULL;
+   m->pindex = 0;
return (1);
}
vm_page_insert_radixdone(m, object, mpred);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301212 - head/sys/vm

2016-06-02 Thread Mark Johnston
Author: markj
Date: Thu Jun  2 17:11:24 2016
New Revision: 301212
URL: https://svnweb.freebsd.org/changeset/base/301212

Log:
  Reset the page busy lock state after failing to insert into the object.
  
  Freeing a shared-busy page is not permitted.
  
  Reviewed by:  kib
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D6670

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Jun  2 17:08:08 2016(r301211)
+++ head/sys/vm/vm_page.c   Thu Jun  2 17:11:24 2016(r301212)
@@ -1748,6 +1748,7 @@ vm_page_alloc(vm_object_t object, vm_pin
}
m->object = NULL;
m->oflags = VPO_UNMANAGED;
+   m->busy_lock = VPB_UNBUSIED;
vm_page_free(m);
return (NULL);
}
@@ -1949,6 +1950,7 @@ retry:
m->object = NULL;
m->oflags |= VPO_UNMANAGED;
}
+   m->busy_lock = VPB_UNBUSIED;
vm_page_free(m);
}
return (NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301213 - head/sys/netinet6

2016-06-02 Thread Mark Johnston
Author: markj
Date: Thu Jun  2 17:17:15 2016
New Revision: 301213
URL: https://svnweb.freebsd.org/changeset/base/301213

Log:
  Always start IPv6 DAD asynchronously.
  
  Otherwise we transmit the first neighbour solicitation in the context of the
  caller of nd6_dad_start(), which can easily result in lock recursion. When
  DAD is to be started after some delay, we send the first NS from the DAD
  callout handler, so just change the implementation to do this in the
  non-delayed case as well.
  
  Reviewed by:  ae, hrs
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6639

Modified:
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/netinet6/nd6_nbr.c
==
--- head/sys/netinet6/nd6_nbr.c Thu Jun  2 17:11:24 2016(r301212)
+++ head/sys/netinet6/nd6_nbr.c Thu Jun  2 17:17:15 2016(r301213)
@@ -1216,7 +1216,6 @@ nd6_dad_start(struct ifaddr *ifa, int de
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
struct dadq *dp;
char ip6buf[INET6_ADDRSTRLEN];
-   int send_ns;
 
/*
 * If we don't need DAD, don't do it.
@@ -1290,12 +1289,7 @@ nd6_dad_start(struct ifaddr *ifa, int de
dp->dad_ns_lcount = dp->dad_loopbackprobe = 0;
refcount_init(&dp->dad_refcnt, 1);
nd6_dad_add(dp);
-   send_ns = 0;
-   if (delay == 0) {
-   send_ns = 1;
-   delay = (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000;
-   }
-   nd6_dad_starttimer(dp, delay, send_ns);
+   nd6_dad_starttimer(dp, delay, 0);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301214 - head/sys/netinet6

2016-06-02 Thread Mark Johnston
Author: markj
Date: Thu Jun  2 17:21:57 2016
New Revision: 301214
URL: https://svnweb.freebsd.org/changeset/base/301214

Log:
  Exploit r301213 to fix in6 ifaddr locking in pfxlist_onlink_check().
  
  Reviewed by:  ae, hrs
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6639

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Thu Jun  2 17:17:15 2016(r301213)
+++ head/sys/netinet6/nd6_rtr.c Thu Jun  2 17:21:57 2016(r301214)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1437,12 +1438,13 @@ find_pfxlist_reachable_router(struct nd_
  * is no router around us.
  */
 void
-pfxlist_onlink_check()
+pfxlist_onlink_check(void)
 {
struct nd_prefix *pr;
struct in6_ifaddr *ifa;
struct nd_defrouter *dr;
struct nd_pfxrouter *pfxrtr = NULL;
+   struct rm_priotracker in6_ifa_tracker;
 
/*
 * Check if there is a prefix that has a reachable advertising
@@ -1573,9 +1575,8 @@ pfxlist_onlink_check()
 * detached.  Note, however, that a manually configured address should
 * always be attached.
 * The precise detection logic is same as the one for prefixes.
-*
-* XXXRW: in6_ifaddrhead locking.
 */
+   IN6_IFADDR_RLOCK(&in6_ifa_tracker);
TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) {
if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF))
continue;
@@ -1610,8 +1611,7 @@ pfxlist_onlink_check()
ifa->ia6_flags |= IN6_IFF_DETACHED;
}
}
-   }
-   else {
+   } else {
TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) {
if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0)
continue;
@@ -1624,6 +1624,7 @@ pfxlist_onlink_check()
}
}
}
+   IN6_IFADDR_RUNLOCK(&in6_ifa_tracker);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301215 - head/lib/libc/iconv

2016-06-02 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jun  2 17:28:39 2016
New Revision: 301215
URL: https://svnweb.freebsd.org/changeset/base/301215

Log:
  citrus: Remove redundant code in _citrus_esdb_get_list().
  
  It appears "sorted" may have not been implemented. Sorted or not,
  we always follow the same action so simplify the code.
  Leave a note for future generations.
  
  CID:  1347084

Modified:
  head/lib/libc/iconv/citrus_esdb.c

Modified: head/lib/libc/iconv/citrus_esdb.c
==
--- head/lib/libc/iconv/citrus_esdb.c   Thu Jun  2 17:21:57 2016
(r301214)
+++ head/lib/libc/iconv/citrus_esdb.c   Thu Jun  2 17:28:39 2016
(r301215)
@@ -291,18 +291,12 @@ _citrus_esdb_get_list(char ***rlist, siz
 
/* get alias entries */
while ((ret = _lookup_seq_next(cla, &key, &data)) == 0) {
-   if (sorted)
-   snprintf(buf, sizeof(buf), "%.*s/%.*s",
-   (int)_region_size(&data),
-   (const char *)_region_head(&data),
-   (int)_region_size(&key),
-   (const char *)_region_head(&key));
-   else
-   snprintf(buf, sizeof(buf), "%.*s/%.*s",
-   (int)_region_size(&data),
-   (const char *)_region_head(&data),
-   (int)_region_size(&key),
-   (const char *)_region_head(&key));
+   /* XXX: sorted? */
+   snprintf(buf, sizeof(buf), "%.*s/%.*s",
+   (int)_region_size(&data),
+   (const char *)_region_head(&data),
+   (int)_region_size(&key),
+   (const char *)_region_head(&key));
_bcs_convert_to_upper(buf);
list[num] = strdup(buf);
if (list[num] == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301216 - head/usr.bin/sockstat

2016-06-02 Thread Michael Tuexen
Author: tuexen
Date: Thu Jun  2 17:31:37 2016
New Revision: 301216
URL: https://svnweb.freebsd.org/changeset/base/301216

Log:
  Fix two types which resulted in setting the address long wrong
  for IPv6 addresses.
  
  Reported by:  pfg@
  CID:  1347086
  MFC after:1 week

Modified:
  head/usr.bin/sockstat/sockstat.c

Modified: head/usr.bin/sockstat/sockstat.c
==
--- head/usr.bin/sockstat/sockstat.cThu Jun  2 17:28:39 2016
(r301215)
+++ head/usr.bin/sockstat/sockstat.cThu Jun  2 17:31:37 2016
(r301216)
@@ -390,7 +390,7 @@ gather_sctp(void)
if (sock->family == AF_INET)
sock->laddr->address.ss_len = sizeof(struct 
sockaddr_in);
else
-   sock->laddr->address.ss_len = sizeof(struct 
sockaddr_in);
+   sock->laddr->address.ss_len = sizeof(struct 
sockaddr_in6);
local_all_loopback = 0;
}
if ((sock->faddr = calloc(1, sizeof(struct addr))) == NULL)
@@ -399,7 +399,7 @@ gather_sctp(void)
if (sock->family == AF_INET)
sock->faddr->address.ss_len = sizeof(struct 
sockaddr_in);
else
-   sock->faddr->address.ss_len = sizeof(struct 
sockaddr_in);
+   sock->faddr->address.ss_len = sizeof(struct 
sockaddr_in6);
no_stcb = 1;
while (offset < len) {
xstcb = (struct xsctp_tcb *)(void *)(buf + offset);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301217 - in head/sys: net netinet netinet6

2016-06-02 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jun  2 17:51:29 2016
New Revision: 301217
URL: https://svnweb.freebsd.org/changeset/base/301217

Log:
  This change re-adds L2 caching for TCP and UDP, as originally added in D4306
  but removed due to other changes in the system. Restore the llentry pointer
  to the "struct route", and use it to cache the L2 lookup (ARP or ND6) as
  appropriate.
  
  Submitted by: Mike Karels
  Differential Revision:https://reviews.freebsd.org/D6262

Modified:
  head/sys/net/flowtable.c
  head/sys/net/if_arcsubr.c
  head/sys/net/if_ethersubr.c
  head/sys/net/if_fddisubr.c
  head/sys/net/if_fwsubr.c
  head/sys/net/if_iso88025subr.c
  head/sys/net/if_llatbl.h
  head/sys/net/route.c
  head/sys/net/route.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/if_ether.h
  head/sys/netinet/in_pcb.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/toecore.c
  head/sys/netinet6/in6.h
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h

Modified: head/sys/net/flowtable.c
==
--- head/sys/net/flowtable.cThu Jun  2 17:31:37 2016(r301216)
+++ head/sys/net/flowtable.cThu Jun  2 17:51:29 2016(r301217)
@@ -696,13 +696,8 @@ flowtable_lookup(sa_family_t sa, struct 
ro->ro_rt = fle->f_rt;
ro->ro_flags |= RT_NORTREF;
lle = fle->f_lle;
-   if (lle != NULL && (lle->la_flags & LLE_VALID)) {
-   ro->ro_prepend = lle->r_linkdata;
-   ro->ro_plen = lle->r_hdrlen;
-   ro->ro_flags |= RT_MAY_LOOP;
-   if (lle->la_flags & LLE_IFADDR)
-   ro->ro_flags |= RT_L2_ME;
-   }
+   if (lle != NULL && (lle->la_flags & LLE_VALID))
+   ro->ro_lle = lle;   /* share ref with fle->f_lle */
 
return (0);
 }

Modified: head/sys/net/if_arcsubr.c
==
--- head/sys/net/if_arcsubr.c   Thu Jun  2 17:31:37 2016(r301216)
+++ head/sys/net/if_arcsubr.c   Thu Jun  2 17:51:29 2016(r301217)
@@ -129,7 +129,8 @@ arc_output(struct ifnet *ifp, struct mbu
else if (ifp->if_flags & IFF_NOARP)
adst = ntohl(SIN(dst)->sin_addr.s_addr) & 0xFF;
else {
-   error = arpresolve(ifp, is_gw, m, dst, &adst, NULL);
+   error = arpresolve(ifp, is_gw, m, dst, &adst, NULL,
+   NULL);
if (error)
return (error == EWOULDBLOCK ? 0 : error);
}
@@ -170,7 +171,8 @@ arc_output(struct ifnet *ifp, struct mbu
if ((m->m_flags & M_MCAST) != 0)
adst = arcbroadcastaddr; /* ARCnet broadcast address */
else {
-   error = nd6_resolve(ifp, is_gw, m, dst, &adst, NULL);
+   error = nd6_resolve(ifp, is_gw, m, dst, &adst, NULL,
+   NULL);
if (error != 0)
return (error == EWOULDBLOCK ? 0 : error);
}

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Thu Jun  2 17:31:37 2016(r301216)
+++ head/sys/net/if_ethersubr.c Thu Jun  2 17:51:29 2016(r301217)
@@ -199,7 +199,7 @@ ether_requestencap(struct ifnet *ifp, st
 static int
 ether_resolve_addr(struct ifnet *ifp, struct mbuf *m,
const struct sockaddr *dst, struct route *ro, u_char *phdr,
-   uint32_t *pflags)
+   uint32_t *pflags, struct llentry **plle)
 {
struct ether_header *eh;
uint32_t lleflags = 0;
@@ -208,13 +208,16 @@ ether_resolve_addr(struct ifnet *ifp, st
uint16_t etype;
 #endif
 
+   if (plle)
+   *plle = NULL;
eh = (struct ether_header *)phdr;
 
switch (dst->sa_family) {
 #ifdef INET
case AF_INET:
if ((m->m_flags & (M_BCAST | M_MCAST)) == 0)
-   error = arpresolve(ifp, 0, m, dst, phdr, &lleflags);
+   error = arpresolve(ifp, 0, m, dst, phdr, &lleflags,
+   plle);
else {
if (m->m_flags & M_BCAST)
memcpy(eh->ether_dhost, ifp->if_broadcastaddr,
@@ -233,7 +236,8 @@ ether_resolve_addr(struct ifnet *ifp, st
 #ifdef INET6
case AF_INET6:
if ((m->m_flags & M_MCAST) == 0)
-   error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags);
+   error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags,
+   plle);
else {
const struct in6_addr *a6;
a6 = &(((const struct sockaddr_in6 *)dst)->sin6_addr);
@@ -283,14 +287,40 @@ ether_ou

svn commit: r301218 - head/sys/boot/fdt/dts/arm

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:24:00 2016
New Revision: 301218
URL: https://svnweb.freebsd.org/changeset/base/301218

Log:
  Revert part of r294418 ("Correct ranges...")
  
  Commit was temporary fix due to rman_res_t defined as 32-bit u_long.
  After redefining it as 64-bit variable workaround is not needed and
  was removed.
  
  Submitted by: Bartosz Szczepanek 
  Obtained from:Semihalf
  Sponsored by: Stormshield
  Differential revision:https://reviews.freebsd.org/D6214

Modified:
  head/sys/boot/fdt/dts/arm/armada-388-gp.dts

Modified: head/sys/boot/fdt/dts/arm/armada-388-gp.dts
==
--- head/sys/boot/fdt/dts/arm/armada-388-gp.dts Thu Jun  2 17:51:29 2016
(r301217)
+++ head/sys/boot/fdt/dts/arm/armada-388-gp.dts Thu Jun  2 18:24:00 2016
(r301218)
@@ -59,7 +59,7 @@
};
 
soc {
-   ranges = <0 0 0xf100 0x10>;
+   ranges = ;
 
internal-regs {
spi@10600 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301219 - head/contrib/blacklist/bin

2016-06-02 Thread Kurt Lidl
Author: lidl
Date: Thu Jun  2 18:25:32 2016
New Revision: 301219
URL: https://svnweb.freebsd.org/changeset/base/301219

Log:
  Fixup path in NetBSD supplied documentation for FreeBSD
  
  NetBSD installs the blacklist-helper script in /libexec, and
  it goes into /usr/libexec on FreeBSD.  Update the docs to
  match FreeBSD's installation location.
  
  Reviewed by:  rpaulo
  Approved by:  rpaulo
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6592

Modified:
  head/contrib/blacklist/bin/blacklistd.8

Modified: head/contrib/blacklist/bin/blacklistd.8
==
--- head/contrib/blacklist/bin/blacklistd.8 Thu Jun  2 18:24:00 2016
(r301218)
+++ head/contrib/blacklist/bin/blacklistd.8 Thu Jun  2 18:25:32 2016
(r301219)
@@ -117,7 +117,7 @@ The following options are available:
 Use
 .Ar controlprog
 to communicate with the packet filter, usually
-.Pa /libexec/blacklistd-helper .
+.Pa /usr/libexec/blacklistd-helper .
 The following arguments are passed to the control program:
 .Bl -tag -width protocol
 .It action
@@ -199,8 +199,8 @@ instead of
 .Xr syslogd 8 .
 .El
 .Sh FILES
-.Bl -tag -width /libexec/blacklistd-helper -compact
-.It Pa /libexec/blacklistd-helper
+.Bl -tag -width /usr/libexec/blacklistd-helper -compact
+.It Pa /usr/libexec/blacklistd-helper
 Shell script invoked to interface with the packet filter.
 .It Pa /etc/blacklistd.conf
 Configuration file.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301220 - in head/sys: arm/mv dev/cesa

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:31:36 2016
New Revision: 301220
URL: https://svnweb.freebsd.org/changeset/base/301220

Log:
  Map CESA SRAM memory in driver attach for Armada38x
  
  On other platforms with CESA accelerator the SRAM memory is mapped in
  early init before driver is attached. This method only works correctly
  with mappings no smaller than L1 section size (1MB). There may be more
  SRAM blocks and they may have smaller sizes than 1MB as is the case
  for Armada38x. Instead, map SRAM memory with bus_space_map() in CESA
  driver attach. Note that we can no longer assume that VA == PA for the
  SRAM.
  
  Submitted by: Michal Stanek https://reviews.freebsd.org/D6215

Modified:
  head/sys/arm/mv/mv_machdep.c
  head/sys/dev/cesa/cesa.c
  head/sys/dev/cesa/cesa.h

Modified: head/sys/arm/mv/mv_machdep.c
==
--- head/sys/arm/mv/mv_machdep.cThu Jun  2 18:25:32 2016
(r301219)
+++ head/sys/arm/mv/mv_machdep.cThu Jun  2 18:31:36 2016
(r301220)
@@ -283,7 +283,7 @@ static struct devmap_entry fdt_devmap[FD
 static int
 platform_sram_devmap(struct devmap_entry *map)
 {
-#if !defined(SOC_MV_ARMADAXP)
+#if !defined(SOC_MV_ARMADAXP) && !defined(SOC_MV_ARMADA38X)
phandle_t child, root;
u_long base, size;
/*

Modified: head/sys/dev/cesa/cesa.c
==
--- head/sys/dev/cesa/cesa.cThu Jun  2 18:25:32 2016(r301219)
+++ head/sys/dev/cesa/cesa.cThu Jun  2 18:31:36 2016(r301220)
@@ -27,15 +27,15 @@
 /*
  * CESA SRAM Memory Map:
  *
- * ++ <= sc->sc_sram_base + CESA_SRAM_SIZE
+ * ++ <= sc->sc_sram_base_va + CESA_SRAM_SIZE
  * ||
  * |  DATA  |
  * ||
- * ++ <= sc->sc_sram_base + CESA_DATA(0)
+ * ++ <= sc->sc_sram_base_va + CESA_DATA(0)
  * |  struct cesa_sa_data   |
  * ++
  * |  struct cesa_sa_hdesc  |
- * ++ <= sc->sc_sram_base
+ * ++ <= sc->sc_sram_base_va
  */
 
 #include 
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -373,7 +374,7 @@ static struct cesa_tdma_desc *
 cesa_tdma_copyin_sa_data(struct cesa_softc *sc, struct cesa_request *cr)
 {
 
-   return (cesa_tdma_copy(sc, sc->sc_sram_base +
+   return (cesa_tdma_copy(sc, sc->sc_sram_base_pa +
sizeof(struct cesa_sa_hdesc), cr->cr_csd_paddr,
sizeof(struct cesa_sa_data)));
 }
@@ -382,7 +383,7 @@ static struct cesa_tdma_desc *
 cesa_tdma_copyout_sa_data(struct cesa_softc *sc, struct cesa_request *cr)
 {
 
-   return (cesa_tdma_copy(sc, cr->cr_csd_paddr, sc->sc_sram_base +
+   return (cesa_tdma_copy(sc, cr->cr_csd_paddr, sc->sc_sram_base_pa +
sizeof(struct cesa_sa_hdesc), sizeof(struct cesa_sa_data)));
 }
 
@@ -390,7 +391,7 @@ static struct cesa_tdma_desc *
 cesa_tdma_copy_sdesc(struct cesa_softc *sc, struct cesa_sa_desc *csd)
 {
 
-   return (cesa_tdma_copy(sc, sc->sc_sram_base, csd->csd_cshd_paddr,
+   return (cesa_tdma_copy(sc, sc->sc_sram_base_pa, csd->csd_cshd_paddr,
sizeof(struct cesa_sa_hdesc)));
 }
 
@@ -566,14 +567,14 @@ cesa_fill_packet(struct cesa_softc *sc, 
bsize = MIN(seg->ds_len, cp->cp_size - cp->cp_offset);
 
if (bsize > 0) {
-   ctd = cesa_tdma_copy(sc, sc->sc_sram_base +
+   ctd = cesa_tdma_copy(sc, sc->sc_sram_base_pa +
CESA_DATA(cp->cp_offset), seg->ds_addr, bsize);
if (!ctd)
return (-ENOMEM);
 
STAILQ_INSERT_TAIL(&cp->cp_copyin, ctd, ctd_stq);
 
-   ctd = cesa_tdma_copy(sc, seg->ds_addr, sc->sc_sram_base +
+   ctd = cesa_tdma_copy(sc, seg->ds_addr, sc->sc_sram_base_pa +
CESA_DATA(cp->cp_offset), bsize);
if (!ctd)
return (-ENOMEM);
@@ -950,22 +951,33 @@ cesa_setup_sram(struct cesa_softc *sc)
 {
phandle_t sram_node;
ihandle_t sram_ihandle;
-   pcell_t sram_handle, sram_reg;
+   pcell_t sram_handle, sram_reg[2];
+   int rv;
 
-   if (OF_getprop(ofw_bus_get_node(sc->sc_dev), "sram-handle",
-   (void *)&sram_handle, sizeof(sram_handle)) <= 0)
-   return (ENXIO);
+   rv = OF_getprop(ofw_bus_get_node(sc->sc_dev), "sram-handle",
+   (void *)&sram_handle, sizeof(sram_handle));
+   if (rv <= 0)
+   return (rv);
 
sram_ihandle = (ihandle_t)sram_handle;
sram_ihandle = fdt32_to_cpu(sram_ihandle);
sram_node = OF_instance_to_package(sram_ihandle);
 
-   if (OF_getprop(sram_node, "reg", (void *)&sram_reg,
-   sizeof(sram_reg)) <= 0)
-   return (ENXIO);
-
-

svn commit: r301221 - head/sys/arm/mv

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:33:26 2016
New Revision: 301221
URL: https://svnweb.freebsd.org/changeset/base/301221

Log:
  Configure CPU window to second CESA SRAM
  
  Check if there is a second CESA SRAM node in FDT and add a CPU window
  for it. Define A38X specific macro for setting device attribute for
  each node.
  
  Submitted by: Michal Stanek 
  Obtained from:Semihalf
  Sponsored by: Stormshield
  Differential revision:https://reviews.freebsd.org/D6216

Modified:
  head/sys/arm/mv/mv_common.c
  head/sys/arm/mv/mvwin.h

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Thu Jun  2 18:31:36 2016(r301220)
+++ head/sys/arm/mv/mv_common.c Thu Jun  2 18:33:26 2016(r301221)
@@ -2107,6 +2107,37 @@ moveon:
return (EINVAL);
 
cpu_win_tbl[t].target = MV_WIN_CESA_TARGET;
+#ifdef SOC_MV_ARMADA38X
+   cpu_win_tbl[t].attr = MV_WIN_CESA_ATTR(0);
+#else
+   cpu_win_tbl[t].attr = MV_WIN_CESA_ATTR(1);
+#endif
+   cpu_win_tbl[t].base = sram_base;
+   cpu_win_tbl[t].size = sram_size;
+   cpu_win_tbl[t].remap = ~0;
+   cpu_wins_no++;
+   debugf("sram: base = 0x%0lx size = 0x%0lx\n", sram_base, sram_size);
+
+   /* Check if there is a second CESA node */
+   while ((node = OF_peer(node)) != 0) {
+   if (fdt_is_compatible(node, "mrvl,cesa-sram")) {
+   if (fdt_regsize(node, &sram_base, &sram_size) != 0)
+   return (EINVAL);
+   break;
+   }
+   }
+
+   if (node == 0)
+   return (0);
+
+   t++;
+   if (t >= ((sizeof(cpu_win_tbl))/(sizeof(cpu_win_tbl[0] {
+   debugf("cannot fit CESA tuple into cpu_win_tbl\n");
+   return (ENOMEM);
+   }
+
+   /* Configure window for CESA1 */
+   cpu_win_tbl[t].target = MV_WIN_CESA_TARGET;
cpu_win_tbl[t].attr = MV_WIN_CESA_ATTR(1);
cpu_win_tbl[t].base = sram_base;
cpu_win_tbl[t].size = sram_size;

Modified: head/sys/arm/mv/mvwin.h
==
--- head/sys/arm/mv/mvwin.h Thu Jun  2 18:31:36 2016(r301220)
+++ head/sys/arm/mv/mvwin.h Thu Jun  2 18:33:26 2016(r301221)
@@ -233,6 +233,19 @@
  *  2: engine0
  */
 #define MV_WIN_CESA_ATTR(eng_sel)  (1 | ((eng_sel) << 2))
+#elif defined(SOC_MV_ARMADA38X)
+#define MV_WIN_CESA_TARGET 9
+/*
+ * Bits [1:0] = Data swapping
+ *  0x0 = Byte swap
+ *  0x1 = No swap
+ *  0x2 = Byte and word swap
+ *  0x3 = Word swap
+ * Bits [4:2] = CESA select:
+ *  0x6 = CESA0
+ *  0x5 = CESA1
+ */
+#define MV_WIN_CESA_ATTR(eng_sel)  (0x11 | (1 << (3 - (eng_sel
 #else
 #define MV_WIN_CESA_TARGET 3
 #define MV_WIN_CESA_ATTR(eng_sel)  0
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301222 - in head/sys: boot/fdt/dts/arm dev/cesa

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:35:35 2016
New Revision: 301222
URL: https://svnweb.freebsd.org/changeset/base/301222

Log:
  Split CESA memory resource into TDMA and CESA regs
  
  TDMA and CESA registers are placed in different ranges of memory. Split
  memory resource in DTS to reflect that. This change is needed to support
  multiple CESA nodes as otherwise the ranges of different nodes would
  overlap.
  
  In consequence, CESA_WRITE and CESA_READ macros have been split depending
  on which range of registers is accessed. Offsets for CESA registers have
  been modified as the base address has changed.
  
  Submitted by: Michal Stanek 
  Obtained from:Semihalf
  Sponsored by: Stormshield
  Differential revision:https://reviews.freebsd.org/D6217

Modified:
  head/sys/boot/fdt/dts/arm/db78100.dts
  head/sys/boot/fdt/dts/arm/db88f6281.dts
  head/sys/boot/fdt/dts/arm/dockstar.dts
  head/sys/boot/fdt/dts/arm/dreamplug-1001.dts
  head/sys/boot/fdt/dts/arm/dreamplug-1001N.dts
  head/sys/boot/fdt/dts/arm/sheevaplug.dts
  head/sys/dev/cesa/cesa.c
  head/sys/dev/cesa/cesa.h

Modified: head/sys/boot/fdt/dts/arm/db78100.dts
==
--- head/sys/boot/fdt/dts/arm/db78100.dts   Thu Jun  2 18:33:26 2016
(r301221)
+++ head/sys/boot/fdt/dts/arm/db78100.dts   Thu Jun  2 18:35:35 2016
(r301222)
@@ -283,7 +283,8 @@
 
crypto@9 {
compatible = "mrvl,cesa";
-   reg = <0x9 0x1>;
+   reg = <0x9 0x1000   /* tdma base reg chan 0 */
+  0x9D000 0x1000>; /* cesa base reg chan 0 */
interrupts = <19>;
interrupt-parent = <&PIC>;
};

Modified: head/sys/boot/fdt/dts/arm/db88f6281.dts
==
--- head/sys/boot/fdt/dts/arm/db88f6281.dts Thu Jun  2 18:33:26 2016
(r301221)
+++ head/sys/boot/fdt/dts/arm/db88f6281.dts Thu Jun  2 18:35:35 2016
(r301222)
@@ -221,7 +221,8 @@
 
crypto@3 {
compatible = "mrvl,cesa";
-   reg = <0x3 0x1>;
+   reg = <0x3 0x1000   /* tdma base reg chan 0 */
+  0x3D000 0x1000>; /* cesa base reg chan 0 */
interrupts = <22>;
interrupt-parent = <&PIC>;
 

Modified: head/sys/boot/fdt/dts/arm/dockstar.dts
==
--- head/sys/boot/fdt/dts/arm/dockstar.dts  Thu Jun  2 18:33:26 2016
(r301221)
+++ head/sys/boot/fdt/dts/arm/dockstar.dts  Thu Jun  2 18:35:35 2016
(r301222)
@@ -206,7 +206,8 @@
 
crypto@3 {
compatible = "mrvl,cesa";
-   reg = <0x3 0x1>;
+   reg = <0x3 0x1000   /* tdma base reg chan 0 */
+  0x3D000 0x1000>; /* cesa base reg chan 0 */
interrupts = <22>;
interrupt-parent = <&PIC>;
 

Modified: head/sys/boot/fdt/dts/arm/dreamplug-1001.dts
==
--- head/sys/boot/fdt/dts/arm/dreamplug-1001.dtsThu Jun  2 18:33:26 
2016(r301221)
+++ head/sys/boot/fdt/dts/arm/dreamplug-1001.dtsThu Jun  2 18:35:35 
2016(r301222)
@@ -270,7 +270,8 @@
 
crypto@3 {
compatible = "mrvl,cesa";
-   reg = <0x3 0x1>;
+   reg = <0x3 0x1000   /* tdma base reg chan 0 */
+  0x3D000 0x1000>; /* cesa base reg chan 0 */
interrupts = <22>;
interrupt-parent = <&PIC>;
 

Modified: head/sys/boot/fdt/dts/arm/dreamplug-1001N.dts
==
--- head/sys/boot/fdt/dts/arm/dreamplug-1001N.dts   Thu Jun  2 18:33:26 
2016(r301221)
+++ head/sys/boot/fdt/dts/arm/dreamplug-1001N.dts   Thu Jun  2 18:35:35 
2016(r301222)
@@ -291,7 +291,8 @@
 
crypto@3 {
compatible = "mrvl,cesa";
-   reg = <0x3 0x1>;
+   reg = <0x3 0x1000   /* tdma base reg chan 0 */
+  0x3D000 0x1000>; /* cesa base reg chan 0 */
interrupts = <22>;
interrupt-parent = <&PIC>;
 

Modified: head/sys/boot/fdt/dts/arm/sheevaplug.dts
==
--- head/sys/boot/fdt/dts/arm/sheevaplug.dtsThu Jun  2 18:33:26 2016
(r301221)
+++ head/sys/boot/fdt/dts/arm/sheevaplug.dtsThu Jun  2 18:35:35 2

svn commit: r301223 - head/sys/dev/cesa

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:37:50 2016
New Revision: 301223
URL: https://svnweb.freebsd.org/changeset/base/301223

Log:
  Truncate HMAC output only if requested by the client
  
  The output of HMAC was previously truncated to 12 bytes. This was only
  correct in case of one particular crypto client - the new version of IPSEC.
  Fix by taking into account the cri_mlen field in cryptoini session request
  filled in by the client.
  
  Submitted by: Michal Stanek 
  Obtained from:Semihalf
  Sponsored by: Stormshield
  Differential revision:https://reviews.freebsd.org/D6218

Modified:
  head/sys/dev/cesa/cesa.c
  head/sys/dev/cesa/cesa.h

Modified: head/sys/dev/cesa/cesa.c
==
--- head/sys/dev/cesa/cesa.cThu Jun  2 18:35:35 2016(r301222)
+++ head/sys/dev/cesa/cesa.cThu Jun  2 18:37:50 2016(r301223)
@@ -1451,24 +1451,32 @@ cesa_newsession(device_t dev, uint32_t *
if (!error && mac) {
switch (mac->cri_alg) {
case CRYPTO_MD5:
-   cs->cs_config |= CESA_CSHD_MD5;
cs->cs_mblen = 1;
-   cs->cs_hlen = MD5_HASH_LEN;
+   cs->cs_hlen = (mac->cri_mlen == 0) ? MD5_HASH_LEN :
+   mac->cri_mlen;
+   cs->cs_config |= CESA_CSHD_MD5;
break;
case CRYPTO_MD5_HMAC:
-   cs->cs_config |= CESA_CSHD_MD5_HMAC;
cs->cs_mblen = MD5_HMAC_BLOCK_LEN;
-   cs->cs_hlen = CESA_HMAC_HASH_LENGTH;
+   cs->cs_hlen = (mac->cri_mlen == 0) ? MD5_HASH_LEN :
+   mac->cri_mlen;
+   cs->cs_config |= CESA_CSHD_MD5_HMAC;
+   if (cs->cs_hlen == CESA_HMAC_TRUNC_LEN)
+   cs->cs_config |= CESA_CSHD_96_BIT_HMAC;
break;
case CRYPTO_SHA1:
-   cs->cs_config |= CESA_CSHD_SHA1;
cs->cs_mblen = 1;
-   cs->cs_hlen = SHA1_HASH_LEN;
+   cs->cs_hlen = (mac->cri_mlen == 0) ? SHA1_HASH_LEN :
+   mac->cri_mlen;
+   cs->cs_config |= CESA_CSHD_SHA1;
break;
case CRYPTO_SHA1_HMAC:
-   cs->cs_config |= CESA_CSHD_SHA1_HMAC;
cs->cs_mblen = SHA1_HMAC_BLOCK_LEN;
-   cs->cs_hlen = CESA_HMAC_HASH_LENGTH;
+   cs->cs_hlen = (mac->cri_mlen == 0) ? SHA1_HASH_LEN :
+   mac->cri_mlen;
+   cs->cs_config |= CESA_CSHD_SHA1_HMAC;
+   if (cs->cs_hlen == CESA_HMAC_TRUNC_LEN)
+   cs->cs_config |= CESA_CSHD_96_BIT_HMAC;
break;
default:
error = EINVAL;

Modified: head/sys/dev/cesa/cesa.h
==
--- head/sys/dev/cesa/cesa.hThu Jun  2 18:35:35 2016(r301222)
+++ head/sys/dev/cesa/cesa.hThu Jun  2 18:37:50 2016(r301223)
@@ -68,7 +68,7 @@
 #define CESA_TDMA_DESCRIPTORS  (CESA_TDMA_DESC_PER_REQ * CESA_REQUESTS)
 
 /* Useful constants */
-#define CESA_HMAC_HASH_LENGTH  12
+#define CESA_HMAC_TRUNC_LEN12
 #define CESA_MAX_FRAGMENTS 64
 #define CESA_SRAM_SIZE 2048
 
@@ -293,8 +293,10 @@ struct cesa_chain_info {
 
 #define CESA_CSHD_MD5  (4 << 4)
 #define CESA_CSHD_SHA1 (5 << 4)
-#define CESA_CSHD_MD5_HMAC ((6 << 4) | (1 << 7))
-#define CESA_CSHD_SHA1_HMAC((7 << 4) | (1 << 7))
+#define CESA_CSHD_MD5_HMAC (6 << 4)
+#define CESA_CSHD_SHA1_HMAC(7 << 4)
+
+#define CESA_CSHD_96_BIT_HMAC  (1 << 7)
 
 #define CESA_CSHD_DES  (1 << 8)
 #define CESA_CSHD_3DES (2 << 8)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301224 - head/sys/dev/cesa

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:39:33 2016
New Revision: 301224
URL: https://svnweb.freebsd.org/changeset/base/301224

Log:
  Add HMAC-SHA256 support in CESA
  
  Only HMAC-SHA256 is added as it is the only SHA-2 variant supported by
  cryptodev. It is not possible to register hardware support for other
  algorithms in the family including regular non-keyed SHA256.
  
  Submitted by: Michal Stanek 
  Obtained from:Semihalf
  Sponsored by: Stormshield
  Differential revision:https://reviews.freebsd.org/D6219

Modified:
  head/sys/dev/cesa/cesa.c
  head/sys/dev/cesa/cesa.h

Modified: head/sys/dev/cesa/cesa.c
==
--- head/sys/dev/cesa/cesa.cThu Jun  2 18:37:50 2016(r301223)
+++ head/sys/dev/cesa/cesa.cThu Jun  2 18:39:33 2016(r301224)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "cryptodev_if.h"
@@ -449,6 +450,7 @@ cesa_set_mkey(struct cesa_session *cs, i
uint8_t ipad[CESA_MAX_HMAC_BLOCK_LEN];
uint8_t opad[CESA_MAX_HMAC_BLOCK_LEN];
SHA1_CTX sha1ctx;
+   SHA256_CTX sha256ctx;
MD5_CTX md5ctx;
uint32_t *hout;
uint32_t *hin;
@@ -481,6 +483,14 @@ cesa_set_mkey(struct cesa_session *cs, i
SHA1Update(&sha1ctx, opad, SHA1_HMAC_BLOCK_LEN);
memcpy(hout, sha1ctx.h.b32, sizeof(sha1ctx.h.b32));
break;
+   case CRYPTO_SHA2_256_HMAC:
+   SHA256_Init(&sha256ctx);
+   SHA256_Update(&sha256ctx, ipad, SHA2_256_HMAC_BLOCK_LEN);
+   memcpy(hin, sha256ctx.state, sizeof(sha256ctx.state));
+   SHA256_Init(&sha256ctx);
+   SHA256_Update(&sha256ctx, opad, SHA2_256_HMAC_BLOCK_LEN);
+   memcpy(hout, sha256ctx.state, sizeof(sha256ctx.state));
+   break;
default:
return (EINVAL);
}
@@ -541,6 +551,7 @@ cesa_is_hash(int alg)
case CRYPTO_MD5_HMAC:
case CRYPTO_SHA1:
case CRYPTO_SHA1_HMAC:
+   case CRYPTO_SHA2_256_HMAC:
return (1);
default:
return (0);
@@ -942,7 +953,11 @@ cesa_execute(struct cesa_softc *sc)
ctd = STAILQ_FIRST(&cr->cr_tdesc);
 
CESA_TDMA_WRITE(sc, CESA_TDMA_ND, ctd->ctd_cthd_paddr);
+#if defined (SOC_MV_ARMADA38X)
+   CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE | CESA_SA_CMD_SHA2);
+#else
CESA_REG_WRITE(sc, CESA_SA_CMD, CESA_SA_CMD_ACTVATE);
+#endif
 
CESA_UNLOCK(sc, requests);
 }
@@ -1174,6 +1189,9 @@ cesa_attach(device_t dev)
 */
CESA_TDMA_WRITE(sc, CESA_TDMA_CR, CESA_TDMA_CR_DBL128 |
CESA_TDMA_CR_SBL128 | CESA_TDMA_CR_ORDEN | CESA_TDMA_CR_NBS |
+#if defined (SOC_MV_ARMADA38X)
+   CESA_TDMA_NUM_OUTSTAND |
+#endif
CESA_TDMA_CR_ENABLE);
 
/*
@@ -1208,6 +1226,7 @@ cesa_attach(device_t dev)
crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0);
crypto_register(sc->sc_cid, CRYPTO_SHA1, 0, 0);
crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0);
+   crypto_register(sc->sc_cid, CRYPTO_SHA2_256_HMAC, 0, 0);
 
return (0);
 err8:
@@ -1478,6 +1497,12 @@ cesa_newsession(device_t dev, uint32_t *
if (cs->cs_hlen == CESA_HMAC_TRUNC_LEN)
cs->cs_config |= CESA_CSHD_96_BIT_HMAC;
break;
+   case CRYPTO_SHA2_256_HMAC:
+   cs->cs_mblen = SHA2_256_HMAC_BLOCK_LEN;
+   cs->cs_hlen = (mac->cri_mlen == 0) ? SHA2_256_HASH_LEN :
+   mac->cri_mlen;
+   cs->cs_config |= CESA_CSHD_SHA2_256_HMAC;
+   break;
default:
error = EINVAL;
break;

Modified: head/sys/dev/cesa/cesa.h
==
--- head/sys/dev/cesa/cesa.hThu Jun  2 18:37:50 2016(r301223)
+++ head/sys/dev/cesa/cesa.hThu Jun  2 18:39:33 2016(r301224)
@@ -74,11 +74,9 @@
 
 /*
  * CESA_MAX_HASH_LEN is maximum length of hash generated by CESA.
- * As CESA suports only MD5 and SHA1 this equals to 20 bytes.
- * However we increase the value to 24 bytes to meet alignment
- * requirements in cesa_sa_data structure.
+ * As CESA supports MD5, SHA1 and SHA-256 this equals to 32 bytes.
  */
-#define CESA_MAX_HASH_LEN  24
+#define CESA_MAX_HASH_LEN  32
 #define CESA_MAX_KEY_LEN   32
 #define CESA_MAX_IV_LEN16
 #define CESA_MAX_HMAC_BLOCK_LEN64
@@ -293,8 +291,10 @@ struct cesa_chain_info {
 
 #define CESA_CSHD_MD5  (4 << 4)
 #define CESA_CSHD_SHA1 (5 << 4)
+#define CESA_CSHD_SHA2_256 (1 << 4)
 #define CESA_CSHD_MD5_HMAC (6 << 4)
 #define CESA_CSHD_SHA1

svn commit: r301225 - in head/sys: arm/conf boot/fdt/dts/arm dev/cesa

2016-06-02 Thread Zbigniew Bodek
Author: zbb
Date: Thu Jun  2 18:41:33 2016
New Revision: 301225
URL: https://svnweb.freebsd.org/changeset/base/301225

Log:
  Add support for CESA on Armada38x
  
  Changes:
  - added new SoC ID in CESA attach
  - allowed crypto driver IDs other than 0
  - added CESA nodes to Armada38x .dts files
  - enabled required devices in kernconf
  
  Submitted by: Michal Stanek 
  Obtained from:Semihalf
  Sponsored by: Stormshield
  Differential revision:https://reviews.freebsd.org/D6220

Modified:
  head/sys/arm/conf/ARMADA38X
  head/sys/boot/fdt/dts/arm/armada-388-gp.dts
  head/sys/boot/fdt/dts/arm/armada-38x.dtsi
  head/sys/dev/cesa/cesa.c

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Thu Jun  2 18:39:33 2016(r301224)
+++ head/sys/arm/conf/ARMADA38X Thu Jun  2 18:41:33 2016(r301225)
@@ -81,6 +81,11 @@ device   iic
 device iicbus
 device twsi
 
+# CESA
+device cesa
+device crypto
+device cryptodev
+
 #FDT
 optionsFDT
 optionsFDT_DTB_STATIC

Modified: head/sys/boot/fdt/dts/arm/armada-388-gp.dts
==
--- head/sys/boot/fdt/dts/arm/armada-388-gp.dts Thu Jun  2 18:39:33 2016
(r301224)
+++ head/sys/boot/fdt/dts/arm/armada-388-gp.dts Thu Jun  2 18:41:33 2016
(r301225)
@@ -62,6 +62,13 @@
ranges = ;
 
internal-regs {
+   crypto@9 {
+   status = "okay";
+   };
+   crypto@92000 {
+   status = "okay";
+   };
+
spi@10600 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;

Modified: head/sys/boot/fdt/dts/arm/armada-38x.dtsi
==
--- head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Thu Jun  2 18:39:33 2016
(r301224)
+++ head/sys/boot/fdt/dts/arm/armada-38x.dtsi   Thu Jun  2 18:41:33 2016
(r301225)
@@ -63,6 +63,8 @@
gpio1 = &gpio1;
serial0 = &uart0;
serial1 = &uart1;
+   sram0 = &SRAM0;
+   sram1 = &SRAM1;
};
 
pmu {
@@ -70,6 +72,16 @@
interrupts-extended = <&mpic 3>;
};
 
+   SRAM0: sram@f110 {
+   compatible = "mrvl,cesa-sram";
+   reg = <0xf110 0x001>;
+   };
+
+   SRAM1: sram@f111 {
+   compatible = "mrvl,cesa-sram";
+   reg = <0xf111 0x001>;
+   };
+
soc {
compatible = "marvell,armada380-mbus", "simple-bus";
#address-cells = <2>;
@@ -140,6 +152,25 @@
#size-cells = <1>;
ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x10>;
 
+   crypto@9 {
+   compatible = "mrvl,cesa";
+   reg = <0x9 0x1>;
+   interrupts = ;
+   interrupt-parent = <&gic>;
+   sram-handle = <&SRAM0>;
+   status = "disabled";
+   };
+
+   crypto@92000 {
+   compatible = "mrvl,cesa";
+   reg = <0x92000 0x1000   /* tdma base reg chan 1 
*/
+  0x9F000 0x1000>; /* cesa base reg chan 1 
*/
+   interrupts = ;
+   interrupt-parent = <&gic>;
+   sram-handle = <&SRAM1>;
+   status = "disabled";
+   };
+
L2: cache-controller@8000 {
compatible = "arm,pl310-cache";
reg = <0x8000 0x1000>;

Modified: head/sys/dev/cesa/cesa.c
==
--- head/sys/dev/cesa/cesa.cThu Jun  2 18:39:33 2016(r301224)
+++ head/sys/dev/cesa/cesa.cThu Jun  2 18:41:33 2016(r301225)
@@ -1043,6 +1043,7 @@ cesa_attach(device_t dev)
switch (d) {
case MV_DEV_88F6281:
case MV_DEV_88F6282:
+   case MV_DEV_88F6828:
sc->sc_tperr = 0;
break;
case MV_DEV_MV78100:
@@ -1214,7 +1215,7 @@ cesa_attach(device_t dev)
 
/* Register in OCF */
sc->sc_cid = crypto_get_driverid(dev, CRYPTOCAP_F_HARDWARE);
-   if (sc->sc_cid) {
+   if (sc->sc_cid < 0) {
device_printf(dev, "could not get crypto driver id\n");
goto err8;
}

Re: svn commit: r301220 - in head/sys: arm/mv dev/cesa

2016-06-02 Thread Ian Lepore
On Thu, 2016-06-02 at 18:31 +, Zbigniew Bodek wrote:
> Author: zbb
> Date: Thu Jun  2 18:31:36 2016
> New Revision: 301220
> URL: https://svnweb.freebsd.org/changeset/base/301220
> 
> Log:
>   Map CESA SRAM memory in driver attach for Armada38x
>   
>   On other platforms with CESA accelerator the SRAM memory is mapped
> in
>   early init before driver is attached. This method only works
> correctly
>   with mappings no smaller than L1 section size (1MB). There may be
> more
>   SRAM blocks and they may have smaller sizes than 1MB as is the case
>   for Armada38x. Instead, map SRAM memory with bus_space_map() in
> CESA
>   driver attach. Note that we can no longer assume that VA == PA for
> the
>   SRAM.
>   
>   Submitted by:   Michal StanekObtained from:  Semihalf
>   Sponsored by:   Stormshield
>   Differential revision:  https://reviews.freebsd.org/D6215
> [...]
> -
> + rv = OF_getprop(sram_node, "reg", (void *)sram_reg,
> sizeof(sram_reg));
> + if (rv <= 0)
> + return (rv);
> +
> + sc->sc_sram_base_pa = fdt32_to_cpu(sram_reg[0]);
> + /* Store SRAM size to be able to unmap in detach() */
> + sc->sc_sram_size = fdt32_to_cpu(sram_reg[1]);
> +

OF_getprop() followed by fdt32_to_cpu() calls is properly spelled
OF_getencprop() (with no fdt32_to_cpu calls).

> +#if defined(SOC_MV_ARMADA38X)
> + /* SRAM memory was not mapped in platform_sram_devmap(), map
> it now */
> + rv = bus_space_map(fdtbus_bs_tag, sc->sc_sram_base_pa, sc
> ->sc_sram_size,
> + 0, &(sc->sc_sram_base_va));

bus_space_map() returns a bus_space_handle_t for use with other
bus_space functions.  The handle is not necessarily "just the virtual
address" (although that happens to be the case right now on arm).  I
don't see any bus_space_x() calls using this handle, that means
that probably the correct function to use is pmap_mapdev(), not
bus_space_map().

-- Ian

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


Re: svn commit: r301220 - in head/sys: arm/mv dev/cesa

2016-06-02 Thread Zbigniew Bodek
2016-06-02 20:48 GMT+02:00 Ian Lepore :

> On Thu, 2016-06-02 at 18:31 +, Zbigniew Bodek wrote:
> > Author: zbb
> > Date: Thu Jun  2 18:31:36 2016
> > New Revision: 301220
> > URL: https://svnweb.freebsd.org/changeset/base/301220
> >
> > Log:
> >   Map CESA SRAM memory in driver attach for Armada38x
> >
> >   On other platforms with CESA accelerator the SRAM memory is mapped
> > in
> >   early init before driver is attached. This method only works
> > correctly
> >   with mappings no smaller than L1 section size (1MB). There may be
> > more
> >   SRAM blocks and they may have smaller sizes than 1MB as is the case
> >   for Armada38x. Instead, map SRAM memory with bus_space_map() in
> > CESA
> >   driver attach. Note that we can no longer assume that VA == PA for
> > the
> >   SRAM.
> >
> >   Submitted by:   Michal Stanek  >   Obtained from:  Semihalf
> >   Sponsored by:   Stormshield
> >   Differential revision:  https://reviews.freebsd.org/D6215
> > [...]
> > -
> > + rv = OF_getprop(sram_node, "reg", (void *)sram_reg,
> > sizeof(sram_reg));
> > + if (rv <= 0)
> > + return (rv);
> > +
> > + sc->sc_sram_base_pa = fdt32_to_cpu(sram_reg[0]);
> > + /* Store SRAM size to be able to unmap in detach() */
> > + sc->sc_sram_size = fdt32_to_cpu(sram_reg[1]);
> > +
>
> OF_getprop() followed by fdt32_to_cpu() calls is properly spelled
> OF_getencprop() (with no fdt32_to_cpu calls).
>
> > +#if defined(SOC_MV_ARMADA38X)
> > + /* SRAM memory was not mapped in platform_sram_devmap(), map
> > it now */
> > + rv = bus_space_map(fdtbus_bs_tag, sc->sc_sram_base_pa, sc
> > ->sc_sram_size,
> > + 0, &(sc->sc_sram_base_va));
>
> bus_space_map() returns a bus_space_handle_t for use with other
> bus_space functions.  The handle is not necessarily "just the virtual
> address" (although that happens to be the case right now on arm).  I
> don't see any bus_space_x() calls using this handle, that means
> that probably the correct function to use is pmap_mapdev(), not
> bus_space_map().
>
> -- Ian
>
> Thanks Ian,

We will fix this ASAP.
BTW. It would be better to get this review prior to committing the patch
;-)
Phabricator revision didn't attract anyone's attention:
https://reviews.freebsd.org/D6215

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


svn commit: r301226 - in head: etc etc/defaults etc/periodic/security etc/rc.d lib lib/libblacklist libexec libexec/blacklistd-helper share/mk tools/build/mk usr.sbin usr.sbin/blacklistctl usr.sbin...

2016-06-02 Thread Kurt Lidl
Author: lidl
Date: Thu Jun  2 19:06:04 2016
New Revision: 301226
URL: https://svnweb.freebsd.org/changeset/base/301226

Log:
  Add basic blacklist build support
  
  Reviewed by:  rpaulo
  Approved by:  rpaulo
  Relnotes: YES
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5913

Added:
  head/etc/blacklistd.conf   (contents, props changed)
  head/etc/rc.d/blacklistd   (contents, props changed)
  head/lib/libblacklist/
  head/lib/libblacklist/Makefile   (contents, props changed)
  head/libexec/blacklistd-helper/
  head/libexec/blacklistd-helper/Makefile   (contents, props changed)
  head/usr.sbin/blacklistctl/
  head/usr.sbin/blacklistctl/Makefile   (contents, props changed)
  head/usr.sbin/blacklistd/
  head/usr.sbin/blacklistd/Makefile   (contents, props changed)
Modified:
  head/etc/Makefile
  head/etc/defaults/rc.conf
  head/etc/periodic/security/520.pfdenied
  head/etc/rc.d/Makefile
  head/lib/Makefile
  head/libexec/Makefile
  head/share/mk/bsd.libnames.mk
  head/share/mk/src.libnames.mk
  head/share/mk/src.opts.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Thu Jun  2 18:41:33 2016(r301225)
+++ head/etc/Makefile   Thu Jun  2 19:06:04 2016(r301226)
@@ -86,6 +86,10 @@ BIN1+= apmd.conf
 BIN1+= auto_master
 .endif
 
+.if ${MK_BLACKLIST_SUPPORT} != "no"
+BIN1+= blacklistd.conf
+.endif
+
 .if ${MK_FREEBSD_UPDATE} != "no"
 BIN1+= freebsd-update.conf
 .endif

Added: head/etc/blacklistd.conf
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/blacklistd.confThu Jun  2 19:06:04 2016(r301226)
@@ -0,0 +1,17 @@
+# $FreeBSD$
+#
+# Blacklist rule
+# adr/mask:porttypeproto   owner   namenfail   disable
+[local]
+sshstream  *   *   *   3   24h
+ftpstream  *   *   *   3   24h
+smtp   stream  *   *   *   3   24h
+submission stream  *   *   *   3   24h
+#6161  stream  tcp6christos*   2   10m
+*  *   *   *   *   3   60
+
+# adr/mask:porttypeproto   owner   namenfail   disable
+[remote]
+#129.168.0.0/16*   *   *   =   *   *
+#6161  =   =   =   =/24=   =
+#* stream  tcp *   =   =   =

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Thu Jun  2 18:41:33 2016(r301225)
+++ head/etc/defaults/rc.conf   Thu Jun  2 19:06:04 2016(r301226)
@@ -270,6 +270,8 @@ hastd_program="/sbin/hastd" # path to ha
 hastd_flags="" # Optional flags to hastd.
 ctld_enable="NO"   # CAM Target Layer / iSCSI target daemon.
 local_unbound_enable="NO"  # local caching resolver
+blacklistd_enable="YES"# Run blacklistd daemon (YES/NO).
+blacklistd_flags=""# Optional flags for blacklistd(8).
 
 #
 # kerberos. Do not run the admin daemons on slave servers

Modified: head/etc/periodic/security/520.pfdenied
==
--- head/etc/periodic/security/520.pfdenied Thu Jun  2 18:41:33 2016
(r301225)
+++ head/etc/periodic/security/520.pfdenied Thu Jun  2 19:06:04 2016
(r301226)
@@ -44,8 +44,14 @@ rc=0
 if check_yesno_period security_status_pfdenied_enable
 then
TMP=`mktemp -t security`
-   if pfctl -sr -v -z 2>/dev/null | nawk '{if (/^block/) {buf=$0; getline; 
gsub(" +"," ",$0); if ($5 > 0) print buf$0;} }' > ${TMP}; then
- check_diff new_only pf ${TMP} "${host} pf denied packets:"
+   touch ${TMP}
+   for _a in "" blacklistd
+   do
+   pfctl -a ${_a} -sr -v -z 2>/dev/null | \
+   nawk '{if (/^block/) {buf=$0; getline; gsub(" +"," ",$0); if 
($5 > 0) print buf$0;} }' >> ${TMP}
+   done
+   if [ -s ${TMP} ]; then
+   check_diff new_only pf ${TMP} "${host} pf denied packets:"
fi
rc=$?
rm -f ${TMP}

Modified: head/etc/rc.d/Makefile
==
--- head/etc/rc.d/Makefile  Thu Jun  2 18:41:33 2016(r301225)
+++ head/etc/rc.d/Makefile  Thu Jun  2 19:06:04 2016(r301226)
@@ -17,6 +17,7 @@ FILES=DAEMON \
auditd \
auditdistd \
bgfsck \
+   ${_blacklistd} \
${_bluetooth} \
bridge \
${_bthidd} \
@@ -168,6 +169,10 @@ FILES+=automountd
 FILES+=autounmountd

Re: svn commit: r301226 - in head: etc etc/defaults etc/periodic/security etc/rc.d lib lib/libblacklist libexec libexec/blacklistd-helper share/mk tools/build/mk usr.sbin usr.sbin/blacklistctl usr.sbi

2016-06-02 Thread Renato Botelho
> On Jun 2, 2016, at 16:06, Kurt Lidl  wrote:
> 
> Author: lidl
> Date: Thu Jun  2 19:06:04 2016
> New Revision: 301226
> URL: https://svnweb.freebsd.org/changeset/base/301226
> 
> Log:
>  Add basic blacklist build support
> 
>  Reviewed by: rpaulo
>  Approved by: rpaulo
>  Relnotes:YES
>  Sponsored by:The FreeBSD Foundation
>  Differential Revision:   https://reviews.freebsd.org/D5913
> 
> Added:
>  head/etc/blacklistd.conf   (contents, props changed)
>  head/etc/rc.d/blacklistd   (contents, props changed)
>  head/lib/libblacklist/
>  head/lib/libblacklist/Makefile   (contents, props changed)
>  head/libexec/blacklistd-helper/
>  head/libexec/blacklistd-helper/Makefile   (contents, props changed)
>  head/usr.sbin/blacklistctl/
>  head/usr.sbin/blacklistctl/Makefile   (contents, props changed)
>  head/usr.sbin/blacklistd/
>  head/usr.sbin/blacklistd/Makefile   (contents, props changed)
> Modified:
>  head/etc/Makefile
>  head/etc/defaults/rc.conf
>  head/etc/periodic/security/520.pfdenied
>  head/etc/rc.d/Makefile
>  head/lib/Makefile
>  head/libexec/Makefile
>  head/share/mk/bsd.libnames.mk
>  head/share/mk/src.libnames.mk
>  head/share/mk/src.opts.mk
>  head/tools/build/mk/OptionalObsoleteFiles.inc
>  head/usr.sbin/Makefile

Looks like it’s missing man pages, no?

--
Renato Botelho

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

Re: svn commit: r301220 - in head/sys: arm/mv dev/cesa

2016-06-02 Thread Ian Lepore
On Thu, 2016-06-02 at 21:03 +0200, Zbigniew Bodek wrote:
> 2016-06-02 20:48 GMT+02:00 Ian Lepore :
> 
> > On Thu, 2016-06-02 at 18:31 +, Zbigniew Bodek wrote:
> > > Author: zbb
> > > Date: Thu Jun  2 18:31:36 2016
> > > New Revision: 301220
> > > URL: https://svnweb.freebsd.org/changeset/base/301220
> > > 
> > > Log:
> > >   Map CESA SRAM memory in driver attach for Armada38x
> > > 
> > >   On other platforms with CESA accelerator the SRAM memory is
> > > mapped
> > > in
> > >   early init before driver is attached. This method only works
> > > correctly
> > >   with mappings no smaller than L1 section size (1MB). There may
> > > be
> > > more
> > >   SRAM blocks and they may have smaller sizes than 1MB as is the
> > > case
> > >   for Armada38x. Instead, map SRAM memory with bus_space_map() in
> > > CESA
> > >   driver attach. Note that we can no longer assume that VA == PA
> > > for
> > > the
> > >   SRAM.
> > > 
> > >   Submitted by:   Michal Stanek  > >   Obtained from:  Semihalf
> > >   Sponsored by:   Stormshield
> > >   Differential revision:  https://reviews.freebsd.org/D6215
> > > [...]
> > > -
> > > + rv = OF_getprop(sram_node, "reg", (void *)sram_reg,
> > > sizeof(sram_reg));
> > > + if (rv <= 0)
> > > + return (rv);
> > > +
> > > + sc->sc_sram_base_pa = fdt32_to_cpu(sram_reg[0]);
> > > + /* Store SRAM size to be able to unmap in detach() */
> > > + sc->sc_sram_size = fdt32_to_cpu(sram_reg[1]);
> > > +
> > 
> > OF_getprop() followed by fdt32_to_cpu() calls is properly spelled
> > OF_getencprop() (with no fdt32_to_cpu calls).
> > 
> > > +#if defined(SOC_MV_ARMADA38X)
> > > + /* SRAM memory was not mapped in platform_sram_devmap(),
> > > map
> > > it now */
> > > + rv = bus_space_map(fdtbus_bs_tag, sc->sc_sram_base_pa, sc
> > > ->sc_sram_size,
> > > + 0, &(sc->sc_sram_base_va));
> > 
> > bus_space_map() returns a bus_space_handle_t for use with other
> > bus_space functions.  The handle is not necessarily "just the
> > virtual
> > address" (although that happens to be the case right now on arm). 
> >  I
> > don't see any bus_space_x() calls using this handle, that means
> > that probably the correct function to use is pmap_mapdev(), not
> > bus_space_map().
> > 
> > -- Ian
> > 
> > Thanks Ian,
> 
> We will fix this ASAP.
> BTW. It would be better to get this review prior to committing the
> patch
> ;-)
> Phabricator revision didn't attract anyone's attention:
> https://reviews.freebsd.org/D6215


I've always said that phabricator was primarily a spam-generation tool,
and now that seems to be true in spades.  It apparently only delivers
html-formatted mail now, and my mail client is smart enough to just
route html-only messages directly to the trash.

-- Ian

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


Re: svn commit: r301226 - in head: etc etc/defaults etc/periodic/security etc/rc.d lib lib/libblacklist libexec libexec/blacklistd-helper share/mk tools/build/mk usr.sbin usr.sbin/blacklistctl usr.sbi

2016-06-02 Thread Renato Botelho
> On Jun 2, 2016, at 16:24, Renato Botelho  wrote:
> 
>> On Jun 2, 2016, at 16:06, Kurt Lidl  wrote:
>> 
>> Author: lidl
>> Date: Thu Jun  2 19:06:04 2016
>> New Revision: 301226
>> URL: https://svnweb.freebsd.org/changeset/base/301226
>> 
>> Log:
>> Add basic blacklist build support
>> 
>> Reviewed by: rpaulo
>> Approved by: rpaulo
>> Relnotes:YES
>> Sponsored by:The FreeBSD Foundation
>> Differential Revision:   https://reviews.freebsd.org/D5913
>> 
>> Added:
>> head/etc/blacklistd.conf   (contents, props changed)
>> head/etc/rc.d/blacklistd   (contents, props changed)
>> head/lib/libblacklist/
>> head/lib/libblacklist/Makefile   (contents, props changed)
>> head/libexec/blacklistd-helper/
>> head/libexec/blacklistd-helper/Makefile   (contents, props changed)
>> head/usr.sbin/blacklistctl/
>> head/usr.sbin/blacklistctl/Makefile   (contents, props changed)
>> head/usr.sbin/blacklistd/
>> head/usr.sbin/blacklistd/Makefile   (contents, props changed)
>> Modified:
>> head/etc/Makefile
>> head/etc/defaults/rc.conf
>> head/etc/periodic/security/520.pfdenied
>> head/etc/rc.d/Makefile
>> head/lib/Makefile
>> head/libexec/Makefile
>> head/share/mk/bsd.libnames.mk
>> head/share/mk/src.libnames.mk
>> head/share/mk/src.opts.mk
>> head/tools/build/mk/OptionalObsoleteFiles.inc
>> head/usr.sbin/Makefile
> 
> Looks like it’s missing man pages, no?

nvm my fat finger, now I saw the other commit. Sorry for the noise.
--
Renato Botelho

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

svn commit: r301227 - in head: contrib/llvm/lib/Target/X86 lib/clang/include/clang/Basic

2016-06-02 Thread Dimitry Andric
Author: dim
Date: Thu Jun  2 19:54:38 2016
New Revision: 301227
URL: https://svnweb.freebsd.org/changeset/base/301227

Log:
  Pull in r271548 from upstream llvm trunk (by me):
  
Only attempt to detect AVG if SSE2 is available
  
Summary:
In PR29973 Sanjay Patel reported an assertion failure when a certain
loop was optimized, for a target without SSE2 support.  It turned out
this was because of the AVG pattern detection introduced in rL253952.
  
Prevent the assertion failure by bailing out early in
`detectAVGPattern()`, if the target does not support SSE2.
  
Also add a minimized test case.
  
Reviewers: congh, eli.friedman, spatel
  
Subscribers: emaste, llvm-commits
  
Differential Revision: http://reviews.llvm.org/D20905
  
  This should fix assertion failures ("Requires at least SSE2!") when
  building the games/0ad port with CPUTYPE=pentium3.
  
  Reported by:  madpilot

Modified:
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
  head/lib/clang/include/clang/Basic/Version.inc

Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
==
--- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppThu Jun  2 
19:06:04 2016(r301226)
+++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppThu Jun  2 
19:54:38 2016(r301227)
@@ -26159,6 +26159,8 @@ static SDValue detectAVGPattern(SDValue 
   if (InScalarVT.getSizeInBits() <= ScalarVT.getSizeInBits())
 return SDValue();
 
+  if (!Subtarget->hasSSE2())
+return SDValue();
   if (Subtarget->hasAVX512()) {
 if (VT.getSizeInBits() > 512)
   return SDValue();

Modified: head/lib/clang/include/clang/Basic/Version.inc
==
--- head/lib/clang/include/clang/Basic/Version.inc  Thu Jun  2 19:06:04 
2016(r301226)
+++ head/lib/clang/include/clang/Basic/Version.inc  Thu Jun  2 19:54:38 
2016(r301227)
@@ -9,4 +9,4 @@
 
 #defineSVN_REVISION"262564"
 
-#defineFREEBSD_CC_VERSION  113U
+#defineFREEBSD_CC_VERSION  114U
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301217 - in head/sys: net netinet netinet6

2016-06-02 Thread Ngie Cooper
On Thu, Jun 2, 2016 at 10:51 AM, George V. Neville-Neil  
wrote:
> Author: gnn
> Date: Thu Jun  2 17:51:29 2016
> New Revision: 301217
> URL: https://svnweb.freebsd.org/changeset/base/301217
>
> Log:
>   This change re-adds L2 caching for TCP and UDP, as originally added in D4306
>   but removed due to other changes in the system. Restore the llentry pointer
>   to the "struct route", and use it to cache the L2 lookup (ARP or ND6) as
>   appropriate.
>
>   Submitted by: Mike Karels
>   Differential Revision:https://reviews.freebsd.org/D6262

This broke ibcore:
https://lists.freebsd.org/pipermail/freebsd-current/2016-June/061640.html
Thanks,
-Ngie
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301228 - head/lib

2016-06-02 Thread Bryan Drewery
Author: bdrewery
Date: Thu Jun  2 20:31:02 2016
New Revision: 301228
URL: https://svnweb.freebsd.org/changeset/base/301228

Log:
  Remove libstdc++ again.
  
  This was mis-merged in r298107 which missed r289389.

Modified:
  head/lib/Makefile

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Thu Jun  2 19:54:38 2016(r301227)
+++ head/lib/Makefile   Thu Jun  2 20:31:02 2016(r301228)
@@ -150,7 +150,6 @@ SUBDIR_DEPEND_libpjdlog= libutil
 SUBDIR_DEPEND_libprocstat= libkvm libutil
 SUBDIR_DEPEND_libradius= libmd
 SUBDIR_DEPEND_libsmb= libkiconv
-SUBDIR_DEPEND_libstdc++:= msun
 SUBDIR_DEPEND_libtacplus= libmd
 SUBDIR_DEPEND_libulog= libmd
 SUBDIR_DEPEND_libunbound= ${_libldns}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301217 - in head/sys: net netinet netinet6

2016-06-02 Thread George Neville-Neil



On 2 Jun 2016, at 16:21, Ngie Cooper wrote:

On Thu, Jun 2, 2016 at 10:51 AM, George V. Neville-Neil 
 wrote:

Author: gnn
Date: Thu Jun  2 17:51:29 2016
New Revision: 301217
URL: https://svnweb.freebsd.org/changeset/base/301217

Log:
  This change re-adds L2 caching for TCP and UDP, as originally added 
in D4306
  but removed due to other changes in the system. Restore the llentry 
pointer
  to the "struct route", and use it to cache the L2 lookup (ARP or 
ND6) as

  appropriate.

  Submitted by: Mike Karels
  Differential Revision:https://reviews.freebsd.org/D6262


This broke ibcore:
https://lists.freebsd.org/pipermail/freebsd-current/2016-June/061640.html
Thanks,
-Ngie


About to commit a fix.

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


svn commit: r301229 - in head/sys/ofed/drivers/infiniband: core ulp/ipoib

2016-06-02 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jun  2 20:53:43 2016
New Revision: 301229
URL: https://svnweb.freebsd.org/changeset/base/301229

Log:
  Fix up the Infiniband code to handle the new arpresolve.

Modified:
  head/sys/ofed/drivers/infiniband/core/addr.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c

Modified: head/sys/ofed/drivers/infiniband/core/addr.c
==
--- head/sys/ofed/drivers/infiniband/core/addr.cThu Jun  2 20:31:02 
2016(r301228)
+++ head/sys/ofed/drivers/infiniband/core/addr.cThu Jun  2 20:53:43 
2016(r301229)
@@ -395,13 +395,13 @@ mcast:
 #ifdef INET
case AF_INET:
error = arpresolve(ifp, is_gw, NULL,
-   is_gw ? rte->rt_gateway : dst_in, edst, NULL);
+   is_gw ? rte->rt_gateway : dst_in, edst, NULL, NULL);
break;
 #endif
 #ifdef INET6
case AF_INET6:
error = nd6_resolve(ifp, is_gw, NULL,
-   is_gw ? rte->rt_gateway : dst_in, edst, NULL);
+   is_gw ? rte->rt_gateway : dst_in, edst, NULL, NULL);
break;
 #endif
default:

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Jun  2 
20:31:02 2016(r301228)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Jun  2 
20:53:43 2016(r301229)
@@ -1296,7 +1296,7 @@ ipoib_output(struct ifnet *ifp, struct m
else if (m->m_flags & M_MCAST)
ip_ib_mc_map(((struct sockaddr_in 
*)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst);
else
-   error = arpresolve(ifp, is_gw, m, dst, edst, NULL);
+   error = arpresolve(ifp, is_gw, m, dst, edst, NULL, 
NULL);
if (error)
return (error == EWOULDBLOCK ? 0 : error);
type = htons(ETHERTYPE_IP);
@@ -1334,7 +1334,7 @@ ipoib_output(struct ifnet *ifp, struct m
else if (m->m_flags & M_MCAST)
ipv6_ib_mc_map(&((struct sockaddr_in6 
*)dst)->sin6_addr, ifp->if_broadcastaddr, edst);
else
-   error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL);
+   error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL, 
NULL);
if (error)
return error;
type = htons(ETHERTYPE_IPV6);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: New Defects reported by Coverity Scan for FreeBSD

2016-06-02 Thread Ngie Cooper
On Tue, May 31, 2016 at 10:30 AM,   wrote:
>
> Hi,
>
> Please find the latest report on new defect(s) introduced to FreeBSD found 
> with Coverity Scan.
>
> 25 new defect(s) introduced to FreeBSD found with Coverity Scan.
> 135 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
> recent build analyzed by Coverity Scan.
>
> New defect(s) Reported-by: Coverity Scan
> Showing 20 of 25 defect(s)

This is pretty cool, actually... the number of defects reported by
Coverity has drastically decreased in the last few months -- down
~1500 issues from ~12000 to ~10300 according to the "Outstanding vs
Fixed defects over period of time" [*] graph (we still have another 2k
issues to beat before we can get back down to our defect count last
year -- 04/2015).
Cheers,
-Ngie

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


Re: svn commit: r301220 - in head/sys: arm/mv dev/cesa

2016-06-02 Thread John Baldwin
On Thursday, June 02, 2016 01:24:28 PM Ian Lepore wrote:
> On Thu, 2016-06-02 at 21:03 +0200, Zbigniew Bodek wrote:
> > 2016-06-02 20:48 GMT+02:00 Ian Lepore :
> > 
> > > On Thu, 2016-06-02 at 18:31 +, Zbigniew Bodek wrote:
> > > > Author: zbb
> > > > Date: Thu Jun  2 18:31:36 2016
> > > > New Revision: 301220
> > > > URL: https://svnweb.freebsd.org/changeset/base/301220
> > > > 
> > > > Log:
> > > >   Map CESA SRAM memory in driver attach for Armada38x
> > > > 
> > > >   On other platforms with CESA accelerator the SRAM memory is
> > > > mapped
> > > > in
> > > >   early init before driver is attached. This method only works
> > > > correctly
> > > >   with mappings no smaller than L1 section size (1MB). There may
> > > > be
> > > > more
> > > >   SRAM blocks and they may have smaller sizes than 1MB as is the
> > > > case
> > > >   for Armada38x. Instead, map SRAM memory with bus_space_map() in
> > > > CESA
> > > >   driver attach. Note that we can no longer assume that VA == PA
> > > > for
> > > > the
> > > >   SRAM.
> > > > 
> > > >   Submitted by:   Michal Stanek  > > >   Obtained from:  Semihalf
> > > >   Sponsored by:   Stormshield
> > > >   Differential revision:  https://reviews.freebsd.org/D6215
> > > > [...]
> > > > -
> > > > + rv = OF_getprop(sram_node, "reg", (void *)sram_reg,
> > > > sizeof(sram_reg));
> > > > + if (rv <= 0)
> > > > + return (rv);
> > > > +
> > > > + sc->sc_sram_base_pa = fdt32_to_cpu(sram_reg[0]);
> > > > + /* Store SRAM size to be able to unmap in detach() */
> > > > + sc->sc_sram_size = fdt32_to_cpu(sram_reg[1]);
> > > > +
> > > 
> > > OF_getprop() followed by fdt32_to_cpu() calls is properly spelled
> > > OF_getencprop() (with no fdt32_to_cpu calls).
> > > 
> > > > +#if defined(SOC_MV_ARMADA38X)
> > > > + /* SRAM memory was not mapped in platform_sram_devmap(),
> > > > map
> > > > it now */
> > > > + rv = bus_space_map(fdtbus_bs_tag, sc->sc_sram_base_pa, sc
> > > > ->sc_sram_size,
> > > > + 0, &(sc->sc_sram_base_va));
> > > 
> > > bus_space_map() returns a bus_space_handle_t for use with other
> > > bus_space functions.  The handle is not necessarily "just the
> > > virtual
> > > address" (although that happens to be the case right now on arm). 
> > >  I
> > > don't see any bus_space_x() calls using this handle, that means
> > > that probably the correct function to use is pmap_mapdev(), not
> > > bus_space_map().
> > > 
> > > -- Ian
> > > 
> > > Thanks Ian,
> > 
> > We will fix this ASAP.
> > BTW. It would be better to get this review prior to committing the
> > patch
> > ;-)
> > Phabricator revision didn't attract anyone's attention:
> > https://reviews.freebsd.org/D6215
> 
> 
> I've always said that phabricator was primarily a spam-generation tool,
> and now that seems to be true in spades.  It apparently only delivers
> html-formatted mail now, and my mail client is smart enough to just
> route html-only messages directly to the trash.

There's a config option to turn off the HTML bit.  A recent "upgrade" of
phab silently turned on HTML e-mails by default.

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


Re: svn commit: r301220 - in head/sys: arm/mv dev/cesa

2016-06-02 Thread Ian Lepore
On Thu, 2016-06-02 at 14:05 -0700, John Baldwin wrote:
> On Thursday, June 02, 2016 01:24:28 PM Ian Lepore wrote:
> > On Thu, 2016-06-02 at 21:03 +0200, Zbigniew Bodek wrote:
> > > 2016-06-02 20:48 GMT+02:00 Ian Lepore :
> > > 
> > > > On Thu, 2016-06-02 at 18:31 +, Zbigniew Bodek wrote:
> > > > > 
[...]
> > 
> > I've always said that phabricator was primarily a spam-generation
> > tool,
> > and now that seems to be true in spades.  It apparently only
> > delivers
> > html-formatted mail now, and my mail client is smart enough to just
> > route html-only messages directly to the trash.
> 
> There's a config option to turn off the HTML bit.  A recent "upgrade"
> of
> phab silently turned on HTML e-mails by default.
> 

I thought at first you meant an option the admins have to set, but I
see now that it's a per-user email setting.  So now I'll be back to
seeing all the phab stuff I don't have time to deal with, and will be
able to feel suitably guilty about it again.

-- Ian

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


svn commit: r301230 - head/sys/conf

2016-06-02 Thread Glen Barber
Author: gjb
Date: Fri Jun  3 00:06:24 2016
New Revision: 301230
URL: https://svnweb.freebsd.org/changeset/base/301230

Log:
  Update to ALPHA2 in preparation of a new set of snapshot builds.
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shThu Jun  2 20:53:43 2016(r301229)
+++ head/sys/conf/newvers.shFri Jun  3 00:06:24 2016(r301230)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.0"
-BRANCH="ALPHA1"
+BRANCH="ALPHA2"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301235 - head/sbin/dhclient

2016-06-02 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jun  3 03:40:39 2016
New Revision: 301235
URL: https://svnweb.freebsd.org/changeset/base/301235

Log:
  dhclient(1): correct obvious mismatch in get_char().
  
  Correct switch between current and previous line buffers when
  encountering a carriage return in the input.
  
  CID:  1305719
  Obtained from:OpenBSD (CVS rev. 1.30)
  MFC after:3 days

Modified:
  head/sbin/dhclient/conflex.c

Modified: head/sbin/dhclient/conflex.c
==
--- head/sbin/dhclient/conflex.cFri Jun  3 03:22:00 2016
(r301234)
+++ head/sbin/dhclient/conflex.cFri Jun  3 03:40:39 2016
(r301235)
@@ -97,8 +97,8 @@ get_char(FILE *cfile)
cur_line = line2;
prev_line = line1;
} else {
-   cur_line = line2;
-   prev_line = line1;
+   cur_line = line1;
+   prev_line = line2;
}
line++;
lpos = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301236 - head/sys/dev/drm2

2016-06-02 Thread Adrian Chadd
Author: adrian
Date: Fri Jun  3 05:01:35 2016
New Revision: 301236
URL: https://svnweb.freebsd.org/changeset/base/301236

Log:
  [drm] fix up hex_dump_to_buffer to not overflow linebuf.
  
  That check wasn't enough to handle appending a two byte character
  following it.
  
  This prevented my T400 (Intel Core 2 Duo P8400) from attaching;
  it would panic from a stack overflow detection.

Modified:
  head/sys/dev/drm2/drm_os_freebsd.c

Modified: head/sys/dev/drm2/drm_os_freebsd.c
==
--- head/sys/dev/drm2/drm_os_freebsd.c  Fri Jun  3 03:40:39 2016
(r301235)
+++ head/sys/dev/drm2/drm_os_freebsd.c  Fri Jun  3 05:01:35 2016
(r301236)
@@ -422,7 +422,7 @@ hex_dump_to_buffer(const void *buf, size
}
}
 
-   if (j > linebuflen - 1)
+   if (j > linebuflen - 4)
break;
 
sprintf(linebuf + j, "%02X", c);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r301236 - head/sys/dev/drm2

2016-06-02 Thread Adrian Chadd
fwiw, this made me cry. a lot. grr.



-adrian


On 2 June 2016 at 22:01, Adrian Chadd  wrote:
> Author: adrian
> Date: Fri Jun  3 05:01:35 2016
> New Revision: 301236
> URL: https://svnweb.freebsd.org/changeset/base/301236
>
> Log:
>   [drm] fix up hex_dump_to_buffer to not overflow linebuf.
>
>   That check wasn't enough to handle appending a two byte character
>   following it.
>
>   This prevented my T400 (Intel Core 2 Duo P8400) from attaching;
>   it would panic from a stack overflow detection.
>
> Modified:
>   head/sys/dev/drm2/drm_os_freebsd.c
>
> Modified: head/sys/dev/drm2/drm_os_freebsd.c
> ==
> --- head/sys/dev/drm2/drm_os_freebsd.c  Fri Jun  3 03:40:39 2016
> (r301235)
> +++ head/sys/dev/drm2/drm_os_freebsd.c  Fri Jun  3 05:01:35 2016
> (r301236)
> @@ -422,7 +422,7 @@ hex_dump_to_buffer(const void *buf, size
> }
> }
>
> -   if (j > linebuflen - 1)
> +   if (j > linebuflen - 4)
> break;
>
> sprintf(linebuf + j, "%02X", c);
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301237 - head/sys/dev/sfxge/common

2016-06-02 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Jun  3 05:27:34 2016
New Revision: 301237
URL: https://svnweb.freebsd.org/changeset/base/301237

Log:
  sfxge(4): support EVQ timer workaround via MCDI
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/6675

Modified:
  head/sys/dev/sfxge/common/ef10_ev.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/hunt_nic.c
  head/sys/dev/sfxge/common/medford_nic.c

Modified: head/sys/dev/sfxge/common/ef10_ev.c
==
--- head/sys/dev/sfxge/common/ef10_ev.c Fri Jun  3 05:01:35 2016
(r301236)
+++ head/sys/dev/sfxge/common/ef10_ev.c Fri Jun  3 05:27:34 2016
(r301237)
@@ -87,6 +87,52 @@ ef10_ev_mcdi(
 
 
 static __checkReturn   efx_rc_t
+efx_mcdi_set_evq_tmr(
+   __inefx_nic_t *enp,
+   __inuint32_t instance,
+   __inuint32_t mode,
+   __inuint32_t timer_ns)
+{
+   efx_mcdi_req_t req;
+   uint8_t payload[MAX(MC_CMD_SET_EVQ_TMR_IN_LEN,
+   MC_CMD_SET_EVQ_TMR_OUT_LEN)];
+   efx_rc_t rc;
+
+   (void) memset(payload, 0, sizeof (payload));
+   req.emr_cmd = MC_CMD_SET_EVQ_TMR;
+   req.emr_in_buf = payload;
+   req.emr_in_length = MC_CMD_SET_EVQ_TMR_IN_LEN;
+   req.emr_out_buf = payload;
+   req.emr_out_length = MC_CMD_SET_EVQ_TMR_OUT_LEN;
+
+   MCDI_IN_SET_DWORD(req, SET_EVQ_TMR_IN_INSTANCE, instance);
+   MCDI_IN_SET_DWORD(req, SET_EVQ_TMR_IN_TMR_LOAD_REQ_NS, timer_ns);
+   MCDI_IN_SET_DWORD(req, SET_EVQ_TMR_IN_TMR_RELOAD_REQ_NS, timer_ns);
+   MCDI_IN_SET_DWORD(req, SET_EVQ_TMR_IN_TMR_MODE, mode);
+
+   efx_mcdi_execute(enp, &req);
+
+   if (req.emr_rc != 0) {
+   rc = req.emr_rc;
+   goto fail1;
+   }
+
+   if (req.emr_out_length_used < MC_CMD_SET_EVQ_TMR_OUT_LEN) {
+   rc = EMSGSIZE;
+   goto fail2;
+   }
+
+   return (0);
+
+fail2:
+   EFSYS_PROBE(fail2);
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+
+static __checkReturn   efx_rc_t
 efx_mcdi_init_evq(
__inefx_nic_t *enp,
__inunsigned int instance,
@@ -437,9 +483,19 @@ ef10_ev_qmoderate(
efx_nic_t *enp = eep->ee_enp;
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_dword_t dword;
-   uint32_t timer_val, mode;
+   uint32_t timer_ns, timer_val, mode;
efx_rc_t rc;
 
+   /* Check that hardware and MCDI use the same timer MODE values */
+   EFX_STATIC_ASSERT(FFE_CZ_TIMER_MODE_DIS ==
+   MC_CMD_SET_EVQ_TMR_IN_TIMER_MODE_DIS);
+   EFX_STATIC_ASSERT(FFE_CZ_TIMER_MODE_IMMED_START ==
+   MC_CMD_SET_EVQ_TMR_IN_TIMER_MODE_IMMED_START);
+   EFX_STATIC_ASSERT(FFE_CZ_TIMER_MODE_TRIG_START ==
+   MC_CMD_SET_EVQ_TMR_IN_TIMER_MODE_TRIG_START);
+   EFX_STATIC_ASSERT(FFE_CZ_TIMER_MODE_INT_HLDOFF ==
+   MC_CMD_SET_EVQ_TMR_IN_TIMER_MODE_INT_HLDOFF);
+
if (us > encp->enc_evq_timer_max_us) {
rc = EINVAL;
goto fail1;
@@ -447,37 +503,46 @@ ef10_ev_qmoderate(
 
/* If the value is zero then disable the timer */
if (us == 0) {
-   timer_val = 0;
+   timer_ns = 0;
mode = FFE_CZ_TIMER_MODE_DIS;
} else {
+   timer_ns = us * 1000u;
+   mode = FFE_CZ_TIMER_MODE_INT_HLDOFF;
+   }
+
+   if (encp->enc_bug61265_workaround) {
+   rc = efx_mcdi_set_evq_tmr(enp, eep->ee_index, mode, timer_ns);
+   if (rc != 0)
+   goto fail2;
+   } else {
/* Calculate the timer value in quanta */
-   timer_val = us * 1000 / encp->enc_evq_timer_quantum_ns;
+   timer_val = timer_ns / encp->enc_evq_timer_quantum_ns;
 
/* Moderation value is base 0 so we need to deduct 1 */
if (timer_val > 0)
timer_val--;
 
-   mode = FFE_CZ_TIMER_MODE_INT_HLDOFF;
-   }
-
-   if (encp->enc_bug35388_workaround) {
-   EFX_POPULATE_DWORD_3(dword,
-   ERF_DD_EVQ_IND_TIMER_FLAGS,
-   EFE_DD_EVQ_IND_TIMER_FLAGS,
-   ERF_DD_EVQ_IND_TIMER_MODE, mode,
-   ERF_DD_EVQ_IND_TIMER_VAL, timer_val);
-   EFX_BAR_TBL_WRITED(enp, ER_DD_EVQ_INDIRECT,
-   eep->ee_index, &dword, 0);
-   } else {
-   EFX_POPULATE_DWORD_2(dword,
-   ERF_DZ_TC_TIMER_MODE, mode,
-   ERF_DZ_TC_TIMER_VAL, timer_val);
-   EFX_BAR_TBL_WRITED(enp, ER_DZ_EVQ_TMR_REG,
-   eep->ee_index, &dword, 0);
+   if (encp->enc_bug35388_workaround) {
+   EFX_POPULATE_DWORD_3(dword,
+  

svn commit: r301240 - in head: tools/build/mk usr.sbin/blacklistd

2016-06-02 Thread Kurt Lidl
Author: lidl
Date: Fri Jun  3 06:15:52 2016
New Revision: 301240
URL: https://svnweb.freebsd.org/changeset/base/301240

Log:
  Add blacklistd.conf manpage
  
  Install the blacklistd.conf man page, missed in the original commit.
  
  Submitted by: Herbert J. Skuhra ( herbert at mailbox.org )
  Reviewed by:  rpaulo
  Approved by:  rpaulo
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6702

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/blacklistd/Makefile

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Jun  3 06:01:32 
2016(r301239)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Jun  3 06:15:52 
2016(r301240)
@@ -449,6 +449,7 @@ OLD_FILES+=usr/share/man/man3/blacklist_
 OLD_FILES+=usr/share/man/man3/blacklist_sa_r.3.gz
 OLD_FILES+=usr/share/man/man8/blacklistctl.8.gz
 OLD_FILES+=usr/share/man/man8/blacklistd.8.gz
+OLD_FILES+=usr/share/man/man8/blacklistd.conf.5.gz
 .endif
 
 .if ${MK_BLUETOOTH} == no

Modified: head/usr.sbin/blacklistd/Makefile
==
--- head/usr.sbin/blacklistd/Makefile   Fri Jun  3 06:01:32 2016
(r301239)
+++ head/usr.sbin/blacklistd/Makefile   Fri Jun  3 06:15:52 2016
(r301240)
@@ -6,7 +6,7 @@ BLACKLIST_DIR=${SRCTOP}/contrib/blacklis
 PROG=  blacklistd
 SRCS=  blacklistd.c conf.c run.c state.c support.c internal.c \
sockaddr_snprintf.c pidfile.c strtoi.c popenve.c
-MAN=   blacklistd.8
+MAN=   blacklistd.8 blacklistd.conf.5
 
 LDFLAGS+=-L${LIBBLACKLISTDIR}
 LIBADD+= blacklist util
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r301241 - head/libexec/ftpd

2016-06-02 Thread Kurt Lidl
Author: lidl
Date: Fri Jun  3 06:24:03 2016
New Revision: 301241
URL: https://svnweb.freebsd.org/changeset/base/301241

Log:
  Add blacklist support to ftpd
  
  Reviewed by:  rpaulo
  Approved by:  rpaulo
  Relnotes: YES
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6703

Added:
  head/libexec/ftpd/blacklist.c   (contents, props changed)
  head/libexec/ftpd/blacklist_client.h   (contents, props changed)
Modified:
  head/libexec/ftpd/Makefile
  head/libexec/ftpd/ftpd.c

Modified: head/libexec/ftpd/Makefile
==
--- head/libexec/ftpd/Makefile  Fri Jun  3 06:15:52 2016(r301240)
+++ head/libexec/ftpd/Makefile  Fri Jun  3 06:24:03 2016(r301241)
@@ -24,6 +24,13 @@ SRCS+=   ls.c cmp.c print.c util.c
 CFLAGS+=-Dmain=ls_main -I${.CURDIR}/${LSDIR}
 LIBADD+=   m
 
+.if ${MK_BLACKLIST_SUPPORT} != "no"
+CFLAGS+= -DUSE_BLACKLIST -I${SRCTOP}/contrib/blacklist/include
+SRCS+= blacklist.c
+LIBADD+= blacklist
+LDFLAGS+=-L${LIBBLACKLISTDIR}
+.endif
+
 .if ${MK_INET6_SUPPORT} != "no"
 CFLAGS+=-DINET6
 .endif

Added: head/libexec/ftpd/blacklist.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/libexec/ftpd/blacklist.c   Fri Jun  3 06:24:03 2016
(r301241)
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2016 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Kurt Lidl under sponsorship from the
+ * FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
+
+/* $FreeBSD$ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "blacklist_client.h"
+#include 
+
+static struct blacklist *blstate;
+
+void
+blacklist_init(void)
+{
+   blstate = blacklist_open();
+}
+
+void
+blacklist_notify(int action, int fd, char *msg)
+{
+   if (blstate == NULL)
+   blacklist_init();
+   if (blstate == NULL)
+   return;
+   (void)blacklist_r(blstate, action, fd, msg);
+}

Added: head/libexec/ftpd/blacklist_client.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/libexec/ftpd/blacklist_client.hFri Jun  3 06:24:03 2016
(r301241)
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2016 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Kurt Lidl under sponsorship from the
+ * FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND 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 AUTHOR 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
+ 

Re: svn commit: r301172 - head/contrib/blacklist

2016-06-02 Thread Jan Beich
Kurt Lidl  writes:

> Author: lidl
> Date: Wed Jun  1 22:04:10 2016
> New Revision: 301172
> URL: https://svnweb.freebsd.org/changeset/base/301172
>
> Log:
>   Import NetBSD's blacklist source from vendor tree
>   
>   This import includes The basic blacklist library and utility programs,
>   to add a system-wide packet filtering notification mechanism to
>   FreeBSD.
>   
>   The rational behind the daemon was given by Christos Zoulas in a
>   presentation at vBSDcon 2015: https://youtu.be/fuuf8G28mjs
>   
>   Reviewed by:rpaulo
>   Approved by:rpaulo
>   Obtained from:  NetBSD
>   Relnotes:   YES

Can you track FreeBSD version in manpages? Maybe ping upstream, so they
add .Fx as well.

$ fgrep .Nx contrib/blacklist/**/*.[0-9]
contrib/blacklist/bin/blacklistctl.8:.Nx 7 .
contrib/blacklist/bin/blacklistd.8:.Nx 7 .
contrib/blacklist/bin/blacklistd.conf.5:.Nx 7 .

$ man blacklistd | col -b | fgrep -A1 HISTORY
HISTORY
 blacklistd appeared in NetBSD 7.


signature.asc
Description: PGP signature


svn commit: r301242 - head/libexec/rshd

2016-06-02 Thread Kurt Lidl
Author: lidl
Date: Fri Jun  3 06:58:20 2016
New Revision: 301242
URL: https://svnweb.freebsd.org/changeset/base/301242

Log:
  Add blacklist support to rshd
  
  Reviewed by:  rpaulo
  Approved by:  rpaulo
  Relnotes: YES
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D6594

Modified:
  head/libexec/rshd/Makefile
  head/libexec/rshd/rshd.c

Modified: head/libexec/rshd/Makefile
==
--- head/libexec/rshd/Makefile  Fri Jun  3 06:24:03 2016(r301241)
+++ head/libexec/rshd/Makefile  Fri Jun  3 06:58:20 2016(r301242)
@@ -2,6 +2,9 @@
 # $FreeBSD$
 
 PACKAGE=rcmds
+
+.include 
+
 PROG=  rshd
 MAN=   rshd.8
 
@@ -12,4 +15,10 @@ WFORMAT=0
 
 LIBADD=util pam
 
+.if ${MK_BLACKLIST_SUPPORT} != "no"
+CFLAGS+= -DUSE_BLACKLIST -I${SRCTOP}/contrib/blacklist/include
+LIBADD+= blacklist
+LDFLAGS+=-L${LIBBLACKLISTDIR}
+.endif
+
 .include 

Modified: head/libexec/rshd/rshd.c
==
--- head/libexec/rshd/rshd.cFri Jun  3 06:24:03 2016(r301241)
+++ head/libexec/rshd/rshd.cFri Jun  3 06:58:20 2016(r301242)
@@ -88,6 +88,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef USE_BLACKLIST
+#include 
+#endif
+
 static struct pam_conv pamc = { openpam_nullconv, NULL };
 static pam_handle_t *pamh;
 static int pam_err;
@@ -252,6 +256,9 @@ doit(struct sockaddr *fromp)
"connection from %s on illegal port %u",
numericname,
srcport);
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "illegal port");
+#endif
exit(1);
}
 
@@ -285,6 +292,9 @@ doit(struct sockaddr *fromp)
"2nd socket from %s on unreserved port %u",
numericname,
port);
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "unreserved port");
+#endif
exit(1);
}
*((in_port_t *)&fromp->sa_data) = htons(port);
@@ -309,6 +319,9 @@ doit(struct sockaddr *fromp)
if (pam_err != PAM_SUCCESS) {
syslog(LOG_ERR|LOG_AUTH, "pam_start(): %s",
pam_strerror(pamh, pam_err));
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "login incorrect");
+#endif
rshd_errx(1, "Login incorrect.");
}
 
@@ -316,6 +329,9 @@ doit(struct sockaddr *fromp)
(pam_err = pam_set_item(pamh, PAM_RHOST, rhost)) != PAM_SUCCESS) {
syslog(LOG_ERR|LOG_AUTH, "pam_set_item(): %s",
pam_strerror(pamh, pam_err));
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "login incorrect");
+#endif
rshd_errx(1, "Login incorrect.");
}
 
@@ -332,6 +348,9 @@ doit(struct sockaddr *fromp)
syslog(LOG_INFO|LOG_AUTH,
"%s@%s as %s: permission denied (%s). cmd='%.80s'",
ruser, rhost, luser, pam_strerror(pamh, pam_err), cmdbuf);
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "permission denied");
+#endif
rshd_errx(1, "Login incorrect.");
}
 
@@ -341,6 +360,9 @@ doit(struct sockaddr *fromp)
syslog(LOG_INFO|LOG_AUTH,
"%s@%s as %s: unknown login. cmd='%.80s'",
ruser, rhost, luser, cmdbuf);
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "unknown login");
+#endif
if (errorstr == NULL)
errorstr = "Login incorrect.";
rshd_errx(1, errorstr, rhost);
@@ -373,6 +395,9 @@ doit(struct sockaddr *fromp)
"%s@%s as %s: permission denied (%s). cmd='%.80s'",
ruser, rhost, luser, __rcmd_errstr,
cmdbuf);
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "permission denied");
+#endif
rshd_errx(1, "Login incorrect.");
}
if (!auth_timeok(lc, time(NULL)))
@@ -468,6 +493,9 @@ doit(struct sockaddr *fromp)
}
}
 
+#ifdef USE_BLACKLIST
+   blacklist(0, STDIN_FILENO, "success");
+#endif
for (fd = getdtablesize(); fd > 2; fd--)
(void) close(fd);
if (setsid() == -1)
@@ -534,8 +562,12 @@ getstr(char *buf, int cnt, const char *e
if (read(STDIN_FILENO, &c, 1) != 1)
exit(1);
*buf++ = c;
-   if (--cnt == 0)
+   if (--cnt == 0) {
+#ifdef USE_BLACKLIST
+   blacklist(1, STDIN_FILENO, "buffer overflow");
+#endif
rshd_errx(1, "%s too long", error);
+   }
} while (c != 0);
 }
 
___
svn-src-head@fr