From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> 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 <dev@dpdk.org>; Tue, 30 Apr 2024 03:17:43 +0200 (CEST) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1eab16c8d83so41155995ad.3 for <dev@dpdk.org>; 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 <batmanustc@gmail.com> Date: Tue, 30 Apr 2024 09:17:30 +0800 Message-ID: <CAOE=1Z1+oQmrofXh7t4fEzCNL_DrHO8iYZ7r2TKym56cyJoA=A@mail.gmail.com> 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 <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=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 <batmanustc@gmail.com> Date: Mon Apr 29 18:44:18 2024 +0800 Bugfix, config same mac address of bond slave. Signed-off-by: Simon Jones <batmanustc@gmail.com> 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 <div dir=3D"ltr"><div>Hi, all</div><div><br></div><div>Should bond slave ne= ed set same mac address?</div><div>Like this patch does:=C2=A0<a href=3D"ht= tps://github.com/batmancn/dpdk/commit/a484ac3f407a6a22d4eb63da23e98e8e76833= 722">https://github.com/batmancn/dpdk/commit/a484ac3f407a6a22d4eb63da23e98e= 8e76833722</a></div><div>```</div><div>commit a484ac3f407a6a22d4eb63da23e98= e8e76833722 (HEAD -> bugfix-bond-same-mac-20240429, batmancn/bugfix-bond= -same-mac-20240429)<br>Author: batmancn <<a href=3D"mailto:batmanustc@gm= ail.com">batmanustc@gmail.com</a>><br>Date: =C2=A0 Mon Apr 29 18:44:18 2= 024 +0800<br><br>=C2=A0 =C2=A0 Bugfix, config same mac address of bond slav= e.<br>=C2=A0 =C2=A0 <br>=C2=A0 =C2=A0 Signed-off-by: Simon Jones <<a hre= f=3D"mailto:batmanustc@gmail.com">batmanustc@gmail.com</a>><br><br>diff = --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_et= h_bond_pmd.c<br>index c40d18d128..0387a9b2aa 100644<br>--- a/drivers/net/bo= nding/rte_eth_bond_pmd.c<br>+++ b/drivers/net/bonding/rte_eth_bond_pmd.c<br= >@@ -1562,6 +1562,15 @@ mac_address_members_update(struct rte_eth_dev *bond= ing_eth_dev)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<b= r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>=C2=A0 = =C2=A0 =C2=A0 =C2=A0 case BONDING_MODE_8023AD:<br>+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (i =3D 0; i < internals->slave_count;= i++) {<br>+ =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(<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 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)) {<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 RTE_BOND= _LOG(ERR, "Failed to update port Id %d MAC address",<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 =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 return -1;<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 }<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 }<br>=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);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 case BOND= ING_MODE_ACTIVE_BACKUP:<br>diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethde= v/rte_ethdev.c<br>index f1c658f49e..c3f8b8d01e 100644<br>--- a/lib/ethdev/r= te_ethdev.c<br>+++ b/lib/ethdev/rte_ethdev.c<br>@@ -1746,7 +1746,8 @@ rte_e= th_dev_start(uint16_t port_id)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 return ret;<br>=C2=A0<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Lets= restore MAC now if device does not support live change */<br>- =C2=A0 =C2= =A0 =C2=A0 if (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR)<br>+ = =C2=A0 =C2=A0 =C2=A0 if ((*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_= ADDR) &&<br>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !(*d= ev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE))<br>=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 eth_dev_mac_restore(dev, &dev_info);= <br>=C2=A0<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 diag =3D (*dev->dev_ops->de= v_start)(dev);<br>~<br></div><div>```</div><br clear=3D"all"><div><div dir= =3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div = dir=3D"ltr"><div><div dir=3D"ltr"><div>----</div>Simon Jones</div></div></d= iv></div></div></div> --000000000000f736b60617462232--