net/mlx5: support new flow counter API
[dpdk.git] / drivers / compress / qat / qat_comp.c
index cbf7614..b9336f3 100644 (file)
@@ -44,7 +44,8 @@ qat_comp_build_request(void *in_op, uint8_t *out_msg,
 
        /* common for sgl and flat buffers */
        comp_req->comp_pars.comp_len = op->src.length;
-       comp_req->comp_pars.out_buffer_sz = rte_pktmbuf_pkt_len(op->m_dst);
+       comp_req->comp_pars.out_buffer_sz = rte_pktmbuf_pkt_len(op->m_dst) -
+                       op->dst.offset;
 
        if (op->m_src->next != NULL || op->m_dst->next != NULL) {
                /* sgl */
@@ -52,25 +53,24 @@ qat_comp_build_request(void *in_op, uint8_t *out_msg,
 
                ICP_QAT_FW_COMN_PTR_TYPE_SET(comp_req->comn_hdr.comn_req_flags,
                                QAT_COMN_PTR_TYPE_SGL);
+
                ret = qat_sgl_fill_array(op->m_src,
-                               rte_pktmbuf_mtophys_offset(op->m_src,
-                                                       op->src.offset),
+                               op->src.offset,
                                &cookie->qat_sgl_src,
                                op->src.length,
                                RTE_PMD_QAT_COMP_SGL_MAX_SEGMENTS);
                if (ret) {
-                       QAT_DP_LOG(ERR, "QAT PMD Cannot fill sgl array");
+                       QAT_DP_LOG(ERR, "QAT PMD Cannot fill source sgl array");
                        return ret;
                }
 
                ret = qat_sgl_fill_array(op->m_dst,
-                               rte_pktmbuf_mtophys_offset(op->m_dst,
-                                                       op->dst.offset),
+                               op->dst.offset,
                                &cookie->qat_sgl_dst,
                                comp_req->comp_pars.out_buffer_sz,
                                RTE_PMD_QAT_COMP_SGL_MAX_SEGMENTS);
                if (ret) {
-                       QAT_DP_LOG(ERR, "QAT PMD Cannot fill sgl array");
+                       QAT_DP_LOG(ERR, "QAT PMD Cannot fill dest. sgl array");
                        return ret;
                }
 
@@ -85,8 +85,9 @@ qat_comp_build_request(void *in_op, uint8_t *out_msg,
                /* flat aka linear buffer */
                ICP_QAT_FW_COMN_PTR_TYPE_SET(comp_req->comn_hdr.comn_req_flags,
                                QAT_COMN_PTR_TYPE_FLAT);
-               comp_req->comn_mid.src_length = rte_pktmbuf_data_len(op->m_src);
-               comp_req->comn_mid.dst_length = rte_pktmbuf_data_len(op->m_dst);
+               comp_req->comn_mid.src_length = op->src.length;
+               comp_req->comn_mid.dst_length =
+                               comp_req->comp_pars.out_buffer_sz;
 
                comp_req->comn_mid.src_data_addr =
                    rte_pktmbuf_mtophys_offset(op->m_src, op->src.offset);
@@ -144,7 +145,6 @@ qat_comp_process_response(void **op, uint8_t *resp)
                rx_op->debug_status =
                        *((uint16_t *)(&resp_msg->comn_resp.comn_error));
        } else {
-               struct qat_comp_xform *qat_xform = rx_op->private_xform;
                struct icp_qat_fw_resp_comp_pars *comp_resp =
                  (struct icp_qat_fw_resp_comp_pars *)&resp_msg->comp_resp_pars;
 
@@ -344,17 +344,16 @@ qat_comp_private_xform_create(struct rte_compressdev *dev,
                if (xform->compress.deflate.huffman == RTE_COMP_HUFFMAN_FIXED ||
                  ((xform->compress.deflate.huffman == RTE_COMP_HUFFMAN_DEFAULT)
                                   && qat->interm_buff_mz == NULL))
-
                        qat_xform->qat_comp_request_type =
                                        QAT_COMP_REQUEST_FIXED_COMP_STATELESS;
 
+               qat_xform->checksum_type = xform->compress.chksum;
 
        } else {
                qat_xform->qat_comp_request_type = QAT_COMP_REQUEST_DECOMPRESS;
+               qat_xform->checksum_type = xform->decompress.chksum;
        }
 
-       qat_xform->checksum_type = xform->compress.chksum;
-
        if (qat_comp_create_templates(qat_xform, qat->interm_buff_mz, xform)) {
                QAT_LOG(ERR, "QAT: Problem with setting compression");
                return -EINVAL;