From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40E17C35274 for ; Mon, 18 Dec 2023 06:37:41 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18BEF40276; Mon, 18 Dec 2023 07:37:40 +0100 (CET) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 7DDCD4026A for ; Mon, 18 Dec 2023 07:37:38 +0100 (CET) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5ca1b4809b5so639806a12.3 for ; Sun, 17 Dec 2023 22:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702881457; x=1703486257; darn=dpdk.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=LVAxvCQ/UYlbM07htFJjguFHh1msH3I5tDKXV9RaqCQ=; b=EQ9yrJ2PFmYGkxZ875fQ3Y7VQD9KOAj24+N5i+Zb/ZlQKMnfCeK5UXT4E//i8lQXBb /rvbzV+JHntpLkfXqNstHCdBkVLo0V1kqvfQZ3lkMRRBv4p7ro0mQJhH8b88y9kZ8RRJ 15COD5HkpBmrC53jE1yYKPAyHpE/kDFt9zfRhDALiN4+WjVJ0U12jhIDQkSHWL95Ntxk MqL9N9/P1sA7MOhSfbDPCOCnC/MOBhRQXwLu19MejIfGZaG96Os9S1u4/cIinJOyq6IK vbq+oC6RjU+EHvA53F/LH08RryjpbX118f2NPu05IReYAarZbIwm8ZEPFmbbZC32u6+W Av2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702881457; x=1703486257; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LVAxvCQ/UYlbM07htFJjguFHh1msH3I5tDKXV9RaqCQ=; b=NQaaK/WBJV5vx3OVHHgFxrvidfAQJsSQgS3a90K1VTEXwLNaleQ43o1st8+qPiFeHd n6O8+YZtDdBGMiRh6Y5MwZCWo0p80iFAKbx0xxVL3ist1hzcllpql/ZxB2gbM/6aFHSV PDyLHw8iEzd4dyh01ZoEAYQ64V/snHUnbDtxtg2B2GAxJ2Ih/K+9c+BpP1QixZhid9n6 N7eQlalnI63wzd4hg2GzcaqUww0Ib5P5Bg58oMAfi+0Z/IHpm4XpKOJS53qZXoaj7Fct 7B3SjABKNKnHo0eHpB3FsgXg4TgasDcU8Am968YvMKV6QjqiQdjpnFpvPQqnlapmFV3H xjhQ== X-Gm-Message-State: AOJu0Yx/csbo1OvwGUWRG2KNUQ+rODvkm4j6iGAqjzeFS9dBe2zqeCuM X+jAPrLUPw+k3Ta2AOY2Xh3iPMBIKxwc2b8xHxc8H/Aw6AMGmw== X-Google-Smtp-Source: AGHT+IGDy7T01lERdBJf5fyVfFaaHgJ46BZsDA0IQoC8WSPKLZASZbUYcfydgmUwEMt8dypO3atffhp/GTG05D6NT4E= X-Received: by 2002:a05:6a20:a107:b0:18f:97c:4f68 with SMTP id q7-20020a056a20a10700b0018f097c4f68mr8914733pzk.116.1702881456793; Sun, 17 Dec 2023 22:37:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Simon Jones Date: Mon, 18 Dec 2023 14:37:25 +0800 Message-ID: Subject: Re: [BUG] [bonding] bonding member delete bug To: dev@dpdk.org Content-Type: multipart/alternative; boundary="00000000000053b029060cc2fc7f" 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 --00000000000053b029060cc2fc7f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Oh, it's fixed by 0911d4ec and f5e72e8e ---- Simon Jones Simon Jones =E4=BA=8E2023=E5=B9=B412=E6=9C=8818=E6= =97=A5=E5=91=A8=E4=B8=80 10:51=E5=86=99=E9=81=93=EF=BC=9A > Hi all, > > I'm using DPDK-21.11 in ovs-dpdk. > > I found a "bonding member delete bug" . > > 1. How to reproduce > > ``` > NOTICE: bondctl is a tool I develop, it's to control DPDK. > > ### step 1, Add bonding device bond0. > bondctl add bond0 mode active-backup > > ### step 2, Add member m1 into bond0. > bondctl set 0000:00:0a.0 master bond0 > > ### step 3, Add bond0 into ovs bridge. > ovs-vsctl add-port brp0 bond0 -- set interface bond0 type=3Ddpdk > options:dpdk-devargs=3Dnet_bonding-bond0 > (this command call @bond_ethdev_start at last.) > > ### step 4, Delete bond0 from ovs bridge. > ovs-vsctl del-port br-phy bond0 > (this command call @bond_ethdev_stop at last.) > > ### step 5, Delete m1 from bond0. > bondctl set 0000:00:0a.0 nomaster > > ### step 6, Delete bond0. > bondctl del bond0 > > ### step 7, Add bond0. > bondctl add bond0 mode active-backup > > ### step 8, Add member m1 into bond0. > bondctl set 0000:00:0a.0 master bond0 > (this command call @bond_ethdev_start at last.) > > ### Then got error message. > 2023-12-15T08:24:04.153Z|00017|dpdk|ERR|Port 0 must be stopped to allow > configurr > ation > 2023-12-15T08:24:04.153Z|00018|dpdk|ERR|bond_cmd_set_master(581) - can no= t > confii > g slave 0000:00:0a.0! > ``` > > 2. Debug > > I found the reason is, when member port is DOWN, then add operation will > call "eth_dev->data->dev_started =3D 1;", but no one add active member po= rt, > so when delete bond0, will NOT call @rte_eth_dev_stop, then add bond0 > again, got error. Detail is: > ``` > ### After step 1-3, add bond0 into ovs-dpdk > bond_ethdev_start > eth_dev->data->dev_started =3D 1; > for (i =3D 0; i < internals->slave_count; i++) { > if (slave_configure(eth_dev, slave_ethdev) !=3D 0) { > if (slave_start(eth_dev, slave_ethdev) !=3D 0) { > rte_eth_dev_start > > ### NOTICE, as member port is DOWN, so will NOT call @activate_slave, > so @active_slave_count is 0. > bond_ethdev_lsc_event_callback > activate_slave(bonded_eth_dev, port_id); > > ### After step 4, delete bond0 from ovs-dpdk, NOTICE, > as @active_slave_count is 0, so will NOT call @rte_eth_dev_stop > bond_ethdev_stop > for (i =3D 0; i < internals->slave_count; i++) { > if (find_slave_by_id(internals->active_slaves, > internals->active_slave_count, slave_id) !=3D > internals->active_slave_count) { > ret =3D rte_eth_dev_stop(slave_id); > > ### After step 5-7, delete bond0 and then add bond0 > > ### After step 8, add bond0, as it's NOT call @rte_eth_dev_stop, so call = @rte_eth_dev_start > again will got error. > 2023-12-15T08:24:04.153Z|00017|dpdk|ERR|Port 0 must be stopped to allow > configurr > ation > > ``` > > 3. My question > > Is this bug fixed ? Which commit ? > > If NOT, how to fix this bug? I think it's better to call @rte_eth_dev_sto= p > for every member, even it's DOWN. How about this? > > Thanks~ > > > ---- > Simon Jones > --00000000000053b029060cc2fc7f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Oh, it's fixed by=C2=A00911d4ec and f5e72e8e
----
Simo= n Jones


