Commit Message
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 <jesse@nicira.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux1394-devel@lists.sourceforge.net
Cc: linux-media@vger.kernel.org
Cc: dev@openvswitch.org
Signed-off-by: Simon Horman <horms@verge.net.au>
---
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(-)
Comments
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 <jesse@nicira.com>
> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: Karsten Keil <isdn@linux-pingi.de>
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux1394-devel@lists.sourceforge.net
> Cc: linux-media@vger.kernel.org
> Cc: dev@openvswitch.org
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> drivers/firewire/net.c | 2 +-
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> 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;
[...]
Em Thu, 21 Mar 2013 17:29:28 +0900
Simon Horman <horms@verge.net.au> 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 <jesse@nicira.com>
> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: Karsten Keil <isdn@linux-pingi.de>
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux1394-devel@lists.sourceforge.net
> Cc: linux-media@vger.kernel.org
> Cc: dev@openvswitch.org
> Signed-off-by: Simon Horman <horms@verge.net.au>
...
> 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 <mchehab@redhat.com>
Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Simon Horman <horms@verge.net.au>
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 <horms@verge.net.au>
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Mar 21, 2013 at 11:56:08AM -0400, David Miller wrote:
> From: Simon Horman <horms@verge.net.au>
> 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 <horms@verge.net.au>
>
> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -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;
@@ -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;
@@ -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;
}
@@ -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);
@@ -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;
@@ -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_MIN 0x0600 /* If the value in the ethernet type is less than this value
+ * then the frame is Ethernet II. Else it is 802.3 */
+
/*
* Non DIX types. Won't clash for 1500 types.
*/
@@ -195,7 +195,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
if (netdev_uses_trailer_tags(dev))
return htons(ETH_P_TRAILER);
- if (ntohs(eth->h_proto) >= 1536)
+ if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
return eth->h_proto;
/*
@@ -681,7 +681,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
/* Normally, setting the skb 'protocol' field would be handled by a
* call to eth_type_trans(), but it assumes there's a sending
* device, which we may not have. */
- if (ntohs(eth->h_proto) >= 1536)
+ if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)
packet->protocol = eth->h_proto;
else
packet->protocol = htons(ETH_P_802_2);