diff options
author | Mandy Lavi <mandy.lavi@freescale.com> | 2013-10-31 16:51:23 (GMT) |
---|---|---|
committer | Madalin-Cristian Bucur <madalin.bucur@freescale.com> | 2014-01-06 15:03:57 (GMT) |
commit | 55cfaca07b53b48608ce29150e152eb4ef0b2703 (patch) | |
tree | 653a859959f2550acc46df7f812e7468cc838222 /drivers/net/ethernet/freescale/fman/Peripherals/FM/SP | |
parent | 4ce33519e320bd72efaf3fab0acc4007af10a60e (diff) | |
download | linux-fsl-qoriq-55cfaca07b53b48608ce29150e152eb4ef0b2703.tar.xz |
fmd: fmd22 integration
- Fix for PCD: key mask not properly enabled in exact match table
- Fix for PFC mapping function
- Added counters for miss entry in match and hash tables
- Added counter for IPv4 options in IP fragmentation
Change-Id: I1626afc661d412c518172d405860a33d801cd005
Signed-off-by: Mandy Lavi <mandy.lavi@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/6251
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Marian-Cornel Chereji <marian.chereji@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Conflicts:
drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c
drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h
Change-Id: If356927d0cd4e22e8949a0106c2a403fcf1343a2
Reviewed-on: http://git.am.freescale.net:8181/7665
Reviewed-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Tested-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/fman/Peripherals/FM/SP')
-rw-r--r-- | drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fm_sp.c | 15 | ||||
-rwxr-xr-x | drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fman_sp.c | 286 |
2 files changed, 151 insertions, 150 deletions
diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fm_sp.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fm_sp.c index 1f1cdf2..14b15a1 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fm_sp.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fm_sp.c @@ -48,8 +48,8 @@ #include "fm_common.h" #include "fsl_fman_sp.h" -#if (DPAA_VERSION >= 11) +#if (DPAA_VERSION >= 11) static t_Error CheckParamsGeneratedInternally(t_FmVspEntry *p_FmVspEntry) { t_Error err = E_OK; @@ -61,6 +61,7 @@ static t_Error CheckParamsGeneratedInternally(t_FmVspEntry *p_FmVspEntry) return err; } + static t_Error CheckParams(t_FmVspEntry *p_FmVspEntry) { t_Error err = E_OK; @@ -538,18 +539,18 @@ t_Error FM_VSP_Init(t_Handle h_FmVsp) fm_vsp_params.buf_margins = (struct fman_sp_buf_margins*)&p_FmVspEntry->bufMargins; fm_vsp_params.int_context = (struct fman_sp_int_context_data_copy*)&p_FmVspEntry->intContext; - /*no check on err - it was checked earlier*/ + /* no check on err - it was checked earlier */ FmVSPGetAbsoluteProfileId(p_FmVspEntry->h_Fm, - p_FmVspEntry->portType, - p_FmVspEntry->portId, - p_FmVspEntry->relativeProfileId, - &absoluteProfileId); - + p_FmVspEntry->portType, + p_FmVspEntry->portId, + p_FmVspEntry->relativeProfileId, + &absoluteProfileId); ASSERT_COND(p_FmVspEntry->p_FmSpRegsBase); ASSERT_COND(fm_vsp_params.int_context); ASSERT_COND(fm_vsp_params.buf_margins); ASSERT_COND(IN_RANGE(0, absoluteProfileId, FM_VSP_MAX_NUM_OF_ENTRIES)); + /* Set all registers related to VSP */ fman_vsp_init(p_FmVspEntry->p_FmSpRegsBase, absoluteProfileId, &fm_vsp_params,FM_PORT_MAX_NUM_OF_EXT_POOLS, BM_MAX_NUM_OF_POOLS, FM_MAX_NUM_OF_PFC_PRIORITIES); diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fman_sp.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fman_sp.c index d1f1467..0f772e9 100755 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fman_sp.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/SP/fman_sp.c @@ -34,164 +34,164 @@ uint32_t fman_vsp_get_statistics(struct fm_pcd_storage_profile_regs *regs, - uint16_t index) + uint16_t index) { - struct fm_pcd_storage_profile_regs *sp_regs; - sp_regs = ®s[index]; - return ioread32be(&sp_regs->fm_sp_acnt); + struct fm_pcd_storage_profile_regs *sp_regs; + sp_regs = ®s[index]; + return ioread32be(&sp_regs->fm_sp_acnt); } void fman_vsp_set_statistics(struct fm_pcd_storage_profile_regs *regs, - uint16_t index, uint32_t value) + uint16_t index, uint32_t value) { - struct fm_pcd_storage_profile_regs *sp_regs; - sp_regs = ®s[index]; - iowrite32be(value, &sp_regs->fm_sp_acnt); + struct fm_pcd_storage_profile_regs *sp_regs; + sp_regs = ®s[index]; + iowrite32be(value, &sp_regs->fm_sp_acnt); } void fman_vsp_defconfig(struct fm_storage_profile_params *cfg) { - cfg->dma_swap_data = - DEFAULT_FMAN_SP_DMA_SWAP_DATA; - cfg->int_context_cache_attr = - DEFAULT_FMAN_SP_DMA_INT_CONTEXT_CACHE_ATTR; - cfg->header_cache_attr = - DEFAULT_FMAN_SP_DMA_HEADER_CACHE_ATTR; - cfg->scatter_gather_cache_attr = - DEFAULT_FMAN_SP_DMA_SCATTER_GATHER_CACHE_ATTR; - cfg->dma_write_optimize = - DEFAULT_FMAN_SP_DMA_WRITE_OPTIMIZE; - cfg->no_scather_gather = - DEFAULT_FMAN_SP_NO_SCATTER_GATHER; + cfg->dma_swap_data = + DEFAULT_FMAN_SP_DMA_SWAP_DATA; + cfg->int_context_cache_attr = + DEFAULT_FMAN_SP_DMA_INT_CONTEXT_CACHE_ATTR; + cfg->header_cache_attr = + DEFAULT_FMAN_SP_DMA_HEADER_CACHE_ATTR; + cfg->scatter_gather_cache_attr = + DEFAULT_FMAN_SP_DMA_SCATTER_GATHER_CACHE_ATTR; + cfg->dma_write_optimize = + DEFAULT_FMAN_SP_DMA_WRITE_OPTIMIZE; + cfg->no_scather_gather = + DEFAULT_FMAN_SP_NO_SCATTER_GATHER; } static inline uint32_t calc_vec_dep(int max_pools, bool *pools, - struct fman_ext_pools *ext_buf_pools, uint32_t mask) + struct fman_ext_pools *ext_buf_pools, uint32_t mask) { - int i, j; - uint32_t vector = 0; - for (i = 0; i < max_pools; i++) - if (pools[i]) - for (j = 0; j < ext_buf_pools->num_pools_used; j++) - if (i == ext_buf_pools->ext_buf_pool[j].id) { - vector |= mask >> j; - break; - } - return vector; + int i, j; + uint32_t vector = 0; + for (i = 0; i < max_pools; i++) + if (pools[i]) + for (j = 0; j < ext_buf_pools->num_pools_used; j++) + if (i == ext_buf_pools->ext_buf_pool[j].id) { + vector |= mask >> j; + break; + } + return vector; } void fman_vsp_init(struct fm_pcd_storage_profile_regs *regs, - uint16_t index, struct fm_storage_profile_params *fm_vsp_params, - int port_max_num_of_ext_pools, int bm_max_num_of_pools, - int max_num_of_pfc_priorities) + uint16_t index, struct fm_storage_profile_params *fm_vsp_params, + int port_max_num_of_ext_pools, int bm_max_num_of_pools, + int max_num_of_pfc_priorities) { - int i = 0, j = 0; - struct fm_pcd_storage_profile_regs *sp_regs; - uint32_t tmp_reg, vector; - struct fman_ext_pools *ext_buf_pools = &fm_vsp_params->fm_ext_pools; - struct fman_buf_pool_depletion *buf_pool_depletion = - &fm_vsp_params->buf_pool_depletion; - struct fman_backup_bm_pools *backup_pools = - &fm_vsp_params->backup_pools; - struct fman_sp_int_context_data_copy *int_context_data_copy = - fm_vsp_params->int_context; - struct fman_sp_buf_margins *external_buffer_margins = - fm_vsp_params->buf_margins; - bool no_scather_gather = fm_vsp_params->no_scather_gather; - uint16_t liodn_offset = fm_vsp_params->liodn_offset; - - sp_regs = ®s[index]; - - /* fill external buffers manager pool information register*/ - for (i = 0; i < ext_buf_pools->num_pools_used; i++) { - tmp_reg = FMAN_SP_EXT_BUF_POOL_VALID | - FMAN_SP_EXT_BUF_POOL_EN_COUNTER; - tmp_reg |= ((uint32_t)ext_buf_pools->ext_buf_pool[i].id << - FMAN_SP_EXT_BUF_POOL_ID_SHIFT); - tmp_reg |= ext_buf_pools->ext_buf_pool[i].size; - /* functionality available only for some deriviatives - (limited by config) */ - for (j = 0; j < backup_pools->num_backup_pools; j++) - if (ext_buf_pools->ext_buf_pool[i].id == - backup_pools->pool_ids[j]) { - tmp_reg |= FMAN_SP_EXT_BUF_POOL_BACKUP; - break; - } - iowrite32be(tmp_reg, &sp_regs->fm_sp_ebmpi[i]); - } - - /* clear unused pools */ - for (i = ext_buf_pools->num_pools_used; - i < port_max_num_of_ext_pools; i++) - iowrite32be(0, &sp_regs->fm_sp_ebmpi[i]); - - /* fill pool depletion register*/ - tmp_reg = 0; - if (buf_pool_depletion->buf_pool_depletion_enabled && buf_pool_depletion->pools_grp_mode_enable) { - /* calculate vector for number of pools depletion */ - vector = calc_vec_dep(bm_max_num_of_pools, buf_pool_depletion-> - pools_to_consider, ext_buf_pools, 0x80000000); - - /* configure num of pools and vector for number of pools mode */ - tmp_reg |= (((uint32_t)buf_pool_depletion->num_pools - 1) << - FMAN_SP_POOL_DEP_NUM_OF_POOLS_SHIFT); - tmp_reg |= vector; - } - - if (buf_pool_depletion->buf_pool_depletion_enabled && buf_pool_depletion->single_pool_mode_enable) { - /* calculate vector for number of pools depletion */ - vector = calc_vec_dep(bm_max_num_of_pools, buf_pool_depletion-> - pools_to_consider_for_single_mode, - ext_buf_pools, 0x00000080); - - /* configure num of pools and vector for number of pools mode */ - tmp_reg |= vector; - } - - /* fill QbbPEV */ - if (buf_pool_depletion->buf_pool_depletion_enabled) { - vector = 0; - for (i = 0; i < max_num_of_pfc_priorities; i++) - if (buf_pool_depletion->pfc_priorities_en[i] == TRUE) - vector |= 0x00008000 >> i; - tmp_reg |= vector; - } - iowrite32be(tmp_reg, &sp_regs->fm_sp_mpd); - - /* fill dma attributes register */ - tmp_reg = 0; - tmp_reg |= (uint32_t)fm_vsp_params->dma_swap_data << - FMAN_SP_DMA_ATTR_SWP_SHIFT; - tmp_reg |= (uint32_t)fm_vsp_params->int_context_cache_attr << - FMAN_SP_DMA_ATTR_IC_CACHE_SHIFT; - tmp_reg |= (uint32_t)fm_vsp_params->header_cache_attr << - FMAN_SP_DMA_ATTR_HDR_CACHE_SHIFT; - tmp_reg |= (uint32_t)fm_vsp_params->scatter_gather_cache_attr << - FMAN_SP_DMA_ATTR_SG_CACHE_SHIFT; - if (fm_vsp_params->dma_write_optimize) - tmp_reg |= FMAN_SP_DMA_ATTR_WRITE_OPTIMIZE; - iowrite32be(tmp_reg, &sp_regs->fm_sp_da); - - /* IC parameters - fill internal context parameters register */ - tmp_reg = 0; - tmp_reg |= (((uint32_t)int_context_data_copy->ext_buf_offset/ - OFFSET_UNITS) << FMAN_SP_IC_TO_EXT_SHIFT); - tmp_reg |= (((uint32_t)int_context_data_copy->int_context_offset/ - OFFSET_UNITS) << FMAN_SP_IC_FROM_INT_SHIFT); - tmp_reg |= (((uint32_t)int_context_data_copy->size/OFFSET_UNITS) << - FMAN_SP_IC_SIZE_SHIFT); - iowrite32be(tmp_reg, &sp_regs->fm_sp_icp); - - /* buffer margins - fill external buffer margins register */ - tmp_reg = 0; - tmp_reg |= (((uint32_t)external_buffer_margins->start_margins) << - FMAN_SP_EXT_BUF_MARG_START_SHIFT); - tmp_reg |= (((uint32_t)external_buffer_margins->end_margins) << - FMAN_SP_EXT_BUF_MARG_END_SHIFT); - if (no_scather_gather) - tmp_reg |= FMAN_SP_SG_DISABLE; - iowrite32be(tmp_reg, &sp_regs->fm_sp_ebm); - - /* buffer margins - fill spliodn register */ - iowrite32be(liodn_offset, &sp_regs->fm_sp_spliodn); + int i = 0, j = 0; + struct fm_pcd_storage_profile_regs *sp_regs; + uint32_t tmp_reg, vector; + struct fman_ext_pools *ext_buf_pools = &fm_vsp_params->fm_ext_pools; + struct fman_buf_pool_depletion *buf_pool_depletion = + &fm_vsp_params->buf_pool_depletion; + struct fman_backup_bm_pools *backup_pools = + &fm_vsp_params->backup_pools; + struct fman_sp_int_context_data_copy *int_context_data_copy = + fm_vsp_params->int_context; + struct fman_sp_buf_margins *external_buffer_margins = + fm_vsp_params->buf_margins; + bool no_scather_gather = fm_vsp_params->no_scather_gather; + uint16_t liodn_offset = fm_vsp_params->liodn_offset; + + sp_regs = ®s[index]; + + /* fill external buffers manager pool information register*/ + for (i = 0; i < ext_buf_pools->num_pools_used; i++) { + tmp_reg = FMAN_SP_EXT_BUF_POOL_VALID | + FMAN_SP_EXT_BUF_POOL_EN_COUNTER; + tmp_reg |= ((uint32_t)ext_buf_pools->ext_buf_pool[i].id << + FMAN_SP_EXT_BUF_POOL_ID_SHIFT); + tmp_reg |= ext_buf_pools->ext_buf_pool[i].size; + /* functionality available only for some deriviatives + (limited by config) */ + for (j = 0; j < backup_pools->num_backup_pools; j++) + if (ext_buf_pools->ext_buf_pool[i].id == + backup_pools->pool_ids[j]) { + tmp_reg |= FMAN_SP_EXT_BUF_POOL_BACKUP; + break; + } + iowrite32be(tmp_reg, &sp_regs->fm_sp_ebmpi[i]); + } + + /* clear unused pools */ + for (i = ext_buf_pools->num_pools_used; + i < port_max_num_of_ext_pools; i++) + iowrite32be(0, &sp_regs->fm_sp_ebmpi[i]); + + /* fill pool depletion register*/ + tmp_reg = 0; + if (buf_pool_depletion->buf_pool_depletion_enabled && buf_pool_depletion->pools_grp_mode_enable) { + /* calculate vector for number of pools depletion */ + vector = calc_vec_dep(bm_max_num_of_pools, buf_pool_depletion-> + pools_to_consider, ext_buf_pools, 0x80000000); + + /* configure num of pools and vector for number of pools mode */ + tmp_reg |= (((uint32_t)buf_pool_depletion->num_pools - 1) << + FMAN_SP_POOL_DEP_NUM_OF_POOLS_SHIFT); + tmp_reg |= vector; + } + + if (buf_pool_depletion->buf_pool_depletion_enabled && buf_pool_depletion->single_pool_mode_enable) { + /* calculate vector for number of pools depletion */ + vector = calc_vec_dep(bm_max_num_of_pools, buf_pool_depletion-> + pools_to_consider_for_single_mode, + ext_buf_pools, 0x00000080); + + /* configure num of pools and vector for number of pools mode */ + tmp_reg |= vector; + } + + /* fill QbbPEV */ + if (buf_pool_depletion->buf_pool_depletion_enabled) { + vector = 0; + for (i = 0; i < max_num_of_pfc_priorities; i++) + if (buf_pool_depletion->pfc_priorities_en[i] == TRUE) + vector |= 0x00000100 << i; + tmp_reg |= vector; + } + iowrite32be(tmp_reg, &sp_regs->fm_sp_mpd); + + /* fill dma attributes register */ + tmp_reg = 0; + tmp_reg |= (uint32_t)fm_vsp_params->dma_swap_data << + FMAN_SP_DMA_ATTR_SWP_SHIFT; + tmp_reg |= (uint32_t)fm_vsp_params->int_context_cache_attr << + FMAN_SP_DMA_ATTR_IC_CACHE_SHIFT; + tmp_reg |= (uint32_t)fm_vsp_params->header_cache_attr << + FMAN_SP_DMA_ATTR_HDR_CACHE_SHIFT; + tmp_reg |= (uint32_t)fm_vsp_params->scatter_gather_cache_attr << + FMAN_SP_DMA_ATTR_SG_CACHE_SHIFT; + if (fm_vsp_params->dma_write_optimize) + tmp_reg |= FMAN_SP_DMA_ATTR_WRITE_OPTIMIZE; + iowrite32be(tmp_reg, &sp_regs->fm_sp_da); + + /* IC parameters - fill internal context parameters register */ + tmp_reg = 0; + tmp_reg |= (((uint32_t)int_context_data_copy->ext_buf_offset/ + OFFSET_UNITS) << FMAN_SP_IC_TO_EXT_SHIFT); + tmp_reg |= (((uint32_t)int_context_data_copy->int_context_offset/ + OFFSET_UNITS) << FMAN_SP_IC_FROM_INT_SHIFT); + tmp_reg |= (((uint32_t)int_context_data_copy->size/OFFSET_UNITS) << + FMAN_SP_IC_SIZE_SHIFT); + iowrite32be(tmp_reg, &sp_regs->fm_sp_icp); + + /* buffer margins - fill external buffer margins register */ + tmp_reg = 0; + tmp_reg |= (((uint32_t)external_buffer_margins->start_margins) << + FMAN_SP_EXT_BUF_MARG_START_SHIFT); + tmp_reg |= (((uint32_t)external_buffer_margins->end_margins) << + FMAN_SP_EXT_BUF_MARG_END_SHIFT); + if (no_scather_gather) + tmp_reg |= FMAN_SP_SG_DISABLE; + iowrite32be(tmp_reg, &sp_regs->fm_sp_ebm); + + /* buffer margins - fill spliodn register */ + iowrite32be(liodn_offset, &sp_regs->fm_sp_spliodn); } |