+ /* The only parts that should have changed in the buffer are
+ * plaintext/ciphertext and digest.
+ * In OOP only the dest buffer should change.
+ */
+ if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_OOP) {
+ struct rte_mbuf *mbuf;
+ uint8_t value;
+ uint32_t head_unchanged_len, changed_len = 0;
+ uint32_t i;
+ uint32_t hdroom_used = 0, tlroom_used = 0;
+ uint32_t hdroom = 0;
+
+ mbuf = sym_op->m_src;
+ /*
+ * Crypto PMDs specify the headroom & tailroom it would use
+ * when processing the crypto operation. PMD is free to modify
+ * this space, and so the verification check should skip that
+ * block.
+ */
+ hdroom_used = dev_info.min_mbuf_headroom_req;
+ tlroom_used = dev_info.min_mbuf_tailroom_req;
+
+ /* Get headroom */
+ hdroom = rte_pktmbuf_headroom(mbuf);
+
+ head_unchanged_len = mbuf->buf_len;
+
+ for (i = 0; i < mbuf->buf_len; i++) {
+
+ /* Skip headroom used by PMD */
+ if (i == hdroom - hdroom_used)
+ i += hdroom_used;
+
+ /* Skip tailroom used by PMD */
+ if (i == (hdroom + mbuf->data_len))
+ i += tlroom_used;
+
+ value = *((uint8_t *)(mbuf->buf_addr)+i);
+ if (value != tmp_src_buf[i]) {
+ snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
+ "line %u FAILED: OOP src outer mbuf data (0x%x) not as expected (0x%x)",
+ __LINE__, value, tmp_src_buf[i]);
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+ }
+
+ mbuf = sym_op->m_dst;
+ if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH) {
+ head_unchanged_len = hdroom + sym_op->auth.data.offset;
+ changed_len = sym_op->auth.data.length;
+ if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
+ changed_len += digest_len;
+ } else {
+ /* cipher-only */
+ head_unchanged_len = hdroom +
+ sym_op->cipher.data.offset;
+ changed_len = sym_op->cipher.data.length;
+ }
+
+ for (i = 0; i < mbuf->buf_len; i++) {
+ if (i == head_unchanged_len)
+ i += changed_len;
+ value = *((uint8_t *)(mbuf->buf_addr)+i);
+ if (value != tmp_dst_buf[i]) {
+ snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
+ "line %u FAILED: OOP dst outer mbuf data "
+ "(0x%x) not as expected (0x%x)",
+ __LINE__, value, tmp_dst_buf[i]);
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+ }
+
+ if (!nb_iterates) {
+ nb_iterates++;
+ goto iterate;
+ }
+ } else {
+ /* In-place operation */
+ struct rte_mbuf *mbuf;
+ uint8_t value;
+ uint32_t head_unchanged_len = 0, changed_len = 0;
+ uint32_t i;
+ uint32_t hdroom_used = 0, tlroom_used = 0;
+ uint32_t hdroom = 0;
+
+ /*
+ * Crypto PMDs specify the headroom & tailroom it would use
+ * when processing the crypto operation. PMD is free to modify
+ * this space, and so the verification check should skip that
+ * block.
+ */
+ hdroom_used = dev_info.min_mbuf_headroom_req;
+ tlroom_used = dev_info.min_mbuf_tailroom_req;
+
+ mbuf = sym_op->m_src;
+
+ /* Get headroom */
+ hdroom = rte_pktmbuf_headroom(mbuf);
+
+ if (t->op_mask & BLOCKCIPHER_TEST_OP_CIPHER) {
+ head_unchanged_len = hdroom +
+ sym_op->cipher.data.offset;
+ changed_len = sym_op->cipher.data.length;
+ } else {
+ /* auth-only */
+ head_unchanged_len = hdroom +
+ sym_op->auth.data.offset +
+ sym_op->auth.data.length;
+ changed_len = 0;
+ }
+
+ if (t->op_mask & BLOCKCIPHER_TEST_OP_AUTH_GEN)
+ changed_len += digest_len;
+
+ for (i = 0; i < mbuf->buf_len; i++) {
+
+ /* Skip headroom used by PMD */
+ if (i == hdroom - hdroom_used)
+ i += hdroom_used;
+
+ if (i == head_unchanged_len)
+ i += changed_len;
+
+ /* Skip tailroom used by PMD */
+ if (i == (hdroom + mbuf->data_len))
+ i += tlroom_used;
+
+ value = *((uint8_t *)(mbuf->buf_addr)+i);
+ if (value != tmp_src_buf[i]) {
+ snprintf(test_msg, BLOCKCIPHER_TEST_MSG_LEN,
+ "line %u FAILED: outer mbuf data (0x%x) "
+ "not as expected (0x%x)",
+ __LINE__, value, tmp_src_buf[i]);
+ status = TEST_FAILED;
+ goto error_exit;
+ }
+ }
+ }
+