extractedLnx/linux-2.6.9/drivers/net/sk98lin/skgepnmi.c_MacPrivateConf.c
PNMI_STATIC int MacPrivateConf(
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: pBuf 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 */
{
unsigned int PhysPortMax;
unsigned int PhysPortIndex;
unsigned int LogPortMax;
unsigned int LogPortIndex;
unsigned int Limit;
unsigned int Offset;
char Val8;
char *pBufPtr;
int Ret;
SK_EVPARA EventParam;
SK_U32 Val32;
/*
* Calculate instance if wished. MAC index 0 is the virtual MAC.
*/
PhysPortMax = pAC->GIni.GIMacsFound;
LogPortMax = SK_PNMI_PORT_PHYS2LOG(PhysPortMax);
if (pAC->Pnmi.DualNetActiveFlag == SK_TRUE) { /* Dual net mode */
LogPortMax--;
}
if ((Instance != (SK_U32)(-1))) { /* Only one specific instance is queried */
/* Check instance range */
if ((Instance < 1) || (Instance > LogPortMax)) {
*pLen = 0;
return (SK_PNMI_ERR_UNKNOWN_INST);
}
LogPortIndex = SK_PNMI_PORT_INST2LOG(Instance);
Limit = LogPortIndex + 1;
}
else { /* Instance == (SK_U32)(-1), get all Instances of that OID */
LogPortIndex = 0;
Limit = LogPortMax;
}
/*
* Perform action
*/
if (Action == SK_PNMI_GET) {
/* Check length */
switch (Id) {
case OID_SKGE_PMD:
case OID_SKGE_CONNECTOR:
case OID_SKGE_LINK_CAP:
case OID_SKGE_LINK_MODE:
case OID_SKGE_LINK_MODE_STATUS:
case OID_SKGE_LINK_STATUS:
case OID_SKGE_FLOWCTRL_CAP:
case OID_SKGE_FLOWCTRL_MODE:
case OID_SKGE_FLOWCTRL_STATUS:
case OID_SKGE_PHY_OPERATION_CAP:
case OID_SKGE_PHY_OPERATION_MODE:
case OID_SKGE_PHY_OPERATION_STATUS:
case OID_SKGE_SPEED_CAP:
case OID_SKGE_SPEED_MODE:
case OID_SKGE_SPEED_STATUS:
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
#endif
if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U8)) {
*pLen = (Limit - LogPortIndex) * sizeof(SK_U8);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
case OID_SKGE_MTU:
case OID_SKGE_PHY_TYPE:
if (*pLen < (Limit - LogPortIndex) * sizeof(SK_U32)) {
*pLen = (Limit - LogPortIndex) * sizeof(SK_U32);
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
default:
SK_ERR_LOG(pAC, SK_ERRCL_SW, SK_PNMI_ERR041,
SK_PNMI_ERR041MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
/*
* Update statistic and increment semaphore to indicate
* that an update was already done.
*/
if ((Ret = SirqUpdate(pAC, IoC)) != SK_PNMI_ERR_OK) {
*pLen = 0;
return (Ret);
}
pAC->Pnmi.SirqUpdatedFlag ++;
/*
* Get value
*/
Offset = 0;
for (; LogPortIndex < Limit; LogPortIndex ++) {
pBufPtr = pBuf + Offset;
switch (Id) {
case OID_SKGE_PMD:
*pBufPtr = pAC->Pnmi.PMD;
Offset += sizeof(char);
break;
case OID_SKGE_CONNECTOR:
*pBufPtr = pAC->Pnmi.Connector;
Offset += sizeof(char);
break;
case OID_SKGE_PHY_TYPE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
continue;
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
Val32 = pAC->GIni.GP[PhysPortIndex].PhyType;
SK_PNMI_STORE_U32(pBufPtr, Val32);
}
}
else { /* DualNetMode */
Val32 = pAC->GIni.GP[NetIndex].PhyType;
SK_PNMI_STORE_U32(pBufPtr, Val32);
}
Offset += sizeof(SK_U32);
break;
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
continue;
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
*pBufPtr = Val8;
}
}
else { /* DualNetMode */
Val8 = (SK_U8) pAC->GIni.GP[PhysPortIndex].PPhyPowerState;
*pBufPtr = Val8;
}
Offset += sizeof(SK_U8);
break;
#endif
case OID_SKGE_LINK_CAP:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkCap;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PLinkCap;
}
Offset += sizeof(char);
break;
case OID_SKGE_LINK_MODE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkModeConf;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PLinkModeConf;
}
Offset += sizeof(char);
break;
case OID_SKGE_LINK_MODE_STATUS:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr =
CalculateLinkModeStatus(pAC, IoC, PhysPortIndex);
}
}
else { /* DualNetMode */
*pBufPtr = CalculateLinkModeStatus(pAC, IoC, NetIndex);
}
Offset += sizeof(char);
break;
case OID_SKGE_LINK_STATUS:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = CalculateLinkStatus(pAC, IoC, PhysPortIndex);
}
}
else { /* DualNetMode */
*pBufPtr = CalculateLinkStatus(pAC, IoC, NetIndex);
}
Offset += sizeof(char);
break;
case OID_SKGE_FLOWCTRL_CAP:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PFlowCtrlCap;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PFlowCtrlCap;
}
Offset += sizeof(char);
break;
case OID_SKGE_FLOWCTRL_MODE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PFlowCtrlMode;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PFlowCtrlMode;
}
Offset += sizeof(char);
break;
case OID_SKGE_FLOWCTRL_STATUS:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PFlowCtrlStatus;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PFlowCtrlStatus;
}
Offset += sizeof(char);
break;
case OID_SKGE_PHY_OPERATION_CAP:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PMSCap;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PMSCap;
}
Offset += sizeof(char);
break;
case OID_SKGE_PHY_OPERATION_MODE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PMSMode;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PMSMode;
}
Offset += sizeof(char);
break;
case OID_SKGE_PHY_OPERATION_STATUS:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PMSStatus;
}
}
else {
*pBufPtr = pAC->GIni.GP[NetIndex].PMSStatus;
}
Offset += sizeof(char);
break;
case OID_SKGE_SPEED_CAP:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkSpeedCap;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PLinkSpeedCap;
}
Offset += sizeof(char);
break;
case OID_SKGE_SPEED_MODE:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkSpeed;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PLinkSpeed;
}
Offset += sizeof(char);
break;
case OID_SKGE_SPEED_STATUS:
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
/* Get value for virtual port */
VirtualConf(pAC, IoC, Id, pBufPtr);
}
else {
/* Get value for physical port */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
*pBufPtr = pAC->GIni.GP[PhysPortIndex].PLinkSpeedUsed;
}
}
else { /* DualNetMode */
*pBufPtr = pAC->GIni.GP[NetIndex].PLinkSpeedUsed;
}
Offset += sizeof(char);
break;
case OID_SKGE_MTU:
Val32 = SK_DRIVER_GET_MTU(pAC, IoC, NetIndex);
SK_PNMI_STORE_U32(pBufPtr, Val32);
Offset += sizeof(SK_U32);
break;
default:
SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR,
("MacPrivateConf: Unknown OID should be handled before"));
pAC->Pnmi.SirqUpdatedFlag --;
return (SK_PNMI_ERR_GENERAL);
}
}
*pLen = Offset;
pAC->Pnmi.SirqUpdatedFlag --;
return (SK_PNMI_ERR_OK);
}
/*
* From here SET or PRESET action. Check if the passed
* buffer length is plausible.
*/
switch (Id) {
case OID_SKGE_LINK_MODE:
case OID_SKGE_FLOWCTRL_MODE:
case OID_SKGE_PHY_OPERATION_MODE:
case OID_SKGE_SPEED_MODE:
if (*pLen < Limit - LogPortIndex) {
*pLen = Limit - LogPortIndex;
return (SK_PNMI_ERR_TOO_SHORT);
}
if (*pLen != Limit - LogPortIndex) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
break;
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
if (*pLen < Limit - LogPortIndex) {
*pLen = Limit - LogPortIndex;
return (SK_PNMI_ERR_TOO_SHORT);
}
break;
#endif
case OID_SKGE_MTU:
if (*pLen < sizeof(SK_U32)) {
*pLen = sizeof(SK_U32);
return (SK_PNMI_ERR_TOO_SHORT);
}
if (*pLen != sizeof(SK_U32)) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
break;
default:
*pLen = 0;
return (SK_PNMI_ERR_READ_ONLY);
}
/*
* Perform preset or set
*/
Offset = 0;
for (; LogPortIndex < Limit; LogPortIndex ++) {
switch (Id) {
case OID_SKGE_LINK_MODE:
/* Check the value range */
Val8 = *(pBuf + Offset);
if (Val8 == 0) {
Offset += sizeof(char);
break;
}
if (Val8 < SK_LMODE_HALF ||
(LogPortIndex != 0 && Val8 > SK_LMODE_AUTOSENSE) ||
(LogPortIndex == 0 && Val8 > SK_LMODE_INDETERMINATED)) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (LogPortIndex == 0) {
/*
* The virtual port consists of all currently
* active ports. Find them and send an event
* with the new link mode to SIRQ.
*/
for (PhysPortIndex = 0;
PhysPortIndex < PhysPortMax;
PhysPortIndex ++) {
if (!pAC->Pnmi.Port[PhysPortIndex].
ActiveFlag) {
continue;
}
EventParam.Para32[0] = PhysPortIndex;
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_LMODE,
EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR043,
SK_PNMI_ERR043MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
}
else {
/*
* Send an event with the new link mode to
* the SIRQ module.
*/
EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC, SK_HWEV_SET_LMODE,
EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR043,
SK_PNMI_ERR043MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
Offset += sizeof(char);
break;
case OID_SKGE_FLOWCTRL_MODE:
/* Check the value range */
Val8 = *(pBuf + Offset);
if (Val8 == 0) {
Offset += sizeof(char);
break;
}
if (Val8 < SK_FLOW_MODE_NONE ||
(LogPortIndex != 0 && Val8 > SK_FLOW_MODE_SYM_OR_REM) ||
(LogPortIndex == 0 && Val8 > SK_FLOW_MODE_INDETERMINATED)) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (LogPortIndex == 0) {
/*
* The virtual port consists of all currently
* active ports. Find them and send an event
* with the new flow control mode to SIRQ.
*/
for (PhysPortIndex = 0;
PhysPortIndex < PhysPortMax;
PhysPortIndex ++) {
if (!pAC->Pnmi.Port[PhysPortIndex].
ActiveFlag) {
continue;
}
EventParam.Para32[0] = PhysPortIndex;
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_FLOWMODE,
EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR044,
SK_PNMI_ERR044MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
}
else {
/*
* Send an event with the new flow control
* mode to the SIRQ module.
*/
EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_FLOWMODE, EventParam)
> 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR044,
SK_PNMI_ERR044MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
Offset += sizeof(char);
break;
case OID_SKGE_PHY_OPERATION_MODE :
/* Check the value range */
Val8 = *(pBuf + Offset);
if (Val8 == 0) {
/* mode of this port remains unchanged */
Offset += sizeof(char);
break;
}
if (Val8 < SK_MS_MODE_AUTO ||
(LogPortIndex != 0 && Val8 > SK_MS_MODE_SLAVE) ||
(LogPortIndex == 0 && Val8 > SK_MS_MODE_INDETERMINATED)) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (LogPortIndex == 0) {
/*
* The virtual port consists of all currently
* active ports. Find them and send an event
* with new master/slave (role) mode to SIRQ.
*/
for (PhysPortIndex = 0;
PhysPortIndex < PhysPortMax;
PhysPortIndex ++) {
if (!pAC->Pnmi.Port[PhysPortIndex].
ActiveFlag) {
continue;
}
EventParam.Para32[0] = PhysPortIndex;
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_ROLE,
EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR042,
SK_PNMI_ERR042MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
}
else {
/*
* Send an event with the new master/slave
* (role) mode to the SIRQ module.
*/
EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_ROLE, EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR042,
SK_PNMI_ERR042MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
Offset += sizeof(char);
break;
case OID_SKGE_SPEED_MODE:
/* Check the value range */
Val8 = *(pBuf + Offset);
if (Val8 == 0) {
Offset += sizeof(char);
break;
}
if (Val8 < (SK_LSPEED_AUTO) ||
(LogPortIndex != 0 && Val8 > (SK_LSPEED_1000MBPS)) ||
(LogPortIndex == 0 && Val8 > (SK_LSPEED_INDETERMINATED))) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (LogPortIndex == 0) {
/*
* The virtual port consists of all currently
* active ports. Find them and send an event
* with the new flow control mode to SIRQ.
*/
for (PhysPortIndex = 0;
PhysPortIndex < PhysPortMax;
PhysPortIndex ++) {
if (!pAC->Pnmi.Port[PhysPortIndex].ActiveFlag) {
continue;
}
EventParam.Para32[0] = PhysPortIndex;
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_SPEED,
EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR045,
SK_PNMI_ERR045MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
}
else {
/*
* Send an event with the new flow control
* mode to the SIRQ module.
*/
EventParam.Para32[0] = SK_PNMI_PORT_LOG2PHYS(
pAC, LogPortIndex);
EventParam.Para32[1] = (SK_U32)Val8;
if (SkGeSirqEvent(pAC, IoC,
SK_HWEV_SET_SPEED,
EventParam) > 0) {
SK_ERR_LOG(pAC, SK_ERRCL_SW,
SK_PNMI_ERR045,
SK_PNMI_ERR045MSG);
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
Offset += sizeof(char);
break;
case OID_SKGE_MTU :
/* Check the value range */
Val32 = *(SK_U32*)(pBuf + Offset);
if (Val32 == 0) {
/* mtu of this port remains unchanged */
Offset += sizeof(SK_U32);
break;
}
if (SK_DRIVER_PRESET_MTU(pAC, IoC, NetIndex, Val32) != 0) {
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (SK_DRIVER_SET_MTU(pAC, IoC, NetIndex, Val32) != 0) {
return (SK_PNMI_ERR_GENERAL);
}
Offset += sizeof(SK_U32);
break;
#ifdef SK_PHY_LP_MODE
case OID_SKGE_PHY_LP_MODE:
/* The preset ends here */
if (Action == SK_PNMI_PRESET) {
return (SK_PNMI_ERR_OK);
}
if (!pAC->Pnmi.DualNetActiveFlag) { /* SingleNetMode */
if (LogPortIndex == 0) {
Offset = 0;
continue;
}
else {
/* Set value for physical ports */
PhysPortIndex = SK_PNMI_PORT_LOG2PHYS(pAC, LogPortIndex);
switch (*(pBuf + Offset)) {
case 0:
/* If LowPowerMode is active, we can leave it. */
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) {
SkDrvInitAdapter(pAC);
}
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
case 1:
case 2:
case 3:
case 4:
/* If no LowPowerMode is active, we can enter it. */
if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
if ((*(pBuf + Offset)) < 3) {
SkDrvDeInitAdapter(pAC);
}
Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
default:
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
}
}
else { /* DualNetMode */
switch (*(pBuf + Offset)) {
case 0:
/* If we are in a LowPowerMode, we can leave it. */
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
Val32 = SkGmLeaveLowPowerMode(pAC, IoC, PhysPortIndex);
if (pAC->GIni.GP[PhysPortIndex].PPhyPowerState < 3) {
SkDrvInitAdapter(pAC);
}
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
case 1:
case 2:
case 3:
case 4:
/* If we are not already in LowPowerMode, we can enter it. */
if (!pAC->GIni.GP[PhysPortIndex].PPhyPowerState) {
if ((*(pBuf + Offset)) < 3) {
SkDrvDeInitAdapter(pAC);
}
else {
Val32 = SkGmEnterLowPowerMode(pAC, IoC, PhysPortIndex, *pBuf);
}
break;
}
else {
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
default:
*pLen = 0;
return (SK_PNMI_ERR_BAD_VALUE);
}
}
Offset += sizeof(SK_U8);
break;
#endif
default:
SK_DBG_MSG(pAC, SK_DBGMOD_PNMI, SK_DBGCAT_ERR,
("MacPrivateConf: Unknown OID should be handled before set"));
*pLen = 0;
return (SK_PNMI_ERR_GENERAL);
}
}
return (SK_PNMI_ERR_OK);
}
Generated by GNU enscript 1.6.4.