From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0056.outbound.protection.outlook.com [104.47.36.56]) by dpdk.org (Postfix) with ESMTP id 04FA8378B for ; Wed, 29 Nov 2017 05:21:57 +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=tjoIQQFB1LUrtGe9l24Y7ZSJs5qFjZBu885psWYfPLY=; b=grwShmUUGWMwoYxIOb8wn4ubY97Bv3G+JC4z3WRFatBNMeMUbXqj8cBV93YweEbiy82kyOiPXUkKrAbQFoTJNAKgCDMCnw6dP4RDxIwn46ZnIX/CZSm0HKzLwH95TeHN0Dh8bvyERoMwQvie1Co0v7s+TtBkzFqawBxa+oKKhyM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from [192.168.0.103] (183.82.140.80) 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.260.4; Wed, 29 Nov 2017 04:21:53 +0000 To: Akhil Goyal , Declan Doherty , Sergio Gonzalez Monroy , Radu Nicolau 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 Joseph Message-ID: Date: Wed, 29 Nov 2017 09:51:36 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <5d0bed52-ad0e-df65-158e-4e62b79fe754@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [183.82.140.80] X-ClientProxiedBy: KL1PR0601CA0012.apcprd06.prod.outlook.com (2603:1096:802:1::22) To SN4PR0701MB3648.namprd07.prod.outlook.com (2603:10b6:803:4d::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81323e2b-e5ee-41bb-aca0-08d536e0b990 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:SN4PR0701MB3648; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3648; 3:LGCIqeWAawXGnObufFIxADGGzpVc4m3tjzWWa1Osl8INVxeP5YP409WkPNpxPnNdTeK99QsAYIVmoMb81XrLRuLi0opJEvQaGKdzbyXl2IChKs1J7DRfZlflq3+Y1qnh6qzoe/HQUodllOPR6l7RMRU43Q7HdyA/Hyv2SsCmtOL7DIyBu7HuDCxYYW8JauXmRTjAnznRSV+Xz8//haZaokaZ2i8g2yJ/XEnocxpJRWTOBh4VI0x2K/gR4fe7n/rk; 25:3DGCo338p/JoSyAFxuOSMMtJRy+Se6uUu5weM0tgCylOl5xkm/jlCG8NqXCOCzQkmutfRtthDLqD5+mMg2JkreZXJMS7u0jSl7o4LFUJjlBGs0kNDOOboR7A8GnKJPeKA7FkTB8DoW5FKpsp8ciwhDJb+5/wgMlBixltY0cJAXeL4oNA+xvexS4G461qFonfgGQoT3xE05THKrth67aH9YFa5OjjxOzco1l9EauReIZ7m+wCstplUbmZ/2OIRgYVxVdPqHtT9lgXGiLasGpanok74TfUYUiMcskysFTuNWkRsBTCKbZcJMNX4pq8tPYyF70nLR7lbpwfYDTklh0vEg==; 31:aS3D9B1NRV/Bj+KxWyicFpOseowyabUgrH6CUNu4EB9q/paNvXoPt9kMztTcxpkrEJfjq/TdDY9O9nb1mmmYR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exO/Cfc7wfnW9KbTny1JsOh8lyKe2a/1zcDTjidKT198dnMR29ZQaq5EYX2abC0mGcHmB2PyqB7+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(3231022)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011); SRVR:SN4PR0701MB3648; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3648; X-Forefront-PRVS: 05066DEDBB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(366004)(346002)(376002)(189002)(199003)(52164004)(24454002)(377424004)(67846002)(53936002)(93886005)(3260700006)(2870700001)(25786009)(33646002)(6116002)(64126003)(7736002)(31686004)(8676002)(3846002)(65826007)(5660300001)(316002)(50466002)(6246003)(229853002)(6666003)(478600001)(42882006)(2950100002)(117156002)(58126008)(54356999)(54906003)(110136005)(76176999)(50986999)(83506002)(101416001)(8656006)(97736004)(4326008)(16576012)(53546010)(36756003)(72206003)(68736007)(65956001)(6486002)(81156014)(106356001)(66066001)(189998001)(305945005)(65806001)(52146003)(23676004)(2486003)(2906002)(31696002)(8936002)(16526018)(81166006)(105586002)(52116002)(47776003)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3648; H:[192.168.0.103]; 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?MTtTTjRQUjA3MDFNQjM2NDg7MjM6YWVZeGFYMkJXTlVUbm9EaXE2bnhvQUJ5?= =?utf-8?B?VUVMNFA5OGFGTWFrZ3VLZG10eE5DMVJiUmI2ZW53amx0aDN2YXRoSW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rJ0F2SaebgeVA/KHKrXp0QuOB7rLeQEMtCf96U27wf8jGirkVHIFDPzE5YkpBTsj9807a09o4Inn2OsXkFuY0IFiIMbc9AqdRZjs5e+yMH2EeGxkZTjqbMu8fCvrDK9bqWXq8Mhfc6mnriqOmvfVAcaWY6xj2goAjGOEEz03qy5FMWtT8dIrjg+zWLi0Xgd48F9PQLi8U2tRXy8AWJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2017 04:21:53.2727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81323e2b-e5ee-41bb-aca0-08d536e0b990 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, 29 Nov 2017 04:21:58 -0000 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? > > > -Akhil Thanks, Anoob