Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread mdf
On Tue, Feb 19, 2013 at 3:57 PM, Giorgos Keramidas keram...@freebsd.org wrote:
 Author: keramida (doc committer)
 Date: Tue Feb 19 23:57:39 2013
 New Revision: 247014
 URL: http://svnweb.freebsd.org/changeset/base/247014

 Log:
   Add a sample program that shows how a custom comparison function and
   qsort(3) can work together to sort an array of integers.

   PR: docs/176197
   Submitted by:   Fernando, fapesteguia at opensistemas.com
   Approved by:gjb (mentor)
   MFC after:  1 week

 Modified:
   head/lib/libc/stdlib/qsort.3

 Modified: head/lib/libc/stdlib/qsort.3
 ==
 --- head/lib/libc/stdlib/qsort.3Tue Feb 19 23:46:51 2013
 (r247013)
 +++ head/lib/libc/stdlib/qsort.3Tue Feb 19 23:57:39 2013
 (r247014)
 @@ -32,7 +32,7 @@
  .\ @(#)qsort.38.1 (Berkeley) 6/4/93
  .\ $FreeBSD$
  .\
 -.Dd September 30, 2003
 +.Dd February 20, 2013
  .Dt QSORT 3
  .Os
  .Sh NAME
 @@ -211,6 +211,52 @@ Previous versions of
  did not permit the comparison routine itself to call
  .Fn qsort 3 .
  This is no longer true.
 +.Sh EXAMPLES
 +A sample program that sorts an array of
 +.Vt int
 +values in place using
 +.Fn qsort ,
 +and then prints the sorted array to standard output is:
 +.Bd -literal
 +#include stdio.h
 +#include stdlib.h
 +#include string.h
 +
 +/*
 + * Custom comparison function that can compare 'int' values through pointers
 + * passed by qsort(3).
 + */
 +static int
 +int_compare(const void *p1, const void *p2)
 +{
 +int *left = (int *)p1;
 +int *right = (int *)p2;

These should be declared const int *.  And the cast shouldn't be
needed in C, since void * can be assigned to any other pointer type.

Cheers,
matthew

 +
 +if (*left  *right)
 +return (-1);
 +else if (*left  *right)
 +return (1);
 +else
 +return (0);
 +}
 +
 +/*
 + * Sort an array of 'int' values and print it to standard output.
 + */
 +int
 +main(void)
 +{
 +   int int_array[] = { 4, 5, 9, 3, 0, 1, 7, 2, 8, 6 };
 +   const int array_size = sizeof(int_array) / sizeof(int_array[0]);
 +   int k;
 +
 +   qsort(int_array, array_size, sizeof(int), int_compare);
 +   for (k = 0; k  array_size; k++)
 +printf( %d, int_array[k]);
 +printf(\\n);
 +exit(EXIT_SUCCESS);
 +}
 +.Ed
  .Sh ERRORS
  The
  .Fn heapsort
___
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: r247014 - head/lib/libc/stdlib

2013-02-20 Thread David Chisnall
On 20 Feb 2013, at 08:25, m...@freebsd.org wrote:

 These should be declared const int *.  And the cast shouldn't be
 needed in C, since void * can be assigned to any other pointer type.

In fact, the entire function body can be replaced with:

  return (*(int*)p1 - *(int*)p2);

qsort doesn't require that you return -1, 0, or 1, it requires you return 0, 
0, or 0.

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


Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Giorgos Keramidas
On 2013-02-20 09:32, David Chisnall thera...@freebsd.org wrote:
 On 20 Feb 2013, at 08:25, m...@freebsd.org wrote:
  These should be declared const int *.  And the cast shouldn't be
  needed in C, since void * can be assigned to any other pointer type.

 In fact, the entire function body can be replaced with:

   return (*(int*)p1 - *(int*)p2);

 qsort doesn't require that you return -1, 0, or 1, it requires you return 0, 
 0, or 0.

That's true.  Since we are trying to document the interface, I'd prefer
if we don't compress the comparison too much.  Would something like this
be ok too?

int
int_compare(const void *p1, const void *p2)
{
const int *left = p1;
const int *right = p2;

return (*left - *right);
}

___
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: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Stefan Farfeleder
On Wed, Feb 20, 2013 at 09:32:43AM +, David Chisnall wrote:
 On 20 Feb 2013, at 08:25, m...@freebsd.org wrote:
 
  These should be declared const int *.  And the cast shouldn't be
  needed in C, since void * can be assigned to any other pointer type.
 
 In fact, the entire function body can be replaced with:
 
   return (*(int*)p1 - *(int*)p2);
 
 qsort doesn't require that you return -1, 0, or 1, it requires you return 0, 
 0, or 0.

The subtraction might overflow and give wrong results. It won't for
these specific elements, but it would be a bad example, IMHO.

Stefan
___
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: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Giorgos Keramidas
On 2013-02-20 10:49, Stefan Farfeleder stef...@freebsd.org wrote:
On Wed, Feb 20, 2013 at 09:32:43AM +, David Chisnall wrote:
On 20 Feb 2013, at 08:25, m...@freebsd.org wrote:
 These should be declared const int *.  And the cast shouldn't be
 needed in C, since void * can be assigned to any other pointer type.

 In fact, the entire function body can be replaced with:

   return (*(int*)p1 - *(int*)p2);

 qsort doesn't require that you return -1, 0, or 1, it requires you return 
 0, 0, or 0.

 The subtraction might overflow and give wrong results. It won't for
 these specific elements, but it would be a bad example, IMHO.

That's a good point.  The Linux version of the manpage uses a string
comparison function as an example, *and* a subtraction, which then
requires a lengthy comment to explain what's happening and why all the
casts:

   static int
   cmpstringp(const void *p1, const void *p2)
   {
   /* The actual arguments to this function are pointers to
  pointers to char, but strcmp(3) arguments are pointers
  to char, hence the following cast plus dereference */

   return strcmp(* (char * const *) p1, * (char * const *) p2);
   }

Now I prefer sticking with the rather explicit and rather simple to
understand version:

/*
 * Custom comparison function that can compare 'int' values through 
pointers
 * passed by qsort(3).
 */
static int
int_compare(const void *p1, const void *p2)
{
const int *left = p1;
const int *right = p2;

if (*left  *right)
return (-1);
else if (*left  *right)
return (1);
else
return (0);
}

Even the comment is not stricly needed.  The code is simpler than the
version with the casts, especially if the casts have to be repeated to
avoid subtraction induced underflows.
___
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: r247025 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 11:14:55 2013
New Revision: 247025
URL: http://svnweb.freebsd.org/changeset/base/247025

Log:
  CFG_ERR, DATA_UNDERRUN and DELIM_UNDERRUN are all flags, rather than
  part of ts_status. Thus:
  
  * make sure we decode them from ts_flags, rather than ts_status;
  * make sure we decode them regardless of whether there's an error or not.
  
  This correctly exposes descriptor configuration errors, TX delimiter
  underruns and TX data underruns.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Feb 20 10:58:42 2013(r247024)
+++ head/sys/dev/ath/if_ath.c   Wed Feb 20 11:14:55 2013(r247025)
@@ -3581,17 +3581,24 @@ ath_tx_update_stats(struct ath_softc *sc
if (ts-ts_status  HAL_TXERR_TIMER_EXPIRED)
sc-sc_stats.ast_tx_timerexpired++;
 
-   if (ts-ts_status  HAL_TX_DATA_UNDERRUN)
-   sc-sc_stats.ast_tx_data_underrun++;
-   if (ts-ts_status  HAL_TX_DELIM_UNDERRUN)
-   sc-sc_stats.ast_tx_delim_underrun++;
-
if (bf-bf_m-m_flags  M_FF)
sc-sc_stats.ast_ff_txerr++;
}
/* XXX when is this valid? */
-   if (ts-ts_status  HAL_TX_DESC_CFG_ERR)
+   if (ts-ts_flags  HAL_TX_DESC_CFG_ERR)
sc-sc_stats.ast_tx_desccfgerr++;
+   /*
+* This can be valid for successful frame transmission!
+* If there's a TX FIFO underrun during aggregate transmission,
+* the MAC will pad the rest of the aggregate with delimiters.
+* If a BA is returned, the frame is marked as OK and it's up
+* to the TX completion code to notice which frames weren't
+* successfully transmitted.
+*/
+   if (ts-ts_flags  HAL_TX_DATA_UNDERRUN)
+   sc-sc_stats.ast_tx_data_underrun++;
+   if (ts-ts_flags  HAL_TX_DELIM_UNDERRUN)
+   sc-sc_stats.ast_tx_delim_underrun++;
 
sr = ts-ts_shortretry;
lr = ts-ts_longretry;
___
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: r247026 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 11:17:03 2013
New Revision: 247026
URL: http://svnweb.freebsd.org/changeset/base/247026

Log:
  Post interrupts in the ath alq trace.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Feb 20 11:14:55 2013(r247025)
+++ head/sys/dev/ath/if_ath.c   Wed Feb 20 11:17:03 2013(r247026)
@@ -1588,6 +1588,10 @@ 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);
ATH_KTR(sc, ATH_KTR_INTERRUPTS, 1, ath_intr: mask=0x%.8x, status);
+#ifdef ATH_DEBUG_ALQ
+   if_ath_alq_post_intr(sc-sc_alq, status, ah-ah_intrstate,
+   ah-ah_syncstate);
+#endif /* ATH_DEBUG_ALQ */
 #ifdef ATH_KTR_INTR_DEBUG
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,
___
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: r247027 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 11:17:29 2013
New Revision: 247027
URL: http://svnweb.freebsd.org/changeset/base/247027

Log:
  oops, tab!

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Feb 20 11:17:03 2013(r247026)
+++ head/sys/dev/ath/if_ath.c   Wed Feb 20 11:17:29 2013(r247027)
@@ -1591,7 +1591,7 @@ ath_intr(void *arg)
 #ifdef ATH_DEBUG_ALQ
if_ath_alq_post_intr(sc-sc_alq, status, ah-ah_intrstate,
ah-ah_syncstate);
-#endif /* ATH_DEBUG_ALQ */
+#endif /* ATH_DEBUG_ALQ */
 #ifdef ATH_KTR_INTR_DEBUG
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,
___
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: r247028 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 11:20:51 2013
New Revision: 247028
URL: http://svnweb.freebsd.org/changeset/base/247028

Log:
  Enable TX FIFO underrun interrupts.  This allows the TX FIFO threshold
  adjustment code to now run.
  
  Tested:
  
  * AR5416, STA
  
  TODO:
  
  * Much more thorough testing on the other chips, AR5210 - AR9287

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Feb 20 11:17:29 2013(r247027)
+++ head/sys/dev/ath/if_ath.c   Wed Feb 20 11:20:51 2013(r247028)
@@ -1983,6 +1983,7 @@ ath_init(void *arg)
 */
sc-sc_imask = HAL_INT_RX | HAL_INT_TX
  | HAL_INT_RXEOL | HAL_INT_RXORN
+ | HAL_INT_TXURN
  | HAL_INT_FATAL | HAL_INT_GLOBAL;
 
/*
___
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: r247029 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 11:22:44 2013
New Revision: 247029
URL: http://svnweb.freebsd.org/changeset/base/247029

Log:
  A couple of quick tidyups:
  
  * Delete this debugging print - I used it when debugging the initial
TX descriptor chaining code.  It now works, so let's toss it.
It just confuses people if they enable TX descriptor debugging as they
get two slightly different versions of the same descriptor.
  
  * Indenting.

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.cWed Feb 20 11:20:51 2013
(r247028)
+++ head/sys/dev/ath/if_ath_tx.cWed Feb 20 11:22:44 2013
(r247029)
@@ -473,11 +473,6 @@ ath_tx_chaindesclist(struct ath_softc *s
bf-bf_state.bfs_ndelim);
}
isFirstDesc = 0;
-#ifdef ATH_DEBUG
-   if (sc-sc_debug  ATH_DEBUG_XMIT)
-   ath_printtxbuf(sc, bf, bf-bf_state.bfs_tx_queue,
-   0, 0);
-#endif
bf-bf_lastds = (struct ath_desc *) ds;
 
/*
@@ -3154,7 +3149,7 @@ ath_tx_tid_filt_comp_aggr(struct ath_sof
 * Don't allow a filtered frame to live forever.
 */
