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

2014-09-08 Thread Kevin Lo
Author: kevlo
Date: Tue Sep  9 05:21:31 2014
New Revision: 271303
URL: http://svnweb.freebsd.org/changeset/base/271303

Log:
  Drop frames that have larger than MCLBYTES.

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

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==
--- head/sys/dev/usb/wlan/if_urtwn.cTue Sep  9 04:20:53 2014
(r271302)
+++ head/sys/dev/usb/wlan/if_urtwn.cTue Sep  9 05:21:31 2014
(r271303)
@@ -660,6 +660,10 @@ urtwn_rx_frame(struct urtwn_softc *sc, u
ifp->if_ierrors++;
return (NULL);
}
+   if (pktlen < sizeof(*wh) || pktlen > MCLBYTES) {
+   ifp->if_ierrors++;
+   return (NULL);
+   }
 
rate = MS(rxdw3, R92C_RXDW3_RATE);
infosz = MS(rxdw0, R92C_RXDW0_INFOSZ) * 8;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271302 - head/sys/netinet6

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 04:20:53 2014
New Revision: 271302
URL: http://svnweb.freebsd.org/changeset/base/271302

Log:
  Add basic RSS awareness for the UDPv6 send path.
  
  This doesn't include the same kind of userland overriding that the IPv4
  path has; nor does it yet know about 2-tuple versus 4-tuple hashing.
  That'll come later.
  
  Differential Revision:https://reviews.freebsd.org/D527
  Reviewed by:  grehan

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Tue Sep  9 04:19:36 2014
(r271301)
+++ head/sys/netinet6/udp6_usrreq.c Tue Sep  9 04:20:53 2014
(r271302)
@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_inet6.h"
 #include "opt_ipfw.h"
 #include "opt_ipsec.h"
+#include "opt_rss.h"
 
 #include 
 #include 
@@ -111,6 +112,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -850,8 +852,30 @@ udp6_output(struct inpcb *inp, struct mb
m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum);
}
 
+   /*
+* XXX for now assume UDP is 2-tuple.
+* Later on this may become configurable as 4-tuple;
+* we should support that.
+*
+* XXX .. and we should likely cache this in the inpcb.
+*/
+#ifdef RSS
+   m->m_pkthdr.flowid = rss_hash_ip6_2tuple(*faddr, *laddr);
+   m->m_flags |= M_FLOWID;
+   M_HASHTYPE_SET(m, M_HASHTYPE_RSS_IPV6);
+#endif
flags = 0;
 
+#ifdef RSS
+   /*
+* Don't override with the inp cached flowid.
+*
+* Until the whole UDP path is vetted, it may actually
+* be incorrect.
+*/
+   flags |= IP_NODEFAULTFLOWID;
+#endif
+
UDP_PROBE(send, NULL, inp, ip6, inp, udp6);
UDPSTAT_INC(udps_opackets);
error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271301 - head/sys/netinet

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 04:19:36 2014
New Revision: 271301
URL: http://svnweb.freebsd.org/changeset/base/271301

Log:
  Calculate the RSS hash for outbound UDPv4 frames.
  
  Differential Revision:https://reviews.freebsd.org/D527
  Reviewed by:  grehan

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Tue Sep  9 04:18:20 2014
(r271300)
+++ head/sys/netinet/udp_usrreq.c   Tue Sep  9 04:19:36 2014
(r271301)
@@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #ifdef IPSEC
 #include 
@@ -207,6 +208,13 @@ void
 udp_init(void)
 {
 
+   /*
+* For now default to 2-tuple UDP hashing - until the fragment
+* reassembly code can also update the flowid.
+*
+* Once we can calculate the flowid that way and re-establish
+* a 4-tuple, flip this to 4-tuple.
+*/
in_pcbinfo_init(&V_udbinfo, "udp", &V_udb, UDBHASHSIZE, UDBHASHSIZE,
"udp_inpcb", udp_inpcb_init, NULL, UMA_ZONE_NOFREE,
IPI_HASHFIELDS_2TUPLE);
@@ -1435,9 +1443,46 @@ udp_output(struct inpcb *inp, struct mbu
m->m_flags |= M_FLOWID;
m->m_pkthdr.flowid = flowid;
M_HASHTYPE_SET(m, flowid_type);
+#ifdef RSS
+   } else {
+   uint32_t hash_val, hash_type;
+   /*
+* Calculate an appropriate RSS hash for UDP and
+* UDP Lite.
+*
+* The called function will take care of figuring out
+* whether a 2-tuple or 4-tuple hash is required based
+* on the currently configured scheme.
+*
+* Later later on connected socket values should be
+* cached in the inpcb and reused, rather than constantly
+* re-calculating it.
+*
+* UDP Lite is a different protocol number and will
+* likely end up being hashed as a 2-tuple until
+* RSS / NICs grow UDP Lite protocol awareness.
+*/
+   if (rss_proto_software_hash_v4(faddr, laddr, fport, lport,
+   pr, &hash_val, &hash_type) == 0) {
+   m->m_pkthdr.flowid = hash_val;
+   m->m_flags |= M_FLOWID;
+   M_HASHTYPE_SET(m, hash_type);
+   }
+#endif
}
 
 #ifdef RSS
+   /*
+* Don't override with the inp cached flowid value.
+*
+* Depending upon the kind of send being done, the inp
+* flowid/flowtype values may actually not be appropriate
+* for this particular socket send.
+*
+* We should either leave the flowid at zero (which is what is
+* currently done) or set it to some software generated
+* hash value based on the packet contents.
+*/
ipflags |= IP_NODEFAULTFLOWID;
 #endif /* RSS */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271300 - in head/sys: net netinet

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 04:18:20 2014
New Revision: 271300
URL: http://svnweb.freebsd.org/changeset/base/271300

Log:
  Update the IPv4 input path to handle reassembled frames and incoming frames
  with no RSS hash.
  
  When doing RSS:
  
  * Create a new IPv4 netisr which expects the frames to have been verified;
it just directly dispatches to the IPv4 input path.
  * Once IPv4 reassembly is done, re-calculate the RSS hash with the new
IP and L3 header; then reinject it as appropriate.
  * Update the IPv4 netisr to be a CPU affinity netisr with the RSS hash
function (rss_soft_m2cpuid) - this will do a software hash if the
hardware doesn't provide one.
  
  NICs that don't implement hardware RSS hashing will now benefit from RSS
  distribution - it'll inject into the correct destination netisr.
  
  Note: the netisr distribution doesn't work out of the box - netisr doesn't
  query RSS for how many CPUs and the affinity setup.  Yes, netisr likely
  shouldn't really be doing CPU stuff anymore and should be "some kind of
  'thing' that is a workqueue that may or may not have any CPU affinity";
  that's for a later commit.
  
  Differential Revision:https://reviews.freebsd.org/D527
  Reviewed by:  grehan

Modified:
  head/sys/net/netisr.h
  head/sys/netinet/in_var.h
  head/sys/netinet/ip_input.c

Modified: head/sys/net/netisr.h
==
--- head/sys/net/netisr.h   Tue Sep  9 04:11:54 2014(r271299)
+++ head/sys/net/netisr.h   Tue Sep  9 04:18:20 2014(r271300)
@@ -57,6 +57,8 @@
 #defineNETISR_IPV6 6
 #defineNETISR_NATM 7
 #defineNETISR_EPAIR8   /* if_epair(4) */
+#defineNETISR_IP_DIRECT9   /* direct-dispatch IPv4 */
+#defineNETISR_IPV6_DIRECT  10  /* direct-dispatch IPv6 */
 
 /*
  * Protocol ordering and affinity policy constants.  See the detailed

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Tue Sep  9 04:11:54 2014(r271299)
+++ head/sys/netinet/in_var.h   Tue Sep  9 04:18:20 2014(r271300)
@@ -411,6 +411,7 @@ voidin_rtqdrain(void);
 intin_addprefix(struct in_ifaddr *, int);
 intin_scrubprefix(struct in_ifaddr *, u_int);
 void   ip_input(struct mbuf *);
+void   ip_direct_input(struct mbuf *);
 void   in_ifadown(struct ifaddr *ifa, int);
 struct mbuf*ip_fastforward(struct mbuf *);
 void   *in_domifattach(struct ifnet *);

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Tue Sep  9 04:11:54 2014(r271299)
+++ head/sys/netinet/ip_input.c Tue Sep  9 04:18:20 2014(r271300)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_ipstealth.h"
 #include "opt_ipsec.h"
 #include "opt_route.h"
+#include "opt_rss.h"
 
 #include 
 #include 
@@ -77,6 +78,7 @@ __FBSDID("$FreeBSD$");
 #ifdef IPSEC
 #include 
 #endif /* IPSEC */
+#include 
 
 #include 
 
@@ -144,8 +146,32 @@ static struct netisr_handler ip_nh = {
.nh_name = "ip",
.nh_handler = ip_input,
.nh_proto = NETISR_IP,
+#ifdef RSS
+   .nh_m2cpuid = rss_soft_m2cpuid,
+   .nh_policy = NETISR_POLICY_CPU,
+   .nh_dispatch = NETISR_DISPATCH_HYBRID,
+#else
.nh_policy = NETISR_POLICY_FLOW,
+#endif
+};
+
+#ifdef RSS
+/*
+ * Directly dispatched frames are currently assumed
+ * to have a flowid already calculated.
+ *
+ * It should likely have something that assert it
+ * actually has valid flow details.
+ */
+static struct netisr_handler ip_direct_nh = {
+   .nh_name = "ip_direct",
+   .nh_handler = ip_direct_input,
+   .nh_proto = NETISR_IP_DIRECT,
+   .nh_m2cpuid = rss_m2cpuid,
+   .nh_policy = NETISR_POLICY_CPU,
+   .nh_dispatch = NETISR_DISPATCH_HYBRID,
 };
+#endif
 
 extern struct domain inetdomain;
 extern struct protosw inetsw[];
@@ -266,6 +292,46 @@ SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQDRO
 CTLTYPE_INT|CTLFLAG_RD, 0, 0, sysctl_netinet_intr_queue_drops, "I",
 "Number of packets dropped from the IP input queue");
 
