From patchwork Mon Jun 18 08:32:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manohar Krishnappa Chidambaraswamy X-Patchwork-Id: 930741 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=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="aLX1IZPI"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="Iaz7144R"; 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 418PV83M1Qz9s0W for ; Mon, 18 Jun 2018 18:32:32 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2541FC87; Mon, 18 Jun 2018 08:32:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9758CBAD for ; Mon, 18 Jun 2018 08:32:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 7E2B1E6 for ; Mon, 18 Jun 2018 08:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1529310745; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=27xup24yOwFsj11+rYAwWmKT/ascfBELdX2enI3yyf0=; b=aLX1IZPIlson88S69aFC1aIVlEiY3VbgTsRKJgOrJHUhAfT9mcoG19H8b1+N3lwb ZT5vb0tgJxrWD8yIhGcsgsJbNra4p+h41UE3QYjzMcf0uO/oQY4lSs7jLObbt1lk jR502turDDCU1HnNpVuEsvEgEBT1bn3lCKEARuXOfEY=; X-AuditID: c1b4fb3a-a01ff700000079c1-a2-5b276e199621 Received: from ESESBMB503.ericsson.se (Unknown_Domain [153.88.183.116]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 3B.9D.31169.91E672B5; Mon, 18 Jun 2018 10:32:25 +0200 (CEST) Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 18 Jun 2018 10:32:25 +0200 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Mon, 18 Jun 2018 10:32:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=27xup24yOwFsj11+rYAwWmKT/ascfBELdX2enI3yyf0=; b=Iaz7144RRsUXWx8rQLCoVIeoOiUleJX2MbD8aLJXuCa5XoJ/x+xk1kDxTprFOj7u1xbBPRSEgEQDzV5R2/5J0b8YsIHenZw9awQmKhdGRbOWeP9+Ln9bXSfcv5ZP8mrXXBcUF9HmtsmKnGKTu9LSU5cBM94RxAGdHW60ZaSJ2bo= Received: from VI1PR07MB4159.eurprd07.prod.outlook.com (20.176.6.20) by VI1SPR8PMB112.eurprd07.prod.outlook.com (10.163.248.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.16; Mon, 18 Jun 2018 08:32:24 +0000 Received: from VI1PR07MB4159.eurprd07.prod.outlook.com ([fe80::7517:1d50:4a6f:9cb8]) by VI1PR07MB4159.eurprd07.prod.outlook.com ([fe80::7517:1d50:4a6f:9cb8%3]) with mapi id 15.20.0884.010; Mon, 18 Jun 2018 08:32:23 +0000 From: Manohar Krishnappa Chidambaraswamy To: Ben Pfaff Thread-Topic: [PATCH v2 1/2] Fix packet drops on LACP bond after link up Thread-Index: AQHUBt7hSqUFnJL8ikawBXpBApdL3w== Date: Mon, 18 Jun 2018 08:32:23 +0000 Message-ID: <83997C00-8548-4FEB-AD23-A643669D5732@ericsson.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=manohar.krishnappa.chidambaraswamy@ericsson.com; x-originating-ip: [125.16.128.122] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1SPR8PMB112; 7:RuW0VUWxiI3ld1Rd5YjZiPyJu4ZAoqtuaWEAX2z4ZDe6QXhe0COdP4UoMGVid9kbMiVBa5UmzfQWiZyH2oPrVGQRCkNuhPkYZNTwwqbG/BUjRNn5CS0/hFaWQpWA8pcDKKnN7Em/zRePFvrv9SVnwE0xW3zB0pk2Yrzb/ipvnXercCUmDCQMJuqZp6V6EUH0uWbOE64tp57ZLG2MJ+EhxvohikWHMLdNWAKm60r+q6FwQysWUFMyoFxPzaudgcco x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(396003)(366004)(39380400002)(39860400002)(346002)(376002)(199004)(189003)(2616005)(8676002)(81166006)(81156014)(478600001)(26005)(55236004)(97736004)(5250100002)(36756003)(59450400001)(6506007)(107886003)(83716003)(2900100001)(86362001)(575784001)(486006)(102836004)(3660700001)(53936002)(476003)(5660300001)(66066001)(8936002)(3280700002)(33656002)(186003)(106356001)(966005)(68736007)(6116002)(6436002)(54906003)(99286004)(316002)(4326008)(105586002)(3846002)(6486002)(2906002)(25786009)(7736002)(6916009)(6512007)(14454004)(82746002)(305945005)(6306002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1SPR8PMB112; H:VI1PR07MB4159.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-office365-filtering-correlation-id: 030f3609-a3d3-4c87-9a44-08d5d4f60423 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:VI1SPR8PMB112; x-ms-traffictypediagnostic: VI1SPR8PMB112: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1SPR8PMB112; BCL:0; PCL:0; RULEID:; SRVR:VI1SPR8PMB112; x-forefront-prvs: 0707248B64 received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5beNmDMrdeg5/p674JHLVoYaV9UgfTzYBnKT+/TJuQ0J76uHJ++p3g73fZJV51MtCwbjh+XsHfhwCm9R2tmHoK2nNEyFEixeSCp9kvM8gGJsmC8KxGJXFZQ1Ox8uftq5QxfQL+1+UpX4aNrXw9lS/v7nIH4ko6WWiTef/585W2+B2ye7iOAbNW1b6+sCHUiZC1SO0pF9p0t5d5gfPMn64mF3KuQpShPq5n7F0pIOpycHyXg6zsN/bEWOQrewp6Q6ot4nxez3G4YZ+Gl7EiXPgOfOWj9LuMv6O8ZgUy/qzKnIQqWI9UO6uwZE51+zIEX+ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 030f3609-a3d3-4c87-9a44-08d5d4f60423 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jun 2018 08:32:23.8778 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1SPR8PMB112 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42KZGbG9RFcyTz3a4OA3E4tXkxsYLY6e3sPs wOTx7OZ/Ro/n13pYApiiuGxSUnMyy1KL9O0SuDK2PmhiKXjgXrFqw07WBsYvrl2MnBwSAiYS czZ9Y+9i5OIQEjjKKLF74Wl2kISQwDdGid6pYRCJJUwS17v3MYMkWAQmMEs8OugAkZjAJLFm 20o2COcRo8Ta/zPBqtgEYiSeHZsENkpEQFri3eN3LCBFzAKdjBI7+26xgiSEBZwl5iyYzQZR 5CGxY/sEFghbT+LEz5/sEOtUJc5e2glWzytgL3G4rRPMZhQQk/h+ag0TiM0sIC5x68l8JoiH BCSW7DnPDGGLSrx8/A+qvkji3r0t7BBxJYnNM19A1ctKXJrfzQhhb2GSuDc/DcI2lDi+cj/U nG+sEj87KiFsX4nPDbfAPpYQOM4o8aG5CWqQlsTBTf9ZIexsiTunlgDFOYBsK4l5Z2IhwnIS q3ofskD07mOW+H5uG/sERoNZSH6YBdTCLKApsX6XPoTpIdH32xmiQlFiSvdD9lngkBCUODnz CcsCRtZVjKLFqcXFuelGRnqpRZnJxcX5eXp5qSWbGIHJ5OCW31Y7GA8+dzzEKMDBqMTDy+Gv Hi3EmlhWXJl7iFGCg1lJhFddBijEm5JYWZValB9fVJqTWnyIUZqDRUmc1ynNIkpIID2xJDU7 NbUgtQgmy8TBKdXAKFX1+rSkEMu1hut9BgHFpVYTJikncO3LcbJL+jnrp/scbZeJ29a7av15 G3lYPXjXumjlnsk764pSJ6pHP4roihJnO/pGaefjeYEb3l3Q5PHfYuB9TvX8RiluH5PF0592 vzFJNLqumPjdz7bzP9tFlytGMZIbIq668t3fU7lb4SDjz7edjz1TlViKMxINtZiLihMBC9l7 uSIDAAA= X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: "dev@openvswitch.org" , Nitin Katiyar Subject: [ovs-dev] [PATCH v2 1/2] Fix packet drops on LACP bond after link up 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Ben, Here are the v2 diffs. Hope this applies without any issue. Thanx Manu Signed-off-by: Manohar K C CC: Jan Scheurich CC: Nitin Katiyar --- v1 1/2: https://patchwork.ozlabs.org/patch/915285/ v2 1/2: Rebased to master lib/lacp.c | 14 ++++++++++++-- lib/lacp.h | 3 ++- ofproto/bond.c | 18 +++++++++++++++--- ofproto/ofproto-dpif-xlate.c | 13 ++++++++++++- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/lib/lacp.c b/lib/lacp.c index d6b36aa..9e43e06 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -154,6 +154,7 @@ static struct slave *slave_lookup(const struct lacp *, const void *slave) OVS_REQUIRES(mutex); static bool info_tx_equal(struct lacp_info *, struct lacp_info *) OVS_REQUIRES(mutex); +static bool slave_may_enable__(struct slave *slave) OVS_REQUIRES(mutex); static unixctl_cb_func lacp_unixctl_show; static unixctl_cb_func lacp_unixctl_show_stats; @@ -324,8 +325,8 @@ lacp_is_active(const struct lacp *lacp) OVS_EXCLUDED(mutex) /* Processes 'packet' which was received on 'slave_'. This function should be * called on all packets received on 'slave_' with Ethernet Type ETH_TYPE_LACP. */ -void -lacp_process_packet(struct lacp *lacp, const void *slave_, +bool +lacp_process_packet(struct lacp *lacp, const void *bond, const void *slave_, const struct dp_packet *packet) OVS_EXCLUDED(mutex) { @@ -333,6 +334,7 @@ lacp_process_packet(struct lacp *lacp, const void *slave_, const struct lacp_pdu *pdu; long long int tx_rate; struct slave *slave; + bool lacp_may_enable = false; lacp_lock(); slave = slave_lookup(lacp, slave_); @@ -362,8 +364,16 @@ lacp_process_packet(struct lacp *lacp, const void *slave_, slave->partner = pdu->actor; } + /* + * Evaluate may_enable here to avoid dropping of packets till main thread + * sets may_enable to true. + */ + lacp_may_enable = slave_may_enable__(slave); + out: lacp_unlock(); + + return lacp_may_enable; } /* Returns the lacp_status of the given 'lacp' object (which may be NULL). */ diff --git a/lib/lacp.h b/lib/lacp.h index f35cff5..1505c2c 100644 --- a/lib/lacp.h +++ b/lib/lacp.h @@ -46,7 +46,8 @@ struct lacp *lacp_ref(const struct lacp *); void lacp_configure(struct lacp *, const struct lacp_settings *); bool lacp_is_active(const struct lacp *); -void lacp_process_packet(struct lacp *, const void *slave, +bool lacp_process_packet(struct lacp *, const void *bond, + const void *slave, const struct dp_packet *packet); enum lacp_status lacp_status(const struct lacp *); diff --git a/ofproto/bond.c b/ofproto/bond.c index f87cdba..5fc1e0e 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -777,6 +777,7 @@ bond_check_admissibility(struct bond *bond, const void *slave_, { enum bond_verdict verdict = BV_DROP; struct bond_slave *slave; + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); ovs_rwlock_rdlock(&rwlock); slave = bond_slave_lookup(bond, slave_); @@ -794,7 +795,13 @@ bond_check_admissibility(struct bond *bond, const void *slave_, * drop all incoming traffic except if lacp_fallback_ab is enabled. */ switch (bond->lacp_status) { case LACP_NEGOTIATED: - verdict = slave->enabled ? BV_ACCEPT : BV_DROP; + /* + * To reduce packet-drops due to delay in enabling of slave (post + * LACP-SYNC), from main thread, check for may_enable as well. + * When may_enable is TRUE, it means LACP is UP and waiting for + * the main thread to run LACP state machine and enable the slave. + */ + verdict = (slave->enabled || slave->may_enable) ? BV_ACCEPT : BV_DROP; goto out; case LACP_CONFIGURED: if (!bond->lacp_fallback_ab) { @@ -830,8 +837,6 @@ bond_check_admissibility(struct bond *bond, const void *slave_, /* Drop all packets which arrive on backup slaves. This is similar to * how Linux bonding handles active-backup bonds. */ if (bond->active_slave != slave) { - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_DBG_RL(&rl, "active-backup bond received packet on backup" " slave (%s) destined for " ETH_ADDR_FMT, slave->name, ETH_ADDR_ARGS(eth_dst)); @@ -853,6 +858,13 @@ bond_check_admissibility(struct bond *bond, const void *slave_, OVS_NOT_REACHED(); out: + if (slave && (verdict != BV_ACCEPT)) { + VLOG_DBG_RL(&rl, "slave= %s actv-slave= %d may_enable %d enable %d " + "LACP %d verdict(A/D/M=0/1/2) %d\n", slave->name, + (bond->active_slave == slave), slave->may_enable, + slave->enabled, bond->lacp_status, verdict); + } + ovs_rwlock_unlock(&rwlock); return verdict; diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index c02a032..b49a223 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3189,6 +3189,7 @@ process_special(struct xlate_ctx *ctx, const struct xport *xport) const struct xbridge *xbridge = ctx->xbridge; const struct dp_packet *packet = ctx->xin->packet; enum slow_path_reason slow; + bool lacp_may_enable; if (!xport) { slow = 0; @@ -3209,7 +3210,17 @@ process_special(struct xlate_ctx *ctx, const struct xport *xport) } else if (xport->xbundle && xport->xbundle->lacp && flow->dl_type == htons(ETH_TYPE_LACP)) { if (packet) { - lacp_process_packet(xport->xbundle->lacp, xport->ofport, packet); + lacp_may_enable = lacp_process_packet(xport->xbundle->lacp, + xport->xbundle->bond, + xport->ofport, packet); + /* + * Update LACP status in bond-slave to avoid packet-drops until + * LACP state machine is run by the main thread. + */ + if (xport->xbundle->bond && lacp_may_enable) { + bond_slave_set_may_enable(xport->xbundle->bond, xport->ofport, + lacp_may_enable); + } } slow = SLOW_LACP; } else if ((xbridge->stp || xbridge->rstp) &&