From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DA72AA057B; Mon, 13 Apr 2020 21:46:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F9481C1C5; Mon, 13 Apr 2020 21:42:48 +0200 (CEST) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id A2A131C117 for ; Mon, 13 Apr 2020 21:42:44 +0200 (CEST) Received: by mail-pj1-f67.google.com with SMTP id o1so3393308pjs.4 for ; Mon, 13 Apr 2020 12:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o+VwIk6n0dmrjhe+EaQhsG+erQJnm8dpqthzREm66+I=; b=c5841YVwidj/GmQjGnCPy7eGb5ZXRNa6NS1dkVlgg4EGck8qXeYECk4CSb9e0qYWhu 3EWnYGplLH0Kw/OcKuaZdUV7l8SJozbyN8/DD4P3czmGcYfaYc0i7W0FXsLsSZXxQqI2 7df7Wf2Ni9Jz4JGZr9pg6lfeUjvTuFsEzW/E4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o+VwIk6n0dmrjhe+EaQhsG+erQJnm8dpqthzREm66+I=; b=fdmZOuAcVQFePH89z+QqLHC4n6g+5QE6VRGq9WrMcaC1oGcy3V9Ch57HJ5YLCQ6Rlb 25x3XsYXLTQCH0E9KhQk6N9L9b4aYW8RXjDy9cwPyXz9hV8YcQ0/dI7O+BXC28uIZ0mg aMw2i4JUAH98bpwW7MWJS56t94t9t5EFsnx5d9FMyQG1K0RsTmCa81XKhQ91x0l8wloF YHpmdhLCmApSoc2XU8INYzCGRg493qfZb2b8cj/UUAU54r7YAjzd02R+IXNhsAPRXZWQ RyB/wLoryW8nXZrHRt9JM7oQp2E5qbxskkJg4aNxfi1k6B/kOBilp6cMpLr1nvwkcjPZ Jy2Q== X-Gm-Message-State: AGi0Pua0uozYlxj0r2wiAxvbEUsxzFsv1l9/VgmWkVmd4/F52yIj/8NJ JyKKTGbcyL4W4LGuw6QaAMIl/s+v3dkLi6HOujX3GPSAEECBA76PJ+U3b8l6ISNt9iMZGYDgUPx n0bZEKkrD8OvMGA64pvmw321NeHzVv+a4HAEWNvuvHqJNcGaQIrcHrpEQGdlii5Qkmf9L X-Google-Smtp-Source: APiQypIrCJafFfQ2XKyH8aW+9WUylBNEHrfXaQlo7prluNI00Cc1SxtOWE/yl0vnxomlyLfB3UmEkg== X-Received: by 2002:a17:902:6b84:: with SMTP id p4mr18559601plk.343.1586806963321; Mon, 13 Apr 2020 12:42:43 -0700 (PDT) Received: from S60.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 9sm1381663pfn.204.2020.04.13.12.42.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2020 12:42:42 -0700 (PDT) From: Venkat Duvvuru To: dev@dpdk.org Cc: Kishore Padmanabha , Venkat Duvvuru Date: Tue, 14 Apr 2020 01:10:01 +0530 Message-Id: <1586806811-21736-25-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1586806811-21736-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1584459511-5353-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <1586806811-21736-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH v2 24/34] net/bnxt: match rte flow actions with flow template actions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kishore Padmanabha This patch does the following 1. Takes act_bitmap generated from the rte_flow_actions 2. Iterates through the static act_bitmap list 3. Returns success if a match is found, otherwise an error Signed-off-by: Kishore Padmanabha Signed-off-by: Venkat Duvvuru Reviewed-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/tf_ulp/ulp_matcher.c | 36 +++++++++++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_matcher.h | 9 +++++++ drivers/net/bnxt/tf_ulp/ulp_template_db.c | 12 +++++++++ drivers/net/bnxt/tf_ulp/ulp_template_db.h | 2 ++ drivers/net/bnxt/tf_ulp/ulp_template_struct.h | 10 ++++++++ 5 files changed, 69 insertions(+) diff --git a/drivers/net/bnxt/tf_ulp/ulp_matcher.c b/drivers/net/bnxt/tf_ulp/ulp_matcher.c index f367e4c..040d08d 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_matcher.c +++ b/drivers/net/bnxt/tf_ulp/ulp_matcher.c @@ -150,3 +150,39 @@ ulp_matcher_pattern_match(enum ulp_direction_type dir, *class_id = 0; return BNXT_TF_RC_ERROR; } + +/* + * Function to handle the matching of RTE Flows and validating + * the action against the flow templates. + */ +int32_t +ulp_matcher_action_match(enum ulp_direction_type dir, + struct ulp_rte_act_bitmap *act_bitmap, + uint32_t *act_id) +{ + struct bnxt_ulp_action_match_info *sel_act_match; + uint32_t act_num, idx; + + /* Select the ingress or egress template to match against */ + if (dir == ULP_DIR_INGRESS) { + sel_act_match = ulp_ingress_act_match_list; + act_num = BNXT_ULP_INGRESS_ACT_MATCH_SZ; + } else { + sel_act_match = ulp_egress_act_match_list; + act_num = BNXT_ULP_EGRESS_ACT_MATCH_SZ; + } + + /* Loop through the list of action templates to find the match */ + for (idx = 0; idx < act_num; idx++, sel_act_match++) { + if (!ULP_BITSET_CMP(&sel_act_match->act_bitmap, + act_bitmap)) { + *act_id = sel_act_match->act_tmpl_id; + BNXT_TF_DBG(DEBUG, "Found matching action template %u\n", + *act_id); + return BNXT_TF_RC_SUCCESS; + } + } + BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n"); + *act_id = 0; + return BNXT_TF_RC_ERROR; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_matcher.h b/drivers/net/bnxt/tf_ulp/ulp_matcher.h index 57a161d..c818bbe 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_matcher.h +++ b/drivers/net/bnxt/tf_ulp/ulp_matcher.h @@ -23,4 +23,13 @@ ulp_matcher_pattern_match(enum ulp_direction_type dir, struct ulp_rte_act_bitmap *act_bitmap, uint32_t *class_id); +/* + * Function to handle the matching of RTE Flows and validating + * the action against the flow templates. + */ +int32_t +ulp_matcher_action_match(enum ulp_direction_type dir, + struct ulp_rte_act_bitmap *act_bitmap, + uint32_t *act_id); + #endif /* ULP_MATCHER_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c index 68a2dc0..5981c74 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c @@ -1119,6 +1119,18 @@ struct bnxt_ulp_mapper_ident_info ulp_ident_list[] = { } }; +struct bnxt_ulp_action_match_info ulp_ingress_act_match_list[] = { + { + .act_bitmap = { .bits = + BNXT_ULP_ACTION_BIT_MARK | + BNXT_ULP_ACTION_BIT_RSS }, + .act_tmpl_id = 0 + } +}; + +struct bnxt_ulp_action_match_info ulp_egress_act_match_list[] = { +}; + struct bnxt_ulp_mapper_tbl_list_info ulp_act_tmpl_list[] = { [((0 << BNXT_ULP_LOG2_MAX_NUM_DEV) | BNXT_ULP_DEVICE_ID_WH_PLUS)] = { .device_name = BNXT_ULP_DEVICE_ID_WH_PLUS, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index 319500a..f4850bf 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -15,6 +15,8 @@ #define BNXT_ULP_LOG2_MAX_NUM_DEV 2 #define BNXT_ULP_INGRESS_HDR_MATCH_SZ 2 #define BNXT_ULP_EGRESS_HDR_MATCH_SZ 1 +#define BNXT_ULP_INGRESS_ACT_MATCH_SZ 2 +#define BNXT_ULP_EGRESS_ACT_MATCH_SZ 1 enum bnxt_ulp_action_bit { BNXT_ULP_ACTION_BIT_MARK = 0x0000000000000001, diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h index dd06fb1..0e811ec 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h @@ -62,6 +62,16 @@ extern struct bnxt_ulp_header_match_info ulp_egress_hdr_match_list[]; /* Flow field match Information Structure Array defined in template source*/ extern struct bnxt_ulp_matcher_field_info ulp_field_match[]; +/* Flow Matcher Action structures */ +struct bnxt_ulp_action_match_info { + struct ulp_rte_act_bitmap act_bitmap; + uint32_t act_tmpl_id; +}; + +/* Flow Matcher templates Structure Array defined in template source */ +extern struct bnxt_ulp_action_match_info ulp_ingress_act_match_list[]; +extern struct bnxt_ulp_action_match_info ulp_egress_act_match_list[]; + /* Device specific parameters */ struct bnxt_ulp_device_params { uint8_t description[16]; -- 2.7.4