* [MACVLAN 00/02]: Macvlan update
@ 2007-11-15 15:54 Patrick McHardy
2007-11-15 15:54 ` [MACVLAN 01/02]: Remove unnecessary IFF_UP check Patrick McHardy
2007-11-15 15:54 ` [MACVLAN 02/02]: Allow setting mac address while device is up Patrick McHardy
0 siblings, 2 replies; 5+ messages in thread
From: Patrick McHardy @ 2007-11-15 15:54 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy
These two patches remove an unnecessary check in macvlan_broadcast() and
add the ability to change the mac address while the device is up.
Please apply, thanks.
drivers/net/macvlan.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
Patrick McHardy (2):
[MACVLAN]: Remove unnecessary IFF_UP check
[MACVLAN]: Allow setting mac address while device is up
^ permalink raw reply [flat|nested] 5+ messages in thread
* [MACVLAN 01/02]: Remove unnecessary IFF_UP check
2007-11-15 15:54 [MACVLAN 00/02]: Macvlan update Patrick McHardy
@ 2007-11-15 15:54 ` Patrick McHardy
2007-11-20 6:00 ` David Miller
2007-11-15 15:54 ` [MACVLAN 02/02]: Allow setting mac address while device is up Patrick McHardy
1 sibling, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2007-11-15 15:54 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy
[MACVLAN]: Remove unnecessary IFF_UP check
Only devices that are UP are in the hash, so macvlan_broadcast() doesn't
need to check for IFF_UP.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit e2d06a34b52a999e8c539d1cdef51ff523e2f2c2
tree f95a5eef37c421950ddc7318797909c0031ee948
parent 86aa441a13a474e66d484af38575609d9a0ff8ec
author Patrick McHardy <kaber@trash.net> Thu, 15 Nov 2007 16:33:24 +0100
committer Patrick McHardy <kaber@trash.net> Thu, 15 Nov 2007 16:33:24 +0100
drivers/net/macvlan.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2e4bcd5..461149c 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -73,8 +73,6 @@ static void macvlan_broadcast(struct sk_buff *skb,
for (i = 0; i < MACVLAN_HASH_SIZE; i++) {
hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[i], hlist) {
dev = vlan->dev;
- if (unlikely(!(dev->flags & IFF_UP)))
- continue;
nskb = skb_clone(skb, GFP_ATOMIC);
if (nskb == NULL) {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [MACVLAN 02/02]: Allow setting mac address while device is up
2007-11-15 15:54 [MACVLAN 00/02]: Macvlan update Patrick McHardy
2007-11-15 15:54 ` [MACVLAN 01/02]: Remove unnecessary IFF_UP check Patrick McHardy
@ 2007-11-15 15:54 ` Patrick McHardy
2007-11-20 6:00 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2007-11-15 15:54 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy
[MACVLAN]: Allow setting mac address while device is up
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 3c50588260810d735231220f9a8ebaa6a6e8fb1e
tree 48ee2625502caf2454263a05b5a9869648de3aed
parent e2d06a34b52a999e8c539d1cdef51ff523e2f2c2
author Patrick McHardy <kaber@trash.net> Thu, 15 Nov 2007 16:38:06 +0100
committer Patrick McHardy <kaber@trash.net> Thu, 15 Nov 2007 16:38:06 +0100
drivers/net/macvlan.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 461149c..3acf8cd 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -213,6 +213,29 @@ static int macvlan_stop(struct net_device *dev)
return 0;
}
+static int macvlan_set_mac_address(struct net_device *dev, void *p)
+{
+ struct macvlan_dev *vlan = netdev_priv(dev);
+ struct net_device *lowerdev = vlan->lowerdev;
+ struct sockaddr *addr = p;
+ int err;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EADDRNOTAVAIL;
+
+ if (!(dev->flags & IFF_UP))
+ goto out;
+
+ err = dev_unicast_add(lowerdev, addr->sa_data, ETH_ALEN);
+ if (err < 0)
+ return err;
+ dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN);
+
+out:
+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ return 0;
+}
+
static void macvlan_change_rx_flags(struct net_device *dev, int change)
{
struct macvlan_dev *vlan = netdev_priv(dev);
@@ -300,6 +323,7 @@ static void macvlan_setup(struct net_device *dev)
dev->stop = macvlan_stop;
dev->change_mtu = macvlan_change_mtu;
dev->change_rx_flags = macvlan_change_rx_flags;
+ dev->set_mac_address = macvlan_set_mac_address;
dev->set_multicast_list = macvlan_set_multicast_list;
dev->hard_start_xmit = macvlan_hard_start_xmit;
dev->destructor = free_netdev;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [MACVLAN 01/02]: Remove unnecessary IFF_UP check
2007-11-15 15:54 ` [MACVLAN 01/02]: Remove unnecessary IFF_UP check Patrick McHardy
@ 2007-11-20 6:00 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2007-11-20 6:00 UTC (permalink / raw)
To: kaber; +Cc: netdev
From: Patrick McHardy <kaber@trash.net>
Date: Thu, 15 Nov 2007 16:54:30 +0100 (MET)
> [MACVLAN]: Remove unnecessary IFF_UP check
>
> Only devices that are UP are in the hash, so macvlan_broadcast() doesn't
> need to check for IFF_UP.
>
> Signed-off-by: Patrick McHardy <kaber@trash.net>
Applied to net-2.6.25, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [MACVLAN 02/02]: Allow setting mac address while device is up
2007-11-15 15:54 ` [MACVLAN 02/02]: Allow setting mac address while device is up Patrick McHardy
@ 2007-11-20 6:00 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2007-11-20 6:00 UTC (permalink / raw)
To: kaber; +Cc: netdev
From: Patrick McHardy <kaber@trash.net>
Date: Thu, 15 Nov 2007 16:54:32 +0100 (MET)
> [MACVLAN]: Allow setting mac address while device is up
>
> Signed-off-by: Patrick McHardy <kaber@trash.net>
I'll apply this to net-2.6.25 as well, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-11-20 6:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-15 15:54 [MACVLAN 00/02]: Macvlan update Patrick McHardy
2007-11-15 15:54 ` [MACVLAN 01/02]: Remove unnecessary IFF_UP check Patrick McHardy
2007-11-20 6:00 ` David Miller
2007-11-15 15:54 ` [MACVLAN 02/02]: Allow setting mac address while device is up Patrick McHardy
2007-11-20 6:00 ` 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).