From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by dpdk.org (Postfix) with ESMTP id 8E4E81B104 for ; Wed, 28 Nov 2018 17:14:47 +0100 (CET) Received: by mail-qt1-f195.google.com with SMTP id i7so26434993qtj.10 for ; Wed, 28 Nov 2018 08:14:47 -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=m2SgTH3yKZ/S75Ui+bXEHqUrmH0KNNZG0pLJmvf53/w=; b=drncirFttKRWgYvu1Xe7l20NCAbI6YpooY/tMRomC6TnTt6Vm/OAzZrm1CiUxgZ+Zu Nayad8oNLkRC0lfNiK+U3SqGObwuDr+s3+JLhlPSLc1pHMPBKhRFT2Xc41q26GA4LDdw 5Z/5MRey//qzXEIBRy5/GucNUWwSgwlSdPWzSarBFJU1MbLMCodmKc0uGfqizvpASKV+ CWnBNnZXqrKGlN5/iEDiZe9IHqYgLouOXmrC96qXzDkTr+31JDUUI6aku/q4ExHrffxD wi1OYWfSIKbRI1DOscakS1AIdVKgrhph8CaVtOgcxePY+TKV+FClTFPLtMjPiQ/F/3SO 7UuQ== 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=m2SgTH3yKZ/S75Ui+bXEHqUrmH0KNNZG0pLJmvf53/w=; b=r8XvRppZJeY18EyXmT4Xno4nzV5gFvlBt+c78aP42OhnzaCJMagxz4fD6oCLE2b4tB RVxY4twyRkqKXtljLw2GqIM9aOMfejn55/Jn/j34rpCZEYSpeeMNp7Gs5yADJgADBlFI AieCdBALdkc4B2aH3f5RN5rLWHJY7/sCvlFAoZU5a5CD8A95dHLgejeOKXV2bH9mpgJn En/ZYXDJBDCO0AlBVhpn5bCJm26CaIcW/we6GIQVe/zz9A3p75FIAxYit7JgVS0DT3zV SHI6NAv/7CrxvoxGn/TPLWEEJ52rus+0/8rrnx7wnmxqjWwQ783XkEc7/Xf9aJXGx81+ Ew1Q== X-Gm-Message-State: AA+aEWZUtAuTEeD9XS6r0aIYTsrTnbQOZ9LMFrBhabtiUbiVY0eUZ4FL T5y41lZK7vFAkQZSDBX/xL4= X-Google-Smtp-Source: AFSGD/Vtcq2n8l26vDQzLSyYO9R7btVfV7syoYPqx9bKgzbsHDGavHE+qJLBDIlPtnqfdhhdfR26zg== X-Received: by 2002:ac8:320a:: with SMTP id x10mr30765655qta.275.1543421686966; Wed, 28 Nov 2018 08:14:46 -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 c45sm4646384qte.66.2018.11.28.08.14.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 08:14:46 -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> <6839bca3-a8f9-b3c9-9d58-66296d00e75a@gmail.com> <0c2a1ddf-726a-c3ef-e786-97a04aebe897@intel.com> From: Chas Williams <3chas3@gmail.com> Message-ID: <8d9cd764-dbdf-dde6-62cd-8bb98f27176c@gmail.com> Date: Wed, 28 Nov 2018 11:14:45 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <0c2a1ddf-726a-c3ef-e786-97a04aebe897@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 16:14:47 -0000 On 11/28/18 11:04 AM, Radu Nicolau wrote: > > > On 11/28/2018 2:28 PM, Chas Williams wrote: >> >> >> 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. > I can do that, and it will be the better fix I mentioned. > But I still think this patch makes the sample app better, at least it > gives a hint to someone looking to develop its own app to check on the > slaves' status before proceeding to rx. Yes, I agree this patch is still valid. If you are writing some sort of test, you should wait until the bonding interface and slaves are ready before you start sending traffic. >> >>> >>>> >>>> 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; >>>>> >>> >