NalDataStream Sample
Description
This sample program uses the NAL API to:
- initialize the application to use the NAL
- query which queues are available from the NAL
- request the use of the first receive and/or transmit queue in the index
- configure the queues
- send and/or receive Ethernet frames
It also allows you to display information about all system device queues. This sample uses a default Ethernet type 0x1234 and a default packet size of 1514 bytes (not counting Ethernet FCS). You can run RtssRun NalDataStream.rtss Interface1 /s /c 11:22:33:44:55:66
.
Alternatively, you can run two instances of NalDataStream.rtss
simultaneously:
RtssRun NalDataStream.rtss Interface1 /s
RtssRun NalDataStream.rtss Interface1 /c 11:22:33:44:55:66
Source Files
File | Description |
---|---|
NalDataStream.h | Header file |
NalDataStream.c | Source file |
NalDataStream.rc | Resource file |
NalDataStream.vcxproj | Project file for Visual Studio 2015 |
NalDataStream.vcxproj.filters | Project filters file for Visual Studio 2015 |
NalDataStream.sln | Solution file for Visual Studio 2015 |
resource.h | Resource header file |
readme.txt | README file |
Building the Sample
This sample application requires Visual Studio 2015.
- Open the
Project NalDataStream.vcxproj
in Visual Studio 2015 - If you are planning to run the sample with the RtNalI10GB driver, you will need to modify the sample to not discard initial receive packets. To do this:
- Open the header file
NalDataStream.h
. - Un-comment the following line:
//#define DISCARD_INITIAL_RECEIVE
NOTE: If you do not perform the above steps, you will receive stale data at the beginning of the sample.
- Set the configuration to RTSSRelease.
- Build the sample.
You should end up with an RTSS process called NalDataStream.rtss
.
Running the Sample
Follow these steps to run the sample using the RtNalIGB driver and send to a peer (destination) MAC address 11:22:33:44:55:66 at the default burst rate:
- Convert your RtNalIGB supported device to RTX64.
- Use
RtNalConfig.exe
to create at least one interface.
RtNalConfig.exe /interface Interface1 /create RtNalIGB.rtdll ( location )
NOTE: Interface names cannot contain spaces.
- Start the NAL:
Rtssrun Rtx64Nal.rtss
- Run the sample with the flag to send packets
RtssRun NalDataStream.rtss Interface1 /c 11:22:33:44:55:66
You should see the following once the sample begins:
NalDataStream: Interface1 Link is UP
NalDataStream: Interface1 Transmitted 100000 packets
NalDataStream: Interface1 Transmitted 200000 packets
NalDataStream: Interface1 Transmitted 300000 packets
…
- To stop the sample use Rtsskill
This sample uses the following flags:
/a
displays all queues configured by the NAL on the System
/s
receive data
If the application receives data you should see output:
NalDataStream: Interface1 Received 100000, Length: 1514
/c <MAC_Address>
continuously send to the provided MAC address using the default data rate. This is the destination to which the packets are sent.
/burst <burst count>
modify the number of packets contained in a burst. The default value is 25. For 100MB connections the suggested value is 10.
/i <interval>
modify the interval between burst in MS. The default is 1MS. For 100MB connections the suggested value is 2MS.
/send <count>
sets the number of frames to send before terminating the sample. The default is set to send forever.
/txlen <bytes>
sets the size of transmitted packet in bytes (not counting FCS). Default is 1514.
/rxlen <bytes>
sets the size of the receive buffer in bytes. Default is 1514.
/tx-tsc 1
enables transmit timestamps.
/type <Ethernet type>
sets the Ethernet type in transmit frames to match receive frames. This is a hexadecimal value without leading 0x. Default is 1234.
Examples
In the following examples, the Interface1
device name is used and the peer (destination) MAC address is 11:22:33:44:55:66.
- To display all queues configured by NAL in a system, run:
RtssRun NalDataStream.rtss /a
- To receive data, run:
RtssRun NalDataStream.rtss Interface1 /s
- To send data with default data rate sending forever, run:
RtssRun NalDataStream.rtss Interface1 /c 11:22:33:44:55:66
- To receive and send data with 10 packets burst, 2 MS between bursts, sending forever, run:
RtssRun NalDataStream.rtss Interface1 /s /c 11:22:33:44:55:66 /burst 10 /i 2
- To receive and send data with 10 packet burst, 2 MS between bursts, terminating the application after 500000 transmitted frames, run:
RtssRun NalDataStream.rtss Interface1 /s /c 11:22:33:44:55:66 /burst 10 /i 2 /send 500000
- To test transmit timestamps, run:
RtssRun NalDataStream.rtss Interface1 /c 11:22:33:44:55:66 /burst 1 /i 1000 /tx-tsc 1
NOTE: This example sends 1 packet per second. By default, the receiving side displays packets at the rate of 100,000. To see receiving packets from this example, you need to modify NalDataStream.c and build the sample.
Remarks
This sample prints an incorrect number of missing received packets if the packets are transmitted from multiple sources.
APIs Referenced
- RtNalInit
- RtNalGetNumberOfQueues
- RtNalGetQueueInfoByIndex
- RtNalAttachProcessExitHandler
- RtNalAcquireQueue
- RtNalConfigureQueue
- RtNalGetReceivePacketCount
- RtNalReceive
- RtNalTransmit
- RtNalIoctl
- RtNalReleaseQueue
- RtNalSetTransmitTimeStampType
- RtNalGetTransmitTimeStamp
See Also
- Real-Time NAL (RtNal) API Functions
These functions are used by applications.
- Real-Time Network (Rtn) Functions
These functions are used by device drivers.