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

2015-11-29 Thread Michal Meloun
Author: mmel
Date: Sun Nov 29 11:28:04 2015
New Revision: 291444
URL: https://svnweb.freebsd.org/changeset/base/291444

Log:
  AHCI: Fix AHCI driver for ARM.
  On ARM, we must ensure proper interdevice write ordering.
  The AHCI interrupt status register must be updated in HW before
  registers in interrupt controller.
  Unfortunately, only way how we can do it is readback.
  
  Discussed with:   mav
  Approved by:  kib (mentor)
  Differential Revision: https://reviews.freebsd.org/D4240

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

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cSun Nov 29 07:20:30 2015(r291443)
+++ head/sys/dev/ahci/ahci.cSun Nov 29 11:28:04 2015(r291444)
@@ -483,6 +483,7 @@ ahci_intr(void *data)
/* AHCI declares level triggered IS. */
if (!(ctlr->quirks & AHCI_Q_EDGEIS))
ATA_OUTL(ctlr->r_mem, AHCI_IS, is);
+   ATA_RBL(ctlr->r_mem, AHCI_IS);
 }
 
 /*
@@ -501,6 +502,7 @@ ahci_intr_one(void *data)
ctlr->interrupt[unit].function(arg);
/* AHCI declares level triggered IS. */
ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit);
+   ATA_RBL(ctlr->r_mem, AHCI_IS);
 }
 
 static void
@@ -516,6 +518,7 @@ ahci_intr_one_edge(void *data)
ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit);
if ((arg = ctlr->interrupt[unit].argument))
ctlr->interrupt[unit].function(arg);
+   ATA_RBL(ctlr->r_mem, AHCI_IS);
 }
 
 struct resource *