+#ifdef RSS
+static int
+sysctl_netinet_intr_direct_queue_maxlen(SYSCTL_HANDLER_ARGS)
+{
+   int error, qlimit;
+
+   netisr_getqlimit(&ip_direct_nh, &qlimit);
+   error = sysctl_handle_int(oidp, &qlimit, 0, req);
+   if (error || !req->newptr)
+   return (error);
+   if (qlimit < 1)
+   return (EINVAL);
+   return (netisr_setqlimit(&ip_direct_nh, qlimit));
+}
+SYSCTL_PROC(_net_inet_ip, IPCTL_INTRQMAXLEN, intr_direct_queue_maxlen,
+CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_netinet_intr_direct_queue_maxlen, "I",
+"Maximum size of the IP direct input queue");
+
+static int
+sysctl_netinet_intr_direct_queue_drops(SYSCTL_HANDLER_ARGS)
+{
+   u_int64_t qdrops_long;
+   int error,

svn commit: r271299 - head/usr.sbin/bhyve

2014-09-08 Thread Peter Grehan
Author: grehan
Date: Tue Sep  9 04:11:54 2014
New Revision: 271299
URL: http://svnweb.freebsd.org/changeset/base/271299

Log:
  Add a callback to be notified about negotiated features.
  
  Submitted by: luigi
  Obtained from:Vincenzo Maffione, Universita` di Pisa
  MFC after:3 days

Modified:
  head/usr.sbin/bhyve/pci_virtio_block.c
  head/usr.sbin/bhyve/pci_virtio_net.c
  head/usr.sbin/bhyve/pci_virtio_rnd.c
  head/usr.sbin/bhyve/virtio.c
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==
--- head/usr.sbin/bhyve/pci_virtio_block.c  Tue Sep  9 04:00:30 2014
(r271298)
+++ head/usr.sbin/bhyve/pci_virtio_block.c  Tue Sep  9 04:11:54 2014
(r271299)
@@ -133,6 +133,7 @@ static struct virtio_consts vtblk_vi_con
pci_vtblk_notify,   /* device-wide qnotify */
pci_vtblk_cfgread,  /* read PCI config */
pci_vtblk_cfgwrite, /* write PCI config */
+   NULL,   /* apply negotiated features */
VTBLK_S_HOSTCAPS,   /* our capabilities */
 };
 

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==
--- head/usr.sbin/bhyve/pci_virtio_net.cTue Sep  9 04:00:30 2014
(r271298)
+++ head/usr.sbin/bhyve/pci_virtio_net.cTue Sep  9 04:11:54 2014
(r271299)
@@ -160,6 +160,7 @@ static struct virtio_consts vtnet_vi_con
NULL,   /* device-wide qnotify -- not used */
pci_vtnet_cfgread,  /* read PCI config */
pci_vtnet_cfgwrite, /* write PCI config */
+   NULL,   /* apply negotiated features */
VTNET_S_HOSTCAPS,   /* our capabilities */
 };
 

Modified: head/usr.sbin/bhyve/pci_virtio_rnd.c
==
--- head/usr.sbin/bhyve/pci_virtio_rnd.cTue Sep  9 04:00:30 2014
(r271298)
+++ head/usr.sbin/bhyve/pci_virtio_rnd.cTue Sep  9 04:11:54 2014
(r271299)
@@ -80,6 +80,7 @@ static struct virtio_consts vtrnd_vi_con
pci_vtrnd_notify,   /* device-wide qnotify */
NULL,   /* read virtio config */
NULL,   /* write virtio config */
+   NULL,   /* apply negotiated features */
0,  /* our capabilities */
 };
 

Modified: head/usr.sbin/bhyve/virtio.c
==
--- head/usr.sbin/bhyve/virtio.cTue Sep  9 04:00:30 2014
(r271298)
+++ head/usr.sbin/bhyve/virtio.cTue Sep  9 04:11:54 2014
(r271299)
@@ -698,6 +698,9 @@ bad:
switch (offset) {
case VTCFG_R_GUESTCAP:
vs->vs_negotiated_caps = value & vc->vc_hv_caps;
+   if (vc->vc_apply_features)
+   (*vc->vc_apply_features)(DEV_SOFTC(vs),
+   vs->vs_negotiated_caps);
break;
case VTCFG_R_PFN:
if (vs->vs_curq >= vc->vc_nvq)

Modified: head/usr.sbin/bhyve/virtio.h
==
--- head/usr.sbin/bhyve/virtio.hTue Sep  9 04:00:30 2014
(r271298)
+++ head/usr.sbin/bhyve/virtio.hTue Sep  9 04:11:54 2014
(r271299)
@@ -352,6 +352,8 @@ struct virtio_consts {
/* called to read config regs */
int (*vc_cfgwrite)(void *, int, int, uint32_t);
/* called to write config regs */
+   void(*vc_apply_features)(void *, uint64_t);
+   /* called to apply negotiated features */
uint64_t vc_hv_caps;/* hypervisor-provided capabilities */
 };
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271297 - head/sys/netinet

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 03:10:21 2014
New Revision: 271297
URL: http://svnweb.freebsd.org/changeset/base/271297

Log:
  Implement IPv4 RSS software hash functions to use during packet ingress
  and egress.
  
  * rss_mbuf_software_hash_v4 - look at the IPv4 mbuf to fetch the IPv4 details
+ direction to calculate a hash.
  * rss_proto_software_hash_v4 - hash the given source/destination IPv4 address,
port and direction.
  * rss_soft_m2cpuid - map the given mbuf to an RSS CPU ("bucket" for now)
  
  These functions are intended to be used by the stack to support
  the following:
  
  * Not all NICs do RSS hashing, so we should support some way of doing
a hash in software;
  * The NIC / driver may not hash frames the way we want (eg UDP 4-tuple
hashing when the stack is only doing 2-tuple hashing for UDP); so we
may need to re-hash frames;
  * .. same with IPv4 fragments - they will need to be re-hashed after
reassembly;
  * .. and same with things like IP tunneling and such;
  * The transmit path for things like UDP, RAW and ICMP don't currently
have any RSS information attached to them - so they'll need an
RSS calculation performed before transmit.
  
  TODO:
  
  * Counters! Everywhere!
  * Add a debug mode that software hashes received frames and compares them
to the hardware hash provided by the hardware to ensure they match.
  
  The IPv6 part of this is missing - I'm going to do some re-juggling of
  where various parts of the RSS framework live before I add the IPv6
  code (read: the IPv6 code is going to go into netinet6/in6_rss.[ch],
  rather than living here.)
  
  Note: This API is still fluid.  Please keep that in mind.
  
  Differential Revision:https://reviews.freebsd.org/D527
  Reviewed by:  grehan

Modified:
  head/sys/netinet/in_rss.c
  head/sys/netinet/in_rss.h

Modified: head/sys/netinet/in_rss.c
==
--- head/sys/netinet/in_rss.c   Tue Sep  9 02:58:58 2014(r271296)
+++ head/sys/netinet/in_rss.c   Tue Sep  9 03:10:21 2014(r271297)
@@ -57,6 +57,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+/* for software rss hash support */
+#include 
+#include 
+#include 
+
 /*-
  * Operating system parts of receiver-side scaling (RSS), which allows
  * network cards to direct flows to particular receive queues based on hashes
@@ -170,6 +175,8 @@ struct rss_table_entry {
 };
 static struct rss_table_entry  rss_table[RSS_TABLE_MAXLEN];
 
+static inline u_int rss_gethashconfig_local(void);
+
 static void
 rss_init(__unused void *arg)
 {
@@ -491,6 +498,254 @@ rss_m2bucket(struct mbuf *m, uint32_t *b
 }
 
 /*
+ * Calculate an appropriate ipv4 2-tuple or 4-tuple given the given
+ * IPv4 source/destination address, UDP or TCP source/destination ports
+ * and the protocol type.
+ *
+ * The protocol code may wish to do a software hash of the given
+ * tuple.  This depends upon the currently configured RSS hash types.
+ *
+ * This assumes that the packet in question isn't a fragment.
+ *
+ * It also assumes the packet source/destination address
+ * are in "incoming" packet order (ie, source is "far" address.)
+ */
+int
+rss_proto_software_hash_v4(struct in_addr s, struct in_addr d,
+u_short sp, u_short dp, int proto,
+uint32_t *hashval, uint32_t *hashtype)
+{
+   uint32_t hash;
+
+   /*
+* Next, choose the hash type depending upon the protocol
+* identifier.
+*/
+   if ((proto == IPPROTO_TCP) &&
+   (rss_gethashconfig_local() & RSS_HASHTYPE_RSS_TCP_IPV4)) {
+   hash = rss_hash_ip4_4tuple(s, sp, d, dp);
+   *hashval = hash;
+   *hashtype = M_HASHTYPE_RSS_TCP_IPV4;
+   return (0);
+   } else if ((proto == IPPROTO_UDP) &&
+   (rss_gethashconfig_local() & RSS_HASHTYPE_RSS_UDP_IPV4)) {
+   hash = rss_hash_ip4_4tuple(s, sp, d, dp);
+   *hashval = hash;
+   *hashtype = M_HASHTYPE_RSS_UDP_IPV4;
+   return (0);
+   } else if (rss_gethashconfig_local() & RSS_HASHTYPE_RSS_IPV4) {
+   /* RSS doesn't hash on other protocols like SCTP; so 2-tuple */
+   hash = rss_hash_ip4_2tuple(s, d);
+   *hashval = hash;
+   *hashtype = M_HASHTYPE_RSS_IPV4;
+   return (0);
+   }
+
+   /* No configured available hashtypes! */
+   printf("%s: no available hashtypes!\n", __func__);
+   return (-1);
+}
+
+/*
+ * Do a software calculation of the RSS for the given mbuf.
+ *
+ * This is typically used by the input path to recalculate the RSS after
+ * some form of packet processing (eg de-capsulation, IP fragment reassembly.)
+ *
+ * dir is the packet direction - RSS_HASH_PKT_INGRESS for incoming and
+ * RSS_HASH_PKT_EGRESS for outgoing.
+ *
+ * Returns 0 if a hash was done, -1 if no hash was done, +1 if
+ * the mbuf already had a valid RSS flowid.
+ *
+ * This func

Re: svn commit: r271296 - head/tools/regression/lib/msun

2014-09-08 Thread yaneurabeya
On Sep 8, 2014, at 19:58, Garrett Cooper  wrote:

> Author: ngie
> Date: Tue Sep  9 02:58:58 2014
> New Revision: 271296
> URL: http://svnweb.freebsd.org/changeset/base/271296
> 
> Log:
>  Be ANSI-C compliant when defining CX_LIMITED_RANGE #pragma
> 
>  This mutes warnings with clang
> 
>  Approved by: rpaulo (mentor)
>  Reviewed by: das, kargl (both as part of a larger patch)
>  Phabric: D742
>  Sponsored by: EMC / Isilon Storage Division

Forgot to add:

MFC after: 3 days


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r271296 - head/tools/regression/lib/msun

2014-09-08 Thread Garrett Cooper
Author: ngie
Date: Tue Sep  9 02:58:58 2014
New Revision: 271296
URL: http://svnweb.freebsd.org/changeset/base/271296

Log:
  Be ANSI-C compliant when defining CX_LIMITED_RANGE #pragma
  
  This mutes warnings with clang
  
  Approved by: rpaulo (mentor)
  Reviewed by: das, kargl (both as part of a larger patch)
  Phabric: D742
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tools/regression/lib/msun/test-conj.c
  head/tools/regression/lib/msun/test-csqrt.c

Modified: head/tools/regression/lib/msun/test-conj.c
==
--- head/tools/regression/lib/msun/test-conj.c  Tue Sep  9 02:53:55 2014
(r271295)
+++ head/tools/regression/lib/msun/test-conj.c  Tue Sep  9 02:58:58 2014
(r271296)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include "test-utils.h"
 
-#pragmaSTDC CX_LIMITED_RANGE   off
+#pragmaSTDC CX_LIMITED_RANGE   OFF
 
 /* Make sure gcc doesn't use builtin versions of these or honor __pure2. */
 static float complex (*libconjf)(float complex) = conjf;

Modified: head/tools/regression/lib/msun/test-csqrt.c
==
--- head/tools/regression/lib/msun/test-csqrt.c Tue Sep  9 02:53:55 2014
(r271295)
+++ head/tools/regression/lib/msun/test-csqrt.c Tue Sep  9 02:58:58 2014
(r271296)
@@ -62,7 +62,7 @@ _csqrt(long double complex d)
return (csqrt((double complex)d));
 }
 
-#pragmaSTDC CX_LIMITED_RANGE   off
+#pragmaSTDC CX_LIMITED_RANGE   OFF
 
 /*
  * Compare d1 and d2 using special rules: NaN == NaN and +0 != -0.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271293 - head/sys/netinet

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 01:45:39 2014
New Revision: 271293
URL: http://svnweb.freebsd.org/changeset/base/271293

Log:
  Add support for receiving and setting flowtype, flowid and RSS bucket
  information as part of recvmsg().
  
  This is primarily used for debugging/verification of the various
  processing paths in the IP, PCB and driver layers.
  
  Unfortunately the current implementation of the control message path
  results in a ~10% or so drop in UDP frame throughput when it's used.
  
  Differential Revision:https://reviews.freebsd.org/D527
  Reviewed by:  grehan

Modified:
  head/sys/netinet/in.h
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_output.c
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Tue Sep  9 00:21:21 2014(r271292)
+++ head/sys/netinet/in.h   Tue Sep  9 01:45:39 2014(r271293)
@@ -492,6 +492,8 @@ __END_DECLS
 #defineIP_FLOWID   90   /* get flow id for the given 
socket/inp */
 #defineIP_FLOWTYPE 91   /* get flow type (M_HASHTYPE) */
 #defineIP_RSSBUCKETID  92   /* get RSS flowid -> bucket 
mapping */
+#defineIP_RECVFLOWID   93   /* bool; receive IP 
flowid/flowtype w/ datagram */
+#defineIP_RECVRSSBUCKETID  94   /* bool; receive IP RSS bucket id 
w/ datagram */
 
 /*
  * Defaults and limits for options

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Tue Sep  9 00:21:21 2014(r271292)
+++ head/sys/netinet/in_pcb.h   Tue Sep  9 01:45:39 2014(r271293)
@@ -549,6 +549,8 @@ short   inp_so_options(const struct inpcb 
 #defineINP_REUSEADDR   0x0020 /* SO_REUSEADDR option is 
set */
 #defineINP_BINDMULTI   0x0040 /* IP_BINDMULTI option is 
set */
 #defineINP_RSS_BUCKET_SET  0x0080 /* IP_RSS_LISTEN_BUCKET is 
set */
+#defineINP_RECVFLOWID  0x0100 /* populate recv datagram 
with flow info */
+#defineINP_RECVRSSBUCKETID 0x0200 /* populate recv datagram 
with bucket id */
 
 /*
  * Flags passed to in_pcblookup*() functions.

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Tue Sep  9 00:21:21 2014(r271292)
+++ head/sys/netinet/ip_input.c Tue Sep  9 01:45:39 2014(r271293)
@@ -1662,6 +1662,43 @@ makedummy:   
if (*mp)
mp = &(*mp)->m_next;
}
+
+   if (inp->inp_flags2 & INP_RECVFLOWID) {
+   uint32_t flowid, flow_type;
+
+   flowid = m->m_pkthdr.flowid;
+   flow_type = M_HASHTYPE_GET(m);
+
+   /*
+* XXX should handle the failure of one or the
+* other - don't populate both?
+*/
+   *mp = sbcreatecontrol((caddr_t) &flowid,
+   sizeof(uint32_t), IP_FLOWID, IPPROTO_IP);
+   if (*mp)
+   mp = &(*mp)->m_next;
+   *mp = sbcreatecontrol((caddr_t) &flow_type,
+   sizeof(uint32_t), IP_FLOWTYPE, IPPROTO_IP);
+   if (*mp)
+   mp = &(*mp)->m_next;
+   }
+
+#ifdef RSS
+   if (inp->inp_flags2 & INP_RECVRSSBUCKETID) {
+   uint32_t flowid, flow_type;
+   uint32_t rss_bucketid;
+
+   flowid = m->m_pkthdr.flowid;
+   flow_type = M_HASHTYPE_GET(m);
+
+   if (rss_hash2bucket(flowid, flow_type, &rss_bucketid) == 0) {
+   *mp = sbcreatecontrol((caddr_t) &rss_bucketid,
+  sizeof(uint32_t), IP_RSSBUCKETID, IPPROTO_IP);
+   if (*mp)
+   mp = &(*mp)->m_next;
+   }
+   }
+#endif
 }
 
 /*

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cTue Sep  9 00:21:21 2014
(r271292)
+++ head/sys/netinet/ip_output.cTue Sep  9 01:45:39 2014
(r271293)
@@ -1016,6 +1016,10 @@ ip_ctloutput(struct socket *so, struct s
case IP_ONESBCAST:
case IP_DONTFRAG:
case IP_RECVTOS:
+   case IP_RECVFLOWID:
+#ifdef RSS
+   case IP_RECVRSSBUCKETID:
+#endif
error = sooptcopyin(sopt, &optval, sizeof optval,
sizeof optval);
if (error)
@@ -1094,6 +1098,9 @@ ip_ctloutput(struct socket *so, struct s
case IP_BINDMULTI:
OPTSET2(INP_BINDMULTI, optval);
b

svn commit: r271292 - head/sys/netinet6

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 00:21:21 2014
New Revision: 271292
URL: http://svnweb.freebsd.org/changeset/base/271292

Log:
  Add IP_NODEFAULTFLOWID awareness to ip6_output().
  
  Differential Revision:https://reviews.freebsd.org/D527

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Sep  9 00:19:02 2014
(r271291)
+++ head/sys/netinet6/ip6_output.c  Tue Sep  9 00:21:21 2014
(r271292)
@@ -227,6 +227,9 @@ in6_delayed_cksum(struct mbuf *m, uint32
  *
  * ifpp - XXX: just for statistics
  */
+/*
+ * XXX TODO: no flowid is assigned for outbound flows?
+ */
 int
 ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 struct route_in6 *ro, int flags, struct ip6_moptions *im6o,
@@ -260,8 +263,14 @@ ip6_output(struct mbuf *m0, struct ip6_p
goto bad;
}
 
-   if (inp != NULL)
+   if (inp != NULL) {
M_SETFIB(m, inp->inp_inc.inc_fibnum);
+   if (((flags & IP_NODEFAULTFLOWID) == 0) &&
+   (inp->inp_flags & (INP_HW_FLOWID|INP_SW_FLOWID))) {
+   m->m_pkthdr.flowid = inp->inp_flowid;
+   m->m_flags |= M_FLOWID;
+   }
+   }
 
finaldst = ip6->ip6_dst;
bzero(&exthdrs, sizeof(exthdrs));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271291 - head/sys/netinet

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Tue Sep  9 00:19:02 2014
New Revision: 271291
URL: http://svnweb.freebsd.org/changeset/base/271291

Log:
  Add a flag to ip_output() - IP_NODEFAULTFLOWID - which prevents it from
  overriding an existing flowid/flowtype field in the outbound mbuf with
  the inp_flowid/inp_flowtype details.
  
  The upcoming RSS UDP support calculates a valid RSS value for outbound
  mbufs and since it may change per send, it doesn't cache it in the inpcb.
  So overriding it here would be wrong.
  
  Differential Revision:https://reviews.freebsd.org/D527
  Reviewed by:  grehan

Modified:
  head/sys/netinet/ip_output.c
  head/sys/netinet/ip_var.h

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cMon Sep  8 21:46:14 2014
(r271290)
+++ head/sys/netinet/ip_output.cTue Sep  9 00:19:02 2014
(r271291)
@@ -145,7 +145,8 @@ ip_output(struct mbuf *m, struct mbuf *o
if (inp != NULL) {
INP_LOCK_ASSERT(inp);
M_SETFIB(m, inp->inp_inc.inc_fibnum);
-   if (inp->inp_flags & (INP_HW_FLOWID|INP_SW_FLOWID)) {
+   if (((flags & IP_NODEFAULTFLOWID) == 0) &&
+   inp->inp_flags & (INP_HW_FLOWID|INP_SW_FLOWID)) {
m->m_pkthdr.flowid = inp->inp_flowid;
M_HASHTYPE_SET(m, inp->inp_flowtype);
m->m_flags |= M_FLOWID;

Modified: head/sys/netinet/ip_var.h
==
--- head/sys/netinet/ip_var.h   Mon Sep  8 21:46:14 2014(r271290)
+++ head/sys/netinet/ip_var.h   Tue Sep  9 00:19:02 2014(r271291)
@@ -161,6 +161,7 @@ voidkmod_ipstat_dec(int statnum);
 #defineIP_SENDTOIF 0x8 /* send on specific 
ifnet */
 #define IP_ROUTETOIF   SO_DONTROUTE/* 0x10 bypass routing tables */
 #define IP_ALLOWBROADCAST  SO_BROADCAST/* 0x20 can send broadcast 
packets */
+#defineIP_NODEFAULTFLOWID  0x40/* Don't set the flowid 
from inp */
 
 #ifdef __NO_STRICT_ALIGNMENT
 #define IP_HDR_ALIGNED_P(ip)   1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r270759 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs vm

2014-09-08 Thread Slawa Olhovchenkov
On Fri, Sep 05, 2014 at 12:23:26PM +0300, Andriy Gapon wrote:

> on 04/09/2014 04:18 Steven Hartland said the following:
> > Indeed that would be interesting, but we might find that its quite memory 
> > size
> > dependent given the scaling so confirming HW details would be nice too.
> > 
> > I'd also be interested to know who wins the free race between the VM and ARC
> > when using that value.
> 
> BTW, I've written a small silly program that tests for a problem that affected
> me in the distant past: http://people.freebsd.org/~avg/arc-vs-swap.c
> 
> It gobbles almost all of the memory and then just sits on it never accessing 
> it
> again.  At the same time it repeatedly reads blocks of data from a large file.
> The idea is that eventually the unused memory should be pushed out to the swap
> and the ARC is allowed to grow to accommodate for the data being read.
> 
> I run this program on a freshly booted system without any other applications.
> Prior to r270759 the system behaves as expected.  Although the pace of 
> shifting
> balance between the ARC and the swap-backed pages is quite slow.
> After r270759 and with the default tuning the ARC always sits at its minimum
> size.  To me this is a regression.
> 
> To summarize: I really appreciate the improvements that you are making here
> https://reviews.freebsd.org/D702
> Thanks!
> 
> P.S.
> I wish there was an easy way to make the page cache and the ARC aware of each 
> other.

I think no single way for any workload.
For some workloads ARC is prefered.
For some -- RSS is prefered.
May be need some tunable for elastics factor ARC/RSS?

PS: very bad that 'data limit' don't anymore reflect application
memory consumer. and very small application can adapt to 'no memory'
from system.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r270759 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs vm

2014-09-08 Thread Nikolai Lifanov

On 2014-09-03 21:18, Steven Hartland wrote:

- Original Message - From: "Andriy Gapon" 



on 03/09/2014 23:22 Nikolai Lifanov said the following:

On 09/03/14 15:22, John Baldwin wrote:

On Wednesday, September 03, 2014 11:05:04 AM Nikolai Lifanov wrote:

On 09/03/14 04:09, Steven Hartland wrote:

I'm looking to MFC this change so wanted to check if
anyone had an final feedback / objections?

I know we currently have Alan's feedback on changing
the #ifdef __i386__ to #ifndef UMA_MD_SMALL_ALLOC
which sounds sensible but waiting Peter to comment on.

   Regards
   Steve


I have no technical input, but this change improves ARC usefulness 
for

me quite a bit. I would like to see the improvement in 10-STABLE.


Can you verify that the current 10-STABLE (as of today) with all the 
various pagedaemon fixes still has ARC issues for your workload?




It doesn't have any issues, but I noticed the improvement on CURRENT. 
I

observed that just after this change, my package builder is much more
likely to retain MFU and not evict useful things from there (the port
tree) after large builds.
However, I run a lot more 10.0-RELEASE than CURRENT and I would like 
to

see this improvement release-bound.

I would be happy to test this on 10-STABLE if you think that this is
relevant.



As noted before, unfortunately, this commit (plus its fixups) contains 
at least
two related but distinct changes.  So, to separate the wheat from the 
chaff,

could you please try to comment out the following block in
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c, function 
arc_reclaim_needed:


   if (kmem_free_count() < zfs_arc_free_target) {
   DTRACE_PROBE2(arc__reclaim_freetarget, uint64_t,
   kmem_free_count(), uint64_t, zfs_arc_free_target);
   return (1);
   }

Alternatively, I think that the same effect can be achieved by setting 
sysctl

vfs.zfs.arc_free_target to the same value as vm.stats.vm.v_free_min.


Thats correct that would achieve the same thing.

It's interesting to me whether you would still see the better 
performance or if

that improvement would be undone.


Indeed that would be interesting, but we might find that its quite 
memory size

dependent given the scaling so confirming HW details would be nice too.

I'd also be interested to know who wins the free race between the VM 
and ARC

when using that value.

For those following this thread but not the review, I've added some 
additional

information there which you might be interested in:
https://reviews.freebsd.org/D702

   Regards
   Steve


I had time to re-test both the "stock" condition after the improvements 
and the condition in which 
vfs.zfs.arc_free_target=vm.stats.vm.v_free_min. It seems that MFU is 
more likely to be reduced in the second case.


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


Re: svn commit: r270759 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs vm

2014-09-08 Thread John Baldwin
On Sunday, September 07, 2014 04:56:49 PM Slawa Olhovchenkov wrote:
> PS: very bad that 'data limit' don't anymore reflect application
> memory consumer. and very small application can adapt to 'no memory'
> from system.

You can use RLIMIT_AS instead of RLIMIT_DATA.  jemalloc can also be configured 
to use sbrk(), though I think there's no way to prevent it from falling back 
to mmap(MAP_ANON) if sbrk() fails.

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


svn commit: r271287 - head/contrib/libc-vis

2014-09-08 Thread Brooks Davis
Author: brooks
Date: Mon Sep  8 19:26:21 2014
New Revision: 271287
URL: http://svnweb.freebsd.org/changeset/base/271287

Log:
  Merge from NetBSD:
  
  PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings
  gracefully.  (don't abuse 0 to mean compute string length internally)
  
  PR:   193447
  Submitted by: Conrad Meyer 
  MFC after:1 month

Modified:
  head/contrib/libc-vis/vis.c
Directory Properties:
  head/contrib/libc-vis/   (props changed)

Modified: head/contrib/libc-vis/vis.c
==
--- head/contrib/libc-vis/vis.c Mon Sep  8 19:24:25 2014(r271286)
+++ head/contrib/libc-vis/vis.c Mon Sep  8 19:26:21 2014(r271287)
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $   */
+/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $");
+__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 #ifdef __FBSDID
 __FBSDID("$FreeBSD$");
@@ -357,7 +357,7 @@ istrsenvisx(char *mbdst, size_t *dlen, c
ssize_t mbslength, maxolen;
 
_DIAGASSERT(mbdst != NULL);
-   _DIAGASSERT(mbsrc != NULL);
+   _DIAGASSERT(mbsrc != NULL || mblength == 0);
_DIAGASSERT(mbextra != NULL);
 
/*
@@ -375,8 +375,6 @@ istrsenvisx(char *mbdst, size_t *dlen, c
 
/* Allocate space for the wide char strings */
psrc = pdst = extra = NULL;
-   if (!mblength)
-   mblength = strlen(mbsrc);
if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL)
return -1;
if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL)
@@ -528,6 +526,15 @@ out:
free(psrc);
return error;
 }
+
+static int
+istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc,
+int flags, const char *mbextra, int *cerr_ptr)
+{
+   return istrsenvisx(mbdst, dlen, mbsrc,
+   mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr);
+}
+
 #endif
 
 #if !HAVE_SVIS
@@ -571,13 +578,13 @@ snvis(char *mbdst, size_t dlen, int c, i
 int
 strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra)
 {
-   return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, mbextra, NULL);
+   return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL);
 }
 
 int
 strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char 
*mbextra)
 {
-   return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, mbextra, NULL);
+   return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL);
 }
 
 int
@@ -646,13 +653,13 @@ nvis(char *mbdst, size_t dlen, int c, in
 int
 strvis(char *mbdst, const char *mbsrc, int flags)
 {
-   return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, "", NULL);
+   return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL);
 }
 
 int
 strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags)
 {
-   return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, "", NULL);
+   return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271286 - head/sys/dev/ixgbe

2014-09-08 Thread Christian Brueffer
Author: brueffer
Date: Mon Sep  8 19:24:25 2014
New Revision: 271286
URL: http://svnweb.freebsd.org/changeset/base/271286

Log:
  Use the right constants in comparisons.  This is currently a nop, as
  MIN_RXD == MIN_TXD and MAX_RXD == MAX_TXD.
  
  Reviewed by:  Eric Joyner @ Intel
  MFC after:1 week

Modified:
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/ixgbe/ixv.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Mon Sep  8 19:19:10 2014(r271285)
+++ head/sys/dev/ixgbe/ixgbe.c  Mon Sep  8 19:24:25 2014(r271286)
@@ -514,7 +514,7 @@ ixgbe_attach(device_t dev)
}
 
if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
-   ixgbe_rxd < MIN_TXD || ixgbe_rxd > MAX_TXD) {
+   ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) {
device_printf(dev, "RXD config issue, using default!\n");
adapter->num_rx_desc = DEFAULT_RXD;
} else

Modified: head/sys/dev/ixgbe/ixv.c
==
--- head/sys/dev/ixgbe/ixv.cMon Sep  8 19:19:10 2014(r271285)
+++ head/sys/dev/ixgbe/ixv.cMon Sep  8 19:24:25 2014(r271286)
@@ -347,7 +347,7 @@ ixv_attach(device_t dev)
adapter->num_tx_desc = ixv_txd;
 
if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
-   ixv_rxd < MIN_TXD || ixv_rxd > MAX_TXD) {
+   ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) {
device_printf(dev, "RXD config issue, using default!\n");
adapter->num_rx_desc = DEFAULT_RXD;
} else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271285 - in head/sys/boot: arm/uboot uboot/common

2014-09-08 Thread Ian Lepore
Author: ian
Date: Mon Sep  8 19:19:10 2014
New Revision: 271285
URL: http://svnweb.freebsd.org/changeset/base/271285

Log:
  Add a 'ubenv import' command to import environment variables from the
  u-boot env into the loader(8) env (which also gets them into the kernel
  env).  You can import selected variables or the whole environment.  Each
  u-boot var=value becomes uboot.var=value in the loader env.  You can also
  use 'ubenv show' to display uboot vars without importing them.

Modified:
  head/sys/boot/arm/uboot/help.uboot
  head/sys/boot/uboot/common/main.c

Modified: head/sys/boot/arm/uboot/help.uboot
==
--- head/sys/boot/arm/uboot/help.uboot  Mon Sep  8 19:00:13 2014
(r271284)
+++ head/sys/boot/arm/uboot/help.uboot  Mon Sep  8 19:19:10 2014
(r271285)
@@ -1 +1,27 @@
 $FreeBSD$
+
+###
+# Tubenv DShow or import U-Boot environment variables
+
+   ubenv  [varname ...]
+
+   Display U-Boot environment variables, or import them into the
+   loader environment (which makes them available in the kernel).
+
+###
+# Tubenv Simport DImport U-Boot env vars
+
+   ubenv import [varname ...]
+
+   If no variable names are specified, all U-Boot environment
+   variables are imported.  Each variable is prefixed with "uboot."
+   to avoid any possible conflicts with loader or kernel variables.
+
+###
+# Tubenv Sshow DShow U-Boot env vars
+
+   ubenv show [varname ...]
+
+   If no variable names are specified, all U-Boot environment
+   variables are shown.
+

Modified: head/sys/boot/uboot/common/main.c
==
--- head/sys/boot/uboot/common/main.c   Mon Sep  8 19:00:13 2014
(r271284)
+++ head/sys/boot/uboot/common/main.c   Mon Sep  8 19:19:10 2014
(r271285)
@@ -556,6 +556,75 @@ command_sysinfo(int argc, char *argv[])
return (CMD_OK);
 }
 
+enum ubenv_action {
+   UBENV_UNKNOWN,
+   UBENV_SHOW,
+   UBENV_IMPORT
+};
+
+static void
+handle_uboot_env_var(enum ubenv_action action, const char * var)
+{
+   const char * val;
+   char ubv[128];
+
+   /*
+* If the user prepended "uboot." (which is how they usually see these
+* names) strip it off as a convenience.
+*/
+   if (strncmp(var, "uboot.", 6) == 0) {
+   snprintf(ubv, sizeof(ubv), "%s", &var[6]);
+   var = ubv;
+   }
+   val = ub_env_get(var);
+   if (action == UBENV_SHOW) {
+   if (val == NULL)
+   printf("uboot.%s is not set\n", var);
+   else
+   printf("uboot.%s=%s\n", var, val);
+   } else if (action == UBENV_IMPORT) {
+   if (val != NULL) {
+   snprintf(ubv, sizeof(ubv), "uboot.%s", var);
+   setenv(ubv, val, 1);
+   }
+   }
+}
+
+static int
+command_ubenv(int argc, char *argv[])
+{
+   enum ubenv_action action;
+   const char *var;
+   int i;
+
+   action = UBENV_UNKNOWN;
+   if (argc > 1) {
+   if (strcasecmp(argv[1], "import") == 0)
+   action = UBENV_IMPORT;
+   else if (strcasecmp(argv[1], "show") == 0)
+   action = UBENV_SHOW;
+   }
+   if (action == UBENV_UNKNOWN) {
+   command_errmsg = "usage: 'ubenv  [var ...]";
+   return (CMD_ERROR);
+   }
+
+   if (argc > 2) {
+   for (i = 2; i < argc; i++)
+   handle_uboot_env_var(action, argv[i]);
+   } else {
+   var = NULL;
+   for (;;) {
+   if ((var = ub_env_enum(var)) == NULL)
+   break;
+   handle_uboot_env_var(action, var);
+   }
+   }
+
+   return (CMD_OK);
+}
+COMMAND_SET(ubenv, "ubenv", "show or import U-Boot env vars", command_ubenv);
+
 #ifdef LOADER_FDT_SUPPORT
 /*
  * Since proper fdt command handling function is defined in fdt_loader_cmd.c,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271284 - head/crypto/heimdal/tools

2014-09-08 Thread Glen Barber
Author: gjb
Date: Mon Sep  8 19:00:13 2014
New Revision: 271284
URL: http://svnweb.freebsd.org/changeset/base/271284

Log:
  Include the gssapi_krb5 library in KRB5_LDFLAGS.
  
  PR:   156245
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/crypto/heimdal/tools/krb5-config.in

Modified: head/crypto/heimdal/tools/krb5-config.in
==
--- head/crypto/heimdal/tools/krb5-config.inMon Sep  8 18:48:54 2014
(r271283)
+++ head/crypto/heimdal/tools/krb5-config.inMon Sep  8 19:00:13 2014
(r271284)
@@ -123,7 +123,7 @@ if test "$do_libs" = "yes"; then
 lib_flags="-L${libdir}"
 case $library in
 gssapi)
-   lib_flags="$lib_flags -lgssapi -lheimntlm"
+   lib_flags="$lib_flags -lgssapi -lgssapi_krb5 -lheimntlm"
;;
 kadm-client)
lib_flags="$lib_flags -lkadm5clnt"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271283 - head/contrib/llvm/patches

2014-09-08 Thread Ed Maste
Author: emaste
Date: Mon Sep  8 18:48:54 2014
New Revision: 271283
URL: http://svnweb.freebsd.org/changeset/base/271283

Log:
  Add clang patch for r271282
  
  Note that r271282 contains only the src change from Clang rev 200797.
  This patch file includes two follow-on changes to the test case, which
  do not apply to the copy in the FreeBSD tree.
  
  Upstream Clang revisions:
  
  200797:
  
  Debug info: fix a crasher when when emitting debug info for
  not-yet-completed templated types. getTypeSize() needs a complete type.
  
  rdar://problem/15931354
  
  200798:
  
  Simplify testcase from r200797 some more.
  
  200805:
  
  Further simplify r200797 and add an explanatory comment.
  
  PR:   193347
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Added:
  
head/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff

Added: 
head/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/contrib/llvm/patches/patch-r271282-clang-r200797-r200798-r200805-debug-info-crash.diff
 Mon Sep  8 18:48:54 2014(r271283)
@@ -0,0 +1,51 @@
+diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
+index 59ba47c..dddc7e7 100644
+--- a/lib/CodeGen/CGDebugInfo.cpp
 b/lib/CodeGen/CGDebugInfo.cpp
+@@ -2251,9 +2251,10 @@ llvm::DICompositeType 
CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
+   if (T && (!T.isForwardDecl() || !RD->getDefinition()))
+   return T;
+ 
+-  // If this is just a forward declaration, construct an appropriately
+-  // marked node and just return it.
+-  if (!RD->getDefinition())
++  // If this is just a forward or incomplete declaration, construct an
++  // appropriately marked node and just return it.
++  const RecordDecl *D = RD->getDefinition();
++  if (!D || !D->isCompleteDefinition())
+ return getOrCreateRecordFwdDecl(Ty, RDContext);
+ 
+   uint64_t Size = CGM.getContext().getTypeSize(Ty);
+diff --git a/test/CodeGenCXX/debug-info-template-fwd.cpp 
b/test/CodeGenCXX/debug-info-template-fwd.cpp
+new file mode 100644
+index 000..b2b7073
+--- /dev/null
 b/test/CodeGenCXX/debug-info-template-fwd.cpp
+@@ -0,0 +1,27 @@
++// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -g -emit-llvm -o - | 
FileCheck %s
++// This test is for a crash when emitting debug info for not-yet-completed
++// types.
++// Test that we don't actually emit a forward decl for the offending class:
++// CHECK:  [ DW_TAG_structure_type ] [Derived] {{.*}} [def]
++// rdar://problem/15931354
++template  class Derived;
++
++template  class Base {
++  static Derived *create();
++};
++
++template  struct Derived : Base {
++};
++
++Base *f;
++
++// During the instantiation of Derived, Base becomes required to be
++// complete - since the declaration has already been emitted (due to 'f',
++// above), we immediately try to build debug info for Base which then
++// requires the (incomplete definition) of Derived which is problematic.
++//
++// (if 'f' is not present, the point at which Base becomes required to be
++// complete during the instantiation of Derived is a no-op because
++// Base was never emitted so we ignore it and carry on until we
++// wire up the base class of Derived in the debug info later on)
++Derived d;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271282 - head/contrib/llvm/tools/clang/lib/CodeGen

2014-09-08 Thread Ed Maste
Author: emaste
Date: Mon Sep  8 18:43:33 2014
New Revision: 271282
URL: http://svnweb.freebsd.org/changeset/base/271282

Log:
  Merge Clang debug info crash fix rev 200797:
  
  Debug info: fix a crasher when when emitting debug info for
  not-yet-completed templated types. getTypeSize() needs a complete type.
  
  rdar://problem/15931354
  
  PR:   193347
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==
--- head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp   Mon Sep  8 
18:11:20 2014(r271281)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp   Mon Sep  8 
18:43:33 2014(r271282)
@@ -2235,9 +2235,10 @@ llvm::DICompositeType CGDebugInfo::Creat
   if (T && (!T.isForwardDecl() || !RD->getDefinition()))
   return T;
 
-  // If this is just a forward declaration, construct an appropriately
-  // marked node and just return it.
-  if (!RD->getDefinition())
+  // If this is just a forward or incomplete declaration, construct an
+  // appropriately marked node and just return it.
+  const RecordDecl *D = RD->getDefinition();
+  if (!D || !D->isCompleteDefinition())
 return getOrCreateRecordFwdDecl(Ty, RDContext);
 
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271278 - head/tools

2014-09-08 Thread Bryan Drewery
Author: bdrewery
Date: Mon Sep  8 17:01:30 2014
New Revision: 271278
URL: http://svnweb.freebsd.org/changeset/base/271278

Log:
  Avoid rs(1) hitting LINE_MAX with custom trees that have large dependencies.

Modified:
  head/tools/make_libdeps.sh

Modified: head/tools/make_libdeps.sh
==
--- head/tools/make_libdeps.sh  Mon Sep  8 15:42:47 2014(r271277)
+++ head/tools/make_libdeps.sh  Mon Sep  8 17:01:30 2014(r271278)
@@ -89,12 +89,12 @@ main()
fi
 
prebuild_libs=$(
-   awk -F"${FS}" '{ print $2 }' ${LIBDEPENDS} |rs 0 1 |sort -u
+   awk -F"${FS}" '{ print $2 }' ${LIBDEPENDS} | tr ' ' '\n' |
+   sort -u
)
echo "Libraries with dependents:"
echo
-   echo ${prebuild_libs} |
-   rs 0 1
+   echo ${prebuild_libs} | tr ' ' '\n'
echo
 
echo "List of interdependencies:"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r271173 - in head/sys: conf gdb libkern sys

2014-09-08 Thread Julian Elischer

On 9/6/14, 12:40 AM, Benno Rice wrote:

Author: benno
Date: Fri Sep  5 16:40:47 2014
New Revision: 271173
URL: http://svnweb.freebsd.org/changeset/base/271173

Log:
   Add support for gdb's memory searching capabilities to our in-kernel gdb
   server.
   
   Submitted by:	Daniel O'Connor 

   Reviewed by: jhb
   Sponsored by:EMC Isilon Storage Division

MFC?

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


svn commit: r271262 - in head/etc: defaults rc.d

2014-09-08 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Sep  8 12:26:52 2014
New Revision: 271262
URL: http://svnweb.freebsd.org/changeset/base/271262

Log:
  Revert r271257 after several issues were pointed out.  An updated patch
  will be committed at a later date.

Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.d/local_unbound

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Mon Sep  8 12:11:49 2014(r271261)
+++ head/etc/defaults/rc.conf   Mon Sep  8 12:26:52 2014(r271262)
@@ -267,13 +267,6 @@ 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
-local_unbound_program="/usr/sbin/unbound"
-local_unbound_workdir=/var/unbound
-local_unbound_config="${local_unbound_workdir}/unbound.conf"
-local_unbound_flags="-c${local_unbound_config}"
-local_unbound_forwardconf="${local_unbound_workdir}/forward.conf}"
-local_unbound_anchor="${local_unbound_workdir}/root.key"
-local_unbound_forwarders=""
 
 #
 # kerberos. Do not run the admin daemons on slave servers

Modified: head/etc/rc.d/local_unbound
==
--- head/etc/rc.d/local_unbound Mon Sep  8 12:11:49 2014(r271261)
+++ head/etc/rc.d/local_unbound Mon Sep  8 12:26:52 2014(r271262)
@@ -13,6 +13,7 @@ name="local_unbound"
 desc="local caching forwarding resolver"
 rcvar="local_unbound_enable"
 
+command="/usr/sbin/unbound"
 extra_commands="anchor configtest reload setup"
 start_precmd="local_unbound_prestart"
 reload_precmd="local_unbound_configtest"
@@ -21,9 +22,18 @@ configtest_cmd="local_unbound_configtest
 setup_cmd="local_unbound_setup"
 pidfile="/var/run/${name}.pid"
 
+: ${local_unbound_workdir:=/var/unbound}
+: ${local_unbound_config:=${local_unbound_workdir}/unbound.conf}
+: ${local_unbound_flags:=-c${local_unbound_config}}
+: ${local_unbound_forwardconf:=${local_unbound_workdir}/forward.conf}
+: ${local_unbound_anchor:=${local_unbound_workdir}/root.key}
+: ${local_unbound_forwarders:=}
+
+load_rc_config $name
+
 do_as_unbound()
 {
-   echo "$@" | /usr/bin/su -m unbound
+   echo "$@" | su -m unbound
 }
 
 #
@@ -31,8 +41,7 @@ do_as_unbound()
 #
 local_unbound_anchor()
 {
-   do_as_unbound ${local_unbound_program%/*}/unbound-anchor \
-   -a ${local_unbound_anchor}
+   do_as_unbound /usr/sbin/unbound-anchor -a ${local_unbound_anchor}
# we can't trust the exit code - check if the file exists
[ -f ${local_unbound_anchor} ]
 }
@@ -42,8 +51,7 @@ local_unbound_anchor()
 #
 local_unbound_configtest()
 {
-   do_as_unbound ${local_unbound_program%/*}/unbound-checkconf \
-   ${local_unbound_config}
+   do_as_unbound /usr/sbin/unbound-checkconf ${local_unbound_config}
 }
 
 #
@@ -53,7 +61,7 @@ local_unbound_configtest()
 local_unbound_setup()
 {
echo "Performing initial setup."
-   ${local_unbound_program%/*}/local-unbound-setup -n \
+   /usr/sbin/local-unbound-setup -n \
-u unbound \
-w ${local_unbound_workdir} \
-c ${local_unbound_config} \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271261 - head/sys/dev/ahci

2014-09-08 Thread Alexander Motin
Author: mav
Date: Mon Sep  8 12:11:49 2014
New Revision: 271261
URL: http://svnweb.freebsd.org/changeset/base/271261

Log:
  Bunch of microoptimizations to reduce dereferences and cache collisions.

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h
  head/sys/dev/ahci/ahciem.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cMon Sep  8 11:18:27 2014(r271260)
+++ head/sys/dev/ahci/ahci.cMon Sep  8 12:11:49 2014(r271261)
@@ -61,31 +61,31 @@ static void ahci_ch_pm(void *arg);
 static void ahci_ch_intr(void *arg);
 static void ahci_ch_intr_direct(void *arg);
 static void ahci_ch_intr_main(struct ahci_channel *ch, uint32_t istatus);
-static void ahci_begin_transaction(device_t dev, union ccb *ccb);
+static void ahci_begin_transaction(struct ahci_channel *ch, union ccb *ccb);
 static void ahci_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int 
error);
 static void ahci_execute_transaction(struct ahci_slot *slot);
 static void ahci_timeout(struct ahci_slot *slot);
 static void ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type 
et);
-static int ahci_setup_fis(device_t dev, struct ahci_cmd_tab *ctp, union ccb 
*ccb, int tag);
+static int ahci_setup_fis(struct ahci_channel *ch, struct ahci_cmd_tab *ctp, 
union ccb *ccb, int tag);
 static void ahci_dmainit(device_t dev);
 static void ahci_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, 
int error);
 static void ahci_dmafini(device_t dev);
 static void ahci_slotsalloc(device_t dev);
 static void ahci_slotsfree(device_t dev);
-static void ahci_reset(device_t dev);
-static void ahci_start(device_t dev, int fbs);
-static void ahci_stop(device_t dev);
-static void ahci_clo(device_t dev);
-static void ahci_start_fr(device_t dev);
-static void ahci_stop_fr(device_t dev);
+static void ahci_reset(struct ahci_channel *ch);
+static void ahci_start(struct ahci_channel *ch, int fbs);
+static void ahci_stop(struct ahci_channel *ch);
+static void ahci_clo(struct ahci_channel *ch);
+static void ahci_start_fr(struct ahci_channel *ch);
+static void ahci_stop_fr(struct ahci_channel *ch);
 
 static int ahci_sata_connect(struct ahci_channel *ch);
-static int ahci_sata_phy_reset(device_t dev);
-static int ahci_wait_ready(device_t dev, int t, int t0);
+static int ahci_sata_phy_reset(struct ahci_channel *ch);
+static int ahci_wait_ready(struct ahci_channel *ch, int t, int t0);
 
-static void ahci_issue_recovery(device_t dev);
-static void ahci_process_read_log(device_t dev, union ccb *ccb);
-static void ahci_process_request_sense(device_t dev, union ccb *ccb);
+static void ahci_issue_recovery(struct ahci_channel *ch);
+static void ahci_process_read_log(struct ahci_channel *ch, union ccb *ccb);
+static void ahci_process_request_sense(struct ahci_channel *ch, union ccb 
*ccb);
 
 static void ahciaction(struct cam_sim *sim, union ccb *ccb);
 static void ahcipoll(struct cam_sim *sim);
@@ -669,7 +669,7 @@ ahci_ch_attach(device_t dev)
}
if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL,
ctlr->direct ? ahci_ch_intr_direct : ahci_ch_intr,
-   dev, &ch->ih))) {
+   ch, &ch->ih))) {
device_printf(dev, "Unable to setup interrupt\n");
error = ENXIO;
goto err1;
@@ -698,7 +698,7 @@ ahci_ch_attach(device_t dev)
}
/* Construct SIM entry */
ch->sim = cam_sim_alloc(ahciaction, ahcipoll, "ahcich", ch,
-   device_get_unit(dev), &ch->mtx,
+   device_get_unit(dev), (struct mtx *)&ch->mtx,
min(2, ch->numslots),
(ch->caps & AHCI_CAP_SNCQ) ? ch->numslots : 0,
devq);
@@ -722,7 +722,7 @@ ahci_ch_attach(device_t dev)
if (ch->pm_level > 3) {
callout_reset(&ch->pm_timer,
(ch->pm_level == 4) ? hz / 1000 : hz / 8,
-   ahci_ch_pm, dev);
+   ahci_ch_pm, ch);
}
mtx_unlock(&ch->mtx);
return (0);
@@ -792,8 +792,8 @@ ahci_ch_init(device_t dev)
 (AHCI_P_CMD_ACTIVE | AHCI_P_CMD_POD | AHCI_P_CMD_SUD |
 ((ch->pm_level == 2 || ch->pm_level == 3) ? AHCI_P_CMD_ALPE : 0) |
 ((ch->pm_level > 2) ? AHCI_P_CMD_ASP : 0 )));
-   ahci_start_fr(dev);
-   ahci_start(dev, 1);
+   ahci_start_fr(ch);
+   ahci_start(ch, 1);
return (0);
 }
 
@@ -805,8 +805,8 @@ ahci_ch_deinit(device_t dev)
/* Disable port interrupts. */
ATA_OUTL(ch->r_mem, AHCI_P_IE, 0);
/* Reset command register. */
-   ahci_stop(dev);
-   ahci_stop_fr(dev);
+   ahci_stop(ch);
+   ahci_stop_fr(ch);
ATA_OUTL(ch->r_mem, AHCI_P_CMD, 0);
/* Allow everything, including partial and slumber modes. */
ATA_OUTL(ch->r_mem, AHCI_P_SCTL, 0);
@@ -845,7 +845,7 @@ ahci_ch_resume(device_t dev)
 
mtx_lock(&ch->mtx);
ahci_ch_i

Re: svn commit: r270874 - in head/sys: dev/netmap net

2014-09-08 Thread Luigi Rizzo
Just noticed this.

I would appreciate if you and others could inform me _before_ touching
netmap-related stuff, and also, if you make changes make sure they are
visible to the preprocessor so i can use conditional compilations.

This is because this code is supposed to be the same on various FreeBSD
revisions
and Linux, and if each platform randomly changes its structures maintainance
becomes very hard

cheers
luigi


On Sun, Aug 31, 2014 at 1:33 PM, Gleb Smirnoff  wrote:

> Author: glebius
> Date: Sun Aug 31 11:33:19 2014
> New Revision: 270874
> URL: http://svnweb.freebsd.org/changeset/base/270874
>
> Log:
>   Provide pointer from struct ifnet to struct netmap_adapter,
>   instead of abusing spare field.
>
> Modified:
>   head/sys/dev/netmap/netmap_kern.h
>   head/sys/net/if_var.h
>
> Modified: head/sys/dev/netmap/netmap_kern.h
>
> ==
> --- head/sys/dev/netmap/netmap_kern.h   Sun Aug 31 10:42:52 2014
> (r270873)
> +++ head/sys/dev/netmap/netmap_kern.h   Sun Aug 31 11:33:19 2014
> (r270874)
> @@ -1187,7 +1187,7 @@ extern int netmap_generic_rings;
>   * WNA is used to write it.
>   */
>  #ifndef WNA
> -#defineWNA(_ifp)   (_ifp)->if_pspare[0]
> +#defineWNA(_ifp)   (_ifp)->if_netmap
>  #endif
>  #defineNA(_ifp)((struct netmap_adapter *)WNA(_ifp))
>
>
> Modified: head/sys/net/if_var.h
>
> ==
> --- head/sys/net/if_var.h   Sun Aug 31 10:42:52 2014(r270873)
> +++ head/sys/net/if_var.h   Sun Aug 31 11:33:19 2014(r270874)
> @@ -67,6 +67,7 @@ struct  ifvlantrunk;
>  struct route;  /* if_output */
>  struct vnet;
>  struct ifmedia;
> +struct netmap_adapter;
>
>  #ifdef _KERNEL
>  #include   /* ifqueue only? */
> @@ -202,6 +203,7 @@ struct ifnet {
> void*if_pf_kif; /* pf glue */
> struct  carp_if *if_carp;   /* carp interface structure */
> struct  label *if_label;/* interface MAC label */
> +   struct  netmap_adapter *if_netmap; /* netmap(4) softc */
>
> /* Various procedures of the layer2 encapsulation and drivers. */
> int (*if_output)/* output routine (enqueue) */
>
>


-- 
-+---
 Prof. Luigi RIZZO, ri...@iet.unipi.it  . Dip. di Ing. dell'Informazione
 http://www.iet.unipi.it/~luigi/. Universita` di Pisa
 TEL  +39-050-2211611   . via Diotisalvi 2
 Mobile   +39-338-6809875   . 56122 PISA (Italy)
-+---
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271259 - head/contrib/smbfs/lib/smb

2014-09-08 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Sep  8 11:01:57 2014
New Revision: 271259
URL: http://svnweb.freebsd.org/changeset/base/271259

Log:
  Make it possible to use empty user name ("-U ''") for mount_smbfs(8).
  It's just like "-U guest", except that it actually works, at least
  with Samba 4, which seems to return authentication failure for "-U guest".
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/smbfs/lib/smb/ctx.c

Modified: head/contrib/smbfs/lib/smb/ctx.c
==
--- head/contrib/smbfs/lib/smb/ctx.cMon Sep  8 10:57:43 2014
(r271258)
+++ head/contrib/smbfs/lib/smb/ctx.cMon Sep  8 11:01:57 2014
(r271259)
@@ -191,10 +191,6 @@ smb_ctx_parseunc(struct smb_ctx *ctx, co
smb_error("no user name required", 0);
return EINVAL;
}
-   if (*p1 == 0) {
-   smb_error("empty user name", 0);
-   return EINVAL;
-   }
error = smb_ctx_setuser(ctx, tmp);
if (error)
return error;
@@ -521,11 +517,6 @@ smb_ctx_resolve(struct smb_ctx *ctx)
smb_error("no server name specified", 0);
return EINVAL;
}
-   if (ssn->ioc_user[0] == 0) {
-   smb_error("no user name specified for server %s",
-   0, ssn->ioc_srvname);
-   return EINVAL;
-   }
if (ctx->ct_minlevel >= SMBL_SHARE && sh->ioc_share[0] == 0) {
smb_error("no share name specified for %s@%s",
0, ssn->ioc_user, ssn->ioc_srvname);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271258 - head/contrib/smbfs/mount_smbfs

2014-09-08 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Sep  8 10:57:43 2014
New Revision: 271258
URL: http://svnweb.freebsd.org/changeset/base/271258

Log:
  Make mount_smbfs(8) preserve the "automounted" mount flag.
  
  The issue here is that we have to pass this flag as a string,
  in iov, because it doesn't fit in mntflags, which is an int.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/smbfs/mount_smbfs/mount_smbfs.c

Modified: head/contrib/smbfs/mount_smbfs/mount_smbfs.c
==
--- head/contrib/smbfs/mount_smbfs/mount_smbfs.cMon Sep  8 09:33:43 
2014(r271257)
+++ head/contrib/smbfs/mount_smbfs/mount_smbfs.cMon Sep  8 10:57:43 
2014(r271258)
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
 #else
struct xvfsconf vfc;
 #endif
-   char *next;
+   char *next, *p, *val;
int opt, error, mntflags, caseopt, fd;
uid_t uid;
gid_t gid;
@@ -194,6 +194,13 @@ main(int argc, char *argv[])
};
case 'o':
getmntopts(optarg, mopts, &mntflags, 0);
+   p = strchr(optarg, '=');
+   val = NULL;
+   if (p != NULL) {
+   *p = '\0';
+   val = p + 1;
+   }
+   build_iovec(&iov, &iovlen, optarg, val, (size_t)-1);
break;
case 'c':
switch (optarg[0]) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r271257 - in head/etc: defaults rc.d

