* [PATCH v3] net: Cavium: Fix MAC address setting in shutdown state
@ 2015-06-23 14:51 Pavel Fedin
2015-06-24 8:03 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Fedin @ 2015-06-23 14:51 UTC (permalink / raw)
To: netdev, 'David Miller'
Cc: Aleksey.Makarov, sgoutham, thlab.kim, s.dyasly, 'Robert Richter'
This bug pops up with NetworkManager on Fedora 21. NetworkManager tends to
stop the interface (nicvf_stop() is called) before changing settings. In
stopped state MAC cannot be sent to a PF. However, when the interface is
restarted (nicvf_open() is called), we ping the PF using NIC_MBOX_MSG_READY
message, and the PF replies back with old MAC address, overriding what we
had after MAC setting from userspace. As a result, we cannot set MAC
address using NetworkManager.
This patch introduces special tracking of MAC change in stopped state so
that the correct new MAC address is sent to a PF when interface is reopen.
Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
---
Changes for v3:
- Fixed (actually hand-edited) file permissions to be 644. I occasionally pushed them as 755 to my
local repo.
Changes for v2:
- Fixed a couple of checkpatch.pl reports (was forgotten in v1)
- Adjusted email client prefs, hopefully will not corrupt patches any more.
---
drivers/net/ethernet/cavium/thunder/nic.h | 1 +
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index a3b43e5..dda8a02 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -263,6 +263,7 @@ struct nicvf {
bool pf_acked;
bool pf_nacked;
bool bgx_stats_acked;
+ bool set_mac_pending;
} ____cacheline_aligned_in_smp;
/* PF <--> VF Mailbox communication
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 02da802..8b119a0 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -201,7 +201,9 @@ static void nicvf_handle_mbx_intr(struct nicvf *nic)
nic->vf_id = mbx.nic_cfg.vf_id & 0x7F;
nic->tns_mode = mbx.nic_cfg.tns_mode & 0x7F;
nic->node = mbx.nic_cfg.node_id;
- ether_addr_copy(nic->netdev->dev_addr, mbx.nic_cfg.mac_addr);
+ if (!nic->set_mac_pending)
+ ether_addr_copy(nic->netdev->dev_addr,
+ mbx.nic_cfg.mac_addr);
nic->link_up = false;
nic->duplex = 0;
nic->speed = 0;
@@ -941,6 +943,11 @@ int nicvf_open(struct net_device *netdev)
nicvf_hw_set_mac_addr(nic, netdev);
}
+ if (nic->set_mac_pending) {
+ nic->set_mac_pending = false;
+ nicvf_hw_set_mac_addr(nic, netdev);
+ }
+
/* Init tasklet for handling Qset err interrupt */
tasklet_init(&nic->qs_err_task, nicvf_handle_qs_err,
(unsigned long)nic);
@@ -1040,9 +1047,12 @@ static int nicvf_set_mac_address(struct net_device *netdev, void *p)
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
- if (nic->msix_enabled)
+ if (nic->msix_enabled) {
if (nicvf_hw_set_mac_addr(nic, netdev))
return -EBUSY;
+ } else {
+ nic->set_mac_pending = true;
+ }
return 0;
}
--
1.9.5.msysgit.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] net: Cavium: Fix MAC address setting in shutdown state
2015-06-23 14:51 [PATCH v3] net: Cavium: Fix MAC address setting in shutdown state Pavel Fedin
@ 2015-06-24 8:03 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-06-24 8:03 UTC (permalink / raw)
To: p.fedin
Cc: netdev, Aleksey.Makarov, sgoutham, thlab.kim, s.dyasly, robert.richter
From: Pavel Fedin <p.fedin@samsung.com>
Date: Tue, 23 Jun 2015 17:51:06 +0300
> This bug pops up with NetworkManager on Fedora 21. NetworkManager tends to
> stop the interface (nicvf_stop() is called) before changing settings. In
> stopped state MAC cannot be sent to a PF. However, when the interface is
> restarted (nicvf_open() is called), we ping the PF using NIC_MBOX_MSG_READY
> message, and the PF replies back with old MAC address, overriding what we
> had after MAC setting from userspace. As a result, we cannot set MAC
> address using NetworkManager.
>
> This patch introduces special tracking of MAC change in stopped state so
> that the correct new MAC address is sent to a PF when interface is reopen.
>
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Applied, thanks.
> - Fixed (actually hand-edited) file permissions to be 644. I occasionally pushed them as 755 to my
> local repo.
You should be sending patches against my repo, or something derived from it,
which therefore has the correct file permissions for these files.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-24 7:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 14:51 [PATCH v3] net: Cavium: Fix MAC address setting in shutdown state Pavel Fedin
2015-06-24 8:03 ` David Miller
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).