From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3F937A034C; Tue, 21 Dec 2021 20:58:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2442741150; Tue, 21 Dec 2021 20:58:10 +0100 (CET) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by mails.dpdk.org (Postfix) with ESMTP id 0D5B5410E6 for ; Tue, 21 Dec 2021 20:58:07 +0100 (CET) Received: by mail-qt1-f181.google.com with SMTP id a1so13896683qtx.11 for ; Tue, 21 Dec 2021 11:58:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ElSdkftuUDLqGmeithizJ8MNbXv4hF3Bob8ayOpDLyg=; b=nsV4ymoqQHnR+N1DICsUePn8DinFStrKDRQAKpUQeyqbaxWPykKXWQOpD/lGLnHaGC JTL84I648l8/tzGebvkDq9+GcFsYoCdYx5higl/qMqm8K9BDHwTfQGRt5nK94rcLO2BD fyzOWVS0cfqxaQ7NibpXKF2xFl0XIOwTq6fQb60jKCm1iDyk61/xKunvLZUitIgl6cqn dvt1b2NMgrvRe1jmaVSRh1D4nM72fntsFH6pXPj1YRVEVaJuolzMAoAX9tBl6F5C03cX 28/lpv7KeL/Jj8KrBHGR8QfG/1XDbfUpYFA+xSClz8P8ld6oeGTGR7Vx1jpTVidP+46x Sapg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ElSdkftuUDLqGmeithizJ8MNbXv4hF3Bob8ayOpDLyg=; b=n5hHztemaYmrCQhWKv8qrkHFGuiJ2KmV9opn5hIANSvIj7dG/7zQ+3iBio8L9FuEq/ asr2P2UIu85jjyy4BgkrzPmiOgRinjFemv5fT2fXzjWNhKG/AcghKVspDt7OeUNrgOOm Bsrt5Gx8iEeJ+ZC8n2yf4P7uerfu6mdoYNj63y4hxruAms9/oC++PTEZ/XHrHkxub1BD 78xyjutvReKcPW8UQmaqK/abKleO2tLxoGbHXZrrIz488l4etZCPBItmLYJzvFs0MGo9 qU7EHbxaOQ9LB5LONuGzcicpeECV7dFHhjCAnOljD2uWI7NxoBcWNczbwltDMVY9dIFN NxCg== X-Gm-Message-State: AOAM531E697IyGdyvZPifkbTfQuI38UN7EhJbgX0n8iFCs1ftUNpxwXv 72mvOX+56LV9xrAGE4I0kffTL17YpDgYWQ== X-Google-Smtp-Source: ABdhPJzIfiDE+2MFBzHFz03ExsoNR2qh96QnuZT6ceF2jTC52Hi0zh7qOYmX9fCCg4KJoGO23tdfRQ== X-Received: by 2002:ac8:5c8e:: with SMTP id r14mr3753274qta.395.1640116686421; Tue, 21 Dec 2021 11:58:06 -0800 (PST) Received: from ubuntu.localdomain (99-153-167-175.lightspeed.ftldfl.sbcglobal.net. [99.153.167.175]) by smtp.gmail.com with ESMTPSA id h3sm14684401qko.78.2021.12.21.11.58.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Dec 2021 11:58:06 -0800 (PST) From: Robert Sanford X-Google-Original-From: Robert Sanford To: dev@dpdk.org Cc: chas3@att.com, humin29@huawei.com, bruce.richardson@intel.com Subject: [PATCH v2 4/8] net/bonding: support enabling LACP short timeout Date: Tue, 21 Dec 2021 14:57:26 -0500 Message-Id: <1640116650-3475-5-git-send-email-rsanford@akamai.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1640116650-3475-1-git-send-email-rsanford@akamai.com> References: <1639592401-56845-2-git-send-email-rsanford@akamai.com> <1640116650-3475-1-git-send-email-rsanford@akamai.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org - Add support for enabling LACP short timeout, i.e., link partner can use fast periodic time interval between transmits. Signed-off-by: Robert Sanford --- drivers/net/bonding/eth_bond_8023ad_private.h | 3 ++- drivers/net/bonding/rte_eth_bond_8023ad.c | 28 +++++++++++++++++++++++---- drivers/net/bonding/rte_eth_bond_8023ad.h | 3 +++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h index 60db31e..bfde03c 100644 --- a/drivers/net/bonding/eth_bond_8023ad_private.h +++ b/drivers/net/bonding/eth_bond_8023ad_private.h @@ -159,7 +159,6 @@ struct mode8023ad_private { uint64_t rx_marker_timeout; uint64_t update_timeout_us; rte_eth_bond_8023ad_ext_slowrx_fn slowrx_cb; - uint8_t external_sm; struct rte_ether_addr mac_addr; struct rte_eth_link slave_link; @@ -178,6 +177,8 @@ struct mode8023ad_private { uint16_t tx_qid; } dedicated_queues; enum rte_bond_8023ad_agg_selection agg_selection; + uint8_t short_timeout_enabled : 1; + uint8_t short_timeout_updated : 1; }; /** diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 9ed2a46..5c175e7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -868,10 +868,10 @@ bond_mode_8023ad_periodic_cb(void *arg) struct rte_eth_link link_info; struct rte_ether_addr slave_addr; struct rte_mbuf *lacp_pkt = NULL; + uint8_t short_timeout_updated = internals->mode4.short_timeout_updated; uint16_t slave_id; uint16_t i; - /* Update link status on each port */ for (i = 0; i < internals->active_slave_count; i++) { uint16_t key; @@ -916,6 +916,13 @@ bond_mode_8023ad_periodic_cb(void *arg) slave_id = internals->active_slaves[i]; port = &bond_mode_8023ad_ports[slave_id]; + if (short_timeout_updated) { + if (internals->mode4.short_timeout_enabled) + ACTOR_STATE_SET(port, LACP_SHORT_TIMEOUT); + else + ACTOR_STATE_CLR(port, LACP_SHORT_TIMEOUT); + } + if ((port->actor.key & rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) == 0) { @@ -960,6 +967,9 @@ bond_mode_8023ad_periodic_cb(void *arg) show_warnings(slave_id); } + if (short_timeout_updated) + internals->mode4.short_timeout_updated = 0; + rte_eal_alarm_set(internals->mode4.update_timeout_us, bond_mode_8023ad_periodic_cb, arg); } @@ -1054,7 +1064,6 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, /* Given slave must not be in active list. */ RTE_ASSERT(find_slave_by_id(internals->active_slaves, internals->active_slave_count, slave_id) == internals->active_slave_count); - RTE_SET_USED(internals); /* used only for assert when enabled */ memcpy(&port->actor, &initial, sizeof(struct port_params)); /* Standard requires that port ID must be greater than 0. @@ -1065,7 +1074,9 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, memcpy(&port->partner_admin, &initial, sizeof(struct port_params)); /* default states */ - port->actor_state = STATE_AGGREGATION | STATE_LACP_ACTIVE | STATE_DEFAULTED; + port->actor_state = STATE_AGGREGATION | STATE_LACP_ACTIVE | + STATE_DEFAULTED | (internals->mode4.short_timeout_enabled ? + STATE_LACP_SHORT_TIMEOUT : 0); port->partner_state = STATE_LACP_ACTIVE | STATE_AGGREGATION; port->sm_flags = SM_FLAGS_BEGIN; @@ -1209,6 +1220,7 @@ bond_mode_8023ad_conf_get(struct rte_eth_dev *dev, struct mode8023ad_private *mode4 = &internals->mode4; uint64_t ms_ticks = rte_get_tsc_hz() / 1000; + memset(conf, 0, sizeof(*conf)); conf->fast_periodic_ms = mode4->fast_periodic_timeout / ms_ticks; conf->slow_periodic_ms = mode4->slow_periodic_timeout / ms_ticks; conf->short_timeout_ms = mode4->short_timeout / ms_ticks; @@ -1219,6 +1231,7 @@ bond_mode_8023ad_conf_get(struct rte_eth_dev *dev, conf->rx_marker_period_ms = mode4->rx_marker_timeout / ms_ticks; conf->slowrx_cb = mode4->slowrx_cb; conf->agg_selection = mode4->agg_selection; + conf->lacp_timeout_control = mode4->short_timeout_enabled; } static void @@ -1234,6 +1247,7 @@ bond_mode_8023ad_conf_get_default(struct rte_eth_bond_8023ad_conf *conf) conf->update_timeout_ms = BOND_MODE_8023AX_UPDATE_TIMEOUT_MS; conf->slowrx_cb = NULL; conf->agg_selection = AGG_STABLE; + conf->lacp_timeout_control = 0; } static void @@ -1274,6 +1288,11 @@ bond_mode_8023ad_setup(struct rte_eth_dev *dev, mode4->slowrx_cb = conf->slowrx_cb; mode4->agg_selection = AGG_STABLE; + if (mode4->short_timeout_enabled != conf->lacp_timeout_control) { + mode4->short_timeout_enabled = conf->lacp_timeout_control; + mode4->short_timeout_updated = 1; + } + if (dev->data->dev_started) bond_mode_8023ad_start(dev); } @@ -1478,7 +1497,8 @@ bond_8023ad_setup_validate(uint16_t port_id, conf->aggregate_wait_timeout_ms == 0 || conf->tx_period_ms == 0 || conf->rx_marker_period_ms == 0 || - conf->update_timeout_ms == 0) { + conf->update_timeout_ms == 0 || + conf->lacp_timeout_control > 1) { RTE_BOND_LOG(ERR, "given mode 4 configuration is invalid"); return -EINVAL; } diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index 7e9a018..87f6b2f 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -139,6 +139,9 @@ struct rte_eth_bond_8023ad_conf { uint32_t update_timeout_ms; rte_eth_bond_8023ad_ext_slowrx_fn slowrx_cb; enum rte_bond_8023ad_agg_selection agg_selection; + uint8_t lacp_timeout_control; + /**< LACPDU.Actor_State.LACP_Timeout flag: 0=Long 1=Short. */ + uint8_t reserved_8s[3]; }; struct rte_eth_bond_8023ad_slave_info { -- 2.7.4