From patchwork Mon Oct 29 12:49:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990178 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="lUMBYazy"; 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 42kDw34zGgz9s3Z for ; Mon, 29 Oct 2018 23:50:11 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F14D626E4; Mon, 29 Oct 2018 12:49:46 +0000 (UTC) X-Original-To: ovs-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 087A42652 for ; Mon, 29 Oct 2018 12:49:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1E14625A for ; Mon, 29 Oct 2018 12:49:44 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181029124942euoutp022ecf139d3a44856541fbdd964bbaca6e~iFT71FFW91683616836euoutp02Q; Mon, 29 Oct 2018 12:49:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181029124942euoutp022ecf139d3a44856541fbdd964bbaca6e~iFT71FFW91683616836euoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817382; bh=8lj1mKxSiJpTG/DrzMXkUfVoyt39AN1VEmnq9T0/uyc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=lUMBYazyzF9Fed8kfTHy0t4iPlOaa/6ccm0UmSD8SfqipZLNdbhGJ3IBT4gStT3u2 cCuIvmHMWJ6OpAK9731A6b1uEabt5A8Mqp+QA7tbzZimkbrO9fjPScxCk7e9v/qjBB nKFW6Y2sp4gywTMS2vadWJRBDb1YKz5iuscaRwOw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124942eucas1p154a1527861c75ae756b0cd82b26bb46e~iFT7bsBW50775007750eucas1p1I; Mon, 29 Oct 2018 12:49:42 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8B.FA.04806.5E107DB5; Mon, 29 Oct 2018 12:49:41 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124941eucas1p14badbead807a3de60bc3b87c39aeb736~iFT6nQ3f-0776207762eucas1p1I; Mon, 29 Oct 2018 12:49:41 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-42-5bd701e559d2 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 86.5C.04284.4E107DB5; Mon, 29 Oct 2018 12:49:40 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:49:40 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:18 +0300 Message-id: <20181029124926.12199-2-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djPc7pPGa9HG7Q0mFpsmTaZ1eLVovPM Flfaf7JbbHx4ltVi7qfnjBa353hZPL34i9miZclOJgcOjxv/brF5LN7zksnj2fTDTB43tp9m 9Xh28z+jR9+WVYwe/5uvsgawR3HZpKTmZJalFunbJXBlTOuYwVjwkr1i+52iBsYpbF2MnBwS AiYSJ09+ArK5OIQEVjBK3P09ixUkISTwmVGitV8Cpqj31352iKJljBLLfrZAOc1MEivW7wAb xSagI3Fq9RFGEFtEQFride8bVpAiZoGJTBJvf14AKxIW8JS4+/EiO4jNIqAq8fPdLLA4r4C1 xLmzV5kg1slLrN5wgBnE5hSwkXh+vx/q1hlsEjun1kHYLhKz5s2DqheWeHV8CzuELSPR2XEQ Kl4vcb/lJSPIERICHYwS0w/9g0rYS2x5fQ6sgVmAT2LStulAyziA4rwSHW1CECUeEs/PfmaE +LKfUeL09tUsExglFzAyrGIUTy0tzk1PLTbOSy3XK07MLS7NS9dLzs/dxAiMztP/jn/dwbjv T9IhRgEORiUe3gfc16KFWBPLiitzDzFKcDArifC+OgsU4k1JrKxKLcqPLyrNSS0+xCjNwaIk zrts3sZoIYH0xJLU7NTUgtQimCwTB6dUA6Nhp+jqJTFuXdsn3/ydWPxMI+XGF+9PG8yO89U3 /5I9sL6gc27j55p934JkF7cI32f+fuX5kX0s8lnvOP2LlV7uk/GZuDfzVdHpyLNXJ66dK+vh banSU3Jmf9kXnur6UwZRKZf8z3TzMNuYhn/KCeU0eSea/cZ8oW7q8Tdn1i2YyFjE33/Jm1GJ pTgj0VCLuag4EQCrR61sygIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGLMWRmVeSWpSXmKPExsVy+t/xq7pPGa9HG5z6y2SxZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVMa1jBmPBS/aK7XeKGhinsHUxcnJI CJhI9P7az97FyMUhJLCEUeLsq71sEE4rk8S8vecZQarYBHQkTq0+AmaLCEhLvO59wwpSxCww mUliSUsTM0hCWMBT4u7Hi+wgNouAqsTPd7PAVvAKWEucO3uVCWKdvMTqDQfA6jkFbCSe3+8H qxECqln1cS7zBEaeBYwMqxhFUkuLc9Nziw31ihNzi0vz0vWS83M3MQJDa9uxn5t3MF7aGHyI UYCDUYmH9wH3tWgh1sSy4srcQ4wSHMxKIryvzgKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8543 qIwSEkhPLEnNTk0tSC2CyTJxcEo1MDaulnHac0zuit25P0X+66/ots3u9Lmdcme5t2R6QMah dfovV1Te0o06uNjUfI/zzH2O8SmmJszSbDuckwv2+yZ8X/uhI72pUTgj5EnMdNMvPzTVsmY8 q73LtuPGLK6SzLnVCvPk217OiTuhx/SsTFGgb/aGQDUvu7YVU7+UlNzsWCXxSayYVYmlOCPR UIu5qDgRAO4JIK4pAgAA X-CMS-MailID: 20181029124941eucas1p14badbead807a3de60bc3b87c39aeb736 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029124941eucas1p14badbead807a3de60bc3b87c39aeb736 References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 1/9] dpif-netdev: Reduce log level for not found mark id. 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 It's a normal case for 'find' function, especially because this happens for every first packet of flow that was not offloaded yet. Should not warn about this. Dropped to DBG to avoid log trashing in case of big number of new flows. CC: Yuanhan Liu Fixes: 241bad15d99a ("dpif-netdev: associate flow with a mark id") Signed-off-by: Ilya Maximets --- lib/dpif-netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 3f7acb5dd..6a5e9e329 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2157,8 +2157,8 @@ megaflow_to_mark_find(const ovs_u128 *mega_ufid) } } - VLOG_WARN("Mark id for ufid "UUID_FMT" was not found\n", - UUID_ARGS((struct uuid *)mega_ufid)); + VLOG_DBG("Mark id for ufid "UUID_FMT" was not found\n", + UUID_ARGS((struct uuid *)mega_ufid)); return INVALID_FLOW_MARK; } From patchwork Mon Oct 29 12:49:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990180 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="i5lr/o2D"; 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 42kDwh5wqLz9s3Z for ; Mon, 29 Oct 2018 23:50:44 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C3ECF2890; Mon, 29 Oct 2018 12:49:50 +0000 (UTC) X-Original-To: ovs-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 5F1222842 for ; Mon, 29 Oct 2018 12:49:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CD4A525A for ; Mon, 29 Oct 2018 12:49:46 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181029124945euoutp028160995adec1f1f3b2af1094dc88bcca~iFT_bqZpM1683616836euoutp02R; Mon, 29 Oct 2018 12:49:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181029124945euoutp028160995adec1f1f3b2af1094dc88bcca~iFT_bqZpM1683616836euoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817385; bh=ylUzvlPrAX6aLBP68Nq5VwVcQealxsH8tAkiTdzAIMc=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=i5lr/o2DMzLJwj3pwqQNafKuSxuGV4lN8rHJsLx37aJKY6dsASD2XyFCmOdhlK75P 8+iLqAb21L8jA+H9MbG3zD75ybE9CwOoJsOOW0eREvI+nVAx8lz1Q1lhdaOpOQIsf7 jY6bK/Ze2YKOuyB874ReIg90IA/eM5vUEIG2xNso= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124945eucas1p1bd2393ff2c2a5be3985737911606429b~iFT_Clu1s0774607746eucas1p1M; Mon, 29 Oct 2018 12:49:45 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 9C.FA.04806.8E107DB5; Mon, 29 Oct 2018 12:49:44 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124944eucas1p1bdec5cdee3c327f4db9329c6a1e88ec7~iFT9XBL2Z2144721447eucas1p1P; Mon, 29 Oct 2018 12:49:44 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-4a-5bd701e89f05 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B7.5C.04284.8E107DB5; Mon, 29 Oct 2018 12:49:44 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:49:44 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:19 +0300 Message-id: <20181029124926.12199-3-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djPc7ovGK9HG8x4rWOxZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVsWTrV+aCA/IVk24sY21gPCPZxcjJ ISFgInHlwjZGEFtIYAWjxPaWqi5GLiD7M6PEhQmTWGGKXt2/xQyRWMYocbR7ASuE08wksf3n N3aQKjYBHYlTq4+AjRIRkJZ43fsGrIhZYCKTxNufF9hAEsICNhLnJx0Hsjk4WARUJVqX8IGY vALWEm8vGUAsk5dYveEAM4jNCVT9/H4/G8gYCYEFbBL33k5nAqmXEHCRONCfB1EvLPHq+BZ2 CFtGorPjIBOEXS9xv+UlI0RvB6PE9EP/oBL2EltenwNrYBbgk5i0bTozxExeiY42IYgSD4me 5ouMED/2M0qsPTWNZQKj5AJGhlWM4qmlxbnpqcXGeanlesWJucWleel6yfm5mxiBsXn63/Gv Oxj3/Uk6xCjAwajEw/uA+1q0EGtiWXFl7iFGCQ5mJRHeV2eBQrwpiZVVqUX58UWlOanFhxil OViUxHmXzdsYLSSQnliSmp2aWpBaBJNl4uCUamCskWFgmLJqT7ZzXPCq+8mT3AxOFutYPBBK uy1u9j6fhVnT7u4biaMdCncrrPbNLX4t/YK398S7rysYl66/E+r2OTk+Jesy09qSf00ypjLf dKbMOb7SfUXNnft/04+qxH2aJ6osPuPkQd7CIpWNzGydQQ9KzZl99Jh2sd5wqd148PSxOdI6 h3mUWIozEg21mIuKEwGWYDXvyQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xq7ovGK9HG1zu57fYMm0yq8WrReeZ La60/2S32PjwLKvF3E/PGS1uz/GyeHrxF7NFy5KdTA4cHjf+3WLzWLznJZPHs+mHmTxubD/N 6vHs5n9Gj74tqxg9/jdfZQ1gj+KySUnNySxLLdK3S+DKWLL1K3PBAfmKSTeWsTYwnpHsYuTk kBAwkXh1/xZzFyMXh5DAEkaJvxvvMEI4rUwSPzfsYQWpYhPQkTi1+ggjiC0iIC3xuvcNK0gR s8BkJoklLU3MIAlhARuJ85OOs3UxcnCwCKhKtC7hAzF5Bawl3l4ygFgmL7F6wwGwak6g6uf3 +9lAbCGgklUf5zJPYORZwMiwilEktbQ4Nz232FCvODG3uDQvXS85P3cTIzCwth37uXkH46WN wYcYBTgYlXh4H3BfixZiTSwrrsw9xCjBwawkwvvqLFCINyWxsiq1KD++qDQntfgQozQHi5I4 73mDyighgfTEktTs1NSC1CKYLBMHp1QDY4PAjI+dP8KWTLnyYGpz3vRFbgJPJ55PeVPxOdze 22oNY+kyi1dn2PcGa/tNizss/2j379cB96yDVt/4cbzk1zbBjed/LtvS//5kysmGe59t/swO s9rkx/TnTLLhe90/Ese/6UzfZb2wJ33XXeOj31/4vfjH47PahTnzEMvGly+U69btDdv8YeZb JZbijERDLeai4kQAzXEphSgCAAA= X-CMS-MailID: 20181029124944eucas1p1bdec5cdee3c327f4db9329c6a1e88ec7 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029124944eucas1p1bdec5cdee3c327f4db9329c6a1e88ec7 References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 2/9] dp-packet: Constantify offloading APIs. 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 Getters should have const arguments. Signed-off-by: Ilya Maximets --- lib/dp-packet.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/dp-packet.h b/lib/dp-packet.h index 5b4c9c7a3..0c4c8c853 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -469,7 +469,7 @@ dp_packet_set_allocated(struct dp_packet *b, uint16_t s) /* Returns the RSS hash of the packet 'p'. Note that the returned value is * correct only if 'dp_packet_rss_valid(p)' returns true */ static inline uint32_t -dp_packet_get_rss_hash(struct dp_packet *p) +dp_packet_get_rss_hash(const struct dp_packet *p) { return p->mbuf.hash.rss; } @@ -482,7 +482,7 @@ dp_packet_set_rss_hash(struct dp_packet *p, uint32_t hash) } static inline bool -dp_packet_rss_valid(struct dp_packet *p) +dp_packet_rss_valid(const struct dp_packet *p) { return p->mbuf.ol_flags & PKT_RX_RSS_HASH; } @@ -509,28 +509,28 @@ dp_packet_mbuf_init(struct dp_packet *p) } static inline bool -dp_packet_ip_checksum_valid(struct dp_packet *p) +dp_packet_ip_checksum_valid(const struct dp_packet *p) { return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) == PKT_RX_IP_CKSUM_GOOD; } static inline bool -dp_packet_ip_checksum_bad(struct dp_packet *p) +dp_packet_ip_checksum_bad(const struct dp_packet *p) { return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) == PKT_RX_IP_CKSUM_BAD; } static inline bool -dp_packet_l4_checksum_valid(struct dp_packet *p) +dp_packet_l4_checksum_valid(const struct dp_packet *p) { return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) == PKT_RX_L4_CKSUM_GOOD; } static inline bool -dp_packet_l4_checksum_bad(struct dp_packet *p) +dp_packet_l4_checksum_bad(const struct dp_packet *p) { return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) == PKT_RX_L4_CKSUM_BAD; @@ -544,7 +544,7 @@ reset_dp_packet_checksum_ol_flags(struct dp_packet *p) } static inline bool -dp_packet_has_flow_mark(struct dp_packet *p, uint32_t *mark) +dp_packet_has_flow_mark(const struct dp_packet *p, uint32_t *mark) { if (p->mbuf.ol_flags & PKT_RX_FDIR_ID) { *mark = p->mbuf.hash.fdir.hi; @@ -606,7 +606,7 @@ dp_packet_set_allocated(struct dp_packet *b, uint16_t s) /* Returns the RSS hash of the packet 'p'. Note that the returned value is * correct only if 'dp_packet_rss_valid(p)' returns true */ static inline uint32_t -dp_packet_get_rss_hash(struct dp_packet *p) +dp_packet_get_rss_hash(const struct dp_packet *p) { return p->rss_hash; } @@ -619,7 +619,7 @@ dp_packet_set_rss_hash(struct dp_packet *p, uint32_t hash) } static inline bool -dp_packet_rss_valid(struct dp_packet *p) +dp_packet_rss_valid(const struct dp_packet *p) { return p->rss_hash_valid; } @@ -641,25 +641,25 @@ dp_packet_mbuf_init(struct dp_packet *p OVS_UNUSED) } static inline bool -dp_packet_ip_checksum_valid(struct dp_packet *p OVS_UNUSED) +dp_packet_ip_checksum_valid(const struct dp_packet *p OVS_UNUSED) { return false; } static inline bool -dp_packet_ip_checksum_bad(struct dp_packet *p OVS_UNUSED) +dp_packet_ip_checksum_bad(const struct dp_packet *p OVS_UNUSED) { return false; } static inline bool -dp_packet_l4_checksum_valid(struct dp_packet *p OVS_UNUSED) +dp_packet_l4_checksum_valid(const struct dp_packet *p OVS_UNUSED) { return false; } static inline bool -dp_packet_l4_checksum_bad(struct dp_packet *p OVS_UNUSED) +dp_packet_l4_checksum_bad(const struct dp_packet *p OVS_UNUSED) { return false; } @@ -670,7 +670,7 @@ reset_dp_packet_checksum_ol_flags(struct dp_packet *p OVS_UNUSED) } static inline bool -dp_packet_has_flow_mark(struct dp_packet *p OVS_UNUSED, +dp_packet_has_flow_mark(const struct dp_packet *p OVS_UNUSED, uint32_t *mark OVS_UNUSED) { return false; From patchwork Mon Oct 29 12:49:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990181 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="itPXzAlN"; 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 42kDxN3XY2z9s3C for ; Mon, 29 Oct 2018 23:51:20 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9231B2B67; Mon, 29 Oct 2018 12:49:52 +0000 (UTC) X-Original-To: ovs-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 489532A93 for ; Mon, 29 Oct 2018 12:49:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 32D3225A for ; Mon, 29 Oct 2018 12:49:50 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181029124948euoutp0222b6b0c74cff6ddc9e9784a5bdbac355~iFUBpACuI1682416824euoutp02U; Mon, 29 Oct 2018 12:49:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181029124948euoutp0222b6b0c74cff6ddc9e9784a5bdbac355~iFUBpACuI1682416824euoutp02U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817388; bh=SOaDZ3Zxu2aSMm6v3YVHdvKIkdZ1OsWodKN3E5iAvHE=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=itPXzAlNR9J4oGuq8yGfj6HDTZD2ZoOD0p+OWZcFD7MqIL2hsuIYtTbpNv0MLPINw uZluZeGA3tXU9qyePgEW3MWzu+4+bfFINx/zMRdQzxxDXZh+CBEcVOFkxlusGrQ0IG Jtj1S1r6Up1gC/tRMl0+ps7M0hIC2O+5HNBOpg+4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124948eucas1p1c3ca0afc5b062c4d0124d8dc5339a482~iFUBBU5av2688326883eucas1p11; Mon, 29 Oct 2018 12:49:48 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 4E.FA.04806.BE107DB5; Mon, 29 Oct 2018 12:49:47 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124947eucas1p13b432aaec616e0e1f9abc39232178a8b~iFUAQC61a2141121411eucas1p1r; Mon, 29 Oct 2018 12:49:47 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-54-5bd701eb4dbe Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id BA.5C.04284.BE107DB5; Mon, 29 Oct 2018 12:49:47 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:49:47 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:20 +0300 Message-id: <20181029124926.12199-4-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWy7djP87qvGa9HG3w6ZW6xZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVcf3UPeaChyYVfcdWszcwrtbsYuTk kBAwkVjzaD5rFyMXh5DACkaJXzM2M0M4nxklHq5dzdLFyAFW1bnGByK+jFHizo53bBBOM5PE kqn/mEFGsQnoSJxafYQRxBYRkJZ43fsGbCyzwEQmibc/L7CBJIQFLCS2brvDBDKVRUBV4ttc K5Awr4C1xNT595ggTpKXWL3hANhMTgEbief3+8GWSQgsYJN4smIGG0SRi8SyZ41QDcISr45v YYewZSQ6Ow5Cxesl7re8ZIRo7mCUmH7oH1TCXmLL63NgDcwCfBKTtk1nhniTV6KjTQiixEPi 2fKlTBBf9jNKNG87wzKBUXIBI8MqRvHU0uLc9NRi47zUcr3ixNzi0rx0veT83E2MwPg8/e/4 1x2M+/4kHWIU4GBU4uF9wH0tWog1say4MvcQowQHs5II76uzQCHelMTKqtSi/Pii0pzU4kOM 0hwsSuK8y+ZtjBYSSE8sSc1OTS1ILYLJMnFwSjUwNgk6Jtt/Dci5f1ny0wtuyclBOi5zm0WV 74UGWko3MzTvn7K/gud8w2/P8ws1jDlsNjLvTm07qP9equVca+PZn1vvhi1ijojtzhf3O+nP dO141PmQOT9bSi7Lq/n8dgxJj7tz4HDLyRnnWQ/Edq4Lq1vp05ZcsyWQOfBUvXCjyc5JkSqP La8osRRnJBpqMRcVJwIAs5d+jssCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xq7qvGa9HG1y9J26xZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVcf3UPeaChyYVfcdWszcwrtbsYuTg kBAwkehc49PFyMUhJLCEUWLT+yusEE4rk8SJ9gvsXYycHGwCOhKnVh9hBLFFBKQlXve+ASti FpjMJLGkpYkZJCEsYCGxddsdJpCpLAKqEt/mWoGEeQWsJabOv8cEYksIyEus3nAArJxTwEbi +f1+NhBbCKhm1ce5zBMYeRYwMqxiFEktLc5Nzy021CtOzC0uzUvXS87P3cQIDKxtx35u3sF4 aWPwIUYBDkYlHt4H3NeihVgTy4orcw8xSnAwK4nwvjoLFOJNSaysSi3Kjy8qzUktPsQozcGi JM573qAySkggPbEkNTs1tSC1CCbLxMEp1cDYZXLpftI0kbIE2YsLNJ38i+O0vv9T7NDxPL0z f8c/Hic1dWH/HyJGV7Ki5KoKX62wnrqj82XsnwWdLKe+amVZchjPsFI82uZe9k+ggtFrQpPW lYAHrB1OXmIuOxba32jSPHziHYeYs/izO1PqC/oebdq56uzpcv/3OrtYBWLuX3Vmuehu80aJ pTgj0VCLuag4EQDVw6OUKAIAAA== X-CMS-MailID: 20181029124947eucas1p13b432aaec616e0e1f9abc39232178a8b X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029124947eucas1p13b432aaec616e0e1f9abc39232178a8b References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 3/9] dp-packet: Refactor offloading API. 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 1. No reason to have mbuf related APIs in a generic code. 2. Not only RSS/checksums should be invalidated in case of tunnel decapsulation or sending to 'ring' ports. In order to fix two above issues, new function 'dp_packet_offload_invalidate' introduced. In order to clean up/unify the code and simplify addition of new offloading features to non-DPDK version of dp-packet, introduced 'ol_flags' bitmask. Additionally reduced code complexity in 'dp_packet_clone_with_headroom' by using already existent generic APIs. Signed-off-by: Ilya Maximets --- lib/dp-packet.c | 13 +++---------- lib/dp-packet.h | 46 +++++++--------------------------------------- lib/netdev-dpdk.c | 6 +++--- lib/netdev.c | 4 ++-- 4 files changed, 15 insertions(+), 54 deletions(-) diff --git a/lib/dp-packet.c b/lib/dp-packet.c index 443c22504..ab34a6cec 100644 --- a/lib/dp-packet.c +++ b/lib/dp-packet.c @@ -30,8 +30,7 @@ dp_packet_init__(struct dp_packet *b, size_t allocated, enum dp_packet_source so b->source = source; dp_packet_reset_offsets(b); pkt_metadata_init(&b->md, 0); - dp_packet_rss_invalidate(b); - dp_packet_mbuf_init(b); + dp_packet_offload_invalidate(b); dp_packet_reset_cutlen(b); /* By default assume the packet type to be Ethernet. */ b->packet_type = htonl(PT_ETH); @@ -178,16 +177,10 @@ dp_packet_clone_with_headroom(const struct dp_packet *buffer, size_t headroom) #ifdef DPDK_NETDEV new_buffer->mbuf.ol_flags = buffer->mbuf.ol_flags; -#else - new_buffer->rss_hash_valid = buffer->rss_hash_valid; #endif - if (dp_packet_rss_valid(new_buffer)) { -#ifdef DPDK_NETDEV - new_buffer->mbuf.hash.rss = buffer->mbuf.hash.rss; -#else - new_buffer->rss_hash = buffer->rss_hash; -#endif + if (dp_packet_rss_valid(buffer)) { + dp_packet_set_rss_hash(new_buffer, dp_packet_get_rss_hash(buffer)); } return new_buffer; diff --git a/lib/dp-packet.h b/lib/dp-packet.h index 0c4c8c853..0e04b2302 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -58,8 +58,9 @@ struct dp_packet { uint16_t allocated_; /* Number of bytes allocated. */ uint16_t data_ofs; /* First byte actually in use. */ uint32_t size_; /* Number of bytes in use. */ + uint32_t ol_flags; /* Offloading flags. */ +#define DP_PACKET_OL_RSS_HASH_MASK 0x1 /* Is the 'rss_hash' valid? */ uint32_t rss_hash; /* Packet hash. */ - bool rss_hash_valid; /* Is the 'rss_hash' valid? */ #endif enum dp_packet_source source; /* Source of memory allocated as 'base'. */ @@ -487,23 +488,12 @@ dp_packet_rss_valid(const struct dp_packet *p) return p->mbuf.ol_flags & PKT_RX_RSS_HASH; } -static inline void -dp_packet_rss_invalidate(struct dp_packet *p OVS_UNUSED) -{ -} - -static inline void -dp_packet_mbuf_rss_flag_reset(struct dp_packet *p) -{ - p->mbuf.ol_flags &= ~PKT_RX_RSS_HASH; -} - /* This initialization is needed for packets that do not come * from DPDK interfaces, when vswitchd is built with --with-dpdk. * The DPDK rte library will still otherwise manage the mbuf. * We only need to initialize the mbuf ol_flags. */ static inline void -dp_packet_mbuf_init(struct dp_packet *p) +dp_packet_offload_invalidate(struct dp_packet *p OVS_UNUSED) { p->mbuf.ol_flags = 0; } @@ -536,13 +526,6 @@ dp_packet_l4_checksum_bad(const struct dp_packet *p) PKT_RX_L4_CKSUM_BAD; } -static inline void -reset_dp_packet_checksum_ol_flags(struct dp_packet *p) -{ - p->mbuf.ol_flags &= ~(PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD | - PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD); -} - static inline bool dp_packet_has_flow_mark(const struct dp_packet *p, uint32_t *mark) { @@ -615,29 +598,19 @@ static inline void dp_packet_set_rss_hash(struct dp_packet *p, uint32_t hash) { p->rss_hash = hash; - p->rss_hash_valid = true; + p->ol_flags |= DP_PACKET_OL_RSS_HASH_MASK; } static inline bool dp_packet_rss_valid(const struct dp_packet *p) { - return p->rss_hash_valid; + return p->ol_flags & DP_PACKET_OL_RSS_HASH_MASK; } static inline void -dp_packet_rss_invalidate(struct dp_packet *p) -{ - p->rss_hash_valid = false; -} - -static inline void -dp_packet_mbuf_rss_flag_reset(struct dp_packet *p OVS_UNUSED) -{ -} - -static inline void -dp_packet_mbuf_init(struct dp_packet *p OVS_UNUSED) +dp_packet_offload_invalidate(struct dp_packet *p) { + p->ol_flags = 0; } static inline bool @@ -664,11 +637,6 @@ dp_packet_l4_checksum_bad(const struct dp_packet *p OVS_UNUSED) return false; } -static inline void -reset_dp_packet_checksum_ol_flags(struct dp_packet *p OVS_UNUSED) -{ -} - static inline bool dp_packet_has_flow_mark(const struct dp_packet *p OVS_UNUSED, uint32_t *mark OVS_UNUSED) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 9d5217218..5d0f92666 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3577,11 +3577,11 @@ netdev_dpdk_ring_send(struct netdev *netdev, int qid, struct dp_packet *packet; /* When using 'dpdkr' and sending to a DPDK ring, we want to ensure that - * the rss hash field is clear. This is because the same mbuf may be + * the offload fields are clear. This is because the same mbuf may be * modified by the consumer of the ring and return into the datapath - * without recalculating the RSS hash. */ + * without recalculating the RSS hash or revalidating the checksums. */ DP_PACKET_BATCH_FOR_EACH (i, packet, batch) { - dp_packet_mbuf_rss_flag_reset(packet); + dp_packet_offload_invalidate(packet); } netdev_dpdk_send__(dev, qid, batch, concurrent_txq); diff --git a/lib/netdev.c b/lib/netdev.c index 84874408a..0934f0072 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -814,10 +814,10 @@ netdev_pop_header(struct netdev *netdev, struct dp_packet_batch *batch) DP_PACKET_BATCH_REFILL_FOR_EACH (i, size, packet, batch) { packet = netdev->netdev_class->pop_header(packet); if (packet) { - /* Reset the checksum offload flags if present, to avoid wrong + /* Reset the offload flags if present, to avoid wrong * interpretation in the further packet processing when * recirculated.*/ - reset_dp_packet_checksum_ol_flags(packet); + dp_packet_offload_invalidate(packet); dp_packet_batch_refill(batch, packet, i); } } From patchwork Mon Oct 29 12:49:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990182 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="g3/r5WmU"; 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 42kDxr6lLzz9s3Z for ; Mon, 29 Oct 2018 23:51:44 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 725602BA1; Mon, 29 Oct 2018 12:49:56 +0000 (UTC) X-Original-To: ovs-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 D9D142ADE for ; Mon, 29 Oct 2018 12:49:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6864E7E5 for ; Mon, 29 Oct 2018 12:49:54 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181029124951euoutp0173988f6f78933afb18d54e289285d52e~iFUEX-Mld3146231462euoutp01T; Mon, 29 Oct 2018 12:49:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181029124951euoutp0173988f6f78933afb18d54e289285d52e~iFUEX-Mld3146231462euoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817391; bh=V5X+1xoOfRiHO+295I4skcvK7w6ev1KV7y9PHEK+NS8=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=g3/r5WmUP8y/nSKCU2Q0Ebv2vGTjLo8U5woZi5o6GwkdNrb1S9CSZBCh3Z3ikOMLn m2KkiKkeemggGOg9SsaGiHoDa1YZ032wsJrjCz7+xn80U39EukZzHGt+hzCvJeX9C7 q0frttgOEb44El1oQQoyMEdJFTOsKaUYRWV8HgKo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124951eucas1p1cd1250bd049b219f99f572239a664af2~iFUD5Aj-j2141021410eucas1p1C; Mon, 29 Oct 2018 12:49:51 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id A5.6F.04294.EE107DB5; Mon, 29 Oct 2018 12:49:50 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029124950eucas1p2116bacbd4581add6e680dbf91ddd3b2b~iFUDN7WWW0911309113eucas1p2g; Mon, 29 Oct 2018 12:49:50 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-b2-5bd701ee76c9 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 3F.ED.04128.EE107DB5; Mon, 29 Oct 2018 12:49:50 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:49:50 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:21 +0300 Message-id: <20181029124926.12199-5-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djPc7rvGK9HGzQ/t7HYMm0yq8WrReeZ La60/2S32PjwLKvF3E/PGS1uz/GyeHrxF7NFy5KdTA4cHjf+3WLzWLznJZPHs+mHmTxubD/N 6vHs5n9Gj74tqxg9/jdfZQ1gj+KySUnNySxLLdK3S+DKOPhgAUvBUf6KI7P6mBoY23m6GDk5 JARMJJ60LGfvYuTiEBJYwSgxe+olFgjnM6PE4t7VjDBVPecmM0IkljFKvHx+A6qlmUni7Jf5 rCBVbAI6EqdWHwHrEBGQlnjd+4YVpIhZYCKTxNufF9hAEsICHhLnt00B2sHBwSKgKnHspiqI yStgLXGhC2qZvMTqDQeYQWxOARuJ5/f72UDGSAjMYZN4snwqM0i9hICLxNYPRRD1whKvjm9h h7BlJC5P7maBsOsl7re8ZITo7WCUmH7oHxNEwl5iy+tzYA3MAnwSk7ZNh5rJK9HRJgRR4iHx 8cUcaEj0M0pM2TSNfQKj5AJGhlWM4qmlxbnpqcVGeanlesWJucWleel6yfm5mxiB0Xn63/Ev Oxh3/Uk6xCjAwajEw/uA+1q0EGtiWXFl7iFGCQ5mJRHeV2eBQrwpiZVVqUX58UWlOanFhxil OViUxHmXzdsYLSSQnliSmp2aWpBaBJNl4uCUamAMMvujseZFk46Bl8pm13ObPR/kJubyvV7t wmTlwC305+YsXufvCjZvDzzmapGNmjCr3GKhNccibfagNzJFP9Ycc5FQTfihfuXIVbVNhdVz YxWDThgs87wgPffTw2bbf4lneJ/v3NAzQWnvjMkdW2Z8Vfi9f4Peje4JtjEX39nEtizUsm1p uj1HiaU4I9FQi7moOBEAEOkqSMoCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xq7rvGK9HG+zbomixZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVcfDBApaCo/wVR2b1MTUwtvN0MXJy SAiYSPScm8zYxcjFISSwhFHixd2/bBBOK5PEkmn3WUCq2AR0JE6tPsIIYosISEu87n3DClLE LDAZqKiliRkkISzgIXF+2xSgBg4OFgFViWM3VUFMXgFriQtdjBDL5CVWbzgAVs0pYCPx/H4/ G4gtBFSy6uNc5gmMPAsYGVYxiqSWFuem5xYb6RUn5haX5qXrJefnbmIEBta2Yz+37GDsehd8 iFGAg1GJh/cB97VoIdbEsuLK3EOMEhzMSiK8r84ChXhTEiurUovy44tKc1KLDzFKc7AoifOe N6iMEhJITyxJzU5NLUgtgskycXBKNTDmPXjet3p3zi/TnYFMnl/n7vy05MCNLx8VXuZcP6Yd mPLC5cV1tiVKbCfeuf7e1NjDlhlXFXI1RlNe0i/+gESY4eSqZ1f3R9bO7m1ZsCdK993+RSbu l555HliWkvfj7oa1RozZG/zfN6rxbng3aUVH1KYZQtErD7/gaMxx8ep7Xmiw/Wwa74zpSizF GYmGWsxFxYkAS4togSgCAAA= X-CMS-MailID: 20181029124950eucas1p2116bacbd4581add6e680dbf91ddd3b2b X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029124950eucas1p2116bacbd4581add6e680dbf91ddd3b2b References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 4/9] dp-packet: Add flow_mark support for non-DPDK case. 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 Additionally, new API call 'dp_packet_set_flow_mark' is needed for packet clone. Mostly for dummy HWOL implementation. Signed-off-by: Ilya Maximets --- lib/dp-packet.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/dp-packet.h b/lib/dp-packet.h index 0e04b2302..a8574ae33 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -60,7 +60,9 @@ struct dp_packet { uint32_t size_; /* Number of bytes in use. */ uint32_t ol_flags; /* Offloading flags. */ #define DP_PACKET_OL_RSS_HASH_MASK 0x1 /* Is the 'rss_hash' valid? */ +#define DP_PACKET_OL_FLOW_MARK_MASK 0x2 /* Is the 'flow_mark' valid? */ uint32_t rss_hash; /* Packet hash. */ + uint32_t flow_mark; /* Packet flow mark. */ #endif enum dp_packet_source source; /* Source of memory allocated as 'base'. */ @@ -537,6 +539,13 @@ dp_packet_has_flow_mark(const struct dp_packet *p, uint32_t *mark) return false; } +static inline void +dp_packet_set_flow_mark(struct dp_packet *p, uint32_t mark) +{ + p->mbuf.hash.fdir.hi = mark; + p->mbuf.ol_flags |= PKT_RX_FDIR_ID; +} + #else /* DPDK_NETDEV */ static inline void * dp_packet_base(const struct dp_packet *b) @@ -638,11 +647,21 @@ dp_packet_l4_checksum_bad(const struct dp_packet *p OVS_UNUSED) } static inline bool -dp_packet_has_flow_mark(const struct dp_packet *p OVS_UNUSED, - uint32_t *mark OVS_UNUSED) +dp_packet_has_flow_mark(const struct dp_packet *p, uint32_t *mark) { + if (p->ol_flags & DP_PACKET_OL_FLOW_MARK_MASK) { + *mark = p->flow_mark; + return true; + } return false; } + +static inline void +dp_packet_set_flow_mark(struct dp_packet *p, uint32_t mark) +{ + p->flow_mark = mark; + p->ol_flags |= DP_PACKET_OL_FLOW_MARK_MASK; +} #endif /* DPDK_NETDEV */ static inline void From patchwork Mon Oct 29 12:49:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990183 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="iuQTvu29"; 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 42kDyJ2q6zz9s5c for ; Mon, 29 Oct 2018 23:52:08 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2F7A42C35; Mon, 29 Oct 2018 12:49:58 +0000 (UTC) X-Original-To: ovs-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 E72C12C24 for ; Mon, 29 Oct 2018 12:49:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 801D97C3 for ; Mon, 29 Oct 2018 12:49:56 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181029124955euoutp01eb910b9a17b5d5a4158ae69cd4fe1777~iFUHc3PxK3146231462euoutp01V; Mon, 29 Oct 2018 12:49:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181029124955euoutp01eb910b9a17b5d5a4158ae69cd4fe1777~iFUHc3PxK3146231462euoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817395; bh=mCjokwsdIaHPHxGLllFIzI3pG55lThPt3lo33VspvIw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=iuQTvu29WfhA3bnnHbqQlR5zeATPdEZsv5tJ5VShDe0UmusWI3bok4LyICC/WtA1n Kqnv8yDKwnXnKRZzqThbLK9aHMXR7jTtfcZvxEPqdBiK2XsPLUYGVdhTU1FgbrZ4A0 fPdeJm5AkScP7ubfEKoMWrvmQSwNi35lCDTvZmkM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029124954eucas1p280846b8e13e6dadc43e1c46a2009f52d~iFUG-Hujg3128731287eucas1p2E; Mon, 29 Oct 2018 12:49:54 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A3.0B.04806.2F107DB5; Mon, 29 Oct 2018 12:49:54 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124953eucas1p1e8454da95ad14d02b510e1b4dc496f35~iFUGR_0nD2687526875eucas1p1F; Mon, 29 Oct 2018 12:49:53 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-6b-5bd701f25e8d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D0.6C.04284.1F107DB5; Mon, 29 Oct 2018 12:49:53 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:49:53 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:22 +0300 Message-id: <20181029124926.12199-6-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7qfGK9HG3SfFbHYMm0yq8WrReeZ La60/2S32PjwLKvF3E/PGS1uz/GyeHrxF7NFy5KdTA4cHjf+3WLzWLznJZPHs+mHmTxubD/N 6vHs5n9Gj74tqxg9/jdfZQ1gj+KySUnNySxLLdK3S+DKaF/3i7mgkbOi/dYnxgbGFvYuRk4O CQETiet7P7B1MXJxCAmsYJQ4t/gjE4TzmVFi5bRJzDBVW49fYIVILGOUaH74D8ppZpI4ub6d FaSKTUBH4tTqI4wgtoiAtMTr3jdgRcwCE5kk3v68wAaSEBawl9h4+QkLiM0ioCrxtfcLE4jN K2AtcWLWayaIdfISqzccAFvNKWAj8fx+P9iBEgJz2CSurV0HdZOLROv3b1BfCEu8Or4FypaR 6Ow4CDWoXuJ+y0tGiOYORonph/5BJewltrw+B9bALMAnMWnbdKChHEBxXomONiGIEg+Jja3N LBBv9jNKPF/2jXUCo+QCRoZVjOKppcW56anFxnmp5XrFibnFpXnpesn5uZsYgTF6+t/xrzsY 9/1JOsQowMGoxMP7gPtatBBrYllxZe4hRgkOZiUR3ldngUK8KYmVValF+fFFpTmpxYcYpTlY lMR5l83bGC0kkJ5YkpqdmlqQWgSTZeLglGpg1KpSEp/eryBrZidrGpwRoS6tEzKppD8p21WD 8dJ7lU/fLNz3/u7oWpc3b/K+37HMs445n28/8OWR/nL1Qw9TRRZ3cTSdnFD3f45Z0woNZ4Gy rI8T+Q7UsN/iSRKat2P3vSyXmyavtCyfG59g0d0Sfl30d+OfmLTp558K1TKWXN36cbf6y03c SizFGYmGWsxFxYkAdD4ERc0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t/xq7ofGa9HGzT/NrHYMm0yq8WrReeZ La60/2S32PjwLKvF3E/PGS1uz/GyeHrxF7NFy5KdTA4cHjf+3WLzWLznJZPHs+mHmTxubD/N 6vHs5n9Gj74tqxg9/jdfZQ1gj+KySUnNySxLLdK3S+DKaF/3i7mgkbOi/dYnxgbGFvYuRk4O CQETia3HL7B2MXJxCAksYZT4M/kQE4TTyiRx+dh1JpAqNgEdiVOrjzCC2CIC0hKve9+AdTAL TGaSWNLSxAySEBawl9h4+QkLiM0ioCrxtfcLWDOvgLXEiVmvmSDWyUus3nAArJ5TwEbi+f1+ NhBbCKhm1ce5zBMYeRYwMqxiFEktLc5Nzy021CtOzC0uzUvXS87P3cQIDK5tx35u3sF4aWPw IUYBDkYlHt4H3NeihVgTy4orcw8xSnAwK4nwvjoLFOJNSaysSi3Kjy8qzUktPsQozcGiJM57 3qAySkggPbEkNTs1tSC1CCbLxMEp1cAoy5hxl1l2AZfL8xTvSl+P4P3MZrkXjnr9Ud3ManRh Ru3bCefSVUv2FSv1Ln4Qk2rvkbbnpcPHcx0Sh+aumbx1scLVD9xpvzYVrnR4tjomvijoQ8VU v+V+nG5FjIGBPEpJ36scF5xL0vv2iyXf+OnbuQIcP4ximhcy8Z/LjXYr2roi99gMc38lluKM REMt5qLiRAADdzjKKgIAAA== X-CMS-MailID: 20181029124953eucas1p1e8454da95ad14d02b510e1b4dc496f35 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029124953eucas1p1e8454da95ad14d02b510e1b4dc496f35 References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 5/9] dp-packet: Copy flow mark on packet clone. 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 Dummy interfaces clones dp-packet while 'receive' appctl processing. In general, we should do this anyway to avoid any possible issues in the future with real interfaces. Signed-off-by: Ilya Maximets --- lib/dp-packet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dp-packet.c b/lib/dp-packet.c index ab34a6cec..a3f97226b 100644 --- a/lib/dp-packet.c +++ b/lib/dp-packet.c @@ -165,6 +165,7 @@ struct dp_packet * dp_packet_clone_with_headroom(const struct dp_packet *buffer, size_t headroom) { struct dp_packet *new_buffer; + uint32_t mark; new_buffer = dp_packet_clone_data_with_headroom(dp_packet_data(buffer), dp_packet_size(buffer), @@ -182,6 +183,9 @@ dp_packet_clone_with_headroom(const struct dp_packet *buffer, size_t headroom) if (dp_packet_rss_valid(buffer)) { dp_packet_set_rss_hash(new_buffer, dp_packet_get_rss_hash(buffer)); } + if (dp_packet_has_flow_mark(buffer, &mark)) { + dp_packet_set_flow_mark(new_buffer, mark); + } return new_buffer; } From patchwork Mon Oct 29 12:49:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990184 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="oBDXM5nu"; 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 42kDyk1pLJz9s3Z for ; Mon, 29 Oct 2018 23:52:30 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EBFD12C72; Mon, 29 Oct 2018 12:50:01 +0000 (UTC) X-Original-To: ovs-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 D35502C6D for ; Mon, 29 Oct 2018 12:50:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2C8147E8 for ; Mon, 29 Oct 2018 12:50:00 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181029124958euoutp0288ab2939fac6bc5871efe3ce550e77b2~iFUK7LGhh1679916799euoutp02Y; Mon, 29 Oct 2018 12:49:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181029124958euoutp0288ab2939fac6bc5871efe3ce550e77b2~iFUK7LGhh1679916799euoutp02Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817398; bh=u89IcTbte/pdbkUPanpkDyEoOAz0z14JMJ1dWJeOTAM=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=oBDXM5nuRDHraegEBmyAgjDk40eOei62MUGLZFfmjFQFiBHMxbAgvdAGiqhKBYTku 1/+1xpVgOoZwU+5J/3aRfnZNS9r5xtH6SHx5IX87LH80DUQ0uOwNg/hC51O82Bjm5S XJDs8PxIDL3pbtqnAXNLqNgbuU1/RqN3l5HwhwzA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029124958eucas1p1d394947fe9a58a4ca69ca69565c95187~iFUKYIs6w3273432734eucas1p1s; Mon, 29 Oct 2018 12:49:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id FC.8E.04441.5F107DB5; Mon, 29 Oct 2018 12:49:57 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029124957eucas1p2a85a856297ffd91d3f79da1ee7fcaafe~iFUJp3oY03134831348eucas1p2U; Mon, 29 Oct 2018 12:49:57 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-4e-5bd701f593d3 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 55.FD.04128.5F107DB5; Mon, 29 Oct 2018 12:49:57 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:49:57 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:23 +0300 Message-id: <20181029124926.12199-7-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWy7djP87rfGK9HGywVstgybTKrxatF55kt rrT/ZLfY+PAsq8XcT88ZLW7P8bJ4evEXs0XLkp1MDhweN/7dYvNYvOclk8ez6YeZPG5sP83q 8ezmf0aPvi2rGD3+N19lDWCP4rJJSc3JLEst0rdL4Mo4ddiv4Ltuxbaud+wNjG+Uuhg5OSQE TCQ6d7WxdDFycQgJrGCUmP/qL5TzmVHiQO8hZpiqS4dmMUIkljFK7Ht3gQnCaWaSOPb6ISNI FZuAjsSp1UfAbBEBaYnXvW9YQYqYBSYySbz9eYENJCEs4CMxb/tysCIWAVWJXb1LmUBsXgFr ib1P/7FCrJOXWL3hANhqTgEbief3+9lABkkIzGGTeHP4JNRNLhJ9OxZB2cISr45vYYewZSQu T+5mgbDrJe63vGSEaO5glJh+6B8TRMJeYsvrc2ANzAJ8EpO2TQcaxAEU55XoaBOCKPGQuHB2 AhvEm/2MEvcubWCdwCi5gJFhFaN4amlxbnpqsWFearlecWJucWleul5yfu4mRmB8nv53/NMO xq+Xkg4xCnAwKvHwPuC+Fi3EmlhWXJl7iFGCg1lJhPfVWaAQb0piZVVqUX58UWlOavEhRmkO FiVx3mXzNkYLCaQnlqRmp6YWpBbBZJk4OKUaGPe3TbQs37P34LpZ0V2Vv5dc/O3PM2PH9NTY oCSX7jztJ9x8d8wyp1hf5LqU9Kt7xozzO/RVzz2ILprnNOXGval9HDHztkWLhaiGclm8XMvt 7ZHss3PxYXk9vtWrvb8mRGguDJzXaJ3pO2GL8Wb25XfuB59ZVrewrGmi6+ZcY7GAhcebxJmS vZRYijMSDbWYi4oTAaGr7k7LAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGLMWRmVeSWpSXmKPExsVy+t/xq7pfGa9HG8x8IGuxZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVceqwX8F33YptXe/YGxjfKHUxcnJI CJhIXDo0i7GLkYtDSGAJo8Shp2uZIJxWJokJe9uZQarYBHQkTq0+wghiiwhIS7zufcMKUsQs MJlJYklLE1iRsICPxLzty8GKWARUJXb1LmUCsXkFrCX2Pv3HCrFOXmL1hgNg9ZwCNhLP7/ez gdhCQDWrPs5lnsDIs4CRYRWjSGppcW56brGRXnFibnFpXrpecn7uJkZgaG079nPLDsaud8GH GAU4GJV4eB9wX4sWYk0sK67MPcQowcGsJML76ixQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO95 g8ooIYH0xJLU7NTUgtQimCwTB6dUA6NL1oOahxtnxjx6sIHf1Nwu8MnqziWNEpkf407KxYh0 y8Us/ZoiKxD+trljBsuTIxv8lt3OCg7/PSm5+O4+XW+1Vu0peW37foQFLuCJXy7fkePx4EhR zqHZpXM3mDos5ZHcqFlTcP3LzKrfQbP6eUR5lBuvbohLeWJ/y/KJVc/mGk4r431LpimxFGck GmoxFxUnAgBh4cFBKQIAAA== X-CMS-MailID: 20181029124957eucas1p2a85a856297ffd91d3f79da1ee7fcaafe X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029124957eucas1p2a85a856297ffd91d3f79da1ee7fcaafe References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 6/9] netdev-dummy: Implement dummy put/del flow offload API. 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 Basic partial HWOL API for dummy interfaces. Signed-off-by: Ilya Maximets --- lib/netdev-dummy.c | 106 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 23817d121..7163ab47c 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -29,6 +29,7 @@ #include "odp-util.h" #include "openvswitch/dynamic-string.h" #include "openvswitch/list.h" +#include "openvswitch/match.h" #include "openvswitch/ofp-print.h" #include "openvswitch/ofpbuf.h" #include "openvswitch/vlog.h" @@ -92,6 +93,13 @@ struct pkt_list_node { struct ovs_list list_node; }; +struct offloaded_flow { + struct hmap_node node; + ovs_u128 ufid; + struct match match; + uint32_t mark; +}; + /* Protects 'dummy_list'. */ static struct ovs_mutex dummy_list_mutex = OVS_MUTEX_INITIALIZER; @@ -124,6 +132,8 @@ struct netdev_dummy { struct in6_addr ipv6, ipv6_mask; struct ovs_list rxes OVS_GUARDED; /* List of child "netdev_rxq_dummy"s. */ + struct hmap offloaded_flows OVS_GUARDED; + /* The following properties are for dummy-pmd and they cannot be changed * when a device is running, so we remember the request and update them * next time netdev_dummy_reconfigure() is called. */ @@ -699,6 +709,7 @@ netdev_dummy_construct(struct netdev *netdev_) dummy_packet_conn_init(&netdev->conn); ovs_list_init(&netdev->rxes); + hmap_init(&netdev->offloaded_flows); ovs_mutex_unlock(&netdev->mutex); ovs_mutex_lock(&dummy_list_mutex); @@ -712,6 +723,7 @@ static void netdev_dummy_destruct(struct netdev *netdev_) { struct netdev_dummy *netdev = netdev_dummy_cast(netdev_); + struct offloaded_flow *off_flow; ovs_mutex_lock(&dummy_list_mutex); ovs_list_remove(&netdev->list_node); @@ -727,6 +739,11 @@ netdev_dummy_destruct(struct netdev *netdev_) dummy_packet_conn_close(&netdev->conn); netdev->conn.type = NONE; + HMAP_FOR_EACH_POP (off_flow, node, &netdev->offloaded_flows) { + free(off_flow); + } + hmap_destroy(&netdev->offloaded_flows); + ovs_mutex_unlock(&netdev->mutex); ovs_mutex_destroy(&netdev->mutex); } @@ -1389,8 +1406,88 @@ netdev_dummy_update_flags(struct netdev *netdev_, return error; } - -/* Helper functions. */ + +/* Flow offload API. */ +static uint32_t +netdev_dummy_flow_hash(const ovs_u128 *ufid) +{ + return ufid->u32[0]; +} + +static struct offloaded_flow * +find_offloaded_flow(const struct hmap *offloaded_flows, const ovs_u128 *ufid) +{ + uint32_t hash = netdev_dummy_flow_hash(ufid); + struct offloaded_flow *data; + + HMAP_FOR_EACH_WITH_HASH (data, node, hash, offloaded_flows) { + if (ovs_u128_equals(*ufid, data->ufid)) { + return data; + } + } + + return NULL; +} + +static int +netdev_dummy_flow_put(struct netdev *netdev, struct match *match, + struct nlattr *actions OVS_UNUSED, + size_t actions_len OVS_UNUSED, + const ovs_u128 *ufid, struct offload_info *info, + struct dpif_flow_stats *stats OVS_UNUSED) +{ + struct netdev_dummy *dev = netdev_dummy_cast(netdev); + struct offloaded_flow *off_flow; + + ovs_mutex_lock(&dev->mutex); + + off_flow = find_offloaded_flow(&dev->offloaded_flows, ufid); + if (!off_flow) { + /* Create new offloaded flow. */ + off_flow = xzalloc(sizeof *off_flow); + memcpy(&off_flow->ufid, ufid, sizeof *ufid); + hmap_insert(&dev->offloaded_flows, &off_flow->node, + netdev_dummy_flow_hash(ufid)); + } + + off_flow->mark = info->flow_mark; + memcpy(&off_flow->match, match, sizeof *match); + + /* As we have per-netdev 'offloaded_flows', we don't need to match + * the 'in_port' for received packets. This will also allow offloading for + * packets passed to 'receive' command without specifying the 'in_port'. */ + off_flow->match.wc.masks.in_port.odp_port = 0; + + ovs_mutex_unlock(&dev->mutex); + + return 0; +} + +static int +netdev_dummy_flow_del(struct netdev *netdev, const ovs_u128 *ufid, + struct dpif_flow_stats *stats OVS_UNUSED) +{ + struct netdev_dummy *dev = netdev_dummy_cast(netdev); + struct offloaded_flow *off_flow; + + ovs_mutex_lock(&dev->mutex); + + off_flow = find_offloaded_flow(&dev->offloaded_flows, ufid); + if (!off_flow) { + ovs_mutex_unlock(&dev->mutex); + return -1; + } + + hmap_remove(&dev->offloaded_flows, &off_flow->node); + free(off_flow); + + ovs_mutex_unlock(&dev->mutex); + return 0; +} + +#define DUMMY_FLOW_OFFLOAD_API \ + .flow_put = netdev_dummy_flow_put, \ + .flow_del = netdev_dummy_flow_del #define NETDEV_DUMMY_CLASS_COMMON \ .run = netdev_dummy_run, \ @@ -1424,7 +1521,8 @@ netdev_dummy_update_flags(struct netdev *netdev_, .rxq_dealloc = netdev_dummy_rxq_dealloc, \ .rxq_recv = netdev_dummy_rxq_recv, \ .rxq_wait = netdev_dummy_rxq_wait, \ - .rxq_drain = netdev_dummy_rxq_drain + .rxq_drain = netdev_dummy_rxq_drain, \ + DUMMY_FLOW_OFFLOAD_API static const struct netdev_class dummy_class = { NETDEV_DUMMY_CLASS_COMMON, @@ -1442,6 +1540,8 @@ static const struct netdev_class dummy_pmd_class = { .is_pmd = true, .reconfigure = netdev_dummy_reconfigure }; + +/* Helper functions. */ static void pkt_list_delete(struct ovs_list *l) From patchwork Mon Oct 29 12:49:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990185 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="REWGiaIG"; 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 42kDz80vSNz9s3Z for ; Mon, 29 Oct 2018 23:52:52 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id BD10E2CB1; Mon, 29 Oct 2018 12:50:06 +0000 (UTC) X-Original-To: ovs-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 9A6C92C75 for ; Mon, 29 Oct 2018 12:50:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 7BE867C3 for ; Mon, 29 Oct 2018 12:50:03 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181029125002euoutp017d3e89b949f93501057706a0f1287c97~iFUN9K60w3146231462euoutp01d; Mon, 29 Oct 2018 12:50:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181029125002euoutp017d3e89b949f93501057706a0f1287c97~iFUN9K60w3146231462euoutp01d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817402; bh=mvM0z7UVhXTNtjAi52SaebJl8HC7vo0EjxJPG8xVNFs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=REWGiaIGZ1h8u5Ok6lG49HlXDO8W7xvLVAWsnJvGYO5yfQUSMhv9eSmy43mjTrWIK daMfGb3rLlYYd2umliX6rEWm2C7RDZ4nfhjY8AXMAAzbRF18zm2WijwVLgoE4YDcPh 7WjAG5Sv6Gl7TG2EagWmW9segitB6j7Xcw2VnwYc= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029125001eucas1p16d6229f12af9f6f2b4956a8366d64ef9~iFUNjNyhQ2144721447eucas1p1h; Mon, 29 Oct 2018 12:50:01 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 3B.6F.04294.9F107DB5; Mon, 29 Oct 2018 12:50:01 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029125000eucas1p21aa7d8f553dc56085a1c4d2bc7ffff3f~iFUMxCJ7m0887608876eucas1p2u; Mon, 29 Oct 2018 12:50:00 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-d1-5bd701f9f963 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E6.FD.04128.8F107DB5; Mon, 29 Oct 2018 12:50:00 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:50:00 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:24 +0300 Message-id: <20181029124926.12199-8-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsWy7djPc7o/Ga9HG1xcL2mxZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CV8f7bcpaCw5oViy7UNzB+luli5OSQ EDCR+Dz/J3sXIxeHkMAKRon/12ewQjifGSVWXehjhqk63raLHcQWEljGKPGyTQGiqJlJ4tSV 42AJNgEdiVOrjzCC2CIC0hKve9+ATWIWmMgk8fbnBTaQhLCAq8SK3VtZQGwWAVWJHzsvgtm8 AtYS27ua2SC2yUus3nAAbDOngI3E8/v9bCCDJARmsElcO9EDdZKLxIpr+5ggbGGJV8e3sEPY MhKXJ3ezQNj1EvdbXjJCNHcwSkw/9A+qwV5iy+tzYA3MAnwSk7ZNBxrKARTnlehoE4IwPSSa fzpAfNnPKHHy6ymmCYySCxgZVjGKp5YW56anFhvlpZbrFSfmFpfmpesl5+duYgRG5+l/x7/s YNz1J+kQowAHoxIP7wPua9FCrIllxZW5hxglOJiVRHhfnQUK8aYkVlalFuXHF5XmpBYfYpTm YFES5102b2O0kEB6YklqdmpqQWoRTJaJg1OqgdF63+MVHasPVV/+e0Bhf7XLJ7MVD5S2zf7W GuuSdGpVivDhy1rik3/NXOb9KUPiR4CX2C+/7Y99eI8cXf9d1nhRI/fG6mkHNGX9hebELD0o 8Mbu3w4ZrraDzEsYE76I3N/B7L7v+zo2+fe8032Fnu4I1jsg+9TW693sgmkLZ5/9zKxanZZ+ guOFEktxRqKhFnNRcSIAwCUUIMoCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGLMWRmVeSWpSXmKPExsVy+t/xq7o/GK9HG7xcamixZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CV8f7bcpaCw5oViy7UNzB+luli5OSQ EDCRON62i72LkYtDSGAJo8TDE92MEE4rk8Tj3hesIFVsAjoSp1YfYQSxRQSkJV73vmEFKWIW mMwksaSliRkkISzgKrFi91YWEJtFQFXix86LYDavgLXE9q5mNoh18hKrNxwAq+cUsJF4fr8f LC4EVLPq41zmCYw8CxgZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgSG1rZjP7fsYOx6F3yI UYCDUYmH9wH3tWgh1sSy4srcQ4wSHMxKIryvzgKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8543 qIwSEkhPLEnNTk0tSC2CyTJxcEo1MK6xdGvicky8IlTFI1Op2qMY+eNZPqfFhAeqghYv79x/ uu+ie6SIW73cdC3madq3F1fLh515zinQcXcyw3tnC4MLwau4ykRm7Dq49/QNP5kHV7bJBEUc 8M21Wbxg9r5H79coy/5je/bJOkZc55JucI5iVdWd3LPOeTXVn9ceiM2Rzr4+89G8P0osxRmJ hlrMRcWJADFNnkMpAgAA X-CMS-MailID: 20181029125000eucas1p21aa7d8f553dc56085a1c4d2bc7ffff3f X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029125000eucas1p21aa7d8f553dc56085a1c4d2bc7ffff3f References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 7/9] netdev-dummy: Set flow mark for offloaded flows. 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 Match packets received on dummy interfaces with offloaded flows and set up corresponding marks in dp-packet. Signed-off-by: Ilya Maximets --- lib/netdev-dummy.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 7163ab47c..bd18a5190 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -156,7 +156,7 @@ struct netdev_rxq_dummy { static unixctl_cb_func netdev_dummy_set_admin_state; static int netdev_dummy_construct(struct netdev *); static void netdev_dummy_queue_packet(struct netdev_dummy *, - struct dp_packet *, int); + struct dp_packet *, struct flow *, int); static void dummy_packet_stream_close(struct dummy_packet_stream *); @@ -283,7 +283,7 @@ dummy_packet_stream_run(struct netdev_dummy *dev, struct dummy_packet_stream *s) if (retval == n && dp_packet_size(&s->rxbuf) > 2) { dp_packet_pull(&s->rxbuf, 2); netdev_dummy_queue_packet(dev, - dp_packet_clone(&s->rxbuf), 0); + dp_packet_clone(&s->rxbuf), NULL, 0); dp_packet_clear(&s->rxbuf); } } else if (retval != -EAGAIN) { @@ -1152,7 +1152,7 @@ netdev_dummy_send(struct netdev *netdev, int qid OVS_UNUSED, struct dp_packet *reply = dp_packet_new(0); compose_arp(reply, ARP_OP_REPLY, dev->hwaddr, flow.dl_src, false, flow.nw_dst, flow.nw_src); - netdev_dummy_queue_packet(dev, reply, 0); + netdev_dummy_queue_packet(dev, reply, NULL, 0); } } @@ -1563,12 +1563,11 @@ eth_from_packet(const char *s) } static struct dp_packet * -eth_from_flow(const char *s, size_t packet_size) +eth_from_flow_str(const char *s, size_t packet_size, struct flow *flow) { enum odp_key_fitness fitness; struct dp_packet *packet; struct ofpbuf odp_key; - struct flow flow; int error; /* Convert string to datapath key. @@ -1585,7 +1584,7 @@ eth_from_flow(const char *s, size_t packet_size) } /* Convert odp_key to flow. */ - fitness = odp_flow_key_to_flow(odp_key.data, odp_key.size, &flow); + fitness = odp_flow_key_to_flow(odp_key.data, odp_key.size, flow); if (fitness == ODP_FIT_ERROR) { ofpbuf_uninit(&odp_key); return NULL; @@ -1593,15 +1592,15 @@ eth_from_flow(const char *s, size_t packet_size) packet = dp_packet_new(0); if (packet_size) { - flow_compose(packet, &flow, NULL, 0); + flow_compose(packet, flow, NULL, 0); if (dp_packet_size(packet) < packet_size) { - packet_expand(packet, &flow, packet_size); + packet_expand(packet, flow, packet_size); } else if (dp_packet_size(packet) > packet_size){ dp_packet_delete(packet); packet = NULL; } } else { - flow_compose(packet, &flow, NULL, 64); + flow_compose(packet, flow, NULL, 64); } ofpbuf_uninit(&odp_key); @@ -1621,14 +1620,28 @@ netdev_dummy_queue_packet__(struct netdev_rxq_dummy *rx, struct dp_packet *packe static void netdev_dummy_queue_packet(struct netdev_dummy *dummy, struct dp_packet *packet, - int queue_id) + struct flow *flow, int queue_id) OVS_REQUIRES(dummy->mutex) { struct netdev_rxq_dummy *rx, *prev; + struct offloaded_flow *data; + struct flow packet_flow; if (dummy->rxq_pcap) { ovs_pcap_write(dummy->rxq_pcap, packet); } + + if (!flow) { + flow = &packet_flow; + flow_extract(packet, flow); + } + HMAP_FOR_EACH (data, node, &dummy->offloaded_flows) { + if (flow_equal_except(flow, &data->match.flow, &data->match.wc)) { + dp_packet_set_flow_mark(packet, data->mark); + break; + } + } + prev = NULL; LIST_FOR_EACH (rx, node, &dummy->rxes) { if (rx->up.queue_id == queue_id && @@ -1674,6 +1687,7 @@ netdev_dummy_receive(struct unixctl_conn *conn, for (i = k; i < argc; i++) { struct dp_packet *packet; + struct flow flow; /* Try to parse 'argv[i]' as packet in hex. */ packet = eth_from_packet(argv[i]); @@ -1693,15 +1707,17 @@ netdev_dummy_receive(struct unixctl_conn *conn, i += 2; } /* Try parse 'argv[i]' as odp flow. */ - packet = eth_from_flow(flow_str, packet_size); + packet = eth_from_flow_str(flow_str, packet_size, &flow); if (!packet) { unixctl_command_reply_error(conn, "bad packet or flow syntax"); goto exit; } + } else { + flow_extract(packet, &flow); } - netdev_dummy_queue_packet(dummy_dev, packet, rx_qid); + netdev_dummy_queue_packet(dummy_dev, packet, &flow, rx_qid); } unixctl_command_reply(conn, NULL); From patchwork Mon Oct 29 12:49:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990186 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="ov4kV0nE"; 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 42kDzZ1LMXz9s3Z for ; Mon, 29 Oct 2018 23:53:14 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7C9B22CD0; Mon, 29 Oct 2018 12:50:08 +0000 (UTC) X-Original-To: ovs-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 83D462CBF for ; Mon, 29 Oct 2018 12:50:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0153D25A for ; Mon, 29 Oct 2018 12:50:06 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181029125005euoutp018b10a1a8902c4d0f735369f9e8b7d92c~iFUROj-kk3235532355euoutp01A; Mon, 29 Oct 2018 12:50:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181029125005euoutp018b10a1a8902c4d0f735369f9e8b7d92c~iFUROj-kk3235532355euoutp01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817405; bh=r/IEBuAPrXDVeFsEgZiloaSVKYKJFDzWFZ9eftWis2k=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ov4kV0nEolX2SRmaW+CRe5fITVT2qp13oJp4Xn57RwP1q3iZir7+0hKuqoONp1kI5 x4WVZgIreCQMgguJ6Mm7jaaxsOzl6w8QFzp70vWtnkSJhj4MXKh3kism1wI/mVLLWJ a8Gj5BKjLGFSSqavKM8ii7WuTH1YPUXVpnxse6/g= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181029125005eucas1p15624ad004fe5a70ac12aaada759a6151~iFUQz3VlG2144721447eucas1p1n; Mon, 29 Oct 2018 12:50:05 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 0C.0B.04806.CF107DB5; Mon, 29 Oct 2018 12:50:04 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029125004eucas1p299796fb9a0385d94a56764dc5660e5f8~iFUQCFaTu0951409514eucas1p25; Mon, 29 Oct 2018 12:50:04 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-93-5bd701fc0d36 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4C.FD.04128.CF107DB5; Mon, 29 Oct 2018 12:50:04 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:50:04 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:25 +0300 Message-id: <20181029124926.12199-9-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRmVeSWpSXmKPExsWy7djPc7p/GK9HG6z7aWCxZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVMf/ALPaCrYoVix5fY2xg3CLexcjJ ISFgIrFg0nKWLkYuDiGBFYwSdz6cYIJwPjNK3Jp8lBmm6uGnNYwQiWWMEs8/XYNqaWaS2Lfo LxNIFZuAjsSp1UcYQWwRAWmJ171vWEGKmAUmMkm8/XmBDSQhLOAisWx5J9hYFgFViaunbwNN 4uDgFbCW2PpNBGKbvMTqDQfASjgFbCSe3+9nA5kjITCHTWL2iiY2iCIXiQOz1kHZwhKvjm9h h7BlJC5P7maBsOsl7re8ZIRo7mCUmH7oHxNEwl5iy+tzYA3MAnwSk7ZNZwY5QkKAV6KjTQii xENixY5lUF/2M0r8+LmPeQKj5AJGhlWM4qmlxbnpqcXGeanlesWJucWleel6yfm5mxiBEXr6 3/GvOxj3/Uk6xCjAwajEw/uA+1q0EGtiWXFl7iFGCQ5mJRHeV2eBQrwpiZVVqUX58UWlOanF hxilOViUxHmXzdsYLSSQnliSmp2aWpBaBJNl4uCUamCcn7l/Q8EmZlZR1mM8RcHvPbm/xcTb pglOCJ7hvjcrOL07W/7hzXU/Wj3M/+mfWPlYIG3lDNYfvpx+MzxP6okoz7rNsOrP22NOm1d1 d0w6pK9vPTekOjP96PPM+cenPpErEHK1WZXya8qkynn5Rgd2LNH7NkPlTY7rQ8v0+tirYVc4 bcoO2gsrsRRnJBpqMRcVJwIAMfB+zMwCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xq7p/GK9HG9x9IGSxZdpkVotXi84z W1xp/8lusfHhWVaLuZ+eM1rcnuNl8fTiL2aLliU7mRw4PG78u8XmsXjPSyaPZ9MPM3nc2H6a 1ePZzf+MHn1bVjF6/G++yhrAHsVlk5Kak1mWWqRvl8CVMf/ALPaCrYoVix5fY2xg3CLexcjJ ISFgIvHw0xpGEFtIYAmjxI6HoV2MXEB2K5PEtVOTmUESbAI6EqdWHwErEhGQlnjd+4YVpIhZ YDKTxJKWJrAiYQEXiWXLO8FsFgFViaunb7N0MXJw8ApYS2z9JgKxTF5i9YYDYCWcAjYSz+/3 s0EstpZY9XEu8wRGngWMDKsYRVJLi3PTc4uN9IoTc4tL89L1kvNzNzECA2vbsZ9bdjB2vQs+ xCjAwajEw/uA+1q0EGtiWXFl7iFGCQ5mJRHeV2eBQrwpiZVVqUX58UWlOanFhxilOViUxHnP G1RGCQmkJ5akZqemFqQWwWSZODilGhiT7Nn7FvK/3rN3VbhVwWZx19dvJml6ezJ3PePkOWdg EXZx2X4rl73nDhZefKm1xvJ3b+OFWzKh6mcbpRYvC536080g5/lL3yW2d9w7PtnaKC52VlOc XBKjXnbV95QW42nX4uPiJzamHmvblP12Q6u8FVPWnH0XMoXdjpWK9k6fXnLq+bntjh+VWIoz Eg21mIuKEwELKiViKAIAAA== X-CMS-MailID: 20181029125004eucas1p299796fb9a0385d94a56764dc5660e5f8 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029125004eucas1p299796fb9a0385d94a56764dc5660e5f8 References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 8/9] netdev-dummy: Add flow offloading related logs. 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 Add debug logging for partial HWOL for dummy interfaces for the future using in tests. Signed-off-by: Ilya Maximets --- lib/netdev-dummy.c | 66 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index bd18a5190..3d548e55e 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -1438,6 +1438,7 @@ netdev_dummy_flow_put(struct netdev *netdev, struct match *match, { struct netdev_dummy *dev = netdev_dummy_cast(netdev); struct offloaded_flow *off_flow; + bool modify = true; ovs_mutex_lock(&dev->mutex); @@ -1448,6 +1449,7 @@ netdev_dummy_flow_put(struct netdev *netdev, struct match *match, memcpy(&off_flow->ufid, ufid, sizeof *ufid); hmap_insert(&dev->offloaded_flows, &off_flow->node, netdev_dummy_flow_hash(ufid)); + modify = false; } off_flow->mark = info->flow_mark; @@ -1460,6 +1462,20 @@ netdev_dummy_flow_put(struct netdev *netdev, struct match *match, ovs_mutex_unlock(&dev->mutex); + if (VLOG_IS_DBG_ENABLED()) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_format(&ds, "%s: flow put[%s]: ", netdev_get_name(netdev), + modify ? "modify" : "create"); + odp_format_ufid(ufid, &ds); + ds_put_cstr(&ds, " flow match: "); + match_format(match, NULL, &ds, OFP_DEFAULT_PRIORITY); + ds_put_format(&ds, ", mark: %"PRIu32, info->flow_mark); + + VLOG_DBG("%s", ds_cstr(&ds)); + ds_destroy(&ds); + } + return 0; } @@ -1469,20 +1485,43 @@ netdev_dummy_flow_del(struct netdev *netdev, const ovs_u128 *ufid, { struct netdev_dummy *dev = netdev_dummy_cast(netdev); struct offloaded_flow *off_flow; + const char *error = NULL; + uint32_t mark; ovs_mutex_lock(&dev->mutex); off_flow = find_offloaded_flow(&dev->offloaded_flows, ufid); if (!off_flow) { - ovs_mutex_unlock(&dev->mutex); - return -1; + error = "No such flow."; + goto exit; } + mark = off_flow->mark; hmap_remove(&dev->offloaded_flows, &off_flow->node); free(off_flow); +exit: ovs_mutex_unlock(&dev->mutex); - return 0; + + if (error || VLOG_IS_DBG_ENABLED()) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_format(&ds, "%s: ", netdev_get_name(netdev)); + if (error) { + ds_put_cstr(&ds, "failed to "); + } + ds_put_cstr(&ds, "flow del: "); + odp_format_ufid(ufid, &ds); + if (error) { + ds_put_format(&ds, " error: %s", error); + } else { + ds_put_format(&ds, " mark: %"PRIu32, mark); + } + VLOG(error ? VLL_WARN : VLL_DBG, "%s", ds_cstr(&ds)); + ds_destroy(&ds); + } + + return error ? -1 : 0; } #define DUMMY_FLOW_OFFLOAD_API \ @@ -1637,7 +1676,28 @@ netdev_dummy_queue_packet(struct netdev_dummy *dummy, struct dp_packet *packet, } HMAP_FOR_EACH (data, node, &dummy->offloaded_flows) { if (flow_equal_except(flow, &data->match.flow, &data->match.wc)) { + dp_packet_set_flow_mark(packet, data->mark); + + if (VLOG_IS_DBG_ENABLED()) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_format(&ds, "%s: packet: ", + netdev_get_name(&dummy->up)); + /* 'flow' does not contain proper port number here. + * Let's just clear it as it wildcarded anyway. */ + flow->in_port.ofp_port = 0; + flow_format(&ds, flow, NULL); + + ds_put_cstr(&ds, " matches with flow: "); + odp_format_ufid(&data->ufid, &ds); + ds_put_cstr(&ds, " "); + match_format(&data->match, NULL, &ds, OFP_DEFAULT_PRIORITY); + ds_put_format(&ds, " with mark: %"PRIu32, data->mark); + + VLOG_DBG("%s", ds_cstr(&ds)); + ds_destroy(&ds); + } break; } } From patchwork Mon Oct 29 12:49:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 990187 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; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="kS1uNpqU"; 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 42kDzz1WGtz9s3Z for ; Mon, 29 Oct 2018 23:53:35 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 3D9812CDD; Mon, 29 Oct 2018 12:50:12 +0000 (UTC) X-Original-To: ovs-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 1324B2CD5 for ; Mon, 29 Oct 2018 12:50:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 711237EB for ; Mon, 29 Oct 2018 12:50:10 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181029125009euoutp022f2de757a115e2068e2a8cefa2bcdde0~iFUUdM3XO1683216832euoutp02a; Mon, 29 Oct 2018 12:50:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181029125009euoutp022f2de757a115e2068e2a8cefa2bcdde0~iFUUdM3XO1683216832euoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1540817409; bh=Ou9xUGYxwZ2yyp23Lqxk2Zwf3cBEMhM/QMk5iO91xnY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=kS1uNpqUzqRxvZvKfujVO98bXV29BwiFZARkEYodEnM6VDklIcal+G6x7Jf2xXMx2 M86x1HGlANsdyRYglC+a6fr3uwF17XCzQWFH/0zO/NmR8JuglsEx3sFCaD6vqI8RXH 61kHoclC1seCDpN3tQZxixTaHmStL0t327EYq/O0= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029125008eucas1p2dfa002eac07df0b6a0ca880a252f6a41~iFUUADtEP1440614406eucas1p2x; Mon, 29 Oct 2018 12:50:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 74.7F.04294.00207DB5; Mon, 29 Oct 2018 12:50:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181029125007eucas1p2d07c30ba57e14324edee58bf3266bf47~iFUTWQGer0969509695eucas1p23; Mon, 29 Oct 2018 12:50:07 +0000 (GMT) X-AuditID: cbfec7f4-c77a99c0000010c6-f6-5bd702003de4 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8C.6C.04284.FF107DB5; Mon, 29 Oct 2018 12:50:07 +0000 (GMT) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHD00EQH2AI7G60@eusync3.samsung.com>; Mon, 29 Oct 2018 12:50:07 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 29 Oct 2018 15:49:26 +0300 Message-id: <20181029124926.12199-10-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181029124926.12199-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djPc7oMTNejDZZfFbHYMm0yq8WrReeZ La60/2S32PjwLKvF3E/PGS1uz/GyeHrxF7NFy5KdTA4cHjf+3WLzWLznJZPHs+mHmTxubD/N 6vHs5n9Gj74tqxg9/jdfZQ1gj+KySUnNySxLLdK3S+DKuP9TuWChUsWavnvMDYyzZLsYOTkk BEwkPu29wdrFyMUhJLCCUeLJ7DOMEM5nRomGkwfZYKq2TPwEZgsJLGOUuHzHE6KomUli3uk+ VpAEm4COxKnVRxhBbBEBaYnXvW/AxjILTGSSePvzAli3sECAxNNDK5hAbBYBVYnH57aBNfMK 2Ejc33uWFWKbvMTqDQeYQWxOoPjz+/1sIIMkBGawScz9tJYJoshF4v3Uv+wQtrDEq+NboGwZ ic6Og1A19RL3W14yQjR3MEpMP/QPKmEvseX1ObAGZgE+iUnbpgNt4wCK80p0tAlBmB4Sh6Yl Q3zczygxsZF7AqPkAkaGVYziqaXFuempxUZ5qeV6xYm5xaV56XrJ+bmbGIGxefrf8S87GHf9 STrEKMDBqMTD+4D7WrQQa2JZcWXuIUYJDmYlEd5XZ4FCvCmJlVWpRfnxRaU5qcWHGKU5WJTE eZfN2xgtJJCeWJKanZpakFoEk2Xi4JRqYJS+/n9TfR5T7rvOiumfdd+6uR+9KbXRludB+eFJ k+t9/3/ZIP2U46xE/k2Pz6ofpug0FyRsPub66G9g2nPlisXrpk3LfLroQtqd19+SqxIOrs+w 75iQ9oPn1mntbPa2ChnWju/3Nm8JsTz66OvGWy5/GM0DG9d8a+bS+dda7/9116/qj5v1rqgo sRRnJBpqMRcVJwIAOVKQzckCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKLMWRmVeSWpSXmKPExsVy+t/xq7r/Ga9HGxxvN7PYMm0yq8WrReeZ La60/2S32PjwLKvF3E/PGS1uz/GyeHrxF7NFy5KdTA4cHjf+3WLzWLznJZPHs+mHmTxubD/N 6vHs5n9Gj74tqxg9/jdfZQ1gj+KySUnNySxLLdK3S+DKuP9TuWChUsWavnvMDYyzZLsYOTkk BEwktkz8xNbFyMUhJLCEUeLt++XsIAkhgVYmiXWndUFsNgEdiVOrjzCC2CIC0hKve9+wgjQw C0xmkljS0sQMkhAW8JP4PG8yWBGLgKrE43PbWEFsXgEbift7z7JCbJOXWL3hAFg9J1D8+f1+ Nohl1hKrPs5lnsDIs4CRYRWjSGppcW56brGhXnFibnFpXrpecn7uJkZgYG079nPzDsZLG4MP MQpwMCrx8D7gvhYtxJpYVlyZe4hRgoNZSYT31VmgEG9KYmVValF+fFFpTmrxIUZpDhYlcd7z BpVRQgLpiSWp2ampBalFMFkmDk6pBkZm78p0n1ObggIOT+t0viLRKhN6zsNwylHGz9qzDj4u uzzJTiRaOI1RyPVP0J01h8o4vhq8veAhe99AINGoTEf09COxDKNXTFZznBV65Nl2/90gd+ZQ vPKxab1zOIT6jyb88Hv74L0k/zm3m8qvBLX9SrsOti5xvqUZ3n18X8KvlKx1c5MYPZVYijMS DbWYi4oTARphBSsoAgAA X-CMS-MailID: 20181029125007eucas1p2d07c30ba57e14324edee58bf3266bf47 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181029125007eucas1p2d07c30ba57e14324edee58bf3266bf47 References: <20181029124926.12199-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Flavio Leitner , Ilya Maximets Subject: [ovs-dev] [PATCH 9/9] dpif-netdev.at: Add basic test for partial HW offloading. 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 Simple test for basic partial HWOL functionality. Signed-off-by: Ilya Maximets --- tests/dpif-netdev.at | 73 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at index 6915d43ba..dd47f8874 100644 --- a/tests/dpif-netdev.at +++ b/tests/dpif-netdev.at @@ -34,6 +34,18 @@ filter_flow_install () { grep 'flow_add' | sed 's/.*flow_add: //' | sort | uniq } +filter_hw_flow_install () { + grep 'netdev_dummy.*flow put\[create\]' | sed 's/.*|DBG|//' | sort | uniq +} + +filter_hw_flow_del () { + grep 'netdev_dummy.*flow del' | sed 's/.*|DBG|//' | sort | uniq +} + +filter_hw_packet_netdev_dummy () { + grep 'netdev_dummy.*: packet:' | sed 's/.*|DBG|//' | sort | uniq +} + filter_flow_dump () { grep 'flow_dump ' | sed ' s/.*flow_dump // @@ -346,3 +358,64 @@ recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), a OVS_VSWITCHD_STOP AT_CLEANUP + +m4_define([DPIF_NETDEV_FLOW_HW_OFFLOAD], + [AT_SETUP([dpif-netdev - partial hw offload - $1]) + OVS_VSWITCHD_START( + [add-port br0 p1 -- set interface p1 type=$1 ofport_request=1 options:pstream=punix:$OVS_RUNDIR/p1.sock -- \ + set bridge br0 datapath-type=dummy \ + other-config:datapath-id=1234 fail-mode=secure], [], [], + [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])]) + AT_CHECK([ovs-appctl vlog/set dpif:file:dbg dpif_netdev:file:dbg netdev_dummy:file:dbg]) + + AT_CHECK([ovs-vsctl set Open_vSwitch . other_config:hw-offload=true]) + OVS_WAIT_UNTIL([grep "netdev: Flow API Enabled" ovs-vswitchd.log]) + + AT_CHECK([ovs-ofctl del-flows br0]) + AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=IN_PORT]) + + packet="packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=0,tos=0,ttl=64,frag=no)" + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) + + OVS_WAIT_UNTIL([grep "miss upcall" ovs-vswitchd.log]) + AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl +skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=00:06:07:08:09:0a,dst=00:01:02:03:04:05),eth_type(0x0800),ipv4(src=127.0.0.1,dst=127.0.0.1,proto=0,tos=0,ttl=64,frag=no) +]) + # Check that flow successfully offloaded. + OVS_WAIT_UNTIL([grep "succeed to add netdev flow" ovs-vswitchd.log]) + AT_CHECK([filter_hw_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl +p1: flow put[[create]]: flow match: recirc_id=0,eth,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, mark: 0 +]) + # Check that datapath flow installed successfully. + AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions: +]) + # Inject the same packet again. + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $packet --len 64], [0]) + + # Check for succesfull packet matching with installed offloaded flow. + AT_CHECK([filter_hw_packet_netdev_dummy < ovs-vswitchd.log | strip_xout], [0], [dnl +p1: packet: ip,vlan_tci=0x0000,dl_src=00:06:07:08:09:0a,dl_dst=00:01:02:03:04:05,nw_src=127.0.0.1,nw_dst=127.0.0.1,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=64 matches with flow: recirc_id=0,eth,ip,vlan_tci=0x0000,nw_frag=no with mark: 0 +]) + + ovs-appctl revalidator/wait + # Dump the datapath flow to see that actions was executed for a packet. + AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_timers], [0], [dnl +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:64, used:0.0s, actions:1 +]) + + # Wait for datapath flow expiration. + ovs-appctl time/stop + ovs-appctl time/warp 15000 + ovs-appctl revalidator/wait + + # Check that flow successfully deleted from HW. + OVS_WAIT_UNTIL([grep "succeed to delete netdev flow" ovs-vswitchd.log]) + AT_CHECK([filter_hw_flow_del < ovs-vswitchd.log | strip_xout], [0], [dnl +p1: flow del: mark: 0 +]) + OVS_VSWITCHD_STOP + AT_CLEANUP]) + +DPIF_NETDEV_FLOW_HW_OFFLOAD([dummy]) +DPIF_NETDEV_FLOW_HW_OFFLOAD([dummy-pmd])