case OVS_TUNNEL_KEY_ATTR_TTL: return 1;
case OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT: return 0;
case OVS_TUNNEL_KEY_ATTR_CSUM: return 0;
+ case OVS_TUNNEL_KEY_ATTR_OAM: return 0;
case __OVS_TUNNEL_KEY_ATTR_MAX:
return -1;
}
case OVS_TUNNEL_KEY_ATTR_CSUM:
tun->flags |= FLOW_TNL_F_CSUM;
break;
+ case OVS_TUNNEL_KEY_ATTR_OAM:
+ tun->flags |= FLOW_TNL_F_OAM;
+ break;
default:
/* Allow this to show up as unexpected, if there are unknown
* tunnel attribute, eventually resulting in ODP_FIT_TOO_MUCH. */
if (tun_key->flags & FLOW_TNL_F_CSUM) {
nl_msg_put_flag(a, OVS_TUNNEL_KEY_ATTR_CSUM);
}
+ if (tun_key->flags & FLOW_TNL_F_OAM) {
+ nl_msg_put_flag(a, OVS_TUNNEL_KEY_ATTR_OAM);
+ }
nl_msg_end_nested(a, tun_key_ofs);
}
odp_tun_key_from_attr(ma, &tun_mask);
if (tun_mask.flags == (FLOW_TNL_F_KEY
| FLOW_TNL_F_DONT_FRAGMENT
- | FLOW_TNL_F_CSUM)) {
+ | FLOW_TNL_F_CSUM
+ | FLOW_TNL_F_OAM)) {
/* The flags are exact match, check the remaining fields. */
tun_mask.flags = 0xffff;
is_exact = is_all_ones((uint8_t *)&tun_mask,
} else {
const struct ovs_key_sctp *sctp_key = nl_attr_get(a);
- ds_put_format(ds, "(src=%"PRIu16",dst=%"PRIu16")",
+ ds_put_format(ds, "src=%"PRIu16",dst=%"PRIu16,
ntohs(sctp_key->sctp_src), ntohs(sctp_key->sctp_dst));
}
break;
static void
odp_flow_key_from_flow__(struct ofpbuf *buf, const struct flow *flow,
const struct flow *mask, odp_port_t odp_in_port,
- size_t max_mpls_depth, bool export_mask)
+ size_t max_mpls_depth, bool recirc, bool export_mask)
{
struct ovs_key_ethernet *eth_key;
size_t encap;
nl_msg_put_u32(buf, OVS_KEY_ATTR_SKB_MARK, data->pkt_mark);
- if (data->recirc_id || (mask && mask->recirc_id)) {
+ if (recirc) {
nl_msg_put_u32(buf, OVS_KEY_ATTR_RECIRC_ID, data->recirc_id);
- }
-
- if (data->dp_hash || (mask && mask->dp_hash)) {
nl_msg_put_u32(buf, OVS_KEY_ATTR_DP_HASH, data->dp_hash);
}
icmpv6_key->icmpv6_type = ntohs(data->tp_src);
icmpv6_key->icmpv6_code = ntohs(data->tp_dst);
- if (flow->tp_dst == htons(0) &&
- (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT) ||
- flow->tp_src == htons(ND_NEIGHBOR_ADVERT)) &&
- (!export_mask || (data->tp_src == htons(0xffff) &&
- data->tp_dst == htons(0xffff)))) {
+ if (flow->tp_dst == htons(0)
+ && (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT)
+ || flow->tp_src == htons(ND_NEIGHBOR_ADVERT))
+ && (!export_mask || (data->tp_src == htons(0xffff)
+ && data->tp_dst == htons(0xffff)))) {
struct ovs_key_nd *nd_key;
* port.
*
* 'buf' must have at least ODPUTIL_FLOW_KEY_BYTES bytes of space, or be
- * capable of being expanded to allow for that much space. */
+ * capable of being expanded to allow for that much space.
+ *
+ * 'recirc' indicates support for recirculation fields. If this is true, then
+ * these fields will always be serialised. */
void
odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow,
- const struct flow *mask, odp_port_t odp_in_port)
+ const struct flow *mask, odp_port_t odp_in_port,
+ bool recirc)
{
- odp_flow_key_from_flow__(buf, flow, mask, odp_in_port, SIZE_MAX, false);
+ odp_flow_key_from_flow__(buf, flow, mask, odp_in_port, SIZE_MAX, recirc,
+ false);
}
/* Appends a representation of 'mask' as OVS_KEY_ATTR_* attributes to
* ARP, IPv4, IPv6, etc.
*
* 'buf' must have at least ODPUTIL_FLOW_KEY_BYTES bytes of space, or be
- * capable of being expanded to allow for that much space. */
+ * capable of being expanded to allow for that much space.
+ *
+ * 'recirc' indicates support for recirculation fields. If this is true, then
+ * these fields will always be serialised. */
void
odp_flow_key_from_mask(struct ofpbuf *buf, const struct flow *mask,
const struct flow *flow, uint32_t odp_in_port_mask,
- size_t max_mpls_depth)
+ size_t max_mpls_depth, bool recirc)
{
- odp_flow_key_from_flow__(buf, flow, mask,
- u32_to_odp(odp_in_port_mask), max_mpls_depth, true);
+ odp_flow_key_from_flow__(buf, flow, mask, u32_to_odp(odp_in_port_mask),
+ max_mpls_depth, recirc, true);
}
/* Generate ODP flow key from the given packet metadata */
flow->recirc_id = nl_attr_get_u32(attrs[OVS_KEY_ATTR_RECIRC_ID]);
expected_attrs |= UINT64_C(1) << OVS_KEY_ATTR_RECIRC_ID;
} else if (is_mask) {
- /* Always exact match recirc_id when datapath does not sepcify it. */
+ /* Always exact match recirc_id if it is not specified. */
flow->recirc_id = UINT32_MAX;
}
commit_set_port_action(const struct flow *flow, struct flow *base,
struct ofpbuf *odp_actions, struct flow_wildcards *wc)
{
+ /* Check if 'flow' really has an L3 header. */
+ if (!flow->nw_proto) {
+ return;
+ }
+
if (!is_ip_any(base) || (!base->tp_src && !base->tp_dst)) {
return;
}