This document describes the functions of gcmd (version 1.2) that controls GNET-1 on linux. It requires the GNET-1 FPGA configuration module version 1.2. Refer to bibliographies [2,4,3] and web page http://www.gtrc.aist.go.jp/gnet/ for details about GNET-1. Please send requirements and reports of bugs to y-kodama@aist.go.jp by E-mail.
Gcmd requires ftdi_sio
that is USB serial driver for the USB
interface chip of FTDI Ltd. The driver accesses to GNET-1 using
/dev/ttyUSB device. The permission of /dev/ttyUSB controls whether only
root controls GNET-1 or user controls GNET-1. We checked gcmd only on
RedHat 9.0.
The original ftdi_sio
takes 16 millisecond to get a data from
GNET-1. We developed patches to decrease the overhead. It is included in
gcmd source directory. You can use it only if you can remake the driver
from the patches. We will not help you how to make the driver.
Only copy gcmd binary on the directory that you want. If you set path to the directory, just run gcmd.
You can re-compile gcmd by gcc. Please show the Makefile included in the distribution.
Gcmd is a control program for Gigabit network testbed GNET-1 that was developed by AIST. It has command-line user interface. It requires the GNET-1 FPGA configuration module version 1.2.
/tmp/ttyUSB<port>
where
(<port>
is the number of USB port). If the file already exists,
the gcmd will be terminated with the message ``ttyUSB already used''.
The file is automatically deleted if gcmd is terminated in success, or it is
terminated by force with SIGQUIT.
> ./gcmd open /dev/ttyUSB0 no init script(gnet1.rc) GNET-1 controller on Linux ver. 1.20 Copyright (C) 2003,2004 AIST Grid Research Center FPGA Config ver.1.2000 GNET-1 S/N 0003 #
Available commands are as follows.
It successively measures output bandwidth of each channel in every specified interval, outputs the results to display and specified file.
Following is an example. If arguments are omitted, default values (itv:1000, rep:1000, file:bw.log000) are used. The last three digits of the default file name changed to the serial number of GNET-1. The commands output the command line with default values, and item names. time is the elapse time from the time when it starts. The next 4 items are the output bandwidth in Mbps for each channel. The last 4 items are the number of words in each packet buffer. It outputs each value repeatedly. While it output each result in a line for output file, it display results on the same line for display. You can terminate the command by Ctrl-C to return to command input.
#B B 1000 1000 bw.log0 time CH0 CH1 CH2 CH3(Mbps) : FIFO used max (words) 13.063 0.001 0.001 0.001 0.001 : 000003 000003 000003 000003 #
While the time unit of interval is millisecond, the overhead of the bandwidth measurement is about 2 ms 1. Also it uses usleep() and it may includes 10 ms overhead. The gcmd estimates the overhead and it successively measures bandwidth if the interval is smaller than it.
The interval of measurement is controlled by software using usleep(),
and it wavers in several milliseconds. However, since GNET-1 measures
both the number of transfered bytes and the clock (time unit is
second), the bandwidth is accurate.
The bandwidth includes the header part of Ethernet and frame check sequence (FCS). It is measured before the Tx MAC. It includes the traffic that GNET-1 generates.
The number of word in FIFO is the maximum value from the last access time to the current access time. The word consists of four bytes.
Since there is an asynchronous FIFO between measurement point and Tx MAC, the measured bandwidth is not equal to the bandwidth at the output port. For example, the bandwidth at the output port includes inter frame gap (IFG), but the bandwidth before the asynchronous FIFO includes no IFG. Current implementation decreases the FIFO size to 512 bytes, it decreases the error.
It successively measures input bandwidth of each channel in every specified interval, outputs the results to display and specified file. It is measured just after the Rx MAC. It includes the traffic that may be discard before buffer. Any other details are same as command ``B''.
<n>
, and
stores them to FIFO<n>
, where n is channel number. CH0 and CH1 is
a pair, and CH2 and CH3 is another pair. In a pair, the FIFOs are used
for same mode. Between pairs, they can select the mode independently. The
capture type of each channel can be select independently.
#T CH0 trace Any Header(ffffffff), 0x00125E98 (1203864) words traced CH1 trace Any Header(ffffffff), 0x003FF361 (4191073) words traced
Tx<ch>capture.log<S/N>
, where <ch>
is channel number,
<S/N>
is the serial number of the GNET-1. The file is overwritten
if it is already exists. You must rename it if need.
The throughput of the save is 400 KB/s, and if captured data is full of FIFO, it takes about 90 seconds.
The captured data is stored as 9 digits of hexadecimal number in the
file. The first digit is a tag of data, and other 8 digits are data. If
the bit 3 (MSB) of tag is 1, it specifies the beginning of frame, and
data shows the receiving time of the frame. The time is represented by
binary where the unit is a second. If the bit 2 of tag is 1,
it specifies the end of frame, and bit 1 and 0 of tag is specifies how
many bytes are valid. If tag is 4, all data is valid. If tag is 5, first
byte from MSB is valid. If tag is F, it specifies the frame to be
discarded.
Following is an example of ACK frame. The messages after //
are
the comment and they are not output to the file.
8E5B22F6D // tv = 229.69603616 sec 000005A9A // **** Ether Frame Header 031A80000 // smac = 00005A9A31A8 05A9A2CD8 // dmac = 00005A9A2CD8 008004500 // type = 0800(IP), // **** IP Header Reference[1] p.200 Fig 8.8 // ip_v = 4, ip_hl = 5 (20bytes), ip_top = 00 0003c0000 // ip_len = 003c (60bytes), ip_id = 0000 040004006 // ip_off = 4000, ip_ttl = 40, ip_p = 06 0B968C0A8 // ip_sum = B968, ip_src = C0A80002 00002C0A8 // ip_dst = C0A80001, 0000113FF // **** TCP header Reference[1] p.754 Fig 24.10 // th_sport = 13FF 0814F148A // th_dport = 814F, th_seq = 148A980A 0980AFEDC // th_ack = FEDC5108 05108A012 // th_off = A (40bytes), th_flg = 012 (ack, syn) 016A00F1B // th_win = 16A0, th_sum = 0F1B 000000204 // th_urp = 0000, // **** TCP option Reference[1] p.814 Fig 26.16 // MSS = 020405B4 (1460 bytes) 005B40402 // SACK = 0402 0080A0060 // TimeStamp = 080A0060CA7707213D20 0CA770721 // 03D200103 // NOP = 01, WindowScale = 030307 (65535*2^7) 003071E4B // FCS = 1E4B38EB 638EB1E4B // EOF(2bytes)
For example, "T 15 0000ffff" specifies that first 16 words (64 bytes) are captured.
If the MTU of the frame is 1500 and the wire-rate data is transferred, above example can capture frames in three seconds. If no header is captured, it can capture frames in 48 seconds. If the transfer rate is lower than the wire-rate, the capture time is longer. If the MTU is smaller than 1500, the capture time is shorter.
Discard a frame that is transfered to the specified channel after the command. For example, "L 0" is issued, it lose a frame that is received from CH1 (or read from FIFO) and transfered to CH0.
Run the script specified by the file. The commands in a script file are same as commands for a prompt.
Quit gcmd.
Following commands are compatible for gbeva that is a control program of GNET-1 on windows.
It inserts the specified delay for transmit of the specified channel.
The delay is rounded by
. The maximum
delay is 1 second, and when the delay is less than 134 millisecond it
will not drop frames even if data is transferred at the wire-rate. The
latency between ports on GNET-1 is 1.08 microsecond, and the specified
delay is added to it.
It reads a register specified by an address. The address is specified by three digits of hexadecimal. The contents of registers are described in GNET-1 FPGA Register Specification (version 1.2)[3].
It writes a data in a register specified by an address. The address is specified by three digits of hexadecimal. The data is specified by eight digits of hexadecimal. The contents of registers are described in GNET-1 FPGA Register Specification (version 1.2)[3].
d1 specifies that commands display results loudly. d1 specifies that commands display results quietly.
It specifies the format of the UDP packet that are generated by the v command. The dmac should be specified by the MAC address of router when the destination is over the router. The length of UDP packet and checksum of IP is automatically calculated. The checksum of UDP is fixed to zero. Other fields of the packet is referred to the registers (0xC1 - 0xCB). Followings are the UDP data.
It successively generates UDP packets those formats are specified by the s command. The len argument of s command is used for calculating the generation bandwidth. The time is represented by a floating number, those time unit is second.
It forward the frames that matches the specified conditions to the destination that specified by the f command. The sip is used for calculating ipsum in the f command. The smac should be specified by the MAC address of router when the frames comes over the router.
It changes the destination of frames that matches the condition of k command. The fields to be changed are as follows. Other fields is still remains.
The forwarding function decrease the wire-rate traffic with MTU 1500 to the traffic of 45Mbps, that can be captured by a PC.
It set inter frame gap (IFG) calculated by
where 18 is the size of Ether frame header and frame check
sequence (FCS), and 26 is the number that is added the size of preample
to it. The output bandwidth is depend on the MTU size. It can be
controlled from 1Gbps to 23Mbps with MTU 1500, and from 1Gbps to 120Mbps
with MTU 9000. It does not work well if frames with different MTUs are
transferred. In such case, you can use ifg command for dynamic IFG
control.
It shows the information from GPS (Global Positioning System). GPS module is an option for GNET-1. It shows whether GPS module is available or not, current clock, the position information, date, and the number of satellite.
Following is an example of the command. Since the information of GPS is
updated in a second, it waits a minute, and get an information of
GPS. Sec is a clock those format is based on RFC1305. The sub-second
followed by the floating point is counted using local clock between PPS
(Pulse Per Second) from GPS module. The frequency of local clock is
measured by PPS every seconds. The counter of local clock is precisely
changed to the binary counter. In the following example, the
frequency of local clock is 31.250523 MHz. It shows the current position
of latitude, longitude, and altitude. Date is the time information from
GPS. It shows the number of visible satellites.
#gps wait a second sec: C4CE7483.56C45600 adjusted clock with 31.250523 MHz pos: N:36 03.7620' E:140 62.4810' H:000040.2 m date: 2004/8/19 0:36:19 Satellites: 10
fbw<ch>.log<S/N>
, where <ch>
is a channel number,
<S/N>
is a serial number of GNET-1), max is a number of
maximum samples).
It measures the bandwidth in precise and fine-grain timing. The B command also measures the bandwidth, but the minimum interval is limited to 2 milliseconds.
In the m command, the measurement of bandwidth is repeated in GNET-1 and the results are stored in a on-chip FIFO. The m command successively reads the results from FIFO if the FIFO does not become full. The specifiable interval is from 52 microsecond to 8 second by 4 microseconds.
Following is an example of the m command. It measures the output bandwidth of channel 1 with the interval of 52 millisecond, and stores the results to the file fbw1.log. The bandwidth is measured in 200000 times, or ctrl-C can terminate the measurement and return to the prompt.
# m1 4 52 fbw1.log 200000 fine bandwidth ch1 is stored in fbw1.log0 fbw1.log0: type:4 interval:52 time(sec) Bandwidth(Mbps) 0.000052 0.000000 ... 0.770224 987.692308 0.770276 987.692308 0.770328 984.615385 0.770380 987.692308 0.770432 987.692308 0.770484 987.076923 0.770536 987.692308 0.770588 984.615385 0.770640 987.692308 ...
portdelay.log<S/N>
, where <S/N>
is a serial number of GNET-1).
It measures the delay between CH1 and CH2 when the network device to be measured is connected with CH1 and CH2. It requires that a frame transferred from CH1 to CH2 via the device.
Following is an example of e command when CH1 and CH2 is directly connected. Other environments is that PC0 connected with CH0, PC1 connected with CH3, and ping command is run on PC0 to PC1. If you want to measure the delay between port on a switch, the switch is connected to GNET-1 with CH1 and CH2, and the difference between the measured result and following result (1.08) is the delay of the switch.
CH1->CH3(us) CH2->CH0(us) 0 1.088000 1.088000 1 1.088000 1.056000 2 1.088000 1.088000 3 1.088000 1.056000 4 1.088000 1.088000 5 1.088000 1.056000 6 1.088000 1.088000 7 1.088000 1.056000 8 1.088000 1.088000 9 1.088000 1.056000 average 1.088000 1.072000 (total)1.080000
It shows the channel status. Link is ANed (auto-negotiation is completed), UP (link is up when auto-negotiation is off), or DOWN (link is down). Error is -- (no error), Rx- (detect receive error), Tx- (detect send error), or RxTx (detect receive error and send error). Pause is off (disable flow control), pass (pass through the control message), rx (enable receive flow control), tx (enable send flow control), and rxtx (enable send and receive flow control). Delay shows the delay value include the channel itself delay. Shaping shows the maximum output bandwidth with current IFG setting. If dynamic IFG control is enable, DYM is prefixed. If not, FIX is prefixed and the bandwidth is based on MTU 1500. If RED is enable, RED shows its parameter. If not, TailDrop shows the current setting of buffer size when frames are dropped. FLOSS shows the probability setting for random frame discarding. DROPS shows the number of frames that are dropped by RED, TailDrop, or FLOSS. FIFO shows the current usage of FIFO. If clr is 1, it clears the error after display it.
Following is an example of c command.
#c0 CH0 Link: ANed Error: ---- Pause: off Delay: 0.00109 ms FIX Shaping: 986 Mbps TailDrop: 16368 KB FLOSS: 0.00000 DROPS: 0 FIFO: 0 KB
"j 1500 0" means that a frame whose MTU is larger than 1500 causes a error. "j 9000 1" means that a frame whose MTU is less than 9000 is available, and a frame whose MT is larger than 9000 causes no error.
It generates a random bit error with the specified probability. Since it generates a bit error in a 32 bit word, the maximum bit error is 0.03125. The minimum bit error is 1E-11. seed is represented by 64 bit hexadecimal number.
#b0 1.0E-10 12345678 bit-error rate: 1e-10 (0000000d) seed 0x0000000012345678
It displays help messages. If there is no arguments, it displays help of gcmd option on command line. If the argument is glb, it displays help for global registers. If the argument is mac, it displays help for registers related to MAC. If the argument is usr, it displays help for other registers. If the argument is reg, it displays help of all registers. If the argument is cmd, it displays help for commands.
It ignores following strings as a comment until the end of line.
It limits the amount of transfer data in the specified time unit. If the data is over the specified data, new frames are kept waiting in a FIFO, and they are transferred in a next time unit. The control is frame by frame. If the mode is 0, the new time unit can transfer the full amount of data, while if the mode is 1, the new time unit can transfer the difference of full amount of data and the size of over-flown data in the previous time unit.
For example, "cb 4 1000 500 0" limits the half of wire-rate transfer in 1 millisecond.
It measures the stream-wise bandwidth. The stream ID must be embedded in a frame. The stream ID is a byte, and its position is specified by the idpos that is the distance bytes from the beginning of the frame. GNET-1 updates each transferred size of 256 streams frame by frame, but the command reads the maxid data with the specified interval.
The ch is a channel number to be accessed. If ch is between 0 to 3, only
one channel is accessed. If ch is 4, all channels are accessed. If ch is
,
<n>
channels from ch<m>
are accessed. The
minimum interval is depend on maxid and channels. If maxid is small and
single channel is measured, the minimum interval is about 2 millisecond,
and if maxid is 256 and four channels are measured, the minimum interval
is about 40 millisecond. If the file is omitted, the default file name
is str<ch>.log<S/N>
, where <ch>
is a channel number,
<S/N>
is a serial number of GNET-1.
Following is an example of the command. It measures bandwidth of 4 streams on two channels from CH0, that is CH0 and CH1 with interval is 20 millisecond in 10 times.
#str 20 4 20000 10 lap(s) CH bandwidth for ID0 - ID3 (Mbps) 0.022 CH0: 0.0 0.0 0.0 0.0 0.020 CH1: 0.0 0.0 0.0 0.0 0.042 CH0: 0.0 0.0 0.0 0.0 0.040 CH1: 0.0 0.0 0.0 0.0 ... 0.202 CH0: 0.0 0.0 0.0 0.0 0.200 CH1: 0.0 0.0 0.0 0.0
It measures the stream-wise bandwidth with fine grain interval. While the
str command has several millisecond software overhead, the fstr command
can measure the stream bandwidth with microseconds interval. The results
are stored in on-chip memory those capacity is 2048 data. The memory is
shared in any streams, if the number of streams is n, 2048/n samples are
measured. The streams to be measured is specified by thee arguments,
IDmin, IDstep and IDmax, that is n streams of IDmin, IDmin+IDstep, ...,
and IDmax, where n is
. If the file is
omitted, the default file name is
fstr<ch>.log<S/N>
, where
<ch>
is a channel number, <S/N>
is a serial number of GNET-1.
Following is an example of the command. It measures eight stream bandwidth of ID0, ID4, ... and ID28 in the interval of 32 microsecond on channel 0. It can measure them during 8.16 millisecond, where 8.16 = 2048 data / 8 streams * 32 nanosecond.
#fstr 0 0 4 28 1000 lap(ms) CH bandwidth for ID0, ID4, .. (Mbps) 0.032 CH0: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.064 CH0: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.096 CH0: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... 8.128 CH0: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 8.160 CH0: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
It sets IFG dynamically. The value is
,
where flen is the size of the previously transmitted frame. The flen
includes the Ether frame header and frame check sequence (FCS). It can
control bandwidth even if frames with different MTU are transferred. If
Mbps is 0, the dynamic IFG control is disabled. minIFG is an optional,
and if it is omitted, the fix IFG is not changed. The maximum IFG is
limited in 65535.
It discards frames randomly in specified probability. rate is between 0.00002 to 1.0. Frames are discarded before storing in buffer.
RED (Random Early Detection) discards frames in proportion to the size of buffers. If buffer size is larger than specified value, frames are dropped with the probability P((bs - min)/(max - min)), where bs is the current buffer size, min is the buffer size to start RED, and max is the buffer size to start tail drop. If max is omitted, the current value of taildrop is used. If min is equal to max, it controls buffer by taildrop.
It sleep in specified time. It uses usleep(), but it has 10 millisecond overhead.
It resets the USB interface and resets the specified channel. If ch is 4, all channels are reseted. It waits three seconds for auto-negotiation, and show the channel status.
It displays the initial messages including the version number of gcmd, copy right, version number of FPGA configuration and the serial number of GNET-1.