patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 17.11] net/bonding: fix reset active slave
@ 2019-07-19  8:42 Rybalchenko, Kirill
  2019-07-23  1:25 ` Yongseok Koh
  0 siblings, 1 reply; 2+ messages in thread
From: Rybalchenko, Kirill @ 2019-07-19  8:42 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: stable

From: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>

[ backported from upstream commit 7f949ae391527200266afa59097317ef0047111e ]

test_alb_reply_from_client test fails due to incorrect active slave array's index. This was due to invalid active slave count.

Count of internals->active_slave is not updated even when active slave is deactivated.
Hence active slave count always keeps incrementing beyond the actual active slaves.

Fix is to set the internals->active_slave to starting index 0 whenever it exceeds the number of slaves in active slave list and also update the active slave count during slave de-activation.

Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness")
Cc: stable@dpdk.org

Signed-off-by: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com
Acked-by: Chas Williams <chas3@att.com>
---
 drivers/net/bonding/rte_eth_bond_api.c | 6 ++++++  drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index f4ca0a3..5f46dff 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -158,6 +158,12 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
        RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves));
        internals->active_slave_count = active_count;

+       /* Resetting active_slave when reaches to max
+        * no of slaves in active list
+        */
+       if (internals->active_slave >= active_count)
+               internals->active_slave = 0;
+
        if (eth_dev->data->dev_started) {
                if (internals->mode == BONDING_MODE_8023AD) {
                        bond_mode_8023ad_start(eth_dev); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 44cf61b..410f9d5 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -111,7 +111,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
                        active_slave = 0;
        }

-       if (++internals->active_slave == slave_count)
+       if (++internals->active_slave >= slave_count)
                internals->active_slave = 0;
        return num_rx_total;
 }
@@ -315,7 +315,7 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,
                        active_slave = 0;
        }

-       if (++internals->active_slave == slave_count)
+       if (++internals->active_slave >= slave_count)
                internals->active_slave = 0;

        return num_rx_total;
@@ -494,7 +494,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
                        idx = 0;
        }

-       if (++internals->active_slave == slave_count)
+       if (++internals->active_slave >= slave_count)
                internals->active_slave = 0;

        return num_rx_total;
--
2.7.4


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

* Re: [dpdk-stable] [PATCH 17.11] net/bonding: fix reset active slave
  2019-07-19  8:42 [dpdk-stable] [PATCH 17.11] net/bonding: fix reset active slave Rybalchenko, Kirill
@ 2019-07-23  1:25 ` Yongseok Koh
  0 siblings, 0 replies; 2+ messages in thread
From: Yongseok Koh @ 2019-07-23  1:25 UTC (permalink / raw)
  To: Rybalchenko, Kirill; +Cc: stable


> On Jul 19, 2019, at 1:42 AM, Rybalchenko, Kirill <kirill.rybalchenko@intel.com> wrote:
> 
> From: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
> 
> [ backported from upstream commit 7f949ae391527200266afa59097317ef0047111e ]
> 
> test_alb_reply_from_client test fails due to incorrect active slave array's index. This was due to invalid active slave count.
> 
> Count of internals->active_slave is not updated even when active slave is deactivated.
> Hence active slave count always keeps incrementing beyond the actual active slaves.
> 
> Fix is to set the internals->active_slave to starting index 0 whenever it exceeds the number of slaves in active slave list and also update the active slave count during slave de-activation.
> 
> Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
> Acked-by: Radu Nicolau <radu.nicolau@intel.com
> Acked-by: Chas Williams <chas3@att.com>
> ---

Hi, 

You might probably see my email.
This patch has been merged from upstream.

Thanks,
Yongseok

> drivers/net/bonding/rte_eth_bond_api.c | 6 ++++++  drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++---
> 2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
> index f4ca0a3..5f46dff 100644
> --- a/drivers/net/bonding/rte_eth_bond_api.c
> +++ b/drivers/net/bonding/rte_eth_bond_api.c
> @@ -158,6 +158,12 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
>        RTE_ASSERT(active_count < RTE_DIM(internals->active_slaves));
>        internals->active_slave_count = active_count;
> 
> +       /* Resetting active_slave when reaches to max
> +        * no of slaves in active list
> +        */
> +       if (internals->active_slave >= active_count)
> +               internals->active_slave = 0;
> +
>        if (eth_dev->data->dev_started) {
>                if (internals->mode == BONDING_MODE_8023AD) {
>                        bond_mode_8023ad_start(eth_dev); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 44cf61b..410f9d5 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -111,7 +111,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
>                        active_slave = 0;
>        }
> 
> -       if (++internals->active_slave == slave_count)
> +       if (++internals->active_slave >= slave_count)
>                internals->active_slave = 0;
>        return num_rx_total;
> }
> @@ -315,7 +315,7 @@ bond_ethdev_rx_burst_8023ad_fast_queue(void *queue, struct rte_mbuf **bufs,
>                        active_slave = 0;
>        }
> 
> -       if (++internals->active_slave == slave_count)
> +       if (++internals->active_slave >= slave_count)
>                internals->active_slave = 0;
> 
>        return num_rx_total;
> @@ -494,7 +494,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
>                        idx = 0;
>        }
> 
> -       if (++internals->active_slave == slave_count)
> +       if (++internals->active_slave >= slave_count)
>                internals->active_slave = 0;
> 
>        return num_rx_total;
> --
> 2.7.4
> 
> <0001-net-bonding-fix-reset-active-slave.patch>


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

end of thread, other threads:[~2019-07-23  1:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19  8:42 [dpdk-stable] [PATCH 17.11] net/bonding: fix reset active slave Rybalchenko, Kirill
2019-07-23  1:25 ` Yongseok Koh

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