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 EB832A059F; Fri, 10 Apr 2020 12:20:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ADA2B1C1C7; Fri, 10 Apr 2020 12:20:30 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B465A1C1C4 for ; Fri, 10 Apr 2020 12:20:28 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03AAFTaC016246; Fri, 10 Apr 2020 03:20:27 -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=6FCYr7yCHyL1CjlhSHC9Wzqok7NZvysdUtwCieYbx6A=; b=htZzFGazxCXN3yR4bCTBAOhCc83cjwA6OoYgTYZiZtNFSiZCJYKX8BYiRF36kK9Hn1TF ZMC1h4N0zXKut8p49z/fOOwv69oQWu6T24kBJ5Xh8XiuM8IlWXwHnvxmqpAn1bNb/Deh sDChkqBwkAMIi7/kdst806whwDHPE0mDrFNLHStpBKboRTdUdbkgRVaXVJ5IqXwDeDG3 aJIy+NLutBpqfR0amaNmuShJGuJQI8J59+e4wP4AZX7tPW/BpcUXa+qB1bXEBRLWiW59 jbOQhUBVnejZeYaXyoOmxt8UF9kF9CEMN2wkUOkfAFcLsz5Z1g34RM4TBXc04m50rvYN jg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3091jwmrx4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 10 Apr 2020 03:20:27 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 10 Apr 2020 03:20:26 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.56) 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 03:20:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJ2bQODJN+IWKZkHozzHPWqelmICAVbMtHlBB8BJB3ib3160aMeV5fxHWWNmZsG0cXZjEmp1U/74c/s94Gqx340RcIGihHDRTp+P9e6kVeN1bkuNt6pq1/dyH4P6aOu/faFzQ7xWAZQPvhJAY7q6y6LmuBxxdSvzxCeWJTZIxHsNPsNteVOYCjiPfq6m7Hemha9LZguEJgnRcowEOQk0cq+ztW1EGyR4nj2mpcgiUlUbckoDs7+apX6CCQ8eJgIDFAcU+dUL/uM1qe1UWj34QSsr1Jq/Y5Fnbdjmd4STwzF6inxAzbYy0jLkO2aFqxK1HYWu+2PkMP8K42fZMD8HjQ== 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=6FCYr7yCHyL1CjlhSHC9Wzqok7NZvysdUtwCieYbx6A=; b=cSoxIE/1v/sjY5/PHjyChe5v7etyRHbQbW+mJNKwQ0ROC386Wulx6q8rpTqamU6ImCEvzQQUBpfS4n+4W9Ge79OGyhxhwC9DxkL2cb/YUYRJYif8OW4TuvwozmzOnc3yFL93DqGZ+h9uCcPSnOrcGz1MIAjK6La4NmDVDe3+OJ5y49hwK6Ear5P13mDYH+dyWnUE92HPGYhbhvrF0dbdKPMlU5R4lm26PKrNXFk/G7S+9m3x3ulnmyqjyBfIbVAvqVjj7NI296Fe1S1vMvuDSnjLsjiZWGV6Xl+Z9lcRHO5ICyPzP8i9KOolTHpr1rsAGyMdsA590SbZIFqm5tP6fw== 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=6FCYr7yCHyL1CjlhSHC9Wzqok7NZvysdUtwCieYbx6A=; b=L6AKqfPi9FT9EHRNae+IUZdM2FFg4t3XPHzdwLXOeGCWl7LaEu3LR+W11GxPhriW/79A8lwtj1tgX7hpKaYUv7L1V13BHR6UkBVf+jzfuamo2rXfAGzEzvT42qEW9VEaaSWvUEz+zQanbuopq1g61qYQQFe/Dw/cY554FhVWl24= Received: from MWHPR1801MB2063.namprd18.prod.outlook.com (2603:10b6:301:6a::11) by MWHPR1801MB2062.namprd18.prod.outlook.com (2603:10b6:301:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.17; Fri, 10 Apr 2020 10:20:24 +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 10:20:23 +0000 Date: Fri, 10 Apr 2020 15:50:06 +0530 From: Nithin Dabilpuram To: Andrzej Ostruszka CC: Message-ID: <20200410102006.GA15933@outlook.office365.com> References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@marvell.com> <20200405085613.1336841-20-jerinj@marvell.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (34cd43c) (2019-09-21) X-ClientProxiedBy: BM1PR0101CA0034.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::20) 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 BM1PR0101CA0034.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Fri, 10 Apr 2020 10:20:22 +0000 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1916dacb-ca99-4167-f030-08d7dd38c76d X-MS-TrafficTypeDiagnostic: MWHPR1801MB2062: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; 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)(366004)(136003)(39860400002)(376002)(346002)(396003)(26005)(8936002)(6916009)(81156014)(55016002)(186003)(9686003)(7696005)(52116002)(55236004)(8676002)(6506007)(956004)(4326008)(53546011)(16526019)(86362001)(1076003)(2906002)(66476007)(478600001)(6666004)(66556008)(5660300002)(33656002)(316002)(66946007)(41533002); 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: zXGwfmC58plX2sFdktS++gsO22jCaLtkkXhm6zv2v9mG5f/c9kgY1QWd5cv080jpjEY43jtc5dCM5N4R109WtKcn7KykycbA368GvVNkNR/+ho330ILvKxsNlcBd/YSXGJOQDyaQ115ux0gxFBrAbGT6qD+D6Cj2sCDWArKaWvL+6JkG5xo0g/lWmxQtFkI7i66wlVIaAkQJMVYNDiV3P2WbSY31gNPTSFx28fxrpBY87XSAPgZgCl1oFIbMwdoXcJxKnrYph92BZs5clHraX78m3SUtC9D2+oMlEzei74q2EGlDodMkrn+T30D8y+gXQPsgTuC0Q6Yz+74CnQ1lLKf8+BUKC4pwCQYptCwpt2MBxtI0IrW0oqnbd8U7JPtPnxF/J6Y8ZbYL50a+KjoHhy+m59Vxkgrizchf/IjHl71UXOdLxWw8T1AKh4E3WzvF5apcKjQjsZZ/PJf63YPMgojQAzaOUkf54UCEEwys4LOgPpNz6LSNET9iVUzrdKzL X-MS-Exchange-AntiSpam-MessageData: o9Kn0sjByQD525kdoHiNNEkkr67iqLR+Y3pl+31MS6p0FP8gh3wZy8RnvWsEI1cjTpMKC+SENF/vuoYPC5TOBczi6+AqPY77xUYAINzrV+jB3r8y4GIQOeAd0NEdEo0qXE0WxV+RIDsgUlsXJWADfQ== X-MS-Exchange-CrossTenant-Network-Message-Id: 1916dacb-ca99-4167-f030-08d7dd38c76d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2020 10:20:23.5929 (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: FRgLBBfBSoGsy7UlZyES7WgDquyCYYWDD7PAcp+CgTF6WXvjAbek2wLq1drctScqREFk/5r6UNr+B0sVWYcMbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1801MB2062 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-10_03:2020-04-09, 2020-04-10 signatures=0 Subject: Re: [dpdk-dev] [PATCH v4 19/29] node: add generic ipv4 lookup node 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:07:34AM +0200, Andrzej Ostruszka wrote: > On 4/5/20 10:56 AM, jerinj@marvell.com wrote: > > From: Pavan Nikhilesh > > > > Add IPv4 lookup process function for ip4_lookup node. > > This node performs LPM lookup using simple RTE_LPM API on every packet > > received and forwards it to a next node that is identified by lookup > > result. > > > > Signed-off-by: Pavan Nikhilesh > > Signed-off-by: Nithin Dabilpuram > [...] > > +static uint16_t > > +ip4_lookup_node_process(struct rte_graph *graph, struct rte_node *node, > > + void **objs, uint16_t nb_objs) > > +{ > > + struct rte_ipv4_hdr *ipv4_hdr; > > + void **to_next, **from; > > + uint16_t last_spec = 0; > > + struct rte_mbuf *mbuf; > > + rte_edge_t next_index; > > + struct rte_lpm *lpm; > > + uint16_t held = 0; > > + uint32_t drop_nh; > > + int i, rc; > > + > > + /* Speculative next */ > > + next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE; > > + /* Drop node */ > > + drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; > > + > > + /* Get socket specific LPM from ctx */ > > + lpm = *((struct rte_lpm **)node->ctx); > > + from = objs; > > + > > + /* Get stream for the speculated next node */ > > + to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs); > > + for (i = 0; i < nb_objs; i++) { > > + uint32_t next_hop; > > + uint16_t next; > > + > > + mbuf = (struct rte_mbuf *)objs[i]; > > + > > + /* Extract DIP of mbuf0 */ > > + ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *, > > + sizeof(struct rte_ether_hdr)); > > + /* Extract cksum, ttl as ipv4 hdr is in cache */ > > + rte_node_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum; > > + rte_node_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live; > > + > > + rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), > > + &next_hop); > > + next_hop = (rc == 0) ? next_hop : drop_nh; > > Maybe simple if here? I see the same in other patches. Will fix it in V5. > > > + > > + rte_node_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop; > > + next_hop = next_hop >> 16; > > + next = (uint16_t)next_hop; > > + > > + if (unlikely(next_index != next)) { > > + /* Copy things successfully speculated till now */ > > + rte_memcpy(to_next, from, last_spec * sizeof(from[0])); > > + from += last_spec; > > + to_next += last_spec; > > + held += last_spec; > > + last_spec = 0; > > + > > + rte_node_enqueue_x1(graph, node, next, from[0]); > > + from += 1; > > + } else { > > + last_spec += 1; > > + } > > + } > > + > > + /* !!! Home run !!! */ > > + if (likely(last_spec == nb_objs)) { > > + rte_node_next_stream_move(graph, node, next_index); > > + return nb_objs; > > + } > > + held += last_spec; > > + rte_memcpy(to_next, from, last_spec * sizeof(from[0])); > > + rte_node_next_stream_put(graph, node, next_index, held); > > OK. Forget my comments in different mail about difference between > encode/put - I got it now. > > > + > > + return nb_objs; > > +} > > + > [...] > > With regards > Andrzej Ostruszka