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 E3EED43F4E; Tue, 30 Apr 2024 03:17:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A2C2402A8; Tue, 30 Apr 2024 03:17:45 +0200 (CEST) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 8F5F640262 for ; Tue, 30 Apr 2024 03:17:43 +0200 (CEST) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1eab16c8d83so41155995ad.3 for ; Mon, 29 Apr 2024 18:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714439862; x=1715044662; darn=dpdk.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=o0zHPMSWF5OgM+d+NG2jiKnRHchwVhjI7Pw7/KrGSPE=; b=EkAr60IagH4VHn65n7TJFLEvWgY2oPHPT8hTggcP/muGG/ht+8oBqgX0eX8b3o9TqJ Sr3pQoGm/8ACYXYuCHiTou10HvRwml90IoMLY/koRpR+ljGlHvY74O6dWQON/l1iYgwJ D21Xh9tJ5X900qiW/YG6rHfzo8fZEMNVqwsy1wmiOtWRxMdJ+eVBpxlyWpUouSOZ5/hQ R7O8sXnUbQRoclBvwPhPUEpT+L8W+YIqjWAktz7MlSdPNHSQjxRdBACRMX09qFoG5zE3 rNj8TxGF9keLO4l0xfFAgfO1xt77KL/IZZWTlrBhBnZBJmVDfsRz9jRJuufYGrUZjkaw nHVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714439862; x=1715044662; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=o0zHPMSWF5OgM+d+NG2jiKnRHchwVhjI7Pw7/KrGSPE=; b=X7eftcGJVJIkUtwdg5j3tzTQZ9SeM9Cj8r3FcphvEZi1Nduqfntfummzt7hl3ac1s6 FG9lEVXzrkXSvApLdef4lkAQzMMESDvBe5uAGqofMMylcQqqUEdjei5evodI48hXE6ht 7lFWNOwt2z1HqnbAehKxinZuYWGtq7eGHplztk10pOTofnT/TSQvT10xTlicLQxfffQc awTazugZwoBH7SvqzeIJHEaJOY7Xv1GLoa10pSpDj5YOP140mfpSWRcAeLoPOLOXIRx4 LcrWDLJ5l5/ccgGwEFukFFcc3nUyBWaCmrE5sn3EdKgee1ZYUudPenAxTAZhIWXX68gK IE2A== X-Gm-Message-State: AOJu0Yyaqgfx4NF4wWNv3cMtSkrkyxvbPIylK07FXuYNQynDmYsEwSHD daeGqSerVA4yQ8bN9E9b1fdolO7rbMzSWWF/87B2dBQ58z4dBmPgRlSLO7v5YTV/gevwr83+MkL sefRdToeR7Fzt2Rb4OjBNhTF5vdAJbCdnVXT8cg== X-Google-Smtp-Source: AGHT+IFRl64CW3z9BeVKc2L1lHPEZgBFImbi5r6+ilh1ArMeDM55ueevdACrkCiz8rfHytRVesCIecKVXgo4qZ2BHnM= X-Received: by 2002:a17:903:40ca:b0:1e2:9ac2:4a03 with SMTP id t10-20020a17090340ca00b001e29ac24a03mr14707936pld.28.1714439862038; Mon, 29 Apr 2024 18:17:42 -0700 (PDT) MIME-Version: 1.0 From: Simon Jones Date: Tue, 30 Apr 2024 09:17:30 +0800 Message-ID: Subject: [bugfix] set same mac of bond slave To: dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000f736b60617462232" 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 --000000000000f736b60617462232 Content-Type: text/plain; charset="UTF-8" Hi, all Should bond slave need set same mac address? Like this patch does: https://github.com/batmancn/dpdk/commit/a484ac3f407a6a22d4eb63da23e98e8e76833722 ``` commit a484ac3f407a6a22d4eb63da23e98e8e76833722 (HEAD -> bugfix-bond-same-mac-20240429, batmancn/bugfix-bond-same-mac-20240429) Author: batmancn Date: Mon Apr 29 18:44:18 2024 +0800 Bugfix, config same mac address of bond slave. Signed-off-by: Simon Jones diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index c40d18d128..0387a9b2aa 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1562,6 +1562,15 @@ mac_address_members_update(struct rte_eth_dev *bonding_eth_dev) } break; case BONDING_MODE_8023AD: + for (i = 0; i < internals->slave_count; i++) { + if (rte_eth_dev_default_mac_addr_set( + internals->slaves[i].port_id, + bonded_eth_dev->data->mac_addrs)) { + RTE_BOND_LOG(ERR, "Failed to update port Id %d MAC address", + internals->slaves[i].port_id); + return -1; + } + } bond_mode_8023ad_mac_address_update(bonding_eth_dev); break; case BONDING_MODE_ACTIVE_BACKUP: diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index f1c658f49e..c3f8b8d01e 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1746,7 +1746,8 @@ rte_eth_dev_start(uint16_t port_id) return ret; /* Lets restore MAC now if device does not support live change */ - if (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR) + if ((*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR) && + !(*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE)) eth_dev_mac_restore(dev, &dev_info); diag = (*dev->dev_ops->dev_start)(dev); ~ ``` ---- Simon Jones --000000000000f736b60617462232 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, all

Should bond slave ne= ed set same mac address?
```
commit a484ac3f407a6a22d4eb63da23e98= e8e76833722 (HEAD -> bugfix-bond-same-mac-20240429, batmancn/bugfix-bond= -same-mac-20240429)
Author: batmancn <batmanustc@gmail.com>
Date: =C2=A0 Mon Apr 29 18:44:18 2= 024 +0800

=C2=A0 =C2=A0 Bugfix, config same mac address of bond slav= e.
=C2=A0 =C2=A0
=C2=A0 =C2=A0 Signed-off-by: Simon Jones <batmanustc@gmail.com>

diff = --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_et= h_bond_pmd.c
index c40d18d128..0387a9b2aa 100644
--- a/drivers/net/bo= nding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c@@ -1562,6 +1562,15 @@ mac_address_members_update(struct rte_eth_dev *bond= ing_eth_dev)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 case BONDING_MODE_8023AD:
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (i =3D 0; i < internals->slave_count;= i++) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 if (rte_eth_dev_default_mac_addr_set(
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =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->slaves[i].port_id,<= br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bonded_eth_d= ev->data->mac_addrs)) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_BOND= _LOG(ERR, "Failed to update port Id %d MAC address",
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =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->slaves[i].port_id);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 return -1;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 }
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bond_mode_= 8023ad_mac_address_update(bonding_eth_dev);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 case BOND= ING_MODE_ACTIVE_BACKUP:
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethde= v/rte_ethdev.c
index f1c658f49e..c3f8b8d01e 100644
--- a/lib/ethdev/r= te_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1746,7 +1746,8 @@ rte_e= th_dev_start(uint16_t port_id)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 return ret;
=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Lets= restore MAC now if device does not support live change */
- =C2=A0 =C2= =A0 =C2=A0 if (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR)
+ = =C2=A0 =C2=A0 =C2=A0 if ((*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_= ADDR) &&
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !(*d= ev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE))
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 eth_dev_mac_restore(dev, &dev_info);=
=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 diag =3D (*dev->dev_ops->de= v_start)(dev);
~
```

----
Simon Jones
--000000000000f736b60617462232--