netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6 5/7] atm: [br2864] fix routed vcmux support
@ 2008-06-16 17:27 chas williams - CONTRACTOR
  2008-06-17  0:20 ` David Miller
  2008-10-02  4:09 ` Maxime Bizon
  0 siblings, 2 replies; 3+ messages in thread
From: chas williams - CONTRACTOR @ 2008-06-16 17:27 UTC (permalink / raw)
  To: netdev; +Cc: davem

commit 1390b21d5244dc3a8a929778ffd2fde05613c761
Author: Eric Kinzie <ekinzie@cmf.nrl.navy.mil>
Date:   Sat Jun 14 17:33:35 2008 -0400

    atm: [br2864] fix routed vcmux support
    
    From: Eric Kinzie <ekinzie@cmf.nrl.navy.mil>
    Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index ac60350..05fafdc 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -188,10 +188,13 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
 				return 0;
 			}
 		}
-	} else {
-		skb_push(skb, 2);
-		if (brdev->payload == p_bridged)
+	} else { /* e_vc */
+		if (brdev->payload == p_bridged) {
+			skb_push(skb, 2);
 			memset(skb->data, 0, 2);
+		} else { /* p_routed */
+			skb_pull(skb, ETH_HLEN);
+		}
 	}
 	skb_debug(skb);
 
@@ -377,11 +380,8 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
 				 (skb->data + 6, ethertype_ipv4,
 				  sizeof(ethertype_ipv4)) == 0)
 				skb->protocol = __constant_htons(ETH_P_IP);
-			else {
-				brdev->stats.rx_errors++;
-				dev_kfree_skb(skb);
-				return;
-			}
+			else
+				goto error;
 			skb_pull(skb, sizeof(llc_oui_ipv4));
 			skb_reset_network_header(skb);
 			skb->pkt_type = PACKET_HOST;
@@ -394,44 +394,56 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
 			   (memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) {
 			skb_pull(skb, sizeof(llc_oui_pid_pad));
 			skb->protocol = eth_type_trans(skb, net_dev);
-		} else {
-			brdev->stats.rx_errors++;
-			dev_kfree_skb(skb);
-			return;
-		}
+		} else
+			goto error;
 
-	} else {
-		/* first 2 chars should be 0 */
-		if (*((u16 *) (skb->data)) != 0) {
-			brdev->stats.rx_errors++;
-			dev_kfree_skb(skb);
-			return;
+	} else { /* e_vc */
+		if (brdev->payload == p_routed) {
+			struct iphdr *iph;
+
+			skb_reset_network_header(skb);
+			iph = ip_hdr(skb);
+			if (iph->version == 4)
+				skb->protocol = __constant_htons(ETH_P_IP);
+			else if (iph->version == 6)
+				skb->protocol = __constant_htons(ETH_P_IPV6);
+			else
+				goto error;
+			skb->pkt_type = PACKET_HOST;
+		} else { /* p_bridged */
+			/* first 2 chars should be 0 */
+			if (*((u16 *) (skb->data)) != 0)
+				goto error;
+			skb_pull(skb, BR2684_PAD_LEN);
+			skb->protocol = eth_type_trans(skb, net_dev);
 		}
-		skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN);	/* pad, dstmac, srcmac, ethtype */
-		skb->protocol = eth_type_trans(skb, net_dev);
 	}
 
 #ifdef CONFIG_ATM_BR2684_IPFILTER
-	if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
-		brdev->stats.rx_dropped++;
-		dev_kfree_skb(skb);
-		return;
-	}
+	if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb)))
+		goto dropped;
 #endif /* CONFIG_ATM_BR2684_IPFILTER */
 	skb->dev = net_dev;
 	ATM_SKB(skb)->vcc = atmvcc;	/* needed ? */
 	pr_debug("received packet's protocol: %x\n", ntohs(skb->protocol));
 	skb_debug(skb);
