本文整理汇总了C++中GT_LPORT_2_PORT函数的典型用法代码示例。如果您正苦于以下问题:C++ GT_LPORT_2_PORT函数的具体用法?C++ GT_LPORT_2_PORT怎么用?C++ GT_LPORT_2_PORT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GT_LPORT_2_PORT函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DBG_INFO
/*******************************************************************************
* gvlnSetPortUserPriLsb
*
* DESCRIPTION:
* This routine Set the user priority (VPT) LSB bit, to be added to the
* user priority on the egress.
*
* INPUTS:
* port - logical port number to set.
* userPriLsb - GT_TRUE for 1, GT_FALSE for 0.
*
* OUTPUTS:
* None.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
* GT_BAD_PARAM - on bad parameters
*
* COMMENTS:
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gvlnSetPortUserPriLsb
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
IN GT_BOOL userPriLsb
)
{
GT_STATUS retVal; /* Functions return value. */
GT_U16 data; /* Data to be set into the */
/* register. */
GT_U8 phyPort; /* Physical port. */
DBG_INFO(("gvlnSetPortUserPriLsb Called.\n"));
/* Gigabit Switch does not support this status. */
if ((IS_IN_DEV_GROUP(dev,DEV_GIGABIT_SWITCH)) ||
(IS_IN_DEV_GROUP(dev,DEV_ENHANCED_FE_SWITCH)) ||
(IS_IN_DEV_GROUP(dev,DEV_FE_AVB_FAMILY)))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
phyPort = GT_LPORT_2_PORT(port);
BOOL_2_BIT(userPriLsb,data);
retVal = hwSetPortRegField(dev,phyPort,QD_REG_PVID,13,1,data);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例2: DBG_INFO
/*******************************************************************************
* gstpSetPortState
*
* DESCRIPTION:
* This routine set the port state.
*
* INPUTS:
* port - the logical port number.
* state - the port state to set.
*
* OUTPUTS:
* None.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
*
* COMMENTS:
*
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gstpSetPortState
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
IN GT_PORT_STP_STATE state
)
{
GT_U8 phyPort; /* Physical port */
GT_U16 data; /* Data to write to register. */
GT_STATUS retVal; /* Functions return value. */
DBG_INFO(("gstpSetPortState Called.\n"));
phyPort = GT_LPORT_2_PORT(port);
data = state;
/* Set the port state bits. */
retVal= hwSetPortRegField(dev,phyPort, QD_REG_PORT_CONTROL,0,2,data);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例3: DBG_INFO
/*******************************************************************************
* gpavSetIngressMonitor
*
* DESCRIPTION:
* This routine sets the Ingress Monitor bit in the PAV.
*
* INPUTS:
* port - the logical port number.
* mode - the ingress monitor bit in the PAV
* GT_FALSE: Ingress Monitor enabled
* GT_TRUE: Ingress Monitor disabled
* OUTPUTS:
* None.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
*
* COMMENTS:
*
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gpavSetIngressMonitor
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
IN GT_BOOL mode
)
{
GT_STATUS retVal; /* Functions return value. */
GT_U16 data; /* Data to be set into the */
/* register. */
GT_U8 phyPort; /* Physical port. */
DBG_INFO(("gpavSetIngressMonitorCalled.\n"));
phyPort = GT_LPORT_2_PORT(port);
BOOL_2_BIT(mode,data);
/* check if device supports this feature */
if (!IS_IN_DEV_GROUP(dev,DEV_ENABLE_MONITORING))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
retVal = hwSetPortRegField(dev,phyPort,QD_REG_PORT_ASSOCIATION,15,1,data);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例4: DBG_INFO
/*******************************************************************************
* gstatsFlushPort
*
* DESCRIPTION:
* Flush All counters for a given port.
*
* INPUTS:
* port - the logical port number.
*
* OUTPUTS:
* None.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
*
* COMMENTS:
* None
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gstatsFlushPort
(
IN GT_QD_DEV *dev,
IN GT_LPORT port
)
{
GT_STATUS retVal;
GT_U8 hwPort; /* physical port number */
DBG_INFO(("gstatsFlushPort Called.\n"));
/* translate logical port to physical port */
hwPort = GT_LPORT_2_PORT(port);
/* check if device supports this feature */
if((retVal = IS_VALID_API_CALL(dev,hwPort, DEV_RMON)) != GT_OK)
{
return retVal;
}
retVal = statsOperationPerform(dev,STATS_FLUSH_PORT,hwPort,0,NULL);
if(retVal != GT_OK)
{
DBG_INFO(("Failed (statsOperationPerform returned GT_FAIL).\n"));
return retVal;
}
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例5: DBG_INFO
/*******************************************************************************
* gprtGetPortCtr
*
* DESCRIPTION:
* This routine gets the port rx/tx counters.
*
* INPUTS:
* port - the logical port number.
*
* OUTPUTS:
* ctr - the counters value.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
*
* COMMENTS:
*
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gprtGetPortCtr
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
OUT GT_PORT_STAT *ctr
)
{
GT_U16 count; /* counters current value */
GT_U8 hwPort; /* physical port number */
DBG_INFO(("gprtGetPortCtr Called.\n"));
if (IS_IN_DEV_GROUP(dev,DEV_88E6093_FAMILY))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
if(ctr == NULL)
{
DBG_INFO(("Failed.\n"));
return GT_BAD_PARAM;
}
/* translate logical port to physical port */
hwPort = GT_LPORT_2_PORT(port);
/* get rx counter value */
if(hwReadPortReg(dev,hwPort, QD_REG_RX_COUNTER, &count) != GT_OK)
{
DBG_INFO(("Failed (Read Rx).\n"));
return GT_FAIL;
}
ctr->rxCtr = count;
/* get tx counter value */
if(hwReadPortReg(dev,hwPort, QD_REG_TX_COUNTER, &count) != GT_OK)
{
DBG_INFO(("Failed (Read Tx).\n"));
return GT_FAIL;
}
ctr->txCtr = count;
if (IS_IN_DEV_GROUP(dev,DEV_ENHANCED_FE_SWITCH))
{
/* get dropped counter value */
if(hwReadPortReg(dev,hwPort, QD_REG_DROPPED_COUNTER, &count) != GT_OK)
{
DBG_INFO(("Failed (Read Tx).\n"));
return GT_FAIL;
}
ctr->dropped = count;
}
else
ctr->dropped = 0;
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例6: DBG_INFO
/*******************************************************************************
* gpcsSetPCSAnEn
*
* DESCRIPTION:
* This routine sets Enable mode of PCS Inband Auto-Negotiation.
*
* INPUTS:
* port - the logical port number.
* mode - GT_TRUE to enable PCS AN mode or GT_FALSE otherwise
*
* OUTPUTS:
* None
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
* GT_NOT_SUPPORTED - if current device does not support this feature.
*
* COMMENTS:
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gpcsSetPCSAnEn
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
IN GT_BOOL mode
)
{
GT_U16 data; /* Used to poll the SWReset bit */
GT_STATUS retVal; /* Functions return value. */
GT_U8 hwPort; /* the physical port number */
DBG_INFO(("gpcsSetPCSAnEn Called.\n"));
/* check if the given Switch supports this feature. */
if (!IS_IN_DEV_GROUP(dev,DEV_PCS))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
/* translate BOOL to binary */
BOOL_2_BIT(mode, data);
/* translate LPORT to hardware port */
hwPort = GT_LPORT_2_PORT(port);
/* check if the given port supports PCS */
if (!DOES_DEVPORT_SUPPORT_PCS(dev,hwPort))
{
if (!IS_IN_DEV_GROUP(dev, DEV_INTERNAL_GPHY))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
if ((hwPort < 4) || (hwPort > 7))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
}
/* Get the PCSAnEn bit. */
retVal = hwSetPortRegField(dev,hwPort, QD_REG_PCS_CONTROL,10,1,data);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
}
else
{
DBG_INFO(("OK.\n"));
}
/* return */
return retVal;
}
示例7: _getSerdesPageNumber
/*******************************************************************************
* gprtGetSerdesMode
*
* DESCRIPTION:
* This routine reads Serdes Interface Mode.
*
* INPUTS:
* port - The physical SERDES device address(4/5)
*
* OUTPUTS:
* mode - Serdes Interface Mode
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
*
* COMMENTS:
* logical port number is supported only for the devices made production
* before 2009.
* (Serdes devices: 88E6131, 88E6122, 88E6108, 88E6161, 88E6165, 88E6352 and 88E320 family)
*
*******************************************************************************/
GT_STATUS gprtGetSerdesMode
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
IN GT_SERDES_MODE *mode
)
{
GT_U16 u16Data; /* The register's read data. */
GT_U8 hwPort, serdesPort; /* the physical port number */
GT_U8 pageNum = _getSerdesPageNumber(dev);
GT_PHY_INFO serdesInfo;
DBG_INFO(("gprtGetSerdesMode Called.\n"));
if(!IS_IN_DEV_GROUP(dev,DEV_SERDES_CORE))
{
return GT_NOT_SUPPORTED;
}
/* check if input is logical port number */
hwPort = GT_LPORT_2_PORT(port);
serdesPort = hwPort;
GT_GET_SERDES_PORT(dev,&serdesPort);
gtSemTake(dev,dev->phyRegsSem,OS_WAIT_FOREVER);
/* check if the port is configurable */
if((serdesInfo.phyId=GT_GET_PHY_ID(dev,hwPort)) == GT_INVALID_PHY)
{
gtSemGive(dev,dev->phyRegsSem);
return GT_NOT_SUPPORTED;
}
if(driverFindPhyInformation(dev,hwPort,&serdesInfo) != GT_OK)
{
DBG_INFO(("Unknown PHY device.\n"));
gtSemGive(dev,dev->phyRegsSem);
return GT_FAIL;
}
/* Get Serdes Register. */
if(hwReadPagedPhyReg(dev,serdesPort,pageNum, 16,serdesInfo.anyPage,&u16Data) != GT_OK)
{
DBG_INFO(("Failed.\n"));
gtSemGive(dev,dev->phyRegsSem);
return GT_FAIL;
}
*mode = u16Data&0x3;
gtSemGive(dev,dev->phyRegsSem);
return GT_OK;
}
示例8: DBG_INFO
/*******************************************************************************
* gstuFindSidEntry
*
* DESCRIPTION:
* Find STU entry for a specific SID, it will return the entry, if found,
* along with its associated data
*
* INPUTS:
* stuEntry - contains the SID to searche for
*
* OUTPUTS:
* found - GT_TRUE, if the appropriate entry exists.
* stuEntry - the entry parameters.
*
* RETURNS:
* GT_OK - on success.
* GT_FAIL - on error or entry does not exist.
* GT_NO_SUCH - no such entry.
* GT_NOT_SUPPORTED - if current device does not support this feature.
*
* COMMENTS:
* Valid SID is 1 ~ 63.
*
*******************************************************************************/
GT_STATUS gstuFindSidEntry
(
IN GT_QD_DEV *dev,
INOUT GT_STU_ENTRY *stuEntry,
OUT GT_BOOL *found
)
{
GT_U8 valid;
GT_STATUS retVal;
GT_U8 port;
GT_LPORT lport;
GT_STU_ENTRY entry;
DBG_INFO(("gstuFindSidEntry Called.\n"));
/* check if device supports this feature */
if (!IS_IN_DEV_GROUP(dev,DEV_802_1S_STU))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
if((stuEntry->sid == 0) || (stuEntry->sid > 0x3F))
{
DBG_INFO(("GT_BAD_PARAM\n"));
return GT_BAD_PARAM;
}
*found = GT_FALSE;
/* Decrement 1 from sid */
entry.sid = stuEntry->sid-1;
valid = 0; /* valid is not used as input in this operation */
retVal = stuOperationPerform(dev,GET_NEXT_STU_ENTRY,&valid, &entry);
if(retVal != GT_OK)
{
DBG_INFO(("Failed (stuOperationPerform returned GT_FAIL).\n"));
return retVal;
}
/* retrive the value from the operation */
if ((entry.sid != stuEntry->sid) | (valid == 0))
return GT_NO_SUCH;
for(lport=0; lport<dev->numOfPorts; lport++)
{
port = GT_LPORT_2_PORT(lport);
stuEntry->portState[lport]=entry.portState[port];
}
*found = GT_TRUE;
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例9: DBG_INFO
/*******************************************************************************
* gsysInitCPUPort
*
* DESCRIPTION:
* This routine initializes CPU Port to required values. It is requred for Opus
*
* INPUTS:
* cpuPort - CPU Port
*
* OUTPUTS:
* None.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
* GT_NOT_SUPPORTED - if current device does not support this feature.
*
* COMMENTS:
* None.
*
*******************************************************************************/
static GT_STATUS gsysInitCPUPort
(
IN GT_QD_DEV *dev,
IN GT_LPORT cpuPort
)
{
GT_STATUS retVal; /* Functions return value. */
GT_U8 hwPort; /* the physical port number */
DBG_INFO(("gsysInitCPUPort Called.\n"));
/* translate LPORT to hardware port */
hwPort = GT_LPORT_2_PORT(cpuPort);
if (!IS_IN_DEV_GROUP(dev,DEV_CPU_PORT_NEED_INIT))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
if (cpuPort >= dev->numOfPorts)
{
return GT_BAD_PARAM;
}
/* Initialize the CPU Port. */
retVal = hwSetPortRegField(dev,hwPort, QD_REG_PORT_CONTROL, 11, 1, 1);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
retVal = hwSetPortRegField(dev,hwPort, QD_REG_PORT_CONTROL, 8, 2, 3);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
retVal = hwSetPortRegField(dev,hwPort, QD_REG_PORT_VLAN_MAP, 0, 10, 0x7ff);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
retVal = hwSetPortRegField(dev,hwPort, QD_REG_PORT_CONTROL2, 10, 4, 0);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
DBG_INFO(("OK.\n"));
return GT_OK;
}
示例10: gprtGetPhyIntPortSummary_mad
GT_STATUS gprtGetPhyIntPortSummary
(
IN GT_QD_DEV *dev,
OUT GT_U16 *intPortMask
)
{
GT_STATUS retVal;
GT_U8 hwPort; /* the physical port number */
GT_U16 portVec;
#ifdef GT_USE_MAD
if (dev->use_mad==GT_TRUE)
return gprtGetPhyIntPortSummary_mad(dev, intPortMask);
#endif
DBG_INFO(("gprtGetPhyIntPortSummary Called.\n"));
/* translate LPORT 0 to hardware port */
hwPort = GT_LPORT_2_PORT(0);
*intPortMask=0;
if (IS_IN_DEV_GROUP(dev,DEV_DEV_PHY_INTERRUPT))
{
return GT_NOT_SUPPORTED;
}
if (IS_IN_DEV_GROUP(dev,DEV_INTERNAL_GPHY))
{
/* get the interrupt port summary from global register */
retVal = hwGetGlobal2RegField(dev,QD_REG_PHYINT_SOURCE,0,dev->maxPorts,&portVec);
GT_GIG_PHY_INT_MASK(dev,portVec);
*intPortMask = (GT_U16)GT_PORTVEC_2_LPORTVEC(portVec);
}
else
{
/* get the interrupt port summary from phy */
retVal = hwReadPhyReg(dev,hwPort, QD_PHY_INT_PORT_SUMMARY_REG, &portVec);
*intPortMask = (GT_U16)GT_PORTVEC_2_LPORTVEC(portVec);
}
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
}
else
{
DBG_INFO(("OK.\n"));
}
return retVal;
}
示例11: DBG_INFO
/*******************************************************************************
* gprtSetPortDuplexMode
*
* DESCRIPTION:
* Sets duplex mode for a specific logical port. This function will keep the speed
* and loopback mode to the previous value, but disable others, such as Autonegotiation.
*
* INPUTS:
* port - logical port number
* dMode - dulpex mode
*
* OUTPUTS:
* None.
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
*
* COMMENTS:
* data sheet register 0.8 - Duplex Mode
*
*******************************************************************************/
GT_STATUS gprtSetPortDuplexMode
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
IN GT_BOOL dMode
)
{
GT_STATUS retVal; /* Functions return value. */
GT_U8 hwPort; /* the physical port number */
GT_U16 u16Data;
DBG_INFO(("gprtSetPortDuplexMode Called.\n"));
/* translate LPORT to hardware port */
hwPort = GT_LPORT_2_PORT(port);
/* check if the port is configurable */
if(!IS_CONFIGURABLE_PHY(dev,hwPort))
{
return GT_NOT_SUPPORTED;
}
if(hwReadPhyReg(dev,hwPort,QD_PHY_CONTROL_REG,&u16Data) != GT_OK)
{
DBG_INFO(("Not able to read Phy Reg(port:%d,offset:%d).\n",hwPort,QD_PHY_CONTROL_REG));
return GT_FAIL;
}
if(dMode)
{
u16Data = QD_PHY_RESET | (u16Data & (QD_PHY_LOOPBACK | QD_PHY_SPEED)) | QD_PHY_DUPLEX;
}
else
{
u16Data = QD_PHY_RESET | (u16Data & (QD_PHY_LOOPBACK | QD_PHY_SPEED));
}
DBG_INFO(("Write to phy(%d) register: regAddr 0x%x, data %#x",
hwPort,QD_PHY_CONTROL_REG,u16Data));
/* Write to Phy Control Register. */
retVal = hwWritePhyReg(dev,hwPort,QD_PHY_CONTROL_REG,u16Data);
if(retVal != GT_OK)
DBG_INFO(("Failed.\n"));
else
DBG_INFO(("OK.\n"));
return retVal;
}
示例12: GT_LPORT_2_PORT
/*******************************************************************************
* lport2phy
*
* DESCRIPTION:
* This function converts logical port number to physical phy number.
*
* INPUTS:
* portVec - physical port list in vector
* port - logical port number
* OUTPUTS:
* None.
* RETURNS:
* physical port number
*
* COMMENTS:
*
*******************************************************************************/
GT_U8 lport2phy
(
IN GT_QD_DEV *dev,
IN GT_LPORT port
)
{
GT_U8 hwPort;
/* check if it's for SERDES */
if(dev->validSerdesVec & (1<<port))
{
hwPort = (GT_U8)port;
}
else
{
hwPort = GT_LPORT_2_PORT(port);
}
return hwPort;
}
示例13: DBG_INFO
/*******************************************************************************
* gpavGetIngressMonitor
*
* DESCRIPTION:
* This routine gets the Ingress Monitor bit in the PAV.
*
* INPUTS:
* port - the logical port number.
*
* OUTPUTS:
* mode - the ingress monitor bit in the PAV
* GT_FALSE: Ingress Monitor enabled
* GT_TRUE: Ingress Monitor disabled
*
* RETURNS:
* GT_OK - on success
* GT_FAIL - on error
* GT_BAD_PARAM - on bad parameters
*
* COMMENTS:
*
*
* GalTis:
*
*******************************************************************************/
GT_STATUS gpavGetIngressMonitor
(
IN GT_QD_DEV *dev,
IN GT_LPORT port,
OUT GT_BOOL *mode
)
{
GT_STATUS retVal; /* Functions return value. */
GT_U16 data; /* The register's read data. */
GT_U8 phyPort; /* Physical port. */
DBG_INFO(("grcGetIngressMonitor Called.\n"));
if(mode == NULL)
{
DBG_INFO(("Failed.\n"));
return GT_BAD_PARAM;
}
phyPort = GT_LPORT_2_PORT(port);
/* check if device supports this feature */
if((retVal = IS_VALID_API_CALL(dev,phyPort, DEV_PORT_MONITORING)) != GT_OK )
return retVal;
if (!IS_IN_DEV_GROUP(dev,DEV_ENABLE_MONITORING))
{
DBG_INFO(("GT_NOT_SUPPORTED\n"));
return GT_NOT_SUPPORTED;
}
retVal = hwGetPortRegField(dev,phyPort,QD_REG_PORT_ASSOCIATION,15,1,&data);
if(retVal != GT_OK)
{
DBG_INFO(("Failed.\n"));
return retVal;
}
BIT_2_BOOL(data,*mode);
DBG_INFO(("OK.\n"));
return GT_OK;
}