-static struct sk_buff *set_dl_addr(struct sk_buff *skb,
- const struct odp_action_dl_addr *a,
- gfp_t gfp)
-{
- skb = make_writable(skb, 0, gfp);
- if (skb) {
- struct ethhdr *eh = eth_hdr(skb);
- if (a->type == ODPAT_SET_DL_SRC)
- memcpy(eh->h_source, a->dl_addr, ETH_ALEN);
- else
- memcpy(eh->h_dest, a->dl_addr, ETH_ALEN);
- }
- return skb;
-}
-
-/* Updates 'sum', which is a field in 'skb''s data, given that a 4-byte field
- * covered by the sum has been changed from 'from' to 'to'. If set,
- * 'pseudohdr' indicates that the field is in the TCP or UDP pseudo-header.
- * Based on nf_proto_csum_replace4. */
-static void update_csum(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr)
-{
- __be32 diff[] = { ~from, to };
-
- if (OVS_CB(skb)->ip_summed != OVS_CSUM_PARTIAL) {
- *sum = csum_fold(csum_partial((char *)diff, sizeof(diff),
- ~csum_unfold(*sum)));
- if (OVS_CB(skb)->ip_summed == OVS_CSUM_COMPLETE && pseudohdr)
- skb->csum = ~csum_partial((char *)diff, sizeof(diff),
- ~skb->csum);
- } else if (pseudohdr)
- *sum = ~csum_fold(csum_partial((char *)diff, sizeof(diff),
- csum_unfold(*sum)));
-}
-