Simon Jones <batmanustc@gmail.com> =E4=BA=8E2023=E5=B9=B412= =E6=9C=8818=E6=97=A5=E5=91=A8=E4=B8=80 10:51=E5=86=99=E9=81=93=EF=BC=9A
=
Hi all,

I'm using DPDK-21.11 in ovs-dpdk.

I found a "bonding member delete bug" .

1. How to reproduce

```
NOTICE: bondctl is a tool I develop, it's to control DPDK.

### step 1, Add bonding device bond0.
bondct= l add bond0 mode active-backup

### step 2, Add mem= ber m1 into=C2=A0bond0.
bondctl set 0000:00:0a.0 master bond0=C2= =A0

### step 3, Add bond0 into ovs bridge.
ovs-vsctl add-port brp0 bond0 -- set interface bond0 type=3Ddpdk options= :dpdk-devargs=3Dnet_bonding-bond0
(this command call @bond_ethdev= _start at last.)

### step 4, Delete bond0 from= ovs bridge.
ovs-vsctl del-port br-phy bond0
(this= command call @bond_ethdev_stop at last.)

##= # step 5, Delete m1 from bond0.
bondctl set 0000:00:0a.0 nomaster=

### step 6, Delete bond0.
bondctl d= el bond0

### step 7, Add bond0.
bond= ctl add bond0 mode active-backup

### step 8, A= dd member m1 into=C2=A0bond0.
bondctl set 0000:00:0a.0 master bon= d0
(this command call @bond_ethdev_start at last.)
<= div>
### Then got error message.
2023-12-15T08:24:0= 4.153Z|00017|dpdk|ERR|Port 0 must be stopped to allow configurr
ation2023-12-15T08:24:04.153Z|00018|dpdk|ERR|bond_cmd_set_master(581) - can not= confii
g slave 0000:00:0a.0!
```

2. Debug

I found the reason is, when member port = is DOWN, then add operation will call "eth_dev->data->dev_starte= d =3D 1;", but no one add active member port, so when delete bond0, wi= ll NOT call=C2=A0@rte_eth_dev_stop, then add bond0 again, got error. Detail= is:
```
### After step 1-3, add bond0 into ovs-dpdk
bond_ethdev_start
=C2=A0 =C2=A0 eth_dev->data->dev_started= =3D 1;
=C2=A0 =C2=A0 for (i =3D 0; i < internals->slave_count; i+= +) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (slave_configure(eth_dev, slave_ethd= ev) !=3D 0) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (slave_start(eth_dev, slave= _ethdev) !=3D 0) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rte_eth_dev= _start

### NOTICE, as member port is DOWN, so will NOT call=C2=A0@activate_slave, so=C2=A0@active_slave_count is 0.
= bond_ethdev_stop
=C2=A0 =C2=A0 for (i =3D 0; i < internals->slave_= count; i++) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (find_slave_by_id(internals= ->active_slaves,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 internals->active_slave_count, slave_id) !=3D
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 internal= s->active_slave_count) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 re= t =3D rte_eth_dev_stop(slave_id);

### After step 5-7, delete bond0 and then add bond0

### After step 8, add bond0, as it's NOT call=C2= =A0@rte_eth_dev_stop, so call=C2=A0@rte_eth_dev_start again w= ill got error.
2023-12-15T08:24:04.153Z|00017|dpdk|ERR|Port 0= must be stopped to allow configurr
ation

```

3. My question=

Is this bug fixed ? Which commit ?

<= div>If NOT, how to fix this bug? I think it's better to call=C2=A0= @rte_eth_dev_stop for every member, even it's DOWN. How about this?
=
Thanks~


----=
Simon Jones
--00000000000053b029060cc2fc7f--