cryptodev: replace mbuf scatter gather flag
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 5 Jul 2018 02:08:02 +0000 (03:08 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 11 Jul 2018 01:57:24 +0000 (03:57 +0200)
The current mbuf scatter gatter feature flag is
too ambiguous, as it is not clear if input and/or output
buffers can be scatter gather mbufs or not, plus
if in-place and/or out-of-place is supported.

Therefore, five new flags will replace this flag:
- RTE_CRYPTODEV_FF_IN_PLACE_SGL
- RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT
- RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT
- RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT
- RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
20 files changed:
doc/guides/cryptodevs/features/aesni_gcm.ini
doc/guides/cryptodevs/features/default.ini
doc/guides/cryptodevs/features/dpaa2_sec.ini
doc/guides/cryptodevs/features/dpaa_sec.ini
doc/guides/cryptodevs/features/null.ini
doc/guides/cryptodevs/features/openssl.ini
doc/guides/cryptodevs/features/qat.ini
doc/guides/cryptodevs/overview.rst
doc/guides/rel_notes/deprecation.rst
doc/guides/rel_notes/release_18_08.rst
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
drivers/crypto/dpaa_sec/dpaa_sec.c
drivers/crypto/null/null_crypto_pmd.c
drivers/crypto/openssl/rte_openssl_pmd.c
drivers/crypto/qat/qat_sym_pmd.c
lib/librte_cryptodev/rte_cryptodev.c
lib/librte_cryptodev/rte_cryptodev.h
test/test/test_cryptodev.c
test/test/test_cryptodev_blockcipher.c

index 920b6b6..b9e9c90 100644 (file)
@@ -10,7 +10,8 @@ CPU AESNI              = Y
 CPU SSE                = Y
 CPU AVX                = Y
 CPU AVX2               = Y
-Mbuf scatter gather    = Y
+OOP SGL In LB  Out     = Y
+OOP LB  In LB  Out     = Y
 ;
 ; Supported crypto algorithms of the 'aesni_gcm' crypto driver.
 ;
index 4278388..92a7ccf 100644 (file)
@@ -18,7 +18,11 @@ CPU AVX512             =
 CPU AESNI              =
 CPU NEON               =
 CPU ARM CE             =
-Mbuf scatter gather    =
+In Place SGL           =
+OOP SGL In SGL Out     =
+OOP SGL In LB  Out     =
+OOP LB  In SGL Out     =
+OOP LB  In LB  Out     =
 
 ;
 ; Supported crypto algorithms of a default crypto driver.
index 68c9960..69700df 100644 (file)
@@ -8,7 +8,11 @@ Symmetric crypto       = Y
 Sym operation chaining = Y
 HW Accelerated         = Y
 Protocol offload       = Y
-Mbuf scatter gather    = Y
+In Place SGL           = Y
+OOP SGL In SGL Out     = Y
+OOP SGL In LB  Out     = Y
+OOP LB  In SGL Out     = Y
+OOP LB  In LB  Out     = Y
 
 ;
 ; Supported crypto algorithms of the 'dpaa2_sec' crypto driver.
index 260fae7..937b621 100644 (file)
@@ -8,7 +8,11 @@ Symmetric crypto       = Y
 Sym operation chaining = Y
 HW Accelerated         = Y
 Protocol offload       = Y
-Mbuf scatter gather    = Y
+In Place SGL           = Y
+OOP SGL In SGL Out     = Y
+OOP SGL In LB  Out     = Y
+OOP LB  In SGL Out     = Y
+OOP LB  In LB  Out     = Y
 
 ;
 ; Supported crypto algorithms of the 'dpaa_sec' crypto driver.
index a9e172d..ecf5779 100644 (file)
@@ -6,7 +6,7 @@
 [Features]
 Symmetric crypto       = Y
 Sym operation chaining = Y
-Mbuf scatter gather    = Y
+In Place SGL           = Y
 
 ;
 ; Supported crypto algorithms of the 'null' crypto driver.
index 6915658..626ec1b 100644 (file)
@@ -6,7 +6,8 @@
 [Features]
 Symmetric crypto       = Y
 Sym operation chaining = Y
-Mbuf scatter gather    = Y
+OOP SGL In LB  Out     = Y
+OOP LB  In LB  Out     = Y
 
 ;
 ; Supported crypto algorithms of the 'openssl' crypto driver.
index 51ed596..29d865e 100644 (file)
@@ -7,7 +7,11 @@
 Symmetric crypto       = Y
 Sym operation chaining = Y
 HW Accelerated         = Y
-Mbuf scatter gather    = Y
+In Place SGL           = Y
+OOP SGL In SGL Out     = Y
+OOP SGL In LB  Out     = Y
+OOP LB  In SGL Out     = Y
+OOP LB  In LB  Out     = Y
 
 ;
 ; Supported crypto algorithms of the 'qat' crypto driver.
index 493cd5f..3f776f0 100644 (file)
@@ -11,14 +11,31 @@ Supported Feature Flags
 
 .. include:: overview_feature_table.txt
 
-Note, the mbuf scatter gather feature (aka chained mbufs, scatter-gather-lists
-or SGLs) indicate all following combinations are supported unless otherwise called
-out in the Limitations section of each PMD.
-
-* In place operation, input buffer as multiple segments, same buffer used for output
-* Out of place operation, input buffer as single segment and output as multiple segments
-* Out of place operation, input buffer as multiple segments and output as single segment
-* Out of place operation, input buffer as multiple segments and output as multiple segments
+.. Note::
+
+   - "In Place SGL" feature flag stands for "In place Scatter-gather list",
+     which means that an input buffer can consist of multiple segments,
+     being the operation in-place (input address = output address).
+
+   - "OOP SGL In SGL Out" feature flag stands for
+     "Out-of-place Scatter-gather list Input, Scatter-gater list Output",
+     which means pmd supports different scatter-gather styled input and output buffers
+     (i.e. both can consists of multiple segments).
+
+   - "OOP SGL In LB Out" feature flag stands for
+     "Out-of-place Scatter-gather list Input, Linear Buffers Output",
+     which means PMD supports input from scatter-gathered styled buffers,
+     outputting linear buffers (i.e. single segment).
+
+   - "OOP LB In SGL Out" feature flag stands for
+     "Out-of-place Linear Buffers Input, Scatter-gather list Output",
+     which means PMD supports input from linear buffer, outputting
+     scatter-gathered styled buffers.
+
+   - "OOP LB In LB Out" feature flag stands for
+     "Out-of-place Linear Buffers Input, Scatter-gather list Output",
+     which means that Out-of-place operation is supported,
+     with linear input and output buffers.
 
 
 Supported Cipher Algorithms
index fa37927..1ff2b52 100644 (file)
@@ -86,5 +86,3 @@ Deprecation Notices
     ``rte_cryptodev_queue_pair_dettach_sym_session()`` will be deprecated from
     18.05 and removed in 18.08, as there are no drivers doing anything useful
     with them.
-  - Some feature flags such as ``RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER`` are ambiguous,
-    so some will be replaced by more explicit flags.
index ff21f00..9ea270c 100644 (file)
@@ -100,6 +100,14 @@ API Changes
   - ``rte_cryptodev_get_private_session_size`` is replaced with
     ``rte_cryptodev_sym_get_private_session_size``
 
+* cryptodev: Feature flag ``RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER`` is
+  replaced with the following more explicit flags:
+  - ``RTE_CRYPTODEV_FF_IN_PLACE_SGL``
+  - ``RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT``
+  - ``RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT``
+  - ``RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT``
+  - ``RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT``
+
 * compressdev: Feature flag ``RTE_COMP_FF_MBUF_SCATTER_GATHER`` is
   replaced with the following more explicit flags:
   - ``RTE_COMP_FF_OOP_SGL_IN_SGL_OUT``
index 88307e0..456ab95 100644 (file)
@@ -492,7 +492,8 @@ aesni_gcm_create(const char *name,
        dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
                        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
                        RTE_CRYPTODEV_FF_CPU_AESNI |
-                       RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
 
        switch (vector_mode) {
        case RTE_AESNI_GCM_SSE:
index 1b1c30d..51c7861 100644 (file)
@@ -2762,7 +2762,11 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
                        RTE_CRYPTODEV_FF_HW_ACCELERATED |
                        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
                        RTE_CRYPTODEV_FF_SECURITY |
-                       RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
+                       RTE_CRYPTODEV_FF_IN_PLACE_SGL |
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
 
        internals = cryptodev->data->dev_private;
 
index b96552c..69965cd 100644 (file)
@@ -2271,7 +2271,11 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev)
                        RTE_CRYPTODEV_FF_HW_ACCELERATED |
                        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
                        RTE_CRYPTODEV_FF_SECURITY |
-                       RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
+                       RTE_CRYPTODEV_FF_IN_PLACE_SGL |
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
 
        internals = cryptodev->data->dev_private;
        internals->max_nb_queue_pairs = RTE_DPAA_MAX_NB_SEC_QPS;
index 0727683..3d7caf1 100644 (file)
@@ -176,7 +176,7 @@ cryptodev_null_create(const char *name,
 
        dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
                        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
-                       RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
+                       RTE_CRYPTODEV_FF_IN_PLACE_SGL;
 
        internals = dev->data->dev_private;
 
index 1ccab4a..2cbe940 100644 (file)
@@ -1660,7 +1660,8 @@ cryptodev_openssl_create(const char *name,
        dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
                        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
                        RTE_CRYPTODEV_FF_CPU_AESNI |
-                       RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
 
        /* Set vector instructions mode supported */
        internals = dev->data->dev_private;
index ee8633b..c9fc1a8 100644 (file)
@@ -274,7 +274,11 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev)
        cryptodev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
                        RTE_CRYPTODEV_FF_HW_ACCELERATED |
                        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
-                       RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
+                       RTE_CRYPTODEV_FF_IN_PLACE_SGL |
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT |
+                       RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT |
+                       RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT;
 
        internals = cryptodev->data->dev_private;
        internals->qat_dev = qat_pci_dev;
index 381330f..754509c 100644 (file)
@@ -361,8 +361,16 @@ rte_cryptodev_get_feature_name(uint64_t flag)
                return "CPU_AESNI";
        case RTE_CRYPTODEV_FF_HW_ACCELERATED:
                return "HW_ACCELERATED";
-       case RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER:
-               return "MBUF_SCATTER_GATHER";
+       case RTE_CRYPTODEV_FF_IN_PLACE_SGL:
+               return "IN_PLACE_SGL";
+       case RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT:
+               return "OOP_SGL_IN_SGL_OUT";
+       case RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT:
+               return "OOP_SGL_IN_LB_OUT";
+       case RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT:
+               return "OOP_LB_IN_SGL_OUT";
+       case RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT:
+               return "OOP_LB_IN_LB_OUT";
        case RTE_CRYPTODEV_FF_CPU_NEON:
                return "CPU_NEON";
        case RTE_CRYPTODEV_FF_CPU_ARM_CE:
index cc219c7..49e9cba 100644 (file)
@@ -292,31 +292,50 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum,
  *
  * Keep these flags synchronised with rte_cryptodev_get_feature_name()
  */
-#define        RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO       (1ULL << 0)
+#define        RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO               (1ULL << 0)
 /**< Symmetric crypto operations are supported */
-#define        RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO      (1ULL << 1)
+#define        RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO              (1ULL << 1)
 /**< Asymmetric crypto operations are supported */
-#define        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2)
+#define        RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING         (1ULL << 2)
 /**< Chaining symmetric crypto operations are supported */
-#define        RTE_CRYPTODEV_FF_CPU_SSE                (1ULL << 3)
+#define        RTE_CRYPTODEV_FF_CPU_SSE                        (1ULL << 3)
 /**< Utilises CPU SIMD SSE instructions */
-#define        RTE_CRYPTODEV_FF_CPU_AVX                (1ULL << 4)
+#define        RTE_CRYPTODEV_FF_CPU_AVX                        (1ULL << 4)
 /**< Utilises CPU SIMD AVX instructions */
-#define        RTE_CRYPTODEV_FF_CPU_AVX2               (1ULL << 5)
+#define        RTE_CRYPTODEV_FF_CPU_AVX2                       (1ULL << 5)
 /**< Utilises CPU SIMD AVX2 instructions */
-#define        RTE_CRYPTODEV_FF_CPU_AESNI              (1ULL << 6)
+#define        RTE_CRYPTODEV_FF_CPU_AESNI                      (1ULL << 6)
 /**< Utilises CPU AES-NI instructions */
-#define        RTE_CRYPTODEV_FF_HW_ACCELERATED         (1ULL << 7)
-/**< Operations are off-loaded to an external hardware accelerator */
-#define        RTE_CRYPTODEV_FF_CPU_AVX512             (1ULL << 8)
+#define        RTE_CRYPTODEV_FF_HW_ACCELERATED                 (1ULL << 7)
+/**< Operations are off-loaded to an
+ * external hardware accelerator
+ */
+#define        RTE_CRYPTODEV_FF_CPU_AVX512                     (1ULL << 8)
 /**< Utilises CPU SIMD AVX512 instructions */
-#define        RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER    (1ULL << 9)
-/**< Scatter-gather mbufs are supported */
-#define        RTE_CRYPTODEV_FF_CPU_NEON               (1ULL << 10)
+#define        RTE_CRYPTODEV_FF_IN_PLACE_SGL                   (1ULL << 9)
+/**< In-place Scatter-gather (SGL) buffers, with multiple segments,
+ * are supported
+ */
+#define RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT            (1ULL << 10)
+/**< Out-of-place Scatter-gather (SGL) buffers are
+ * supported in input and output
+ */
+#define RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT             (1ULL << 11)
+/**< Out-of-place Scatter-gather (SGL) buffers are supported
+ * in input, combined with linear buffers (LB), with a
+ * single segment in output
+ */
+#define RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT             (1ULL << 12)
+/**< Out-of-place Scatter-gather (SGL) buffers are supported
+ * in output, combined with linear buffers (LB) in input
+ */
+#define RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT              (1ULL << 13)
+/**< Out-of-place linear buffers (LB) are supported in input and output */
+#define        RTE_CRYPTODEV_FF_CPU_NEON                       (1ULL << 14)
 /**< Utilises CPU NEON instructions */
-#define        RTE_CRYPTODEV_FF_CPU_ARM_CE             (1ULL << 11)
+#define        RTE_CRYPTODEV_FF_CPU_ARM_CE                     (1ULL << 15)
 /**< Utilises ARM CPU Cryptographic Extensions */
-#define        RTE_CRYPTODEV_FF_SECURITY               (1ULL << 12)
+#define        RTE_CRYPTODEV_FF_SECURITY                       (1ULL << 16)
 /**< Support Security Protocol Processing */
 
 
index 877dc16..b759e08 100644 (file)
@@ -3160,8 +3160,11 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata)
        struct rte_cryptodev_info dev_info;
 
        rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
-       if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
-               printf("Device doesn't support scatter-gather. "
+
+       uint64_t feat_flags = dev_info.feature_flags;
+
+       if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
+               printf("Device doesn't support in-place scatter-gather. "
                                "Test Skipped.\n");
                return 0;
        }
@@ -3308,8 +3311,11 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata)
        struct rte_cryptodev_info dev_info;
 
        rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
-       if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
-               printf("Device doesn't support scatter-gather. "
+
+       uint64_t feat_flags = dev_info.feature_flags;
+       if (!(feat_flags & RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT)) {
+               printf("Device doesn't support out-of-place scatter-gather "
+                               "in both input and output mbufs. "
                                "Test Skipped.\n");
                return 0;
        }
@@ -3659,8 +3665,12 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata)
        struct rte_cryptodev_info dev_info;
 
        rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
-       if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
-               printf("Device doesn't support scatter-gather. "
+
+       uint64_t feat_flags = dev_info.feature_flags;
+
+       if (!(feat_flags & RTE_CRYPTODEV_FF_OOP_SGL_IN_SGL_OUT)) {
+               printf("Device doesn't support out-of-place scatter-gather "
+                               "in both input and output mbufs. "
                                "Test Skipped.\n");
                return 0;
        }
@@ -4493,10 +4503,13 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata)
                return -ENOTSUP;
 
        rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
-       if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
-               printf("Device doesn't support scatter-gather. "
+
+       uint64_t feat_flags = dev_info.feature_flags;
+
+       if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
+               printf("Device doesn't support in-place scatter-gather. "
                                "Test Skipped.\n");
-               return -ENOTSUP;
+               return 0;
        }
 
        plaintext_len = ceil_byte_length(tdata->plaintext.len);
index 256a7da..828f7b5 100644 (file)
@@ -77,12 +77,25 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
 
        if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) {
                rte_cryptodev_info_get(dev_id, &dev_info);
-               if (!(dev_info.feature_flags &
-                               RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) {
-                       printf("Device doesn't support scatter-gather. "
+               uint64_t feat_flags = dev_info.feature_flags;
+               uint64_t oop_flag = RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT;
+
+               if (t->feature_mask && BLOCKCIPHER_TEST_FEATURE_OOP) {
+                       if (!(feat_flags & oop_flag)) {
+                               printf("Device doesn't support out-of-place "
+                                       "scatter-gather in input mbuf. "
+                                       "Test Skipped.\n");
+                               return 0;
+                       }
+               } else {
+                       if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
+                               printf("Device doesn't support in-place "
+                                       "scatter-gather mbufs. "
                                        "Test Skipped.\n");
-                       return 0;
+                               return 0;
+                       }
                }
+
                nb_segs = 3;
        }