[dpdk-dev] net/enic: add primary mac address handler
Checks
Commit Message
Reused the .mac_addr_add and .mac_addr_del callbacks code to implement
primary mac address handler.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
drivers/net/enic/enic_ethdev.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Mon, Feb 19, 2018 at 01:42:27PM +0100, David Marchand wrote:
> Reused the .mac_addr_add and .mac_addr_del callbacks code to implement
> primary mac address handler.
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
Hi, thanks for taking a stab at this.
> +static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev,
> + struct ether_addr *addr)
> +{
> + enicpmd_remove_mac_addr(eth_dev, 0);
> + enicpmd_add_mac_addr(eth_dev, addr, 0, 0);
> +}
Unfortunately, this does not work as expected. The caller updates
mac_addrs[0] prior to calling mac_addr_set.
int
rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *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);
[...]
So, enicpmd_remove_mac_addr tries to remove mac_addrs[0], which is the
'new' default address and does not exist on the NIC. Then,
enicpmd_add_mac_addr adds the new address to the NIC. At the end, the
NIC ends up with both the old and the new addresses.
I think the driver would have to treat the 'default' mac address
differently. I can submit a new patch as part of our next upstream
patch set. Or you are welcome to spin a new version. Up to you.
Thanks.
-Hyong
Hello,
On Tue, Feb 20, 2018 at 6:41 AM, Hyong Youb Kim <hyonkim@cisco.com> wrote:
> On Mon, Feb 19, 2018 at 01:42:27PM +0100, David Marchand wrote:
>> Reused the .mac_addr_add and .mac_addr_del callbacks code to implement
>> primary mac address handler.
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>
> Hi, thanks for taking a stab at this.
>
>> +static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev,
>> + struct ether_addr *addr)
>> +{
>> + enicpmd_remove_mac_addr(eth_dev, 0);
>> + enicpmd_add_mac_addr(eth_dev, addr, 0, 0);
>> +}
>
> Unfortunately, this does not work as expected. The caller updates
> mac_addrs[0] prior to calling mac_addr_set.
Indeed.
Btw, I had forgotten about the deprecation notice [1] sent by Olivier.
Just discussed it with him, let's wait for this change before looking
at the issue again.
1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5
On Tue, Feb 20, 2018 at 10:17:34AM +0100, David Marchand wrote:
[...]
> Btw, I had forgotten about the deprecation notice [1] sent by Olivier.
> Just discussed it with him, let's wait for this change before looking
> at the issue again.
>
>
> 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5
Makes sense. Will wait. Thanks.
-Hyong
On 2/20/2018 12:16 PM, Hyong Youb Kim wrote:
> On Tue, Feb 20, 2018 at 10:17:34AM +0100, David Marchand wrote:
> [...]
>> Btw, I had forgotten about the deprecation notice [1] sent by Olivier.
>> Just discussed it with him, let's wait for this change before looking
>> at the issue again.
>>
>>
>> 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5
>
> Makes sense. Will wait. Thanks.
Latest version of Olivier's patch: https://dpdk.org/dev/patchwork/patch/37427/ ,
FYI.
>
> -Hyong
>
On 4/6/2018 6:33 PM, Ferruh Yigit wrote:
> On 2/20/2018 12:16 PM, Hyong Youb Kim wrote:
>> On Tue, Feb 20, 2018 at 10:17:34AM +0100, David Marchand wrote:
>> [...]
>>> Btw, I had forgotten about the deprecation notice [1] sent by Olivier.
>>> Just discussed it with him, let's wait for this change before looking
>>> at the issue again.
>>>
>>>
>>> 1: http://dpdk.org/browse/dpdk/commit/doc?id=16a7009aeed5836d671aada0d9fe11b20a4c3ce5
>>
>> Makes sense. Will wait. Thanks.
>
> Latest version of Olivier's patch: https://dpdk.org/dev/patchwork/patch/37427/ ,
> FYI.
Hi David,
Olivier's patch is merged into next-net, can you please re-make this patch based
on latest code?
Thanks,
ferruh
@@ -610,6 +610,13 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index)
enic_del_mac_address(enic, index);
}
+static void enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev,
+ struct ether_addr *addr)
+{
+ enicpmd_remove_mac_addr(eth_dev, 0);
+ enicpmd_add_mac_addr(eth_dev, addr, 0, 0);
+}
+
static int enicpmd_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
{
struct enic *enic = pmd_priv(eth_dev);
@@ -657,6 +664,7 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = {
.priority_flow_ctrl_set = NULL,
.mac_addr_add = enicpmd_add_mac_addr,
.mac_addr_remove = enicpmd_remove_mac_addr,
+ .mac_addr_set = enicpmd_set_mac_addr,
.filter_ctrl = enicpmd_dev_filter_ctrl,
};