2014-09-08 Thread Dag-Erling Smørgrav
yaneurab...@gmail.com writes:
> Dag-Erling Smørgrav  writes:
> > +local_unbound_flags="-c${local_unbound_config}"
> > +local_unbound_forwardconf="${local_unbound_workdir}/forward.conf}”
> Is this a typo (dangling “}” at the end)?

Ouch, yes.  Peter also pointed out a nit in the line right before that.
I will fix both at once.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r271257 - in head/etc: defaults rc.d

2014-09-08 Thread yaneurabeya
On Sep 8, 2014, at 2:33, Dag-Erling Smørgrav  wrote:

> Author: des
> Date: Mon Sep  8 09:33:43 2014
> New Revision: 271257
> URL: http://svnweb.freebsd.org/changeset/base/271257
> 
> Log:
>  Use the correct idiom for default values, and ensure that the script
>  works correctly if the user overrides them.
> 
>  PR:  193255
>  Submitted by:hrs@
>  MFC after:   3 days
> 
> Modified:
>  head/etc/defaults/rc.conf
>  head/etc/rc.d/local_unbound
> 
> Modified: head/etc/defaults/rc.conf
> ==
> --- head/etc/defaults/rc.conf Mon Sep  8 09:19:01 2014(r271256)
> +++ head/etc/defaults/rc.conf Mon Sep  8 09:33:43 2014(r271257)
> @@ -267,6 +267,13 @@ 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
> +local_unbound_program="/usr/sbin/unbound"
> +local_unbound_workdir=/var/unbound
> +local_unbound_config="${local_unbound_workdir}/unbound.conf"
> +local_unbound_flags="-c${local_unbound_config}"
> +local_unbound_forwardconf="${local_unbound_workdir}/forward.conf}”

