/*
@func ret_t | rtl8370_setAsicVlanPortBasedVID | Set port based VID which is indexed to 32 VLAN member configurations.
@parm uint32 | port | Physical port number (0~15).
@parm uint32 | index | Index to VLAN member configuration (0~31).
@parm uint32 | pri | 1Q Port based VLAN priority (0~7).
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_VLAN_PRIORITY | Invalid priority
@rvalue RT_ERR_VLAN_ENTRY_NOT_FOUND | Invalid VLAN member configuration index (0~31).
@rvalue RT_ERR_PORT_ID | Invalid port number.
@comm
    This API can Set Port-Based VLAN setting
    In port based VLAN, untagged packets recieved by port N are forwarded to a VLAN according to the setting VID of port N. 
    Usage of VLAN 4k table is enabled and there are only VID and 802.1q priority retrieved from 32 member configurations . 
    Member set, untag set and FID of port based VLAN are be retrieved from 4K mapped VLAN entry.
    
*/
ret_t rtl8370_setAsicVlanPortBasedVID(uint32 port, uint32 index, uint32 pri)
{
    uint32 regAddr, bit_mask;
    ret_t  retVal;

    if(port > RTL8370_PORTIDMAX)
        return RT_ERR_PORT_ID;

    if(index > RTL8370_CVIDXMAX)
        return RT_ERR_VLAN_ENTRY_NOT_FOUND;

    if(pri > RTL8370_PRIMAX) 
        return RT_ERR_VLAN_PRIORITY;

    regAddr = RTL8370_VLAN_PVID_CTRL_REG(port);
    bit_mask = RTL8370_PORT_VIDX_MASK(port);
    retVal = rtl8370_setAsicRegBits(regAddr, bit_mask, index);
    if(retVal != RT_ERR_OK)
        return retVal;

    regAddr = RTL8370_VLAN_PORTBASED_PRIORITY_REG(port);
    bit_mask = RTL8370_VLAN_PORTBASED_PRIORITY_MASK(port);
    retVal = rtl8370_setAsicRegBits(regAddr, bit_mask, pri);
    if(retVal != RT_ERR_OK)
        return retVal;

    return RT_ERR_OK;
}
Exemplo n.º 2
0
/*
@func ret_t | rtl8370_setAsicPortMirror | Configure port mirror function.
@parm uint32 | source | Source port no.
@parm uint32 | monitor | Monitor (destination) port. 
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_PORT_ID | Invalid port number.
@comm
    System supports one set of port mirror function. Mirrored port will be checked if mirror receiving frame or mirror transmitting frame to monitor port.   
*/
ret_t rtl8370_setAsicPortMirror(uint32 source, uint32 monitor)
{
    ret_t retVal;

    if((source > RTL8370_PORTIDMAX) || (monitor > RTL8370_PORTIDMAX))
        return RT_ERR_PORT_ID;

    retVal = rtl8370_setAsicRegBits(RTL8370_MIRROR_CTRL_REG, RTL8370_MIRROR_SOURCE_PORT_MASK, source);
    if(retVal !=  RT_ERR_OK)
        return retVal;

    return rtl8370_setAsicRegBits(RTL8370_MIRROR_CTRL_REG, RTL8370_MIRROR_MONITOR_PORT_MASK, monitor);
}
/*
@func ret_t | rtl8370_setAsicVlanPortAndProtocolBased | Set protocol and port based VLAN configuration. 
@parm uint32 | port | Physical port number (0~15).
@parm uint32 | index | Index of protocol and port based database index.
@parm rtl8370_protocolvlancfg* | ptr_ppbcfg | Protocol and port based VLAN configuration.
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_PORT_ID | Invalid port number.
@rvalue RT_ERR_OUT_OF_RANGE | input out of range.
@comm
    Each port has 4 VLAN configurations for each protocol and port based group database. 
    Protocol and port based VLAN configuration contained 1 valid bit setting for each 
    group database entry. There is 802.1q priority field setting for each group database 
    entry. Different with port based VLAN information retrieving, ASIC decided 802.1q priority 
    of reveiving frame from dedicated port based VLAN configuration and didn't decide from 
    priority field of system VLAN 16 member configurations.
    
*/
ret_t rtl8370_setAsicVlanPortAndProtocolBased(uint32 port, uint32 index, rtl8370_protocolvlancfg *ptr_ppbcfg)
{
    uint32  reg_addr, bit_mask, bit_value;
    ret_t   retVal;

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

    if(index > RTL8370_PROTOVLAN_GIDX_MAX)
        return RT_ERR_OUT_OF_RANGE;

    if(NULL == ptr_ppbcfg)
        return RT_ERR_INPUT;

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

    if(ptr_ppbcfg->vlan_idx > RTL8370_CVIDXMAX)
        return RT_ERR_VLAN_ENTRY_NOT_FOUND;

    if(ptr_ppbcfg->priority > RTL8370_PRIMAX)
        return RT_ERR_VLAN_PRIORITY;

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

    /* Calculate the actual register address for CVLAN index*/
    reg_addr = RTL8370_VLAN_PPB_CTRL_REG(index,port);
    bit_mask = RTL8370_VLAN_PPB_CTRL_MASK(port);
    bit_value = ptr_ppbcfg->vlan_idx;
    
       retVal    = rtl8370_setAsicRegBits(reg_addr, bit_mask, bit_value);
    if(retVal != RT_ERR_OK)
        return retVal;

    /* write priority */
    reg_addr  = RTL8370_VLAN_PPB_PRIORITY_ITEM_REG(port,index);
    bit_mask  = RTL8370_VLAN_PPB_PRIORITY_ITEM_MASK(port);
    bit_value = ptr_ppbcfg->priority;
    retVal    = rtl8370_setAsicRegBits(reg_addr, bit_mask, bit_value);
    if(retVal != RT_ERR_OK)
        return retVal;

    return RT_ERR_OK;
}
/*
@func ret_t | rtl8370_setAsicUnknownMulticastTrapPriority | Set trap priority of unknown multicast frame
@parm uint32 | priority | priority (0~7)
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_QOS_INT_PRIORITY | Invalid priority.
@comm
*/
ret_t rtl8370_setAsicUnknownMulticastTrapPriority(uint32 priority)
{
    if(priority > RTL8370_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

    return rtl8370_setAsicRegBits(RTL8370SG_QOS_TRAP_PRIORITY_CTRL0_REG, RTL8370_UNKNOWN_MC_PRIORTY_MASK, priority);
}
ret_t rtl8370_setAsicOamCpuPri(uint32 priority)
{
    if(priority > RTL8370_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

    return rtl8370_setAsicRegBits(RTL8370_REG_QOS_TRAP_PRIORITY0, RTL8370_OAM_PRIOIRTY_MASK, priority);
}
Exemplo n.º 6
0
/*
@func ret_t | rtl8370_setAsicPortUnknownDaBehavior | Set UNDA behavior
@parm uint32 | behavior | 0: flooding; 1: drop; 2:trap
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_NOT_ALLOWED | Invalid behavior.
@comm
    The API set the behavior switch when the DA of received packet is unknown
*/
ret_t rtl8370_setAsicPortUnknownDaBehavior(uint32 behavior)
{
    if(behavior >= L2_BEHAV_MAX)
        return RT_ERR_NOT_ALLOWED;

    return rtl8370_setAsicRegBits(RTL8370_PORT_SECURIT_CTRL_REG, RTL8370_UNKNOWN_UNICAST_DA_BEHAVE_MASK, behavior);
}
/*
@func ret_t | rtl8370_setAsicSvlanTrapPriority | Trap to CPU priority assignment
@parm uint32 | priority | Priority assignment
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_INPUT | Invalid input parameter.
@comm
    The API can set trapping priority to packet from uplink port.

*/
ret_t rtl8370_setAsicSvlanTrapPriority(uint32 priority)
{
    if(priority > RTL8370_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY; 

    return rtl8370_setAsicRegBits(RTL8370_REG_QOS_TRAP_PRIORITY0, RTL8370_SVLAN_PRIOIRTY_MASK,priority);
}
Exemplo n.º 8
0
ret_t _rtl8370_setAsicEeelldpFrameDataReg(uint32 regAddr, uint32 dataLength, int8 *writeDataPtr)
{
    ret_t ret;
    uint32 i;
    uint32 regData;
    uint16 *accessPtr;

    accessPtr = (uint16*)writeDataPtr;

    for(i=0; i < dataLength / 2; i++)
    {
        regData = *accessPtr;
        ret = rtl8370_setAsicReg(regAddr + i, regData);
        if(RT_ERR_OK != ret)
            return ret;

        accessPtr++;
    }
    
    if (dataLength & 0x1)
    {
        regData = *accessPtr;
        ret = rtl8370_setAsicRegBits(regAddr + dataLength / 2, 0xFF, regData);
        if(RT_ERR_OK != ret)
            return ret;
    }

    return RT_ERR_OK;
}
/*
@func ret_t  | rtl8370_setAsic1xTrapPriority | Set 802.1x Trap priority
@parm uint32 | priority | priority (0~7)
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_QOS_INT_PRIORITY | Invalid priority.
@comm
    The API can update the 802.1x trap priority.
*/
ret_t rtl8370_setAsic1xTrapPriority(uint32 priority)
{
    if(priority > RTL8370_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;
    
    return rtl8370_setAsicRegBits(RTL8370SG_QOS_TRAP_PRIORITY_CTRL0_REG, RTL8370_DOT1X_PRIORTY_MASK,priority);
}
/*
@func ret_t  | rtl8370_setAsicGVIndexConfig | Set 802.1x guest vlan index
@parm uint32 | index | 802.1x guest vlan index (0~31)
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_DOT1X_GVLANIDX | Invalid guest vlan index
@comm
    The API can update the 802.1x guest vlan index content.
*/
ret_t rtl8370_setAsic1xGuestVidx(uint32 index)
{
    if(index >= RTL8370_CVLANMCNO)
        return RT_ERR_DOT1X_GVLANIDX;

    return rtl8370_setAsicRegBits(RTL8370_DOT1X_CFG_REG, RTL8370_DOT1X_GVIDX_MASK, index);
}
Exemplo n.º 11
0
/*
@func ret_t | rtl8370_setAsicLutLearnOverAct | Configure auto learn over limit number action.
@parm uint32 | action | Learn over action 0:normal, 1:drop 2:trap. 
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_NOT_ALLOWED | Invalid learn over action
@common
    The API can set ASIC treat SA unknown packet while auto learn limit number is over 
*/
ret_t rtl8370_setAsicLutLearnOverAct(uint32 action)
{
    if(action >= LRNOVERACT_MAX)
        return RT_ERR_NOT_ALLOWED;
        
    return rtl8370_setAsicRegBits(RTL8370_REG_PORT_SECURITY_CTRL, RTL8370_LUT_LEARN_OVER_ACT_MASK, action);
}
/*
@func ret_t | rtl8370_setAsicSvlanDefaultVlan | Configure default egress SVLAN.
@parm uint32 | index | index SVLAN member configuration
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_SVLAN_ENTRY_INDEX | Invalid input SVLAN index.
@comm
    The API can set port n S-tag format index while receiving frame from port n 
    is transmit through uplink port with s-tag field

*/
ret_t rtl8370_setAsicSvlanDefaultVlan(uint32 index)
{
    if(index > RTL8370_SVIDXMAX)
        return RT_ERR_SVLAN_ENTRY_INDEX;

    return rtl8370_setAsicRegBits(RTL8370_REG_SVLAN_CFG, RTL8370_VS_CPSVIDX_MASK,index);        
}
/*
@func ret_t | rtl8370_setAsicLedForceBlinkRate | Set led blinking rate for force mode led.
@parm enum RTL8370_LEDBLINKRATE | blinkRate | Support 4 blink rates.
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@comm
    The API can set LED blink rate for force mode LED at 512ms, 1024ms, 2048ms, or identical to normal mode LED.
 */
ret_t rtl8370_setAsicLedForceBlinkRate(enum RTL8370_LEDFORCERATE blinkRate)
{
    if(blinkRate >=LEDFORCERATE_MAX)
        return RT_ERR_INPUT;

    return rtl8370_setAsicRegBits(RTL8370_REG_LED_MODE, RTL8370_FORCE_RATE_MASK,blinkRate);
}
Exemplo n.º 14
0
/*
@func ret_t | rtl8370_setAsicCputagTrapPort | Set cpu tag trap port
@parm uint32 | port | port number (0~15)
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_PORT_ID  Invalid port number.
@comm
    This API can set destination port of trapping frame
*/
ret_t rtl8370_setAsicCputagTrapPort(uint32 port)
{
    if(port >= RTL8370_PORTNO)
        return RT_ERR_PORT_ID;

    return rtl8370_setAsicRegBits(RTL8370_CPU_CTRL_REG, RTL8370_CPU_TRAP_PORT_MASK, port);    
}
/*
@func ret_t | rtl8370_setAsicLedBlinkRate | Set led blinking rate ate mode 0 to mode 3
@parm enum RTL8370_LEDBLINKRATE | blinkRate | Support 6 blink rates.
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@comm
    The API can set LED blink rate at 43ms, 84ms, 120ms, 170ms, 340ms and 670ms.
 */
ret_t rtl8370_setAsicLedBlinkRate(enum RTL8370_LEDBLINKRATE blinkRate)
{
    if(blinkRate >=LEDBLINKRATE_MAX)
        return RT_ERR_INPUT;

    return rtl8370_setAsicRegBits(RTL8370_REG_LED_MODE, RTL8370_SEL_LEDRATE_MASK,blinkRate);
}
Exemplo n.º 16
0
/*
@func ret_t | rtl8370_setAsicCputagInsertMode | Set ports that can parse CPU tag
@parm uint32 | mode | 0: insert to all packets; 1: insert to trapped packets; 2: don't insert
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_NOT_ALLOWED | Invalid action.
@comm
    This API can set the decision of which frames should be inserted
    with CPU tage. 
*/
ret_t rtl8370_setAsicCputagInsertMode(uint32 mode)
{
    if(mode >= CPUTAG_INSERT_MAX)
        return RT_ERR_NOT_ALLOWED;

    return rtl8370_setAsicRegBits(RTL8370_CPU_CTRL_REG, RTL8370_CPU_INSERTMODE_MASK, mode);
}
Exemplo n.º 17
0
/*
@func ret_t | rtl8370_setAsicCputagPriorityRemapping | Set queue assignment of CPU port
@parm uint32 | srcPri | internal priority (0~7)
@parm uint32 | newPri | internal priority after remapping (0~7)
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_QOS_INT_PRIORITY | Invalid priority.
@comm
    This API can set the priority remapping of frames to CPU port
*/
ret_t rtl8370_setAsicCputagPriorityRemapping(uint32 srcPri, uint32 newPri)
{
    if(srcPri > RTL8370_PRIMAX || newPri > RTL8370_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;

    return rtl8370_setAsicRegBits(RTL8370_QOS_PRIPORITY_REMAPPING_IN_CPU_REG(srcPri), RTL8370_QOS_PRIPORITY_REMAPPING_IN_CPU_MASK(srcPri), newPri);
}
Exemplo n.º 18
0
/*
@func ret_t | rtl8370_setAsicTrunkingGroup | Set trunking group available port mask
@parm uint32 | group | Port trunking group (0~3).
@parm uint32 | portmask | Logic trunking enable port mask, max 4 ports
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_LA_TRUNK_ID | Invalid trunking group
@comm
    The API can set 4 port trunking group enabled port mask. Each port trunking group has max 4 ports.
    If enabled port mask has less than 2 ports available setting, then this trunking group function is disabled.    
 */
ret_t rtl8370_setAsicTrunkingGroup(uint32 group,uint32 portmask)
{
    if(group > RTL8370_TRUNKING_GROUPMAX)
        return RT_ERR_LA_TRUNK_ID;

    return rtl8370_setAsicRegBits(RTL8370_PORT_TRUNK_GROUP_MASK_REG, RTL8370_PORT_TRUNK_GROUP_MASK_MASK(group), portmask);
}
/*
@func ret_t | rtl8370_setAsicSvlanPrioritySel | SVLAN priority field setting
@parm uint32 | prisel | S-priority assignment method, 0:internal priority 1:C-tag priority 2:using Svlan member configuration
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_INPUT | Invalid input parameter.
@comm
    The API can set S-priority assignment method for S-tag frame output from uplink port 
*/
ret_t rtl8370_setAsicSvlanPrioritySel(uint32 prisel)
{
    if(prisel >= SPRISEL_MAX)
        return RT_ERR_INPUT;
    
    return rtl8370_setAsicRegBits(RTL8370_REG_SVLAN_CFG, RTL8370_VS_SPRISEL_MASK, prisel);
}
Exemplo n.º 20
0
/*
@func ret_t | rtl8370_setAsicPortUnmatchedSaBehavior | Set Unmatched SA behavior
@parm uint32 | behavior | 0: flooding; 1: drop; 2:trap
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_NOT_ALLOWED | Invalid behavior.
@comm
    The API set the behavior switch when the SA and SPA of received packet are unmatched
*/
ret_t rtl8370_setAsicPortUnmatchedSaBehavior(uint32 behavior)
{
    if(behavior >= L2_BEHAV_MAX)
        return RT_ERR_NOT_ALLOWED;

    return rtl8370_setAsicRegBits(RTL8370_PORT_SECURIT_CTRL_REG, RTL8370_UNMATCHED_SA_BEHAVE_MASK, behavior);
}
Exemplo n.º 21
0
/*
@func ret_t | rtl8370_setAsicTrunkingHashSelect | Set port trunking hash select sources
@parm uint32 | hashsel | hash sources mask
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_LA_HASHMASK | Hash algorithm selection error.
@comm
    The API can set port trunking hash algorithm sources.
    7 bits mask for link aggregation group0 hash parameter selection {DIP, SIP, DMAC, SMAC, SPA}
    0b0000001: SPA
    0b0000010: SMAC
    0b0000100: DMAC
    0b0001000: SIP
    0b0010000: DIP
    0b0100000: TCP/UDP Source Port
    0b1000000: TCP/UDP Destination Port
    Example:
    0b0000011: SMAC & SPA
    Note that it could be an arbitrary combination or independent set
 */
ret_t rtl8370_setAsicTrunkingHashSelect(uint32 hashsel)
{
    if (hashsel > RTL8370_PORT_TRUNK_HASH_MASK)
        return RT_ERR_LA_HASHMASK;

    return rtl8370_setAsicRegBits(RTL8370_REG_PORT_TRUNK_CTRL, RTL8370_PORT_TRUNK_HASH_MASK, hashsel);
}
Exemplo n.º 22
0
/*
@func ret_t | rtl8370_setAsicVlanProtocolBasedGroupData | Set protocol and port based group database.
@parm uint32 | index | Index of protocol and port based database index (0~7).
@parm rtl8370_protocolgdatacfg* | ptr_pbcfg | Protocol and port based group database entry.
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_OUT_OF_RANGE | input out of range.
@comm
    This API can set protocol and port based group database.
    System supported only 4 entries and 3 types of frame format. Supported frame types are defined 
    as Ethernet (frame type = 0b00, Ether type > 0x05FF), RFC 1042 (frame type = 0b01,6 bytes after 
    Type/Length = AA-AA-03-00-00-00) and LLC other(frame type = 0b10). ASIC has available setting of
    each frame type per port and available system setting each defined frame type. If per system 
    frame type is set to invalid, then per port frame setting is take no effect. There is contained 
    valid bit setting in each group database.    
*/
ret_t rtl8370_setAsicVlanProtocolBasedGroupData(uint32 index, rtl8370_protocolgdatacfg *ptr_pbcfg)
{
    uint32  frame_type;
    uint32  ether_type;
    ret_t    retVal;

    /* Error Checking */
    if(index > RTL8370_PROTOVLAN_GIDX_MAX)
        return RT_ERR_OUT_OF_RANGE;

    if(NULL == ptr_pbcfg)
        return RT_ERR_INPUT;

    if(ptr_pbcfg->frame_type >= PPVLAN_FRAME_TYPE_MAX_BOUND )
        return RT_ERR_INPUT;

    if((ptr_pbcfg->frame_type==PPVLAN_FRAME_TYPE_ETHERNET)&&(ptr_pbcfg->ether_type<0x0600)&&(ptr_pbcfg->ether_type!=0))
        return RT_ERR_INPUT;    

    frame_type = ptr_pbcfg->frame_type;
    ether_type = ptr_pbcfg->ether_type;

    /* Frame type */
    retVal = rtl8370_setAsicRegBits(RTL8370SG_VLAN_PPB_FRAMETYPE_REG(index), RTL8370SG_VLAN_PPB_FRAMETYPE_MASK, frame_type);
    if(retVal != RT_ERR_OK)
        return retVal;
    
    /* Ether type */
    retVal = rtl8370_setAsicReg(RTL8370_VLAN_PPB_ETHERTYPR_REG(index), ether_type);
    if(retVal != RT_ERR_OK)
        return retVal;

    return RT_ERR_OK;
}
Exemplo n.º 23
0
/*
@func ret_t | rtl8370_setAsicEeelldpSubtype | Set eeelldp frame subtype of ASIC.
@parm uint32 | subtype | (0~0xFF).
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_INPUT | Invalid input parameter.
@comm
    This API set subtype of EEELLDP.
    The subtype is used to identify a eeelldp frame
*/
ret_t rtl8370_setAsicEeelldpSubtype(uint32 subtype)
{
    if (subtype > 0xFF)
        return RT_ERR_INPUT;
    
    return rtl8370_setAsicRegBits(RTL8370_EEELLDP_CTRL0_REG, RTL8370_EEELLDP_SUBTYPE_MASK, subtype);
}
Exemplo n.º 24
0
/*
@func ret_t | rtl8370_setAsicEeelldpTrapCpuPri | Set trap eeelldp trap to CPU priority.
@parm uint32 | priority | trap to CPU priority (0~7).
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_INPUT | Invalid input parameter.
@comm
    This API set the priority of EEELLDP pakcet trapping to CPU.
    If EEELLDP function is enabled, upon receiving an eeelldp frame,
    ASIC will trap the eeelldp frame to 8051
*/
ret_t rtl8370_setAsicEeelldpTrapCpuPri(uint32 priority)
{
    if (priority > RTL8370_PRIMAX)
        return RT_ERR_QOS_INT_PRIORITY;
    
    return rtl8370_setAsicRegBits(RTL8370SG_QOS_TRAP_PRIORITY_CTRL1_REG, RTL8370_EEELLDP_TRAP_PRI_MASK, priority);
}
ret_t rtl8370_setAsicSpecialCongestModeConfig(uint32 port, uint32 sustain)
{
    if(port >= RTL8370_PORTNO)
        return RT_ERR_PORT_ID;
    if(sustain > RTL8370_SPECIALCONGEST_SUSTAIN_TIMERMAX)
        return RT_ERR_OUT_OF_RANGE;

    return rtl8370_setAsicRegBits(RTL8370_PORT_MISC_CFG_REG(port), RTL8370_SPECIALCONGEST_SUSTAIN_TIMER_MASK, sustain);
}
/*
@func ret_t | rtl8370_setAsicStormFilterBroadcastMeter | Set per-port broadcast storm filter meter.
@parm uint32 | port | port number (0~15).
@parm uint32 | meter | meter index (0~63).
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_PORT_ID | Invalid port number.
@rvalue RT_ERR_FILTER_METER_ID | Invalid meter index
@comm
    This API set per-port broadcast stomr filter meter
    Broadcast storm filters of each port point to some meters. If 
    broadcast storm filter of port n is enabled, data length of
    broadcast packet will be included in the meter pointed by port
    n to elminate broadcast packet egress rate.
*/
ret_t rtl8370_setAsicStormFilterBroadcastMeter(uint32 port, uint32 meter)
{
    if(port >= RTL8370_PORTNO)
        return RT_ERR_PORT_ID;

    if(meter > RTL8370_METERMAX)
        return RT_ERR_FILTER_METER_ID;

    return rtl8370_setAsicRegBits(RTL8370_STORM_BCAST_METER_CRTL_REG(port), RTL8370_STORM_BCAST_METER_CRTL_MASK(port), meter);
}
/*
@func ret_t  | rtl8370_setAsic1xProcConfig | Set 802.1x unauth. behavior configuration
@parm uint32 | port | Physical port number.
@parm uint32 | proc | 802.1x unauth. behavior configuration 0:drop 1:trap to CPU 2:Guest VLAN
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_DOT1X_PROC | Invalid input parameter.
@rvalue RT_ERR_PORT_ID | Invalid port number.
@comm
    The API can update the 802.1x unauth. behavior content.
*/
ret_t rtl8370_setAsic1xProcConfig(uint32 port, uint32 proc)
{
    if(port >= RTL8370_PORTNO)
        return RT_ERR_PORT_ID;

    if(proc >= DOT1X_UNAUTH_MAX)
        return RT_ERR_DOT1X_PROC;

    return rtl8370_setAsicRegBits(RTL8370_DOT1X_UNAUTH_ACT_REG(port), RTL8370_DOT1X_UNAUTH_ACT_MASK(port),proc);
}
/*
@func ret_t | rtl8370_setAsicPortIsolationEfid | Set port isolation EFID
@parm uint32 | port | Physical port number (0~15).
@parm uint32 | efid | EFID (0~7)
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error. 
@rvalue RT_ERR_PORT_ID | Invalid port number.
@rvalue RT_ERR_OUT_OF_RANGE | input out of range.
@comm
    This API set the EFID of each port.
    EFID is used in individual learning in filtering database
*/
ret_t rtl8370_setAsicPortIsolationEfid(uint32 port, uint32 efid)
{
    if(port >= RTL8370_PORTNO)
        return RT_ERR_PORT_ID;

    if(efid > RTL8370_EFIDMAX)
        return RT_ERR_OUT_OF_RANGE;

    return rtl8370_setAsicRegBits(RTL8370_PORT_EFID_REG(port), RTL8370_PORT_EFID_MASK(port), efid);
}
Exemplo n.º 29
0
/*
@func ret_t | rtl8370_setAsicLeakyBucketParameter | Set Leaky Bucket Paramters.
@parm uint32 | tick | Tick is used for time slot size unit.
@parm uint32 | token | Token is used for adding budget in each time slot.
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_TICK | Invalid TICK.
@rvalue RT_ERR_TOKEN | Invalid TOKEN.
@comm
    The API can set leaky bucket parameters as token and tick.
    The default suggesting values of (tick, token) are (0x77, 0x62).
 */
ret_t rtl8370_setAsicLeakyBucketParameter(uint32 tick, uint32 token)
{
    ret_t retVal;

    if(tick > 0xFF)
        return RT_ERR_TICK;

    if(token > 0xFF)
        return RT_ERR_TOKEN;
        
    retVal = rtl8370_setAsicRegBits(RTL8370_LEAKY_BUCKET_TICK_REG, RTL8370_LEAKY_BUCKET_TICK_MASK, tick);

    if(retVal != RT_ERR_OK)
        return retVal;

    retVal = rtl8370_setAsicRegBits(RTL8370_LEAKY_BUCKET_TOKEN_REG, RTL8370_LEAKY_BUCKET_TOKEN_MASK, token);

    return retVal;
}
Exemplo n.º 30
0
/*
@func ret_t | rtl8370_setAsicLutAgeTimerSpeed | Set LUT agging out speed
@parm uint32 | timer | Agging out timer 0:Has been aged out.
@parm uint32 | speed | Agging out speed 0-fastest 3-slowest.
@rvalue RT_ERR_OK | Success.
@rvalue RT_ERR_SMI | SMI access error.
@rvalue RT_ERR_OUT_OF_RANGE | LUT aging parameter out of range.
@comm
     The API can set LUT agging out period for each entry. Differet {timer, speed} parameter will make asic do agging out task
     at different period time. Following description is times period for different timer,speed combination setting.
            Timer        1        2        3        4        5        6        7
    Speed
    0                    14.3s    28.6s    42.9s    57.2s    1.19m    1.43m    1.67m
    1                    28.6s    57.2s    1.43m    1.9m     2.38m    2.86m    3.34m
    2                    57.2s    1.9m     2.86m    3.81m    4.77m    5.72m    6.68m
    3                    1.9m     3.8m     5.72m    7.63m    9.54m    11.45m   13.36m
     (s:Second m:Minute)
 */
ret_t rtl8370_setAsicLutAgeTimerSpeed( uint32 timer, uint32 speed)
{
    if(timer > RTL8370_LUT_AGETIMERMAX)
        return RT_ERR_OUT_OF_RANGE;

    if(speed > RTL8370_LUT_AGESPEEDMAX)
        return RT_ERR_OUT_OF_RANGE;
    
    return rtl8370_setAsicRegBits(RTL8370_REG_LUT_CFG, RTL8370_AGE_TIMER_MASK | RTL8370_AGE_SPEED_MASK, (timer << RTL8370_AGE_TIMER_OFFSET) | (speed << RTL8370_AGE_SPEED_OFFSET));        
}