All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN
@ 2014-02-23  8:05 ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2014-02-23  8:05 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, David S. Miller, bridge, linux-kernel

Convert the more obvious uses of memcpy to ether_addr_copy.

There are still uses of memcpy that could be converted but
these addresses are __aligned(2).

Convert a couple uses of 6 in gr_private.h to ETH_ALEN.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/bridge/br_device.c    | 2 +-
 net/bridge/br_multicast.c | 4 ++--
 net/bridge/br_private.h   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index bf34451..b063050 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -367,7 +367,7 @@ void br_dev_setup(struct net_device *dev)
 	br->bridge_id.prio[0] = 0x80;
 	br->bridge_id.prio[1] = 0x00;
 
-	memcpy(br->group_addr, eth_reserved_addr_base, ETH_ALEN);
+	ether_addr_copy(br->group_addr, eth_reserved_addr_base);
 
 	br->stp_enabled = BR_NO_STP;
 	br->group_fwd_mask = BR_GROUPFWD_DEFAULT;
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index ef66365..c97c3c8 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -363,7 +363,7 @@ static struct sk_buff *br_ip4_multicast_alloc_query(struct net_bridge *br,
 	skb_reset_mac_header(skb);
 	eth = eth_hdr(skb);
 
-	memcpy(eth->h_source, br->dev->dev_addr, ETH_ALEN);
+	ether_addr_copy(eth->h_source, br->dev->dev_addr);
 	eth->h_dest[0] = 1;
 	eth->h_dest[1] = 0;
 	eth->h_dest[2] = 0x5e;
@@ -433,7 +433,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
 	skb_reset_mac_header(skb);
 	eth = eth_hdr(skb);
 
-	memcpy(eth->h_source, br->dev->dev_addr, ETH_ALEN);
+	ether_addr_copy(eth->h_source, br->dev->dev_addr);
 	eth->h_proto = htons(ETH_P_IPV6);
 	skb_put(skb, sizeof(*eth));
 
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 3ba11bc..e1ca1dc 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -46,12 +46,12 @@ typedef __u16 port_id;
 struct bridge_id
 {
 	unsigned char	prio[2];
-	unsigned char	addr[6];
+	unsigned char	addr[ETH_ALEN];
 };
 
 struct mac_addr
 {
-	unsigned char	addr[6];
+	unsigned char	addr[ETH_ALEN];
 };
 
 struct br_ip
-- 
1.8.1.2.459.gbcd45b4.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Bridge] [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN
@ 2014-02-23  8:05 ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2014-02-23  8:05 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, bridge, David S. Miller, linux-kernel

Convert the more obvious uses of memcpy to ether_addr_copy.

There are still uses of memcpy that could be converted but
these addresses are __aligned(2).

Convert a couple uses of 6 in gr_private.h to ETH_ALEN.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/bridge/br_device.c    | 2 +-
 net/bridge/br_multicast.c | 4 ++--
 net/bridge/br_private.h   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index bf34451..b063050 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -367,7 +367,7 @@ void br_dev_setup(struct net_device *dev)
 	br->bridge_id.prio[0] = 0x80;
 	br->bridge_id.prio[1] = 0x00;
 
-	memcpy(br->group_addr, eth_reserved_addr_base, ETH_ALEN);
+	ether_addr_copy(br->group_addr, eth_reserved_addr_base);
 
 	br->stp_enabled = BR_NO_STP;
 	br->group_fwd_mask = BR_GROUPFWD_DEFAULT;
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index ef66365..c97c3c8 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -363,7 +363,7 @@ static struct sk_buff *br_ip4_multicast_alloc_query(struct net_bridge *br,
 	skb_reset_mac_header(skb);
 	eth = eth_hdr(skb);
 
-	memcpy(eth->h_source, br->dev->dev_addr, ETH_ALEN);
+	ether_addr_copy(eth->h_source, br->dev->dev_addr);
 	eth->h_dest[0] = 1;
 	eth->h_dest[1] = 0;
 	eth->h_dest[2] = 0x5e;
@@ -433,7 +433,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
 	skb_reset_mac_header(skb);
 	eth = eth_hdr(skb);
 
-	memcpy(eth->h_source, br->dev->dev_addr, ETH_ALEN);
+	ether_addr_copy(eth->h_source, br->dev->dev_addr);
 	eth->h_proto = htons(ETH_P_IPV6);
 	skb_put(skb, sizeof(*eth));
 
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 3ba11bc..e1ca1dc 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -46,12 +46,12 @@ typedef __u16 port_id;
 struct bridge_id
 {
 	unsigned char	prio[2];
-	unsigned char	addr[6];
+	unsigned char	addr[ETH_ALEN];
 };
 
 struct mac_addr
 {
-	unsigned char	addr[6];
+	unsigned char	addr[ETH_ALEN];
 };
 
 struct br_ip
-- 
1.8.1.2.459.gbcd45b4.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] bridge: netfilter: Use ether_addr_copy
  2014-02-23  8:05 ` [Bridge] " Joe Perches
@ 2014-02-23  8:05   ` Joe Perches
  -1 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2014-02-23  8:05 UTC (permalink / raw)
  To: netdev
  Cc: Stephen Hemminger, David S. Miller, Bart De Schuymer,
	Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik, bridge,
	linux-kernel, netfilter-devel, netfilter, coreteam

Convert the uses of memcpy to ether_addr_copy because
for some architectures it is smaller and faster.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/bridge/br_netfilter.c           | 2 +-
 net/bridge/netfilter/ebt_among.c    | 2 +-
 net/bridge/netfilter/ebt_dnat.c     | 2 +-
 net/bridge/netfilter/ebt_redirect.c | 6 +++---
 net/bridge/netfilter/ebt_snat.c     | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index b008c59..df0f114 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -506,7 +506,7 @@ bridged_dnat:
 					       1);
 				return 0;
 			}
