- /* Remove the hdr bit maps that are internal or computed */
- ulp_matcher_hdr_fields_normalize(hdr_bitmap, &hdr_bitmap_masked);
-
- /* Loop through the list of class templates to find the match */
- for (idx = 0; idx < hdr_num; idx++, sel_hdr_match++) {
- if (ULP_BITSET_CMP(&sel_hdr_match->hdr_bitmap,
- &hdr_bitmap_masked)) {
- /* no match found */
- BNXT_TF_DBG(DEBUG, "Pattern Match failed template=%d\n",
- idx);
- continue;
- }
- match = ULP_BITMAP_ISSET(act_bitmap->bits,
- BNXT_ULP_ACTION_BIT_VNIC);
- if (match != sel_hdr_match->act_vnic) {
- /* no match found */
- BNXT_TF_DBG(DEBUG, "Vnic Match failed template=%d\n",
- idx);
- continue;
- } else {
- match = 1;
- }
-
- /* Found a matching hdr bitmap, match the fields next */
- start_idx = sel_hdr_match->start_idx;
- for (jdx = 0; jdx < sel_hdr_match->num_entries; jdx++) {
- m_field = &hdr_field[jdx + BNXT_ULP_HDR_FIELD_LAST - 1];
- sf = &ulp_field_match[start_idx + jdx];
- switch (sf->mask_opcode) {
- case BNXT_ULP_FMF_MASK_ANY:
- match &= ulp_field_mask_is_zero(m_field->mask,
- m_field->size);
- break;
- case BNXT_ULP_FMF_MASK_EXACT:
- match &= ulp_field_mask_is_ones(m_field->mask,
- m_field->size);
- break;
- case BNXT_ULP_FMF_MASK_WILDCARD:
- match &= ulp_field_mask_notzero(m_field->mask,
- m_field->size);
- break;
- case BNXT_ULP_FMF_MASK_IGNORE:
- default:
- break;
- }
- if (!match)
- break;
- }
- if (match) {
- BNXT_TF_DBG(DEBUG,
- "Found matching pattern template %d\n",
- sel_hdr_match->class_tmpl_id);
- *class_id = sel_hdr_match->class_tmpl_id;
- return BNXT_TF_RC_SUCCESS;
- }
+ /* calculate the hash of the given flow */
+ class_hid = ulp_matcher_class_hash_calculate(params->hdr_bitmap.bits,
+ params->fld_bitmap.bits);
+
+ /* validate the calculate hash values */
+ if (class_hid >= BNXT_ULP_CLASS_SIG_TBL_MAX_SZ)
+ goto error;
+ tmpl_id = ulp_class_sig_tbl[class_hid];
+ if (!tmpl_id)
+ goto error;
+
+ class_match = &ulp_class_match_list[tmpl_id];
+ if (ULP_BITMAP_CMP(¶ms->hdr_bitmap, &class_match->hdr_sig)) {
+ BNXT_TF_DBG(DEBUG, "Proto Header does not match\n");
+ goto error;
+ }
+ if (ULP_BITMAP_CMP(¶ms->fld_bitmap, &class_match->field_sig)) {
+ BNXT_TF_DBG(DEBUG, "Field signature does not match\n");
+ goto error;