[v2,1/2] net/bonding: in 8023ad mode enable all multicast rather than promiscuous

Message ID 1533203824-14430-1-git-send-email-radu.nicolau@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series [v2,1/2] net/bonding: in 8023ad mode enable all multicast rather than promiscuous |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Radu Nicolau Aug. 2, 2018, 9:57 a.m. UTC
  Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Matan Azrad Aug. 2, 2018, 10:21 a.m. UTC | #1
Hi Radu

From: Radu Nicolau
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
>  drivers/net/bonding/rte_eth_bond_8023ad.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c
> b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index f8cea4b..730087f 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -917,7 +917,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev
> *bond_dev,
>  	};
> 
>  	char mem_name[RTE_ETH_NAME_MAX_LEN];
> -	int socket_id;
> +	int socket_id, ret;
>  	unsigned element_size;
>  	uint32_t total_tx_desc;
>  	struct bond_tx_queue *bd_tx_q;
> @@ -942,7 +942,12 @@ bond_mode_8023ad_activate_slave(struct
> rte_eth_dev *bond_dev,
> 
>  	/* use this port as agregator */
>  	port->aggregator_port_id = slave_id;
> -	rte_eth_promiscuous_enable(slave_id);
> +
> +	/* try to enable multicast, if fail set promiscuous */
> +	rte_eth_allmulticast_enable(slave_id);
> +	ret = rte_eth_allmulticast_get(slave_id);
> +	if (ret != 1)
> +		rte_eth_promiscuous_enable(slave_id);

It is still greedy to configure allmulticast for LACP,
The user may not expect to get multicast traffic.

Moreover, here each slave can be with different unexpected configuration, may be even worst from the application perspective.

> 
>  	timer_cancel(&port->warning_timer);
> 
> --
> 2.7.5
  
Chas Williams Aug. 2, 2018, 9:16 p.m. UTC | #2
On Thu, Aug 2, 2018 at 6:03 AM Radu Nicolau <radu.nicolau@intel.com> wrote:

> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
>  drivers/net/bonding/rte_eth_bond_8023ad.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c
> b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index f8cea4b..730087f 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -917,7 +917,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev
> *bond_dev,
>         };
>
>         char mem_name[RTE_ETH_NAME_MAX_LEN];
> -       int socket_id;
> +       int socket_id, ret;
>         unsigned element_size;
>         uint32_t total_tx_desc;
>         struct bond_tx_queue *bd_tx_q;
> @@ -942,7 +942,12 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev
> *bond_dev,
>
>         /* use this port as agregator */
>         port->aggregator_port_id = slave_id;
> -       rte_eth_promiscuous_enable(slave_id);
> +
> +       /* try to enable multicast, if fail set promiscuous */
> +       rte_eth_allmulticast_enable(slave_id);
> +       ret = rte_eth_allmulticast_get(slave_id);
>

You should really try to use rte_eth_dev_set_mc_addr_list() first.
Luckily, bonding doesn't implement rte_eth_dev_set_mc_addr_list()
so you don't need to reserve a slot.


> +       if (ret != 1)
> +               rte_eth_promiscuous_enable(slave_id);
>
>         timer_cancel(&port->warning_timer);
>
> --
> 2.7.5
>
>
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index f8cea4b..730087f 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -917,7 +917,7 @@  bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,
 	};
 
 	char mem_name[RTE_ETH_NAME_MAX_LEN];
-	int socket_id;
+	int socket_id, ret;
 	unsigned element_size;
 	uint32_t total_tx_desc;
 	struct bond_tx_queue *bd_tx_q;
@@ -942,7 +942,12 @@  bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,
 
 	/* use this port as agregator */
 	port->aggregator_port_id = slave_id;
-	rte_eth_promiscuous_enable(slave_id);
+
+	/* try to enable multicast, if fail set promiscuous */
+	rte_eth_allmulticast_enable(slave_id);
+	ret = rte_eth_allmulticast_get(slave_id);
+	if (ret != 1)
+		rte_eth_promiscuous_enable(slave_id);
 
 	timer_cancel(&port->warning_timer);