02.03.2014 Views

BSP Developer's Guide

BSP Developer's Guide

BSP Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

H<br />

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

STATUS m2IfCounterUpdate<br />

(<br />

M2_ID * pId, /* The pointer to the device M2_ID object */<br />

UINT ctrId, /* Counter to update */<br />

ULONG value /* Amount to update the counter by */<br />

)<br />

Code Conversion from RFC 1213 to RFC 2233<br />

■<br />

Send Routines<br />

In the Send( ) and PollSend( ) routines, add an RFC 2233 MIB-II counter<br />

update for outgoing packets.<br />

For example, change a Send( ) routine as follows:<br />

■<br />

if (pDrvCtrl->endObj.pMib2Tbl != NULL)<br />

{<br />

pDrvCtrl->endObj.pMib2Tbl->m2PktCountRtn(pDrvCtrl->endObj.pMib2Tbl,<br />

M2_PACKET_OUT, pEnetHdr,<br />

len);<br />

}<br />

For example, change a PollSend routine as follows:<br />

if (pDrvCtrl->endObj.pMib2Tbl != NULL)<br />

{<br />

pDrvCtrl->endObj.pMib2Tbl->m2PktCountRtn(pDrvCtrl->endObj.pMib2Tbl,<br />

M2_PACKET_OUT, pEnetHdr,<br />

len);<br />

}<br />

Receive Routines<br />

In Receive( ) and PollReceive( ) routines, add an RFC 2233 MIB-II counter<br />

update for incoming packets.<br />

For example, change a Receive( ) routine as follows:<br />

if (pDrvCtrl->endObj.pMib2Tbl != NULL)<br />

{<br />

pDrvCtrl->endObj.pMib2Tbl->m2PktCountRtn(pDrvCtrl->endObj.pMib2Tbl,<br />

M2_PACKET_IN,<br />

pMblk->mBlkHdr.mData,<br />

pMblk->mBlkHdr.mLen);<br />

}<br />

For example, change a PollReceive( ) routine as follows:<br />

if (pDrvCtrl->endObj.pMib2Tbl != NULL)<br />

{<br />

pDrvCtrl->endObj.pMib2Tbl->m2PktCountRtn(pDrvCtrl->endObj.pMib2Tbl,<br />

M2_PACKET_IN,<br />

H<br />

315

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

Saved successfully!

Ooh no, something went wrong!