#define IEEE_802_3_PHY_V3_INTERFACE "ieee_802_3_phy_v3" SIM_INTERFACE(ieee_802_3_phy_v3) { int (*send_frame)( conf_object_t *obj, const frags_t *frame, int replace_crc); int (*check_tx_bandwidth)(conf_object_t *obj); };
Interface that should be implemented by 802.3 physical layers.
The send_frame function is used by a device to send an Ethernet
frame. The frame should be a frags_t
containing a
complete Ethernet frame, excluding the preamble and SFD, but including space
for the CRC field. The passed frame must not be modified by
the called function.
The replace_crc flag indicates whether the CRC field contents can be modified by the implementing object: if replace_crc is not set, the implementing object will leave the CRC field untouched; if replace_crc is set, the implementing object is free to rewrite the CRC field according to the link constraints. Note that in many cases, setting replace_crc to true will allow the link to assume the CRC field to be matching the frame contents, thus skipping CRC calculation and improving simulation performance. replace_crc should only be set to false when the device wants to send a frame with a CRC field not matching the frame contents.
If the function return 0, the frame was sent to the link; In case
-1 is returned, there was not enough bandwidth available right now,
and the frame could not be sent. The PHY should call the
tx_bandwidth_available in the ieee_802_3_mac_v3
interface at the MAC, when the frame can be sent.
The check_tx_bandwidth can also be used to check that there is bandwidth available, without sending a frame. It returns 0 if there is no bandwidth available, and a positive value if the frame can be sent right away.