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

2012-10-28 Thread Sergey Kandaurov
On 28 October 2012 03:42, Davide Italiano dav...@freebsd.org wrote:
 Author: davide
 Date: Sat Oct 27 23:42:41 2012
 New Revision: 242202
 URL: http://svn.freebsd.org/changeset/base/242202

 Log:
   The fields of struct timespec32 should be int32_t and not uint32_t.
   Make this change.

   Reviewed by:  bde, davidxu
   Tested by:pho
   MFC after:1 week

 Modified:
   head/sys/kern/kern_umtx.c

 Modified: head/sys/kern/kern_umtx.c
 ==
 --- head/sys/kern/kern_umtx.c   Sat Oct 27 23:36:41 2012(r242201)
 +++ head/sys/kern/kern_umtx.c   Sat Oct 27 23:42:41 2012(r242202)
 @@ -3291,8 +3291,8 @@ freebsd32_umtx_unlock(struct thread *td,
  }

  struct timespec32 {
 -   uint32_t tv_sec;
 -   uint32_t tv_nsec;
 +   int32_t tv_sec;
 +   int32_t tv_nsec;
  };

  struct umtx_time32 {

Thanks.
It could be fine to take this from compat/freebsd32, OTOH it hardly makes
sense for me.  IMHO duplicating a single struct definition is sometimes
lesser evil than inclusion pile of unused stuff from yet another header(s).

-- 
wbr,
pluknet
___
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: r242208 - head/contrib/tzdata

2012-10-28 Thread Edwin Groothuis
Author: edwin
Date: Sun Oct 28 09:14:42 2012
New Revision: 242208
URL: http://svn.freebsd.org/changeset/base/242208

Log:
  Merge of vendor import of tzdata2012h
  
  - Bahia no longer has DST.
  - Tocantins has DST.
  - Israel has new DST rules next year.
  - Jordan stays on DST this winter.

Modified:
  head/contrib/tzdata/asia
  head/contrib/tzdata/southamerica
Directory Properties:
  head/contrib/tzdata/   (props changed)

Modified: head/contrib/tzdata/asia
==
--- head/contrib/tzdata/asiaSun Oct 28 09:13:07 2012(r242207)
+++ head/contrib/tzdata/asiaSun Oct 28 09:14:42 2012(r242208)
@@ -1170,15 +1170,15 @@ RuleZion2004only-   Sep 22  
1:000   S
 #
 #  ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+beyond.ps
 
-# From Paul Eggert (2005-02-22):
+# From Paul Eggert (2012-10-26):
 # I used Ephraim Silverberg's dst-israel.el program
 # ftp://ftp.cs.huji.ac.il/pub/tz/software/dst-israel.el (2005-02-20)
 # along with Ed Reingold's cal-hebrew in GNU Emacs 21.4,
-# to generate the transitions in this list.
+# to generate the transitions from 2005 through 2012.
 # (I replaced lastFri with Fri=26 by hand.)
-# The spring transitions below all correspond to the following Rule:
+# The spring transitions all correspond to the following Rule:
 #
-# Rule Zion2005max -   Mar Fri=26 2:001:00D
+# Rule Zion20052012-   Mar Fri=26 2:001:00D
 #
 # but older zic implementations (e.g., Solaris 8) do not support
 # Fri=26 to mean April 1 in years like 2005, so for now we list the
@@ -1195,39 +1195,36 @@ RuleZion2009only-   Sep 27  
2:000   S
 Rule   Zion2010only-   Sep 12  2:000   S
 Rule   Zion2011only-   Apr  1  2:001:00D
 Rule   Zion2011only-   Oct  2  2:000   S
-Rule   Zion20122015-   Mar Fri=26 2:001:00D
+Rule   Zion2012only-   Mar Fri=26 2:001:00D
 Rule   Zion2012only-   Sep 23  2:000   S
-Rule   Zion2013only-   Sep  8  2:000   S
-Rule   Zion2014only-   Sep 28  2:000   S
-Rule   Zion2015only-   Sep 20  2:000   S
-Rule   Zion2016only-   Apr  1  2:001:00D
-Rule   Zion2016only-   Oct  9  2:000   S
-Rule   Zion20172021-   Mar Fri=26 2:001:00D
-Rule   Zion2017only-   Sep 24  2:000   S
-Rule   Zion2018only-   Sep 16  2:000   S
-Rule   Zion2019only-   Oct  6  2:000   S
-Rule   Zion2020only-   Sep 27  2:000   S
-Rule   Zion2021only-   Sep 12  2:000   S
-Rule   Zion2022only-   Apr  1  2:001:00D
-Rule   Zion2022only-   Oct  2  2:000   S
-Rule   Zion20232032-   Mar Fri=26 2:001:00D
-Rule   Zion2023only-   Sep 24  2:000   S
-Rule   Zion2024only-   Oct  6  2:000   S
-Rule   Zion2025only-   Sep 28  2:000   S
-Rule   Zion2026only-   Sep 20  2:000   S
-Rule   Zion2027only-   Oct 10  2:000   S
-Rule   Zion2028only-   Sep 24  2:000   S
-Rule   Zion2029only-   Sep 16  2:000   S
-Rule   Zion2030only-   Oct  6  2:000   S
-Rule   Zion2031only-   Sep 21  2:000   S
-Rule   Zion2032only-   Sep 12  2:000   S
-Rule   Zion2033only-   Apr  1  2:001:00D
-Rule   Zion2033only-   Oct  2  2:000   S
-Rule   Zion20342037-   Mar Fri=26 2:001:00D
-Rule   Zion2034only-   Sep 17  2:000   S
-Rule   Zion2035only-   Oct  7  2:000   S
-Rule   Zion2036only-   Sep 28  2:000   S
-Rule   Zion2037only-   Sep 13  2:000   S
+
+# From Ephraim Silverberg (2012-10-18):
+
+# Yesterday, the Interior Ministry Committee, after more than a year
+# past, approved sending the proposed June 2011 changes to the Time
+# Decree Law back to the Knesset for second and third (final) votes
+# before the upcoming elections on Jan. 22, 2013.  Hence, although the
+# changes are not yet law, they are expected to be so before Februray 2013.
+#
+# As of 2013, DST starts at 02:00 on the Friday before the last Sunday in 

Re: svn commit: r241916 - in head/sys: netinet netinet6

2012-10-28 Thread Ulrich Spörlein
On Tue, 2012-10-23 at 20:43:33 +0200, Michael Tuexen wrote:
 On Oct 23, 2012, at 8:28 PM, Bruce Evans wrote:
 
  On Tue, 23 Oct 2012, Michael Tuexen wrote:
  
  On Oct 23, 2012, at 6:23 AM, Bruce Evans wrote:
  
  On Mon, 22 Oct 2012, Xin LI wrote:
  
  Log:
  Remove __P.
  
  This was a chance to remove style bugs in the prototypes.  At least it
  didn't create so many new ones, unlike the original __P axing.  It
  still enlarged about a hundred by changing from Gnu style continuation
  to Gnu style continuation indentation with an off-by-5 error.
  
  please note that the SCTP code in the FreeBSD sources is generated
  via an export script from a codebase which runs on multiple platforms.
  The script tries to follow FreeBSDs guidelines, but is far from being
  perfect.
  
  The export script might not like manual editing of its output.
  
  Portability might require __P(()), and then removing it cleaning requires
  a complicated script.
 Maybe I wasn't clear...
 
 * The removal of __P() needs also be done upstream. I'll handle this, not 
 problem.
   I don't think we need __P on any platform.
 * My comment was regarding your list of formatting issues of the code. 
 Changing
   the formatting would require changing the export script.
   If someone just changes the FreeBSD sources and these changes are not 
 included
   upstream, they are lost by the next commit of rrs@ or mine.
 
 My point was: Getting rid of __P is fine and we can handle that upstream (as
 any other non whitespace/formatting changes needed), but changing the 
 formatting
 is NOT that easy. I'm sorry about that and just wanted to let you know that
 there is a reason why the style 9 stuff is not followed exactly within the
 SCTP code.
 
 I hope this makes the situation clearer.

Maybe running it through uncrustify[1] as part of the export for FreeBSD
could help here?

hth
Uli

[1] http://uncrustify.sourceforge.net/ and textproc/uncrustify
___
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: r242218 - in head/sys/ia64: ia64 include

2012-10-28 Thread Konstantin Belousov
Author: kib
Date: Sun Oct 28 11:53:54 2012
New Revision: 242218
URL: http://svn.freebsd.org/changeset/base/242218

Log:
  Fix compilation on ia64 when page size is configured for 16KB.
  
  Reviewed by:  alc, marcel

Modified:
  head/sys/ia64/ia64/pmap.c
  head/sys/ia64/include/pmap.h

Modified: head/sys/ia64/ia64/pmap.c
==
--- head/sys/ia64/ia64/pmap.c   Sun Oct 28 11:27:54 2012(r242217)
+++ head/sys/ia64/ia64/pmap.c   Sun Oct 28 11:53:54 2012(r242218)
@@ -140,6 +140,29 @@ extern uint64_t ia64_gateway_page[];
 #definepmap_set_wired(lpte)(lpte)-pte |= PTE_WIRED
 
 /*
+ * Individual PV entries are stored in per-pmap chunks.  This saves
+ * space by eliminating the need to record the pmap within every PV
+ * entry.
+ */
+#if PAGE_SIZE == 8192
+#define_NPCM   6
+#define_NPCPV  337
+#define_NPCS   2
+#elif PAGE_SIZE == 16384
+#define_NPCM   11
+#define_NPCPV  677
+#define_NPCS   1
+#endif
+struct pv_chunk {
+   pmap_t  pc_pmap;
+   TAILQ_ENTRY(pv_chunk)   pc_list;
+   u_long  pc_map[_NPCM];  /* bitmap; 1 = free */
+   TAILQ_ENTRY(pv_chunk)   pc_lru;
+   u_long  pc_spare[_NPCS];
+   struct pv_entry pc_pventry[_NPCPV];
+};
+
+/*
  * The VHPT bucket head structure.
  */
 struct ia64_bucket {
@@ -693,8 +716,6 @@ pmap_growkernel(vm_offset_t addr)
  ***/
 
 CTASSERT(sizeof(struct pv_chunk) == PAGE_SIZE);
-CTASSERT(_NPCM == 6);
-CTASSERT(_NPCPV == 337);
 
 static __inline struct pv_chunk *
 pv_to_chunk(pv_entry_t pv)
@@ -705,13 +726,23 @@ pv_to_chunk(pv_entry_t pv)
 
 #define PV_PMAP(pv) (pv_to_chunk(pv)-pc_pmap)
 
-#definePC_FREE0_4  0xul
-#definePC_FREE50x0001ul
+#definePC_FREE_FULL0xul
+#definePC_FREE_PARTIAL \
+   ((1UL  (_NPCPV - sizeof(u_long) * 8 * (_NPCM - 1))) - 1)
 
+#if PAGE_SIZE == 8192
 static const u_long pc_freemask[_NPCM] = {
-   PC_FREE0_4, PC_FREE0_4, PC_FREE0_4,
-   PC_FREE0_4, PC_FREE0_4, PC_FREE5
+   PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+   PC_FREE_FULL, PC_FREE_FULL, PC_FREE_PARTIAL
 };
+#elif PAGE_SIZE == 16384
+static const u_long pc_freemask[_NPCM] = {
+   PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+   PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+   PC_FREE_FULL, PC_FREE_FULL, PC_FREE_FULL,
+   PC_FREE_FULL, PC_FREE_PARTIAL
+};
+#endif
 
 static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, VM/pmap parameters);
 

Modified: head/sys/ia64/include/pmap.h
==
--- head/sys/ia64/include/pmap.hSun Oct 28 11:27:54 2012
(r242217)
+++ head/sys/ia64/include/pmap.hSun Oct 28 11:53:54 2012
(r242218)
@@ -105,21 +105,6 @@ typedef struct pv_entry {
TAILQ_ENTRY(pv_entry)   pv_list;
 } *pv_entry_t;
 
-/*
- * pv_entries are allocated in chunks per-process.  This avoids the
- * need to track per-pmap assignments.
- */
-#define_NPCM   6
-#define_NPCPV  337
-struct pv_chunk {
-   pmap_t  pc_pmap;
-   TAILQ_ENTRY(pv_chunk)   pc_list;
-   u_long  pc_map[_NPCM];  /* bitmap; 1 = free */
-   TAILQ_ENTRY(pv_chunk)   pc_lru;
-   u_long  pc_spare[2];
-   struct pv_entry pc_pventry[_NPCPV];
-};
-
 #ifdef _KERNEL
 
 extern vm_paddr_t phys_avail[];
___
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: r242223 - head/sys/dev/sound/usb

2012-10-28 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Oct 28 14:37:17 2012
New Revision: 242223
URL: http://svn.freebsd.org/changeset/base/242223

Log:
  Implement support for the so-called USB feedback endpoint for USB
  audio devices. This endpoint gives clues to the USB host about the
  actual data rate on asynchronous endpoints and makes the more
  expensive USB audio devices usable under FreeBSD.
  The Linux USB audio driver was used as reference for the
  automagic shift of the received value.
  
  MFC after:1 week

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Sun Oct 28 13:21:35 2012
(r24)
+++ head/sys/dev/sound/usb/uaudio.c Sun Oct 28 14:37:17 2012
(r242223)
@@ -176,7 +176,7 @@ struct uaudio_chan {
struct mtx *pcm_mtx;/* lock protecting this structure */
struct uaudio_softc *priv_sc;
struct pcm_channel *pcm_ch;
-   struct usb_xfer *xfer[UAUDIO_NCHANBUFS];
+   struct usb_xfer *xfer[UAUDIO_NCHANBUFS + 1];
union uaudio_asf1d p_asf1d;
union uaudio_sed p_sed;
const usb_endpoint_descriptor_audio_t *p_ed1;
@@ -206,6 +206,12 @@ struct uaudio_chan {
uint8_t iface_index;
uint8_t iface_alt_index;
uint8_t channels;
+
+   uint8_t last_sync_time;
+   uint8_t last_sync_state;
+#defineUAUDIO_SYNC_NONE 0
+#defineUAUDIO_SYNC_MORE 1
+#defineUAUDIO_SYNC_LESS 2
 };
 
 #defineUMIDI_CABLES_MAX   16   /* units */
@@ -386,7 +392,9 @@ static device_attach_t uaudio_attach;
 static device_detach_t uaudio_detach;
 
 static usb_callback_t uaudio_chan_play_callback;
+static usb_callback_t uaudio_chan_play_sync_callback;
 static usb_callback_t uaudio_chan_record_callback;
+static usb_callback_t uaudio_chan_record_sync_callback;
 static usb_callback_t uaudio_mixer_write_cfg_callback;
 static usb_callback_t umidi_bulk_read_callback;
 static usb_callback_t umidi_bulk_write_callback;
@@ -482,7 +490,7 @@ static void uaudio_chan_dump_ep_desc(
 #endif
 
 static const struct usb_config
-   uaudio_cfg_record[UAUDIO_NCHANBUFS] = {
+   uaudio_cfg_record[UAUDIO_NCHANBUFS + 1] = {
[0] = {
.type = UE_ISOCHRONOUS,
.endpoint = UE_ADDR_ANY,
@@ -502,10 +510,20 @@ static const struct usb_config
.flags = {.short_xfer_ok = 1,},
.callback = uaudio_chan_record_callback,
},
+
+   [2] = {
+   .type = UE_ISOCHRONOUS,
+   .endpoint = UE_ADDR_ANY,
+   .direction = UE_DIR_OUT,
+   .bufsize = 0,   /* use wMaxPacketSize * frames */
+   .frames = 1,
+   .flags = {.no_pipe_ok = 1,.short_xfer_ok = 1,},
+   .callback = uaudio_chan_record_sync_callback,
+   },
 };
 
 static const struct usb_config
-   uaudio_cfg_play[UAUDIO_NCHANBUFS] = {
+   uaudio_cfg_play[UAUDIO_NCHANBUFS + 1] = {
[0] = {
.type = UE_ISOCHRONOUS,
.endpoint = UE_ADDR_ANY,
@@ -525,6 +543,16 @@ static const struct usb_config
.flags = {.short_xfer_ok = 1,},
.callback = uaudio_chan_play_callback,
},
+
+   [2] = {
+   .type = UE_ISOCHRONOUS,
+   .endpoint = UE_ADDR_ANY,
+   .direction = UE_DIR_IN,
+   .bufsize = 0,   /* use wMaxPacketSize * frames */
+   .frames = 1,
+   .flags = {.no_pipe_ok = 1,.short_xfer_ok = 1,},
+   .callback = uaudio_chan_play_sync_callback,
+   },
 };
 
 static const struct usb_config
@@ -845,9 +873,9 @@ uaudio_detach(device_t dev)
 * any.
 */
if (sc-sc_play_chan.valid)
-   usbd_transfer_unsetup(sc-sc_play_chan.xfer, UAUDIO_NCHANBUFS);
+   usbd_transfer_unsetup(sc-sc_play_chan.xfer, UAUDIO_NCHANBUFS + 
1);
if (sc-sc_rec_chan.valid)
-   usbd_transfer_unsetup(sc-sc_rec_chan.xfer, UAUDIO_NCHANBUFS);
+   usbd_transfer_unsetup(sc-sc_rec_chan.xfer, UAUDIO_NCHANBUFS + 
1);
 
if (bus_generic_detach(dev) != 0) {
DPRINTF(detach failed!\n);
@@ -1396,10 +1424,96 @@ done:
 }
 
 static void
+uaudio_chan_play_sync_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+   struct uaudio_chan *ch = usbd_xfer_softc(xfer);
+   struct usb_page_cache *pc;
+   uint8_t buf[4];
+   uint64_t temp;
+   int len;
+   int actlen;
+   int nframes;
+
+   usbd_xfer_status(xfer, actlen, NULL, NULL, nframes);
+
+   switch (USB_GET_STATE(xfer)) {
+   case USB_ST_TRANSFERRED:
+
+   DPRINTFN(6, transferred %d bytes\n, actlen);
+
+   if (nframes == 0)
+   break;
+   len = usbd_xfer_frame_len(xfer, 0);
+   if (len == 0)
+   break;
+

svn commit: r242249 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 17:16:09 2012
New Revision: 242249
URL: http://svn.freebsd.org/changeset/base/242249

Log:
  Adjust the initial default CWND upon connection establishment to the
  new and increased values specified by RFC5681 Section 3.1.
  
  The even larger initial CWND per RFC3390, if enabled, is not affected.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSun Oct 28 17:06:50 2012
(r242248)
+++ head/sys/netinet/tcp_input.cSun Oct 28 17:16:09 2012
(r242249)
@@ -351,8 +351,15 @@ cc_conn_init(struct tcpcb *tp)
if (V_tcp_do_rfc3390)
tp-snd_cwnd = min(4 * tp-t_maxseg,
max(2 * tp-t_maxseg, 4380));
-   else
-   tp-snd_cwnd = tp-t_maxseg;
+   else {
+   /* Per RFC5681 Section 3.1 */
+   if (tp-t_maxseg  2190)
+   tp-snd_cwnd = 2 * tp-t_maxseg;
+   else if (tp-t_maxseg  1095)
+   tp-snd_cwnd = 3 * tp-t_maxseg;
+   else
+   tp-snd_cwnd = 4 * tp-t_maxseg;
+   }
 
if (CC_ALGO(tp)-conn_init != NULL)
CC_ALGO(tp)-conn_init(tp-ccv);
___
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: r242250 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 17:25:08 2012
New Revision: 242250
URL: http://svn.freebsd.org/changeset/base/242250

Log:
  When SYN or SYN/ACK had to be retransmitted RFC5681 requires us to
  reduce the initial CWND to one segment.  This reduction got lost
  some time ago due to a change in initialization ordering.
  
  Additionally in tcp_timer_rexmt() avoid entering fast recovery when
  we're still in TCPS_SYN_SENT state.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSun Oct 28 17:16:09 2012
(r242249)
+++ head/sys/netinet/tcp_input.cSun Oct 28 17:25:08 2012
(r242250)
@@ -345,10 +345,16 @@ cc_conn_init(struct tcpcb *tp)
/*
 * Set the initial slow-start flight size.
 *
-* RFC3390 says only do this if SYN or SYN/ACK didn't got lost.
-* XXX: We currently check only in syncache_socket for that.
-*/
-   if (V_tcp_do_rfc3390)
+* RFC5681 Section 3.1 specifies the default conservative values.
+* RFC3390 specifies slightly more aggressive values.
+*
+* If a SYN or SYN/ACK was lost and retransmitted, we have to
+* reduce the initial CWND to one segment as congestion is likely
+* requiring us to be cautious.
+*/
+   if (tp-snd_cwnd == 1)
+   tp-snd_cwnd = tp-t_maxseg;/* SYN(-ACK) lost */
+   else if (V_tcp_do_rfc3390)
tp-snd_cwnd = min(4 * tp-t_maxseg,
max(2 * tp-t_maxseg, 4380));
else {

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Sun Oct 28 17:16:09 2012
(r242249)
+++ head/sys/netinet/tcp_syncache.c Sun Oct 28 17:25:08 2012
(r242250)
@@ -852,11 +852,12 @@ syncache_socket(struct syncache *sc, str
tcp_mss(tp, sc-sc_peer_mss);
 
/*
-* If the SYN,ACK was retransmitted, reset cwnd to 1 segment.
+* If the SYN,ACK was retransmitted, indicate that CWND to be
+* limited to one segment in cc_conn_init().
 * NB: sc_rxmits counts all SYN,ACK transmits, not just retransmits.
 */
if (sc-sc_rxmits  1)
-   tp-snd_cwnd = tp-t_maxseg;
+   tp-snd_cwnd = 1;
 
 #ifdef TCP_OFFLOAD
/*

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 17:16:09 2012
(r242249)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 17:25:08 2012
(r242250)
@@ -539,7 +539,13 @@ tcp_timer_rexmt(void * xtp)
}
INP_INFO_RUNLOCK(V_tcbinfo);
headlocked = 0;
-   if (tp-t_rxtshift == 1) {
+   if (tp-t_state == TCPS_SYN_SENT) {
+   /*
+* If the SYN was retransmitted, indicate CWND to be
+* limited to 1 segment in cc_conn_init().
+*/
+   tp-snd_cwnd = 1;
+   } else if (tp-t_rxtshift == 1) {
/*
 * first retransmit; record ssthresh and cwnd so they can
 * be recovered if this turns out to be a bad retransmit.
___
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: r242251 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 17:30:28 2012
New Revision: 242251
URL: http://svn.freebsd.org/changeset/base/242251

Log:
  When SYN or SYN/ACK had to be retransmitted RFC5681 requires us to
  reduce the initial CWND to one segment.  This reduction got lost
  some time ago due to a change in initialization ordering.
  
  Additionally in tcp_timer_rexmt() avoid entering fast recovery when
  we're still in TCPS_SYN_SENT state.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_output.c

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Sun Oct 28 17:25:08 2012
(r242250)
+++ head/sys/netinet/tcp_output.c   Sun Oct 28 17:30:28 2012
(r242251)
@@ -551,10 +551,14 @@ after_sack_rexmit:
 * max size segments, or at least 50% of the maximum possible
 * window, then want to send a window update to peer.
 * Skip this if the connection is in T/TCP half-open state.
-* Don't send pure window updates when the peer has closed
-* the connection and won't ever send more data.
+*
+* Don't send an independent window update if a delayed
+* ACK is pending (it will get piggy-backed on it) or the
+* remote side already has done a half-close and won't send
+* more data.
 */
if (recwin  0  !(tp-t_flags  TF_NEEDSYN) 
+   !(tp-t_flags  TF_DELACK) 
!TCPS_HAVERCVDFIN(tp-t_state)) {
/*
 * adv is the amount we can increase the window,
___
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: r242252 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 17:40:35 2012
New Revision: 242252
URL: http://svn.freebsd.org/changeset/base/242252

Log:
  Prevent a flurry of forced window updates when an application is
  doing small reads on a (partially) filled receive socket buffer.
  
  Normally one would a send a window update every time the available
  space in the socket buffer increases by two times MSS.  This leads
  to a flurry of window updates that do not provide any meaningful
  new information to the sender.  There still is available space in
  the window and the sender can continue sending data.  All window
  updates then get carried by the regular ACKs.  Only when the socket
  buffer was (almost) full and the window closed accordingly a window
  updates delivery new information and allows the sender to start
  sending more data again.
  
  Send window updates only every two MSS when the socket buffer
  has less than 1/8 space available, or the available space in the
  socket buffer increased by 1/4 its full capacity, or the socket
  buffer is very small.  The next regular data ACK will carry and
  report the exact window size again.
  
  Reported by:  sbruno
  Tested by:darrenr
  Tested by:Darren Baginski
  PR:   kern/116335
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_output.c

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Sun Oct 28 17:30:28 2012
(r242251)
+++ head/sys/netinet/tcp_output.c   Sun Oct 28 17:40:35 2012
(r242252)
@@ -545,23 +545,39 @@ after_sack_rexmit:
}
 
/*
-* Compare available window to amount of window
-* known to peer (as advertised window less
-* next expected input).  If the difference is at least two
-* max size segments, or at least 50% of the maximum possible
-* window, then want to send a window update to peer.
-* Skip this if the connection is in T/TCP half-open state.
+* Sending of standalone window updates.
+*
+* Window updates important when we close our window due to a full
+* socket buffer and are opening it again after the application
+* reads data from it.  Once the window has opened again and the
+* remote end starts to send again the ACK clock takes over and
+* provides the most current window information.
+*
+* We must avoid to the silly window syndrome whereas every read
+* from the receive buffer, no matter how small, causes a window
+* update to be sent.  We also should avoid sending a flurry of
+* window updates when the socket buffer had queued a lot of data
+* and the application is doing small reads.
+*
+* Prevent a flurry of pointless window updates by only sending
+* an update when we can increase the advertized window by more
+* than 1/4th of the socket buffer capacity.  When the buffer is
+* getting full or is very small be more aggressive and send an
+* update whenever we can increase by two mss sized segments.
+* In all other situations the ACK's to new incoming data will
+* carry further window increases.
 *
 * Don't send an independent window update if a delayed
 * ACK is pending (it will get piggy-backed on it) or the
 * remote side already has done a half-close and won't send
-* more data.
+* more data.  Skip this if the connection is in T/TCP
+* half-open state.
 */
if (recwin  0  !(tp-t_flags  TF_NEEDSYN) 
!(tp-t_flags  TF_DELACK) 
!TCPS_HAVERCVDFIN(tp-t_state)) {
/*
-* adv is the amount we can increase the window,
+* adv is the amount we could increase the window,
 * taking into account that we are limited by
 * TCP_MAXWIN  tp-rcv_scale.
 */
@@ -581,9 +597,11 @@ after_sack_rexmit:
 */
if (oldwin  tp-rcv_scale == (adv + oldwin)  tp-rcv_scale)
goto dontupdate;
-   if (adv = (long) (2 * tp-t_maxseg))
-   goto send;
-   if (2 * adv = (long) so-so_rcv.sb_hiwat)
+
+   if (adv = (long)(2 * tp-t_maxseg) 
+   (adv = (long)(so-so_rcv.sb_hiwat / 4) ||
+recwin = (long)(so-so_rcv.sb_hiwat / 8) ||
+so-so_rcv.sb_hiwat = 8 * tp-t_maxseg))
goto send;
}
 dontupdate:
___
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: r242253 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 17:59:46 2012
New Revision: 242253
URL: http://svn.freebsd.org/changeset/base/242253

Log:
  Simplify implementation of net.inet.tcp.reass.maxsegments and
  net.inet.tcp.reass.cursegments.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_reass.c

Modified: head/sys/netinet/tcp_reass.c
==
--- head/sys/netinet/tcp_reass.cSun Oct 28 17:40:35 2012
(r242252)
+++ head/sys/netinet/tcp_reass.cSun Oct 28 17:59:46 2012
(r242253)
@@ -74,7 +74,6 @@ __FBSDID($FreeBSD$);
 #include netinet/tcp_debug.h
 #endif /* TCPDEBUG */
 
-static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS);
 static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS);
 
 static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
@@ -82,16 +81,12 @@ static SYSCTL_NODE(_net_inet_tcp, OID_AU
 
 static VNET_DEFINE(int, tcp_reass_maxseg) = 0;
 #defineV_tcp_reass_maxseg  VNET(tcp_reass_maxseg)
-SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments,
-CTLTYPE_INT | CTLFLAG_RDTUN,
-VNET_NAME(tcp_reass_maxseg), 0, tcp_reass_sysctl_maxseg, I,
+SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
+VNET_NAME(tcp_reass_maxseg), 0,
 Global maximum number of TCP Segments in Reassembly Queue);
 
-static VNET_DEFINE(int, tcp_reass_qsize) = 0;
-#defineV_tcp_reass_qsize   VNET(tcp_reass_qsize)
 SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments,
-CTLTYPE_INT | CTLFLAG_RD,
-VNET_NAME(tcp_reass_qsize), 0, tcp_reass_sysctl_qsize, I,
+(CTLTYPE_INT | CTLFLAG_RD), NULL, 0, tcp_reass_sysctl_qsize, I,
 Global number of TCP Segments currently in Reassembly Queue);
 
 static VNET_DEFINE(int, tcp_reass_overflows) = 0;
@@ -109,8 +104,10 @@ static void
 tcp_reass_zone_change(void *tag)
 {
 
+   /* Set the zone limit and read back the effective value. */
V_tcp_reass_maxseg = nmbclusters / 16;
uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
+   V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
 }
 
 void
@@ -122,7 +119,9 @@ tcp_reass_init(void)
V_tcp_reass_maxseg);
V_tcp_reass_zone = uma_zcreate(tcpreass, sizeof (struct tseg_qent),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+   /* Set the zone limit and read back the effective value. */
uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
+   V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
EVENTHANDLER_REGISTER(nmbclusters_change,
tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 }
@@ -156,17 +155,12 @@ tcp_reass_flush(struct tcpcb *tp)
 }
 
 static int
-tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS)
-{
-   V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
-   return (sysctl_handle_int(oidp, arg1, arg2, req));
-}
-
-static int
 tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS)
 {
-   V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone);
-   return (sysctl_handle_int(oidp, arg1, arg2, req));
+   int qsize;
+
+   qsize = uma_zone_get_cur(V_tcp_reass_zone);
+   return (sysctl_handle_int(oidp, qsize, sizeof(qsize), req));
 }
 
 int
___
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: r242254 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 18:07:34 2012
New Revision: 242254
URL: http://svn.freebsd.org/changeset/base/242254

Log:
  Change the syncache count reporting the current number of entries
  from an unprotected u_int that reports garbage on SMP to a function
  based sysctl obtaining the current value from UMA.
  
  Also read back the actual cache_limit after page size rounding by UMA.
  
  PR:   kern/165879
  MFC after:2 weeks

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

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Sun Oct 28 17:59:46 2012
(r242253)
+++ head/sys/netinet/tcp_syncache.c Sun Oct 28 18:07:34 2012
(r242254)
@@ -123,6 +123,7 @@ struct syncache *syncache_lookup(struct 
 static int  syncache_respond(struct syncache *);
 static struct   socket *syncache_socket(struct syncache *, struct socket *,
struct mbuf *m);
+static int  syncache_sysctl_count(SYSCTL_HANDLER_ARGS);
 static void syncache_timeout(struct syncache *sc, struct syncache_head 
*sch,
int docallout);
 static void syncache_timer(void *);
@@ -158,8 +159,8 @@ SYSCTL_VNET_UINT(_net_inet_tcp_syncache,
 VNET_NAME(tcp_syncache.cache_limit), 0,
 Overall entry limit for syncache);
 
-SYSCTL_VNET_UINT(_net_inet_tcp_syncache, OID_AUTO, count, CTLFLAG_RD,
-VNET_NAME(tcp_syncache.cache_count), 0,
+SYSCTL_VNET_PROC(_net_inet_tcp_syncache, OID_AUTO, count, 
(CTLTYPE_UINT|CTLFLAG_RD),
+NULL, 0, syncache_sysctl_count, IU,
 Current number of entries in syncache);
 
 SYSCTL_VNET_UINT(_net_inet_tcp_syncache, OID_AUTO, hashsize, CTLFLAG_RDTUN,
@@ -225,7 +226,6 @@ syncache_init(void)
 {
int i;
 
-   V_tcp_syncache.cache_count = 0;
V_tcp_syncache.hashsize = TCP_SYNCACHE_HASHSIZE;
V_tcp_syncache.bucket_limit = TCP_SYNCACHE_BUCKETLIMIT;
V_tcp_syncache.rexmt_limit = SYNCACHE_MAXREXMTS;
@@ -269,6 +269,7 @@ syncache_init(void)
V_tcp_syncache.zone = uma_zcreate(syncache, sizeof(struct syncache),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
uma_zone_set_max(V_tcp_syncache.zone, V_tcp_syncache.cache_limit);
+   V_tcp_syncache.cache_limit = uma_zone_get_max(V_tcp_syncache.zone);
 }
 
 #ifdef VIMAGE
@@ -296,8 +297,8 @@ syncache_destroy(void)
mtx_destroy(sch-sch_mtx);
}
 
-   KASSERT(V_tcp_syncache.cache_count == 0, (%s: cache_count %d not 0,
-   __func__, V_tcp_syncache.cache_count));
+   KASSERT(uma_zone_get_cur(V_tcp_syncache.zone) == 0,
+   (%s: cache_count not 0, __func__));
 
/* Free the allocated global resources. */
uma_zdestroy(V_tcp_syncache.zone);
@@ -305,6 +306,15 @@ syncache_destroy(void)
 }
 #endif
 
+static int
+syncache_sysctl_count(SYSCTL_HANDLER_ARGS)
+{
+   int count;
+
+   count = uma_zone_get_cur(V_tcp_syncache.zone);
+   return (sysctl_handle_int(oidp, count, sizeof(count), req));
+}
+
 /*
  * Inserts a syncache entry into the specified bucket row.
  * Locks and unlocks the syncache_head autonomously.
@@ -347,7 +357,6 @@ syncache_insert(struct syncache *sc, str
 
SCH_UNLOCK(sch);
 
-   V_tcp_syncache.cache_count++;
TCPSTAT_INC(tcps_sc_added);
 }
 
@@ -373,7 +382,6 @@ syncache_drop(struct syncache *sc, struc
 #endif
 
syncache_free(sc);
-   V_tcp_syncache.cache_count--;
 }
 
 /*
@@ -958,7 +966,6 @@ syncache_expand(struct in_conninfo *inc,
tod-tod_syncache_removed(tod, sc-sc_todctx);
}
 #endif
-   V_tcp_syncache.cache_count--;
SCH_UNLOCK(sch);
}
 

Modified: head/sys/netinet/tcp_syncache.h
==
--- head/sys/netinet/tcp_syncache.h Sun Oct 28 17:59:46 2012
(r242253)
+++ head/sys/netinet/tcp_syncache.h Sun Oct 28 18:07:34 2012
(r242254)
@@ -112,7 +112,6 @@ struct tcp_syncache {
u_int   hashsize;
u_int   hashmask;
u_int   bucket_limit;
-   u_int   cache_count;/* XXX: unprotected */
u_int   cache_limit;
u_int   rexmt_limit;
u_int   hash_secret;
___
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: r242255 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 18:33:52 2012
New Revision: 242255
URL: http://svn.freebsd.org/changeset/base/242255

Log:
  Allow arbitrary MSS sizes and don't mind about the cluster size anymore.
  We've got more cluster sizes for quite some time now and the orginally
  imposed limits and the previously codified thoughts on efficiency gains
  are no longer true.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSun Oct 28 18:07:34 2012
(r242254)
+++ head/sys/netinet/tcp_input.cSun Oct 28 18:33:52 2012
(r242255)
@@ -3322,10 +3322,8 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt
 /*
  * Determine a reasonable value for maxseg size.
  * If the route is known, check route for mtu.
- * If none, use an mss that can be handled on the outgoing
- * interface without forcing IP to fragment; if bigger than
- * an mbuf cluster (MCLBYTES), round down to nearest multiple of MCLBYTES
- * to utilize large mbufs.  If no route is found, route has no mtu,
+ * If none, use an mss that can be handled on the outgoing interface
+ * without forcing IP to fragment.  If no route is found, route has no mtu,
  * or the destination isn't local, use a default, hopefully conservative
  * size (usually 512 or the default IP max size, but no more than the mtu
  * of the interface), as we can't discover anything about intervening
@@ -3506,13 +3504,6 @@ tcp_mss_update(struct tcpcb *tp, int off
 (tp-t_flags  TF_RCVD_TSTMP) == TF_RCVD_TSTMP))
mss -= TCPOLEN_TSTAMP_APPA;
 
-#if(MCLBYTES  (MCLBYTES - 1)) == 0
-   if (mss  MCLBYTES)
-   mss = ~(MCLBYTES-1);
-#else
-   if (mss  MCLBYTES)
-   mss = mss / MCLBYTES * MCLBYTES;
-#endif
tp-t_maxseg = mss;
 }
 
___
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: r242256 - head/sys/kern

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 18:38:51 2012
New Revision: 242256
URL: http://svn.freebsd.org/changeset/base/242256

Log:
  Improve m_cat() by being able to also merge contents from M_EXT
  mbuf's by doing proper testing with M_WRITABLE().
  
  In m_collapse() replace an incomplete manual check for M_RDONLY
  with the M_WRITABLE() macro that also tests for shared buffers
  and other cases that make a particular mbuf immutable.
  
  MFC after:2 weeks

Modified:
  head/sys/kern/uipc_mbuf.c

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Sun Oct 28 18:33:52 2012(r242255)
+++ head/sys/kern/uipc_mbuf.c   Sun Oct 28 18:38:51 2012(r242256)
@@ -911,8 +911,8 @@ m_cat(struct mbuf *m, struct mbuf *n)
while (m-m_next)
m = m-m_next;
while (n) {
-   if (m-m_flags  M_EXT ||
-   m-m_data + m-m_len + n-m_len = m-m_dat[MLEN]) {
+   if (!M_WRITABLE(m) ||
+   M_TRAILINGSPACE(m)  n-m_len) {
/* just join the two chains */
m-m_next = n;
return;
@@ -1584,7 +1584,7 @@ again:
n = m-m_next;
if (n == NULL)
break;
-   if ((m-m_flags  M_RDONLY) == 0 
+   if (M_WRITABLE(m) 
n-m_len  M_TRAILINGSPACE(m)) {
bcopy(mtod(n, void *), mtod(m, char *) + m-m_len,
n-m_len);
___
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: r242257 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 18:45:04 2012
New Revision: 242257
URL: http://svn.freebsd.org/changeset/base/242257

Log:
  Remove bogus 'else' in #ifdef that prevented the rttvar from being reset
  tcp_timer_rexmt() on retransmit for IPv6 sessions.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 18:38:51 2012
(r242256)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 18:45:04 2012
(r242257)
@@ -596,7 +596,6 @@ tcp_timer_rexmt(void * xtp)
 #ifdef INET6
if ((tp-t_inpcb-inp_vflag  INP_IPV6) != 0)
in6_losing(tp-t_inpcb);
-   else
 #endif
tp-t_rttvar += (tp-t_srtt  TCP_RTT_SHIFT);
tp-t_srtt = 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: r242258 - head/sys/dev/ath

2012-10-28 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 28 18:46:06 2012
New Revision: 242258
URL: http://svn.freebsd.org/changeset/base/242258

Log:
  Add a temporary (for values of temporary) work around for hotplug
  support with ath(4) and VIMAGE.
  
  Right now the VIMAGE code doesn't supply a default vnet context during:
  
  * hotplug attach;
  * any device detach.
  
  It special cases kldload/boot time probing (by setting the context to
  vnet0) but that doesn't occur when probing devices during a bus rescan -
  eg, adding a cardbus card.
  
  These will eventually go away when the VIMAGE support extends to providing
  default contexts to hotplug attach/detach.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sun Oct 28 18:45:04 2012(r242257)
+++ head/sys/dev/ath/if_ath.c   Sun Oct 28 18:46:06 2012(r242258)
@@ -281,6 +281,7 @@ ath_attach(u_int16_t devid, struct ath_s
 
DPRINTF(sc, ATH_DEBUG_ANY, %s: devid 0x%x\n, __func__, devid);
 
+   CURVNET_SET(vnet0);
ifp = sc-sc_ifp = if_alloc(IFT_IEEE80211);
if (ifp == NULL) {
device_printf(sc-sc_dev, can not if_alloc()\n);
@@ -292,6 +293,7 @@ ath_attach(u_int16_t devid, struct ath_s
/* set these up early for if_printf use */
if_initname(ifp, device_get_name(sc-sc_dev),
device_get_unit(sc-sc_dev));
+   CURVNET_RESTORE();
 
ah = ath_hal_attach(devid, sc, sc-sc_st, sc-sc_sh,
sc-sc_eepromdata, status);
@@ -887,8 +889,11 @@ bad2:
 bad:
if (ah)
ath_hal_detach(ah);
-   if (ifp != NULL)
+   if (ifp != NULL) {
+   CURVNET_SET(ifp-if_vnet);
if_free(ifp);
+   CURVNET_RESTORE();
+   }
sc-sc_invalid = 1;
return error;
 }
@@ -930,7 +935,10 @@ ath_detach(struct ath_softc *sc)
ath_rxdma_teardown(sc);
ath_tx_cleanup(sc);
ath_hal_detach(sc-sc_ah);  /* NB: sets chip in full sleep */
+
+   CURVNET_SET(ifp-if_vnet);
if_free(ifp);
+   CURVNET_RESTORE();
 
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: r242259 - in head/sys: sys ufs/ffs

2012-10-28 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Oct 28 18:53:28 2012
New Revision: 242259
URL: http://svn.freebsd.org/changeset/base/242259

Log:
  Fix two problems that caused instant panic when the device mounted
  with softupdates went away.  Note that this does not fix the problem
  entirely; I'm committing it now to make it easier for someone to pick
  up the work.
  
  Reviewed by:  mckusick

Modified:
  head/sys/sys/buf.h
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Sun Oct 28 18:46:06 2012(r242258)
+++ head/sys/sys/buf.h  Sun Oct 28 18:53:28 2012(r242259)
@@ -427,7 +427,6 @@ buf_deallocate(struct buf *bp)
 {
if (bioops.io_deallocate)
(*bioops.io_deallocate)(bp);
-   BUF_LOCKFREE(bp);
 }
 
 static __inline int

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Sun Oct 28 18:46:06 2012
(r242258)
+++ head/sys/ufs/ffs/ffs_softdep.c  Sun Oct 28 18:53:28 2012
(r242259)
@@ -13342,8 +13342,13 @@ softdep_deallocate_dependencies(bp)
 
if ((bp-b_ioflags  BIO_ERROR) == 0)
panic(softdep_deallocate_dependencies: dangling deps);
-   softdep_error(bp-b_vp-v_mount-mnt_stat.f_mntonname, bp-b_error);
-   panic(softdep_deallocate_dependencies: unrecovered I/O error);
+   if (bp-b_vp != NULL  bp-b_vp-v_mount != NULL)
+   softdep_error(bp-b_vp-v_mount-mnt_stat.f_mntonname, 
bp-b_error);
+   else
+   printf(softdep_deallocate_dependencies: 
+   got error %d while accessing filesystem\n, bp-b_error);
+   if (bp-b_error != ENXIO)
+   panic(softdep_deallocate_dependencies: unrecovered I/O 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


svn commit: r242260 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 18:56:57 2012
New Revision: 242260
URL: http://svn.freebsd.org/changeset/base/242260

Log:
  When retransmitting SYN in TCPS_SYN_SENT state use TCPTV_RTOBASE,
  the default retransmit timeout, as base to calculate the backoff
  time until next try instead of the TCP_REXMTVAL() macro which only
  works correctly when we already have measured an actual RTT+RTTVAR.
  
  Before it would cause the first retransmit at RTOBASE, the next
  four at the same time (!) about 200ms later, and then another one
  again RTOBASE later.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 18:53:28 2012
(r242259)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 18:56:57 2012
(r242260)
@@ -572,7 +572,7 @@ tcp_timer_rexmt(void * xtp)
tp-t_flags = ~TF_PREVVALID;
TCPSTAT_INC(tcps_rexmttimeo);
if (tp-t_state == TCPS_SYN_SENT)
-   rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp-t_rxtshift];
+   rexmt = TCPTV_RTOBASE * tcp_syn_backoff[tp-t_rxtshift];
else
rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp-t_rxtshift];
TCPT_RANGESET(tp-t_rxtcur, rexmt,
___
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: r242261 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 19:02:07 2012
New Revision: 242261
URL: http://svn.freebsd.org/changeset/base/242261

Log:
  For retransmits of SYN|ACK from the syncache use the slightly more
  aggressive special tcp_syn_backoff[] retransmit schedule instead of
  the normal tcp_backoff[] schedule for established connections.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timer.h

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Sun Oct 28 18:56:57 2012
(r242260)
+++ head/sys/netinet/tcp_syncache.c Sun Oct 28 19:02:07 2012
(r242261)
@@ -391,7 +391,7 @@ static void
 syncache_timeout(struct syncache *sc, struct syncache_head *sch, int docallout)
 {
sc-sc_rxttime = ticks +
-   TCPTV_RTOBASE * (tcp_backoff[sc-sc_rxmits]);
+   TCPTV_RTOBASE * (tcp_syn_backoff[sc-sc_rxmits]);
sc-sc_rxmits++;
if (TSTMP_LT(sc-sc_rxttime, sch-sch_nextc)) {
sch-sch_nextc = sc-sc_rxttime;

Modified: head/sys/netinet/tcp_timer.h
==
--- head/sys/netinet/tcp_timer.hSun Oct 28 18:56:57 2012
(r242260)
+++ head/sys/netinet/tcp_timer.hSun Oct 28 19:02:07 2012
(r242261)
@@ -170,6 +170,7 @@ extern int tcp_rexmit_slop;
 extern int tcp_msl;
 extern int tcp_ttl;/* time to live for TCP segs */
 extern int tcp_backoff[];
+extern int tcp_syn_backoff[];
 
 extern int tcp_finwait2_timeout;
 extern int tcp_fast_finwait2_recycle;
___
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: r242262 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 19:16:22 2012
New Revision: 242262
URL: http://svn.freebsd.org/changeset/base/242262

Log:
  Simplify and enhance the window change/update acceptance logic,
  especially in the presence of bi-directional data transfers.
  
  snd_wl1 tracks the right edge, including data in the reassembly
  queue, of valid incoming data.  This makes it like rcv_nxt plus
  reassembly.  It never goes backwards to prevent older, possibly
  reordered segments from updating the window.
  
  snd_wl2 tracks the left edge of sent data.  This makes it a duplicate
  of snd_una.  However joining them right now is difficult due to
  separate update dependencies in different places in the code flow.
  
  snd_wnd tracks the current advertized send window by the peer.  In
  tcp_output() the effective window is calculated by subtracting the
  already in-flight data, snd_nxt less snd_una, from it.
  
  ACK's become the main clock of window updates and will always update
  the window when the left edge of what we sent is advanced.  The ACK
  clock is the primary signaling mechanism in ongoing data transfers.
  This works reliably even in the presence of reordering, reassembly
  and retransmitted segments.  The ACK clock is most important because
  it determines how much data we are allowed to inject into the network.
  
  Zero window updates get us out of persistence mode are crucial.  Here
  a segment that neither moves ACK nor SEQ but enlarges WND is accepted.
  
  When the ACK clock is not active (that is we're not or no longer
  sending any data) any segment that moves the extended right SEQ edge,
  including out-of-order segments, updates the window.  This gives us
  updates especially during ping-pong transfers where the peer isn't
  done consuming the already acknowledged data from the receive buffer
  while responding with data.
  
  The SSH protocol is a prime candidate to benefit from the improved
  bi-directional window update logic as it has its own windowing
  mechanism on top of TCP and is frequently sending back protocol ACK's.
  
  Tcpdump provided by:  darrenr
  Tested by:darrenr
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSun Oct 28 19:02:07 2012
(r242261)
+++ head/sys/netinet/tcp_input.cSun Oct 28 19:16:22 2012
(r242262)
@@ -1714,7 +1714,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 * Pull snd_wl1 up to prevent seq wrap relative to
 * th_seq.
 */
-   tp-snd_wl1 = th-th_seq;
+   tp-snd_wl1 = th-th_seq + tlen;
/*
 * Pull rcv_up up to prevent seq wrap relative to
 * rcv_nxt.
@@ -2327,7 +2327,6 @@ tcp_do_segment(struct mbuf *m, struct tc
if (tlen == 0  (thflags  TH_FIN) == 0)
(void) tcp_reass(tp, (struct tcphdr *)0, 0,
(struct mbuf *)0);
-   tp-snd_wl1 = th-th_seq - 1;
/* FALLTHROUGH */
 
/*
@@ -2638,12 +2637,10 @@ process_ACK:
 
SOCKBUF_LOCK(so-so_snd);
if (acked  so-so_snd.sb_cc) {
-   tp-snd_wnd -= so-so_snd.sb_cc;
sbdrop_locked(so-so_snd, (int)so-so_snd.sb_cc);
ourfinisacked = 1;
} else {
sbdrop_locked(so-so_snd, acked);
-   tp-snd_wnd -= acked;
ourfinisacked = 0;
}
/* NB: sowwakeup_locked() does an implicit unlock. */
@@ -2733,24 +2730,56 @@ step6:
INP_WLOCK_ASSERT(tp-t_inpcb);
 
/*
-* Update window information.
-* Don't look at window if no ACK: TAC's send garbage on first SYN.
+* Window update acceptance logic.  We have to be careful not
+* to accept window updates from old segments in the presence
+* of reordering or duplication.
+*
+* A window update is valid when:
+*  - the segment ACK's new data.
+*  - the segment carries new data and its ACK is current.
+*  - the segment matches the current SEQ and ACK but increases
+*the window.  This is the escape from persist mode, if there
+*data to be sent.
+*
+* XXXAO: The presence of new SACK information would allow to
+* accept window updates during retransmits.  We don't have an
+* easy way to test for that the moment.
+*
+* NB: The other side isn't allowed to shrink the window when
+* not sending or acking new data.  This behavior is strongly
+* discouraged by RFC793, section 3.7, page 42 anyways.
+*
+* XXXAO: tiwin = minmss to avoid jitter?
   

svn commit: r242263 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 19:20:23 2012
New Revision: 242263
URL: http://svn.freebsd.org/changeset/base/242263

Log:
  Add SACK_PERMIT to the list of TCP options that are switched off after
  retransmitting a SYN three times.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 19:16:22 2012
(r242262)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 19:20:23 2012
(r242263)
@@ -585,7 +585,7 @@ tcp_timer_rexmt(void * xtp)
 * unknown-to-them TCP options.
 */
if ((tp-t_state == TCPS_SYN_SENT)  (tp-t_rxtshift == 3))
-   tp-t_flags = ~(TF_REQ_SCALE|TF_REQ_TSTMP);
+   tp-t_flags = ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT);
/*
 * If we backed off this far, our srtt estimate is probably bogus.
 * Clobber it so we'll take the next rtt measurement as our srtt;
___
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: r242264 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 19:22:18 2012
New Revision: 242264
URL: http://svn.freebsd.org/changeset/base/242264

Log:
  Update comment to reflect the change made in r242263.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 19:20:23 2012
(r242263)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 19:22:18 2012
(r242264)
@@ -578,7 +578,7 @@ tcp_timer_rexmt(void * xtp)
TCPT_RANGESET(tp-t_rxtcur, rexmt,
  tp-t_rttmin, TCPTV_REXMTMAX);
/*
-* Disable rfc1323 if we haven't got any response to
+* Disable RFC1323 and SACK if we haven't got any response to
 * our third SYN to work-around some broken terminal servers
 * (most of which have hopefully been retired) that have bad VJ
 * header compression code which trashes TCP segments containing
___
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: r242265 - head/sbin/tunefs

2012-10-28 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Oct 28 19:38:42 2012
New Revision: 242265
URL: http://svn.freebsd.org/changeset/base/242265

Log:
  Declare functions as static and move global variables to the top;
  no functional changes.

Modified:
  head/sbin/tunefs/tunefs.c

Modified: head/sbin/tunefs/tunefs.c
==
--- head/sbin/tunefs/tunefs.c   Sun Oct 28 19:22:18 2012(r242264)
+++ head/sbin/tunefs/tunefs.c   Sun Oct 28 19:38:42 2012(r242265)
@@ -70,14 +70,16 @@ __FBSDID($FreeBSD$);
 /* the optimization warning string template */
 #defineOPTWARN should optimize for %s with minfree %s %d%%
 
+static int blocks;
+static char clrbuf[MAXBSIZE];
 static struct uufsd disk;
 #definesblock disk.d_fs
 
-void usage(void);
-void printfs(void);
-int journal_alloc(int64_t size);
-void journal_clear(void);
-void sbdirty(void);
+static void usage(void);
+static void printfs(void);
+static int journal_alloc(int64_t size);
+static void journal_clear(void);
+static void sbdirty(void);
 
 int
 main(int argc, char *argv[])
@@ -545,16 +547,13 @@ err:
err(12, %s, special);
 }
 
-void
+static void
 sbdirty(void)
 {
disk.d_fs.fs_flags |= FS_UNCLEAN | FS_NEEDSFSCK;
disk.d_fs.fs_clean = 0;
 }
 
-static int blocks;
-static char clrbuf[MAXBSIZE];
-
 static ufs2_daddr_t
 journal_balloc(void)
 {
@@ -880,7 +879,7 @@ indir_fill(ufs2_daddr_t blk, int level, 
 /*
  * Clear the flag bits so the journal can be removed.
  */
-void
+static void
 journal_clear(void)
 {
struct ufs1_dinode *dp1;
@@ -911,7 +910,7 @@ journal_clear(void)
}
 }
 
-int
+static int
 journal_alloc(int64_t size)
 {
struct ufs1_dinode *dp1;
@@ -1060,7 +1059,7 @@ out:
return (-1);
 }
 
-void
+static void
 usage(void)
 {
fprintf(stderr, %s\n%s\n%s\n%s\n%s\n%s\n,
@@ -1073,7 +1072,7 @@ usage(void)
exit(2);
 }
 
-void
+static void
 printfs(void)
 {
warnx(POSIX.1e ACLs: (-a)%s,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r242266 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 19:47:46 2012
New Revision: 242266
URL: http://svn.freebsd.org/changeset/base/242266

Log:
  Increase the initial CWND to 10 segments as defined in IETF TCPM
  draft-ietf-tcpm-initcwnd-05. It explains why the increased initial
  window improves the overall performance of many web services without
  risking congestion collapse.
  
  As long as it remains a draft it is placed under a sysctl marking it
  as experimental:
   net.inet.tcp.experimental.initcwnd10 = 1
  When it becomes an official RFC soon the sysctl will be changed to
  the RFC number and moved to net.inet.tcp.
  
  This implementation differs from the RFC draft in that it is a bit
  more conservative in the case of packet loss on SYN or SYN|ACK because
  we haven't reduced the default RTO to 1 second yet.  Also the restart
  window isn't yet increased as allowed.  Both will be adjusted with
  upcoming changes.
  
  Is is enabled by default.  In Linux it is enabled since kernel 3.0.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cSun Oct 28 19:38:42 2012
(r242265)
+++ head/sys/netinet/tcp_input.cSun Oct 28 19:47:46 2012
(r242266)
@@ -159,6 +159,14 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
 VNET_NAME(tcp_do_rfc3390), 0,
 Enable RFC 3390 (Increasing TCP's Initial Congestion Window));
 
+SYSCTL_NODE(_net_inet_tcp, OID_AUTO, experimental, CTLFLAG_RW, 0,
+Experimental TCP extensions);
+
+VNET_DEFINE(int, tcp_do_initcwnd10) = 1;
+SYSCTL_VNET_INT(_net_inet_tcp_experimental, OID_AUTO, initcwnd10, CTLFLAG_RW,
+VNET_NAME(tcp_do_initcwnd10), 0,
+Enable draft-ietf-tcpm-initcwnd-05 (Increasing initial CWND to 10));
+
 VNET_DEFINE(int, tcp_do_rfc3465) = 1;
 SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, rfc3465, CTLFLAG_RW,
 VNET_NAME(tcp_do_rfc3465), 0,
@@ -347,6 +355,7 @@ cc_conn_init(struct tcpcb *tp)
 *
 * RFC5681 Section 3.1 specifies the default conservative values.
 * RFC3390 specifies slightly more aggressive values.
+* Draft-ietf-tcpm-initcwnd-05 increases it to ten segments.
 *
 * If a SYN or SYN/ACK was lost and retransmitted, we have to
 * reduce the initial CWND to one segment as congestion is likely
@@ -354,6 +363,9 @@ cc_conn_init(struct tcpcb *tp)
 */
if (tp-snd_cwnd == 1)
tp-snd_cwnd = tp-t_maxseg;/* SYN(-ACK) lost */
+   else if (V_tcp_do_initcwnd10)
+   tp-snd_cwnd = min(10 * tp-t_maxseg,
+   max(2 * tp-t_maxseg, 14600));
else if (V_tcp_do_rfc3390)
tp-snd_cwnd = min(4 * tp-t_maxseg,
max(2 * tp-t_maxseg, 4380));

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Sun Oct 28 19:38:42 2012(r242265)
+++ head/sys/netinet/tcp_var.h  Sun Oct 28 19:47:46 2012(r242266)
@@ -611,6 +611,7 @@ VNET_DECLARE(int, tcp_mssdflt); /* XXX *
 VNET_DECLARE(int, tcp_minmss);
 VNET_DECLARE(int, tcp_delack_enabled);
 VNET_DECLARE(int, tcp_do_rfc3390);
+VNET_DECLARE(int, tcp_do_initcwnd10);
 VNET_DECLARE(int, tcp_sendspace);
 VNET_DECLARE(int, tcp_recvspace);
 VNET_DECLARE(int, path_mtu_discovery);
@@ -623,6 +624,7 @@ VNET_DECLARE(int, tcp_abc_l_var);
 #defineV_tcp_minmssVNET(tcp_minmss)
 #defineV_tcp_delack_enabledVNET(tcp_delack_enabled)
 #defineV_tcp_do_rfc3390VNET(tcp_do_rfc3390)
+#defineV_tcp_do_initcwnd10 VNET(tcp_do_initcwnd10)
 #defineV_tcp_sendspace VNET(tcp_sendspace)
 #defineV_tcp_recvspace VNET(tcp_recvspace)
 #defineV_path_mtu_discoveryVNET(path_mtu_discovery)
___
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: r242267 - head/sys/netinet

2012-10-28 Thread Andre Oppermann
Author: andre
Date: Sun Oct 28 19:58:20 2012
New Revision: 242267
URL: http://svn.freebsd.org/changeset/base/242267

Log:
  If the user has closed the socket then drop a persisting connection
  after a much reduced timeout.
  
  Typically web servers close their sockets quickly under the assumption
  that the TCP connections goes away as well.  That is not entirely true
  however.  If the peer closed the window we're going to wait for a long
  time with lots of data in the send buffer.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 19:47:46 2012
(r242266)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 19:58:20 2012
(r242267)
@@ -447,6 +447,16 @@ tcp_timer_persist(void *xtp)
tp = tcp_drop(tp, ETIMEDOUT);
goto out;
}
+   /*
+* If the user has closed the socket then drop a persisting
+* connection after a much reduced timeout.
+*/
+   if (tp-t_state  TCPS_CLOSE_WAIT 
+   (ticks - tp-t_rcvtime) = TCPTV_PERSMAX) {
+   TCPSTAT_INC(tcps_persistdrop);
+   tp = tcp_drop(tp, ETIMEDOUT);
+   goto out;
+   }
tcp_setpersist(tp);
tp-t_flags |= TF_FORCEDATA;
(void) tcp_output(tp);
___
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: r242268 - head/sys/vm

2012-10-28 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Oct 28 20:03:57 2012
New Revision: 242268
URL: http://svn.freebsd.org/changeset/base/242268

Log:
  Remove useless check; vm_pindex_t is unsigned on all architectures.
  
  CID:  3701
  Found with:   Coverity Prevent

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSun Oct 28 19:58:20 2012(r242267)
+++ head/sys/vm/vm_pageout.cSun Oct 28 20:03:57 2012(r242268)
@@ -1895,7 +1895,7 @@ again:
continue;
 
size = vmspace_resident_count(vm);
-   if (limit = 0  size = limit) {
+   if (size = limit) {
vm_pageout_map_deactivate_pages(
vm-vm_map, limit);
}
___
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: r242254 - head/sys/netinet

2012-10-28 Thread Gleb Smirnoff
On Sun, Oct 28, 2012 at 06:07:34PM +, Andre Oppermann wrote:
A @@ -296,8 +297,8 @@ syncache_destroy(void)
A  mtx_destroy(sch-sch_mtx);
A  }
A  
A -KASSERT(V_tcp_syncache.cache_count == 0, (%s: cache_count %d not 0,
A -__func__, V_tcp_syncache.cache_count));
A +KASSERT(uma_zone_get_cur(V_tcp_syncache.zone) == 0,
A +(%s: cache_count not 0, __func__));
A  
A  /* Free the allocated global resources. */
A  uma_zdestroy(V_tcp_syncache.zone);

btw, keg_dtor() which is called in uma_zdestroy() printfs a warning
(even on non-invariant kernel) if keg had items in it. So leak won't
be unnoticed.


-- 
Totus tuus, Glebius.
___
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: r242270 - head/share/man/man9

2012-10-28 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Oct 28 21:01:32 2012
New Revision: 242270
URL: http://svn.freebsd.org/changeset/base/242270

Log:
  Make it clear that NULL can only be returned when M_NOWAIT was used.

Modified:
  head/share/man/man9/zone.9

Modified: head/share/man/man9/zone.9
==
--- head/share/man/man9/zone.9  Sun Oct 28 20:14:21 2012(r242269)
+++ head/share/man/man9/zone.9  Sun Oct 28 21:01:32 2012(r242270)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 25, 2012
+.Dd October 28, 2012
 .Dt ZONE 9
 .Os
 .Sh NAME
@@ -145,7 +145,7 @@ or
 .Dv NULL
 in the rare case where all items in the zone are in use and the
 allocator is unable to grow the zone
-or when
+and
 .Dv M_NOWAIT
 is specified.
 .Pp
@@ -218,8 +218,10 @@ The
 .Fn uma_zalloc
 function returns a pointer to an item, or
 .Dv NULL
-if the zone ran out of unused items and the allocator was unable to
-enlarge it.
+if the zone ran out of unused items
+and
+.Dv M_NOWAIT
+was specified.
 .Sh SEE ALSO
 .Xr malloc 9
 .Sh HISTORY
___
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: r242266 - head/sys/netinet

2012-10-28 Thread Rui Paulo
On 28 Oct 2012, at 12:47, Andre Oppermann an...@freebsd.org wrote:

 Author: andre
 Date: Sun Oct 28 19:47:46 2012
 New Revision: 242266
 URL: http://svn.freebsd.org/changeset/base/242266
 
 Log:
  Increase the initial CWND to 10 segments as defined in IETF TCPM
  draft-ietf-tcpm-initcwnd-05. It explains why the increased initial
  window improves the overall performance of many web services without
  risking congestion collapse.
 
  As long as it remains a draft it is placed under a sysctl marking it
  as experimental:
   net.inet.tcp.experimental.initcwnd10 = 1
  When it becomes an official RFC soon the sysctl will be changed to
  the RFC number and moved to net.inet.tcp.
 
  This implementation differs from the RFC draft in that it is a bit
  more conservative in the case of packet loss on SYN or SYN|ACK because
  we haven't reduced the default RTO to 1 second yet.  Also the restart
  window isn't yet increased as allowed.  Both will be adjusted with
  upcoming changes.
 
  Is is enabled by default.  In Linux it is enabled since kernel 3.0.


Didn't you also forget to point out the problems associated with it?

http://tools.ietf.org/html/draft-gettys-iw10-considered-harmful-00

Regards,
--
Rui Paulo

___
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: r242254 - head/sys/netinet

2012-10-28 Thread Andre Oppermann

On 28.10.2012 21:07, Gleb Smirnoff wrote:

On Sun, Oct 28, 2012 at 06:07:34PM +, Andre Oppermann wrote:
A @@ -296,8 +297,8 @@ syncache_destroy(void)
A   mtx_destroy(sch-sch_mtx);
A   }
A
A - KASSERT(V_tcp_syncache.cache_count == 0, (%s: cache_count %d not 0,
A - __func__, V_tcp_syncache.cache_count));
A + KASSERT(uma_zone_get_cur(V_tcp_syncache.zone) == 0,
A + (%s: cache_count not 0, __func__));
A
A   /* Free the allocated global resources. */
A   uma_zdestroy(V_tcp_syncache.zone);

btw, keg_dtor() which is called in uma_zdestroy() printfs a warning
(even on non-invariant kernel) if keg had items in it. So leak won't
be unnoticed.


Thanks, didn't know that.  I leave the KASSERT() in if you don't
mind to make it a bit more forceful than a printf that gets overlooked
too easily.

--
Andre

___
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: r242161 - in head/sys: net netinet netpfil/pf

2012-10-28 Thread Andre Oppermann

On 28.10.2012 00:01, Gleb Smirnoff wrote:

On Sat, Oct 27, 2012 at 12:58:52PM +0200, Andre Oppermann wrote:
A On 26.10.2012 23:06, Gleb Smirnoff wrote:
A  Author: glebius
A  Date: Fri Oct 26 21:06:33 2012
A  New Revision: 242161
A  URL: http://svn.freebsd.org/changeset/base/242161
A 
A  Log:
A o Remove last argument to ip_fragment(), and obtain all needed 
information
A   on checksums directly from mbuf flags. This simplifies code.
A o Clear CSUM_IP from the mbuf in ip_fragment() if we did checksums in
A   hardware. Some driver may not announce CSUM_IP in theur if_hwassist,
A   although try to do checksums if CSUM_IP set on mbuf. Example is em(4).
A
A I'm not getting your description here?  Why work around a bug in a driver
A in ip_fragment() when we can fix the bug in the driver?

Well, that was actually bug in the stack and a very special driver that
demonstrates it. I may even agree that driver is incorrect, but the stack was
incorrect, too.


Ah, OK.  Do you intend to fix the driver as well?

--
Andre

___
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: r242271 - head/sys/dev/ath

2012-10-28 Thread Adrian Chadd
Author: adrian
Date: Sun Oct 28 21:13:12 2012
New Revision: 242271
URL: http://svn.freebsd.org/changeset/base/242271

Log:
  Begin fleshing out some software queue awareness for TIM handling with
  the power save queue.
  
  * introduce some new ATH_NODE lock protected fields, tracking the
net80211 psq and TIM state;
  * when doing buffer transitions - ie, when sending and completing
buffers - check the state of the SWQ and update the TIM appropriately.
  * when clearing the TIM bit, if the SWQ is not empty then delay clearing
it.
  
  This is racy, but it's no less racy than the current net80211 power
  save queue management code.  Specifically, with multiple TX threads,
  it's quite plausible that parallel state updates will race and the
  TIM will be left in an inconsistent state.  I'll address that in
  a follow-up commit.

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sun Oct 28 21:01:32 2012(r242270)
+++ head/sys/dev/ath/if_ath.c   Sun Oct 28 21:13:12 2012(r242271)
@@ -201,6 +201,7 @@ static void ath_announce(struct ath_soft
 
 static voidath_dfs_tasklet(void *, int);
 static voidath_node_powersave(struct ieee80211_node *, int);
+static int ath_node_set_tim(struct ieee80211_node *, int);
 
 #ifdef IEEE80211_SUPPORT_TDMA
 #include dev/ath/if_ath_tdma.h
@@ -1152,6 +1153,9 @@ ath_vap_create(struct ieee80211com *ic, 
avp-av_node_ps = vap-iv_node_ps;
vap-iv_node_ps = ath_node_powersave;
 
+   avp-av_set_tim = vap-iv_set_tim;
+   vap-iv_set_tim = ath_node_set_tim;
+
/* Set default parameters */
 
/*
@@ -2558,6 +2562,12 @@ ath_start(struct ifnet *ifp)
ieee80211_free_node(ni);
continue;
}
+
+   /*
+* Check here if the node is in power save state.
+*/
+   ath_tx_update_tim(sc, ni, 1);
+
if (next != NULL) {
/*
 * Beware of state changing between frags.
@@ -3536,6 +3546,24 @@ ath_tx_default_comp(struct ath_softc *sc
SEQNO(bf-bf_state.bfs_seqno));
 
/*
+* Check if the node software queue is empty; if so
+* then clear the TIM.
+*
+* This needs to be done before the buffer is freed as
+* otherwise the node reference will have been released
+* and the node may not actually exist any longer.
+*
+* XXX I don't like this belonging here, but it's cleaner
+* to do it here right now then all the other places
+* where ath_tx_default_comp() is called.
+*
+* XXX TODO: during drain, ensure that the callback is
+* being called so we get a chance to update the TIM.
+*/
+   if (bf-bf_node)
+   ath_tx_update_tim(sc, bf-bf_node, 0);
+
+   /*
 * Do any tx complete callback.  Note this must
 * be done before releasing the node reference.
 * This will free the mbuf, release the net80211
@@ -3559,6 +3587,7 @@ ath_tx_update_ratectrl(struct ath_softc 
return;
 
an = ATH_NODE(ni);
+   ATH_NODE_UNLOCK_ASSERT(an);
 
if ((ts-ts_status  HAL_TXERR_FILT) == 0) {
ATH_NODE_LOCK(an);
@@ -3754,6 +3783,8 @@ ath_tx_processq(struct ath_softc *sc, st
 * Update statistics and call completion
 */
ath_tx_process_buf_completion(sc, txq, ts, bf);
+
+   /* XXX at this point, bf and ni may be totally invalid */
}
 #ifdef IEEE80211_SUPPORT_SUPERG
/*
@@ -5397,6 +5428,219 @@ ath_node_powersave(struct ieee80211_node
avp-av_node_ps(ni, enable);
 }
 
+/*
+ * Notification from net80211 that the powersave queue state has
+ * changed.
+ *
+ * Since the software queue also may have some frames:
+ *
+ * + if the node software queue has frames and the TID state
+ *   is 0, we set the TIM;
+ * + if the node and the stack are both empty, we clear the TIM bit.
+ * + If the stack tries to set the bit, always set it.
+ * + If the stack tries to clear the bit, only clear it if the
+ *   software queue in question is also cleared.
+ *
+ * TODO: this is called during node teardown; so let's ensure this
+ * is all correctly handled and that the TIM bit is cleared.
+ * It may be that the node flush is called _AFTER_ the net80211
+ * stack clears the TIM.
+ *
+ * Here is the racy part.  Since it's possible 1 concurrent,
+ * overlapping TXes will appear complete with a TX completion in
+ * another thread, it's possible that the concurrent TIM calls will
+ * clash.  We can't hold the node lock here because setting the
+ * TIM grabs the 

Re: svn commit: r242263 - head/sys/netinet

2012-10-28 Thread Rui Paulo
On 28 Oct 2012, at 12:20, Andre Oppermann an...@freebsd.org wrote:

 Author: andre
 Date: Sun Oct 28 19:20:23 2012
 New Revision: 242263
 URL: http://svn.freebsd.org/changeset/base/242263
 
 Log:
  Add SACK_PERMIT to the list of TCP options that are switched off after
  retransmitting a SYN three times.
 
  MFC after:   2 weeks
 
 Modified:
  head/sys/netinet/tcp_timer.c
 
 Modified: head/sys/netinet/tcp_timer.c
 ==
 --- head/sys/netinet/tcp_timer.c  Sun Oct 28 19:16:22 2012
 (r242262)
 +++ head/sys/netinet/tcp_timer.c  Sun Oct 28 19:20:23 2012
 (r242263)
 @@ -585,7 +585,7 @@ tcp_timer_rexmt(void * xtp)
* unknown-to-them TCP options.
*/
   if ((tp-t_state == TCPS_SYN_SENT)  (tp-t_rxtshift == 3))
 - tp-t_flags = ~(TF_REQ_SCALE|TF_REQ_TSTMP);
 + tp-t_flags = ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT);
   /*
* If we backed off this far, our srtt estimate is probably bogus.
* Clobber it so we'll take the next rtt measurement as our srtt;

Do you have any data regarding this commit or you're just trying to make sure 
the SACK option follows the same behaviour of the WSCALE/TSTMP options?

Regards,
--
Rui Paulo

___
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: r242266 - head/sys/netinet

2012-10-28 Thread Andre Oppermann

On 28.10.2012 22:03, Rui Paulo wrote:

On 28 Oct 2012, at 12:47, Andre Oppermann an...@freebsd.org wrote:


Author: andre
Date: Sun Oct 28 19:47:46 2012
New Revision: 242266
URL: http://svn.freebsd.org/changeset/base/242266

Log:
  Increase the initial CWND to 10 segments as defined in IETF TCPM
  draft-ietf-tcpm-initcwnd-05. It explains why the increased initial
  window improves the overall performance of many web services without
  risking congestion collapse.

  As long as it remains a draft it is placed under a sysctl marking it
  as experimental:
   net.inet.tcp.experimental.initcwnd10 = 1
  When it becomes an official RFC soon the sysctl will be changed to
  the RFC number and moved to net.inet.tcp.

  This implementation differs from the RFC draft in that it is a bit
  more conservative in the case of packet loss on SYN or SYN|ACK because
  we haven't reduced the default RTO to 1 second yet.  Also the restart
  window isn't yet increased as allowed.  Both will be adjusted with
  upcoming changes.

  Is is enabled by default.  In Linux it is enabled since kernel 3.0.



Didn't you also forget to point out the problems associated with it?

http://tools.ietf.org/html/draft-gettys-iw10-considered-harmful-00


IW10 has been heavily discussed on IETF TCPM.  A lot of research on
the impact has been done and the overall result has been a significant
improvement with very little downside.  Linux has adopted it for quite
some time already as default setting.

The bufferbloat issue is certainly real and should not be neglected.
However the solution to bufferbloat is not to send less packets into
the network.  In fact that doesn't even make a difference simply because
other packets with take their place.  Buffer bloat can only be fixed
in the devices that actually do the buffering.  A much discussed and
apparently good approach seems to be the Codel algorithm for active
buffer management.

--
Andre

___
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: r242261 - head/sys/netinet

2012-10-28 Thread Rui Paulo
On 28 Oct 2012, at 12:02, Andre Oppermann an...@freebsd.org wrote:

 Author: andre
 Date: Sun Oct 28 19:02:07 2012
 New Revision: 242261
 URL: http://svn.freebsd.org/changeset/base/242261
 
 Log:
  For retransmits of SYN|ACK from the syncache use the slightly more
  aggressive special tcp_syn_backoff[] retransmit schedule instead of
  the normal tcp_backoff[] schedule for established connections.


How did you came up with the values for tcp_syn_backoff? I obviously understand 
the aggressiveness, but did you measure any significant improvement in 
connection establishment time and if so, on what type of links?

Regards,
--
Rui Paulo

___
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: r242266 - head/sys/netinet

2012-10-28 Thread Rui Paulo
On 28 Oct 2012, at 14:33, Andre Oppermann an...@freebsd.org wrote:
 IW10 has been heavily discussed on IETF TCPM.  A lot of research on
 the impact has been done and the overall result has been a significant
 improvement with very little downside.  Linux has adopted it for quite
 some time already as default setting.

I have followed the discussions at tcpm, but I did not find any conclusive 
evidence of the benefit of IW10. I'm sure it can help in multiple situations 
but, as always, there are tradeoffs. Section 6 of draft-ietf-tcpm-initcwnd 
never convinced me.

 The bufferbloat issue is certainly real and should not be neglected.
 However the solution to bufferbloat is not to send less packets into
 the network.  In fact that doesn't even make a difference simply because
 other packets with take their place.

Right, my point is that sending more packets in an already congested link will 
negatively affect the throughput / latency of the network. I'm not saying that 
it won't help you download a YouTube video faster, but the overall fairness of 
TCP will be reduced.

  Buffer bloat can only be fixed
 in the devices that actually do the buffering.  A much discussed and
 apparently good approach seems to be the Codel algorithm for active
 buffer management.


Are you working on CoDel? :-)

Regards,
--
Rui Paulo

___
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: r242263 - head/sys/netinet

2012-10-28 Thread Andre Oppermann

On 28.10.2012 22:26, Rui Paulo wrote:

On 28 Oct 2012, at 12:20, Andre Oppermann an...@freebsd.org wrote:


Author: andre
Date: Sun Oct 28 19:20:23 2012
New Revision: 242263
URL: http://svn.freebsd.org/changeset/base/242263

Log:
  Add SACK_PERMIT to the list of TCP options that are switched off after
  retransmitting a SYN three times.

  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp_timer.c

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cSun Oct 28 19:16:22 2012
(r242262)
+++ head/sys/netinet/tcp_timer.cSun Oct 28 19:20:23 2012
(r242263)
@@ -585,7 +585,7 @@ tcp_timer_rexmt(void * xtp)
 * unknown-to-them TCP options.
 */
if ((tp-t_state == TCPS_SYN_SENT)  (tp-t_rxtshift == 3))
-   tp-t_flags = ~(TF_REQ_SCALE|TF_REQ_TSTMP);
+   tp-t_flags = ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT);
/*
 * If we backed off this far, our srtt estimate is probably bogus.
 * Clobber it so we'll take the next rtt measurement as our srtt;


Do you have any data regarding this commit or you're just trying to make sure

 the SACK option follows the same behaviour of the WSCALE/TSTMP options?

The latter.  For the purpose of turning off the options after three tries
it is contradictory to leave SACK on.

There is discussion of scrapping this whole option disabling altogether.
Until then better have the 'correct' behavior.

--
Andre

___
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: r242261 - head/sys/netinet

2012-10-28 Thread Andre Oppermann

On 28.10.2012 22:34, Rui Paulo wrote:

On 28 Oct 2012, at 12:02, Andre Oppermann an...@freebsd.org wrote:


Author: andre
Date: Sun Oct 28 19:02:07 2012
New Revision: 242261
URL: http://svn.freebsd.org/changeset/base/242261

Log:
  For retransmits of SYN|ACK from the syncache use the slightly more
  aggressive special tcp_syn_backoff[] retransmit schedule instead of
  the normal tcp_backoff[] schedule for established connections.



How did you came up with the values for tcp_syn_backoff? I obviously

 understand the aggressiveness, but did you measure any significant
 improvement in connection establishment time and if so, on what type of links?

I didn't come up with the values.  tcp_syn_backoff[] was introduced
almost 12 years ago by jlemon.  For syncache it got lost somewhere
along the line.

There has been recent talk by some large FreeBSD web server operators
of reducing SYN|ACK retransmit timeouts.  This change fixes a part of
the problem.  The recent RFC on reducing the RTO will fix the other
part.

--
Andre

___
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: r242261 - head/sys/netinet

2012-10-28 Thread Rui Paulo
On Oct 28, 2012, at 14:56, Andre Oppermann an...@freebsd.org wrote:

 On 28.10.2012 22:34, Rui Paulo wrote:
 On 28 Oct 2012, at 12:02, Andre Oppermann an...@freebsd.org wrote:
 
 Author: andre
 Date: Sun Oct 28 19:02:07 2012
 New Revision: 242261
 URL: http://svn.freebsd.org/changeset/base/242261
 
 Log:
  For retransmits of SYN|ACK from the syncache use the slightly more
  aggressive special tcp_syn_backoff[] retransmit schedule instead of
  the normal tcp_backoff[] schedule for established connections.
 
 
 How did you came up with the values for tcp_syn_backoff? I obviously
  understand the aggressiveness, but did you measure any significant
  improvement in connection establishment time and if so, on what type of 
  links?
 
 I didn't come up with the values.  tcp_syn_backoff[] was introduced
 almost 12 years ago by jlemon.  For syncache it got lost somewhere
 along the line.

Oh, I see. I read it backwards. 

 
 There has been recent talk by some large FreeBSD web server operators
 of reducing SYN|ACK retransmit timeouts.  This change fixes a part of
 the problem.  The recent RFC on reducing the RTO will fix the other
 part.

Which RFC? I'm only aware of draft-hurtig-tcpm-rtorestart. 
___
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: r242261 - head/sys/netinet

2012-10-28 Thread Andre Oppermann

On 28.10.2012 23:01, Rui Paulo wrote:

On Oct 28, 2012, at 14:56, Andre Oppermann an...@freebsd.org wrote:


On 28.10.2012 22:34, Rui Paulo wrote:

On 28 Oct 2012, at 12:02, Andre Oppermann an...@freebsd.org wrote:


Author: andre
Date: Sun Oct 28 19:02:07 2012
New Revision: 242261
URL: http://svn.freebsd.org/changeset/base/242261

Log:
  For retransmits of SYN|ACK from the syncache use the slightly more
  aggressive special tcp_syn_backoff[] retransmit schedule instead of
  the normal tcp_backoff[] schedule for established connections.



How did you came up with the values for tcp_syn_backoff? I obviously
understand the aggressiveness, but did you measure any significant
improvement in connection establishment time and if so, on what type of links?


I didn't come up with the values.  tcp_syn_backoff[] was introduced
almost 12 years ago by jlemon.  For syncache it got lost somewhere
along the line.


Oh, I see. I read it backwards.



There has been recent talk by some large FreeBSD web server operators
of reducing SYN|ACK retransmit timeouts.  This change fixes a part of
the problem.  The recent RFC on reducing the RTO will fix the other
part.


Which RFC? I'm only aware of draft-hurtig-tcpm-rtorestart.


RFC6298.

--
Andre

___
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: r242266 - head/sys/netinet

2012-10-28 Thread Andre Oppermann

On 28.10.2012 22:44, Rui Paulo wrote:

On 28 Oct 2012, at 14:33, Andre Oppermann an...@freebsd.org wrote:

IW10 has been heavily discussed on IETF TCPM.  A lot of research on
the impact has been done and the overall result has been a significant
improvement with very little downside.  Linux has adopted it for quite
some time already as default setting.


I have followed the discussions at tcpm, but I did not find any conclusive 
evidence of the benefit of IW10. I'm sure it can help in multiple situations 
but, as always, there are tradeoffs. Section 6 of draft-ietf-tcpm-initcwnd 
never convinced me.


Then please raise your points on TCPM.


The bufferbloat issue is certainly real and should not be neglected.
However the solution to bufferbloat is not to send less packets into
the network.  In fact that doesn't even make a difference simply because
other packets with take their place.


Right, my point is that sending more packets in an already congested link will 
negatively affect the throughput / latency of the network. I'm not saying that 
it won't help you download a YouTube video faster, but the overall fairness of 
TCP will be reduced.


That's always the case.  Reality is that the majority of links these
days is very fast compared to twenty years ago.  We can afford to be
a bit more aggressive here.  Otherwise taking your point to the extreme
would mean that IW can only ever be 1 MSS.

Then there is the unfairness of low RTT to high RTT transfers.  But that's
inherent in any end to end feedback system.


  Buffer bloat can only be fixed
in the devices that actually do the buffering.  A much discussed and
apparently good approach seems to be the Codel algorithm for active
buffer management.


Are you working on CoDel? :-)


I'm looking into how the whole interface stuff including ALTQ can be
improved in an SMP world.

--
Andre

___
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: r242266 - head/sys/netinet

2012-10-28 Thread Rui Paulo
On 28 Oct 2012, at 15:25, Andre Oppermann an...@freebsd.org wrote:

 That's always the case.  Reality is that the majority of links these
 days is very fast compared to twenty years ago.  We can afford to be
 a bit more aggressive here.  Otherwise taking your point to the extreme
 would mean that IW can only ever be 1 MSS.

Not really. My point was that raising the initial window to overcome 
deficiencies somewhere else is the wrong approach.

Regards,
--
Rui Paulo

___
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: r242272 - head/sys/dev/mii

2012-10-28 Thread Juli Mallett
Author: jmallett
Date: Mon Oct 29 00:17:12 2012
New Revision: 242272
URL: http://svn.freebsd.org/changeset/base/242272

Log:
  Recognize the Marvell 88E1145 Quad Gigabit PHY.

Modified:
  head/sys/dev/mii/e1000phy.c

Modified: head/sys/dev/mii/e1000phy.c
==
--- head/sys/dev/mii/e1000phy.c Sun Oct 28 21:13:12 2012(r242271)
+++ head/sys/dev/mii/e1000phy.c Mon Oct 29 00:17:12 2012(r242272)
@@ -108,6 +108,7 @@ static const struct mii_phydesc e1000phy
MII_PHY_DESC(xxMARVELL, E1116R),
MII_PHY_DESC(xxMARVELL, E1116R_29),
MII_PHY_DESC(xxMARVELL, E1118),
+   MII_PHY_DESC(xxMARVELL, E1145),
MII_PHY_DESC(xxMARVELL, E1149R),
MII_PHY_DESC(xxMARVELL, E3016),
MII_PHY_DESC(xxMARVELL, PHYG65G),
___
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: r242273 - in head/sys: contrib/octeon-sdk mips/cavium

2012-10-28 Thread Juli Mallett
Author: jmallett
Date: Mon Oct 29 00:51:53 2012
New Revision: 242273
URL: http://svn.freebsd.org/changeset/base/242273

Log:
  Use Simple Executive LED display routines, which correctly use the LED base
  address passed from the bootloader, rather than using a hard-coded value.
  
  Make FreeBSD announce itself on the LED display similar to other kernels.
  
  Remove uses of the previous LED routines, which were under-used and only used
  in drivers for what seem like debugging purposes, despite those drivers being
  widely-tested.
  
  Remove several inlines for accessing memory that duplicate other functions
  which are now used instead, as they are now entirely unused.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-ebt3000.c
  head/sys/mips/cavium/files.octeon1
  head/sys/mips/cavium/octeon_ebt3000_cf.c
  head/sys/mips/cavium/octeon_machdep.c
  head/sys/mips/cavium/octeon_pcmap_regs.h
  head/sys/mips/cavium/uart_dev_oct16550.c

Modified: head/sys/contrib/octeon-sdk/cvmx-ebt3000.c
==
--- head/sys/contrib/octeon-sdk/cvmx-ebt3000.c  Mon Oct 29 00:17:12 2012
(r242272)
+++ head/sys/contrib/octeon-sdk/cvmx-ebt3000.c  Mon Oct 29 00:51:53 2012
(r242273)
@@ -52,15 +52,18 @@
  *
  */
 
+#if !defined(__FreeBSD__) || !defined(_KERNEL)
 #include cvmx-config.h
+#endif
 #include cvmx.h
+#include cvmx-ebt3000.h
 #include cvmx-sysinfo.h
 
 
 void ebt3000_char_write(int char_position, char val)
 {
 /* Note: phys_to_ptr won't work here, as we are most likely going to 
access the boot bus. */
-void *led_base = CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, 
cvmx_sysinfo_get()-led_display_base_addr));
+char *led_base = CASTPTR(char , CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, 
cvmx_sysinfo_get()-led_display_base_addr));
 if (!led_base)
 return;
 if (cvmx_sysinfo_get()-board_type == CVMX_BOARD_TYPE_EBT3000  
cvmx_sysinfo_get()-board_rev_major == 1)
@@ -82,10 +85,10 @@ void ebt3000_char_write(int char_positio
 void ebt3000_str_write(const char *str)
 {
 /* Note: phys_to_ptr won't work here, as we are most likely going to 
access the boot bus. */
-void *led_base;
+char *led_base;
 if (!cvmx_sysinfo_get()-led_display_base_addr)
 return;
-led_base = CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, 
cvmx_sysinfo_get()-led_display_base_addr));
+led_base = CASTPTR(char, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, 
cvmx_sysinfo_get()-led_display_base_addr));
 if (cvmx_sysinfo_get()-board_type == CVMX_BOARD_TYPE_EBT3000  
cvmx_sysinfo_get()-board_rev_major == 1)
 {
 char *ptr = (char *)(led_base + 4);

Modified: head/sys/mips/cavium/files.octeon1
==
--- head/sys/mips/cavium/files.octeon1  Mon Oct 29 00:17:12 2012
(r242272)
+++ head/sys/mips/cavium/files.octeon1  Mon Oct 29 00:51:53 2012
(r242273)
@@ -58,6 +58,7 @@ mips/cavium/octeon_gpio.c optional gpi
 contrib/octeon-sdk/cvmx-cmd-queue.cstandard
 contrib/octeon-sdk/cvmx-bootmem.c  standard
 contrib/octeon-sdk/cvmx-clock.cstandard
+contrib/octeon-sdk/cvmx-ebt3000.c  standard
 contrib/octeon-sdk/cvmx-fpa.c  standard
 contrib/octeon-sdk/cvmx-helper.c   standard
 contrib/octeon-sdk/cvmx-helper-board.c standard

Modified: head/sys/mips/cavium/octeon_ebt3000_cf.c
==
--- head/sys/mips/cavium/octeon_ebt3000_cf.cMon Oct 29 00:17:12 2012
(r242272)
+++ head/sys/mips/cavium/octeon_ebt3000_cf.cMon Oct 29 00:51:53 2012
(r242273)
@@ -326,15 +326,10 @@ static int cf_cmd_read (uint32_t nr_sect
uint8_t  *ptr_8;
int error;
 
-//#define OCTEON_VISUAL_CF_0 1
-#ifdef OCTEON_VISUAL_CF_0
-octeon_led_write_char(0, 'R');
-#endif
ptr_8  = (uint8_t*)buf;
ptr_16 = (uint16_t*)buf;
lba = start_sector; 
 
-
while (nr_sectors--) {
error = cf_send_cmd(lba, CMD_READ_SECTOR);
if (error != 0) {
@@ -366,9 +361,6 @@ static int cf_cmd_read (uint32_t nr_sect
 
lba++;
}
-#ifdef OCTEON_VISUAL_CF_0
-octeon_led_write_char(0, ' ');
-#endif
return (0);
 }
 
@@ -387,10 +379,6 @@ static int cf_cmd_write (uint32_t nr_sec
uint8_t  *ptr_8;
int error;

-//#define OCTEON_VISUAL_CF_1 1
-#ifdef OCTEON_VISUAL_CF_1
-octeon_led_write_char(1, 'W');
-#endif
lba = start_sector;
ptr_8  = (uint8_t*)buf;
ptr_16 = (uint16_t*)buf;
@@ -425,9 +413,6 @@ static int cf_cmd_write (uint32_t nr_sec
 
lba++;
}
-#ifdef OCTEON_VISUAL_CF_1
-octeon_led_write_char(1, ' ');
-#endif
return (0);
 }
 
@@ -543,13 +528,6 @@ static int cf_wait_busy (void)
 {
uint8_t 

svn commit: r242274 - head/sys/sys

2012-10-28 Thread Attilio Rao
Author: attilio
Date: Mon Oct 29 01:35:17 2012
New Revision: 242274
URL: http://svn.freebsd.org/changeset/base/242274

Log:
  Compiler have a precise knowledge of the content of sched_pin() and
  sched_unpin() as they are functions static and inline.  This way it
  can do two dangerous things:
  - Reorder instructions around both of them, taking out from the safe
path operations that are supposed to be (ie. per-cpu accesses)
  - Cache the value of td_pinned in CPU registers not making visible
in kernel context to the scheduler once it is scanning the runqueue,
as td_pinned is not marked volatile.
  
  In order to avoid both possible bugs explicitly, protect the safe path
  with compiler memory barriers. This will prevent reordering and caching
  by the compiler about td_pinned operations.
  
  Generally this could lead to suboptimal code traversing the pinnings
  but this is not the case as can be easilly verified:
  http://lists.freebsd.org/pipermail/svn-src-projects/2012-October/005797.html
  
  Discussed with:   jeff, jhb
  MFC after:2 weeks

Modified:
  head/sys/sys/sched.h

Modified: head/sys/sys/sched.h
==
--- head/sys/sys/sched.hMon Oct 29 00:51:53 2012(r242273)
+++ head/sys/sys/sched.hMon Oct 29 01:35:17 2012(r242274)
@@ -151,11 +151,13 @@ static __inline void
 sched_pin(void)
 {
curthread-td_pinned++;
+   __compiler_membar();
 }
 
 static __inline void
 sched_unpin(void)
 {
+   __compiler_membar();
curthread-td_pinned--;
 }
 
___
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: r242276 - head/sys/mips/cavium

2012-10-28 Thread Juli Mallett
Author: jmallett
Date: Mon Oct 29 02:10:20 2012
New Revision: 242276
URL: http://svn.freebsd.org/changeset/base/242276

Log:
  Wrap some long lines and display board serial numbers at boot.

Modified:
  head/sys/mips/cavium/octeon_machdep.c

Modified: head/sys/mips/cavium/octeon_machdep.c
==
--- head/sys/mips/cavium/octeon_machdep.c   Mon Oct 29 01:51:24 2012
(r242275)
+++ head/sys/mips/cavium/octeon_machdep.c   Mon Oct 29 02:10:20 2012
(r242276)
@@ -512,14 +512,19 @@ octeon_process_app_desc_ver_6(void)
octeon_bootinfo-board_rev_major,
octeon_bootinfo-board_rev_minor,
octeon_bootinfo-eclock_hz);
-   memcpy(cvmx_sysinfo_get()-mac_addr_base, 
octeon_bootinfo-mac_addr_base, 6);
+   memcpy(cvmx_sysinfo_get()-mac_addr_base,
+  octeon_bootinfo-mac_addr_base, 6);
cvmx_sysinfo_get()-mac_addr_count = octeon_bootinfo-mac_addr_count;
cvmx_sysinfo_get()-compact_flash_common_base_addr = 
octeon_bootinfo-compact_flash_common_base_addr;
cvmx_sysinfo_get()-compact_flash_attribute_base_addr = 
octeon_bootinfo-compact_flash_attribute_base_addr;
cvmx_sysinfo_get()-core_mask = octeon_bootinfo-core_mask;
-   cvmx_sysinfo_get()-led_display_base_addr = 
octeon_bootinfo-led_display_base_addr;
+   cvmx_sysinfo_get()-led_display_base_addr =
+   octeon_bootinfo-led_display_base_addr;
+   memcpy(cvmx_sysinfo_get()-board_serial_number,
+  octeon_bootinfo-board_serial_number,
+  sizeof cvmx_sysinfo_get()-board_serial_number);
 }
 
 static void
@@ -588,5 +593,6 @@ octeon_boot_params_init(register_t ptr)
 #endif
strcpy(cpu_model, octeon_model_get_string(cvmx_get_proc_id()));
printf(Model: %s\n, cpu_model);
+   printf(Serial number: %s\n, cvmx_sysinfo_get()-board_serial_number);
 }
 /* impEND: This stuff should move back into the Cavium SDK */
___
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: r242277 - head/usr.sbin/kldxref

2012-10-28 Thread Tim Kientzle
Author: kientzle
Date: Mon Oct 29 03:31:22 2012
New Revision: 242277
URL: http://svn.freebsd.org/changeset/base/242277

Log:
  Clarify a warning message.

Modified:
  head/usr.sbin/kldxref/ef.c

Modified: head/usr.sbin/kldxref/ef.c
==
--- head/usr.sbin/kldxref/ef.c  Mon Oct 29 02:10:20 2012(r242276)
+++ head/usr.sbin/kldxref/ef.c  Mon Oct 29 03:31:22 2012(r242277)
@@ -600,7 +600,8 @@ ef_open(const char *filename, struct elf
printf(\n);
ef-ef_nsegs = nsegs;
if (phdyn == NULL) {
-   warnx(file isn't dynamically-linked);
+   warnx(Skipping %s: not dynamically-linked,
+   filename);
break;
}
if (ef_read_entry(ef, phdyn-p_offset,
___
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: r242161 - in head/sys: net netinet netpfil/pf

2012-10-28 Thread YongHyeon PYUN
On Sun, Oct 28, 2012 at 02:01:37AM +0400, Gleb Smirnoff wrote:
 On Sat, Oct 27, 2012 at 12:58:52PM +0200, Andre Oppermann wrote:
 A On 26.10.2012 23:06, Gleb Smirnoff wrote:
 A  Author: glebius
 A  Date: Fri Oct 26 21:06:33 2012
 A  New Revision: 242161
 A  URL: http://svn.freebsd.org/changeset/base/242161
 A 
 A  Log:
 A o Remove last argument to ip_fragment(), and obtain all needed 
 information
 A   on checksums directly from mbuf flags. This simplifies code.
 A o Clear CSUM_IP from the mbuf in ip_fragment() if we did checksums in

I'm not sure whether ti(4)'s checksum offloading for IP fragmented
packets(CSUM_IP_FRAGS) still works after this change.  ti(4)
requires CSUM_IP should be set for IP fragmented packets. Not sure
whether it's a bug or not. I have a ti(4) controller but I don't
remember where I can find it and don't have a link
parter(1000baseSX) to test it. :-(

 A   hardware. Some driver may not announce CSUM_IP in theur if_hwassist,
 A   although try to do checksums if CSUM_IP set on mbuf. Example is 
 em(4).

em(4) had TX IP checksum offloading support but it was removed
without justification. There could be some reason on that decision
but I don't see any compelling reason.

 A 
 A I'm not getting your description here?  Why work around a bug in a driver
 A in ip_fragment() when we can fix the bug in the driver?
 
 Well, that was actually bug in the stack and a very special driver that
 demonstrates it. I may even agree that driver is incorrect, but the stack was
 incorrect, too.
 
 -- 
 Totus tuus, Glebius.
___
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: r242274 - head/sys/sys

2012-10-28 Thread Gleb Smirnoff
On Mon, Oct 29, 2012 at 01:35:17AM +, Attilio Rao wrote:
A Author: attilio
A Date: Mon Oct 29 01:35:17 2012
A New Revision: 242274
A URL: http://svn.freebsd.org/changeset/base/242274
A 
A Log:
A   Compiler have a precise knowledge of the content of sched_pin() and
A   sched_unpin() as they are functions static and inline.  This way it
A   can do two dangerous things:
A   - Reorder instructions around both of them, taking out from the safe
A path operations that are supposed to be (ie. per-cpu accesses)
A   - Cache the value of td_pinned in CPU registers not making visible
A in kernel context to the scheduler once it is scanning the runqueue,
A as td_pinned is not marked volatile.
A   
A   In order to avoid both possible bugs explicitly, protect the safe path
A   with compiler memory barriers. This will prevent reordering and caching
A   by the compiler about td_pinned operations.
A   
A   Generally this could lead to suboptimal code traversing the pinnings
A   but this is not the case as can be easilly verified:
A   
http://lists.freebsd.org/pipermail/svn-src-projects/2012-October/005797.html

Now __compiler_membar() can be removed from kern_rmlock.c:360

-- 
Totus tuus, Glebius.
___
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: r242161 - in head/sys: net netinet netpfil/pf

2012-10-28 Thread Gleb Smirnoff
On Mon, Oct 29, 2012 at 01:41:04PM -0700, YongHyeon PYUN wrote:
Y On Sun, Oct 28, 2012 at 02:01:37AM +0400, Gleb Smirnoff wrote:
Y  On Sat, Oct 27, 2012 at 12:58:52PM +0200, Andre Oppermann wrote:
Y  A On 26.10.2012 23:06, Gleb Smirnoff wrote:
Y  A  Author: glebius
Y  A  Date: Fri Oct 26 21:06:33 2012
Y  A  New Revision: 242161
Y  A  URL: http://svn.freebsd.org/changeset/base/242161
Y  A 
Y  A  Log:
Y  A o Remove last argument to ip_fragment(), and obtain all needed 
information
Y  A   on checksums directly from mbuf flags. This simplifies code.
Y  A o Clear CSUM_IP from the mbuf in ip_fragment() if we did checksums 
in
Y 
Y I'm not sure whether ti(4)'s checksum offloading for IP fragmented
Y packets(CSUM_IP_FRAGS) still works after this change.  ti(4)
Y requires CSUM_IP should be set for IP fragmented packets. Not sure
Y whether it's a bug or not. I have a ti(4) controller but I don't
Y remember where I can find it and don't have a link
Y parter(1000baseSX) to test it. :-(

ti(4) declares both CSUM_IP and CSUM_IP_FRAGS, so ip_fragment() won't do
software checksums, and thus won't clear these flags.

Potentially a driver that announces one flag in if_hwassist but relies on
couple of flags to be set on mbuf is not correct. If a driver can't do single
checksum  processing independently from others, then it should set or clear
appropriate flags in if_hwassist as a group.

Y  A   hardware. Some driver may not announce CSUM_IP in theur 
if_hwassist,
   

Oh, that was a typo! Software was meant.

-- 
Totus tuus, Glebius.
___
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: r242161 - in head/sys: net netinet netpfil/pf

2012-10-28 Thread YongHyeon PYUN
On Mon, Oct 29, 2012 at 09:21:00AM +0400, Gleb Smirnoff wrote:
 On Mon, Oct 29, 2012 at 01:41:04PM -0700, YongHyeon PYUN wrote:
 Y On Sun, Oct 28, 2012 at 02:01:37AM +0400, Gleb Smirnoff wrote:
 Y  On Sat, Oct 27, 2012 at 12:58:52PM +0200, Andre Oppermann wrote:
 Y  A On 26.10.2012 23:06, Gleb Smirnoff wrote:
 Y  A  Author: glebius
 Y  A  Date: Fri Oct 26 21:06:33 2012
 Y  A  New Revision: 242161
 Y  A  URL: http://svn.freebsd.org/changeset/base/242161
 Y  A 
 Y  A  Log:
 Y  A o Remove last argument to ip_fragment(), and obtain all needed 
 information
 Y  A   on checksums directly from mbuf flags. This simplifies code.
 Y  A o Clear CSUM_IP from the mbuf in ip_fragment() if we did 
 checksums in
 Y 
 Y I'm not sure whether ti(4)'s checksum offloading for IP fragmented
 Y packets(CSUM_IP_FRAGS) still works after this change.  ti(4)
 Y requires CSUM_IP should be set for IP fragmented packets. Not sure
 Y whether it's a bug or not. I have a ti(4) controller but I don't
 Y remember where I can find it and don't have a link
 Y parter(1000baseSX) to test it. :-(
 
 ti(4) declares both CSUM_IP and CSUM_IP_FRAGS, so ip_fragment() won't do

Because it supports both CSUM_IP and CSUM_IP_FRAGS. Probably ti(4)
is the only controller that supports TCP/UDP checksum offloading
for an IP fragmented packet.

 software checksums, and thus won't clear these flags.
 
 Potentially a driver that announces one flag in if_hwassist but relies on
 couple of flags to be set on mbuf is not correct. If a driver can't do single
 checksum  processing independently from others, then it should set or clear
 appropriate flags in if_hwassist as a group.

Hmm, then what would be best way to achieve CSUM_IP_FRAGS in
driver? I don't have clear idea how to utilize the hardware
feature. The stack should tell that the mbuf needs TCP/UDP checksum
offloading for IP fragmented packet(i.e. CSUM_IP_FRAGS is not set by
upper stack).

 
 Y  A   hardware. Some driver may not announce CSUM_IP in theur 
 if_hwassist,

 
 Oh, that was a typo! Software was meant.
 
 -- 
 Totus tuus, Glebius.
___
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