From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0080.outbound.protection.outlook.com [104.47.36.80]) by dpdk.org (Postfix) with ESMTP id D8A301B18C for ; Wed, 6 Dec 2017 12:08:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=NRheY1AhydI85woOJpfYw+p+VyxHt0uTdkOFq/SpmDs=; b=Ad4+ZgShYxsLYMrTXVF4fGQvDCH8nkDxr5Koslbp+TEYv+GaDuNNR+cNTQVTQ/9XzQq4l6jt1Mws7IhXQkyxBZ1xxEzzGmNWv+iiQ8CBKAB1LMernadBBoSAHK3xQY5p37s1E1F/wjiTkHzCGGuoio4QX2DcvpJEOYfB6AkRE8M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from hyd1ajoseph-dt.caveonetworks.com (115.113.156.2) by SN4PR0701MB3648.namprd07.prod.outlook.com (2603:10b6:803:4d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Wed, 6 Dec 2017 11:08:54 +0000 To: Akhil Goyal , Declan Doherty , Sergio Gonzalez Monroy , Radu Nicolau , Bruce Richardson Cc: Narayana Prasad , Jerin Jacob , dev@dpdk.org 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: Anoob Message-ID: <19976ae6-23db-9d35-4fa1-894317bd998a@caviumnetworks.com> Date: Wed, 6 Dec 2017 16:38:48 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; 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-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: CO2PR05CA0102.namprd05.prod.outlook.com (2603:10b6:104:1::28) To SN4PR0701MB3648.namprd07.prod.outlook.com (2603:10b6:803:4d::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8c7a021-58a4-4bfb-25c9-08d53c99bf03 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603286); SRVR:SN4PR0701MB3648; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3648; 3:OBNZ6DdtroFKwo+StvvxGUrCjD89ENOAQut+1w0T4Jd0b4WCfviRhmZb5PGl/jZMmKv33pn+FPWdJPAOn6vhY1gEZjC86c6i+egsc2T6z/F4sfFrGG8ZCO/4Z/G0Aj0vPa6YweUdwGFGgNCSFDf29kJsmT0ia6cPvbs7Hmsk8YMnA0uDanBjBNHmG45Y/1Q5BLVw+oN5NgzKIlSHIpecMIx+BIn7U9zbf2NgxNmeO9mJtJELkHkxdBVQwJOP95oY; 25:pwSQEC5wSEcn4vbCeqZ04H/SLjH+XIqFLBKdZJIcXRdgRImT2j4Eo+RMdKfOoaLTKvA6Kz2mEJ0iLzjapXQSLIhyeFAfKfeeAyMNgAizdTLA/CQEueXr3T+JWuwzZRnnPry+Qf21W/QIICbkuEW+5Or2Uq56Cy5lEKLpthtehajCOHvvOGpAO88LahMiT67HXavMbFuPqmma3+xXm8PvG6cUl8dF31vmFXiigz3hayFI3tdaHi1VW8QbTS0Z23yCvAAnFywQVSYUCT2TtKS2e9YyO7T58F0hAvopBnxa8++bxa+kBMpLW+8w6V3rd95mR2cuBpsItCBMLEZf+7fPug==; 31:aZtM3OyO+q+U7OPqTSKsZ8yBkr7cbigUnnCe/ph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9o+Uw5JUMVMmJ1vHLZGuyL8R+S0glAAbtLAU4tkXIVkNw/6rLGlARSJS14dMQCA22n6IUxQWN4DADLt0GiTwdsDITMk/Ci4eoizOyQ8tvhfoiY6/u+4eiIEojoJCXMKipB2E3v4/kkDX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231022)(93006095)(6041248)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN4PR0701MB3648; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3648; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(52164004)(189003)(199004)(377424004)(24454002)(81166006)(16526018)(81156014)(8676002)(316002)(305945005)(6486002)(6246003)(6506006)(65826007)(8656006)(50466002)(52116002)(5660300001)(42882006)(2950100002)(6666003)(58126008)(4326008)(25786009)(76176011)(229853002)(68736007)(53416004)(83506002)(8936002)(478600001)(6116002)(69596002)(64126003)(3846002)(66066001)(53546010)(101416001)(93886005)(97736004)(31686004)(2906002)(72206003)(65956001)(47776003)(2870700001)(7736002)(110136005)(54906003)(6512007)(52146003)(53936002)(106356001)(67846002)(2486003)(23676004)(55236003)(105586002)(31696002)(36756003)(33646002)(65806001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3648; H:hyd1ajoseph-dt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjRQUjA3MDFNQjM2NDg7MjM6TlR0M3hTQnNNbDZKMDZHTmwzLzB3dmRV?= =?utf-8?B?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L3IYyG8I9UdSKpjR1k5eTvOMwxPqgtVHpR4t+G3OFvR/55xAWcp8ZxXsX5e6wBdHbWccBkcxD3Qbd/uBkMW/xJPuoPr9PrqsbAwg6NGKaWLhd+xXpfmB0LxF4TIZIJIlVtHdiugAXz0IS5jzcEpkHkl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 11:08:54.8391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8c7a021-58a4-4bfb-25c9-08d53c99bf03 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0701MB3648 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: Wed, 06 Dec 2017 11:08:59 -0000 Hi Akhil, On 12/04/2017 01:19 PM, Akhil Goyal wrote: > 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. This will call for an ABI change. And LPM library has multiple variants for v4 & v6 lookups. We will need to modify all such instances. I've CCed Bruce for his opinion on this matter. If maintainers can decide on how to address this properly, I can plan my next steps accordingly. > Sergio can comment on this. > > Duplicating code for get_hop_for_offload_packet may not be a good idea. > > -Akhil >