From patchwork Mon Dec 28 09:24:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: taoyunxiang X-Patchwork-Id: 1421015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D4Qk81gQzz9sWC for ; Tue, 29 Dec 2020 05:17:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8FBC785899; Mon, 28 Dec 2020 18:17:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QZMJTtuuuwB0; Mon, 28 Dec 2020 18:16:59 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 3A2FD8743E; Mon, 28 Dec 2020 18:12:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0FB8BC2015; Mon, 28 Dec 2020 18:12:17 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id DEC02C0891 for ; Mon, 28 Dec 2020 09:26:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CB4E12045F for ; Mon, 28 Dec 2020 09:26:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i8eKOAfQfe6H for ; Mon, 28 Dec 2020 09:26:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by silver.osuosl.org (Postfix) with ESMTP id A125620464 for ; Mon, 28 Dec 2020 09:26:32 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee35fe9a490540-bee47; Mon, 28 Dec 2020 17:25:38 +0800 (CST) X-RM-TRANSID: 2ee35fe9a490540-bee47 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from yun.localdomain (unknown[112.25.154.146]) by rmsmtp-syy-appsvr02-12002 (RichMail) with SMTP id 2ee25fe9a48a90b-7b865; Mon, 28 Dec 2020 17:25:38 +0800 (CST) X-RM-TRANSID: 2ee25fe9a48a90b-7b865 From: Tao YunXiang To: ovs-dev@openvswitch.org Date: Mon, 28 Dec 2020 01:24:32 -0800 Message-Id: <20201228092520.11807-15-taoyunxiang@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201228092520.11807-1-taoyunxiang@cmss.chinamobile.com> References: <8> <20201228092520.11807-1-taoyunxiang@cmss.chinamobile.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 28 Dec 2020 18:10:34 +0000 Cc: Liuchang Subject: [ovs-dev] [PATCH 14/62] netdev-offload-dpdk: add vxlan encap action dump method 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" From: Liuchang Code Source From: Self Code Description: For debug reason, add vxlan encap action dump method Jira: #[Optional] 市场项目编号(名称):[Optional] --- lib/netdev-offload-dpdk.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 7e59d51..8f8a85b 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -326,6 +326,31 @@ dump_flow_pattern(struct ds *s, const struct rte_flow_item *item) } else { ds_put_cstr(s, " Mask = null\n"); } + } else if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) { + const struct rte_flow_item_vxlan *vxlan_spec = item->spec; + const struct rte_flow_item_vxlan *vxlan_mask = item->mask; + + ds_put_cstr(s, "rte flow vxlan pattern:\n"); + ds_put_cstr(s, "vxlan "); + if (vxlan_spec) { + ds_put_format(s, " Spec: flags=0x%x, vni=%d\n", + vxlan_spec->flags, + ntohl(*(ovs_be32 *)vxlan_spec->vni) >> 8); + ds_put_format(s, "vni spec %d ", + ntohl(*(ovs_be32 *)vxlan_spec->vni) >> 8); + } else { + ds_put_cstr(s, " Spec = null\n"); + } + if (vxlan_mask) { + ds_put_format(s, " Mask: flags=0x%x, vni=0x%06x\n", + vxlan_mask->flags, + ntohl(*(ovs_be32 *)vxlan_mask->vni) >> 8); + ds_put_format(s, "vni mask 0x%06x ", + ntohl(*(ovs_be32 *)vxlan_mask->vni) >> 8); + } else { + ds_put_cstr(s, " Mask = null\n"); + } + ds_put_cstr(s, "/ "); } else { ds_put_format(s, "unknown rte flow pattern (%d)\n", item->type); } @@ -374,6 +399,26 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) } } else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) { ds_put_cstr(s, "rte flow drop action\n"); + } else if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) { + const struct rte_flow_action_raw_encap *raw_encap = actions->conf; + + ds_put_cstr(s, "rte flow raw-encap action:\n"); + if (raw_encap) { + ds_put_format(s, " Raw-encap: size=%ld\n", raw_encap->size); + ds_put_format(s, " Raw-encap: encap=\n"); + ds_put_hex_dump(s, raw_encap->data, raw_encap->size, 0, false); + } else { + ds_put_cstr(s, " Raw-encap = null\n"); + } + } else if (actions->type == RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP) { + const struct rte_flow_action_vxlan_encap *vxlan_encap = actions->conf; + const struct rte_flow_item *items = vxlan_encap->definition; + + ds_put_cstr(s, "rte flow vxlan-encap action:\n"); + ds_put_cstr(s, "vxlan_encap / "); + while (items && items->type != RTE_FLOW_ITEM_TYPE_END) { + dump_flow_pattern(s, items++); + } } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC || actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_DST) { const struct rte_flow_action_set_mac *set_mac = actions->conf; @@ -459,6 +504,14 @@ netdev_offload_dpdk_flow_create(struct netdev *netdev, struct ds s; flow = netdev_dpdk_rte_flow_create(netdev, attr, items, actions, error); + /* work around: for dump_flow even if rte_flow create fail */ + if (!VLOG_DROP_DBG(&rl)) { + ds_init(&s); + dump_flow(&s, attr, items, actions); + VLOG_DBG_RL(&rl, "TIMO:%s: rte_flow 0x%"PRIxPTR" printed:\n%s", + netdev_get_name(netdev), (intptr_t) flow, ds_cstr(&s)); + ds_destroy(&s); + } if (flow) { if (!VLOG_DROP_DBG(&rl)) { ds_init(&s);