From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f65.google.com (mail-vk0-f65.google.com [209.85.213.65]) by dpdk.org (Postfix) with ESMTP id E312A108F for ; Mon, 23 Jan 2017 09:50:24 +0100 (CET) Received: by mail-vk0-f65.google.com with SMTP id 23so10534486vkc.2 for ; Mon, 23 Jan 2017 00:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nfware-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7fn5JyFuM4iFNlBSZXu61T0JyX78lPdZupiZEjBeRjY=; b=XSKDT8vh34EsA8ALMyvVeJCZ9m1MPMTOHiZTlJsG9smONiMFq8y1PPMVBlWzLToTOe KDVKoMeafgRC+ckVDs4EEj993WLSJ83qtVs2Pu6m54vQn6DlVsEWfg2DlyYQpPaRWV0O grtiVVoODVHcJoT+b8Z7+rlW+PuBSq0erk7UMnswqn5qV5U0F1oI/Jj0N9XVIzEnSHUq FEq22XAcimZqCrs7G9wgmfI5/onz2znR46vLnXCHDzLGxqzNqAz04fxnfkspRs7cv09Z g8pldrNy0waBtfPcbUTmLbz9KQrwhSuZmCoLiM26u79KuP3el+LDFysRC177sfNMLzUm 2ffQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7fn5JyFuM4iFNlBSZXu61T0JyX78lPdZupiZEjBeRjY=; b=SkLayJ048/FIqdWpn8VNs2K/9Q1LVDe3yQ/wZ44ZiMiEgUMnHNYVfxBAMelJbszNRK wOpjjb66SQflhVmhj3hPEEQaUkVslDawwvc+dEZgAYVmg9iMUW6amOTe3faYZgJhREZl 6wf7wbL/2NKbLg0xWZO/1uQ/cFwYdNWF45JafZLQXustLfWu4HDt32bnVHUisOedWJIH 7U/8az7JDqDokirlYWtfMVSziiQqmSnQiDDDwzlek2p0FKfVZaXfuIN+Ytuy8V5SuFW9 an1vmi5H4K+Q0lp6CbFV/5NJ2kVhyrd0gVdHJkN0hsBCttg9KdGjxdTwUY5tVjyHiLdo vbcw== X-Gm-Message-State: AIkVDXIrfRfYKXAWaA6/Qg+5OR2iTfRxeNY/rRb6SUfPrYwyK70XinlNI0e5aDHccbIjnOV9VfgoaEpj19WymA== X-Received: by 10.31.72.69 with SMTP id v66mr12613249vka.156.1485161424151; Mon, 23 Jan 2017 00:50:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.35.80 with HTTP; Mon, 23 Jan 2017 00:50:23 -0800 (PST) X-Originating-IP: [95.182.74.2] In-Reply-To: <20170120222349.14567-1-jonshin@cisco.com> References: <20170119184721.22348-1-jonshin@cisco.com> <20170120222349.14567-1-jonshin@cisco.com> From: Igor Ryzhov Date: Mon, 23 Jan 2017 11:50:23 +0300 Message-ID: To: Steve Shin Cc: "dev@dpdk.org" , Ferruh Yigit Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix MAC address replay 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: Mon, 23 Jan 2017 08:50:25 -0000 Hello Steve, Thank you for all the fixes. But I think I noticed another one issue in MAC replay process. Pool number is extracted only once: if (RTE_ETH_DEV_SRIOV(dev).active) pool = RTE_ETH_DEV_SRIOV(dev).def_vmdq_idx; But when MAC address is added using rte_eth_dev_mac_addr_add several different pool numbers can be used. Shouldn't we extract pool number for each MAC address separately from mac_pool_sel array during restoration process? Best regards, Igor On Sat, Jan 21, 2017 at 1:23 AM, Steve Shin wrote: > This patch fixes a bug in replaying MAC address to the hardware > in rte_eth_dev_config_restore() routine. Added default MAC replay as well. > > Fixes: 4bdefaade6d1 ("ethdev: VMDQ enhancements") > > --- > v2: Added default MAC replay & Code optimization > > Signed-off-by: Steve Shin > --- > lib/librte_ether/rte_ethdev.c | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 4790faf..150f350 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -931,7 +931,7 @@ rte_eth_dev_config_restore(uint8_t port_id) > { > struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info; > - struct ether_addr addr; > + struct ether_addr *addr; > uint16_t i; > uint32_t pool = 0; > > @@ -942,23 +942,23 @@ rte_eth_dev_config_restore(uint8_t port_id) > if (RTE_ETH_DEV_SRIOV(dev).active) > pool = RTE_ETH_DEV_SRIOV(dev).def_vmdq_idx; > > - /* replay MAC address configuration */ > - for (i = 0; i < dev_info.max_mac_addrs; i++) { > - addr = dev->data->mac_addrs[i]; > + /* replay MAC address configuration including default MAC */ > + if (*dev->dev_ops->mac_addr_set != NULL) { > + addr = &dev->data->mac_addrs[0]; > + (*dev->dev_ops->mac_addr_set)(dev, addr); > + } > > - /* skip zero address */ > - if (is_zero_ether_addr(&addr)) > - continue; > + if (*dev->dev_ops->mac_addr_add != NULL) { > + for (i = 1; i < dev_info.max_mac_addrs; i++) { > + addr = &dev->data->mac_addrs[i]; > > - /* add address to the hardware */ > - if (*dev->dev_ops->mac_addr_add && > - (dev->data->mac_pool_sel[i] & (1ULL << pool))) > - (*dev->dev_ops->mac_addr_add)(dev, &addr, i, > pool); > - else { > - RTE_PMD_DEBUG_TRACE("port %d: MAC address array > not supported\n", > - port_id); > - /* exit the loop but not return an error */ > - break; > + /* skip zero address */ > + if (is_zero_ether_addr(addr)) > + continue; > + > + /* add address to the hardware */ > + if (dev->data->mac_pool_sel[i] & (1ULL << pool)) > + (*dev->dev_ops->mac_addr_add)(dev, addr, > i, pool); > } > } > > -- > 2.9.3 > >