Packet Basics
Prev | Chapter 3. Software | Next

## Packet Basics

Local and remote HomePlug® AV powerline devices are managed by sending Ethernet frames that contain HomePlug AV® formatted management messages. These frames have an 802.3 Ethernet header and a payload that contains the Management Message (MM).

The Ethernet header must be transmitted in newtwork byte order which is big-endian. The Ethernet payload must be sent in ARM™ host byte order which is little endian. You should use standard network functions `htons()` and `htonl()` to write Ethernet headers and `ntohs()` and `ntohl()` to read them. You should use function `HTOLE16()` and `HTOLE32()` to write integer payload values and `LE26TOH()` and `LE32TOH()` to read them.

    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
    | Ethernet Header                                       | Ethernet Payload    |
    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+

Ethernet headers consist of a destination address (`ODA`), a source address (`OSA`) and an ethertype (`MTYPE`). The ethertype is always 0x88E1 for Homeplug frames of any type. Programmers may use either function EthernetHeader.c or EncodeEthernetHeader to encode a buffer with the ODA and OSA and the HomePlug ethertype. An example appears later on. Structure `header_eth` is defined in ihp.h for this purpose.

    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
    |          ODA          |          OSA          | MTYPE | Ethernet Payload    |
    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+

Management messages consist of a message header (MMHEADER) and a message entry (MMENTRY). The message header identifies the nature of the message entry that follows it. The acronyms MME and MMENTRY both mean Management Message Entry but they are often used to mean the entire management message or Ethernet frame. This imprecise usage can be confusing at times. Structure `header_mme` is defined in ihp.h for this purpose.

    +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+
    |             | MMHEADER              | MMENTRY                                 |
    +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+

The message header contains message protocol version (MMV), message type (MMTYPE) and vendor identifier (OUI). The management message entry (MMENTRY) that follows the header contains information unique to a the request (REQ), confirmation (CNF), response (RSP) or indication (IND). Programmers may use the Atheros EncodeAtherosHeader function to encode a buffer with a specific MMTYPE and the Atheros MMV and OUI. AN example appears later on.

    +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+
    |             |MMV| MMTYPE|    OUI    |        MMENTRY                          |
    +---+ ... +---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+---+---+---+

The MMV value, within MMHEADER, indicates the Homeplug AV Management Message protocol version which determines how the message should be interpreted. The protocol version is defined in the HomePlug AV Specification and may change from time to time. One notable change is the recent insertion of an FMI (Fragment Management Information ) field between MMTYPE and OUI , as shown below.

In most cases, protocol changes are hidden from the application by the Atheros API functions; however, software developers should set the `HOMEPLUG_MMV` constant, defined in ihp.h, to the version appropriate for their firmware or application. The value of this constant enables or disables conditional compilation statements throughout the HomePlug API code base.

To send an MME, you must encode an Ethernet frame buffer with information and transmit it. To read an MME, you must read an Ethernet frame buffer and decode it. The information necessary to encode or decode Atheros vendor-specific Ethernet frames is covered in the INT6000™ Firmware Technical Reference Manual; however, the Atheros HomePlug API includes many buffer encode and decode functions that support basic operational requirements.

Prev | Up | Next
Endian-ness | Home | Frame Encoding