-	if (unlikely(!(net_dev->flags & IFF_UP))) {
-		/* sigh, interface is down */
-		brdev->stats.rx_dropped++;
-		dev_kfree_skb(skb);
-		return;
-	}
+	/* sigh, interface is down? */
+	if (unlikely(!(net_dev->flags & IFF_UP)))
+		goto dropped;
 	brdev->stats.rx_packets++;
 	brdev->stats.rx_bytes += skb->len;
 	memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
 	netif_rx(skb);
+	return;
+
+dropped:
+	brdev->stats.rx_dropped++;
+	goto free_skb;
+error:
+	brdev->stats.rx_errors++;
+free_skb:
+	dev_kfree_skb(skb);
+	return;
 }
 
 /*

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

* Re: [PATCH net-2.6 5/7] atm: [br2864] fix routed vcmux support
  2008-06-16 17:27 [PATCH net-2.6 5/7] atm: [br2864] fix routed vcmux support chas williams - CONTRACTOR
@ 2008-06-17  0:20 ` David Miller
  2008-10-02  4:09 ` Maxime Bizon
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2008-06-17  0:20 UTC (permalink / raw)
  To: chas; +Cc: netdev

From: "chas williams - CONTRACTOR" <chas@cmf.nrl.navy.mil>
Date: Mon, 16 Jun 2008 13:27:41 -0400

>     atm: [br2864] fix routed vcmux support
>     
>     From: Eric Kinzie <ekinzie@cmf.nrl.navy.mil>
>     Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>

Applied.

But please provide more detailed commit messages, this one leaves a
lot to be desired.

What was broken about vcmux support and what was the top-level scheme
used to fix that problem?

Not many people other than the author of the patch knows the answer to
those questions because this commit message is opaque.  If someone
has to come across this commit to try and diagnose something, they
will be pretty lost as to what was the intent here.


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

* Re: [PATCH net-2.6 5/7] atm: [br2864] fix routed vcmux support
  2008-06-16 17:27 [PATCH net-2.6 5/7] atm: [br2864] fix routed vcmux support chas williams - CONTRACTOR
  2008-06-17  0:20 ` David Miller
@ 2008-10-02  4:09 ` Maxime Bizon
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Bizon @ 2008-10-02  4:09 UTC (permalink / raw)
  To: chas williams - CONTRACTOR; +Cc: netdev, davem


On Mon, 2008-06-16 at 13:27 -0400, chas williams - CONTRACTOR wrote:

Hello,

> commit 1390b21d5244dc3a8a929778ffd2fde05613c761
> Author: Eric Kinzie <ekinzie@cmf.nrl.navy.mil>
> Date:   Sat Jun 14 17:33:35 2008 -0400
> 
>     atm: [br2864] fix routed vcmux support
>     
>     From: Eric Kinzie <ekinzie@cmf.nrl.navy.mil>
>     Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
> 
> diff --git a/net/atm/br2684.c b/net/atm/br2684.c
> index ac60350..05fafdc 100644
> --- a/net/atm/br2684.c
> +++ b/net/atm/br2684.c
> @@ -188,10 +188,13 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
>  				return 0;
>  			}
>  		}
> -	} else {
> -		skb_push(skb, 2);
> -		if (brdev->payload == p_bridged)
> +	} else { /* e_vc */
> +		if (brdev->payload == p_bridged) {
> +			skb_push(skb, 2);
>  			memset(skb->data, 0, 2);
> +		} else { /* p_routed */
> +			skb_pull(skb, ETH_HLEN);
> +		}
>  	}

Very old stuff sorry, but could you explain the skb_pull(skb, ETH_HLEN)
for e_vc/p_routed ?

netdevice is declared like this:

	netdev->hard_header_len = 0;
	netdev->type = ARPHRD_PPP;
	netdev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;

so there should be no ethernet header to remove.


Regards,

-- 
Maxime


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

end of thread, other threads:[~2008-10-02  4:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16 17:27 [PATCH net-2.6 5/7] atm: [br2864] fix routed vcmux support chas williams - CONTRACTOR
2008-06-17  0:20 ` David Miller
2008-10-02  4:09 ` Maxime Bizon

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