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 026B1A00C5; Sun, 25 Sep 2022 12:35:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BC9C400D4; Sun, 25 Sep 2022 12:35:45 +0200 (CEST) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by mails.dpdk.org (Postfix) with ESMTP id B2AF64003F for ; Sun, 25 Sep 2022 12:35:42 +0200 (CEST) Received: by mail-qk1-f182.google.com with SMTP id x18so2629867qkn.6 for ; Sun, 25 Sep 2022 03:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=eVWnBbVGpWYH8jY6gflJH/0mGgA83z89Oy7sMi+XNTo=; b=bXAHylRGox8ZyEQDxnZxLMDOeiLNa5sp06vhTnGcYblFI4uM0OWTQeTmRwtxncWFm3 xVvvg8Irs3MLCrNn65Ab8sYTrjlvKoFm70A+uFQnNpc3t1C4ywrrpg6vVWBEkXusVbYD rPUocjwR4HRkt2hO9qnvV8yq8EYjc6Ms/XeUfpPi1oJUheXtBiXNkM+NJktuIC0KnBR9 1fxwA41LSu/N7KB80BsCxjIfig9pI5CQE9F8yt7GSEogykUlpEcPQnBE7Bc8lgSTvtWK a+73x/+Ny2hJ0wIoMH9PuKrQ0XdiOT6rg7E8sYbFuTdzD80j1/UnjWBSJ+7Ov+1+Vk+/ 2NRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=eVWnBbVGpWYH8jY6gflJH/0mGgA83z89Oy7sMi+XNTo=; b=3Xwak+mmGtSf+tcrx6UPEuARseVu3tsb1fWtgAJTTt3c9ET35TO0y48makeZP4HTkw vXh8mLgUKVRAkg6m5DUn1kzkl5gRyAx8Y3zj2Rcgxph0+YZhuu1E+4YCY5nVYr92U1aw mZaa8tznAkD5k1eNmkodqcIvbd4IOIF5owy+XQiS9bS6Ev7BhhSO6etV3TQR5ly8xVJv lof3qKJigZh4WHA6xsmvKqJi/hBklAKXbu2Pq+ycdS9C0yJJjPSi/HbAEOSQjb5fZW8/ iwEbjdeAinkhzax2Lm4E8TEGJi84GIC7EKhHcaDocXwvEeccONO0HaG1WkCVYKpCqYc7 ACGw== X-Gm-Message-State: ACrzQf2yr+sr0QLY7dCp//m57I+h/MEAl8MhDW2eS+RPSUK/HyFCiRy/ 4dgzBLCCGnlexckpKVHrEjIRUKusUWvFyg== X-Google-Smtp-Source: AMsMyM48onJbfRL0FWnPffF/x/V0mnUQUWRSYtPlpqgZtuLbv/XRrId0gl82Kcgm6VwINz912WwsLg== X-Received: by 2002:a05:620a:6018:b0:6cf:83ef:53c5 with SMTP id dw24-20020a05620a601800b006cf83ef53c5mr5830240qkb.646.1664102142311; Sun, 25 Sep 2022 03:35:42 -0700 (PDT) Received: from ?IPV6:2600:4040:225b:ea00:6063:8c9b:774a:6cf4? ([2600:4040:225b:ea00:6063:8c9b:774a:6cf4]) by smtp.googlemail.com with ESMTPSA id w7-20020ac857c7000000b0035bbb6268e2sm10063622qta.67.2022.09.25.03.35.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Sep 2022 03:35:42 -0700 (PDT) Message-ID: Date: Sun, 25 Sep 2022 06:35:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH V3] net/bonding: add link speeds configuration Content-Language: en-US To: Huisong Li , dev@dpdk.org Cc: ferruh.yigit@xilinx.com, andrew.rybchenko@oktetlabs.ru, huangdaode@huawei.com, liudongdong3@huawei.com References: <20220805031912.11729-1-lihuisong@huawei.com> <20220922013317.10051-1-lihuisong@huawei.com> From: Chas Williams <3chas3@gmail.com> In-Reply-To: <20220922013317.10051-1-lihuisong@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Thanks for making the changes! Signed-off-by: 3chas3@gmail.com On 9/21/22 21:33, Huisong Li wrote: > This patch adds link speeds configuration. > > --- > -v3: add an intersection of the supported speeds to check 'link_speeds'. > -v2: resend due to CI compiling failure. > > Signed-off-by: Huisong Li > --- > drivers/net/bonding/eth_bond_private.h | 3 +++ > drivers/net/bonding/rte_eth_bond_api.c | 3 +++ > drivers/net/bonding/rte_eth_bond_pmd.c | 27 ++++++++++++++++++++++++++ > 3 files changed, 33 insertions(+) > > diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h > index 8222e3cd38..d067ea8c9a 100644 > --- a/drivers/net/bonding/eth_bond_private.h > +++ b/drivers/net/bonding/eth_bond_private.h > @@ -131,6 +131,9 @@ struct bond_dev_private { > uint32_t link_down_delay_ms; > uint32_t link_up_delay_ms; > > + uint32_t speed_capa; > + /**< Supported speeds bitmap (RTE_ETH_LINK_SPEED_). */ > + > uint16_t nb_rx_queues; /**< Total number of rx queues */ > uint16_t nb_tx_queues; /**< Total number of tx queues*/ > > diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c > index 4ac191c468..e64ec0ed20 100644 > --- a/drivers/net/bonding/rte_eth_bond_api.c > +++ b/drivers/net/bonding/rte_eth_bond_api.c > @@ -513,6 +513,8 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) > internals->primary_port = slave_port_id; > internals->current_primary_port = slave_port_id; > > + internals->speed_capa = dev_info.speed_capa; > + > /* Inherit queues settings from first slave */ > internals->nb_rx_queues = slave_eth_dev->data->nb_rx_queues; > internals->nb_tx_queues = slave_eth_dev->data->nb_tx_queues; > @@ -527,6 +529,7 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) > } else { > int ret; > > + internals->speed_capa &= dev_info.speed_capa; > eth_bond_slave_inherit_dev_info_rx_next(internals, &dev_info); > eth_bond_slave_inherit_dev_info_tx_next(internals, &dev_info); > > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > index 3191158ca7..0adbf0e1b2 100644 > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > @@ -1717,6 +1717,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, > > slave_eth_dev->data->dev_conf.rxmode.mtu = > bonded_eth_dev->data->dev_conf.rxmode.mtu; > + slave_eth_dev->data->dev_conf.link_speeds = > + bonded_eth_dev->data->dev_conf.link_speeds; > > slave_eth_dev->data->dev_conf.txmode.offloads |= > bonded_eth_dev->data->dev_conf.txmode.offloads; > @@ -2275,6 +2277,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > > dev_info->reta_size = internals->reta_size; > dev_info->hash_key_size = internals->rss_key_len; > + dev_info->speed_capa = internals->speed_capa; > > return 0; > } > @@ -3591,6 +3594,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) > uint64_t offloads; > int arg_count; > uint16_t port_id = dev - rte_eth_devices; > + uint32_t link_speeds; > uint8_t agg_mode; > > static const uint8_t default_rss_key[40] = { > @@ -3659,6 +3663,29 @@ bond_ethdev_configure(struct rte_eth_dev *dev) > dev->data->dev_conf.txmode.offloads = offloads; > } > > + link_speeds = dev->data->dev_conf.link_speeds; > + /* > + * The default value of 'link_speeds' is zero. From its definition, > + * this value actually means auto-negotiation. But not all PMDs support > + * auto-negotiation. So ignore the check for the auto-negotiation and > + * only consider fixed speed to reduce the impact on PMDs. > + */ > + if (link_speeds & RTE_ETH_LINK_SPEED_FIXED) { > + if ((link_speeds & > + (internals->speed_capa & ~RTE_ETH_LINK_SPEED_FIXED)) == 0) { > + RTE_BOND_LOG(ERR, "the fixed speed is not supported by all slave devices."); > + return -EINVAL; > + } > + /* > + * Two '1' in binary of 'link_speeds': bit0 and a unique > + * speed bit. > + */ > + if (__builtin_popcountl(link_speeds) != 2) { > + RTE_BOND_LOG(ERR, "please set a unique speed."); > + return -EINVAL; > + } > + } > + > /* set the max_rx_pktlen */ > internals->max_rx_pktlen = internals->candidate_max_rx_pktlen; >