From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by dpdk.org (Postfix) with ESMTP id 782811B43F for ; Wed, 28 Nov 2018 15:29:00 +0100 (CET) Received: by mail-qt1-f196.google.com with SMTP id d19so25974352qtq.9 for ; Wed, 28 Nov 2018 06:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jmtjzcr9lguov6VurMtT6X5yPdpzlcaQ8pgloGi5NAk=; b=OiWiRorOqyaazhFIVav1vbyNqNkfZeR4BgmTyRhySnt0ItKH6c3QuvknGKqi+kAYD8 WS+Z4sPvSmCwnbTRZ2hWN4eFy8MQOH9QrvjBMvbgSp6si4sRjxlF1VgCXzgr/Bn3rL6w UE5gNHsWL+YhGCVy5OkHBTqXrFhn2dhGY+AdJ9ClehYyVsUx89UhiCRzIhgVWIetIgkU Y76eiKiWs1E/H+6XwK3QMVFhghs7AJo13p3YnhS+wDKN8mBhidNup+Mkd39vw+u7milp kwooyzpHyJW0ME2Q5CvTJszAPT1IRQxsZ+r9rHzILhWMeeSXrxrdmlgbu+xx/7cHag0/ H6eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jmtjzcr9lguov6VurMtT6X5yPdpzlcaQ8pgloGi5NAk=; b=HpahEbIzF1xY+8HvvorSMX255NJRR3vHNDblnOzO7fcCO849MhEIzaY3LH6NenFu9A HK4o75sM9IgSFIQBunPhi6uykqkA7ML90qO4KD2K7Cri6iAEWziG7CfgEysm9UBBGFzY siVz+VQfwE822tejbYswpWrYXJBgSoqKgB+c3rAHABSvB4sLXB2mxRj3qSkV3XaAk7Nt 3r2Jdg4RGAh9bw3HMkVUXHorQRKtKSolWCbOJ6t7BexzCLk+8Kgp8Pdbaa9cnwEaDcQW LGyHMbNQv7NwwYWjzIKV68pQCc9gnfwVBjkAtXHLch93GjNv6Dp5BguAhd0G4djIw2hV 6xYw== X-Gm-Message-State: AA+aEWbqaEEDwNE6yyssqZOn0N1I1P8gPiiNSxHb2UaLRX8/h8ldt7pO 0h3By8AXDW29NcSaxLL83FM= X-Google-Smtp-Source: AFSGD/VfOicXtoCYGQ1nABlq2bzzFewiVoDNbCrzdB/d2ExtKFLCXB6E4KC+SKw6PUHr4fj7vgaV3Q== X-Received: by 2002:a0c:e189:: with SMTP id p9mr35127847qvl.68.1543415339871; Wed, 28 Nov 2018 06:28:59 -0800 (PST) Received: from [192.168.1.10] (pool-96-255-82-34.washdc.fios.verizon.net. [96.255.82.34]) by smtp.gmail.com with ESMTPSA id y2sm3879908qtb.88.2018.11.28.06.28.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 06:28:58 -0800 (PST) To: Radu Nicolau , Ferruh Yigit , dev@dpdk.org Cc: declan.doherty@intel.com, chas3@att.com References: <1542197949-15992-1-git-send-email-radu.nicolau@intel.com> <2e452920-4514-6395-27e5-f7457de01797@intel.com> <9425dd1c-877a-0bee-72b8-6aae9617286f@intel.com> From: Chas Williams <3chas3@gmail.com> Message-ID: <6839bca3-a8f9-b3c9-9d58-66296d00e75a@gmail.com> Date: Wed, 28 Nov 2018 09:28:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <9425dd1c-877a-0bee-72b8-6aae9617286f@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] examples/bond: wait for slaves to become active X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2018 14:29:00 -0000 On 11/28/2018 08:48 AM, Radu Nicolau wrote: > Hi > > > On 11/28/2018 11:08 AM, Ferruh Yigit wrote: >> On 11/14/2018 12:19 PM, Radu Nicolau wrote: >>> Do not start the packet processing threads until all configured >>> slaves become active. >> Hi Radu, >> >> What happens if packet processing threads started before all slaves >> active? Exit >> app, error, crash? >> >> So can we say this patch is fixing packet forwarding? (fix in title?) >> >> And do we know what break it, why this was not required previously but >> required >> now? (Fixes line ?) > From what I see, the problem was always there: bond_ethdev_rx_burst > will cycle through slaves, but if called more times with no active > slaves the active slave index will point out of bounds, resulting in a > segfault. > While this may require a better fix, this patch is an improvement even > if that fix comes - the configured slaves needs to be checked, and if > none became active there is no point going further. > > in bond_ethdev_rx_burst: > > slave_count = internals->active_slave_count; > ... > if (++internals->active_slave == slave_count) > internals->active_slave = 0; > slave_count is zero, the if() will never be true and active_slave will > be continuously incremented. It was not written to work with no active > slaves. Just create another patch for the rx routines. If the active_slave_count is 0, there's nothing to do really. It should just return and not bother with any of the other work. > >> >> Thanks, >> ferruh >> >>> Signed-off-by: Radu Nicolau >>> --- >>> examples/bond/main.c | 15 +++++++++++++++ >>> 1 file changed, 15 insertions(+) >>> >>> diff --git a/examples/bond/main.c b/examples/bond/main.c >>> index b282e68..6623cae 100644 >>> --- a/examples/bond/main.c >>> +++ b/examples/bond/main.c >>> @@ -220,6 +220,7 @@ bond_port_init(struct rte_mempool *mbuf_pool) >>> struct rte_eth_rxconf rxq_conf; >>> struct rte_eth_txconf txq_conf; >>> struct rte_eth_conf local_port_conf = port_conf; >>> + uint16_t wait_counter = 20; >>> retval = rte_eth_bond_create("net_bonding0", BONDING_MODE_ALB, >>> 0 /*SOCKET_ID_ANY*/); >>> @@ -274,6 +275,20 @@ bond_port_init(struct rte_mempool *mbuf_pool) >>> if (retval < 0) >>> rte_exit(retval, "Start port %d failed (res=%d)", >>> BOND_PORT, retval); >>> + printf("Waiting for slaves to become active..."); >>> + while (wait_counter) { >>> + uint16_t act_slaves[16] = {0}; >>> + if (rte_eth_bond_active_slaves_get(BOND_PORT, act_slaves, >>> 16) == >>> + slaves_count) { >>> + printf("\n"); >>> + break; >>> + } >>> + sleep(1); >>> + printf("..."); >>> + if (--wait_counter == 0) >>> + rte_exit(-1, "\nFailed to activate slaves\n"); >>> + } >>> + >>> rte_eth_promiscuous_enable(BOND_PORT); >>> struct ether_addr addr; >>> >