📄 pipc_qos.c
字号:
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "as is"
* and any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose
* are disclaimed. In no event shall VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: pipc_qos.c
*
* Purpose: Port control and QoS module shared UI callback functions
*
* Author: Tevin Chen
*
* Date: Jan 08, 2002
*
* Functions:
*
* Revision History:
*
*/
#ifdef __ASIC_VT6524
#include "str.h"
#include "swport.h"
#include "swqos.h"
#include "swmsg.h"
#include "piportmp.h"
#include "pigencfg.h"
#include "pieeprom.h"
#include "pipc_qos.h"
#include "pidef.h"
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Macros -----------------------------*/
/*--------------------- Export Functions --------------------------*/
void PIPORT_vSetEepDefault (SPort_QosPageCfg* pSPageCfg_Port) DIRECT_FUNTYPE_REENT
{
DIRECT_MEMTYPE_CODE SPerPortCfg SPortCfgDefault = {
DEFAULT_PORT_ENABLE,
DEFAULT_PORT_AUTO,
DEFAULT_PORT_SPD_DPX,
DEFAULT_FLOW_CONTROL,
DEFAULT_STATIC_PRIORITY // Qos
};
// sizeof(SPerPortCfg) = 1 Byte
STRvMemset(pSPageCfg_Port, *((PBYTE)(&SPortCfgDefault)), SWITCH_PORT_NUM);
// for Qos
pSPageCfg_Port->byQosMode = DEFAULT_QOS_MODE;
pSPageCfg_Port->by8021pMap = DEFAULT_8021P_MAP;
PIEEP_vSetCfgIntoEep((PBYTE)pSPageCfg_Port, EEP_ADDR_PORT_CFG, EEP_SIZE_PORT_QOS_CFG); // include qos
PIEEP_vUpdateChecksum();
}
BYTE PIPCQOS_byOp(SPort_QosPageCfg* pSPageCfg_Port, BYTE byOp, PBYTE pbyRtnPortId) DIRECT_FUNTYPE_REENT
{
UINT32 dwPhyPortMask;
BYTE byPhyPID, byLogPortIndex=0;
for (byLogPortIndex=0; byLogPortIndex<g_byLogIdNum; byLogPortIndex++)
{
dwPhyPortMask = PIPORTMP_dwLogPtrToPhyMsk(byLogPortIndex);
for (byPhyPID=0; byPhyPID<SWITCH_PORT_NUM; byPhyPID++)
{
if (dwPhyPortMask & 0x01)
{
if (byOp == PORT_QOS_OP_EEP_TO_BUF)
{
PIEEP_vGetCfgFromEep(EEP_ADDR_PORT_CFG + EEP_SIZE_PORT_OFFSET * byPhyPID,
EEP_SIZE_PORT_OFFSET,
(PBYTE)(pSPageCfg_Port->aSPortCfg+byLogPortIndex));
break;
}
// buf to eep and hw
else
{
if ((byOp == PORT_OP_BUF_TO_HW)||(byOp == PORT_OP_BUF_TO_EEP_HW))
{
// set port enable
SWPORT_vSetPortEn(byPhyPID, pSPageCfg_Port->aSPortCfg[byLogPortIndex].f1Enable);
// set port abl
if (OP_OK != SWPORT_bySetSpdDpx(byPhyPID, pSPageCfg_Port->aSPortCfg[byLogPortIndex].f1Auto,
pSPageCfg_Port->aSPortCfg[byLogPortIndex].f3SpdDpx))
{
*pbyRtnPortId = byLogPortIndex;
return PORT_OP_WRONG_AUTO_ABY;
}
// set port flowctrl
SWPORT_vSetFlowCtrlEn(byPhyPID, pSPageCfg_Port->aSPortCfg[byLogPortIndex].f1FC);
}
else //if ((byOp == QOS_OP_BUF_TO_HW)||(byOp == QOS_OP_BUF_TO_EEP_HW))
{
// set port priority (if QoS is disabled, disable static priority)
if (pSPageCfg_Port->byQosMode == QOS_FCFS)
SWQOS_vSetStaticPrior(byPhyPID, QOS_PORT_PRIORI_DISABLE);
else
SWQOS_vSetStaticPrior(byPhyPID, pSPageCfg_Port->aSPortCfg[byLogPortIndex].f2StaticPrior);
}
// save to eep
if ((byOp == PORT_OP_BUF_TO_EEP_HW)||(byOp == QOS_OP_BUF_TO_EEP_HW))
PIEEP_vSetCfgIntoEep((PBYTE)(pSPageCfg_Port->aSPortCfg+byLogPortIndex),
EEP_ADDR_PORT_CFG + EEP_SIZE_PORT_OFFSET * byPhyPID,
EEP_SIZE_PORT_OFFSET);
}
}
dwPhyPortMask >>= 1;
} // end for byPhyPID
} // end for byLogPortIndex
if (byOp == PORT_QOS_OP_EEP_TO_BUF)
PIEEP_vGetCfgFromEep(EEP_ADDR_QOS_CFG, EEP_SIZE_QOS_CFG, &(pSPageCfg_Port->byQosMode));
else if ((byOp == QOS_OP_BUF_TO_HW)||(byOp == QOS_OP_BUF_TO_EEP_HW))
{
if (QOS_OP_BUF_TO_EEP_HW)
PIEEP_vSetCfgIntoEep(&(pSPageCfg_Port->byQosMode), EEP_ADDR_QOS_CFG, EEP_SIZE_QOS_CFG);
SWQOS_vSetQosCfg(pSPageCfg_Port->byQosMode);
SWQOS_vSet8021pPriorMap(pSPageCfg_Port->by8021pMap);
}
if ((byOp == PORT_OP_BUF_TO_EEP_HW)||(byOp == QOS_OP_BUF_TO_EEP_HW))
PIEEP_vUpdateChecksum();
return OP_OK;
}
#endif // __ASIC_VT6524
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -