Re: [PATCH] net: add ETH_P_802_3_MIN

2013-03-22 Thread Simon Horman
On Thu, Mar 21, 2013 at 11:56:08AM -0400, David Miller wrote:
> From: Simon Horman 
> Date: Thu, 21 Mar 2013 17:29:28 +0900
> 
> > Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
> > an 802.3 frame. Frames with a lower value in the ethernet type field
> > are Ethernet II.
> > 
> > Also update all the users of this value that I could find to use the
> > new constant.
> > 
> > I anticipate adding some more users of this constant when
> > adding MPLS support to Open vSwtich.
> > 
> > As suggested by Jesse Gross.
> > 
> > Compile tested only.
> > 
> > Signed-off-by: Simon Horman 
> 
> You missed a few cases:
> 
> drivers/media/dvb-core/dvb_net.c:   } while (p->ule_sndu_type < 1536);
> drivers/media/dvb-core/dvb_net.c:   if 
> (priv->ule_sndu_type < 1536) {
> net/atm/lec.h: *is less than 1536(0x0600) MUST be encoded by placing that 
> length
> drivers/net/wireless/ray_cs.c:  if (ntohs(proto) >= 1536) { /* DIX II 
> ethernet frame */
> net/bridge/netfilter/ebtables.c:if (FWINV2(ntohs(ethproto) >= 
> 1536, EBT_IPROTO))
> include/linux/if_vlan.h:if (ntohs(proto) >= 1536) {
> net/bluetooth/bnep/netdev.c:if (proto >= 1536)
> net/openvswitch/flow.c: if (ntohs(proto) >= 1536)
> net/mac80211/tx.c:  } else if (ethertype >= 0x600) {
> net/wireless/util.c:} else if (ethertype > 0x600) {
> 
> In fact, the last line looks like a bug, it should be >= not >.

Thanks for finding those.

> Could you take care of these bits and respin your patch?

Sure.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: add ETH_P_802_3_MIN

2013-03-21 Thread David Miller
From: Simon Horman 
Date: Thu, 21 Mar 2013 17:29:28 +0900

> Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
> an 802.3 frame. Frames with a lower value in the ethernet type field
> are Ethernet II.
> 
> Also update all the users of this value that I could find to use the
> new constant.
> 
> I anticipate adding some more users of this constant when
> adding MPLS support to Open vSwtich.
> 
> As suggested by Jesse Gross.
> 
> Compile tested only.
> 
> Signed-off-by: Simon Horman 

You missed a few cases:

drivers/media/dvb-core/dvb_net.c:   } while (p->ule_sndu_type < 1536);
drivers/media/dvb-core/dvb_net.c:   if 
(priv->ule_sndu_type < 1536) {
net/atm/lec.h: *is less than 1536(0x0600) MUST be encoded by placing that 
length
drivers/net/wireless/ray_cs.c:  if (ntohs(proto) >= 1536) { /* DIX II ethernet 
frame */
net/bridge/netfilter/ebtables.c:if (FWINV2(ntohs(ethproto) >= 
1536, EBT_IPROTO))
include/linux/if_vlan.h:if (ntohs(proto) >= 1536) {
net/bluetooth/bnep/netdev.c:if (proto >= 1536)
net/openvswitch/flow.c: if (ntohs(proto) >= 1536)
net/mac80211/tx.c:  } else if (ethertype >= 0x600) {
net/wireless/util.c:} else if (ethertype > 0x600) {

In fact, the last line looks like a bug, it should be >= not >.

Could you take care of these bits and respin your patch?

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: add ETH_P_802_3_MIN

2013-03-21 Thread Mauro Carvalho Chehab
Em Thu, 21 Mar 2013 17:29:28 +0900
Simon Horman  escreveu:

> Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
> an 802.3 frame. Frames with a lower value in the ethernet type field
> are Ethernet II.
> 
> Also update all the users of this value that I could find to use the
> new constant.
> 
> I anticipate adding some more users of this constant when
> adding MPLS support to Open vSwtich.
> 
> As suggested by Jesse Gross.
> 
> Compile tested only.
> 
> Cc: Jesse Gross 
> Cc: Stefan Richter 
> Cc: Karsten Keil 
> Cc: Mauro Carvalho Chehab 
> Cc: linux1394-de...@lists.sourceforge.net
> Cc: linux-media@vger.kernel.org
> Cc: d...@openvswitch.org
> Signed-off-by: Simon Horman 

...

> diff --git a/drivers/media/dvb-core/dvb_net.c 
> b/drivers/media/dvb-core/dvb_net.c
> index 44225b1..9fc82a1 100644
> --- a/drivers/media/dvb-core/dvb_net.c
> +++ b/drivers/media/dvb-core/dvb_net.c
> @@ -185,7 +185,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
>   skb->pkt_type=PACKET_MULTICAST;
>   }
>  
> - if (ntohs(eth->h_proto) >= 1536)
> + if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
>   return eth->h_proto;

...

Acked-by: Mauro Carvalho Chehab 

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: add ETH_P_802_3_MIN

2013-03-21 Thread Stefan Richter
On Mar 21 Simon Horman wrote:
> Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
> an 802.3 frame. Frames with a lower value in the ethernet type field
> are Ethernet II.
> 
> Also update all the users of this value that I could find to use the
> new constant.
> 
> I anticipate adding some more users of this constant when
> adding MPLS support to Open vSwtich.
> 
> As suggested by Jesse Gross.
> 
> Compile tested only.
> 
> Cc: Jesse Gross 
> Cc: Stefan Richter 
> Cc: Karsten Keil 
> Cc: Mauro Carvalho Chehab 
> Cc: linux1394-de...@lists.sourceforge.net
> Cc: linux-media@vger.kernel.org
> Cc: d...@openvswitch.org
> Signed-off-by: Simon Horman 
> ---
>  drivers/firewire/net.c   |2 +-

Acked-by: Stefan Richter 

>  drivers/isdn/i4l/isdn_net.c  |2 +-
>  drivers/media/dvb-core/dvb_net.c |6 +++---
>  drivers/net/ethernet/sun/niu.c   |2 +-
>  drivers/net/plip/plip.c  |2 +-
>  include/uapi/linux/if_ether.h|3 +++
>  net/ethernet/eth.c   |2 +-
>  net/openvswitch/datapath.c   |2 +-
>  8 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
> index 2b27bff..bd34ca1 100644
> --- a/drivers/firewire/net.c
> +++ b/drivers/firewire/net.c
> @@ -630,7 +630,7 @@ static int fwnet_finish_incoming_packet(struct net_device 
> *net,
>   if (memcmp(eth->h_dest, net->dev_addr, net->addr_len))
>   skb->pkt_type = PACKET_OTHERHOST;
>   }
> - if (ntohs(eth->h_proto) >= 1536) {
> + if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) {
>   protocol = eth->h_proto;
>   } else {
>   rawp = (u16 *)skb->data;
[...]

-- 
Stefan Richter
-=-===-= --== =-=-=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] net: add ETH_P_802_3_MIN

2013-03-21 Thread Simon Horman
Add a new constant ETH_P_802_3_MIN, the minimum ethernet type for
an 802.3 frame. Frames with a lower value in the ethernet type field
are Ethernet II.

Also update all the users of this value that I could find to use the
new constant.

I anticipate adding some more users of this constant when
adding MPLS support to Open vSwtich.

As suggested by Jesse Gross.

Compile tested only.

Cc: Jesse Gross 
Cc: Stefan Richter 
Cc: Karsten Keil 
Cc: Mauro Carvalho Chehab 
Cc: linux1394-de...@lists.sourceforge.net
Cc: linux-media@vger.kernel.org
Cc: d...@openvswitch.org
Signed-off-by: Simon Horman 
---
 drivers/firewire/net.c   |2 +-
 drivers/isdn/i4l/isdn_net.c  |2 +-
 drivers/media/dvb-core/dvb_net.c |6 +++---
 drivers/net/ethernet/sun/niu.c   |2 +-
 drivers/net/plip/plip.c  |2 +-
 include/uapi/linux/if_ether.h|3 +++
 net/ethernet/eth.c   |2 +-
 net/openvswitch/datapath.c   |2 +-
 8 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 2b27bff..bd34ca1 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -630,7 +630,7 @@ static int fwnet_finish_incoming_packet(struct net_device 
*net,
if (memcmp(eth->h_dest, net->dev_addr, net->addr_len))
skb->pkt_type = PACKET_OTHERHOST;
}
-   if (ntohs(eth->h_proto) >= 1536) {
+   if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) {
protocol = eth->h_proto;
} else {
rawp = (u16 *)skb->data;
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index babc621..88d657d 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1385,7 +1385,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct 
net_device *dev)
if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
skb->pkt_type = PACKET_OTHERHOST;
}
-   if (ntohs(eth->h_proto) >= 1536)
+   if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
return eth->h_proto;
 
rawp = skb->data;
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
index 44225b1..9fc82a1 100644
--- a/drivers/media/dvb-core/dvb_net.c
+++ b/drivers/media/dvb-core/dvb_net.c
@@ -185,7 +185,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
skb->pkt_type=PACKET_MULTICAST;
}
 
-   if (ntohs(eth->h_proto) >= 1536)
+   if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
return eth->h_proto;
 
rawp = skb->data;
@@ -228,9 +228,9 @@ static int ule_test_sndu( struct dvb_net_priv *p )
 static int ule_bridged_sndu( struct dvb_net_priv *p )
 {
struct ethhdr *hdr = (struct ethhdr*) p->ule_next_hdr;
-   if(ntohs(hdr->h_proto) < 1536) {
+   if(ntohs(hdr->h_proto) < ETH_P_802_3_MIN) {
int framelen = p->ule_sndu_len - 
((p->ule_next_hdr+sizeof(struct ethhdr)) - p->ule_skb->data);
-   /* A frame Type < 1536 for a bridged frame, introduces a LLC 
Length field. */
+   /* A frame Type < ETH_P_802_3_MIN for a bridged frame, 
introduces a LLC Length field. */
if(framelen != ntohs(hdr->h_proto)) {
return -1;
}
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index e4c1c88..95cff98 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -6618,7 +6618,7 @@ static u64 niu_compute_tx_flags(struct sk_buff *skb, 
struct ethhdr *ehdr,
   (len << TXHDR_LEN_SHIFT) |
   ((l3off / 2) << TXHDR_L3START_SHIFT) |
   (ihl << TXHDR_IHL_SHIFT) |
-  ((eth_proto_inner < 1536) ? TXHDR_LLC : 0) |
+  ((eth_proto_inner < ETH_P_802_3_MIN) ? TXHDR_LLC : 0) |
   ((eth_proto == ETH_P_8021Q) ? TXHDR_VLAN : 0) |
   (ipv6 ? TXHDR_IP_VER : 0) |
   csum_bits);
diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c
index bed62d9..1f7bef9 100644
--- a/drivers/net/plip/plip.c
+++ b/drivers/net/plip/plip.c
@@ -560,7 +560,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct 
net_device *dev)
 *  so don't forget to remove it.
 */
 
-   if (ntohs(eth->h_proto) >= 1536)
+   if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
return eth->h_proto;
 
rawp = skb->data;
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 798032d..ade07f1 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -94,6 +94,9 @@
 #define ETH_P_EDSA 0xDADA  /* Ethertype DSA [ NOT AN OFFICIALLY 
REGISTERED ID ] */
 #define ETH_P_AF_IUCV   0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY 
REGISTERED ID ] */
 
+#define ETH_P_802_3_MIN0x0600  /* If the value in the ethe