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

2012-09-24 Thread Adrian Chadd
Author: adrian
Date: Tue Sep 25 05:56:59 2012
New Revision: 240914
URL: http://svn.freebsd.org/changeset/base/240914

Log:
  Call ath_tx_tid_unsched() after the node has been flushed, so the
  state can be printed correctly.

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

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cTue Sep 25 03:59:10 2012
(r240913)
+++ head/sys/dev/ath/if_ath_tx.cTue Sep 25 05:56:59 2012
(r240914)
@@ -3468,12 +3468,11 @@ ath_tx_node_flush(struct ath_softc *sc, 
struct ath_tid *atid = &an->an_tid[tid];
struct ath_txq *txq = sc->sc_ac2q[atid->ac];
 
-   /* Remove this tid from the list of active tids */
ATH_TXQ_LOCK(txq);
-   ath_tx_tid_unsched(sc, atid);
-
/* Free packets */
ath_tx_tid_drain(sc, an, atid, &bf_cq);
+   /* Remove this tid from the list of active tids */
+   ath_tx_tid_unsched(sc, atid);
ATH_TXQ_UNLOCK(txq);
}
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240913 - head/sys/arm/arm

2012-09-24 Thread Alan Cox
Author: alc
Date: Tue Sep 25 03:59:10 2012
New Revision: 240913
URL: http://svn.freebsd.org/changeset/base/240913

Log:
  Eliminate an unused declaration.

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/arm/pmap.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Tue Sep 25 02:33:25 2012(r240912)
+++ head/sys/arm/arm/pmap-v6.c  Tue Sep 25 03:59:10 2012(r240913)
@@ -219,7 +219,6 @@ vm_offset_t virtual_end;/* VA of last a
 vm_offset_t pmap_curmaxkvaddr;
 vm_paddr_t kernel_l1pa;
 
-extern void *end;
 vm_offset_t kernel_vm_end = 0;
 
 struct pmap kernel_pmap_store;

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Tue Sep 25 02:33:25 2012(r240912)
+++ head/sys/arm/arm/pmap.c Tue Sep 25 03:59:10 2012(r240913)
@@ -215,7 +215,6 @@ vm_offset_t virtual_end;/* VA of last a
 vm_offset_t pmap_curmaxkvaddr;
 vm_paddr_t kernel_l1pa;
 
-extern void *end;
 vm_offset_t kernel_vm_end = 0;
 
 struct pmap kernel_pmap_store;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240902 - head/usr.sbin/mountd

2012-09-24 Thread Rick Macklem
Author: rmacklem
Date: Mon Sep 24 23:57:16 2012
New Revision: 240902
URL: http://svn.freebsd.org/changeset/base/240902

Log:
  Attila Bogar reported a bug in mountd when multiple export
  entries with different security flavors are in the exports(5)
  file. For that case, mountd replies with the security flavors
  of the last entry and not the correct one for the client host.
  This patch fixes that by storing separate copies of the flavors
  for each host/net case, plus a default one for the case where
  no hosts/nets are specified on an entry in the exports(5) file.
  Unlike the patch in the PR, it replies with the security flavors
  for the entry instead of merging the security flavors for all
  the entries and replying with that.
  
  Tested by:attila.bogar at linguamatics.com
  PR:   kern/164933
  MFC after:2 weeks

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Mon Sep 24 21:45:41 2012
(r240901)
+++ head/usr.sbin/mountd/mountd.c   Mon Sep 24 23:57:16 2012
(r240902)
@@ -117,6 +117,8 @@ struct exportlist {
char*ex_indexfile;
int ex_numsecflavors;
int ex_secflavors[MAXSECFLAVORS];
+   int ex_defnumsecflavors;
+   int ex_defsecflavors[MAXSECFLAVORS];
 };
 /* ex_flag bits */
 #defineEX_LINKED   0x1
@@ -136,6 +138,8 @@ struct grouplist {
int gr_type;
union grouptypes gr_ptr;
struct grouplist *gr_next;
+   int gr_numsecflavors;
+   int gr_secflavors[MAXSECFLAVORS];
 };
 /* Group types */
 #defineGT_NULL 0x0
@@ -163,12 +167,13 @@ struct fhreturn {
 /* Global defs */
 char   *add_expdir(struct dirlist **, char *, int);
 void   add_dlist(struct dirlist **, struct dirlist *,
-   struct grouplist *, int);
+   struct grouplist *, int, struct exportlist *);
 void   add_mlist(char *, char *);
 intcheck_dirpath(char *);
 intcheck_options(struct dirlist *);
 intcheckmask(struct sockaddr *sa);
-intchk_host(struct dirlist *, struct sockaddr *, int *, int *);
+intchk_host(struct dirlist *, struct sockaddr *, int *, int *, int *,
+int **);
 static int create_service(struct netconfig *nconf);
 static voidcomplete_service(struct netconfig *nconf, char *port_str);
 static voidclearout_service(void);
@@ -938,6 +943,7 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
int bad = 0, defset, hostset;
sigset_t sighup_mask;
+   int numsecflavors, *secflavorsp;
 
