/* Function Name:
 *      rtl8367b_setAsicVlanPortBasedVID
 * Description:
 *      Set port based VID which is indexed to 32 VLAN member configurations
 * Input:
 *      port 	- Physical port number (0~7)
 *      index 	- Index to VLAN member configuration
 *      pri 	- 1Q Port based VLAN priority
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 					- Success
 *      RT_ERR_SMI  				- SMI access error
 *      RT_ERR_PORT_ID  			- Invalid port number
 *      RT_ERR_QOS_INT_PRIORITY  	- Invalid priority
 *      RT_ERR_VLAN_ENTRY_NOT_FOUND - Invalid VLAN member configuration index
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicVlanPortBasedVID(rtk_uint32 port, rtk_uint32 index, rtk_uint32 pri)
{
    rtk_uint32 regAddr, bit_mask;
    ret_t  retVal;

    if(port > RTL8367B_PORTIDMAX)
        return RT_ERR_PORT_ID;

    if(index > RTL8367B_CVIDXMAX)
        return RT_ERR_VLAN_ENTRY_NOT_FOUND;

    if(pri > RTL8367B_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

    regAddr = RTL8367B_VLAN_PVID_CTRL_REG(port);
    bit_mask = RTL8367B_PORT_VIDX_MASK(port);
    retVal = rtl8367b_setAsicRegBits(regAddr, bit_mask, index);
    if(retVal != RT_ERR_OK)
        return retVal;

    regAddr = RTL8367B_VLAN_PORTBASED_PRIORITY_REG(port);
    bit_mask = RTL8367B_VLAN_PORTBASED_PRIORITY_MASK(port);
    retVal = rtl8367b_setAsicRegBits(regAddr, bit_mask, pri);
    if(retVal != RT_ERR_OK)
        return retVal;

    return RT_ERR_OK;
}
/* Function Name:
 *      rtl8367b_setAsicForceGroupLed
 * Description:
 *      Turn on/off Led of all ports
 * Input:
 *      group 	- LED group number
 *      mode 	- 0b00:normal mode, 0b01:force blink, 0b10:force off, 0b11:force on
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *		None
 */
