[ovs-dev] [PATCH 01/19] tunneling: Remove call to eth_type_trans() on receive.

Ben Pfaff blp at nicira.com
Thu Dec 9 17:32:26 UTC 2010


On Wed, Dec 08, 2010 at 10:13:59PM -0800, Jesse Gross wrote:
> On receive we call eth_type_trans() to set skb->protocol.  However,
> that function also sets skb->pkt_type, which requires several
> comparisons to MAC addresses.  Nothing in OVS cares about pkt_type,
> so this is wasteful.  If we actually do egress to the IP stack
> through an internal device then we'll call eth_type_trans() to get
> everything correctly setup.  It's possible for device drivers to
> see an incorrect pkt_type or not correctly parse legacy IPX (which
> eth_type_trans() also handles) but it's highly unlikely that they
> will care.

The old version of this function did a skb_reset_mac_header(),
indirectly in eth_type_trans().  The new version doesn't.  That implies
that the MAC header is already correct, but if that is so then 
        struct ethhdr *eh = (struct ethhdr *)skb->data;
could be written as
        struct ethhdr *eh = eth_hdr(skb);
So I don't know what to think here, since it wasn't obvious to me from
the callers that the MAC header had been set properly.

Otherwise look fine to me, thanks.




More information about the dev mailing list