On 5/9/23 11:37, Nobuhiro MIKI wrote:
> For tunnels such as SRv6, some popular vendor appliances support
> IPv6 flowlabel based load balancing. In preparation for OVS to
> support it, this patch modifies the encapsulation to allow IPv6
> flowlabel to be configured.
> 
> Signed-off-by: Nobuhiro MIKI <[email protected]>
> ---
>  lib/netdev-native-tnl.c | 14 ++++++++------
>  lib/netdev-native-tnl.h |  2 +-
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
> index 9abdf51076a8..55e1bd567fa1 100644
> --- a/lib/netdev-native-tnl.c
> +++ b/lib/netdev-native-tnl.c
> @@ -35,6 +35,7 @@
>  #include "byte-order.h"
>  #include "csum.h"
>  #include "dp-packet.h"
> +#include "flow.h"
>  #include "netdev.h"
>  #include "netdev-vport.h"
>  #include "netdev-vport-private.h"
> @@ -276,7 +277,7 @@ eth_build_header(struct ovs_action_push_tnl *data,
>  void *
>  netdev_tnl_ip_build_header(struct ovs_action_push_tnl *data,
>                             const struct netdev_tnl_build_header_params 
> *params,
> -                           uint8_t next_proto)
> +                           uint8_t next_proto, uint32_t ipv6_label)
>  {
>      void *l3;
>  
> @@ -308,7 +309,8 @@ netdev_tnl_ip_build_header(struct ovs_action_push_tnl 
> *data,
>          ip6 = (struct ovs_16aligned_ip6_hdr *) l3;
>  
>          put_16aligned_be32(&ip6->ip6_flow, htonl(6 << 28) |
> -                           htonl(params->flow->tunnel.ip_tos << 20));
> +                           htonl(params->flow->tunnel.ip_tos << 20) |
> +                           htonl(ipv6_label & 0xfffff));

IPV6_LABEL_MASK should be used instead.  Also, it's a bit strange to
pass areound the lable in the host order.  Having it in ovs_be32
will likely be more intuitive.

But see the comments for the second patch.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to