Hi,
Is this a typo (dangling “}” at the end)?
Thanks!
-Garrett


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r271257 - in head/etc: defaults rc.d

2014-09-08 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Sep  8 09:33:43 2014
New Revision: 271257
URL: http://svnweb.freebsd.org/changeset/base/271257

Log:
  Use the correct idiom for default values, and ensure that the script
  works correctly if the user overrides them.
  
  PR:   193255
  Submitted by: hrs@
  MFC after:3 days

Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.d/local_unbound

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Mon Sep  8 09:19:01 2014(r271256)
+++ head/etc/defaults/rc.conf   Mon Sep  8 09:33:43 2014(r271257)
@@ -267,6 +267,13 @@ 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
+local_unbound_program="/usr/sbin/unbound"
+local_unbound_workdir=/var/unbound
+local_unbound_config="${local_unbound_workdir}/unbound.conf"
+local_unbound_flags="-c${local_unbound_config}"
+local_unbound_forwardconf="${local_unbound_workdir}/forward.conf}"
+local_unbound_anchor="${local_unbound_workdir}/root.key"
+local_unbound_forwarders=""
 
 #
 # kerberos. Do not run the admin daemons on slave servers

Modified: head/etc/rc.d/local_unbound
==
--- head/etc/rc.d/local_unbound Mon Sep  8 09:19:01 2014(r271256)
+++ head/etc/rc.d/local_unbound Mon Sep  8 09:33:43 2014(r271257)
@@ -13,7 +13,6 @@ name="local_unbound"
 desc="local caching forwarding resolver"
 rcvar="local_unbound_enable"
 