ret_t rtl8367b_setAsicForceGroupLed(rtk_uint32 groupmask, rtk_uint32 mode)
{
    ret_t retVal;
	rtk_uint32 i,bitmask;
    CONST rtk_uint16 bits[3]= {0x0004,0x0010,0x0040};

    /* Invalid input parameter */
    if(groupmask > RTL8367B_LEDGROUPMASK)
        return RT_ERR_OUT_OF_RANGE;

    if(mode >= LEDFORCEMODE_END)
        return RT_ERR_OUT_OF_RANGE;

    bitmask = 0;
	for(i = 0; i <  RTL8367B_LEDGROUPNO; i++)
	{
	    if(groupmask & (1 << i))
	    {
            bitmask = bitmask | bits[i];
	    }

	}

    retVal = rtl8367b_setAsicRegBits(RTL8367B_LED_FORCE_CTRL, RTL8367B_LED_FORCE_MODE_MASK, bitmask);

    retVal = rtl8367b_setAsicRegBits(RTL8367B_LED_FORCE_CTRL, RTL8367B_FORCE_MODE_MASK, mode);

    if(LEDFORCEMODE_NORMAL == mode)
        retVal = rtl8367b_setAsicRegBits(RTL8367B_LED_FORCE_CTRL, RTL8367B_LED_FORCE_MODE_MASK, 0);

    return retVal;
}
/* Function Name:
 *      rtl8367b_setAsicIGMPSuppression
 * Description:
 *      Set the suppression function
 * Input:
 *      report_supp_enabled 	- Report suppression, 1:Enable, 0:disable
 *      leave_supp_enabled 		- Leave suppression, 1:Enable, 0:disable
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 	- Success
 *      RT_ERR_SMI  - SMI access error
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicIGMPSuppression(rtk_uint32 report_supp_enabled, rtk_uint32 leave_supp_enabled)
{
    ret_t   retVal;

    retVal = rtl8367b_setAsicRegBits(RTL8367B_REG_IGMP_MLD_CFG0, RTL8367B_REPORT_SUPPRESSION_MASK, report_supp_enabled);
    if(retVal != RT_ERR_OK)
        return retVal;

    retVal = rtl8367b_setAsicRegBits(RTL8367B_REG_IGMP_MLD_CFG0, RTL8367B_LEAVE_SUPPRESSION_MASK, leave_supp_enabled);
    if(retVal != RT_ERR_OK)
        return retVal;

    return RT_ERR_OK;
}
/* Function Name:
 *      rtl8367b_setAsicFlowControlSharedDropThreshold
 * Description:
 *      Set share-based fdrop parameters
 * Input:
 *      onThreshold 	- Drop turn ON threshold
 *      offThreshold 	- Drop turn OFF threshold
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicFlowControlSharedDropThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
{
    ret_t retVal;
 
    if((onThreshold >= RTL8367B_PAGE_NUMBER) || (offThreshold >= RTL8367B_PAGE_NUMBER))
        return RT_ERR_OUT_OF_RANGE;
    
    retVal = rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_FCOFF_SHARE_OFF, RTL8367B_FLOWCTRL_FCOFF_SHARE_OFF_MASK, offThreshold);
    if(retVal != RT_ERR_OK)
        return retVal;

    retVal = rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_FCOFF_SHARE_ON, RTL8367B_FLOWCTRL_FCOFF_SHARE_ON_MASK, onThreshold);

    return retVal;
}
/* Function Name:
 *      rtl8367b_setAsicVlanPortAndProtocolBased
 * Description:
 *      Set protocol and port based VLAN configuration
 * Input:
 *      port 		- Physical port number (0~7)
 *      index 		- Index of protocol and port based database index
 *      pPpbCfg 	- Protocol and port based VLAN configuration
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 					- Success
 *      RT_ERR_SMI  				- SMI access error
 *      RT_ERR_INPUT  				- Invalid input parameter
 *      RT_ERR_PORT_ID  			- Invalid port number
 *      RT_ERR_QOS_INT_PRIORITY  	- Invalid priority
 *      RT_ERR_VLAN_PROTO_AND_PORT  - Invalid protocol base group database index
 *      RT_ERR_VLAN_ENTRY_NOT_FOUND - Invalid VLAN member configuration index
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicVlanPortAndProtocolBased(rtk_uint32 port, rtk_uint32 index, rtl8367b_protocolvlancfg *pPpbCfg)
{
	rtk_uint32  reg_addr, bit_mask, bit_value;
	ret_t   retVal;

	/* Error Checking */
	if(port > RTL8367B_PORTIDMAX)
		return RT_ERR_PORT_ID;

	if(index > RTL8367B_PROTOVLAN_GIDX_MAX)
		return RT_ERR_VLAN_PROTO_AND_PORT;

	if( (pPpbCfg->valid != FALSE) && (pPpbCfg->valid != TRUE) )
        return RT_ERR_INPUT;

	if(pPpbCfg->vlan_idx > RTL8367B_CVIDXMAX)
        return RT_ERR_VLAN_ENTRY_NOT_FOUND;

	if(pPpbCfg->priority > RTL8367B_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

	/* Valid bit */
	reg_addr  = RTL8367B_VLAN_PPB_VALID_REG(index);
	bit_mask  = 0x0001 << port;
	bit_value = ((TRUE == pPpbCfg->valid) ? 0x1 : 0x0);
	retVal    = rtl8367b_setAsicRegBits(reg_addr, bit_mask, bit_value);
	if(retVal != RT_ERR_OK)
		return retVal;

	/* Calculate the actual register address for CVLAN index*/
	reg_addr = RTL8367B_VLAN_PPB_CTRL_REG(index, port);
	bit_mask = RTL8367B_VLAN_PPB_CTRL_MASK(port);
	bit_value = pPpbCfg->vlan_idx;

   	retVal	= rtl8367b_setAsicRegBits(reg_addr, bit_mask, bit_value);
	if(retVal != RT_ERR_OK)
		return retVal;

	/* write priority */
	reg_addr  = RTL8367B_VLAN_PPB_PRIORITY_ITEM_REG(port, index);
	bit_mask  = RTL8367B_VLAN_PPB_PRIORITY_ITEM_MASK(port);
	bit_value = pPpbCfg->priority;
	retVal    = rtl8367b_setAsicRegBits(reg_addr, bit_mask, bit_value);
	if(retVal != RT_ERR_OK)
		return retVal;

    return RT_ERR_OK;
}
/* Function Name:
 *      rtl8367b_setAsicIGMPStaticRouterPort
 * Description:
 *      Set IGMP static router port mask
 * Input:
 *      pmsk 	- Static portmask
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_PORT_MASK  	- Invalid port mask
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicIGMPStaticRouterPort(rtk_uint32 pmsk)
{
    if(pmsk > RTL8367B_PORTMASK)
        return RT_ERR_PORT_MASK;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_IGMP_STATIC_ROUTER_PORT, RTL8367B_IGMP_STATIC_ROUTER_PORT_MASK, pmsk);
}
/* Function Name:
 *      rtl8367b_setAsicUnknownMulticastTrapPriority
 * Description:
 *      Set trap priority of unknown multicast frame
 * Input:
 *      priority 	- priority (0~7)
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 				- Success
 *      RT_ERR_SMI  			- SMI access error
 *      RT_ERR_QOS_INT_PRIORITY - Invalid priority
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicUnknownMulticastTrapPriority(rtk_uint32 priority)
{
    if(priority > RTL8367B_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

    return rtl8367b_setAsicRegBits(RTL8367BG_QOS_TRAP_PRIORITY_CTRL0_REG, RTL8367B_UNKNOWN_MC_PRIORTY_MASK, priority);
}
/* Function Name:
 *      rtl8367b_setAsicPortUnknownSaBehavior
 * Description:
 *      Set UNSA behavior
 * Input:
 *      behavior 	- 0: flooding; 1: drop; 2:trap
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_NOT_ALLOWED  - Invalid behavior
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicPortUnknownSaBehavior(rtk_uint32 behavior)
{
    if(behavior >= L2_BEHAVE_SA_END)
		return RT_ERR_NOT_ALLOWED;

	return rtl8367b_setAsicRegBits(RTL8367B_PORT_SECURIT_CTRL_REG, RTL8367B_UNKNOWN_SA_BEHAVE_MASK, behavior);
}
/* Function Name:
 *      rtl8367b_setAsicRldp8051Portmask
 * Description:
 *      Set portmask that send/forward RLDP frame
 * Input:
 *      portmask 	- 0~0xFF
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_PORT_MASK  	- Invalid portmask
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicRldp8051Portmask(rtk_uint32 portmask)
{
    if(portmask > RTL8367B_PORTMASK)
        return RT_ERR_PORT_MASK;

    return rtl8367b_setAsicRegBits(RTL8367B_RLDP_CTRL0_REG,RTL8367B_RLDP_8051_LOOP_PORTMSK_MASK,portmask);
}
/* Function Name:
 *      rtl8367b_setAsicCputagTrapPort
 * Description:
 *      Set cpu tag trap port
 * Input:
 *      port - port number
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 		- Success
 *      RT_ERR_SMI  	- SMI access error
 *      RT_ERR_PORT_ID  - Invalid port number
 * Note:
 *     API can set destination port of trapping frame
 */
