From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E376EC5B578 for ; Sat, 6 Jul 2019 08:41:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2D8F216B7 for ; Sat, 6 Jul 2019 08:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726001AbfGFIlp convert rfc822-to-8bit (ORCPT ); Sat, 6 Jul 2019 04:41:45 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38252 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbfGFIlo (ORCPT ); Sat, 6 Jul 2019 04:41:44 -0400 Received: by mail-ed1-f66.google.com with SMTP id r12so9808695edo.5 for ; Sat, 06 Jul 2019 01:41:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=1+5yPTDjCxphlEYZ/xRtmGNYP5vPtrUId2OQ7WEZnc8=; b=WHBisrhYTpUyEJnTzvIrwSvVt6R+dp36I+cKHkN6BzW5I45M81kTSFHYXGUXJVEmV5 hT43abHZ8j+5nOyLm7xKGZb2FD9NxdnYs0Njx26uJqOubdWM7AS1lmSkzypepAiYKs8O a4jnnU6+Rm8aY9R/RQuDV7r3EbOzJhduRIzMwNJo4jmKcbj/yOohlXKcj5xFSysx86Kq 7awqAz//LPTObwZji/GtfrLi5MFepjEwO1D2oHfPN6aAO9LLjkP+jTgd4AiqLHaIUfz1 0ahoVNJX6klTUy3PE19D4F51hOmyXIQyw0fmh+5WDDgLAHQ41cm4AtEYQXdQjJkJfSA6 sWVA== X-Gm-Message-State: APjAAAVoCBPMTKq+wOCDHxEPxLbcUpckxA2F0OYlS7brZqTrjIRN20oR qz2x7G7Y1s7hLtVSx59YCbWUgg== X-Google-Smtp-Source: APXvYqz4ZrHp6mvfl/zShozfgJfvuSZKkpmkblyZ5wdF+aWIFriTWI5b6wtuKEyHxottxac+FsDpeA== X-Received: by 2002:aa7:d68e:: with SMTP id d14mr8934790edr.253.1562402503016; Sat, 06 Jul 2019 01:41:43 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id d1sm2171973ejn.11.2019.07.06.01.41.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 06 Jul 2019 01:41:42 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 4D3281800C5; Sat, 6 Jul 2019 10:41:41 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Y Song Cc: Daniel Borkmann , Alexei Starovoitov , netdev , David Miller , Jesper Dangaard Brouer , Jakub Kicinski , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= Subject: Re: [PATCH bpf-next 3/3] xdp: Add devmap_hash map type for looking up devices by hashed index In-Reply-To: References: <156234940798.2378.9008707939063611210.stgit@alrua-x1> <156234940855.2378.3580468359411972045.stgit@alrua-x1> X-Clacks-Overhead: GNU Terry Pratchett Date: Sat, 06 Jul 2019 10:41:41 +0200 Message-ID: <87d0in1rne.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Y Song writes: > On Fri, Jul 5, 2019 at 11:14 AM Toke Høiland-Jørgensen wrote: >> >> From: Toke Høiland-Jørgensen >> >> A common pattern when using xdp_redirect_map() is to create a device map >> where the lookup key is simply ifindex. Because device maps are arrays, >> this leaves holes in the map, and the map has to be sized to fit the >> largest ifindex, regardless of how many devices actually are actually >> needed in the map. >> >> This patch adds a second type of device map where the key is looked up >> using a hashmap, instead of being used as an array index. This allows maps >> to be densely packed, so they can be smaller. >> >> Signed-off-by: Toke Høiland-Jørgensen >> --- >> include/linux/bpf.h | 7 + >> include/linux/bpf_types.h | 1 >> include/trace/events/xdp.h | 3 >> include/uapi/linux/bpf.h | 7 + >> kernel/bpf/devmap.c | 192 +++++++++++++++++++++++++++++++ >> kernel/bpf/verifier.c | 2 >> net/core/filter.c | 9 + >> tools/bpf/bpftool/map.c | 1 >> tools/include/uapi/linux/bpf.h | 7 + >> tools/lib/bpf/libbpf_probes.c | 1 >> tools/testing/selftests/bpf/test_maps.c | 16 +++ >> 11 files changed, 237 insertions(+), 9 deletions(-) > > Could you break this patch into multiple commits for easy backporting > and easy syncing to libbpf repo? > For example, you can break it into 4 patches: > . kernel patch > . sync uapi bpf.h > . tools/lib/bpf/libbpf_probes.c > . other tools changes. Sure, I'll send a v2. -Toke