DD1984 / sockperf

Automatically exported from code.google.com/p/sockperf
Other
1 stars 0 forks source link

Patch to allow setting TOS #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What is the definition of this task?
1.Allow specifying Type Of Service (TOS) for data.

What is the expected output?
Verify in IP header that the DSCP bits are set correctly.

Patch is for version: 2.5.193
Tested on Linux x86_64 build, verified output with tcpdump

Original issue reported on code.google.com by pchawla...@gmail.com on 18 Apr 2013 at 2:24

Attachments:

GoogleCodeExporter commented 9 years ago
Alex,

Attached (by pawan chawla) is patch to allow specifying IP_TOS in command line. 
 I didn't check it thoroughly; however, the idea sounds good.  
Among all your checks, It may worth to verify that the default value is what we 
had anyhow (for making sure there is backward compatibility for current users).

For your convenience, below is the definition of IP_TOS from "man 7 ip".  
(Notice that we can consider additional improvement by using different value 
for throughput tests vs. latency tests.)

*IP_TOS (since Linux 1.0)*
Set or receive the Type-Of-Service (TOS) field that is sent with every IP 
packet originating from this socket. It is used to prioritize packets on the 
network. TOS is a byte. There are some standard TOS flags defined: 
IPTOS_LOWDELAY to minimize delays for interactive traffic, IPTOS_THROUGHPUT to 
optimize throughput, IPTOS_RELIABILITY to optimize for reliability, 
IPTOS_MINCOST should be used for "filler data" where slow transmission doesn't 
matter. At most one of these TOS values can be specified. Other bits are 
invalid and shall be cleared. Linux sends IPTOS_LOWDELAY datagrams first by 
default, but the exact behavior depends on the configured queueing discipline. 
Some high priority levels may require superuser privileges (the CAP_NET_ADMIN 
capability). The priority can also be set in a protocol independent way by the 
(SOL_SOCKET, SO_PRIORITY) socket option (see socket(7)).

Original comment by avne...@gmail.com on 18 Apr 2013 at 10:30

GoogleCodeExporter commented 9 years ago
Also, need to verify it doesn't break our MS-Windows support.

Original comment by avne...@gmail.com on 18 Apr 2013 at 10:46

GoogleCodeExporter commented 9 years ago
The default value in the patch is is IPTOS_LOWDELAY (0x01). I will shortly 
attach one with default value 0.

Original comment by pchawla...@gmail.com on 18 Apr 2013 at 3:39

GoogleCodeExporter commented 9 years ago
Typo in previous comment, IPTOS_LOWDELAY value is 0x10.
I have modified the patch to have default TOS value of 0x00.

- Pawan

Original comment by pchawla...@gmail.com on 18 Apr 2013 at 4:20

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Pawan,

Thanks for your patch.  Can you please adjust it to the latest version in svn 
trunk and make sure for the following:
1. It doesn't break our MS-Windows support
2. The default value is what the user has anyhow.

Thanks,
  Avner

Original comment by avne...@gmail.com on 21 Apr 2013 at 6:51

GoogleCodeExporter commented 9 years ago
Hi Avner,

I have created another patch from the trunk, made the default value (0x00) 
which is the TOS value if not configured, however I do not have a Windows 
machine to test this on. 

Thanks,
Pawan

Original comment by pchawla...@gmail.com on 4 Jun 2013 at 9:27

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks Pawan,

sounds good.
I looked in MSDN, it sounds that this option exists in Windows, but it is not 
recommended to use it.  Hence, I am afraid it might mislead our Windows users.  
See 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738586(v=vs.85).aspx .

I would suggest to use #ifndef w-i-n-d-o-w-s gourd, in the following block: 

+        
+        if ( !rc && aopt_check(common_obj, OPT_TOS) ) {
+            const char * optarg = aopt_value(common_obj, OPT_TOS);
+            if (optarg)
+           {
            #ifndef ...
               print error and exit
            #endif
+                int value=strtol(optarg,NULL,0);
+                s_user_params.tos = value;
+            }
+       }

In case, we are running under Windows, just print error message and exit.  This 
way we live option for someone in the future to continue your work and support 
it in Windows.

Do you mind completing it in this way.
Thanks,
  Avner

Original comment by avne...@gmail.com on 5 Jun 2013 at 8:08

GoogleCodeExporter commented 9 years ago
Hi Avner,

I have added a check for WIN32 or _WIN32 being defined, which logs error and 
return the unsupported error code.

thanks
pawan

Original comment by pchawla...@gmail.com on 6 Jun 2013 at 9:55

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks Pawan.

Alex, Or,

Do you mind integrating the last patch?  According to the author it should work 
out of the box without breaking Windows.  
If there is any issue, it will probably fast caught in tests.

Avner

Original comment by avne...@gmail.com on 9 Jun 2013 at 7:43

GoogleCodeExporter commented 9 years ago

Original comment by rosenbau...@gmail.com on 18 Jun 2013 at 8:32

GoogleCodeExporter commented 9 years ago

Original comment by rosenbau...@gmail.com on 18 Jun 2013 at 8:33

GoogleCodeExporter commented 9 years ago

Original comment by rosenbau...@gmail.com on 18 Jun 2013 at 11:09

GoogleCodeExporter commented 9 years ago

Original comment by rosenbau...@gmail.com on 18 Jun 2013 at 11:09