DPDK patches and discussions
 help / color / mirror / Atom feed
* [bugfix] set same mac of bond slave
@ 2024-04-30  1:17 Simon Jones
  2024-04-30  3:37 ` Stephen Hemminger
  2024-04-30 15:55 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Jones @ 2024-04-30  1:17 UTC (permalink / raw)
  To: dev

[-- Attachment #1: Type: text/plain, Size: 2118 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3029 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bugfix] set same mac of bond slave
  2024-04-30  1:17 [bugfix] set same mac of bond slave Simon Jones
@ 2024-04-30  3:37 ` Stephen Hemminger
  2024-04-30  6:37   ` Simon Jones
  2024-04-30 15:55 ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2024-04-30  3:37 UTC (permalink / raw)
  To: Simon Jones; +Cc: dev

On Tue, 30 Apr 2024 09:17:30 +0800
Simon Jones <batmanustc@gmail.com> wrote:

> 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>

This won't apply to current DPDK since slave has been renamed to member.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bugfix] set same mac of bond slave
  2024-04-30  3:37 ` Stephen Hemminger
@ 2024-04-30  6:37   ` Simon Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Jones @ 2024-04-30  6:37 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

OK

Does you mean that, need this patch to set same mac, but change
"internals->slaves" to "internals->members".

What I want to say is, in my test (DPDK-21.11), bond mac is NOT same in
802.3ad mode.
So when bond connect to some SWITCH, will it NOT work?
So I want to set same mac, and discuss here if it's necessary.

----
Simon Jones


Stephen Hemminger <stephen@networkplumber.org> 于2024年4月30日周二 11:37写道:

> On Tue, 30 Apr 2024 09:17:30 +0800
> Simon Jones <batmanustc@gmail.com> wrote:
>
> > 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>
>
> This won't apply to current DPDK since slave has been renamed to member.
>

[-- Attachment #2: Type: text/html, Size: 2072 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [bugfix] set same mac of bond slave
  2024-04-30  1:17 [bugfix] set same mac of bond slave Simon Jones
  2024-04-30  3:37 ` Stephen Hemminger
@ 2024-04-30 15:55 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2024-04-30 15:55 UTC (permalink / raw)
  To: Simon Jones; +Cc: dev

On Tue, 30 Apr 2024 09:17:30 +0800
Simon Jones <batmanustc@gmail.com> wrote:

> +               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);

This patch looks wrong. If you read bond_mode_8023ad_mac_address_update() it
expects each member to have different address.

Other modes, already set all members of the bond to have the same mac address.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-30 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30  1:17 [bugfix] set same mac of bond slave Simon Jones
2024-04-30  3:37 ` Stephen Hemminger
2024-04-30  6:37   ` Simon Jones
2024-04-30 15:55 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).