From patchwork Mon Jan 31 10:55:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1586604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Cjy9pbcH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JnQ2q6vQDz9s8q for ; Mon, 31 Jan 2022 21:55:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2CF2C83FE7; Mon, 31 Jan 2022 10:55:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7KwVGYrARvNX; Mon, 31 Jan 2022 10:55:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6B178830B8; Mon, 31 Jan 2022 10:55:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3E66BC0011; Mon, 31 Jan 2022 10:55:44 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id EF83FC000B for ; Mon, 31 Jan 2022 10:55:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DE52E60BD6 for ; Mon, 31 Jan 2022 10:55:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iKQkBg_pLxns for ; Mon, 31 Jan 2022 10:55:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 367DA60608 for ; Mon, 31 Jan 2022 10:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643626541; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8JKgeaDL9n/D44gUHYwOWyYqGtQHmMVIFFUtdsmqzaI=; b=Cjy9pbcHubl4XCgJHFTUlm++lkUqkj5IHymyC+V9wRf61lF+AIME20AoKN9Rlsb7cEKWLK A+Wi4rtlXkaevJs6HjM25H2znNUmioJJ0U2627hI4oXIEvEQoonGX+LaTTU7zA7R5dIodj L6Tg5Z2GxoGrId3hYyEhpjdQ+VjrUiM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-7-pHwwdsOPKqUlKrJ9YK7w-1; Mon, 31 Jan 2022 05:55:21 -0500 X-MC-Unique: 7-pHwwdsOPKqUlKrJ9YK7w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE291190A7A0; Mon, 31 Jan 2022 10:55:20 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.194.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43357108BD33; Mon, 31 Jan 2022 10:55:20 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Mon, 31 Jan 2022 11:55:10 +0100 Message-Id: <164362650513.2824752.3415995944135755088.stgit@ebuild> In-Reply-To: <164362511347.2824752.11751862323892747321.stgit@ebuild> References: <164362511347.2824752.11751862323892747321.stgit@ebuild> User-Agent: StGit/1.1 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=echaudro@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v2 10/10] odp-util: Fix output for tc to be equal to kernel X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When the same flow is programmed in the kernel and tc, they look different due to the way they are translated. They take the userspace approach by always including the packet type attribute. To make the outputs the same, show the ethernet header when the packet type is wildcarded, and not printed. So without the fix the kernel would show (ovs-appctl dpctl/dump-flows): in_port(3),eth(),eth_type(0x0800),ipv4(frag=no), packets:19, bytes:11614, used:0.001s, actions:output Where as TC would show: in_port(3),eth_type(0x0800),ipv4(frag=no), packets:19, bytes:11614, used:0.001s, actions:output Signed-off-by: Eelco Chaudron Acked-by: Roi Dayan --- lib/odp-util.c | 5 +++++ tests/tunnel.at | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/odp-util.c b/lib/odp-util.c index 99dd55807..cd7063046 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -4630,6 +4630,11 @@ odp_flow_format(const struct nlattr *key, size_t key_len, ds_put_char(ds, ','); } ds_put_cstr(ds, "eth()"); + } else if (attr_type == OVS_KEY_ATTR_PACKET_TYPE && is_wildcard) { + /* See the above help text, however in the case where the + * packet type is not shown, we still need to display the + * eth() header if the packets type is wildcarded. */ + has_packet_type_key = false; } ofpbuf_clear(&ofp); } diff --git a/tests/tunnel.at b/tests/tunnel.at index b8ae7caa9..fd482aa87 100644 --- a/tests/tunnel.at +++ b/tests/tunnel.at @@ -126,7 +126,7 @@ AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl AT_CHECK([ovs-appctl dpctl/add-flow "tunnel(dst=1.1.1.1,src=3.3.3.200/255.255.255.0,tp_dst=123,tp_src=1,ttl=64),recirc_id(0),in_port(1),eth(),eth_type(0x0800),ipv4()" "2"]) AT_CHECK([ovs-appctl dpctl/dump-flows | tail -1], [0], [dnl -tunnel(src=3.3.3.200/255.255.255.0,dst=1.1.1.1,ttl=64,tp_src=1,tp_dst=123),recirc_id(0),in_port(1),eth_type(0x0800), packets:0, bytes:0, used:never, actions:2 +tunnel(src=3.3.3.200/255.255.255.0,dst=1.1.1.1,ttl=64,tp_src=1,tp_dst=123),recirc_id(0),in_port(1),eth(),eth_type(0x0800), packets:0, bytes:0, used:never, actions:2 ]) OVS_VSWITCHD_STOP