svn commit: r318571 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep

2017-05-19 Thread Ed Maste
Author: emaste
Date: Sat May 20 03:51:31 2017
New Revision: 318571
URL: https://svnweb.freebsd.org/changeset/base/318571

Log:
  bsdgrep: emit more than MAX_LINE_MATCHES per line
  
  We should not set an arbitrary cap on the number of matches on a line,
  and in any case MAX_LINE_MATCHES of 32 is much too low.  Instead, if we
  match more than MAX_LINE_MATCHES, keep processing and matching from the
  last match until all are found.
  
  For the regression test, we produce 4096 matches (larger than we expect
  we'll ever set MAX_LINE_MATCHES) and make sure we actually get 4096
  lines of output with the -o flag.
  
  We'll also make sure that every distinct line is getting its own line
  number to detect line metadata not being printed as appropriate along
  the way.
  
  PR:   218811
  Submitted by: Kyle Evans 
  Reported by:  jbeich
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D10577

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/util.c

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat May 20 01:04:47 
2017(r318570)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat May 20 03:51:31 
2017(r318571)
@@ -413,6 +413,26 @@ wflag_emptypat_body()
atf_check -o file:test4 grep -w -e "" test4
 }
 
+atf_test_case excessive_matches
+excessive_matches_head()
+{
+   atf_set "descr" "Check for proper handling of lines with excessive 
matches (PR 218811)"
+}
+excessive_matches_body()
+{
+   grep_type
+   if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then
+   atf_expect_fail "this test does not pass with GNU grep in base"
+   fi
+
+   for i in $(jot 4096); do
+   printf "x" >> test.in
+   done
+
+   atf_check -s exit:0 -x '[ $(grep -o x test.in | wc -l) -eq 4096 ]'
+   #atf_check -s exit:1 -x 'grep -on x test.in | grep -v "1:x"'
+}
+
 atf_test_case fgrep_sanity
 fgrep_sanity_head()
 {
@@ -603,6 +623,7 @@ atf_init_test_cases()
atf_add_test_case egrep_empty_invalid
atf_add_test_case zerolen
atf_add_test_case wflag_emptypat
+   atf_add_test_case excessive_matches
atf_add_test_case wv_combo_break
atf_add_test_case fgrep_sanity
atf_add_test_case egrep_sanity

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cSat May 20 01:04:47 2017(r318570)
+++ head/usr.bin/grep/util.cSat May 20 03:51:31 2017(r318571)
@@ -63,6 +63,7 @@ static boolfirst_match = true;
 struct parsec {
regmatch_t matches[MAX_LINE_MATCHES];   /* Matches made */
struct str ln;  /* Current line */
+   size_t lnstart; /* Start of line processing */
size_t matchidx;/* Latest used match index */
bool binary;/* Binary file? */
 };
@@ -247,8 +248,9 @@ procfile(const char *fn)
mcount = mlimit;
 
for (c = 0;  c == 0 || !(lflag || qflag); ) {
-   /* Reset match count for every line processed */
+   /* Reset match count and line start for every line processed */
pc.matchidx = 0;
+   pc.lnstart = 0;
pc.ln.off += pc.ln.len + 1;
if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL ||
pc.ln.len == 0) {
@@ -288,6 +290,14 @@ procfile(const char *fn)
/* Print the matching line, but only if not quiet/binary */
if (t == 0 && printmatch) {
printline(&pc, ':');
+   while (pc.matchidx >= MAX_LINE_MATCHES) {
+   /* Reset matchidx and try again */
+   pc.matchidx = 0;
+   if (procline(&pc) == 0)
+   printline(&pc, ':');
+   else
+   break;
+   }
first_match = false;
same_file = true;
last_outed = 0;
@@ -356,11 +366,11 @@ procline(struct parsec *pc)
 {
regmatch_t pmatch, lastmatch, chkmatch;
wchar_t wbegin, wend;
-   size_t st = 0, nst = 0;
+   size_t st, nst;
unsigned int i;
int c = 0, r = 0, lastmatches = 0, leflags = eflags;
size_t startm = 0, matchidx;
-   int retry;
+   unsigned int retry;
 
matchidx = pc->matchidx;
 
@@ -376,6 +386,8 @@ procline(struct parsec *pc)
} else if (matchall)
return (0);
 
+   st = pc->lnstart;
+   nst = 0;
/* Initialize to avoid a false positive warning from GCC. */
lastmatch.rm_

svn commit: r318566 - head/sys/net80211

2017-05-19 Thread Adrian Chadd
Author: adrian
Date: Sat May 20 00:43:52 2017
New Revision: 318566
URL: https://svnweb.freebsd.org/changeset/base/318566

Log:
  [net80211] prepare for A-MSDU/A-MPDU offload crypto / sequence number 
checking.
  
  When doing AMSDU offload, the driver (for now!) presents 802.11 frames with
  the same sequence number and crypto sequence number / IV values up to the 
stack.
  But, this will trip afoul over the sequence number detection.
  
  So drivers now have a way to signify that a frame is part of an offloaded
  AMSDU group, so we can just ensure that we pass those frames up to the
  stack.
  
  The logic will be a bit messy - the TL;DR will be that if it's part of
  the previously seen sequence number then it belongs in the same burst.
  But if we get a repeat of the same sequence number (eg we sent an ACK
  but the receiver didn't hear it) then we shouldn't be passing those frames
  up.  So, we can't just say "all subframes go up", we need to track
  whether we've seen the end of a burst of frames for the given sequence
  number or not, so we know whether to actually pass them up or not.
  
  The first part of doing all of this is to ensure the ieee80211_rx_stats
  struct is available in the RX sequence number check path and the
  RX ampdu reorder path.  So, start by passing the pointer into these
  functions to avoid doing another lookup.
  
  The actual support will come in a subsequent commit once I know the
  functionality actually works!

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h
  head/sys/net80211/ieee80211_input.h
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Sat May 20 00:42:47 2017
(r318565)
+++ head/sys/net80211/ieee80211_adhoc.c Sat May 20 00:43:52 2017
(r318566)
@@ -448,7 +448,7 @@ adhoc_input(struct ieee80211_node *ni, s
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
-   if (! ieee80211_check_rxseq(ni, wh, bssid))
+   if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@@ -479,7 +479,7 @@ adhoc_input(struct ieee80211_node *ni, s
 * and we should do nothing more with it.
 */
if ((m->m_flags & M_AMPDU) &&
-   ieee80211_ampdu_reorder(ni, m) != 0) {
+   ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cSat May 20 00:42:47 2017
(r318565)
+++ head/sys/net80211/ieee80211_hostap.cSat May 20 00:43:52 2017
(r318566)
@@ -577,7 +577,7 @@ hostap_input(struct ieee80211_node *ni, 
if (IEEE80211_QOS_HAS_SEQ(wh) &&
TID_TO_WME_AC(tid) >= WME_AC_VI)
ic->ic_wme.wme_hipri_traffic++;
-   if (! ieee80211_check_rxseq(ni, wh, bssid))
+   if (! ieee80211_check_rxseq(ni, wh, bssid, rxs))
goto out;
}
}
@@ -665,7 +665,7 @@ hostap_input(struct ieee80211_node *ni, 
 * and we should do nothing more with it.
 */
if ((m->m_flags & M_AMPDU) &&
-   ieee80211_ampdu_reorder(ni, m) != 0) {
+   ieee80211_ampdu_reorder(ni, m, rxs) != 0) {
m = NULL;
goto out;
}

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cSat May 20 00:42:47 2017
(r318565)
+++ head/sys/net80211/ieee80211_ht.cSat May 20 00:43:52 2017
(r318566)
@@ -849,7 +849,8 @@ ampdu_rx_flush_upto(struct ieee80211_nod
  * the frame should be processed normally by the caller.
  */
 int
-ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m)
+ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m,
+const struct ieee80211_rx_stats *rxs)
 {
 #definePROCESS 0   /* caller should process frame */
 #defineCONSUMED1   /* frame consumed, caller does nothing 
*/

Modified: head/sys/net80211/ieee80211_ht.h
==
--- head/sys/net80211/ieee80211_ht.hSat Ma

svn commit: r318565 - head/usr.bin/grep

2017-05-19 Thread Ed Maste
Author: emaste
Date: Sat May 20 00:42:47 2017
New Revision: 318565
URL: https://svnweb.freebsd.org/changeset/base/318565

Log:
  bsdgrep: fix segfault with --mmap
  
  r313948 partially fixed --mmap behavior but was incomplete.  This commit
  generally reverts it and does it the more correct way- by just consuming
  the rest of the buffer and moving on.
  
  PR:   219402
  Submitted by: Kyle Evans 
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D10820

Modified:
  head/usr.bin/grep/file.c

Modified: head/usr.bin/grep/file.c
==
--- head/usr.bin/grep/file.cSat May 20 00:41:12 2017(r318564)
+++ head/usr.bin/grep/file.cSat May 20 00:42:47 2017(r318565)
@@ -213,24 +213,24 @@ grep_fgetln(struct file *f, size_t *lenp
if (grep_lnbufgrow(len + LNBUFBUMP))
goto error;
memcpy(lnbuf + off, bufpos, len - off);
+   /* With FILE_MMAP, this is EOF; there's no more to refill */
+   if (filebehave == FILE_MMAP) {
+   bufrem -= len;
+   break;
+   }
off = len;
+   /* Fetch more to try and find EOL/EOF */
if (grep_refill(f) != 0)
goto error;
if (bufrem == 0)
/* EOF: return partial line */
break;
-   if ((p = memchr(bufpos, fileeol, bufrem)) == NULL &&
-   filebehave != FILE_MMAP)
+   if ((p = memchr(bufpos, fileeol, bufrem)) == NULL)
continue;
-   if (p == NULL) {
-   /* mmap EOF: return partial line, consume buffer */
-   diff = len;
-   } else {
-   /* got it: finish up the line (like code above) */
-   ++p;
-   diff = p - bufpos;
-   len += diff;
-   }
+   /* got it: finish up the line (like code above) */
+   ++p;
+   diff = p - bufpos;
+   len += diff;
if (grep_lnbufgrow(len))
goto error;
memcpy(lnbuf + off, bufpos, diff);
___
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: r318562 - head/sys/arm/conf

2017-05-19 Thread John Baldwin
Author: jhb
Date: Fri May 19 22:54:45 2017
New Revision: 318562
URL: https://svnweb.freebsd.org/changeset/base/318562

Log:
  Exclude ccr(4) from arm LINT since it excludes cxgbe(4).

Modified:
  head/sys/arm/conf/NOTES

Modified: head/sys/arm/conf/NOTES
==
--- head/sys/arm/conf/NOTES Fri May 19 21:20:01 2017(r318561)
+++ head/sys/arm/conf/NOTES Fri May 19 22:54:45 2017(r318562)
@@ -79,6 +79,7 @@ nodevice  snake_saver
 nodevice   star_saver
 nodevice   warp_saver
 
+nodevice   ccr
 nodevice   cxgbe
 nodevice   cxgbev
 nodevice   snd_cmi
___
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: r318550 - head/usr.sbin/devctl

2017-05-19 Thread Maxim Konovalov
Author: maxim
Date: Fri May 19 20:02:32 2017
New Revision: 318550
URL: https://svnweb.freebsd.org/changeset/base/318550

Log:
  o Missed flag restored.
  
  PR:   219395
  Submitted by: Tiwei Bie

Modified:
  head/usr.sbin/devctl/devctl.8

Modified: head/usr.sbin/devctl/devctl.8
==
--- head/usr.sbin/devctl/devctl.8   Fri May 19 18:23:44 2017
(r318549)
+++ head/usr.sbin/devctl/devctl.8   Fri May 19 20:02:32 2017
(r318550)
@@ -156,7 +156,7 @@ the device will not be changed.
 Rescan a bus device checking for devices that have been added or
 removed.
 .It Xo Cm delete
-.Op Fl
+.Op Fl f
 .Ar device
 .Xc
 Delete the device from the device tree.
___
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: r318548 - head/sys/fs/msdosfs

2017-05-19 Thread Ed Maste
Author: emaste
Date: Fri May 19 18:13:41 2017
New Revision: 318548
URL: https://svnweb.freebsd.org/changeset/base/318548

Log:
  msdosfs: use C99 types
  
  General cleanup, for diff reduction with NetBSD and future use by FAT
  support in makefs.
  
  Submitted by: Siva Mahadevan 
  Obtained from:NetBSD
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D10821

Modified:
  head/sys/fs/msdosfs/bootsect.h
  head/sys/fs/msdosfs/bpb.h
  head/sys/fs/msdosfs/denode.h
  head/sys/fs/msdosfs/direntry.h
  head/sys/fs/msdosfs/msdosfs_conv.c
  head/sys/fs/msdosfs/msdosfs_fat.c
  head/sys/fs/msdosfs/msdosfs_lookup.c
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/fs/msdosfs/msdosfsmount.h

Modified: head/sys/fs/msdosfs/bootsect.h
==
--- head/sys/fs/msdosfs/bootsect.h  Fri May 19 18:07:28 2017
(r318547)
+++ head/sys/fs/msdosfs/bootsect.h  Fri May 19 18:13:41 2017
(r318548)
@@ -25,13 +25,13 @@
  * first sector of a partitioned hard disk.
  */
 struct bootsector33 {
-   u_int8_tbsJump[3];  /* jump inst E9 or EBxx90 */
+   uint8_t bsJump[3];  /* jump inst E9 or EBxx90 */
int8_t  bsOemName[8];   /* OEM name and version */
int8_t  bsBPB[19];  /* BIOS parameter block */
int8_t  bsDriveNumber;  /* drive number (0x80) */
int8_t  bsBootCode[479];/* pad so struct is 512b */
-   u_int8_tbsBootSectSig0;
-   u_int8_tbsBootSectSig1;
+   uint8_t bsBootSectSig0;
+   uint8_t bsBootSectSig1;
 #defineBOOTSIG00x55
 #defineBOOTSIG10xaa
 };
@@ -47,25 +47,25 @@ struct extboot {
 };
 
 struct bootsector50 {
-   u_int8_tbsJump[3];  /* jump inst E9 or EBxx90 */
+   uint8_t bsJump[3];  /* jump inst E9 or EBxx90 */
int8_t  bsOemName[8];   /* OEM name and version */
int8_t  bsBPB[25];  /* BIOS parameter block */
int8_t  bsExt[26];  /* Bootsector Extension */
int8_t  bsBootCode[448];/* pad so structure is 512b */
-   u_int8_tbsBootSectSig0;
-   u_int8_tbsBootSectSig1;
+   uint8_t bsBootSectSig0;
+   uint8_t bsBootSectSig1;
 #defineBOOTSIG00x55
 #defineBOOTSIG10xaa
 };
 
 struct bootsector710 {
-   u_int8_tbsJump[3];  /* jump inst E9 or EBxx90 */
+   uint8_t bsJump[3];  /* jump inst E9 or EBxx90 */
int8_t  bsOEMName[8];   /* OEM name and version */
int8_t  bsBPB[53];  /* BIOS parameter block */
int8_t  bsExt[26];  /* Bootsector Extension */
int8_t  bsBootCode[420];/* pad so structure is 512b */
-   u_int8_tbsBootSectSig0;
-   u_int8_tbsBootSectSig1;
+   uint8_t bsBootSectSig0;
+   uint8_t bsBootSectSig1;
 #defineBOOTSIG00x55
 #defineBOOTSIG10xaa
 };

Modified: head/sys/fs/msdosfs/bpb.h
==
--- head/sys/fs/msdosfs/bpb.h   Fri May 19 18:07:28 2017(r318547)
+++ head/sys/fs/msdosfs/bpb.h   Fri May 19 18:13:41 2017(r318548)
@@ -24,17 +24,17 @@
  * BIOS Parameter Block (BPB) for DOS 3.3
  */
 struct bpb33 {
-   u_int16_t   bpbBytesPerSec; /* bytes per sector */
-   u_int8_tbpbSecPerClust; /* sectors per cluster */
-   u_int16_t   bpbResSectors;  /* number of reserved sectors */
-   u_int8_tbpbFATs;/* number of FATs */
-   u_int16_t   bpbRootDirEnts; /* number of root directory entries */
-   u_int16_t   bpbSectors; /* total number of sectors */
-   u_int8_tbpbMedia;   /* media descriptor */
-   u_int16_t   bpbFATsecs; /* number of sectors per FAT */
-   u_int16_t   bpbSecPerTrack; /* sectors per track */
-   u_int16_t   bpbHeads;   /* number of heads */
-   u_int16_t   bpbHiddenSecs;  /* number of hidden sectors */
+   uint16_tbpbBytesPerSec; /* bytes per sector */
+   uint8_t bpbSecPerClust; /* sectors per cluster */
+   uint16_tbpbResSectors;  /* number of reserved sectors */
+   uint8_t bpbFATs;/* number of FATs */
+   uint16_tbpbRootDirEnts; /* number of root directory entries */
+   uint16_tbpbSectors; /* total number of sectors */
+   uint8_t bpbMedia;   /* media descriptor */
+   uint16_tbpbFATsecs; /* number of sectors per FAT */
+   uint16_tbpbSecPerTra

pkgbase and conf files (was Re: svn commit: r318441 - in head/etc: . cron.d)

2017-05-19 Thread John Baldwin
On Friday, May 19, 2017 06:33:55 PM Baptiste Daroussin wrote:
> On Fri, May 19, 2017 at 09:17:23AM -0700, John Baldwin wrote:
> > On Thursday, May 18, 2017 11:24:29 PM Baptiste Daroussin wrote:
> > I think an upgrade won't bring the file back necessarily (etcupdate warns 
> > you
> > that a removed file changed, but it doesn't bring it back, I think a similar
> > strategy might be sensible for pkg as well).
> 
> I need to check, I do not remember what I did here and I will certainly add a
> regression test for that to ensure this behaviour is always working as 
> expected.

One nice "feature" to have in pkg for pkgbase would be a way to ask pkg to 
restore
a stock configuration file (perhaps with an option to restore it to an alternate
directory or filename?)  This would imply that packages would need to keep the
"pristine" conf files around somewhere.  This would also let you do 'pkg 
confdiff'
or the like (as a replacement for 'etcupdate diff')

-- 
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"


svn commit: r318546 - in head: contrib/netbsd-tests/fs/tmpfs tests/sys/fs/tmpfs

2017-05-19 Thread Ngie Cooper
Author: ngie
Date: Fri May 19 17:14:29 2017
New Revision: 318546
URL: https://svnweb.freebsd.org/changeset/base/318546

Log:
  sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic
  
  The previous logic was flawed in the sense that it assumed that /dev/md3
  was always available. This was a caveat I noted in r306038, that I hadn't
  gotten around to solving before now.
  
  Cache the device for the mountpoint after executing mdmfs, then use the
  cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
  device.
  
  Apply sed expressions to use reuse logic in the NetBSD code that could
  also be applied to FreeBSD, just with different tools.
  
  Differential Revision:D10766
  MFC after:1 week
  Reviewed by:  bdrewery
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
  head/tests/sys/fs/tmpfs/Makefile

Modified: head/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
==
--- head/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh Fri May 19 17:04:01 2017
(r318545)
+++ head/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh Fri May 19 17:14:29 2017
(r318546)
@@ -28,6 +28,10 @@
 # Verifies that vnd works with files stored in tmpfs.
 #
 
+# Begin FreeBSD
+MD_DEVICE_FILE=md.device
+# End FreeBSD
+
 atf_test_case basic cleanup
 basic_head() {
atf_set "descr" "Verifies that vnd works with files stored in tmpfs"
@@ -41,7 +45,10 @@ basic_body() {
# Begin FreeBSD
if true; then
atf_check -s eq:0 -o empty -e empty mkdir mnt
-   atf_check -s eq:0 -o empty -e empty mdmfs -F disk.img md3 mnt
+   atf_check -s eq:0 -o empty -e empty mdmfs -F disk.img md mnt
+   md_dev=$(df mnt | awk 'NR != 1 { print $1 }' | xargs basename)
+   atf_check test -c /dev/$md_dev # Sanity check
+   echo -n $md_dev > $TMPDIR/$MD_DEVICE_FILE
else
# End FreeBSD
atf_check -s eq:0 -o empty -e empty vndconfig /dev/vnd3 disk.img
@@ -67,31 +74,23 @@ basic_body() {
done
 
atf_check -s eq:0 -o empty -e empty umount mnt
-   # Begin FreeBSD
-   if true; then
-   atf_check -s eq:0 -o empty -e empty mdconfig -d -u 3
-   else
-   # End FreeBSD
atf_check -s eq:0 -o empty -e empty vndconfig -u /dev/vnd3
-   # Begin FreeBSD
-   fi
-   # End FreeBSD
 
test_unmount
touch done
 }
 basic_cleanup() {
+   # Begin FreeBSD
+   if md_dev=$(cat $TMPDIR/$MD_DEVICE_FILE); then
+   echo "Will try disconnecting $md_dev"
+   else
+   echo "$MD_DEVICE_FILE doesn't exist in $TMPDIR; returning early"
+   return 0
+   fi
+   # End FreeBSD
if [ ! -f done ]; then
umount mnt 2>/dev/null 1>&2
-   # Begin FreeBSD
-   if true; then
-   [ ! -c /dev/md3 ] || mdconfig -d -u 3
-   else
-   # End FreeBSD
vndconfig -u /dev/vnd3 2>/dev/null 1>&2
-   # Begin FreeBSD
-   fi
-   # End FreeBSD
fi
 }
 

Modified: head/tests/sys/fs/tmpfs/Makefile
==
--- head/tests/sys/fs/tmpfs/MakefileFri May 19 17:04:01 2017
(r318545)
+++ head/tests/sys/fs/tmpfs/MakefileFri May 19 17:14:29 2017
(r318546)
@@ -54,6 +54,9 @@ ATF_TESTS_SH_SED_mount_test=  \
 ATF_TESTS_SH_SED_readdir_test= -e 's,mknod fifo p,mkfifo fifo,g'
 ATF_TESTS_SH_SED_sizes_test=   -e 's,-o -s,-o size=,g'
 ATF_TESTS_SH_SED_statvfs_test= -e 's,-o -s,-o size=,g'
+ATF_TESTS_SH_SED_vnd_test= \
+   -e 's,vndconfig -u /dev/vnd3,mdconfig 
-d -u $$md_dev,g' \
+   -e 's,/dev/vnd3,/dev/$$md_dev,g'
 ATF_TESTS_SH_SED_vnode_leak_test=  -e 's,-o -s,-o size=,g'
 
 .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"


svn commit: r318545 - head/etc

2017-05-19 Thread Ngie Cooper
Author: ngie
Date: Fri May 19 17:04:01 2017
New Revision: 318545
URL: https://svnweb.freebsd.org/changeset/base/318545

Log:
  Install {cron.d,newsyslog.conf.d,syslog.d} via `make distribution`, not `make 
install`
  
  I incorrectly started this pattern in r277541 with the opensm 
newsyslog.conf.d file,
  and continued using it in r318441 and r318443.
  
  This will fix the files being handled improperly via installworld, preventing 
tools like
  etcupdate, mergemaster, etc from functioning properly when comparing the 
installed
  contents on a system vs the contents in a source tree when doing merges.
  
  PR:   219404
  Submitted by: Dan McGregor 
  MFC after:2 weeks
  MFC with: r277541, r318441, r318443
  Sponsored by: Dell EMC Isilon

Modified:
  head/etc/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Fri May 19 16:22:26 2017(r318544)
+++ head/etc/Makefile   Fri May 19 17:04:01 2017(r318545)
@@ -7,10 +7,6 @@ FILESGROUPS=   FILES
 
 # No need as it is empty and just causes rebuilds since this file does so much.
 UPDATE_DEPENDFILE= no
-SUBDIR=\
-   cron.d \
-   newsyslog.conf.d \
-   syslog.d
 
 .if ${MK_SENDMAIL} != "no"
 SUBDIR+=sendmail
@@ -254,9 +250,11 @@ distribution:
 .if ${MK_CASPER} != "no"
${_+_}cd ${.CURDIR}/casper; ${MAKE} install
 .endif
+   ${_+_}cd ${.CURDIR}/cron.d; ${MAKE} install
${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
${_+_}cd ${.CURDIR}/devd; ${MAKE} install
${_+_}cd ${.CURDIR}/gss; ${MAKE} install
+   ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install
 .if ${MK_NTP} != "no"
${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
 .endif
@@ -266,6 +264,7 @@ distribution:
 .endif
${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install
${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
+   ${_+_}cd ${.CURDIR}/syslog.d; ${MAKE} install
${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install
cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \
___
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: r318441 - in head/etc: . cron.d

2017-05-19 Thread Baptiste Daroussin
On Fri, May 19, 2017 at 09:17:23AM -0700, John Baldwin wrote:
> On Thursday, May 18, 2017 11:24:29 PM Baptiste Daroussin wrote:
> > On Thu, May 18, 2017 at 09:48:25AM -0700, John Baldwin wrote:
> > > On Thursday, May 18, 2017 03:09:32 PM Baptiste Daroussin wrote:
> > > > On Thu, May 18, 2017 at 02:56:31AM -0700, Rodney W. Grimes wrote:
> > > > > > Author: ngie
> > > > > > Date: Thu May 18 06:25:39 2017
> > > > > > New Revision: 318441
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/318441
> > > > > > 
> > > > > > Log:
> > > > > >   Handle the cron.d entry for MK_AT in cron conditionally
> > > > > >   
> > > > > >   Install /etc/cron.d/at if MK_AT != no, always using it, which 
> > > > > > tries
> > > > > >   to run a non-existent program via cron(8) every 5 minutes with the
> > > > > >   default /etc/crontab, prior to this commit.
> > > > > >   
> > > > > >   SHELL and PATH are duplicated between /etc/crontab and 
> > > > > > /etc/cron.d/at
> > > > > >   because atrun(8) executes programs, which may rely on environment
> > > > > >   currently set via /etc/crontab.
> > > > > >   
> > > > > >   Noted by: bdrewery (in an internal review)
> > > > > >   MFC after:2 months
> > > > > >   Relnotes: yes (may need to add environmental modifications to
> > > > > >  /etc/cron.d/at)
> > > > > >   Sponsored by: Dell EMC Isilon
> > > > > > 
> > > > > > Added:
> > > > > >   head/etc/cron.d/
> > > > > >   head/etc/cron.d/Makefile   (contents, props changed)
> > > > > >   head/etc/cron.d/at   (contents, props changed)
> > > > > > Modified:
> > > > > >   head/etc/Makefile
> > > > > >   head/etc/crontab
> > > > > > 
> > > > > > Modified: head/etc/Makefile
> > > > > > ==
> > > > > > --- head/etc/Makefile   Thu May 18 06:15:42 2017
> > > > > > (r318440)
> > > > > > +++ head/etc/Makefile   Thu May 18 06:25:39 2017
> > > > > > (r318441)
> > > > > > @@ -8,6 +8,7 @@ FILESGROUPS=FILES
> > > > > >  # No need as it is empty and just causes rebuilds since this file 
> > > > > > does so much.
> > > > > >  UPDATE_DEPENDFILE= no
> > > > > >  SUBDIR=\
> > > > > > +   cron.d \
> > > > > > newsyslog.conf.d \
> > > > > > syslog.d
> > > > > 
> > > > > The thread on the newsyslog clearly shows that this is a 
> > > > > contriversial change.
> > > > > 
> > > > > I strongly object to further splitting of /etc/FOO into 
> > > > > /etc/foo.d/FOO files
> > > > > to suite Dell/EMC/Isilon's needs.  It is in conflict with the needs 
> > > > > and
> > > > > desires of others.
> > > > 
> > > > Has multiple people has stated, on the newsyslog thread. this is not a
> > > > DELL/EMC/Isilon need, this is also a requirement for plenty of use cases
> > > > 1. Consistency
> > > >   as a project we do support building WITHOUT_FOO there is no reason to 
> > > > install
> > > >   syslog, cron configuration for FOO if the system was built without foo
> > > 
> > > Though it doesn't _hurt_, and breaking POLA has to be worth it, not just
> > > because it looks nice.
> > > 
> > > > 2. Packaging base
> > > >   if one does not install at there is no need for the at crontab to be 
> > > > installed
> > > >   (same reason as 1.)
> > > 
> > > This is a viable reason except that it isn't fully baked yet.
> > > 
> > > > 3. Large deployment of freebsd farms
> > > >   Being able to administrate thousands of FreeBSD machines, one often 
> > > > ends up
> > > >   using tools like puppet, chef, ansible, cfengine. When 
> > > > programmatically
> > > >   handling configuration management it is way easier and safer to simple
> > > >   add/removes files in a directory rather than mangling^Winplace 
> > > > editing files.
> > > 
> > > There's nothing preventing you now from deploying split files and an empty
> > > global configuration file since the daemons support foo.d.  You don't 
> > > require
> > > that to change in upstream since you should be using some sort of VCS to
> > > manage your configuration as it is.
> > > 
> > > > 4. Ports/packages
> > > >   On can provide easily sample configuration for cron, syslog (not 
> > > > only) and the
> > > >   admin can decide to use it or not easily (ususally this is done by 
> > > > making
> > > >   symlinks from the said file which would live in share/* into the .d 
> > > > directory.
> > > > 
> > > > This is not a new trend in FreeBSD: newsyslog, rc.conf, libmap and more.
> > > 
> > > The support for broken out files has long been there, but the base system 
> > > has
> > > not used them previously for default config shipped during a release.  
> > > That
> > > is in fact a new trend.
> > > 
> > > However, the current approach seems to be the absolute worst way to do 
> > > this.
> > > If someone wants to use the existing base system image and modify it with
> > > config management, they now have to use a mix of styles (for some services
> > > edit a global config file for certain

Re: svn commit: r318441 - in head/etc: . cron.d

2017-05-19 Thread John Baldwin
On Thursday, May 18, 2017 11:24:29 PM Baptiste Daroussin wrote:
> On Thu, May 18, 2017 at 09:48:25AM -0700, John Baldwin wrote:
> > On Thursday, May 18, 2017 03:09:32 PM Baptiste Daroussin wrote:
> > > On Thu, May 18, 2017 at 02:56:31AM -0700, Rodney W. Grimes wrote:
> > > > > Author: ngie
> > > > > Date: Thu May 18 06:25:39 2017
> > > > > New Revision: 318441
> > > > > URL: https://svnweb.freebsd.org/changeset/base/318441
> > > > > 
> > > > > Log:
> > > > >   Handle the cron.d entry for MK_AT in cron conditionally
> > > > >   
> > > > >   Install /etc/cron.d/at if MK_AT != no, always using it, which tries
> > > > >   to run a non-existent program via cron(8) every 5 minutes with the
> > > > >   default /etc/crontab, prior to this commit.
> > > > >   
> > > > >   SHELL and PATH are duplicated between /etc/crontab and 
> > > > > /etc/cron.d/at
> > > > >   because atrun(8) executes programs, which may rely on environment
> > > > >   currently set via /etc/crontab.
> > > > >   
> > > > >   Noted by:   bdrewery (in an internal review)
> > > > >   MFC after:  2 months
> > > > >   Relnotes:   yes (may need to add environmental modifications to
> > > > >/etc/cron.d/at)
> > > > >   Sponsored by:   Dell EMC Isilon
> > > > > 
> > > > > Added:
> > > > >   head/etc/cron.d/
> > > > >   head/etc/cron.d/Makefile   (contents, props changed)
> > > > >   head/etc/cron.d/at   (contents, props changed)
> > > > > Modified:
> > > > >   head/etc/Makefile
> > > > >   head/etc/crontab
> > > > > 
> > > > > Modified: head/etc/Makefile
> > > > > ==
> > > > > --- head/etc/Makefile Thu May 18 06:15:42 2017(r318440)
> > > > > +++ head/etc/Makefile Thu May 18 06:25:39 2017(r318441)
> > > > > @@ -8,6 +8,7 @@ FILESGROUPS=  FILES
> > > > >  # No need as it is empty and just causes rebuilds since this file 
> > > > > does so much.
> > > > >  UPDATE_DEPENDFILE=   no
> > > > >  SUBDIR=  \
> > > > > + cron.d \
> > > > >   newsyslog.conf.d \
> > > > >   syslog.d
> > > > 
> > > > The thread on the newsyslog clearly shows that this is a contriversial 
> > > > change.
> > > > 
> > > > I strongly object to further splitting of /etc/FOO into /etc/foo.d/FOO 
> > > > files
> > > > to suite Dell/EMC/Isilon's needs.  It is in conflict with the needs and
> > > > desires of others.
> > > 
> > > Has multiple people has stated, on the newsyslog thread. this is not a
> > > DELL/EMC/Isilon need, this is also a requirement for plenty of use cases
> > > 1. Consistency
> > >   as a project we do support building WITHOUT_FOO there is no reason to 
> > > install
> > >   syslog, cron configuration for FOO if the system was built without foo
> > 
> > Though it doesn't _hurt_, and breaking POLA has to be worth it, not just
> > because it looks nice.
> > 
> > > 2. Packaging base
> > >   if one does not install at there is no need for the at crontab to be 
> > > installed
> > >   (same reason as 1.)
> > 
> > This is a viable reason except that it isn't fully baked yet.
> > 
> > > 3. Large deployment of freebsd farms
> > >   Being able to administrate thousands of FreeBSD machines, one often 
> > > ends up
> > >   using tools like puppet, chef, ansible, cfengine. When programmatically
> > >   handling configuration management it is way easier and safer to simple
> > >   add/removes files in a directory rather than mangling^Winplace editing 
> > > files.
> > 
> > There's nothing preventing you now from deploying split files and an empty
> > global configuration file since the daemons support foo.d.  You don't 
> > require
> > that to change in upstream since you should be using some sort of VCS to
> > manage your configuration as it is.
> > 
> > > 4. Ports/packages
> > >   On can provide easily sample configuration for cron, syslog (not only) 
> > > and the
> > >   admin can decide to use it or not easily (ususally this is done by 
> > > making
> > >   symlinks from the said file which would live in share/* into the .d 
> > > directory.
> > > 
> > > This is not a new trend in FreeBSD: newsyslog, rc.conf, libmap and more.
> > 
> > The support for broken out files has long been there, but the base system 
> > has
> > not used them previously for default config shipped during a release.  That
> > is in fact a new trend.
> > 
> > However, the current approach seems to be the absolute worst way to do this.
> > If someone wants to use the existing base system image and modify it with
> > config management, they now have to use a mix of styles (for some services
> > edit a global config file for certain settings, but use a dedicated file for
> > other settings for the same service, or for the same settings but a 
> > different
> > service).  It's also the worst case for humans trying to work with our 
> > system
> > as the division between which services are broken out vs global is
> > inconsistent and arbitrary.
> > 
> > Once you split up the files

svn commit: r318539 - head/lib/libthr/thread

2017-05-19 Thread Eric van Gyzen
Author: vangyzen
Date: Fri May 19 13:04:05 2017
New Revision: 318539
URL: https://svnweb.freebsd.org/changeset/base/318539

Log:
  libthr: fix warnings at WARNS=6
  
  Fix warnings about the following when WARNS=6 (which I will commit soon):
  
  - casting away const
  - no previous 'extern' declaration for non-static variable
  - others as explained by #pragmas and comments
  - unused parameters
  
  The last is the only functional change.
  
  Reviewed by:  kib
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10808

Modified:
  head/lib/libthr/thread/thr_attr.c
  head/lib/libthr/thread/thr_exit.c
  head/lib/libthr/thread/thr_sig.c
  head/lib/libthr/thread/thr_spec.c
  head/lib/libthr/thread/thr_stack.c
  head/lib/libthr/thread/thr_symbols.c
  head/lib/libthr/thread/thr_umtx.c
  head/lib/libthr/thread/thr_umtx.h

Modified: head/lib/libthr/thread/thr_attr.c
==
--- head/lib/libthr/thread/thr_attr.c   Fri May 19 13:02:19 2017
(r318538)
+++ head/lib/libthr/thread/thr_attr.c   Fri May 19 13:04:05 2017
(r318539)
@@ -607,7 +607,7 @@ _pthread_attr_setaffinity_np(pthread_att
/* Kernel checks invalid bits, we check it here too. */
size_t i;
for (i = kern_size; i < cpusetsize; ++i) {
-   if (((char *)cpusetp)[i])
+   if (((const char *)cpusetp)[i])
return (EINVAL);
}
}

Modified: head/lib/libthr/thread/thr_exit.c
==
--- head/lib/libthr/thread/thr_exit.c   Fri May 19 13:02:19 2017
(r318538)
+++ head/lib/libthr/thread/thr_exit.c   Fri May 19 13:04:05 2017
(r318539)
@@ -119,7 +119,8 @@ _Unwind_GetCFA(struct _Unwind_Context *c
 #endif /* PIC */
 
 static void
-thread_unwind_cleanup(_Unwind_Reason_Code code, struct _Unwind_Exception *e)
+thread_unwind_cleanup(_Unwind_Reason_Code code __unused,
+struct _Unwind_Exception *e __unused)
 {
/*
 * Specification said that _Unwind_Resume should not be used here,
@@ -130,10 +131,10 @@ thread_unwind_cleanup(_Unwind_Reason_Cod
 }
 
 static _Unwind_Reason_Code
-thread_unwind_stop(int version, _Unwind_Action actions,
-   int64_t exc_class,
-   struct _Unwind_Exception *exc_obj,
-   struct _Unwind_Context *context, void *stop_parameter)
+thread_unwind_stop(int version __unused, _Unwind_Action actions,
+   int64_t exc_class __unused,
+   struct _Unwind_Exception *exc_obj __unused,
+   struct _Unwind_Context *context, void *stop_parameter __unused)
 {
struct pthread *curthread = _get_curthread();
struct pthread_cleanup *cur;

Modified: head/lib/libthr/thread/thr_sig.c
==
--- head/lib/libthr/thread/thr_sig.cFri May 19 13:02:19 2017
(r318538)
+++ head/lib/libthr/thread/thr_sig.cFri May 19 13:04:05 2017
(r318539)
@@ -441,7 +441,7 @@ _thr_signal_init(int dlopened)
 }
 
 void
-_thr_sigact_unload(struct dl_phdr_info *phdr_info)
+_thr_sigact_unload(struct dl_phdr_info *phdr_info __unused)
 {
 #if 0
struct pthread *curthread = _get_curthread();

Modified: head/lib/libthr/thread/thr_spec.c
==
--- head/lib/libthr/thread/thr_spec.c   Fri May 19 13:02:19 2017
(r318538)
+++ head/lib/libthr/thread/thr_spec.c   Fri May 19 13:04:05 2017
(r318539)
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX];
+static struct pthread_key _thread_keytable[PTHREAD_KEYS_MAX];
 
 __weak_reference(_pthread_key_create, pthread_key_create);
 __weak_reference(_pthread_key_delete, pthread_key_delete);

Modified: head/lib/libthr/thread/thr_stack.c
==
--- head/lib/libthr/thread/thr_stack.c  Fri May 19 13:02:19 2017
(r318538)
+++ head/lib/libthr/thread/thr_stack.c  Fri May 19 13:04:05 2017
(r318539)
@@ -290,6 +290,19 @@ _thr_stack_alloc(struct pthread_attr *at
return (-1);
 }
 
+/*
+ * Disable this warning from clang:
+ *
+ * cast from 'char *' to
+ *'struct stack *' increases required alignment from 1 to 8
+ *[-Werror,-Wcast-align]
+ * spare_stack = (struct stack *)
+ */
+#ifdef __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-align"
+#endif
+
 /* This function must be called with _thread_list_lock held. */
 void
 _thr_stack_free(struct pthread_attr *attr)
@@ -316,3 +329,7 @@ _thr_stack_free(struct pthread_attr *att
attr->stackaddr_attr = NULL;
}
 }
+
+#ifdef __clang__
+#pr

svn commit: r318531 - head/sys/dev/mlx4/mlx4_core

2017-05-19 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May 19 12:22:48 2017
New Revision: 318531
URL: https://svnweb.freebsd.org/changeset/base/318531

Log:
  mlx4: Use the CQ quota for SRIOV when creating completion EQs
  
  When creating EQs to handle CQ completion events for the PF or for
  VFs, we create enough EQE entries to handle completions for the max
  number of CQs that can use that EQ.
  
  When SRIOV is activated, the max number of CQs a VF (or the PF) can
  obtain is its CQ quota (determined by the Hypervisor resource
  tracker).  Therefore, when creating an EQ, the number of EQE entries
  that the VF should request for that EQ is the CQ quota value (and not
  the total number of CQs available in the firmware).
  
  Under SRIOV, the PF, also must use its CQ quota, because the resource
  tracker also controls how many CQs the PF can obtain.
  
  Using the firmware total CQs instead of the CQ quota when creating EQs
  resulted wasting MTT entries, due to allocating more EQEs than were
  needed.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_eq.c
  head/sys/dev/mlx4/mlx4_core/mlx4_main.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_eq.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_eq.c   Fri May 19 11:45:14 2017
(r318530)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_eq.c   Fri May 19 12:22:48 2017
(r318531)
@@ -1169,8 +1169,7 @@ int mlx4_init_eq_table(struct mlx4_dev *
}
 
for (i = 0; i < dev->caps.num_comp_vectors; ++i) {
-   err = mlx4_create_eq(dev, dev->caps.num_cqs -
- dev->caps.reserved_cqs +
+   err = mlx4_create_eq(dev, dev->quotas.cq +
  MLX4_NUM_SPARE_EQE,
 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
 &priv->eq_table.eq[i]);
@@ -1190,8 +1189,7 @@ int mlx4_init_eq_table(struct mlx4_dev *
for (i = dev->caps.num_comp_vectors + 1;
  i < dev->caps.num_comp_vectors + dev->caps.comp_pool + 1; ++i) {
 
-   err = mlx4_create_eq(dev, dev->caps.num_cqs -
- dev->caps.reserved_cqs +
+   err = mlx4_create_eq(dev, dev->quotas.cq +
  MLX4_NUM_SPARE_EQE,
 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
 &priv->eq_table.eq[i]);

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Fri May 19 11:45:14 2017
(r318530)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Fri May 19 12:22:48 2017
(r318531)
@@ -3446,6 +3446,8 @@ slave_start:
goto err_free_eq;
}
 
+   mlx4_init_quotas(dev);
+
err = mlx4_setup_hca(dev);
if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) &&
!mlx4_is_mfunc(dev)) {
@@ -3459,7 +3461,6 @@ slave_start:
if (err)
goto err_steer;
 
-   mlx4_init_quotas(dev);
mlx4_init_hca_info(dev);
 
for (port = 1; port <= dev->caps.num_ports; port++) {
___
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: r318530 - head/sys/arm/include

2017-05-19 Thread Michal Meloun
Author: mmel
Date: Fri May 19 11:45:14 2017
New Revision: 318530
URL: https://svnweb.freebsd.org/changeset/base/318530

Log:
  Increase maximum text segment size.
  LLVM binaries are huge...
  
  MFC after:3 days

Modified:
  head/sys/arm/include/vmparam.h

Modified: head/sys/arm/include/vmparam.h
==
--- head/sys/arm/include/vmparam.h  Fri May 19 10:16:51 2017
(r318529)
+++ head/sys/arm/include/vmparam.h  Fri May 19 11:45:14 2017
(r318530)
@@ -42,7 +42,7 @@
  * Virtual memory related constants, all in bytes
  */
 #ifndefMAXTSIZ
-#defineMAXTSIZ (64UL*1024*1024)/* max text size */
+#defineMAXTSIZ (256UL*1024*1024)   /* max text size */
 #endif
 #ifndefDFLDSIZ
 #defineDFLDSIZ (128UL*1024*1024)   /* initial data size 
limit */
___
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: r318527 - head/sys/netpfil/ipfw

2017-05-19 Thread Don Lewis
Author: truckman
Date: Fri May 19 08:38:03 2017
New Revision: 318527
URL: https://svnweb.freebsd.org/changeset/base/318527

Log:
  Fix the queue delay estimation in PIE/FQ-PIE when the timestamp
  (TS) method is used.  When packet timestamp is used, the "current_qdelay"
  keeps storing the last queue delay value calculated in the dequeue
  function.  Therefore, when a burst of packets arrives followed by
  a pause, the "current_qdelay" will store a high value caused by the
  burst and stick to that value during the pause because the queue
  delay measurement is done inside the dequeue function.  This causes
  the drop probability calculation function to calculate high drop
  probability value instead of zero and prevents the burst allowance
  mechanism from working properly.  Fix this problem by resetting
  "current_qdelay" inside the drop probability calculation function
  when the queue length is zero and TS option is used.
  
  Submitted by: Rasool Al-Saadi 
  MFC after:1 week

Modified:
  head/sys/netpfil/ipfw/dn_aqm_pie.c
  head/sys/netpfil/ipfw/dn_sched_fq_pie.c

Modified: head/sys/netpfil/ipfw/dn_aqm_pie.c
==
--- head/sys/netpfil/ipfw/dn_aqm_pie.c  Fri May 19 08:26:41 2017
(r318526)
+++ head/sys/netpfil/ipfw/dn_aqm_pie.c  Fri May 19 08:38:03 2017
(r318527)
@@ -211,11 +211,16 @@ calculate_drop_prob(void *x)
pprms = pst->parms;
prob = pst->drop_prob;
 
-   /* calculate current qdelay */
-   if (pprms->flags & PIE_DEPRATEEST_ENABLED) {
+   /* calculate current qdelay using DRE method.
+* If TS is used and no data in the queue, reset current_qdelay
+* as it stays at last value during dequeue process. 
+   */
+   if (pprms->flags & PIE_DEPRATEEST_ENABLED)
pst->current_qdelay = ((uint64_t)pst->pq->ni.len_bytes *
pst->avg_dq_time) >> PIE_DQ_THRESHOLD_BITS;
-   }
+   else 
+   if (!pst->pq->ni.len_bytes)
+pst->current_qdelay = 0;
 
/* calculate drop probability */
p = (int64_t)pprms->alpha * 

Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c
==
--- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Fri May 19 08:26:41 2017
(r318526)
+++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Fri May 19 08:38:03 2017
(r318527)
@@ -383,11 +383,16 @@ fq_calculate_drop_prob(void *x)
pprms = pst->parms;
prob = pst->drop_prob;
 
-   /* calculate current qdelay */
-   if (pprms->flags & PIE_DEPRATEEST_ENABLED) {
+   /* calculate current qdelay using DRE method.
+* If TS is used and no data in the queue, reset current_qdelay
+* as it stays at last value during dequeue process.
+   */
+   if (pprms->flags & PIE_DEPRATEEST_ENABLED)
pst->current_qdelay = ((uint64_t)q->stats.len_bytes  * 
pst->avg_dq_time)
>> PIE_DQ_THRESHOLD_BITS;
-   }
+   else
+   if (!q->stats.len_bytes)
+   pst->current_qdelay = 0;
 
/* calculate drop probability */
p = (int64_t)pprms->alpha * 
___
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: r318526 - head/sys/arm/mv/armada38x

2017-05-19 Thread Wojciech Macek
Author: wma
Date: Fri May 19 08:26:41 2017
New Revision: 318526
URL: https://svnweb.freebsd.org/changeset/base/318526

Log:
  Fix boot up on ARMADA38X uniprocessor variant
  
  Marvell Armada 380 is a uni-processor variant of the 38x SoC
  family. A function platform_mp_setmaxid() was setting a hardcoded
  value, which caused boot fail on A380. Fix this by relying on
  the CPU count obtained from device tree nodes.
  
  Submitted by:  Marcin Wojtas https://reviews.freebsd.org/D10783

Modified:
  head/sys/arm/mv/armada38x/armada38x_mp.c

Modified: head/sys/arm/mv/armada38x/armada38x_mp.c
==
--- head/sys/arm/mv/armada38x/armada38x_mp.cFri May 19 08:25:40 2017
(r318525)
+++ head/sys/arm/mv/armada38x/armada38x_mp.cFri May 19 08:26:41 2017
(r318526)
@@ -127,7 +127,7 @@ platform_mp_setmaxid(void)
 
/* Armada38x family supports maximum 2 cores */
mp_ncpus = platform_cnt_cpus();
-   mp_maxid = 1;
+   mp_maxid = mp_ncpus - 1;
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-05-19 Thread Wojciech Macek
Author: wma
Date: Fri May 19 08:25:40 2017
New Revision: 318525
URL: https://svnweb.freebsd.org/changeset/base/318525

Log:
  Fix MPIC mask/unmask
  
  Before the fix for single interrupt, both percpu and non-percpu routes
  were enabled/disable at the same time.
  
  Submitted by:  Marcin Wojtas https://reviews.freebsd.org/D10716

Modified:
  head/sys/arm/mv/mpic.c

Modified: head/sys/arm/mv/mpic.c
==
--- head/sys/arm/mv/mpic.c  Fri May 19 08:24:23 2017(r318524)
+++ head/sys/arm/mv/mpic.c  Fri May 19 08:25:40 2017(r318525)
@@ -148,6 +148,7 @@ static void mpic_unmask_irq(uintptr_t nb
 static voidmpic_mask_irq(uintptr_t nb);
 static voidmpic_mask_irq_err(uintptr_t nb);
 static voidmpic_unmask_irq_err(uintptr_t nb);
+static boolean_t mpic_irq_is_percpu(uintptr_t);
 #ifdef INTRNG
 static int mpic_intr(void *arg);
 #endif
@@ -474,14 +475,24 @@ mpic_mask_irq_err(uintptr_t nb)
MPIC_CPU_WRITE(mv_mpic_sc, MPIC_ERR_MASK, mask);
 }
 
+static boolean_t
+mpic_irq_is_percpu(uintptr_t nb)
+{
+   if (nb < MPIC_PPI)
+   return TRUE;
+
+   return FALSE;
+}
+
 static void
 mpic_unmask_irq(uintptr_t nb)
 {
 
-   if (nb < ERR_IRQ) {
-   MPIC_WRITE(mv_mpic_sc, MPIC_ISE, nb);
+   if (mpic_irq_is_percpu(nb))
MPIC_CPU_WRITE(mv_mpic_sc, MPIC_ICM, nb);
-   } else if (nb < MSI_IRQ)
+   else if (nb < ERR_IRQ)
+   MPIC_WRITE(mv_mpic_sc, MPIC_ISE, nb);
+   else if (nb < MSI_IRQ)
mpic_unmask_irq_err(nb);
 
if (nb == 0)
@@ -492,10 +503,11 @@ static void
 mpic_mask_irq(uintptr_t nb)
 {
 
-   if (nb < ERR_IRQ) {
-   MPIC_WRITE(mv_mpic_sc, MPIC_ICE, nb);
+   if (mpic_irq_is_percpu(nb))
MPIC_CPU_WRITE(mv_mpic_sc, MPIC_ISM, nb);
-   } else if (nb < MSI_IRQ)
+   else if (nb < ERR_IRQ)
+   MPIC_WRITE(mv_mpic_sc, MPIC_ICE, nb);
+   else if (nb < MSI_IRQ)
mpic_mask_irq_err(nb);
 }
 
___
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: r318524 - head/sys/dev/etherswitch/e6000sw

2017-05-19 Thread Wojciech Macek
Author: wma
Date: Fri May 19 08:24:23 2017
New Revision: 318524
URL: https://svnweb.freebsd.org/changeset/base/318524

Log:
  Poll PHY status using internal e6000sw registers
  
  e6000sw family automatically reflects PHY status in each port's registers.
  Therefore it is not necessary to do a full PHY polling squence, which
  results in much quicker operation and much less significant usage of
  the SMI bus.
  
  Care must be taken that the resulting ifmedia_active is identical to
  what the PHY will compute, or gratuitous link status changes will
  occur whenever the PHYs update function is called.
  
  This patch implements above improvement. On the occasion set a pointer to
  the proc structure to be part of software context instead of being
  a global variable.
  
  Submitted by: Marcin Wojtas 
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Reviewed by: loos
  Differential revision: https://reviews.freebsd.org/D10714

Modified:
  head/sys/dev/etherswitch/e6000sw/e6000sw.c
  head/sys/dev/etherswitch/e6000sw/e6000swreg.h

Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c
==
--- head/sys/dev/etherswitch/e6000sw/e6000sw.c  Fri May 19 08:19:51 2017
(r318523)
+++ head/sys/dev/etherswitch/e6000sw/e6000sw.c  Fri May 19 08:24:23 2017
(r318524)
@@ -89,7 +89,7 @@ typedef struct e6000sw_softc {
char*ifname[E6000SW_MAX_PORTS];
device_tmiibus[E6000SW_MAX_PORTS];
struct mii_data *mii[E6000SW_MAX_PORTS];
-   struct callout  tick_callout;
+   struct proc *kproc;
 
uint32_tcpuports_mask;
uint32_tfixed_mask;
@@ -149,8 +149,6 @@ static __inline int e6000sw_is_phyport(e
 static __inline struct mii_data *e6000sw_miiforphy(e6000sw_softc_t *sc,
 unsigned int phy);
 
-static struct proc *e6000sw_kproc;
-
 static device_method_t e6000sw_methods[] = {
/* device interface */
DEVMETHOD(device_identify,  e6000sw_identify),
@@ -419,8 +417,7 @@ e6000sw_attach(device_t dev)
bus_generic_probe(dev);
bus_generic_attach(dev);
 
-   kproc_create(e6000sw_tick, sc, &e6000sw_kproc, 0, 0,
-   "e6000sw tick kproc");
+   kproc_create(e6000sw_tick, sc, &sc->kproc, 0, 0, "e6000sw tick kproc");
 
return (0);
 
@@ -1010,23 +1007,65 @@ e6000sw_get_pvid(e6000sw_softc_t *sc, in
return (0);
 }
 
+/*
+ * Convert port status to ifmedia.
+ */
+static void
+e6000sw_update_ifmedia(uint16_t portstatus, u_int *media_status, u_int 
*media_active)
+{
+   *media_active = IFM_ETHER;
+   *media_status = IFM_AVALID;
+
+   if ((portstatus & PORT_STATUS_LINK_MASK) != 0)
+   *media_status |= IFM_ACTIVE;
+   else {
+   *media_active |= IFM_NONE;
+   return;
+   }
+
+   switch (portstatus & PORT_STATUS_SPEED_MASK) {
+   case PORT_STATUS_SPEED_10:
+   *media_active |= IFM_10_T;
+   break;
+   case PORT_STATUS_SPEED_100:
+   *media_active |= IFM_100_TX;
+   break;
+   case PORT_STATUS_SPEED_1000:
+   *media_active |= IFM_1000_T;
+   break;
+   }
+
+   if ((portstatus & PORT_STATUS_DUPLEX_MASK) == 0)
+   *media_active |= IFM_FDX;
+   else
+   *media_active |= IFM_HDX;
+}
+
 static void
 e6000sw_tick (void *arg)
 {
e6000sw_softc_t *sc;
struct mii_softc *miisc;
+   uint16_t portstatus;
int port;
 
sc = arg;
 
E6000SW_LOCK_ASSERT(sc, SA_UNLOCKED);
+
for (;;) {
E6000SW_LOCK(sc);
for (port = 0; port < sc->num_ports; port++) {
/* Tick only on PHY ports */
if (!e6000sw_is_phyport(sc, port))
continue;
-   mii_tick(sc->mii[port]);
+
+   portstatus = e6000sw_readreg(sc, REG_PORT(port), 
PORT_STATUS);
+
+   e6000sw_update_ifmedia(portstatus,
+   &sc->mii[port]->mii_media_status,
+   &sc->mii[port]->mii_media_active);
+
LIST_FOREACH(miisc, &sc->mii[port]->mii_phys, mii_list) 
{
if 
(IFM_INST(sc->mii[port]->mii_media.ifm_cur->ifm_media)
!= miisc->mii_inst)

Modified: head/sys/dev/etherswitch/e6000sw/e6000swreg.h
==
--- head/sys/dev/etherswitch/e6000sw/e6000swreg.h   Fri May 19 08:19:51 
2017(r318523)
+++ head/sys/dev/etherswitch/e6000sw/e6000swreg.h   Fri May 19 08:24:23 
2017(r318524)
@@ -55,6 +55,14 @@ struct atu_opt {
  * Per-Port Switch Registers
  */
 #define PORT_STATUS0x0
+#definePORT_STATUS_SPEED_

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

2017-05-19 Thread Roger Pau Monné
Author: royger
Date: Fri May 19 08:19:51 2017
New Revision: 318523
URL: https://svnweb.freebsd.org/changeset/base/318523

Log:
  xen/netfront: don't drop the ring RX lock with inconsistent ring state
  
  Make sure the RX ring lock is only released when the state of the ring is
  consistent, or else concurrent calls to xn_rxeof might get an inconsistent 
ring
  state and thus some packets might be processed twice.
  
  Note that this is not very common, and could only happen when an interrupt is
  delivered while in xn_ifinit.
  
  Reported by:  cperciva
  Tested by:cperciva
  MFC after:1 week
  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.cFri May 19 08:19:39 2017
(r318522)
+++ head/sys/dev/xen/netfront/netfront.cFri May 19 08:19:51 2017
(r318523)
@@ -1161,17 +1161,18 @@ xn_rxeof(struct netfront_rxq *rxq)
struct mbufq mbufq_rxq, mbufq_errq;
int err, work_to_do;
 
-   do {
-   XN_RX_LOCK_ASSERT(rxq);
-   if (!netfront_carrier_ok(np))
-   return;
-
-   /* XXX: there should be some sane limit. */
-   mbufq_init(&mbufq_errq, INT_MAX);
-   mbufq_init(&mbufq_rxq, INT_MAX);
+   XN_RX_LOCK_ASSERT(rxq);
+
+   if (!netfront_carrier_ok(np))
+   return;
+
+   /* XXX: there should be some sane limit. */
+   mbufq_init(&mbufq_errq, INT_MAX);
+   mbufq_init(&mbufq_rxq, INT_MAX);
 
-   ifp = np->xn_ifp;
+   ifp = np->xn_ifp;
 
+   do {
rp = rxq->ring.sring->rsp_prod;
rmb();  /* Ensure we see queued responses up to 'rp'. */
 
@@ -1191,7 +1192,7 @@ xn_rxeof(struct netfront_rxq *rxq)
}
 
m->m_pkthdr.rcvif = ifp;
-   if ( rx->flags & NETRXF_data_validated ) {
+   if (rx->flags & NETRXF_data_validated) {
/*
 * According to mbuf(9) the correct way to tell
 * the stack that the checksum of an inbound
@@ -1214,50 +1215,45 @@ xn_rxeof(struct netfront_rxq *rxq)
}
 
(void )mbufq_enqueue(&mbufq_rxq, m);
-   rxq->ring.rsp_cons = i;
}
 
-   mbufq_drain(&mbufq_errq);
+   rxq->ring.rsp_cons = i;
 
-   /*
-* Process all the mbufs after the remapping is complete.
-* Break the mbuf chain first though.
-*/
-   while ((m = mbufq_dequeue(&mbufq_rxq)) != NULL) {
-   if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+   xn_alloc_rx_buffers(rxq);
 
-   /* XXX: Do we really need to drop the rx lock? */
-   XN_RX_UNLOCK(rxq);
+   RING_FINAL_CHECK_FOR_RESPONSES(&rxq->ring, work_to_do);
+   } while (work_to_do);
+
+   XN_RX_UNLOCK(rxq);
+   mbufq_drain(&mbufq_errq);
+   /*
+* Process all the mbufs after the remapping is complete.
+* Break the mbuf chain first though.
+*/
+   while ((m = mbufq_dequeue(&mbufq_rxq)) != NULL) {
+   if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 #if (defined(INET) || defined(INET6))
-   /* Use LRO if possible */
-   if ((ifp->if_capenable & IFCAP_LRO) == 0 ||
-   lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) {
-   /*
-* If LRO fails, pass up to the stack
-* directly.
-*/
-   (*ifp->if_input)(ifp, m);
-   }
-#else
+   /* Use LRO if possible */
+   if ((ifp->if_capenable & IFCAP_LRO) == 0 ||
+   lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) {
+   /*
+* If LRO fails, pass up to the stack
+* directly.
+*/
(*ifp->if_input)(ifp, m);
-#endif
-
-   XN_RX_LOCK(rxq);
}
-
-   rxq->ring.rsp_cons = i;
+#else
+   (*ifp->if_input)(ifp, m);
+#endif
+   }
 
 #if (defined(INET) || defined(INET6))
-   /*
-* Flush any outstanding LRO work
-*/
-   tcp_lro_flush_all(lro);
+   /*
+* Flush any outstanding LRO work
+*/
+   tcp_lro_flush_all(lro);
 #endif
-
-   xn_alloc_rx_buffers(rxq);
-
-   RING_FINAL_CHECK_FOR_RESPONSES(&rxq->ring, work_to_do);
-   } while (work_to_do);
+   XN_RX_LOCK

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

2017-05-19 Thread Wojciech Macek
Author: wma
Date: Fri May 19 08:19:39 2017
New Revision: 318522
URL: https://svnweb.freebsd.org/changeset/base/318522

Log:
  Enable proper configuration of CESA MBUS windows
  
  For all Marvell devices, MBUS windows configuration is done
  in a common place. Only CESA was an exception, so move its
  related code from driver to mv_common.c. This way it uses
  same proper DRAM information, same as  all other interfaces
  instead of parsing DT /memory node directly.
  
  Submitted by: Marcin Wojtas 
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Reviewed by: loos
  Differential revision: https://reviews.freebsd.org/D10723

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

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Fri May 19 08:16:47 2017(r318521)
+++ head/sys/arm/mv/mv_common.c Fri May 19 08:19:39 2017(r318522)
@@ -76,6 +76,7 @@ MALLOC_DEFINE(M_IDMA, "idma", "idma dma 
 
 static int win_eth_can_remap(int i);
 
+static int decode_win_cesa_valid(void);
 static int decode_win_cpu_valid(void);
 static int decode_win_usb_valid(void);
 static int decode_win_usb3_valid(void);
@@ -91,6 +92,7 @@ static void decode_win_cpu_setup(void);
 #ifdef SOC_MV_ARMADAXP
 static int decode_win_sdram_fixup(void);
 #endif
+static void decode_win_cesa_setup(u_long);
 static void decode_win_usb_setup(u_long);
 static void decode_win_usb3_setup(u_long);
 static void decode_win_eth_setup(u_long);
@@ -101,6 +103,7 @@ static void decode_win_sdhci_setup(u_lon
 static void decode_win_idma_setup(u_long);
 static void decode_win_xor_setup(u_long);
 
+static void decode_win_cesa_dump(u_long);
 static void decode_win_usb_dump(u_long);
 static void decode_win_usb3_dump(u_long);
 static void decode_win_eth_dump(u_long base);
@@ -146,6 +149,7 @@ static struct soc_node_spec soc_nodes[] 
{ "mrvl,sata", &decode_win_sata_setup, NULL },
{ "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump },
{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump },
+   { "mrvl,cesa", &decode_win_cesa_setup, &decode_win_cesa_dump },
{ "mrvl,pcie", &decode_win_pcie_setup, NULL },
{ NULL, NULL, NULL },
 };
@@ -574,7 +578,7 @@ soc_decode_win(void)
!decode_win_eth_valid() || !decode_win_idma_valid() ||
!decode_win_pcie_valid() || !decode_win_sata_valid() ||
!decode_win_xor_valid() || !decode_win_usb3_valid() ||
-   !decode_win_sdhci_valid())
+   !decode_win_sdhci_valid() || !decode_win_cesa_valid())
return (EINVAL);
 
decode_win_cpu_setup();
@@ -601,6 +605,11 @@ WIN_REG_IDX_WR(win_cpu, br, MV_WIN_CPU_B
 WIN_REG_IDX_WR(win_cpu, remap_l, MV_WIN_CPU_REMAP_LO, MV_MBUS_BRIDGE_BASE)
 WIN_REG_IDX_WR(win_cpu, remap_h, MV_WIN_CPU_REMAP_HI, MV_MBUS_BRIDGE_BASE)
 
+WIN_REG_BASE_IDX_RD(win_cesa, cr, MV_WIN_CESA_CTRL)
+WIN_REG_BASE_IDX_RD(win_cesa, br, MV_WIN_CESA_BASE)
+WIN_REG_BASE_IDX_WR(win_cesa, cr, MV_WIN_CESA_CTRL)
+WIN_REG_BASE_IDX_WR(win_cesa, br, MV_WIN_CESA_BASE)
+
 WIN_REG_BASE_IDX_RD(win_usb, cr, MV_WIN_USB_CTRL)
 WIN_REG_BASE_IDX_RD(win_usb, br, MV_WIN_USB_BASE)
 WIN_REG_BASE_IDX_WR(win_usb, cr, MV_WIN_USB_CTRL)
@@ -1071,6 +1080,63 @@ ddr_target(int i)
 }
 
 /**
+ * CESA windows routines
+ **/
+static int
+decode_win_cesa_valid(void)
+{
+
+   return (decode_win_can_cover_ddr(MV_WIN_CESA_MAX));
+}
+
+static void
+decode_win_cesa_dump(u_long base)
+{
+   int i;
+
+   for (i = 0; i < MV_WIN_CESA_MAX; i++)
+   printf("CESA window#%d: c 0x%08x, b 0x%08x\n", i,
+   win_cesa_cr_read(base, i), win_cesa_br_read(base, i));
+}
+
+/*
+ * Set CESA decode windows.
+ */
+static void
+decode_win_cesa_setup(u_long base)
+{
+   uint32_t br, cr;
+   int i, j;
+
+   for (i = 0; i < MV_WIN_CESA_MAX; i++) {
+   win_cesa_cr_write(base, i, 0);
+   win_cesa_br_write(base, i, 0);
+   }
+
+   /* Only access to active DRAM banks is required */
+   for (i = 0; i < MV_WIN_DDR_MAX; i++) {
+   if (ddr_is_active(i)) {
+   br = ddr_base(i);
+
+   cr = (((ddr_size(i) - 1) & 0x) |
+   (ddr_attr(i) << IO_WIN_ATTR_SHIFT) |
+   (ddr_target(i) << IO_WIN_TGT_SHIFT) |
+   IO_WIN_ENA_MASK);
+
+   /* Set the first free CESA window */
+   for (j = 0; j < MV_WIN_CESA_MAX; j++) {
+   if (win_cesa_cr_read(base, j) & 0x1)
+   continue;
+
+   win_cesa_br_write(base, j, br);
+   

svn commit: r318521 - head/sys/dev/etherswitch/e6000sw

2017-05-19 Thread Wojciech Macek
Author: wma
Date: Fri May 19 08:16:47 2017
New Revision: 318521
URL: https://svnweb.freebsd.org/changeset/base/318521

Log:
  Improve busy-wait loop during switch phy access in e6000sw
  
  Hitherto implementation of PHY polling resulted in a risk of an
  endless loop and very high occupation of the SMI bus. Improve the
  operation by limiting the polling tries and adding sleepable
  pause.
  
  Submitted by: Marcin Wojtas 
  Obtained from: Semihalf
  Sponsored by: Stormshield
  Reviewed by: loos
  Differential revision: https://reviews.freebsd.org/D10713

Modified:
  head/sys/dev/etherswitch/e6000sw/e6000sw.c

Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c
==
--- head/sys/dev/etherswitch/e6000sw/e6000sw.c  Fri May 19 08:11:15 2017
(r318520)
+++ head/sys/dev/etherswitch/e6000sw/e6000sw.c  Fri May 19 08:16:47 2017
(r318521)
@@ -431,13 +431,21 @@ out_fail:
return (err);
 }
 
-static __inline void
+static __inline int
 e6000sw_poll_done(e6000sw_softc_t *sc)
 {
+   int i;
+
+   for (i = 0; i < 16; i++) {
+
+   if (!(e6000sw_readreg(sc, REG_GLOBAL2, PHY_CMD) &
+   (1 << PHY_CMD_SMI_BUSY)))
+   return (0);
 
-   while (e6000sw_readreg(sc, REG_GLOBAL2, PHY_CMD) &
-   (1 << PHY_CMD_SMI_BUSY))
-   continue;
+   pause("e6000sw PHY poll", hz/1000);
+   }
+
+   return (ETIMEDOUT);
 }
 
 /*
@@ -449,6 +457,7 @@ e6000sw_readphy(device_t dev, int phy, i
 {
e6000sw_softc_t *sc;
uint32_t val;
+   int err;
 
sc = device_get_softc(dev);
val = 0;
@@ -460,14 +469,25 @@ e6000sw_readphy(device_t dev, int phy, i
 
E6000SW_LOCK_ASSERT(sc, SA_XLOCKED);
 
-   e6000sw_poll_done(sc);
+   err = e6000sw_poll_done(sc);
+   if (err != 0) {
+   device_printf(dev, "Timeout while waiting for switch\n");
+   return (err);
+   }
+
val |= 1 << PHY_CMD_SMI_BUSY;
val |= PHY_CMD_MODE_MDIO << PHY_CMD_MODE;
val |= PHY_CMD_OPCODE_READ << PHY_CMD_OPCODE;
val |= (reg << PHY_CMD_REG_ADDR) & PHY_CMD_REG_ADDR_MASK;
val |= (phy << PHY_CMD_DEV_ADDR) & PHY_CMD_DEV_ADDR_MASK;
e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, val);
-   e6000sw_poll_done(sc);
+
+   err = e6000sw_poll_done(sc);
+   if (err != 0) {
+   device_printf(dev, "Timeout while waiting for switch\n");
+   return (err);
+   }
+
val = e6000sw_readreg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG)
& PHY_DATA_MASK;
 
@@ -479,6 +499,7 @@ e6000sw_writephy(device_t dev, int phy, 
 {
e6000sw_softc_t *sc;
uint32_t val;
+   int err;
 
sc = device_get_softc(dev);
val = 0;
@@ -490,7 +511,12 @@ e6000sw_writephy(device_t dev, int phy, 
 
E6000SW_LOCK_ASSERT(sc, SA_XLOCKED);
 
-   e6000sw_poll_done(sc);
+   err = e6000sw_poll_done(sc);
+   if (err != 0) {
+   device_printf(dev, "Timeout while waiting for switch\n");
+   return (err);
+   }
+
val |= PHY_CMD_MODE_MDIO << PHY_CMD_MODE;
val |= 1 << PHY_CMD_SMI_BUSY;
val |= PHY_CMD_OPCODE_WRITE << PHY_CMD_OPCODE;
@@ -499,7 +525,12 @@ e6000sw_writephy(device_t dev, int phy, 
e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_DATA_REG,
 data & PHY_DATA_MASK);
e6000sw_writereg(sc, REG_GLOBAL2, SMI_PHY_CMD_REG, val);
-   e6000sw_poll_done(sc);
+
+   err = e6000sw_poll_done(sc);
+   if (err != 0) {
+   device_printf(dev, "Timeout while waiting for switch\n");
+   return (err);
+   }
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318520 - head/sys/dev/xen/blkfront

2017-05-19 Thread Roger Pau Monné
Author: royger
Date: Fri May 19 08:11:15 2017
New Revision: 318520
URL: https://svnweb.freebsd.org/changeset/base/318520

Log:
  xen/blkfront: correctly detach a disk with active users
  
  Call disk_gone when the backend switches to the "Closing" state and blkfront
  still has pending users. This allows the disk to be detached, and will call
  into xbd_closing by itself when the geom layout cleanup has finished.
  
  Reported by:  bapt
  Tested by:manu
  Reviewed by:  bapt
  Sponsored by: Citrix Systems R&D
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D10772

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

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cFri May 19 07:31:48 2017
(r318519)
+++ head/sys/dev/xen/blkfront/blkfront.cFri May 19 08:11:15 2017
(r318520)
@@ -1578,11 +1578,14 @@ xbd_backend_changed(device_t dev, Xenbus
break;
 
case XenbusStateClosing:
-   if (sc->xbd_users > 0)
-   xenbus_dev_error(dev, -EBUSY,
-   "Device in use; refusing to close");
-   else
+   if (sc->xbd_users > 0) {
+   device_printf(dev, "detaching with pending users\n");
+   KASSERT(sc->xbd_disk != NULL,
+   ("NULL disk with pending users\n"));
+   disk_gone(sc->xbd_disk);
+   } else {
xbd_closing(dev);
+   }
break;  
}
 }
___
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"