FWIW, tgtap does all the IP, MAC and ARP stuff for you. It will continue searching for ip addresses and update the arp cache as new devices appear on the network, so you don't have to worry about it once started.

fpga.tap_start("my10gbe_core",mac_addr,ip_addr,port)

where "my10gbe_core" is the simulink name of the port you want to configure and mac_addr, ip_addr and port (integers) are the addresses you'd like to assign to this core.

eg ip of 10.0.0.12 = 10*2^24 + 0*2^16 + 0*2^8 + 12 = 167772172

recommended mac address is 02:01:01:xx:yy:zz where xx, yy and zz are arbitrary (I just pick the lsbs from the IP address).

Please make sure you're running updated versions of the katcp and corr python package, tgtap, tcpborphserver and the linux kernel if you want to use tgtap. I will package a new recommended roach filesystem and check it into SVN later this week with all the current versions pre- packaged.

Jason

On 23 Mar 2010, at 11:37, Nevada Sanchez wrote:

We've had similar problems before. If you're going to use sockets, you need to be sure that you are setting the source IP address on the GBE module. Otherwise, you will see packets in Wireshark, but not in the sockets. You can do this in python with something like

fpga.write(gbe_block, source_ip, offset = 0x10)

(Here gbe_block is the name of the gbe yellow block). Also, it might be a good idea to set an arp entry on the roach, with something like the following:


def set_arp_entry(dev_name, last_ip_octet, mac):
   assert(last_ip_octet < 256)
   fpga.write(dev_name, mac, offset = 0x3002 + last_ip_octet*8)
...
set_arp_entry(gbe_block, 1, pc_mac_addr)


You will not get very high data rates through Python (it's too slow). I would suggest using similar code, but in C.

-Nevada

On Mar 23, 2010, at 14:21 PM, [email protected] wrote:

Hi Paul,

Thanks for the reply. By "not working" I meant that no data appears and
therefore the script stalls on the line
data = s.recvfrom(1024)[0]

Also, currently I don't need very high data rates (~ 10Mb/s), but I will
need them in the near future.


Sean

Hi Sean,

I've used python code almost identical to yours pretty successfully,
mainly for simple tests/debugging. Whether or not this is the right way to build a bigger application depends on things like the data rate you need to support, any additional data processing/formatting that needs to
be done, etc.

What form of "not working" are you experiencing? ie, an error message, no data appears, data comes in but you can't keep up with it... or something
else?

-Paul

On Tue, 23 Mar 2010, [email protected] wrote:

Hi all,

I need to dump data from a ROACH board to a PC over the 10gbe. Do any
of
you have any recommendations for what I should use as a client to handle
the incoming data?

I've been trying to use a simple Python client like,

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((ip_address, port))
data = s.recvfrom(1024)[0]

where "ip_address" is the address of the pc's 10gbe nic.  This has
worked... only occasionally.  And I'm not sure why it fails.  Using
Wireshark I can see the incoming packets are coming in with 1024 bytes
from the ROACH as I expect.  Any thoughts?

Thanks a lot.


Sean








Reply via email to