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 70A13A059F; Fri, 10 Apr 2020 16:41:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 557421D588; Fri, 10 Apr 2020 16:41:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id D52571D557 for ; Fri, 10 Apr 2020 16:41:48 +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 03AEdY3C016649; Fri, 10 Apr 2020 07:41:48 -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=teRFvFJOyt72ajhowlyMca1N1U4GAMD/RsLdWDdZAzs=; b=mqLO2tHGaAb0sHnYAMZQwc7Z9KH9JjylkcmO17QTOjPnFdBbLecUfySMbHZhDtLqItql fPZJsymaIUffM7IL156kk/lgMLYBxh0RMgbAu2CCLxFcE+alOsle7jpCEhXw+KEjGJQD 2Zs4rT1Ru9x9TbRZZ9Kb415FUMifOu7glt2fUcAHCkDzta0sdQ4KJtD6xCBuBJYREf7H McdGaBP5vKGjl5t1vN2hszjPQAodEMF9zoJ76h+zd4ZLXGGBQasK7axamn1uwonycfJ/ ceRF5fqaKcpqwHjqbjjhaQrAQp6dJWpoQ1x/PCg+NLGUk16ss190AGe+HfkpQKOpRnlY rg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3091jwnk4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 10 Apr 2020 07:41:47 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 10 Apr 2020 07:41:46 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 10 Apr 2020 07:41:45 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Fri, 10 Apr 2020 07:41:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eF5yYyR6kgGfklDz1x3Yxs9wx/RhL47jROUVBBYSwtBKgbqsmljZ3ps5+AvuZDo+7HvNEdzjbfLngv1wxixYc9KHjSSm9KvIgzDPmT9tHRa8ioV4N7aWnSX5Ck/y1FHRyOOQmXJcwqCGdfa8zm1/0v/4iyBdtzsvaTPVGxG1iiKB01V+xlzOQ3mOtO/zGlIv+CK6VgErkJLzJUwDtuhqcqerC3acz9NZGmqst6pwk58ybOfUlC7cX2sBG3Fj/cjmOLdeJxQPteYulQmoILdmxesXZP/toKi9ZMG/zWUnzQho5gBH+O7/65Q0ox7HHBxRxMN1ysXzeiYE4n+QRrq6Ow== 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=teRFvFJOyt72ajhowlyMca1N1U4GAMD/RsLdWDdZAzs=; b=Cp0NPNXn27OWAoCiq+BWT2Ulmp+b33iwzMqUg1yJstPHICGebjr6Pps1XaOt6OSFAIsH9gADRFPlR16SFwRsRByE7lvmKVQgkQjudBFO7ElZNVW4+6LELjbJrnCVeWLUBZqOcFIVDaZU235+WXoX0HO/nixJ/4Pdhh64tgz35Opgp66KD/miStcq/gi8ebhaodBS7fodbc/HOLqeKJZRHipuklIGhTnGUra15bN58aMiG6kgrSglGfmJ5MoGUNXgcKkG0KrOLRQdfY1ecwz/oXo94zDKWAX9uO4NleTmQHOIbQ+yVLGi8Hadv7LvAgjH2g3lqtciczq8DaFjg/CHXQ== 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=teRFvFJOyt72ajhowlyMca1N1U4GAMD/RsLdWDdZAzs=; b=RYS7PXmDKEnBPEmyMjCGbp+IrgN3ECSlc+jL0Ummmslrh/kBnJaPd6CHaqE3+QP6hi3LyXcqSjmo/CuEkEC/Le4SXV/9BnDlt5GpX4UqmIayaynUE/xVTV6qwZWAsLaf4WSCdlsQcnyvAgezz+0PxzOFofPFb/PP+cjzuLxgm30= Received: from MWHPR1801MB2063.namprd18.prod.outlook.com (2603:10b6:301:6a::11) by MWHPR1801MB1870.namprd18.prod.outlook.com (2603:10b6:301:63::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.21; Fri, 10 Apr 2020 14:41:44 +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 14:41:44 +0000 Date: Fri, 10 Apr 2020 20:11:30 +0530 From: Nithin Dabilpuram To: Andrzej Ostruszka CC: Message-ID: <20200410144130.GA4537@outlook.office365.com> References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@marvell.com> <20200405085613.1336841-20-jerinj@marvell.com> <20200410102006.GA15933@outlook.office365.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200410102006.GA15933@outlook.office365.com> User-Agent: Mutt/1.12.2 (34cd43c) (2019-09-21) X-ClientProxiedBy: BMXPR01CA0078.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::18) 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 BMXPR01CA0078.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::18) 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 14:41:42 +0000 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad5b4fa9-05eb-44bb-a53e-08d7dd5d49f2 X-MS-TrafficTypeDiagnostic: MWHPR1801MB1870: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:843; 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)(376002)(396003)(136003)(366004)(39860400002)(346002)(186003)(8676002)(26005)(4326008)(7696005)(8936002)(956004)(2906002)(81156014)(6506007)(316002)(52116002)(55236004)(86362001)(1076003)(16526019)(9686003)(6666004)(66946007)(5660300002)(66556008)(53546011)(6916009)(55016002)(66476007)(33656002)(478600001)(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: L8nMdirecker6HZJA7U1IafyJmNIJ4hVCNYG6ZzTH+x1puBrufTlctmMoFxsqXXJ6IkLEl9hpDhkOwTOYY/r9yAwsgdDVALL1xDNpGuPR5asvUB7Jhciu57MJ1/ruZ/Ao2v7qBUHL6FbIEl+Ir+nznYZfRZJVVUOGQ2BOF2Xp8Js3hg83lF4IVlMZ0y4+RlNxOGzXZqdIhTO6GKTa6wWk+5cjEtUt3ZkNqWZCpGSaquFFzs+W0GPcEIdj6+2IeRkljA5En8U9U7Fywg+9vjra2PieLjq82AXdKxeLuOSk7Xs9xHsb9yDbGmxRT9sfDNe9lofR2JLROR6EW9m3Ab1LObqDMDxEO7bwQLJ/73jbXCHdLesX8a7Y9Mc9efwBb4XLNjeLQYgeH9P6h/ZL2Vsm19nFQUktNRwv/zFcbuqa1yefZaRKARE/DbPNzNRT7kXpD2CAgSIbmqa8nDM1HoDzqzQm5yb/HyPsMgjURk+l9x06oiq2qImZdE64q5rgsKC X-MS-Exchange-AntiSpam-MessageData: BZW4PX4XymfGvHYI7RChYDIOA0+qNZlJ6KnA7zT50uCCWlKxwuI4NXI8QHJEfBEQw3NHDrQ1OexK+3dbegmVyoValrmRV2IxT7O2AWA6t6mo9vs3PyntCuOF27SsLDNpYW+npiEtIbTs3FM0cBU+7A== X-MS-Exchange-CrossTenant-Network-Message-Id: ad5b4fa9-05eb-44bb-a53e-08d7dd5d49f2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2020 14:41:44.1438 (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: +UR4LqjeD7InfMGNtu/VwYQb/+5U1jAZ2rXqqpY76gQbUEnCnWxOSegpbCPVOq83H05YtH47+9671AQnaaZ3Hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1801MB1870 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-10_05: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 03:50:06PM +0530, Nithin Dabilpuram wrote: > 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. I now see it is better to leave this statement instead of putting an "if(unlikely(rc))" that might force an explicit branch instruction. On other hand, conditional might be making use of an "csel" instruction in arm64 or "cmov" in x86. Are you ok with leaving this line as it is ? or you have a strong opinion to change it to if ? > > > > > + > > > + 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