From patchwork Tue Sep 26 05:36:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanhan Liu X-Patchwork-Id: 818464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fridaylinux-org.20150623.gappssmtp.com header.i=@fridaylinux-org.20150623.gappssmtp.com header.b="sh/zqera"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y1VHx1brgz9t30 for ; Tue, 26 Sep 2017 15:43:57 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9CEEBC0D; Tue, 26 Sep 2017 05:40:44 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id F1291AB9 for ; Tue, 26 Sep 2017 05:40:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5043A367 for ; Tue, 26 Sep 2017 05:40:43 +0000 (UTC) Received: by mail-pf0-f179.google.com with SMTP id m63so5038410pfk.7 for ; Mon, 25 Sep 2017 22:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eD5JKmVjWaJIytIv7Spg+jRu1XQO/2O5LsmidoH+dto=; b=sh/zqerazyJjfDmGZpvIoiTDEUEt5FKDiA43b139Wi9O+qMRWBZclU5q9ISMhfVvCy Djnbg39SeSAwhZMSZUqttiDDyaF+e//8M4XgXPo/zrnh+Q1EFgwk7CN8JiMAx5lyEUM1 w3etdEaU/Hb1SogguTtoODKCN5KFfdQNiGl/4ZtwF6P4q61qraEUBL2vFQC9rpw05WrN YMmBkjuiHHzUNJ5Y+BfUPjqV7MihZyZhZY00CClqLrveWqIijH6vIRC453YGOlv6e/8j L65UurbMxUmYvyr7+7BNIxu34nPgccNk2CxpwfIxlfMwy23m/BK3zh+Tr7Rqv+8tkNV5 b99g== 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:in-reply-to :references; bh=eD5JKmVjWaJIytIv7Spg+jRu1XQO/2O5LsmidoH+dto=; b=tia+AgV4As32zLmBVDTqDYPBR8uoBrRZN1XmUSrY1XDfURhXuhqhwCHgepX9die6gQ UWLTy1R4JXeuvcR9gjN3kOzN+l5TuHFeqcmXGHLb/MU7zyFTKFjTuXjCoK+ie811r5LE OqxICbr105nnO77rncnQJKTc9ivC1SYjXWclDgBYFI8iknItyhehAgouWTdZTnzoSqvJ gAMC2te9MM8G1WEjcwQh7OHn3e3nl0o1+9SKOu6a9YK4m76tjJlOcFKsSw4vKmVnNSRk g+rHtHK9z3254wVgbROUHcOHD+fBrwKV/8Wnr8PoxrDP2h4gVc425+NwkioNMK6Ytf/y 4SjA== X-Gm-Message-State: AHPjjUjmcx8D0rKHOV8g3bxRceAi3Ozny+ei0sRxxliBOzVHTHqBOoSP iyBzcjWRDNHS9+eWGEfb2dsT3VNC3AJxdQ== X-Google-Smtp-Source: AOwi7QCEC2COWQq7HRqKq1dZkN617IxZq44l/QHuZs2lLoiNSNdGBJQpKpEVGWfVU7FgPMplOgBiuA== X-Received: by 10.84.160.204 with SMTP id v12mr9646863plg.382.1506404442552; Mon, 25 Sep 2017 22:40:42 -0700 (PDT) Received: from localhost.localdomain ([101.228.205.132]) by smtp.gmail.com with ESMTPSA id o79sm13180077pfi.108.2017.09.25.22.40.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Sep 2017 22:40:41 -0700 (PDT) From: Yuanhan Liu To: dev@openvswitch.org Date: Tue, 26 Sep 2017 13:36:38 +0800 Message-Id: <1506404199-23579-9-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506404199-23579-1-git-send-email-yliu@fridaylinux.org> References: <1506404199-23579-1-git-send-email-yliu@fridaylinux.org> X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Simon Horman Subject: [ovs-dev] [PATCH v3 8/9] netdev-dpdk: add debug for rte flow patterns X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The log level will be set to DBG when this patchset is close to being merged. Co-authored-by: Finn Christensen Signed-off-by: Yuanhan Liu Signed-off-by: Finn Christensen --- lib/netdev-dpdk.c | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 02c3677..80fd64b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3420,6 +3420,182 @@ struct flow_actions { }; static void +dump_flow_pattern(struct rte_flow_item *item) +{ + if (item->type == RTE_FLOW_ITEM_TYPE_ETH) { + const struct rte_flow_item_eth *eth_spec = item->spec; + const struct rte_flow_item_eth *eth_mask = item->mask; + + VLOG_INFO("rte flow eth pattern:\n"); + if (eth_spec) { + VLOG_INFO("spec: src="ETH_ADDR_FMT", dst="ETH_ADDR_FMT", " + "type=0x%04" PRIx16"\n", + eth_spec->src.addr_bytes[0], eth_spec->src.addr_bytes[1], + eth_spec->src.addr_bytes[2], eth_spec->src.addr_bytes[3], + eth_spec->src.addr_bytes[4], eth_spec->src.addr_bytes[5], + eth_spec->dst.addr_bytes[0], eth_spec->dst.addr_bytes[1], + eth_spec->dst.addr_bytes[2], eth_spec->dst.addr_bytes[3], + eth_spec->dst.addr_bytes[4], eth_spec->dst.addr_bytes[5], + ntohs(eth_spec->type)); + } else { + VLOG_INFO("spec = null\n"); + } + if (eth_mask) { + VLOG_INFO("mask: src="ETH_ADDR_FMT", dst="ETH_ADDR_FMT", " + "type=0x%04"PRIx16"\n", + eth_mask->src.addr_bytes[0], eth_mask->src.addr_bytes[1], + eth_mask->src.addr_bytes[2], eth_mask->src.addr_bytes[3], + eth_mask->src.addr_bytes[4], eth_mask->src.addr_bytes[5], + eth_mask->dst.addr_bytes[0], eth_mask->dst.addr_bytes[1], + eth_mask->dst.addr_bytes[2], eth_mask->dst.addr_bytes[3], + eth_mask->dst.addr_bytes[4], eth_mask->dst.addr_bytes[5], + eth_mask->type); + } else { + VLOG_INFO("mask = null\n"); + } + } + + if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) { + const struct rte_flow_item_vlan *vlan_spec = item->spec; + const struct rte_flow_item_vlan *vlan_mask = item->mask; + + VLOG_INFO("rte flow vlan pattern:\n"); + if (vlan_spec) { + VLOG_INFO("spec: tpid=0x%"PRIx16", tci=0x%"PRIx16"\n", + ntohs(vlan_spec->tpid), ntohs(vlan_spec->tci)); + } else { + VLOG_INFO("spec = null\n"); + } + + if (vlan_mask) { + VLOG_INFO("mask: tpid=0x%"PRIx16", tci=0x%"PRIx16"\n", + vlan_mask->tpid, vlan_mask->tci); + } else { + VLOG_INFO("mask = null\n"); + } + } + + if (item->type == RTE_FLOW_ITEM_TYPE_IPV4) { + const struct rte_flow_item_ipv4 *ipv4_spec = item->spec; + const struct rte_flow_item_ipv4 *ipv4_mask = item->mask; + + VLOG_INFO("rte flow ipv4 pattern:\n"); + if (ipv4_spec) { + VLOG_INFO("spec: tos=0x%"PRIx8", ttl=%"PRIx8", proto=0x%"PRIx8 + ", src="IP_FMT", dst="IP_FMT"\n", + ipv4_spec->hdr.type_of_service, + ipv4_spec->hdr.time_to_live, + ipv4_spec->hdr.next_proto_id, + IP_ARGS(ipv4_spec->hdr.src_addr), + IP_ARGS(ipv4_spec->hdr.dst_addr)); + } else { + VLOG_INFO("spec = null\n"); + } + if (ipv4_mask) { + VLOG_INFO("mask: tos=0x%"PRIx8", ttl=%"PRIx8", proto=0x%"PRIx8 + ", src="IP_FMT", dst="IP_FMT"\n", + ipv4_mask->hdr.type_of_service, + ipv4_mask->hdr.time_to_live, + ipv4_mask->hdr.next_proto_id, + IP_ARGS(ipv4_mask->hdr.src_addr), + IP_ARGS(ipv4_mask->hdr.dst_addr)); + } else { + VLOG_INFO("mask = null\n"); + } + } + + if (item->type == RTE_FLOW_ITEM_TYPE_UDP) { + const struct rte_flow_item_udp *udp_spec = item->spec; + const struct rte_flow_item_udp *udp_mask = item->mask; + + VLOG_INFO("rte flow udp pattern:\n"); + if (udp_spec) { + VLOG_INFO("spec: src_port=%"PRIu16", dst_port=%"PRIu16"\n", + ntohs(udp_spec->hdr.src_port), + ntohs(udp_spec->hdr.dst_port)); + } else { + VLOG_INFO("spec = null\n"); + } + if (udp_mask) { + VLOG_INFO("mask: src_port=0x%"PRIx16", dst_port=0x%"PRIx16"\n", + udp_mask->hdr.src_port, + udp_mask->hdr.dst_port); + } else { + VLOG_INFO("mask = null\n"); + } + } + + if (item->type == RTE_FLOW_ITEM_TYPE_SCTP) { + const struct rte_flow_item_sctp *sctp_spec = item->spec; + const struct rte_flow_item_sctp *sctp_mask = item->mask; + + VLOG_INFO("rte flow sctp pattern:\n"); + if (sctp_spec) { + VLOG_INFO("spec: src_port=%"PRIu16", dst_port=%"PRIu16"\n", + ntohs(sctp_spec->hdr.src_port), + ntohs(sctp_spec->hdr.dst_port)); + } else { + VLOG_INFO("spec = null\n"); + } + if (sctp_mask) { + VLOG_INFO("mask: src_port=0x%"PRIx16", dst_port=0x%"PRIx16"\n", + sctp_mask->hdr.src_port, + sctp_mask->hdr.dst_port); + } else { + VLOG_INFO("mask = null\n"); + } + } + + if (item->type == RTE_FLOW_ITEM_TYPE_ICMP) { + const struct rte_flow_item_icmp *icmp_spec = item->spec; + const struct rte_flow_item_icmp *icmp_mask = item->mask; + + VLOG_INFO("rte flow icmp pattern:\n"); + if (icmp_spec) { + VLOG_INFO("spec: icmp_type=%"PRIu8", icmp_code=%"PRIu8"\n", + ntohs(icmp_spec->hdr.icmp_type), + ntohs(icmp_spec->hdr.icmp_code)); + } else { + VLOG_INFO("spec = null\n"); + } + if (icmp_mask) { + VLOG_INFO("mask: icmp_type=0x%"PRIx8", icmp_code=0x%"PRIx8"\n", + icmp_spec->hdr.icmp_type, + icmp_spec->hdr.icmp_code); + } else { + VLOG_INFO("mask = null\n"); + } + } + + if (item->type == RTE_FLOW_ITEM_TYPE_TCP) { + const struct rte_flow_item_tcp *tcp_spec = item->spec; + const struct rte_flow_item_tcp *tcp_mask = item->mask; + + VLOG_INFO("rte flow tcp pattern:\n"); + if (tcp_spec) { + VLOG_INFO("spec: src_port=%"PRIu16", dst_port=%"PRIu16 + ", data_off=0x%"PRIx8", tcp_flags=0x%"PRIx8"\n", + ntohs(tcp_spec->hdr.src_port), + ntohs(tcp_spec->hdr.dst_port), + tcp_spec->hdr.data_off, + tcp_spec->hdr.tcp_flags); + } else { + VLOG_INFO("spec = null\n"); + } + if (tcp_mask) { + VLOG_INFO("mask: src_port=%"PRIx16", dst_port=%"PRIx16 + ", data_off=0x%"PRIx8", tcp_flags=0x%"PRIx8"\n", + tcp_mask->hdr.src_port, + tcp_mask->hdr.dst_port, + tcp_mask->hdr.data_off, + tcp_mask->hdr.tcp_flags); + } else { + VLOG_INFO("mask = null\n"); + } + } +} + +static void add_flow_pattern(struct flow_patterns *patterns, enum rte_flow_item_type type, const void *spec, const void *mask) { @@ -3438,6 +3614,7 @@ add_flow_pattern(struct flow_patterns *patterns, enum rte_flow_item_type type, patterns->items[cnt].spec = spec; patterns->items[cnt].mask = mask; patterns->items[cnt].last = NULL; + dump_flow_pattern(&patterns->items[cnt]); patterns->cnt++; }