Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.networking > #1515 > unrolled thread

scatter/gather test

Started bywkevin <wkevils@gmail.com>
First post2012-07-17 11:37 -0700
Last post2012-07-18 18:55 +0000
Articles 9 — 4 participants

Back to article view | Back to comp.os.linux.networking


Contents

  scatter/gather test wkevin <wkevils@gmail.com> - 2012-07-17 11:37 -0700
    Re: scatter/gather test Rick Jones <rick.jones2@hp.com> - 2012-07-17 20:48 +0000
      Re: scatter/gather test wkevin <wkevils@gmail.com> - 2012-07-17 23:21 -0700
        Re: scatter/gather test Noob <root@127.0.0.1> - 2012-07-18 12:08 +0200
          Re: scatter/gather test wkevin <wkevils@gmail.com> - 2012-07-18 05:18 -0700
            Re: scatter/gather test Noob <root@127.0.0.1> - 2012-07-18 15:38 +0200
            Re: scatter/gather test Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-07-18 14:48 +0000
          Re: scatter/gather test wkevin <wkevils@gmail.com> - 2012-07-18 05:14 -0700
        Re: scatter/gather test Rick Jones <rick.jones2@hp.com> - 2012-07-18 18:55 +0000

#1515 — scatter/gather test

Fromwkevin <wkevils@gmail.com>
Date2012-07-17 11:37 -0700
Subjectscatter/gather test
Message-ID<1e1274bf-aabe-48d3-b1cc-2fbcea2fc9c9@googlegroups.com>
Hi,
I want to perform a test which uses scatter/gather.
This is to say, I set scatter/gather via ethtool
with ethtool -K eth0 sg on

scatter gather should work when nr_frags > 0 

Many drivers have special treatment for scatter/gather

see for example : drivers/net/ethernet/realtek/8139cp.c
and the cp_start_xmit() method. 

Is there a way by user space tools or by some program 
to generate tx traffic on the nic so that 
skb->shinfo(nr_frags) will be greater than 0 in the tx path? 

rgs,
Kevin

[toc] | [next] | [standalone]


#1516

FromRick Jones <rick.jones2@hp.com>
Date2012-07-17 20:48 +0000
Message-ID<ju4j27$lks$1@usenet01.boi.hp.com>
In reply to#1515
wkevin <wkevils@gmail.com> wrote:
> I want to perform a test which uses scatter/gather.  This is to say,
> I set scatter/gather via ethtool with ethtool -K eth0 sg on scatter
> gather should work when nr_frags > 0

> Many drivers have special treatment for scatter/gather

> see for example : drivers/net/ethernet/realtek/8139cp.c and the
> cp_start_xmit() method.

> Is there a way by user space tools or by some program to generate tx
> traffic on the nic so that skb->shinfo(nr_frags) will be greater
> than 0 in the tx path?

Using sendfile() might do that, as might something like a netperf
TCP_STREAM test with a smallish send size.  You would want to
instrument the driver in question to verify you were indeed getting
fragments though.

rick jones
-- 
denial, anger, bargaining, depression, acceptance, rebirth...
                                     where do you want to be today?
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com  but NOT BOTH...

[toc] | [prev] | [next] | [standalone]


#1517

Fromwkevin <wkevils@gmail.com>
Date2012-07-17 23:21 -0700
Message-ID<bd62df23-6ea9-4ed2-9781-f368c58ff97a@googlegroups.com>
In reply to#1516
Hi,
Thanks for you answer
I tried with netperf like this:
netperf -H 192.168.1.3 -l 200
and also:
netperf -H 192.168.1.3 -l 6000

I added print of skb_shinfo(skb)->nr_frags in the tx path of the driver
In both cases scatter/gather is not performed. And I see skb_shinfo(skb)->nr_frags=0, and not greater than 0 (as should be in the 
case of scatter/gather).


ethtool -k eth0 shows that sg is on.

Any ideas ? did anybody had success with testing scatter/gather?

[toc] | [prev] | [next] | [standalone]


#1518

