From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7181EA0597; Fri, 10 Apr 2020 01:04:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D0B11C43C; Fri, 10 Apr 2020 01:04:05 +0200 (CEST) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id 488CB1C2F1 for ; Fri, 10 Apr 2020 01:04:03 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id z26so271225ljz.11 for ; Thu, 09 Apr 2020 16:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=lbEnyYAroViHK19zGgcQqWRK/HJ+x4DCb9A3PljEJA8=; b=x8kvRaO4opiBXXLfdQpxWBr9gG/+TFYWaMgBhBuculM1htNQUiAzF2wLLMguTM8cHf b3HPML+cHlbVN8Nu+NU7kL+ohBrS7KWWbkKb34ttyiZZyZt+qkxOegdU0cloWLKNbQeJ 6Yx1+50V6dJh5HfUihs0M2osMNpvnm2EAHFupbD+3Oof3ICn/FGdm+HT9WdQPj2fR41a 3TIuf34LhaCSPQUrEaSpDrAJOHnkZO0tlf08YYBiRu6kbwQN1kDt6eY6If4NgjPPUMRH CJmrvZ3nB/K10BqvZfodPxx1/n3IWd//yeW9II0HzB0IiX28wnOu2YQMKmUpqOp9WEM6 yFSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lbEnyYAroViHK19zGgcQqWRK/HJ+x4DCb9A3PljEJA8=; b=isyYrYV24pWXLX9cPA7yQfP4KQzSAkKxcNhpYRVyv+MA0ziOFvlDCerhQr2rDs40MS Y9LD2cn2MudtxIutor0SiXFJIJbkrGZB0NxO/VTOoOLKWOzmksyLyfUxq/CSvN5lLYMQ T1yVQha26SznKyv5I9D+k77BEFFY8DMBdQyrJ3ZUteK52R+NpbAjQtexWIa01BsVdSho 0ILRcqayxRpeIhpoc/umnNi7PnfrbPU3YFhBxq5FRKJ5AMsPQBWnWa95tyScV9Gt4fr2 n4rCyov21nFXLGbCyOiP4cBQhK5a1ZrWV3jlZcF2rsoJgOQ0iuaQul2x1FbupMRNzPBW 9zYw== X-Gm-Message-State: AGi0PuYrV83SDPrh0hgEJNoMfzoRA9ippDeouKAAlB8t/nKI3yfr609D aSBflLJVqFerWNfPih21aBTTqpkwvCo= X-Google-Smtp-Source: APiQypIA0RYBuQ5k5h6X9dVCleXhM0TssHOSbpIRhpnuc0KyU45Cn/zdTUT9CiuBpLUtgmGQKiMtEA== X-Received: by 2002:a2e:9bc9:: with SMTP id w9mr850293ljj.213.1586473442220; Thu, 09 Apr 2020 16:04:02 -0700 (PDT) Received: from [192.168.8.100] (user-5-173-33-152.play-internet.pl. [5.173.33.152]) by smtp.gmail.com with ESMTPSA id y20sm245660lfh.25.2020.04.09.16.04.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2020 16:04:01 -0700 (PDT) To: dev@dpdk.org References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@marvell.com> <20200405085613.1336841-28-jerinj@marvell.com> From: Andrzej Ostruszka Message-ID: <8b4a122f-9d59-ddb3-8187-63f1e57e3d25@semihalf.com> Date: Fri, 10 Apr 2020 01:04:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200405085613.1336841-28-jerinj@marvell.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 27/29] l3fwd-graph: add graph config and main loop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 4/5/20 10:56 AM, jerinj@marvell.com wrote: > From: Nithin Dabilpuram > > Add graph creation, configuration logic and graph main loop. > This graph main loop is run on every slave lcore and calls > rte_graph_walk() to walk over lcore specific rte_graph. > Master core accumulates and prints graph walk stats of all the > lcore's graph's. > > Signed-off-by: Nithin Dabilpuram > --- [...] > @@ -826,11 +936,26 @@ main(int argc, char **argv) > "port=%d\n", > ret, portid); > > + /* Add this queue node to its graph */ > + snprintf(qconf->rx_queue_list[queue].node_name, > + RTE_NODE_NAMESIZE, "ethdev_rx-%u-%u", portid, > + queueid); > + } > + > + /* Alloc a graph to this lcore only if source exists */ > + if (qconf->n_rx_queue) { > + qconf->graph_id = nb_graphs; See below for a comment related to that. > + nb_graphs++; > } > } > > printf("\n"); > > + /* Ethdev node config, skip rx queue mapping */ > + ret = rte_node_eth_config(ethdev_conf, nb_conf, nb_graphs); > + if (ret) > + rte_exit(EXIT_FAILURE, "rte_node_eth_config: err=%d\n", ret); > + > /* Start ports */ > RTE_ETH_FOREACH_DEV(portid) > { > @@ -858,6 +983,119 @@ main(int argc, char **argv) > > check_all_ports_link_status(enabled_port_mask); > > + /* Graph Initialization */ > + memset(&graph_conf, 0, sizeof(graph_conf)); > + graph_conf.node_patterns = node_patterns; > + nb_patterns = RTE_DIM(node_patterns); > + > + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { > + rte_graph_t graph_id; > + rte_edge_t i; > + > + if (rte_lcore_is_enabled(lcore_id) == 0) > + continue; > + > + qconf = &lcore_conf[lcore_id]; > + > + /* Skip graph creation if no source exists */ > + if (!qconf->n_rx_queue) > + continue; > + > + /* Add rx node patterns of this lcore */ > + for (i = 0; i < qconf->n_rx_queue; i++) { > + graph_conf.node_patterns[nb_patterns + i] = > + qconf->rx_queue_list[i].node_name; > + } > + > + graph_conf.nb_node_patterns = nb_patterns + i; > + graph_conf.socket_id = rte_lcore_to_socket_id(lcore_id); > + > + snprintf(qconf->name, sizeof(qconf->name), "worker_%u", > + lcore_id); > + > + graph_id = rte_graph_create(qconf->name, &graph_conf); > + if (graph_id != qconf->graph_id) > + rte_exit(EXIT_FAILURE, > + "rte_graph_create(): graph_id=%d not " > + " as expected for lcore %u(%u\n", > + graph_id, lcore_id, qconf->graph_id); Should application be checking graph implementation? Maybe just check that it is not "invalid" and here store it to qconf->graph_id? > + > + qconf->graph = rte_graph_lookup(qconf->name); > + if (!qconf->graph) > + rte_exit(EXIT_FAILURE, > + "rte_graph_lookup(): graph %s not found\n", > + qconf->name); > + } > + > + memset(&rewrite_data, 0, sizeof(rewrite_data)); > + rewrite_len = sizeof(rewrite_data); > + > + /* Add route to ip4 graph infra */ > + for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) { > + char route_str[INET6_ADDRSTRLEN * 4]; > + char abuf[INET6_ADDRSTRLEN]; > + struct in_addr in; > + uint32_t dst_port; > + uint16_t next_hop; > + > + /* Skip unused ports */ > + if ((1 << ipv4_l3fwd_lpm_route_array[i].if_out & > + enabled_port_mask) == 0) > + continue; > + > + dst_port = ipv4_l3fwd_lpm_route_array[i].if_out; > + next_hop = i; What is the difference between next_hop and i? It looks to me like they both have the same type and value. So maybe instead of another object just add comment to route_add() below? No strong feeling here so you can ignore this comment. > + > + in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip); > + snprintf(route_str, sizeof(route_str), "%s / %d (%d)", > + inet_ntop(AF_INET, &in, abuf, sizeof(abuf)), > + ipv4_l3fwd_lpm_route_array[i].depth, > + ipv4_l3fwd_lpm_route_array[i].if_out); > + > + ret = rte_node_ip4_route_add( > + ipv4_l3fwd_lpm_route_array[i].ip, > + ipv4_l3fwd_lpm_route_array[i].depth, next_hop, > + RTE_NODE_IP4_LOOKUP_NEXT_REWRITE); > + With regards Andrzej Ostruszka