From patchwork Thu Oct 5 14:41:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Craig Gallek X-Patchwork-Id: 821847 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y7Fpj0cgsz9sNw for ; Fri, 6 Oct 2017 01:42:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751331AbdJEOmC (ORCPT ); Thu, 5 Oct 2017 10:42:02 -0400 Received: from mail-qk0-f171.google.com ([209.85.220.171]:51584 "EHLO mail-qk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbdJEOmB (ORCPT ); Thu, 5 Oct 2017 10:42:01 -0400 Received: by mail-qk0-f171.google.com with SMTP id 17so14887460qkq.8 for ; Thu, 05 Oct 2017 07:42:01 -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:date:message-id; bh=CD0UctlSotzGXadW6A/QFdPnJLkcD3aRvq37ddVIo7k=; b=kcNjWk4r7aaHbV3uBOMpLrvkxqh3NlR86N8e1ahdcvtSrXSDPpzE0mZu3kKsjDMMQ2 u3hoDDgaD5k0Sr60F0fsGOK9poXb/Sfh6cDVveEnpwKfoG4r7sujvH90KUBgHwMYZ2p4 L+J4TtgLkmOigk1SygPHD/htI19sLOhIEBjavxvKz5L+DhseYUtjrsZw+M1qkGA9ZPvq gCqad0z1Hx6Q1zdXP/RuPM4kja5zCQ1k2Prjxkkq3tnVmdsXtC0PllSLDg+kXumpJxW/ mNs2PeWSL8LqJtiAYi6JsXRZf3g6Bw2Brmb0oKEOxlUhuPUb3+ZDLOkyQGiJwheMF6+d rrGQ== X-Gm-Message-State: AMCzsaXanXgvnwVn9Mmt6c3VeuRNBk8FQG9gUwP47FMZihRZicS8bsJx wg7wQc5fdysaZVEDlF6NN02+nw== X-Google-Smtp-Source: AOwi7QB6HXbqTBTPTvpxBbXzttPNSSdjZd9Bb1AD/Al9XkGxYZScGqCdUm3gVImf6gyXF9TnecCbEw== X-Received: by 10.55.217.1 with SMTP id u1mr6579733qki.53.1507214520688; Thu, 05 Oct 2017 07:42:00 -0700 (PDT) Received: from monkey.nyc.corp.google.com ([100.101.213.10]) by smtp.gmail.com with ESMTPSA id u40sm3527086qtu.9.2017.10.05.07.41.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Oct 2017 07:41:59 -0700 (PDT) From: Craig Gallek To: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , "David S . Miller" Cc: Chonggang Li , netdev@vger.kernel.org Subject: [PATCH net-next v3 0/2] libbpf: support more map options Date: Thu, 5 Oct 2017 10:41:56 -0400 Message-Id: <20171005144158.14860-1-kraigatgoog@gmail.com> X-Mailer: git-send-email 2.14.2.920.gcf0c67979c-goog Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Craig Gallek The functional change to this series is the ability to use flags when creating maps from object files loaded by libbpf. In order to do this, the first patch updates the library to handle map definitions that differ in size from libbpf's struct bpf_map_def. For object files with a larger map definition, libbpf will continue to load if the unknown fields are all zero, otherwise the map is rejected. If the map definition in the object file is smaller than expected, libbpf will use zero as a default value in the missing fields. Craig Gallek (2): libbpf: parse maps sections of varying size libbpf: use map_flags when creating maps tools/lib/bpf/libbpf.c | 72 +++++++++++++++++++++++++++++--------------------- tools/lib/bpf/libbpf.h | 1 + 2 files changed, 43 insertions(+), 30 deletions(-) Acked-by: Alexei Starovoitov