X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fdpaa2%2Fbase%2Fdpaa2_hw_dpni.c;h=713a41bf34646519f0ca1b9355361970c536d3c7;hb=0ebce6129bc62697c3385606cd50a0c713cbd09d;hp=547025dfd17d902c5f94f49c6057de5c0ff6c4f0;hpb=9464dbe9c970ee209bc54b680b2c797e05a2561f;p=dpdk.git diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 547025dfd1..713a41bf34 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -1,63 +1,36 @@ -/*- - * BSD LICENSE +/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright (c) 2016 NXP. All rights reserved. + * Copyright 2016 NXP * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Freescale Semiconductor, Inc nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include -#include +#include #include #include #include #include #include #include -#include -#include +#include #include #include #include "../dpaa2_ethdev.h" -static void +static int dpaa2_distset_to_dpkg_profile_cfg( - uint32_t req_dist_set, + uint64_t req_dist_set, struct dpkg_profile_cfg *kg_cfg); int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, - uint32_t req_dist_set) + uint64_t req_dist_set) { struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; struct fsl_mc_io *dpni = priv->hw; @@ -69,20 +42,26 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, p_params = rte_malloc( NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); if (!p_params) { - RTE_LOG(ERR, PMD, "Memory unavaialble\n"); + DPAA2_PMD_ERR("Unable to allocate flow-dist parameters"); return -ENOMEM; } memset(p_params, 0, DIST_PARAM_IOVA_SIZE); memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg)); - dpaa2_distset_to_dpkg_profile_cfg(req_dist_set, &kg_cfg); + ret = dpaa2_distset_to_dpkg_profile_cfg(req_dist_set, &kg_cfg); + if (ret) { + DPAA2_PMD_ERR("Given RSS Hash (%" PRIx64 ") not supported", + req_dist_set); + rte_free(p_params); + return ret; + } tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params)); tc_cfg.dist_size = eth_dev->data->nb_rx_queues; tc_cfg.dist_mode = DPNI_DIST_MODE_HASH; - ret = dpni_prepare_key_cfg(&kg_cfg, p_params); + ret = dpkg_prepare_key_cfg(&kg_cfg, p_params); if (ret) { - RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n"); + DPAA2_PMD_ERR("Unable to prepare extract parameters"); rte_free(p_params); return ret; } @@ -91,8 +70,9 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, &tc_cfg); rte_free(p_params); if (ret) { - RTE_LOG(ERR, PMD, "Setting distribution for Rx failed with" - " err code: %d\n", ret); + DPAA2_PMD_ERR( + "Setting distribution for Rx failed with err: %d", + ret); return ret; } @@ -113,19 +93,19 @@ int dpaa2_remove_flow_dist( p_params = rte_malloc( NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); if (!p_params) { - RTE_LOG(ERR, PMD, "Memory unavaialble\n"); + DPAA2_PMD_ERR("Unable to allocate flow-dist parameters"); return -ENOMEM; } memset(p_params, 0, DIST_PARAM_IOVA_SIZE); memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg)); - + kg_cfg.num_extracts = 0; tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params)); tc_cfg.dist_size = 0; tc_cfg.dist_mode = DPNI_DIST_MODE_NONE; - ret = dpni_prepare_key_cfg(&kg_cfg, p_params); + ret = dpkg_prepare_key_cfg(&kg_cfg, p_params); if (ret) { - RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n"); + DPAA2_PMD_ERR("Unable to prepare extract parameters"); rte_free(p_params); return ret; } @@ -133,17 +113,16 @@ int dpaa2_remove_flow_dist( ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index, &tc_cfg); rte_free(p_params); - if (ret) { - RTE_LOG(ERR, PMD, "Setting distribution for Rx failed with" - " err code: %d\n", ret); - return ret; - } + if (ret) + DPAA2_PMD_ERR( + "Setting distribution for Rx failed with err: %d", + ret); return ret; } -static void +static int dpaa2_distset_to_dpkg_profile_cfg( - uint32_t req_dist_set, + uint64_t req_dist_set, struct dpkg_profile_cfg *kg_cfg) { uint32_t loop = 0, i = 0, dist_field = 0; @@ -277,14 +256,17 @@ dpaa2_distset_to_dpkg_profile_cfg( break; default: - PMD_DRV_LOG(WARNING, "Bad flow distribution" - " option %x\n", dist_field); + DPAA2_PMD_WARN( + "Unsupported flow dist option %x", + dist_field); + return -EINVAL; } } req_dist_set = req_dist_set >> 1; loop++; } kg_cfg->num_extracts = i; + return 0; } int @@ -313,17 +295,19 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, layout.options = DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM | DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | DPNI_BUF_LAYOUT_OPT_PARSER_RESULT | + DPNI_BUF_LAYOUT_OPT_DATA_ALIGN | DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE; layout.pass_frame_status = 1; layout.private_data_size = DPAA2_FD_PTA_SIZE; layout.pass_parser_result = 1; + layout.data_align = DPAA2_PACKET_LAYOUT_ALIGN; layout.data_head_room = tot_size - DPAA2_FD_PTA_SIZE - DPAA2_MBUF_HW_ANNOTATION; retcode = dpni_set_buffer_layout(dpni, CMD_PRI_LOW, priv->token, DPNI_QUEUE_RX, &layout); if (retcode) { - PMD_INIT_LOG(ERR, "Err(%d) in setting rx buffer layout\n", + DPAA2_PMD_ERR("Error configuring buffer pool Rx layout (%d)", retcode); return retcode; } @@ -332,15 +316,15 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, bpool_cfg.num_dpbp = 1; bpool_cfg.pools[0].dpbp_id = bp_list->buf_pool.dpbp_node->dpbp_id; bpool_cfg.pools[0].backup_pool = 0; - bpool_cfg.pools[0].buffer_size = - RTE_ALIGN_CEIL(bp_list->buf_pool.size, - 256 /*DPAA2_PACKET_LAYOUT_ALIGN*/); + bpool_cfg.pools[0].buffer_size = RTE_ALIGN_CEIL(bp_list->buf_pool.size, + DPAA2_PACKET_LAYOUT_ALIGN); + bpool_cfg.pools[0].priority_mask = 0; retcode = dpni_set_pools(dpni, CMD_PRI_LOW, priv->token, &bpool_cfg); if (retcode != 0) { - PMD_INIT_LOG(ERR, "Error in attaching the buffer pool list" - " bpid = %d Error code = %d\n", - bpool_cfg.pools[0].dpbp_id, retcode); + DPAA2_PMD_ERR("Error configuring buffer pool on interface." + " bpid = %d error code = %d", + bpool_cfg.pools[0].dpbp_id, retcode); return retcode; }