sigemptyset(&sighup_mask);
sigaddset(&sighup_mask, SIGHUP);
@@ -1000,9 +1006,11 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
sigprocmask(SIG_BLOCK, &sighup_mask, NULL);
ep = ex_search(&fsb.f_fsid);
hostset = defset = 0;
-   if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset) ||
+   if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset,
+   &numsecflavors, &secflavorsp) ||
((dp = dirp_search(ep->ex_dirl, dirpath)) &&
- chk_host(dp, saddr, &defset, &hostset)) ||
+ chk_host(dp, saddr, &defset, &hostset, &numsecflavors,
+  &secflavorsp)) ||
(defset && scan_tree(ep->ex_defdir, saddr) == 0 &&
 scan_tree(ep->ex_dirl, saddr) == 0))) {
if (bad) {
@@ -1012,10 +1020,15 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
return;
}
-   if (hostset & DP_HOSTSET)
+   if (hostset & DP_HOSTSET) {
fhr.fhr_flag = hostset;
-   else
+   fhr.fhr_numsecflavors = numsecflavors;
+   fhr.fhr_secflavors = secflavorsp;
+   } else {
fhr.fhr_flag = defset;
+   fhr.fhr_numsecflavors = ep->ex_defnumsecflavors;
+   fhr.fhr_secflavors = ep->ex_defsecflavors;
+   }
fhr.fhr_vers = rqstp->rq_vers;
/* Get the file handle */
memset(&fhr.fhr_fh, 0, sizeof(nfsfh_t));
@@ -1028,8 +1041,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
return;
}
-   fhr.fhr_numsecflavors = ep->ex_numsecflavors;
-   fhr.

svn commit: r240901 - head/sys/dev/tws

2012-09-24 Thread Jim Harris
Author: jimharris
Date: Mon Sep 24 21:45:41 2012
New Revision: 240901
URL: http://svn.freebsd.org/changeset/base/240901

Log:
  Use CAM_SEL_TIMEOUT and CAM_DEV_NOT_THERE to report missing targets or
  LUNs respectively.  This removes a huge number of error messages
  from CAM during bus scans.
  
  Copied almost verbatim from mav's commit r237460.
  
  Submitted by: Mike Tancsa 
  MFC after:3 days

Modified:
  head/sys/dev/tws/tws_cam.c

