app/crypto-perf: parse segment size
[dpdk.git] / app / test-crypto-perf / cperf_ops.c
index 5be20d9..ad32065 100644 (file)
@@ -175,6 +175,14 @@ cperf_set_ops_auth(struct rte_crypto_op **ops,
                                        offset -= tbuf->data_len;
                                        tbuf = tbuf->next;
                                }
+                               /*
+                                * If there is not enough room in segment,
+                                * place the digest in the next segment
+                                */
+                               if ((tbuf->data_len - offset) < options->digest_sz) {
+                                       tbuf = tbuf->next;
+                                       offset = 0;
+                               }
                                buf = tbuf;
                        }
 
@@ -256,6 +264,14 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops,
                                        offset -= tbuf->data_len;
                                        tbuf = tbuf->next;
                                }
+                               /*
+                                * If there is not enough room in segment,
+                                * place the digest in the next segment
+                                */
+                               if ((tbuf->data_len - offset) < options->digest_sz) {
+                                       tbuf = tbuf->next;
+                                       offset = 0;
+                               }
                                buf = tbuf;
                        }
 
@@ -346,6 +362,14 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
                                        offset -= tbuf->data_len;
                                        tbuf = tbuf->next;
                                }
+                               /*
+                                * If there is not enough room in segment,
+                                * place the digest in the next segment
+                                */
+                               if ((tbuf->data_len - offset) < options->digest_sz) {
+                                       tbuf = tbuf->next;
+                                       offset = 0;
+                               }
                                buf = tbuf;
                        }