X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=VNFs%2FDPPD-PROX%2Fhandle_qinq_encap6.c;h=c65386552b2b078d3cf750b5c9498f54065ab2e7;hb=b1cfe607cf04071e217f670b200b56d379b7b975;hp=e5b774da6ae2e5eedd83149507c7f923b6ece562;hpb=cb94e0036256c6a3fb0aadb682a04d8ad30ddd2a;p=samplevnf.git diff --git a/VNFs/DPPD-PROX/handle_qinq_encap6.c b/VNFs/DPPD-PROX/handle_qinq_encap6.c index e5b774da..c6538655 100644 --- a/VNFs/DPPD-PROX/handle_qinq_encap6.c +++ b/VNFs/DPPD-PROX/handle_qinq_encap6.c @@ -29,6 +29,8 @@ #include "mpls.h" #include "hash_utils.h" #include "quit.h" +#include "prox_compat.h" +#include "handle_sched.h" struct task_qinq_encap6 { struct task_base base; @@ -36,6 +38,7 @@ struct task_qinq_encap6 { uint8_t tx_portid; uint8_t runtime_flags; struct rte_table_hash *cpe_table; + struct rte_sched_port *sched_port; }; static void init_task_qinq_encap6(struct task_base *tbase, struct task_args *targ) @@ -45,15 +48,19 @@ static void init_task_qinq_encap6(struct task_base *tbase, struct task_args *tar task->qinq_tag = targ->qinq_tag; task->cpe_table = targ->cpe_table; task->runtime_flags = targ->runtime_flags; + if (task->runtime_flags & TASK_CLASSIFY) { + int rc = init_port_sched(&task->sched_port, targ); + PROX_PANIC(rc, "Did not find any QoS task to transmit to => undefined sched_port parameters\n"); + } } /* Encapsulate IPv6 packet in QinQ where the QinQ is derived from the IPv6 address */ static inline uint8_t handle_qinq_encap6(struct rte_mbuf *mbuf, struct task_qinq_encap6 *task) { - struct qinq_hdr *pqinq = (struct qinq_hdr *)rte_pktmbuf_prepend(mbuf, 2 * sizeof(struct vlan_hdr)); + struct qinq_hdr *pqinq = (struct qinq_hdr *)rte_pktmbuf_prepend(mbuf, 2 * sizeof(prox_rte_vlan_hdr)); PROX_ASSERT(pqinq); - struct ipv6_hdr *pip6 = (struct ipv6_hdr *)(pqinq + 1); + prox_rte_ipv6_hdr *pip6 = (prox_rte_ipv6_hdr *)(pqinq + 1); if (pip6->hop_limits) { pip6->hop_limits--; @@ -67,7 +74,7 @@ static inline uint8_t handle_qinq_encap6(struct rte_mbuf *mbuf, struct task_qinq uint64_t pkts_mask = RTE_LEN2MASK(1, uint64_t); uint64_t lookup_hit_mask; struct cpe_data* entries[64]; // TODO: use bulk size - rte_table_hash_ext_dosig_ops.f_lookup(task->cpe_table, &mbuf, pkts_mask, &lookup_hit_mask, (void**)entries); + prox_rte_table_lookup(task->cpe_table, &mbuf, pkts_mask, &lookup_hit_mask, (void**)entries); if (lookup_hit_mask == 0x1) { /* will also overwrite part of the destination addr */ @@ -80,7 +87,7 @@ static inline uint8_t handle_qinq_encap6(struct rte_mbuf *mbuf, struct task_qinq /* classification can only be done from this point */ if (task->runtime_flags & TASK_CLASSIFY) { - rte_sched_port_pkt_write(mbuf, 0, entries[0]->user, 0, 0, 0); + prox_rte_sched_port_pkt_write(task->sched_port, mbuf, 0, entries[0]->user, 0, 0, 0); } return 0; } @@ -101,15 +108,17 @@ void init_cpe6_table(struct task_args *targ) } uint32_t n_entries = MAX_GRE / table_part; - struct rte_table_hash_ext_params table_hash_params = { + static char hash_name[30]; + sprintf(hash_name, "cpe6_table_%03d", targ->lconf->id); + struct prox_rte_table_params table_hash_params = { + .name = hash_name, .key_size = sizeof(struct ipv6_addr), .n_keys = n_entries, .n_buckets = n_entries >> 2, - .n_buckets_ext = n_entries >> 3, - .f_hash = hash_crc32, + .f_hash = (rte_table_hash_op_hash)hash_crc32, .seed = 0, - .signature_offset = HASH_METADATA_OFFSET(0), .key_offset = HASH_METADATA_OFFSET(0), + .key_mask = NULL }; size_t entry_size = sizeof(struct cpe_data); @@ -117,8 +126,7 @@ void init_cpe6_table(struct task_args *targ) entry_size = rte_align32pow2(entry_size); } - struct rte_table_hash* phash = rte_table_hash_ext_dosig_ops. - f_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), entry_size); + struct rte_table_hash* phash = prox_rte_table_create(&table_hash_params, rte_lcore_to_socket_id(targ->lconf->id), entry_size); PROX_PANIC(phash == NULL, "Unable to allocate memory for IPv6 hash table on core %u\n", targ->lconf->id); for (uint8_t task_id = 0; task_id < targ->lconf->n_tasks_all; ++task_id) {