WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2011-Jan-24 01:44:24

wj326_0
Member
Registered: 2010-Oct-14
Posts: 52

Questions about the MAC Address and IP adress for each WARP Node.

hi, i have some questions about  the MAC Address and IP adress for each WARP Node:

1. does  each WARP Board  has a individuell MAC Address (for example: xx-xx-xx-xx-xx-xx)?  how can i find it? i mean can i read the MAC Address value of each WARP Board with a function in c code, just like read DIP value with function "warpmac_getMyId()" in csmamac.c


2. i find the the fowlling MAC address "16-24-63-53-e2-(c2+state.myID)" in rtsctsmac.c file in function "initAddresses()". why use "16-24-63-53-e2-c2" as a part of  MAC address for node and is it for each warp node production? is there any connection between the MAC- and IP-address for more than two nodes? i mean, can i use 10.0.0.x to configurate the IP address of each node without the MAC address in c code? or if i have more than two nodes, i have to use the MAC address?

void initAddresses() {
    unsigned char i;
   
    //Read Dip Switch value from FPGA board.
    //This value will be used as an index into the routing table for other nodes
    state.myID = warpmac_getMyId();
   
    //Create an arbitrary address for this node (16-24-63-53-e2-(c2+state.myID))
    state.addr.my[0] = 0x16; state.addr.my[1] = 0x24; state.addr.my[2] = 0x63;
    state.addr.my[3] = 0x53; state.addr.my[4] = 0xe2; state.addr.my[5] = 0xc2+state.myID;

3. i find the fowlling struct for address in rtsctsmac.c file:
    struct {
        ///MAC address of this node, for example: 16-24-63-53-e2-(c2+state.myID), totally 6 values
        unsigned char my[6];
        ///network IP address, 10.0.0.x, totally 4 values
        const unsigned char net[4];
    } addr;

i have no idea about the values "payload+33<16, payload+32, payload+31 and payload+30" in function "rtsmac_emacRx_callback(Xuint32 length, char* payload)" in the same c code. what is stand for these values?

there are 4 values for "const unsigned char net[4]", because of the IP address for each node is "10.0.0.x", so why only 3 values were used here (from "state.addr.net[0]" to "state.addr.net[2]")?

int rtsmac_emacRx_callback(Xuint32 length, char* payload) {
   
    ///each node hat a IP address: 10.0.0.x  whose first three bytes match the net address (state.addr.net)
    ///and last byte matches the node ID (setting of the dip switches).
    if(*(unsigned char *)(payload+33)<16
        && *(unsigned char *)(payload+32)==state.addr.net[2]
        && *(unsigned char *)(payload+31)==state.addr.net[1]
        && *(unsigned char *)(payload+30)==state.addr.net[0]) {

4. now i have 3 WARP Boards, two as Transmitter(node_0 and node_1) and one as receiver (node_2), i want to simulate the 802.11 CSMA Protocol (Backoff, Timeout, DIFS, SIFS, NAV-Timer etc.).  i write the code to let them know each other (the src and dest address of each node):

///DATA-ACK-DAT between the node_0 <---------> node_2  and  node_1 <---------> node_2
void iniAddress(){
    ID = warpmac_getMyId();
         ///for transmitter Node_0 and Node_1: MyID = 0 and MyID = 1; DestID = 2
    if (ID <=1) {      
       MyID = ID;
           DestID = 2;
       }
        else {
         ///for receiver node_2: MyID = 2
         MyID = ID;
       }
       break;
}

but how can i configurate the dest address of  ACK packet which is send from node_2 to node_0 or node_1? i can not use the fowlling function in csmamac.c, because only two Nodes were used for csmamac.c (node_0 <----> node_1)
   
myID = warpmac_getMyId();
destNode = (myID+1)%2;
txMacframe.header.destAddr = (unsigned short int)(NODEID_TO_ADDR(destNode));

many thanks for your help!

Offline

 

#2 2011-Jan-24 16:41:15

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Questions about the MAC Address and IP adress for each WARP Node.

1) There's a sticker on the bottom of the FPGA board with a MAC address unique to that board. You can use this in your design if desired. It is not hard-coded anywhere in memory. Our examples do not use actual IEEE-compliant MAC addresses; we just use the node ID (0, 1, 2...). This is likely sufficient for your setup as well.

2-3) rtsctsmac.c is very old code; I can't help much in interpreting it (it was written by a student no longer with the project and has not been maintained). Using IP addresses as a proxy for MAC addresses has been discussed previously; see this and this. The basic idea is to extract the last byte of the IP addresses in an IP header and map it to a MAC-level node ID. It's important to filter by Ethertype here, so that only IP packets are interpreted this way.

4) This will be handled automatically by the auto-responders; csmaMac.c configures the header translator to copy the source address of the received packet to the destination address of the transmitted ACK.

