From patchwork Mon Jun 5 12:23:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1790410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bNNGo6hV; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QZXpL2W16z20QH for ; Mon, 5 Jun 2023 22:23:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 55C2D40530; Mon, 5 Jun 2023 12:23:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 55C2D40530 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bNNGo6hV X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kYaVuFOrX3Jo; Mon, 5 Jun 2023 12:23:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 41F9B401E1; Mon, 5 Jun 2023 12:23:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 41F9B401E1 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 181D1C0037; Mon, 5 Jun 2023 12:23:48 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9ABF0C0029 for ; Mon, 5 Jun 2023 12:23:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 81A9C40350 for ; Mon, 5 Jun 2023 12:23:46 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 81A9C40350 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W8UMIfcw13ex for ; Mon, 5 Jun 2023 12:23:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 26DD1401E1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 26DD1401E1 for ; Mon, 5 Jun 2023 12:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685967823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ygLlBSSddjO5sZdYMS18qtQzYqPo2sFKEDsm9s9yEis=; b=bNNGo6hVNWTSu8dVDH1qg89dxFwlQtiySNCOcWzjdpsIkN6tMI4Y0SjdDMtMtBPotlTD4R hpayC2kPtd0WBBFylv6Nnibz16jn7DWFNl0khPnsKCdYpKKQwJ4vE7HCTCHMNbNd5omi9N 7srTIP6dEvEJFdAE6ZA7mggXyyfmCK8= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-121-J964YNdjMG2PQkidGxibAA-1; Mon, 05 Jun 2023 08:23:42 -0400 X-MC-Unique: J964YNdjMG2PQkidGxibAA-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-4ec817fb123so3182247e87.3 for ; Mon, 05 Jun 2023 05:23:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685967821; x=1688559821; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ygLlBSSddjO5sZdYMS18qtQzYqPo2sFKEDsm9s9yEis=; b=S4fIZziyNx2nxx6KbdzTrucp+MXS3/2R38XFs5FveVnmRC4tx14JCbOe8+9uRdu7IB OH6wfK0g4r//Nn1OAw9SrIk1TSx/DcDsfWXbmEyfTDAAur0hY4WV8+HHRXJj4fC14z69 8F9K/1s0ke+Eg+t2plHQJYX7rxsVJBk0CTbCG744YIUIg/nXbJorSzZVwjtVjkdTfNwp MUShuCcwgFkDspyeXn8IxSpdfuFszDrL+HY8CoMQUyoNOOEZstBlP5ZFM0OIOJQ5RFxf dJEH2vSTJswlRkvzOF39yS1/tlmUWUjJvtPV56d+tf3Nl0PY8I8+xlJPk5opMftM9Xd+ QuwA== X-Gm-Message-State: AC+VfDx8DP9x7ViVGUj3/69KYHcgoVoL7AtKVWNwdWP2ZtmqJGBuO7/r 8c6KkyfDR0eMjiVLiq7LXkZ+0CuvtN2OtMtEq8bA4EIQKqR9ixNdxRfvMu1sIQpYO155CwehByF hQpCpveii4x+S2kHw8WXT260Lwk9fd2T9j8FMjjOgjsJPWZKUyd4RpGoMTWJM8zRbfaB8Y6jG+m KloJkJfCWyBcfJ X-Received: by 2002:ac2:532a:0:b0:4f3:8196:80cb with SMTP id f10-20020ac2532a000000b004f3819680cbmr5015846lfh.41.1685967821021; Mon, 05 Jun 2023 05:23:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5HQRNQkA/IhkRfOp9RkTZPgu8knlAazqtweRb5zsKdc3NRMdDL7pgoHH42VOSQgj2f5r1Bsg== X-Received: by 2002:ac2:532a:0:b0:4f3:8196:80cb with SMTP id f10-20020ac2532a000000b004f3819680cbmr5015825lfh.41.1685967820530; Mon, 05 Jun 2023 05:23:40 -0700 (PDT) Received: from localhost (net-130-25-106-149.cust.vodafonedsl.it. [130.25.106.149]) by smtp.gmail.com with ESMTPSA id s19-20020a7bc393000000b003f4248dcfcbsm14392548wmj.30.2023.06.05.05.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 05:23:39 -0700 (PDT) From: Lorenzo Bianconi To: ovs-dev@openvswitch.org Date: Mon, 5 Jun 2023 14:23:32 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: jlibosva@redhat.com Subject: [ovs-dev] [PATCH ovn] controller: make garp_max_timeout configurable X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When using VLAN backed networks and OVN routers leveraging the 'ovn-chassis-mac-mappings' option for east-west traffic, the eth.src field is replaced by the chassis mac address in order to not expose the router mac address from different nodes and confuse the TOR switch. However doing so the TOR switch is not able to learn the port/mac bindings for routed E/W traffic and it is force to always flood it. Fix this issue adding the capability to configure a given timeout for garp sent by ovn-controller and not disable it after the exponential backoff in order to keep refreshing the entries in TOR swtich fdb table. More into about the issue can be found here [0]. [0] https://mail.openvswitch.org/pipermail/ovs-discuss/2020-September/050678.html Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2087779 Signed-off-by: Lorenzo Bianconi --- controller/ovn-controller.c | 5 ++++- controller/pinctrl.c | 41 ++++++++++++++++++++++++++++++------- controller/pinctrl.h | 4 +++- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 3a81a13fb..1b1a8ba1f 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1028,6 +1028,7 @@ ctrl_register_ovs_idl(struct ovsdb_idl *ovs_idl) * calls are after the "non-track" calls. */ ovsdb_idl_add_table(ovs_idl, &ovsrec_table_open_vswitch); ovsdb_idl_add_column(ovs_idl, &ovsrec_open_vswitch_col_other_config); + ovsdb_idl_add_column(ovs_idl, &ovsrec_open_vswitch_col_external_ids); ovsdb_idl_add_column(ovs_idl, &ovsrec_open_vswitch_col_bridges); ovsdb_idl_add_column(ovs_idl, &ovsrec_open_vswitch_col_datapaths); ovsdb_idl_add_table(ovs_idl, &ovsrec_table_interface); @@ -5339,7 +5340,9 @@ main(int argc, char *argv[]) &runtime_data->local_datapaths, &runtime_data->active_tunnels, &runtime_data->local_active_ports_ipv6_pd, - &runtime_data->local_active_ports_ras); + &runtime_data->local_active_ports_ras, + ovsrec_open_vswitch_table_get( + ovs_idl_loop.idl)); stopwatch_stop(PINCTRL_RUN_STOPWATCH_NAME, time_msec()); mirror_run(ovs_idl_txn, diff --git a/controller/pinctrl.c b/controller/pinctrl.c index c396ad4c2..389c5f6a9 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -165,6 +165,7 @@ VLOG_DEFINE_THIS_MODULE(pinctrl); static struct ovs_mutex pinctrl_mutex = OVS_MUTEX_INITIALIZER; static struct seq *pinctrl_handler_seq; static struct seq *pinctrl_main_seq; +static long long int garp_rarp_max_timeout = LLONG_MAX; static void *pinctrl_handler(void *arg); @@ -226,7 +227,8 @@ static void send_garp_rarp_prepare( const struct ovsrec_bridge *, const struct sbrec_chassis *, const struct hmap *local_datapaths, - const struct sset *active_tunnels) + const struct sset *active_tunnels, + const struct ovsrec_open_vswitch_table *ovs_table) OVS_REQUIRES(pinctrl_mutex); static void send_garp_rarp_run(struct rconn *swconn, long long int *send_garp_rarp_time) @@ -3491,7 +3493,8 @@ pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn, const struct hmap *local_datapaths, const struct sset *active_tunnels, const struct shash *local_active_ports_ipv6_pd, - const struct shash *local_active_ports_ras) + const struct shash *local_active_ports_ras, + const struct ovsrec_open_vswitch_table *ovs_table) { ovs_mutex_lock(&pinctrl_mutex); run_put_mac_bindings(ovnsb_idl_txn, sbrec_datapath_binding_by_key, @@ -3502,7 +3505,7 @@ pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn, send_garp_rarp_prepare(ovnsb_idl_txn, sbrec_port_binding_by_datapath, sbrec_port_binding_by_name, sbrec_mac_binding_by_lport_ip, br_int, chassis, - local_datapaths, active_tunnels); + local_datapaths, active_tunnels, ovs_table); prepare_ipv6_ras(local_active_ports_ras, sbrec_port_binding_by_name); prepare_ipv6_prefixd(ovnsb_idl_txn, sbrec_port_binding_by_name, local_active_ports_ipv6_pd, chassis, @@ -4423,7 +4426,8 @@ send_garp_rarp_update(struct ovsdb_idl_txn *ovnsb_idl_txn, struct ovsdb_idl_index *sbrec_mac_binding_by_lport_ip, const struct hmap *local_datapaths, const struct sbrec_port_binding *binding_rec, - struct shash *nat_addresses) + struct shash *nat_addresses, + long long int garp_max_timeout) { volatile struct garp_rarp_data *garp_rarp = NULL; @@ -4449,6 +4453,9 @@ send_garp_rarp_update(struct ovsdb_idl_txn *ovnsb_idl_txn, if (garp_rarp) { garp_rarp->dp_key = binding_rec->datapath->tunnel_key; garp_rarp->port_key = binding_rec->tunnel_key; + if (garp_max_timeout != garp_rarp_max_timeout) { + garp_rarp->announce_time = time_msec() + 1000; + } } else { add_garp_rarp(name, laddrs->ea, laddrs->ipv4_addrs[i].addr, @@ -4473,6 +4480,9 @@ send_garp_rarp_update(struct ovsdb_idl_txn *ovnsb_idl_txn, if (garp_rarp) { garp_rarp->dp_key = binding_rec->datapath->tunnel_key; garp_rarp->port_key = binding_rec->tunnel_key; + if (garp_max_timeout != garp_rarp_max_timeout) { + garp_rarp->announce_time = time_msec() + 1000; + } } else { add_garp_rarp(name, laddrs->ea, 0, binding_rec->datapath->tunnel_key, @@ -4492,6 +4502,9 @@ send_garp_rarp_update(struct ovsdb_idl_txn *ovnsb_idl_txn, if (garp_rarp) { garp_rarp->dp_key = binding_rec->datapath->tunnel_key; garp_rarp->port_key = binding_rec->tunnel_key; + if (garp_max_timeout != garp_rarp_max_timeout) { + garp_rarp->announce_time = time_msec() + 1000; + } return; } @@ -4581,6 +4594,8 @@ send_garp_rarp(struct rconn *swconn, struct garp_rarp_data *garp_rarp, if (garp_rarp->backoff < 16) { garp_rarp->backoff *= 2; garp_rarp->announce_time = current_time + garp_rarp->backoff * 1000; + } else if (garp_rarp_max_timeout != LLONG_MAX) { + garp_rarp->announce_time = current_time + garp_rarp_max_timeout; } else { garp_rarp->announce_time = LLONG_MAX; } @@ -5880,13 +5895,21 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, const struct ovsrec_bridge *br_int, const struct sbrec_chassis *chassis, const struct hmap *local_datapaths, - const struct sset *active_tunnels) + const struct sset *active_tunnels, + const struct ovsrec_open_vswitch_table *ovs_table) OVS_REQUIRES(pinctrl_mutex) { struct sset localnet_vifs = SSET_INITIALIZER(&localnet_vifs); struct sset local_l3gw_ports = SSET_INITIALIZER(&local_l3gw_ports); struct sset nat_ip_keys = SSET_INITIALIZER(&nat_ip_keys); struct shash nat_addresses; + unsigned long long garp_max_timeout = LLONG_MAX; + const struct ovsrec_open_vswitch *cfg = + ovsrec_open_vswitch_table_first(ovs_table); + if (cfg) { + garp_max_timeout = smap_get_ullong( + &cfg->external_ids, "garp-max-timeout", LLONG_MAX); + } shash_init(&nat_addresses); @@ -5917,7 +5940,8 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, if (pb) { send_garp_rarp_update(ovnsb_idl_txn, sbrec_mac_binding_by_lport_ip, - local_datapaths, pb, &nat_addresses); + local_datapaths, pb, &nat_addresses, + garp_max_timeout); } } @@ -5928,7 +5952,8 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, = lport_lookup_by_name(sbrec_port_binding_by_name, gw_port); if (pb) { send_garp_rarp_update(ovnsb_idl_txn, sbrec_mac_binding_by_lport_ip, - local_datapaths, pb, &nat_addresses); + local_datapaths, pb, &nat_addresses, + garp_max_timeout); } } @@ -5946,6 +5971,8 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, shash_destroy(&nat_addresses); sset_destroy(&nat_ip_keys); + + garp_rarp_max_timeout = garp_max_timeout; } static bool diff --git a/controller/pinctrl.h b/controller/pinctrl.h index 279a49fbc..23343f097 100644 --- a/controller/pinctrl.h +++ b/controller/pinctrl.h @@ -30,6 +30,7 @@ struct ovsdb_idl; struct ovsdb_idl_index; struct ovsdb_idl_txn; struct ovsrec_bridge; +struct ovsrec_open_vswitch_table; struct sbrec_chassis; struct sbrec_dns_table; struct sbrec_controller_event_table; @@ -57,7 +58,8 @@ void pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn, const struct hmap *local_datapaths, const struct sset *active_tunnels, const struct shash *local_active_ports_ipv6_pd, - const struct shash *local_active_ports_ras); + const struct shash *local_active_ports_ras, + const struct ovsrec_open_vswitch_table *ovs_table); void pinctrl_wait(struct ovsdb_idl_txn *ovnsb_idl_txn); void pinctrl_destroy(void); void pinctrl_set_br_int_name(const char *br_int_name);