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.

VxWorks 5.5<br />

<strong>BSP</strong> Developer’s <strong>Guide</strong><br />

}<br />

pMblk->mBlkHdr.mData,<br />

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

Step 6:<br />

Take special care to ensure that all failure conditions be properly logged.<br />

The RFC 2233 interface provides the routine m2IfCounterUpdate( ) to maintain<br />

the various counters relevant for failure conditions. All failure conditions are<br />

considered errors. However, there are two general classes of failure conditions. The<br />

device can return an error status either because of failure to accomplish a requested<br />

action, or because of the driver’s inability to handle a packet due to a lack of<br />

available resources.<br />

Device failure conditions can be further categorized into errors-only and<br />

errors-with-discards, based on whether the failure causes packets to be dropped or<br />

not. If no packet is dropped, the failure is only an error; if data is dropped, the<br />

failure is both an error and a discard. Most device errors are both.<br />

If the driver receives a packet that was corrupted at receipt, this constitutes an error<br />

only. However, if a driver is unable to handle a perfectly good packet due to a lack<br />

of resources, this is always both an error and a discard.<br />

The RFC 2233 interface maintains counters for both incoming and outgoing errors<br />

and discards. The API provides selection by providing corresponding flags that<br />

designate each particular counter. This flag is passed as the second argument to<br />

m2IfCounterUpdate( ).<br />

The relevant flags are:<br />

M2_ctrId_ifInDiscards<br />

M2_ctrId_ifInErrors<br />

M2_ctrId_ifOutDiscards<br />

M2_ctrId_ifOutErrors<br />

For example:<br />

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

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

{<br />

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

M2_ctrId_ifInErrors, 1);<br />

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

M2_ctrId_ifInDiscards, 1);<br />

}<br />

316

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

Saved successfully!

Ooh no, something went wrong!