[linux-cifs-client] CIFS slow on gigabit, doesn't support sockopt=TCP_NODELAY ?

Jeff Layton jlayton at redhat.com
Tue Aug 25 05:09:07 MDT 2009


On Mon, 24 Aug 2009 23:10:15 -0400
Timothy Normand Miller <theosib at gmail.com> wrote:

> I have another question.  Setting TCP_NODELAY and IPTOS_LOWDELAY seem
> to affect different levels of the protocol stack.  Consider this bit
> of code I googled:
> 
> #ifdef IPTOS_LOWDELAY
>       int lowdelay = IPTOS_LOWDELAY;
>       if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, (void *)&lowdelay,
>                      sizeof(lowdelay)) < 0)
>         error("setsockopt IPTOS_LOWDELAY: %.100s", strerror(errno));
> #endif /* IPTOS_LOWDELAY */
> #if defined(TCP_NODELAY) && defined(ENABLE_TCP_NODELAY)
>       if (setsockopt(connection_in, IPPROTO_TCP, TCP_NODELAY, (void *)&on,
>                      sizeof(on)) < 0)
>         error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
> #endif /* TCP_NODELAY */
> 
> I figured out how to set TCP_NODELAY in the kernel, because I saw an
> example.  So I do this in ipv4_connect:
> 
>         val = 1;
>         socket->ops->setsockopt(socket, SOL_TCP, TCP_NODELAY,
>                                             (char __user *)&val, sizeof(val));
> 

That'll probably work in most cases but it's more consistent and
correct to use kernel_setsockopt (it'll make sure the %fs register gets
set correctly for the call). The args are the same and it calls the
socket's setsockopt operation after doing some setup.


> Thus, for IPTOS_LOWDELAY, would I do this?
> 
>         val = IPTOS_LOWDELAY;
>         socket->ops->setsockopt(socket, SOL_IP, IP_TOS,
>                                             (char __user *)&val, sizeof(val));
> 
> 

Hmm...never used setsockopt to set TOS bits, but I suppose it would
work. You could also do that with iptables rules too.

-- 
Jeff Layton <jlayton at redhat.com>


More information about the linux-cifs-client mailing list