FromNoob <root@127.0.0.1>
Date2012-07-18 12:08 +0200
Message-ID<ju61ug$e5e$1@dont-email.me>
In reply to#1517
wkevin wrote:

> Any ideas? did anybody had success with testing scatter/gather?

Have you tried coalescing multiple disjoint buffers using sendmsg?
(sendmsg is the text-book API for user-space scatter/gather.)

http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html

ssize_t sendmsg(int socket, const struct msghdr *message, int flags);

The msghdr structure shall include at least the following members:

void          *msg_name        Optional address.
socklen_t      msg_namelen     Size of address.
struct iovec  *msg_iov         Scatter/gather array.
int            msg_iovlen      Members in msg_iov.
void          *msg_control     Ancillary data; see below.
socklen_t      msg_controllen  Ancillary data buffer len.
int            msg_flags       Flags on received message.

Regards.

[toc] | [prev] | [next] | [standalone]


#1519

Fromwkevin <wkevils@gmail.com>
Date2012-07-18 05:18 -0700
Message-ID<fe427b4e-bbf6-4923-babd-2094e1589633@googlegroups.com>
In reply to#1518
Hi,
Thanks for your answer. I started 
coding according to the sendmsg links.

Three more questions that might help me, if I may:

Should msg_iovlen for scatter gather case be greater than 1 ? this is what I think.
and should  msg_controllen  be greater than 1 ? or msg_control  can be null ? 


Will scatter gather work with this sendmsg API  with UDP/TCP/RAW sockets , or in only one or two of them ? 


thnks, 
Kevin


On Wednesday, July 18, 2012 1:08:26 PM UTC+3, Noob wrote:
> wkevin wrote:
> 
> &gt; Any ideas? did anybody had success with testing scatter/gather?
> 
> Have you tried coalescing multiple disjoint buffers using sendmsg?
> (sendmsg is the text-book API for user-space scatter/gather.)
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
> 
> ssize_t sendmsg(int socket, const struct msghdr *message, int flags);
> 
> The msghdr structure shall include at least the following members:
> 
> void          *msg_name        Optional address.
> socklen_t      msg_namelen     Size of address.
> struct iovec  *msg_iov         Scatter/gather array.
> int            msg_iovlen      Members in msg_iov.
> void          *msg_control     Ancillary data; see below.
> socklen_t      msg_controllen  Ancillary data buffer len.
> int            msg_flags       Flags on received message.
> 
> Regards.

[toc] | [prev] | [next] | [standalone]


#1521

