02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

H<br />

Implementing a MUX-Based Network Interface Driver<br />

the packet, the MUX does not show the packet to any of the other protocols further<br />

down on the END_OBJ.protocols list.<br />

If you want a protocol to act as a firewall, the protocol should register as type<br />

MUX_PROTO_SNARF and should return TRUE from its receive function. If you<br />

want a protocol to see all uneaten packets that show up on the device, register the<br />

protocol with type MUX_PROTO_PROMISC.<br />

Protocols and Network Addressing<br />

The system is written to support both RFC 894 type Ethernet packets as well as<br />

802.3 encoded packets. If a protocol wants to use 802.3 style packets, it must<br />

register SAP (Service Access Point) as its protocol type. Otherwise, the protocol<br />

must use one of the accepted protocol types from RFC 1700.<br />

Output Protocols<br />

A single protocol can be bound to each device for the filtering of output packets.<br />

This functionality is provided for applications that want to look at every packet<br />

that is output on a particular device. The type MUX_PROTO_OUTPUT is passed<br />

into muxBind( ) when this protocol is registered. Only the stackRcvRtn parameter<br />

is valid with this type.<br />

Sending Data<br />

To put the appropriate address header information into the buffer, the protocol<br />

calls muxAddressForm( ). Finally, to send the packet, the protocol calls<br />

muxSend( ), passing in the cookie returned from the muxBind( ) as well as the<br />

mBlk that contains the packet it wants to send. The MUX then hands the packet to<br />

the driver.<br />

H<br />

Receiving Data<br />

In response to an interrupt from the network device, VxWorks executes the<br />

device’s previously registered interrupt service routine. This routine gets the<br />

packet off the device and queues it for processing the task level, where the driver<br />

prepares the packet for hand-off to the MUX. For a more detailed description of<br />

this process, see H.3 <strong>Guide</strong>lines for Handling Packet Reception in Your Driver, p.275.<br />

To hand the packet off to the MUX, the driver calls muxReceive( ). The<br />

muxReceive( ) routine determines the protocol type of the packet (0x800 for IP,<br />

303

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!