X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fdpaa2%2Fbase%2Fdpaa2_hw_dpni.c;h=641e7027f12e9ddd121923cfe8ba8a70d7082f4e;hb=b37ed6def36798342172f298516c5fc6d0d8e070;hp=d69156bcc8f158417a327f5fcfc66e0f315a248a;hpb=40f840253100e4105f16e71e9cf8fd33bb51a6a0;p=dpdk.git diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index d69156bcc8..641e7027f1 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2019 NXP + * Copyright 2016-2021 NXP * */ @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include @@ -41,6 +41,17 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, void *p_params; int ret, tc_index = 0; + if (!rte_eth_dev_is_valid_port(port_id)) { + DPAA2_PMD_WARN("Invalid port id %u", port_id); + return -EINVAL; + } + + if (strcmp(eth_dev->device->driver->name, + RTE_STR(NET_DPAA2_PMD_DRIVER_NAME))) { + DPAA2_PMD_WARN("Not a valid dpaa2 port"); + return -EINVAL; + } + p_params = rte_zmalloc( NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); if (!p_params) { @@ -88,7 +99,21 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, struct dpni_rx_dist_cfg tc_cfg; struct dpkg_profile_cfg kg_cfg; void *p_params; - int ret; + int ret, tc_dist_queues; + + /*TC distribution size is set with dist_queues or + * nb_rx_queues % dist_queues in order of TC priority index. + * Calculating dist size for this tc_index:- + */ + tc_dist_queues = eth_dev->data->nb_rx_queues - + tc_index * priv->dist_queues; + if (tc_dist_queues <= 0) { + DPAA2_PMD_INFO("No distribution on TC%d", tc_index); + return 0; + } + + if (tc_dist_queues > priv->dist_queues) + tc_dist_queues = priv->dist_queues; p_params = rte_malloc( NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE); @@ -109,7 +134,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev, } tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params)); - tc_cfg.dist_size = priv->dist_queues; + tc_cfg.dist_size = tc_dist_queues; tc_cfg.enable = true; tc_cfg.tc = tc_index; @@ -180,14 +205,16 @@ dpaa2_distset_to_dpkg_profile_cfg( uint64_t req_dist_set, struct dpkg_profile_cfg *kg_cfg) { - uint32_t loop = 0, i = 0, dist_field = 0; + uint32_t loop = 0, i = 0; + uint64_t dist_field = 0; int l2_configured = 0, l3_configured = 0; int l4_configured = 0, sctp_configured = 0; + int mpls_configured = 0; memset(kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); while (req_dist_set) { if (req_dist_set % 2 != 0) { - dist_field = 1U << loop; + dist_field = 1ULL << loop; switch (dist_field) { case ETH_RSS_L2_PAYLOAD: @@ -206,6 +233,43 @@ dpaa2_distset_to_dpkg_profile_cfg( i++; break; + case ETH_RSS_MPLS: + + if (mpls_configured) + break; + mpls_configured = 1; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_MPLS; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_MPLS_MPLSL_1; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_MPLS; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_MPLS_MPLSL_2; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + + kg_cfg->extracts[i].extract.from_hdr.prot = + NET_PROT_MPLS; + kg_cfg->extracts[i].extract.from_hdr.field = + NH_FLD_MPLS_MPLSL_N; + kg_cfg->extracts[i].type = + DPKG_EXTRACT_FROM_HDR; + kg_cfg->extracts[i].extract.from_hdr.type = + DPKG_FULL_FIELD; + i++; + break; + case ETH_RSS_IPV4: case ETH_RSS_FRAG_IPV4: case ETH_RSS_NONFRAG_IPV4_OTHER: @@ -312,7 +376,7 @@ dpaa2_distset_to_dpkg_profile_cfg( default: DPAA2_PMD_WARN( - "Unsupported flow dist option %x", + "unsupported flow dist option 0x%" PRIx64, dist_field); return -EINVAL; }