From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>, Satyam Sharma <satyam@infradead.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 03/11] netpoll: no need to store local_mac
Date: Sat, 03 Nov 2007 11:43:17 -0700 [thread overview]
Message-ID: <20071103184338.581312051@linux-foundation.org> (raw)
In-Reply-To: 20071103184314.216145305@linux-foundation.org
[-- Attachment #1: netpoll-local-mac.patch --]
[-- Type: text/plain, Size: 2812 bytes --]
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>
--- a/include/linux/netpoll.h 2007-11-03 09:12:48.000000000 -0700
+++ b/include/linux/netpoll.h 2007-11-03 09:18:34.000000000 -0700
@@ -20,7 +20,7 @@ struct netpoll {
u32 local_ip, remote_ip;
u16 local_port, remote_port;
- u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN];
+ u8 remote_mac[ETH_ALEN];
};
struct netpoll_info {
--- a/net/core/netpoll.c 2007-11-03 09:18:30.000000000 -0700
+++ b/net/core/netpoll.c 2007-11-03 09:19:34.000000000 -0700
@@ -360,8 +360,8 @@ void netpoll_send_udp(struct netpoll *np
eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
skb_reset_mac_header(skb);
skb->protocol = eth->h_proto = htons(ETH_P_IP);
- memcpy(eth->h_source, np->local_mac, 6);
- memcpy(eth->h_dest, np->remote_mac, 6);
+ memcpy(eth->h_source, np->dev->dev_addr, ETH_ALEN);
+ memcpy(eth->h_dest, np->remote_mac, ETH_ALEN);
skb->dev = np->dev;
@@ -431,7 +431,7 @@ static void arp_reply(struct sk_buff *sk
/* Fill the device header for the ARP frame */
if (dev_hard_header(send_skb, skb->dev, ptype,
- sha, np->local_mac,
+ sha, np->dev->dev_addr,
send_skb->len) < 0) {
kfree_skb(send_skb);
return;
@@ -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) {
rcu_read_lock();
in_dev = __in_dev_get_rcu(ndev);
--- a/drivers/net/netconsole.c 2007-10-17 15:25:31.000000000 -0700
+++ b/drivers/net/netconsole.c 2007-11-03 09:26:27.000000000 -0700
@@ -306,9 +306,11 @@ static ssize_t show_remote_ip(struct net
static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
{
+ struct net_device *dev = nt->np.dev;
+
DECLARE_MAC_BUF(mac);
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)
@@ -667,7 +669,7 @@ static int netconsole_netdev_event(struc
struct netconsole_target *nt;
struct net_device *dev = ptr;
- if (!(event == NETDEV_CHANGEADDR || event == NETDEV_CHANGENAME))
+ if (!(event == NETDEV_CHANGENAME))
goto done;
spin_lock_irqsave(&target_list_lock, flags);
@@ -675,10 +677,6 @@ static int netconsole_netdev_event(struc
netconsole_target_get(nt);
if (nt->np.dev == dev) {
switch (event) {
- case NETDEV_CHANGEADDR:
- memcpy(nt->np.local_mac, dev->dev_addr, ETH_ALEN);
- break;
-
case NETDEV_CHANGENAME:
strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
break;
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-11-03 23:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-03 18:43 [PATCH 00/11] netpoll cleanups Stephen Hemminger
2007-11-03 18:43 ` [PATCH 01/11] netpoll: use skb_queue_purge Stephen Hemminger
2007-11-20 3:15 ` David Miller
2007-11-03 18:43 ` [PATCH 02/11] netpoll: netpoll_poll cleanup Stephen Hemminger
2007-11-20 3:21 ` David Miller
2007-11-03 18:43 ` Stephen Hemminger [this message]
2007-11-20 3:23 ` [PATCH 03/11] netpoll: no need to store local_mac David Miller
2007-11-03 18:43 ` [PATCH 04/11] netpoll: alternative implementation of dropping Stephen Hemminger
2007-11-20 3:25 ` David Miller
2007-11-03 18:43 ` [PATCH 05/11] netpoll: dont need rx_flags Stephen Hemminger
2007-11-20 3:39 ` David Miller
2007-11-03 18:43 ` [PATCH 06/11] netpoll: remove dev_name for npinfo Stephen Hemminger
2007-11-20 3:47 ` David Miller
2007-11-20 4:07 ` Stephen Hemminger
2007-11-03 18:43 ` [PATCH 07/11] netpoll: get rid of name parameter Stephen Hemminger
2007-11-20 3:49 ` David Miller
2007-11-03 18:43 ` [PATCH 08/11] netpoll: NETPOLL_TRAP configuration change Stephen Hemminger
2007-11-20 3:52 ` David Miller
2007-11-03 18:43 ` [PATCH 09/11] netpoll: ethernet devices only Stephen Hemminger
2007-11-20 3:55 ` David Miller
2007-11-20 4:14 ` Stephen Hemminger
2007-11-03 18:43 ` [PATCH 10/11] netpoll: rx optimization Stephen Hemminger
2007-11-20 4:00 ` David Miller
2007-11-03 18:43 ` [PATCH 11/11] netpoll: rx use RCU Stephen Hemminger
2007-11-20 4:00 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071103184338.581312051@linux-foundation.org \
--to=shemminger@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=satyam@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).