ret_t rtl8367b_setAsicCputagTrapPort(rtk_uint32 port)
{
    if(port >= RTL8367B_PORTNO)
        return RT_ERR_PORT_ID;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_CPU_CTRL, RTL8367B_CPU_TRAP_PORT_MASK, port);    
}
/* Function Name:
 *      rtl8367b_setAsicCputagInsertMode
 * Description:
 *      Set CPU-tag insert mode
 * Input:
 *      mode - 0: insert to all packets; 1: insert to trapped packets; 2: don't insert
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_NOT_ALLOWED  - Actions not allowed by the function
 * Note:
 *     None
 */
ret_t rtl8367b_setAsicCputagInsertMode(rtk_uint32 mode)
{
    if(mode >= CPUTAG_INSERT_END)
        return RT_ERR_NOT_ALLOWED;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_CPU_CTRL, RTL8367B_CPU_INSERTMODE_MASK, mode);
}
/* Function Name:
 *      rtl8367b_setAsicOamCpuPri
 * Description:
 *      Set trap priority for OAM packet
 * Input:
 *      priority 	- priority (0~7)
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 					- Success
 *      RT_ERR_SMI  				- SMI access error
 *      RT_ERR_QOS_INT_PRIORITY  	- Invalid priority
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicOamCpuPri(rtk_uint32 priority)
{
    if(priority > RTL8367B_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_QOS_TRAP_PRIORITY0, RTL8367B_OAM_PRIOIRTY_MASK, priority);
}
Beispiel #13
0
/* Function Name:
 *      rtl8367b_setAsicLedForceBlinkRate
 * Description:
 *      Set LEd blinking rate for force mode led
 * Input:
 *      blinkRate 	- Support 6 blink rates
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *		None
 */
