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 />

Set the hardware address macro to point to where the physical address is stored in<br />

the RFC 2233-type MIB. For RFC 2233-type MIBs, the physical address for an<br />

Ethernet device is stored in the pMib2Tbl in the END_OBJ. For example:<br />

#define END_HADDR(pEnd) \<br />

((pEnd)->pMib2Tbl->m2Data.mibIfTbl.ifPhysAddress.phyAddress)<br />

Step 4:<br />

Add the EIOCGMIB2233 case in the ioctl routine.<br />

For example:<br />

/* New RFC 2233 mib2 interface */<br />

case EIOCGMIB2233:<br />

if ((data == NULL) || (pEndObj->pMib2Tbl == NULL))<br />

error = EINVAL;<br />

else<br />

*((M2_ID **)data) = pEndObj->pMib2Tbl;<br />

break;<br />

Step 5:<br />

Replace the old RFC 1213 interface API with the RFC 2233 interface API; then delete<br />

the old RFC 1213 interface API.<br />

RFC 1213 interface API. The old RFC 1213 interface used the END_ERR_ADD<br />

macro for both updating packet counts and for counting error conditions.<br />

(a) Replace all instances of END_ERR_ADD calls. After an END_ERR_ADD<br />

instance is replaced, it can be deleted. For example:<br />

END_ERR_ADD (&pDrvCtrl->endObj, MIB2_IN_UCAST, +1);<br />

(b) Replace the deleted RFC 1213 interface.<br />

H<br />

RFC 2233 Interface API. The RFC 2233 interface API consists of<br />

m2IfGenericPacketCount( ) and m2IfCounterUpdate( ). These routines are<br />

accessed through pointers stored in pMib2Tbl of the END_OBJ. The pointer to<br />

m2IfGenericPacketCount( ) is held in pDrvCtrl-> endObj.pMib2Tbl-><br />

m2PktCountRtn. The pointer to m2IfCounterUpdate( ) is in pDrvCtrl-><br />

endObj.pMib2Tbl-> m2CtrUpdateRtn.<br />

The APIs for these routines are as follows:<br />

m2If8023PacketCount. Increment the interface packet counters for an 802.3 device.<br />

This function is used to update basic interface counters for a packet. The ctrl<br />

argument specifies whether the packet is being sent or received<br />

(M2_PACKET_IN or M2_PACKET_OUT). This function works for the 802.3<br />

313

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

Saved successfully!

Ooh no, something went wrong!