[dpdk-dev] [PATCH] lib/librte_ether: error handling on MAC address replay
Igor Ryzhov
iryzhov at nfware.com
Fri Jan 20 13:17:57 CET 2017
Hello Steve,
I think it's not the right solution, because if we want to restore default
MAC address, it should be done using dev->dev_ops->mac_addr_set(), not
using dev->dev_ops->mac_addr_add().
I think that right solution may be to store default MAC address in separate
variable dev->data->default_mac_addr, not in dev->data->mac_addrs array.
And, accordingly, restore default_mac_addr using mac_addr_set(), and
restore mac_addrs array using mac_addr_add().
Best regards,
Igor
On Fri, Jan 20, 2017 at 5:30 AM, Steve Shin (jonshin) <jonshin at cisco.com>
wrote:
> Thanks Igor for your comments!
>
>
>
> A good point on the first item.
>
> For the second question, I walked through device initialization routines
> to see any other potential issue.
>
> I found one case where index 0 is still required to replay MAC address;
> ex) MAC address change on the PHY port – index 0
>
> No code path was found to restore a changed MAC value with index 0.
> Therefore, we may have to use the existing rte_eth_dev_config_restore()
> function to replay 0 indexed MAC.
>
> Currently rte_eth_dev_default_mac_addr_set() is called to program PHY MAC
> without setting mac_pool_sel for 0 index.
>
> So the following code is also required inside rte_eth_dev_default_mac_addr_set()
> routine as a complete solution:
>
> @@ -2237,6 +2234,9 @@ struct rte_eth_dev *
>
>
>
> (*dev->dev_ops->mac_addr_set)(dev, addr);
>
>
>
> + /* Update pool bitmap in NIC data structure */
>
> + dev->data->mac_pool_sel[0] = 1;
>
> +
>
> return 0;
>
>
>
> Any thoughts would be appreciated.
>
>
>
> Regards,
>
> Steve
>
>
>
> *From: *Igor Ryzhov <iryzhov at nfware.com>
> *Date: *Thursday, January 19, 2017 at 2:39 PM
> *To: *Steve Shin <jonshin at cisco.com>
> *Cc: *"dev at dpdk.org" <dev at dpdk.org>, "ferruh.yigit at intel.com" <
> ferruh.yigit at intel.com>
> *Subject: *Re: [dpdk-dev] [PATCH] lib/librte_ether: error handling on MAC
> address replay
>
>
>
> Hello Steve,
>
>
>
> Thank you for the patch.
>
>
>
> I think a couple of improvements can be done:
>
> 1. Function existence check – if (*dev->dev_ops->mac_addr_add) – can be
> taken out of the loop. We don't need to check it on each iteration.
>
> 2. I'm not completely sure, but I think loop can be started from 1, not
> from 0, because mac_pool_sel[0] is always zero. Am I right?
>
>
>
> Best regards,
>
> Igor
>
>
>
> On Thu, Jan 19, 2017 at 10:35 PM, Steve Shin (jonshin) <jonshin at cisco.com>
> wrote:
>
> Dear maintainer,
>
> Sorry that I forgot to add “Fixes:” line as follows:
>
> Fixes: 4bdefaade6d1 ("ethdev: VMDQ enhancements")
>
> Can you please add the above line as part of comment?
>
> Thanks,
> Steve
>
>
> On 1/19/17, 10:47 AM, "Steve Shin (jonshin)" <jonshin at cisco.com> wrote:
>
> This patch fixes a bug in replaying MAC address to the hardware
> in rte_eth_dev_config_restore() routine.
>
> Signed-off-by: Steve Shin <jonshin at cisco.com>
> ---
> lib/librte_ether/rte_ethdev.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.c
> b/lib/librte_ether/rte_ethdev.c
> index 4790faf..7e01f10 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -951,10 +951,12 @@ rte_eth_dev_config_restore(uint8_t port_id)
> continue;
>
> /* 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 {
> + if (*dev->dev_ops->mac_addr_add) {
> + if (dev->data->mac_pool_sel[i] & (1ULL << pool))
> + (*dev->dev_ops->mac_addr_add)(dev, &addr,
> i, pool);
> + else
> + continue;
> + } else {
> RTE_PMD_DEBUG_TRACE("port %d: MAC address array
> not supported\n",
> port_id);
> /* exit the loop but not return an error */
> --
> 2.9.3
>
>
>
>
More information about the dev
mailing list