[dpdk-dev] [PATCH] lib/librte_ether: error handling on MAC address replay
Igor Ryzhov
iryzhov at nfware.com
Thu Jan 19 23:39:54 CET 2017
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