-command="/usr/sbin/unbound"
 extra_commands="anchor configtest reload setup"
 start_precmd="local_unbound_prestart"
 reload_precmd="local_unbound_configtest"
@@ -22,18 +21,9 @@ configtest_cmd="local_unbound_configtest
 setup_cmd="local_unbound_setup"
 pidfile="/var/run/${name}.pid"
 
-: ${local_unbound_workdir:=/var/unbound}
-: ${local_unbound_config:=${local_unbound_workdir}/unbound.conf}
-: ${local_unbound_flags:=-c${local_unbound_config}}
-: ${local_unbound_forwardconf:=${local_unbound_workdir}/forward.conf}
-: ${local_unbound_anchor:=${local_unbound_workdir}/root.key}
-: ${local_unbound_forwarders:=}
-
-load_rc_config $name
-
 do_as_unbound()
 {
-   echo "$@" | su -m unbound
+   echo "$@" | /usr/bin/su -m unbound
 }
 
 #
@@ -41,7 +31,8 @@ do_as_unbound()
 #
 local_unbound_anchor()
 {
-   do_as_unbound /usr/sbin/unbound-anchor -a ${local_unbound_anchor}
+   do_as_unbound ${local_unbound_program%/*}/unbound-anchor \
+   -a ${local_unbound_anchor}
# we can't trust the exit code - check if the file exists
[ -f ${local_unbound_anchor} ]
 }
@@ -51,7 +42,8 @@ local_unbound_anchor()
 #
 local_unbound_configtest()
 {
-   do_as_unbound /usr/sbin/unbound-checkconf ${local_unbound_config}
+   do_as_unbound ${local_unbound_program%/*}/unbound-checkconf \
+   ${local_unbound_config}
 }
 
 #
@@ -61,7 +53,7 @@ local_unbound_configtest()
 local_unbound_setup()
 {
echo "Performing initial setup."
-   /usr/sbin/local-unbound-setup -n \
+   ${local_unbound_program%/*}/local-unbound-setup -n \
-u unbound \
-w ${local_unbound_workdir} \
-c ${local_unbound_config} \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271256 - head/lib/libpam/modules/pam_login_access

2014-09-08 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Sep  8 09:19:01 2014
New Revision: 271256
URL: http://svnweb.freebsd.org/changeset/base/271256

Log:
  Fail rather than segfault if neither PAM_TTY nor PAM_RHOST is set.
  
  PR:   83099
  MFC after:3 days

Modified:
  head/lib/libpam/modules/pam_login_access/pam_login_access.c

Modified: head/lib/libpam/modules/pam_login_access/pam_login_access.c
==
--- head/lib/libpam/modules/pam_login_access/pam_login_access.c Mon Sep  8 
09:16:07 2014(r271255)
+++ head/lib/libpam/modules/pam_login_access/pam_login_access.c Mon Sep  8 
09:19:01 2014(r271256)
@@ -79,7 +79,14 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int
 
gethostname(hostname, sizeof hostname);
 
-   if (rhost == NULL || *(const char *)rhost == '\0') {
+   if (rhost != NULL && *(const char *)rhost != '\0') {
+   PAM_LOG("Checking login.access for user %s from host %s",
+   (const char *)user, (const char *)rhost);
+   if (login_access(user, rhost) != 0)
+   return (PAM_SUCCESS);
+   PAM_VERBOSE_ERROR("%s is not allowed to log in from %s",
+   user, rhost);
+   } else if (tty != NULL || *(const char *)tty != '\0') {
PAM_LOG("Checking login.access for user %s on tty %s",
(const char *)user, (const char *)tty);
if (login_access(user, tty) != 0)
@@ -87,12 +94,8 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int
PAM_VERBOSE_ERROR("%s is not allowed to log in on %s",
user, tty);
} else {
-   PAM_LOG("Checking login.access for user %s from host %s",
-   (const char *)user, (const char *)rhost);
-   if (login_access(user, rhost) != 0)
-   return (PAM_SUCCESS);
-   PAM_VERBOSE_ERROR("%s is not allowed to log in from %s",
-   user, rhost);
+   PAM_VERBOSE_ERROR("PAM_RHOST or PAM_TTY required");
+   return (PAM_AUTHINFO_UNAVAIL);
}
 
return (PAM_AUTH_ERR);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271255 - head/usr.sbin/unbound/local-setup

2014-09-08 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Sep  8 09:16:07 2014
New Revision: 271255
URL: http://svnweb.freebsd.org/changeset/base/271255

Log:
  Fix support for IPv6 nameservers.
  
  PR:   188931
  Submitted by: Takefu 
  MFC after:3 days

Modified:
  head/usr.sbin/unbound/local-setup/local-unbound-setup.sh

Modified: head/usr.sbin/unbound/local-setup/local-unbound-setup.sh
==
--- head/usr.sbin/unbound/local-setup/local-unbound-setup.shMon Sep  8 
09:04:22 2014(r271254)
+++ head/usr.sbin/unbound/local-setup/local-unbound-setup.shMon Sep  8 
09:16:07 2014(r271255)
@@ -178,7 +178,7 @@ gen_forward_conf() {
echo "forward-zone:"
echo "name: ."
for forwarder ; do
-   if expr "${forwarder}" : "^[0-9:.]\{1,\}$" >/dev/null ; then
+   if expr "${forwarder}" : "^[0-9A-Fa-f:.]\{1,\}$" >/dev/null ; 
then
echo "forward-addr: ${forwarder}"
else
echo "forward-host: ${forwarder}"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271254 - head/sys/kern

2014-09-08 Thread Hiroki Sato
Author: hrs
Date: Mon Sep  8 09:04:22 2014
New Revision: 271254
URL: http://svnweb.freebsd.org/changeset/base/271254

Log:
  - Make hhook_run_socket() vnet-aware instead of adding CURVNET_SET() around
the function calls.
  - Fix a memory leak and stats in the case that hhook_run_socket() fails
in soalloc().
  
  PR:   193265

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Mon Sep  8 08:44:50 2014(r271253)
+++ head/sys/kern/uipc_socket.c Mon Sep  8 09:04:22 2014(r271254)
@@ -391,25 +391,24 @@ soalloc(struct vnet *vnet)
sx_init(&so->so_snd.sb_sx, "so_snd_sx");
sx_init(&so->so_rcv.sb_sx, "so_rcv_sx");
TAILQ_INIT(&so->so_aiojobq);
-   mtx_lock(&so_global_mtx);
-   so->so_gencnt = ++so_gencnt;
-   ++numopensockets;
 #ifdef VIMAGE
VNET_ASSERT(vnet != NULL, ("%s:%d vnet is NULL, so=%p",
__func__, __LINE__, so));
-   vnet->vnet_sockcnt++;
so->so_vnet = vnet;
 #endif
-   mtx_unlock(&so_global_mtx);
-
-   CURVNET_SET(vnet);
/* We shouldn't need the so_global_mtx */
-   if (V_socket_hhh[HHOOK_SOCKET_CREATE]->hhh_nhooks > 0) {
-   if (hhook_run_socket(so, NULL, HHOOK_SOCKET_CREATE))
-   /* Do we need more comprehensive error returns? */
-   so = NULL;
+   if (hhook_run_socket(so, NULL, HHOOK_SOCKET_CREATE)) {
+   /* Do we need more comprehensive error returns? */
+   uma_zfree(socket_zone, so);
+   return (NULL);
}
-   CURVNET_RESTORE();
+   mtx_lock(&so_global_mtx);
+   so->so_gencnt = ++so_gencnt;
+   ++numopensockets;
+#ifdef VIMAGE
+   vnet->vnet_sockcnt++;
+#endif
+   mtx_unlock(&so_global_mtx);
 
return (so);
 }
@@ -447,10 +446,7 @@ sodealloc(struct socket *so)
 #ifdef MAC
mac_socket_destroy(so);
 #endif
-   CURVNET_SET(so->so_vnet);
-   if (V_socket_hhh[HHOOK_SOCKET_CLOSE]->hhh_nhooks > 0)
-   hhook_run_socket(so, NULL, HHOOK_SOCKET_CLOSE);
-   CURVNET_RESTORE();
+   hhook_run_socket(so, NULL, HHOOK_SOCKET_CLOSE);
 
crfree(so->so_cred);
khelp_destroy_osd(&so->osd);
@@ -2406,10 +2402,13 @@ hhook_run_socket(struct socket *so, void
struct socket_hhook_data hhook_data = {
.so = so,
.hctx = hctx,
-   .m = NULL
+   .m = NULL,
+   .status = 0
};
 
-   hhook_run_hooks(V_socket_hhh[h_id], &hhook_data, &so->osd);
+   CURVNET_SET(so->so_vnet);
+   HHOOKS_RUN_IF(V_socket_hhh[h_id], &hhook_data, &so->osd);
+   CURVNET_RESTORE();
 
/* Ugly but needed, since hhooks return void for now */
return (hhook_data.status);
@@ -3245,7 +3244,6 @@ static int
 filt_soread(struct knote *kn, long hint)
 {
struct socket *so;
-   int ret;
 
so = kn->kn_fp->f_data;
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
@@ -3266,14 +3264,8 @@ filt_soread(struct knote *kn, long hint)
return 1;
}
 
-   CURVNET_SET(so->so_vnet);
-   if (V_socket_hhh[HHOOK_FILT_SOREAD]->hhh_nhooks > 0)
-   ret = hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD);
-   else
-   ret = 0;
-   CURVNET_RESTORE();
-
-   return (ret);
+   /* This hook returning non-zero indicates an event, not error */
+   return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD));
 }
 
 static void
