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 50AF4C3DA6E for ; Mon, 18 Dec 2023 02:51:52 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D363340282; Mon, 18 Dec 2023 03:51:50 +0100 (CET) Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) by mails.dpdk.org (Postfix) with ESMTP id 4388340269 for ; Mon, 18 Dec 2023 03:51:49 +0100 (CET) Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-35fb4159ee2so771795ab.0 for ; Sun, 17 Dec 2023 18:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702867908; x=1703472708; darn=dpdk.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=H8xMOL6Y7Lr1tJwlXdpxo77h2mCuLN+EHd4lb0xaEes=; b=h0Tv1LoopuONl3k/fuWFUVAcL5QGNAqAy8OpK7lhtI/BCaQfrAdp9WM5VtoVr7UaH7 P1boS4vYO4QINpuj6tC80oZGsT4N0eJP0MaAS2HDIOezZRdot9OprWRfzsYvgMztD5Qv 4Hqvyn85/QzvY/jc421MfFlD4Dbkb74kDE6oOoc7ohZ4at+W6JBxP6Fn6BVW6ZYqAz2L sTIW/RfR4MbWQEJ91AcnYzZGGoRU4ZFyIVUz44NuJhB7vjPREKIa8mLgl8wTHk4mUIpo lV882Xu5ofnjmd5ltk5lM9F0248Cdpqazl6VXf4xM4+EC1IqTMG9Gf7VQ7AfQ+yFIEDJ Cmcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702867908; x=1703472708; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=H8xMOL6Y7Lr1tJwlXdpxo77h2mCuLN+EHd4lb0xaEes=; b=wKkXRj+aLEMoDwyCvKPORgNpE3NWnZmSRN987hjLfby2icK86T+WU3mpQUqz9uS+Od +K3G0UK2ZvLzVWmfO5lJXY0b9lqOEeIaxYwdOMilX6eNqqg8Q/mmBORMObBtzTV22rb0 eomS7C2MQVNKy8s0HAAoidc6LQM1DYDNV+QK2ikToI7xjlWtk/UlZ2bn1LUkQ82N7qcj zThJhr1gnk+qGkCSNYB5QU80xQ7LU5DOgdOS+R8KuLAyIrcDMqEruRf1Xw9NmBDE9k5x ryxuIC3d/7y0jsacrQolYGAgsu6M7QMCOLABF9Cse738j7R7S1lujjC0IqJcJhUusI1q fAaw== X-Gm-Message-State: AOJu0YymLWl7pV+c+j6I9VmoKpHtcAWQcEU8jBTfa9k1Vl/Ha6qCOrfQ t8wL1PjF/4Y9HSEuawgZStbA/rKMHe6367Dw8TaNhe+iXnv2nQ== X-Google-Smtp-Source: AGHT+IEQ05Pe6Ys2TDU4G+YphzPHbWeGgYaZmmYESP3ul33cJ2/rpCqnr4T07WC52vWA5yz7rfMBAJSzKEqZoXue0oU= X-Received: by 2002:a05:6e02:1545:b0:35f:a2a8:cf4c with SMTP id j5-20020a056e02154500b0035fa2a8cf4cmr5439605ilu.46.1702867907916; Sun, 17 Dec 2023 18:51:47 -0800 (PST) MIME-Version: 1.0 From: Simon Jones Date: Mon, 18 Dec 2023 10:51:36 +0800 Message-ID: Subject: [BUG] [bonding] bonding member delete bug To: dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000c0378c060cbfd49b" 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 --000000000000c0378c060cbfd49b Content-Type: text/plain; charset="UTF-8" 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=dpdk options:dpdk-devargs=net_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 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_started = 1;", but no one add active member port, 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 = 1; for (i = 0; i < internals->slave_count; i++) { if (slave_configure(eth_dev, slave_ethdev) != 0) { if (slave_start(eth_dev, slave_ethdev) != 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 = 0; i < internals->slave_count; i++) { if (find_slave_by_id(internals->active_slaves, internals->active_slave_count, slave_id) != internals->active_slave_count) { ret = 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_stop for every member, even it's DOWN. How about this? Thanks~ ---- Simon Jones --000000000000c0378c060cbfd49b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

I'm using DPDK-2= 1.11 in ovs-dpdk.

I found a "bonding member d= elete bug" .

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

### step 1, Add bonding device bond= 0.
bondctl add bond0 mode active-backup

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

### step 3, Add bond0 into o= vs bridge.
ovs-vsctl add-port brp0 bond0 -- set interface bond0 t= ype=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 bon= d0
(this command call @bond_ethdev_stop at last.)

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

### step 6, Delete bond0.
bondctl del bond0

### step 7, Add bon= d0.
bondctl add bond0 mode active-backup

=
### step 8, Add member m1 into=C2=A0bond0.
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 con= figurr
ation
2023-12-15T08:24:04.153Z|00018|dpdk|ERR|bond_cmd_set_mas= ter(581) - can not confii
g slave 0000:00:0a.0!
```
<= div>
2. Debug

I found the reason is,= when member port is DOWN, then add operation will call "eth_dev->d= ata->dev_started =3D 1;", but no one add active member port, so whe= n delete bond0, will NOT call=C2=A0@rte_eth_dev_stop, then add bond0 again,= got error. Detail is:
```
### After step 1-3, add bond= 0 into ovs-dpdk
bond_ethdev_start
=C2=A0 =C2=A0 eth_dev->da= ta->dev_started =3D 1;
=C2=A0 =C2=A0 for (i =3D 0; i < internals-&= gt;slave_count; i++) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (slave_configure(e= th_dev, slave_ethdev) !=3D 0) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (slave_st= art(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@act= ivate_slave, so=C2=A0@active_slave_count is 0.
bond_ethdev_lsc_ev= ent_callback
=C2=A0 =C2=A0 activate_slave(bonded_eth_dev, port_id);
<= br>### After step 4, delete bond0 from ovs-dpdk, NOTICE, as=C2=A0@active_sl= ave_count is 0, so will NOT call=C2=A0@rte_eth_dev_stop
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_s= lave_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 internals->active_slave_count) {<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D rte_eth_dev_stop(slave= _id);

### Aft= er step 5-7, delete bond0 and then add bond0

### A= fter step 8, add bond0, as it's NOT call=C2=A0@rte_eth_dev_stop, so call=C2=A0@rte_eth_dev_start agai= n will got error.
2023-12-15T08:24:04.153Z|00017|dpdk|ERR|Por= t 0 must be stopped to allow configurr
ation

```

3. My quest= ion

Is this bug fixed ? Which commit ?

If NOT, how to fix this bug? I think it's better to call=C2=A0@rte_eth_dev_stop f= or every member, even it's DOWN. How about this?

Thanks~


----
Simon Jones
--000000000000c0378c060cbfd49b--