[ovs-dev] [PATCH] datapath: make skb->csum consistent with rest of networking stack.

Jesse Gross jesse at nicira.com
Tue Jun 11 00:23:22 UTC 2013


On Mon, Jun 10, 2013 at 3:56 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
> diff --git a/datapath/actions.c b/datapath/actions.c
> index 0dac658..6d60cd0 100644
> --- a/datapath/actions.c
> +++ b/datapath/actions.c
> @@ -132,9 +132,17 @@ static int set_eth_addr(struct sk_buff *skb,
>         if (unlikely(err))
>                 return err;
>
> +       if (get_ip_summed(skb) == OVS_CSUM_COMPLETE)
> +               skb->csum = csum_sub(skb->csum, csum_partial(eth_hdr(skb),
> +                                                            ETH_HLEN, 0));
> +
>         memcpy(eth_hdr(skb)->h_source, eth_key->eth_src, ETH_ALEN);
>         memcpy(eth_hdr(skb)->h_dest, eth_key->eth_dst, ETH_ALEN);
>
> +       if (get_ip_summed(skb) == OVS_CSUM_COMPLETE)
> +               skb->csum = csum_add(skb->csum, csum_partial(eth_hdr(skb),
> +                                                            ETH_HLEN, 0));
> +

The add and subtract operations can be combined into a single
operation - see csum_replace4() for an example.

> diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
> index 9a159cd..4fdbc59 100644
> --- a/datapath/vport-internal_dev.c
> +++ b/datapath/vport-internal_dev.c
> @@ -267,6 +267,7 @@ static int internal_dev_recv(struct vport *vport, struct sk_buff *skb)
>         struct net_device *netdev = netdev_vport_priv(vport)->dev;
>         int len;
>
> +       forward_ip_summed(skb, false);
>  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
>         if (unlikely(vlan_deaccel_tag(skb)))
>                 return 0;

I think we also need to handle this in vlan_deaccel_tag() as well.

In LISP, even though there is no Ethernet header to start out with we
add one later, so it needs the same treatment.



More information about the dev mailing list