ret_t rtl8367b_setAsicLedForceBlinkRate(rtk_uint32 blinkRate)
{
    if(blinkRate >= LEDFORCERATE_END)
        return RT_ERR_OUT_OF_RANGE;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_LED_MODE, RTL8367B_FORCE_RATE_MASK, blinkRate);
}
Beispiel #14
0
/* Function Name:
 *      rtl8367b_setAsicLedBlinkRate
 * Description:
 *      Set led blinking rate at mode 0 to mode 3
 * Input:
 *      blinkRate 	- Support 6 blink rates
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *		LED blink rate can be at 43ms, 84ms, 120ms, 170ms, 340ms and 670ms
 */
ret_t rtl8367b_setAsicLedBlinkRate(rtk_uint32 blinkRate)
{
    if(blinkRate >= LEDBLINKRATE_END)
        return RT_ERR_OUT_OF_RANGE;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_LED_MODE, RTL8367B_SEL_LEDRATE_MASK, blinkRate);
}
/* Function Name:
 *      rtl8367b_setAsicSvlanPrioritySel
 * Description:
 *      Set SVLAN priority field setting
 * Input:
 *      priSel 	- S-priority assignment method, 0:internal priority 1:C-tag priority 2:using Svlan member configuration
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 		- Success
 *      RT_ERR_SMI  	- SMI access error
 *      RT_ERR_INPUT  	- Invalid input parameter
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicSvlanPrioritySel(rtk_uint32 priSel)
{
    if(priSel >= SPRISEL_END)
        return RT_ERR_INPUT;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_SVLAN_CFG, RTL8367B_VS_SPRISEL_MASK, priSel);
}
/* Function Name:
 *      rtl8367b_setAsic1xTrapPriority
 * Description:
 *      Set 802.1x Trap priority
 * Input:
 *      priority	- priority (0~7)
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 				- Success
 *      RT_ERR_SMI  			- SMI access error
 *      RT_ERR_QOS_INT_PRIORITY	- Invalid priority
 * Note:
 *      None
 */
