1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
5 #include "qat_common.h"
6 #include "qat_device.h"
10 qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buf_start,
11 struct qat_sgl *list, uint32_t data_len)
15 uint32_t buf_len = rte_pktmbuf_iova(buf) -
16 buf_start + rte_pktmbuf_data_len(buf);
18 list->buffers[0].addr = buf_start;
19 list->buffers[0].resrvd = 0;
20 list->buffers[0].len = buf_len;
22 if (data_len <= buf_len) {
24 list->buffers[0].len = data_len;
30 if (unlikely(nr == QAT_SGL_MAX_NUMBER)) {
32 "QAT PMD exceeded size of QAT SGL entry(%u)",
37 list->buffers[nr].len = rte_pktmbuf_data_len(buf);
38 list->buffers[nr].resrvd = 0;
39 list->buffers[nr].addr = rte_pktmbuf_iova(buf);
41 buf_len += list->buffers[nr].len;
44 if (buf_len > data_len) {
45 list->buffers[nr].len -=
56 void qat_stats_get(struct qat_pci_device *dev,
57 struct qat_common_stats *stats,
58 enum qat_service_type service)
63 if (stats == NULL || dev == NULL || service >= QAT_SERVICE_INVALID) {
64 QAT_LOG(ERR, "invalid param: stats %p, dev %p, service %d",
69 qp = dev->qps_in_use[service];
70 for (i = 0; i < ADF_MAX_QPS_ON_ANY_SERVICE; i++) {
72 QAT_LOG(DEBUG, "Service %d Uninitialised qp %d",
77 stats->enqueued_count += qp[i]->stats.enqueued_count;
78 stats->dequeued_count += qp[i]->stats.dequeued_count;
79 stats->enqueue_err_count += qp[i]->stats.enqueue_err_count;
80 stats->dequeue_err_count += qp[i]->stats.dequeue_err_count;
84 void qat_stats_reset(struct qat_pci_device *dev,
85 enum qat_service_type service)
90 if (dev == NULL || service >= QAT_SERVICE_INVALID) {
91 QAT_LOG(ERR, "invalid param: dev %p, service %d",
96 qp = dev->qps_in_use[service];
97 for (i = 0; i < ADF_MAX_QPS_ON_ANY_SERVICE; i++) {
99 QAT_LOG(DEBUG, "Service %d Uninitialised qp %d",
103 memset(&(qp[i]->stats), 0, sizeof(qp[i]->stats));
106 QAT_LOG(DEBUG, "QAT: %d stats cleared", service);