Ejemplo n.º 1
0
MV_STATUS mvNfpSecDbClear(MV_VOID)
{
	MV_U32 i;
	MV_NFP_SEC_SPD_RULE *pCurrSpdInRule, *pCurrSpdOutRule;
	MV_NFP_SEC_SA_ENTRY *pCurrSAInEntery, *pCurrSAOutEntery;

	if ((spdInDb == NULL) && (spdOutDb == NULL) && (saInDb == NULL) && (saOutDb == NULL))
		return MV_NOT_INITIALIZED;

	/* assume all 4 DBs are initialized */
	for (i = 0; i < secDbSize; i++) {
		pCurrSpdInRule = (spdInDb + i);
		pCurrSpdOutRule = (spdOutDb + i);
		pCurrSAInEntery = (saInDb + i);
		pCurrSAOutEntery = (saOutDb + i);
		mvOsFree(pCurrSpdInRule);
		mvOsFree(pCurrSpdOutRule);
		mvOsFree(pCurrSAInEntery);
		mvOsFree(pCurrSAOutEntery);
	}

	spdInDb = spdOutDb = NULL;
	saInDb = saOutDb = NULL;

	return MV_OK;
}
Ejemplo n.º 2
0
MV_STATUS mvCesaIfFinish(void)
{
	if(MV_CESA_CHANNELS > 1) {
		/* Free results queues */
		mvOsFree(pResQueue);
		mvOsFree(resQueue);
	}

	return mvCesaFinish();
}
Ejemplo n.º 3
0
/* Purpose: Delete existing stack
 * Inputs:
 *	- void*		stackHndl	- Stack handle as returned by "mvStackCreate()" function
 *
 * Return: MV_STATUS	MV_NOT_FOUND - Failure. StackHandle is not valid.
 *						MV_OK        - Success.
 */