ret_t rtl8367b_setAsic1xTrapPriority(rtk_uint32 priority)
{
    if(priority > RTL8367B_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;
    
	return rtl8367b_setAsicRegBits(RTL8367B_REG_QOS_TRAP_PRIORITY0, RTL8367B_DOT1X_PRIORTY_MASK,priority);
}
/* Function Name:
 *      rtl8367b_setAsicCputagPriorityRemapping
 * Description:
 *      Set queue assignment of CPU port
 * Input:
 *      srcPri - internal priority (0~7)
 *      newPri - internal priority after remapping (0~7)
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 					- Success
 *      RT_ERR_SMI  				- SMI access error
 *      RT_ERR_QOS_INT_PRIORITY  	- Invalid priority
 * Note:
 *     None
 */
ret_t rtl8367b_setAsicCputagPriorityRemapping(rtk_uint32 srcPri, rtk_uint32 newPri)
{
    if((srcPri > RTL8367B_PRIMAX) || (newPri > RTL8367B_PRIMAX))
        return RT_ERR_QOS_INT_PRIORITY;

    return rtl8367b_setAsicRegBits(RTL8367B_QOS_PRIPORITY_REMAPPING_IN_CPU_REG(srcPri), RTL8367B_QOS_PRIPORITY_REMAPPING_IN_CPU_MASK(srcPri), newPri);
}
/* Function Name:
 *      rtl8367b_setAsic1xGuestVidx
 * Description:
 *      Set 802.1x guest vlan index
 * Input:
 *      index	- 802.1x guest vlan index (0~31)
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 				- Success
 *      RT_ERR_SMI  			- SMI access error
 *      RT_ERR_DOT1X_GVLANIDX  	- Invalid cvid index
 * Note:
 *      None
 */
ret_t rtl8367b_setAsic1xGuestVidx(rtk_uint32 index)
{
	if(index >= RTL8367B_CVIDXNO)
		return RT_ERR_DOT1X_GVLANIDX;

	return rtl8367b_setAsicRegBits(RTL8367B_DOT1X_CFG_REG, RTL8367B_DOT1X_GVIDX_MASK, index);
}
/* Function Name:
 *      rtl8367b_setAsicFlowControlPortPrivateJumboThreshold
 * Description:
 *      Set Jumbo Port-private-based flow control parameters
 * Input:
 *      onThreshold 	- Flow control turn ON threshold
 *      offThreshold 	- Flow control turn OFF threshold
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicFlowControlPortPrivateJumboThreshold(rtk_uint32 onThreshold, rtk_uint32 offThreshold)
{
    ret_t retVal;
 
    if((onThreshold >= RTL8367B_PAGE_NUMBER) || (offThreshold >= RTL8367B_PAGE_NUMBER))
        return RT_ERR_OUT_OF_RANGE;
    
    retVal = rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_JUMBO_PORT_PRIVATE_OFF, RTL8367B_FLOWCTRL_JUMBO_PORT_PRIVATE_OFF_MASK, offThreshold);

    if(retVal != RT_ERR_OK)
        return retVal;

    retVal = rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_JUMBO_PORT_PRIVATE_ON, RTL8367B_FLOWCTRL_JUMBO_PORT_PRIVATE_ON_MASK, onThreshold);

    return retVal;
}
/* Function Name:
 *      rtl8367b_setAsicFlowControlDropAll
 * Description:
 *      Set system-based drop parameters
 * Input:
 *      dropall 	- Whole system drop threshold
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicFlowControlDropAll(rtk_uint32 dropall)
{
	if(dropall >= RTL8367B_PAGE_NUMBER)
   		return RT_ERR_OUT_OF_RANGE;
	 
	return rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_CTRL0, RTL8367B_DROP_ALL_THRESHOLD_MASK, dropall);
}
/* Function Name:
 *      rtl8367b_setAsicLutLearnOverAct
 * Description:
 *      Set auto learn over limit number action
 * Input:
 *      action 	- Learn over action 0:normal, 1:drop 2:trap
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_NOT_ALLOWED  - Invalid learn over action
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicLutLearnOverAct(rtk_uint32 action)
{
    if(action >= LRNOVERACT_END)
        return RT_ERR_NOT_ALLOWED;

	return rtl8367b_setAsicRegBits(RTL8367B_REG_PORT_SECURITY_CTRL, RTL8367B_LUT_LEARN_OVER_ACT_MASK, action);
}
/* Function Name:
 *      rtl8367b_setAsicFlowControlPauseAll
 * Description:
 *      Set system-based all ports enable flow control parameters
 * Input:
 *      threshold 	- Whole system pause all threshold
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicFlowControlPauseAllThreshold(rtk_uint32 threshold)
{
    if(threshold >= RTL8367B_PAGE_NUMBER)
        return RT_ERR_OUT_OF_RANGE;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_ALL_ON, RTL8367B_FLOWCTRL_ALL_ON_THRESHOLD_MASK, threshold);
}
/* Function Name:
 *      rtl8367b_setAsicFlowControlJumboModeSize
 * Description:
 *      Set Jumbo size for Jumbo mode flow control
 * Input:
 *      size 		- Jumbo size 0:3Kbytes 1:4Kbytes 2:6Kbytes 3:9Kbytes
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI 			- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicFlowControlJumboModeSize(rtk_uint32 size)
{
	if(size >= FC_JUMBO_SIZE_END)
		return RT_ERR_OUT_OF_RANGE;
	
    return rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_JUMBO_SIZE, RTL8367B_JUMBO_SIZE_MASK, size);
}
/* Function Name:
 *      rtl8367b_setAsicEgressFlowControlQueueDropGap
 * Description:
 *      Set Queue-based egress flow control turn off or ingress flow control drop off gap
 * Input:
 *      gap 	- Flow control/drop turn OFF threshold = turn ON threshold - gap
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicEgressFlowControlQueueDropGap(rtk_uint32 gap)
{
    if(gap >= RTL8367B_PAGE_NUMBER)
        return RT_ERR_OUT_OF_RANGE;

    return rtl8367b_setAsicRegBits(RTL8367B_REG_FLOWCTRL_QUEUE_GAP, RTL8367B_FLOWCTRL_QUEUE_GAP_MASK, gap);
}
/* Function Name:
 *      rtl8367b_setAsicVlanProtocolBasedGroupData
 * Description:
 *      Set protocol and port based group database
 * Input:
 *      index 		- Index to VLAN member configuration
 *      pPbCfg 	- Protocol and port based group database entry
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 					- Success
 *      RT_ERR_SMI  				- SMI access error
 *      RT_ERR_INPUT  				- Invalid input parameter
 *      RT_ERR_VLAN_PROTO_AND_PORT  - Invalid protocol base group database index
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicVlanProtocolBasedGroupData(rtk_uint32 index, rtl8367b_protocolgdatacfg *pPbCfg)
{
	rtk_uint32  frameType;
    rtk_uint32  etherType;
	ret_t	retVal;

	/* Error Checking */
	if(index > RTL8367B_PROTOVLAN_GIDX_MAX)
		return RT_ERR_VLAN_PROTO_AND_PORT;

    if(pPbCfg->frameType >= PPVLAN_FRAME_TYPE_END )
		return RT_ERR_INPUT;

	frameType = pPbCfg->frameType;
	etherType = pPbCfg->etherType;

	/* Frame type */
    retVal = rtl8367b_setAsicRegBits(RTL8367BG_VLAN_PPB_FRAMETYPE_REG(index), RTL8367BG_VLAN_PPB_FRAMETYPE_MASK, frameType);
    if(retVal != RT_ERR_OK)
        return retVal;

	/* Ether type */
	retVal = rtl8367b_setAsicReg(RTL8367B_VLAN_PPB_ETHERTYPR_REG(index), etherType);
    if(retVal != RT_ERR_OK)
        return retVal;

    return RT_ERR_OK;
}
/* Function Name:
 *      rtl8367b_setAsic1xProcConfig
 * Description:
 *      Set 802.1x unauth. behavior configuration
 * Input:
 *      port 	- Physical port number (0~7)
 *      proc 	- 802.1x unauth. behavior configuration 0:drop 1:trap to CPU 2:Guest VLAN
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_PORT_ID  	- Invalid port number
 *      RT_ERR_DOT1X_PROC  	- Unauthorized behavior error
 * Note:
 *      None
 */
