Return-Path: <owner-ips@ece.cmu.edu>
X-Sieve: cmu-sieve 2.0
Return-Path: <owner-ips@ece.cmu.edu>
Received: (from majordom@localhost)
	by ece.cmu.edu (8.11.0/8.10.2) id h3IFhGr19383
	for ips-outgoing; Fri, 18 Apr 2003 11:43:16 -0400 (EDT)
X-Authentication-Warning: ece.cmu.edu: majordom set sender to owner-ips@ece.cmu.edu using -f
Received: from cybernetics.com (cyborg.cybernetics.com [206.246.200.18])
	by ece.cmu.edu (8.11.0/8.10.2) with ESMTP id h3IFaf318818
	for <ips@ece.cmu.edu>; Fri, 18 Apr 2003 11:36:41 -0400 (EDT)
Received: from condor ([137.157.1.224]) by cyborg.cybernetics.com with SMTP id <119116>; Fri, 18 Apr 2003 11:35:23 -0400
Reply-To: <tonyb@cybernetics.com>
From: "Tony Battersby" <tonyb@cybernetics.com>
To: <mingz@ele.uri.edu>
Cc: <ips@ece.cmu.edu>
Subject: RE: iSCSI read/write cost difference
Date:  Fri, 18 Apr 2003 11:35:29 -0400
Message-ID: <003701c305c0$24e7da20$e0019d89@cybernetics.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0)
In-Reply-To: <200304181116.52709.mingz@ele.uri.edu>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Importance: Normal
Sender: owner-ips@ece.cmu.edu
Precedence: bulk

> > I think the UNH iSCSI implementation dosen't set TCP_NODELAY on the
> > connection sockets, which can lead to strange performance 
> characteristics
> > like this.  See the man pages for "setsockopt" and "tcp".  
> You can find an
> > example of setting TCP_NODELAY in the linux-iscsi drivers at
> > http://sourceforge.net/projects/linux-iscsi.  Just download 
> the source and
> > grep for TCP_NODELAY.
> yes, it doesn't set the TCP_NODELAY. I read the linux-iscsi 
> code and try to 
> add this sock->ops->setsockopt() in UNH code. But it always 
> return EFAULT 
> indicating a bad address. but i use a similar way to define 
> arg = 1 as a 
> local variable. i am not sure why i am wrong. and i check the 
> inet_set_sockopt and tcp_setsock_opt, nowhere return a EFAULT.
> 
> can some one figure it out? thx.

For calling setsockopt() from kernel code, try something like this:

#include <asm/uaccess.h>

int arg = 1;
mm_segment_t oldfs;

oldfs = get_fs();
set_fs(get_ds());

if (sock->ops->setsockopt(sock,
                          IPPROTO_TCP,
                          TCP_NODELAY,
                          (char *) &arg,
                          sizeof(arg)) < 0)
   {
   /* handle error */
   }

set_fs(oldfs);

Anthony J. Battersby
Cybernetics