if (bf-bf_state.bfs_retries  SWMAX_RETRIES) {
-   sc-sc_stats.ast_tx_swretrymax++;
+   sc-sc_stats.ast_tx_swretrymax++;
DPRINTF(sc, ATH_DEBUG_SW_TX_FILT,
%s: bf=%p, seqno=%d, exceeded retries\n,
__func__,
___
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: r247030 - head/sys/dev/ath/ath_hal/ar5416

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 11:24:11 2013
New Revision: 247030
URL: http://svnweb.freebsd.org/changeset/base/247030

Log:
  If any of the TX queues have underrun reporting enabled, enable
  HAL_INT_TXURN in the interrupt mask register.
  
  This should now allow for TXURN interrupts to be posted.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Wed Feb 20 11:22:44 
2013(r247029)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Wed Feb 20 11:24:11 
2013(r247030)
@@ -307,6 +307,8 @@ ar5416SetInterrupts(struct ath_hal *ah, 
mask |= AR_IMR_TXDESC;
if (ahp-ah_txEolInterruptMask)
mask |= AR_IMR_TXEOL;
+   if (ahp-ah_txUrnInterruptMask)
+   mask |= AR_IMR_TXURN;
}
if (ints  (HAL_INT_BMISC)) {
mask |= AR_IMR_BCNMISC;
___
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: r246033 - head/usr.bin/systat

2013-02-20 Thread Bruce Evans

On Tue, 29 Jan 2013, Andrey Zonov wrote:


On 1/28/13 6:51 PM, Bruce Evans wrote:

On Mon, 28 Jan 2013, Andrey Zonov wrote:


Log:
 - Show page faults requiring I/O on vmstat display.


No space is available there for showing it.


Yep, you're right.



+mvprintw(VMSTATROW, VMSTATCOL + 9, ioflt);


Putting it first unsorts the fields a bit and makes the diff large.

It is not documented in the man page.


Fixed in attached systat1.patch.txt.


OK.


...
buf is even more useless with zfs.  So are some of the other fields
...


I totally agree with you, 'buf' should go away from systat and top. I
removed 'buf' from systat.  Please review systat2.patch.txt.


I'd just like it to be replaced by a useful buf field someday.

Since the field in row 23 (starting at row 0) is now useful, omitting it
is not so good so I I agree with your patch removing the special code
to avoid printing it on 24-row terminals.


To count 'disk cache' we have to add new counter which should track all
pages with OBJT_VNODE type.  It doesn't look hard to implement this.  I
wrote utility [1] which allows me to inspect memory and find what is in
disk cache.


I think I would like at least 2 fields:
- total disk space mapped in VMIO buffers
- total disk space mapped in the buffer cache.


I also found that %ozfod is not useful for me and I removed it to not
mangle 'free' on 24-line terminals (systat3.patch.txt).


Certainly no space is available for the luxury of both ozfod and %ozfod.

That would also allow leaving buf and its 24-column support alone.  Only
3 fields would move relative to the old version (not just 1 field changing
for swapping %ozfod with the new field, since you want to put the new field
first).  Are the other fields in the best order?  I think they are.  If not,
it would be good to move some when adjusting all the row numbers.


Thanks for comments!

[1] https://github.com/z0nt/meminfo/


Bruce
___
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: r247033 - head/sys/dev/ath/ath_hal/ar5416

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Wed Feb 20 12:14:49 2013
New Revision: 247033
URL: http://svnweb.freebsd.org/changeset/base/247033

Log:
  Configure larger TX FIFO default and maximum level values.
  
  This has reduced the number of TX delimiter and data underruns when
  doing large UDP transfers (100mbit).
  
  This stops any HAL_INT_TXURN interrupts from occuring, which is a good
  sign!
  
  Obtained from:Qualcomm Atheros

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Feb 20 12:06:33 
2013(r247032)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Wed Feb 20 12:14:49 
2013(r247033)
@@ -241,8 +241,24 @@ ar5416InitState(struct ath_hal_5416 *ahp
/* Enable all ANI functions to begin with */
AH5416(ah)-ah_ani_function = 0x;
 
-/* Set overridable ANI methods */
-AH5212(ah)-ah_aniControl = ar5416AniControl;
+   /* Set overridable ANI methods */
+   AH5212(ah)-ah_aniControl = ar5416AniControl;
+
+   /* Default FIFO Trigger levels */
+#defineAR_FTRIG_512B   0x0080 // 5 bits total
+   /* AR9285/AR9271 need to use half the TX FIFOs */
+   if (AR_SREV_KITE(ah) || AR_SREV_9271(ah)) {
+   AH5212(ah)-ah_txTrigLev = (AR_FTRIG_256B  AR_FTRIG_S);
+   AH5212(ah)-ah_maxTxTrigLev = ((2048 / 64) - 1);
+   } else {
+   AH5212(ah)-ah_txTrigLev = (AR_FTRIG_512B  AR_FTRIG_S);
+   AH5212(ah)-ah_maxTxTrigLev = ((4096 / 64) - 1);
+   }
+   ath_hal_printf(ah, %s: trigLev=%d, maxTxTrigLev=%d\n,
+   __func__,
+   AH5212(ah)-ah_txTrigLev,
+   AH5212(ah)-ah_maxTxTrigLev);
+#undef AR_FTRIG_512B
 }
 
 uint32_t
___
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: r247034 - head/usr.sbin/mountd

2013-02-20 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Feb 20 12:40:26 2013
New Revision: 247034
URL: http://svnweb.freebsd.org/changeset/base/247034

Log:
  Check if the -sec option is given without an argument.
  
  PR:   bin/170413
  Submitted by: Andrey Simonenko si...@comsys.ntu-kpi.kiev.ua
  MFC after:1 week

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

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Wed Feb 20 12:14:49 2013
(r247033)
+++ head/usr.sbin/mountd/mountd.c   Wed Feb 20 12:40:26 2013
(r247034)
@@ -2235,7 +2235,7 @@ do_opt(char **cpp, char **endcpp, struct
ep-ex_indexfile = strdup(cpoptarg);
} else if (!strcmp(cpopt, quiet)) {
opt_flags |= OP_QUIET;
-   } else if (!strcmp(cpopt, sec)) {
+   } else if (cpoptarg  !strcmp(cpopt, sec)) {
if (parsesec(cpoptarg, ep))
return (1);
opt_flags |= OP_SEC;
___
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: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Dag-Erling Smørgrav
Author: des
Date: Wed Feb 20 12:59:21 2013
New Revision: 247035
URL: http://svnweb.freebsd.org/changeset/base/247035

Log:
  Reduce excessive nesting.

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

Modified: head/sys/dev/ixgbe/ixgbe_phy.c
==
--- head/sys/dev/ixgbe/ixgbe_phy.c  Wed Feb 20 12:40:26 2013
(r247034)
+++ head/sys/dev/ixgbe/ixgbe_phy.c  Wed Feb 20 12:59:21 2013
(r247035)
@@ -1194,25 +1194,23 @@ s32 ixgbe_identify_sfp_module_generic(st
/* Make sure we're a supported PHY type */
if (hw-phy.type == ixgbe_phy_sfp_intel) {
status = IXGBE_SUCCESS;
+   } else if (hw-allow_unsupported_sfp == TRUE) {
+   EWARN(hw, WARNING: Intel (R) Network 
+   Connections are quality tested 
+   using Intel (R) Ethernet Optics.
+Using untested modules is not 
+   supported and may cause unstable
+operation or damage to the 
+   module or the adapter. Intel 
+   Corporation is not responsible 
+   for any harm caused by using 
+   untested modules.\n, status);
+   status = IXGBE_SUCCESS;
} else {
-   if (hw-allow_unsupported_sfp == TRUE) {
-   EWARN(hw, WARNING: Intel (R) Network 
- Connections are quality tested 
- using Intel (R) Ethernet Optics.
-  Using untested modules is not 
- supported and may cause unstable
-  operation or damage to the 
- module or the adapter. Intel 
- Corporation is not responsible 
- for any harm caused by using 
- untested modules.\n, status);
-   status = IXGBE_SUCCESS;
-   } else {
-   DEBUGOUT(SFP+ module not supported\n);
-   hw-phy.type =
-   ixgbe_phy_sfp_unsupported;
-   status = IXGBE_ERR_SFP_NOT_SUPPORTED;
-   }
+   DEBUGOUT(SFP+ module not supported\n);
+   hw-phy.type =
+   ixgbe_phy_sfp_unsupported;
+   status = IXGBE_ERR_SFP_NOT_SUPPORTED;
}
} else {
status = IXGBE_SUCCESS;
___
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: r247036 - head/usr.bin/systat

2013-02-20 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Feb 20 13:47:05 2013
New Revision: 247036
URL: http://svnweb.freebsd.org/changeset/base/247036

Log:
  Add interface name filtering via 'match' cmd.
  Add 'pps' cmd for switching beetween interface packets/bytes statistics.
  
  Submitted by: vsevolod
  MFC after:2 weeks

Modified:
  head/usr.bin/systat/ifcmds.c
  head/usr.bin/systat/ifstat.c
  head/usr.bin/systat/systat.1

Modified: head/usr.bin/systat/ifcmds.c
==
--- head/usr.bin/systat/ifcmds.cWed Feb 20 12:59:21 2013
(r247035)
+++ head/usr.bin/systat/ifcmds.cWed Feb 20 13:47:05 2013
(r247036)
@@ -28,11 +28,19 @@
  * $FreeBSD$
  */
 
+#include sys/types.h
+
 #include systat.h
 #include extern.h
 #include convtbl.h
 
+#include stdlib.h
+#include string.h
+
 int curscale = SC_AUTO;
+char *matchline = NULL;
+int showpps = 0;
+int needsort = 0;
 
 int
 ifcmd(const char *cmd, const char *args)
@@ -48,6 +56,24 @@ ifcmd(const char *cmd, const char *args)
addstr(what scale? );
addstr(get_helplist());
}
-   }
+   } else if (prefix(cmd, match)) {
+   if (args != NULL  *args != '\0'  memcmp(args, *, 2) != 0) 
{
+   /* We got a valid match line */
+   if (matchline != NULL) {
+   free(matchline);
+   }
+   needsort = 1;
+   matchline = strdup(args);
+   } else {
+   /* Empty or * pattern, turn filtering off */
+   if (matchline != NULL) {
+   free(matchline);
+   }
+   needsort = 1;
+   matchline = NULL;
+   }
+   } else if (prefix(cmd, pps))
+   showpps = !showpps;
+
return (1);
 }

Modified: head/usr.bin/systat/ifstat.c
==
--- head/usr.bin/systat/ifstat.cWed Feb 20 12:59:21 2013
(r247035)
+++ head/usr.bin/systat/ifstat.cWed Feb 20 13:47:05 2013
(r247036)
@@ -38,6 +38,7 @@
 #include string.h
 #include err.h
 #include errno.h
+#include fnmatch.h
 
 #include systat.h
 #include extern.h
@@ -71,12 +72,22 @@ struct if_stat {
u_long  if_out_curtraffic;
u_long  if_in_traffic_peak;
u_long  if_out_traffic_peak;
+   u_long  if_in_curpps;
+   u_long  if_out_curpps;
+   u_long  if_in_pps_peak;
+   u_long  if_out_pps_peak;
u_int   if_row; /* Index into ifmib sysctl */
u_int   if_ypos;/* 0 if not being displayed */
u_int   display;
+   u_int   match;
 };
 
-extern  u_int curscale;
+extern  int curscale;
+extern  char *matchline;
+extern  int showpps;
+extern  int needsort;
+
+static  int needclear = 0;
 
 static  void  right_align_string(struct if_stat *);
 static  void  getifmibdata(const int, struct ifmibdata *);
@@ -96,34 +107,48 @@ static  u_int getifnum(void);
 #define STARTING_ROW   (TOPLINE + 1)
 #define ROW_SPACING(3)
 
-#define CLEAR_LINE(y, x)   do {\
-   wmove(wnd, y, x);   \
-   wclrtoeol(wnd); \
-} while (0)
-
-#define IN_col2(ifp-if_in_curtraffic)
-#define OUT_col2   (ifp-if_out_curtraffic)
-#define IN_col3(ifp-if_in_traffic_peak)
-#define OUT_col3   (ifp-if_out_traffic_peak)
-#define IN_col4(ifp-if_mib.ifmd_data.ifi_ibytes)
-#define OUT_col4   (ifp-if_mib.ifmd_data.ifi_obytes)
+#define IN_col2(showpps ? ifp-if_in_curpps : 
ifp-if_in_curtraffic)
+#define OUT_col2   (showpps ? ifp-if_out_curpps : ifp-if_out_curtraffic)
+#define IN_col3(showpps ? \
+   ifp-if_in_pps_peak : ifp-if_in_traffic_peak)
+#define OUT_col3   (showpps ? \
+   ifp-if_out_pps_peak : ifp-if_out_traffic_peak)
+#define IN_col4(showpps ? \
+   ifp-if_mib.ifmd_data.ifi_ipackets : ifp-if_mib.ifmd_data.ifi_ibytes)
+#define OUT_col4   (showpps ? \
+   ifp-if_mib.ifmd_data.ifi_opackets : ifp-if_mib.ifmd_data.ifi_obytes)
 
 #define EMPTY_COLUMN   
 #define CLEAR_COLUMN(y, x) mvprintw((y), (x), %20s, EMPTY_COLUMN);
 
 #define DOPUTRATE(c, r, d) do {\
CLEAR_COLUMN(r, c); \
-   mvprintw(r, (c), %10.3f %s%s  ,   \
-convert(d##_##c, curscale),\
-get_string(d##_##c, curscale), \
-/s); \
+   if 

svn commit: r247037 - head/usr.bin/systat

2013-02-20 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Feb 20 14:19:09 2013
New Revision: 247037
URL: http://svnweb.freebsd.org/changeset/base/247037

Log:
  Fix several new  old style issues.
  
  Pointed by:   ae, pluknet, zont
  MFC with: r247036

Modified:
  head/usr.bin/systat/ifcmds.c
  head/usr.bin/systat/ifstat.c
  head/usr.bin/systat/systat.1

Modified: head/usr.bin/systat/ifcmds.c
==
--- head/usr.bin/systat/ifcmds.cWed Feb 20 13:47:05 2013
(r247036)
+++ head/usr.bin/systat/ifcmds.cWed Feb 20 14:19:09 2013
(r247037)
@@ -59,16 +59,14 @@ ifcmd(const char *cmd, const char *args)
} else if (prefix(cmd, match)) {
if (args != NULL  *args != '\0'  memcmp(args, *, 2) != 0) 
{
/* We got a valid match line */
-   if (matchline != NULL) {
+   if (matchline != NULL)
free(matchline);
-   }
needsort = 1;
matchline = strdup(args);
} else {
/* Empty or * pattern, turn filtering off */
-   if (matchline != NULL) {
+   if (matchline != NULL)
free(matchline);
-   }
needsort = 1;
matchline = NULL;
}

Modified: head/usr.bin/systat/ifstat.c
==
--- head/usr.bin/systat/ifstat.cWed Feb 20 13:47:05 2013
(r247036)
+++ head/usr.bin/systat/ifstat.cWed Feb 20 14:19:09 2013
(r247037)
@@ -230,7 +230,7 @@ initifstat(void)
 
n = getifnum();
if (n = 0)
-   return -1;
+   return (-1);
 
SLIST_INIT(curlist);
 
@@ -254,7 +254,7 @@ initifstat(void)
 
sort_interface_list();
 
-   return 1;
+   return (1);
 }
 
 void
@@ -372,9 +372,9 @@ check_match(const char *ifname) 
char *p = matchline, *c, t;
int match = 0, mlen;

-   if (matchline == NULL) {
-   return 0;
-   }
+   if (matchline == NULL)
+   return (0);
+
/* Strip leading whitespaces */
while (*p == ' ')
p ++;
@@ -387,7 +387,7 @@ check_match(const char *ifname) 
*p = '\0';
if (fnmatch(c, ifname, FNM_CASEFOLD) == 0) {
*p = t;
-   return 1;
+   return (1);
}
*p = t;
c = p + strspn(p,  ;,);
@@ -397,7 +397,7 @@ check_match(const char *ifname) 
}
}
 