MV_STATUS   mvStackDelete(void* stackHndl)
{
	MV_STACK*   pStack = (MV_STACK*)stackHndl;

	if( (pStack == NULL) || (pStack->stackElements == NULL) )
		return MV_NOT_FOUND;

    mvOsFree(pStack->stackElements);
    mvOsFree(pStack);

    return MV_OK;
}
Ejemplo n.º 4
0
/*******************************************************************************
* mvEthTxPolicyDel - Delete TX policy for packets with special MACDA.
*
* DESCRIPTION:
*       This function deletes existing TX policy for outgoing packets with 
*   special MAC DAs.. 
*
* INPUT:
*       void*	pTxPolHndl  - TX Policy component handler
*       MV_U8*  pMacAddr    - Pointer to MACDA for the entry will be deleted.
*
* RETURN:   MV_STATUS
*       MV_OK       - Success
*       MV_FAIL     - Failed. 
*
*******************************************************************************/
MV_STATUS	mvEthTxPolicyDel(void* pTxPolHndl, MV_U8* pMacAddr)
{
    int             idx; 
    ETH_TX_POLICY*  pTxPolicy = (ETH_TX_POLICY*)pTxPolHndl;

    for(idx=0; idx<pTxPolicy->txPolMaxDa; idx++)
    {
        if( (pTxPolicy->txPolDa[idx].policy.txQ != MV_INVALID) && 
            (memcmp(pTxPolicy->txPolDa[idx].macDa, pMacAddr, 
                                        MV_MAC_ADDR_SIZE) == 0) )
        {
            /* Entry found */
            pTxPolicy->txPolDa[idx].policy.txQ = MV_INVALID;
	    if(pTxPolicy->txPolDa[idx].policy.pHeader != NULL)
	    {
	    	mvOsFree(pTxPolicy->txPolDa[idx].policy.pHeader);
		pTxPolicy->txPolDa[idx].policy.pHeader = NULL;
		pTxPolicy->txPolDa[idx].policy.headerSize = 0;
	    }

            if(idx == (pTxPolicy->txPolMaxDa - 1))
                pTxPolicy->txPolMaxDa--;

            /* Decrease table */
            while( (pTxPolicy->txPolMaxDa > 0) && 
                   (pTxPolicy->txPolDa[pTxPolicy->txPolMaxDa-1].policy.txQ == MV_INVALID) )
                pTxPolicy->txPolMaxDa--;

            return MV_OK;
        }
    }
    mvOsPrintf("ethTxPolicy: Can't delete the MACDA entry\n");
    return MV_NO_SUCH;
}
Ejemplo n.º 5
0
static MV_STATUS mvTdmChRemove(MV_U8 ch)
{
	MV_TDM_CH_INFO *chInfo;
	MV_U8 buff;

	MV_TRC_REC("->%s ch%d\n",__FUNCTION__,ch);

	if(ch >= MV_TDM_TOTAL_CHANNELS)
	{
		mvOsPrintf("%s: error, channel(%d) exceeds maximum(%d)\n",__FUNCTION__, ch, MV_TDM_TOTAL_CHANNELS);
		return MV_BAD_PARAM;
	}

	chInfo = tdmChInfo[ch];

	for(buff = 0; buff < TOTAL_BUFFERS; buff++)
	{
		mvOsIoUncachedFree(NULL, MV_TDM_CH_BUFF_SIZE(pcmFormat, tdmBandMode, factor), chInfo->rxBuffPhys[buff],
					chInfo->rxBuffVirt[buff],0);
		mvOsIoUncachedFree(NULL, MV_TDM_CH_BUFF_SIZE(pcmFormat, tdmBandMode, factor), chInfo->txBuffPhys[buff],
					chInfo->txBuffVirt[buff],0);
	}

	mvOsFree(chInfo);

	MV_TRC_REC("<-%s ch%d\n",__FUNCTION__,ch);
	return MV_OK;
}
/* Delete a specified rule from the Routing + ARP information table */
MV_STATUS mvFpRuleDelete(MV_FP_RULE *rule)
{
	MV_U32 hash, hash_tr;
	MV_FP_RULE *currRule, *prevRule;

	nfpRuleDeleteCount++;
	hash = mv_jhash_3words(rule->routingInfo.dstIp, rule->routingInfo.srcIp, (MV_U32) 0, fp_ip_jhash_iv);
	hash_tr = hash & (ruleDbSize - 1);

	prevRule = NULL;
	for (currRule = ruleDb[hash_tr].ruleChain; currRule != NULL; prevRule = currRule, currRule = currRule->next) {
		if ((currRule->routingInfo.srcIp == rule->routingInfo.srcIp) &&
		    (currRule->routingInfo.dstIp == rule->routingInfo.dstIp)) {
			if (prevRule == NULL)
				ruleDb[hash_tr].ruleChain = currRule->next;
			else
				prevRule->next = currRule->next;
#ifdef MV_FP_DEBUG
			mvOsPrintf("DelNFP_%03u: DIP=%u.%u.%u.%u, SIP=%u.%u.%u.%u, hash=0x%04x\n",
				   nfpRuleDeleteCount, MV_IP_QUAD(currRule->routingInfo.dstIp),
				   MV_IP_QUAD(currRule->routingInfo.srcIp), hash_tr);
#endif
			mvOsFree(currRule);
			return MV_OK;
		}
	}
	return MV_NOT_FOUND;
}
Ejemplo n.º 7
0
/* Delete all elements in a given list and free the list head */
MV_STATUS mvListDestroy(MV_LIST_ELEMENT *head)
{
	MV_LIST_ELEMENT *curr, *tmp;

#ifdef MV_LIST_SANITY_CHECKS
	/* sanity check */
	if (!head) {
		mvOsPrintf("%s ERROR: trying to destroy uninitialized list\n", __func__);
		return MV_ERROR;
	}
#endif /* MV_LIST_SANITY_CHECKS */

	/* delete all elements in the list */
	/* skip list head, it never contains real data */
	curr = head->next;
	while (curr) {
		tmp = curr;
		curr = curr->next;
		mvListDel(tmp);
	}

	/* free the list head */
	mvOsFree(head);

	return MV_OK;
}
Ejemplo n.º 8
0
/* Purpose: Create new stack
 * Inputs:
 *	- MV_U32	noOfElements	- maximum number of elements in the stack.
 *                              Each element 4 bytes size
 * Return: void* - pointer to created stack.
 */
