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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 58158C282DA for ; Sun, 3 Feb 2019 17:11:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24EC52083B for ; Sun, 3 Feb 2019 17:11:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GdNm6fMl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727192AbfBCRLe (ORCPT ); Sun, 3 Feb 2019 12:11:34 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46585 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726737AbfBCRLe (ORCPT ); Sun, 3 Feb 2019 12:11:34 -0500 Received: by mail-pg1-f193.google.com with SMTP id w7so5212385pgp.13 for ; Sun, 03 Feb 2019 09:11:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QrKGdX7ZJUgNMr7ckPiRMd/hz3xiFm6cSrcacZudiDs=; b=GdNm6fMlYz418tq/mXJ4iY3f4GWX/bbA2lADMUZzfE9xNzEPke2z1HwABHCDLEHayX RFSJjjop4/9yqS63zuzqXG6SKI7nzBk0FqdNy7JiZ7evG91jvlmFyBQhmpEBf+zPJZDE v5IdsiSHy5kZvbCwG9w93mYQykhSdQVOYfHk7dWhZrAQ0oPTuTcqeJwPVJ+TLMwpXxMZ jMZiDlKs3E8Ns7NB5WylhpeP3oTL6nvZee7qb3s0EXE0S5V8+DHpGiImcRt3b11fovXK 0yOB0hSZYKED8SID2lnmHt/EiZaBQiMGrNfr0rLTjIM8EJaG++9BBful8S7FGTt8GgpK p6Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QrKGdX7ZJUgNMr7ckPiRMd/hz3xiFm6cSrcacZudiDs=; b=kUlMB6jBwhn8OD8zGtiikfJx9l85a5jhGYraJF+Se8hMX5XvwOJJpAWWPQUJ9xbs+O R0bsUCdVv8HB4Rx63UoSt+DR43RU6SwWWx2hHJQwQ5dwTK1JP2eFaaBxs/e6QF1LJJla OqovxN/4ghmdD1HI8e7+AczkIVu9XfnzO97rdAwRf9V0helj17nhESCsxm2M3KJnMDaC L0zYqq90L1FkYclfIozs67ssiZd/TeBuH8OXyOpMJs95m/wfRwozgvgm/xCbxaSfHEsE jxcERQcBNC/JRXX9HED4cWJE5ZObWNfuhwf0uUBpWt6yAUID4U0hv3uXoHVp0yPeBoYd rw5Q== X-Gm-Message-State: AHQUAubvAPN8pwe0EB/5ugpi8yns7LCwRVlP6l0Kh1WV2EZOP4fNfqnh mkFO5Ow3N2wJ0ETj2KbrSvNxC1ck X-Google-Smtp-Source: AHgI3IZTuVhphKzrkoZCpexoadVSGsLLoe8QPIidAhgsHEq1ZRUdxD/B/Wd1+YnfvanpN9SriXksJw== X-Received: by 2002:a63:c0f:: with SMTP id b15mr10109702pgl.314.1549213893115; Sun, 03 Feb 2019 09:11:33 -0800 (PST) Received: from ?IPv6:2601:282:800:fd80:782b:4032:4a50:78b9? ([2601:282:800:fd80:782b:4032:4a50:78b9]) by smtp.googlemail.com with ESMTPSA id n70sm20116999pfi.185.2019.02.03.09.11.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Feb 2019 09:11:31 -0800 (PST) Subject: Re: [PATCH iproute2-next] tc: full JSON support for 'bpf' actions To: Davide Caratti , David Ahern , Stephen Hemminger Cc: netdev@vger.kernel.org References: From: David Ahern Message-ID: Date: Sun, 3 Feb 2019 10:11:30 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 1/31/19 10:58 AM, Davide Caratti wrote: > Add full JSON output support in the dump of 'act_bpf'. > > Example using eBPF: > > # tc actions flush action bpf > # tc action add action bpf object bpf/action.o section 'action-ok' > # tc -j action list action bpf | jq > [ > { > "total acts": 1 > }, > { > "actions": [ > { > "order": 0, > "kind": "bpf", > "bpf_name": "action.o:[action-ok]", > "prog": { > "id": 33, > "tag": "a04f5eef06a7f555", > "jited": 1 > }, > "control_action": { > "type": "pipe" > }, > "index": 1, > "ref": 1, > "bind": 0 > } > ] > } > ] > > Example using cBPF: > > # tc actions flush action bpf > # a=$(mktemp) > # tcpdump -ddd not ether proto 0x888e >$a > # tc action add action bpf bytecode-file $a index 42 > # rm $a > # tc -j action list action bpf | jq > [ > { > "total acts": 1 > }, > { > "actions": [ > { > "order": 0, > "kind": "bpf", > "bytecode": { > "length": 4, > "insns": [ > { > "code": 40, > "jt": 0, > "jf": 0, > "k": 12 > }, > { > "code": 21, > "jt": 0, > "jf": 1, > "k": 34958 > }, > { > "code": 6, > "jt": 0, > "jf": 0, > "k": 0 > }, > { > "code": 6, > "jt": 0, > "jf": 0, > "k": 262144 > } > ] > }, > "control_action": { > "type": "pipe" > }, > "index": 42, > "ref": 1, > "bind": 0 > } > ] > } > ] > > Tested with: > # ./tdc.py -c bpf > > Cc: Andrea Claudi > Signed-off-by: Davide Caratti > --- > include/bpf_util.h | 2 +- > lib/bpf.c | 26 ++++++++++++++++++-------- > tc/f_bpf.c | 2 +- > tc/m_bpf.c | 32 +++++++++++++++++--------------- > 4 files changed, 37 insertions(+), 25 deletions(-) > applied to iproute2-next. Thanks