Matching RoCE IB BTH opcode/dest_qp
IB BTH fields (opcode, and dst_qp) can be matched now using the new IB BTH item: RTE_FLOW_ITEM_TYPE_IB_BTH. Currently, this item is supported on group > 1, and supports only the RoCEv2 packet. The input BTH match item is defaulted to match one RoCEv2 packet.
To match field opcode (0x81) and dst_qp (0xabd4) to queue 1:
flow create 0 ingress pattern eth / end actions jump group 1 / end
flow create 0 group 1 ingress pattern eth / ipv4 / udp / ib_bth opcode is 0x81 dst_qp is 0xabd4 / end actions queue index 1 / end
struct rte_flow_attr attr;
struct rte_flow_error error;
struct rte_flow_item pattern[MAX_PATTERN_NUM];
struct rte_flow_action action[MAX_ACTION_NUM];
struct rte_flow_action_queue queue = { .index = 1 };
struct rte_flow_item_ib_bth bth = { 0 };
memset(&attr, 0, sizeof(struct rte_flow_attr));
attr.ingress = 1;
attr.group = 1;
attr.priority = 1;
bth.hdr.opcode = 0x81;
bth.hdr.dst_qp[0] = 0x0;
bth.hdr.dst_qp[1] = 0xab;
bth.hdr.dst_qp[2] = 0xd4;
pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
pattern[2].type = RTE_FLOW_ITEM_TYPE_UDP;
pattern[3].type = RTE_FLOW_ITEM_TYPE_IB_BTH;
pattern[3].spec = &bth;
pattern[4].type = RTE_FLOW_ITEM_TYPE_END;
action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
action[0].conf = &queue;
action[1].type = RTE_FLOW_ACTION_TYPE_END;
res = rte_flow_validate(port_id, &attr, pattern, action, &error);
if (!res)
flow = rte_flow_create(port_id, &attr, pattern, action, &error);
return flow;