All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steve Shin (jonshin)" <jonshin@cisco.com>
To: Igor Ryzhov <iryzhov@nfware.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>
Subject: Re: [PATCH] lib/librte_ether: error handling on MAC address replay
Date: Fri, 20 Jan 2017 19:12:26 +0000	[thread overview]
Message-ID: <B5077178-7463-460D-965E-E889FA3C8435@cisco.com> (raw)
In-Reply-To: <CAF+s_Fxg4iwLJxaPTz3DS7JUn_8uepZ8qX3hjxFUGX4j+xOPVQ@mail.gmail.com>

Dear Igor,

That makes sense to use mac_addr_set() for default MAC address replay.

As default MAC is kept in dev->data->mac_addrs[0], we may not need to create a separate variable for default one.
Will run some unit test with new change and upload a new diff for your review.

FYI: Ferruh recommended to change tag in patch subject title. So next patch will have a different tile as “ethdev: fix MAC address replay”.

Thanks & Regards,
Steve

From: Igor Ryzhov <iryzhov@nfware.com>
Date: Friday, January 20, 2017 at 4:17 AM
To: Steve Shin <jonshin@cisco.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH] lib/librte_ether: error handling on MAC address replay

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@cisco.com<mailto:jonshin@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@nfware.com<mailto:iryzhov@nfware.com>>
Date: Thursday, January 19, 2017 at 2:39 PM
To: Steve Shin <jonshin@cisco.com<mailto:jonshin@cisco.com>>
Cc: "dev@dpdk.org<mailto:dev@dpdk.org>" <dev@dpdk.org<mailto:dev@dpdk.org>>, "ferruh.yigit@intel.com<mailto:ferruh.yigit@intel.com>" <ferruh.yigit@intel.com<mailto:ferruh.yigit@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@cisco.com<mailto:jonshin@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@cisco.com<mailto:jonshin@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@cisco.com<mailto:jonshin@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




  reply	other threads:[~2017-01-20 19:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19 18:47 [PATCH] lib/librte_ether: error handling on MAC address replay Steve Shin
2017-01-19 19:35 ` Steve Shin (jonshin)
2017-01-19 22:39   ` Igor Ryzhov
2017-01-20  2:30     ` Steve Shin (jonshin)
2017-01-20 12:17       ` Igor Ryzhov
2017-01-20 19:12         ` Steve Shin (jonshin) [this message]
2017-01-20 22:23 ` [PATCH v2] ethdev: fix " Steve Shin
2017-01-23  8:50   ` Igor Ryzhov
2017-01-23 23:19     ` Steve Shin (jonshin)
2017-01-23 23:50   ` [PATCH v3] " Steve Shin
2017-01-24  2:21     ` [PATCH v4] " Steve Shin
2017-01-24 10:09       ` Igor Ryzhov
2017-01-24 13:21         ` Ferruh Yigit
2017-01-24 14:00           ` Igor Ryzhov
2017-01-25 10:25           ` Thomas Monjalon
2017-01-27 17:57       ` [PATCH v5] " Steve Shin
2017-01-30  9:21         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5077178-7463-460D-965E-E889FA3C8435@cisco.com \
    --to=jonshin@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=iryzhov@nfware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.