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 92E46A00C5; Tue, 15 Feb 2022 11:32:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 284C6410F3; Tue, 15 Feb 2022 11:32:57 +0100 (CET) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by mails.dpdk.org (Postfix) with ESMTP id 0FF2B40E78 for ; Tue, 15 Feb 2022 11:32:55 +0100 (CET) Received: by mail-ej1-f41.google.com with SMTP id hw13so14674312ejc.9 for ; Tue, 15 Feb 2022 02:32:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6OKG8JKfgLaNzDpMmMNmf6NU9JUrkZHi+DTlgyCFU/w=; b=OHvdslpJetiT+yZvplqRW4aPtYusbk8wpDrRNSGAL+aIja8amF1CNUQngmLADXFJ3U P6+T7AIhyDI0vqgaJ1VH6MqQuKrb9/VoaYocS5ityx6WQUAnymTR97nHbPlovWhTwbPh T7hezK0dx/TVslatVp0c6hsTLU/N94WZdVH0+W8ZQ8ztOK01X9VTGN6BrjT+k8MjeQe1 F3MuZPv0Yza1R12mxklrNT1xv7C349zlttXh0F/w8ZCfGo7cD8i4Y5JOwP0DBrcs10bU IJwIdXg85tjMWdHgXVwde3ctKZA/IFDkF/a6PnpxigCXmHA1XaMfawBTOjU4PYZD+dhh u8mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6OKG8JKfgLaNzDpMmMNmf6NU9JUrkZHi+DTlgyCFU/w=; b=yDGkpgmc+HJz5UGTLUmwQDnTWoZN60KOkElMIDyD3daWd/vsO3+pu/1xnFZZGflbHZ wwsHISkQXMVQjR8y1E9ba2ponWH+ED4hCfd1npYL94uFRIaLAUItBk7WSg8/K0sc8DXA rt+mlCWPftEUc6InmGHhsFScu51bCI/GeDZbNpwr2NqZL5t7FgxwPBfabezt4y9qx0hI 7ipruXQ2QYIBE8eJ2WfGk9AuBwNc9BFlt+3a3/Q6VobRsgVyAA6xYBClF5qDbjGpCk7W o6hi+4YTw5KdSgbUTqpuItE0a6yI778so77nqRPs52ONEgsuDdnxM7Irkat3YwpnrGB9 E2iA== X-Gm-Message-State: AOAM532YwN+B19e3kkOkU8yKHbyOMnWKQ9QSrverGslNHKmdYcJLkDcS Z/d+ESkFJW2ebGXOuYYt4Jo2wj+5RlBy512dnUYHUQ== X-Google-Smtp-Source: ABdhPJwtxShQrdjhVvIJiNlZUOdrDsPWKEW2Mx+FIdJGJcKz499AUbYD+dxqSR2vxVGr5/egpkkS63dsL4WT81A+YNk= X-Received: by 2002:a17:907:7ba4:: with SMTP id ne36mr2377885ejc.79.1644921175397; Tue, 15 Feb 2022 02:32:55 -0800 (PST) MIME-Version: 1.0 References: <20220214081344.13637-1-wanjunjie@bytedance.com> <20220214081344.13637-2-wanjunjie@bytedance.com> In-Reply-To: From: Wan Junjie Date: Tue, 15 Feb 2022 18:32:44 +0800 Message-ID: Subject: Re: [External] Re: [PATCH 2/2] net/bonding: fix slaves initilizing on mtu setting To: "Min Hu (Connor)" Cc: dev@dpdk.org, Chas Williams Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hi Min Hu, On Tue, Feb 15, 2022 at 5:26 PM Min Hu (Connor) wrote: > > Hi, wan, > two comments: > 1. wrong spelling in headline Will fix it in v2. > 2. comment info should be detailed, such as, > show the testpmd commands about how to operate > in this two situations. > Testpmd did not show the issue here. to reproduce, we need call the api by the sequence: rte_eth_dev_configure rte_eth_dev_set_mtu queue setup and start ... for dpdk application, pass the device --vdev=3D"net_bonding0,mode=3D2,slave=3D0000:af:00.0" Then application will complain for the slave device, that "Port 0 must be configured before MTU set" Will add it to commit msg in v2 Regards, Wan Junjie > Thanks. > > =E5=9C=A8 2022/2/14 16:13, Wan Junjie =E5=86=99=E9=81=93: > > When initializing a bonding device with all slaves in vdev string, > > which means bonding device initilizes slaves, instead of initializing > > slaves before creating the bonding device, it will fail to call > > set_mtu api for the bonding device. > > > > Fixes:b26bee1 ("ethdev: forbid MTU set before device configure") > > > > Signed-off-by: Wan Junjie > > --- > > app/test/test_link_bonding.c | 4 +++ > > app/test/test_link_bonding_rssconf.c | 4 +++ > > drivers/net/bonding/eth_bond_private.h | 4 +++ > > drivers/net/bonding/rte_eth_bond_api.c | 6 ++++ > > drivers/net/bonding/rte_eth_bond_pmd.c | 43 ++++++++++++++++++++++---= - > > 5 files changed, 55 insertions(+), 6 deletions(-) > > > > diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.= c > > index dc6fc46b9c..12c50ef393 100644 > > --- a/app/test/test_link_bonding.c > > +++ b/app/test/test_link_bonding.c > > @@ -181,6 +181,10 @@ configure_ethdev(uint16_t port_id, uint8_t start, = uint8_t en_isr) > > test_params->nb_tx_q, &default_pmd_conf), > > "rte_eth_dev_configure for port %d failed", port_= id); > > > > + int ret =3D rte_eth_dev_set_mtu(port_id, 1550); > > + RTE_TEST_ASSERT(ret =3D=3D 0 || ret =3D=3D -ENOTSUP, > > + "rte_eth_dev_set_mtu for port %d failed", port_id= ); > > + > > for (q_id =3D 0; q_id < test_params->nb_rx_q; q_id++) > > TEST_ASSERT_SUCCESS(rte_eth_rx_queue_setup(port_id, q_id,= RX_RING_SIZE, > > rte_eth_dev_socket_id(port_id), &rx_conf_= default, > > diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_= bonding_rssconf.c > > index f9eae93973..7228965ced 100644 > > --- a/app/test/test_link_bonding_rssconf.c > > +++ b/app/test/test_link_bonding_rssconf.c > > @@ -128,6 +128,10 @@ configure_ethdev(uint16_t port_id, struct rte_eth_= conf *eth_conf, > > RXTX_QUEUE_COUNT, eth_conf) =3D=3D 0, "Failed to = configure device %u", > > port_id); > > > > + int ret =3D rte_eth_dev_set_mtu(port_id, 1550); > > + RTE_TEST_ASSERT(ret =3D=3D 0 || ret =3D=3D -ENOTSUP, > > + "rte_eth_dev_set_mtu for port %d failed", port_id= ); > > + > > for (rxq =3D 0; rxq < RXTX_QUEUE_COUNT; rxq++) { > > TEST_ASSERT(rte_eth_rx_queue_setup(port_id, rxq, RXTX_RIN= G_SIZE, > > rte_eth_dev_socket_id(port_id), NULL, > > diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bondi= ng/eth_bond_private.h > > index 156335c425..8222e3cd38 100644 > > --- a/drivers/net/bonding/eth_bond_private.h > > +++ b/drivers/net/bonding/eth_bond_private.h > > @@ -246,6 +246,10 @@ int > > slave_configure(struct rte_eth_dev *bonded_eth_dev, > > struct rte_eth_dev *slave_eth_dev); > > > > +int > > +slave_start(struct rte_eth_dev *bonded_eth_dev, > > + struct rte_eth_dev *slave_eth_dev); > > + > > void > > slave_remove(struct bond_dev_private *internals, > > struct rte_eth_dev *slave_eth_dev); > > diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bondi= ng/rte_eth_bond_api.c > > index b78867b125..4ac191c468 100644 > > --- a/drivers/net/bonding/rte_eth_bond_api.c > > +++ b/drivers/net/bonding/rte_eth_bond_api.c > > @@ -566,6 +566,12 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_por= t_id, uint16_t slave_port_id) > > slave_port_id); > > return -1; > > } > > + if (slave_start(bonded_eth_dev, slave_eth_dev) !=3D 0) { > > + internals->slave_count--; > > + RTE_BOND_LOG(ERR, "rte_bond_slaves_start: port=3D= %d", > > + slave_port_id); > > + return -1; > > + } > > } > > > > /* Update all slave devices MACs */ > > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bondi= ng/rte_eth_bond_pmd.c > > index aa6519f83c..c31b723071 100644 > > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > > @@ -1678,14 +1678,10 @@ int > > slave_configure(struct rte_eth_dev *bonded_eth_dev, > > struct rte_eth_dev *slave_eth_dev) > > { > > - struct bond_rx_queue *bd_rx_q; > > - struct bond_tx_queue *bd_tx_q; > > uint16_t nb_rx_queues; > > uint16_t nb_tx_queues; > > > > int errval; > > - uint16_t q_id; > > - struct rte_flow_error flow_error; > > > > struct bond_dev_private *internals =3D bonded_eth_dev->data->dev_= private; > > > > @@ -1758,6 +1754,19 @@ slave_configure(struct rte_eth_dev *bonded_eth_d= ev, > > slave_eth_dev->data->port_id, errval); > > return errval; > > } > > + return 0; > > +} > > + > > +int > > +slave_start(struct rte_eth_dev *bonded_eth_dev, > > + struct rte_eth_dev *slave_eth_dev) > > +{ > > + int errval =3D 0; > > + struct bond_rx_queue *bd_rx_q; > > + struct bond_tx_queue *bd_tx_q; > > + uint16_t q_id; > > + struct rte_flow_error flow_error; > > + struct bond_dev_private *internals =3D bonded_eth_dev->data->dev_= private; > > > > /* Setup Rx Queues */ > > for (q_id =3D 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id+= +) { > > @@ -1806,10 +1815,13 @@ slave_configure(struct rte_eth_dev *bonded_eth_= dev, > > return errval; > > } > > > > - if (internals->mode4.dedicated_queues.flow[slave_eth_dev-= >data->port_id] !=3D NULL) > > - rte_flow_destroy(slave_eth_dev->data->port_id, > > + if (internals->mode4.dedicated_queues.flow[slave_eth_dev-= >data->port_id] !=3D NULL) { > > + errval =3D rte_flow_destroy(slave_eth_dev->data->= port_id, > > internals->mode4.dedicated_queues= .flow[slave_eth_dev->data->port_id], > > &flow_error); > > + RTE_BOND_LOG(ERR, "bond_ethdev_8023ad_flow_destro= y: port=3D%d, err (%d)", > > + slave_eth_dev->data->port_id, errval); > > + } > > > > errval =3D bond_ethdev_8023ad_flow_set(bonded_eth_dev, > > slave_eth_dev->data->port_id); > > @@ -2001,6 +2013,13 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) > > internals->slaves[i].port_id); > > goto out_err; > > } > > + if (slave_start(eth_dev, slave_ethdev) !=3D 0) { > > + RTE_BOND_LOG(ERR, > > + "bonded port (%d) failed to start slave d= evice (%d)", > > + eth_dev->data->port_id, > > + internals->slaves[i].port_id); > > + goto out_err; > > + } > > /* We will need to poll for link status if any slave does= n't > > * support interrupts > > */ > > @@ -3849,6 +3868,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev) > > return -1; > > } > > > > + /* configure slaves so we can pass mtu setting */ > > + for (i =3D 0; i < internals->slave_count; i++) { > > + struct rte_eth_dev *slave_ethdev =3D > > + &(rte_eth_devices[internals->slaves[i].po= rt_id]); > > + if (slave_configure(dev, slave_ethdev) !=3D 0) { > > + RTE_BOND_LOG(ERR, > > + "bonded port (%d) failed to configure sla= ve device (%d)", > > + dev->data->port_id, > > + internals->slaves[i].port_id); > > + return -1; > > + } > > + } > > return 0; > > } > > > >