kd5660 vlan划分
Vlan划分相当于对port创建一个集合,集合里面的port互相之间可以进行网络转发。根据不同的场景需求可以创建不同的vlan,kd5600支持建立4094个vlan表。vlanMember 代表的是集合中的port成员,从port0-port23共24位,例如只有port1 port2互通和齐塔port不通的vlan中,vlanMember的值为0x03;系统中只能存在一个vlan,当我们切换vlan时,系统之前的vlan会被更新清除掉。Kd5660会将所有的vlan设置存入flash中但是最后生效的是最后vlan配置。
配置方法如下:
void sysStartInitialManage(void)
{
UINT portId;
gFlashSaveDataP = (gSaveDataInfo_t *)0 ;
memset((void *)&gSysInfo , 0 , sizeof(SystemManageInfo_t));
for(portId = 0; portId<BOARD_PORT_NUM; portId++)
{
gSysInfo.sysConfig.vlanMember[1] = 0x50000;
gSysInfo.sysConfig.pvid[portId] = 1;
gSysInfo.sysConfig.portCfg[portId].autoEn = 0;
gSysInfo.sysConfig.portCfg[portId].speed = SPEED_1000M;
gSysInfo.sysConfig.portCfg[portId].duplex = FULL_DUPLEX;
gSysInfo.sysConfig.portStpCfg[portId] = 4;
}
for(portId = 0; portId<BOARD_PORT_NUM; portId++)
{
gSysInfo.sysConfig.vlanMember[2] = 0x60000;
gSysInfo.sysConfig.pvid[portId] = 2;
gSysInfo.sysConfig.portCfg[portId].autoEn = 0;
gSysInfo.sysConfig.portCfg[portId].speed = SPEED_1000M;
gSysInfo.sysConfig.portCfg[portId].duplex = FULL_DUPLEX;
gSysInfo.sysConfig.portStpCfg[portId] = 4;
}
}