-			memcpy(eth_hdr(skb)->h_dest, dev->dev_addr, ETH_ALEN);
+			ether_addr_copy(eth_hdr(skb)->h_dest, dev->dev_addr);
 			skb->pkt_type = PACKET_HOST;
 		}
 	} else {
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 3fb3c84..9024283 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -28,7 +28,7 @@ static bool ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
 	uint32_t cmp[2] = { 0, 0 };
 	int key = ((const unsigned char *)mac)[5];
 
-	memcpy(((char *) cmp) + 2, mac, ETH_ALEN);
+	ether_addr_copy(((char *) cmp) + 2, mac);
 	start = wh->table[key];
 	limit = wh->table[key + 1];
 	if (ip) {
diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c
index c59f7bf..4e0b0c3 100644
--- a/net/bridge/netfilter/ebt_dnat.c
+++ b/net/bridge/netfilter/ebt_dnat.c
@@ -22,7 +22,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
 	if (!skb_make_writable(skb, 0))
 		return EBT_DROP;
 
-	memcpy(eth_hdr(skb)->h_dest, info->mac, ETH_ALEN);
+	ether_addr_copy(eth_hdr(skb)->h_dest, info->mac);
 	return info->target;
 }
 
diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c
index 46624bb..20396499 100644
--- a/net/bridge/netfilter/ebt_redirect.c
+++ b/net/bridge/netfilter/ebt_redirect.c
@@ -25,10 +25,10 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
 
 	if (par->hooknum != NF_BR_BROUTING)
 		/* rcu_read_lock()ed by nf_hook_slow */
-		memcpy(eth_hdr(skb)->h_dest,
-		       br_port_get_rcu(par->in)->br->dev->dev_addr, ETH_ALEN);
+		ether_addr_copy(eth_hdr(skb)->h_dest,
+				br_port_get_rcu(par->in)->br->dev->dev_addr);
 	else
-		memcpy(eth_hdr(skb)->h_dest, par->in->dev_addr, ETH_ALEN);
+		ether_addr_copy(eth_hdr(skb)->h_dest, par->in->dev_addr);
 	skb->pkt_type = PACKET_HOST;
 	return info->target;
 }
diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c
index 0f6b118..e56ccd0 100644
--- a/net/bridge/netfilter/ebt_snat.c
+++ b/net/bridge/netfilter/ebt_snat.c
@@ -24,7 +24,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
 	if (!skb_make_writable(skb, 0))
 		return EBT_DROP;
 
-	memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
+	ether_addr_copy(eth_hdr(skb)->h_source, info->mac);
 	if (!(info->target & NAT_ARP_BIT) &&
 	    eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
 		const struct arphdr *ap;
-- 
1.8.1.2.459.gbcd45b4.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Bridge] [PATCH 2/2] bridge: netfilter: Use ether_addr_copy
@ 2014-02-23  8:05   ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2014-02-23  8:05 UTC (permalink / raw)
  To: netdev
  Cc: netfilter, coreteam, bridge, linux-kernel, Patrick McHardy,
	Stephen Hemminger, Bart De Schuymer, netfilter-devel,
	Jozsef Kadlecsik, David S. Miller, Pablo Neira Ayuso

Convert the uses of memcpy to ether_addr_copy because
for some architectures it is smaller and faster.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/bridge/br_netfilter.c           | 2 +-
 net/bridge/netfilter/ebt_among.c    | 2 +-
 net/bridge/netfilter/ebt_dnat.c     | 2 +-
 net/bridge/netfilter/ebt_redirect.c | 6 +++---
 net/bridge/netfilter/ebt_snat.c     | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index b008c59..df0f114 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -506,7 +506,7 @@ bridged_dnat:
 					       1);
 				return 0;
 			}
-			memcpy(eth_hdr(skb)->h_dest, dev->dev_addr, ETH_ALEN);
+			ether_addr_copy(eth_hdr(skb)->h_dest, dev->dev_addr);
 			skb->pkt_type = PACKET_HOST;
 		}
 	} else {
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 3fb3c84..9024283 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -28,7 +28,7 @@ static bool ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
 	uint32_t cmp[2] = { 0, 0 };
 	int key = ((const unsigned char *)mac)[5];
 
-	memcpy(((char *) cmp) + 2, mac, ETH_ALEN);
+	ether_addr_copy(((char *) cmp) + 2, mac);
 	start = wh->table[key];
 	limit = wh->table[key + 1];
 	if (ip) {
diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c
index c59f7bf..4e0b0c3 100644
--- a/net/bridge/netfilter/ebt_dnat.c
+++ b/net/bridge/netfilter/ebt_dnat.c
@@ -22,7 +22,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
 	if (!skb_make_writable(skb, 0))
 		return EBT_DROP;
 
-	memcpy(eth_hdr(skb)->h_dest, info->mac, ETH_ALEN);
+	ether_addr_copy(eth_hdr(skb)->h_dest, info->mac);
 	return info->target;
 }
 
diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c
index 46624bb..20396499 100644
--- a/net/bridge/netfilter/ebt_redirect.c
+++ b/net/bridge/netfilter/ebt_redirect.c
@@ -25,10 +25,10 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
 
 	if (par->hooknum != NF_BR_BROUTING)
 		/* rcu_read_lock()ed by nf_hook_slow */
-		memcpy(eth_hdr(skb)->h_dest,
-		       br_port_get_rcu(par->in)->br->dev->dev_addr, ETH_ALEN);
+		ether_addr_copy(eth_hdr(skb)->h_dest,
+				br_port_get_rcu(par->in)->br->dev->dev_addr);
 	else
-		memcpy(eth_hdr(skb)->h_dest, par->in->dev_addr, ETH_ALEN);
+		ether_addr_copy(eth_hdr(skb)->h_dest, par->in->dev_addr);
 	skb->pkt_type = PACKET_HOST;
 	return info->target;
 }
diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c
index 0f6b118..e56ccd0 100644
--- a/net/bridge/netfilter/ebt_snat.c
+++ b/net/bridge/netfilter/ebt_snat.c
@@ -24,7 +24,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
 	if (!skb_make_writable(skb, 0))
 		return EBT_DROP;
 
-	memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
+	ether_addr_copy(eth_hdr(skb)->h_source, info->mac);
 	if (!(info->target & NAT_ARP_BIT) &&
 	    eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
 		const struct arphdr *ap;
-- 
1.8.1.2.459.gbcd45b4.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN
  2014-02-23  8:05 ` [Bridge] " Joe Perches
  (?)
@ 2014-02-25  0:16   ` David Miller
  -1 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-02-25  0:16 UTC (permalink / raw)
  To: joe; +Cc: netdev, stephen, bridge, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Sun, 23 Feb 2014 00:05:25 -0800

> Convert the more obvious uses of memcpy to ether_addr_copy.
> 
> There are still uses of memcpy that could be converted but
> these addresses are __aligned(2).
> 
> Convert a couple uses of 6 in gr_private.h to ETH_ALEN.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN
@ 2014-02-25  0:16   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-02-25  0:16 UTC (permalink / raw)
  To: joe; +Cc: stephen, netdev, bridge, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Sun, 23 Feb 2014 00:05:25 -0800

> Convert the more obvious uses of memcpy to ether_addr_copy.
> 
> There are still uses of memcpy that could be converted but
> these addresses are __aligned(2).
> 
> Convert a couple uses of 6 in gr_private.h to ETH_ALEN.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Bridge] [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN
@ 2014-02-25  0:16   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-02-25  0:16 UTC (permalink / raw)
  To: joe; +Cc: stephen, netdev, bridge, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Sun, 23 Feb 2014 00:05:25 -0800

> Convert the more obvious uses of memcpy to ether_addr_copy.
> 
> There are still uses of memcpy that could be converted but
> these addresses are __aligned(2).
> 
> Convert a couple uses of 6 in gr_private.h to ETH_ALEN.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] bridge: netfilter: Use ether_addr_copy
  2014-02-23  8:05   ` [Bridge] " Joe Perches
@ 2014-02-25  0:17     ` David Miller
  -1 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-02-25  0:17 UTC (permalink / raw)
  To: joe
  Cc: netdev, stephen, bart.de.schuymer, pablo, kaber, kadlec, bridge,
	linux-kernel, netfilter-devel, netfilter, coreteam

From: Joe Perches <joe@perches.com>
Date: Sun, 23 Feb 2014 00:05:26 -0800

> Convert the uses of memcpy to ether_addr_copy because
> for some architectures it is smaller and faster.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Bridge] [PATCH 2/2] bridge: netfilter: Use ether_addr_copy
@ 2014-02-25  0:17     ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-02-25  0:17 UTC (permalink / raw)
  To: joe
  Cc: netfilter, coreteam, netdev, bridge, linux-kernel, stephen,
	bart.de.schuymer, netfilter-devel, kadlec, kaber, pablo

From: Joe Perches <joe@perches.com>
Date: Sun, 23 Feb 2014 00:05:26 -0800

> Convert the uses of memcpy to ether_addr_copy because
> for some architectures it is smaller and faster.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-25  0:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-23  8:05 [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN Joe Perches
2014-02-23  8:05 ` [Bridge] " Joe Perches
2014-02-23  8:05 ` [PATCH 2/2] bridge: netfilter: Use ether_addr_copy Joe Perches
2014-02-23  8:05   ` [Bridge] " Joe Perches
2014-02-25  0:17   ` David Miller
2014-02-25  0:17     ` [Bridge] " David Miller
2014-02-25  0:16 ` [PATCH 1/2] bridge: Use ether_addr_copy and ETH_ALEN David Miller
2014-02-25  0:16   ` [Bridge] " David Miller
2014-02-25  0:16   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.