Offline

 

#3 2011-Jan-25 08:50:06

wj326_0
Member
Registered: 2010-Oct-14
Posts: 52

Re: Questions about the MAC Address and IP adress for each WARP Node.

Hi Murphpo,

Thanks much for your information!

i want to mimic 802.11 MAC behavior, so i want to add DIFS time before send DATA at send station, and add SIFS time before send ACK at receive station:

send station:   DIFS--->Backoff--->send DATA
recev station:   __________________________--->SIFS--->ACK

i have added the following code in csmamac.c:

//set DIFS to 50 microsecond
void setCSMAIdleTime(){
ofdm_txrx_mimo_WriteReg_Rx_PktDet_setDIFSPeriod(500);
}

dataFromNetworkLayer_callback(Xuint32 length, char* payload){
    ..............some code...........
    if(warpmac_carrierSense()) {
        //If the modium is idle;
        setCSMAIdleTime();

is there any function with that i can set the SIFS value like "ofdm_txrx_mimo_WriteReg_Rx_PktDet_setDIFSPeriod ()"? or should i use the function usleep() before send ACK to sende station?

thanks!

Last edited by wj326_0 (2011-Jan-25 08:50:52)

Offline

 

#4 2011-Jan-25 12:16:03

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Questions about the MAC Address and IP adress for each WARP Node.

is there any function with that i can set the SIFS

The SIFS interval is not an artificial delay imposed by the MAC; it's defined by the minimum time required for a node to transition from receiving to transmitting. This transition requires ~20usec in the OFDM reference design (it's around 20; I don't recall the exact value in the latest design). Ideally this would be zero, but real hardware requires time for the Rx/Tx turnaround. The 802.11 standards define the SIFS as a sum of times allowed for each stage of the turnaround (Rx processing delay, Tx settling times, etc.).

Offline

 

#5 2011-Jan-25 12:46:26

wj326_0
Member
Registered: 2010-Oct-14
Posts: 52

Re: Questions about the MAC Address and IP adress for each WARP Node.

murphpo wrote:

is there any function with that i can set the SIFS

The SIFS interval is not an artificial delay imposed by the MAC; it's defined by the minimum time required for a node to transition from receiving to transmitting. This transition requires ~20usec in the OFDM reference design (it's around 20; I don't recall the exact value in the latest design). Ideally this would be zero, but real hardware requires time for the Rx/Tx turnaround. The 802.11 standards define the SIFS as a sum of times allowed for each stage of the turnaround (Rx processing delay, Tx settling times, etc.).

thanks for your help!
1. so you mean that i acturally do not need to define the SIFS value. there is already a SIFS value (as you said around 20 microsecond) before the transmitted ACK from Auto Response System in  OFDM reference design. am i right?

2. if i want to add DIFS time and implement it before send DATA, should just use the function ofdm_txrx_mimo_WriteReg_Rx_PktDet_setDIFSPeriod()? or i need more functions to start the implementation: anything like "start_DIFS_Periode()" after function "ofdm_txrx_mimo_WriteReg_Rx_PktDet_setDIFSPeriod()"?

Last edited by wj326_0 (2011-Jan-25 12:47:36)

Offline

 

#6 2011-Jan-26 13:41:08

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Questions about the MAC Address and IP adress for each WARP Node.

1) Right.

2) ofdm_txrx_mimo_WriteReg_Rx_PktDet_setDIFSPeriod() should be enough. If your goal is to control the MAC timing precisely, you need to study the current design, especially the interaction of the PHY's packet detector (which generates the Idle-For-DIFS signal), the timer (which uses the Idle-For-DIFS signal) and the MAC code.

Offline

 

#7 2011-Jan-27 15:31:40

wj326_0
Member
Registered: 2010-Oct-14
Posts: 52

Re: Questions about the MAC Address and IP adress for each WARP Node.

murphpo wrote:

1) Right.

2) ofdm_txrx_mimo_WriteReg_Rx_PktDet_setDIFSPeriod() should be enough. If your goal is to control the MAC timing precisely, you need to study the current design, especially the interaction of the PHY's packet detector (which generates the Idle-For-DIFS signal), the timer (which uses the Idle-For-DIFS signal) and the MAC code.

thanks for your help!

i have three more questions about csmamac.c

