This commits adds:
- Type of service
- Next protocol ID

Signed-off-by: Nelio Laranjeiro <nelio.laranje...@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarg...@6wind.com>
---
 drivers/net/mlx5/mlx5_flow.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 01f7a77..77021b5 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -172,11 +172,13 @@ static const struct mlx5_flow_items mlx5_flow_items[] = {
                        .hdr = {
                                .src_addr = -1,
                                .dst_addr = -1,
+                               .type_of_service = -1,
+                               .next_proto_id = -1,
                        },
                },
                .mask_sz = sizeof(struct rte_flow_item_ipv4),
                .convert = mlx5_flow_create_ipv4,
-               .dst_sz = sizeof(struct ibv_exp_flow_spec_ipv4),
+               .dst_sz = sizeof(struct ibv_exp_flow_spec_ipv4_ext),
        },
        [RTE_FLOW_ITEM_TYPE_IPV6] = {
                .items = ITEMS(RTE_FLOW_ITEM_TYPE_UDP,
@@ -574,29 +576,35 @@ mlx5_flow_create_ipv4(const struct rte_flow_item *item, 
void *data)
        const struct rte_flow_item_ipv4 *spec = item->spec;
        const struct rte_flow_item_ipv4 *mask = item->mask;
        struct mlx5_flow *flow = (struct mlx5_flow *)data;
-       struct ibv_exp_flow_spec_ipv4 *ipv4;
-       unsigned int ipv4_size = sizeof(struct ibv_exp_flow_spec_ipv4);
+       struct ibv_exp_flow_spec_ipv4_ext *ipv4;
+       unsigned int ipv4_size = sizeof(struct ibv_exp_flow_spec_ipv4_ext);
 
        ipv4 = (void *)((uintptr_t)flow->ibv_attr + flow->offset);
-       *ipv4 = (struct ibv_exp_flow_spec_ipv4) {
-               .type = flow->inner | IBV_EXP_FLOW_SPEC_IPV4,
+       *ipv4 = (struct ibv_exp_flow_spec_ipv4_ext) {
+               .type = flow->inner | IBV_EXP_FLOW_SPEC_IPV4_EXT,
                .size = ipv4_size,
        };
        if (spec) {
-               ipv4->val = (struct ibv_exp_flow_ipv4_filter){
+               ipv4->val = (struct ibv_exp_flow_ipv4_ext_filter){
                        .src_ip = spec->hdr.src_addr,
                        .dst_ip = spec->hdr.dst_addr,
+                       .proto = spec->hdr.next_proto_id,
+                       .tos = spec->hdr.type_of_service,
                };
        }
        if (mask) {
-               ipv4->mask = (struct ibv_exp_flow_ipv4_filter){
+               ipv4->mask = (struct ibv_exp_flow_ipv4_ext_filter){
                        .src_ip = mask->hdr.src_addr,
                        .dst_ip = mask->hdr.dst_addr,
+                       .proto = mask->hdr.next_proto_id,
+                       .tos = mask->hdr.type_of_service,
                };
        }
        /* Remove unwanted bits from values. */
        ipv4->val.src_ip &= ipv4->mask.src_ip;
        ipv4->val.dst_ip &= ipv4->mask.dst_ip;
+       ipv4->val.proto &= ipv4->mask.proto;
+       ipv4->val.tos &= ipv4->mask.tos;
        ++flow->ibv_attr->num_of_specs;
        flow->ibv_attr->priority = 1;
        return 0;
-- 
2.1.4

Reply via email to