ret_t rtl8367b_setAsic1xProcConfig(rtk_uint32 port, rtk_uint32 proc)
{
	if(port >= RTL8367B_PORTNO)
		return RT_ERR_PORT_ID;

	if(proc >= DOT1X_UNAUTH_END)
		return RT_ERR_DOT1X_PROC;

	return rtl8367b_setAsicRegBits(RTL8367B_DOT1X_UNAUTH_ACT_BASE, RTL8367B_DOT1X_UNAUTH_ACT_MASK(port),proc);
}
/* Function Name:
 *      rtl8367b_setAsicEgressFlowControlPortDropThreshold
 * Description:
 *      Set port-based egress flow control turn on or ingress flow control drop on threshold
 * Input:
 *      port 		- Physical port number (0~7)
 *      threshold 	- Queue-based flown control/drop turn ON threshold
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_PORT_ID 		- Invalid port number
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicEgressFlowControlPortDropThreshold(rtk_uint32 port, rtk_uint32 threshold)
{
    if(port > RTL8367B_PORTIDMAX)
      return RT_ERR_PORT_ID;

    if(threshold >= RTL8367B_PAGE_NUMBER)
      return RT_ERR_OUT_OF_RANGE;

    return rtl8367b_setAsicRegBits(RTL8367B_FLOWCTRL_PORT_DROP_ON_REG(port), RTL8367B_FLOWCTRL_PORT_DROP_ON_MASK, threshold);
}
/* Function Name:
 *      rtl8367b_setAsicEgressFlowControlQueueDropThreshold
 * Description:
 *      Set Queue-based egress flow control turn on or ingress flow control drop on threshold
 * Input:
 *      qid 		- The queue id
 *      threshold 	- Queue-based flown control/drop turn ON threshold
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 			- Success
 *      RT_ERR_SMI  		- SMI access error
 *      RT_ERR_OUT_OF_RANGE - input parameter out of range
 *      RT_ERR_QUEUE_ID 	- Invalid queue id
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicEgressFlowControlQueueDropThreshold(rtk_uint32 qid, rtk_uint32 threshold)
{
    if( threshold >= RTL8367B_PAGE_NUMBER)
        return RT_ERR_OUT_OF_RANGE;
    
    if(qid > RTL8367B_QIDMAX)
        return RT_ERR_QUEUE_ID;

    return rtl8367b_setAsicRegBits(RTL8367B_FLOWCTRL_QUEUE_DROP_ON_REG(qid), RTL8367B_FLOWCTRL_QUEUE_DROP_ON_MASK, threshold);
}
/* Function Name:
 *      rtl8367b_setAsicVlanAccpetFrameType
 * Description:
 *      Set per-port acceptable frame type
 * Input:
 *      port 		- Physical port number (0~7)
 *      frameType 	- The acceptable frame type
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 						- Success
 *      RT_ERR_SMI  					- SMI access error
 *      RT_ERR_PORT_ID  				- Invalid port number
 *      RT_ERR_VLAN_ACCEPT_FRAME_TYPE  	- Invalid frame type
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicVlanAccpetFrameType(rtk_uint32 port, rtl8367b_accframetype frameType)
{
    if(port > RTL8367B_PORTIDMAX)
        return RT_ERR_PORT_ID;

    if(frameType >= FRAME_TYPE_MAX_BOUND)
        return RT_ERR_VLAN_ACCEPT_FRAME_TYPE;

    return rtl8367b_setAsicRegBits(RTL8367B_VLAN_ACCEPT_FRAME_TYPE_REG(port), RTL8367B_VLAN_ACCEPT_FRAME_TYPE_MASK(port), frameType);
}
/* Function Name:
 *      rtl8367b_setAsicVlanEgressTagMode
 * Description:
 *      Set CVLAN egress tag mode
 * Input:
 *      port 		- Physical port number (0~7)
 *      tagMode 	- The egress tag mode. Including Original mode, Keep tag mode and Priority tag mode
 * Output:
 *      None
 * Return:
 *      RT_ERR_OK 		- Success
 *      RT_ERR_SMI  	- SMI access error
 *      RT_ERR_INPUT  	- Invalid input parameter
 *      RT_ERR_PORT_ID  - Invalid port number
 * Note:
 *      None
 */
ret_t rtl8367b_setAsicVlanEgressTagMode(rtk_uint32 port, rtl8367b_egtagmode tagMode)
{
    if(port > RTL8367B_PORTIDMAX)
        return RT_ERR_PORT_ID;

    if(tagMode >= EG_TAG_MODE_END)
        return RT_ERR_INPUT;

    return rtl8367b_setAsicRegBits(RTL8367B_PORT_MISC_CFG_REG(port), RTL8367B_VLAN_EGRESS_MDOE_MASK, tagMode);
}