From 23ecb71068ce6970ee5c400d66da5b95c68fc83b Mon Sep 17 00:00:00 2001 From: Mandy Lavi Date: Thu, 27 Feb 2014 18:08:35 +0200 Subject: fmd: fix flow id classification to work after PCD re-init" For KG & Policer: Renamed pointedOwners --> RequiredActionFlag changed from counter to flag added flag clear at delete Change-Id: I55dd4125202d59e7659a3ffb8e39f56eaac7cd62 Signed-off-by: Mandy Lavi Reviewed-on: http://git.am.freescale.net:8181/9261 Reviewed-by: Eyal Harari Reviewed-by: Jose Rivera Tested-by: Jose Rivera Reviewed-on: http://git.am.freescale.net:8181/9449 diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/HC/hc.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/HC/hc.c index a06dd9d..74047dd 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/HC/hc.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/HC/hc.c @@ -472,7 +472,7 @@ t_Error FmHcPcdKgCcGetSetParams(t_Handle h_FmHc, t_Handle h_Scheme, uint32_t re if ( relativeSchemeId == FM_PCD_KG_NUM_OF_SCHEMES) RETURN_ERROR(MAJOR, E_NOT_IN_RANGE, NO_MSG); - if (!FmPcdKgGetPointedOwners(p_FmHc->h_FmPcd, relativeSchemeId) || + if (!FmPcdKgGetRequiredActionFlag(p_FmHc->h_FmPcd, relativeSchemeId) || !(FmPcdKgGetRequiredAction(p_FmHc->h_FmPcd, relativeSchemeId) & requiredAction)) { if ((requiredAction & UPDATE_NIA_ENQ_WITHOUT_DMA) && @@ -805,7 +805,7 @@ t_Error FmHcPcdPlcrCcGetSetParams(t_Handle h_FmHc,uint16_t absoluteProfileId, ui t_DpaaFD fmFd; t_Error err; uint32_t tmpReg32 = 0; - uint32_t requiredActionTmp, pointedOwnersTmp; + uint32_t requiredActionTmp, requiredActionFlag; uint32_t seqNum; SANITY_CHECK_RETURN_VALUE(h_FmHc, E_INVALID_HANDLE,0); @@ -816,9 +816,9 @@ t_Error FmHcPcdPlcrCcGetSetParams(t_Handle h_FmHc,uint16_t absoluteProfileId, ui */ requiredActionTmp = FmPcdPlcrGetRequiredAction(p_FmHc->h_FmPcd, absoluteProfileId); - pointedOwnersTmp = FmPcdPlcrGetPointedOwners(p_FmHc->h_FmPcd, absoluteProfileId); + requiredActionFlag = FmPcdPlcrGetRequiredActionFlag(p_FmHc->h_FmPcd, absoluteProfileId); - if (!pointedOwnersTmp || !(requiredActionTmp & requiredAction)) + if (!requiredActionFlag || !(requiredActionTmp & requiredAction)) { if (requiredAction & UPDATE_NIA_ENQ_WITHOUT_DMA) { diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c index c610a4c..fa17dc7 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_cc.c @@ -6850,14 +6850,14 @@ t_Handle FM_PCD_HashTableSet(t_Handle h_FmPcd, t_FmPcdHashTableParams *p_Param) p_CcNodeHashTbl = FM_PCD_MatchTableSet(h_FmPcd, p_IndxHashCcNodeParam); if (p_CcNodeHashTbl) + { p_CcNodeHashTbl->kgHashShift = p_Param->kgHashShift; - /* Storing the allocated counters for buckets 'miss' in the hash table - and is statistics for miss wre enabled. */ - p_CcNodeHashTbl->h_MissStatsCounters = h_MissStatsCounters; - p_CcNodeHashTbl->statsEnForMiss = statsEnForMiss; - - XX_Print("Hash 0x%x: 0x%x\n", p_CcNodeHashTbl, h_MissStatsCounters); + /* Storing the allocated counters for buckets 'miss' in the hash table + and is statistics for miss wre enabled. */ + p_CcNodeHashTbl->h_MissStatsCounters = h_MissStatsCounters; + p_CcNodeHashTbl->statsEnForMiss = statsEnForMiss; + } XX_Free(p_IndxHashCcNodeParam); XX_Free(p_ExactMatchCcNodeParam); diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_kg.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_kg.c index 4b0edc2..5f848892 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_kg.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_kg.c @@ -746,16 +746,16 @@ static void DecSchemeOwners(t_FmPcd *p_FmPcd, t_FmPcdKgInterModuleBindPortToSche } } -static void UpateSchemePointedOwner(t_FmPcdKgScheme *p_Scheme, bool add) +static void UpdateRequiredActionFlag(t_FmPcdKgScheme *p_Scheme, bool set) { /* this routine is locked by the calling routine */ ASSERT_COND(p_Scheme); ASSERT_COND(p_Scheme->valid); - if (add) - p_Scheme->pointedOwners++; + if (set) + p_Scheme->requiredActionFlag = TRUE; else - p_Scheme->pointedOwners--; + p_Scheme->requiredActionFlag = FALSE; } static t_Error KgWriteSp(t_FmPcd *p_FmPcd, uint8_t hardwarePortId, uint32_t spReg, bool add) @@ -2558,13 +2558,13 @@ uint32_t FmPcdKgGetRequiredAction(t_Handle h_FmPcd, uint8_t schemeId) return p_FmPcd->p_FmPcdKg->schemes[schemeId].requiredAction; } -uint32_t FmPcdKgGetPointedOwners(t_Handle h_FmPcd, uint8_t schemeId) +uint32_t FmPcdKgGetRequiredActionFlag(t_Handle h_FmPcd, uint8_t schemeId) { t_FmPcd *p_FmPcd = (t_FmPcd*)h_FmPcd; ASSERT_COND(p_FmPcd->p_FmPcdKg->schemes[schemeId].valid); - return p_FmPcd->p_FmPcdKg->schemes[schemeId].pointedOwners; + return p_FmPcd->p_FmPcdKg->schemes[schemeId].requiredActionFlag; } bool FmPcdKgIsDirectPlcr(t_Handle h_FmPcd, uint8_t schemeId) @@ -2765,7 +2765,7 @@ t_Error FmPcdKgCcGetSetParams(t_Handle h_FmPcd, t_Handle h_Scheme, uint32_t requ { err = FmHcPcdKgCcGetSetParams(p_FmPcd->h_Hc, h_Scheme, requiredAction, value); - UpateSchemePointedOwner(h_Scheme,TRUE); + UpdateRequiredActionFlag(h_Scheme,TRUE); FmPcdKgUpdateRequiredAction(h_Scheme,requiredAction); return err; } @@ -2776,7 +2776,7 @@ t_Error FmPcdKgCcGetSetParams(t_Handle h_FmPcd, t_Handle h_Scheme, uint32_t requ if (relativeSchemeId >= FM_PCD_KG_NUM_OF_SCHEMES) RETURN_ERROR(MAJOR, E_NOT_IN_RANGE, NO_MSG); - if (!p_FmPcd->p_FmPcdKg->schemes[relativeSchemeId].pointedOwners || + if (!p_FmPcd->p_FmPcdKg->schemes[relativeSchemeId].requiredActionFlag || !(p_FmPcd->p_FmPcdKg->schemes[relativeSchemeId].requiredAction & requiredAction)) { if (requiredAction & UPDATE_NIA_ENQ_WITHOUT_DMA) @@ -2860,7 +2860,7 @@ t_Error FmPcdKgCcGetSetParams(t_Handle h_FmPcd, t_Handle h_Scheme, uint32_t requ } } - UpateSchemePointedOwner(h_Scheme, TRUE); + UpdateRequiredActionFlag(h_Scheme, TRUE); FmPcdKgUpdateRequiredAction(h_Scheme, requiredAction); return E_OK; @@ -3019,6 +3019,8 @@ t_Error FM_PCD_KgSchemeDelete(t_Handle h_Scheme) p_FmPcd = (t_FmPcd*)(p_Scheme->h_FmPcd); + UpdateRequiredActionFlag(h_Scheme, FALSE); + /* check that no port is bound to this scheme */ err = InvalidateSchemeSw(h_Scheme); if (err) diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_pcd.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_pcd.h index 965f46b..ca0fb81 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_pcd.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_pcd.h @@ -228,7 +228,7 @@ typedef struct { t_FmPcdKgKeyOrder orderedArray; e_FmPcdEngine nextEngine; e_FmPcdDoneAction doneAction; - uint8_t pointedOwners; + bool requiredActionFlag; uint32_t requiredAction; bool extractedOrs; uint8_t bitOffsetInPlcrProfile; @@ -270,7 +270,7 @@ typedef struct { bool valid; t_FmPcdLock *p_Lock; t_FmPcdAllocMng profilesMng; - uint8_t pointedOwners; + bool requiredActionFlag; uint32_t requiredAction; e_FmPcdEngine nextEngineOnGreen; /**< Green next engine type */ u_FmPcdPlcrNextEngineParams paramsOnGreen; /**< Green next engine params */ diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_plcr.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_plcr.c index ded7960..d08293a 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_plcr.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_plcr.c @@ -585,6 +585,20 @@ static void FreeSharedProfiles(t_FmPcd *p_FmPcd, uint16_t numOfProfiles, uint16_ } } +static void UpdateRequiredActionFlag(t_Handle h_FmPcd, uint16_t absoluteProfileId, bool set) +{ + t_FmPcd *p_FmPcd = (t_FmPcd*)h_FmPcd; + + /* this routine is protected by calling routine */ + + ASSERT_COND(p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].valid); + + if (set) + p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredActionFlag = TRUE; + else + p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredActionFlag = FALSE; +} + /*********************************************/ /*............Policer Exception..............*/ /*********************************************/ @@ -1176,7 +1190,7 @@ t_Error FmPcdPlcrCcGetSetParams(t_Handle h_FmPcd, uint16_t profileIndx ,uint32_t { err = FmHcPcdPlcrCcGetSetParams(p_FmPcd->h_Hc, profileIndx, requiredAction); - FmPcdPlcrUpatePointedOwner(p_FmPcd, profileIndx, TRUE); + UpdateRequiredActionFlag(p_FmPcd, profileIndx, TRUE); FmPcdPlcrUpdateRequiredAction(p_FmPcd, profileIndx, requiredAction); /*PlcrProfileUnlock(&p_FmPcd->p_FmPcdPlcr->profiles[profileIndx], intFlags);*/ @@ -1189,7 +1203,7 @@ t_Error FmPcdPlcrCcGetSetParams(t_Handle h_FmPcd, uint16_t profileIndx ,uint32_t intFlags = PlcrHwLock(p_FmPcdPlcr); WritePar(p_FmPcd, FmPcdPlcrBuildReadPlcrActionReg(profileIndx)); - if (!p_FmPcd->p_FmPcdPlcr->profiles[profileIndx].pointedOwners || + if (!p_FmPcd->p_FmPcdPlcr->profiles[profileIndx].requiredActionFlag || !(p_FmPcd->p_FmPcdPlcr->profiles[profileIndx].requiredAction & requiredAction)) { if (requiredAction & UPDATE_NIA_ENQ_WITHOUT_DMA) @@ -1256,7 +1270,7 @@ t_Error FmPcdPlcrCcGetSetParams(t_Handle h_FmPcd, uint16_t profileIndx ,uint32_t } PlcrHwUnlock(p_FmPcdPlcr, intFlags); - FmPcdPlcrUpatePointedOwner(p_FmPcd, profileIndx, TRUE); + UpdateRequiredActionFlag(p_FmPcd, profileIndx, TRUE); FmPcdPlcrUpdateRequiredAction(p_FmPcd, profileIndx, requiredAction); /*PlcrProfileUnlock(&p_FmPcd->p_FmPcdPlcr->profiles[profileIndx], intFlags);*/ @@ -1264,27 +1278,13 @@ t_Error FmPcdPlcrCcGetSetParams(t_Handle h_FmPcd, uint16_t profileIndx ,uint32_t return E_OK; } -void FmPcdPlcrUpatePointedOwner(t_Handle h_FmPcd, uint16_t absoluteProfileId, bool add) -{ - t_FmPcd *p_FmPcd = (t_FmPcd*)h_FmPcd; - - /* this routine is protected by calling routine */ - - ASSERT_COND(p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].valid); - - if (add) - p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].pointedOwners++; - else - p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].pointedOwners--; -} - -uint32_t FmPcdPlcrGetPointedOwners(t_Handle h_FmPcd, uint16_t absoluteProfileId) +uint32_t FmPcdPlcrGetRequiredActionFlag(t_Handle h_FmPcd, uint16_t absoluteProfileId) { t_FmPcd *p_FmPcd = (t_FmPcd*)h_FmPcd; ASSERT_COND(p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].valid); - return p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].pointedOwners; + return p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredActionFlag; } uint32_t FmPcdPlcrGetRequiredAction(t_Handle h_FmPcd, uint16_t absoluteProfileId) @@ -1468,6 +1468,7 @@ void FmPcdPlcrUpdateRequiredAction(t_Handle h_FmPcd, uint16_t absoluteProfileId, p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredAction |= requiredAction; } + /*********************** End of inter-module routines ************************/ @@ -1739,6 +1740,8 @@ t_Error FM_PCD_PlcrProfileDelete(t_Handle h_Profile) profileIndx = p_Profile->absoluteProfileId; + UpdateRequiredActionFlag(p_FmPcd, profileIndx, FALSE); + FmPcdPlcrInvalidateProfileSw(p_FmPcd,profileIndx); if (p_FmPcd->h_Hc) diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_replic.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_replic.h index 3cfd67e..7e4224b 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_replic.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_replic.h @@ -87,9 +87,6 @@ typedef struct t_FmPcdFrmReplicMember typedef struct t_FmPcdFrmReplicGroup { t_Handle h_FmPcd; -#ifdef UNDER_CONSTRUCTION_STATISTICS_SUPPORT - e_FmPcdCcStatsMode statisticsMode; -#endif /* UNDER_CONSTRUCTION_STATISTICS_SUPPORT */ uint8_t maxNumOfEntries;/**< maximal number of members in the group */ uint8_t numOfEntries; /**< actual number of members in the group */ diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c index 14579f7..e788107 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c @@ -384,7 +384,6 @@ static void EnableTimeStamp(t_Fm *p_Fm) { struct fman_fpm_regs *fpm_rg = p_Fm->p_FmFpmRegs; - ASSERT_COND(p_Fm); ASSERT_COND(p_Fm->p_FmStateStruct); ASSERT_COND(p_Fm->p_FmStateStruct->count1MicroBit); @@ -611,7 +610,7 @@ static t_Error SetVSPWindow(t_Handle h_Fm, t_Fm *p_Fm = (t_Fm *)h_Fm; ASSERT_COND(h_Fm); - ASSERT_COND(hardwarePortId); + ASSERT_COND(IN_RANGE(1, hardwarePortId, 63)); if ((p_Fm->guestId != NCSW_MASTER_ID) && !p_Fm->p_FmBmiRegs && @@ -4434,6 +4433,7 @@ t_Error FM_SetPortsBandwidth(t_Handle h_Fm, t_FmPortsBandwidthParams *p_PortsBan p_PortsBandwidth->portsBandwidths[i].type, p_PortsBandwidth->portsBandwidths[i].relativePortId); + ASSERT_COND(IN_RANGE(1, hardwarePortId, 63)); weights[hardwarePortId] = weight; } diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h index d693a51..c9c963a 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h @@ -670,8 +670,6 @@ bool FmPcdLockTryLockAll(t_Handle h_FmPcd); void FmPcdLockUnlockAll(t_Handle h_FmPcd); t_Error FmPcdHcSync(t_Handle h_FmPcd); t_Handle FmGetPcd(t_Handle h_Fm); - - /***********************************************************************/ /* Common API for FM-PCD KG module */ /***********************************************************************/ @@ -699,7 +697,7 @@ bool FmPcdKgIsSchemeValidSw(t_Handle h_Scheme); t_Error FmPcdKgBindPortToSchemes(t_Handle h_FmPcd , t_FmPcdKgInterModuleBindPortToSchemes *p_SchemeBind); t_Error FmPcdKgUnbindPortToSchemes(t_Handle h_FmPcd , t_FmPcdKgInterModuleBindPortToSchemes *p_SchemeBind); uint32_t FmPcdKgGetRequiredAction(t_Handle h_FmPcd, uint8_t schemeId); -uint32_t FmPcdKgGetPointedOwners(t_Handle h_FmPcd, uint8_t schemeId); +uint32_t FmPcdKgGetRequiredActionFlag(t_Handle h_FmPcd, uint8_t schemeId); e_FmPcdDoneAction FmPcdKgGetDoneAction(t_Handle h_FmPcd, uint8_t schemeId); e_FmPcdEngine FmPcdKgGetNextEngine(t_Handle h_FmPcd, uint8_t schemeId); void FmPcdKgUpdateRequiredAction(t_Handle h_Scheme, uint32_t requiredAction); @@ -737,8 +735,7 @@ void FmPcdPlcrInvalidateProfileSw(t_Handle h_FmPcd, uint16_t absoluteProf void FmPcdPlcrValidateProfileSw(t_Handle h_FmPcd, uint16_t absoluteProfileId); bool FmPcdPlcrHwProfileIsValid(uint32_t profileModeReg); uint32_t FmPcdPlcrGetRequiredAction(t_Handle h_FmPcd, uint16_t absoluteProfileId); -uint32_t FmPcdPlcrGetPointedOwners(t_Handle h_FmPcd, uint16_t absoluteProfileId); -void FmPcdPlcrUpatePointedOwner(t_Handle h_FmPcd, uint16_t absoluteProfileId, bool add); +uint32_t FmPcdPlcrGetRequiredActionFlag(t_Handle h_FmPcd, uint16_t absoluteProfileId); uint32_t FmPcdPlcrBuildNiaProfileReg(bool green, bool yellow, bool red); void FmPcdPlcrUpdateRequiredAction(t_Handle h_FmPcd, uint16_t absoluteProfileId, uint32_t requiredAction); t_Error FmPcdPlcrCcGetSetParams(t_Handle h_FmPcd, uint16_t profileIndx,uint32_t requiredAction); @@ -765,7 +762,6 @@ t_Error FmPcdCcUnbindTree(t_Handle h_FmPcd, t_Handle h_CcTree); /* Common API for FM-PCD Manip module */ /***********************************************************************/ t_Error FmPcdManipUpdate(t_Handle h_FmPcd, t_Handle h_PcdParams, t_Handle h_FmPort, t_Handle h_Manip, t_Handle h_Ad, bool validate, int level, t_Handle h_FmTree, bool modify); -uint32_t FmPcdManipGetRequiredAction (t_Handle h_Manip); /***********************************************************************/ /* Common API for FM-Port module */ -- cgit v0.10.2