From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F42D45B4C; Tue, 22 Oct 2024 21:15:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F7AD410FC; Tue, 22 Oct 2024 21:13:36 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 3A25540A81 for ; Tue, 22 Oct 2024 21:13:09 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1E1871A050D; Tue, 22 Oct 2024 21:13:09 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C6C481A0FA1; Tue, 22 Oct 2024 21:13:08 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 3513B183DC05; Wed, 23 Oct 2024 03:13:08 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v4 26/42] net/dpaa2: frame attribute flags parser Date: Wed, 23 Oct 2024 00:42:39 +0530 Message-Id: <20241022191256.516818-27-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241022191256.516818-1-vanshika.shukla@nxp.com> References: <20241014120126.170790-1-vanshika.shukla@nxp.com> <20241022191256.516818-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jun Yang FAF parser extracts are used to identify protocol type instead of extracts of previous protocol' type. FAF starts from offset 2 to include user defined flags which will be used for soft protocol distribution. Signed-off-by: Jun Yang --- drivers/net/dpaa2/dpaa2_flow.c | 475 +++++++++++++++++++-------------- 1 file changed, 273 insertions(+), 202 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index a66edf78bc..4c80efeff7 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -22,13 +22,6 @@ #include #include -/* Workaround to discriminate the UDP/TCP/SCTP - * with next protocol of l3. - * MC/WRIOP are not able to identify - * the l4 protocol with l4 ports. - */ -static int mc_l4_port_identification; - static char *dpaa2_flow_control_log; static uint16_t dpaa2_flow_miss_flow_id; /* Default miss flow id is 0. */ @@ -256,6 +249,10 @@ dpaa2_flow_qos_extracts_log(const struct dpaa2_dev_priv *priv) sprintf(string, "raw offset/len: %d/%d", extract->extract.from_data.offset, extract->extract.from_data.size); + } else if (type == DPKG_EXTRACT_FROM_PARSE) { + sprintf(string, "parse offset/len: %d/%d", + extract->extract.from_parse.offset, + extract->extract.from_parse.size); } DPAA2_FLOW_DUMP("%s", string); if ((idx + 1) < dpkg->num_extracts) @@ -294,6 +291,10 @@ dpaa2_flow_fs_extracts_log(const struct dpaa2_dev_priv *priv, sprintf(string, "raw offset/len: %d/%d", extract->extract.from_data.offset, extract->extract.from_data.size); + } else if (type == DPKG_EXTRACT_FROM_PARSE) { + sprintf(string, "parse offset/len: %d/%d", + extract->extract.from_parse.offset, + extract->extract.from_parse.size); } DPAA2_FLOW_DUMP("%s", string); if ((idx + 1) < dpkg->num_extracts) @@ -627,6 +628,66 @@ dpaa2_flow_fs_rule_insert_hole(struct dpaa2_dev_priv *priv, return 0; } +static int +dpaa2_flow_faf_advance(struct dpaa2_dev_priv *priv, + int faf_byte, enum dpaa2_flow_dist_type dist_type, int tc_id, + int *insert_offset) +{ + int offset, ret; + struct dpaa2_key_profile *key_profile; + int num, pos; + + if (dist_type == DPAA2_FLOW_QOS_TYPE) + key_profile = &priv->extract.qos_key_extract.key_profile; + else + key_profile = &priv->extract.tc_key_extract[tc_id].key_profile; + + num = key_profile->num; + + if (num >= DPKG_MAX_NUM_OF_EXTRACTS) { + DPAA2_PMD_ERR("Number of extracts overflows"); + return -EINVAL; + } + + if (key_profile->ip_addr_type != IP_NONE_ADDR_EXTRACT) { + offset = key_profile->ip_addr_extract_off; + pos = key_profile->ip_addr_extract_pos; + key_profile->ip_addr_extract_pos++; + key_profile->ip_addr_extract_off++; + if (dist_type == DPAA2_FLOW_QOS_TYPE) { + ret = dpaa2_flow_qos_rule_insert_hole(priv, + offset, 1); + } else { + ret = dpaa2_flow_fs_rule_insert_hole(priv, + offset, 1, tc_id); + } + if (ret) + return ret; + } else { + pos = num; + } + + if (pos > 0) { + key_profile->key_offset[pos] = + key_profile->key_offset[pos - 1] + + key_profile->key_size[pos - 1]; + } else { + key_profile->key_offset[pos] = 0; + } + + key_profile->key_size[pos] = 1; + key_profile->prot_field[pos].type = DPAA2_FAF_KEY; + key_profile->prot_field[pos].key_field = faf_byte; + key_profile->num++; + + if (insert_offset) + *insert_offset = key_profile->key_offset[pos]; + + key_profile->key_max_size++; + + return pos; +} + /* Move IPv4/IPv6 addresses to fill new extract previous IP address. * Current MC/WRIOP only support generic IP extract but IP address * is not fixed, so we have to put them at end of extracts, otherwise, @@ -688,6 +749,7 @@ dpaa2_flow_key_profile_advance(enum net_prot prot, } key_profile->key_size[pos] = field_size; + key_profile->prot_field[pos].type = DPAA2_NET_PROT_KEY; key_profile->prot_field[pos].prot = prot; key_profile->prot_field[pos].key_field = field; key_profile->num++; @@ -711,6 +773,55 @@ dpaa2_flow_key_profile_advance(enum net_prot prot, return pos; } +static int +dpaa2_flow_faf_add_hdr(int faf_byte, + struct dpaa2_dev_priv *priv, + enum dpaa2_flow_dist_type dist_type, int tc_id, + int *insert_offset) +{ + int pos, i, offset; + struct dpaa2_key_extract *key_extract; + struct dpkg_profile_cfg *dpkg; + struct dpkg_extract *extracts; + + if (dist_type == DPAA2_FLOW_QOS_TYPE) + key_extract = &priv->extract.qos_key_extract; + else + key_extract = &priv->extract.tc_key_extract[tc_id]; + + dpkg = &key_extract->dpkg; + extracts = dpkg->extracts; + + if (dpkg->num_extracts >= DPKG_MAX_NUM_OF_EXTRACTS) { + DPAA2_PMD_ERR("Number of extracts overflows"); + return -EINVAL; + } + + pos = dpaa2_flow_faf_advance(priv, + faf_byte, dist_type, tc_id, + insert_offset); + if (pos < 0) + return pos; + + if (pos != dpkg->num_extracts) { + /* Not the last pos, must have IP address extract.*/ + for (i = dpkg->num_extracts - 1; i >= pos; i--) { + memcpy(&extracts[i + 1], + &extracts[i], sizeof(struct dpkg_extract)); + } + } + + offset = DPAA2_FAFE_PSR_OFFSET + faf_byte; + + extracts[pos].type = DPKG_EXTRACT_FROM_PARSE; + extracts[pos].extract.from_parse.offset = offset; + extracts[pos].extract.from_parse.size = 1; + + dpkg->num_extracts++; + + return 0; +} + static int dpaa2_flow_extract_add_hdr(enum net_prot prot, uint32_t field, uint8_t field_size, @@ -997,6 +1108,7 @@ dpaa2_flow_extract_add_raw(struct dpaa2_dev_priv *priv, key_profile->key_offset[pos] = 0; } key_profile->key_size[pos] = item_size; + key_profile->prot_field[pos].type = DPAA2_NET_PROT_KEY; key_profile->prot_field[pos].prot = NET_PROT_PAYLOAD; key_profile->prot_field[pos].key_field = field; @@ -1036,7 +1148,7 @@ dpaa2_flow_extract_add_raw(struct dpaa2_dev_priv *priv, static inline int dpaa2_flow_extract_search(struct dpaa2_key_profile *key_profile, - enum net_prot prot, uint32_t key_field) + enum key_prot_type type, enum net_prot prot, uint32_t key_field) { int pos; struct key_prot_field *prot_field; @@ -1049,16 +1161,23 @@ dpaa2_flow_extract_search(struct dpaa2_key_profile *key_profile, prot_field = key_profile->prot_field; for (pos = 0; pos < key_profile->num; pos++) { - if (prot_field[pos].prot == prot && - prot_field[pos].key_field == key_field) { + if (type == DPAA2_NET_PROT_KEY && + prot_field[pos].prot == prot && + prot_field[pos].key_field == key_field && + prot_field[pos].type == type) + return pos; + else if (type == DPAA2_FAF_KEY && + prot_field[pos].key_field == key_field && + prot_field[pos].type == type) return pos; - } } - if (dpaa2_flow_l4_src_port_extract(prot, key_field)) { + if (type == DPAA2_NET_PROT_KEY && + dpaa2_flow_l4_src_port_extract(prot, key_field)) { if (key_profile->l4_src_port_present) return key_profile->l4_src_port_pos; - } else if (dpaa2_flow_l4_dst_port_extract(prot, key_field)) { + } else if (type == DPAA2_NET_PROT_KEY && + dpaa2_flow_l4_dst_port_extract(prot, key_field)) { if (key_profile->l4_dst_port_present) return key_profile->l4_dst_port_pos; } @@ -1068,80 +1187,53 @@ dpaa2_flow_extract_search(struct dpaa2_key_profile *key_profile, static inline int dpaa2_flow_extract_key_offset(struct dpaa2_key_profile *key_profile, - enum net_prot prot, uint32_t key_field) + enum key_prot_type type, enum net_prot prot, uint32_t key_field) { int i; - i = dpaa2_flow_extract_search(key_profile, prot, key_field); + i = dpaa2_flow_extract_search(key_profile, type, prot, key_field); if (i >= 0) return key_profile->key_offset[i]; else return i; } -struct prev_proto_field_id { - enum net_prot prot; - union { - rte_be16_t eth_type; - uint8_t ip_proto; - }; -}; - static int -dpaa2_flow_prev_proto_rule(struct dpaa2_dev_priv *priv, +dpaa2_flow_faf_add_rule(struct dpaa2_dev_priv *priv, struct dpaa2_dev_flow *flow, - const struct prev_proto_field_id *prev_proto, + enum dpaa2_rx_faf_offset faf_bit_off, int group, enum dpaa2_flow_dist_type dist_type) { int offset; uint8_t *key_addr; uint8_t *mask_addr; - uint32_t field = 0; - rte_be16_t eth_type; - uint8_t ip_proto; struct dpaa2_key_extract *key_extract; struct dpaa2_key_profile *key_profile; + uint8_t faf_byte = faf_bit_off / 8; + uint8_t faf_bit_in_byte = faf_bit_off % 8; - if (prev_proto->prot == NET_PROT_ETH) { - field = NH_FLD_ETH_TYPE; - } else if (prev_proto->prot == NET_PROT_IP) { - field = NH_FLD_IP_PROTO; - } else { - DPAA2_PMD_ERR("Prev proto(%d) not support!", - prev_proto->prot); - return -EINVAL; - } + faf_bit_in_byte = 7 - faf_bit_in_byte; if (dist_type & DPAA2_FLOW_QOS_TYPE) { key_extract = &priv->extract.qos_key_extract; key_profile = &key_extract->key_profile; offset = dpaa2_flow_extract_key_offset(key_profile, - prev_proto->prot, field); + DPAA2_FAF_KEY, NET_PROT_NONE, faf_byte); if (offset < 0) { DPAA2_PMD_ERR("%s QoS key extract failed", __func__); return -EINVAL; } key_addr = flow->qos_key_addr + offset; mask_addr = flow->qos_mask_addr + offset; - if (prev_proto->prot == NET_PROT_ETH) { - eth_type = prev_proto->eth_type; - memcpy(key_addr, ð_type, sizeof(rte_be16_t)); - eth_type = 0xffff; - memcpy(mask_addr, ð_type, sizeof(rte_be16_t)); - flow->qos_rule_size += sizeof(rte_be16_t); - } else if (prev_proto->prot == NET_PROT_IP) { - ip_proto = prev_proto->ip_proto; - memcpy(key_addr, &ip_proto, sizeof(uint8_t)); - ip_proto = 0xff; - memcpy(mask_addr, &ip_proto, sizeof(uint8_t)); - flow->qos_rule_size += sizeof(uint8_t); - } else { - DPAA2_PMD_ERR("Invalid Prev proto(%d)", - prev_proto->prot); - return -EINVAL; - } + + if (!(*key_addr) && + key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) + flow->qos_rule_size++; + + *key_addr |= (1 << faf_bit_in_byte); + *mask_addr |= (1 << faf_bit_in_byte); } if (dist_type & DPAA2_FLOW_FS_TYPE) { @@ -1149,7 +1241,7 @@ dpaa2_flow_prev_proto_rule(struct dpaa2_dev_priv *priv, key_profile = &key_extract->key_profile; offset = dpaa2_flow_extract_key_offset(key_profile, - prev_proto->prot, field); + DPAA2_FAF_KEY, NET_PROT_NONE, faf_byte); if (offset < 0) { DPAA2_PMD_ERR("%s TC[%d] key extract failed", __func__, group); @@ -1158,23 +1250,12 @@ dpaa2_flow_prev_proto_rule(struct dpaa2_dev_priv *priv, key_addr = flow->fs_key_addr + offset; mask_addr = flow->fs_mask_addr + offset; - if (prev_proto->prot == NET_PROT_ETH) { - eth_type = prev_proto->eth_type; - memcpy(key_addr, ð_type, sizeof(rte_be16_t)); - eth_type = 0xffff; - memcpy(mask_addr, ð_type, sizeof(rte_be16_t)); - flow->fs_rule_size += sizeof(rte_be16_t); - } else if (prev_proto->prot == NET_PROT_IP) { - ip_proto = prev_proto->ip_proto; - memcpy(key_addr, &ip_proto, sizeof(uint8_t)); - ip_proto = 0xff; - memcpy(mask_addr, &ip_proto, sizeof(uint8_t)); - flow->fs_rule_size += sizeof(uint8_t); - } else { - DPAA2_PMD_ERR("Invalid Prev proto(%d)", - prev_proto->prot); - return -EINVAL; - } + if (!(*key_addr) && + key_profile->ip_addr_type == IP_NONE_ADDR_EXTRACT) + flow->fs_rule_size++; + + *key_addr |= (1 << faf_bit_in_byte); + *mask_addr |= (1 << faf_bit_in_byte); } return 0; @@ -1196,7 +1277,7 @@ dpaa2_flow_hdr_rule_data_set(struct dpaa2_dev_flow *flow, } offset = dpaa2_flow_extract_key_offset(key_profile, - prot, field); + DPAA2_NET_PROT_KEY, prot, field); if (offset < 0) { DPAA2_PMD_ERR("P(%d)/F(%d) does not exist!", prot, field); @@ -1234,7 +1315,7 @@ dpaa2_flow_raw_rule_data_set(struct dpaa2_dev_flow *flow, field = extract_offset << DPAA2_FLOW_RAW_OFFSET_FIELD_SHIFT; field |= extract_size; offset = dpaa2_flow_extract_key_offset(key_profile, - NET_PROT_PAYLOAD, field); + DPAA2_NET_PROT_KEY, NET_PROT_PAYLOAD, field); if (offset < 0) { DPAA2_PMD_ERR("offset(%d)/size(%d) raw extract failed", extract_offset, size); @@ -1317,60 +1398,39 @@ dpaa2_flow_extract_support(const uint8_t *mask_src, } static int -dpaa2_flow_identify_by_prev_prot(struct dpaa2_dev_priv *priv, +dpaa2_flow_identify_by_faf(struct dpaa2_dev_priv *priv, struct dpaa2_dev_flow *flow, - const struct prev_proto_field_id *prev_prot, + enum dpaa2_rx_faf_offset faf_off, enum dpaa2_flow_dist_type dist_type, int group, int *recfg) { - int ret, index, local_cfg = 0, size = 0; + int ret, index, local_cfg = 0; struct dpaa2_key_extract *extract; struct dpaa2_key_profile *key_profile; - enum net_prot prot = prev_prot->prot; - uint32_t key_field = 0; - - if (prot == NET_PROT_ETH) { - key_field = NH_FLD_ETH_TYPE; - size = sizeof(rte_be16_t); - } else if (prot == NET_PROT_IP) { - key_field = NH_FLD_IP_PROTO; - size = sizeof(uint8_t); - } else if (prot == NET_PROT_IPV4) { - prot = NET_PROT_IP; - key_field = NH_FLD_IP_PROTO; - size = sizeof(uint8_t); - } else if (prot == NET_PROT_IPV6) { - prot = NET_PROT_IP; - key_field = NH_FLD_IP_PROTO; - size = sizeof(uint8_t); - } else { - DPAA2_PMD_ERR("Invalid Prev prot(%d)", prot); - return -EINVAL; - } + uint8_t faf_byte = faf_off / 8; if (dist_type & DPAA2_FLOW_QOS_TYPE) { extract = &priv->extract.qos_key_extract; key_profile = &extract->key_profile; index = dpaa2_flow_extract_search(key_profile, - prot, key_field); + DPAA2_FAF_KEY, NET_PROT_NONE, faf_byte); if (index < 0) { - ret = dpaa2_flow_extract_add_hdr(prot, - key_field, size, priv, - DPAA2_FLOW_QOS_TYPE, group, + ret = dpaa2_flow_faf_add_hdr(faf_byte, + priv, DPAA2_FLOW_QOS_TYPE, group, NULL); if (ret) { - DPAA2_PMD_ERR("QOS prev extract add failed"); + DPAA2_PMD_ERR("QOS faf extract add failed"); return -EINVAL; } local_cfg |= DPAA2_FLOW_QOS_TYPE; } - ret = dpaa2_flow_prev_proto_rule(priv, flow, prev_prot, group, + ret = dpaa2_flow_faf_add_rule(priv, flow, faf_off, group, DPAA2_FLOW_QOS_TYPE); if (ret) { - DPAA2_PMD_ERR("QoS prev rule set failed"); + DPAA2_PMD_ERR("QoS faf rule set failed"); return -EINVAL; } } @@ -1380,14 +1440,13 @@ dpaa2_flow_identify_by_prev_prot(struct dpaa2_dev_priv *priv, key_profile = &extract->key_profile; index = dpaa2_flow_extract_search(key_profile, - prot, key_field); + DPAA2_FAF_KEY, NET_PROT_NONE, faf_byte); if (index < 0) { - ret = dpaa2_flow_extract_add_hdr(prot, - key_field, size, priv, - DPAA2_FLOW_FS_TYPE, group, + ret = dpaa2_flow_faf_add_hdr(faf_byte, + priv, DPAA2_FLOW_FS_TYPE, group, NULL); if (ret) { - DPAA2_PMD_ERR("FS[%d] prev extract add failed", + DPAA2_PMD_ERR("FS[%d] faf extract add failed", group); return -EINVAL; @@ -1395,17 +1454,17 @@ dpaa2_flow_identify_by_prev_prot(struct dpaa2_dev_priv *priv, local_cfg |= DPAA2_FLOW_FS_TYPE; } - ret = dpaa2_flow_prev_proto_rule(priv, flow, prev_prot, group, + ret = dpaa2_flow_faf_add_rule(priv, flow, faf_off, group, DPAA2_FLOW_FS_TYPE); if (ret) { - DPAA2_PMD_ERR("FS[%d] prev rule set failed", + DPAA2_PMD_ERR("FS[%d] faf rule set failed", group); return -EINVAL; } } if (recfg) - *recfg = local_cfg; + *recfg |= local_cfg; return 0; } @@ -1432,7 +1491,7 @@ dpaa2_flow_add_hdr_extract_rule(struct dpaa2_dev_flow *flow, key_profile = &key_extract->key_profile; index = dpaa2_flow_extract_search(key_profile, - prot, field); + DPAA2_NET_PROT_KEY, prot, field); if (index < 0) { ret = dpaa2_flow_extract_add_hdr(prot, field, size, priv, @@ -1571,6 +1630,7 @@ dpaa2_flow_add_ipaddr_extract_rule(struct dpaa2_dev_flow *flow, key_profile->key_max_size += NH_FLD_IPV6_ADDR_SIZE; } key_profile->num++; + key_profile->prot_field[num].type = DPAA2_NET_PROT_KEY; dpkg->extracts[num].extract.from_hdr.prot = prot; dpkg->extracts[num].extract.from_hdr.field = field; @@ -1681,15 +1741,28 @@ dpaa2_configure_flow_eth(struct dpaa2_dev_flow *flow, spec = pattern->spec; mask = pattern->mask ? pattern->mask : &dpaa2_flow_item_eth_mask; - if (!spec) { - DPAA2_PMD_WARN("No pattern spec for Eth flow"); - return -EINVAL; - } /* Get traffic class index and flow id to be configured */ flow->tc_id = group; flow->tc_index = attr->priority; + if (!spec) { + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_ETH_FRAM, DPAA2_FLOW_QOS_TYPE, + group, &local_cfg); + if (ret) + return ret; + + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_ETH_FRAM, DPAA2_FLOW_FS_TYPE, + group, &local_cfg); + if (ret) + return ret; + + (*device_configured) |= local_cfg; + return 0; + } + if (dpaa2_flow_extract_support((const uint8_t *)mask, RTE_FLOW_ITEM_TYPE_ETH)) { DPAA2_PMD_WARN("Extract field(s) of ethernet failed"); @@ -1778,15 +1851,18 @@ dpaa2_configure_flow_vlan(struct dpaa2_dev_flow *flow, flow->tc_index = attr->priority; if (!spec) { - struct prev_proto_field_id prev_proto; + ret = dpaa2_flow_identify_by_faf(priv, flow, FAF_VLAN_FRAM, + DPAA2_FLOW_QOS_TYPE, group, + &local_cfg); + if (ret) + return ret; - prev_proto.prot = NET_PROT_ETH; - prev_proto.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN); - ret = dpaa2_flow_identify_by_prev_prot(priv, flow, &prev_proto, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, - group, &local_cfg); + ret = dpaa2_flow_identify_by_faf(priv, flow, FAF_VLAN_FRAM, + DPAA2_FLOW_FS_TYPE, group, + &local_cfg); if (ret) return ret; + (*device_configured) |= local_cfg; return 0; } @@ -1833,7 +1909,6 @@ dpaa2_configure_flow_ipv4(struct dpaa2_dev_flow *flow, struct rte_eth_dev *dev, const void *key, *mask; struct dpaa2_dev_priv *priv = dev->data->dev_private; int size; - struct prev_proto_field_id prev_prot; group = attr->group; @@ -1846,19 +1921,21 @@ dpaa2_configure_flow_ipv4(struct dpaa2_dev_flow *flow, struct rte_eth_dev *dev, flow->tc_id = group; flow->tc_index = attr->priority; - prev_prot.prot = NET_PROT_ETH; - prev_prot.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4); + ret = dpaa2_flow_identify_by_faf(priv, flow, FAF_IPV4_FRAM, + DPAA2_FLOW_QOS_TYPE, group, + &local_cfg); + if (ret) + return ret; - ret = dpaa2_flow_identify_by_prev_prot(priv, flow, &prev_prot, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, group, - &local_cfg); - if (ret) { - DPAA2_PMD_ERR("IPv4 identification failed!"); + ret = dpaa2_flow_identify_by_faf(priv, flow, FAF_IPV4_FRAM, + DPAA2_FLOW_FS_TYPE, group, &local_cfg); + if (ret) return ret; - } - if (!spec_ipv4) + if (!spec_ipv4) { + (*device_configured) |= local_cfg; return 0; + } if (dpaa2_flow_extract_support((const uint8_t *)mask_ipv4, RTE_FLOW_ITEM_TYPE_IPV4)) { @@ -1950,7 +2027,6 @@ dpaa2_configure_flow_ipv6(struct dpaa2_dev_flow *flow, struct rte_eth_dev *dev, struct dpaa2_dev_priv *priv = dev->data->dev_private; const char zero_cmp[NH_FLD_IPV6_ADDR_SIZE] = {0}; int size; - struct prev_proto_field_id prev_prot; group = attr->group; @@ -1962,19 +2038,21 @@ dpaa2_configure_flow_ipv6(struct dpaa2_dev_flow *flow, struct rte_eth_dev *dev, flow->tc_id = group; flow->tc_index = attr->priority; - prev_prot.prot = NET_PROT_ETH; - prev_prot.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6); + ret = dpaa2_flow_identify_by_faf(priv, flow, FAF_IPV6_FRAM, + DPAA2_FLOW_QOS_TYPE, group, + &local_cfg); + if (ret) + return ret; - ret = dpaa2_flow_identify_by_prev_prot(priv, flow, &prev_prot, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, - group, &local_cfg); - if (ret) { - DPAA2_PMD_ERR("IPv6 identification failed!"); + ret = dpaa2_flow_identify_by_faf(priv, flow, FAF_IPV6_FRAM, + DPAA2_FLOW_FS_TYPE, group, &local_cfg); + if (ret) return ret; - } - if (!spec_ipv6) + if (!spec_ipv6) { + (*device_configured) |= local_cfg; return 0; + } if (dpaa2_flow_extract_support((const uint8_t *)mask_ipv6, RTE_FLOW_ITEM_TYPE_IPV6)) { @@ -2078,18 +2156,15 @@ dpaa2_configure_flow_icmp(struct dpaa2_dev_flow *flow, flow->tc_index = attr->priority; if (!spec) { - /* Next proto of Generical IP is actually used - * for ICMP identification. - * Example: flow create 0 ingress pattern icmp - */ - struct prev_proto_field_id prev_proto; + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_ICMP_FRAM, DPAA2_FLOW_QOS_TYPE, + group, &local_cfg); + if (ret) + return ret; - prev_proto.prot = NET_PROT_IP; - prev_proto.ip_proto = IPPROTO_ICMP; - ret = dpaa2_flow_identify_by_prev_prot(priv, - flow, &prev_proto, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, - group, &local_cfg); + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_ICMP_FRAM, DPAA2_FLOW_FS_TYPE, + group, &local_cfg); if (ret) return ret; @@ -2166,22 +2241,21 @@ dpaa2_configure_flow_udp(struct dpaa2_dev_flow *flow, flow->tc_id = group; flow->tc_index = attr->priority; - if (!spec || !mc_l4_port_identification) { - struct prev_proto_field_id prev_proto; + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_UDP_FRAM, DPAA2_FLOW_QOS_TYPE, + group, &local_cfg); + if (ret) + return ret; - prev_proto.prot = NET_PROT_IP; - prev_proto.ip_proto = IPPROTO_UDP; - ret = dpaa2_flow_identify_by_prev_prot(priv, - flow, &prev_proto, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_UDP_FRAM, DPAA2_FLOW_FS_TYPE, group, &local_cfg); - if (ret) - return ret; + if (ret) + return ret; + if (!spec) { (*device_configured) |= local_cfg; - - if (!spec) - return 0; + return 0; } if (dpaa2_flow_extract_support((const uint8_t *)mask, @@ -2253,22 +2327,21 @@ dpaa2_configure_flow_tcp(struct dpaa2_dev_flow *flow, flow->tc_id = group; flow->tc_index = attr->priority; - if (!spec || !mc_l4_port_identification) { - struct prev_proto_field_id prev_proto; + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_TCP_FRAM, DPAA2_FLOW_QOS_TYPE, + group, &local_cfg); + if (ret) + return ret; - prev_proto.prot = NET_PROT_IP; - prev_proto.ip_proto = IPPROTO_TCP; - ret = dpaa2_flow_identify_by_prev_prot(priv, - flow, &prev_proto, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_TCP_FRAM, DPAA2_FLOW_FS_TYPE, group, &local_cfg); - if (ret) - return ret; + if (ret) + return ret; + if (!spec) { (*device_configured) |= local_cfg; - - if (!spec) - return 0; + return 0; } if (dpaa2_flow_extract_support((const uint8_t *)mask, @@ -2340,22 +2413,21 @@ dpaa2_configure_flow_sctp(struct dpaa2_dev_flow *flow, flow->tc_id = group; flow->tc_index = attr->priority; - if (!spec || !mc_l4_port_identification) { - struct prev_proto_field_id prev_proto; + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_SCTP_FRAM, DPAA2_FLOW_QOS_TYPE, + group, &local_cfg); + if (ret) + return ret; - prev_proto.prot = NET_PROT_IP; - prev_proto.ip_proto = IPPROTO_SCTP; - ret = dpaa2_flow_identify_by_prev_prot(priv, - flow, &prev_proto, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_SCTP_FRAM, DPAA2_FLOW_FS_TYPE, group, &local_cfg); - if (ret) - return ret; + if (ret) + return ret; + if (!spec) { (*device_configured) |= local_cfg; - - if (!spec) - return 0; + return 0; } if (dpaa2_flow_extract_support((const uint8_t *)mask, @@ -2428,21 +2500,20 @@ dpaa2_configure_flow_gre(struct dpaa2_dev_flow *flow, flow->tc_index = attr->priority; if (!spec) { - struct prev_proto_field_id prev_proto; + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_GRE_FRAM, DPAA2_FLOW_QOS_TYPE, + group, &local_cfg); + if (ret) + return ret; - prev_proto.prot = NET_PROT_IP; - prev_proto.ip_proto = IPPROTO_GRE; - ret = dpaa2_flow_identify_by_prev_prot(priv, - flow, &prev_proto, - DPAA2_FLOW_QOS_TYPE | DPAA2_FLOW_FS_TYPE, - group, &local_cfg); + ret = dpaa2_flow_identify_by_faf(priv, flow, + FAF_GRE_FRAM, DPAA2_FLOW_FS_TYPE, + group, &local_cfg); if (ret) return ret; (*device_configured) |= local_cfg; - - if (!spec) - return 0; + return 0; } if (dpaa2_flow_extract_support((const uint8_t *)mask, -- 2.25.1