From patchwork Fri Jul 21 13:28:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 792126 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=) 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 3xDWmy6fl2z9s0g for ; Fri, 21 Jul 2017 23:28:34 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6FF3BB1F; Fri, 21 Jul 2017 13:28:33 +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 45A4F4A4 for ; Fri, 21 Jul 2017 13:28:32 +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 860FF152 for ; Fri, 21 Jul 2017 13:28:31 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OTG008LO03HT550@mailout1.w1.samsung.com> for ovs-dev@openvswitch.org; Fri, 21 Jul 2017 14:28:29 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170721132828eucas1p24d8cf672690e641f8a9ffb5de08f96d2~TW4Cny0Kl1220912209eucas1p2g; Fri, 21 Jul 2017 13:28:28 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 6A.74.04459.C7102795; Fri, 21 Jul 2017 14:28:28 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170721132828eucas1p2df4379bead184dc4e3852e102c763e83~TW4B8226p1221012210eucas1p2w; Fri, 21 Jul 2017 13:28:28 +0000 (GMT) X-AuditID: cbfec7f1-f796e6d00000116b-a0-5972017ce447 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A5.F3.20206.B7102795; Fri, 21 Jul 2017 14:28:28 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OTG00M1403CPY50@eusync2.samsung.com>; Fri, 21 Jul 2017 14:28:27 +0100 (BST) From: Ilya Maximets To: ovs-dev@openvswitch.org, Andy Zhou Date: Fri, 21 Jul 2017 16:28:22 +0300 Message-id: <1500643702-5955-1-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsWy7djP87o1jEWRBqsm6FjMe7+J0WLa59vs Flfaf7JbzP30nNGBxePZzf+MHs+v9bB49G1ZxRjAHMVlk5Kak1mWWqRvl8CVsebeDLaCfr6K s8vTGxgPcHcxcnJICJhIbPzVyAZhi0lcuLceyObiEBJYyijxpWkRI4TzmVFiY+98ZpiO9+9+ Q1UtY5SYufQHC0hCSKCZSeLa6kIQm01AR+LU6iOMILaIgJnE+m3rWUFsZoFgiR3rj4GtExbw kXj5citQnIODRUB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FuZGRkjjv1A9XwoUE0hNLUrNTUwtSi2D6mDg4pRoYa0p+Ljd260l3zdObtPT1 LH5bU9miw5eU27k8zdZKvVLjn7KA8/a+GtuUrw25LgpSb79VX59g/nKdg+szj3ehX+IDv2bN bbF52uQz7d8M45e/ra/FtJ57q8i0b8IUXr5552POXI2OF9XnnbhzRWU1q6TMvvzEDd+O3Fpn vXvl09gulds1z9dcUmIpzkg01GIuKk4EADFDQVRJAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170721132828eucas1p2df4379bead184dc4e3852e102c763e83 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?= =?UTF-8?B?G+yCvOyEseyghOyekBtMZWFkaW5nIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbTGVhZGluZyBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170721132828eucas1p2df4379bead184dc4e3852e102c763e83 X-RootMTR: 20170721132828eucas1p2df4379bead184dc4e3852e102c763e83 References: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Heetae Ahn Subject: [ovs-dev] [PATCH] bond: Unify hash functions in hash action and entry lookup. 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 'lookup_bond_entry' currently uses 'flow_hash_symmetric_l4' while OVS_ACTION_ATTR_HASH uses 'flow_hash_5tuple'. This may lead to inconsistency in slave choosing for the new flows. In general, there is no point to unify hash functions, because it's not required for correct work, but it's logically wrong to use different hash functions there. Unfortunately we're not able to use RSS hash here, because we have no packet at this point, but we may reduce inconsistency by using 'flow_hash_5tuple' instead of 'flow_hash_symmetric_l4' because symmetric quality is not needed. 'flow_hash_symmetric_l4' was used previously just because there was no other implemented hash function at the moment. Now we have 5tuple hash and may replace the old function. 'flow_hash_5tuple' is preferable solution because it in 2 - 8 times (depending on the flow) faster than symmetric function. So, this change will also speed up handling of the new flows and statistics accounting. Signed-off-by: Ilya Maximets --- ofproto/bond.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ofproto/bond.c b/ofproto/bond.c index cb25a1d..72b373c 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -1746,12 +1746,10 @@ static unsigned int bond_hash_tcp(const struct flow *flow, uint16_t vlan, uint32_t basis) { struct flow hash_flow = *flow; + hash_flow.vlans[0].tci = htons(vlan); - /* The symmetric quality of this hash function is not required, but - * flow_hash_symmetric_l4 already exists, and is sufficient for our - * purposes, so we use it out of convenience. */ - return flow_hash_symmetric_l4(&hash_flow, basis); + return flow_hash_5tuple(&hash_flow, basis); } static unsigned int