gcmd document (version 1.2)

KODAMA Yuetsu(y-kodama@aist.go.jp)

National Institute of Advanced Industrial Science and Technology (AIST)

2003-12-15 (2004-9-1 Modified)

Grid Technology Research Center (GTRC)

About this document

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.

How to install

USB driver

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.

gcmd

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.

About gcmd

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.

Commands of gcmd

Available commands are as follows.

B (Transmit Bandwidth)
B itv rep file (itv is interval (ms), rep is repeat times, file is output file name).

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 $2^{-24}$ 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.

rxbw (Receive Bandwidth)
rxbw itv rep file (itv is interval (ms), rep is repeat times, file is output file name).

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''.

T (Frame Capture)
T type (type 0:off, 1:CH0/1 En, 2:CH2/3 En, 3:save, 4:help, 10-15: CH0 type, 20-25: CH1 type, 30-35: CH2 type, 40-45: CH3 type, 50-55: all channel type, 0:off, 1:any header, 2:any full, 3:marked header, 4:marked full, 5:set header select with HexArg)

L (Discard a Frame)
L ch (ch is a channel number 0-3).

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 script)
. file (file is a script file name).

Run the script specified by the file. The commands in a script file are same as commands for a prompt.

q (quit)

Quit gcmd.

Following commands are compatible for gbeva that is a control program of GNET-1 on windows.

D (Delay)
Dch delay [unit] (ch is channel number 0-3, or 4 (all channels), delay is delay time, unit is ether s, ms, us, or ns. (default is ns).

It inserts the specified delay for transmit of the specified channel. The delay is rounded by $2^{-24} second (\simeq 59.6ns)$. 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.

R (Read a register)
Raaa (aaa is an address).

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].

W (Write a register)
Waaadddddddd (aaa is an address, dddddddd is a data to be written).

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].

d (Display control)
d[0, 1]

d1 specifies that commands display results loudly. d1 specifies that commands display results quietly.

s (Send frames format)
sch dmac dip len (ch is a channel number 0-3, dmac is a destination MAC address, dip is a destination IP address with dotted decimal notation, len is a length of IP frame)

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.

v (Generate packets)
vch mbps time (ch is a channel number 0-3, mbps is the generation bandwidth, time is a generation time (second)).

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.

k (Forward condition)
kch dmac smac sip (ch is a channel number 0-3, dmac is a destination MAC address, smac is a source MAC address, sip is a source IP address with dotted decimal notation).

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.

f (Forward destination)
fch dmac dip (ch is a channel number 0-3, dmac is a destination MAC, dip is a destination IP address with dotted decimal notation).

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.

p (Fixed IFG)
pch mbps mtu (ch is a channel number 0-3, or 4 (all channels), mbps is a transfer bandwidth, mtu is a MTU of the frame).

It set inter frame gap (IFG) calculated by $(MTU+18)/(MTU+26+IFG) =
mbps/1000$ 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.

g (GPS)

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 $2^{24} Hz$ 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

m (precise bandwidth)
mch type itv file max (ch is a channel number 0-3, type is a data type to be measured (4: output bandwidth (Mbps), 5: output frames, 6: input bandwidth(Mbps), or 7: input frames), itv is an interval (microsecond), file is a file name to be stored the results (default is 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
...

e (delay between port)
e rep file (rep is a repeat time, file is a output file name (default is 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

c (Channel status)
cch [clr] (ch is a channel number 0-3, or 4 (all channels)).

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

a (Auto-negotiation)
ach type (ch is a channel number 0-3, or 4 (all channels), type is 0(auto-negotiation off), or 1nm(auto-negotiation on) where n is the flow control type 0(off), 1(pass), 2(rx), 4(tx), 6(rxtx), and m is 0 (no pause), 1 (asymmetric), 2(symmetric), 3(both)).

j (Jumbo frame)
jch mtu jumben (ch is a channel number 0-3, or 4 (all channels), mtu is a MTU size to be enable, jumben is a flag that frames larger than the specified mtu causes no error).

"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.

b (bit error generation)
bch rate [seed] (ch is a channel number 0-3, or 4 (all channels), rate is a bit error rate, seed is a random seed).

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

h (Help)
h $[glb \vert mac \vert usr \vert reg \vert cmd]$

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.

; (Comment)

It ignores following strings as a comment until the end of line.

credit or cb (Credit-base buffer control)
cb ch time-unit bw mode (ch is a channel number 0-3, or 4 (all channels), time-unit is a time unit (micro second) for credit base buffer control, bw is a maximum bandwidth (Mbps) in the time unit, mode is a control mode).

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.

stream or str (Stream bandwidth)
str ch maxid interval rep file idpos (ch is a channel number, maxid is the number of streams, interval is a interval (microsecond) of measurement, rep is the repeat times, file is the file name where results are stored, idpos is the position of stream ID).

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*10+m (n>=1)$, <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

finestream or fstr (Finegrain stream bandwidth)
fstr ch IDmin IDstep IDmax interval file (ch is a channel number 0-3, IDmin is the first stream ID to be measured, IDstep is the step of stream ID to be measured, IDmax is the last stream ID to be measured, interval is the interval of cycles in 32 nanosecond, file is a file name where results are stored).

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 $n=(IDmax-IDmin)/IDstep + 1$. 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

ifg (output pacing by Dynamic IFG control)
ifg ch Mbps [minIFG] (ch is a channel number, Mbps is a output bandwidth, and minIFG is an optional fixed minimum IFG).

It sets IFG dynamically. The value is $(1000/Mbps - 1) * flen - 8$, 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.

floss (Random frame discarding)
floss ch rate (ch is a channel number, rate is the probability of discarding frames).

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 control)
red ch min [max] (ch is a channel number, min is the start buffer size for RED control, and max is the end buffer size for RED control).

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.

usleep (Sleep)
usleep time (time to be sleep in microsecond).

It sleep in specified time. It uses usleep(), but it has 10 millisecond overhead.

reset (Reset)
reset ch (ch is a channel number).

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.

version (Version)
version.

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.

Bibliography

1
The Implementation (TCP/IP Illustrated, Volume 2) by Gary R. Wright, et al.

2
Y.Kodama, T. Kudoh, R. Takano, H. Sato, O. Tatebe and S. Sekiguchi, ``GNET-1: Gigabit Ethernet Network Testbed,'' Proc. of 2004 IEEE International Conference on Cluster Computing (Cluster2004), Sep. (2004).

3
``NET-1 FPGA Register Specification Ver.1.2,'' Sep. (2004).

4
``Functions of GNET-1 FPGA configuration (version 1.2),'' Sep. (2004).



Footnotes

... ms1
The original USB serial driver takes 16ms. It must be patched to decrease the overhead


fechanti 2004-11-26