From patchwork Mon Dec 28 09:24:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: taoyunxiang X-Patchwork-Id: 1421007 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.133; helo=hemlock.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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D4QfZ2BXPz9sVv for ; Tue, 29 Dec 2020 05:13:58 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9BF1C87507; Mon, 28 Dec 2020 18:13:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KTsWV0A-Va9p; Mon, 28 Dec 2020 18:13:54 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id D281E874B9; Mon, 28 Dec 2020 18:12:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 804BDC1EEA; Mon, 28 Dec 2020 18:12:10 +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 571EFC0893 for ; Mon, 28 Dec 2020 09:26:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 452EA2046B for ; Mon, 28 Dec 2020 09:26:35 +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 euMLIQmkRP7Q 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 A779B20487 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 2ee35fe9a495549-bee50; Mon, 28 Dec 2020 17:25:41 +0800 (CST) X-RM-TRANSID: 2ee35fe9a495549-bee50 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-7b87c; Mon, 28 Dec 2020 17:25:41 +0800 (CST) X-RM-TRANSID: 2ee25fe9a48a90b-7b87c From: Tao YunXiang To: ovs-dev@openvswitch.org Date: Mon, 28 Dec 2020 01:24:40 -0800 Message-Id: <20201228092520.11807-23-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: Rongyin Subject: [ovs-dev] [PATCH 22/62] netdev-offload-dpdk: fix dpif_type caused thread dead lock 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: Rongyin NOTE: https://patchwork.ozlabs.org/patch/1205684/ Code Source From: Self Code Description: fix dpif_type caused thread dead lock Jira: #[Optional] 市场项目编号(名称):[Optional] --- lib/dpif-netdev.c | 1 + lib/netdev-offload-dpdk.c | 17 +++++++++++------ lib/netdev-offload.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 74ceadc..008ffa8 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2437,6 +2437,7 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload) } } info.flow_mark = mark; + info.dpif_type_str = dpif_type_str; port = netdev_ports_get(in_port, dpif_type_str); if (!port) { diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 3e268bf..ea1eb2e 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -628,14 +628,14 @@ free_flow_actions(struct flow_actions *actions) actions->cnt = 0; } -static int +static void parse_vxlan_match(struct flow_patterns *patterns, const struct match *match) { struct rte_flow_item_vxlan *vx_spec, *vx_mask; if (is_all_zeros(&match->wc.masks.tunnel, sizeof match->wc.masks.tunnel)) { - return 0; + return ; } VLOG_DBG("TIMO:in parse_vxlan_match"); @@ -656,7 +656,7 @@ parse_vxlan_match(struct flow_patterns *patterns, htonl(ntohll(match->wc.masks.tunnel.tun_id) << 8)); add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VXLAN, vx_spec, vx_mask); - return 0; + return ; } static int @@ -994,7 +994,7 @@ add_output_action(struct netdev *netdev, int ret = 0; port = nl_attr_get_odp_port(nla); - outdev = netdev_ports_get(port, netdev->dpif_type); + outdev = netdev_ports_get(port, info->dpif_type_str); if (outdev == NULL) { VLOG_DBG_RL(&rl, "Cannot find netdev for odp port %"PRIu32, port); return -1; @@ -1247,11 +1247,14 @@ parse_clone_actions(struct netdev *netdev, } else if (clone_type == OVS_ACTION_ATTR_OUTPUT) { if (add_output_action(netdev, actions, ca, info)) { return -1; + } + /* } else if (info->valid_ucast) { VLOG_DBG_RL(&rl, "Unsupported multicast output action"); return -1; + info->valid_ucast = true; } - info->valid_ucast = true; + */ } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) { const struct ovs_action_push_vlan *vlan = nl_attr_get(ca); struct rte_flow_action_of_push_vlan *vlan_tci; @@ -1292,11 +1295,13 @@ parse_flow_actions(struct netdev *netdev, if (nl_attr_type(nla) == OVS_ACTION_ATTR_OUTPUT) { if (add_output_action(netdev, actions, nla, info)) { return -1; + /* } else if (info->valid_ucast) { VLOG_DBG_RL(&rl, "Unsupported multicast output action"); return -1; + info->valid_ucast = true; + */ } - info->valid_ucast = true; } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_DROP) { add_flow_action(actions, RTE_FLOW_ACTION_TYPE_DROP, NULL); } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_SET || diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h index 8264e32..a4b8d5f 100644 --- a/lib/netdev-offload.h +++ b/lib/netdev-offload.h @@ -78,6 +78,7 @@ struct offload_info { * to delete the original flow. */ bool valid_ucast; /* flag to judge multicast && broadcast */ bool vxlan_decap; /* flag to turn on vxlan decap */ + const char *dpif_type_str; /* dpif type string. */ }; int netdev_flow_flush(struct netdev *);