void *mvStackCreate(int numOfElements)
{
    MV_STACK *pStack;
    MV_U32 *pStackElements;

    pStack = (MV_STACK *) mvOsMalloc(sizeof(MV_STACK));
    pStackElements = (MV_U32 *) mvOsMalloc(numOfElements * sizeof(MV_U32));
    if ((pStack == NULL) || (pStackElements == NULL)) {
        mvOsPrintf("mvStack: Can't create new stack\n");
        if (pStack)
            mvOsFree(pStack);
        if (pStackElements)
            mvOsFree(pStackElements);
        return NULL;
    }
    memset(pStackElements, 0, numOfElements * sizeof(MV_U32));
    pStack->numOfElements = numOfElements;
    pStack->stackIdx = 0;
    pStack->stackElements = pStackElements;

    return pStack;
}
Ejemplo n.º 9
0
int __devinit mv_l2fw_init(void)
{
    int size, port;
    MV_U32 bytes;
    MV_U32 regVal;
    mv_eth_ports_l2fw_num = mvCtrlEthMaxPortGet();
    mvOsPrintf("in %s: mv_eth_ports_l2fw_num=%d\n", __func__, mv_eth_ports_l2fw_num);
    size = mv_eth_ports_l2fw_num * sizeof(struct eth_port_l2fw *);
    mv_eth_ports_l2fw = mvOsMalloc(size);
    if (!mv_eth_ports_l2fw)
        goto oom;
    memset(mv_eth_ports_l2fw, 0, size);
    for (port = 0; port < mv_eth_ports_l2fw_num; port++) {
        mv_eth_ports_l2fw[port] =
            mvOsMalloc(sizeof(struct eth_port_l2fw));
        if (!mv_eth_ports_l2fw[port])
            goto oom1;
        mv_eth_ports_l2fw[port]->cmd    = L2FW_DISABLE;
        mv_eth_ports_l2fw[port]->txPort = -1;
    }

    bytes = sizeof(L2FW_RULE *) * L2FW_HASH_SIZE;
    l2fw_jhash_iv = mvOsRand();

    l2fw_hash = (L2FW_RULE **)mvOsMalloc(bytes);
    if (l2fw_hash == NULL) {
        mvOsPrintf("l2fw hash: not enough memory\n");
        return MV_NO_RESOURCE;
    }

    mvOsMemset(l2fw_hash, 0, bytes);

    mvOsPrintf("L2FW hash init %d entries, %d bytes\n", L2FW_HASH_SIZE, bytes);
    regVal = 0;
#ifdef CONFIG_MV_ETH_L2SEC
    cesa_init();
#endif

#ifdef CONFIG_MV_INCLUDE_XOR
    setXorDesc();
#endif
    return 0;
oom:
    mvOsPrintf("%s: out of memory in L2FW initialization\n", __func__);
oom1:
    mvOsFree(mv_eth_ports_l2fw);
    return -ENOMEM;

}
Ejemplo n.º 10
0
MV_STATUS mvFpFdbRuleDel(MV_FP_FDB_RULE *oldrule)
{
	MV_U32 hash;
	MV_FP_FDB_RULE* rule, *prev;

	/* ignore foreign ifindex */
	if (oldrule->fdbInfo.ifIndex >= ETH_FP_IFINDEX_MAX)
		return MV_OUT_OF_RANGE;

	if (oldrule->fdbInfo.flags & MV_FP_FDB_IS_LOCAL) {
		fdbMember[oldrule->fdbInfo.ifIndex] = 0;
		fdbMember[oldrule->fdbInfo.bridge] = 0;
		MV_NFP_DBG("NFP (fdb): del member bridge=%d ifIndex=%d\n", 
                oldrule->fdbInfo.bridge, oldrule->fdbInfo.ifIndex);
	}

	hash = mvFpFdbRuleHash(oldrule);
	hash &= (fdbRuleDbSize - 1);

	rule = fdbRuleDb[hash].ruleChain;    
	prev = NULL;

	while (rule) {
		if (!mvFpFdbRuleCmp(&rule->fdbInfo, &oldrule->fdbInfo)) {

			if (prev)
				prev->next = rule->next;
			else
				fdbRuleDb[hash].ruleChain = rule->next;

            fdbRuleDeleteCount++;
			MV_NFP_DBG("NFP (fdb): del bridge=%d ifIndex=%d %02X:%02X:%02X:%02X:%02X:%02X flags=%x count=%d\n",
					rule->fdbInfo.bridge, rule->fdbInfo.ifIndex,
					rule->fdbInfo.mac[0], rule->fdbInfo.mac[1], rule->fdbInfo.mac[2], 
					rule->fdbInfo.mac[3], rule->fdbInfo.mac[4], rule->fdbInfo.mac[5], 
					rule->fdbInfo.flags, rule->mgmtInfo.new_count);

			mvOsFree(rule);	
			return MV_OK;
		}

		prev = rule;
		rule = rule->next;
	}

	return MV_NOT_FOUND;
}
Ejemplo n.º 11
0
void mvNfpFibClean(void)
{
	int i;
	NFP_RULE_FIB *fib, *next;

	for (i = 0; i < NFP_FIB_HASH_SIZE; i++) {
		fib = fib_hash[i];
		while (fib) {
#ifdef NFP_PNC
			mvNfpPncFibDel(fib);
#endif
			next = fib->next;
			mvOsFree(fib);
			fib = next;
		}
		fib_hash[i] = NULL;
	}
}
Ejemplo n.º 12
0
/* Clear Fast Route Bridge Rule Database (SNAT + DNAT table) */
MV_STATUS mvFpFdbClear(void)
{
	MV_U32 i = fdbRuleDbSize;
	MV_FP_FDB_RULE *rule, *tmp;

	if (fdbRuleDb != NULL)
		return MV_NOT_INITIALIZED;

	while (i--) {
		rule = fdbRuleDb[i].ruleChain;
		while (rule) {
			tmp = rule;
			rule = rule->next;
			mvOsFree(tmp);
		}
        	fdbRuleDb[i].ruleChain = NULL;
	}
	return MV_OK;
}
Ejemplo n.º 13
0
/* Clear Bridge Rule Database */
MV_STATUS mvNfpBridgeClear(void)
{
	int	i;
	NFP_RULE_BRIDGE	*rule, *tmp;

	if (nfp_bridge_hash == NULL)
		return MV_NOT_INITIALIZED;

	for (i = 0; i < NFP_BRIDGE_HASH_SIZE; i++) {

		rule = nfp_bridge_hash[i];
		while (rule) {
			tmp = rule;
			rule = rule->next;
			mvOsFree(tmp);
		}
		nfp_bridge_hash[i] = NULL;
	}
	return MV_OK;
}
Ejemplo n.º 14
0
/* Clear NFP NAT Rule Database (SNAT + DNAT table) */
MV_STATUS   mvFpNatDbClear(void)
{
	MV_U32 i = 0;
	MV_FP_NAT_RULE *currRule;
	MV_FP_NAT_RULE *tmpRule;

	if (natRuleDb == NULL) 
		return MV_NOT_INITIALIZED;

	for (i = 0; i < natRuleDbSize; i++) {
		currRule = natRuleDb[i].natRuleChain;
		while (currRule != NULL) {
			tmpRule = currRule;
			currRule = currRule->next;
			mvOsFree(tmpRule);
		}
        	natRuleDb[i].natRuleChain = NULL;
	}
	return MV_OK;
}
Ejemplo n.º 15
0
MV_STATUS mvNfpFibRuleDel(int family, NFP_RULE_FIB *fib2)
{
	MV_U32 hash;
	NFP_RULE_FIB *fib, *prev;

	hash = mv_jhash_2addr(family, (const MV_U8 *)&fib2->srcL3, (const MV_U8 *)&fib2->dstL3, 0, mgr_rule_jhash_iv);
	hash &= NFP_FIB_HASH_MASK;

	fib = fib_hash[hash];
	prev = NULL;

	while (fib) {
		if ((l3_addr_eq(family, fib->srcL3, fib2->srcL3)) && (l3_addr_eq(family, fib->dstL3, fib2->dstL3))) {

#ifdef NFP_PNC
			mvNfpPncFibDel(fib);
#endif
			if (fib->ref) {
				fib->flags = NFP_F_INV;
				NFP_DBG("NFP (fib) del %p, retain ref=%d \n", fib, fib->ref);
				return MV_OK;
			}

			if (prev)
				prev->next = fib->next;
			else
				fib_hash[hash] = fib->next;

			NFP_DBG("NFP (fib) del %p\n", fib);
			mvOsFree(fib);

			return MV_OK;
		}

		prev = fib;
		fib = fib->next;
	}

	return MV_NOT_FOUND;
}
Ejemplo n.º 16
0
/* Delete a specified NAT rule from the SNAT + DNAT table */
MV_STATUS mvFpNatRuleDelete(MV_FP_NAT_RULE *natRule)
{
    MV_U32      hash, hash_tr;
    MV_FP_NAT_RULE  *currRule, *prevRule;

    natRuleDeleteCount++;

    hash = mv_jhash_3words(natRule->dstIp, natRule->srcIp, 
                            (MV_U32)((natRule->dstPort << 16) | natRule->srcPort), 
                            (MV_U32)((fp_ip_jhash_iv << 8) | natRule->proto));
    hash_tr = hash & (natRuleDbSize - 1);

    prevRule = NULL;
    for (currRule = natRuleDb[hash_tr].natRuleChain; 
	 currRule != NULL; 
	 prevRule = currRule, currRule = currRule->next) 
    {
	    if (currRule->srcIp == natRule->srcIp && 
		currRule->dstIp == natRule->dstIp && 
		currRule->srcPort == natRule->srcPort && 
		currRule->dstPort == natRule->dstPort && 
		currRule->proto == natRule->proto ) 
	    {		
		    if (prevRule == NULL)
			    natRuleDb[hash_tr].natRuleChain = currRule->next;
		    else
			    prevRule->next = currRule->next;

#ifdef MV_FP_DEBUG
		    mvOsPrintf("DelNAT_%03u: DIP=0x%08x, SIP=0x%08x, proto=%d, DPort=%d, SPort=%d, hash=0x%04x\n",
              	        natRuleDeleteCount, currRule->dstIp, currRule->srcIp, currRule->proto, 
			            MV_16BIT_BE(currRule->dstPort), MV_16BIT_BE(currRule->srcPort), hash_tr);
#endif
		mvOsFree(currRule);	
		return MV_OK;
	    }
    }
    return MV_NOT_FOUND;
}
Ejemplo n.º 17
0
void mvNfpFibDestroy(void)
{
	if (fib_hash != NULL)
		mvOsFree(fib_hash);
}
Ejemplo n.º 18
0
void daaFreeChannel(unsigned int daa_dev)
{
	MV_DAA_DEV *pDaaDev = (MV_DAA_DEV *)daa_dev;
	mvOsFree(pDaaDev);
}
Ejemplo n.º 19
0
void mvFpFdbDestroy(void)
{
	if (fdbRuleDb != NULL)
		mvOsFree(fdbRuleDb);
}
Ejemplo n.º 20
0
MV_STATUS l2fw_add_ip(const char *buf)
{
    char *addr1, *addr2;
    L2FW_RULE *l2fw_rule;
    MV_U32 srcIP;
    MV_U32 dstIP;
    MV_U8	  *srcIPchr, *dstIPchr;
    char dest1[15];
    char dest2[15];
    char *portStr;
    int offset1, offset2, port;
    MV_U32 hash    = 0;
    if (numHashEntries == L2FW_HASH_SIZE) {
        printk(KERN_INFO "cannot add entry, hash table is full, there are %d entires \n", L2FW_HASH_SIZE);
        return MV_ERROR;
    }

    memset(dest1,   0, sizeof(dest1));
    memset(dest2,   0, sizeof(dest2));

    addr1 = strchr(buf, ',');
    addr2 =	strchr(addr1+1, ',');
    offset1 = addr1-buf;
    offset2 = addr2-addr1;
    if (!addr1) {
        printk(KERN_INFO "first separating comma (',') missing in input in %s\n", __func__);
        return MV_FAIL;
    }
    if (!addr2) {
        printk(KERN_INFO "second separating comma (',') missing in input in %s\n", __func__);
        return MV_FAIL;
    }

    strncpy(dest1, buf, addr1-buf);
    srcIP = in_aton(dest1);
    strncpy(dest2, buf+offset1+1, addr2-addr1-1);
    dstIP = in_aton(dest2);
    srcIPchr = (MV_U8 *)&(srcIP);
    dstIPchr = (MV_U8 *)&(dstIP);
    portStr = addr2+1;
    if (*portStr == 'D') {
        L2FW_RULE *l2fw_rule_to_del, *prev;
        hash = mv_jhash_3words(srcIP, dstIP, (MV_U32) 0, l2fw_jhash_iv);
        hash &= L2FW_HASH_MASK;
        l2fw_rule_to_del = l2fw_hash[hash];
        prev = NULL;

        while (l2fw_rule_to_del) {
            if ((l2fw_rule_to_del->srcIP == srcIP) &&
                    (l2fw_rule_to_del->dstIP == dstIP)) {
                if (prev)
                    prev->next = l2fw_rule_to_del->next;
                else
                    l2fw_hash[hash] = l2fw_rule_to_del->next;
                mvOsPrintf("%u.%u.%u.%u->%u.%u.%u.%u deleted\n", MV_IPQUAD(srcIPchr), MV_IPQUAD(dstIPchr));
                mvOsFree(l2fw_rule_to_del);
                numHashEntries--;
                return MV_OK;
            }

            prev = l2fw_rule_to_del;
            l2fw_rule_to_del = l2fw_rule_to_del->next;
        }
        mvOsPrintf("%u.%u.%u.%u->%u.%u.%u.%u : entry not found\n", MV_IPQUAD(srcIPchr), MV_IPQUAD(dstIPchr));
        return MV_NOT_FOUND;
    }

    port = atoi(portStr);
    hash = mv_jhash_3words(srcIP, dstIP, (MV_U32) 0, l2fw_jhash_iv);
    hash &= L2FW_HASH_MASK;

    l2fw_rule = l2fw_lookup(srcIP, dstIP);
    if (l2fw_rule) {
        mvOsPrintf("%u.%u.%u.%u->%u.%u.%u.%u : entry already exist\n",
                   MV_IPQUAD(srcIPchr), MV_IPQUAD(dstIPchr));
        return MV_OK;
    }

    l2fw_rule = (L2FW_RULE *)mvOsMalloc(sizeof(L2FW_RULE));
    if (!l2fw_rule) {
        mvOsPrintf("%s: OOM\n", __func__);
        return MV_FAIL;
    }
#ifdef CONFIG_MV_ETH_L2FW_DEBUG
    mvOsPrintf("adding a rule to l2fw hash in %s\n", __func__);
#endif
    l2fw_rule->srcIP = srcIP;
    l2fw_rule->dstIP = dstIP;
    l2fw_rule->port = port;

    l2fw_rule->next = l2fw_hash[hash];
    l2fw_hash[hash] = l2fw_rule;
    numHashEntries++;
    return MV_OK;

}
Ejemplo n.º 21
0
void mvNfpBridgeDestroy(void)
{
	if (nfp_bridge_hash != NULL)
		mvOsFree(nfp_bridge_hash);
}
Ejemplo n.º 22
0
static ssize_t tcam_store(struct device *dev, 
				   struct device_attribute *attr, const char *buf, size_t len)
{
	const char* name = attr->attr.name;
	unsigned int err=0, a=0, b=0;
	unsigned long flags;

