[ovs-dev] [PATCH v3 12/17] netdev-vport: Introduce ip_build_header()

Jesse Gross jesse at kernel.org
Tue May 17 23:41:25 UTC 2016


On Tue, May 10, 2016 at 10:30 AM, Pravin B Shelar <pshelar at ovn.org> wrote:
> This function can be used to build varius tunnel headers.

"various"

> diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
> index 2e181f2..375713a 100644
> --- a/lib/netdev-native-tnl.c
> +++ b/lib/netdev-native-tnl.c
> +eth_build_header(struct ovs_action_push_tnl *data,
> +                 uint16_t eth_proto,
> +                 const struct eth_addr dmac,
> +                 const struct eth_addr smac,
>                   unsigned int *hlen)
>  {
> -    struct ip_header *ip;
> -    struct ovs_16aligned_ip6_hdr *ip6;
> -    struct udp_header *udp;
> -    bool is_ipv6;
> +    struct eth_header *eth;
> +
> +    /* Build Ethernet and IP headers. */
> +    memset(data->header, 0, sizeof data->header);

I guess this comment doesn't really apply any more.

> -    is_ipv6 = netdev_tnl_is_header_ipv6(data->header);
> +void *
> +netdev_tnl_ip_build_header(struct ovs_action_push_tnl *data,
> +                           const struct flow *tnl_flow,
> +                           uint8_t next_proto,
> +                           unsigned int *hlen,
> +                           const struct eth_addr dmac,
> +                           const struct eth_addr smac,
> +                           const struct in6_addr *src,
> +                           bool *is_ipv6)
[...]
> +    } else {
> +        struct ovs_16aligned_ip6_hdr *ip6;
> +
> +        ip6 = (struct ovs_16aligned_ip6_hdr *) l3;
> +
> +        ip6->ip6_vfc = 0x60;

I realize that this is a problem in the original code but it looks
like this doesn't set the traffic class - we should be able to set
this to tnl_flow->tunnel.ip_tos, the same as IPv4.

> diff --git a/lib/netdev.h b/lib/netdev.h
> index a292167..2c76966 100644
> --- a/lib/netdev.h
> +++ b/lib/netdev.h
> @@ -154,7 +154,10 @@ int netdev_send(struct netdev *, int qid, struct dp_packet_batch *,
>  void netdev_send_wait(struct netdev *, int qid);
>
>  int netdev_build_header(const struct netdev *, struct ovs_action_push_tnl *data,
> -                        const struct flow *tnl_flow);
> +                        const struct flow *tnl_flow,
> +                        const struct eth_addr dmac,
> +                        const struct eth_addr smac,
> +                        const struct in6_addr *src);

Should we turn these arguments into a struct? It's pretty unwieldy
passing them all around through different functions.



More information about the dev mailing list