@@ -3298,10 +3290,7 @@ filt_sowrite(struct knote *kn, long hint
SOCKBUF_LOCK_ASSERT(&so->so_snd);
kn->kn_data = sbspace(&so->so_snd);
 
-   CURVNET_SET(so->so_vnet);
-   if (V_socket_hhh[HHOOK_FILT_SOWRITE]->hhh_nhooks > 0)
-   hhook_run_socket(so, kn, HHOOK_FILT_SOWRITE);
-   CURVNET_RESTORE();
+   hhook_run_socket(so, kn, HHOOK_FILT_SOWRITE);
 
if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
kn->kn_flags |= EV_EOF;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271253 - head/sys/kern

2014-09-08 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Mon Sep  8 08:44:50 2014
New Revision: 271253
URL: http://svnweb.freebsd.org/changeset/base/271253

Log:
  pause_sbt(): Take the cold path (ie. use DELAY()) if KDB is active
  
  This fixes a panic in the i915 driver when one uses debug.kdb.enter=1
  under vt(4).
  
  PR:   193269
  Reported by:  emaste@
  Submitted by: avg@
  MFC after:3 days

Modified:
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Mon Sep  8 08:25:33 2014(r271252)
+++ head/sys/kern/kern_synch.c  Mon Sep  8 08:44:50 2014(r271253)
@@ -362,7 +362,7 @@ pause_sbt(const char *wmesg, sbintime_t 
if (sbt == 0)
sbt = tick_sbt;
 
-   if (cold) {
+   if (cold || kdb_active) {
/*
 * We delay one second at a time to avoid overflowing the
 * system specific DELAY() function(s):
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271251 - head/sys/libkern

2014-09-08 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Sep  8 08:12:09 2014
New Revision: 271251
URL: http://svnweb.freebsd.org/changeset/base/271251

Log:
  Use __DECONST to avoid compiler warnings (and thus build failures)
  with gcc on sparc64, mips, and powerpc after r271173.

Modified:
  head/sys/libkern/memmem.c

Modified: head/sys/libkern/memmem.c
==
--- head/sys/libkern/memmem.c   Mon Sep  8 07:37:03 2014(r271250)
+++ head/sys/libkern/memmem.c   Mon Sep  8 08:12:09 2014(r271251)
@@ -52,9 +52,9 @@ memmem(const void *l, size_t l_len, cons
 return memchr(l, (int)*cs, l_len);
 
 /* the last position where its possible to find "s" in "l" */
-last = (char *)cl + l_len - s_len;
+last = __DECONST(char *, cl) + l_len - s_len;
 
-for (cur = (char *)cl; cur <= last; cur++)
+for (cur = __DECONST(char *, cl); cur <= last; cur++)
 if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
 return cur;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271250 - head/sys/dev/vt

2014-09-08 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Mon Sep  8 07:37:03 2014
New Revision: 271250
URL: http://svnweb.freebsd.org/changeset/base/271250

Log:
  vt(4): Change the terminal and buffer sizes, even without a font
  
  This fixes a bug where scroll lock would not work for tty #0 when using
  vt_vga's textmode. The reason was that this window is created with a
  static 256x100 buffer, larger than the real size of 80x25.
  
  Now, in vt_change_font() and vt_compute_drawable_area(), we still
  perform operations even of the window has no font loaded (this is the
  case in textmode here vw->vw_font == NULL). One of these operation
  resizes the buffer accordingly.
  
  In vt_compute_drawable_area(), we take the terminal size as is (ie.
  80x25) for the drawable area.
  
  The font argument to vt_set_border() is removed (it was never used) and
  the code now uses the computed drawable area instead of re-doing its own
  calculation.
  
  Reported by:  Harald Schmalzbauer 
  Tested by:Harald Schmalzbauer 
  MFC after:3 days

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Sep  8 07:16:00 2014(r271249)
+++ head/sys/dev/vt/vt_core.c   Mon Sep  8 07:37:03 2014(r271250)
@@ -430,10 +430,16 @@ vt_compute_drawable_area(struct vt_windo
struct vt_device *vd;
struct vt_font *vf;
 
-   if (vw->vw_font == NULL)
+   vd = vw->vw_device;
+
+   if (vw->vw_font == NULL) {
+   vw->vw_draw_area.tr_begin.tp_col = 0;
+   vw->vw_draw_area.tr_begin.tp_row = 0;
+   vw->vw_draw_area.tr_end.tp_col = vd->vd_width;
+   vw->vw_draw_area.tr_end.tp_row = vd->vd_height;
return;
+   }
 
-   vd = vw->vw_device;
vf = vw->vw_font;
 
/*
@@ -1300,30 +1306,40 @@ vtterm_opened(struct terminal *tm, int o
 }
 
 static int
-vt_set_border(struct vt_window *vw, struct vt_font *vf, term_color_t c)
+vt_set_border(struct vt_window *vw, term_color_t c)
 {
struct vt_device *vd = vw->vw_device;
-   int x, y, off_x, off_y;
 
if (vd->vd_driver->vd_drawrect == NULL)
return (ENOTSUP);
 
-   x = vd->vd_width - 1;
-   y = vd->vd_height - 1;
-   off_x = vw->vw_draw_area.tr_begin.tp_col;
-   off_y = vw->vw_draw_area.tr_begin.tp_row;
-
/* Top bar. */
-   if (off_y > 0)
-   vd->vd_driver->vd_drawrect(vd, 0, 0, x, off_y - 1, 1, c);
+   if (vw->vw_draw_area.tr_begin.tp_row > 0)
+   vd->vd_driver->vd_drawrect(vd,
+   0, 0,
+   vd->vd_width - 1, vw->vw_draw_area.tr_begin.tp_row - 1,
+   1, c);
+
/* Left bar. */
-   if (off_x > 0)
-   vd->vd_driver->vd_drawrect(vd, 0, off_y, off_x - 1, y - off_y,
+   if (vw->vw_draw_area.tr_begin.tp_col > 0)
+   vd->vd_driver->vd_drawrect(vd,
+   0, 0,
+   vw->vw_draw_area.tr_begin.tp_col - 1, vd->vd_height - 1,
+   1, c);
+
+   /* Right bar. */
+   if (vw->vw_draw_area.tr_end.tp_col < vd->vd_width)
+   vd->vd_driver->vd_drawrect(vd,
+   vw->vw_draw_area.tr_end.tp_col - 1, 0,
+   vd->vd_width - 1, vd->vd_height - 1,
+   1, c);
+
+   /* Bottom bar. */
+   if (vw->vw_draw_area.tr_end.tp_row < vd->vd_height)
+   vd->vd_driver->vd_drawrect(vd,
+   0, vw->vw_draw_area.tr_end.tp_row - 1,
+   vd->vd_width - 1, vd->vd_height - 1,
1, c);
-   /* Right bar.  May be 1 pixel wider than necessary due to rounding. */
-   vd->vd_driver->vd_drawrect(vd, x - off_x, off_y, x, y - off_y, 1, c);
-   /* Bottom bar.  May be 1 mixel taller than necessary due to rounding. */
-   vd->vd_driver->vd_drawrect(vd, 0, y - off_y, x, y, 1, c);
 
return (0);
 }
@@ -1355,11 +1371,6 @@ vt_change_font(struct vt_window *vw, str
VT_UNLOCK(vd);
return (EBUSY);
}
-   if (vd->vd_flags & VDF_TEXTMODE) {
-   /* Our device doesn't need fonts. */
-   VT_UNLOCK(vd);
-   return (ENOTTY);
-   }
vw->vw_flags |= VWF_BUSY;
VT_UNLOCK(vd);
 
@@ -1374,7 +1385,7 @@ vt_change_font(struct vt_window *vw, str
 
/* Actually apply the font to the current window. */
VT_LOCK(vd);
-   if (vw->vw_font != vf) {
+   if (vw->vw_font != vf && vw->vw_font != NULL && vf != NULL) {
/*
 * In case vt_change_font called to update size we don't need
 * to update font link.
@@ -1397,7 +1408,7 @@ vt_change_font(struct vt_window *vw, str
 
/* Force a full redraw the next timer tick. */
if (vd->vd_curwindow == vw) {
-   vt_set_border(vw, vf, TC_BLACK);
+   vt_set_border(vw,

svn commit: r271249 - head/sys/dev/iwn

2014-09-08 Thread Adrian Chadd
Author: adrian
Date: Mon Sep  8 07:16:00 2014
New Revision: 271249
URL: http://svnweb.freebsd.org/changeset/base/271249

Log:
  Implement htprotmode handling.
  
  This is separate to 11g protection - the default is to RTS protect
  11n frames, including A-MPDU frames.
  
  Tested:
  
  * Intel 5100, STA mode

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Mon Sep  8 05:14:58 2014(r271248)
+++ head/sys/dev/iwn/if_iwn.c   Mon Sep  8 07:16:00 2014(r271249)
@@ -4206,11 +4206,11 @@ iwn_check_rate_needs_protection(struct i
return (0);
 
/*
-* If it's an 11n rate, then for now we enable
-* protection.
+* If it's an 11n rate - no protection.
+* We'll do it via a specific 11n check.
 */
if (rate & IEEE80211_RATE_MCS) {
-   return (1);
+   return (0);
}
 
/*
@@ -4440,6 +4440,9 @@ iwn_tx_data(struct iwn_softc *sc, struct
flags |= IWN_TX_NEED_CTS;
else if (ic->ic_protmode == IEEE80211_PROT_RTSCTS)
flags |= IWN_TX_NEED_RTS;
+   } else if ((rate & IEEE80211_RATE_MCS) &&
+   (ic->ic_htprotmode == IEEE80211_PROT_RTSCTS)) {
+   flags |= IWN_TX_NEED_RTS;
}
 
/* XXX HT protection? */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"