Modified: head/sys/dev/tws/tws_cam.c
==
--- head/sys/dev/tws/tws_cam.c  Mon Sep 24 21:40:22 2012(r240900)
+++ head/sys/dev/tws/tws_cam.c  Mon Sep 24 21:45:41 2012(r240901)
@@ -529,10 +529,10 @@ tws_scsi_err_complete(struct tws_request
 
 if ( ccb->ccb_h.target_lun ) {
 TWS_TRACE_DEBUG(sc, "invalid lun error",0,0);
-ccb->ccb_h.status |= CAM_LUN_INVALID;
+ccb->ccb_h.status |= CAM_DEV_NOT_THERE;
 } else {
 TWS_TRACE_DEBUG(sc, "invalid target error",0,0);
-ccb->ccb_h.status |= CAM_TID_INVALID;
+ccb->ccb_h.status |= CAM_SEL_TIMEOUT;
 }
 
 } else {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240900 - head/sys/dev/tws

2012-09-24 Thread Jim Harris
Author: jimharris
Date: Mon Sep 24 21:40:22 2012
New Revision: 240900
URL: http://svn.freebsd.org/changeset/base/240900

Log:
  Specify MTX_RECURSE for the controller's io_lock.  Without it, tws(4)
  immediately panics on boot with INVARIANTS enabled.  The driver already
  clearly expects to be able to recurse on this mutex - the main I/O
  is always recursing on this lock.
  
  Reported and tested by:  Mike Tancsa 
  MFC after: 1 week

Modified:
  head/sys/dev/tws/tws.c

Modified: head/sys/dev/tws/tws.c
==
--- head/sys/dev/tws/tws.c  Mon Sep 24 20:35:56 2012(r240899)
+++ head/sys/dev/tws/tws.c  Mon Sep 24 21:40:22 2012(r240900)
@@ -197,7 +197,7 @@ tws_attach(device_t dev)
 mtx_init( &sc->q_lock, "tws_q_lock", NULL, MTX_DEF);
 mtx_init( &sc->sim_lock,  "tws_sim_lock", NULL, MTX_DEF);
 mtx_init( &sc->gen_lock,  "tws_gen_lock", NULL, MTX_DEF);
-mtx_init( &sc->io_lock,  "tws_io_lock", NULL, MTX_DEF);
+mtx_init( &sc->io_lock,  "tws_io_lock", NULL, MTX_DEF | MTX_RECURSE);
 
 if ( tws_init_trace_q(sc) == FAILURE )
 printf("trace init failure\n");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-09-24 Thread Adrian Chadd
Author: adrian
Date: Mon Sep 24 20:35:56 2012
New Revision: 240899
URL: http://svn.freebsd.org/changeset/base/240899

Log:
  Migrate the ath(4) KTR logging to use an ATH_KTR() macro.
  
  This should eventually be unified with ATH_DEBUG() so I can get both
  from one macro; that may take some time.
  
  Add some new probes for TX and TX completion.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_debug.h
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_ath_rx_edma.c
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Mon Sep 24 20:05:52 2012(r240898)
+++ head/sys/dev/ath/if_ath.c   Mon Sep 24 20:35:56 2012(r240899)
@@ -1519,9 +1519,9 @@ ath_intr(void *arg)
 */
ath_hal_getisr(ah, &status);/* NB: clears ISR too */
DPRINTF(sc, ATH_DEBUG_INTR, "%s: status 0x%x\n", __func__, status);
-   CTR1(ATH_KTR_INTR, "ath_intr: mask=0x%.8x", status);
+   ATH_KTR(sc, ATH_KTR_INTERRUPTS, 1, "ath_intr: mask=0x%.8x", status);
 #ifdef ATH_KTR_INTR_DEBUG
-   CTR5(ATH_KTR_INTR,
+   ATH_KTR(sc, ATH_KTR_INTERRUPTS, 5,
"ath_intr: ISR=0x%.8x, ISR_S0=0x%.8x, ISR_S1=0x%.8x, ISR_S2=0x%.8x, 
ISR_S5=0x%.8x",
ah->ah_intrstate[0],
ah->ah_intrstate[1],
@@ -1597,7 +1597,7 @@ ath_intr(void *arg)
}
if (status & HAL_INT_RXEOL) {
int imask;
-   CTR0(ATH_KTR_ERR, "ath_intr: RXEOL");
+   ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_intr: RXEOL");
ATH_PCU_LOCK(sc);
/*
 * NB: the hardware should re-read the link when
@@ -1663,6 +1663,11 @@ ath_intr(void *arg)
ATH_PCU_LOCK(sc);
txqs = 0x;
ath_hal_gettxintrtxqs(sc->sc_ah, &txqs);
+   ATH_KTR(sc, ATH_KTR_INTERRUPTS, 3,
+   "ath_intr: TX; txqs=0x%08x, txq_active was 
0x%08x, now 0x%08x",
+   txqs,
+   sc->sc_txq_active,
+   sc->sc_txq_active | txqs);
sc->sc_txq_active |= txqs;
ATH_PCU_UNLOCK(sc);
}
@@ -1701,7 +1706,7 @@ ath_intr(void *arg)
}
if (status & HAL_INT_RXORN) {
/* NB: hal marks HAL_INT_FATAL when RXORN is fatal */
-   CTR0(ATH_KTR_ERR, "ath_intr: RXORN");
+   ATH_KTR(sc, ATH_KTR_ERROR, 0, "ath_intr: RXORN");
sc->sc_stats.ast_rxorn++;
}
}
@@ -3637,6 +3642,14 @@ ath_tx_processq(struct ath_softc *sc, st
__func__, txq->axq_qnum,
(caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum),
txq->axq_link);
+
+   ATH_KTR(sc, ATH_KTR_TXCOMP, 4,
+   "ath_tx_processq: txq=%u head %p link %p depth %p",
+   txq->axq_qnum,
+   (caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum),
+   txq->axq_link,
+   txq->axq_depth);
+
nacked = 0;
for (;;) {
ATH_TXQ_LOCK(txq);
@@ -3648,17 +3661,21 @@ ath_tx_processq(struct ath_softc *sc, st
}
ds = bf->bf_lastds; /* XXX must be setup correctly! */
ts = &bf->bf_status.ds_txstat;
+
status = ath_hal_txprocdesc(ah, ds, ts);
 #ifdef ATH_DEBUG
if (sc->sc_debug & ATH_DEBUG_XMIT_DESC)
ath_printtxbuf(sc, bf, txq->axq_qnum, 0,
status == HAL_OK);
-   else if ((sc->sc_debug & ATH_DEBUG_RESET) && (dosched == 0)) {
+   else if ((sc->sc_debug & ATH_DEBUG_RESET) && (dosched == 0))
ath_printtxbuf(sc, bf, txq->axq_qnum, 0,
status == HAL_OK);
-   }
 #endif
+
if (status == HAL_EINPROGRESS) {
+   ATH_KTR(sc, ATH_KTR_TXCOMP, 3,
+   "ath_tx_processq: txq=%u, bf=%p ds=%p, 
HAL_EINPROGRESS",
+   txq->axq_qnum, bf, ds);
ATH_TXQ_UNLOCK(txq);
break;
}
@@ -3684,6 +3701,10 @@ ath_tx_processq(struct ath_softc *sc, st
txq->axq_aggr_depth--;
 
ni = bf->bf_node;
+
+   ATH_KTR(sc, ATH_KTR_TXCOMP, 5,
+   "ath_tx_processq: txq=%u, bf=%p, ds=%p, ni=%p, 
ts_status=0x%08x",
+   txq->axq_qnum, bf, ds, ni, ts->ts_status);
/*
 * If unicast frame was a

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

2012-09-24 Thread Adrian Chadd
Author: adrian
Date: Mon Sep 24 19:48:41 2012
New Revision: 240895
URL: http://svn.freebsd.org/changeset/base/240895

Log:
  Debugging output fixes:
  
  * use the correct frame status - although the completion descriptor is
the _last_ in the frame/aggregate, the status is currently stored in
the _first_ buffer.
  
  * Print out ath_buf specific fields once, not per descriptor in an ath_buf.

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

Modified: head/sys/dev/ath/if_ath_debug.c
==
--- head/sys/dev/ath/if_ath_debug.c Mon Sep 24 19:32:24 2012
(r240894)
+++ head/sys/dev/ath/if_ath_debug.c Mon Sep 24 19:48:41 2012
(r240895)
@@ -198,7 +198,7 @@ static void
 ath_printtxbuf_legacy(struct ath_softc *sc, const struct ath_buf *first_bf,
u_int qnum, u_int ix, int done)
 {
-   const struct ath_tx_status *ts = 
&first_bf->bf_last->bf_status.ds_txstat;
+   const struct ath_tx_status *ts = &first_bf->bf_status.ds_txstat;
const struct ath_buf *bf = first_bf;
struct ath_hal *ah = sc->sc_ah;
const struct ath_desc *ds;
@@ -206,16 +206,17 @@ ath_printtxbuf_legacy(struct ath_softc *
 
printf("Q%u[%3u]", qnum, ix);
while (bf != NULL) {
+   printf("(bf=%p, lastds=%p)\n", bf, first_bf->bf_lastds);
+   printf("Seq: %d swtry: %d ADDBAW?: %d DOBAW?: %d\n",
+   bf->bf_state.bfs_seqno,
+   bf->bf_state.bfs_retries,
+   bf->bf_state.bfs_addedbaw,
+   bf->bf_state.bfs_dobaw);
for (i = 0, ds = bf->bf_desc; i < bf->bf_nseg; i++, ds++) {
printf(" (DS.V:%p DS.P:%p) L:%08x D:%08x F:%04x%s\n",
ds, (const struct ath_desc *)bf->bf_daddr + i,
ds->ds_link, ds->ds_data, bf->bf_state.bfs_txflags,
!done ? "" : (ts->ts_status == 0) ? " *" : " !");
-   printf("Seq: %d swtry: %d ADDBAW?: %d DOBAW?: 
%d\n",
-   bf->bf_state.bfs_seqno,
-   bf->bf_state.bfs_retries,
-   bf->bf_state.bfs_addedbaw,
-   bf->bf_state.bfs_dobaw);
printf("%08x %08x %08x %08x %08x %08x\n",
ds->ds_ctl0, ds->ds_ctl1,
ds->ds_hw[0], ds->ds_hw[1],
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240893 - head/sbin/ipfw

2012-09-24 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Sep 24 17:34:30 2012
New Revision: 240893
URL: http://svn.freebsd.org/changeset/base/240893

Log:
  Whitespace fixes
  
  MFC after:2 weeks

Modified:
  head/sbin/ipfw/ipv6.c

Modified: head/sbin/ipfw/ipv6.c
==
--- head/sbin/ipfw/ipv6.c   Mon Sep 24 17:31:08 2012(r240892)
+++ head/sbin/ipfw/ipv6.c   Mon Sep 24 17:34:30 2012(r240893)
@@ -336,21 +336,21 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av)
 * Note d[1] points to struct in6_add r mask6 of cmd
 */
 
-   cmd->o.len &= ~F_LEN_MASK;  /* zero len */
+   cmd->o.len &= ~F_LEN_MASK;  /* zero len */
 
-   if (strcmp(av, "any") == 0)
-  return (1);
+   if (strcmp(av, "any") == 0)
+   return (1);
 
 
-   if (strcmp(av, "me") == 0) {/* Set the data for "me" opt*/
-  cmd->o.len |= F_INSN_SIZE(ipfw_insn);
-  return (1);
-   }
+   if (strcmp(av, "me") == 0) {/* Set the data for "me" opt*/
+   cmd->o.len |= F_INSN_SIZE(ipfw_insn);
+   return (1);
+   }
 
-   if (strcmp(av, "me6") == 0) {   /* Set the data for "me" opt*/
-  cmd->o.len |= F_INSN_SIZE(ipfw_insn);
-  return (1);
-   }
+   if (strcmp(av, "me6") == 0) {   /* Set the data for "me" opt*/
+   cmd->o.len |= F_INSN_SIZE(ipfw_insn);
+   return (1);
+   }
 
if (strncmp(av, "table(", 6) == 0) {
char *p = strchr(av + 6, ',');
@@ -368,8 +368,8 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av)
return (1);
}
 
-   av = strdup(av);
-   while (av) {
+   av = strdup(av);
+   while (av) {
/*
 * After the address we can have '/' indicating a mask,
 * or ',' indicating another address follows.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240892 - head/sbin/ipfw

2012-09-24 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Sep 24 17:31:08 2012
New Revision: 240892
URL: http://svn.freebsd.org/changeset/base/240892

Log:
  Permit table to be used as IPv6 address.
  
  Reported by:  Serhiy Popov 
  MFC after:2 weeks

Modified:
  head/sbin/ipfw/ipv6.c

Modified: head/sbin/ipfw/ipv6.c
==
--- head/sbin/ipfw/ipv6.c   Mon Sep 24 17:13:33 2012(r240891)
+++ head/sbin/ipfw/ipv6.c   Mon Sep 24 17:31:08 2012(r240892)
@@ -352,6 +352,22 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av)
   return (1);
}
 
+   if (strncmp(av, "table(", 6) == 0) {
+   char *p = strchr(av + 6, ',');
+   uint32_t *dm = ((ipfw_insn_u32 *)cmd)->d;
+
+   if (p)
+   *p++ = '\0';
+   cmd->o.opcode = O_IP_DST_LOOKUP;
+   cmd->o.arg1 = strtoul(av + 6, NULL, 0);
+   if (p) {
+   cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32);
+   dm[0] = strtoul(p, NULL, 0);
+   } else
+   cmd->o.len |= F_INSN_SIZE(ipfw_insn);
+   return (1);
+   }
+
av = strdup(av);
while (av) {
/*
@@ -469,7 +485,11 @@ add_srcip6(ipfw_insn *cmd, char *av)
 {
 
fill_ip6((ipfw_insn_ip6 *)cmd, av);
-   if (F_LEN(cmd) == 0) {  /* any */
+   if (cmd->opcode == O_IP_DST_SET)/* set */
+   cmd->opcode = O_IP_SRC_SET;
+   else if (cmd->opcode == O_IP_DST_LOOKUP)/* table */
+   cmd->opcode = O_IP_SRC_LOOKUP;
+   else if (F_LEN(cmd) == 0) { /* any */
} else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) {  /* "me" */
cmd->opcode = O_IP6_SRC_ME;
} else if (F_LEN(cmd) ==
@@ -487,7 +507,11 @@ add_dstip6(ipfw_insn *cmd, char *av)
 {
 
fill_ip6((ipfw_insn_ip6 *)cmd, av);
-   if (F_LEN(cmd) == 0) {  /* any */
+   if (cmd->opcode == O_IP_DST_SET)/* set */
+   ;
+   else if (cmd->opcode == O_IP_DST_LOOKUP)/* table */
+   ;
+   else if (F_LEN(cmd) == 0) { /* any */
} else if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn)) {  /* "me" */
cmd->opcode = O_IP6_DST_ME;
} else if (F_LEN(cmd) ==
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240891 - in head: etc usr.sbin/moused

2012-09-24 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep 24 17:13:33 2012
New Revision: 240891
URL: http://svn.freebsd.org/changeset/base/240891

Log:
  Make sure moused is exiting as quick as possible after that the
  umsX character device returns a read error. Update devd.conf rules
  to use "DEVFS" events which are generated after that the umsX
  character device node has been created/destroyed, and then there
  should be no need for moused to wait up to 10 seconds for umsX to
  be ready. Opening umsX should not fail except if the kernel is low
  on memory. In that case the user can replug the USB mouse or use
  "usbconfig" to reset the device. In case of USB mouse devices,
  moused should neither retry to open its character device,
  once the first read error has happened. This is an indication
  of device detach.
  
  MFC after:1 week

Modified:
  head/etc/devd.conf
  head/usr.sbin/moused/moused.c

Modified: head/etc/devd.conf
==
--- head/etc/devd.conf  Mon Sep 24 16:34:13 2012(r240890)
+++ head/etc/devd.conf  Mon Sep 24 17:13:33 2012(r240891)
@@ -115,14 +115,22 @@ detach 100 {
action "/etc/rc.d/syscons setkeyboard /dev/kbd0";
 };
 
-attach 100 {
-   device-name "ums[0-9]+";
-   action "/etc/rc.d/moused quietstart $device-name";
+notify 100 {
+   match "system" "DEVFS";
+   match "subsystem" "CDEV";
+   match "type" "CREATE";
+   match "cdev" "ums[0-9]+";
+
+   action "/etc/rc.d/moused quietstart $cdev";
 };
 
-detach 100 {
-device-name "ums[0-9]+";
-action "/etc/rc.d/moused stop $device-name";
+notify 100 {
+   match "system" "DEVFS";
+   match "subsystem" "CDEV";
+   match "type" "DESTROY";
+   match "cdev" "ums[0-9]+";
+
+   action "/etc/rc.d/moused stop $cdev";
 };
 
 # Firmware download into the ActiveWire board. After the firmware download is

Modified: head/usr.sbin/moused/moused.c
==
--- head/usr.sbin/moused/moused.c   Mon Sep 24 16:34:13 2012
(r240890)
+++ head/usr.sbin/moused/moused.c   Mon Sep 24 17:13:33 2012
(r240891)
@@ -408,6 +408,7 @@ static struct rodentparam {
 int cfd;   /* /dev/consolectl file descriptor */
 int mremsfd;   /* mouse remote server file descriptor */
 int mremcfd;   /* mouse remote client file descriptor */
+int is_removable;  /* set if device is removable, like USB */
 long clickthreshold;   /* double click speed in msec */
 long button2timeout;   /* 3 button emulation timeout */
 mousehw_t hw;  /* mouse device hardware information */
@@ -434,6 +435,7 @@ static struct rodentparam {
 .cfd = -1,
 .mremsfd = -1,
 .mremcfd = -1,
+.is_removable = 0,
 .clickthreshold = DFLT_CLICKTHRESHOLD,
 .button2timeout = DFLT_BUTTON2TIMEOUT,
 .accelx = 1.0,
@@ -570,7 +572,6 @@ main(int argc, char *argv[])
 int c;
 inti;
 intj;
-static int retry;
 
 for (i = 0; i < MOUSE_MAXBUTTON; ++i)
mstate[i] = &bstate[i];
@@ -876,10 +877,8 @@ main(int argc, char *argv[])
usage();
 }
 
-retry = 1;
-if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
-   retry = 5;
-}
+if (strncmp(rodent.portname, "/dev/ums", 8) == 0)
+   rodent.is_removable = 1;
 
 for (;;) {
if (setjmp(env) == 0) {
@@ -888,13 +887,8 @@ main(int argc, char *argv[])
signal(SIGQUIT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGUSR1, pause_mouse);
-   for (i = 0; i < retry; ++i) {
-   if (i > 0)
-   sleep(2);
-   rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
-   if (rodent.mfd != -1 || errno != ENOENT)
-   break;
-   }
+
+   rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
if (rodent.mfd == -1)
logerr(1, "unable to open %s", rodent.portname);
if (r_identify() == MOUSE_PROTO_UNKNOWN) {
@@ -944,6 +938,8 @@ main(int argc, char *argv[])
if (rodent.cfd != -1)
close(rodent.cfd);
rodent.mfd = rodent.cfd = -1;
+   if (rodent.is_removable)
+   exit(0);
 }
 /* NOT REACHED */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share

2012-09-24 Thread Garrett Cooper
On Mon, Sep 24, 2012 at 9:45 AM, Devin Teske  wrote:
>
> On Sep 23, 2012, at 8:13 PM, Doug Barton wrote:
>
>> On 09/22/2012 15:16, Devin Teske wrote:
>>> -if : 2> /dev/null > "$_PATH_DB"; then
>>> +if true 2> /dev/null > "$_PATH_DB"; then
>>>  cat <<-EOF > "$_PATH_DB"
>>>  $zoneinfo
>>>  EOF
>>
>> Is there a reason you're not using mktemp here?
>>
>
> Hi Doug,
>
> There is indeed a reason that mktemp is not used in this situation.
>
> 1. No possibility of a race condition, so little-to-no need for mktemp.
> 2. Using mktemp in a "file-truncate operation" would just be "wrong" (quoting 
> others).
>
> P.S. I posited your question to IRC to see what general consensus was and 
> many agreed that mktemp is not right in this situation.

Indeed. It's either going to pass (truncate the file) or fail. No
sense in using a temporary file here.
Thanks,
-Garrett
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share

2012-09-24 Thread Devin Teske

On Sep 23, 2012, at 8:13 PM, Doug Barton wrote:

> On 09/22/2012 15:16, Devin Teske wrote:
>> -if : 2> /dev/null > "$_PATH_DB"; then
>> +if true 2> /dev/null > "$_PATH_DB"; then
>>  cat <<-EOF > "$_PATH_DB"
>>  $zoneinfo
>>  EOF
> 
> Is there a reason you're not using mktemp here?
> 

Hi Doug,

There is indeed a reason that mktemp is not used in this situation.

1. No possibility of a race condition, so little-to-no need for mktemp.
2. Using mktemp in a "file-truncate operation" would just be "wrong" (quoting 
others).
-- 
Devin

P.S. I posited your question to IRC to see what general consensus was and many 
agreed that mktemp is not right in this situation.

_
The information contained in this message is proprietary and/or confidential. 
If you are not the intended recipient, please: (i) delete the message and all 
copies; (ii) do not disclose, distribute or use the message in any manner; and 
(iii) notify the sender immediately. In addition, please be aware that any 
message addressed to our domain is subject to archiving and review by persons 
other than the intended recipient. Thank you.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-09-24 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep 24 16:34:13 2012
New Revision: 240890
URL: http://svn.freebsd.org/changeset/base/240890

Log:
  DWC OTG host mode improvements:
   - Make HSIC selection dynamic.
   - Make LOW speed USB devices work through HIGH speed USB HUB.

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

Modified: head/sys/dev/usb/controller/dwc_otg.c
==
--- head/sys/dev/usb/controller/dwc_otg.c   Mon Sep 24 15:16:06 2012
(r240889)
+++ head/sys/dev/usb/controller/dwc_otg.c   Mon Sep 24 16:34:13 2012
(r240890)
@@ -101,12 +101,18 @@ __FBSDID("$FreeBSD$");
GINTMSK_HCHINTMSK | \
GINTSTS_PRTINT)
 
-#define DWC_OTG_USE_HSIC 0
+static int dwc_otg_use_hsic;
+
+static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG");
+
+SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, use_hsic, CTLFLAG_RD,
+&dwc_otg_use_hsic, 0, "DWC OTG uses HSIC interface");
+
+TUNABLE_INT("hw.usb.dwc_otg.use_hsic", &dwc_otg_use_hsic);
 
 #ifdef USB_DEBUG
 static int dwc_otg_debug;
 
-static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG");
 SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, debug, CTLFLAG_RW,
 &dwc_otg_debug, 0, "DWC OTG debug level");
 #endif
@@ -701,6 +707,15 @@ dwc_otg_host_setup_tx(struct dwc_otg_td 
}
}
 
+   /* treat NYET like NAK, if SPLIT transactions are used */
+   if (hcint & HCINT_NYET) {
+   if (td->hcsplt != 0) {
+   DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
+   hcint &= ~HCINT_NYET;
+   hcint |= HCINT_NAK;
+   }
+   }
+
/* channel must be disabled before we can complete the transfer */
 
if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -1041,6 +1056,15 @@ dwc_otg_host_data_rx(struct dwc_otg_td *
}
}
 
+   /* treat NYET like NAK, if SPLIT transactions are used */
+   if (hcint & HCINT_NYET) {
+   if (td->hcsplt != 0) {
+   DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
+   hcint &= ~HCINT_NYET;
+   hcint |= HCINT_NAK;
+   }
+   }
+
/* channel must be disabled before we can complete the transfer */
 
if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -1391,6 +1415,15 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
}
}
 
+   /* treat NYET like NAK, if SPLIT transactions are used */
+   if (hcint & HCINT_NYET) {
+   if (td->hcsplt != 0) {
+   DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
+   hcint &= ~HCINT_NYET;
+   hcint |= HCINT_NAK;
+   }
+   }
+
/* channel must be disabled before we can complete the transfer */
 
if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -2979,7 +3012,7 @@ dwc_otg_init(struct dwc_otg_softc *sc)
}
 
/* select HSIC or non-HSIC mode */
-   if (DWC_OTG_USE_HSIC) {
+   if (dwc_otg_use_hsic) {
DWC_OTG_WRITE_4(sc, DOTG_GUSBCFG,
GUSBCFG_PHYIF |
GUSBCFG_TRD_TIM_SET(5) | temp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240887 - head/share/man/man4

2012-09-24 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Mon Sep 24 15:02:31 2012
New Revision: 240887
URL: http://svn.freebsd.org/changeset/base/240887

Log:
  Minor man page cleanup -- fix grammar, markup fixes, and start each
  sentence on a new line.
  
  Approved by:  hrs (mentor)

Modified:
  head/share/man/man4/vale.4

Modified: head/share/man/man4/vale.4
==
--- head/share/man/man4/vale.4  Mon Sep 24 14:54:27 2012(r240886)
+++ head/share/man/man4/vale.4  Mon Sep 24 15:02:31 2012(r240887)
@@ -39,7 +39,7 @@
 .Sh DESCRIPTION
 .Nm
 is a feature of the
-.Nm netmap
+.Xr netmap 4
 module that implements multiple Virtual switches that can
 be used to interconnect netmap clients, including traffic
 sources and sinks, packet forwarders, userspace firewalls,
@@ -52,7 +52,7 @@ second (Mpps) per core with small frames
 with 1500 byte frames.
 .Sh OPERATION
 .Nm
-dynamically creates switches and ports as client connect
+dynamically creates switches and ports as clients connect
 to it using the
 .Xr netmap 4
 API.
@@ -68,7 +68,7 @@ indicates a specific switch (the colon i
 and
 .Pa port
 indicates a port within the switch.
-Bridge and ports names are arbitrary strings, the only
+Bridge and port names are arbitrary strings, the only
 constraint being that the full name must fit within 16
 characters.
 .Pp
@@ -77,13 +77,14 @@ See
 for details on the API.
 .Ss LIMITS
 .Nm
-currently supports up to 4 switches, 16 ports per switch,
-1024 buffers per port. These hard limits will be
+currently supports up to 4 switches, 16 ports per switch, with
+1024 buffers per port.
+These hard limits will be
 changed to sysctl variables in future releases.
 .Sh SYSCTL VARIABLES
 .Nm
 uses the following sysctl variables to control operation:
-.Bl -tag -width 12
+.Bl -tag -width dev.netmap.verbose
 .It dev.netmap.bridge
 The maximum number of packets processed internally
 in each iteration.
@@ -120,12 +121,12 @@ June 2012, http://info.iet.unipi.it/~lui
 .An -nosplit
 The
 .Nm
-switch  has been designed and implemented in 2012 by
+switch was designed and implemented in 2012 by
 .An Luigi Rizzo
 and
 .An Giuseppe Lettieri
 at the Universita` di Pisa.
 .Pp
 .Nm
-has been funded by the European Commission within FP7 Projects
+was funded by the European Commission within FP7 Projects
 CHANGE (257422) and OPENLAB (287581).
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r240868 - in head: cddl/lib/libzpool sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/modules/zfs

2012-09-24 Thread Dmitry Morozovsky
On Sun, 23 Sep 2012, Pawel Jakub Dawidek wrote:

> Author: pjd
> Date: Sun Sep 23 19:40:58 2012
> New Revision: 240868
> URL: http://svn.freebsd.org/changeset/base/240868
> 
> Log:
>   Add TRIM support.

[snip]

Yesss! ;-)

Thank you very much.

Based on your thoughts, how could you estimate stablility (and, therefore, 
MFCability) of this feature?


-- 
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: ma...@freebsd.org ]

*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***

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


Re: svn commit: r240850 - head/lib/libstand

2012-09-24 Thread Konstantin Belousov
On Mon, Sep 24, 2012 at 09:47:45AM +0100, David Chisnall wrote:
> On 23 Sep 2012, at 20:27, Garrett Cooper wrote:
> 
> >+1. free(3) should silently ignore NULL parameters passed into it.
> 
> Indeed.  The C standard's description for free() states that:
> 
> > If ptr is a null pointer, no action occurs.
> 
> This means that a standards-compilant compiler is entirely at liberty
> to elide these checks (not sure if GCC or LLVM does, but both have
> optimisation passes that optimise based on assumptions about standard
> library functions, although they may not run when compiled in a
> freestanding environment).
>
In this specific case your note is irrelevant, since libstand free()
is not a function at all. Would you look at the code, you note that
free() is the macro calling the function Free().

Indeed, in freestanding environment conforming compiler is denied to
specially process free().

> The only reasons for a NULL check before free() should be:
> 
> - Sanity checking (i.e. this pointer is never meant to be NULL, assert that 
> it isnt)
> - Recursive cleanup (don't dereference this pointer to clean up its elements 
> if it is NULL)

- Non-standard free() which does not understand NULL.

> 
> David


pgpIsue2sUd2q.pgp
Description: PGP signature


Re: svn commit: r240850 - head/lib/libstand

2012-09-24 Thread David Chisnall
On 23 Sep 2012, at 20:27, Garrett Cooper wrote:

>+1. free(3) should silently ignore NULL parameters passed into it.

Indeed.  The C standard's description for free() states that:

> If ptr is a null pointer, no action occurs.

This means that a standards-compilant compiler is entirely at liberty to elide 
these checks (not sure if GCC or LLVM does, but both have optimisation passes 
that optimise based on assumptions about standard library functions, although 
they may not run when compiled in a freestanding environment).

The only reasons for a NULL check before free() should be:

- Sanity checking (i.e. this pointer is never meant to be NULL, assert that it 
isnt)
- Recursive cleanup (don't dereference this pointer to clean up its elements if 
it is NULL)

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


svn commit: r240885 - head/share/man/man4

2012-09-24 Thread Alexander Motin
Author: mav
Date: Mon Sep 24 08:32:19 2012
New Revision: 240885
URL: http://svn.freebsd.org/changeset/base/240885

Log:
  Document ipv6 hook, present there for ages.
  
  Submitted by: Dmitry Luhtionov 

Modified:
  head/share/man/man4/ng_ppp.4

Modified: head/share/man/man4/ng_ppp.4
==
--- head/share/man/man4/ng_ppp.4Mon Sep 24 08:23:05 2012
(r240884)
+++ head/share/man/man4/ng_ppp.4Mon Sep 24 08:32:19 2012
(r240885)
@@ -35,7 +35,7 @@
 .\" $FreeBSD$
 .\" $Whistle: ng_ppp.8,v 1.3 1999/01/25 23:46:27 archie Exp $
 .\"
-.Dd December 28, 2006
+.Dd September 24, 2012
 .Dt NG_PPP 4
 .Os
 .Sh NAME
@@ -325,6 +325,8 @@ Connection to
 hook
 .It Dv inet
 IP packet data
+.It Dv ipv6
+IPv6 packet data
 .It Dv atalk
 AppleTalk packet data
 .It Dv ipx
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240884 - head/sys/dev/sound/pci/hda

2012-09-24 Thread Alexander Motin
Author: mav
Date: Mon Sep 24 08:23:05 2012
New Revision: 240884
URL: http://svn.freebsd.org/changeset/base/240884

Log:
  Fix panic caused by wrong pointer dereference, left after pin sense rewrite
  at r230551.
  
  Also while there, make sense polling use reported for each node separately
  instead of reporting accumulated total status.
  
  Submitted by: Barbara  (1)
  MFC after:3 days

Modified:
  head/sys/dev/sound/pci/hda/hdaa.c

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==
--- head/sys/dev/sound/pci/hda/hdaa.c   Mon Sep 24 06:42:20 2012
(r240883)
+++ head/sys/dev/sound/pci/hda/hdaa.c   Mon Sep 24 08:23:05 2012
(r240884)
@@ -627,7 +627,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev
(HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) 
& 1) != 0) {
device_printf(devinfo->dev,
"No presence detection support at nid %d\n",
-   as[i].pins[15]);
+   w->nid);
} else {
if (w->unsol < 0)
poll = 1;
@@ -636,7 +636,7 @@ hdaa_sense_init(struct hdaa_devinfo *dev
"Headphones redirection for "
"association %d nid=%d using %s.\n",
w->bindas, w->nid,
-   (poll != 0) ? "polling" :
+   (w->unsol < 0) ? "polling" :
"unsolicited responses");
);
};
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"