From 62f235b427813b031176be5db848cad3ef7df019 Mon Sep 17 00:00:00 2001 From: Mandy Lavi Date: Mon, 20 Apr 2015 01:14:44 +0900 Subject: fmd: Add support for SW parser being run before HW parser Change-Id: Ia1830aa7a73fcc081dc6e54ee0599b10747bcd2b Signed-off-by: Mandy Lavi Reviewed-on: http://git.am.freescale.net:8181/35266 Reviewed-by: Liron Himi Reviewed-by: Honghua Yin Tested-by: Honghua Yin diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c index 50d8d4c..bbcc59a 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c @@ -1093,6 +1093,7 @@ static t_Error SetPcd(t_FmPort *p_FmPort, t_FmPortPcdParams *p_PcdParams) uint8_t physicalSchemeId; uint32_t ccTreePhysOffset; t_FmPcdKgInterModuleBindPortToSchemes schemeBind; + uint32_t initialSwPrs = 0; ASSERT_COND(p_FmPort); SANITY_CHECK_RETURN_ERROR(!p_FmPort->p_FmPortDriverParam, E_INVALID_STATE); @@ -1493,6 +1494,24 @@ static t_Error SetPcd(t_FmPort *p_FmPort, t_FmPortPcdParams *p_PcdParams) for (i = 0; i < p_PcdParams->p_PrsParams->numOfHdrsWithAdditionalParams; i++) { + /* case for using sw parser as the initial NIA address, before + * HW parsing + */ + if ((p_PcdParams->p_PrsParams->additionalParams[i].hdr == HEADER_TYPE_NONE) && + p_PcdParams->p_PrsParams->additionalParams[i].swPrsEnable) + { + initialSwPrs = FmPcdGetSwPrsOffset(p_FmPort->h_FmPcd, HEADER_TYPE_NONE, + p_PcdParams->p_PrsParams->additionalParams[i].indexPerHdr); + if (initialSwPrs == ILLEGAL_BASE) + RETURN_ERROR(MAJOR, E_INVALID_VALUE, NO_MSG); + + /* clear parser first HXS */ + p_FmPort->savedBmiNia &= ~BMI_RFNE_HXS_MASK; /* 0x000000FF */ + /* rewrite with soft parser start */ + p_FmPort->savedBmiNia |= initialSwPrs; + continue; + } + hdrNum = GetPrsHdrNum(p_PcdParams->p_PrsParams->additionalParams[i].hdr); if (hdrNum == ILLEGAL_HDR_NUM) diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h index b9fe9b3..eabf892 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h @@ -509,6 +509,7 @@ typedef _Packed struct #define BMI_PORT_RFNE_FRWD_DCL4C 0x10000000 #define BMI_PORT_RFNE_FRWD_RPD 0x40000000 #define BMI_RFNE_FDCS_MASK 0xFF000000 +#define BMI_RFNE_HXS_MASK 0x000000FF #define BMI_CMD_MR_LEAC 0x00200000 #define BMI_CMD_MR_SLEAC 0x00100000 diff --git a/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_pcd_ext.h b/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_pcd_ext.h index 3961a37..e4519cc 100644 --- a/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_pcd_ext.h +++ b/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_pcd_ext.h @@ -434,7 +434,10 @@ typedef struct t_FmPcdPrsLabelParams { uint32_t instructionOffset; /**< SW parser label instruction offset (2 bytes resolution), relative to Parser RAM. */ e_NetHeaderType hdr; /**< The existence of this header will invoke - the SW parser code. */ + the SW parser code; Use HEADER_TYPE_NONE + to indicate that sw parser is to run + independent of the existence of any protocol + (run before HW parser). */ uint8_t indexPerHdr; /**< Normally 0, if more than one SW parser attachments for the same header, use this index to distinguish between them. */ diff --git a/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_port_ext.h b/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_port_ext.h index 804b598..dbade61 100644 --- a/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_port_ext.h +++ b/drivers/net/ethernet/freescale/fman/inc/Peripherals/fm_port_ext.h @@ -2176,7 +2176,12 @@ typedef union u_FmPcdHdrPrsOpts { @Description A structure for defining each header for the parser *//***************************************************************************/ typedef struct t_FmPcdPrsAdditionalHdrParams { - e_NetHeaderType hdr; /**< Selected header */ + e_NetHeaderType hdr; /**< Selected header; use HEADER_TYPE_NONE + to indicate that sw parser is to run first + (before HW parser, and independent of the + existence of any protocol), in this case, + swPrsEnable must be set, and all other + parameters are irrelevant. */ bool errDisable; /**< TRUE to disable error indication */ bool swPrsEnable; /**< Enable jump to SW parser when this header is recognized by the HW parser. */ -- cgit v0.10.2