summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c
diff options
context:
space:
mode:
authorMandy Lavi <mandy.lavi@freescale.com>2013-05-16 16:07:56 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-05-24 20:09:44 (GMT)
commit4ca916d89845745105578b374c2ccd8ce98bd61c (patch)
tree6d556920ac5d4c82a4eb8a9d37eefe6a707689e0 /drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c
parent54e9bb38263cf3a5bf893525be29eea46cda3468 (diff)
downloadlinux-fsl-qoriq-4ca916d89845745105578b374c2ccd8ce98bd61c.tar.xz
fmd: fmd21.1 integration
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com> - PFC Adjustments for PFC configuration constraints and limitations related to port prefetch mode - workaround ucode issues Fix the following HW erratas regarding discard/error frames on V3: FM_OP_NO_VSP_NO_RELEASE_ERRATA_FMAN_A006675 - Description: OP without VSP will cause buffer leaks when instructed to discard a frame. Workaround: FW will release the buffers. FM_ERROR_VSP_NO_MATCH_SW006 - Description: Any port with VSP enabled and multiple VSPs are configured on this port can cause a situation where an error frame will be enqueued to the error queue not with the default VSP. Workaround: FW will replaced the current VSP with the default VSP just before the frame is being enqueued to the error queue. - Chosen-node new parameter support errors-to-discard Usage: optional Value type: <u32> Definition: Specifies which errors should be discarded. Errors that are not in the mask, will not be discarded; I.e. those errors will be enqueued and sent to the default error queue. Change-Id: Ib468c67de88376e17d9c39ab5a0c8fc5b33b7b82 Reviewed-on: http://git.am.freescale.net:8181/2605 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com> Reviewed-by: Garg Vakul-B16394 <vakul@freescale.com> Reviewed-by: Radulescu Ruxandra Ioana-B05472 <ruxandra.radulescu@freescale.com> Reviewed-by: Chereji Marian-Cornel-R27762 <marian.chereji@freescale.com> Reviewed-by: Wang Haiying-R54964 <Haiying.Wang@freescale.com> Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c')
-rw-r--r--drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c71
1 files changed, 58 insertions, 13 deletions
diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c
index 6f27b2c..2fdc4c8 100644
--- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c
+++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c
@@ -1317,25 +1317,67 @@ uint16_t FmGetTnumAgingPeriod(t_Handle h_Fm)
return p_Fm->tnumAgingPeriod;
}
-t_Error FmSetCongestionGroupPFCpriority(t_Handle h_Fm,
- uint32_t congestionGroupId,
- uint8_t priorityBitMap)
+t_Error FmSetPortPreFetchConfiguration(t_Handle h_Fm,
+ uint8_t portNum,
+ bool preFetchConfigured)
{
- t_Fm *p_Fm = (t_Fm *)h_Fm;
+ t_Fm *p_Fm = (t_Fm*)h_Fm;
+
+ SANITY_CHECK_RETURN_ERROR(p_Fm, E_INVALID_HANDLE);
+ SANITY_CHECK_RETURN_ERROR(!p_Fm->p_FmDriverParam, E_INVALID_STATE);
+
+ p_Fm->portsPreFetchConfigured[portNum] = TRUE;
+ p_Fm->portsPreFetchValue[portNum] = preFetchConfigured;
+
+ return E_OK;
+}
+
+t_Error FmGetPortPreFetchConfiguration(t_Handle h_Fm,
+ uint8_t portNum,
+ bool *p_PortConfigured,
+ bool *p_PreFetchConfigured)
+{
+ t_Fm *p_Fm = (t_Fm*)h_Fm;
+
+ SANITY_CHECK_RETURN_ERROR(p_Fm, E_INVALID_HANDLE);
+ SANITY_CHECK_RETURN_ERROR(!p_Fm->p_FmDriverParam, E_INVALID_STATE);
+
+ /* If the prefetch wasn't configured yet (not enable or disabled)
+ we return the value TRUE as it was already configured */
+ if (!p_Fm->portsPreFetchConfigured[portNum])
+ {
+ *p_PortConfigured = FALSE;
+ *p_PreFetchConfigured = FALSE;
+ }
+ else
+ {
+ *p_PortConfigured = TRUE;
+ *p_PreFetchConfigured = (p_Fm->portsPreFetchConfigured[portNum]);
+ }
+
+ return E_OK;
+}
+
+t_Error FmSetCongestionGroupPFCpriority(t_Handle h_Fm,
+ uint32_t congestionGroupId,
+ uint8_t priorityBitMap)
+{
+ t_Fm *p_Fm = (t_Fm *)h_Fm;
ASSERT_COND(h_Fm);
if (congestionGroupId > FM_PORT_NUM_OF_CONGESTION_GRPS)
RETURN_ERROR(MAJOR, E_INVALID_VALUE,
- ("Congestion group ID bigger than %d \n!",
+ ("Congestion group ID bigger than %d",
FM_PORT_NUM_OF_CONGESTION_GRPS));
if (p_Fm->guestId == NCSW_MASTER_ID)
{
- uint32_t *p_Cpg = (uint32_t*)(p_Fm->baseAddr+FM_MM_CGP);
- uint32_t tmpReg;
- uint32_t reg_num;
- uint32_t offset;
+ uint32_t *p_Cpg = (uint32_t*)(p_Fm->baseAddr+FM_MM_CGP);
+ uint32_t tmpReg;
+ uint32_t reg_num;
+ uint32_t offset;
+ uint32_t mask;
ASSERT_COND(p_Fm->baseAddr);
reg_num = (FM_PORT_NUM_OF_CONGESTION_GRPS-1-(congestionGroupId))/4;
@@ -1346,15 +1388,13 @@ t_Error FmSetCongestionGroupPFCpriority(t_Handle h_Fm,
/* Adding priorities*/
if (priorityBitMap)
{
- if (tmpReg & (0xFF<<(offset*8)))
+ if (tmpReg & (0xFF << (offset*8)))
RETURN_ERROR(MAJOR, E_INVALID_STATE,
("PFC priority for the congestion group is already set!"));
}
else /* Deleting priorities */
{
- uint32_t mask;
-
- mask = 0xFF<<(offset*8);
+ mask = (uint32_t)(0xFF << (offset*8));
tmpReg &= ~mask;
}
@@ -2318,6 +2358,10 @@ void FmFreePortParams(t_Handle h_Fm,t_FmInterModulePortFreeParams *p_PortParams)
HW_PORT_ID_TO_SW_PORT_ID(macId, hardwarePortId);
+ /* Delete prefetch configuration*/
+ p_Fm->portsPreFetchConfigured[macId] = FALSE;
+ p_Fm->portsPreFetchValue[macId] = FALSE;
+
#if defined(FM_MAX_NUM_OF_10G_MACS) && (FM_MAX_NUM_OF_10G_MACS)
if ((p_PortParams->portType == e_FM_PORT_TYPE_TX_10G) ||
(p_PortParams->portType == e_FM_PORT_TYPE_RX_10G))
@@ -4119,6 +4163,7 @@ t_Handle FM_Config(t_FmParams *p_FmParam)
p_Fm->p_FmStateStruct->revInfo.minorRev = (uint8_t)((tmpReg & FPM_REV1_MINOR_MASK) >> FPM_REV1_MINOR_SHIFT);
/* Chip dependent, will be configured in Init */
+ p_Fm->tnumAgingPeriod = DEFAULT_tnumAgingPeriod;
p_Fm->p_FmDriverParam->dmaAidOverride = DEFAULT_aidOverride;
p_Fm->p_FmDriverParam->dmaAidMode = DEFAULT_aidMode;
#ifdef FM_AID_MODE_NO_TNUM_SW005