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 A8801A0597; Fri, 10 Apr 2020 01:04:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 87BFB1D14C; Fri, 10 Apr 2020 01:04:41 +0200 (CEST) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 2988E1D127 for ; Fri, 10 Apr 2020 01:04:40 +0200 (CEST) Received: by mail-lf1-f66.google.com with SMTP id 198so136995lfo.7 for ; Thu, 09 Apr 2020 16:04:40 -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=0bM90UzIs4op7TPXmexWaZ099YJTYASHCPUoEqgfJkw=; b=DJfB13icBgs66Bit7Y1EY/bC8cnZgWOxg77qzPSwOkBpk13jur8g3h7MpB/FhIFKSw VClFy0xIpVB52fAPnSEBAAk29s1b7d820ATmMQPmy8iM2itqeuyDA7aLD7U2ZzBzR+6Z RteXaApg6uifWSgi/mdNeGB4tEBde33ZcLh97I+tk/6PUgYuc5FZW02I5c2Xo/VSKjp4 u/kTOW0NgjdGHKoTZqTTHs4yPe/TKbbfY/Ig6IAarZPehUnBS9lZN4azKHnWE0jxRzMk GZSsHwHvSxaAmvoqwwkMPaLYL9l/ddAp8HoHDc8kygaMcle0m/O8hKpjzEWscLNLNi9d umIQ== 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=0bM90UzIs4op7TPXmexWaZ099YJTYASHCPUoEqgfJkw=; b=oBlzbCgT/5rFTiNSVbvM4T51iceYFRQ9Kr3IaQATykK4r5VZ5Ruvlr/uP/Nxj6ckxi gZcaNIVlxVrS7vSxrpS2OM/K5GtkSXSztYE3GFJfzPSb01jxCVTAptrZYF8jREQ29Sgk YddiwDW7Hjv8brd6Yap2IAASXi6aUFSh+rgHyBOkkveOYnd4Nwj2AE2H8Ry3wdmgt6/U 7po9mrtBgMQA0EQBPSMGJJlXak+vb33pgXXLvfIC2RLSYnawRM87drxpmmeEPVennlKx oxE08p3bXsdjScO08kZKM3j1zGQBBG2Zg4RwytY4CjafhbkRtbLRlaBFk0/AcKSMSRzh +QIA== X-Gm-Message-State: AGi0PuYwJMwgK9/u6WIJD6R1BHJcWaNTCIwcnnvhVYX6/w95SPfkcMTo Z+sY0KgXzNsbWelPuelCq37bUbR1vMU= X-Google-Smtp-Source: APiQypK+NnC70mHw7nnf+2GQqmJqYe5dDbCg/MeXjJgyjlDJEqKOnBLVsfzZ+UtmTu/LFPAidOwhNw== X-Received: by 2002:a05:6512:74:: with SMTP id i20mr361418lfo.104.1586473479201; Thu, 09 Apr 2020 16:04:39 -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 y199sm230920lfa.80.2020.04.09.16.04.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2020 16:04:38 -0700 (PDT) To: dev@dpdk.org References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@marvell.com> <20200405085613.1336841-24-jerinj@marvell.com> From: Andrzej Ostruszka Message-ID: <56ccde3d-3f50-595f-1dd2-a8be362dff3c@semihalf.com> Date: Fri, 10 Apr 2020 01:04:37 +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-24-jerinj@marvell.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 23/29] node: add ipv4 rewrite and lookup ctrl API 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 ip4_rewrite and ip4_lookup ctrl API. ip4_lookup ctrl > API is used to add route entries for LPM lookup with > result data containing next hop id and next proto. > ip4_rewrite ctrl API is used to add rewrite data for > every next hop. > > Signed-off-by: Nithin Dabilpuram > Signed-off-by: Pavan Nikhilesh > Signed-off-by: Kiran Kumar K > --- [...] > @@ -93,6 +97,18 @@ rte_node_eth_config(struct rte_node_ethdev_config *conf, uint16_t nb_confs, > > node_dbg("ethdev", "Tx node %s-%s: is at %u", tx_node->name, > name, id); > + > + /* Prepare the actual name of the cloned node */ > + snprintf(name, sizeof(name), "ethdev_tx-%u", port_id); > + > + /* Add this tx port node as next to ip4_rewrite_node */ > + rte_node_edge_update(ip4_rewrite_node->id, RTE_EDGE_ID_INVALID, > + &next_nodes, 1); Maybe I've missed something but it looks to me like all uses are of "append" kind. Either during initialization (with 0) or here, so maybe a chance to simplify API? > + /* Assuming edge id is the last one alloc'ed */ > + rc = ip4_rewrite_set_next( > + port_id, rte_node_edge_count(ip4_rewrite_node->id) - 1); > + if (rc < 0) > + return rc; > } > > ctrl.nb_graphs = nb_graphs; > diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c > index 3a38f5ad8..d10d17879 100644 > --- a/lib/librte_node/ip4_lookup.c > +++ b/lib/librte_node/ip4_lookup.c > @@ -28,6 +28,8 @@ struct ip4_lookup_node_main { > struct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES]; > }; > > +static struct ip4_lookup_node_main ip4_lookup_nm; > + > #if defined(RTE_MACHINE_CPUFLAG_NEON) > #include "ip4_lookup_neon.h" > #elif defined(RTE_ARCH_X86) > @@ -109,12 +111,90 @@ ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node, > > #endif > > +int > +rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop, > + enum rte_node_ip4_lookup_next next_node) > +{ > + char abuf[INET6_ADDRSTRLEN]; > + struct in_addr in; > + uint8_t socket; > + uint32_t val; > + int ret; > + > + in.s_addr = htonl(ip); > + inet_ntop(AF_INET, &in, abuf, sizeof(abuf)); > + /* Embedded next node id in next hop */ > + val = (next_node << 16) | next_hop; I guess this assumes that the next hop is 32 bits. I might be misunderstanding the implementation but it looks to me like it is 24bits (the docs still say "the user data is 1-byte long" though), at least this is my impression from struct rte_lpm_tbl_entry. > + node_dbg("ip4_lookup", "LPM: Adding route %s / %d nh (0x%x)", abuf, > + depth, val); > + > + for (socket = 0; socket < RTE_MAX_NUMA_NODES; socket++) { > + if (!ip4_lookup_nm.lpm_tbl[socket]) > + continue; > + > + ret = rte_lpm_add(ip4_lookup_nm.lpm_tbl[socket], ip, depth, > + val); > + > + if (ret < 0) { > + node_err("ip4_lookup", > + "Unable to add entry %s / %d nh (%x) to LPM table on sock %d, rc=%d\n", > + abuf, depth, val, socket, ret); > + return ret; > + } > + } > + > + return 0; > +} With regards Andrzej Ostruszka