------1. i read warpphy.h and found following code:
#define PKTHEADER_INDX_SRCADDR    4
#define PKTHEADER_INDX_DSTADDR    6
#define PKTHEADER_INDX_RLYADDR    8
#define PKTHEADER_INDX_TYPE        10

so could you please tell me what is between the Index_0--3 and what is from index_12 to the end?

here is what i thought about it:
   INDX_0 to 3: Preamble and SFD;       
   INDX_4 to 5: SrcAddr         
   INDX_6 to 7: DestAddr           
   INDX_8 to 9: RLYADDR           
INDX_10 to 11: Type
INDX_12 to 13: SeqNum             
INDX_14 to 1514: Payload
INDX_1515 to 1518: Checksum

is it right?

-------2. there is a function "PHY_AUTORESPONSE_TXACTION_CONFIG(pktBuf, options, delay, conditions)" in csmamac.c main function.

i read the API and introduction about AutoResponseSystem, the Parameter "delay" is: "the delay of the automatic transmission. The time starts when the final byte of the incoming packet is decoded."

As default it is set to "0", can i set the "Delay" value to set the SIFS or i should not touch this value at all?  could you please tell me the UNIT about "delay"? if i set "Delay" to 10, so it means 10 microsecond or..............

And is there possible to add a NAV for the THIRD Node, if channel is busy (802.11 csma: two transmitter_nodes, but only one receive_node)


-------3. if i set the DIFS Value or other periode like NAV, i want know whether it works. So how can i measure the time about these times: the period between DATA and ACK, and the others like periode about NAV, DIFS or SIFS in the real time?  use wireshark? or.........

for now  i use "iperf" to send UDP frame from send_node_0 to recv_node_1, and i use "printf" to debugg the csmamac.c. I can see the lots of message like "ACK received" on Ternimal (at the send_node_0). but i can not find any message about "ACK" in wireshark at the same pc.  because i observe the interface Ethernet "10.0.0.1"?


thanks again and have a nice weekend!

Last edited by wj326_0 (2011-Jan-27 16:04:48)

Offline

 

#8 2011-Jan-27 22:42:44

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Questions about the MAC Address and IP adress for each WARP Node.

The PKTHEADER_INDX_ values are the indicies of various fields in the MAC header (indicies into the phyHeader struct).

The autoResponse delay is set in increments of 50 nsec. Increasing this from zero will add additional delay between the DATA and ACK.

The best way to measure latencies of packet events is with an oscilloscope connected to the digital outputs on the FPGA board. The first two bits on the 16-pin debug header are connected to Tx and Rx in the PHY. By observing these you can directly measure the duration of each packet event and idle periods between them. Using printf to measure times is a bad idea (printing things via the UART takes a *long* time, longer than any packet event).

Offline

 

#9 2011-Feb-08 10:29:47

wj326_0
Member
Registered: 2010-Oct-14
Posts: 52

Re: Questions about the MAC Address and IP adress for each WARP Node.

hi murphpo,

i use the following cod to copy the node's MAC address into the Tx buffer's source address field:
   
txMacframe.header.srcAddr = (unsigned short int)(NODEID_TO_ADDR(myID));

but i also found another way to do this in some old code, like in hopMacServe.c:

       //Create an arbitrary address for this node
    unsigned char tmpAddr[6] = {0x16,0x24,0x63,0x53,0xe2,0xc2+myID};
   
    memcpy((unsigned char *)myAddr,(unsigned char *)tmpAddr,6);
   
    //Fill an arbitrary routing table so that nodes know each others' addresses
    unsigned char i;
    for(i=0;i<16;i++){
        routeTable[i].addr[0] = myAddr[0];
        routeTable[i].addr[1] = myAddr[1];
        routeTable[i].addr[2] = myAddr[2];
        routeTable[i].addr[3] = myAddr[3];
        routeTable[i].addr[4] = myAddr[4];
        routeTable[i].addr[5] = myAddr[5]+i-myID;
    }
   
    warpmac_setMacAddr((unsigned char *)(&myAddr));

should i just ignore the second old way? because this way is too old?

thanks!

Offline

 

#10 2011-Feb-08 20:24:53

murphpo
Administrator
From: Mango Communications
Registered: 2006-Jul-03
Posts: 5159

Re: Questions about the MAC Address and IP adress for each WARP Node.

In older reference designs the MAC addresses were 6 bytes long (as they are in 802.11). We replaced those with shorts (2 bytes) in few versions ago, recognizing there will never be 2^16 WARP nodes. It also makes the code easier- no memcpy required to assign/copy addresses.

Offline

 

Board footer