Commit 09538641 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[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: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5106930b
...@@ -306,9 +306,11 @@ static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf) ...@@ -306,9 +306,11 @@ static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
static ssize_t show_local_mac(struct netconsole_target *nt, char *buf) static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
{ {
struct net_device *dev = nt->np.dev;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
return snprintf(buf, PAGE_SIZE, "%s\n", return snprintf(buf, PAGE_SIZE, "%s\n",
print_mac(mac, nt->np.local_mac)); print_mac(mac, dev->dev_addr));
} }
static ssize_t show_remote_mac(struct netconsole_target *nt, char *buf) static 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,7 +669,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
struct netconsole_target *nt; struct netconsole_target *nt;
struct net_device *dev = ptr; struct net_device *dev = ptr;
if (!(event == NETDEV_CHANGEADDR || event == NETDEV_CHANGENAME)) if (!(event == NETDEV_CHANGENAME))
goto done; goto done;
spin_lock_irqsave(&target_list_lock, flags); spin_lock_irqsave(&target_list_lock, flags);
...@@ -675,10 +677,6 @@ static int netconsole_netdev_event(struct notifier_block *this, ...@@ -675,10 +677,6 @@ static int netconsole_netdev_event(struct notifier_block *this,
netconsole_target_get(nt); netconsole_target_get(nt);
if (nt->np.dev == dev) { if (nt->np.dev == dev) {
switch (event) { switch (event) {
case NETDEV_CHANGEADDR:
memcpy(nt->np.local_mac, dev->dev_addr, ETH_ALEN);
break;
case NETDEV_CHANGENAME: case NETDEV_CHANGENAME:
strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ); strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
break; break;
......
...@@ -20,7 +20,7 @@ struct netpoll { ...@@ -20,7 +20,7 @@ struct netpoll {
u32 local_ip, remote_ip; u32 local_ip, remote_ip;
u16 local_port, remote_port; u16 local_port, remote_port;
u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN]; u8 remote_mac[ETH_ALEN];
}; };
struct netpoll_info { struct netpoll_info {
......
...@@ -360,8 +360,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) ...@@ -360,8 +360,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->protocol = eth->h_proto = htons(ETH_P_IP); skb->protocol = eth->h_proto = htons(ETH_P_IP);
memcpy(eth->h_source, np->local_mac, 6); memcpy(eth->h_source, np->dev->dev_addr, ETH_ALEN);
memcpy(eth->h_dest, np->remote_mac, 6); memcpy(eth->h_dest, np->remote_mac, ETH_ALEN);
skb->dev = np->dev; skb->dev = np->dev;
...@@ -431,7 +431,7 @@ static void arp_reply(struct sk_buff *skb) ...@@ -431,7 +431,7 @@ static void arp_reply(struct sk_buff *skb)
/* Fill the device header for the ARP frame */ /* Fill the device header for the ARP frame */
if (dev_hard_header(send_skb, skb->dev, ptype, if (dev_hard_header(send_skb, skb->dev, ptype,
sha, np->local_mac, sha, np->dev->dev_addr,
send_skb->len) < 0) { send_skb->len) < 0) {
kfree_skb(send_skb); kfree_skb(send_skb);
return; return;
...@@ -737,9 +737,6 @@ int netpoll_setup(struct netpoll *np) ...@@ -737,9 +737,6 @@ int netpoll_setup(struct netpoll *np)
} }
} }
if (is_zero_ether_addr(np->local_mac) && ndev->dev_addr)
memcpy(np->local_mac, ndev->dev_addr, 6);
if (!np->local_ip) { if (!np->local_ip) {
rcu_read_lock(); rcu_read_lock();
in_dev = __in_dev_get_rcu(ndev); in_dev = __in_dev_get_rcu(ndev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment