@@ -42,6 +42,13 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base,
odp_packet_hdr_t *pkt_hdr);
/**
+ * @internal
+ * Select packet destination queue basing on provided cos entry
+ */
+odp_queue_t cls_pkt_get_queue(odp_packet_hdr_t *pkt_hdr, cos_t *cos,
+ const uint8_t *base);
+
+/**
Packet IO classifier init
This function does initialization of classifier object associated with pktio.
@@ -961,8 +961,7 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base,
odp_packet_hdr_t *pkt_hdr)
{
cos_t *cos;
- uint32_t tbl_index;
- uint32_t hash;
+ odp_queue_t queue;
packet_parse_reset(pkt_hdr);
packet_set_len(pkt_hdr, pkt_len);
@@ -979,20 +978,37 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base,
return -EFAULT;
*pool = cos->s.pool;
+
pkt_hdr->p.input_flags.dst_queue = 1;
- if (!cos->s.queue_group) {
- pkt_hdr->dst_queue = queue_fn->from_ext(cos->s.queue);
- return 0;
- }
+ queue = cls_pkt_get_queue(pkt_hdr, cos, base);
+ pkt_hdr->dst_queue = queue_fn->from_ext(queue);
+
+ return 0;
+}
+
+/**
+ * Set packet destination queue basing on the cos
+ *
+ * @param cos
+ * @param pkt_hdr Packet header
+ * @param base Packet data
+ */
+odp_queue_t cls_pkt_get_queue(odp_packet_hdr_t *pkt_hdr, cos_t *cos,
+ const uint8_t *base)
+{
+ uint32_t tbl_index;
+ uint32_t hash;
+
+ if (!cos->s.queue_group)
+ return cos->s.queue;
hash = packet_rss_hash(pkt_hdr, cos->s.hash_proto, base);
/* CLS_COS_QUEUE_MAX is a power of 2 */
hash = hash & (CLS_COS_QUEUE_MAX - 1);
tbl_index = (cos->s.index * CLS_COS_QUEUE_MAX) + hash;
- pkt_hdr->dst_queue = queue_fn->from_ext(queue_grp_tbl->
- s.queue[tbl_index]);
- return 0;
+
+ return queue_grp_tbl->s.queue[tbl_index];
}
static uint32_t packet_rss_hash(odp_packet_hdr_t *pkt_hdr,