-static struct sk_buff *
-set_tp_port(struct sk_buff *skb, struct odp_flow_key *key,
- const struct odp_action_tp_port *a,
- gfp_t gfp)
+static struct sk_buff *set_nw_tos(struct sk_buff *skb,
+ const struct odp_flow_key *key,
+ const struct odp_action_nw_tos *a,
+ gfp_t gfp)
+{
+ if (key->dl_type != htons(ETH_P_IP))
+ return skb;
+
+ skb = make_writable(skb, 0, gfp);
+ if (skb) {
+ struct iphdr *nh = ip_hdr(skb);
+ u8 *f = &nh->tos;
+ u8 old = *f;
+ u8 new;
+
+ /* Set the DSCP bits and preserve the ECN bits. */
+ new = a->nw_tos | (nh->tos & INET_ECN_MASK);
+ update_csum(&nh->check, skb, htons((uint16_t)old),
+ htons((uint16_t)new), 0);
+ *f = new;
+ }
+ return skb;
+}
+
+static struct sk_buff *set_tp_port(struct sk_buff *skb,
+ const struct odp_flow_key *key,
+ const struct odp_action_tp_port *a, gfp_t gfp)