From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0054.outbound.protection.outlook.com [104.47.41.54]) by dpdk.org (Postfix) with ESMTP id 2E1A0201 for ; Mon, 4 Dec 2017 08:50:01 +0100 (CET) Received: from MWHPR03CA0038.namprd03.prod.outlook.com (2603:10b6:301:3b::27) by SN2PR03MB2367.namprd03.prod.outlook.com (2603:10b6:804:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Mon, 4 Dec 2017 07:50:00 +0000 Received: from BN1AFFO11FD006.protection.gbl (2a01:111:f400:7c10::132) by MWHPR03CA0038.outlook.office365.com (2603:10b6:301:3b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Mon, 4 Dec 2017 07:50:00 +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; caviumnetworks.com; dmarc=fail action=none header.from=nxp.com; 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 BN1AFFO11FD006.mail.protection.outlook.com (10.58.52.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.239.4 via Frontend Transport; Mon, 4 Dec 2017 07:50:00 +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 vB47ntLB026663; Mon, 4 Dec 2017 00:49:56 -0700 To: Anoob Joseph , 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> <5d0bed52-ad0e-df65-158e-4e62b79fe754@nxp.com> From: Akhil Goyal Message-ID: Date: Mon, 4 Dec 2017 13:19:55 +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: 131568474002487310; (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)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(377424004)(24454002)(52164004)(199003)(189002)(83506002)(33646002)(54906003)(36756003)(53936002)(67846002)(81166006)(85426001)(81156014)(8676002)(31686004)(8936002)(498600001)(68736007)(93886005)(316002)(110136005)(58126008)(104016004)(97736004)(189998001)(31696002)(305945005)(86362001)(77096006)(5660300001)(47776003)(4326008)(106466001)(64126003)(105606002)(229853002)(2906002)(2950100002)(53546010)(54356011)(76176011)(2486003)(2870700001)(23676004)(6246003)(50466002)(65826007)(65956001)(356003)(65806001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2367; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD006; 1:my7eREtD/j4si/fxFFHfTQl7padpYM58C2pU7nQptPuKO4PjIRmqpPp4t+5WVcx+z8BCUdKmKxnbhUgG+hoE3psFrQogXyy+kJ5UWWRuCpCiNxD/2YgbUVUawF9MWVh9 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02863f27-b977-4a7d-96ad-08d53aeb9f03 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603286); SRVR:SN2PR03MB2367; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 3:jQi/fbDFaHoxNmyRcSc0ndKdzNxRmxZrk3aA4AFha5qCrG/fAo9H/dlaNFnFHwvmi0rcy64BaWeCJHXDjqQ2L+lRne8fH0krzXeyj9A1K9lsP1UyeQHx9T61wym6GxldSUd8HT2jJ3Y4+UQ4Y3ZbJRKwutaSWXPQE1/G0Wm/HyWb06hZk0mtb4vxPZAJqETg3tjI7EYrmtkvik2uqsJIgYuCVNdsRjJz+iFTG5so7UM6JZ3I5U62nGPHN4XH5oxtNUfaamEjmMEIe1BwylwW7r8OoE2ojC1v97hSP2D8yktawZWr/yhny86f7dktCFFHVpi/zSSLkS+KMlWr3jgwRGAVZ9gMC+7O5qWylSNHMEk=; 25:UkfEoRe+8viClKAn+bwxKYPHB5nPfE1Kt+Jk6L56jtv0lk/lN3tQIzaF4bWiV6ZJbxz1xV3CYcC5evIMQMV9u94GwEd3f9jAPsddVYauyizDld/HPmjhSySW9hhD10kXVUQhWtbykxwSdagJch9UU6nUTgolf6BrfhbFZiiNY6h84NHGPQnk3XJ6WfON5Rg0NHasR2pBaNLaQiePQv77aUCWFJL46VWTFL224GERZc62KOG9YNFT0upg8NLS1h5bLb2n3XFYWAFyBk0yX9tznFRjwuYcPLOUN6AuMpUnMlV+D7l4nPE0KTGfcF2US4EO8Vm2xaJlDaA2DvdQLGdF/Q== X-MS-TrafficTypeDiagnostic: SN2PR03MB2367: X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 31:fcg3v/ANo93UONzkMA4zsu2sxr1W5mIHErTlfqmoYSay9OZgfYpLjBed0r3W52BheLMPkHUyGXDxzwdv5Uhlo0GML204EBzZ3Jk/NZQyXNuOMTijTw+Xa7SuzOB7ReTVISmxgD2c4EWsk/iTj5rURzPdLQlCVUI2s03FWji0vP6Jso7bwPt6GiJLp+bTvWx+AvwI9OXbj5YPIePwi8pqXLk/Ob6U+ehYqW0lE7HqIvE=; 4:o/F6SCuOjgLV5G6yRk03WBxMV614Z/2HriNtLXt0bEXyIzWYqavBMlgBeZNOlzNe1bqOLHzA9pAKVbIr0zuFoWisU0Dmf7CmiArhMYgdWzJ0YaL6360swypjvAgsdf0MKlfvrzt6N1cZ0jicfWygBsDT705QGtERbtFnZA8R8k+JlyK15w0xEzOww3kKLFyQIZ6I7YLOAMvs/j/ztiIwJOtbC7IpMlP+bRRIfs7+HzhdlJojxX2XcFafXJe0KBaeBwrgJXhNRFRBY+ZB3mIbKwmwtnDw2FPzETg4YGSXn1CiaKvFh4zIAEIrOTxLje3y 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)(93006095)(93001095)(3002001)(10201501046)(3231022)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123565025)(20161123561025)(20161123556025)(20161123559100)(201708071742011); SRVR:SN2PR03MB2367; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2367; X-Forefront-PRVS: 051158ECBB X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjJQUjAzTUIyMzY3OzIzOmgvRmNTaFRyR2dLcDlFbFY5VTNCNTdkSTZt?= =?utf-8?B?R25ZeEEzUDg4NlVic08wQnN6ZFVWNlhKWGZOcXd3cnR1V0JoMXNvOUErWHlK?= =?utf-8?B?azZvZGFCM09DK050U2JxcFdrQVVUZkZqTGVTbWEvdVFkUktHajdZRmFxMGVu?= =?utf-8?B?dGY2amx1OERiUUNUWllMUGtxOU5aVFFrR2twNHlKcUI3MEZBVjlXSDE4dHlQ?= =?utf-8?B?NWdhL0N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SGXyIxPD8NTA2RYTSQNTiPZm6o9a6bd2bVNI5iE+/4tMFDsOAzkrUiVTD+wDQAigg2bxphzeOsijq37dY0ezClhxz2fl1Ss1nUW87Y/SSIPaSJIICZjsoZJFdUj0OSVann6FoOU732m1REG0wq4bTUq3Yat735qn8/RCks24HHiYusQyM8s6RWG1sorP5yluS8tqYpwcPHFAIuqL1qe9x0HHk2kkQesc59tNm2k8eWqDScthIPzh0SfUDv4/oQQGR0H1zGaW094zLMMLdNpF2h5vpECsENPRW4IASOgccjdZF8=; 5:pkqc8GwzphUh2sI3/vZEo9BOUgQfxwQTgzVXMMXuvEFt8gL/Ei6j64qklR38HaZ3x7iXyl6So+A6Rp2UgnF8ITqvr/naTOqxsBy3KvqM/+1EhTN5ubprBaT5gK2hYT8fth7NWO5LCyOGcAd9D9qEUtRZyHpPI/bArnvt1brMItY=; 24:MumslTsSRZPT8NsqFPKBlYCwtPW7SrlhOFA7vnM9CgF0carLfHjgV+43g+3/KpD9qjtu9oVvQrSA97nxzH/A0R4bt+HAzkYRWmAaGAjrrC8=; 7:EGAwLoVasJshsqNcmz5ec8DLLhLOil0sZjne1e01ig5KHc8HXYt2pjMHUqq6MsRbc+gcKIjZ8k9Jyssu5qKhq8PRhYw169HURxbbSeaZfnE/Gnx3RJek+zRUxcU8LgRQexzK0I7glKVYa4pTNIFnKlhRaw0T18MDpIZMFPXr9LO7oBx0YJnfWCNHCw7m+0+A5+TvKhTSEiitW2ba98xMbtbYl8Tvmscg7cC7fey4NL8lYUBY9+awO2jvksUhSaAS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 07:50:00.0147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02863f27-b977-4a7d-96ad-08d53aeb9f03 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: SN2PR03MB2367 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: Mon, 04 Dec 2017 07:50:02 -0000 Hi Anoob, On 11/29/2017 9:51 AM, Anoob Joseph wrote: > Hi Akhil, > > > On 24-11-2017 16:19, Akhil Goyal wrote: >> 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 > If we have ipv4 and ipv6 variants of the "get_hop_for_offload_packet" > function, the code would look much cleaner. Shall I update the patch > with such a change and send v4? I believe we shall get rid of "RTE_LPM_LOOKUP_SUCCESS" from the rte_lpm_lookup_bulk(), we shall have similar error flags for v4 and v6 APIs. Either we can have RTE_LPM_LOOKUP_SUCCESS or -1 as check for errors. Sergio can comment on this. Duplicating code for get_hop_for_offload_packet may not be a good idea. -Akhil