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 06F1CA04C1 for ; Mon, 10 Aug 2020 05:14:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 521FC2A5D; Mon, 10 Aug 2020 05:14:42 +0200 (CEST) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by dpdk.org (Postfix) with ESMTP id 940CA2142 for ; Mon, 10 Aug 2020 05:14:40 +0200 (CEST) Received: by mail-lj1-f179.google.com with SMTP id f26so6567239ljc.8 for ; Sun, 09 Aug 2020 20:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IDG72uFvamxOTZ6b5GziE/KoSrLeGH/g2xzlN3rV0Mo=; b=hUzio3YPfmdCn3KQdocLrMDWJOI2RRHEfLBbYXSAe2HF7zRVN+atxPE/8qvvZyHsln JhAQjDn+SDUeYuJxUEzQO8A5go0akzGA8XRMpnT5vptj/xGMCXoTcVWNpkibtzXDsz4E Tzc366H7G1QUbbU62QWHRi7qMUVVfAfnVjsxkIvPI3SverSQlv8elgcbhe3XmOXEr5Km gmxf3xzSGy2taVKxXgAtlx59h2gmBfNNFddJuqAVVVMHXKM+6oHonl0/feBLhJik2n0p hg8xAT3QJjkFy3az6zUdK0GpZRqINycbblWJLjRtE4VizYznklVmVzw5Td1VUfyxQUgC JXbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IDG72uFvamxOTZ6b5GziE/KoSrLeGH/g2xzlN3rV0Mo=; b=tNVj4ZzbiXnRtmc6K3VmP0AYexchkXLF6QDC1SFRr6Sr+cszi8d0bhguK4lPkk4LWj 0kH6T4yGOnv2IAxQORf3QJivJsRcg476+FWHJV+ENJ8kc0ncAnr9f7tx1IRC+DkatoXW Do9BD4c3YPQaBAG1JRm8E6m66EBNJ71TepUn73f+76zKZWTtKy27QatnrxXTr8ixVRIJ r4c32uGURYA5rXrnPmjA/mKwAjm+O7TWA7at/Pr7ER3uxbo1Y0F7HzS2bS1mjzs7f8E8 BxdcY5O+3/qqAsYcbxZmCwSK2vs5yupudJbE7ExwOGlIXc3bfJl/KInO4YVWenYQFR+i n6Aw== X-Gm-Message-State: AOAM532LWjhKxdfW/L47N9zirJsHw3W2LvsJonca2esXDxmmpyPa5sSO pArQM0FowM5qPvQvxhkDK7oZPiSzVDUj8If/14U= X-Google-Smtp-Source: ABdhPJxWTvFjxRc43S2jvghsN3x24hCqSgU+7EGA6zPzbEpmI0mJcmHGtr8dN53519FhQ2rq0MAnyjwj+c/yRs4FsK0= X-Received: by 2002:a2e:b0c9:: with SMTP id g9mr10958962ljl.65.1597029279982; Sun, 09 Aug 2020 20:14:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arvind Narayanan Date: Sun, 9 Aug 2020 22:14:28 -0500 Message-ID: To: Cliff Burdick Cc: users Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-users] rte_flow() usage of htonl() for ipv4 addr masks? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org Sender: "users" On Sun, Aug 9, 2020 at 9:56 PM Cliff Burdick wrote: > > It should convert to network order, although many applications it won't matter since they use all F's. If you follow the code in flow_filtering, indeed it's using: > > #define FULL_MASK 0xffffffff /* full mask */ > > So it won't make any difference. The example should probably be updated, though.. Thanks Cliff! Yes, when it's all Fs, it doesn't matter. But I am trying to install rte_flow rules for subnets by parsing a file which has IPv4 ranges mentioned using CIDR format. I have it working for say /24 ranges, but as I go to /30 or /29, the same implementation is not working. I followed the flow classify example. https://doc.dpdk.org/guides/sample_app_ug/flow_classify.html as it does the same thing. ``` static uint32_t convert_depth_to_bitmask(uint32_t depth_val) { uint32_t bitmask = 0; int i, j; for (i = depth_val, j = 0; i > 0; i--, j++) bitmask |= (1 << (31 - j)); return bitmask; } ip_mask.hdr.dst_addr = htonl(convert_depth_to_bitmask(29)) ``` and https://github.com/DPDK/dpdk/blob/master/examples/flow_classify/flow_classify.c#L377-L396 for ipv4 parsing. I'll keep digging. As always, it seems too trivial to fix as a bug, but it's been driving me crazy.. haha - Arvind > > On Sun, Aug 9, 2020 at 7:03 PM Arvind Narayanan wrote: >> >> Hi, >> >> In the flow_filtering sample application, the IP's mask was set without >> using htonl(). >> https://github.com/DPDK/dpdk/blob/master/examples/flow_filtering/flow_blocks.c#L85 >> >> Another DPDK page shows >> how a testpmd command is translated to C code. >> On this page though, Example 4.2 (Range IPv4 drop) has used htonl() to set >> the mask. >> >> Any clarification on how to load the mask would be helpful. >> >> Thanks, >> Arvind