It is indeed possible to remove the eth_type field from struct 
ovs_action_push_eth and let the netdev datapath determine the Ethertype of the 
resulting frame automatically based on the packet_type of the current packet as 
you suggest in the patch below and is done in the kernel datapath.

/Jan

> 
> Hello Jan,
> 
> I talked with Yi over lync to clarify what he meant with his mail below. He 
> suggested to remove eth_type from struct ovs_action_push_eth,
> do not specify it when putting the OVS_ACTION_ATTR_PUSH_ETH action argument. 
> Then in push_eth() in lib/packet.c, the eth_type could
> be derived from packet->packet_type.
> 
> /* Push Ethernet header onto 'packet' assuming it is layer 3 */
> void
> push_eth(struct dp_packet *packet, const struct eth_addr *dst,
> -         const struct eth_addr *src, ovs_be16 type)
> +         const struct eth_addr *src)
> {
>     struct eth_header *eh;
> 
>     ovs_assert(packet->packet_type != htonl(PT_ETH));
>     eh = dp_packet_resize_l2(packet, ETH_HEADER_LEN);
>     eh->eth_dst = *dst;
>     eh->eth_src = *src;
> -    eh->eth_type = type;
> +    eh->eth_type = pt_ns_type_be(packet->packet_type);
>     packet->packet_type = htonl(PT_ETH);
> }
> 
> That way, the new ethertype would be set automatically, like in the kernel 
> module.
> 


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to