-   return match;
+   return (match);
 }
 
 /*
@@ -447,7 +447,7 @@ getifnum(void)
if (sysctl(name, 5, (void *)data, (size_t *)datalen, (void *)NULL,
(size_t)0) != 0)
IFSTAT_ERR(1, sysctl error);
-   return data;
+   return (data);
 }
 
 static void
@@ -485,5 +485,5 @@ cmdifstat(const char *cmd, const char *a
}
}
 
-   return retval;
+   return (retval);
 }

Modified: head/usr.bin/systat/systat.1
==
--- head/usr.bin/systat/systat.1Wed Feb 20 13:47:05 2013
(r247036)
+++ head/usr.bin/systat/systat.1Wed Feb 20 14:19:09 2013
(r247037)
@@ -28,7 +28,7 @@
 .\@(#)systat.18.2 (Berkeley) 12/30/93
 .\ $FreeBSD$
 .\
-.Dd September 17, 2012
+.Dd February 20, 2013
 .Dt SYSTAT 1
 .Os
 .Sh NAME
___
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: r247041 - head/usr.sbin/makefs

2013-02-20 Thread Brooks Davis
Author: brooks
Date: Wed Feb 20 15:18:42 2013
New Revision: 247041
URL: http://svnweb.freebsd.org/changeset/base/247041

Log:
  Add a -D flag that causes duplicate entries in an mtree manifest to be
  treated as warnings rather than errors.
  
  Reviewed by:  marcel
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c
  head/usr.sbin/makefs/makefs.h
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/makefs.8
==
--- head/usr.sbin/makefs/makefs.8   Wed Feb 20 14:26:51 2013
(r247040)
+++ head/usr.sbin/makefs/makefs.8   Wed Feb 20 15:18:42 2013
(r247041)
@@ -43,7 +43,7 @@
 .Nd create a file system image from a directory tree or a mtree manifest
 .Sh SYNOPSIS
 .Nm
-.Op Fl px
+.Op Fl Dpx
 .Op Fl B Ar byte-order
 .Op Fl b Ar free-blocks
 .Op Fl d Ar debug-mask
@@ -106,6 +106,8 @@ An optional
 suffix may be provided to indicate that
 .Ar free-blocks
 indicates a percentage of the calculated image size.
+.It Fl D
+Treat duplicate paths in an mtree manifest as warnings not error.
 .It Fl d Ar debug-mask
 Enable various levels of debugging, depending upon which bits are
 set in

Modified: head/usr.sbin/makefs/makefs.c
==
--- head/usr.sbin/makefs/makefs.c   Wed Feb 20 14:26:51 2013
(r247040)
+++ head/usr.sbin/makefs/makefs.c   Wed Feb 20 15:18:42 2013
(r247041)
@@ -73,6 +73,7 @@ static fstype_t fstypes[] = {
 };
 
 u_int  debug;
+intdupsok;
 struct timespecstart_time;
 
 static fstype_t *get_fstype(const char *);
@@ -112,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
 
-   while ((ch = getopt(argc, argv, B:b:d:f:F:M:m:N:o:ps:S:t:x)) != -1) {
+   while ((ch = getopt(argc, argv, B:b:Dd:f:F:M:m:N:o:ps:S:t:x)) != -1) {
switch (ch) {
 
case 'B':
@@ -148,6 +149,10 @@ main(int argc, char *argv[])
}
break;
 
+   case 'D':
+   dupsok = 1;
+   break;
+
case 'd':
debug = strtoll(optarg, NULL, 0);
break;

Modified: head/usr.sbin/makefs/makefs.h
==
--- head/usr.sbin/makefs/makefs.h   Wed Feb 20 14:26:51 2013
(r247040)
+++ head/usr.sbin/makefs/makefs.h   Wed Feb 20 15:18:42 2013
(r247041)
@@ -169,6 +169,7 @@ voidcd9660_makefs(const char *, const 
 
 
 extern u_int   debug;
+extern int dupsok;
 extern struct timespec start_time;
 
 /*

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cWed Feb 20 14:26:51 2013
(r247040)
+++ head/usr.sbin/makefs/mtree.cWed Feb 20 15:18:42 2013
(r247041)
@@ -881,8 +881,14 @@ read_mtree_spec1(FILE *fp, bool def, con
 
if (strcmp(name, node-name) == 0) {
if (def == true) {
-   mtree_error(duplicate definition of %s,
-   name);
+   if (!dupsok)
+   mtree_error(
+   duplicate definition of %s,
+   name);
+   else
+   mtree_warning(
+   duplicate definition of %s,
+   name);
return (0);
}
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247042 - head/usr.sbin/makefs

2013-02-20 Thread Brooks Davis
Author: brooks
Date: Wed Feb 20 15:25:40 2013
New Revision: 247042
URL: http://svnweb.freebsd.org/changeset/base/247042

Log:
  Fix the -N option in manifest mode by using pwcache(3).  This also
  speeds up image creation appreciably.
  
  Reviewed by:  marcel
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cWed Feb 20 15:18:42 2013
(r247041)
+++ head/usr.sbin/makefs/mtree.cWed Feb 20 15:25:40 2013
(r247042)
@@ -508,8 +508,8 @@ read_mtree_keywords(FILE *fp, fsnode *no
 {
char keyword[PATH_MAX];
char *name, *p, *value;
-   struct group *grent;
-   struct passwd *pwent;
+   gid_t gid;
+   uid_t uid;
struct stat *st, sb;
intmax_t num;
u_long flset, flclr;
@@ -585,11 +585,10 @@ read_mtree_keywords(FILE *fp, fsnode *no
error = ENOATTR;
break;
}
-   grent = getgrnam(value);
-   if (grent != NULL)
-   st-st_gid = grent-gr_gid;
+   if (gid_from_group(value, gid) == 0)
+   st-st_gid = gid;
else
-   error = errno;
+   error = EINVAL;
} else
error = ENOSYS;
break;
@@ -698,11 +697,10 @@ read_mtree_keywords(FILE *fp, fsnode *no
error = ENOATTR;
break;
}
-   pwent = getpwnam(value);
-   if (pwent != NULL)
-   st-st_uid = pwent-pw_uid;
+   if (uid_from_user(value, uid) == 0)
+   st-st_uid = uid;
else
-   error = errno;
+   error = EINVAL;
} else
error = ENOSYS;
break;
___
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: r247043 - head/usr.sbin/makefs

2013-02-20 Thread Brooks Davis
Author: brooks
Date: Wed Feb 20 15:28:40 2013
New Revision: 247043
URL: http://svnweb.freebsd.org/changeset/base/247043

Log:
  Allow '.' components in manifest paths.  They are always the first
  component of mtree -C and install -M output and are easily skipped.
  
  Reviewed by:  marcel
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cWed Feb 20 15:25:40 2013
(r247042)
+++ head/usr.sbin/makefs/mtree.cWed Feb 20 15:28:40 2013
(r247043)
@@ -974,15 +974,15 @@ read_mtree_spec(FILE *fp)
do {
*cp++ = '\0';
 
-   /* Disallow '.' and '..' as components. */
-   if (IS_DOT(pathspec) || IS_DOTDOT(pathspec)) {
-   mtree_error(absolute path cannot contain . 
-   or .. components);
+   /* Disallow '..' as a component. */
+   if (IS_DOTDOT(pathspec)) {
+   mtree_error(absolute path cannot contain 
+   .. component);
goto out;
}
 
-   /* Ignore multiple adjacent slashes. */
-   if (pathspec[0] != '\0')
+   /* Ignore multiple adjacent slashes and '.'. */
+   if (pathspec[0] != '\0'  !IS_DOT(pathspec))
error = read_mtree_spec1(fp, false, pathspec);
memmove(pathspec, cp, strlen(cp) + 1);
cp = strchr(pathspec, '/');
___
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: r247044 - head/sys/netinet

2013-02-20 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Feb 20 15:44:40 2013
New Revision: 247044
URL: http://svnweb.freebsd.org/changeset/base/247044

Log:
  ip_savecontrol() style fixes. No functional changes.
  - fix indentation
  - put the operator at the end of the line for long statements
  - remove spaces between the type and the variable in a cast
  - remove excessive parentheses
  
  Tested by:md5

Modified:
  head/sys/netinet/ip_input.c

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Wed Feb 20 15:28:40 2013(r247043)
+++ head/sys/netinet/ip_input.c Wed Feb 20 15:44:40 2013(r247044)
@@ -1592,8 +1592,8 @@ ip_savecontrol(struct inpcb *inp, struct
 
bintime(bt);
if (inp-inp_socket-so_options  SO_BINTIME) {
-   *mp = sbcreatecontrol((caddr_t) bt, sizeof(bt),
-   SCM_BINTIME, SOL_SOCKET);
+   *mp = sbcreatecontrol((caddr_t)bt, sizeof(bt),
+   SCM_BINTIME, SOL_SOCKET);
if (*mp)
mp = (*mp)-m_next;
}
@@ -1601,20 +1601,20 @@ ip_savecontrol(struct inpcb *inp, struct
struct timeval tv;
 
bintime2timeval(bt, tv);
-   *mp = sbcreatecontrol((caddr_t) tv, sizeof(tv),
-   SCM_TIMESTAMP, SOL_SOCKET);
+   *mp = sbcreatecontrol((caddr_t)tv, sizeof(tv),
+   SCM_TIMESTAMP, SOL_SOCKET);
if (*mp)
mp = (*mp)-m_next;
}
}
if (inp-inp_flags  INP_RECVDSTADDR) {
-   *mp = sbcreatecontrol((caddr_t) ip-ip_dst,
+   *mp = sbcreatecontrol((caddr_t)ip-ip_dst,
sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP);
if (*mp)
mp = (*mp)-m_next;
}
if (inp-inp_flags  INP_RECVTTL) {
-   *mp = sbcreatecontrol((caddr_t) ip-ip_ttl,
+   *mp = sbcreatecontrol((caddr_t)ip-ip_ttl,
sizeof(u_char), IP_RECVTTL, IPPROTO_IP);
if (*mp)
mp = (*mp)-m_next;
@@ -1626,14 +1626,14 @@ ip_savecontrol(struct inpcb *inp, struct
 */
/* options were tossed already */
if (inp-inp_flags  INP_RECVOPTS) {
-   *mp = sbcreatecontrol((caddr_t) opts_deleted_above,
+   *mp = sbcreatecontrol((caddr_t)opts_deleted_above,
sizeof(struct in_addr), IP_RECVOPTS, IPPROTO_IP);
if (*mp)
mp = (*mp)-m_next;
}
/* ip_srcroute doesn't do what we want here, need to fix */
if (inp-inp_flags  INP_RECVRETOPTS) {
-   *mp = sbcreatecontrol((caddr_t) ip_srcroute(m),
+   *mp = sbcreatecontrol((caddr_t)ip_srcroute(m),
sizeof(struct in_addr), IP_RECVRETOPTS, IPPROTO_IP);
if (*mp)
mp = (*mp)-m_next;
@@ -1648,32 +1648,32 @@ ip_savecontrol(struct inpcb *inp, struct
struct sockaddr_dl *sdp;
struct sockaddr_dl *sdl2 = sdlbuf.sdl;
 
-   if (((ifp = m-m_pkthdr.rcvif)) 
-( ifp-if_index  (ifp-if_index = V_if_index))) {
+   if ((ifp = m-m_pkthdr.rcvif) 
+   ifp-if_index  ifp-if_index = V_if_index) {
sdp = (struct sockaddr_dl *)ifp-if_addr-ifa_addr;
/*
 * Change our mind and don't try copy.
 */
-   if ((sdp-sdl_family != AF_LINK)
-   || (sdp-sdl_len  sizeof(sdlbuf))) {
+   if (sdp-sdl_family != AF_LINK ||
+   sdp-sdl_len  sizeof(sdlbuf)) {
goto makedummy;
}
bcopy(sdp, sdl2, sdp-sdl_len);
} else {
 makedummy: 
-   sdl2-sdl_len
-   = offsetof(struct sockaddr_dl, sdl_data[0]);
+   sdl2-sdl_len =
+   offsetof(struct sockaddr_dl, sdl_data[0]);
sdl2-sdl_family = AF_LINK;
sdl2-sdl_index = 0;
sdl2-sdl_nlen = sdl2-sdl_alen = sdl2-sdl_slen = 0;
}
-   *mp = sbcreatecontrol((caddr_t) sdl2, sdl2-sdl_len,
-   IP_RECVIF, IPPROTO_IP);
+   *mp = sbcreatecontrol((caddr_t)sdl2, sdl2-sdl_len,
+   IP_RECVIF, IPPROTO_IP);
if (*mp)
mp = (*mp)-m_next;
}
if (inp-inp_flags  INP_RECVTOS) {
-   *mp = sbcreatecontrol((caddr_t) ip-ip_tos,
+   *mp = 

Re: svn commit: r247012 - in head/contrib/binutils: gas/config opcodes

2013-02-20 Thread John Baldwin
On Tuesday, February 19, 2013 4:35:17 pm John-Mark Gurney wrote:
 Author: jmg
 Date: Tue Feb 19 21:35:17 2013
 New Revision: 247012
 URL: http://svnweb.freebsd.org/changeset/base/247012
 
 Log:
   add support for AES and PCLMULQDQ instructions to binutils...
   
   Thanks to Mike Belopuhov for the pointer to the OpenBSD patch, though
   OpenBSD's gcc is very different that it only helped w/ where to modify,
   not how...  Thanks to jhb for some early reviews...
   
   Reviewed by:imp, kib
   MFC after:  1 month

Nice!  Sorry I wasn't able to review this in more detail. :(  Can you also add 
support for these instructions to ddb's disassembler?

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


svn commit: r247045 - head/sys/boot/fdt

2013-02-20 Thread Tim Kientzle
Author: kientzle
Date: Wed Feb 20 16:32:38 2013
New Revision: 247045
URL: http://svnweb.freebsd.org/changeset/base/247045

Log:
  Fix fdt addr to accept literal addresses rather than va offsets.
  When initializing the fdt, query U-Boot as well.
  
  With this change, it is now feasible to have U-Boot load
  the FDT, ubldr will pull it from U-Boot and hand it to the
  kernel.

Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Wed Feb 20 15:44:40 2013
(r247044)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Wed Feb 20 16:32:38 2013
(r247045)
@@ -235,26 +235,47 @@ fdt_load_dtb(vm_offset_t va)
 }
 
 static int
-fdt_setup_fdtp()
+fdt_load_dtb_addr(struct fdt_header *header)
 {
struct preloaded_file *bfp;
-   vm_offset_t va;
 
-   bfp = file_findfile(NULL, dtb);
+   bfp = mem_load_raw(dtb, memory.dtb, header, fdt_totalsize(header));
if (bfp == NULL) {
-   if ((va = fdt_find_static_dtb()) == 0) {
-   command_errmsg = no device tree blob found!;
-   return (1);
-   }
-   } else {
-   /* Dynamic blob has precedence over static. */
-   va = bfp-f_addr;
+   command_errmsg = unable to copy DTB into module directory;
+   return (1);
}
+   return fdt_load_dtb(bfp-f_addr);
+}
 
-   if (fdt_load_dtb(va) != 0)
-   return (1);
-   
-   return (0);
+static int
+fdt_setup_fdtp()
+{
+  struct preloaded_file *bfp;
+  struct fdt_header *hdr;
+  const char *s, *p;
+  vm_offset_t va;
+
+  if ((bfp = file_findfile(NULL, dtb)) != NULL) {
+ printf(Using DTB from loaded file.\n);
+ return fdt_load_dtb(bfp-f_addr);
+  } 
+
+  s = ub_env_get(fdtaddr);
+  if (s != NULL  *s != '\0') {
+ hdr = (struct fdt_header *)strtoul(s, p, 16);
+ if (*p == '\0') {
+ printf(Using DTB provided by U-Boot.\n);
+ return fdt_load_dtb_addr(hdr);
+ }
+  }
+
+  if ((va = fdt_find_static_dtb()) != 0) {
+ printf(Using DTB compiled into kernel.\n);
+ return (fdt_load_dtb(va));
+  }
+
+  command_errmsg = no device tree blob found!;
+  return (1);
 }
 
 #define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \
@@ -789,8 +810,8 @@ command_fdt_internal(int argc, char *arg
 static int
 fdt_cmd_addr(int argc, char *argv[])
 {
-   vm_offset_t va;
-   char *addr, *cp;
+   struct fdt_header *hdr;
+   const char *addr, *cp;
 
if (argc  2)
addr = argv[2];
@@ -799,13 +820,13 @@ fdt_cmd_addr(int argc, char *argv[])
return (CMD_ERROR);
}
 
-   va = strtol(addr, cp, 0);
+   hdr = (struct fdt_header *)strtoul(addr, cp, 0);
if (cp == addr) {
sprintf(command_errbuf, Invalid address: %s, addr);
return (CMD_ERROR);
}
 
-   if (fdt_load_dtb(va) != 0)
+   if (fdt_load_dtb_addr(hdr) != 0)
return (CMD_ERROR);
 
return (CMD_OK);
@@ -1484,6 +1505,7 @@ fdt_cmd_mkprop(int argc, char *argv[])
if (fdt_modprop(o, propname, value, 1))
return (CMD_ERROR);
 
+   COPYIN(fdtp, fdtp_va, fdtp_size);
return (CMD_OK);
 }
 
___
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: r247046 - in head/sys/arm: arm at91 econa include s3c2xx0 sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa

2013-02-20 Thread Alan Cox
Author: alc
Date: Wed Feb 20 16:48:52 2013
New Revision: 247046
URL: http://svnweb.freebsd.org/changeset/base/247046

Log:
  Initialize vm_max_kernel_address on non-FDT platforms.  (This should have
  been included in r246926.)
  
  The second parameter to pmap_bootstrap() is redundant.  Eliminate it.
  
  Reviewed by:  andrew

Modified:
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/arm/pmap.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/include/pmap.h
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/sa11x0/assabet_machdep.c
  head/sys/arm/xscale/i80321/ep80219_machdep.c
  head/sys/arm/xscale/i80321/iq31244_machdep.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/pxa/pxa_machdep.c

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Wed Feb 20 16:32:38 2013(r247045)
+++ head/sys/arm/arm/machdep.c  Wed Feb 20 16:48:52 2013(r247046)
@@ -1476,7 +1476,7 @@ initarm(struct arm_boot_params *abp)
arm_intrnames_init();
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
arm_dump_avail_init(memsize, sizeof(dump_avail) / 
sizeof(dump_avail[0]));
-   pmap_bootstrap(freemempos, vm_max_kernel_address, kernel_l1pt);
+   pmap_bootstrap(freemempos, kernel_l1pt);
msgbufp = (void *)msgbufpv.pv_va;
msgbufinit(msgbufp, msgbufsize);
mutex_init();

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Wed Feb 20 16:32:38 2013(r247045)
+++ head/sys/arm/arm/pmap-v6.c  Wed Feb 20 16:48:52 2013(r247046)
@@ -1538,7 +1538,7 @@ pmap_alloc_specials(vm_offset_t *availp,
 #define PMAP_STATIC_L2_SIZE 16
 
 void
-pmap_bootstrap(vm_offset_t firstaddr, vm_offset_t lastaddr, struct pv_addr 
*l1pt)
+pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
 {
static struct l1_ttable static_l1;
static struct l2_dtable static_l2[PMAP_STATIC_L2_SIZE];
@@ -1554,7 +1554,7 @@ pmap_bootstrap(vm_offset_t firstaddr, vm
int l1idx, l2idx, l2next = 0;
 
PDEBUG(1, printf(firstaddr = %08x, lastaddr = %08x\n,
-   firstaddr, lastaddr));
+   firstaddr, vm_max_kernel_address));
 
virtual_avail = firstaddr;
kernel_pmap-pm_l1 = l1;
@@ -1670,7 +1670,8 @@ pmap_bootstrap(vm_offset_t firstaddr, vm
pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)csrc_pte);
pmap_alloc_specials(virtual_avail, 1, cdstp, cdst_pte);
pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)cdst_pte);
-   size = ((lastaddr - pmap_curmaxkvaddr) + L1_S_OFFSET) / L1_S_SIZE;
+   size = ((vm_max_kernel_address - pmap_curmaxkvaddr) + L1_S_OFFSET) /
+   L1_S_SIZE;
pmap_alloc_specials(virtual_avail,
round_page(size * L2_TABLE_SIZE_REAL) / PAGE_SIZE,
pmap_kernel_l2ptp_kva, NULL);
@@ -1692,9 +1693,9 @@ pmap_bootstrap(vm_offset_t firstaddr, vm
cpu_l2cache_wbinv_all();
 
virtual_avail = round_page(virtual_avail);
-   virtual_end = lastaddr;
+   virtual_end = vm_max_kernel_address;
kernel_vm_end = pmap_curmaxkvaddr;
-   arm_nocache_startaddr = lastaddr;
+   arm_nocache_startaddr = vm_max_kernel_address;
mtx_init(cmtx, TMP mappings mtx, NULL, MTX_DEF);
 
pmap_set_pcb_pagedir(kernel_pmap, thread0.td_pcb);

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Wed Feb 20 16:32:38 2013(r247045)
+++ head/sys/arm/arm/pmap.c Wed Feb 20 16:48:52 2013(r247046)
@@ -2254,7 +2254,7 @@ extern struct mtx smallalloc_mtx;
 #endif
 
 void
-pmap_bootstrap(vm_offset_t firstaddr, vm_offset_t lastaddr, struct pv_addr 
*l1pt)
+pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
 {
static struct l1_ttable static_l1;
static struct l2_dtable static_l2[PMAP_STATIC_L2_SIZE];
@@ -2270,7 +2270,7 @@ pmap_bootstrap(vm_offset_t firstaddr, vm
int l1idx, l2idx, l2next = 0;
 
PDEBUG(1, printf(firstaddr = %08x, lastaddr = %08x\n,
-   firstaddr, lastaddr));
+   firstaddr, vm_max_kernel_address));

virtual_avail = firstaddr;
kernel_pmap-pm_l1 = l1;
@@ -2388,7 +2388,8 @@ pmap_bootstrap(vm_offset_t firstaddr, vm
pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)csrc_pte);
pmap_alloc_specials(virtual_avail, 1, cdstp, cdst_pte);
pmap_set_pt_cache_mode(kernel_l1pt, (vm_offset_t)cdst_pte);
-   size = ((lastaddr - pmap_curmaxkvaddr) + L1_S_OFFSET) / L1_S_SIZE;
+   size = ((vm_max_kernel_address - pmap_curmaxkvaddr) + L1_S_OFFSET) /
+   L1_S_SIZE;
pmap_alloc_specials(virtual_avail,
round_page(size * 

svn commit: r247047 - in head/sys: amd64/include boot/userboot/userboot i386/include x86/include

2013-02-20 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 20 17:39:52 2013
New Revision: 247047
URL: http://svnweb.freebsd.org/changeset/base/247047

Log:
  Convert machine/elf.h, machine/frame.h, machine/sigframe.h,
  machine/signal.h and machine/ucontext.h into common x86 includes,
  copying from amd64 and merging with i386.
  
  Kernel-only compat definitions are kept in the i386/include/sigframe.h
  and i386/include/signal.h, to reduce amd64 kernel namespace pollution.
  The amd64 compat uses its own definitions so far.
  
  The _MACHINE_ELF_WANT_32BIT definition is to allow the
  sys/boot/userboot/userboot/elf32_freebsd.c to use i386 ELF definitions
  on the amd64 compile host.  The same hack could be usefully abused by
  other code too.

Added:
  head/sys/x86/include/elf.h
 - copied, changed from r247045, head/sys/amd64/include/elf.h
  head/sys/x86/include/frame.h
 - copied, changed from r247045, head/sys/amd64/include/frame.h
  head/sys/x86/include/sigframe.h
 - copied, changed from r247045, head/sys/amd64/include/sigframe.h
  head/sys/x86/include/signal.h
 - copied, changed from r247045, head/sys/amd64/include/signal.h
  head/sys/x86/include/ucontext.h
 - copied, changed from r247045, head/sys/amd64/include/ucontext.h
Modified:
  head/sys/amd64/include/elf.h
  head/sys/amd64/include/frame.h
  head/sys/amd64/include/sigframe.h
  head/sys/amd64/include/signal.h
  head/sys/amd64/include/ucontext.h
  head/sys/boot/userboot/userboot/elf32_freebsd.c
  head/sys/i386/include/elf.h
  head/sys/i386/include/frame.h
  head/sys/i386/include/sigframe.h
  head/sys/i386/include/signal.h
  head/sys/i386/include/ucontext.h

Modified: head/sys/amd64/include/elf.h
==
--- head/sys/amd64/include/elf.hWed Feb 20 16:48:52 2013
(r247046)
+++ head/sys/amd64/include/elf.hWed Feb 20 17:39:52 2013
(r247047)
@@ -1,124 +1,6 @@
 /*-
- * Copyright (c) 1996-1997 John D. Polstra.
- * 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$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_ELF_H_
-#define_MACHINE_ELF_H_ 1
-
-/*
- * ELF definitions for the AMD64 architecture.
- */
-
-
-#ifndef __ELF_WORD_SIZE
-#define__ELF_WORD_SIZE 64  /* Used by sys/elf_generic.h */
-#endif
-#include sys/elf32.h /* Definitions common to all 32 bit architectures. */
-#include sys/elf64.h /* Definitions common to all 64 bit architectures. */
-#include sys/elf_generic.h
-
-#defineELF_ARCHEM_X86_64
-#defineELF_ARCH32  EM_386
-
-#defineELF_MACHINE_OK(x) ((x) == EM_X86_64)
-
-/*
- * Auxiliary vector entries for passing information to the interpreter.
- *
- * The i386 supplement to the SVR4 ABI specification names this auxv_t,
- * but POSIX lays claim to all symbols ending with _t.
- */
-typedef struct {   /* Auxiliary vector entry on initial stack */
-   int a_type; /* Entry type. */
-   union {
-   int a_val;  /* Integer value. */
-   } a_un;
-} Elf32_Auxinfo;
-
-
-typedef struct {   /* Auxiliary vector entry on initial stack */
-   longa_type; /* Entry type. */
-   union {
-   longa_val;  /* Integer value. */
-   void*a_ptr; /* Address. */
-   void(*a_fcn)(void); /* Function pointer (not used). */
-   } a_un;
-} Elf64_Auxinfo;
-
-__ElfType(Auxinfo);
-
-/* Values for a_type. */
-#defineAT_NULL 0   /* Terminates the vector. */
-#defineAT_IGNORE   1   /* Ignored entry. */
-#defineAT_EXECFD   2   /* File 

svn commit: r247048 - head/cddl/contrib/opensolaris/cmd/dtrace

2013-02-20 Thread Justin T. Gibbs
Author: gibbs
Date: Wed Feb 20 17:46:38 2013
New Revision: 247048
URL: http://svnweb.freebsd.org/changeset/base/247048

Log:
  Orphaned processes that are being traced are killed by the
  kernel.  Properly restore, continue, and detach from processes
  being DTraced when DTrace exits with an error so the program
  being inspected is not terminated.
  
  cddl/contrib/opensolaris/cmd/dtrace/dtrace.c:
In fatal(), the generic error handler, close the DTrace
handle as is done in the probe/script error handler
dfatal().  fatal() can be invoked after DTrace attaches
to processes (e.g. a script specified by command line
argument can't be found) and closing the handle will
release them.
  
  Submitted by: Spectra Logic Corporation
  Reviewed by:  rpaulo, gnn

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c   Wed Feb 20 17:39:52 
2013(r247047)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c   Wed Feb 20 17:46:38 
2013(r247048)
@@ -195,6 +195,13 @@ fatal(const char *fmt, ...)
verror(fmt, ap);
va_end(ap);
 
+   /*
+* Close the DTrace handle to ensure that any controlled processes are
+* correctly restored and continued.
+*/
+   if (g_dtp)
+   dtrace_close(g_dtp);
+
exit(E_ERROR);
 }
 
___
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: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Jack Vogel
OK, this change must be backed out. This was not run past me, and this is a
shared code
file, that means its code that we license in both GPL, BSD, and closed
source licensing,
and thus we CANNOT accept changes without special handling. Further, I do
not author
this code, its done by another team internally, and I simply accept it as a
component.

If someone feels a change needs to happen the way to handle it is to send
email to me
to discuss it, I need to have it reviewed internally by the full
development team, and a
special waiver from the author will be needed to handle the licensing.

So, please uncommit this.

Jack


On Wed, Feb 20, 2013 at 4:59 AM, Dag-Erling Smørgrav d...@freebsd.orgwrote:

 Author: des
 Date: Wed Feb 20 12:59:21 2013
 New Revision: 247035
 URL: http://svnweb.freebsd.org/changeset/base/247035

 Log:
   Reduce excessive nesting.

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

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

 ==
 --- head/sys/dev/ixgbe/ixgbe_phy.c  Wed Feb 20 12:40:26 2013
  (r247034)
 +++ head/sys/dev/ixgbe/ixgbe_phy.c  Wed Feb 20 12:59:21 2013
  (r247035)
 @@ -1194,25 +1194,23 @@ s32 ixgbe_identify_sfp_module_generic(st
 /* Make sure we're a supported PHY type */
 if (hw-phy.type == ixgbe_phy_sfp_intel) {
 status = IXGBE_SUCCESS;
 +   } else if (hw-allow_unsupported_sfp == TRUE) {
 +   EWARN(hw, WARNING: Intel (R) Network 
 +   Connections are quality tested 
 +   using Intel (R) Ethernet Optics.
 +Using untested modules is not 
 +   supported and may cause unstable
 +operation or damage to the 
 +   module or the adapter. Intel 
 +   Corporation is not responsible 
 +   for any harm caused by using 
 +   untested modules.\n, status);
 +   status = IXGBE_SUCCESS;
 } else {
 -   if (hw-allow_unsupported_sfp == TRUE) {
 -   EWARN(hw, WARNING: Intel (R)
 Network 
 - Connections are quality
 tested 
 - using Intel (R) Ethernet
 Optics.
 -  Using untested modules is
 not 
 - supported and may cause
 unstable
 -  operation or damage to the
 
 - module or the adapter.
 Intel 
 - Corporation is not
 responsible 
 - for any harm caused by
 using 
 - untested modules.\n,
 status);
 -   status = IXGBE_SUCCESS;
 -   } else {
 -   DEBUGOUT(SFP+ module not
 supported\n);
 -   hw-phy.type =
 -   ixgbe_phy_sfp_unsupported;
 -   status =
 IXGBE_ERR_SFP_NOT_SUPPORTED;
 -   }
 +   DEBUGOUT(SFP+ module not supported\n);
 +   hw-phy.type =
 +   ixgbe_phy_sfp_unsupported;
 +   status = IXGBE_ERR_SFP_NOT_SUPPORTED;
 }
 } else {
 status = IXGBE_SUCCESS;

___
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: r247049 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2013-02-20 Thread Justin T. Gibbs
Author: gibbs
Date: Wed Feb 20 17:55:17 2013
New Revision: 247049
URL: http://svnweb.freebsd.org/changeset/base/247049

Log:
  Avoid panic when tearing down the DTrace pid provider for a
  process that has crashed.
  
  sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c:
In fasttrap_pid_disable(), we cannot PHOLD the proc
structure for a process that no longer exists, but
we still have other, fasttrap specific, state that
must be cleaned up for probes that existed in the
dead process.  Instead of returning early if the
process related to our probes isn't found,
conditionalize the locking and carry on with a NULL
proc pointer.  The rest of the fasttrap code already
understands that a NULL proc is possible and does
the right things in this case.
  
  Sponsored by: Spectra Logic Corporation
  Reviewed by:  rpaulo, gnn
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Wed Feb 
20 17:46:38 2013(r247048)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c  Wed Feb 
20 17:55:17 2013(r247049)
@@ -1124,14 +1124,12 @@ fasttrap_pid_disable(void *arg, dtrace_i
 * provider lock as a point of mutual exclusion to prevent other
 * DTrace consumers from disabling this probe.
 */
-   if ((p = pfind(probe-ftp_pid)) == NULL) {
-   mutex_exit(provider-ftp_mtx);
-   return;
-   }
+   if ((p = pfind(probe-ftp_pid)) != NULL) {
 #ifdef __FreeBSD__
-   _PHOLD(p);
-   PROC_UNLOCK(p);
+   _PHOLD(p);
+   PROC_UNLOCK(p);
 #endif
+   }
 
/*
 * Disable all the associated tracepoints (for fully enabled probes).
@@ -1168,7 +1166,8 @@ fasttrap_pid_disable(void *arg, dtrace_i
fasttrap_pid_cleanup();
 
 #ifdef __FreeBSD__
-   PRELE(p);
+   if (p != NULL)
+   PRELE(p);
 #endif
if (!probe-ftp_enabled)
return;
___
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: r247050 - head/lib/libc/stdlib

2013-02-20 Thread Giorgos Keramidas
Author: keramida (doc committer)
Date: Wed Feb 20 18:31:55 2013
New Revision: 247050
URL: http://svnweb.freebsd.org/changeset/base/247050

Log:
  Various improvements to the qsort(3) usage example:
  
  - Remove unused #include.
  - Do not cast away const.
  - Use the canonical idiom to compare two numbers.
  - Use proper type for sizes, i.e. size_t instead of int.
  - Correct indentation.
  - Simplify printf(\n) to puts().
  - Use return instead of exit() in main().
  
  Submitted by: Christoph Mallon, christoph.mallon at gmx.de
  Approved by:  gjb (mentor)
  Reviewed by:  stefanf
  MFC after:1 week

Modified:
  head/lib/libc/stdlib/qsort.3

Modified: head/lib/libc/stdlib/qsort.3
==
--- head/lib/libc/stdlib/qsort.3Wed Feb 20 17:55:17 2013
(r247049)
+++ head/lib/libc/stdlib/qsort.3Wed Feb 20 18:31:55 2013
(r247050)
@@ -220,7 +220,6 @@ and then prints the sorted array to stan
 .Bd -literal
 #include stdio.h
 #include stdlib.h
-#include string.h
 
 /*
  * Custom comparison function that can compare 'int' values through pointers
@@ -229,15 +228,10 @@ and then prints the sorted array to stan
 static int
 int_compare(const void *p1, const void *p2)
 {
-int *left = (int *)p1;
-int *right = (int *)p2;
+int left = *(const int *)p1;
+int right = *(const int *)p2;
 
-if (*left  *right)
-return (-1);
-else if (*left  *right)
-return (1);
-else
-return (0);
+return ((left  right) - (left  right));
 }
 
 /*
@@ -247,14 +241,14 @@ int
 main(void)
 {
int int_array[] = { 4, 5, 9, 3, 0, 1, 7, 2, 8, 6 };
-   const int array_size = sizeof(int_array) / sizeof(int_array[0]);
-   int k;
+   const size_t array_size = sizeof(int_array) / sizeof(int_array[0]);
+   size_t k;
 
-   qsort(int_array, array_size, sizeof(int), int_compare);
+   qsort(int_array, array_size, sizeof(int_array[0]), int_compare);
for (k = 0; k  array_size; k++)
 printf( %d, int_array[k]);
-printf(\\n);
-exit(EXIT_SUCCESS);
+puts();
+return (EXIT_SUCCESS);
 }
 .Ed
 .Sh ERRORS
___
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: r247012 - in head/contrib/binutils: gas/config opcodes

2013-02-20 Thread John-Mark Gurney
John Baldwin wrote this message on Wed, Feb 20, 2013 at 08:09 -0500:
 On Tuesday, February 19, 2013 4:35:17 pm John-Mark Gurney wrote:
  Author: jmg
  Date: Tue Feb 19 21:35:17 2013
  New Revision: 247012
  URL: http://svnweb.freebsd.org/changeset/base/247012
  
  Log:
add support for AES and PCLMULQDQ instructions to binutils...

Thanks to Mike Belopuhov for the pointer to the OpenBSD patch, though
OpenBSD's gcc is very different that it only helped w/ where to modify,
not how...  Thanks to jhb for some early reviews...

Reviewed by:  imp, kib
MFC after:1 month
 
 Nice!  Sorry I wasn't able to review this in more detail. :(  Can you also 
 add 
 support for these instructions to ddb's disassembler?

Considering that ddb doesn't appear to support xmm registers, that'll
be a bit of work...  even simple instructions such as pxor aren't there
yet...  So, it'd be more like adding all of the SSE instructions to db
than just adding the AES instructions...  If I had time, I'd do it, but
I don't right now..

Also, I just happen to be looking at the declaration in
amd64/amd64/db_disasm.c of:
static const char * const db_reg[2][4][16] = {

shouldn't we change that to:
static const char const db_reg[2][4][16][6] = {

That would save a level of indirection, and also all those pointers
associated... I estimate that it would save about 1k of space on
amd64...  it might be a bit less, but at least 512 bytes...

Just a thought...

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 All that I will do, has been done, All that I have, has not.
___
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: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Dag-Erling Smørgrav
Jack Vogel jfvo...@gmail.com writes:
 OK, this change must be backed out. This was not run past me, and this
 is a shared code file, that means its code that we license in both
 GPL, BSD, and closed source licensing, and thus we CANNOT accept
 changes without special handling. Further, I do not author this code,
 its done by another team internally, and I simply accept it as a
 component.

I think you're confused.  I did not commit this to Intel's code
repository.  I committed it to FreeBSD's code repository as a precursor
to a slightly more extensive patch which I intend to commit once I've
tested it more thoroughly.

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

Re: svn commit: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Jack Vogel
No, I'm not confused, I am the owner of the driver, and keep the FreeBSD
code
and the Intel code in sync, any changes to the code should be run by me
first.

Jack


On Wed, Feb 20, 2013 at 10:57 AM, Dag-Erling Smørgrav d...@des.no wrote:

 Jack Vogel jfvo...@gmail.com writes:
  OK, this change must be backed out. This was not run past me, and this
  is a shared code file, that means its code that we license in both
  GPL, BSD, and closed source licensing, and thus we CANNOT accept
  changes without special handling. Further, I do not author this code,
  its done by another team internally, and I simply accept it as a
  component.

 I think you're confused.  I did not commit this to Intel's code
 repository.  I committed it to FreeBSD's code repository as a precursor
 to a slightly more extensive patch which I intend to commit once I've
 tested it more thoroughly.

 DES
 --
 Dag-Erling Smørgrav - d...@des.no

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


svn commit: r247051 - head/lib/libc/stdlib

2013-02-20 Thread Joel Dahl
Author: joel (doc committer)
Date: Wed Feb 20 19:05:13 2013
New Revision: 247051
URL: http://svnweb.freebsd.org/changeset/base/247051

Log:
  Sort sections.

Modified:
  head/lib/libc/stdlib/qsort.3

Modified: head/lib/libc/stdlib/qsort.3
==
--- head/lib/libc/stdlib/qsort.3Wed Feb 20 18:31:55 2013
(r247050)
+++ head/lib/libc/stdlib/qsort.3Wed Feb 20 19:05:13 2013
(r247051)
@@ -205,12 +205,6 @@ functions
 return no value.
 .Pp
 .Rv -std heapsort mergesort
-.Sh COMPATIBILITY
-Previous versions of
-.Fn qsort
-did not permit the comparison routine itself to call
-.Fn qsort 3 .
-This is no longer true.
 .Sh EXAMPLES
 A sample program that sorts an array of
 .Vt int
@@ -251,6 +245,12 @@ main(void)
 return (EXIT_SUCCESS);
 }
 .Ed
+.Sh COMPATIBILITY
+Previous versions of
+.Fn qsort
+did not permit the comparison routine itself to call
+.Fn qsort 3 .
+This is no longer true.
 .Sh ERRORS
 The
 .Fn heapsort
___
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: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Juli Mallett
On Wed, Feb 20, 2013 at 10:57 AM, Dag-Erling Smørgrav d...@des.no wrote:
 Jack Vogel jfvo...@gmail.com writes:
 OK, this change must be backed out. This was not run past me, and this
 is a shared code file, that means its code that we license in both
 GPL, BSD, and closed source licensing, and thus we CANNOT accept
 changes without special handling. Further, I do not author this code,
 its done by another team internally, and I simply accept it as a
 component.

 I think you're confused.  I did not commit this to Intel's code
 repository.  I committed it to FreeBSD's code repository as a precursor
 to a slightly more extensive patch which I intend to commit once I've
 tested it more thoroughly.

Please don't.  Many others have accepted/respected Jack's
maintainership by letting him keep control of the in-tree driver as
much as is possible, particularly outside of ixgbe.c.  I would love to
have committed my code to handle 1G SFPs quite some time ago, but it
makes at least a little sense to me that Jack handles the merges and
testing and whatnot and doesn't need the additional work of
maintaining FreeBSD additions he can't test.  In general, the benefit
of having the Intel drivers updated regularly by someone who has done
extensive testing and who has the backing of Intel has outweighed the
cost of deferring to Intel and Jack about what can go into the
drivers.

If your changes are so compelling, I would have expected them to have
appeared at least on a major public mailing list, rather than
committed at a whim to a driver which has a clear and obvious
maintainer.  If we really do have a lot of wonderful changes that are
stalled by Jack's maintainership, provide a second driver in-tree and
maintain it, which has all the go-faster/better/stronger stripes.

It's not just Jack that unexpected changes to these critical drivers
make things harder for.  There's Luigi, Ryan Stone, John Baldwin,
myself and others, who maintain extensions to the Intel drivers
in-tree and/or privately.

Thanks,
Juli.
___
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: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Dag-Erling Smørgrav
Jack Vogel jfvo...@gmail.com writes:
 No, I'm not confused, I am the owner of the driver, and keep the
 FreeBSD code and the Intel code in sync, any changes to the code
 should be run by me first.

Where is this documented?

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

Re: svn commit: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Dag-Erling Smørgrav
Juli Mallett jmall...@freebsd.org writes:
 Please don't.  Many others have accepted/respected Jack's
 maintainership by letting him keep control of the in-tree driver as
 much as is possible, particularly outside of ixgbe.c.

Jack claims to have a hard lock on the driver.  While not unheard of, it
is somewhat unusual, and there is no documentation of it anywhere -
neither in MAINTAINERS nor in the README or LICENSE files which
accompany the driver.

He also needs to work on his attitude.

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

svn commit: r247052 - head/usr.sbin/makefs

2013-02-20 Thread Brooks Davis
Author: brooks
Date: Wed Feb 20 19:32:31 2013
New Revision: 247052
URL: http://svnweb.freebsd.org/changeset/base/247052

Log:
  Support hardlinks in manifest files by the same logic as the treewalk
  code.
  
  Reviewed by:  marcel
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/makefs/makefs.h
  head/usr.sbin/makefs/mtree.c
  head/usr.sbin/makefs/walk.c

Modified: head/usr.sbin/makefs/makefs.h
==
--- head/usr.sbin/makefs/makefs.h   Wed Feb 20 19:05:13 2013
(r247051)
+++ head/usr.sbin/makefs/makefs.h   Wed Feb 20 19:32:31 2013
(r247052)
@@ -280,6 +280,8 @@ extern  struct timespec start_time;
 struct fs;
 void   ffs_fragacct_swap(struct fs *, int, int32_t [], int, int);
 
+fsinode *link_check(fsinode *);
+
 /*
  * Declarations for compat routines.
  */

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cWed Feb 20 19:05:13 2013
(r247051)
+++ head/usr.sbin/makefs/mtree.cWed Feb 20 19:32:31 2013
(r247052)
@@ -779,6 +779,24 @@ read_mtree_keywords(FILE *fp, fsnode *no
return (0);
}
 
+   /*
+ * Check for hardlinks. If the contents key is used, then the check
+ * will only trigger if the contents file is a link even if it is used
+ * by more than one file
+*/
+   if (sb.st_nlink  1) {
+   fsinode *curino;
+
+   st-st_ino = sb.st_ino;
+   st-st_dev = sb.st_dev;
+   curino = link_check(node-inode);
+   if (curino != NULL) {
+   free(node-inode);
+   node-inode = curino;
+   node-inode-nlink++;
+   }
+   }
+
free(node-contents);
node-contents = name;
st-st_size = sb.st_size;

Modified: head/usr.sbin/makefs/walk.c
==
--- head/usr.sbin/makefs/walk.c Wed Feb 20 19:05:13 2013(r247051)
+++ head/usr.sbin/makefs/walk.c Wed Feb 20 19:32:31 2013(r247052)
@@ -59,7 +59,6 @@ staticvoid apply_specdir(const char *,
 static void apply_specentry(const char *, NODE *, fsnode *);
 static fsnode  *create_fsnode(const char *, const char *, const char *,
   struct stat *);
-static fsinode *link_check(fsinode *);
 
 
 /*
@@ -644,7 +643,7 @@ inode_type(mode_t mode)
 /* This was borrowed from du.c and tweaked to keep an fsnode 
  * pointer instead. -- d...@netbsd.org
  */
-static fsinode *
+fsinode *
 link_check(fsinode *entry)
 {
static struct entry {
___
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: r247012 - in head/contrib/binutils: gas/config opcodes

2013-02-20 Thread John Baldwin
On Wednesday, February 20, 2013 1:42:00 pm John-Mark Gurney wrote:
 John Baldwin wrote this message on Wed, Feb 20, 2013 at 08:09 -0500:
  On Tuesday, February 19, 2013 4:35:17 pm John-Mark Gurney wrote:
   Author: jmg
   Date: Tue Feb 19 21:35:17 2013
   New Revision: 247012
   URL: http://svnweb.freebsd.org/changeset/base/247012
   
   Log:
 add support for AES and PCLMULQDQ instructions to binutils...
 
 Thanks to Mike Belopuhov for the pointer to the OpenBSD patch, though
 OpenBSD's gcc is very different that it only helped w/ where to modify,
 not how...  Thanks to jhb for some early reviews...
 
 Reviewed by:imp, kib
 MFC after:  1 month
  
  Nice!  Sorry I wasn't able to review this in more detail. :(  Can you also 
  add 
  support for these instructions to ddb's disassembler?
 
 Considering that ddb doesn't appear to support xmm registers, that'll
 be a bit of work...  even simple instructions such as pxor aren't there
 yet...  So, it'd be more like adding all of the SSE instructions to db
 than just adding the AES instructions...  If I had time, I'd do it, but
 I don't right now..

Ahh, that's fair.  The ones I added recently did not use XMM registers so
they weren't as tricky.

 Also, I just happen to be looking at the declaration in
 amd64/amd64/db_disasm.c of:
 static const char * const db_reg[2][4][16] = {
 
 shouldn't we change that to:
 static const char const db_reg[2][4][16][6] = {
 
 That would save a level of indirection, and also all those pointers
 associated... I estimate that it would save about 1k of space on
 amd64...  it might be a bit less, but at least 512 bytes...
 
 Just a thought...

On arm or mips I'd say yes.  On amd64 I doubt it would be noticable, and
the first version is arguably slightly more readable.  I don't really care
one way or another though.

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


svn commit: r247054 - head/share/mk

2013-02-20 Thread Ed Maste
Author: emaste
Date: Wed Feb 20 20:42:56 2013
New Revision: 247054
URL: http://svnweb.freebsd.org/changeset/base/247054

Log:
  Fix parallel build race with DEBUG_FLAGS
  
  Reported by: Jan Beich on freebsd-current
  Tested by: markj

Modified:
  head/share/mk/bsd.lib.mk

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkWed Feb 20 20:12:17 2013(r247053)
+++ head/share/mk/bsd.lib.mkWed Feb 20 20:42:56 2013(r247054)
@@ -113,12 +113,20 @@ PO_FLAG=-pg
 
 all: objwarn
 
+.if defined(SHLIB_NAME)
+.if defined(DEBUG_FLAGS)
+SHLIB_NAME_FULL=${SHLIB_NAME}.debug
+.else
+SHLIB_NAME_FULL=${SHLIB_NAME}
+.endif
+.endif
+
 .include bsd.symver.mk
 
 # Allow libraries to specify their own version map or have it
 # automatically generated (see bsd.symver.mk above).
 .if ${MK_SYMVER} == yes  !empty(VERSION_MAP)
-${SHLIB_NAME}: ${VERSION_MAP}
+${SHLIB_NAME_FULL}:${VERSION_MAP}
 LDFLAGS+=  -Wl,--version-script=${VERSION_MAP}
 .endif
 
@@ -165,12 +173,6 @@ SOBJS+=${OBJS:.o=.So}
 .if defined(SHLIB_NAME)
 _LIBS+=${SHLIB_NAME}
 
-.if defined(DEBUG_FLAGS)
-SHLIB_NAME_FULL=${SHLIB_NAME}.debug
-.else
-SHLIB_NAME_FULL=${SHLIB_NAME}
-.endif
-
 SOLINKOPTS=-shared -Wl,-x
 .if !defined(ALLOW_SHARED_TEXTREL)
 SOLINKOPTS+=   -Wl,--fatal-warnings -Wl,--warn-shared-textrel
___
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: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Jack Vogel
My attitude? And what part of courtesy were you missing, did I make comments
about you or your behavior. At this point I'd say you owe me an apology as
well
as the uncommit.

Jack

On Wed, Feb 20, 2013 at 11:07 AM, Dag-Erling Smørgrav d...@des.no wrote:

 Juli Mallett jmall...@freebsd.org writes:
  Please don't.  Many others have accepted/respected Jack's
  maintainership by letting him keep control of the in-tree driver as
  much as is possible, particularly outside of ixgbe.c.

 Jack claims to have a hard lock on the driver.  While not unheard of, it
 is somewhat unusual, and there is no documentation of it anywhere -
 neither in MAINTAINERS nor in the README or LICENSE files which
 accompany the driver.

 He also needs to work on his attitude.

 DES
 --
 Dag-Erling Smørgrav - d...@des.no

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


Re: svn commit: r247035 - head/sys/dev/ixgbe

2013-02-20 Thread Dag-Erling Smørgrav
Jack Vogel jfvo...@gmail.com writes:
 My attitude? And what part of courtesy were you missing, did I make
 comments about you or your behavior. At this point I'd say you owe me
 an apology as well as the uncommit.

I'll revert the commit, but you won't get an apology.  You and / or
Intel clearly don't understand how open source works.  That's your
problem, though, not mine.

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

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

2013-02-20 Thread Dag-Erling Smørgrav
Author: des
Date: Wed Feb 20 21:16:50 2013
New Revision: 247056
URL: http://svnweb.freebsd.org/changeset/base/247056

Log:
  revert 247035

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

Modified: head/sys/dev/ixgbe/ixgbe_phy.c
==
--- head/sys/dev/ixgbe/ixgbe_phy.c  Wed Feb 20 20:56:07 2013
(r247055)
+++ head/sys/dev/ixgbe/ixgbe_phy.c  Wed Feb 20 21:16:50 2013
(r247056)
@@ -1194,23 +1194,25 @@ s32 ixgbe_identify_sfp_module_generic(st
/* Make sure we're a supported PHY type */
if (hw-phy.type == ixgbe_phy_sfp_intel) {
status = IXGBE_SUCCESS;
-   } else if (hw-allow_unsupported_sfp == TRUE) {
-   EWARN(hw, WARNING: Intel (R) Network 
-   Connections are quality tested 
-   using Intel (R) Ethernet Optics.
-Using untested modules is not 
-   supported and may cause unstable
-operation or damage to the 
-   module or the adapter. Intel 
-   Corporation is not responsible 
-   for any harm caused by using 
-   untested modules.\n, status);
-   status = IXGBE_SUCCESS;
} else {
-   DEBUGOUT(SFP+ module not supported\n);
-   hw-phy.type =
-   ixgbe_phy_sfp_unsupported;
-   status = IXGBE_ERR_SFP_NOT_SUPPORTED;
+   if (hw-allow_unsupported_sfp == TRUE) {
+   EWARN(hw, WARNING: Intel (R) Network 
+ Connections are quality tested 
+ using Intel (R) Ethernet Optics.
+  Using untested modules is not 
+ supported and may cause unstable
+  operation or damage to the 
+ module or the adapter. Intel 
+ Corporation is not responsible 
+ for any harm caused by using 
+ untested modules.\n, status);
+   status = IXGBE_SUCCESS;
+   } else {
+   DEBUGOUT(SFP+ module not supported\n);
+   hw-phy.type =
+   ixgbe_phy_sfp_unsupported;
+   status = IXGBE_ERR_SFP_NOT_SUPPORTED;
+   }
}
} else {
status = IXGBE_SUCCESS;
___
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: r247059 - head/sys/sys

2013-02-20 Thread Warner Losh
Author: imp
Date: Wed Feb 20 22:20:49 2013
New Revision: 247059
URL: http://svnweb.freebsd.org/changeset/base/247059

Log:
  Remove the unused spl functions: spl0, splsoftcam, splsofttty,
  splsofttq and splstatclock.
  
  Other used spl functions to follow.

Modified:
  head/sys/sys/systm.h

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hWed Feb 20 21:57:01 2013(r247058)
+++ head/sys/sys/systm.hWed Feb 20 22:20:49 2013(r247059)
@@ -324,19 +324,14 @@ caddr_t   kern_timeout_callwheel_alloc(cad
 void   kern_timeout_callwheel_init(void);
 
 /* Stubs for obsolete functions that used to be for interrupt management */
-static __inline void   spl0(void)  { return; }
 static __inline intrmask_t splbio(void){ return 0; }
 static __inline intrmask_t splcam(void){ return 0; }
 static __inline intrmask_t splclock(void)  { return 0; }
 static __inline intrmask_t splhigh(void)   { return 0; }
 static __inline intrmask_t splimp(void){ return 0; }
 static __inline intrmask_t splnet(void){ return 0; }
-static __inline intrmask_t splsoftcam(void){ return 0; }
 static __inline intrmask_t splsoftclock(void)  { return 0; }
-static __inline intrmask_t splsofttty(void){ return 0; }
 static __inline intrmask_t splsoftvm(void) { return 0; }
-static __inline intrmask_t splsofttq(void) { return 0; }
-static __inline intrmask_t splstatclock(void)  { return 0; }
 static __inline intrmask_t spltty(void){ return 0; }
 static __inline intrmask_t splvm(void) { return 0; }
 static __inline void   splx(intrmask_t ipl __unused)   { return; }
___
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: r247060 - head/usr.sbin/pkg

2013-02-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Feb 20 22:51:42 2013
New Revision: 247060
URL: http://svnweb.freebsd.org/changeset/base/247060

Log:
  Do not use deprecated functions from libarchive

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

Modified: head/usr.sbin/pkg/pkg.c
==
--- head/usr.sbin/pkg/pkg.c Wed Feb 20 22:20:49 2013(r247059)
+++ head/usr.sbin/pkg/pkg.c Wed Feb 20 22:51:42 2013(r247060)
@@ -212,7 +212,7 @@ extract_pkg_static(int fd, char *p, int 
warn(archive_read_new);
return (ret);
}
-   archive_read_support_compression_all(a);
+   archive_read_support_filter_all(a);
archive_read_support_format_tar(a);
 
if (lseek(fd, 0, 0) == -1) {
@@ -247,7 +247,7 @@ extract_pkg_static(int fd, char *p, int 
warnx(fail to extract pkg-static);
 
 cleanup:
-   archive_read_finish(a);
+   archive_read_free(a);
return (ret);
 
 }
___
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: r247061 - in head/sys: crypto/aesni opencrypto

2013-02-20 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Feb 20 22:59:53 2013
New Revision: 247061
URL: http://svnweb.freebsd.org/changeset/base/247061

Log:
  When porting XTS-related code from OpenBSD I forgot to update copyright (only
  OpenBSD was credited in one of two commits). Fix it.
  
  Reported by:  Theo de Raadt dera...@cvs.openbsd.org
  Reviewed by:  Damien Miller d...@mindrot.org

Modified:
  head/sys/crypto/aesni/aesni_wrap.c
  head/sys/opencrypto/xform.c

Modified: head/sys/crypto/aesni/aesni_wrap.c
==
--- head/sys/crypto/aesni/aesni_wrap.c  Wed Feb 20 22:51:42 2013
(r247060)
+++ head/sys/crypto/aesni/aesni_wrap.c  Wed Feb 20 22:59:53 2013
(r247061)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (C) 2008 Damien Miller d...@mindrot.org
  * Copyright (c) 2010 Konstantin Belousov k...@freebsd.org
  * Copyright (c) 2010-2011 Pawel Jakub Dawidek pa...@dawidek.net
  * All rights reserved.

Modified: head/sys/opencrypto/xform.c
==
--- head/sys/opencrypto/xform.c Wed Feb 20 22:51:42 2013(r247060)
+++ head/sys/opencrypto/xform.c Wed Feb 20 22:59:53 2013(r247061)
@@ -1,8 +1,9 @@
 /* $OpenBSD: xform.c,v 1.16 2001/08/28 12:20:43 ben Exp $  */
 /*-
  * The authors of this code are John Ioannidis (j...@tla.org),
- * Angelos D. Keromytis (ker...@csd.uch.gr) and
- * Niels Provos (pro...@physnet.uni-hamburg.de).
+ * Angelos D. Keromytis (ker...@csd.uch.gr),
+ * Niels Provos (pro...@physnet.uni-hamburg.de) and
+ * Damien Miller (d...@mindrot.org).
  *
  * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
  * in November 1995.
@@ -15,11 +16,15 @@
  *
  * Additional features in 1999 by Angelos D. Keromytis.
  *
+ * AES XTS implementation in 2008 by Damien Miller
+ *
  * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
  * Angelos D. Keromytis and Niels Provos.
  *
  * Copyright (C) 2001, Angelos D. Keromytis.
  *
+ * Copyright (C) 2008, Damien Miller
+ *
  * Permission to use, copy, and modify this software with or without fee
  * is hereby granted, provided that this entire notice is included in
  * all copies of any software which is or includes a copy or
___
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: r247062 - head/sys/dev/cxgbe

2013-02-20 Thread Navdeep Parhar
Author: np
Date: Wed Feb 20 23:15:40 2013
New Revision: 247062
URL: http://svnweb.freebsd.org/changeset/base/247062

Log:
  cxgbe(4): Assume that CSUM_TSO in the transmit path implies CSUM_IP and
  CSUM_TCP too.  They are all set explicitly by the kernel usually.
  
  While here, fix an unrelated bug where hardware L4 checksum calculation
  was accidentally disabled for some IPv6 packets.
  
  Reported by:  alfred@
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Wed Feb 20 22:59:53 2013(r247061)
+++ head/sys/dev/cxgbe/t4_sge.c Wed Feb 20 23:15:40 2013(r247062)
@@ -2950,13 +2950,13 @@ write_txpkt_wr(struct port_info *pi, str
 
/* Checksum offload */
ctrl1 = 0;
-   if (!(m-m_pkthdr.csum_flags  CSUM_IP))
+   if (!(m-m_pkthdr.csum_flags  (CSUM_IP | CSUM_TSO)))
ctrl1 |= F_TXPKT_IPCSUM_DIS;
if (!(m-m_pkthdr.csum_flags  (CSUM_TCP | CSUM_UDP | CSUM_UDP_IPV6 |
-   CSUM_TCP_IPV6)))
+   CSUM_TCP_IPV6 | CSUM_TSO)))
ctrl1 |= F_TXPKT_L4CSUM_DIS;
if (m-m_pkthdr.csum_flags  (CSUM_IP | CSUM_TCP | CSUM_UDP |
-   CSUM_UDP_IPV6 | CSUM_TCP_IPV6))
+   CSUM_UDP_IPV6 | CSUM_TCP_IPV6 | CSUM_TSO))
txq-txcsum++;  /* some hardware assistance provided */
 
/* VLAN tag insertion */
@@ -3152,11 +3152,13 @@ write_ulp_cpl_sgl(struct port_info *pi, 
 
/* Checksum offload */
ctrl = 0;
-   if (!(m-m_pkthdr.csum_flags  CSUM_IP))
+   if (!(m-m_pkthdr.csum_flags  (CSUM_IP | CSUM_TSO)))
ctrl |= F_TXPKT_IPCSUM_DIS;
-   if (!(m-m_pkthdr.csum_flags  (CSUM_TCP | CSUM_UDP)))
+   if (!(m-m_pkthdr.csum_flags  (CSUM_TCP | CSUM_UDP | CSUM_UDP_IPV6 |
+   CSUM_TCP_IPV6 | CSUM_TSO)))
ctrl |= F_TXPKT_L4CSUM_DIS;
-   if (m-m_pkthdr.csum_flags  (CSUM_IP | CSUM_TCP | CSUM_UDP))
+   if (m-m_pkthdr.csum_flags  (CSUM_IP | CSUM_TCP | CSUM_UDP |
+   CSUM_UDP_IPV6 | CSUM_TCP_IPV6 | CSUM_TSO))
txq-txcsum++;  /* some hardware assistance provided */
 
/* VLAN tag insertion */
___
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: r247059 - head/sys/sys

2013-02-20 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2013-02-20 17:20:50 -0500, Warner Losh wrote:
 Author: imp Date: Wed Feb 20 22:20:49 2013 New Revision: 247059 
 URL: http://svnweb.freebsd.org/changeset/base/247059
 
 Log: Remove the unused spl functions: spl0, splsoftcam,
 splsofttty, splsofttq and splstatclock.
 
 Other used spl functions to follow.
...

Hallelujah!  12 years...

Jung-uk Kim
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (FreeBSD)

iQEcBAEBAgAGBQJRJVqMAAoJECXpabHZMqHOgAYIALzL7aNILn4jH545V/fnmvK/
VWKuEdKI5t1Ewp4sU8Zf2HOzZRYLExQIrW1YKTRxij99Y/MnKByo//yCtMXMx7Cu
PgbET0DnkH2Z2CMIFgRvJ1a5MN0lAB41ecPSfrVKS8yPbxDMdSUUbwOPKc67uqAp
qMIkZ2W/LHAaBi8vcLyja+drTucBdJdG/ilJmkDLu1OiYFJQ0ig1ftwkyFh6BMno
WnZaQp1cPBumwBuyYxnZpiDFlXmHLJpc2OYVndgFNTFbkIO3Hl1AlqFwEWcpxAI5
oJxzHBg4EHYMJSlSFu7yYSQqAQ5vZWjUbiu+INThpRwRqt9/22QDV7+z+2qU4/Y=
=wpUg
-END PGP SIGNATURE-
___
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: r247064 - head/sys/dev/e1000

2013-02-20 Thread Jack F Vogel
Author: jfv
Date: Thu Feb 21 00:25:45 2013
New Revision: 247064
URL: http://svnweb.freebsd.org/changeset/base/247064

Log:
  Refresh on the shared code for the E1000 drivers.
- bear with me, there are lots of white space changes, I would not
  do them, but I am a mere consumer of this stuff and if these drivers
  are to stay in shape they need to be taken.
  
  em driver changes: support for the new i217/i218 interfaces
  
  igb driver changes:
- TX mq start has a quick turnaround to the stack
- Link/media handling improvement
- When link status changes happen the current flow control state
  will now be displayed.
- A few white space/style changes.
  
  lem driver changes:
- the shared code uncovered a bogus write to the RLPML register
  (which does not exist in this hardware) in the vlan code,this
  is removed.

Modified:
  head/sys/dev/e1000/e1000_82571.c
  head/sys/dev/e1000/e1000_82575.c
  head/sys/dev/e1000/e1000_82575.h
  head/sys/dev/e1000/e1000_api.c
  head/sys/dev/e1000/e1000_api.h
  head/sys/dev/e1000/e1000_defines.h
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/e1000_i210.c
  head/sys/dev/e1000/e1000_i210.h
  head/sys/dev/e1000/e1000_ich8lan.c
  head/sys/dev/e1000/e1000_ich8lan.h
  head/sys/dev/e1000/e1000_mac.c
  head/sys/dev/e1000/e1000_mac.h
  head/sys/dev/e1000/e1000_manage.c
  head/sys/dev/e1000/e1000_nvm.c
  head/sys/dev/e1000/e1000_nvm.h
  head/sys/dev/e1000/e1000_osdep.h
  head/sys/dev/e1000/e1000_phy.c
  head/sys/dev/e1000/e1000_phy.h
  head/sys/dev/e1000/e1000_regs.h
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/e1000/if_lem.c

Modified: head/sys/dev/e1000/e1000_82571.c
==
--- head/sys/dev/e1000/e1000_82571.cWed Feb 20 23:26:14 2013
(r247063)
+++ head/sys/dev/e1000/e1000_82571.cThu Feb 21 00:25:45 2013
(r247064)
@@ -1,6 +1,6 @@
 /**
 
-  Copyright (c) 2001-2011, Intel Corporation 
+  Copyright (c) 2001-2013, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -32,8 +32,7 @@
 **/
 /*$FreeBSD$*/
 
-/*
- * 82571EB Gigabit Ethernet Controller
+/* 82571EB Gigabit Ethernet Controller
  * 82571EB Gigabit Ethernet Controller (Copper)
  * 82571EB Gigabit Ethernet Controller (Fiber)
  * 82571EB Dual Port Gigabit Mezzanine Adapter
@@ -51,9 +50,6 @@
 
 #include e1000_api.h
 
-static s32  e1000_init_phy_params_82571(struct e1000_hw *hw);
-static s32  e1000_init_nvm_params_82571(struct e1000_hw *hw);
-static s32  e1000_init_mac_params_82571(struct e1000_hw *hw);
 static s32  e1000_acquire_nvm_82571(struct e1000_hw *hw);
 static void e1000_release_nvm_82571(struct e1000_hw *hw);
 static s32  e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset,
@@ -78,7 +74,6 @@ static s32  e1000_get_hw_semaphore_82571
 static s32  e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
 static s32  e1000_get_phy_id_82571(struct e1000_hw *hw);
 static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw);
-static s32  e1000_get_hw_semaphore_82573(struct e1000_hw *hw);
 static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw);
 static s32  e1000_get_hw_semaphore_82574(struct e1000_hw *hw);
 static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw);
@@ -99,13 +94,13 @@ static void e1000_power_down_phy_copper_
 static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
 {
struct e1000_phy_info *phy = hw-phy;
-   s32 ret_val = E1000_SUCCESS;
+   s32 ret_val;
 
DEBUGFUNC(e1000_init_phy_params_82571);
 
if (hw-phy.media_type != e1000_media_type_copper) {
phy-type = e1000_phy_none;
-   goto out;
+   return E1000_SUCCESS;
}
 
phy-addr   = 1;
@@ -165,8 +160,7 @@ static s32 e1000_init_phy_params_82571(s
phy-ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574;
break;
default:
-   ret_val = -E1000_ERR_PHY;
-   goto out;
+   return -E1000_ERR_PHY;
break;
}
 
@@ -174,7 +168,7 @@ static s32 e1000_init_phy_params_82571(s
ret_val = e1000_get_phy_id_82571(hw);
if (ret_val) {
DEBUGOUT(Error getting PHY ID\n);
-   goto out;
+   return ret_val;
}
 
/* Verify phy id */
@@ -201,7 +195,6 @@ static s32 e1000_init_phy_params_82571(s
if (ret_val)
DEBUGOUT1(PHY ID unknown: type = 0x%08x\n, phy-id);
 
-out:
return ret_val;
 }
 
@@ -241,8 +234,7 @@ static s32 e1000_init_nvm_params_82571(s
if (((eecd  15)  0x3) == 0x3) {
nvm-type = e1000_nvm_flash_hw;
nvm-word_size = 2048;
-  

svn commit: r247065 - head/sys/dev/ppc

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 00:26:31 2013
New Revision: 247065
URL: http://svnweb.freebsd.org/changeset/base/247065

Log:
  No longer need splhigh() since locking was done, delete it and
  comments about it.

Modified:
  head/sys/dev/ppc/ppc_isa.c

Modified: head/sys/dev/ppc/ppc_isa.c
==
--- head/sys/dev/ppc/ppc_isa.c  Thu Feb 21 00:25:45 2013(r247064)
+++ head/sys/dev/ppc/ppc_isa.c  Thu Feb 21 00:26:31 2013(r247065)
@@ -141,7 +141,7 @@ ppc_isa_write(device_t dev, char *buf, i
 {
struct ppc_data *ppc = device_get_softc(dev);
char ecr, ecr_sav, ctr, ctr_sav;
-   int s, error = 0;
+   int error = 0;
int spin;
 
PPC_ASSERT_LOCKED(ppc);
@@ -190,12 +190,6 @@ ppc_isa_write(device_t dev, char *buf, i
w_ecr(ppc, ecr);
ecr = r_ecr(ppc);
 
-   /* enter splhigh() not to be preempted
-* by the dma interrupt, we may miss
-* the wakeup otherwise
-*/
-   s = splhigh();
-
ppc-ppc_dmastat = PPC_DMA_INIT;
 
/* enable interrupts */
@@ -221,8 +215,6 @@ ppc_isa_write(device_t dev, char *buf, i
ppcdma, 0);
} while (error == EWOULDBLOCK);
 
-   splx(s);
-
if (error) {
 #ifdef PPC_DEBUG
printf(i);
___
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: r247066 - head/sys/dev/ppc

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 00:27:51 2013
New Revision: 247066
URL: http://svnweb.freebsd.org/changeset/base/247066

Log:
  Replace splhigh() with critical_enter()/leave() to ensure we write the
  config mode unlock sequence quickly enough. This likely isn't too critical,
  since splhigh() has been a noop for a decade...

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

Modified: head/sys/dev/ppc/ppc.c
==
--- head/sys/dev/ppc/ppc.c  Thu Feb 21 00:26:31 2013(r247065)
+++ head/sys/dev/ppc/ppc.c  Thu Feb 21 00:27:51 2013(r247066)
@@ -74,6 +74,22 @@ static void ppcintr(void *arg);
 
 #define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev))
 
+/*
+ * We use critical enter/leave for the simple config locking needed to
+ * detect the devices. We just want to make sure that both of our writes
+ * happen without someone else also writing to those config registers. Since
+ * we just do this at startup, Giant keeps multiple threads from executing,
+ * and critical_enter() then is all that's needed to keep us from being 
preempted
+ * during the critical sequences with the hardware.
+ *
+ * Note: this doesn't prevent multiple threads from putting the chips into
+ * config mode, but since we only do that to detect the type at startup the
+ * extra overhead isn't needed since Giant protects us from multiple entry
+ * and no other code changes these registers.
+ */
+#define PPC_CONFIG_LOCK(ppc)   critical_enter()
+#define PPC_CONFIG_UNLOCK(ppc) critical_leave()
+
 devclass_t ppc_devclass;
 const char ppc_driver_name[] = ppc;
 
@@ -689,7 +705,7 @@ ppc_pc873xx_detect(struct ppc_data *ppc,
 static int
 ppc_smc37c66xgt_detect(struct ppc_data *ppc, int chipset_mode)
 {
-   int s, i;
+   int i;
u_char r;
int type = -1;
int csr = SMC66x_CSR;   /* initial value is 0x3F0 */
@@ -702,11 +718,10 @@ ppc_smc37c66xgt_detect(struct ppc_data *
/*
 * Detection: enter configuration mode and read CRD register.
 */
-
-   s = splhigh();
+   PPC_CONFIG_LOCK(ppc);
outb(csr, SMC665_iCODE);
outb(csr, SMC665_iCODE);
-   splx(s);
+   PPC_CONFIG_UNLOCK(ppc);
 
outb(csr, 0xd);
if (inb(cio) == 0x65) {
@@ -715,10 +730,10 @@ ppc_smc37c66xgt_detect(struct ppc_data *
}
 
for (i = 0; i  2; i++) {
-   s = splhigh();
+   PPC_CONFIG_LOCK(ppc);
outb(csr, SMC666_iCODE);
outb(csr, SMC666_iCODE);
-   splx(s);
+   PPC_CONFIG_UNLOCK(ppc);
 
outb(csr, 0xd);
if (inb(cio) == 0x66) {
@@ -734,16 +749,20 @@ config:
/*
 * If chipset not found, do not continue.
 */
-   if (type == -1)
+   if (type == -1) {
+   outb(csr, 0xaa);/* end config mode */
return (-1);
+   }
 
/* select CR1 */
outb(csr, 0x1);
 
/* read the port's address: bits 0 and 1 of CR1 */
r = inb(cio)  SMC_CR1_ADDR;
-   if (port_address[(int)r] != ppc-ppc_base)
+   if (port_address[(int)r] != ppc-ppc_base) {
+   outb(csr, 0xaa);/* end config mode */
return (-1);
+   }
 
ppc-ppc_model = type;
 
@@ -881,8 +900,7 @@ end_detect:
outb(cio, (r | SMC_CR4_EPPTYPE));
}
 
-   /* end config mode */
-   outb(csr, 0xaa);
+   outb(csr, 0xaa);/* end config mode */
 
ppc-ppc_type = PPC_TYPE_SMCLIKE;
ppc_smclike_setmode(ppc, chipset_mode);
@@ -897,13 +915,12 @@ end_detect:
 static int
 ppc_smc37c935_detect(struct ppc_data *ppc, int chipset_mode)
 {
-   int s;
int type = -1;
 
-   s = splhigh();
+   PPC_CONFIG_LOCK(ppc);
outb(SMC935_CFG, 0x55); /* enter config mode */
outb(SMC935_CFG, 0x55);
-   splx(s);
+   PPC_CONFIG_UNLOCK(ppc);
 
outb(SMC935_IND, SMC935_ID); /* check device id */
if (inb(SMC935_DAT) == 0x2)
___
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: r247067 - head/sys/pci

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 00:36:12 2013
New Revision: 247067
URL: http://svnweb.freebsd.org/changeset/base/247067

Log:
  Kill now-bogus splhigh() -- it is a nop

Modified:
  head/sys/pci/ncr.c

Modified: head/sys/pci/ncr.c
==
--- head/sys/pci/ncr.c  Thu Feb 21 00:27:51 2013(r247066)
+++ head/sys/pci/ncr.c  Thu Feb 21 00:36:12 2013(r247067)
@@ -5544,7 +5544,6 @@ static void ncr_exception (ncb_p np)
**  Freeze system to be able to read the messages.
*/
printf (ncr: fatal error: system halted - press reset to reboot ...);
-   (void) splhigh();
for (;;);
 #endif
 
___
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: r247068 - head/sys/x86/isa

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 00:40:08 2013
New Revision: 247068
URL: http://svnweb.freebsd.org/changeset/base/247068

Log:
  Fix broken usage of splhigh() by removing it.

Modified:
  head/sys/x86/isa/atrtc.c

Modified: head/sys/x86/isa/atrtc.c
==
--- head/sys/x86/isa/atrtc.cThu Feb 21 00:36:12 2013(r247067)
+++ head/sys/x86/isa/atrtc.cThu Feb 21 00:40:08 2013(r247068)
@@ -328,7 +328,6 @@ static int
 atrtc_gettime(device_t dev, struct timespec *ts)
 {
struct clocktime ct;
-   int s;
 
/* Look if we have a RTC present and the time is valid */
if (!(rtcin(RTC_STATUSD)  RTCSD_PWR)) {
@@ -338,11 +337,8 @@ atrtc_gettime(device_t dev, struct times
 
/* wait for time update to complete */
/* If RTCSA_TUP is zero, we have at least 244us before next update */
-   s = splhigh();
-   while (rtcin(RTC_STATUSA)  RTCSA_TUP) {
-   splx(s);
-   s = splhigh();
-   }
+   while (rtcin(RTC_STATUSA)  RTCSA_TUP)
+   continue;
ct.nsec = 0;
ct.sec = readrtc(RTC_SEC);
ct.min = readrtc(RTC_MIN);
___
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: r247069 - head/sys/dev/mcd

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 02:34:04 2013
New Revision: 247069
URL: http://svnweb.freebsd.org/changeset/base/247069

Log:
  The other giant locked storage drivers have removed splbio(), for the
  most part, so remove it here too. Anybody locking this driver will need
  far more than locks where splbio() were, so remove these nops.

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

Modified: head/sys/dev/mcd/mcd.c
==
--- head/sys/dev/mcd/mcd.c  Thu Feb 21 00:40:08 2013(r247068)
+++ head/sys/dev/mcd/mcd.c  Thu Feb 21 02:34:04 2013(r247069)
@@ -289,7 +289,6 @@ static void
 mcdstrategy(struct bio *bp)
 {
struct mcd_softc *sc;
-   int s;
 
sc = (struct mcd_softc *)bp-bio_dev-si_drv1;
 
@@ -318,9 +317,7 @@ mcdstrategy(struct bio *bp)
bp-bio_resid = 0;
 
/* queue it */
-   s = splbio();
bioq_disksort(sc-data.head, bp);
-   splx(s);
 
/* now check whether we can perform processing */
mcd_start(sc);
@@ -338,10 +335,8 @@ static void
 mcd_start(struct mcd_softc *sc)
 {
struct bio *bp;
-   int s = splbio();
 
if (sc-data.flags  MCDMBXBSY) {
-   splx(s);
return;
}
 
@@ -350,10 +345,8 @@ mcd_start(struct mcd_softc *sc)
/* block found to process, dequeue */
/*MCD_TRACE(mcd_start: found block bp=0x%x\n,bp,0,0,0);*/
sc-data.flags |= MCDMBXBSY;
-   splx(s);
} else {
/* nothing to do */
-   splx(s);
return;
}
 
___
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: r247070 - head/sys/pci

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 02:40:20 2013
New Revision: 247070
URL: http://svnweb.freebsd.org/changeset/base/247070

Log:
  Most other giant locked storage drivers in the tree don't use
  splsoftclock to note the need for future locking, so remove it from
  here.

Modified:
  head/sys/pci/ncr.c

Modified: head/sys/pci/ncr.c
==
--- head/sys/pci/ncr.c  Thu Feb 21 02:34:04 2013(r247069)
+++ head/sys/pci/ncr.c  Thu Feb 21 02:40:20 2013(r247070)
@@ -6396,12 +6396,8 @@ static   nccb_p ncr_get_nccb
(ncb_p np, u_long target, u_long lun)
 {
lcb_p lp;
-   int s;
nccb_p cp = NULL;
 
-   /* Keep our timeout handler out */
-   s = splsoftclock();
-   
/*
**  Lun structure available ?
*/
@@ -6434,7 +6430,6 @@ staticnccb_p ncr_get_nccb
}
cp-magic = 1;
}
-   splx(s);
return (cp);
 }
 
___
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: r247071 - head/sys/kern

2013-02-20 Thread Jamie Gritton
Author: jamie
Date: Thu Feb 21 02:41:37 2013
New Revision: 247071
URL: http://svnweb.freebsd.org/changeset/base/247071

Log:
  Don't worry if a module is already loaded when looking for a fstype to mount
  (possible in a race condition).
  
  Reviewed by:  kib
  MFC after:1 week

Modified:
  head/sys/kern/vfs_init.c

Modified: head/sys/kern/vfs_init.c
==
--- head/sys/kern/vfs_init.cThu Feb 21 02:40:20 2013(r247070)
+++ head/sys/kern/vfs_init.cThu Feb 21 02:41:37 2013(r247071)
@@ -122,7 +122,7 @@ struct vfsconf *
 vfs_byname_kld(const char *fstype, struct thread *td, int *error)
 {
struct vfsconf *vfsp;
-   int fileid;
+   int fileid, loaded;
 
vfsp = vfs_byname(fstype);
if (vfsp != NULL)
@@ -130,13 +130,17 @@ vfs_byname_kld(const char *fstype, struc
 
/* Try to load the respective module. */
*error = kern_kldload(td, fstype, fileid);
+   loaded = (*error == 0);
+   if (*error == EEXIST)
+   *error = 0;
if (*error)
return (NULL);
 
/* Look up again to see if the VFS was loaded. */
vfsp = vfs_byname(fstype);
if (vfsp == NULL) {
-   (void)kern_kldunload(td, fileid, LINKER_UNLOAD_FORCE);
+   if (loaded)
+   (void)kern_kldunload(td, fileid, LINKER_UNLOAD_FORCE);
*error = ENODEV;
return (NULL);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r247072 - head/sys/fs/nfsclient

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 02:43:44 2013
New Revision: 247072
URL: http://svnweb.freebsd.org/changeset/base/247072

Log:
  The request queue is already locked, so we don't need the splsofclock/splx
  here to note future work.

Modified:
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==
--- head/sys/fs/nfsclient/nfs_clstate.c Thu Feb 21 02:41:37 2013
(r247071)
+++ head/sys/fs/nfsclient/nfs_clstate.c Thu Feb 21 02:43:44 2013
(r247072)
@@ -1888,7 +1888,7 @@ nfscl_recover(struct nfsclclient *clp, s
struct nfsreq *rep;
u_int64_t len;
u_int32_t delegtype = NFSV4OPEN_DELEGATEWRITE, mode;
-   int i, igotlock = 0, error, trycnt, firstlock, s;
+   int i, igotlock = 0, error, trycnt, firstlock;
struct nfscllayout *lyp, *nlyp;
 
/*
@@ -1945,14 +1945,12 @@ nfscl_recover(struct nfsclclient *clp, s
 * This will be translated to NFSERR_STALEDONTRECOVER when
 * R_DONTRECOVER is set.
 */
-   s = splsoftclock();
NFSLOCKREQ();
TAILQ_FOREACH(rep, nfsd_reqq, r_chain) {
if (rep-r_nmp == nmp)
rep-r_flags |= R_DONTRECOVER;
}
NFSUNLOCKREQ();
-   splx(s);
 
/*
 * Now, mark all delegations need reclaim.
___
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: r247073 - head/sys/dev/ath/ath_hal/ar5416

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Thu Feb 21 02:52:13 2013
New Revision: 247073
URL: http://svnweb.freebsd.org/changeset/base/247073

Log:
  Remove this unneeded printf(), sorry!

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Feb 21 02:43:44 
2013(r247072)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Feb 21 02:52:13 
2013(r247073)
@@ -254,10 +254,6 @@ ar5416InitState(struct ath_hal_5416 *ahp
AH5212(ah)-ah_txTrigLev = (AR_FTRIG_512B  AR_FTRIG_S);
AH5212(ah)-ah_maxTxTrigLev = ((4096 / 64) - 1);
}
-   ath_hal_printf(ah, %s: trigLev=%d, maxTxTrigLev=%d\n,
-   __func__,
-   AH5212(ah)-ah_txTrigLev,
-   AH5212(ah)-ah_maxTxTrigLev);
 #undef AR_FTRIG_512B
 }
 
___
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: r247085 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Thu Feb 21 06:18:40 2013
New Revision: 247085
URL: http://svnweb.freebsd.org/changeset/base/247085

Log:
  Add a new option to limit the maximum size of aggregates.
  The default is to limit them to what the hardware is capable of.
  
  Add sysctl twiddles for both the non-RTS and RTS protected aggregate
  generation.
  
  Whilst here, add some comments about stuff that I've discovered during
  my exploration of the TX aggregate / delimiter setup path from the
  reference driver.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tx.h
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Thu Feb 21 06:12:26 2013(r247084)
+++ head/sys/dev/ath/if_ath.c   Thu Feb 21 06:18:40 2013(r247085)
@@ -799,6 +799,7 @@ ath_attach(u_int16_t devid, struct ath_s
sc-sc_hwq_limit = ATH_AGGR_MIN_QDEPTH;
sc-sc_tid_hwq_lo = ATH_AGGR_SCHED_LOW;
sc-sc_tid_hwq_hi = ATH_AGGR_SCHED_HIGH;
+   sc-sc_aggr_limit = ATH_AGGR_MAXSIZE;
 
/*
 * Check if the hardware requires PCI register serialisation.

Modified: head/sys/dev/ath/if_ath_sysctl.c
==
--- head/sys/dev/ath/if_ath_sysctl.cThu Feb 21 06:12:26 2013
(r247084)
+++ head/sys/dev/ath/if_ath_sysctl.cThu Feb 21 06:18:40 2013
(r247085)
@@ -704,7 +704,7 @@ ath_sysctlattach(struct ath_softc *sc)
 
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
hwq_limit, CTLFLAG_RW, sc-sc_hwq_limit, 0,
-   );
+   Hardware queue depth before software-queuing TX frames);
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
tid_hwq_lo, CTLFLAG_RW, sc-sc_tid_hwq_lo, 0,
);
@@ -712,6 +712,12 @@ ath_sysctlattach(struct ath_softc *sc)
tid_hwq_hi, CTLFLAG_RW, sc-sc_tid_hwq_hi, 0,
);
 
+   /* Aggregate length twiddles */
+   SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+   aggr_limit, CTLFLAG_RW, sc-sc_aggr_limit, 0, );
+   SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+   rts_aggr_limit, CTLFLAG_RW, sc-sc_rts_aggr_limit, 0, );
+
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
txq_data_minfree, CTLFLAG_RW, sc-sc_txq_data_minfree,
0, Minimum free buffers before adding a data frame

Modified: head/sys/dev/ath/if_ath_tx.h
==
--- head/sys/dev/ath/if_ath_tx.hThu Feb 21 06:12:26 2013
(r247084)
+++ head/sys/dev/ath/if_ath_tx.hThu Feb 21 06:18:40 2013
(r247085)
@@ -79,6 +79,11 @@
 #defineBAW_WITHIN(_start, _bawsz, _seqno)  \
_seqno) - (_start))  4095)  (_bawsz))
 
+/*
+ * Maximum aggregate size
+ */
+#defineATH_AGGR_MAXSIZE65530
+
 extern void ath_freetx(struct mbuf *m);
 extern void ath_tx_node_flush(struct ath_softc *sc, struct ath_node *an);
 extern void ath_tx_txq_drain(struct ath_softc *sc, struct ath_txq *txq);

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 21 06:12:26 2013
(r247084)
+++ head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 21 06:18:40 2013
(r247085)
@@ -346,12 +346,19 @@ ath_compute_num_delims(struct ath_softc 
 * crypto hardware catch up. This could be tuned per-MAC and
 * per-rate, but for now we'll simply assume encryption is
 * always enabled.
+*
+* Also note that the Atheros reference driver inserts two
+* delimiters by default for pre-AR9380 peers.  This will
+* include that required delimiter.
 */
ndelim += ATH_AGGR_ENCRYPTDELIM;
 
/*
 * For AR9380, there's a minimum number of delimeters
 * required when doing RTS.
+*
+* XXX TODO: this is only needed if (a) RTS/CTS is enabled, and
+* XXX (b) this is the first sub-frame in the aggregate.
 */
if (sc-sc_use_ent  (sc-sc_ent_cfg  AH_ENT_RTSCTS_DELIM_WAR)
 ndelim  AH_FIRST_DESC_NDELIMS)
@@ -420,9 +427,12 @@ ath_compute_num_delims(struct ath_softc 
 static int
 ath_get_aggr_limit(struct ath_softc *sc, struct ath_buf *bf)
 {
-   int amin = 65530;
+   int amin = ATH_AGGR_MAXSIZE;
int i;
 
+   if (sc-sc_aggr_limit  0  sc-sc_aggr_limit  ATH_AGGR_MAXSIZE)
+   amin = sc-sc_aggr_limit;
+
for (i = 0; i  ATH_RC_NUM; i++) {
if (bf-bf_state.bfs_rc[i].tries == 0)
continue;
@@ -488,6 +498,13 @@ ath_rateseries_setup(struct ath_softc *s
 * XXX It's 

svn commit: r247086 - head/sys/x86/isa

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 06:38:24 2013
New Revision: 247086
URL: http://svnweb.freebsd.org/changeset/base/247086

Log:
  Correct comment about use of pmtimer, and the real reason it isn't
  used or desirable for amd64.

Modified:
  head/sys/x86/isa/clock.c

Modified: head/sys/x86/isa/clock.c
==
--- head/sys/x86/isa/clock.cThu Feb 21 06:18:40 2013(r247085)
+++ head/sys/x86/isa/clock.cThu Feb 21 06:38:24 2013(r247086)
@@ -478,9 +478,10 @@ i8254_restore(void)
  *
  * This function is called from pmtimer_resume() to restore all the timers.
  * This should not be necessary, but there are broken laptops that do not
- * restore all the timers on resume.
- * As long as pmtimer is not part of amd64 suport, skip this for the amd64
- * case.
+ * restore all the timers on resume. The APM spec was at best vague on the
+ * subject.
+ * pmtimer is used only with the old APM power management, and not with
+ * acpi, which is required for amd64, so skip it in that case.
  */
 void
 timer_restore(void)
___
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: r247087 - head/sys/dev/ath

2013-02-20 Thread Adrian Chadd
Author: adrian
Date: Thu Feb 21 06:38:49 2013
New Revision: 247087
URL: http://svnweb.freebsd.org/changeset/base/247087

Log:
  Add an option to allow the minimum number of delimiters to be tweaked.
  
  This is primarily for debugging purposes.
  
  Tested:
  
  * AR5416, STA mode

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Thu Feb 21 06:38:24 2013(r247086)
+++ head/sys/dev/ath/if_ath.c   Thu Feb 21 06:38:49 2013(r247087)
@@ -800,6 +800,7 @@ ath_attach(u_int16_t devid, struct ath_s
sc-sc_tid_hwq_lo = ATH_AGGR_SCHED_LOW;
sc-sc_tid_hwq_hi = ATH_AGGR_SCHED_HIGH;
sc-sc_aggr_limit = ATH_AGGR_MAXSIZE;
+   sc-sc_delim_min_pad = 0;
 
/*
 * Check if the hardware requires PCI register serialisation.

Modified: head/sys/dev/ath/if_ath_sysctl.c
==
--- head/sys/dev/ath/if_ath_sysctl.cThu Feb 21 06:38:24 2013
(r247086)
+++ head/sys/dev/ath/if_ath_sysctl.cThu Feb 21 06:38:49 2013
(r247087)
@@ -714,9 +714,16 @@ ath_sysctlattach(struct ath_softc *sc)
 
/* Aggregate length twiddles */
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
-   aggr_limit, CTLFLAG_RW, sc-sc_aggr_limit, 0, );
+   aggr_limit, CTLFLAG_RW, sc-sc_aggr_limit, 0,
+   Maximum A-MPDU size, or 0 for 'default');
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
-   rts_aggr_limit, CTLFLAG_RW, sc-sc_rts_aggr_limit, 0, );
+   rts_aggr_limit, CTLFLAG_RW, sc-sc_rts_aggr_limit, 0,
+   Maximum A-MPDU size for RTS-protected frames, or '0' 
+   for default);
+   SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+   delim_min_pad, CTLFLAG_RW, sc-sc_delim_min_pad, 0,
+   Enforce a minimum number of delimiters per A-MPDU 
+sub-frame);
 
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
txq_data_minfree, CTLFLAG_RW, sc-sc_txq_data_minfree,

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 21 06:38:24 2013
(r247086)
+++ head/sys/dev/ath/if_ath_tx_ht.c Thu Feb 21 06:38:49 2013
(r247087)
@@ -364,6 +364,13 @@ ath_compute_num_delims(struct ath_softc 
 ndelim  AH_FIRST_DESC_NDELIMS)
ndelim = AH_FIRST_DESC_NDELIMS;
 
+   /*
+* If sc_delim_min_pad is non-zero, enforce it as the minimum
+* pad delimiter count.
+*/
+   if (sc-sc_delim_min_pad != 0)
+   ndelim = MAX(ndelim, sc-sc_delim_min_pad);
+
DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR,
%s: pktlen=%d, ndelim=%d, mpdudensity=%d\n,
__func__, pktlen, ndelim, mpdudensity);

Modified: head/sys/dev/ath/if_athvar.h
==
--- head/sys/dev/ath/if_athvar.hThu Feb 21 06:38:24 2013
(r247086)
+++ head/sys/dev/ath/if_athvar.hThu Feb 21 06:38:49 2013
(r247087)
@@ -719,6 +719,7 @@ struct ath_softc {
int sc_rxchainmask; /* currently configured RX 
chainmask */
int sc_rts_aggr_limit;  /* TX limit on RTS 
aggregates */
int sc_aggr_limit;  /* TX limit on all aggregates */
+   int sc_delim_min_pad;   /* Minimum delimiter 
count */
 
/* Queue limits */
 
___
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: r247086 - head/sys/x86/isa

2013-02-20 Thread Alexey Dokuchaev
On Thu, Feb 21, 2013 at 06:38:24AM +, Warner Losh wrote:
 New Revision: 247086
 URL: http://svnweb.freebsd.org/changeset/base/247086
 
 Log:
   Correct comment about use of pmtimer, and the real reason it isn't
   used or desirable for amd64.

Thanks!

 + * pmtimer is used only with the old APM power management, and not with
 + * acpi, which is required for amd64, so skip it in that case.

Does it also mean it should be removed from ACPI-driven i386 machines kernel
configs?

./danfe
___
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: r247086 - head/sys/x86/isa

2013-02-20 Thread Warner Losh

On Feb 20, 2013, at 11:49 PM, Alexey Dokuchaev wrote:

 On Thu, Feb 21, 2013 at 06:38:24AM +, Warner Losh wrote:
 New Revision: 247086
 URL: http://svnweb.freebsd.org/changeset/base/247086
 
 Log:
  Correct comment about use of pmtimer, and the real reason it isn't
  used or desirable for amd64.
 
 Thanks!
 
 + * pmtimer is used only with the old APM power management, and not with
 + * acpi, which is required for amd64, so skip it in that case.
 
 Does it also mean it should be removed from ACPI-driven i386 machines kernel
 configs?

Likely, but let me confirm with one of the laptops that I have that I know is 
affected and supports acpi.

Warner


___
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: r247088 - head/sys/i386/isa

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 07:16:40 2013
New Revision: 247088
URL: http://svnweb.freebsd.org/changeset/base/247088

Log:
  Locking for todr got pushed down into inittodr and the client
  libraries it calls (although some might not be doing it right). We are
  serialized right now by giant as well. This means the splsoftclock are
  now an anachronism that has no benefit, even marking where locking
  needs to happen. Remove them.

Modified:
  head/sys/i386/isa/pmtimer.c

Modified: head/sys/i386/isa/pmtimer.c
==
--- head/sys/i386/isa/pmtimer.c Thu Feb 21 06:38:49 2013(r247087)
+++ head/sys/i386/isa/pmtimer.c Thu Feb 21 07:16:40 2013(r247088)
@@ -82,26 +82,21 @@ static struct timeval diff_time;
 static int
 pmtimer_suspend(device_t dev)
 {
-   int pl;
 
-   pl = splsoftclock();
microtime(diff_time);
inittodr(0);
microtime(suspend_time);
timevalsub(diff_time, suspend_time);
-   splx(pl);
return (0);
 }
 
 static int
 pmtimer_resume(device_t dev)
 {
-   int pl;
u_int second, minute, hour;
struct timeval resume_time, tmp_time;
 
/* modified for adjkerntz */
-   pl = splsoftclock();
timer_restore();/* restore the all timers */
inittodr(0);/* adjust time to RTC */
microtime(resume_time);
@@ -118,16 +113,13 @@ pmtimer_resume(device_t dev)
timevalsub(resume_time, suspend_time);
/* Fixup the calltodo list with the delta time. */
adjust_timeout_calltodo(resume_time);
-#endif /* PMTIMER_FIXUP_CALLTODOK */
-   splx(pl);
-#ifndef PMTIMER_FIXUP_CALLTODO
-   second = resume_time.tv_sec - suspend_time.tv_sec; 
-#else /* PMTIMER_FIXUP_CALLTODO */
/* 
 * We've already calculated resume_time to be the delta between 
 * the suspend and the resume. 
 */
second = resume_time.tv_sec; 
+#else /* !PMTIMER_FIXUP_CALLTODO */
+   second = resume_time.tv_sec - suspend_time.tv_sec; 
 #endif /* PMTIMER_FIXUP_CALLTODO */
hour = second / 3600;
second %= 3600;
___
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: r247089 - head/sys/dev/si

2013-02-20 Thread Warner Losh
Author: imp
Date: Thu Feb 21 07:19:50 2013
New Revision: 247089
URL: http://svnweb.freebsd.org/changeset/base/247089

Log:
  Remove incorrect comment about splsoftclock.

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

Modified: head/sys/dev/si/si.c
==
--- head/sys/dev/si/si.cThu Feb 21 07:16:40 2013(r247088)
+++ head/sys/dev/si/si.cThu Feb 21 07:19:50 2013(r247089)
@@ -1446,7 +1446,6 @@ si_start(struct tty *tp)
 
 #if 0
 /*
- * Note: called at splsoftclock from the timeout code
  * This has to deal with two things...  cause wakeups while waiting for
  * tty drains on last process exit, and call l_start at about the right
  * time for protocols like ppp.
___
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