1 /*
2         Copyright (C) 2007 Hewlett-Packard Company
3 */
4 
5  /* This file contains the test-specific definitions for netperf's SDP */
6  /* sockets tests */
7 
8 /* one of these days, this should not be required */
9 #ifndef AF_INET_SDP
10 #define AF_INET_SDP 27
11 #define PF_INET_SDP AF_INET_SDP
12 #endif
13 
14 struct	sdp_stream_request_struct {
15   int	send_buf_size;
16   int	recv_buf_size;	/* how big does the client want it - the */
17 			/* receive socket buffer that is */
18   int	receive_size;   /* how many bytes do we want to receive at one */
19 			/* time? */
20   int	recv_alignment; /* what is the alignment of the receive */
21 			/* buffer? */
22   int	recv_offset;    /* and at what offset from that alignment? */
23   int	no_delay;       /* do we disable the nagle algorithm for send */
24 			/* coalescing? */
25   int	measure_cpu;	/* does the client want server cpu utilization */
26 			/* measured? */
27   float	cpu_rate;	/* do we know how fast the cpu is already? */
28   int	test_length;	/* how long is the test?		*/
29   int	so_rcvavoid;    /* do we want the remote to avoid copies on */
30 			/* receives? */
31   int	so_sndavoid;    /* do we want the remote to avoid send copies? */
32   int   dirty_count;    /* how many integers in the receive buffer */
33 			/* should be made dirty before calling recv? */
34   int   clean_count;    /* how many integers should be read from the */
35 			/* recv buffer before calling recv? */
36   int   port;		/* the to port to which recv side should bind
37 			   to allow netperf to run through firewalls */
38   int   ipfamily;	/* address family of ipaddress */
39   int   non_blocking;   /* run the test in non-blocking mode */
40 };
41 
42 struct	sdp_stream_response_struct {
43   int	recv_buf_size;	/* how big does the client want it	*/
44   int	receive_size;
45   int	no_delay;
46   int	measure_cpu;	/* does the client want server cpu	*/
47   int	test_length;	/* how long is the test?		*/
48   int	send_buf_size;
49   int	data_port_number;	/* connect to me here	*/
50   float	cpu_rate;		/* could we measure	*/
51   int	so_rcvavoid;	/* could the remote avoid receive copies? */
52   int	so_sndavoid;	/* could the remote avoid send copies? */
53   int   non_blocking;   /* run the test in non-blocking mode */
54 };
55 
56 struct sdp_stream_results_struct {
57   double         bytes_received;
58   unsigned int	 recv_calls;
59   float	         elapsed_time;	/* how long the test ran */
60   float	         cpu_util;	/* -1 if not measured */
61   float	         serv_dem;	/* -1 if not measured */
62   int            cpu_method;    /* how was cpu util measured? */
63   int            num_cpus;      /* how many CPUs had the remote? */
64 };
65 
66 struct	sdp_rr_request_struct {
67   int	recv_buf_size;	/* how big does the client want it	*/
68   int	send_buf_size;
69   int	recv_alignment;
70   int	recv_offset;
71   int	send_alignment;
72   int	send_offset;
73   int	request_size;
74   int	response_size;
75   int	no_delay;
76   int	measure_cpu;	/* does the client want server cpu	*/
77   float	cpu_rate;	/* do we know how fast the cpu is?	*/
78   int	test_length;	/* how long is the test?		*/
79   int	so_rcvavoid;    /* do we want the remote to avoid receive */
80 			/* copies? */
81   int	so_sndavoid;    /* do we want the remote to avoid send copies? */
82   int   port;		/* the to port to which recv side should bind
83 			   to allow netperf to run through firewalls */
84   int   ipfamily;	/* address family of ipaddress */
85   int   non_blocking;   /* run the test in non-blocking mode */
86 };
87 
88 struct	sdp_rr_response_struct {
89   int	recv_buf_size;	/* how big does the client want it	*/
90   int	no_delay;
91   int	measure_cpu;	/* does the client want server cpu	*/
92   int	test_length;	/* how long is the test?		*/
93   int	send_buf_size;
94   int	data_port_number;	/* connect to me here	*/
95   float	cpu_rate;		/* could we measure	*/
96   int	so_rcvavoid;	/* could the remote avoid receive copies? */
97   int	so_sndavoid;	/* could the remote avoid send copies? */
98   int   non_blocking;   /* run the test in non-blocking mode */
99 };
100 
101 struct sdp_rr_results_struct {
102   unsigned int  bytes_received;	/* ignored initially */
103   unsigned int	recv_calls;	/* ignored initially */
104   unsigned int	trans_received;	/* not ignored  */
105   float	        elapsed_time;	/* how long the test ran */
106   float	        cpu_util;	/* -1 if not measured */
107   float	        serv_dem;	/* -1 if not measured */
108   int           cpu_method;    /* how was cpu util measured? */
109   int           num_cpus;      /* how many CPUs had the remote? */
110 };
111 
112 struct	sdp_maerts_request_struct {
113   int	send_buf_size;
114   int	recv_buf_size;	/* how big does the client want it - the */
115 			/* receive socket buffer that is */
116   int	send_size;      /* how many bytes do we want netserver to send
117 			   at one time? */
118   int	send_alignment; /* what is the alignment of the send */
119 			/* buffer? */
120   int	send_offset;    /* and at what offset from that alignment? */
121   int	no_delay;       /* do we disable the nagle algorithm for send */
122 			/* coalescing? */
123   int	measure_cpu;	/* does the client want server cpu utilization */
124 			/* measured? */
125   float	cpu_rate;	/* do we know how fast the cpu is already? */
126   int	test_length;	/* how long is the test?		*/
127   int	so_rcvavoid;    /* do we want the remote to avoid copies on */
128 			/* receives? */
129   int	so_sndavoid;    /* do we want the remote to avoid send copies? */
130   int   dirty_count;    /* how many integers in the send buffer */
131 			/* should be made dirty before calling recv? */
132   int   clean_count;    /* how many integers should be read from the */
133 			/* recv buffer before calling recv? */
134   int   port;           /* the port to which the recv side should bind
135 			   to allow netperf to run through those evil
136 			   firewall things */
137   int   ipfamily;
138 };
139 
140 struct	sdp_maerts_response_struct {
141   int	recv_buf_size;	/* how big does the client want it	*/
142   int	send_size;
143   int	no_delay;
144   int	measure_cpu;	/* does the client want server cpu	*/
145   int	test_length;	/* how long is the test?		*/
146   int	send_buf_size;
147   int	data_port_number;	/* connect to me here	*/
148   float	cpu_rate;		/* could we measure	*/
149   int	so_rcvavoid;	/* could the remote avoid receive copies? */
150   int	so_sndavoid;	/* could the remote avoid send copies? */
151 };
152 
153 struct sdp_maerts_results_struct {
154   double         bytes_sent;
155   unsigned int	 send_calls;
156   float	         elapsed_time;	/* how long the test ran */
157   float	         cpu_util;	/* -1 if not measured */
158   float	         serv_dem;	/* -1 if not measured */
159   int            cpu_method;    /* how was cpu util measured? */
160   int            num_cpus;      /* how many CPUs had the remote? */
161 };
162 
163 extern void send_sdp_stream();
164 extern void send_sdp_rr();
165 
166 extern void recv_sdp_stream();
167 extern void recv_sdp_rr();
168 
169 extern void loc_cpu_rate();
170 extern void rem_cpu_rate();
171