netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* build failure from ip6mr stats change.
@ 2008-05-21 21:42 David Miller
  2008-05-22  8:32 ` Pavel Emelyanov
  0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2008-05-21 21:42 UTC (permalink / raw)
  To: xemul; +Cc: netdev


How could you possibly have test compiled this?

You kept the "stats->foo" dereferences but those all
need to be "stats.foo"

I've fixed it up as below.

UGH, the ipv4 ipmr patch has the same problem, I'll fix that up to :-(

ip6mr: Use on-device stats instead of private ones.

Similar to ipmr.

[ Fix build failures -DaveM ]

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv6/ip6mr.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 2de3c46..6d76103 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -388,8 +388,8 @@ static int pim6_rcv(struct sk_buff *skb)
 	skb->ip_summed = 0;
 	skb->pkt_type = PACKET_HOST;
 	dst_release(skb->dst);
-	((struct net_device_stats *)netdev_priv(reg_dev))->rx_bytes += skb->len;
-	((struct net_device_stats *)netdev_priv(reg_dev))->rx_packets++;
+	reg_dev->stats.rx_bytes += skb->len;
+	reg_dev->stats.rx_packets++;
 	skb->dst = NULL;
 	nf_reset(skb);
 	netif_rx(skb);
@@ -409,26 +409,20 @@ static struct inet6_protocol pim6_protocol = {
 static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	read_lock(&mrt_lock);
-	((struct net_device_stats *)netdev_priv(dev))->tx_bytes += skb->len;
-	((struct net_device_stats *)netdev_priv(dev))->tx_packets++;
+	dev->stats.tx_bytes += skb->len;
+	dev->stats.tx_packets++;
 	ip6mr_cache_report(skb, reg_vif_num, MRT6MSG_WHOLEPKT);
 	read_unlock(&mrt_lock);
 	kfree_skb(skb);
 	return 0;
 }
 
-static struct net_device_stats *reg_vif_get_stats(struct net_device *dev)
-{
-	return (struct net_device_stats *)netdev_priv(dev);
-}
-
 static void reg_vif_setup(struct net_device *dev)
 {
 	dev->type		= ARPHRD_PIMREG;
 	dev->mtu		= 1500 - sizeof(struct ipv6hdr) - 8;
 	dev->flags		= IFF_NOARP;
 	dev->hard_start_xmit	= reg_vif_xmit;
-	dev->get_stats		= reg_vif_get_stats;
 	dev->destructor		= free_netdev;
 }
 
@@ -436,9 +430,7 @@ static struct net_device *ip6mr_reg_vif(void)
 {
 	struct net_device *dev;
 
-	dev = alloc_netdev(sizeof(struct net_device_stats), "pim6reg",
-			   reg_vif_setup);
-
+	dev = alloc_netdev(0, "pim6reg", reg_vif_setup);
 	if (dev == NULL)
 		return NULL;
 
@@ -1377,8 +1369,8 @@ static int ip6mr_forward2(struct sk_buff *skb, struct mfc6_cache *c, int vifi)
 	if (vif->flags & MIFF_REGISTER) {
 		vif->pkt_out++;
 		vif->bytes_out += skb->len;
-		((struct net_device_stats *)netdev_priv(vif->dev))->tx_bytes += skb->len;
-		((struct net_device_stats *)netdev_priv(vif->dev))->tx_packets++;
+		vif->dev->stats.tx_bytes += skb->len;
+		vif->dev->stats.tx_packets++;
 		ip6mr_cache_report(skb, vifi, MRT6MSG_WHOLEPKT);
 		kfree_skb(skb);
 		return 0;
-- 
1.5.5.1.308.g1fbb5


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

* Re: build failure from ip6mr stats change.
  2008-05-21 21:42 build failure from ip6mr stats change David Miller
@ 2008-05-22  8:32 ` Pavel Emelyanov
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Emelyanov @ 2008-05-22  8:32 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

David Miller wrote:
> How could you possibly have test compiled this?
> 
> You kept the "stats->foo" dereferences but those all
> need to be "stats.foo"

Yikes! 8( I swear I saw the

  CC    net/ipv6/ip6mr.o

line when building one...

Argh :( I didn't turn the CONFIG_IP_PIMSM on and all statistics
happened to be under this option only.

> I've fixed it up as below.
> 
> UGH, the ipv4 ipmr patch has the same problem, I'll fix that up to :-(

Thank you. Sorry for bad patchset :(

> ip6mr: Use on-device stats instead of private ones.
> 
> Similar to ipmr.
> 
> [ Fix build failures -DaveM ]
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> Signed-off-by: David S. Miller <davem@davemloft.net>

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

end of thread, other threads:[~2008-05-22  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 21:42 build failure from ip6mr stats change David Miller
2008-05-22  8:32 ` Pavel Emelyanov

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).