Modified: head/sys/dev/ahci/ahci.h
==
--- head/sys/dev/ahci/ahci.hSun Nov 29 07:20:30 2015(r291443)
+++ head/sys/dev/ahci/ahci.hSun Nov 29 11:28:04 2015(r291444)
@@ -562,6 +562,20 @@ enum ahci_err_type {
 #define ATA_OUTSL_STRM(res, offset, addr, count) \
bus_write_multi_stream_4((res), (offset), (addr), (count))
 
+/*
+ * On some platforms, we must ensure proper interdevice write ordering.
+ * The AHCI interrupt status register must be updated in HW before
+ * registers in interrupt controller.
+ * Unfortunately, only way how we can do it is readback.
+ *
+ * Currently, only ARM is known to have this issue.
+ */
+#if defined(__arm__)
+#define ATA_RBL(res, offset) \
+   bus_read_4((res), (offset))
+#else
+#define ATA_RBL(res, offset)
+#endif
 
 #define AHCI_Q_NOFORCE 0x0001
 #define AHCI_Q_NOPMP   0x0002
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291445 - head/usr.bin/rctl

2015-11-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 29 11:30:17 2015
New Revision: 291445
URL: https://svnweb.freebsd.org/changeset/base/291445

Log:
  User and group identifiers the rctl(8) utility receives from the kernel
  are always in numeric form; don't try to resolve them by names.  This
  speeds up rule listing with large rulesets by about 50%.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.bin/rctl/rctl.c
==
--- head/usr.bin/rctl/rctl.cSun Nov 29 11:28:04 2015(r291444)
+++ head/usr.bin/rctl/rctl.cSun Nov 29 11:30:17 2015(r291445)
@@ -193,7 +193,7 @@ humanize_ids(char *rule)
struct passwd *pwd;
struct group *grp;
const char *subject, *textid, *rest;
-   char *humanized;
+   char *end, *humanized;
 
subject = strsep(&rule, ":");
textid = strsep(&rule, ":");
@@ -206,12 +206,16 @@ humanize_ids(char *rule)
 
/* Replace numerical user and group ids with names. */
if (strcasecmp(subject, "user") == 0) {
-   id = parse_user(textid);
+   id = strtod(textid, &end);
+   if ((size_t)(end - textid) != strlen(textid))
+   errx(1, "malformed uid '%s'", textid);
pwd = getpwuid(id);
if (pwd != NULL)
textid = pwd->pw_name;
} else if (strcasecmp(subject, "group") == 0) {
-   id = parse_group(textid);
+   id = strtod(textid, &end);
+   if ((size_t)(end - textid) != strlen(textid))
+   errx(1, "malformed gid '%s'", textid);
grp = getgrgid(id);
if (grp != NULL)
textid = grp->gr_name;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291446 - head/sys/vm

2015-11-29 Thread Konstantin Belousov
Author: kib
Date: Sun Nov 29 11:37:25 2015
New Revision: 291446
URL: https://svnweb.freebsd.org/changeset/base/291446

Log:
  Minor cleanup.
  
  Systematically use ANSI C functions definitions.
  Correct type of the flags argument to the dev_pager_putpages() function.
  Use vm_pager_free_nonreq().
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/device_pager.c

Modified: head/sys/vm/device_pager.c
==
--- head/sys/vm/device_pager.c  Sun Nov 29 11:30:17 2015(r291445)
+++ head/sys/vm/device_pager.c  Sun Nov 29 11:37:25 2015(r291446)
@@ -60,10 +60,8 @@ static vm_object_t dev_pager_alloc(void 
 vm_ooffset_t, struct ucred *);
 static void dev_pager_dealloc(vm_object_t);
 static int dev_pager_getpages(vm_object_t, vm_page_t *, int, int);
-static void dev_pager_putpages(vm_object_t, vm_page_t *, int, 
-   boolean_t, int *);
-static boolean_t dev_pager_haspage(vm_object_t, vm_pindex_t, int *,
-   int *);
+static void dev_pager_putpages(vm_object_t, vm_page_t *, int, int, int *);
+static boolean_t dev_pager_haspage(vm_object_t, vm_pindex_t, int *, int *);
 static void dev_pager_free_page(vm_object_t object, vm_page_t m);
 
 /* list of device pager objects */
@@ -101,8 +99,9 @@ static struct cdev_pager_ops old_dev_pag
 };
 
 static void
-dev_pager_init()
+dev_pager_init(void)
 {
+
TAILQ_INIT(&dev_pager_object_list);
mtx_init(&dev_pager_mtx, "dev_pager list", NULL, MTX_DEF);
 }
@@ -233,8 +232,7 @@ dev_pager_free_page(vm_object_t object, 
 }
 
 static void
-dev_pager_dealloc(object)
-   vm_object_t object;
+dev_pager_dealloc(vm_object_t object)
 {
vm_page_t m;
 
@@ -261,7 +259,7 @@ dev_pager_dealloc(object)
 static int
 dev_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int reqpage)
 {
-   int error, i;
+   int error;
 
VM_OBJECT_ASSERT_WLOCKED(object);
error = object->un_pager.devp.ops->cdev_pg_fault(object,
@@ -269,13 +267,7 @@ dev_pager_getpages(vm_object_t object, v
 
VM_OBJECT_ASSERT_WLOCKED(object);
 
-   for (i = 0; i < count; i++) {
-   if (i != reqpage) {
-   vm_page_lock(ma[i]);
-   vm_page_free(ma[i]);
-   vm_page_unlock(ma[i]);
-   }
-   }
+   vm_pager_free_nonreq(object, ma, reqpage, count, TRUE);
 
if (error == VM_PAGER_OK) {
KASSERT((object->type == OBJT_DEVICE &&
@@ -362,24 +354,18 @@ old_dev_pager_fault(vm_object_t object, 
 }
 
 static void
-dev_pager_putpages(object, m, count, sync, rtvals)
-   vm_object_t object;
-   vm_page_t *m;
-   int count;
-   boolean_t sync;
-   int *rtvals;
+dev_pager_putpages(vm_object_t object, vm_page_t *m, int count, int flags,
+int *rtvals)
 {
 
panic("dev_pager_putpage called");
 }
 
 static boolean_t
-dev_pager_haspage(object, pindex, before, after)
-   vm_object_t object;
-   vm_pindex_t pindex;
-   int *before;
-   int *after;
+dev_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *before,
+int *after)
 {
+
if (before != NULL)
*before = 0;
if (after != NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291447 - head/usr.bin/rctl

2015-11-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 29 12:01:36 2015
New Revision: 291447
URL: https://svnweb.freebsd.org/changeset/base/291447

Log:
  Rewrite the rctl(8) utility to make it possible to add multiple rules
  in a single run.  This speeds up operation with large rulesets.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/rctl/rctl.8
  head/usr.bin/rctl/rctl.c

Modified: head/usr.bin/rctl/rctl.8
==
--- head/usr.bin/rctl/rctl.8Sun Nov 29 11:37:25 2015(r291446)
+++ head/usr.bin/rctl/rctl.8Sun Nov 29 12:01:36 2015(r291447)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 5, 2015
+.Dd November 29, 2015
 .Dt RCTL 8
 .Os
 .Sh NAME
@@ -35,22 +35,22 @@
 .Nm
 .Op Fl h
 .Op Fl n
-.Op Ar filter
+.Op Ar filter Ar ...
 .Nm
 .Fl a
-.Ar rule
+.Ar rule Ar ...
 .Nm
 .Fl l
 .Op Fl h
 .Op Fl n
-.Ar filter
+.Ar filter Ar ...
 .Nm
 .Fl r
-.Ar filter
+.Ar filter Ar ...
 .Nm
 .Fl u
 .Op Fl h
-.Ar filter
+.Ar filter Ar ...
 .Pp
 .Nm
 requires the kernel to be compiled with:

Modified: head/usr.bin/rctl/rctl.c
==
--- head/usr.bin/rctl/rctl.cSun Nov 29 11:37:25 2015(r291446)
+++ head/usr.bin/rctl/rctl.cSun Nov 29 12:01:36 2015(r291447)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,97 +51,60 @@ __FBSDID("$FreeBSD$");
 
 #defineRCTL_DEFAULT_BUFSIZE128 * 1024
 
-static id_t
-parse_user(const char *s)
+static int
+parse_user(const char *s, id_t *uidp)
 {
-   id_t id;
char *end;
struct passwd *pwd;
 
pwd = getpwnam(s);
-   if (pwd != NULL)
-   return (pwd->pw_uid);
+   if (pwd != NULL) {
+   *uidp = pwd->pw_uid;
+   return (0);
+   }
 
-   if (!isnumber(s[0]))
-   errx(1, "uknown user '%s'", s);
+   if (!isnumber(s[0])) {
+   warnx("uknown user '%s'", s);
+   return (1);
+   }
 
-   id = strtod(s, &end);
-   if ((size_t)(end - s) != strlen(s))
-   errx(1, "trailing characters after numerical id");
+   *uidp = strtod(s, &end);
+   if ((size_t)(end - s) != strlen(s)) {
+   warnx("trailing characters after numerical id");
+   return (1);
+   }
 
-   return (id);
+   return (0);
 }
 
-static id_t
-parse_group(const char *s)
+static int
+parse_group(const char *s, id_t *gidp)
 {
-   id_t id;
char *end;
struct group *grp;
 
grp = getgrnam(s);
-   if (grp != NULL)
-   return (grp->gr_gid);
-
-   if (!isnumber(s[0]))
-   errx(1, "uknown group '%s'", s);
-
-   id = strtod(s, &end);
-   if ((size_t)(end - s) != strlen(s))
-   errx(1, "trailing characters after numerical id");
-
-   return (id);
-}
-
-/*
- * This routine replaces user/group name with numeric id.
- */
-static char *
-resolve_ids(char *rule)
-{
-   id_t id;
-   const char *subject, *textid, *rest;
-   char *resolved;
-
-   subject = strsep(&rule, ":");
-   textid = strsep(&rule, ":");
-   if (textid == NULL)
-   errx(1, "error in rule specification -- no subject");
-   if (rule != NULL)
-   rest = rule;
-   else
-   rest = "";
-
-   if (strcasecmp(subject, "u") == 0)
-   subject = "user";
-   else if (strcasecmp(subject, "g") == 0)
-   subject = "group";
-   else if (strcasecmp(subject, "p") == 0)
-   subject = "process";
-   else if (strcasecmp(subject, "l") == 0 ||
-   strcasecmp(subject, "c") == 0 ||
-   strcasecmp(subject, "class") == 0)
-   subject = "loginclass";
-   else if (strcasecmp(subject, "j") == 0)
-   subject = "jail";
+   if (grp != NULL) {
+   *gidp = grp->gr_gid;
+   return (0);
+   }
 
-   if (strcasecmp(subject, "user") == 0 && strlen(textid) > 0) {
-   id = parse_user(textid);
-   asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
-   } else if (strcasecmp(subject, "group") == 0 && strlen(textid) > 0) {
-   id = parse_group(textid);
-   asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
-   } else
-   asprintf(&resolved, "%s:%s:%s", subject, textid, rest);
+   if (!isnumber(s[0])) {
+   warnx("uknown group '%s'", s);
+   return (1);
+   }
 
-   if (resolved == NULL)
-   err(1, "asprintf");
+   *gidp = strtod(s, &end);
+   if ((size_t)(end - s) != strlen(s)) {
+   warnx("trailing characters after numerical id");
+   return (1);
+   }
 
-   return (resolved);
+   return (0);
 }
 
 /*
- * This routine replace

svn commit: r291448 - head/usr.bin/rctl

2015-11-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 29 12:09:12 2015
New Revision: 291448
URL: https://svnweb.freebsd.org/changeset/base/291448

Log:
  Handle asprintf(3) errors in a standards-compliant way.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.bin/rctl/rctl.c
==
--- head/usr.bin/rctl/rctl.cSun Nov 29 12:01:36 2015(r291447)
+++ head/usr.bin/rctl/rctl.cSun Nov 29 12:09:12 2015(r291448)
@@ -112,6 +112,7 @@ expand_amount(char *rule)
uint64_t num;
const char *subject, *subject_id, *resource, *action, *amount, *per;
char *copy, *expanded;
+   int ret;
 
copy = strdup(rule);
if (copy == NULL) {
@@ -142,14 +143,15 @@ expand_amount(char *rule)
return (NULL);
}
 
-   if (per == NULL)
-   asprintf(&expanded, "%s:%s:%s:%s=%ju", subject, subject_id,
-   resource, action, (uintmax_t)num);
-   else
-   asprintf(&expanded, "%s:%s:%s:%s=%ju/%s", subject, subject_id,
-   resource, action, (uintmax_t)num, per);
+   if (per == NULL) {
+   ret = asprintf(&expanded, "%s:%s:%s:%s=%ju",
+   subject, subject_id, resource, action, (uintmax_t)num);
+   } else {
+   ret = asprintf(&expanded, "%s:%s:%s:%s=%ju/%s",
+   subject, subject_id, resource, action, (uintmax_t)num, per);
+   }
 
-   if (expanded == NULL) {
+   if (ret <= 0) {
warn("asprintf");
free(copy);
return (NULL);
@@ -165,7 +167,7 @@ expand_rule(char *rule, bool resolve_ids
id_t id;
const char *subject, *textid, *rest;
char *resolved;
-   int error;
+   int error, ret;
 
subject = strsep(&rule, ":");
textid = strsep(&rule, ":");
@@ -196,18 +198,18 @@ expand_rule(char *rule, bool resolve_ids
error = parse_user(textid, &id);
if (error != 0)
return (NULL);
-   asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
+   ret = asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
} else if (resolve_ids &&
strcasecmp(subject, "group") == 0 && strlen(textid) > 0) {
error = parse_group(textid, &id);
if (error != 0)
return (NULL);
-   asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
+   ret = asprintf(&resolved, "%s:%d:%s", subject, (int)id, rest);
} else {
-   asprintf(&resolved, "%s:%s:%s", subject, textid, rest);
+   ret = asprintf(&resolved, "%s:%s:%s", subject, textid, rest);
}
 
-   if (resolved == NULL) {
+   if (ret <= 0) {
warn("asprintf");
return (NULL);
}
@@ -223,6 +225,7 @@ humanize_ids(char *rule)
struct group *grp;
const char *subject, *textid, *rest;
char *end, *humanized;
+   int ret;
 
subject = strsep(&rule, ":");
textid = strsep(&rule, ":");
@@ -250,9 +253,8 @@ humanize_ids(char *rule)
textid = grp->gr_name;
}
 
-   asprintf(&humanized, "%s:%s:%s", subject, textid, rest);
-
-   if (humanized == NULL)
+   ret = asprintf(&humanized, "%s:%s:%s", subject, textid, rest);
+   if (ret <= 0)
err(1, "asprintf");
 
return (humanized);
@@ -279,6 +281,7 @@ humanize_amount(char *rule)
int64_t num;
const char *subject, *subject_id, *resource, *action, *amount, *per;
char *copy, *humanized, buf[6];
+   int ret;
 
copy = strdup(rule);
if (copy == NULL)
@@ -306,14 +309,15 @@ humanize_amount(char *rule)
HN_DECIMAL | HN_NOSPACE) == -1)
err(1, "humanize_number");
 
-   if (per == NULL)
-   asprintf(&humanized, "%s:%s:%s:%s=%s", subject, subject_id,
-   resource, action, buf);
-   else
-   asprintf(&humanized, "%s:%s:%s:%s=%s/%s", subject, subject_id,
-   resource, action, buf, per);
+   if (per == NULL) {
+   ret = asprintf(&humanized, "%s:%s:%s:%s=%s",
+   subject, subject_id, resource, action, buf);
+   } else {
+   ret = asprintf(&humanized, "%s:%s:%s:%s=%s/%s",
+   subject, subject_id, resource, action, buf, per);
+   }
 
-   if (humanized == NULL)
+   if (ret <= 0)
err(1, "asprintf");
 
return (humanized);
@@ -423,6 +427,7 @@ humanize_usage_amount(char *usage)
int64_t num;
const char *resource, *amount;
char *copy, *humanized, buf[6];
+   int ret;
 
copy = strdup(usage);
if (copy == NULL)
@@ -441,8 +446,8 @@ humanize_usage_amount(char *usage)

svn commit: r291449 - head/usr.bin/rctl

2015-11-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 29 12:21:02 2015
New Revision: 291449
URL: https://svnweb.freebsd.org/changeset/base/291449

Log:
  Fix some memory management problems.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.bin/rctl/rctl.c
==
--- head/usr.bin/rctl/rctl.cSun Nov 29 12:09:12 2015(r291448)
+++ head/usr.bin/rctl/rctl.cSun Nov 29 12:21:02 2015(r291449)
@@ -111,10 +111,10 @@ expand_amount(char *rule)
 {
uint64_t num;
const char *subject, *subject_id, *resource, *action, *amount, *per;
-   char *copy, *expanded;
+   char *copy, *expanded, *tofree;
int ret;
 
-   copy = strdup(rule);
+   tofree = copy = strdup(rule);
if (copy == NULL) {
warn("strdup");
return (NULL);
@@ -128,7 +128,7 @@ expand_amount(char *rule)
per = copy;
 
if (amount == NULL || strlen(amount) == 0) {
-   free(copy);
+   free(tofree);
return (rule);
}
 
@@ -139,7 +139,7 @@ expand_amount(char *rule)
 
if (expand_number(amount, &num)) {
warnx("invalid numeric value '%s'", amount);
-   free(copy);
+   free(tofree);
return (NULL);
}
 
@@ -153,10 +153,11 @@ expand_amount(char *rule)
 
if (ret <= 0) {
warn("asprintf");
-   free(copy);
+   free(tofree);
return (NULL);
}
 
+   free(tofree);
return (expanded);
 }
 
@@ -280,10 +281,10 @@ humanize_amount(char *rule)
 {
int64_t num;
const char *subject, *subject_id, *resource, *action, *amount, *per;
-   char *copy, *humanized, buf[6];
+   char *copy, *humanized, buf[6], *tofree;
int ret;
 
-   copy = strdup(rule);
+   tofree = copy = strdup(rule);
if (copy == NULL)
err(1, "strdup");
 
@@ -296,7 +297,7 @@ humanize_amount(char *rule)
 
if (amount == NULL || strlen(amount) == 0 ||
str2int64(amount, &num) != 0) {
-   free(copy);
+   free(tofree);
return (rule);
}
 
@@ -320,6 +321,7 @@ humanize_amount(char *rule)
if (ret <= 0)
err(1, "asprintf");
 
+   free(tofree);
return (humanized);
 }
 
@@ -426,10 +428,10 @@ humanize_usage_amount(char *usage)
 {
int64_t num;
const char *resource, *amount;
-   char *copy, *humanized, buf[6];
+   char *copy, *humanized, buf[6], *tofree;
int ret;
 
-   copy = strdup(usage);
+   tofree = copy = strdup(usage);
if (copy == NULL)
err(1, "strdup");
 
@@ -442,7 +444,7 @@ humanize_usage_amount(char *usage)
if (str2int64(amount, &num) != 0 || 
humanize_number(buf, sizeof(buf), num, "", HN_AUTOSCALE,
HN_DECIMAL | HN_NOSPACE) == -1) {
-   free(copy);
+   free(tofree);
return (usage);
}
 
@@ -450,6 +452,7 @@ humanize_usage_amount(char *usage)
if (ret <= 0)
err(1, "asprintf");
 
+   free(tofree);
return (humanized);
 }
 
@@ -460,7 +463,7 @@ static int
 show_usage(const char *filter, int hflag)
 {
int error;
-   char *outbuf = NULL, *tmp;
+   char *copy, *outbuf = NULL, *tmp;
size_t outbuflen = RCTL_DEFAULT_BUFSIZE / 4;
 
do {
@@ -478,7 +481,8 @@ show_usage(const char *filter, int hflag
}
} while (error && errno == ERANGE);
 
-   while ((tmp = strsep(&outbuf, ",")) != NULL) {
+   copy = outbuf;
+   while ((tmp = strsep(©, ",")) != NULL) {
if (tmp[0] == '\0')
break; /* XXX */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291450 - head/sys/modules/uart

2015-11-29 Thread Ulrich Spoerlein
Author: uqs
Date: Sun Nov 29 12:23:08 2015
New Revision: 291450
URL: https://svnweb.freebsd.org/changeset/base/291450

Log:
  Fix make depend

Modified:
  head/sys/modules/uart/Makefile

Modified: head/sys/modules/uart/Makefile
==
--- head/sys/modules/uart/Makefile  Sun Nov 29 12:21:02 2015
(r291449)
+++ head/sys/modules/uart/Makefile  Sun Nov 29 12:23:08 2015
(r291450)
@@ -34,6 +34,6 @@ SRCS= uart_bus_acpi.c ${uart_bus_ebus} u
 
 SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \
power_if.h pccarddevs.h serdev_if.h
-SRCS+= opt_platform.h
+SRCS+= opt_platform.h opt_uart.h
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291451 - head/usr.bin/rctl

2015-11-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 29 12:33:56 2015
New Revision: 291451
URL: https://svnweb.freebsd.org/changeset/base/291451

Log:
  Simplify rule retrieval and improve error handling.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.bin/rctl/rctl.c
==
--- head/usr.bin/rctl/rctl.cSun Nov 29 12:23:08 2015(r291450)
+++ head/usr.bin/rctl/rctl.cSun Nov 29 12:33:56 2015(r291451)
@@ -387,20 +387,24 @@ show_limits(const char *filter, int hfla
char *outbuf = NULL;
size_t outbuflen = RCTL_DEFAULT_BUFSIZE / 4;
 
-   do {
+   for (;;) {
outbuflen *= 4;
outbuf = realloc(outbuf, outbuflen);
if (outbuf == NULL)
err(1, "realloc");
+   error = rctl_get_limits(filter, strlen(filter) + 1,
+   outbuf, outbuflen);
+   if (error == 0)
+   break;
+   if (errno == ERANGE)
+   continue;
+   if (errno == ENOSYS)
+   enosys();
+   warn("rctl_get_limits");
+   free(outbuf);
 
-   error = rctl_get_limits(filter, strlen(filter) + 1, outbuf,
-   outbuflen);
-   if (error && errno != ERANGE) {
-   if (errno == ENOSYS)
-   enosys();
-   warn("rctl_get_limits");
-   }
-   } while (error && errno == ERANGE);
+   return (error);
+   }
 
print_rules(outbuf, hflag, nflag);
free(outbuf);
@@ -466,20 +470,24 @@ show_usage(const char *filter, int hflag
char *copy, *outbuf = NULL, *tmp;
size_t outbuflen = RCTL_DEFAULT_BUFSIZE / 4;
 
-   do {
+   for (;;) {
outbuflen *= 4;
outbuf = realloc(outbuf, outbuflen);
if (outbuf == NULL)
err(1, "realloc");
+   error = rctl_get_racct(filter, strlen(filter) + 1,
+   outbuf, outbuflen);
+   if (error == 0)
+   break;
+   if (errno == ERANGE)
+   continue;
+   if (errno == ENOSYS)
+   enosys();
+   warn("rctl_get_racct");
+   free(outbuf);
 
-   error = rctl_get_racct(filter, strlen(filter) + 1, outbuf,
-   outbuflen);
-   if (error && errno != ERANGE) {
-   if (errno == ENOSYS)
-   enosys();
-   warn("rctl_get_racct");
-   }
-   } while (error && errno == ERANGE);
+   return (error);
+   }
 
copy = outbuf;
while ((tmp = strsep(©, ",")) != NULL) {
@@ -512,19 +520,23 @@ show_rules(const char *filter, int hflag
else
filterlen = 0;
 
-   do {
+   for (;;) {
outbuflen *= 4;
outbuf = realloc(outbuf, outbuflen);
if (outbuf == NULL)
err(1, "realloc");
-
error = rctl_get_rules(filter, filterlen, outbuf, outbuflen);
-   if (error && errno != ERANGE) {
-   if (errno == ENOSYS)
-   enosys();
-   warn("rctl_get_rules");
-   }
-   } while (error && errno == ERANGE);
+   if (error == 0)
+   break;
+   if (errno == ERANGE)
+   continue;
+   if (errno == ENOSYS)
+   enosys();
+   warn("rctl_get_rules");
+   free(outbuf);
+
+   return (error);
+   }
 
print_rules(outbuf, hflag, nflag);
free(outbuf);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291452 - head/usr.bin/rctl

2015-11-29 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 29 13:14:45 2015
New Revision: 291452
URL: https://svnweb.freebsd.org/changeset/base/291452

Log:
  Improve error reporting to clearly show problematic rules.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.bin/rctl/rctl.c
==
--- head/usr.bin/rctl/rctl.cSun Nov 29 12:33:56 2015(r291451)
+++ head/usr.bin/rctl/rctl.cSun Nov 29 13:14:45 2015(r291452)
@@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$");
 #defineRCTL_DEFAULT_BUFSIZE128 * 1024
 
 static int
-parse_user(const char *s, id_t *uidp)
+parse_user(const char *s, id_t *uidp, const char *unexpanded_rule)
 {
char *end;
struct passwd *pwd;
@@ -64,13 +64,15 @@ parse_user(const char *s, id_t *uidp)
}
 
if (!isnumber(s[0])) {
-   warnx("uknown user '%s'", s);
+   warnx("malformed rule '%s': uknown user '%s'",
+   unexpanded_rule, s);
return (1);
}
 
*uidp = strtod(s, &end);
if ((size_t)(end - s) != strlen(s)) {
-   warnx("trailing characters after numerical id");
+   warnx("malformed rule '%s': trailing characters "
+   "after numerical id", unexpanded_rule);
return (1);
}
 
@@ -78,7 +80,7 @@ parse_user(const char *s, id_t *uidp)
 }
 
 static int
-parse_group(const char *s, id_t *gidp)
+parse_group(const char *s, id_t *gidp, const char *unexpanded_rule)
 {
char *end;
struct group *grp;
@@ -90,13 +92,15 @@ parse_group(const char *s, id_t *gidp)
}
 
if (!isnumber(s[0])) {
-   warnx("uknown group '%s'", s);
+   warnx("malformed rule '%s': uknown group '%s'",
+   unexpanded_rule, s);
return (1);
}
 
*gidp = strtod(s, &end);
if ((size_t)(end - s) != strlen(s)) {
-   warnx("trailing characters after numerical id");
+   warnx("malformed rule '%s': trailing characters "
+   "after numerical id", unexpanded_rule);
return (1);
}
 
@@ -107,30 +111,22 @@ parse_group(const char *s, id_t *gidp)
  * Replace human-readable number with its expanded form.
  */
 static char *
-expand_amount(char *rule)
+expand_amount(char *rule, const char *unexpanded_rule)
 {
uint64_t num;
const char *subject, *subject_id, *resource, *action, *amount, *per;
-   char *copy, *expanded, *tofree;
+   char *expanded;
int ret;
 
-   tofree = copy = strdup(rule);
-   if (copy == NULL) {
-   warn("strdup");
-   return (NULL);
-   }
-
-   subject = strsep(©, ":");
-   subject_id = strsep(©, ":");
-   resource = strsep(©, ":");
-   action = strsep(©, "=/");
-   amount = strsep(©, "/");
-   per = copy;
+   subject = strsep(&rule, ":");
+   subject_id = strsep(&rule, ":");
+   resource = strsep(&rule, ":");
+   action = strsep(&rule, "=/");
+   amount = strsep(&rule, "/");
+   per = rule;
 
-   if (amount == NULL || strlen(amount) == 0) {
-   free(tofree);
+   if (amount == NULL || strlen(amount) == 0)
return (rule);
-   }
 
assert(subject != NULL);
assert(subject_id != NULL);
@@ -138,8 +134,8 @@ expand_amount(char *rule)
assert(action != NULL);
 
if (expand_number(amount, &num)) {
-   warnx("invalid numeric value '%s'", amount);
-   free(tofree);
+   warnx("malformed rule '%s': invalid numeric value '%s'",
+   unexpanded_rule, amount);
return (NULL);
}
 
@@ -153,31 +149,34 @@ expand_amount(char *rule)
 
if (ret <= 0) {
warn("asprintf");
-   free(tofree);
return (NULL);
}
 
-   free(tofree);
return (expanded);
 }
 
-
 static char *
-expand_rule(char *rule, bool resolve_ids)
+expand_rule(const char *rule, bool resolve_ids)
 {
id_t id;
const char *subject, *textid, *rest;
-   char *resolved;
+   char *copy, *expanded, *resolved, *tofree;
int error, ret;
 
-   subject = strsep(&rule, ":");
-   textid = strsep(&rule, ":");
+   tofree = copy = strdup(rule);
+   if (copy == NULL) {
+   warn("strdup");
+   return (NULL);
+   }
+
+   subject = strsep(©, ":");
+   textid = strsep(©, ":");
if (textid == NULL) {
-   warnx("error in rule specification -- no subject");
+   warnx("malformed rule '%s': missing subject", rule);
return (NULL);
}
-   if (rule != NULL)
-   rest = rule;
+   if (copy != NULL)
+   rest = copy;
else
rest = "";
 
@@ -196,15 +195

svn commit: r291453 - head/lib/libfetch

2015-11-29 Thread Dag-Erling Smørgrav
Author: des
Date: Sun Nov 29 14:26:59 2015
New Revision: 291453
URL: https://svnweb.freebsd.org/changeset/base/291453

Log:
  Use .netrc for HTTP sites and proxies, not just FTP.
  
  PR:   193740
  Submitted by: TEUBEL György 
  MFC after:1 week

Modified:
  head/lib/libfetch/fetch.3
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/fetch.3
==
--- head/lib/libfetch/fetch.3   Sun Nov 29 13:14:45 2015(r291452)
+++ head/lib/libfetch/fetch.3   Sun Nov 29 14:26:59 2015(r291453)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 25, 2015
+.Dd November 29, 2015
 .Dt FETCH 3
 .Os
 .Sh NAME
@@ -631,11 +631,11 @@ If defined but empty, no User-Agent head
 .It Ev NETRC
 Specifies a file to use instead of
 .Pa ~/.netrc
-to look up login names and passwords for FTP sites.
+to look up login names and passwords for FTP and HTTP sites as well as
+HTTP proxies.
 See
 .Xr ftp 1
 for a description of the file format.
-This feature is experimental.
 .It Ev NO_PROXY
 Either a single asterisk, which disables the use of proxies
 altogether, or a comma- or whitespace-separated list of hosts for

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cSun Nov 29 13:14:45 2015(r291452)
+++ head/lib/libfetch/http.cSun Nov 29 14:26:59 2015(r291453)
@@ -1658,6 +1658,9 @@ http_request_body(struct url *URL, const
http_seterr(HTTP_NEED_PROXY_AUTH);
goto ouch;
}
+   } else if (fetch_netrc_auth(purl) == 0) {
+   aparams.user = strdup(purl->user);
+   aparams.password = strdup(purl->pwd);
}
http_authorize(conn, "Proxy-Authorization",
   &proxy_challenges, &aparams, url);
@@ -1685,6 +1688,11 @@ http_request_body(struct url *URL, const
http_seterr(HTTP_NEED_AUTH);
goto ouch;
}
+   } else if (fetch_netrc_auth(url) == 0) {
+   aparams.user = url->user ?
+   strdup(url->user) : strdup("");
+   aparams.password = url->pwd ?
+   strdup(url->pwd) : strdup("");
} else if (fetchAuthMethod &&
   fetchAuthMethod(url) == 0) {
aparams.user = strdup(url->user);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r291454 - stable/10/sys/vm

2015-11-29 Thread Konstantin Belousov
Author: kib
Date: Sun Nov 29 14:44:40 2015
New Revision: 291454
URL: https://svnweb.freebsd.org/changeset/base/291454

Log:
  MFC r289895:
  Reduce the amount of calls to VOP_BMAP() made from the local vnode
  pager.
  
  MFC r291157, r291158:
  Include the pages before/after the requested page, that fit into the
  reqblock, into the calculation of the size of run of pages.
  
  Tested by:pho

Modified:
  stable/10/sys/vm/vnode_pager.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/vm/vnode_pager.c
==
--- stable/10/sys/vm/vnode_pager.c  Sun Nov 29 14:26:59 2015
(r291453)
+++ stable/10/sys/vm/vnode_pager.c  Sun Nov 29 14:44:40 2015
(r291454)
@@ -696,26 +696,22 @@ vnode_pager_generic_getpages(vp, m, byte
int reqpage;
 {
vm_object_t object;
-   vm_offset_t kva;
-   off_t foff, tfoff, nextoff;
-   int i, j, size, bsize, first;
-   daddr_t firstaddr, reqblock;
struct bufobj *bo;
-   int runpg;
-   int runend;
struct buf *bp;
struct mount *mp;
-   int count;
-   int error;
-
-   object = vp->v_object;
-   count = bytecount / PAGE_SIZE;
+   vm_offset_t kva;
+   daddr_t firstaddr, reqblock;
+   off_t foff, nextoff, tfoff, pib;
+   int pbefore, pafter, i, size, bsize, first, last;
+   int count, error, before, after, secmask;
 
KASSERT(vp->v_type != VCHR && vp->v_type != VBLK,
("vnode_pager_generic_getpages does not support devices"));
if (vp->v_iflag & VI_DOOMED)
-   return VM_PAGER_BAD;
+   return (VM_PAGER_BAD);
 
+   object = vp->v_object;
+   count = bytecount / PAGE_SIZE;
bsize = vp->v_mount->mnt_stat.f_iosize;
 
/* get the UNDERLYING device for the file with VOP_BMAP() */
@@ -729,7 +725,8 @@ vnode_pager_generic_getpages(vp, m, byte
/*
 * if we can't bmap, use old VOP code
 */
-   error = VOP_BMAP(vp, foff / bsize, &bo, &reqblock, NULL, NULL);
+   error = VOP_BMAP(vp, IDX_TO_OFF(m[reqpage]->pindex) / bsize, &bo,
+   &reqblock, &after, &before);
if (error == EOPNOTSUPP) {
VM_OBJECT_WLOCK(object);

@@ -772,7 +769,7 @@ vnode_pager_generic_getpages(vp, m, byte
VM_OBJECT_WUNLOCK(object);
PCPU_INC(cnt.v_vnodein);
PCPU_INC(cnt.v_vnodepgsin);
-   return vnode_pager_input_smlfs(object, m[reqpage]);
+   return (vnode_pager_input_smlfs(object, m[reqpage]));
}
 
/*
@@ -807,79 +804,40 @@ vnode_pager_generic_getpages(vp, m, byte
m[reqpage]->valid = 0;
VM_OBJECT_WUNLOCK(object);
 
-   /*
-* here on direct device I/O
-*/
-   firstaddr = -1;
-
-   /*
-* calculate the run that includes the required page
-*/
-   for (first = 0, i = 0; i < count; i = runend) {
-   if (vnode_pager_addr(vp, IDX_TO_OFF(m[i]->pindex), &firstaddr,
-   &runpg) != 0) {
-   VM_OBJECT_WLOCK(object);
-   for (; i < count; i++)
-   if (i != reqpage) {
-   vm_page_lock(m[i]);
-   vm_page_free(m[i]);
-   vm_page_unlock(m[i]);
-   }
-   VM_OBJECT_WUNLOCK(object);
-   return (VM_PAGER_ERROR);
-   }
-   if (firstaddr == -1) {
-   VM_OBJECT_WLOCK(object);
-   if (i == reqpage && foff < 
object->un_pager.vnp.vnp_size) {
-   panic("vnode_pager_getpages: unexpected missing 
page: firstaddr: %jd, foff: 0x%jx%08jx, vnp_size: 0x%jx%08jx",
-   (intmax_t)firstaddr, (uintmax_t)(foff >> 
32),
-   (uintmax_t)foff,
-   (uintmax_t)
-   (object->un_pager.vnp.vnp_size >> 32),
-   (uintmax_t)object->un_pager.vnp.vnp_size);
-   }
+   pib = IDX_TO_OFF(m[reqpage]->pindex) % bsize;
+   pbefore = ((daddr_t)before * bsize + pib) / PAGE_SIZE;
+   pafter = ((daddr_t)(after + 1) * bsize - pib) / PAGE_SIZE - 1;
+   first = reqpage < pbefore ? 0 : reqpage - pbefore;
+   last = reqpage + pafter >= count ? count - 1 : reqpage + pafter;
+   if (first > 0 || last + 1 < count) {
+   VM_OBJECT_WLOCK(object);
+   for (i = 0; i < first; i++) {
vm_page_lock(m[i]);
vm_page_free(m[i]);
vm_page_unlock(m[i]);
-   VM_OBJECT_WUNLOCK(object);
-   runend = i + 1;
-  

svn commit: r291455 - in head: etc/mtree lib/libclang_rt lib/libclang_rt/include tools/build/mk

2015-11-29 Thread Dimitry Andric
Author: dim
Date: Sun Nov 29 16:28:40 2015
New Revision: 291455
URL: https://svnweb.freebsd.org/changeset/base/291455

Log:
  Install the public sanitizer headers.  These are useful for programs
  that want to directly interface with sanitizer internals.

Added:
  head/lib/libclang_rt/include/
  head/lib/libclang_rt/include/Makefile   (contents, props changed)
Modified:
  head/etc/mtree/BSD.usr.dist
  head/lib/libclang_rt/Makefile
  head/lib/libclang_rt/Makefile.inc
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Sun Nov 29 14:44:40 2015(r291454)
+++ head/etc/mtree/BSD.usr.dist Sun Nov 29 16:28:40 2015(r291455)
@@ -21,6 +21,8 @@
 clang
 3.7.0
 include
+   sanitizer
+   ..
 ..
 lib
 freebsd

Modified: head/lib/libclang_rt/Makefile
==
--- head/lib/libclang_rt/Makefile   Sun Nov 29 14:44:40 2015
(r291454)
+++ head/lib/libclang_rt/Makefile   Sun Nov 29 16:28:40 2015
(r291455)
@@ -3,7 +3,8 @@
 .include 
 
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-SUBDIR+= asan\
+SUBDIR+= include\
+asan\
 asan-preinit\
 asan_cxx\
 safestack\

Modified: head/lib/libclang_rt/Makefile.inc
==
--- head/lib/libclang_rt/Makefile.inc   Sun Nov 29 14:44:40 2015
(r291454)
+++ head/lib/libclang_rt/Makefile.inc   Sun Nov 29 16:28:40 2015
(r291455)
@@ -5,7 +5,8 @@
 CRTARCH=${MACHINE_CPUARCH:C/amd64/x86_64/}
 CRTSRC=${.CURDIR}/../../../contrib/compiler-rt
 
-LIBDIR=/usr/lib/clang/3.7.0/lib/freebsd
+CLANGDIR=/usr/lib/clang/3.7.0
+LIBDIR=${CLANGDIR}/lib/freebsd
 
 NO_PIC=
 MK_PROFILE=no

Added: head/lib/libclang_rt/include/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libclang_rt/include/Makefile   Sun Nov 29 16:28:40 2015
(r291455)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+.include 
+
+.PATH: ${CRTSRC}/include/sanitizer
+
+INCSDIR=${CLANGDIR}/include/sanitizer
+
+INCS=  allocator_interface.h\
+   asan_interface.h\
+   common_interface_defs.h\
+   coverage_interface.h\
+   dfsan_interface.h\
+   linux_syscall_hooks.h\
+   lsan_interface.h\
+   msan_interface.h\
+   tsan_interface_atomic.h
+
+.include 

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Nov 29 14:44:40 
2015(r291454)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Nov 29 16:28:40 
2015(r291455)
@@ -1048,6 +1048,16 @@ OLD_FILES+=usr/bin/clang++
 OLD_FILES+=usr/bin/clang-cpp
 OLD_FILES+=usr/bin/clang-tblgen
 OLD_FILES+=usr/bin/tblgen
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/allocator_interface.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/asan_interface.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/common_interface_defs.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/coverage_interface.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/dfsan_interface.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/linux_syscall_hooks.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/lsan_interface.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/msan_interface.h
+OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/tsan_interface_atomic.h
+OLD_DIRS+=usr/lib/clang/3.7.0/include/sanitizer
 OLD_FILES+=usr/lib/clang/3.7.0/include/__stddef_max_align_t.h
 OLD_FILES+=usr/lib/clang/3.7.0/include/__wmmintrin_aes.h
 OLD_FILES+=usr/lib/clang/3.7.0/include/__wmmintrin_pclmul.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291456 - stable/10/sys/dev/ata/chipsets

2015-11-29 Thread Alexander Motin
Author: mav
Date: Sun Nov 29 17:14:05 2015
New Revision: 291456
URL: https://svnweb.freebsd.org/changeset/base/291456

Log:
  MFC r290855: Increase reset assertion time from 10 to 100us.
  
  On my own tests I see no effect from this change, but I also can't
  reproduce the reported problem in general.
  
  PR:   127391
  PR:   204554
  Submitted by: s...@iranger.com

Modified:
  stable/10/sys/dev/ata/chipsets/ata-intel.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ata/chipsets/ata-intel.c
==
--- stable/10/sys/dev/ata/chipsets/ata-intel.c  Sun Nov 29 16:28:40 2015
(r291455)
+++ stable/10/sys/dev/ata/chipsets/ata-intel.c  Sun Nov 29 17:14:05 2015
(r291456)
@@ -422,7 +422,7 @@ ata_intel_reset(device_t dev)
mask |= (1 << smap[1]);
pci_write_config(parent, 0x92,
pci_read_config(parent, 0x92, 2) & ~mask, 2);
-   DELAY(10);
+   DELAY(100);
pci_write_config(parent, 0x92,
pci_read_config(parent, 0x92, 2) | mask, 2);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291457 - stable/9/sys/dev/ata/chipsets

2015-11-29 Thread Alexander Motin
Author: mav
Date: Sun Nov 29 17:14:46 2015
New Revision: 291457
URL: https://svnweb.freebsd.org/changeset/base/291457

Log:
  MFC r290855: Increase reset assertion time from 10 to 100us.
  
  On my own tests I see no effect from this change, but I also can't
  reproduce the reported problem in general.
  
  PR: 127391
  PR: 204554
  Submitted by:   s...@iranger.com

Modified:
  stable/9/sys/dev/ata/chipsets/ata-intel.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/ata/chipsets/ata-intel.c
==
--- stable/9/sys/dev/ata/chipsets/ata-intel.c   Sun Nov 29 17:14:05 2015
(r291456)
+++ stable/9/sys/dev/ata/chipsets/ata-intel.c   Sun Nov 29 17:14:46 2015
(r291457)
@@ -494,7 +494,7 @@ ata_intel_reset(device_t dev)
mask |= (1 << smap[1]);
pci_write_config(parent, 0x92,
pci_read_config(parent, 0x92, 2) & ~mask, 2);
-   DELAY(10);
+   DELAY(100);
pci_write_config(parent, 0x92,
pci_read_config(parent, 0x92, 2) | mask, 2);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r291453 - head/lib/libfetch

2015-11-29 Thread Jason Unovitch
On Sun, Nov 29, 2015 at 9:27 AM, Dag-Erling Smørgrav  wrote:
> Author: des
> Date: Sun Nov 29 14:26:59 2015
> New Revision: 291453
> URL: https://svnweb.freebsd.org/changeset/base/291453
>
> Log:
>   Use .netrc for HTTP sites and proxies, not just FTP.
>
>   PR:   193740
>   Submitted by: TEUBEL György 
>   MFC after:1 week
>
> Modified:
>   head/lib/libfetch/fetch.3
>   head/lib/libfetch/http.c

> Modified: head/lib/libfetch/http.c
> ==
> --- head/lib/libfetch/http.cSun Nov 29 13:14:45 2015(r291452)
> +++ head/lib/libfetch/http.cSun Nov 29 14:26:59 2015(r291453)
> @@ -1658,6 +1658,9 @@ http_request_body(struct url *URL, const
> http_seterr(HTTP_NEED_PROXY_AUTH);
> goto ouch;
> }
> +   } else if (fetch_netrc_auth(purl) == 0) {
> +   aparams.user = strdup(purl->user);
> +   aparams.password = strdup(purl->pwd);
> }
> http_authorize(conn, "Proxy-Authorization",
>&proxy_challenges, &aparams, url);
> @@ -1685,6 +1688,11 @@ http_request_body(struct url *URL, const
> http_seterr(HTTP_NEED_AUTH);
> goto ouch;
> }
> +   } else if (fetch_netrc_auth(url) == 0) {
> +   aparams.user = url->user ?
> +   strdup(url->user) : strdup("");
> +   aparams.password = url->pwd ?
> +   strdup(url->pwd) : strdup("");
> } else if (fetchAuthMethod &&
>fetchAuthMethod(url) == 0) {
> aparams.user = strdup(url->user);
> ___

`make buildworld` fails after this commit:

/usr/src/head/lib/libfetch/http.c:1692:25: error: address of array
'url->user' will always evaluate to 'true' [-Werro
r,-Wpointer-bool-conversion]
aparams.user = url->user ?
   ~^~~~ ~
/usr/src/head/lib/libfetch/http.c:1694:29: error: address of array
'url->pwd' will always evaluate to 'true' [-Werror
,-Wpointer-bool-conversion]
aparams.password = url->pwd ?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r291458 - head/sys/contrib/dev/ath/ath_hal/ar9300

2015-11-29 Thread Adrian Chadd
Author: adrian
Date: Sun Nov 29 18:14:18 2015
New Revision: 291458
URL: https://svnweb.freebsd.org/changeset/base/291458

Log:
  add missing initvals.
  
  Sorry y'all.

Added:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar953x.ini

Added: head/sys/contrib/dev/ath/ath_hal/ar9300/ar953x.ini
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar953x.ini  Sun Nov 29 18:14:18 
2015(r291458)
@@ -0,0 +1,1420 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+
+#define INI_VERSION_AR953X "$Id$"
+static const u_int32_t qca953xCommon_wo_xlna_rx_gain_bounds_honeybee_1p0[][5] 
= {
+/*Addr5G_HT20 5G_HT40 2G_HT40 2G_HT20  
   */
+  { 0x9e44, 0xfe321e27, 0xfe321e27, 0xfe291e27, 0xfe291e27 },
+  { 0x9e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012 },
+};
+
+static const u_int32_t qca953x_honeybee_1p0_mac_postamble_emulation[][5] = {
+/*Addr5G_HT20 5G_HT40 2G_HT40 2G_HT20  
   */
+  { 0x8014, 0x10f810f8, 0x10f810f8, 0x10f810f8, 0x10f810f8 },
+  { 0x801c, 0x0e8d8017, 0x0e8d8017, 0x0e8d8017, 0x0e8d8017 },
+};
+
+static const u_int32_t 
qca953x_honeybee_1p0_tx_gain_table_baseband_postamble_emulation[][5] = {
+/*Addr5G_HT20 5G_HT40 2G_HT40 2G_HT20  
   */
+  { 0xa410, 0x00d5, 0x00d5, 0x00d5, 0x00d5 },
+  { 0xa500, 0x, 0x, 0x, 0x },
+  { 0xa504, 0x4002, 0x4002, 0x4002, 0x4002 },
+  { 0xa508, 0x8004, 0x8004, 0x8004, 0x8004 },
+  { 0xa510, 0x0001000c, 0x0001000c, 0x0001000c, 0x0001000c },
+  { 0xa514, 0x0001420b, 0x0001420b, 0x0001420b, 0x0001420b },
+  { 0xa518, 0x0001824a, 0x0001824a, 0x0001824a, 0x0001824a },
+  { 0xa51c, 0x0001c44a, 0x0001c44a, 0x0001c44a, 0x0001c44a },
+  { 0xa520, 0x0002064a, 0x0002064a, 0x0002064a, 0x0002064a },
+  { 0xa524, 0x0002484a, 0x0002484a, 0x0002484a, 0x0002484a },
+  { 0xa528, 0x00028a4a, 0x00028a4a, 0x00028a4a, 0x00028a4a },
+  { 0xa52c, 0x00030e4a, 0x00030e4a, 0x00030e4a, 0x00030e4a },
+  { 0xa530, 0x00030e4a, 0x00030e4a, 0x00030e4a, 0x00030e4a },
+  { 0xa534, 0x00034e8a, 0x00034e8a, 0x00034e8a, 0x00034e8a },
+};
+
+static const u_int32_t qca953xModes_no_xpa_tx_gain_table_honeybee_1p1[][2] = {
+/*Addrallmodes*/
+  { 0xa2dc, 0xffd5f552 },
+  { 0xa2e0, 0xffe60664 },
+  { 0xa2e4, 0xfff80780 },
+  { 0xa2e8, 0xf800 },
+  { 0xa410, 0x50de },
+  { 0xa500, 0x0061 },
+  { 0xa504, 0x0463 },
+  { 0xa508, 0x0865 },
+  { 0xa50c, 0x0c000261 },
+  { 0xa510, 0x1263 },
+  { 0xa514, 0x14000265 },
+  { 0xa518, 0x18000482 },
+  { 0xa51c, 0x1b000484 },
+  { 0xa520, 0x1f000486 },
+  { 0xa524, 0x240008c2 },
+  { 0xa528, 0x28000cc1 },
+  { 0xa52c, 0x2d000ce3 },
+  { 0xa530, 0x31000ce5 },
+  { 0xa534, 0x350010e5 },
+  { 0xa538, 0x360012e5 },
+  { 0xa53c, 0x380014e5 },
+  { 0xa540, 0x3b0018e5 },
+  { 0xa544, 0x3d001d04 },
+  { 0xa548, 0x3e001d05 },
+  { 0xa54c, 0x40001d07 },
+  { 0xa550, 0x42001f27 },
+  { 0xa554, 0x43001f67 },
+  { 0xa558, 0x46001fe7 },
+  { 0xa55c, 0x47001f2b },
+  { 0xa560, 0x49001f0d },
+  { 0xa564, 0x4b001ed2 },
+  { 0xa568, 0x4c001ed4 },
+  { 0xa56c, 0x4e001f15 },
+  { 0xa570, 0x4f001ff6 },
+  { 0xa574, 0x4f001ff6 },
+  { 0xa578, 0x4f001ff6 },
+  { 0xa57c, 0x4f001ff6 },
+  { 0xa600, 0x },
+  { 0xa604, 0x },
+  { 0xa608, 0x },
+  { 0xa60c, 0x00804201 },
+  { 0xa610, 0x01008201 },
+  { 0xa614, 0x0180c402 },
+  { 0xa618, 0x0180c603 },
+  { 0xa61c, 0x0180c603 },
+  { 0xa620, 0x01c10603 },
+  { 0xa624, 0x01c10704 },
+  { 0xa628, 0x02c18b05 },
+  { 0xa62c, 0x02c14c07 },
+  { 0xa630, 0x01008704 },
+  { 0xa634, 0x01c10402 },
+  { 0xa638, 0x0301cc07 },
+  { 0xa63c, 0x0301cc07 },
+  { 0xb2dc, 0xffd5f552 },
+  { 0xb2e0, 0xffe60664 },
+  { 0xb2e4, 0xfff8

svn commit: r291459 - in head/sys: fs/nfs fs/nfsclient ufs/ffs

2015-11-29 Thread Kirk McKusick
Author: mckusick
Date: Sun Nov 29 21:01:02 2015
New Revision: 291459
URL: https://svnweb.freebsd.org/changeset/base/291459

Log:
  For performance reasons, it is useful to have a single string used as
  the name of a filesystem when setting it as the first parameter to the
  getnewvnode() function. Most filesystems call getnewvnode from just one
  place so can use a literal string as the first parameter. However, NFS
  calls getnewvnode from two places, so we create a global constant string
  that can be used by the two instances. This change also collapses two
  instances of getnewvnode() in the UFS filesystem to a single call.
  
  Reviewed by: kib
  Tested by:   Peter Holm

Modified:
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfsclient/nfs_clnode.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/fs/nfs/nfsport.h
==
--- head/sys/fs/nfs/nfsport.h   Sun Nov 29 18:14:18 2015(r291458)
+++ head/sys/fs/nfs/nfsport.h   Sun Nov 29 21:01:02 2015(r291459)
@@ -964,6 +964,13 @@ struct nfsreq {
 #defineNFSVNO_DELEGOK(v)   (1)
 #endif
 
+/*
+ * Name used by getnewvnode() to describe filesystem, "nfs".
+ * For perfomance reasons it is useful to have the same string
+ * used in both places that call getnewvnode().
+ */
+extern const char nfs_vnode_tag[];
+
 #endif /* _KERNEL */
 
 #endif /* _NFS_NFSPORT_H */

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==
--- head/sys/fs/nfsclient/nfs_clnode.c  Sun Nov 29 18:14:18 2015
(r291458)
+++ head/sys/fs/nfsclient/nfs_clnode.c  Sun Nov 29 21:01:02 2015
(r291459)
@@ -64,6 +64,8 @@ MALLOC_DECLARE(M_NEWNFSREQ);
 
 uma_zone_t newnfsnode_zone;
 
+const char nfs_vnode_tag[] = "nfs";
+
 static voidnfs_freesillyrename(void *arg, __unused int pending);
 
 void
@@ -122,7 +124,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
}
np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO);
 
-   error = getnewvnode("nfs", mntp, &newnfs_vnodeops, &nvp);
+   error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp);
if (error) {
uma_zfree(newnfsnode_zone, np);
return (error);
@@ -330,4 +332,3 @@ ncl_invalcaches(struct vnode *vp)
KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
mtx_unlock(&np->n_mtx);
 }
-

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Sun Nov 29 18:14:18 2015
(r291458)
+++ head/sys/fs/nfsclient/nfs_clport.c  Sun Nov 29 21:01:02 2015
(r291459)
@@ -210,7 +210,7 @@ nfscl_nget(struct mount *mntp, struct vn
}
np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO);
 
-   error = getnewvnode("nfs", mntp, &newnfs_vnodeops, &nvp);
+   error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp);
if (error) {
uma_zfree(newnfsnode_zone, np);
FREE((caddr_t)nfhp, M_NFSFH);

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==
--- head/sys/ufs/ffs/ffs_vfsops.c   Sun Nov 29 18:14:18 2015
(r291458)
+++ head/sys/ufs/ffs/ffs_vfsops.c   Sun Nov 29 21:01:02 2015
(r291459)
@@ -1670,10 +1670,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
ip = uma_zalloc(uma_inode, M_WAITOK | M_ZERO);
 
/* Allocate a new vnode/inode. */
-   if (fs->fs_magic == FS_UFS1_MAGIC)
-   error = getnewvnode("ufs", mp, &ffs_vnodeops1, &vp);
-   else
-   error = getnewvnode("ufs", mp, &ffs_vnodeops2, &vp);
+   error = getnewvnode("ufs", mp, fs->fs_magic == FS_UFS1_MAGIC ?
+   &ffs_vnodeops1 : &ffs_vnodeops2, &vp);
if (error) {
*vpp = NULL;
uma_zfree(uma_inode, ip);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291460 - head/sys/kern

2015-11-29 Thread Kirk McKusick
Author: mckusick
Date: Sun Nov 29 21:42:26 2015
New Revision: 291460
URL: https://svnweb.freebsd.org/changeset/base/291460

Log:
  As the kernel allocates and frees vnodes, it fully initializes them
  on every allocation and fully releases them on every free.  These
  are not trivial costs: it starts by zeroing a large structure then
  initializes a mutex, a lock manager lock, an rw lock, four lists,
  and six pointers. And looking at vfs.vnodes_created, these operations
  are being done millions of times an hour on a busy machine.
  
  As a performance optimization, this code update uses the uma_init
  and uma_fini routines to do these initializations and cleanups only
  as the vnodes enter and leave the vnode_zone. With this change the
  initializations are only done kern.maxvnodes times at system startup
  and then only rarely again. The frees are done only if the vnode_zone
  shrinks which never happens in practice. For those curious about the
  avoided work, look at the vnode_init() and vnode_fini() functions in
  kern/vfs_subr.c to see the code that has been removed from the main
  vnode allocation/free path.
  
  Reviewed by: kib
  Tested by:   Peter Holm

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cSun Nov 29 21:01:02 2015(r291459)
+++ head/sys/kern/vfs_subr.cSun Nov 29 21:42:26 2015(r291460)
@@ -346,6 +346,66 @@ PCTRIE_DEFINE(BUF, buf, b_lblkno, buf_tr
 #ifndefMAXVNODES_MAX
 #defineMAXVNODES_MAX   (512 * 1024 * 1024 / 64)/* 8M */
 #endif
+
+/*
+ * Initialize a vnode as it first enters the zone.
+ */
+static int
+vnode_init(void *mem, int size, int flags)
+{
+   struct vnode *vp;
+   struct bufobj *bo;
+
+   vp = mem;
+   bzero(vp, size);
+   /*
+* Setup locks.
+*/
+   vp->v_vnlock = &vp->v_lock;
+   mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF);
+   /*
+* By default, don't allow shared locks unless filesystems opt-in.
+*/
+   lockinit(vp->v_vnlock, PVFS, "vnode", VLKTIMEOUT,
+   LK_NOSHARE | LK_IS_VNODE);
+   /*
+* Initialize bufobj.
+*/
+   bo = &vp->v_bufobj;
+   bo->__bo_vnode = vp;
+   rw_init(BO_LOCKPTR(bo), "bufobj interlock");
+   bo->bo_private = vp;
+   TAILQ_INIT(&bo->bo_clean.bv_hd);
+   TAILQ_INIT(&bo->bo_dirty.bv_hd);
+   /*
+* Initialize namecache.
+*/
+   LIST_INIT(&vp->v_cache_src);
+   TAILQ_INIT(&vp->v_cache_dst);
+   /*
+* Initialize rangelocks.
+*/
+   rangelock_init(&vp->v_rl);
+   return (0);
+}
+
+/*
+ * Free a vnode when it is cleared from the zone.
+ */
+static void
+vnode_fini(void *mem, int size)
+{
+   struct vnode *vp;
+   struct bufobj *bo;
+
+   vp = mem;
+   rangelock_destroy(&vp->v_rl);
+   lockdestroy(vp->v_vnlock);
+   mtx_destroy(&vp->v_interlock);
+   bo = &vp->v_bufobj;
+   rw_destroy(BO_LOCKPTR(bo));
+}
+
 static void
 vntblinit(void *dummy __unused)
 {
@@ -379,7 +439,7 @@ vntblinit(void *dummy __unused)
TAILQ_INIT(&vnode_free_list);
mtx_init(&vnode_free_list_mtx, "vnode_free_list", NULL, MTX_DEF);
vnode_zone = uma_zcreate("VNODE", sizeof (struct vnode), NULL, NULL,
-   NULL, NULL, UMA_ALIGN_PTR, 0);
+   vnode_init, vnode_fini, UMA_ALIGN_PTR, 0);
vnodepoll_zone = uma_zcreate("VNODEPOLL", sizeof (struct vpollinfo),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
/*
@@ -1223,8 +1283,8 @@ getnewvnode(const char *tag, struct moun
 struct vnode **vpp)
 {
struct vnode *vp;
-   struct bufobj *bo;
struct thread *td;
+   struct lock_object *lo;
static int cyclecount;
int error;
 
@@ -1271,40 +1331,42 @@ getnewvnode(const char *tag, struct moun
mtx_unlock(&vnode_free_list_mtx);
 alloc:
atomic_add_long(&vnodes_created, 1);
-   vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK|M_ZERO);
+   vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK);
/*
-* Setup locks.
-*/
-   vp->v_vnlock = &vp->v_lock;
-   mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF);
-   /*
-* By default, don't allow shared locks unless filesystems
-* opt-in.
-*/
-   lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE | LK_IS_VNODE);
-   /*
-* Initialize bufobj.
+* Locks are given the generic name "vnode" when created.
+* Follow the historic practice of using the filesystem
+* name when they allocated, e.g., "zfs", "ufs", "nfs, etc.
+*
+* Locks live in a witness group keyed on their name. Thus,
+* when a lock is renamed, it must also move from the witness
+* group of its old name to the witness group of its new name.
+   

svn commit: r291461 - head/lib/libfetch

2015-11-29 Thread Dimitry Andric
Author: dim
Date: Sun Nov 29 22:37:48 2015
New Revision: 291461
URL: https://svnweb.freebsd.org/changeset/base/291461

Log:
  Fix buildworld after r291453, similar to r284346: url->user and url->pwd
  are arrays, so they can never be NULL.
  
  Reported by:  many
  Pointy hat to:des

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cSun Nov 29 21:42:26 2015(r291460)
+++ head/lib/libfetch/http.cSun Nov 29 22:37:48 2015(r291461)
@@ -1689,10 +1689,8 @@ http_request_body(struct url *URL, const
goto ouch;
}
} else if (fetch_netrc_auth(url) == 0) {
-   aparams.user = url->user ?
-   strdup(url->user) : strdup("");
-   aparams.password = url->pwd ?
-   strdup(url->pwd) : strdup("");
+   aparams.user = strdup(url->user);
+   aparams.password = strdup(url->pwd);
} else if (fetchAuthMethod &&
   fetchAuthMethod(url) == 0) {
aparams.user = strdup(url->user);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r291453 - head/lib/libfetch

2015-11-29 Thread Dimitry Andric
On 29 Nov 2015, at 18:35, Jason Unovitch  wrote:
> 
> On Sun, Nov 29, 2015 at 9:27 AM, Dag-Erling Smørgrav  wrote:
>> Author: des
>> Date: Sun Nov 29 14:26:59 2015
>> New Revision: 291453
>> URL: https://svnweb.freebsd.org/changeset/base/291453
...
> `make buildworld` fails after this commit:
> 
> /usr/src/head/lib/libfetch/http.c:1692:25: error: address of array
> 'url->user' will always evaluate to 'true' [-Werro
> r,-Wpointer-bool-conversion]
>aparams.user = url->user ?
>   ~^~~~ ~
> /usr/src/head/lib/libfetch/http.c:1694:29: error: address of array
> 'url->pwd' will always evaluate to 'true' [-Werror
> ,-Wpointer-bool-conversion]
>aparams.password = url->pwd ?

This should now be fixed by r291461.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r291462 - in head/sys: conf powerpc/mpc85xx

2015-11-29 Thread Justin Hibbits
Author: jhibbits
Date: Mon Nov 30 02:23:56 2015
New Revision: 291462
URL: https://svnweb.freebsd.org/changeset/base/291462

Log:
  Add Freescale QorIQ GPIO driver.
  
  Still missing interrupt support, to come later.
  
  Sponsored by: Alex Perez/Inertial Computing

Added:
  head/sys/powerpc/mpc85xx/qoriq_gpio.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sun Nov 29 22:37:48 2015(r291461)
+++ head/sys/conf/files.powerpc Mon Nov 30 02:23:56 2015(r291462)
@@ -142,6 +142,7 @@ powerpc/mpc85xx/mpc85xx_gpio.c  optional
 powerpc/mpc85xx/platform_mpc85xx.c optionalmpc85xx | qoriq_dpaa
 powerpc/mpc85xx/pci_mpc85xx.c  optionalpci mpc85xx | pci qoriq_dpaa
 powerpc/mpc85xx/pci_mpc85xx_pcib.c optionalpci mpc85xx | pci 
qoriq_dpaa
+powerpc/mpc85xx/qoriq_gpio.c   optionalmpc85xx gpio | qoriq_dpaa gpio
 powerpc/ofw/ofw_machdep.c  standard
 powerpc/ofw/ofw_pci.c  optionalpci
 powerpc/ofw/ofw_pcibus.c   optionalpci

Added: head/sys/powerpc/mpc85xx/qoriq_gpio.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/mpc85xx/qoriq_gpio.c   Mon Nov 30 02:23:56 2015
(r291462)
@@ -0,0 +1,309 @@
+/*-
+ * Copyright (c) 2015 Justin Hibbits
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "gpio_if.h"
+
+#define MAXPIN (31)
+
+#define VALID_PIN(u)   ((u) >= 0 && (u) <= MAXPIN)
+
+#define GPIO_LOCK(sc)  mtx_lock(&(sc)->sc_mtx)
+#defineGPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
+#define GPIO_LOCK_INIT(sc) \
+   mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \
+   "gpio", MTX_DEF)
+#define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
+
+#defineGPIO_GPDIR  0x0
+#defineGPIO_GPODR  0x4
+#defineGPIO_GPDAT  0x8
+#defineGPIO_GPIER  0xc
+#defineGPIO_GPIMR  0x10
+#defineGPIO_GPICR  0x14
+
+
+struct qoriq_gpio_softc {
+   device_tdev;
+   device_tbusdev;
+   struct mtx  sc_mtx;
+   struct resource *sc_mem;/* Memory resource */
+};
+
+static device_t
+qoriq_gpio_get_bus(device_t dev)
+{
+   struct qoriq_gpio_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   return (sc->busdev);
+}
+
+static int
+qoriq_gpio_pin_max(device_t dev, int *maxpin)
+{
+
+   *maxpin = MAXPIN;
+   return (0);
+}
+
+/* Get a specific pin's capabilities. */
+static int
+qoriq_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
+{
+
+   if (!VALID_PIN(pin))
+   return (EINVAL);
+
+   *caps = (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN);
+
+   return (0);
+}
+
+/* Get a specific pin's name. */
+static int
+qoriq_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
+{
+
+   if (!VALID_PIN(pin))
+   return (EINVAL);
+
+   snprintf(name, GPIOMAXNAME, "qoriq_gpio%d.%d",
+   device_get_unit(dev), pin);
+   name[GPIOMAXNAME-1] = '\0';
+
+   return (0);
+}
+
+/* Set flags for the pin. */
+static int
+qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
+{
+   struct qoriq_gpio_softc *sc = device_

svn commit: r291463 - in head/sys/powerpc: include powerpc

2015-11-29 Thread Justin Hibbits
Author: jhibbits
Date: Mon Nov 30 02:40:41 2015
New Revision: 291463
URL: https://svnweb.freebsd.org/changeset/base/291463

Log:
  Print machine check address for Book-E.
  
  Bits in mcsr indicate if the address is valid, and whether it's a physical
  address or effective address.
  
  Sponsored by: Alex Perez/Inertial Computing

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

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Mon Nov 30 02:23:56 2015
(r291462)
+++ head/sys/powerpc/include/spr.h  Mon Nov 30 02:40:41 2015
(r291463)
@@ -652,7 +652,9 @@
 
 #elif defined(BOOKE)
 
+#defineSPR_MCARU   0x239   /* ..8 Machine Check Address 
register upper bits */
 #defineSPR_MCSR0x23c   /* ..8 Machine Check Syndrome 
register */
+#defineSPR_MCAR0x23d   /* ..8 Machine Check Address 
register */
 
 #defineSPR_ESR 0x003e  /* ..8 Exception Syndrome 
Register */
 #define  ESR_PIL 0x0800 /* Program interrupt - 
illegal */

Modified: head/sys/powerpc/powerpc/trap.c
==
--- head/sys/powerpc/powerpc/trap.c Mon Nov 30 02:23:56 2015
(r291462)
+++ head/sys/powerpc/powerpc/trap.c Mon Nov 30 02:40:41 2015
(r291463)
@@ -401,6 +401,9 @@ static void
 printtrap(u_int vector, struct trapframe *frame, int isfatal, int user)
 {
uint16_t ver;
+#ifdef BOOKE
+   vm_paddr_t pa;
+#endif
 
printf("\n");
printf("%s %s trap:\n", isfatal ? "fatal" : "handled",
@@ -429,7 +432,10 @@ printtrap(u_int vector, struct trapframe
printf("msssr0 = 0x%lx\n",
(u_long)mfspr(SPR_MSSSR0));
 #elif defined(BOOKE)
-   printf("   mcsr   = 0x%lx\n", (u_long)mfspr(SPR_MCSR));
+   pa = mfspr(SPR_MCARU);
+   pa = (pa << 32) | mfspr(SPR_MCAR);
+   printf("   mcsr= 0x%lx\n", (u_long)mfspr(SPR_MCSR));
+   printf("   mcar= 0x%jx\n", (uintmax_t)pa);
 #endif
break;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-11-29 Thread Kubilay Kocak
On 30/11/2015 8:42 AM, Kirk McKusick wrote:
> Author: mckusick
> Date: Sun Nov 29 21:42:26 2015
> New Revision: 291460
> URL: https://svnweb.freebsd.org/changeset/base/291460
> 
> Log:
>   As the kernel allocates and frees vnodes, it fully initializes them
>   on every allocation and fully releases them on every free.  These
>   are not trivial costs: it starts by zeroing a large structure then
>   initializes a mutex, a lock manager lock, an rw lock, four lists,
>   and six pointers. And looking at vfs.vnodes_created, these operations
>   are being done millions of times an hour on a busy machine.
>   
>   As a performance optimization, this code update uses the uma_init
>   and uma_fini routines to do these initializations and cleanups only
>   as the vnodes enter and leave the vnode_zone. With this change the
>   initializations are only done kern.maxvnodes times at system startup
>   and then only rarely again. The frees are done only if the vnode_zone
>   shrinks which never happens in practice. For those curious about the
>   avoided work, look at the vnode_init() and vnode_fini() functions in
>   kern/vfs_subr.c to see the code that has been removed from the main
>   vnode allocation/free path.
>   
>   Reviewed by: kib
>   Tested by:   Peter Holm
> 
> Modified:
>   head/sys/kern/vfs_subr.c
> 

Kirk,

Very interesting.

Any estimation / expectation on the performance impact^W benefit of
this, and in what scenario's / use-cases it might be particularly
beneficial? Any benchmarks or tests you can share?

./koobs

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


svn commit: r291464 - in head/lib: . lib80211

2015-11-29 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 30 04:41:50 2015
New Revision: 291464
URL: https://svnweb.freebsd.org/changeset/base/291464

Log:
  Add lib80211, a small (but hopefully soon to grow) set of library
  routines to interface with net80211.
  
  This is all from the ifconfig program; the duplicate code from ifconfig
  will be removed when it starts using this API.
  
  Differential Revision:https://reviews.freebsd.org/D4290

Added:
  head/lib/lib80211/
  head/lib/lib80211/Makefile   (contents, props changed)
  head/lib/lib80211/lib80211.3   (contents, props changed)
  head/lib/lib80211/lib80211_ioctl.c   (contents, props changed)
  head/lib/lib80211/lib80211_ioctl.h   (contents, props changed)
  head/lib/lib80211/lib80211_regdomain.c   (contents, props changed)
  head/lib/lib80211/lib80211_regdomain.h   (contents, props changed)
Modified:
  head/lib/Makefile

Modified: head/lib/Makefile
==
--- head/lib/Makefile   Mon Nov 30 02:40:41 2015(r291463)
+++ head/lib/Makefile   Mon Nov 30 04:41:50 2015(r291464)
@@ -71,6 +71,7 @@ SUBDIR=   ${SUBDIR_ORDERED} \
${_libmp} \
libmt \
${_libnandfs} \
+   lib80211 \
libnetbsd \
${_libnetgraph} \
${_libngatm} \

Added: head/lib/lib80211/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/lib80211/Makefile  Mon Nov 30 04:41:50 2015(r291464)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+LIB=   80211
+SHLIBDIR?= /lib
+SHLIB_MAJOR= 1
+SRCS=  lib80211_regdomain.c lib80211_ioctl.c
+
+INCSDIR=   ${INCLUDEDIR}/lib80211/
+INCS=  lib80211_regdomain.h lib80211_ioctl.h
+
+MAN=   lib80211.3
+
+CFLAGS+=-I${.CURDIR}
+
+.include 

Added: head/lib/lib80211/lib80211.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/lib80211/lib80211.3Mon Nov 30 04:41:50 2015
(r291464)
@@ -0,0 +1,118 @@
+.\" Copyright (c) 2015 Adrian Chadd.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 24, 2015
+.Dt 80211 3
+.Os
+.Sh NAME
+.Nm lib80211_alloc_regdata ,
+.Nm lib80211_free_regdata ,
+.Nm lib80211_regdomain_readconfig ,
+.Nm lib80211_regdomain_cleanup ,
+.Nm lib80211_regdomain_findbysku ,
+.Nm lib80211_regdomain_findbyname ,
+.Nm lib80211_country_findbycc ,
+.Nm lib80211_country_findbyname
+.Nd manage net80211 configuration and regulatory database.
+.Sh LIBRARY
+.Lb lib80211
+.Sh SYNOPSIS
+.In lib80211/lib80211_regdomain.h
+.In lib80211/lib80211_ioctl.h
+.Ft struct regdata *
+.Fn lib80211_alloc_regdata void
+.Ft void
+.Fn lib80211_free_regdata "struct regdata *reg"
+.Ft int
+.Fn lib80211_regdomain_readconfig "struct regdata *reg" "const void *config" 
"size_t size"
+.Ft void
+.Fn lib80211_regdomain_cleanup "struct regdata *reg"
+.Ft const struct regdomain *
+.Fn lib80211_regdomain_findbysku "const struct regdata *reg" 
"enumRegDomainCode"
+.Ft const struct regdomain *
+.Fn lib80211_regdomain_findbyname "const struct regdata *reg" "const char *sku"
+.Ft const struct country *
+.Fn lib80211_country_findbycc "const struct regdata *reg" "enum ISOCountryCode"
+.Ft const struct country *
+.Fn lib80211_country_findbyname "const struct regdata *reg" "const char *cc"
+.Sh DESCRIPTION
+The
+.Nm lib80211
+library is an interface to the
+.Xr net80211 4
+infrastructure.
+It implements wrappers around the
+.Xr net80211 4
+ioctl command, as well as providing a convenient API to access the regulatory
+database.
+.Pp
+T

svn commit: r291465 - head/etc/mtree

2015-11-29 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 30 04:59:01 2015
New Revision: 291465
URL: https://svnweb.freebsd.org/changeset/base/291465

Log:
  Add lib80211 to include path.
  
  (This commit was missing from my lib80211 commit.)

Modified:
  head/etc/mtree/BSD.include.dist

Modified: head/etc/mtree/BSD.include.dist
==
--- head/etc/mtree/BSD.include.dist Mon Nov 30 04:41:50 2015
(r291464)
+++ head/etc/mtree/BSD.include.dist Mon Nov 30 04:59:01 2015
(r291465)
@@ -241,6 +241,8 @@
 ..
 krb5
 ..
+lib80211
+..
 libmilter
 ..
 libxo
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2015-11-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Nov 30 05:51:14 2015
New Revision: 291466
URL: https://svnweb.freebsd.org/changeset/base/291466

Log:
  Add new rt_foreach_fib_walk_del() function for deleting route entries
by filter function instead of picking into routing table details in
each consumer.
  Remove now-unused rt_expunge() (eliminating last external RTF_RNH_LOCKED
   user).
  This simplifies future nexthops/mulitipath changes and rtrequest1_fib()
locking refactoring.
  
  Actual changes:
  Add "rt_chain" field to permit rte grouping while doing batched delete
from routing table (thus growing rte 200->208 on amd64).
  Add "rti_filter" /  "rti_filterdata" / "rti_spare" fields to rt_addrinfo
to pass filter function to various routing subsystems in standard way.
  Convert all rt_expunge() customers to new rt_addinfo-based api and eliminate
rt_expunge().

Modified:
  head/sys/net/route.c
  head/sys/net/route.h
  head/sys/netinet/in_rmx.c
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cMon Nov 30 04:59:01 2015(r291465)
+++ head/sys/net/route.cMon Nov 30 05:51:14 2015(r291466)
@@ -139,7 +139,14 @@ static VNET_DEFINE(uma_zone_t, rtzone);
 static int rtrequest1_fib_change(struct radix_node_head *, struct rt_addrinfo 
*,
 struct rtentry **, u_int);
 static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *);
-static int rt_ifdelroute(struct rtentry *rt, void *arg);
+static int rt_ifdelroute(const struct rtentry *rt, void *arg);
+static struct rtentry *rt_unlinkrte(struct radix_node_head *rnh,
+struct rt_addrinfo *info, int *perror);
+static void rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info);
+#ifdef RADIX_MPATH
+static struct radix_node *rt_mpath_unlink(struct radix_node_head *rnh,
+struct rt_addrinfo *info, struct rtentry *rto, int *perror);
+#endif
 
 struct if_mtuinfo
 {
@@ -237,6 +244,7 @@ rtentry_ctor(void *mem, int size, void *
 
bzero(rt, offsetof(struct rtentry, rt_endzero));
counter_u64_zero(rt->rt_pksent);
+   rt->rt_chain = NULL;
 
return (0);
 }
@@ -867,6 +875,108 @@ rt_foreach_fib_walk(int af, rt_setwarg_t
}
 }
 
+struct rt_delinfo
+{
+   struct rt_addrinfo info;
+   struct radix_node_head *rnh;
+   struct rtentry *head;
+};
+
+/*
+ * Conditionally unlinks @rn from radix tree based
+ * on info data passed in @arg.
+ */
+static int
+rt_checkdelroute(struct radix_node *rn, void *arg)
+{
+   struct rt_delinfo *di;
+   struct rt_addrinfo *info;
+   struct rtentry *rt;
+   int error;
+
+   di = (struct rt_delinfo *)arg;
+   rt = (struct rtentry *)rn;
+   info = &di->info;
+   error = 0;
+
+   info->rti_info[RTAX_DST] = rt_key(rt);
+   info->rti_info[RTAX_NETMASK] = rt_mask(rt);
+   info->rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+
+   rt = rt_unlinkrte(di->rnh, info, &error);
+   if (rt == NULL) {
+   /* Either not allowed or not matched. Skip entry */
+   return (0);
+   }
+
+   /* Entry was unlinked. Add to the list and return */
+   rt->rt_chain = di->head;
+   di->head = rt;
+
+   return (0);
+}
+
+/*
+ * Iterates over all existing fibs in system.
+ * Deletes each element for which @filter_f function returned
+ * non-zero value.
+ * If @af is not AF_UNSPEC, iterates over fibs in particular
+ * address family.
+ */
+void
+rt_foreach_fib_walk_del(int af, rt_filter_f_t *filter_f, void *arg)
+{
+   struct radix_node_head *rnh;
+   struct rt_delinfo di;
+   struct rtentry *rt;
+   uint32_t fibnum;
+   int i, start, end;
+
+   bzero(&di, sizeof(di));
+   di.info.rti_filter = filter_f;
+   di.info.rti_filterdata = arg;
+
+   for (fibnum = 0; fibnum < rt_numfibs; fibnum++) {
+   /* Do we want some specific family? */
+   if (af != AF_UNSPEC) {
+   start = af;
+   end = af;
+   } else {
+   start = 1;
+   end = AF_MAX;
+   }
+
+   for (i = start; i <= end; i++) {
+   rnh = rt_tables_get_rnh(fibnum, i);
+   if (rnh == NULL)
+   continue;
+   di.rnh = rnh;
+
+   RADIX_NODE_HEAD_LOCK(rnh);
+   rnh->rnh_walktree(rnh, rt_checkdelroute, &di);
+   RADIX_NODE_HEAD_UNLOCK(rnh);
+
+   if (di.head == NULL)
+   continue;
+
+   /* We might have something to reclaim */
+   while (di.head != NULL) {
+   rt = di.head;
+   di.head = rt->rt_chain;
+   rt->rt_chain = NULL;

svn commit: r291467 - head/sys/net

2015-11-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Nov 30 05:59:22 2015
New Revision: 291467
URL: https://svnweb.freebsd.org/changeset/base/291467

Log:
  Move flowtable rte checks to separate function.

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cMon Nov 30 05:51:14 2015(r291466)
+++ head/sys/net/route.cMon Nov 30 05:59:22 2015(r291467)
@@ -1365,6 +1365,68 @@ rt_mpath_unlink(struct radix_node_head *
 }
 #endif
 
+#ifdef FLOWTABLE
+static struct rtentry *
+rt_flowtable_check_route(struct radix_node_head *rnh, struct rt_addrinfo *info)
+{
+   struct radix_node *rn;
+   struct rtentry *rt0;
+
+   rt0 = NULL;
+   /* "flow-table" only supports IPv6 and IPv4 at the moment. */
+   switch (dst->sa_family) {
+#ifdef INET6
+   case AF_INET6:
+#endif
+#ifdef INET
+   case AF_INET:
+#endif
+#if defined(INET6) || defined(INET)
+   rn = rnh->rnh_matchaddr(dst, rnh);
+   if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) {
+   struct sockaddr *mask;
+   u_char *m, *n;
+   int len;
+
+   /*
+* compare mask to see if the new route is
+* more specific than the existing one
+*/
+   rt0 = RNTORT(rn);
+   RT_LOCK(rt0);
+   RT_ADDREF(rt0);
+   RT_UNLOCK(rt0);
+   /*
+* A host route is already present, so
+* leave the flow-table entries as is.
+*/
+   if (rt0->rt_flags & RTF_HOST) {
+   RTFREE(rt0);
+   rt0 = NULL;
+   } else if (!(flags & RTF_HOST) && netmask) {
+   mask = rt_mask(rt0);
+   len = mask->sa_len;
+   m = (u_char *)mask;
+   n = (u_char *)netmask;
+   while (len-- > 0) {
+   if (*n != *m)
+   break;
+   n++;
+   m++;
+   }
+   if (len == 0 || (*n < *m)) {
+   RTFREE(rt0);
+   rt0 = NULL;
+   }
+   }
+   }
+#endif/* INET6 || INET */
+   }
+
+   return (rt0);
+}
+#endif
+
 int
 rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
u_int fibnum)
@@ -1508,56 +1570,7 @@ rtrequest1_fib(int req, struct rt_addrin
 #endif
 
 #ifdef FLOWTABLE
-   rt0 = NULL;
-   /* "flow-table" only supports IPv6 and IPv4 at the moment. */
-   switch (dst->sa_family) {
-#ifdef INET6
-   case AF_INET6:
-#endif
-#ifdef INET
-   case AF_INET:
-#endif
-#if defined(INET6) || defined(INET)
-   rn = rnh->rnh_matchaddr(dst, rnh);
-   if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) {
-   struct sockaddr *mask;
-   u_char *m, *n;
-   int len;
-   
-   /*
-* compare mask to see if the new route is
-* more specific than the existing one
-*/
-   rt0 = RNTORT(rn);
-   RT_LOCK(rt0);
-   RT_ADDREF(rt0);
-   RT_UNLOCK(rt0);
-   /*
-* A host route is already present, so 
-* leave the flow-table entries as is.
-*/
-   if (rt0->rt_flags & RTF_HOST) {
-   RTFREE(rt0);
-   rt0 = NULL;
-   } else if (!(flags & RTF_HOST) && netmask) {
-   mask = rt_mask(rt0);
-   len = mask->sa_len;
-   m = (u_char *)mask;
-   n = (u_char *)netmask;
-   while (len-- > 0) {
-   if (*n != *m)
-   break;
-   n++;
-   m++;
-

svn commit: r291468 - head/sys/netinet

2015-11-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Nov 30 06:02:35 2015
New Revision: 291468
URL: https://svnweb.freebsd.org/changeset/base/291468

Log:
  Remove in_setifarnh definition.

Modified:
  head/sys/netinet/in_rmx.c

Modified: head/sys/netinet/in_rmx.c
==
--- head/sys/netinet/in_rmx.c   Mon Nov 30 05:59:22 2015(r291467)
+++ head/sys/netinet/in_rmx.c   Mon Nov 30 06:02:35 2015(r291468)
@@ -53,9 +53,6 @@ extern intin_inithead(void **head, int 
 extern int in_detachhead(void **head, int off);
 #endif
 
-static void in_setifarnh(struct radix_node_head *rnh, uint32_t fibnum,
-int af, void *_arg);
-
 /*
  * Do what we need to do when inserting a route.
  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291469 - in head/sys: contrib/dev/ath/ath_hal/ar9300 dev/ath/ath_hal

2015-11-29 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 30 06:26:59 2015
New Revision: 291469
URL: https://svnweb.freebsd.org/changeset/base/291469

Log:
  fix ht/40 configuration for ar9331 (hornet).
  
  The synth programming here requires the real centre frequency,
  which for HT20 channels is the normal channel, but HT40 is
  /not/ the primary channel.  Everything else was using 'freq',
  which is the correct centre frequency, but the hornet config
  was using 'ichan' to do the lookup which was also the primary
  channel.
  
  So, modify the HAL call that does the mapping to take a frequency
  in MHz and return the channel number.
  
  Tested:
  
  * Carambola 2, AR9331, tested both HT/20 and HT/40 operation.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radio.c
  head/sys/dev/ath/ath_hal/ah.c
  head/sys/dev/ath/ath_hal/ah_internal.h

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radio.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radio.c  Mon Nov 30 
06:02:35 2015(r291468)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radio.c  Mon Nov 30 
06:26:59 2015(r291469)
@@ -99,7 +99,6 @@ ar9300_set_channel(struct ath_hal *ah, s
 ar9300_get_channel_centers(ah, chan, ¢ers);
 freq = centers.synth_center;
 
-
 if (freq < 4800) { /* 2 GHz, fractional mode */
 b_mode = 1; /* 2 GHz */
 
@@ -116,7 +115,19 @@ ar9300_set_channel(struct ath_hal *ah, s
 #endif
 uint32_t i;
 
-i = ath_hal_mhz2ieee_2ghz(ah, ichan);
+/*
+ * Pay close attention to this bit!
+ *
+ * We need to map the actual desired synth frequency to
+ * one of the channel select array entries.
+ *
+ * For HT20, it'll align with the channel we select.
+ *
+ * For HT40 though it won't - the centre frequency
+ * will not be the frequency of chan->ic_freq or ichan->freq;
+ * it needs to be whatever frequency maps to 'freq'.
+ */
+i = ath_hal_mhz2ieee_2ghz(ah, freq);
 HALASSERT(i > 0 && i <= 14);
 if (clk_25mhz) {
 channel_sel = ar9300_chansel_xtal_25M[i - 1];

Modified: head/sys/dev/ath/ath_hal/ah.c
==
--- head/sys/dev/ath/ath_hal/ah.c   Mon Nov 30 06:02:35 2015
(r291468)
+++ head/sys/dev/ath/ath_hal/ah.c   Mon Nov 30 06:26:59 2015
(r291469)
@@ -1431,15 +1431,15 @@ ath_hal_EepromDataRead(struct ath_hal *a
  * This is the unmapped frequency which is programmed into the hardware.
  */
 int
-ath_hal_mhz2ieee_2ghz(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *ichan)
+ath_hal_mhz2ieee_2ghz(struct ath_hal *ah, int freq)
 {
 
-   if (ichan->channel == 2484)
+   if (freq == 2484)
return 14;
-   if (ichan->channel < 2484)
-   return ((int) ichan->channel - 2407) / 5;
+   if (freq < 2484)
+   return ((int) freq - 2407) / 5;
else
-   return 15 + ((ichan->channel - 2512) / 20);
+   return 15 + ((freq - 2512) / 20);
 }
 
 /*

Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==
--- head/sys/dev/ath/ath_hal/ah_internal.h  Mon Nov 30 06:02:35 2015
(r291468)
+++ head/sys/dev/ath/ath_hal/ah_internal.h  Mon Nov 30 06:26:59 2015
(r291469)
@@ -1031,7 +1031,7 @@ ath_hal_getantennaallowed(struct ath_hal
 /*
  * Map the given 2GHz channel to an IEEE number.
  */
-extern int ath_hal_mhz2ieee_2ghz(struct ath_hal *, HAL_CHANNEL_INTERNAL *);
+extern int ath_hal_mhz2ieee_2ghz(struct ath_hal *, int freq);
 
 /*
  * Clear the channel survey data.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291470 - head/sbin/ifconfig

2015-11-29 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 30 06:34:16 2015
New Revision: 291470
URL: https://svnweb.freebsd.org/changeset/base/291470

Log:
  Convert ifconfig to use lib80211.
  
  * remove regdomain.[ch] - it's now part of lib80211.
  * convert ifieee80211.c to use the ioctl routines in lib80211 and
implement the "error? exit" wrapper behaviour the callers expect.

Deleted:
  head/sbin/ifconfig/regdomain.c
  head/sbin/ifconfig/regdomain.h
Modified:
  head/sbin/ifconfig/Makefile
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/Makefile
==
--- head/sbin/ifconfig/Makefile Mon Nov 30 06:26:59 2015(r291469)
+++ head/sbin/ifconfig/Makefile Mon Nov 30 06:34:16 2015(r291470)
@@ -37,8 +37,8 @@ SRCS+=ifgif.c # GIF reversed header w
 SRCS+= sfp.c   # SFP/SFP+ information
 LIBADD+=   m
 
-SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support
-LIBADD+=   bsdxml sbuf
+SRCS+= ifieee80211.c   # SIOC[GS]IEEE80211 support
+LIBADD+=   bsdxml sbuf 80211
 
 SRCS+= carp.c  # SIOC[GS]VH support
 SRCS+= ifgroup.c   # ...

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Nov 30 06:26:59 2015
(r291469)
+++ head/sbin/ifconfig/ifieee80211.cMon Nov 30 06:34:16 2015
(r291470)
@@ -90,7 +90,9 @@
 #include /* NB: for offsetof */
 
 #include "ifconfig.h"
-#include "regdomain.h"
+
+#include 
+#include 
 
 #ifndef IEEE80211_FIXED_RATE_NONE
 #defineIEEE80211_FIXED_RATE_NONE   0xff
@@ -4886,60 +4888,31 @@ end:
 static int
 get80211(int s, int type, void *data, int len)
 {
-   struct ieee80211req ireq;
 
-   (void) memset(&ireq, 0, sizeof(ireq));
-   (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
-   ireq.i_type = type;
-   ireq.i_data = data;
-   ireq.i_len = len;
-   return ioctl(s, SIOCG80211, &ireq);
+   return (lib80211_get80211(s, name, type, data, len));
 }
 
 static int
 get80211len(int s, int type, void *data, int len, int *plen)
 {
-   struct ieee80211req ireq;
 
-   (void) memset(&ireq, 0, sizeof(ireq));
-   (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
-   ireq.i_type = type;
-   ireq.i_len = len;
-   assert(ireq.i_len == len);  /* NB: check for 16-bit truncation */
-   ireq.i_data = data;
-   if (ioctl(s, SIOCG80211, &ireq) < 0)
-   return -1;
-   *plen = ireq.i_len;
-   return 0;
+   return (lib80211_get80211len(s, name, type, data, len, plen));
 }
 
 static int
 get80211val(int s, int type, int *val)
 {
-   struct ieee80211req ireq;
 
-   (void) memset(&ireq, 0, sizeof(ireq));
-   (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
-   ireq.i_type = type;
-   if (ioctl(s, SIOCG80211, &ireq) < 0)
-   return -1;
-   *val = ireq.i_val;
-   return 0;
+   return (lib80211_get80211val(s, name, type, val));
 }
 
 static void
 set80211(int s, int type, int val, int len, void *data)
 {
-   struct ieee80211req ireq;
+   int ret;
 
-   (void) memset(&ireq, 0, sizeof(ireq));
-   (void) strncpy(ireq.i_name, name, sizeof(ireq.i_name));
-   ireq.i_type = type;
-   ireq.i_val = val;
-   ireq.i_len = len;
-   assert(ireq.i_len == len);  /* NB: check for 16-bit truncation */
-   ireq.i_data = data;
-   if (ioctl(s, SIOCS80211, &ireq) < 0)
+   ret = lib80211_set80211(s, name, type, val, len, data);
+   if (ret < 0)
err(1, "SIOCS80211");
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r291471 - head/share/mk

2015-11-29 Thread Adrian Chadd
Author: adrian
Date: Mon Nov 30 06:56:25 2015
New Revision: 291471
URL: https://svnweb.freebsd.org/changeset/base/291471

Log:
  Add missing lib declaration.

Modified:
  head/share/mk/src.libnames.mk

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Mon Nov 30 06:34:16 2015
(r291470)
+++ head/share/mk/src.libnames.mk   Mon Nov 30 06:56:25 2015
(r291471)
@@ -50,6 +50,7 @@ _INTERNALLIBS=\
 _LIBRARIES=\
${_PRIVATELIBS} \
${_INTERNALLIBS} \
+   80211 \
alias \
archive \
asn1 \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"