aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-11-19 22:23:29 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:17 -0500
commit0953864160bdd28dfe45fd46fa462b4d2d53cb96 (patch)
treefcc3be7c24858b4606d6eeafee2292a58d84c6a4
parent5106930bd6b57402205e3de54dae9476e215b622 (diff)
[NETPOLL]: no need to store local_mac
The local_mac is managed by the network device, no need to keep a spare copy and all the management problems that could cause. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/netconsole.c10
-rw-r--r--include/linux/netpoll.h2
-rw-r--r--net/core/netpoll.c9
3 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 5ffbb8891647..31e047dd7bb3 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -306,9 +306,11 @@ static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
306 306
307static ssize_t show_local_mac(struct netconsole_target *nt, char *buf) 307static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
308{ 308{
309 struct net_device *dev = nt->np.dev;
310
309 DECLARE_MAC_BUF(mac); 311 DECLARE_MAC_BUF(mac);
310 return snprintf(buf, PAGE_SIZE, "%s\n", 312 return snprintf(buf, PAGE_SIZE, "%s\n",
311 print_mac(mac, nt->np.local_mac)); 313 print_mac(mac, dev->dev_addr));
312} 314}
313 315
314static ssize_t show_remote_mac(struct netconsole_target *nt, char *buf) 316static ssize_t show_remote_mac(struct netconsole_target *nt, char *buf)
@@ -667,7 +669,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
667 struct netconsole_target *nt; 669 struct netconsole_target *nt;
668 struct net_device *dev = ptr; 670 struct net_device *dev = ptr;
669 671
670 if (!(event == NETDEV_CHANGEADDR || event == NETDEV_CHANGENAME)) 672 if (!(event == NETDEV_CHANGENAME))
671 goto done; 673 goto done;
672 674
673 spin_lock_irqsave(&target_list_lock, flags); 675 spin_lock_irqsave(&target_list_lock, flags);
@@ -675,10 +677,6 @@ static int netconsole_netdev_event(struct notifier_block *this,
675 netconsole_target_get(nt); 677 netconsole_target_get(nt);
676 if (nt->np.dev == dev) { 678 if (nt->np.dev == dev) {
677 switch (event) { 679 switch (event) {
678 case NETDEV_CHANGEADDR:
679 memcpy(nt->np.local_mac, dev->dev_addr, ETH_ALEN);
680 break;
681
682 case NETDEV_CHANGENAME: 680 case NETDEV_CHANGENAME:
683 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); 681 strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
684 break; 682 break;
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 20250d963d72..e3d79593fb3a 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -20,7 +20,7 @@ struct netpoll {
20 20
21 u32 local_ip, remote_ip; 21 u32 local_ip, remote_ip;
22 u16 local_port, remote_port; 22 u16 local_port, remote_port;
23 u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN]; 23 u8 remote_mac[ETH_ALEN];
24}; 24};
25 25
26struct netpoll_info { 26struct netpoll_info {
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 250868f68762..cf6acd3084a4 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -360,8 +360,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
360 eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); 360 eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
361 skb_reset_mac_header(skb); 361 skb_reset_mac_header(skb);
362 skb->protocol = eth->h_proto = htons(ETH_P_IP); 362 skb->protocol = eth->h_proto = htons(ETH_P_IP);
363 memcpy(eth->h_source, np->local_mac, 6); 363 memcpy(eth->h_source, np->dev->dev_addr, ETH_ALEN);
364 memcpy(eth->h_dest, np->remote_mac, 6); 364 memcpy(eth->h_dest, np->remote_mac, ETH_ALEN);
365 365
366 skb->dev = np->dev; 366 skb->dev = np->dev;
367 367
@@ -431,7 +431,7 @@ static void arp_reply(struct sk_buff *skb)
431 431
432 /* Fill the device header for the ARP frame */ 432 /* Fill the device header for the ARP frame */
433 if (dev_hard_header(send_skb, skb->dev, ptype, 433 if (dev_hard_header(send_skb, skb->dev, ptype,
434 sha, np->local_mac, 434 sha, np->dev->dev_addr,
435 send_skb->len) < 0) { 435 send_skb->len) < 0) {
436 kfree_skb(send_skb); 436 kfree_skb(send_skb);
437 return; 437 return;
@@ -737,9 +737,6 @@ int netpoll_setup(struct netpoll *np)
737 } 737 }
738 } 738 }
739 739
740 if (is_zero_ether_addr(np->local_mac) && ndev->dev_addr)
741 memcpy(np->local_mac, ndev->dev_addr, 6);
742
743 if (!np->local_ip) { 740 if (!np->local_ip) {
744 rcu_read_lock(); 741 rcu_read_lock();
745 in_dev = __in_dev_get_rcu(ndev); 742 in_dev = __in_dev_get_rcu(ndev);