TCP on IPv6 when IPV6_USE_MIN_MTU is set

2016-11-07 Thread kato
Folks,

This is not limited to NetBSD current but with all NetBSD releases
with IPv6, and other BSD based varients as well.

Applications which do not want to depend on Path MTU Discovery may set
IPV6_USE_MIN_MTU=1 to use IPv6_MMTU (1280) as defined in RFC3542. This
works well for UDP as long as fragmentation is allowed and no other
method to reduce message size is available.

But when the socket is set with this option, TCP doesn't see it and it
may send a larger segment especially when the peer notifies larger MSS
value. In this case, the segment is fragmented, and delivery
efficiency decreases. In some cases, if a middle box refuses fragments
(some of the boxes only pass the first fragment), the TCP session
breaks.

There was a short discussion on IETF 6man mailing list but no
conclusion was made:

https://www.ietf.org/mail-archive/web/ipv6/current/msg24977.html

I understood that it may not be the best to use IPV6_USE_MIN_MTU to
control this, however, there is no suitable knob defined at this
moment, and some TCP sessions currently fail in IPv6.

When IPV6_USE_MIN_MTU is defined to be 1 (IP6PO_MINMTU_ALL),
followings are necessary to avoid IPv6 fragmentation:
- it should advertise TCP MSS to be 1220 or less
- when TCP MSS is advertised from its peer, it should be clipped
  to be 1220 or less
- when it send a TCP segment, its segment size should be 1220 or less
Note: 1220 is IPV6_MMTU - IP6/TCP header size.

Enclosed is a quick ugly patch for NetBSD-7 to mitigate this
situation, which may not be complete.

