WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2015-Sep-09 06:28:35

Edlmann
Member
Registered: 2015-Sep-09
Posts: 30

ETH Packet-generation on Warp V3

Im currently working on implementing a custom MAC on WARP v3, using the 802.11 Reference Design as a starting point.

To enable measurement managment similar to the WARP_EXP Framework, i currently need the ability to generate ETH Packets on Cpu High to transmit over ETH A.

Reusing the buffer where ETH Packets are received in (inside the XAxiDMA RX Ring) and the wlan_eth_dma_send function to transmit the packet works fine.

However when trying to use a free TX-Buffer, a packet with the correct length but containing only 0's is transmitted.

Stripped down code of the transmission:

Code:

bfr_ptr = TX_PKT_BUF_TO_ADDR(7); //Buffer 7 is free + unused
//Generate ETH-Header, IP-Header, UDP-Header + Content starting at bfr_ptr

u8 res = wlan_eth_dma_send((void*)TX_PKT_BUF_TO_ADDR(7),(ETH_HDR_LENGTH+IP_HDR_LENGTH+UDP_HDR_LENGTH+sizeof(measPacketDataStatus)));  //measPacketDataStatus is my custom payload
//res is 0 afterwards, no errors occur inside wlan_eth_dma_send

Inside wlan_eth_dma_send, the transmission has the following content:

Code:

FF FF FF FF FF FF  0 50 C2 63 31 6A  8  0 45  0 
10 14 C5 F5 40  0 40 11 E0 29 C0 A8  1 6A C0 A8 
 1 FF 3A A0 1D 4C  0 10  0  0 60 42  2  8  0  0 
 0  0  0  0  0  0  0  0  0  0  0  0

Where 60 42  2  8  0 is the custom payload i want to transmit.

However, wireshark + other boards connected to the same router only receive

Code:

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 
 0  0  0  0  0  0  0  0  0  0  0  0

What am i missing for a successful transmission?
Thanks in advance.

If any information is missing, please tell me so i can add it, still new to what amount of info is necessary on here.

Offline

 

#2 2015-Sep-09 08:32:38

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

Re: ETH Packet-generation on Warp V3

Short answer- create your packets in DRAM and send them from there.

The axi_dma that moves data between the Ethernet MAC and memory is an AXI master on an interconnect configured as a crossbar. The DMA's master can only communicate with some slaves. We enabled the master-slave connections necessary for the 802.11 design to run, and disabled ones that would never be used. This approach of a partially-connected crossbar improves logic utilization and timing.

The axi_dma for ETH A can read packet data from the auxiliary BRAM, from the DRAM and from the MAC's Rx packet buffers. It cannot read any other memory blocks. The MAC code assumes it can use all of the aux BRAM and Rx packet buffers. Thus your best option is to reserve some space in the DRAM and create/send your packets from there. The upper MAC framework leaves a small section of DRAM empty for this purpose, called the user scratch space. Refer to wlan_mac_high.h for details. Specifically, use space between USER_SCRATCH_BASE and USER_SCRATCH_HIGH. The framework guarantees not to touch any memory in this region during normal operation of the MAC.

Offline

 

#3 2015-Sep-09 08:42:11

Edlmann
Member
Registered: 2015-Sep-09
Posts: 30

Re: ETH Packet-generation on Warp V3

Thanks murphpo, after locating the buffer inside the Scratch space the transmission works.

However, I'll need to be able to send a Buffer filled on CPU-Low (containing measurement data) over ETH, if possible without a copy.
My initial plan was to use additional TX-Buffers i added to the design and transfer control of those buffers to CPU-High once they're ready to be send.

If I understood your answer correctly the TX-Buffers cannot be used for this, but if I would use RX-Buffers instead this would be possible. Correct?

[Edit]
The documentation for wlan_eth_dma_send seems to contain a minor error then, as it states:

Code:

 * Custom code which needs to send Ethernet packets can use a spare wireless Tx/Rx packet buffer, a spare
 * Tx queue entry in DRAM or the user scratch space in DRAM to create custom Ethernet payloads.

http://warpproject.org/trac/browser/Ref … til.c#L594

Last edited by Edlmann (2015-Sep-09 08:46:57)

Offline

 

#4 2015-Sep-09 09:17:37

welsh
Administrator
From: Mango Communications
Registered: 2013-May-15
Posts: 612

Re: ETH Packet-generation on Warp V3

You are correct.  You can use the RX buffers without modifying the design.

We apologize for the error in the documentation.  We'll get that fixed for the next release.

The other option would be to modify the design such that the Ethernet A DMA can access the TX packet buffers.  If you look at the connectivity (see picture below), all you would need to do is add a connection from the MM2S (ie the Memory to Stream interface; the interface that pulls data from the node memory to send over Ethernet) of the mb_high_eth_dma to the pkt_buff_TX_bram_ctrl.  Once you re-build the design, the you can Tx packet buffers to store information to transmitted over Ethernet.

http://warp-downloads.s3.amazonaws.com/images/forum_images/802_11_v1_3_0_connectivity_mod.PNG

Offline

 

#5 2015-Sep-09 09:56:57

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

Re: ETH Packet-generation on Warp V3

If I understood your answer correctly the TX-Buffers cannot be used for this, but if I would use RX-Buffers instead this would be possible. Correct?

Correct.

Does your code create data to send via Ethernet as part of its normal wireless Rx processing? In other words, can you use the current Rx packet buffer to convey your measurement data from CPU Low -> High? Or do you need a different buffer, separate from the buffer containing the latest wireless Rx?

The reference hardware uses a 32KB BRAM for the Rx packet buffers. The C code divides this into 8 4KB buffers. The code uses all 8 buffers by default, cycling through them sequentially. CPU High and Low mark buffers as free using the mutex and a flag in the rx_frame_info struct at the start of each buffer. CPU Low uses the framework function wlan_mac_low_lock_empty_rx_pkt_buf() to find and lock the next available Rx packet buffer. If you need a separate buffer for your measurement data, you will need to modify this behavior in CPU Low, to effectively reserve an Rx buffer for your code. I think the easiest way to do this would be to modify wlan_mac_low_lock_empty_rx_pkt_buf() to cycle through buffers [0, NUM_RX_PKT_BUFS-2] instead of the default [0, NUM_RX_PKT_BUFS-1], then use pkt buf (NUM_RX_PKT_BUFS-1) for your measurement data.

Offline

 

#6 2015-Sep-09 10:12:10

Edlmann
Member
Registered: 2015-Sep-09
Posts: 30

Re: ETH Packet-generation on Warp V3

Thanks welsh + murphpo,

Since I had already added 8 new Tx-Buffers (by increasing the corresponding BRAM to 64k + adding that change to the defines in source), adding the connection is the simplest solution. I won't need to worry about changing the source further. Currently synthesizing the changed design, should all work then.

Offline

 

Board footer