diff options
author | Mandy Lavi <mandy.lavi@freescale.com> | 2014-03-27 11:51:52 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-04-03 17:19:57 (GMT) |
commit | c617aa4aa3e4509ef581243872a8151661a5da42 (patch) | |
tree | 960d2649c14d51eb8a850b0c553206e0fb6f7ea9 /drivers/net/ethernet/freescale/fman/Peripherals/FM | |
parent | 591db9ed6e7c05681969a416be2e2770a37bc5a1 (diff) | |
download | linux-fsl-qoriq-c617aa4aa3e4509ef581243872a8151661a5da42.tar.xz |
fmd: Handled clearing of plcr profile and scheme for re-use
Change-Id: I0058a7152ec34038961bdfb7598d280b7ec47777
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/10411
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Tested-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/Peripherals/FM')
-rw-r--r-- | drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_kg.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/fman/Peripherals/FM/Pcd/fm_plcr.c | 7 |
2 files changed, 12 insertions, 0 deletions
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 b271204..769a7ab 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 @@ -769,7 +769,10 @@ static void UpdateRequiredActionFlag(t_FmPcdKgScheme *p_Scheme, bool set) if (set) p_Scheme->requiredActionFlag = TRUE; else + { + p_Scheme->requiredAction = 0; p_Scheme->requiredActionFlag = FALSE; + } } static t_Error KgWriteSp(t_FmPcd *p_FmPcd, uint8_t hardwarePortId, uint32_t spReg, bool add) @@ -2943,6 +2946,8 @@ t_Handle FM_PCD_KgSchemeSet(t_Handle h_FmPcd, t_FmPcdKgSchemeParams *p_SchemePa ("Scheme id (%d)!", relativeSchemeId)); return NULL; } + /* Clear all fields, scheme may have beed previously used */ + memset(p_Scheme, 0, sizeof(t_FmPcdKgScheme)); p_Scheme->schemeId = p_FmPcd->p_FmPcdKg->schemesIds[relativeSchemeId]; p_Scheme->h_FmPcd = p_FmPcd; 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 d08293a..e4eeddc 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 @@ -596,7 +596,10 @@ static void UpdateRequiredActionFlag(t_Handle h_FmPcd, uint16_t absoluteProfileI if (set) p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredActionFlag = TRUE; else + { + p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredAction = 0; p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId].requiredActionFlag = FALSE; + } } /*********************************************/ @@ -1637,6 +1640,7 @@ t_Handle FM_PCD_PlcrProfileSet(t_Handle h_FmPcd, /* initialize profile struct */ p_Profile = &p_FmPcd->p_FmPcdPlcr->profiles[absoluteProfileId]; + p_Profile->h_FmPcd = p_FmPcd; p_Profile->absoluteProfileId = absoluteProfileId; @@ -1761,10 +1765,13 @@ t_Error FM_PCD_PlcrProfileDelete(t_Handle h_Profile) WritePar(p_FmPcd, tmpReg32); PlcrHwUnlock(p_FmPcd->p_FmPcdPlcr, intFlags); + if (p_Profile->p_Lock) /* release allocated Profile lock */ FmPcdReleaseLock(p_FmPcd, p_Profile->p_Lock); + /* we do not memset profile as all its fields are being re-initialized at "set", + * plus its allocation information is still valid. */ return E_OK; } |