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 59603A04F3; Fri, 6 Dec 2019 23:11:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7BEA7235; Fri, 6 Dec 2019 23:11:25 +0100 (CET) Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by dpdk.org (Postfix) with ESMTP id EDCFD91 for ; Fri, 6 Dec 2019 23:11:23 +0100 (CET) Received: by mail-pj1-f44.google.com with SMTP id w23so3328057pjd.2 for ; Fri, 06 Dec 2019 14:11:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=yIi9j4i28InTgGv9qpCDJBiLCJ8TdS7fKmps5R7Zfp0=; b=v0g4+2d1gL8XlSBg1D9I33M4mLO3YYwp05tjg7/JECudDF+DpBULTFsyN/d5SoKynZ ptZVgTa3fObP8E1fTYC+SvIEFK4AVxtS3A1U7fquWjT1blTrEyeWY28bagDuQVMFyTob X23Zi2uIDT7MRiOnYFxAGDQYHcC33VMNDT77H+xAoBR6uJf9th64CNQXxF7C3R6FRQzU s/VubnFVVNOUVHdOpC6GmZ2SZwj5x00MADwq8mFtgaz/3+C1L2nbuZtLicOo7NE4FJjj ZsZCU4nycvS1oW0wUA2d46fOdzWXNEOaY/B9FEfNVxbfLUoChAWBrkKe/QGCay5UWO6h uDIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-transfer-encoding; bh=yIi9j4i28InTgGv9qpCDJBiLCJ8TdS7fKmps5R7Zfp0=; b=k96+Wqp02cgSqh/xHI2j6iMpuk2fPCoDK4He7i5JftGhPTVypGVUAnZU/YqQOMJUgE J2EhOt6VnnOU7BAJG/zCZ7olQzptyGjZTPeXYeLWAwmbqOugEe4eetQNULNkL6arZA6A 8ez+o8s0Ag2M5majBa8ZQlRSyw6YRi/mqCUE+LGK6rf6iO/nUY0PmG38cRgij40VJqJQ dS62mSZ1GCDEqEk4GJuNc9qHx5SAxzQmhrMQc0pquLpc1W66P+ymQcE5r3le6bWwTKdg fQtk/iA5TDiSJMosf47un0sSwo3UKnnPetAcxOIVLDvxoxg05kaQOqVAgQYB8/zcoKoy hXSg== X-Gm-Message-State: APjAAAUckQGQ1vBijar9Vc8nEX5Xgk7V5bTqxiNXz9XYLLKe1iKphwOI FmFKXlA9BVEOYk69YxRW7xmlAX4O7t7FGg== X-Google-Smtp-Source: APXvYqxikmaZG0SP/86/IJ9kz/R1WNFowyGwttmE2RPwRDKusDS5ZzswyLBqnZkoYLfsXMXmj75ndQ== X-Received: by 2002:a17:902:7898:: with SMTP id q24mr16869198pll.23.1575670282724; Fri, 06 Dec 2019 14:11:22 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id q41sm4279924pja.20.2019.12.06.14.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 14:11:22 -0800 (PST) Date: Fri, 6 Dec 2019 14:11:14 -0800 From: Stephen Hemminger To: Ray Kinsella Cc: dev@dpdk.org Message-ID: <20191206141114.6b7d6d60@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] RFC - adding filter to packet capture API 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In the process of updating packet capture to take a filter program, there is one open question about API/ABI. The example is: int rte_pdump_enable(uint16_t port, uint16_t queue, uint32_t flags, struct rte_ring *ring, struct rte_mempool *mp, void *filter); For the new version want to add ability to pass a BPF (classic) program from libcap. This is described in most pcap API's as "struct bpf_program". The filter parameter was left as a placeholder, but in typical YAGNI fashion. When we do need to use it, it is not going to work out. Since the existing filter argument was never used, there are a bunch of options (in order from best to worse). 1. Introduce new API which takes a filter. int rte_pdump_enable_bpf(uint16_t port, uint16_t queue, uint32_t flags, struct rte_ring *ring, struct rte_mempool *mp, const struct bpf_program *filter); The old API is just the same as calling new API with NULL as filter. This solution is safe but adds minor bloat. 2. Use API versioning. This solves the ABI problem but it is still an API breakage since program that was passing junk would still not compile. 3. Change the function signature of existing API. This risks breaking at compile time some program that was passing some other value. Similarly, a program could have passed garbage, we never checked. 4. Keep existing function signature, but be type unsafe. This keeps API, but still is ABI breakage for programs that passed garbage. Plus C is unsafe enough already.