WARP Project Forums - Wireless Open-Access Research Platform

You are not logged in.

#1 2010-Nov-25 00:17:32

warpsinu
Member
Registered: 2009-Jun-24
Posts: 30

byte ordering

Why does warpmac.h define htons macro the way it does ?
(The PowerPC is big-endian, and to convert to network byte order, nothing
would need to be done ?)
The gnu build env with the EDK doesnt seem to have any function/macro defined
for htons/ntohs etc.

Offline

 

#2 2010-Nov-25 10:59:55

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

Re: byte ordering

There's an implicit endian swap when writing multi-byte values to the shared memory blocks in the PHY's auto-response system. In csmaMac.c, for example, it's used when specifying the 16-bit address value for the ACK match conditions.

Offline

 

#3 2010-Nov-25 21:28:04

warpsinu
Member
Registered: 2009-Jun-24
Posts: 30

Re: byte ordering

Thanks for your quick reply (& hope your thesis defense went well !)
Do you think it is better to rename this (PHY shared-mem specific) htons macro to something else ?
We have a control network (similar to warpnet) where control messages are being sent
from a notebook (typically little-endian), and using the htons macro defined in warpmac.h upsets
the endian handling.
(What about the warpnode* structs in warpnet_node.h ? Guess they wont work as well ?)

Offline

 

#4 2010-Nov-26 12:49:21

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

Re: byte ordering

I think what would make even more sense would be to fix the byte ordering in the PHY logic itself, so native register writes would "just work". I'll add this to the list of fixes for the next iteration of the design.

For WARPnet, we decided to handle all the byte ordering issues on the PC side, to minimize latencies through the PowerPC (when we dump per-packet observations via WARPnet, getting packets out quickly is critical).

Offline

 

Board footer