I think it is still necessary to keep eth_type in push_eth action, for the classifier case, it will push_nsh then push_eth for the original frame, this will need to set eth_type to 0x894f by push_eth, otherwise push_eth won't know this eth_type.
-----Original Message----- From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Simon Horman Sent: Monday, May 09, 2016 4:18 PM To: Jiri Benc <jb...@redhat.com> Cc: d...@openvswitch.org; netdev@vger.kernel.org Subject: Re: [ovs-dev] [PATCH v9 net-next 4/7] openvswitch: add layer 3 flow/port support On Fri, May 06, 2016 at 11:35:04AM +0200, Jiri Benc wrote: > On Wed, 4 May 2016 16:36:30 +0900, Simon Horman wrote: > > +static int push_eth(struct sk_buff *skb, struct sw_flow_key *key, > > + const struct ovs_action_push_eth *ethh) { > > + int err; > > + > > + /* De-accelerate any hardware accelerated VLAN tag added to a previous > > + * Ethernet header */ > > + err = skb_vlan_deaccel(skb); > > + if (unlikely(err)) > > + return err; > > + > > + /* Add the new Ethernet header */ > > + if (skb_cow_head(skb, ETH_HLEN) < 0) > > + return -ENOMEM; > > + > > + skb_push(skb, ETH_HLEN); > > + skb_reset_mac_header(skb); > > + skb_reset_mac_len(skb); > > + > > + ether_addr_copy(eth_hdr(skb)->h_source, ethh->addresses.eth_src); > > + ether_addr_copy(eth_hdr(skb)->h_dest, ethh->addresses.eth_dst); > > + eth_hdr(skb)->h_proto = ethh->eth_type; > > This doesn't seem right. We know the packet type, it's skb->protocol. > We should fill in that. I think that makes sense. Possibly the eth_type field can be removed from ovs_action_push_eth. > In addition, we should check whether mac_len > 0 and in such case, > change skb->protocol to ETH_P_TEB first (and store that value in the > pushed eth header). > > Similarly on pop_eth, we need to check skb->protocol and if it is > ETH_P_TEB, call eth_type_trans on the modified frame to set the new > skb->protocol correctly. It's probably not that simple, as we'd need a > version of eth_type_trans that doesn't need a net device. I'm not sure I understand the interaction with ETH_P_TEB here. In my mind skb->protocol == ETH_P_TEB may be used early on in OvS's receive processing to find the inner protocol from the packet and at that point skb->protocol is set to that value. And that for further packet skb->processing the fact the packet was received as TEB is transparent. Conversely, skb->protocol may be set as necessary on transmit as a packet exits OvS. _______________________________________________ dev mailing list d...@openvswitch.org http://openvswitch.org/mailman/listinfo/dev