DPDK patches and discussions
 help / color / mirror / Atom feed
From: Igor Ryzhov <iryzhov@nfware.com>
To: Andrew Rybchenko <arybchenko@solarflare.com>
Cc: Olivier Matz <olivier.matz@6wind.com>,
	dev@dpdk.org,  Thomas Monjalon <thomas@monjalon.net>,
	Laurent Hardy <laurent.hardy@6wind.com>,
	stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] ethdev: fix setting of MAC address
Date: Mon, 18 Dec 2017 13:53:47 +0300	[thread overview]
Message-ID: <CAF+s_FyBQfevMSaLHH9xOV=+DvTwk70XNcOrtGToumhKvs-kMA@mail.gmail.com> (raw)
In-Reply-To: <adea1787-9c1c-3942-3b9e-ea42a2e44728@solarflare.com>

Hello Andrew,

Don't you think that it's not correct that net/sfc works that way?

If we go further, dev->dev_ops->mac_addr_set not only should be called
before ether_addr_copy.
It should return status code, and in case of error ether_addr_copy
shouldn't be called at all.
Am I wrong?

Best regards,
Igor

On Mon, Dec 18, 2017 at 1:35 PM, Andrew Rybchenko <arybchenko@solarflare.com
> wrote:

> On 12/14/2017 08:15 PM, Olivier Matz wrote:
>
>> From: Laurent Hardy <laurent.hardy@6wind.com>
>>
>> When a new mac address is set, it is saved in dev->data->mac_addrs
>> before the ethdev handler is called.
>>
>> First, it is inconsistent with the other ethdev functions
>> rte_eth_dev_mac_addr_remove() and rte_eth_dev_mac_addr_add().
>>
>> Moreover, it prevents the drivers from wrongly comparing the old address
>> and the new one, like it's done in i40evf driver:
>>
>>         if (is_same_ether_addr(mac_addr, dev->data->mac_addrs))
>>                 return;
>>
>> Fixes: 943c2d899a0c ("net/i40e: set VF MAC from VF")
>> Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
>> ---
>>   lib/librte_ether/rte_ethdev.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.
>> c
>> index 4f492e3db..297c02a54 100644
>> --- a/lib/librte_ether/rte_ethdev.c
>> +++ b/lib/librte_ether/rte_ethdev.c
>> @@ -2643,11 +2643,11 @@ rte_eth_dev_default_mac_addr_set(uint16_t
>> port_id, struct ether_addr *addr)
>>         dev = &rte_eth_devices[port_id];
>>         RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
>>   +     (*dev->dev_ops->mac_addr_set)(dev, addr);
>> +
>>         /* Update default address in NIC data structure */
>>         ether_addr_copy(addr, &dev->data->mac_addrs[0]);
>>   -     (*dev->dev_ops->mac_addr_set)(dev, addr);
>> -
>>         return 0;
>>   }
>>
>
> NACK, unfortunately it will break net/sfc in one of branches when a new MAC
> is set using restart. It relies on the fact that a new MAC is already
> available in
> device data.
>

  reply	other threads:[~2017-12-18 10:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 17:15 Olivier Matz
2017-12-18 10:35 ` Andrew Rybchenko
2017-12-18 10:53   ` Igor Ryzhov [this message]
2017-12-18 11:38     ` Andrew Rybchenko
2017-12-19  9:29       ` Olivier MATZ
2017-12-19  9:47         ` Andrew Rybchenko
2017-12-20 10:00           ` Andrew Rybchenko
2018-01-03 13:43             ` Olivier Matz
2018-01-03 13:54               ` Olivier Matz
2018-01-03 14:12                 ` Andrew Rybchenko
2018-01-08 11:59                   ` Ferruh Yigit
2018-01-08 14:23                     ` Olivier Matz
2018-01-03 13:34 ` [dpdk-dev] [PATCH v2] net/i40e: fix setting of MAC address on i40evf Olivier Matz
2018-01-04  7:39   ` Xing, Beilei
2018-01-08  6:43     ` Zhang, Helin

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='CAF+s_FyBQfevMSaLHH9xOV=+DvTwk70XNcOrtGToumhKvs-kMA@mail.gmail.com' \
    --to=iryzhov@nfware.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=laurent.hardy@6wind.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).