extractedLnx/linux-2.6.9/drivers/net/sk98lin/skgepnmi.c_General.c
PNMI_STATIC int General(
SK_AC *pAC, /* Pointer to adapter context */
SK_IOC IoC, /* IO context handle */
int Action, /* GET/PRESET/SET action */
SK_U32 Id, /* Object ID that is to be processed */
char *pBuf, /* Buffer used for the management data transfer */
unsigned int *pLen, /* On call: buffer length. On return: used buffer */
SK_U32 Instance, /* Instance (1..n) that is to be queried or -1 */
unsigned int TableIndex, /* Index to the Id table */
SK_U32 NetIndex) /* NetIndex (0..n), in single net mode always zero */
{
int Ret;
unsigned int Index;
unsigned int Len;
unsigned int Offset;
unsigned int Val;
SK_U8 Val8;
SK_U16 Val16;
SK_U32 Val32;
SK_U64 Val64;
SK_U64 Val64RxHwErrs = 0;
SK_U64 Val64TxHwErrs = 0;
SK_BOOL Is64BitReq = SK_FALSE;
char Buf[256];
int MacType;
/*
* Check instance. We only handle single instance variables.
*/
if (Instance != (SK_U32)(-1) && Instance != 1) {
*pLen = 0;
return (SK_PNMI_ERR_UNKNOWN_INST);
}
/*
* Check action. We only allow get requests.
*/
if (Action != SK_PNMI_GET) {
*pLen = 0;
return (SK_PNMI_ERR_READ_ONLY);
}
MacType = pAC->GIni.GIMacType;
/*
* Check length for the various supported OIDs
*/
switch (Id) {
case OID_GEN_XMIT_ERROR:
case OID_GEN_RCV_ERROR:
case OID_GEN_RCV_NO_BUFFER:
#ifndef SK_NDIS_64BIT_CTR
if (*pLen < sizeof(SK_U32)) {
*pLen = sizeof(SK_U32);
return (SK_PNMI_ERR_TOO_SHORT);
}
#else /* SK_NDIS_64BIT_CTR */
/*
* for compatibility, at least 32bit are required for oid
*/
if (*pLen < sizeof(SK_U32)) {
/*
* but indicate handling for 64bit values,
* if insufficient space is provided
*/
*pLen = sizeof(SK_U64);
return (SK_PNMI_ERR_TOO_SHORT);
}
Is64BitReq = (*pLen < sizeof(SK_U64)) ? SK_FALSE : SK_TRUE;
#endif /* SK_NDIS_64BIT_CTR */
break;
case OID_SKGE_PORT_NUMBER:
case OID_SKGE_DEVICE_TYPE:
case OID_SKGE_RESULT:
case OID_SKGE_RLMT_MONITOR_NUMBER:
case OID_GEN_TRANSMIT_QUEUE_LENGTH:
case OID_SKGE_TRAP_NUMBER:
case OID_SKGE_MDB_VERSION:
case OID_SKGE_BOARDLEVEL:
case OID_SKGE_CHIPID:
case OID_SKGE_RAMSIZE:
if (*pLen < sizeof(SK_U32)) {
*pLen = sizeof(SK_U32);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
case OID_SKGE_CHIPSET:
if (*pLen < sizeof(SK_U16)) {
*pLen = sizeof(SK_U16);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
case OID_SKGE_BUS_TYPE:
case OID_SKGE_BUS_SPEED:
case OID_SKGE_BUS_WIDTH:
case OID_SKGE_SENSOR_NUMBER:
case OID_SKGE_CHKSM_NUMBER:
case OID_SKGE_VAUXAVAIL:
if (*pLen < sizeof(SK_U8)) {
*pLen = sizeof(SK_U8);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
case OID_SKGE_TX_SW_QUEUE_LEN:
case OID_SKGE_TX_SW_QUEUE_MAX:
case OID_SKGE_TX_RETRY:
case OID_SKGE_RX_INTR_CTS:
case OID_SKGE_TX_INTR_CTS:
case OID_SKGE_RX_NO_BUF_CTS:
case OID_SKGE_TX_NO_BUF_CTS:
case OID_SKGE_TX_USED_DESCR_NO:
case OID_SKGE_RX_DELIVERED_CTS:
case OID_SKGE_RX_OCTETS_DELIV_CTS:
case OID_SKGE_RX_HW_ERROR_CTS:
case OID_SKGE_TX_HW_ERROR_CTS:
case OID_SKGE_IN_ERRORS_CTS:
case OID_SKGE_OUT_ERROR_CTS:
case OID_SKGE_ERR_RECOVERY_CTS:
case OID_SKGE_SYSUPTIME:
if (*pLen < sizeof(SK_U64)) {
*pLen = sizeof(SK_U64);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
default:
/* Checked later */
break;
}
/* Update statistic */
if (Id == OID_SKGE_RX_HW_ERROR_CTS ||
Id == OID_SKGE_TX_HW_ERROR_CTS ||
Id == OID_SKGE_IN_ERRORS_CTS ||
Id == OID_SKGE_OUT_ERROR_CTS ||
Id == OID_GEN_XMIT_ERROR ||
Id == OID_GEN_RCV_ERROR) {
/* Force the XMAC to update its statistic counters and
* Increment semaphore to indicate that an update was
* already done.
*/
Ret = MacUpdate(pAC, IoC, 0, pAC->GIni.GIMacsFound - 1);
if (Ret != SK_PNMI_ERR_OK) {
*pLen = 0;
return (Ret);
}
pAC->Pnmi.MacUpdatedFlag ++;
/*
* Some OIDs consist of multiple hardware counters. Those
* values which are contained in all of them will be added
* now.
*/
switch (Id) {
case OID_SKGE_RX_HW_ERROR_CTS:
case OID_SKGE_IN_ERRORS_CTS:
case OID_GEN_RCV_ERROR:
Val64RxHwErrs =
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_MISSED, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FRAMING, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_OVERFLOW, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_JABBER, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CARRIER, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_IRLENGTH, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SYMBOL, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_SHORTS, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_RUNT, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_TOO_LONG, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_FCS, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HRX_CEXT, NetIndex);
break;
case OID_SKGE_TX_HW_ERROR_CTS:
case OID_SKGE_OUT_ERROR_CTS:
case OID_GEN_XMIT_ERROR:
Val64TxHwErrs =
GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_EXCESS_COL, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_LATE_COL, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_UNDERRUN, NetIndex) +
GetStatVal(pAC, IoC, 0, SK_PNMI_HTX_CARRIER, NetIndex);
break;
}
}
/*
* Retrieve value
*/
switch (Id) {
case OID_SKGE_SUPPORTED_LIST:
Len = ID_TABLE_SIZE * sizeof(SK_U32);
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
for (Offset = 0, Index = 0; Offset < Len;
Offset += sizeof(SK_U32), Index ++) {
Val32 = (SK_U32)IdTable[Index].Id;
SK_PNMI_STORE_U32(pBuf + Offset, Val32);
}
*pLen = Len;
break;
case OID_SKGE_BOARDLEVEL:
Val32 = (SK_U32)pAC->GIni.GILevel;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_PORT_NUMBER:
Val32 = (SK_U32)pAC->GIni.GIMacsFound;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_DEVICE_TYPE:
Val32 = (SK_U32)pAC->Pnmi.DeviceType;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_DRIVER_DESCR:
if (pAC->Pnmi.pDriverDescription == NULL) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR007,
SK_PNMI_ERR007MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len = SK_STRLEN(pAC->Pnmi.pDriverDescription) + 1;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR029,
SK_PNMI_ERR029MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverDescription, Len - 1);
*pLen = Len;
break;
case OID_SKGE_DRIVER_VERSION:
if (pAC->Pnmi.pDriverVersion == NULL) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
SK_PNMI_ERR030MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len = SK_STRLEN(pAC->Pnmi.pDriverVersion) + 1;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
SK_PNMI_ERR031MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverVersion, Len - 1);
*pLen = Len;
break;
case OID_SKGE_DRIVER_RELDATE:
if (pAC->Pnmi.pDriverReleaseDate == NULL) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
SK_PNMI_ERR053MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len = SK_STRLEN(pAC->Pnmi.pDriverReleaseDate) + 1;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
SK_PNMI_ERR054MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverReleaseDate, Len - 1);
*pLen = Len;
break;
case OID_SKGE_DRIVER_FILENAME:
if (pAC->Pnmi.pDriverFileName == NULL) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR030,
SK_PNMI_ERR055MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len = SK_STRLEN(pAC->Pnmi.pDriverFileName) + 1;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR031,
SK_PNMI_ERR056MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, pAC->Pnmi.pDriverFileName, Len - 1);
*pLen = Len;
break;
case OID_SKGE_HW_DESCR:
/*
* The hardware description is located in the VPD. This
* query may move to the initialisation routine. But
* the VPD data is cached and therefore a call here
* will not make much difference.
*/
Len = 256;
if (VpdRead(pAC, IoC, VPD_NAME, Buf, (int *)&Len) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR032,
SK_PNMI_ERR032MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
Len ++;
if (Len > SK_PNMI_STRINGLEN1) {
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR033,
SK_PNMI_ERR033MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
*pBuf = (char)(Len - 1);
SK_MEMCPY(pBuf + 1, Buf, Len - 1);
*pLen = Len;
break;
case OID_SKGE_HW_VERSION:
/* Oh, I love to do some string manipulation */
if (*pLen < 5) {
*pLen = 5;
return (SK_PNMI_ERR_TOO_SHORT);
}
Val8 = (SK_U8)pAC->GIni.GIPciHwRev;
pBuf[0] = 4;
pBuf[1] = 'v';
pBuf[2] = (char)(0x30 | ((Val8 >> 4) & 0x0F));
pBuf[3] = '.';
pBuf[4] = (char)(0x30 | (Val8 & 0x0F));
*pLen = 5;
break;
case OID_SKGE_CHIPSET:
Val16 = pAC->Pnmi.Chipset;
SK_PNMI_STORE_U16(pBuf, Val16);
*pLen = sizeof(SK_U16);
break;
case OID_SKGE_CHIPID:
Val32 = pAC->GIni.GIChipId;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_RAMSIZE:
Val32 = pAC->GIni.GIRamSize;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_VAUXAVAIL:
*pBuf = (char) pAC->GIni.GIVauxAvail;
*pLen = sizeof(char);
break;
case OID_SKGE_BUS_TYPE:
*pBuf = (char) SK_PNMI_BUS_PCI;
*pLen = sizeof(char);
break;
case OID_SKGE_BUS_SPEED:
*pBuf = pAC->Pnmi.PciBusSpeed;
*pLen = sizeof(char);
break;
case OID_SKGE_BUS_WIDTH:
*pBuf = pAC->Pnmi.PciBusWidth;
*pLen = sizeof(char);
break;
case OID_SKGE_RESULT:
Val32 = pAC->Pnmi.TestResult;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_SENSOR_NUMBER:
*pBuf = (char)pAC->I2c.MaxSens;
*pLen = sizeof(char);
break;
case OID_SKGE_CHKSM_NUMBER:
*pBuf = SKCS_NUM_PROTOCOLS;
*pLen = sizeof(char);
break;
case OID_SKGE_TRAP_NUMBER:
GetTrapQueueLen(pAC, &Len, &Val);
Val32 = (SK_U32)Val;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_TRAP:
GetTrapQueueLen(pAC, &Len, &Val);
if (*pLen < Len) {
*pLen = Len;
return (SK_PNMI_ERR_TOO_SHORT);
}
CopyTrapQueue(pAC, pBuf);
*pLen = Len;
break;
case OID_SKGE_RLMT_MONITOR_NUMBER:
/* XXX Not yet implemented by RLMT therefore we return zero elements */
Val32 = 0;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_SKGE_TX_SW_QUEUE_LEN:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].TxSwQueueLen;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].TxSwQueueLen +
pAC->Pnmi.BufPort[1].TxSwQueueLen;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].TxSwQueueLen;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].TxSwQueueLen +
pAC->Pnmi.Port[1].TxSwQueueLen;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_TX_SW_QUEUE_MAX:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].TxSwQueueMax;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].TxSwQueueMax +
pAC->Pnmi.BufPort[1].TxSwQueueMax;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].TxSwQueueMax;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].TxSwQueueMax +
pAC->Pnmi.Port[1].TxSwQueueMax;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_TX_RETRY:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].TxRetryCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].TxRetryCts +
pAC->Pnmi.BufPort[1].TxRetryCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].TxRetryCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].TxRetryCts +
pAC->Pnmi.Port[1].TxRetryCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_RX_INTR_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].RxIntrCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].RxIntrCts +
pAC->Pnmi.BufPort[1].RxIntrCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].RxIntrCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].RxIntrCts +
pAC->Pnmi.Port[1].RxIntrCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_TX_INTR_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].TxIntrCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].TxIntrCts +
pAC->Pnmi.BufPort[1].TxIntrCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].TxIntrCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].TxIntrCts +
pAC->Pnmi.Port[1].TxIntrCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_RX_NO_BUF_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].RxNoBufCts +
pAC->Pnmi.BufPort[1].RxNoBufCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].RxNoBufCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].RxNoBufCts +
pAC->Pnmi.Port[1].RxNoBufCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_TX_NO_BUF_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].TxNoBufCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].TxNoBufCts +
pAC->Pnmi.BufPort[1].TxNoBufCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].TxNoBufCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].TxNoBufCts +
pAC->Pnmi.Port[1].TxNoBufCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_TX_USED_DESCR_NO:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].TxUsedDescrNo;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].TxUsedDescrNo +
pAC->Pnmi.BufPort[1].TxUsedDescrNo;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].TxUsedDescrNo;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].TxUsedDescrNo +
pAC->Pnmi.Port[1].TxUsedDescrNo;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_RX_DELIVERED_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].RxDeliveredCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].RxDeliveredCts +
pAC->Pnmi.BufPort[1].RxDeliveredCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].RxDeliveredCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].RxDeliveredCts +
pAC->Pnmi.Port[1].RxDeliveredCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_RX_OCTETS_DELIV_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].RxOctetsDeliveredCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].RxOctetsDeliveredCts +
pAC->Pnmi.BufPort[1].RxOctetsDeliveredCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].RxOctetsDeliveredCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].RxOctetsDeliveredCts +
pAC->Pnmi.Port[1].RxOctetsDeliveredCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_RX_HW_ERROR_CTS:
SK_PNMI_STORE_U64(pBuf, Val64RxHwErrs);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_TX_HW_ERROR_CTS:
SK_PNMI_STORE_U64(pBuf, Val64TxHwErrs);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_IN_ERRORS_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = Val64RxHwErrs + pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
}
/* Single net mode */
else {
Val64 = Val64RxHwErrs +
pAC->Pnmi.BufPort[0].RxNoBufCts +
pAC->Pnmi.BufPort[1].RxNoBufCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = Val64RxHwErrs + pAC->Pnmi.Port[NetIndex].RxNoBufCts;
}
/* Single net mode */
else {
Val64 = Val64RxHwErrs +
pAC->Pnmi.Port[0].RxNoBufCts +
pAC->Pnmi.Port[1].RxNoBufCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_OUT_ERROR_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = Val64TxHwErrs + pAC->Pnmi.BufPort[NetIndex].TxNoBufCts;
}
/* Single net mode */
else {
Val64 = Val64TxHwErrs +
pAC->Pnmi.BufPort[0].TxNoBufCts +
pAC->Pnmi.BufPort[1].TxNoBufCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = Val64TxHwErrs + pAC->Pnmi.Port[NetIndex].TxNoBufCts;
}
/* Single net mode */
else {
Val64 = Val64TxHwErrs +
pAC->Pnmi.Port[0].TxNoBufCts +
pAC->Pnmi.Port[1].TxNoBufCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_ERR_RECOVERY_CTS:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.BufPort[NetIndex].ErrRecoveryCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.BufPort[0].ErrRecoveryCts +
pAC->Pnmi.BufPort[1].ErrRecoveryCts;
}
}
else {
/* Dual net mode */
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) {
Val64 = pAC->Pnmi.Port[NetIndex].ErrRecoveryCts;
}
/* Single net mode */
else {
Val64 = pAC->Pnmi.Port[0].ErrRecoveryCts +
pAC->Pnmi.Port[1].ErrRecoveryCts;
}
}
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_SYSUPTIME:
Val64 = SK_PNMI_HUNDREDS_SEC(SkOsGetTime(pAC));
Val64 -= pAC->Pnmi.StartUpTime;
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
break;
case OID_SKGE_MDB_VERSION:
Val32 = SK_PNMI_MDB_VERSION;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
case OID_GEN_RCV_ERROR:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
Val64 = Val64RxHwErrs + pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
}
else {
Val64 = Val64RxHwErrs + pAC->Pnmi.Port[NetIndex].RxNoBufCts;
}
/*
* by default 32bit values are evaluated
*/
if (!Is64BitReq) {
Val32 = (SK_U32)Val64;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
}
else {
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
}
break;
case OID_GEN_XMIT_ERROR:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
Val64 = Val64TxHwErrs + pAC->Pnmi.BufPort[NetIndex].TxNoBufCts;
}
else {
Val64 = Val64TxHwErrs + pAC->Pnmi.Port[NetIndex].TxNoBufCts;
}
/*
* by default 32bit values are evaluated
*/
if (!Is64BitReq) {
Val32 = (SK_U32)Val64;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
}
else {
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
}
break;
case OID_GEN_RCV_NO_BUFFER:
/* 2002-09-17 pweber: For XMAC, use the frozen SW counters (BufPort) */
if (MacType == SK_MAC_XMAC) {
Val64 = pAC->Pnmi.BufPort[NetIndex].RxNoBufCts;
}
else {
Val64 = pAC->Pnmi.Port[NetIndex].RxNoBufCts;
}
/*
* by default 32bit values are evaluated
*/
if (!Is64BitReq) {
Val32 = (SK_U32)Val64;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
}
else {
SK_PNMI_STORE_U64(pBuf, Val64);
*pLen = sizeof(SK_U64);
}
break;
case OID_GEN_TRANSMIT_QUEUE_LENGTH:
Val32 = (SK_U32)pAC->Pnmi.Port[NetIndex].TxSwQueueLen;
SK_PNMI_STORE_U32(pBuf, Val32);
*pLen = sizeof(SK_U32);
break;
default:
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR034,
SK_PNMI_ERR034MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
if (Id == OID_SKGE_RX_HW_ERROR_CTS ||
Id == OID_SKGE_TX_HW_ERROR_CTS ||
Id == OID_SKGE_IN_ERRORS_CTS ||
Id == OID_SKGE_OUT_ERROR_CTS ||
Id == OID_GEN_XMIT_ERROR ||
Id == OID_GEN_RCV_ERROR) {
pAC->Pnmi.MacUpdatedFlag --;
}
return (SK_PNMI_ERR_OK);
}
Generated by GNU enscript 1.6.4.