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 5E2E9A059B; Fri, 10 Apr 2020 09:25:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5023E1C2E9; Fri, 10 Apr 2020 09:25:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 11BB51C2E7 for ; Fri, 10 Apr 2020 09:25:11 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03A7P5NS015559; Fri, 10 Apr 2020 00:25:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pfpt0818; bh=CxS9ANW0JGSpoefX9g6WV9UaqBN8Mfw7o4P3tkYMALE=; b=AqU0Ks8CGMUz84tzywglZ6zekeylb95e0Ph2j0RCcg/y+WtbxQpJMZGDIbTs+6ILFli5 AEXmepeiEzlKLkp7zZfHO8t3snQkkP/qdG79aaoSpPLvErwVDCeQC77/7Lgtrtb7A+AJ vXPzklVuA33ylnG1WEAyTTg+Xycxw2W28bHnNEcQ3Jl9+9MbiUMZdxgapw6il0at8HxK GMIaKrGY2EtDM0jngW6gbRRxihOAt8bCQxekRX+0nX2Dlf5UfOW478uHREDSm9RXd9sx F10oBJdBKJs2efsCx0SKcmBjaztb8FTHHdCAUw8W1t7hqrqXmWv1wAIsL5EhDkUAZinZ fw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 3091mec600-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 10 Apr 2020 00:25:11 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 10 Apr 2020 00:25:08 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Fri, 10 Apr 2020 00:25:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aa1jt3PhYXRyxGs3o4MOr405IQmPSnS6hdBOd/tOn/RNyE9u0uqDaaY0te4nhUNVYcVSHoJRJiHXKEkEd9fGvltLZXOrzg5IUtz0SOu6PZXcVdlBRNRc7b5iayOCZLX5xRZh4BRuRymrjCaSlUUZmI3xaUL1Cyj1U9Yb4tKCqx+hyW+RkrhYAE3/A8z8wSdPI9wCLm544ysXWr8yWfO1sDIenMNTrXsjszmrOaH+kZyMXw1t0sWSZMyOX8mgIp0Jyk1cGOKkO/lAPZwRk4gpqUUR1vxR6zj+LNIV5A8JLgcJ5zpTaErRg+wQ7uPL7lhSqVj3F6K0etBBfIEEcY2oTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CxS9ANW0JGSpoefX9g6WV9UaqBN8Mfw7o4P3tkYMALE=; b=Eknpt4mc3p1M9OUkzgr3S7Y4ttA0rKQa2x9uX74ml2FbXbrQDCecabdnNxwd0ybW9Nca9WJtBOJ0ShDnd5/mNEjcwcPCMpL8HkCA9LnU7m3qJyn9ZerRuZKUvqstfkxtwH+Sl9CQCS3XLkV16uSBmkqWG5cKzD2F4ozeFa8cj5TXNGvgfSwqdyLPRNIxggkOcoAUC21rcG5phbLTRfXUemGk+VvRtx92f8/6BhW2HeVkl5zenzV3vxadgJPGXkbEc+zl8OnGYFlcV4iJ8AkT+OX4MvQfJbuVI+oLJahfF5UnFObCjSaFCxcKkqCyD4Y3bx26uw7etWZi54OguRAoGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CxS9ANW0JGSpoefX9g6WV9UaqBN8Mfw7o4P3tkYMALE=; b=PWp8x00NxiA941OB/Fb+LT2nZNZDRunGzVDS7W7bCITUtDMRa4/+zSgdRgQifZJ8lglEqXsBv4mmdtS4b64xS5XEmZTKwnbiVVAHKHeQS0W57zI64nEWzjFgfS4mApKwgsX+2z9gsLOxAUeBFcafOcHEIRKrGnGNHCwZuYZxqG8= Received: from MWHPR1801MB2063.namprd18.prod.outlook.com (2603:10b6:301:6a::11) by MWHPR1801MB1872.namprd18.prod.outlook.com (2603:10b6:301:68::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.20; Fri, 10 Apr 2020 07:25:06 +0000 Received: from MWHPR1801MB2063.namprd18.prod.outlook.com ([fe80::380f:5ca1:ce60:6586]) by MWHPR1801MB2063.namprd18.prod.outlook.com ([fe80::380f:5ca1:ce60:6586%7]) with mapi id 15.20.2856.027; Fri, 10 Apr 2020 07:25:06 +0000 Date: Fri, 10 Apr 2020 12:54:54 +0530 From: Nithin Dabilpuram To: Andrzej Ostruszka CC: Message-ID: <20200410072454.GB23867@outlook.office365.com> References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@marvell.com> <20200405085613.1336841-24-jerinj@marvell.com> <56ccde3d-3f50-595f-1dd2-a8be362dff3c@semihalf.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56ccde3d-3f50-595f-1dd2-a8be362dff3c@semihalf.com> User-Agent: Mutt/1.12.2 (34cd43c) (2019-09-21) X-ClientProxiedBy: BMXPR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::23) To MWHPR1801MB2063.namprd18.prod.outlook.com (2603:10b6:301:6a::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from outlook.office365.com (115.113.156.2) by BMXPR01CA0037.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.17 via Frontend Transport; Fri, 10 Apr 2020 07:25:04 +0000 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d03d0083-f9b7-4ee9-4bbc-08d7dd204ab9 X-MS-TrafficTypeDiagnostic: MWHPR1801MB1872: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:660; X-Forefront-PRVS: 0369E8196C X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1801MB2063.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(346002)(39860400002)(136003)(376002)(396003)(366004)(55236004)(53546011)(55016002)(7696005)(4326008)(52116002)(6506007)(6916009)(6666004)(9686003)(478600001)(33656002)(2906002)(1076003)(316002)(66476007)(66946007)(16526019)(81156014)(66556008)(186003)(5660300002)(956004)(8676002)(86362001)(26005)(8936002); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uia8WDp29S4YZ0saivOrtWFtuRbGjDoBi1QI6m5I4YUogfwYkN1Lg1WPgZYZ7P19GVJUk5AOTgwevolBJOIPrwgWKGIAVkhOMH/FFa+A6pknu1pwBflIJj/52o6KmjJ/YFHVEc0hZ0YoBUdHE6ASyOWaKRdvVZbB4wX0seIUJ+pGgG/6CdFBoy8kecGLtLnYexPu0xrQXIvfyDdDbRqMxYO9Gqw/6gdTw4yAVP4LUfFWb+Ubla4jr3T5nFHQAEISA7QZpan9vaf0MRyiVRJtAV99L6kM0buKSZ7pvp19czlwSOCvJbks+yCo4xIbh0K+gFDzrz68L5PUjkpZVdkwfxP+G/qNjrNZzajDhjjJw3Do5bu+uQE0cq7RN6wWgLZOQsbRwvE/HLYVt//kmSbl59v36vjH7Cu0khFXcb0TGSS+kyQUk5JWMTgg4XfgNJMd X-MS-Exchange-AntiSpam-MessageData: mFLISSkXLufkgUQ7IiCyD+PDzYlwLBl5wJUkUYaKEcI5Qwm10+L9ZAXC0dnSDS6T6a3aCA7IymTLJOgl8uHXB7PraFWDdSd6LvTDfZayNg6QjXPqRII0q+woUmNacrxdXgLI75sdCZTwYqAO/i62VA== X-MS-Exchange-CrossTenant-Network-Message-Id: d03d0083-f9b7-4ee9-4bbc-08d7dd204ab9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2020 07:25:06.1162 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kWvmRyngjTaUZqoo+tWSvKno8N5qPpIC8sybKAurKUYz8kMoLo/OFcwthCx6xuxSve7VdxcSBngpOjr/RwD+aA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1801MB1872 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-10_02:2020-04-07, 2020-04-10 signatures=0 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 Fri, Apr 10, 2020 at 01:04:37AM +0200, Andrzej Ostruszka wrote: > 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. Agree. I'll mask out upper 8 bits here in next patch. Since next_node is enum and is in control of lookup node implementation, BIT(23:16) for "next_node" should be sufficient with space for 256 next nodes for now. > > > + 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 >