FromNoob <root@127.0.0.1>
Date2012-07-18 15:38 +0200
Message-ID<ju6e96$jtk$1@dont-email.me>
In reply to#1519
[ Please, don't top-post ]

wkevin wrote:

> Noob wrote:
> 
>> Have you tried coalescing multiple disjoint buffers using sendmsg?
>> (sendmsg is the text-book API for user-space scatter/gather.)
>>
>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
>>
>> ssize_t sendmsg(int socket, const struct msghdr *message, int flags);
>>
>> The msghdr structure shall include at least the following members:
>>
>> void          *msg_name        Optional address.
>> socklen_t      msg_namelen     Size of address.
>> struct iovec  *msg_iov         Scatter/gather array.
>> int            msg_iovlen      Members in msg_iov.
>> void          *msg_control     Ancillary data; see below.
>> socklen_t      msg_controllen  Ancillary data buffer len.
>> int            msg_flags       Flags on received message.
> 
> I started coding according to the sendmsg links.
> 
> Three more questions that might help me, if I may:
> 
> Should msg_iovlen for scatter gather case be greater than 1?
> this is what I think.

Right. sendmsg is supposed to coalesce ("gather") the data scattered
in the msg_iov[k].iov_base buffers.

POSIX states:
> The msg_iov and msg_iovlen fields of message specify zero or more
> buffers containing the data to be sent. msg_iov points to an array of
> iovec structures; msg_iovlen shall be set to the dimension of this
> array. In each iovec structure, the iov_base field specifies a
> storage area and the iov_len field gives its size in bytes. Some of
> these sizes can be zero. The data from each storage area indicated by
> msg_iov is sent in turn.

> and should msg_controllen be greater than 1?
> or msg_control can be NULL?

If you don't want to deal with all the complexity of sendmsg,
you can also use writev for connected sockets.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html

> Will scatter gather work with this sendmsg API with UDP/TCP/RAW sockets,
> or in only one or two of them ?

I believe it's supposed to work with all types of sockets.

Regards.

[toc] | [prev] | [next] | [standalone]


#1522

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2012-07-18 14:48 +0000
Message-ID<slrnk0dj6c.rk7.grahn+nntp@frailea.sa.invalid>
In reply to#1519
On Wed, 2012-07-18, wkevin wrote:
> Hi,
> Thanks for your answer. I started 
> coding according to the sendmsg links.
>
> Three more questions that might help me, if I may:
>

> Should msg_iovlen for scatter gather case be greater than 1 ? this
> is what I think.

Read the sendmsg() manual page! Mine says quite clearly "elements in
msg_iov".  The "elements" are the iovec structs, and each of them
contains a chunk of octets.

If you want to be overwhelmed by information, you can also install the
POSIX manual pages. sendmsg(3p) is even more detailed, but also harder
to read.

> and should  msg_controllen  be greater than 1 ? or msg_control  can be null ? 

Read the sendmsg() manual page!  Or try it yourself.
"Ancillary data" is an obscure feature which you can happily ignore.

> Will scatter gather work with this sendmsg API with UDP/TCP/RAW
> sockets , or in only one or two of them ? 

Read the sendmsg() manual page!  Or try it yourself. But no such error
code is listed, so it should work everywhere, unless documented
otherwise in udp(7), tcp(7), raw(7) and so on.  (Of course no hardware
NIC support will be involved when you use it for Unix domain sockets
et cetera.)

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#1520

Fromwkevin <wkevils@gmail.com>
Date2012-07-18 05:14 -0700
Message-ID<6f3c69ba-feb3-4958-ad28-5d4984080701@googlegroups.com>
In reply to#1518
On Wednesday, July 18, 2012 1:08:26 PM UTC+3, Noob wrote:
> wkevin wrote:
> 
> &gt; Any ideas? did anybody had success with testing scatter/gather?
> 
> Have you tried coalescing multiple disjoint buffers using sendmsg?
> (sendmsg is the text-book API for user-space scatter/gather.)
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
> 
> ssize_t sendmsg(int socket, const struct msghdr *message, int flags);
> 
> The msghdr structure shall include at least the following members:
> 
> void          *msg_name        Optional address.
> socklen_t      msg_namelen     Size of address.
> struct iovec  *msg_iov         Scatter/gather array.
> int            msg_iovlen      Members in msg_iov.
> void          *msg_control     Ancillary data; see below.
> socklen_t      msg_controllen  Ancillary data buffer len.
> int            msg_flags       Flags on received message.
> 
> Regards.

[toc] | [prev] | [next] | [standalone]


#1523

FromRick Jones <rick.jones2@hp.com>
Date2012-07-18 18:55 +0000
Message-ID<ju70q6$nvk$1@usenet01.boi.hp.com>
In reply to#1517
wkevin <wkevils@gmail.com> wrote:
> Hi,
> Thanks for you answer
> I tried with netperf like this:
> netperf -H 192.168.1.3 -l 200
> and also:
> netperf -H 192.168.1.3 -l 6000

All that does is change the runtime of the test.  200 seconds in the
first case, and 6000 seconds in the second.

If you want to use sendfile() via netperf that would be the
"TCP_SENDFILE" test:

netperf -t TCP_SENDFILE ...

If you want to change the size of what netperf puts into the socket
buffer each time, that would be a "test-specific" (after the "--" on
the command line) -m option:

netperf <global options>  -- -m <size>

for example:

netperf -H 192.168.1.3 -- -m 128

will cause netperf to call send() with 128 bytes each time.

http://www.netperf.org/svn/netperf2/tags/netperf-2.6.0/doc/netperf.html

rick jones
-- 
firebug n, the idiot who tosses a lit cigarette out his car window
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.networking


csiph-web