Patchwork [v2] macvlan: Fix rx counters update in macvlan_handle_frame()

login
register
mail settings
Submitter Sridhar Samudrala
Date July 27, 2010, 7:10 p.m.
Message ID <1280257807.27059.4.camel@w-sridhar.beaverton.ibm.com>
Download mbox | patch
Permalink /patch/60033/
State Accepted
Delegated to: David Miller
Headers show

Comments

Sridhar Samudrala - July 27, 2010, 7:10 p.m.
Fix macvlan_handle_frame() to update the rx counters based
on the return value of the vlan->receive call.

Updated the patch to not do any packet count drops when the interface
is down based on Herber'ts comments.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu - July 28, 2010, 12:14 a.m.
On Tue, Jul 27, 2010 at 12:10:07PM -0700, Sridhar Samudrala wrote:
> Fix macvlan_handle_frame() to update the rx counters based
> on the return value of the vlan->receive call.
> 
> Updated the patch to not do any packet count drops when the interface
> is down based on Herber'ts comments.
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
David Miller - July 28, 2010, 4:03 a.m.
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 28 Jul 2010 08:14:04 +0800

> On Tue, Jul 27, 2010 at 12:10:07PM -0700, Sridhar Samudrala wrote:
>> Fix macvlan_handle_frame() to update the rx counters based
>> on the return value of the vlan->receive call.
>> 
>> Updated the patch to not do any packet count drops when the interface
>> is down based on Herber'ts comments.
>> 
>> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied to net-next-2.6, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 87e8d4c..bcb1b36 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -152,7 +152,8 @@  static struct sk_buff *macvlan_handle_frame(struct macvlan_port *port,
 	const struct macvlan_dev *vlan;
 	const struct macvlan_dev *src;
 	struct net_device *dev;
-	unsigned int len;
+	unsigned int len = 0;
+	int ret = NET_RX_DROP;
 
 	if (is_multicast_ether_addr(eth->h_dest)) {
 		src = macvlan_hash_lookup(port, eth->h_source);
@@ -188,14 +189,16 @@  static struct sk_buff *macvlan_handle_frame(struct macvlan_port *port,
 	}
 	len = skb->len + ETH_HLEN;
 	skb = skb_share_check(skb, GFP_ATOMIC);
-	macvlan_count_rx(vlan, len, skb != NULL, 0);
 	if (!skb)
-		return NULL;
+		goto out;
 
 	skb->dev = dev;
 	skb->pkt_type = PACKET_HOST;
 
-	vlan->receive(skb);
+	ret = vlan->receive(skb);
+
+out:
+	macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
 	return NULL;
 }