-- Akira Kato, WIDE Project
*** tcp_input.c.ORG Sun Aug  2 15:08:15 2015
--- tcp_input.c Mon Nov  7 17:12:05 2016
***
*** 4443,4448 
--- 4443,4461 
sc->sc_ourmaxseg = tcp_mss_to_advertise(m->m_flags & M_PKTHDR ?
m->m_pkthdr.rcvif : NULL,
sc->sc_src.sa.sa_family);
+ #ifdefINET6
+   if (tp && tp->t_in6pcb && tp->t_in6pcb->in6p_outputopts) {
+   if (tp->t_in6pcb->in6p_outputopts->ip6po_minmtu ==
+   IP6PO_MINMTU_ALL) {
+   sc->sc_ourmaxseg = min(sc->sc_ourmaxseg,
+   IPV6_MMTU - sizeof(struct ip6_hdr)
+   - sizeof(struct tcphdr));
+   sc->sc_peermaxseg = min(sc->sc_peermaxseg,
+   IPV6_MMTU - sizeof(struct ip6_hdr)
+   - sizeof(struct tcphdr));
+   }
+   }
+ #endif
sc->sc_win = win;
sc->sc_timebase = tcp_now - 1;  /* see tcp_newtcpcb() */
sc->sc_timestamp = tb.ts_recent;
*** tcp_output.c.ORGSun Aug  2 15:08:15 2015
--- tcp_output.cTue Nov  1 08:29:38 2016
***
*** 1124,1129 
--- 1124,1138 
tp->snd_nxt = tp->iss;
tp->t_ourmss = tcp_mss_to_advertise(synrt != NULL ?
synrt->rt_ifp : NULL, af);
+ #ifdef INET6
+   if (tp->t_in6pcb && tp->t_in6pcb->in6p_outputopts) {
+   if (tp->t_in6pcb->in6p_outputopts->ip6po_minmtu ==
+   IP6PO_MINMTU_ALL)
+   tp->t_ourmss = min(tp->t_ourmss, 
+   IPV6_MMTU - sizeof(struct ip6_hdr)
+   - sizeof(struct tcphdr));
+   }
+ #endif
if ((tp->t_flags & TF_NOOPT) == 0 && OPT_FITS(4)) {
opt[0] = TCPOPT_MAXSEG;
opt[1] = 4;
*** tcp_subr.c.ORG  Thu Feb 26 12:44:13 2015
--- tcp_subr.c  Thu Nov  3 09:25:45 2016
***
*** 2001,2006 
--- 2001,2014 
mss = tcp_mssdflt;
if (offer)
mss = offer;
+ #ifdef INET6
+   if (tp->t_in6pcb && tp->t_in6pcb->in6p_outputopts) {
+   if (tp->t_in6pcb->in6p_outputopts->ip6po_minmtu ==
+   IP6PO_MINMTU_ALL)
+   mss = min(mss, IPV6_MMTU - sizeof(struct ip6_hdr)
+   - sizeof(struct tcphdr));
+   }
+ #endif
mss = max(mss, 256);/* sanity */
tp->t_peermss = mss;
mss -= tcp_optlen(tp);


LSI MegaRaid SAS3108

2015-04-20 Thread kato
Folks,

Is anybody working to support 12Gbps SAS version of LSI MegaRAID
SAS3108 based card on NetBSD-current, -7Beta, or even 6.1?

It seems that SAS3108 is supported in latest versions of OpenBSD and
FreeBSD.

-- Akira Kato



Re: suspend/resume friendly laptop

2014-06-13 Thread kato

Thanks, folks. I will write you more precisely, however, TP X61
running 6.99.43 suspends successfully. However, when I open the lid
again after a while, it doesn't resume well; the screen is black and
small underlined cursor appears in two locations. When I type
something on the keyboard, the characters displayed in two locations,
but nothing more. No command is accepted; No network is working.
I also guess that vesa mode is a suspect. I will let you know if
I got more detailed status.

The other purpose of my last posting was to know about laptop models
currently available in the market. Even if TP X61 works fine, nobody
can purchase it in brend new status any more. I'm also happy if recent
models such as TP X240 (I know Intel 7260 wireless is not supported at
this moment), Dell Latitude 14 5000 (Intel 7260 must be replaced with
Intel 6250, for example), HP ???, ASUS ???, ..., works well.

-- Akira Kato

From: Jukka Ruohonen jruoho...@iki.fi
Subject: Re: suspend/resume friendly laptop
Date: Tue, 10 Jun 2014 13:31:18 +0300

 On Tue, Jun 10, 2014 at 12:17:35PM +0900, k...@wide.ad.jp wrote:
 I'm afraid if this inquiry is a little bit off topic.
 
 Not at all.
 
 In my Lenovo X61, suspend/resume doesn't work well in NetBSD 6.1 and
 NetBSD 6.99 regardless of the value of
hw.acpi.sleep.vbios
hw.acpi.acpivga0.bios_switch
 in non-X11 environment and X11 environment (vesa driver is in use).
 
 I have X61s and X60s, both of which can suspend and resume. At least this
 worked very well for the 6.X series, but for today's -current resume
 occasionally hangs. Actually, not resuming itself (i.e., the system comes
 back to life) but indeed the graphics (vesa) do not always resume. I have
 no idea what causes this non-deterministic behavior, but vesa is a suspect.
 I would also appreciate hints on how this could be even debugged.
 
 Any information is appreciated but I'd prefer if such laptops are
 still available in the market (in brand new shape), and if they are
 less than 2kg/4lb. Minor hardware change (such as replacing PCIe-mini
 wireless lan card -- it may not be available in Lenovo) is acceptable.
 
 I think after the big Intel/X.org/KMS/whatnot thing is resolved, it becomes
 much easier to start more systematic investigations.
 
 - Jukka.


suspend/resume friendly laptop

2014-06-09 Thread kato

I'm afraid if this inquiry is a little bit off topic.

In my Lenovo X61, suspend/resume doesn't work well in NetBSD 6.1 and
NetBSD 6.99 regardless of the value of
  hw.acpi.sleep.vbios
  hw.acpi.acpivga0.bios_switch
in non-X11 environment and X11 environment (vesa driver is in use).

I have a question: What laptops are known to work suspend/resume
correctly with X11 enabled in NetBSD 6.1 and/or NetBSD 6.99?
Configuration information is also appreciated. 

Any information is appreciated but I'd prefer if such laptops are
still available in the market (in brand new shape), and if they are
less than 2kg/4lb. Minor hardware change (such as replacing PCIe-mini
wireless lan card -- it may not be available in Lenovo) is acceptable.

-- Akira Kato