From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0086.outbound.protection.outlook.com [104.47.42.86]) by dpdk.org (Postfix) with ESMTP id B9CC2235 for ; Fri, 24 Nov 2017 11:49:27 +0100 (CET) Received: from DM5PR03CA0044.namprd03.prod.outlook.com (10.174.189.161) by CY1PR03MB2361.namprd03.prod.outlook.com (10.166.207.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Fri, 24 Nov 2017 10:49:25 +0000 Received: from BN1AFFO11FD044.protection.gbl (2a01:111:f400:7c10::162) by DM5PR03CA0044.outlook.office365.com (2603:10b6:4:3b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Fri, 24 Nov 2017 10:49:25 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD044.mail.protection.outlook.com (10.58.52.191) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Fri, 24 Nov 2017 10:49:25 +0000 Received: from [10.232.134.49] ([10.232.134.49]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAOAnLGw030783; Fri, 24 Nov 2017 03:49:22 -0700 To: Anoob , Declan Doherty , Sergio Gonzalez Monroy , Radu Nicolau CC: Narayana Prasad , Jerin Jacob , References: <1510673823-24475-1-git-send-email-anoob.joseph@caviumnetworks.com> <1510738915-14712-1-git-send-email-anoob.joseph@caviumnetworks.com> <0349861e-de98-92b5-8b6f-7ab944dd45bf@nxp.com> From: Akhil Goyal Message-ID: <5d0bed52-ad0e-df65-158e-4e62b79fe754@nxp.com> Date: Fri, 24 Nov 2017 16:19:21 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131559941655809400; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(376002)(346002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(24454002)(65826007)(5660300001)(229853002)(36756003)(76176999)(54356999)(77096006)(50986999)(104016004)(64126003)(93886005)(31686004)(53936002)(6246003)(67846002)(2950100002)(83506002)(68736007)(4326008)(189998001)(2906002)(2870700001)(47776003)(65956001)(356003)(305945005)(65806001)(81166006)(8676002)(81156014)(33646002)(106466001)(105606002)(53546010)(8936002)(50466002)(498600001)(2486003)(23676004)(316002)(54906003)(31696002)(85426001)(58126008)(97736004)(110136005)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2361; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD044; 1:r5agRvxS5y0GIoojEH1LuD8u3+8EtDMJHpg6ZqLCND2WBxTrfaMGgnIpM5eZswG1alno2k1OKyFhXnhWgOdPcNE4eT8GhOzRPTKxjAoOmfZ0V1WKRb/k51psjNSx98r+ X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(2017052603258); SRVR:CY1PR03MB2361; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 3:/Ak0jQZ9uSvo2rOMRA9naaL9kEMhVAFObAaB1vA4Kw7dnd2AE2jwvyifGOw9nXH2PtymWeZUEoUI7VdTOBrNujl4q6j1vLHOjL7Fb3vfZ2DmjUmTlO8Bd3Qs6WpeoW8Ufx4gDQ7rYGnml7Nr7kdkDgIuylpdWfsAxfzmRO872upH6/ch+2P/zcbU1LnVfK/5V/OKfQpnhvZ4ryaDJTSui3kjZILUqzXmVO30+wDvJIADbvf2iGUNO3IylqoutL3PZ5cQ86pdCeHGB6qxwQw5en6vIyFrlmfUQLFUL348tBKRp/sVU2gpG5CVYKfTTzNA+GYGTFij0MaavTpbUaa1eEtLiPb9vXSqXOMsvW1yKMo=; 25:lzba0LRShjxVo6JBCsdwgkClde7RyvAydXGUb+ZPE0BRlpYnfdgIm8mdWMMhznMEo7Mri175F72Nzz7rDZ9TDWZbmzeoBKzuQ5kdmkFjuM/XNoJvVprxivmcvAAcD3cYIy94yOf52vTjy4azR5XxbzlPy2ZNcNQn8iNexsSmagF0F+L51o/UfkWSCANxOPopzUTLgsPX72gjo6sg6YYTUw/tX8+rSb8fK+PFVdnOrfGx17bx/fjzF6zzUJ54P7B4Mm5CPPLfXD6wwxqIVHBuDsL+ATzy3YCz8HmTlyPJ3tWISDPGwHK22xOULWfeku2JxlISt2R8oUg9e9u9xumHsBLUnurCDiDcTFfBjuo4tHQ= X-MS-TrafficTypeDiagnostic: CY1PR03MB2361: X-MS-Office365-Filtering-Correlation-Id: b2a047d2-8eff-4060-6c15-08d533290785 X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 31:NCQoXe51+uTLfXF85bSyJrKr9sLe1xpOYplOfBbTnsmcZe1/n9w8ljzwE2Mk0aYMDojvjdNmL0EQyqJqeq7pP9HXGI/Jketl0Sp53THhowHEY7xLVyJjfHHEnWOGtrSvR5SG/UEoe+cZcK6j4VUDY8glW5vtSIBoloVXawENqAH6UPuG9ILDznN+7EUDfsNubJlsfrkOkqiKwvYOFTePjZ7vt4mznN9GDXpBjufic1w=; 4:D9PxAgOC1fJxhGW2pT5MZz5Kwezv7KznBG27W9aHuxTKXdJbXZFHbWNM/CtC4vhJTH+QCH6QFillrr7LJl3OcqzqhSJ2uwTGuLIxl2HMntEc1ocvU3LCmuyLVHE86g/qXPrc0zIGLKHgowlfbYPkHe9iRDAFkO55KM7gZEJraVOgvLdYjfzp9il+c4FanaWk6Aaix/u6QNkypjoz0mx2IhI9bZ2QBG7g7ph2++7r/5LvKoOa2sEF/un6vn2equo561d+lZyhdeqq//DoUUfOJoCINnCPDxeltf4lg+ShWrNnJpOC03H0JVN7fmYPEJIw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3231022)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025)(20161123563025)(20161123556025)(20161123561025)(20161123559100)(201708071742011); SRVR:CY1PR03MB2361; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY1PR03MB2361; X-Forefront-PRVS: 05015EB482 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjAzTUIyMzYxOzIzOmtIbDMwZytORUxITnZvRlZ1UEpmTjIxS1Er?= =?utf-8?B?UDlwNVRnbE1jQ3o0MDR1SzZqTE1aVWg3eklQWVV4UExwd1Y1THp5WEV2dEoz?= =?utf-8?B?aisyRDNMUTVUblNVa2d3RDcreTNnVm9tc0JBamtzSDBDdVd0Z2pjQS9nZTha?= =?utf-8?B?TG85MXord09Fd1FiRFVOaUNvek8xL3dmMGtpaUJ0aU00UW9zelhkd3JrMWl0?= =?utf-8?B?UXlxTUNJUnd2Z3hhZk9BVjVLR0RvcU1sL0FQNVF6STRyOWx2c05COXU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IY/jr6j050tw7oVYWnLdB1uWXSwsYN0pThGSTFpGWWEPfIJXnQkyAA9hRKxpo2GH1gtJ7QNyg6HmaPDsJu3DT4TF5EZDLUghHtIS+p15QcHICsaSKiDzNuNdlFa5NghjtnuZfZHvqShJ1U7QQ/Z+4H0/b7pSyfWe03alUQYIyJswG/hRCWFGlBh9gNS1PrZgngqNUD37qK4=; 5:LrJ9faIiRTQSJf5+xJzjfgucBtNqV44raAw/8JSHNuZ1hRGJDLGzUH7YnpRwwaiyhmpUew1poVy75RJoZQYJbIspIbc3nW7zJfUdSgagF3q1eO9O6ohJWwOf7CfI0K3RjRYGPtt0r9Hsqa4mogifDFsL3CnBzK9Ax1s3Qzq5rZ0=; 24:AIbBdWEu89xa9nLnNkSnroSUWk+IlfHSsBVDxMM+iFRgdcpy1QLlj5XgdQCSrpnP7Orpd0kQRPgdavR+2EfRF9CAOLgQt8TlWlF/q4pdSzY=; 7:KQRmHKhusO0v+nnzLl/1HR0cYX4TogGkr9KACjX75iVWvY4F0fuFCA1P09WhyWd08mFuDRotU8opPpGnsfKOFN7iGlC4HEQ/ltMvLjnCxuzbx9SucZfXK3WktNkUEfi3Z5q4fOY95bP1N0m1sh7MpMhvNvx2XFigy5bJ87B34T2quMqcGeSXSydtZICwt/nSBBxqSnn8I1XvQifSerSX+yoyeHwLx6Yp0XnikluQmtrqb11H1vES9zpjpS3DUyj3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2017 10:49:25.3625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2a047d2-8eff-4060-6c15-08d533290785 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2361 Subject: Re: [dpdk-dev] [PATCH v3] examples/ipsec-secgw: fix usage of incorrect port 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: , X-List-Received-Date: Fri, 24 Nov 2017 10:49:28 -0000 Hi Anoob, On 11/24/2017 3:28 PM, Anoob wrote: >>>   static inline void >>>   route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t >>> nb_pkts) >>>   { >>>       uint32_t hop[MAX_PKT_BURST * 2]; >>>       uint32_t dst_ip[MAX_PKT_BURST * 2]; >>> +    int32_t pkt_hop = 0; >>>       uint16_t i, offset; >>> +    uint16_t lpm_pkts = 0; >>>         if (nb_pkts == 0) >>>           return; >>>   +    /* Need to do an LPM lookup for non-offload packets. Offload >>> packets >>> +     * will have port ID in the SA >>> +     */ >>> + >>>       for (i = 0; i < nb_pkts; i++) { >>> -        offset = offsetof(struct ip, ip_dst); >>> -        dst_ip[i] = *rte_pktmbuf_mtod_offset(pkts[i], >>> -                uint32_t *, offset); >>> -        dst_ip[i] = rte_be_to_cpu_32(dst_ip[i]); >>> +        if (!(pkts[i]->ol_flags & PKT_TX_SEC_OFFLOAD)) { >>> +            /* Security offload not enabled. So an LPM lookup is >>> +             * required to get the hop >>> +             */ >>> +            offset = offsetof(struct ip, ip_dst); >>> +            dst_ip[lpm_pkts] = *rte_pktmbuf_mtod_offset(pkts[i], >>> +                    uint32_t *, offset); >>> +            dst_ip[lpm_pkts] = rte_be_to_cpu_32(dst_ip[lpm_pkts]); >>> +            lpm_pkts++; >>> +        } >>>       } >>>   -    rte_lpm_lookup_bulk((struct rte_lpm *)rt_ctx, dst_ip, hop, >>> nb_pkts); >>> +    rte_lpm_lookup_bulk((struct rte_lpm *)rt_ctx, dst_ip, hop, >>> lpm_pkts); >>> + >>> +    lpm_pkts = 0; >>>         for (i = 0; i < nb_pkts; i++) { >>> -        if ((hop[i] & RTE_LPM_LOOKUP_SUCCESS) == 0) { >>> +        if (pkts[i]->ol_flags & PKT_TX_SEC_OFFLOAD) { >>> +            /* Read hop from the SA */ >>> +            pkt_hop = get_hop_for_offload_pkt(pkts[i]); >>> +        } else { >>> +            /* Need to use hop returned by lookup */ >>> +            pkt_hop = hop[lpm_pkts++]; >>> +            if ((pkt_hop & RTE_LPM_LOOKUP_SUCCESS) == 0) >>> +                pkt_hop = -1; >>> +        } >>> + >> I believe the following check is redundant for non inline case. I >> believe get_hop_for_offload_pkt can also set the >> RTE_LPM_LOOKUP_SUCCESS if route is success and take the (pkt_hop & >> RTE_LPM_LOOKUP_SUCCESS) == 0 check outside the if else block and free >> the packet if it is unsuccessful. >> >> Same comment for route6_pkts. Checking with -1 may not be a good idea >> if we have a flag available for the same. >> Others can comment. > The problem is ipv4 & ipv6 LPM lookups return different error values, > but we are using a single routine to get the hop for offload packets. > The flag(RTE_LPM_LOOKUP_SUCCESS) is only for ipv4 lookups. For ipv6, > error is -1. If we need a cleaner solution, we can have ipv4 & ipv6 > variants of "get_hop_for_offload_pkt". But that would be repetition of > some code. my concern over this patch is that there is an addition of an extra check in the non inline case and we can get rid of that with some changes in the code(lib/app). Regarding route6_pkts, the code looks cleaner than route4_pkts -Akhil