	if (!capable(CAP_NET_ADMIN))
		return -EPERM;

	sscanf(buf,"%x %x",&a, &b);

	raw_local_irq_save(flags);

	if (!strcmp(name, "hw_write")) 
		tcam_hw_write(&te, a);
	else if (!strcmp(name, "hw_read")) 
		tcam_hw_read(&te, a);
	else if (!strcmp(name, "hw_debug")) 
		tcam_hw_debug(a);
	else if (!strcmp(name, "hw_inv")) 
		tcam_hw_inv(a);
	else if (!strcmp(name, "hw_inv_all")) 
		tcam_hw_inv_all();
	else if (!strcmp(name, "hw_hits")) 
		tcam_hw_record(a);
#ifdef CONFIG_MV_ETH_PNC_AGING
	else if (!strcmp(name, "age_clear")) 
		mvPncAgingCntrClear(a);
	else if (!strcmp(name, "age_cntr")) {
		b = mvPncAgingCntrRead(a);
		printk("tid=%d: age_cntr = 0x%08x\n", a, b);
	}
#endif /* CONFIG_MV_ETH_PNC_AGING */
	else if (!strcmp(name, "sw_clear")) 
		tcam_sw_clear(&te);
	else if (!strcmp(name, "sw_text")) 
	{
		/* Remove last byte (new line) from the buffer */
		int len = strlen(buf);
		char* temp = mvOsMalloc(len + 1);

		strncpy(temp, buf, len-1);
		temp[len-1] = 0;
		tcam_sw_text(&te, temp);
		mvOsFree(temp);
	}
	else if (!strcmp(name, "t_port"))
		tcam_sw_set_port(&te, a, b);	
	else if (!strcmp(name, "t_lookup")) 
		tcam_sw_set_lookup(&te, a);
	else if (!strcmp(name, "t_ainfo_0")) 
		tcam_sw_set_ainfo(&te, 0<<a, 1<<a);
	else if (!strcmp(name, "t_ainfo_1")) 
		tcam_sw_set_ainfo(&te, 1<<a, 1<<a);
	else if (!strcmp(name, "t_ainfo")) 
		tcam_sw_set_ainfo(&te, a, b);
	else if (!strcmp(name, "t_offset_byte"))
		tcam_sw_set_byte(&te, a, b);
	else if (!strcmp(name, "t_offset_mask"))
		tcam_sw_set_mask(&te, a, b);
	else if (!strcmp(name, "s_lookup")) 
		sram_sw_set_next_lookup(&te, a);
	else if (!strcmp(name, "s_ainfo")) 
		sram_sw_set_ainfo(&te, a, b);
	else if (!strcmp(name, "s_lookup_done"))
		sram_sw_set_lookup_done(&te, a);
	else if (!strcmp(name, "s_next_lookup_shift"))
		sram_sw_set_next_lookup_shift(&te, a);	
	else if (!strcmp(name, "s_rxq")) 
		sram_sw_set_rxq(&te, a, b);
	else if (!strcmp(name, "s_shift_update"))
		sram_sw_set_shift_update(&te,a,b);
	else if (!strcmp(name, "s_rinfo")) 
		sram_sw_set_rinfo(&te, 1 << a);
	else if (!strcmp(name, "s_rinfo_extra")) 
		sram_sw_set_rinfo_extra(&te, a << (b & ~1));
	else if (!strcmp(name, "s_flowid")) 
		sram_sw_set_flowid(&te, a, b);
	else if (!strcmp(name, "s_flowid_nibble")) 
		sram_sw_set_flowid_nibble(&te, a, b);
#ifdef CONFIG_MV_ETH_PNC_AGING
	else if (!strcmp(name, "age_gr_set")) 
		mvPncAgingCntrGroupSet(a, b);
#endif /* CONFIG_MV_ETH_PNC_AGING */
	else {
		err = 1;
		printk("%s: illegal operation <%s>\n", __FUNCTION__, attr->attr.name);
	}
	raw_local_irq_restore(flags);

	if (err) 
		printk("%s: <%s>, error %d\n", __FUNCTION__, attr->attr.name, err);
	
	return err ? -EINVAL : len;
}
/* Free Rule Database memory */
void mvFpRuleDbDestroy(void)
{
	if (ruleDb != NULL)
		mvOsFree(ruleDb);
}
Ejemplo n.º 24
0
/* Free NAT Database memory */
void mvFpNatDbDestroy(void)
{
	if (natRuleDb != NULL)
		mvOsFree(natRuleDb);
}
Ejemplo n.º 25
0
void mvCpuCntrsEventDelete(MV_CPU_CNTRS_EVENT *event)
{
	if (event != NULL)
		mvOsFree(event);
}