Jump to main content

##

# 1.2.5.2.33 TCPIP_MAC_PacketTx Function

## C

    TCPIP_MAC_RES TCPIP_MAC_PacketTx(
        DRV_HANDLE hMac,
        TCPIP_MAC_PACKET * ptrPacket
    );

## Description

This is the MAC transmit function. Using this function a packet is submitted to the MAC driver for transmission.

## Precondtions

TCPIP_MAC_Initialize() should have been called. TCPIP_MAC_Open() should have been called to obtain a valid handle.

## Parameters

Parameters | Description
--- | ---
hMac | MAC client handle obtained by a call to TCPIP_MAC_Open().
ptrPacket | Pointer to a TCPIP_MAC_PACKET that's completely formatted and ready to be transmitted over the network.

## Returns

- TCPIP_MAC_RES_OK - if all processing went on OK.
- TCPIP_MAC_RES error code - if processing failed for some reason.

## Remarks

A success code returned from this function signals only that the packet was successfully scheduled for transmission over the interface and not that the packet was actually transmitted. An event will be triggered when the packet is transmitted.

The MAC driver has to support internal queuing. Since the TCPIP_MAC_PACKET data structure contains internal queuing members the MAC can queue the packet at no expense. Therefore a packet is to be rejected only if it's not properly formatted. Otherwise it has to be scheduled for transmission in an internal MAC queue.

Once the packet is scheduled for transmission the MAC driver has to set the TCPIP_MAC_PKT_FLAG_QUEUED flag so that the stack is aware that this packet is under processing and cannot be modified.

Once the packet is transmitted, the TCPIP_MAC_PKT_FLAG_QUEUED has to be cleared, the proper packet acknowledgment result (ackRes) has to be set and the packet acknowledgment function (ackFunc) has to be called. It is implementation dependent if all these steps are implemented as part of the ackFunc itself or as discrete steps.

On 32-bit machines, the 1st segment payload of a packet is allocated so that it is always cache line size aligned and its size is a cache line multiple.

Harmony MAC driver specific : the driver checks that the segLoadOffset >= 8. See notes for the segLoadOffset member.

The packet is not required to contain the Frame Check Sequence (FCS/CRC32) field. The MAC driver/controller will insert that field itself, if it's required.

The MAC driver is required to support the transmission of multiple chained packets.