[dpdk-dev] [PATCH v3 1/7] crypto/virtio: add virtio related fundamental functions

2018-03-25 Thread Jay Zhou
Since there does not have the common virtio library, we have to put
these files here. They are basically the same with virtio net related files
with some minor changes.

Signed-off-by: Jay Zhou 
---
 config/common_base  |  20 ++
 drivers/crypto/virtio/virtio_logs.h |  47 
 drivers/crypto/virtio/virtio_pci.c  | 460 
 drivers/crypto/virtio/virtio_pci.h  | 253 
 drivers/crypto/virtio/virtio_ring.h | 137 +++
 drivers/crypto/virtio/virtqueue.c   |  43 
 drivers/crypto/virtio/virtqueue.h   | 176 ++
 7 files changed, 1136 insertions(+)
 create mode 100644 drivers/crypto/virtio/virtio_logs.h
 create mode 100644 drivers/crypto/virtio/virtio_pci.c
 create mode 100644 drivers/crypto/virtio/virtio_pci.h
 create mode 100644 drivers/crypto/virtio/virtio_ring.h
 create mode 100644 drivers/crypto/virtio/virtqueue.c
 create mode 100644 drivers/crypto/virtio/virtqueue.h

diff --git a/config/common_base b/config/common_base
index ad03cf4..19d0cdd 100644
--- a/config/common_base
+++ b/config/common_base
@@ -482,6 +482,26 @@ CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
 CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
 
 #
+# Compile PMD for virtio crypto devices
+#
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_SESSION=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DRIVER=n
+CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DUMP=n
+#
+# Number of maximum virtio crypto devices
+#
+CONFIG_RTE_MAX_VIRTIO_CRYPTO=32
+#
+# Number of sessions to create in the session memory pool
+# on a single virtio crypto device.
+#
+CONFIG_RTE_VIRTIO_CRYPTO_PMD_MAX_NB_SESSIONS=1024
+
+#
 # Compile PMD for AESNI backed device
 #
 CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
diff --git a/drivers/crypto/virtio/virtio_logs.h 
b/drivers/crypto/virtio/virtio_logs.h
new file mode 100644
index 000..20582a4
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_logs.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+ */
+
+#ifndef _VIRTIO_LOGS_H_
+#define _VIRTIO_LOGS_H_
+
+#include 
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_INIT
+#define PMD_INIT_LOG(level, fmt, args...) \
+   RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+#else
+#define PMD_INIT_LOG(level, fmt, args...) do { } while (0)
+#define PMD_INIT_FUNC_TRACE() do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_SESSION
+#define PMD_SESSION_LOG(level, fmt, args...) \
+   RTE_LOG(level, PMD, "%s() session: " fmt "\n", __func__, ## args)
+#else
+#define PMD_SESSION_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_RX
+#define PMD_RX_LOG(level, fmt, args...) \
+   RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
+#else
+#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_TX
+#define PMD_TX_LOG(level, fmt, args...) \
+   RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_PMD_VIRTIO_CRYPTO_DEBUG_DRIVER
+#define PMD_DRV_LOG(level, fmt, args...) \
+   RTE_LOG(level, PMD, "%s(): driver " fmt "\n", __func__, ## args)
+#else
+#define PMD_DRV_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#endif /* _VIRTIO_LOGS_H_ */
diff --git a/drivers/crypto/virtio/virtio_pci.c 
b/drivers/crypto/virtio/virtio_pci.c
new file mode 100644
index 000..7aa5cdd
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -0,0 +1,460 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+ */
+
+#include 
+
+#ifdef RTE_EXEC_ENV_LINUXAPP
+ #include 
+ #include 
+#endif
+
+#include 
+#include 
+
+#include "virtio_pci.h"
+#include "virtqueue.h"
+
+/*
+ * Following macros are derived from linux/pci_regs.h, however,
+ * we can't simply include that header here, as there is no such
+ * file for non-Linux platform.
+ */
+#define PCI_CAPABILITY_LIST0x34
+#define PCI_CAP_ID_VNDR0x09
+#define PCI_CAP_ID_MSIX0x11
+
+/*
+ * The remaining space is defined by each driver as the per-driver
+ * configuration space.
+ */
+#define VIRTIO_PCI_CONFIG(hw) \
+   (((hw)->use_msix == VIRTIO_MSIX_ENABLED) ? 24 : 20)
+
+static inline int
+check_vq_phys_addr_ok(struct virtqueue *vq)
+{
+   /* Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
+* and only accepts 32 bit page frame number.
+* Check if the allocated physical memory exceeds 16TB.
+*/
+   if ((vq->vq_ring_mem + vq->vq_ring_size - 1) >>
+   (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32)) {
+   PMD_INIT_LOG(ERR, "vring 

[dpdk-dev] [PATCH v3 0/7] crypto: add virtio poll mode driver

2018-03-25 Thread Jay Zhou
This patch series introduce virtio crypto poll mode driver.

Since it is limited by the vhost crypto backend of the virtio-crypto,
this patch series only supports a limited subset of crypto services.
Only the following algorithms are tested:

Cipher algorithms:
  - RTE_CRYPTO_CIPHER_AES_CBC (128-bit, 192-bit and 256-bit keys)

Cipher then hash algorithms:
  - RTE_CRYPTO_CIPHER_AES_CBC with RTE_CRYPTO_AUTH_SHA1_HMAC

The qemu side has supported vhost crypto and the vhost user crypto server
side patches had been sent to DPDK community, pls see

[PATCH v2 00/10] lib/librte_vhost: introduce new vhost  user crypto backend
support
https://dpdk.org/ml/archives/dev/2018-February/091594.html

Firstly run DPDK vhost crypto sample as a server side and build QEMU with
vhost crypto enabled. 
QEMU can then be started using the following parameters:

qemu-system-x86_64 \
[...] \
-chardev socket,id=charcrypto0,path=/path/to/your/socket \
-object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 \
-device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0
[...]

Bind the uio_generic driver for the virtio-crypto device.
For example, :00:04.0 is the domain, bus, device and function
number of the virtio-crypto device:
modprobe uio_pci_generic
echo -n :00:04.0 > /sys/bus/pci/drivers/virtio-pci/unbind
echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_id

The front-end virtio crypto PMD driver can be installed:
cd to the top-level DPDK directory
sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO\)=n,\1=y,' 
config/common_base
make config T=x86_64-native-linuxapp-gcc
make install T=x86_64-native-linuxapp-gcc

The unit test cases can be compiled as below:
cd to the top-level DPDK directory
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=`pwd`
cd to test/test
make
./test (MUST reserve enough huge pages memory)
type the command "cryptodev_virtio_autotest" to test

The result should be like this:
RTE>>cryptodev_virtio_autotest
 + --- +
 + Test Suite : Crypto VIRTIO Unit Test Suite
 + --- +
  0) TestCase AES-128-CBC Encryption PASS
  1) TestCase AES-128-CBC Decryption PASS
  2) TestCase AES-192-CBC Encryption PASS
  3) TestCase AES-192-CBC Decryption PASS
  4) TestCase AES-256-CBC Encryption PASS
  5) TestCase AES-256-CBC Decryption PASS
  6) TestCase AES-256-CBC OOP Encryption PASS
  7) TestCase AES-256-CBC OOP Decryption PASS
  8) TestCase AES-128-CTR Encryption PASS
  9) TestCase AES-128-CTR Decryption PASS
  10) TestCase AES-192-CTR Encryption PASS
  11) TestCase AES-192-CTR Decryption PASS
  12) TestCase AES-256-CTR Encryption PASS
  13) TestCase AES-256-CTR Decryption PASS
 + TestCase [ 0] : test_AES_cipheronly_virtio_all succeeded
 + --- +
 + Test Suite Summary
 + Tests Total :1
 + Tests Skipped :  0
 + Tests Executed : 1
 + Tests Unsupported:   0
 + Tests Passed :   1
 + Tests Failed :   0
 + --- +
Test OK

The performance can be tested as below:

reserve enough huge pages
cd to the top-level DPDK directory
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=`pwd`
cd to app/test-crypto-perf
type the command "make" to compile
run the tests with the following command:

./dpdk-test-crypto-perf -l 0,1 -- --devtype crypto_virtio \
--ptest throughput --optype cipher-then-auth --cipher-algo aes-cbc \
--cipher-op encrypt --cipher-key-sz 16 --auth-algo sha1-hmac \
--auth-op generate --auth-key-sz 64 --digest-sz 12 \
--total-ops 1 --burst-sz 64 --buffer-sz 2048

Please help to review, thanks!

Changes in v3:
 - set up capabilities for virtio crypto PMD [Fan]
 - delete AES-CTR unit test cases since vhost_user crypto backend does not
   support [Fan]
 - fix a variable uninitialized in virtio_crypto_queue_setup() [Xin, Fan]
 - fix a bug in virtqueue_dequeue_burst_rx()

Changes in v2:
 - using pre-allocated mempool instead of rte_malloc to improve performance 
[Fan]
 - split the patch into a patchset [Fan]
 - using linux/virtio_crypto.h instead of creating a copy of the file [Fan]
 - update doc/guides/cryptodevs for describing virtio crypto PMD [Fan]
 - update copyright
 - delete virtio legacy mode code since virtio-crypto conforms to virtio-1.0
 - refine the function and variable names
 - fix errors and warnings reported by checkpatch

Jay Zhou (7):
  crypto/virtio: add virtio related fundamental functions
  crpyto/virtio: add crypto related session structure
  cryptodev/virtio: core code of crypto devices
  crypto/virtio: add makefile
  cryptodev: add document for virtio crypto PMD
  cryptodev: add function tests for virtio crypto PMD
  MAINTAINERS: add myself as virtio crypto PMD maintainer

 MAINTAINERS   

[dpdk-dev] [PATCH v3 3/7] cryptodev/virtio: core code of crypto devices

2018-03-25 Thread Jay Zhou
The idea comes from QAT and virtio-net devices.

Signed-off-by: Jay Zhou 
---
 drivers/crypto/virtio/virtio_crypto_capabilities.h |   51 +
 drivers/crypto/virtio/virtio_cryptodev.c   | 1553 
 drivers/crypto/virtio/virtio_cryptodev.h   |   66 +
 drivers/crypto/virtio/virtio_rxtx.c|  540 +++
 4 files changed, 2210 insertions(+)
 create mode 100644 drivers/crypto/virtio/virtio_crypto_capabilities.h
 create mode 100644 drivers/crypto/virtio/virtio_cryptodev.c
 create mode 100644 drivers/crypto/virtio/virtio_cryptodev.h
 create mode 100644 drivers/crypto/virtio/virtio_rxtx.c

diff --git a/drivers/crypto/virtio/virtio_crypto_capabilities.h 
b/drivers/crypto/virtio/virtio_crypto_capabilities.h
new file mode 100644
index 000..0d8dfac
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_crypto_capabilities.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+ */
+
+#ifndef _VIRTIO_CRYPTO_CAPABILITIES_H_
+#define _VIRTIO_CRYPTO_CAPABILITIES_H_
+
+#define VIRTIO_SYM_CAPABILITIES
\
+   {   /* SHA1 HMAC */ \
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, \
+   {.sym = {   \
+   .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,\
+   {.auth = {  \
+   .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,  \
+   .block_size = 64,   \
+   .key_size = {   \
+   .min = 1,   \
+   .max = 64,  \
+   .increment = 1  \
+   },  \
+   .digest_size = {\
+   .min = 1,   \
+   .max = 20,  \
+   .increment = 1  \
+   },  \
+   .iv_size = { 0 }\
+   }, }\
+   }, }\
+   },  \
+   {   /* AES CBC */   \
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, \
+   {.sym = {   \
+   .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,  \
+   {.cipher = {\
+   .algo = RTE_CRYPTO_CIPHER_AES_CBC,  \
+   .block_size = 16,   \
+   .key_size = {   \
+   .min = 16,  \
+   .max = 32,  \
+   .increment = 8  \
+   },  \
+   .iv_size = {\
+   .min = 16,  \
+   .max = 16,  \
+   .increment = 0  \
+   }   \
+   }, }\
+   }, }\
+   }
+
+#endif /* _VIRTIO_CRYPTO_CAPABILITIES_H_ */
diff --git a/drivers/crypto/virtio/virtio_cryptodev.c 
b/drivers/crypto/virtio/virtio_cryptodev.c
new file mode 100644
index 000..8affbef
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_cryptodev.c
@@ -0,0 +1,1553 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#ifdef RTE_EXEC_ENV_LINUXAPP
+#include 
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "virtio_cryptodev.h"
+#include "virtqueue.h"
+#include "virtio_crypto_algs.h"
+#include "virtio_crypto_capabilities.h"
+
+static int virtio_crypto_dev_configure(struct rte_cryptodev *dev,
+ 

[dpdk-dev] [PATCH v3 2/7] crpyto/virtio: add crypto related session structure

2018-03-25 Thread Jay Zhou
This structure will be used in the following patches, especially
at creating and destroying crypto sessions.

Signed-off-by: Jay Zhou 
---
 drivers/crypto/virtio/virtio_crypto_algs.h | 27 +++
 1 file changed, 27 insertions(+)
 create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h

diff --git a/drivers/crypto/virtio/virtio_crypto_algs.h 
b/drivers/crypto/virtio/virtio_crypto_algs.h
new file mode 100644
index 000..5f1e9df
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_crypto_algs.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+ */
+
+#ifndef _VIRTIO_CRYPTO_ALGS_H_
+#define _VIRTIO_CRYPTO_ALGS_H_
+
+#include 
+#include 
+
+struct virtio_crypto_session {
+   uint64_t session_id;
+
+   struct {
+   uint16_t offset;
+   uint16_t length;
+   } iv;
+
+   struct {
+   uint32_t length;
+   phys_addr_t phys_addr;
+   } aad;
+
+   struct virtio_crypto_op_ctrl_req ctrl;
+};
+
+#endif /* _VIRTIO_CRYPTO_ALGS_H_ */
-- 
1.8.3.1




[dpdk-dev] [PATCH v3 5/7] cryptodev: add document for virtio crypto PMD

2018-03-25 Thread Jay Zhou
Signed-off-by: Jay Zhou 
---
 doc/guides/cryptodevs/features/virtio.ini |  22 ++
 doc/guides/cryptodevs/virtio.rst  | 117 ++
 2 files changed, 139 insertions(+)
 create mode 100644 doc/guides/cryptodevs/features/virtio.ini
 create mode 100644 doc/guides/cryptodevs/virtio.rst

diff --git a/doc/guides/cryptodevs/features/virtio.ini 
b/doc/guides/cryptodevs/features/virtio.ini
new file mode 100644
index 000..eaac734
--- /dev/null
+++ b/doc/guides/cryptodevs/features/virtio.ini
@@ -0,0 +1,22 @@
+; Supported features of the 'virtio' crypto driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Symmetric crypto   = Y
+Sym operation chaining = Y
+HW Accelerated = N
+Mbuf scatter gather= N
+
+;
+; Supported crypto algorithms of the 'virtio' crypto driver.
+;
+[Cipher]
+AES CBC (128)  = Y
+AES CBC (192)  = Y
+AES CBC (256)  = Y
+;
+; Supported authentication algorithms of the 'virtio' crypto driver.
+;
+[Auth]
+SHA1 HMAC  = Y
diff --git a/doc/guides/cryptodevs/virtio.rst b/doc/guides/cryptodevs/virtio.rst
new file mode 100644
index 000..f3aa7c6
--- /dev/null
+++ b/doc/guides/cryptodevs/virtio.rst
@@ -0,0 +1,117 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+
+Virtio Crypto Poll Mode Driver
+==
+
+The virtio crypto PMD provides poll mode driver support for the virtio crypto
+device.
+
+Features
+
+
+The virtio crypto PMD has support for:
+
+Cipher algorithms:
+
+* ``RTE_CRYPTO_CIPHER_AES_CBC``
+
+Hash algorithms:
+
+* ``RTE_CRYPTO_AUTH_SHA1_HMAC``
+
+Limitations
+---
+
+*  Only supports the session-oriented API implementation (session-less APIs are
+   not supported).
+*  Only supports modern mode since virtio crypto conforms to virtio-1.0.
+*  Only has two types of queues: data queue and control queue. These two queues
+   only support indirect buffers to communication with the virtio backend.
+*  Only supports AES_CBC cipher only algorithm and AES_CBC with HMAC_SHA1
+   chaining algorithm since the vhost crypto backend only these algorithms
+   are supported.
+*  Does not support Link State interrupt.
+*  Does not support runtime configuration.
+
+Virtio crypto PMD Rx/Tx Callbacks
+-
+
+Rx callbacks:
+
+* ``virtio_crypto_pkt_rx_burst``
+
+Tx callbacks:
+
+* ``virtio_crypto_pkt_tx_burst``
+
+Installation
+
+
+Quick instructions are as follows:
+
+Firstly run DPDK vhost crypto sample as a server side and build QEMU with
+vhost crypto enabled.
+QEMU can then be started using the following parameters:
+
+.. code-block:: console
+
+qemu-system-x86_64 \
+[...] \
+-chardev socket,id=charcrypto0,path=/path/to/your/socket \
+-object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 \
+-device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0
+[...]
+
+Secondly bind the uio_generic driver for the virtio-crypto device.
+For example, :00:04.0 is the domain, bus, device and function
+number of the virtio-crypto device:
+
+.. code-block:: console
+
+modprobe uio_pci_generic
+echo -n :00:04.0 > /sys/bus/pci/drivers/virtio-pci/unbind
+echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_id
+
+Finally the front-end virtio crypto PMD driver can be installed:
+
+.. code-block:: console
+
+cd to the top-level DPDK directory
+sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO\)=n,\1=y,' 
config/common_base
+make config T=x86_64-native-linuxapp-gcc
+make install T=x86_64-native-linuxapp-gcc
+
+Tests
+-
+
+The unit test cases can be tested as below:
+
+.. code-block:: console
+
+reserve enough huge pages
+cd to the top-level DPDK directory
+export RTE_TARGET=x86_64-native-linuxapp-gcc
+export RTE_SDK=`pwd`
+cd to test/test
+type the command "make" to compile
+run the tests with "./test"
+type the command "cryptodev_virtio_autotest" to test
+
+The performance can be tested as below:
+
+.. code-block:: console
+
+reserve enough huge pages
+cd to the top-level DPDK directory
+export RTE_TARGET=x86_64-native-linuxapp-gcc
+export RTE_SDK=`pwd`
+cd to app/test-crypto-perf
+type the command "make" to compile
+run the tests with the following command:
+
+./dpdk-test-crypto-perf -l 0,1 -- --devtype crypto_virtio \
+--ptest throughput --optype cipher-then-auth --cipher-algo aes-cbc \
+--cipher-op encrypt --cipher-key-sz 16 --auth-algo sha1-hmac \
+--auth-op generate --auth-key-sz 64 --digest-sz 12 \
+--total-ops 1 --burst-sz 64 --buffer-sz 2048
-- 
1.8.3.1




[dpdk-dev] [PATCH v3 7/7] MAINTAINERS: add myself as virtio crypto PMD maintainer

2018-03-25 Thread Jay Zhou
Signed-off-by: Jay Zhou 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a646ca3..be1b394 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -719,6 +719,12 @@ F: drivers/crypto/snow3g/
 F: doc/guides/cryptodevs/snow3g.rst
 F: doc/guides/cryptodevs/features/snow3g.ini
 
+Virtio
+M: Jay Zhou 
+F: drivers/crypto/virtio/
+F: doc/guides/cryptodevs/virtio.rst
+F: doc/guides/cryptodevs/features/virtio.ini
+
 ZUC
 M: Pablo de Lara 
 F: drivers/crypto/zuc/
-- 
1.8.3.1




[dpdk-dev] [PATCH v3 6/7] cryptodev: add function tests for virtio crypto PMD

2018-03-25 Thread Jay Zhou
Only RTE_CRYPTO_CIPHER_AES_CBC cipher
algorithms are tested as unit test, it is supported both by the
cryptodev-backend-builtin and cryptodev-vhost-user of qemu side.

Signed-off-by: Jay Zhou 
---
 test/test/test_cryptodev.c  | 49 +
 test/test/test_cryptodev.h  |  1 +
 test/test/test_cryptodev_aes_test_vectors.h | 24 +-
 test/test/test_cryptodev_blockcipher.c  |  9 +-
 test/test/test_cryptodev_blockcipher.h  |  1 +
 5 files changed, 75 insertions(+), 9 deletions(-)

diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
index 1417482..357e1df 100644
--- a/test/test/test_cryptodev.c
+++ b/test/test/test_cryptodev.c
@@ -1765,6 +1765,26 @@ struct crypto_unittest_params {
 }
 
 static int
+test_AES_cipheronly_virtio_all(void)
+{
+   struct crypto_testsuite_params *ts_params = &testsuite_params;
+   int status;
+
+   status = test_blockcipher_all_tests(ts_params->mbuf_pool,
+   ts_params->op_mpool,
+   ts_params->session_mpool,
+   ts_params->valid_devs[0],
+   rte_cryptodev_driver_id_get(
+   RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)),
+   BLKCIPHER_AES_CIPHERONLY_TYPE);
+
+   TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+   return TEST_SUCCESS;
+}
+
+
+static int
 test_AES_chain_dpaa_sec_all(void)
 {
struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -8767,6 +8787,18 @@ struct test_crypto_vector {
}
 };
 
+static struct unit_test_suite cryptodev_virtio_testsuite  = {
+   .suite_name = "Crypto VIRTIO Unit Test Suite",
+   .setup = testsuite_setup,
+   .teardown = testsuite_teardown,
+   .unit_test_cases = {
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_AES_cipheronly_virtio_all),
+
+   TEST_CASES_END() /**< NULL terminate unit test array */
+   }
+};
+
 static struct unit_test_suite cryptodev_aesni_mb_testsuite  = {
.suite_name = "Crypto Device AESNI MB Unit Test Suite",
.setup = testsuite_setup,
@@ -9664,6 +9696,22 @@ struct test_crypto_vector {
 }
 
 static int
+test_cryptodev_virtio(void /*argv __rte_unused, int argc __rte_unused*/)
+{
+   gbl_driver_id = rte_cryptodev_driver_id_get(
+   RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD));
+
+   if (gbl_driver_id == -1) {
+   RTE_LOG(ERR, USER1, "VIRTIO PMD must be loaded. Check if "
+   "CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO is enabled 
"
+   "in config file to run this testsuite.\n");
+   return TEST_FAILED;
+   }
+
+   return unit_test_suite_runner(&cryptodev_virtio_testsuite);
+}
+
+static int
 test_cryptodev_aesni_mb(void /*argv __rte_unused, int argc __rte_unused*/)
 {
gbl_driver_id = rte_cryptodev_driver_id_get(
@@ -9879,3 +9927,4 @@ struct test_crypto_vector {
 REGISTER_TEST_COMMAND(cryptodev_sw_mrvl_autotest, test_cryptodev_mrvl);
 REGISTER_TEST_COMMAND(cryptodev_dpaa2_sec_autotest, test_cryptodev_dpaa2_sec);
 REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_autotest, test_cryptodev_dpaa_sec);
+REGISTER_TEST_COMMAND(cryptodev_virtio_autotest, test_cryptodev_virtio);
diff --git a/test/test/test_cryptodev.h b/test/test/test_cryptodev.h
index 8cdc087..c311277 100644
--- a/test/test/test_cryptodev.h
+++ b/test/test/test_cryptodev.h
@@ -61,6 +61,7 @@
 #define CRYPTODEV_NAME_DPAA2_SEC_PMD   crypto_dpaa2_sec
 #define CRYPTODEV_NAME_SCHEDULER_PMD   crypto_scheduler
 #define CRYPTODEV_NAME_MRVL_PMDcrypto_mrvl
+#define CRYPTODEV_NAME_VIRTIO_PMD   crypto_virtio
 
 /**
  * Write (spread) data from buffer to mbuf data
diff --git a/test/test/test_cryptodev_aes_test_vectors.h 
b/test/test/test_cryptodev_aes_test_vectors.h
index 3577ef4..cac7cda 100644
--- a/test/test/test_cryptodev_aes_test_vectors.h
+++ b/test/test/test_cryptodev_aes_test_vectors.h
@@ -1526,7 +1526,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
-   BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+   BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+   BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-128-CBC Decryption",
@@ -1538,7 +1539,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |
BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |
-   BLOCKCIPHER_TEST_TARGET_PMD_MRVL
+   BLOCKCIPHER_TEST_TARGET_PMD_MRVL |
+   BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO
},
{
.test_descr = "AES-192-CBC Encryption",
@@ -1549,7 +1551,8 @@
BLOCKCIPHER_TEST_TARGET_PMD_MB |
   

[dpdk-dev] [PATCH v3 4/7] crypto/virtio: add makefile

2018-03-25 Thread Jay Zhou
The virtio crypto PMD driver can be compiled now.

Signed-off-by: Jay Zhou 
---
 drivers/crypto/Makefile|  1 +
 drivers/crypto/virtio/Makefile | 31 ++
 .../virtio/rte_pmd_virtio_crypto_version.map   |  3 +++
 mk/rte.app.mk  |  1 +
 4 files changed, 36 insertions(+)
 create mode 100644 drivers/crypto/virtio/Makefile
 create mode 100644 drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map

diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 26e503e..e48bbdd 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -20,5 +20,6 @@ endif
 ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_SEC) += dpaa_sec
 endif
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/crypto/virtio/Makefile b/drivers/crypto/virtio/Makefile
new file mode 100644
index 000..c4727ea
--- /dev/null
+++ b/drivers/crypto/virtio/Makefile
@@ -0,0 +1,31 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_virtio_crypto.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_virtio_crypto_version.map
+
+LIBABIVER := 1
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtqueue.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_pci.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_rxtx.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_cryptodev.c
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_mempool 
lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_cryptodev
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map 
b/drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map
new file mode 100644
index 000..de8e412
--- /dev/null
+++ b/drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map
@@ -0,0 +1,3 @@
+DPDK_18.05 {
+   local: *;
+};
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 94525dc..d7ddda4 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -204,6 +204,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM)   += 
-L$(AESNI_MULTI_BUFFER_LIB_PATH)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += -lrte_pmd_openssl -lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += -lrte_pmd_virtio_crypto 
-lcrypto
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)  += -lrte_pmd_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G)  += -L$(LIBSSO_SNOW3G_PATH)/build 
-lsso_snow3g
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI)  += -lrte_pmd_kasumi
-- 
1.8.3.1




Re: [dpdk-dev] [PATCH 0/3] add ifcvf driver

2018-03-25 Thread Maxime Coquelin



On 03/23/2018 11:27 AM, Wang, Xiao W wrote:

Hi Maxime,


-Original Message-
From: Maxime Coquelin [mailto:maxime.coque...@redhat.com]
Sent: Thursday, March 22, 2018 4:48 AM
To: Wang, Xiao W ; dev@dpdk.org
Cc: Wang, Zhihong ; y...@fridaylinux.org; Liang,
Cunming ; Xu, Rosen ; Chen,
Junjie J ; Daly, Dan 
Subject: Re: [PATCH 0/3] add ifcvf driver

Hi Xiao,

On 03/15/2018 05:49 PM, Wang, Xiao W wrote:

Hi Maxime,


-Original Message-
From: Maxime Coquelin [mailto:maxime.coque...@redhat.com]
Sent: Sunday, March 11, 2018 2:24 AM
To: Wang, Xiao W ; dev@dpdk.org
Cc: Wang, Zhihong ; y...@fridaylinux.org; Liang,
Cunming ; Xu, Rosen ;

Chen,

Junjie J ; Daly, Dan 
Subject: Re: [PATCH 0/3] add ifcvf driver

Hi Xiao,

On 03/10/2018 12:08 AM, Xiao Wang wrote:

This patch set has dependency on

http://dpdk.org/dev/patchwork/patch/35635/

(vhost: support selective datapath);

ifc VF is compatible with virtio vring operations, this driver implements
vDPA driver ops which configures ifc VF to be a vhost data path accelerator.

ifcvf driver uses vdev as a control domain to manage ifc VFs that belong
to it. It registers vDPA device ops to vhost lib to enable these VFs to be
used as vhost data path accelerator.

Live migration feature is supported by ifc VF and this driver enables
it based on vhost lib.

vDPA needs to create different containers for different devices, thus this
patch set adds APIs in eal/vfio to support multiple container.

Thanks for this! That will avoind having to duplicate these functions
for every new offload driver.




Junjie Chen (1):
 eal/vfio: add support for multiple container

Xiao Wang (2):
 bus/pci: expose sysfs parsing API


Still, I'm not convinced the offload device should be a virtual device.
It is a real PCI device, why not having a new device type for offload
devices, and let the device to be probed automatically by the existing
device model?


IFC VFs are generated from SRIOV, with the PF driven by kernel driver.
In DPDK we need to have something to represent PF, to register itself as
a vDPA engine, so a virtual device is used for this purpose.

I went through the code, and something is not clear to me.

Why do we need to have a representation of the PF in DPDK?
Why cannot we just bind at VF level?


1. With the vdev representation we could use it to talk to PF kernel driver to 
do flow configuration, we can implement
flow API on the vdev in future for this purpose. Using a vdev allows 
introducing this kind of control plane thing.

2. When port representor is ready, we would integrate it into ifcvf driver, 
then each VF will have a
Representor port. For now we don’t have port representor, so this patch set 
manages VF resource internally.


Ok, we may need to have a vdev to represent the PF, but we need to be
able to bind at VF level anyway.

Else, how do you support passing two VFs of the same PF to different
DPDK applications?
Or have some VFs managed by Kernel or QEMU and some by the DPDK
application? My feeling is that current implementation is creating an
artificial constraint.

Isn't there a possibility to have the virtual representation for the PF
to be probed separately? Or created automatically when the first VF of a
PF is probed (and later VFs attach to the PF rep when probed)?

Doing this, we could use the generic device probing.
For IFCVF, to specify we want it to be probed as an offload device
instead of a virtio device, we could have a new EAL parameter to specify
for a given device if we want it to be probed as an offload device (for
example --offload=00:01.1).
Offload drivers would register by passing a flag that specifies they are
an offload driver.
This new argument would be optional and only used to force the device to
being probed in offload mode. For devices that have their own device
IDs for offload mode, then it would be automatic.

Regards,
Maxime

BRs,
Xiao



[dpdk-dev] vmxnet3 RX VLAN Strip offload incorrect behaviour

2018-03-25 Thread Padam Jeet Singh
When configuring the vmxnet3 based ethernet device, the VLAN Strip RX offload 
does not work as it usually does with other real NICs.

When configuring with rxmode.hw_vlan_strip = 1, the ipackets statistic does not 
increase when a VLAN ether type frame is received on the port and it is also 
not received on queue RX.
However, when configuring rxmode.hw_vlan_strip = 0 ,the ipackets statistic 
increases as well as frames arrives with VLAN header.

Though calling  rte_eth_dev_set_vlan_offload(port, ETH_VLAN_STRIP_OFFLOAD) 
returns a success, however VLAN stripping on RX does not work.

TX VLAN INSERT offload on the other hand works just fine.

Is this a bug in vmxnet3 driver of dpdk?

Thanks,
Padam

This email was sent from within Inventum Technologies Private Limited 
(https://www.inventum.net). This email (and any attachments or hyperlinks 
within it) may contain information that is confidential, legally privileged or 
otherwise protected from disclosure. If you are not the intended recipient of 
this email, you are not entitled to use, disclose, distribute, copy, print, 
disseminate or rely on this email in any way. If you have received this email 
in error, please notify the sender immediately by telephone or email and 
destroy it, and all copies of it.



Re: [dpdk-dev] [PATCH v2] net/mlx4: support CRC strip toggling

2018-03-25 Thread Ophir Munk
Hi Adrien,
v3 is ready and will be sent soon.
Please see inline more comments.

> -Original Message-
> From: Adrien Mazarguil [mailto:adrien.mazarg...@6wind.com]
> Sent: Friday, March 23, 2018 5:53 PM
> To: Ophir Munk 
> Cc: dev@dpdk.org; Thomas Monjalon ; Olga Shern
> ; Shahaf Shuler 
> Subject: Re: [PATCH v2] net/mlx4: support CRC strip toggling
> 
> Hi Ophir,
> 
> On Mon, Mar 19, 2018 at 04:36:50PM +, Ophir Munk wrote:
> > Previous to this commit mlx4 CRC stripping was executed by default and
> > there was no verbs API to disable it.
> >
> > Current support in MLNX_OFED_4.3-1.5.0.0 and above
> 
> I suggest to drop this line as it's not exclusive to MLNX_OFED; the
> documented minimum requirements are already correct and rdma-core v15
> also supports it.
> 

Actually rdma-core v15 does not expose CRC capability in mlx4. It is probably 
expected in rdma-core v18.
The OFED support for CRC stripping only starts with in MLNX_OFED_4.3-1.5.0.0.
Regardless - for v3 I have dropped the versioning information (as requested) 
since I think versioning information 
can be present in documentation rather than in commit logs.

> > Signed-off-by: Ophir Munk 
> 
> A few more comments below.
> 
> > ---
> > v1: initial version
> > v2: following internal reviews
> >
> >  drivers/net/mlx4/mlx4.c  |  4 
> >  drivers/net/mlx4/mlx4.h  |  1 +
> >  drivers/net/mlx4/mlx4_rxq.c  | 33 +++--
> > drivers/net/mlx4/mlx4_rxtx.c |  5 -  drivers/net/mlx4/mlx4_rxtx.h
> > |  1 +
> >  5 files changed, 41 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index
> > ee93daf..d4f4323 100644
> > --- a/drivers/net/mlx4/mlx4.c
> > +++ b/drivers/net/mlx4/mlx4.c
> > @@ -578,6 +578,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv,
> struct rte_pci_device *pci_dev)
> > }
> > DEBUG("supported RSS hash fields mask: %016" PRIx64,
> >   priv->hw_rss_sup);
> > +   priv->hw_fcs_strip = !!(device_attr_ex.raw_packet_caps &
> > +
> IBV_RAW_PACKET_CAP_SCATTER_FCS);
> 
> Minor nit, indentation contains one extra space.

The full block is already with an extra space. So removing the extra space in 
just this line will appear miss-aligned with
the remaining block. I suggest leaving this line as is for v3.

> 
> > +   DEBUG("FCS stripping toggling is %ssupported",
> > + (priv->hw_fcs_strip ? "" : "not "));
> 

> Another minor nit, mlx5 prints "configuration" instead of "toggling", wouldn't
> it make sense for both PMDs to print the same information?
> 

I have followed your review and changed "toggling" to "configuration" in v3. 
However please note that
the commit title is "support CRC strip toggling". So using the same wording 
"toggling" is clearer in my view.
(it was also an input I got from internal review prior to ML submission).

> Also the extra set of parentheses around the conditional expression could be
> removed.
> 

Done for v3. Please note that another line had an extra set of parentheses (not 
included in this patch) which was
updated as well in v3.

> > /* Configure the first MAC address by default. */
> > if (mlx4_get_mac(priv, &mac.addr_bytes)) {
> > ERROR("cannot get MAC address, is mlx4_en
> loaded?"
> > diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index
> > 19c8a22..3ae3ce6 100644
> > --- a/drivers/net/mlx4/mlx4.h
> > +++ b/drivers/net/mlx4/mlx4.h
> > @@ -105,6 +105,7 @@ struct priv {
> > uint32_t isolated:1; /**< Toggle isolated mode. */
> > uint32_t hw_csum:1; /**< Checksum offload is supported. */
> > uint32_t hw_csum_l2tun:1; /**< Checksum support for L2 tunnels. */
> > +   uint32_t hw_fcs_strip:1; /**< FCS stripping toggling is supported.
> > +*/
> > uint64_t hw_rss_sup; /**< Supported RSS hash fields (Verbs format).
> */
> > struct rte_intr_handle intr_handle; /**< Port interrupt handle. */
> > struct mlx4_drop *drop; /**< Shared resources for drop flow rules.
> > */ diff --git a/drivers/net/mlx4/mlx4_rxq.c
> > b/drivers/net/mlx4/mlx4_rxq.c index 7a036ed..6748355 100644
> > --- a/drivers/net/mlx4/mlx4_rxq.c
> > +++ b/drivers/net/mlx4/mlx4_rxq.c
> > @@ -491,6 +491,8 @@ mlx4_rxq_attach(struct rxq *rxq)
> > const char *msg;
> > struct ibv_cq *cq = NULL;
> > struct ibv_wq *wq = NULL;
> > +   unsigned int create_flags = 0;
> > +   unsigned int comp_mask = 0;
> 
> I suggest using uint32_t to align these with Verb's definitions for struct
> ibv_wq_init_attr.
> 

Done in v3

> > volatile struct mlx4_wqe_data_seg (*wqes)[];
> > unsigned int i;
> > int ret;
> > @@ -503,6 +505,11 @@ mlx4_rxq_attach(struct rxq *rxq)
> > msg = "CQ creation failure";
> > goto error;
> > }
> > +   /* By default, FCS (CRC) is stripped by hardware. */
> > +   if (rxq->crc_present) {
> > +   create_flags |= IBV_WQ_FLAGS_SCATTER_FCS;
> > +   comp

[dpdk-dev] [PATCH v2 00/11] mempool: prepare to add bucket driver

2018-03-25 Thread Andrew Rybchenko
The patch series should be applied on top of [7].

The initial patch series [1] is split into two to simplify processing.
The second series relies on this one and will add bucket mempool driver
and related ops.

The patch series has generic enhancements suggested by Olivier.
Basically it adds driver callbacks to calculate required memory size and
to populate objects using provided memory area. It allows to remove
so-called capability flags used before to tell generic code how to
allocate and slice allocated memory into mempool objects.
Clean up which removes get_capabilities and register_memory_area is
not strictly required, but I think right thing to do.
Existing mempool drivers are updated.

rte_mempool_populate_iova_tab() is also deprecated in v2 as agreed in [2].
Unfortunately it requires addition of -Wno-deprecated-declarations flag
to librte_mempool since the function is used by deprecated earlier
rte_mempool_populate_phys_tab(). If the later may be removed in the
release, we can avoid addition of the flag to allow usage of deprecated
functions.

One open question remains from previous review [3].

The patch series interfere with memory hotplug for DPDK [4] ([5] to be
precise). So, rebase may be required.

A new patch is added to the series to rename MEMPOOL_F_NO_PHYS_CONTIG
as MEMPOOL_F_NO_IOVA_CONTIG as agreed in [6].
MEMPOOL_F_CAPA_PHYS_CONTIG is not renamed since it removed in this
patchset.

It breaks ABI since changes rte_mempool_ops. Also it removes
rte_mempool_ops_register_memory_area() and
rte_mempool_ops_get_capabilities() since corresponding callbacks are
removed.

Internal global functions are not listed in map file since it is not
a part of external API.

[1] https://dpdk.org/ml/archives/dev/2018-January/088698.html
[2] https://dpdk.org/ml/archives/dev/2018-March/093186.html
[3] https://dpdk.org/ml/archives/dev/2018-March/093329.html
[4] https://dpdk.org/ml/archives/dev/2018-March/092070.html
[5] https://dpdk.org/ml/archives/dev/2018-March/092088.html
[6] https://dpdk.org/ml/archives/dev/2018-March/093345.html
[7] https://dpdk.org/ml/archives/dev/2018-March/093196.html

v1 -> v2:
  - deprecate rte_mempool_populate_iova_tab()
  - add patch to fix memory leak if no objects are populated
  - add patch to rename MEMPOOL_F_NO_PHYS_CONTIG
  - minor fixes (typos, blank line at the end of file)
  - highlight meaning of min_chunk_size (when it is virtual or
physical contiguous)
  - make sure that mempool is initialized in rte_mempool_populate_anon()
  - move patch to ensure that mempool is initialized earlier in the series

RFCv2 -> v1:
  - split the series in two
  - squash octeontx patches which implement calc_mem_size and populate
callbacks into the patch which removes get_capabilities since it is
the easiest way to untangle the tangle of tightly related library
functions and flags advertised by the driver
  - consistently name default callbacks
  - move default callbacks to dedicated file
  - see detailed description in patches

RFCv1 -> RFCv2:
  - add driver ops to calculate required memory size and populate
mempool objects, remove extra flags which were required before
to control it
  - transition of octeontx and dpaa drivers to the new callbacks
  - change info API to get information from driver required to
API user to know contiguous block size
  - remove get_capabilities (not required any more and may be
substituted with more in info get API)
  - remove register_memory_area since it is substituted with
populate callback which can do more
  - use SPDX tags
  - avoid all objects affinity to single lcore
  - fix bucket get_count
  - deprecate XMEM API
  - avoid introduction of a new function to flush cache
  - fix NO_CACHE_ALIGN case in bucket mempool


Andrew Rybchenko (9):
  mempool: fix memhdr leak when no objects are populated
  mempool: rename flag to control IOVA-contiguous objects
  mempool: add op to calculate memory size to be allocated
  mempool: add op to populate objects using provided memory
  mempool: remove callback to get capabilities
  mempool: deprecate xmem functions
  mempool/octeontx: prepare to remove register memory area op
  mempool/dpaa: prepare to remove register memory area op
  mempool: remove callback to register memory area

Artem V. Andreev (2):
  mempool: ensure the mempool is initialized before populating
  mempool: support flushing the default cache of the mempool

 doc/guides/rel_notes/deprecation.rst|  12 +-
 doc/guides/rel_notes/release_18_05.rst  |  33 ++-
 drivers/mempool/dpaa/dpaa_mempool.c |  13 +-
 drivers/mempool/octeontx/rte_mempool_octeontx.c |  64 --
 drivers/net/thunderx/nicvf_ethdev.c |   2 +-
 lib/librte_mempool/Makefile |   6 +-
 lib/librte_mempool/meson.build  |  17 +-
 lib/librte_mempool/rte_mempool.c| 179 ---
 lib/librte_mempool/rte_mempool.h| 280 +---
 lib/

[dpdk-dev] [PATCH v2 01/11] mempool: fix memhdr leak when no objects are populated

2018-03-25 Thread Andrew Rybchenko
Fixes: 84121f197187 ("mempool: store memory chunks in a list")
Cc: sta...@dpdk.org

Suggested-by: Olivier Matz 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - added in v2 as discussed in [1]

[1] https://dpdk.org/ml/archives/dev/2018-March/093329.html

 lib/librte_mempool/rte_mempool.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 54f7f4b..80bf941 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -408,12 +408,18 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char 
*vaddr,
}
 
/* not enough room to store one object */
-   if (i == 0)
-   return -EINVAL;
+   if (i == 0) {
+   ret = -EINVAL;
+   goto fail;
+   }
 
STAILQ_INSERT_TAIL(&mp->mem_list, memhdr, next);
mp->nb_mem_chunks++;
return i;
+
+fail:
+   rte_free(memhdr);
+   return ret;
 }
 
 int
-- 
2.7.4



[dpdk-dev] [PATCH v2 02/11] mempool: rename flag to control IOVA-contiguous objects

2018-03-25 Thread Andrew Rybchenko
Flag MEMPOOL_F_NO_PHYS_CONTIG is renamed as MEMPOOL_F_NO_IOVA_CONTIG
to follow IO memory contiguos terminology.
MEMPOOL_F_NO_PHYS_CONTIG is kept for backward compatibility and
deprecated.

Suggested-by: Olivier Matz 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - added in v2 as discussed in [1]

[1] https://dpdk.org/ml/archives/dev/2018-March/093345.html

 drivers/net/thunderx/nicvf_ethdev.c | 2 +-
 lib/librte_mempool/rte_mempool.c| 6 +++---
 lib/librte_mempool/rte_mempool.h| 9 +
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/thunderx/nicvf_ethdev.c 
b/drivers/net/thunderx/nicvf_ethdev.c
index 067f224..f3be744 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1308,7 +1308,7 @@ nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, 
uint16_t qidx,
}
 
/* Mempool memory must be physically contiguous */
-   if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG) {
+   if (mp->flags & MEMPOOL_F_NO_IOVA_CONTIG) {
PMD_INIT_LOG(ERR, "Mempool memory must be physically 
contiguous");
return -EINVAL;
}
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 80bf941..6ffa795 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -446,7 +446,7 @@ rte_mempool_populate_iova_tab(struct rte_mempool *mp, char 
*vaddr,
if (mp->nb_mem_chunks != 0)
return -EEXIST;
 
-   if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG)
+   if (mp->flags & MEMPOOL_F_NO_IOVA_CONTIG)
return rte_mempool_populate_iova(mp, vaddr, RTE_BAD_IOVA,
pg_num * pg_sz, free_cb, opaque);
 
@@ -500,7 +500,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char 
*addr,
if (RTE_ALIGN_CEIL(len, pg_sz) != len)
return -EINVAL;
 
-   if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG)
+   if (mp->flags & MEMPOOL_F_NO_IOVA_CONTIG)
return rte_mempool_populate_iova(mp, addr, RTE_BAD_IOVA,
len, free_cb, opaque);
 
@@ -602,7 +602,7 @@ rte_mempool_populate_default(struct rte_mempool *mp)
goto fail;
}
 
-   if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG)
+   if (mp->flags & MEMPOOL_F_NO_IOVA_CONTIG)
iova = RTE_BAD_IOVA;
else
iova = mz->iova;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 8b1b7f7..e531a15 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -244,7 +244,8 @@ struct rte_mempool {
 #define MEMPOOL_F_SP_PUT 0x0004 /**< Default put is 
"single-producer".*/
 #define MEMPOOL_F_SC_GET 0x0008 /**< Default get is 
"single-consumer".*/
 #define MEMPOOL_F_POOL_CREATED   0x0010 /**< Internal: pool is created. */
-#define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous 
objs. */
+#define MEMPOOL_F_NO_IOVA_CONTIG 0x0020 /**< Don't need IOVA contiguous objs. 
*/
+#define MEMPOOL_F_NO_PHYS_CONTIG MEMPOOL_F_NO_IOVA_CONTIG /* deprecated */
 /**
  * This capability flag is advertised by a mempool handler, if the whole
  * memory area containing the objects must be physically contiguous.
@@ -710,8 +711,8 @@ typedef void (rte_mempool_ctor_t)(struct rte_mempool *, 
void *);
  *   - MEMPOOL_F_SC_GET: If this flag is set, the default behavior
  * when using rte_mempool_get() or rte_mempool_get_bulk() is
  * "single-consumer". Otherwise, it is "multi-consumers".
- *   - MEMPOOL_F_NO_PHYS_CONTIG: If set, allocated objects won't
- * necessarily be contiguous in physical memory.
+ *   - MEMPOOL_F_NO_IOVA_CONTIG: If set, allocated objects won't
+ * necessarily be contiguous in IO memory.
  * @return
  *   The pointer to the new allocated mempool, on success. NULL on error
  *   with rte_errno set appropriately. Possible rte_errno values include:
@@ -1439,7 +1440,7 @@ rte_mempool_empty(const struct rte_mempool *mp)
  *   A pointer (virtual address) to the element of the pool.
  * @return
  *   The IO address of the elt element.
- *   If the mempool was created with MEMPOOL_F_NO_PHYS_CONTIG, the
+ *   If the mempool was created with MEMPOOL_F_NO_IOVA_CONTIG, the
  *   returned value is RTE_BAD_IOVA.
  */
 static inline rte_iova_t
-- 
2.7.4



[dpdk-dev] [PATCH v2 03/11] mempool: ensure the mempool is initialized before populating

2018-03-25 Thread Andrew Rybchenko
From: "Artem V. Andreev" 

Callback to calculate required memory area size may require mempool
driver data to be already allocated and initialized.

Signed-off-by: Artem V. Andreev 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - add init check to mempool_ops_alloc_once()
 - move ealier in the patch series since it is required when driver
   ops are called and it is better to have it before new ops are added

RFCv2 -> v1:
 - rename helper function as mempool_ops_alloc_once()

 lib/librte_mempool/rte_mempool.c | 33 ++---
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 6ffa795..d8e3720 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -323,6 +323,21 @@ rte_mempool_free_memchunks(struct rte_mempool *mp)
}
 }
 
+static int
+mempool_ops_alloc_once(struct rte_mempool *mp)
+{
+   int ret;
+
+   /* create the internal ring if not already done */
+   if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) {
+   ret = rte_mempool_ops_alloc(mp);
+   if (ret != 0)
+   return ret;
+   mp->flags |= MEMPOOL_F_POOL_CREATED;
+   }
+   return 0;
+}
+
 /* Add objects in the pool, using a physically contiguous memory
  * zone. Return the number of objects added, or a negative value
  * on error.
@@ -339,13 +354,9 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char 
*vaddr,
struct rte_mempool_memhdr *memhdr;
int ret;
 
-   /* create the internal ring if not already done */
-   if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) {
-   ret = rte_mempool_ops_alloc(mp);
-   if (ret != 0)
-   return ret;
-   mp->flags |= MEMPOOL_F_POOL_CREATED;
-   }
+   ret = mempool_ops_alloc_once(mp);
+   if (ret != 0)
+   return ret;
 
/* Notify memory area to mempool */
ret = rte_mempool_ops_register_memory_area(mp, vaddr, iova, len);
@@ -556,6 +567,10 @@ rte_mempool_populate_default(struct rte_mempool *mp)
unsigned int mp_flags;
int ret;
 
+   ret = mempool_ops_alloc_once(mp);
+   if (ret != 0)
+   return ret;
+
/* mempool must not be populated */
if (mp->nb_mem_chunks != 0)
return -EEXIST;
@@ -667,6 +682,10 @@ rte_mempool_populate_anon(struct rte_mempool *mp)
return 0;
}
 
+   ret = mempool_ops_alloc_once(mp);
+   if (ret != 0)
+   return ret;
+
/* get chunk of virtually continuous memory */
size = get_anon_size(mp);
addr = mmap(NULL, size, PROT_READ | PROT_WRITE,
-- 
2.7.4



[dpdk-dev] [PATCH v2 07/11] mempool: deprecate xmem functions

2018-03-25 Thread Andrew Rybchenko
Move rte_mempool_xmem_size() code to internal helper function
since it is required in two places: deprecated rte_mempool_xmem_size()
and non-deprecated rte_mempool_op_calc_mem_size_default().

Suggested-by: Olivier Matz 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - deprecate rte_mempool_populate_iova_tab()
 - add -Wno-deprecated-declarations to fix build errors because of
   rte_mempool_populate_iova_tab() deprecation
 - add @deprecated to deprecated functions description

RFCv2 -> v1:
 - advertise deprecation in release notes
 - factor out default memory size calculation into non-deprecated
   internal function to avoid usage of deprecated function internally
 - remove test for deprecated functions to address build issue because
   of usage of deprecated functions (it is easy to allow usage of
   deprecated function in Makefile, but very complicated in meson)

 doc/guides/rel_notes/deprecation.rst |  7 ---
 doc/guides/rel_notes/release_18_05.rst   | 11 ++
 lib/librte_mempool/Makefile  |  3 +++
 lib/librte_mempool/meson.build   | 12 +++
 lib/librte_mempool/rte_mempool.c | 19 ++---
 lib/librte_mempool/rte_mempool.h | 30 +++
 lib/librte_mempool/rte_mempool_ops_default.c |  4 ++--
 test/test/test_mempool.c | 31 
 8 files changed, 74 insertions(+), 43 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 4deed9a..473330d 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -60,13 +60,6 @@ Deprecation Notices
   - ``rte_eal_mbuf_default_mempool_ops``
 
 * mempool: several API and ABI changes are planned in v18.05.
-  The following functions, introduced for Xen, which is not supported
-  anymore since v17.11, are hard to use, not used anywhere else in DPDK.
-  Therefore they will be deprecated in v18.05 and removed in v18.08:
-
-  - ``rte_mempool_xmem_create``
-  - ``rte_mempool_xmem_size``
-  - ``rte_mempool_xmem_usage``
 
   The following changes are planned:
 
diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index c50f26c..6a8db54 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -74,6 +74,17 @@ API Changes
   Now the new driver callbacks ``calc_mem_size`` and ``populate`` may be
   used to achieve it without specific knowledge in the generic code.
 
+* **Deprecated mempool xmem functions.**
+
+  The following functions, introduced for Xen, which is not supported
+  anymore since v17.11, are hard to use, not used anywhere else in DPDK.
+  Therefore they were deprecated in v18.05 and will be removed in v18.08:
+
+  - ``rte_mempool_xmem_create``
+  - ``rte_mempool_xmem_size``
+  - ``rte_mempool_xmem_usage``
+  - ``rte_mempool_populate_iova_tab``
+
 
 ABI Changes
 ---
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 072740f..2c46fdd 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -7,6 +7,9 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_mempool.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Allow deprecated symbol to use deprecated rte_mempool_populate_iova_tab()
+# from earlier deprecated rte_mempool_populate_phys_tab()
+CFLAGS += -Wno-deprecated-declarations
 LDLIBS += -lrte_eal -lrte_ring
 
 EXPORT_MAP := rte_mempool_version.map
diff --git a/lib/librte_mempool/meson.build b/lib/librte_mempool/meson.build
index 9e3b527..22e912a 100644
--- a/lib/librte_mempool/meson.build
+++ b/lib/librte_mempool/meson.build
@@ -1,6 +1,18 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+extra_flags = []
+
+# Allow deprecated symbol to use deprecated rte_mempool_populate_iova_tab()
+# from earlier deprecated rte_mempool_populate_phys_tab()
+extra_flags += '-Wno-deprecated-declarations'
+
+foreach flag: extra_flags
+   if cc.has_argument(flag)
+   cflags += flag
+   endif
+endforeach
+
 version = 4
 sources = files('rte_mempool.c', 'rte_mempool_ops.c',
'rte_mempool_ops_default.c')
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 40eedde..8c3b0b1 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -204,11 +204,13 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t 
flags,
 
 
 /*
- * Calculate maximum amount of memory required to store given number of 
objects.
+ * Internal function to calculate required memory chunk size shared
+ * by default implementation of the corresponding callback and
+ * deprecated external function.
  */
 size_t
-rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift,
- __rte_unused unsigned int flags)
+rte_mempool_calc_mem_size_helper(uint32_t elt_num, size_t total_elt_sz,
+   

[dpdk-dev] [PATCH v2 05/11] mempool: add op to populate objects using provided memory

2018-03-25 Thread Andrew Rybchenko
The callback allows to customize how objects are stored in the
memory chunk. Default implementation of the callback which simply
puts objects one by one is available.

Suggested-by: Olivier Matz 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - fix memory leak if off is bigger than len

RFCv2 -> v1:
 - advertise ABI changes in release notes
 - use consistent name for default callback:
   rte_mempool_op__default()
 - add opaque data pointer to populated object callback
 - move default callback to dedicated file

 doc/guides/rel_notes/deprecation.rst |  2 +-
 doc/guides/rel_notes/release_18_05.rst   |  2 +
 lib/librte_mempool/rte_mempool.c | 23 ---
 lib/librte_mempool/rte_mempool.h | 90 
 lib/librte_mempool/rte_mempool_ops.c | 21 +++
 lib/librte_mempool/rte_mempool_ops_default.c | 24 
 lib/librte_mempool/rte_mempool_version.map   |  1 +
 7 files changed, 149 insertions(+), 14 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index e02d4ca..c06fc67 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -72,7 +72,7 @@ Deprecation Notices
 
   - removal of ``get_capabilities`` mempool ops and related flags.
   - substitute ``register_memory_area`` with ``populate`` ops.
-  - addition of new ops to customize objects population and allocate contiguous
+  - addition of new op to allocate contiguous
 block of objects if underlying driver supports it.
 
 * mbuf: The control mbuf API will be removed in v18.05. The impacted
diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index 59583ea..abaefe5 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -84,6 +84,8 @@ ABI Changes
 
   A new callback ``calc_mem_size`` has been added to ``rte_mempool_ops``
   to allow to customize required memory size calculation.
+  A new callback ``populate`` has been added to ``rte_mempool_ops``
+  to allow to customize objects population.
 
 
 Removed Items
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index dd2d0fe..d917dc7 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -99,7 +99,8 @@ static unsigned optimize_object_size(unsigned obj_size)
 }
 
 static void
-mempool_add_elem(struct rte_mempool *mp, void *obj, rte_iova_t iova)
+mempool_add_elem(struct rte_mempool *mp, __rte_unused void *opaque,
+void *obj, rte_iova_t iova)
 {
struct rte_mempool_objhdr *hdr;
struct rte_mempool_objtlr *tlr __rte_unused;
@@ -116,9 +117,6 @@ mempool_add_elem(struct rte_mempool *mp, void *obj, 
rte_iova_t iova)
tlr = __mempool_get_trailer(obj);
tlr->cookie = RTE_MEMPOOL_TRAILER_COOKIE;
 #endif
-
-   /* enqueue in ring */
-   rte_mempool_ops_enqueue_bulk(mp, &obj, 1);
 }
 
 /* call obj_cb() for each mempool element */
@@ -407,17 +405,16 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char 
*vaddr,
else
off = RTE_PTR_ALIGN_CEIL(vaddr, RTE_CACHE_LINE_SIZE) - vaddr;
 
-   while (off + total_elt_sz <= len && mp->populated_size < mp->size) {
-   off += mp->header_size;
-   if (iova == RTE_BAD_IOVA)
-   mempool_add_elem(mp, (char *)vaddr + off,
-   RTE_BAD_IOVA);
-   else
-   mempool_add_elem(mp, (char *)vaddr + off, iova + off);
-   off += mp->elt_size + mp->trailer_size;
-   i++;
+   if (off > len) {
+   ret = -EINVAL;
+   goto fail;
}
 
+   i = rte_mempool_ops_populate(mp, mp->size - mp->populated_size,
+   (char *)vaddr + off,
+   (iova == RTE_BAD_IOVA) ? RTE_BAD_IOVA : (iova + off),
+   len - off, mempool_add_elem, NULL);
+
/* not enough room to store one object */
if (i == 0) {
ret = -EINVAL;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 191255d..754261e 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -456,6 +456,63 @@ ssize_t rte_mempool_op_calc_mem_size_default(const struct 
rte_mempool *mp,
uint32_t obj_num, uint32_t pg_shift,
size_t *min_chunk_size, size_t *align);
 
+/**
+ * Function to be called for each populated object.
+ *
+ * @param[in] mp
+ *   A pointer to the mempool structure.
+ * @param[in] opaque
+ *   An opaque pointer passed to iterator.
+ * @param[in] vaddr
+ *   Object virtual address.
+ * @param[in] iova
+ *   Input/output virtual address of the object or RTE_BAD_IOVA.
+ */
+typedef void (rte_mempool_populate_obj_cb_t)(struct rte_mempool *mp,
+   void *opaque, void *vaddr, rte_iova_t iova);
+
+/**
+ * Populate memory pool objects using provided memory

[dpdk-dev] [PATCH v2 04/11] mempool: add op to calculate memory size to be allocated

2018-03-25 Thread Andrew Rybchenko
Size of memory chunk required to populate mempool objects depends
on how objects are stored in the memory. Different mempool drivers
may have different requirements and a new operation allows to
calculate memory size in accordance with driver requirements and
advertise requirements on minimum memory chunk size and alignment
in a generic way.

Bump ABI version since the patch breaks it.

Suggested-by: Olivier Matz 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - clarify min_chunk_size meaning
 - rebase on top of patch series which fixes library version in meson
   build

RFCv2 -> v1:
 - move default calc_mem_size callback to rte_mempool_ops_default.c
 - add ABI changes to release notes
 - name default callback consistently: rte_mempool_op__default()
 - bump ABI version since it is the first patch which breaks ABI
 - describe default callback behaviour in details
 - avoid introduction of internal function to cope with deprecation
   (keep it to deprecation patch)
 - move cache-line or page boundary chunk alignment to default callback
 - highlight that min_chunk_size and align parameters are output only

 doc/guides/rel_notes/deprecation.rst |  3 +-
 doc/guides/rel_notes/release_18_05.rst   |  7 ++-
 lib/librte_mempool/Makefile  |  3 +-
 lib/librte_mempool/meson.build   |  5 +-
 lib/librte_mempool/rte_mempool.c | 43 +++---
 lib/librte_mempool/rte_mempool.h | 86 +++-
 lib/librte_mempool/rte_mempool_ops.c | 18 ++
 lib/librte_mempool/rte_mempool_ops_default.c | 38 
 lib/librte_mempool/rte_mempool_version.map   |  7 +++
 9 files changed, 182 insertions(+), 28 deletions(-)
 create mode 100644 lib/librte_mempool/rte_mempool_ops_default.c

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 6594585..e02d4ca 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -72,8 +72,7 @@ Deprecation Notices
 
   - removal of ``get_capabilities`` mempool ops and related flags.
   - substitute ``register_memory_area`` with ``populate`` ops.
-  - addition of new ops to customize required memory chunk calculation,
-customize objects population and allocate contiguous
+  - addition of new ops to customize objects population and allocate contiguous
 block of objects if underlying driver supports it.
 
 * mbuf: The control mbuf API will be removed in v18.05. The impacted
diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index f2525bb..59583ea 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -80,6 +80,11 @@ ABI Changes
Also, make sure to start the actual text at the margin.
=
 
+* **Changed rte_mempool_ops structure.**
+
+  A new callback ``calc_mem_size`` has been added to ``rte_mempool_ops``
+  to allow to customize required memory size calculation.
+
 
 Removed Items
 -
@@ -152,7 +157,7 @@ The libraries prepended with a plus sign were incremented 
in this version.
  librte_latencystats.so.1
  librte_lpm.so.2
  librte_mbuf.so.3
- librte_mempool.so.3
+   + librte_mempool.so.4
+ librte_meter.so.2
  librte_metrics.so.1
  librte_net.so.1
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 24e735a..072740f 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -11,11 +11,12 @@ LDLIBS += -lrte_eal -lrte_ring
 
 EXPORT_MAP := rte_mempool_version.map
 
-LIBABIVER := 3
+LIBABIVER := 4
 
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool.c
 SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_ops.c
+SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_ops_default.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h
 
diff --git a/lib/librte_mempool/meson.build b/lib/librte_mempool/meson.build
index 712720f..9e3b527 100644
--- a/lib/librte_mempool/meson.build
+++ b/lib/librte_mempool/meson.build
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-version = 3
-sources = files('rte_mempool.c', 'rte_mempool_ops.c')
+version = 4
+sources = files('rte_mempool.c', 'rte_mempool_ops.c',
+   'rte_mempool_ops_default.c')
 headers = files('rte_mempool.h')
 deps += ['ring']
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index d8e3720..dd2d0fe 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -561,10 +561,10 @@ rte_mempool_populate_default(struct rte_mempool *mp)
unsigned int mz_flags = RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY;
char mz_name[RTE_MEMZONE_NAMESIZE];
const struct rte_memzone *mz;
-   size_t size, total_elt_sz, align, pg_sz, pg_shift;
+   ssize_t mem_size;
+   size_t

[dpdk-dev] [PATCH v2 11/11] mempool: support flushing the default cache of the mempool

2018-03-25 Thread Andrew Rybchenko
From: "Artem V. Andreev" 

Mempool get/put API cares about cache itself, but sometimes it is
required to flush the cache explicitly.

The function is moved in the file since it now requires
rte_mempool_default_cache().

Signed-off-by: Artem V. Andreev 
Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - none

 lib/librte_mempool/rte_mempool.h | 36 
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 314f909..3e06ae0 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -1169,22 +1169,6 @@ void
 rte_mempool_cache_free(struct rte_mempool_cache *cache);
 
 /**
- * Flush a user-owned mempool cache to the specified mempool.
- *
- * @param cache
- *   A pointer to the mempool cache.
- * @param mp
- *   A pointer to the mempool.
- */
-static __rte_always_inline void
-rte_mempool_cache_flush(struct rte_mempool_cache *cache,
-   struct rte_mempool *mp)
-{
-   rte_mempool_ops_enqueue_bulk(mp, cache->objs, cache->len);
-   cache->len = 0;
-}
-
-/**
  * Get a pointer to the per-lcore default mempool cache.
  *
  * @param mp
@@ -1207,6 +1191,26 @@ rte_mempool_default_cache(struct rte_mempool *mp, 
unsigned lcore_id)
 }
 
 /**
+ * Flush a user-owned mempool cache to the specified mempool.
+ *
+ * @param cache
+ *   A pointer to the mempool cache.
+ * @param mp
+ *   A pointer to the mempool.
+ */
+static __rte_always_inline void
+rte_mempool_cache_flush(struct rte_mempool_cache *cache,
+   struct rte_mempool *mp)
+{
+   if (cache == NULL)
+   cache = rte_mempool_default_cache(mp, rte_lcore_id());
+   if (cache == NULL || cache->len == 0)
+   return;
+   rte_mempool_ops_enqueue_bulk(mp, cache->objs, cache->len);
+   cache->len = 0;
+}
+
+/**
  * @internal Put several objects back in the mempool; used internally.
  * @param mp
  *   A pointer to the mempool structure.
-- 
2.7.4



[dpdk-dev] [PATCH v2 09/11] mempool/dpaa: prepare to remove register memory area op

2018-03-25 Thread Andrew Rybchenko
Populate mempool driver callback is executed a bit later than
register memory area, provides the same information and will
substitute the later since it gives more flexibility and in addition
to notification about memory area allows to customize how mempool
objects are stored in memory.

Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - fix build error because of prototype mismatch

 drivers/mempool/dpaa/dpaa_mempool.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mempool/dpaa/dpaa_mempool.c 
b/drivers/mempool/dpaa/dpaa_mempool.c
index 7b82f4b..0dcb488 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -264,10 +264,9 @@ dpaa_mbuf_get_count(const struct rte_mempool *mp)
 }
 
 static int
-dpaa_register_memory_area(const struct rte_mempool *mp,
- char *vaddr __rte_unused,
- rte_iova_t paddr __rte_unused,
- size_t len)
+dpaa_populate(struct rte_mempool *mp, unsigned int max_objs,
+ char *vaddr, rte_iova_t paddr, size_t len,
+ rte_mempool_populate_obj_cb_t *obj_cb, void *obj_cb_arg)
 {
struct dpaa_bp_info *bp_info;
unsigned int total_elt_sz;
@@ -289,7 +288,9 @@ dpaa_register_memory_area(const struct rte_mempool *mp,
if (len >= total_elt_sz * mp->size)
bp_info->flags |= DPAA_MPOOL_SINGLE_SEGMENT;
 
-   return 0;
+   return rte_mempool_op_populate_default(mp, max_objs, vaddr, paddr, len,
+  obj_cb, obj_cb_arg);
+
 }
 
 struct rte_mempool_ops dpaa_mpool_ops = {
@@ -299,7 +300,7 @@ struct rte_mempool_ops dpaa_mpool_ops = {
.enqueue = dpaa_mbuf_free_bulk,
.dequeue = dpaa_mbuf_alloc_bulk,
.get_count = dpaa_mbuf_get_count,
-   .register_memory_area = dpaa_register_memory_area,
+   .populate = dpaa_populate,
 };
 
 MEMPOOL_REGISTER_OPS(dpaa_mpool_ops);
-- 
2.7.4



[dpdk-dev] [PATCH v2 10/11] mempool: remove callback to register memory area

2018-03-25 Thread Andrew Rybchenko
The callback is not required any more since there is a new callback
to populate objects using provided memory area which provides
the same information.

Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - none

RFCv2 -> v1:
 - advertise ABI changes in release notes

 doc/guides/rel_notes/deprecation.rst   |  1 -
 doc/guides/rel_notes/release_18_05.rst |  2 ++
 lib/librte_mempool/rte_mempool.c   |  5 -
 lib/librte_mempool/rte_mempool.h   | 31 --
 lib/librte_mempool/rte_mempool_ops.c   | 14 --
 lib/librte_mempool/rte_mempool_version.map |  1 -
 6 files changed, 2 insertions(+), 52 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 473330d..5301259 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -63,7 +63,6 @@ Deprecation Notices
 
   The following changes are planned:
 
-  - substitute ``register_memory_area`` with ``populate`` ops.
   - addition of new op to allocate contiguous
 block of objects if underlying driver supports it.
 
diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index 6a8db54..016c4ed 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -108,6 +108,8 @@ ABI Changes
   Callback ``get_capabilities`` has been removed from ``rte_mempool_ops``
   since its features are covered by ``calc_mem_size`` and ``populate``
   callbacks.
+  Callback ``register_memory_area`` has been removed from ``rte_mempool_ops``
+  since the new callback ``populate`` may be used instead of it.
 
 
 Removed Items
diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 8c3b0b1..c58bcc6 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -355,11 +355,6 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char 
*vaddr,
if (ret != 0)
return ret;
 
-   /* Notify memory area to mempool */
-   ret = rte_mempool_ops_register_memory_area(mp, vaddr, iova, len);
-   if (ret != -ENOTSUP && ret < 0)
-   return ret;
-
/* mempool is already populated */
if (mp->populated_size >= mp->size)
return -ENOSPC;
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
index 9107f5a..314f909 100644
--- a/lib/librte_mempool/rte_mempool.h
+++ b/lib/librte_mempool/rte_mempool.h
@@ -371,12 +371,6 @@ typedef int (*rte_mempool_dequeue_t)(struct rte_mempool 
*mp,
 typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp);
 
 /**
- * Notify new memory area to mempool.
- */
-typedef int (*rte_mempool_ops_register_memory_area_t)
-(const struct rte_mempool *mp, char *vaddr, rte_iova_t iova, size_t len);
-
-/**
  * Calculate memory size required to store given number of objects.
  *
  * If mempool objects are not required to be IOVA-contiguous
@@ -514,10 +508,6 @@ struct rte_mempool_ops {
rte_mempool_dequeue_t dequeue;   /**< Dequeue an object. */
rte_mempool_get_count get_count; /**< Get qty of available objs. */
/**
-* Notify new memory area to mempool
-*/
-   rte_mempool_ops_register_memory_area_t register_memory_area;
-   /**
 * Optional callback to calculate memory size required to
 * store specified number of objects.
 */
@@ -639,27 +629,6 @@ unsigned
 rte_mempool_ops_get_count(const struct rte_mempool *mp);
 
 /**
- * @internal wrapper for mempool_ops register_memory_area callback.
- * API to notify the mempool handler when a new memory area is added to pool.
- *
- * @param mp
- *   Pointer to the memory pool.
- * @param vaddr
- *   Pointer to the buffer virtual address.
- * @param iova
- *   Pointer to the buffer IO address.
- * @param len
- *   Pool size.
- * @return
- *   - 0: Success;
- *   - -ENOTSUP - doesn't support register_memory_area ops (valid error case).
- *   - Otherwise, rte_mempool_populate_phys fails thus pool create fails.
- */
-int
-rte_mempool_ops_register_memory_area(const struct rte_mempool *mp,
-   char *vaddr, rte_iova_t iova, size_t len);
-
-/**
  * @internal wrapper for mempool_ops calc_mem_size callback.
  * API to calculate size of memory required to store specified number of
  * object.
diff --git a/lib/librte_mempool/rte_mempool_ops.c 
b/lib/librte_mempool/rte_mempool_ops.c
index 6ac669a..ea9be1e 100644
--- a/lib/librte_mempool/rte_mempool_ops.c
+++ b/lib/librte_mempool/rte_mempool_ops.c
@@ -57,7 +57,6 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
ops->enqueue = h->enqueue;
ops->dequeue = h->dequeue;
ops->get_count = h->get_count;
-   ops->register_memory_area = h->register_memory_area;
ops->calc_mem_size = h->calc_mem_size;
ops->populate = h->populate;
 
@@ -99,19 +98,6 @@ rte_mempool_ops_get_count(const struct r

[dpdk-dev] [PATCH v2 08/11] mempool/octeontx: prepare to remove register memory area op

2018-03-25 Thread Andrew Rybchenko
Callback to populate pool objects has all required information and
executed a bit later than register memory area callback.

Signed-off-by: Andrew Rybchenko 
---
v1 -> v2
 - none

 drivers/mempool/octeontx/rte_mempool_octeontx.c | 25 ++---
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/mempool/octeontx/rte_mempool_octeontx.c 
b/drivers/mempool/octeontx/rte_mempool_octeontx.c
index 64ed528..ab94dfe 100644
--- a/drivers/mempool/octeontx/rte_mempool_octeontx.c
+++ b/drivers/mempool/octeontx/rte_mempool_octeontx.c
@@ -152,26 +152,15 @@ octeontx_fpavf_calc_mem_size(const struct rte_mempool *mp,
 }
 
 static int
-octeontx_fpavf_register_memory_area(const struct rte_mempool *mp,
-   char *vaddr, rte_iova_t paddr, size_t len)
-{
-   RTE_SET_USED(paddr);
-   uint8_t gpool;
-   uintptr_t pool_bar;
-
-   gpool = octeontx_fpa_bufpool_gpool(mp->pool_id);
-   pool_bar = mp->pool_id & ~(uint64_t)FPA_GPOOL_MASK;
-
-   return octeontx_fpavf_pool_set_range(pool_bar, len, vaddr, gpool);
-}
-
-static int
 octeontx_fpavf_populate(struct rte_mempool *mp, unsigned int max_objs,
void *vaddr, rte_iova_t iova, size_t len,
rte_mempool_populate_obj_cb_t *obj_cb, void *obj_cb_arg)
 {
size_t total_elt_sz;
size_t off;
+   uint8_t gpool;
+   uintptr_t pool_bar;
+   int ret;
 
if (iova == RTE_BAD_IOVA)
return -EINVAL;
@@ -188,6 +177,13 @@ octeontx_fpavf_populate(struct rte_mempool *mp, unsigned 
int max_objs,
iova += off;
len -= off;
 
+   gpool = octeontx_fpa_bufpool_gpool(mp->pool_id);
+   pool_bar = mp->pool_id & ~(uint64_t)FPA_GPOOL_MASK;
+
+   ret = octeontx_fpavf_pool_set_range(pool_bar, len, vaddr, gpool);
+   if (ret < 0)
+   return ret;
+
return rte_mempool_op_populate_default(mp, max_objs, vaddr, iova, len,
   obj_cb, obj_cb_arg);
 }
@@ -199,7 +195,6 @@ static struct rte_mempool_ops octeontx_fpavf_ops = {
.enqueue = octeontx_fpavf_enqueue,
.dequeue = octeontx_fpavf_dequeue,
.get_count = octeontx_fpavf_get_count,
-   .register_memory_area = octeontx_fpavf_register_memory_area,
.calc_mem_size = octeontx_fpavf_calc_mem_size,
.populate = octeontx_fpavf_populate,
 };
-- 
2.7.4



[dpdk-dev] [PATCH v2 06/11] mempool: remove callback to get capabilities

2018-03-25 Thread Andrew Rybchenko
The callback was introduced to let generic code to know octeontx
mempool driver requirements to use single physically contiguous
memory chunk to store all objects and align object address to
total object size. Now these requirements are met using a new
callbacks to calculate required memory chunk size and to populate
objects using provided memory chunk.

These capability flags are not used anywhere else.

Restricting capabilities to flags is not generic and likely to
be insufficient to describe mempool driver features. If required
in the future, API which returns structured information may be
added.

Signed-off-by: Andrew Rybchenko 
---
v1 -> v2:
 - fix typo
 - rebase on top of patch which renames MEMPOOL_F_NO_PHYS_CONTIG

RFCv2 -> v1:
 - squash mempool/octeontx patches to add calc_mem_size and populate
   callbacks to this one in order to avoid breakages in the middle of
   patchset
 - advertise API changes in release notes

 doc/guides/rel_notes/deprecation.rst|  1 -
 doc/guides/rel_notes/release_18_05.rst  | 11 +
 drivers/mempool/octeontx/rte_mempool_octeontx.c | 59 +
 lib/librte_mempool/rte_mempool.c| 44 ++
 lib/librte_mempool/rte_mempool.h| 52 +-
 lib/librte_mempool/rte_mempool_ops.c| 14 --
 lib/librte_mempool/rte_mempool_ops_default.c| 15 +--
 lib/librte_mempool/rte_mempool_version.map  |  1 -
 8 files changed, 68 insertions(+), 129 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index c06fc67..4deed9a 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -70,7 +70,6 @@ Deprecation Notices
 
   The following changes are planned:
 
-  - removal of ``get_capabilities`` mempool ops and related flags.
   - substitute ``register_memory_area`` with ``populate`` ops.
   - addition of new op to allocate contiguous
 block of objects if underlying driver supports it.
diff --git a/doc/guides/rel_notes/release_18_05.rst 
b/doc/guides/rel_notes/release_18_05.rst
index abaefe5..c50f26c 100644
--- a/doc/guides/rel_notes/release_18_05.rst
+++ b/doc/guides/rel_notes/release_18_05.rst
@@ -66,6 +66,14 @@ API Changes
Also, make sure to start the actual text at the margin.
=
 
+* **Removed mempool capability flags and related functions.**
+
+  Flags ``MEMPOOL_F_CAPA_PHYS_CONTIG`` and
+  ``MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS`` were used by octeontx mempool
+  driver to customize generic mempool library behaviour.
+  Now the new driver callbacks ``calc_mem_size`` and ``populate`` may be
+  used to achieve it without specific knowledge in the generic code.
+
 
 ABI Changes
 ---
@@ -86,6 +94,9 @@ ABI Changes
   to allow to customize required memory size calculation.
   A new callback ``populate`` has been added to ``rte_mempool_ops``
   to allow to customize objects population.
+  Callback ``get_capabilities`` has been removed from ``rte_mempool_ops``
+  since its features are covered by ``calc_mem_size`` and ``populate``
+  callbacks.
 
 
 Removed Items
diff --git a/drivers/mempool/octeontx/rte_mempool_octeontx.c 
b/drivers/mempool/octeontx/rte_mempool_octeontx.c
index d143d05..64ed528 100644
--- a/drivers/mempool/octeontx/rte_mempool_octeontx.c
+++ b/drivers/mempool/octeontx/rte_mempool_octeontx.c
@@ -126,14 +126,29 @@ octeontx_fpavf_get_count(const struct rte_mempool *mp)
return octeontx_fpa_bufpool_free_count(pool);
 }
 
-static int
-octeontx_fpavf_get_capabilities(const struct rte_mempool *mp,
-   unsigned int *flags)
+static ssize_t
+octeontx_fpavf_calc_mem_size(const struct rte_mempool *mp,
+uint32_t obj_num, uint32_t pg_shift,
+size_t *min_chunk_size, size_t *align)
 {
-   RTE_SET_USED(mp);
-   *flags |= (MEMPOOL_F_CAPA_PHYS_CONTIG |
-   MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS);
-   return 0;
+   ssize_t mem_size;
+
+   /*
+* Simply need space for one more object to be able to
+* fulfil alignment requirements.
+*/
+   mem_size = rte_mempool_op_calc_mem_size_default(mp, obj_num + 1,
+   pg_shift,
+   min_chunk_size, align);
+   if (mem_size >= 0) {
+   /*
+* Memory area which contains objects must be physically
+* contiguous.
+*/
+   *min_chunk_size = mem_size;
+   }
+
+   return mem_size;
 }
 
 static int
@@ -150,6 +165,33 @@ octeontx_fpavf_register_memory_area(const struct 
rte_mempool *mp,
return octeontx_fpavf_pool_set_range(pool_bar, len, vaddr, gpool);
 }
 
+static int
+octeontx_fpavf_populate(struct rte_mempool *mp, unsigned int max_objs,
+

Re: [dpdk-dev] [PATCH v2 1/2] Add RIB library

2018-03-25 Thread Vladimir Medvedkin
Hi,

2018-03-14 14:09 GMT+03:00 Bruce Richardson :

> On Wed, Feb 21, 2018 at 09:44:54PM +, Medvedkin Vladimir wrote:
> > RIB is an alternative to current LPM library.
> > It solves the following problems
> >  - Increases the speed of control plane operations against lpm such as
> >adding/deleting routes
> >  - Adds abstraction from dataplane algorithms, so it is possible to add
> >different ip route lookup algorythms such as DXR/poptrie/lpc-trie/etc
> >in addition to current dir24_8
> >  - It is possible to keep user defined application specific additional
> >information in struct rte_rib_node which represents route entry.
> >It can be next hop/set of next hops (i.e. active and feasible),
> >pointers to link rte_rib_node based on some criteria (i.e. next_hop),
> >plenty of additional control plane information.
> >  - For dir24_8 implementation it is possible to remove
> rte_lpm_tbl_entry.depth
> >field that helps to save 6 bits.
> >  - Also new dir24_8 implementation supports different next_hop sizes
> >(1/2/4/8 bytes per next hop)
> >  - Removed RTE_LPM_LOOKUP_SUCCESS to save 1 bit and to eleminate ternary
> operator.
> >Instead it returns special default value if there is no route.
> >
> > Signed-off-by: Medvedkin Vladimir 
> > ---
> >  config/common_base |   6 +
> >  doc/api/doxy-api.conf  |   1 +
> >  lib/Makefile   |   2 +
> >  lib/librte_rib/Makefile|  22 ++
> >  lib/librte_rib/rte_dir24_8.c   | 482 ++
> +++
> >  lib/librte_rib/rte_dir24_8.h   | 116 
> >  lib/librte_rib/rte_rib.c   | 526 ++
> +++
> >  lib/librte_rib/rte_rib.h   | 322 +++
> >  lib/librte_rib/rte_rib_version.map |  18 ++
> >  mk/rte.app.mk  |   1 +
> >  10 files changed, 1496 insertions(+)
> >  create mode 100644 lib/librte_rib/Makefile
> >  create mode 100644 lib/librte_rib/rte_dir24_8.c
> >  create mode 100644 lib/librte_rib/rte_dir24_8.h
> >  create mode 100644 lib/librte_rib/rte_rib.c
> >  create mode 100644 lib/librte_rib/rte_rib.h
> >  create mode 100644 lib/librte_rib/rte_rib_version.map
> >
>
> First pass review comments. For now just reviewed the main public header
> file rte_rib.h. Later reviews will cover the other files as best I can.
>
> /Bruce
>
> 
> > diff --git a/lib/librte_rib/rte_rib.h b/lib/librte_rib/rte_rib.h
> > new file mode 100644
> > index 000..6eac8fb
> > --- /dev/null
> > +++ b/lib/librte_rib/rte_rib.h
> > @@ -0,0 +1,322 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright(c) 2018 Vladimir Medvedkin 
> > + */
> > +
> > +#ifndef _RTE_RIB_H_
> > +#define _RTE_RIB_H_
> > +
> > +/**
> > + * @file
> > + * Compressed trie implementation for Longest Prefix Match
> > + */
> > +
> > +/** @internal Macro to enable/disable run-time checks. */
> > +#if defined(RTE_LIBRTE_RIB_DEBUG)
> > +#define RTE_RIB_RETURN_IF_TRUE(cond, retval) do {\
> > + if (cond)   \
> > + return retval;  \
> > +} while (0)
> > +#else
> > +#define RTE_RIB_RETURN_IF_TRUE(cond, retval)
> > +#endif
>
> use RTE_ASSERT?
>
it was done just like it was done in the LPM lib. But if you think it
should be RTE_ASSERT so be it.


>
> > +
> > +#define RTE_RIB_VALID_NODE   1
>
> should there be an INVALID_NODE macro?
>
No


>
> > +#define RTE_RIB_GET_NXT_ALL  0
> > +#define RTE_RIB_GET_NXT_COVER1
> > +
> > +#define RTE_RIB_INVALID_ROUTE0
> > +#define RTE_RIB_VALID_ROUTE  1
> > +
> > +/** Max number of characters in RIB name. */
> > +#define RTE_RIB_NAMESIZE 64
> > +
> > +/** Maximum depth value possible for IPv4 RIB. */
> > +#define RTE_RIB_MAXDEPTH 32
>
> I think we should have IPv4 in the name here. Will it not be extended to
> support IPv6 in future?
>
I think there should be a separate implementation of the library for ipv6


>
> > +
> > +/**
> > + * Macro to check if prefix1 {key1/depth1}
> > + * is covered by prefix2 {key2/depth2}
> > + */
> > +#define RTE_RIB_IS_COVERED(key1, depth1, key2, depth2)
>  \
> > + key1 ^ key2) & (uint32_t)(UINT64_MAX << (32 - depth2))) == 0)\
> > + && (depth1 > depth2))
> Neat check!
>
> Any particular reason for using UINT64_MAX here rather than UINT32_MAX?

in case when depth2 = 0 UINT32_MAX shifted left by 32 bit will remain
UINT32_MAX because shift count will be masked to 5 bits.

I think you can avoid the casting and have a slightly shorter mask by
> changing "(uint32_t)(UINT64_MAX << (32 - depth2)" to
> "~(UINT32_MAX >> depth2)"
> I'd also suggest for readability putting the second check first, and,
> for maintainability, using an inline function rather than a macro.
>
 Agree, it looks clearer


> > +
> > +/** @internal Macro to get next node in tree*/
> > +#define RTE_RIB_GET_NXT_NODE(node, key)
>   \
> > + ((key & (1 << (31 - node->dept

Re: [dpdk-dev] i40e mbuf->rss indication

2018-03-25 Thread Chilikin, Andrey
Hi Hanoh,

Could you please explain what do you mean by *wrong hash value*?

i40e calculates hash value for TCP/UDP using 4-tuple: L3 source/destination 
addresses and L4 source/destination ports. It does not use IP protocol, as TCP 
and UDP already separated to different PCTYPEs at HW level. Could this be the 
root cause of the problem you are seeing?

Regards,
Andrey

> -Original Message-
> From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Bruce Richardson
> Sent: Thursday, March 22, 2018 2:22 PM
> To: Hanoch Haim (hhaim) 
> Cc: Yigit, Ferruh ; dev@dpdk.org
> Subject: Re: [dpdk-dev] i40e mbuf->rss indication
> 
> On Thu, Mar 22, 2018 at 12:52:30PM +, Hanoch Haim (hhaim) wrote:
> > Hi,
> > I think this is not the vector driver because I'm user scatter/gather
> >
> 
> Vector driver has supported multi-buffer packets for a while now, so it
> should be used for packet RX in i40e in just about all cases.
> 
> If possible, could you check if adjusting the setting for 16B/32B
> descriptors in the build-time config makes a difference. For 16B
> descriptors the flow director ID and RSS hash share a field in the
> descriptor, while they don't with 32B versions (though the vector driver
> only ever reads the first 16B of each descriptor in any case).
> 
> /Bruce
> 
> > Thanks,
> > Hanoh
> >
> >
> > -Original Message-
> > From: Ferruh Yigit [mailto:ferruh.yi...@intel.com]
> > Sent: Thursday, March 22, 2018 2:18 PM
> > To: Hanoch Haim (hhaim); Bruce Richardson
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] i40e mbuf->rss indication
> >
> > On 3/22/2018 11:46 AM, Hanoch Haim (hhaim) wrote:
> > > Driver: i40e
> > >
> > > DPDK : 17.11
> > >
> > > Configuration :
> > >
> > > 1) RSS configuration
> > >rxmode.mq_mode = ETH_MQ_RX_RSS;
> > >rss->rss_hf = ETH_RSS_UDP | ETH_RSS_TCP;
> > >rss->rss_key = Microsoft key
> > >rss->rss_key_len = 52
> > >
> > >*configure RETA to some rx-queues
> > >
> > > 2)Change hash to TOEPLITZ (only for i40e)
> > >
> > >   struct rte_eth_hash_filter_info info = {};
> > >   info.info_type = RTE_ETH_HASH_FILTER_GLOBAL_CONFIG;
> > >   info.info.global_conf.hash_func =
> RTE_ETH_HASH_FUNCTION_TOEPLITZ;
> > >   rte_eth_dev_filter_ctrl(m_repid,
> > >   RTE_ETH_FILTER_HASH,
> > >   RTE_ETH_FILTER_SET, &info);
> > >
> > > 3) Configure some flow-director rules
> > >
> > > 4) TCP/UDP packets are received to the *right* core (based on a SW
> Toeplitz calculation +reta table) however
> > >The reported rss value is *wrong* in the mbuf
> > >   (m->hash.rss == *wrong value*)
> >
> > Are you getting same result with both scalar and vector driver?
> >
> > >   ((m->ol_flags&PKT_RX_RSS_HASH) == PKT_RX_RSS_HASH
> > >
> > > 5) The above works fine for mlx5 and ixgbe
> > >
> > > 6) I suspect the hash is something else, maybe flow-director id or xor
> hash ..
> > >
> > > Wanted to know if this is a known issue. I can provide a simple way to
> reproduce it using TRex
> > >
> > > Thanks,
> > > Hanoh
> > >
> > >
> > > -Original Message-
> > > From: Bruce Richardson [mailto:bruce.richard...@intel.com]
> > > Sent: Thursday, March 22, 2018 1:35 PM
> > > To: Hanoch Haim (hhaim)
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] i40e mbuf->rss indication
> > >
> > > On Wed, Mar 21, 2018 at 06:47:22PM +, Hanoch Haim (hhaim) wrote:
> > >> Hi All,
> > >> DPDK:17.11
> > >> When i40e is configured with RSS enabled and hash.type=toeplitz
> > >>
> > >> m->hash.rss = some weird number
> > >> ((m->ol_flags&PKT_RX_RSS_HASH) == PKT_RX_RSS_HASH
> > >>
> > >> The hash value is correct and match the MS Toeplitz standard.
> > >>
> > >> Is this expected?
> > >
> > > I'm sorry, but I don't quite follow the question, or the problem. Are you
> meaning to say that the hash value is incorrect, or that the flag is not being
> set or something else?
> > >
> > > /Bruce
> > >
> > >>
> > >> The above works fine with ixgbe/mlx5
> > >>
> > >> Thanks,
> > >> Hanoh
> > >>
> >


Re: [dpdk-dev] [PATCH v3 1/2] Add RIB library

2018-03-25 Thread Vladimir Medvedkin
2018-03-15 17:27 GMT+03:00 Bruce Richardson :

> On Thu, Feb 22, 2018 at 10:50:55PM +, Medvedkin Vladimir wrote:
> > RIB is an alternative to current LPM library.
> > It solves the following problems
> >  - Increases the speed of control plane operations against lpm such as
> >adding/deleting routes
> >  - Adds abstraction from dataplane algorithms, so it is possible to add
> >different ip route lookup algorythms such as DXR/poptrie/lpc-trie/etc
> >in addition to current dir24_8
> >  - It is possible to keep user defined application specific additional
> >information in struct rte_rib_node which represents route entry.
> >It can be next hop/set of next hops (i.e. active and feasible),
> >pointers to link rte_rib_node based on some criteria (i.e. next_hop),
> >plenty of additional control plane information.
> >  - For dir24_8 implementation it is possible to remove
> >rte_lpm_tbl_entry.depth field that helps to save 6 bits.
> >  - Also new dir24_8 implementation supports different next_hop sizes
> >(1/2/4/8 bytes per next hop)
> >  - Removed RTE_LPM_LOOKUP_SUCCESS to save 1 bit and to eleminate
> >ternary operator.
> >Instead it returns special default value if there is no route.
> >
> > Signed-off-by: Medvedkin Vladimir 
>
> More comments inline below. Mostly for rte_rib.c file.
>
> /Bruce
>
> > ---
> >  config/common_base |   6 +
> >  doc/api/doxy-api.conf  |   1 +
> >  lib/Makefile   |   2 +
> >  lib/librte_rib/Makefile|  23 ++
>
> Don't forget meson.build file too, to build with meson and ninja. [Strongly
> recommend it for your day-to-day development work too, incremental builds
> are much, much faster using ninja].
>
Will add

>
> >  lib/librte_rib/rte_dir24_8.c   | 482 ++
> +++
> >  lib/librte_rib/rte_dir24_8.h   | 115 
> >  lib/librte_rib/rte_rib.c   | 526 ++
> +++
> >  lib/librte_rib/rte_rib.h   | 322 +++
> >  lib/librte_rib/rte_rib_version.map |  18 ++
> >  mk/rte.app.mk  |   1 +
> >  10 files changed, 1496 insertions(+)
> >  create mode 100644 lib/librte_rib/Makefile
> >  create mode 100644 lib/librte_rib/rte_dir24_8.c
> >  create mode 100644 lib/librte_rib/rte_dir24_8.h
> >  create mode 100644 lib/librte_rib/rte_rib.c
> >  create mode 100644 lib/librte_rib/rte_rib.h
> >  create mode 100644 lib/librte_rib/rte_rib_version.map
> >
> > diff --git a/config/common_base b/config/common_base
> > index ad03cf4..aceeff5 100644
> > --- a/config/common_base
> > +++ b/config/common_base
> > @@ -679,6 +679,12 @@ CONFIG_RTE_LIBRTE_LPM=y
> >  CONFIG_RTE_LIBRTE_LPM_DEBUG=n
> >
> >  #
> > +# Compile librte_rib
> > +#
> > +CONFIG_RTE_LIBRTE_RIB=y
> > +CONFIG_RTE_LIBRTE_RIB_DEBUG=n
> > +
> > +#
> >  # Compile librte_acl
> >  #
> >  CONFIG_RTE_LIBRTE_ACL=y
> > diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf
> > index cda52fd..8e4f969 100644
> > --- a/doc/api/doxy-api.conf
> > +++ b/doc/api/doxy-api.conf
> > @@ -60,6 +60,7 @@ INPUT   = doc/api/doxy-api-index.md \
> >lib/librte_kvargs \
> >lib/librte_latencystats \
> >lib/librte_lpm \
> > +  lib/librte_rib \
> >lib/librte_mbuf \
> >lib/librte_member \
> >lib/librte_mempool \
> > diff --git a/lib/Makefile b/lib/Makefile
> > index ec965a6..e4faf10 100644
> > --- a/lib/Makefile
> > +++ b/lib/Makefile
> > @@ -43,6 +43,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_EFD) += librte_efd
> >  DEPDIRS-librte_efd := librte_eal librte_ring librte_hash
> >  DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
> >  DEPDIRS-librte_lpm := librte_eal
> > +DIRS-$(CONFIG_RTE_LIBRTE_RIB) += librte_rib
> > +DEPDIRS-librte_rib := librte_eal librte_mempool
> >  DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl
> >  DEPDIRS-librte_acl := librte_eal
> >  DIRS-$(CONFIG_RTE_LIBRTE_MEMBER) += librte_member
> > diff --git a/lib/librte_rib/Makefile b/lib/librte_rib/Makefile
> > new file mode 100644
> > index 000..f6431b6
> > --- /dev/null
> > +++ b/lib/librte_rib/Makefile
> > @@ -0,0 +1,23 @@
> > +# SPDX-License-Identifier: BSD-3-Clause
> > +# Copyright(c) 2018 Vladimir Medvedkin 
> > +
> > +include $(RTE_SDK)/mk/rte.vars.mk
> > +
> > +# library name
> > +LIB = librte_rib.a
> > +
> > +CFLAGS += -O3
> > +CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
> > +LDLIBS += -lrte_eal -lrte_mempool
> > +
> > +EXPORT_MAP := rte_rib_version.map
> > +
> > +LIBABIVER := 1
> > +
> > +# all source are stored in SRCS-y
> > +SRCS-$(CONFIG_RTE_LIBRTE_RIB) := rte_rib.c rte_dir24_8.c
> > +
> > +# install this header file
> > +SYMLINK-$(CONFIG_RTE_LIBRTE_RIB)-include := rte_rib.h rte_dir24_8.h
> > +
> > +include $(RTE_SDK)/mk/rte.lib.mk
> > diff --git a/lib/librte_rib/rte_dir24_8.c b/lib/librte_rib/rte_dir

[dpdk-dev] [PATCH] net/bnxt: convert to SPDX license tag

2018-03-25 Thread Ajit Khaparde
From: Scott Branden 

Update the license header on bnxt files to be the standard
BSD-3-Clause license used for the rest of DPDK,
bring the files in compliance with the DPDK licensing policy.

Signed-off-by: Scott Branden 
Signed-off-by: Ajit Khaparde 
---
 doc/guides/nics/bnxt.rst   | 30 ++
 drivers/net/bnxt/bnxt.h| 33 +++--
 drivers/net/bnxt/bnxt_cpr.c| 33 +++--
 drivers/net/bnxt/bnxt_cpr.h| 33 +++--
 drivers/net/bnxt/bnxt_ethdev.c | 33 +++--
 drivers/net/bnxt/bnxt_filter.c | 33 +++--
 drivers/net/bnxt/bnxt_filter.h | 33 +++--
 drivers/net/bnxt/bnxt_hwrm.c   | 33 +++--
 drivers/net/bnxt/bnxt_hwrm.h   | 33 +++--
 drivers/net/bnxt/bnxt_irq.c| 33 +++--
 drivers/net/bnxt/bnxt_irq.h| 33 +++--
 drivers/net/bnxt/bnxt_nvm_defs.h   | 12 
 drivers/net/bnxt/bnxt_ring.c   | 33 +++--
 drivers/net/bnxt/bnxt_ring.h   | 33 +++--
 drivers/net/bnxt/bnxt_rxq.c| 33 +++--
 drivers/net/bnxt/bnxt_rxq.h| 33 +++--
 drivers/net/bnxt/bnxt_rxr.c| 33 +++--
 drivers/net/bnxt/bnxt_rxr.h| 33 +++--
 drivers/net/bnxt/bnxt_stats.c  | 33 +++--
 drivers/net/bnxt/bnxt_stats.h  | 33 +++--
 drivers/net/bnxt/bnxt_txq.c| 33 +++--
 drivers/net/bnxt/bnxt_txq.h| 33 +++--
 drivers/net/bnxt/bnxt_txr.c| 33 +++--
 drivers/net/bnxt/bnxt_txr.h| 33 +++--
 drivers/net/bnxt/bnxt_vnic.c   | 33 +++--
 drivers/net/bnxt/bnxt_vnic.h   | 33 +++--
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 33 +++--
 drivers/net/bnxt/rte_pmd_bnxt.c| 33 +++--
 drivers/net/bnxt/rte_pmd_bnxt.h| 33 +++--
 29 files changed, 87 insertions(+), 846 deletions(-)

diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst
index 9826b3509..3ecd29dce 100644
--- a/doc/guides/nics/bnxt.rst
+++ b/doc/guides/nics/bnxt.rst
@@ -1,31 +1,5 @@
-..  BSD LICENSE
-Copyright 2016 Broadcom Limited
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in
-the documentation and/or other materials provided with the
-distribution.
-* Neither the name of Broadcom Limited nor the names of its
-contributors may be used to endorse or promote products derived
-from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright 2016-2018 Broadcom
 
 BNXT Poll Mode Driver
 =
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index b5a0badfc..967c94d14 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -1,34 +1,7 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) Broadcom Limited.
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ *   Copyright(c) 2014-2018 Broadcom
  *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- * *

Re: [dpdk-dev] [PATCH v3 3/3] net/i40e: enable runtime queue setup

2018-03-25 Thread Ananyev, Konstantin
Hi Qi,

> 
> Expose the runtime queue configuration capability and enhance
> i40e_dev_[rx|tx]_queue_setup to handle the situation when
> device already started.
> 
> Signed-off-by: Qi Zhang 
> ---
> v3:
> - no queue start/stop in setup/release
> - return fail when required rx/tx function conflict with
>   exist setup
> 
>  drivers/net/i40e/i40e_ethdev.c |  4 +++
>  drivers/net/i40e/i40e_rxtx.c   | 64 
> ++
>  2 files changed, 68 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 508b4171c..68960dcaa 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -3197,6 +3197,10 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct 
> rte_eth_dev_info *dev_info)
>   DEV_TX_OFFLOAD_GRE_TNL_TSO |
>   DEV_TX_OFFLOAD_IPIP_TNL_TSO |
>   DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
> + dev_info->runtime_queue_setup_capa =
> + DEV_RUNTIME_RX_QUEUE_SETUP |
> + DEV_RUNTIME_TX_QUEUE_SETUP;
> +
>   dev_info->hash_key_size = (I40E_PFQF_HKEY_MAX_INDEX + 1) *
>   sizeof(uint32_t);
>   dev_info->reta_size = pf->hash_lut_size;
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 1217e5a61..9eb009d63 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1712,6 +1712,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
>   uint16_t len, i;
>   uint16_t reg_idx, base, bsf, tc_mapping;
>   int q_offset, use_def_burst_func = 1;
> + int ret = 0;
> 
>   if (hw->mac.type == I40E_MAC_VF || hw->mac.type == I40E_MAC_X722_VF) {
>   vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> @@ -1841,6 +1842,36 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
>   rxq->dcb_tc = i;
>   }
> 
> + if (dev->data->dev_started) {
> + ret = i40e_rx_queue_init(rxq);
> + if (ret != I40E_SUCCESS) {
> + PMD_DRV_LOG(ERR,
> + "Failed to do RX queue initialization");
> + return ret;
> + }

We probably also have to do here:

if (use_def_burst_func != 0 && ad-> rx_bulk_alloc_allowed) {error;}

and we have to do that before we assign ad-> rx_bulk_alloc_allowed
(inside rx_queue_setup() few lines above).


> + /* check vector conflict */
> + if (ad->rx_vec_allowed) {
> + if (i40e_rxq_vec_setup(rxq)) {
> + PMD_DRV_LOG(ERR, "Failed vector rx setup");
> + i40e_dev_rx_queue_release(rxq);
> + return -EINVAL;
> + }
> + }
> + /* check scatterred conflict */
> + if (!dev->data->scattered_rx) {
> + uint16_t buf_size =
> + (uint16_t)(rte_pktmbuf_data_room_size(rxq->mp) -
> +RTE_PKTMBUF_HEADROOM);
> +
> + if ((rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) >
> + buf_size) {
> + PMD_DRV_LOG(ERR, "Scattered rx is required");
> + i40e_dev_rx_queue_release(rxq);
> + return -EINVAL;
> + }
> + }
> + }
> +
>   return 0;
>  }
> 
> @@ -1980,6 +2011,8 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
>   const struct rte_eth_txconf *tx_conf)
>  {
>   struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct i40e_adapter *ad =
> + I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>   struct i40e_vsi *vsi;
>   struct i40e_pf *pf = NULL;
>   struct i40e_vf *vf = NULL;
> @@ -1989,6 +2022,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
>   uint16_t tx_rs_thresh, tx_free_thresh;
>   uint16_t reg_idx, i, base, bsf, tc_mapping;
>   int q_offset;
> + int ret = 0;
> 
>   if (hw->mac.type == I40E_MAC_VF || hw->mac.type == I40E_MAC_X722_VF) {
>   vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> @@ -2162,6 +2196,36 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
>   txq->dcb_tc = i;
>   }
> 
> + if (dev->data->dev_started) {
> + ret = i40e_tx_queue_init(txq);
> + if (ret != I40E_SUCCESS) {
> + PMD_DRV_LOG(ERR,
> + "Failed to do TX queue initialization");
> + return ret;
> + }
> +
> + /* check vector conflict */
> + if (ad->tx_vec_allowed) {

Same thing here:
i40e_dev_tx_queue_setup()->i40e_set_tx_function_flag()
can change both ad->tx_vec_allowed and tx_simple_allowed.
I think we have to do that check before device settings are af

Re: [dpdk-dev] [PATCH v3 1/3] ether: support runtime queue setup

2018-03-25 Thread Ananyev, Konstantin


> -Original Message-
> From: Zhang, Qi Z
> Sent: Wednesday, March 21, 2018 7:28 AM
> To: tho...@monjalon.net; Ananyev, Konstantin 
> Cc: dev@dpdk.org; Xing, Beilei ; Wu, Jingjing 
> ; Lu, Wenzhuo ;
> Zhang, Qi Z 
> Subject: [PATCH v3 1/3] ether: support runtime queue setup
> 
> The patch let etherdev driver expose the capability flag through
> rte_eth_dev_info_get when it support runtime queue configuraiton,
> then base on the flag rte_eth_[rx|tx]_queue_setup could decide
> continue to setup the queue or just return fail when device already
> started.
> 
> Signed-off-by: Qi Zhang 
> ---
> v3:
> - not overload deferred start
> - rename deferred setup to runtime setup
> 
> v2:
> - enhance comment
> 
>  doc/guides/nics/features.rst  |  8 
>  lib/librte_ether/rte_ethdev.c | 30 ++
>  lib/librte_ether/rte_ethdev.h |  7 +++
>  3 files changed, 33 insertions(+), 12 deletions(-)
> 
> diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
> index 1b4fb979f..6983faa4e 100644
> --- a/doc/guides/nics/features.rst
> +++ b/doc/guides/nics/features.rst
> @@ -892,7 +892,15 @@ Documentation describes performance values.
> 
>  See ``dpdk.org/doc/perf/*``.
> 
> +.. _nic_features_queue_runtime_setup_capabilities:
> 
> +Queue runtime setup capabilities
> +-
> +
> +Supports queue setup / release after device started.
> +
> +* **[provides] rte_eth_dev_info**:
> ``runtime_queue_config_capa:DEV_RUNTIME_RX_QUEUE_SETUP,DEV_RUNTIME_TX_QUEUE_SETUP``.
> +* **[related]  API**: ``rte_eth_dev_info_get()``.
> 
>  .. _nic_features_other:
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index 0590f0c10..343b1a6c0 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -1425,12 +1425,6 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t 
> rx_queue_id,
>   return -EINVAL;
>   }
> 
> - if (dev->data->dev_started) {
> - RTE_PMD_DEBUG_TRACE(
> - "port %d must be stopped to allow configuration\n", 
> port_id);
> - return -EBUSY;
> - }
> -
>   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
>   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
> 
> @@ -1474,6 +1468,15 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t 
> rx_queue_id,
>   return -EINVAL;
>   }
> 
> + if (dev->data->dev_started &&
> + !(dev_info.runtime_queue_setup_capa &
> + DEV_RUNTIME_RX_QUEUE_SETUP))
> + return -EBUSY;
> +
> + if (dev->data->rx_queue_state[rx_queue_id] !=
> + RTE_ETH_QUEUE_STATE_STOPPED)
> + return -EBUSY;
> +
>   rxq = dev->data->rx_queues;
>   if (rxq[rx_queue_id]) {
>   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release,
> @@ -1573,12 +1576,6 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t 
> tx_queue_id,
>   return -EINVAL;
>   }
> 
> - if (dev->data->dev_started) {
> - RTE_PMD_DEBUG_TRACE(
> - "port %d must be stopped to allow configuration\n", 
> port_id);
> - return -EBUSY;
> - }
> -
>   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
>   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
> 
> @@ -1596,6 +1593,15 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t 
> tx_queue_id,
>   return -EINVAL;
>   }
> 
> + if (dev->data->dev_started &&
> + !(dev_info.runtime_queue_setup_capa &
> + DEV_RUNTIME_TX_QUEUE_SETUP))
> + return -EBUSY;
> +
> + if (dev->data->rx_queue_state[tx_queue_id] !=
> + RTE_ETH_QUEUE_STATE_STOPPED)
> + return -EBUSY;
> +
>   txq = dev->data->tx_queues;
>   if (txq[tx_queue_id]) {
>   RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release,
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 036153306..4e2088458 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -981,6 +981,11 @@ struct rte_eth_conf {
>   */
>  #define DEV_TX_OFFLOAD_SECURITY 0x0002
> 
> +#define DEV_RUNTIME_RX_QUEUE_SETUP 0x0001
> +/**< Deferred setup rx queue */
> +#define DEV_RUNTIME_TX_QUEUE_SETUP 0x0002
> +/**< Deferred setup tx queue */
> +
>  /*
>   * If new Tx offload capabilities are defined, they also must be
>   * mentioned in rte_tx_offload_names in rte_ethdev.c file.
> @@ -1029,6 +1034,8 @@ struct rte_eth_dev_info {
>   /** Configured number of rx/tx queues */
>   uint16_t nb_rx_queues; /**< Number of RX queues. */
>   uint16_t nb_tx_queues; /**< Number of TX queues. */
> + uint64_t runtime_queue_setup_capa;
> + /**< queues can be setup after dev_start (DEV_DEFERRED_). */
>  };
> 
>  /**
> --

Acked-by: Konstantin Ananyev 

> 2.13.6



[dpdk-dev] [PATCH v3] net/mlx4: support CRC strip toggling

2018-03-25 Thread Ophir Munk
Previous to this commit mlx4 CRC stripping was executed by default and
there was no verbs API to disable it.

Signed-off-by: Ophir Munk 
---
v1: initial version
v2: following internal reviews
v3: following dpdk.org mailing list reviews

 drivers/net/mlx4/mlx4.c  |  6 +-
 drivers/net/mlx4/mlx4.h  |  1 +
 drivers/net/mlx4/mlx4_rxq.c  | 33 +++--
 drivers/net/mlx4/mlx4_rxtx.c |  3 +++
 drivers/net/mlx4/mlx4_rxtx.h |  1 +
 5 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index ee93daf..eea6e93 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -562,7 +562,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct 
rte_pci_device *pci_dev)
(device_attr.vendor_part_id ==
 PCI_DEVICE_ID_MELLANOX_CONNECTX3PRO);
DEBUG("L2 tunnel checksum offloads are %ssupported",
- (priv->hw_csum_l2tun ? "" : "not "));
+ priv->hw_csum_l2tun ? "" : "not ");
priv->hw_rss_sup = device_attr_ex.rss_caps.rx_hash_fields_mask;
if (!priv->hw_rss_sup) {
WARN("no RSS capabilities reported; disabling support"
@@ -578,6 +578,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct 
rte_pci_device *pci_dev)
}
DEBUG("supported RSS hash fields mask: %016" PRIx64,
  priv->hw_rss_sup);
+   priv->hw_fcs_strip = !!(device_attr_ex.raw_packet_caps &
+IBV_RAW_PACKET_CAP_SCATTER_FCS);
+   DEBUG("FCS stripping toggling is %ssupported",
+ priv->hw_fcs_strip ? "" : "not ");
/* Configure the first MAC address by default. */
if (mlx4_get_mac(priv, &mac.addr_bytes)) {
ERROR("cannot get MAC address, is mlx4_en loaded?"
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 19c8a22..3ae3ce6 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -105,6 +105,7 @@ struct priv {
uint32_t isolated:1; /**< Toggle isolated mode. */
uint32_t hw_csum:1; /**< Checksum offload is supported. */
uint32_t hw_csum_l2tun:1; /**< Checksum support for L2 tunnels. */
+   uint32_t hw_fcs_strip:1; /**< FCS stripping toggling is supported. */
uint64_t hw_rss_sup; /**< Supported RSS hash fields (Verbs format). */
struct rte_intr_handle intr_handle; /**< Port interrupt handle. */
struct mlx4_drop *drop; /**< Shared resources for drop flow rules. */
diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c
index 7a036ed..b437bb8 100644
--- a/drivers/net/mlx4/mlx4_rxq.c
+++ b/drivers/net/mlx4/mlx4_rxq.c
@@ -491,6 +491,8 @@ mlx4_rxq_attach(struct rxq *rxq)
const char *msg;
struct ibv_cq *cq = NULL;
struct ibv_wq *wq = NULL;
+   uint32_t create_flags = 0;
+   uint32_t comp_mask = 0;
volatile struct mlx4_wqe_data_seg (*wqes)[];
unsigned int i;
int ret;
@@ -503,6 +505,11 @@ mlx4_rxq_attach(struct rxq *rxq)
msg = "CQ creation failure";
goto error;
}
+   /* By default, FCS (CRC) is stripped by hardware. */
+   if (rxq->crc_present) {
+   create_flags |= IBV_WQ_FLAGS_SCATTER_FCS;
+   comp_mask |= IBV_WQ_INIT_ATTR_FLAGS;
+   }
wq = mlx4_glue->create_wq
(priv->ctx,
 &(struct ibv_wq_init_attr){
@@ -511,6 +518,8 @@ mlx4_rxq_attach(struct rxq *rxq)
.max_sge = sges_n,
.pd = priv->pd,
.cq = cq,
+   .comp_mask = comp_mask,
+   .create_flags = create_flags,
 });
if (!wq) {
ret = errno ? errno : EINVAL;
@@ -649,9 +658,10 @@ mlx4_rxq_detach(struct rxq *rxq)
 uint64_t
 mlx4_get_rx_queue_offloads(struct priv *priv)
 {
-   uint64_t offloads = DEV_RX_OFFLOAD_SCATTER |
-   DEV_RX_OFFLOAD_CRC_STRIP;
+   uint64_t offloads = DEV_RX_OFFLOAD_SCATTER;
 
+   if (priv->hw_fcs_strip)
+   offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
if (priv->hw_csum)
offloads |= DEV_RX_OFFLOAD_CHECKSUM;
return offloads;
@@ -736,6 +746,7 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, 
uint16_t desc,
},
};
int ret;
+   uint32_t crc_present;
 
(void)conf; /* Thresholds configuration (ignored). */
DEBUG("%p: configuring queue %u for %u descriptors",
@@ -774,6 +785,23 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, 
uint16_t desc,
 " to the next power of two (%u)",
 (void *)dev, idx, desc);
}
+   /* By default, FCS (CRC) is stripped by hardware. */
+   if 

Re: [dpdk-dev] i40e mbuf->rss indication

2018-03-25 Thread Hanoch Haim (hhaim)
Hi Andrey,

The ML specification is clear. The key is defined and work the same for all 
driver.
My point is that the RSS result (Rx-queue) is *correct* but the 32bit 
intermediate hash value that is reported in the descriptor is not correct. The 
hash value reside in the first 16B.
I can send how to reproduce this if needed.It might be related to flow-director 
configuration I have.

Thanks,
Hanoh
Sent from my iPhone

On 25 Mar 2018, at 11:20, Chilikin, Andrey 
mailto:andrey.chili...@intel.com>> wrote:

Hi Hanoh,

Could you please explain what do you mean by *wrong hash value*?

i40e calculates hash value for TCP/UDP using 4-tuple: L3 source/destination 
addresses and L4 source/destination ports. It does not use IP protocol, as TCP 
and UDP already separated to different PCTYPEs at HW level. Could this be the 
root cause of the problem you are seeing?

Regards,
Andrey

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Bruce Richardson
Sent: Thursday, March 22, 2018 2:22 PM
To: Hanoch Haim (hhaim) mailto:hh...@cisco.com>>
Cc: Yigit, Ferruh mailto:ferruh.yi...@intel.com>>; 
dev@dpdk.org
Subject: Re: [dpdk-dev] i40e mbuf->rss indication

On Thu, Mar 22, 2018 at 12:52:30PM +, Hanoch Haim (hhaim) wrote:
Hi,
I think this is not the vector driver because I'm user scatter/gather


Vector driver has supported multi-buffer packets for a while now, so it
should be used for packet RX in i40e in just about all cases.

If possible, could you check if adjusting the setting for 16B/32B
descriptors in the build-time config makes a difference. For 16B
descriptors the flow director ID and RSS hash share a field in the
descriptor, while they don't with 32B versions (though the vector driver
only ever reads the first 16B of each descriptor in any case).

/Bruce

Thanks,
Hanoh


-Original Message-
From: Ferruh Yigit [mailto:ferruh.yi...@intel.com]
Sent: Thursday, March 22, 2018 2:18 PM
To: Hanoch Haim (hhaim); Bruce Richardson
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] i40e mbuf->rss indication

On 3/22/2018 11:46 AM, Hanoch Haim (hhaim) wrote:
Driver: i40e

DPDK : 17.11

Configuration :

1) RSS configuration
  rxmode.mq_mode = ETH_MQ_RX_RSS;
  rss->rss_hf = ETH_RSS_UDP | ETH_RSS_TCP;
  rss->rss_key = Microsoft key
  rss->rss_key_len = 52

  *configure RETA to some rx-queues

2)Change hash to TOEPLITZ (only for i40e)

 struct rte_eth_hash_filter_info info = {};
 info.info_type = RTE_ETH_HASH_FILTER_GLOBAL_CONFIG;
 info.info.global_conf.hash_func =
RTE_ETH_HASH_FUNCTION_TOEPLITZ;
 rte_eth_dev_filter_ctrl(m_repid,
 RTE_ETH_FILTER_HASH,
 RTE_ETH_FILTER_SET, &info);

3) Configure some flow-director rules

4) TCP/UDP packets are received to the *right* core (based on a SW
Toeplitz calculation +reta table) however
  The reported rss value is *wrong* in the mbuf
 (m->hash.rss == *wrong value*)

Are you getting same result with both scalar and vector driver?

 ((m->ol_flags&PKT_RX_RSS_HASH) == PKT_RX_RSS_HASH

5) The above works fine for mlx5 and ixgbe

6) I suspect the hash is something else, maybe flow-director id or xor
hash ..

Wanted to know if this is a known issue. I can provide a simple way to
reproduce it using TRex

Thanks,
Hanoh


-Original Message-
From: Bruce Richardson [mailto:bruce.richard...@intel.com]
Sent: Thursday, March 22, 2018 1:35 PM
To: Hanoch Haim (hhaim)
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] i40e mbuf->rss indication

On Wed, Mar 21, 2018 at 06:47:22PM +, Hanoch Haim (hhaim) wrote:
Hi All,
DPDK:17.11
When i40e is configured with RSS enabled and hash.type=toeplitz

m->hash.rss = some weird number
((m->ol_flags&PKT_RX_RSS_HASH) == PKT_RX_RSS_HASH

The hash value is correct and match the MS Toeplitz standard.

Is this expected?

I'm sorry, but I don't quite follow the question, or the problem. Are you
meaning to say that the hash value is incorrect, or that the flag is not being
set or something else?

/Bruce


The above works fine with ixgbe/mlx5

Thanks,
Hanoh




[dpdk-dev] [PATCH v3] net/i40e: fix flow RSS configuration error

2018-03-25 Thread Wei Zhao
I40e need a protection for rss rule flow configuration
after one rule is set for a port.

Fixes: ecad87d22383 ("net/i40e: move RSS to flow API")
Signed-off-by: Wei Zhao 
Tested-by: Peng Yuan 
---
Changes in v2:

 change fixes version number.

Changes in v3:

 change ret default number.
---
 drivers/net/i40e/i40e_flow.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 16c47cf..69d1ba5 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -4385,14 +4385,15 @@ i40e_config_rss_filter_set(struct rte_eth_dev *dev,
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+   int ret;
 
if (conf->queue_region_conf) {
-   i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
+   ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
conf->queue_region_conf = 0;
} else {
-   i40e_config_rss_filter(pf, conf, 1);
+   ret = i40e_config_rss_filter(pf, conf, 1);
}
-   return 0;
+   return ret;
 }
 
 static int
@@ -4545,6 +4546,8 @@ i40e_flow_create(struct rte_eth_dev *dev,
case RTE_ETH_FILTER_HASH:
ret = i40e_config_rss_filter_set(dev,
&cons_filter.rss_conf);
+   if (ret)
+   goto free_flow;
flow->rule = &pf->rss_info;
break;
default:
-- 
2.7.5



Re: [dpdk-dev] [PATCH] net/e1000: fix flow RSS queue index error

2018-03-25 Thread Lu, Wenzhuo
Hi,

> -Original Message-
> From: Zhao1, Wei
> Sent: Wednesday, March 21, 2018 3:18 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo ; Zhao1, Wei
> 
> Subject: [PATCH] net/e1000: fix flow RSS queue index error
> 
> Igb has a bug about queue index for rss rule flow configuration when set
> redirection table.
> 
> Fixes: 424ae915baf0 ("net/e1000: move RSS to flow API")
> Signed-off-by: Wei Zhao 
> Tested-by: Peng Yuan 
Acked-by: Wenzhuo Lu 


Re: [dpdk-dev] [PATCH 08/17] net/virtio: implement receive path for packed queues

2018-03-25 Thread Jason Wang



On 2018年03月16日 23:21, Jens Freimann wrote:

From: Yuanhan Liu 

Implement the receive part here. No support for mergeable buffers yet.

Signed-off-by: Jens Freimann 
Signed-off-by: Yuanhan Liu 
---
  drivers/net/virtio/virtio_ethdev.c |   5 +-
  drivers/net/virtio/virtio_ethdev.h |   2 +
  drivers/net/virtio/virtio_rxtx.c   | 134 +
  3 files changed, 140 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c 
b/drivers/net/virtio/virtio_ethdev.c
index 722a2cd..888cc49 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1352,6 +1352,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev 
*dev,
PMD_INIT_LOG(INFO, "virtio: using simple Rx path on port %u",
eth_dev->data->port_id);
eth_dev->rx_pkt_burst = virtio_recv_pkts_vec;
+   } else if (vtpci_packed_queue(hw)) {
+   eth_dev->rx_pkt_burst = &virtio_recv_pkts_packed;
} else if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
PMD_INIT_LOG(INFO,
"virtio: using mergeable buffer Rx path on port %u",
@@ -1507,7 +1509,8 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev 
*dev,
  
  	/* Setting up rx_header size for the device */

if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) ||
-   vtpci_with_feature(hw, VIRTIO_F_VERSION_1))
+   vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||
+   vtpci_with_feature(hw, VIRTIO_F_RING_PACKED))
hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf);
else
hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr);
diff --git a/drivers/net/virtio/virtio_ethdev.h 
b/drivers/net/virtio/virtio_ethdev.h
index cfefe4d..92c1c4f 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -72,6 +72,8 @@ int virtio_dev_tx_queue_setup_finish(struct rte_eth_dev *dev,
  
  uint16_t virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,

uint16_t nb_pkts);
+uint16_t virtio_recv_pkts_packed(void *rx_queue, struct rte_mbuf **rx_pkts,
+   uint16_t nb_pkts);
  
  uint16_t virtio_recv_mergeable_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,

uint16_t nb_pkts);
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index f1df004..7834747 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -31,6 +31,7 @@
  #include "virtqueue.h"
  #include "virtio_rxtx.h"
  #include "virtio_rxtx_simple.h"
+#include "virtio_ring.h"
  
  #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP

  #define VIRTIO_DUMP_PACKET(m, len) rte_pktmbuf_dump(stdout, m, len)
@@ -428,6 +429,34 @@
  
  	PMD_INIT_FUNC_TRACE();
  
+	if (vtpci_packed_queue(hw)) {

+   struct vring_desc_packed *desc;
+   struct vq_desc_extra *dxp;
+
+   for (desc_idx = 0; desc_idx < vq->vq_nentries;
+   desc_idx++) {
+   m = rte_mbuf_raw_alloc(rxvq->mpool);
+   if (unlikely(m == NULL))
+   return -ENOMEM;
+
+   dxp = &vq->vq_descx[desc_idx];
+   dxp->cookie = m;
+   dxp->ndescs = 1;
+
+   desc = &vq->vq_ring.desc_packed[desc_idx];
+   desc->addr = VIRTIO_MBUF_ADDR(m, vq) +
+   RTE_PKTMBUF_HEADROOM - hw->vtnet_hdr_size;
+   desc->len = m->buf_len - RTE_PKTMBUF_HEADROOM +
+   hw->vtnet_hdr_size;
+   desc->flags |= VRING_DESC_F_WRITE;
+   rte_smp_wmb();
+   set_desc_avail(&vq->vq_ring, desc);
+   }
+   toggle_wrap_counter(&vq->vq_ring);
+
+   return 0;
+   }
+
/* Allocate blank mbufs for the each rx descriptor */
nbufs = 0;
  
@@ -702,6 +731,111 @@

vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO6);
  }
  
+uint16_t

+virtio_recv_pkts_packed(void *rx_queue, struct rte_mbuf **rx_pkts,
+uint16_t nb_pkts)
+{
+   struct virtnet_rx *rxvq = rx_queue;
+   struct virtqueue *vq = rxvq->vq;
+   struct virtio_hw *hw = vq->hw;
+   struct rte_mbuf *rxm, *nmb;
+   uint16_t nb_rx;
+   uint32_t len;
+   uint32_t i;
+   uint32_t hdr_size;
+   int offload;
+   struct virtio_net_hdr *hdr;
+   struct vring_desc_packed *descs = vq->vq_ring.desc_packed;
+   struct vring_desc_packed *desc;
+   uint16_t used_idx = vq->vq_used_cons_idx;
+   struct vq_desc_extra *dxp;
+
+   nb_rx = 0;
+   if (unlikely(hw->started == 0))
+   return nb_rx;
+
+   hdr_size = hw->vtnet_hdr_size;
+   offload = rx_offload_enabled(hw);
+
+   for (i = 0; i < nb_pkts; i++) {
+   desc 

Re: [dpdk-dev] [PATCH 07/17] net/virtio: implement transmit path for packed queues

2018-03-25 Thread Jason Wang



On 2018年03月16日 23:21, Jens Freimann wrote:

This implements the transmit path for devices with
support for Virtio 1.1.

Add the feature bit for Virtio 1.1 and enable code to
add buffers to vring and mark descriptors as available.

This is based on a patch by Yuanhan Liu.

Signed-off-by: Jens Freiman 
---
  drivers/net/virtio/Makefile  |   1 +
  drivers/net/virtio/virtio_ethdev.c   |  11 ++-
  drivers/net/virtio/virtio_ethdev.h   |   3 +
  drivers/net/virtio/virtio_rxtx.c |   7 +-
  drivers/net/virtio/virtio_rxtx_1.1.c | 161 +++
  5 files changed, 180 insertions(+), 3 deletions(-)
  create mode 100644 drivers/net/virtio/virtio_rxtx_1.1.c

diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 6c2c996..aa1e600 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -28,6 +28,7 @@ LIBABIVER := 1
  SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c
  SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c
  SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c
+SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_1.1.c
  SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c
  SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_simple.c
  
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c

index 19536eb..722a2cd 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -383,6 +383,8 @@ struct rte_virtio_xstats_name_off {
vq->hw = hw;
vq->vq_queue_index = vtpci_queue_idx;
vq->vq_nentries = vq_size;
+   if (vtpci_packed_queue(hw))
+   vq->vq_ring.avail_wrap_counter = 1;
  
  	/*

 * Reserve a memzone for vring elements
@@ -603,7 +605,8 @@ struct rte_virtio_xstats_name_off {
}
  
  	vtpci_reset(hw);

-   virtio_dev_free_mbufs(dev);
+   if (!vtpci_packed_queue(hw))
+   virtio_dev_free_mbufs(dev);
virtio_free_queues(hw);
  }
  
@@ -1360,7 +1363,11 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,

eth_dev->rx_pkt_burst = &virtio_recv_pkts;
}
  
-	if (hw->use_simple_tx) {

+   if (vtpci_packed_queue(hw)) {
+   PMD_INIT_LOG(INFO, "virtio: using virtio 1.1 Tx path on port 
%u",
+   eth_dev->data->port_id);
+   eth_dev->tx_pkt_burst = virtio_xmit_pkts_packed;
+   } else if (hw->use_simple_tx) {
PMD_INIT_LOG(INFO, "virtio: using simple Tx path on port %u",
eth_dev->data->port_id);
eth_dev->tx_pkt_burst = virtio_xmit_pkts_simple;
diff --git a/drivers/net/virtio/virtio_ethdev.h 
b/drivers/net/virtio/virtio_ethdev.h
index 4539d2e..cfefe4d 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -36,6 +36,7 @@
 1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE |\
 1u << VIRTIO_RING_F_INDIRECT_DESC |\
 1ULL << VIRTIO_F_VERSION_1   |   \
+1ULL << VIRTIO_F_RING_PACKED |   \
 1ULL << VIRTIO_F_IOMMU_PLATFORM)
  
  #define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES	\

@@ -77,6 +78,8 @@ uint16_t virtio_recv_mergeable_pkts(void *rx_queue, struct 
rte_mbuf **rx_pkts,
  
  uint16_t virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,

uint16_t nb_pkts);
+uint16_t virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts,
+   uint16_t nb_pkts);
  
  uint16_t virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,

uint16_t nb_pkts);
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 8dbf2a3..f1df004 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -545,6 +545,10 @@
  
  	PMD_INIT_FUNC_TRACE();
  
+	if (vtpci_packed_queue(hw)) {

+   vq->vq_ring.avail_wrap_counter = 1;
+   }
+
if (hw->use_simple_tx) {
for (desc_idx = 0; desc_idx < mid_idx; desc_idx++) {
vq->vq_ring.avail->ring[desc_idx] =
@@ -565,7 +569,8 @@
vq->vq_ring.avail->ring[desc_idx] = desc_idx;
}
  
-	VIRTQUEUE_DUMP(vq);

+   if (!vtpci_packed_queue(hw))
+   VIRTQUEUE_DUMP(vq);
  
  	return 0;

  }
diff --git a/drivers/net/virtio/virtio_rxtx_1.1.c 
b/drivers/net/virtio/virtio_rxtx_1.1.c
new file mode 100644
index 000..05ec085
--- /dev/null
+++ b/drivers/net/virtio/virtio_rxtx_1.1.c
@@ -0,0 +1,161 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary 

Re: [dpdk-dev] [PATCH] net/i40e: remove unnecessary FDIR mask configuration

2018-03-25 Thread Zhang, Qi Z


> -Original Message-
> From: Rybalchenko, Kirill
> Sent: Wednesday, March 14, 2018 11:17 PM
> To: Xing, Beilei ; Zhang, Qi Z 
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/i40e: remove unnecessary FDIR mask
> configuration
> 
> 
> 
> > -Original Message-
> > From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Beilei Xing
> > Sent: Sunday 11 February 2018 07:10
> > To: Zhang, Qi Z 
> > Cc: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH] net/i40e: remove unnecessary FDIR mask
> > configuration
> >
> > Remove unnecessary FDIR mask configuration, otherwise flow directory
> > mask will be changed when configuring hash input set.
> >
> > Signed-off-by: Beilei Xing 
> > ---
> >  drivers/net/i40e/rte_pmd_i40e.c | 4 
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/drivers/net/i40e/rte_pmd_i40e.c
> > b/drivers/net/i40e/rte_pmd_i40e.c index 1288c51..b684249 100644
> > --- a/drivers/net/i40e/rte_pmd_i40e.c
> > +++ b/drivers/net/i40e/rte_pmd_i40e.c
> > @@ -3094,10 +3094,6 @@ rte_pmd_i40e_inset_set(uint16_t port, uint8_t
> > pctype,
> > return -ENOTSUP;
> > }
> >
> > -   /* Clear mask first */
> > -   for (i = 0; i < 2; i++)
> > -   i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
> > 0);
> > -
> > inset_reg = inset->inset;
> > for (i = 0; i < 2; i++)
> > mask_reg[i] = (inset->mask[i].field_idx << 16) |
> > --
> > 2.5.5
> 
> 
> Reviewed-by: Kirill Rybalchenko 
> 
> 
Acked-by: Qi Zhang 


[dpdk-dev] [PATCH v2] net/bnxt: fix flow director with same cmd different queue

2018-03-25 Thread Somnath Kotur
When user reissues same flow director cmd with a different queue
update the existing filter to redirect flow to the new desired
queue as destination just like the other filters like 5 tuple and
generic flow.

Fixes: 2d64da097aa0 ("net/bnxt: support FDIR")
Cc: ajit.khapa...@broadcom.com

Signed-off-by: Somnath Kotur 
---
v2:
* Trimmed the subject line.
* Removed some redundant comments in the code

 drivers/net/bnxt/bnxt_ethdev.c | 46 --
 1 file changed, 31 insertions(+), 15 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 21c46f8..0b21653 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2358,7 +2358,8 @@ bnxt_parse_fdir_filter(struct bnxt *bp,
 }
 
 static struct bnxt_filter_info *
-bnxt_match_fdir(struct bnxt *bp, struct bnxt_filter_info *nf)
+bnxt_match_fdir(struct bnxt *bp, struct bnxt_filter_info *nf,
+   struct bnxt_vnic_info **mvnic)
 {
struct bnxt_filter_info *mf = NULL;
int i;
@@ -2396,8 +2397,11 @@ bnxt_match_fdir(struct bnxt *bp, struct bnxt_filter_info 
*nf)
!memcmp(mf->dst_ipaddr, nf->dst_ipaddr,
sizeof(nf->dst_ipaddr)) &&
!memcmp(mf->dst_ipaddr_mask, nf->dst_ipaddr_mask,
-   sizeof(nf->dst_ipaddr_mask)))
+   sizeof(nf->dst_ipaddr_mask))) {
+   if (mvnic)
+   *mvnic = vnic;
return mf;
+   }
}
}
return NULL;
@@ -2411,7 +2415,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
struct rte_eth_fdir_filter *fdir  = (struct rte_eth_fdir_filter *)arg;
struct bnxt_filter_info *filter, *match;
-   struct bnxt_vnic_info *vnic;
+   struct bnxt_vnic_info *vnic, *mvnic;
int ret = 0, i;
 
if (filter_op == RTE_ETH_FILTER_NOP)
@@ -2423,7 +2427,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
switch (filter_op) {
case RTE_ETH_FILTER_ADD:
case RTE_ETH_FILTER_DELETE:
-   /* FALLTHROUGH */
filter = bnxt_get_unused_filter(bp);
if (filter == NULL) {
PMD_DRV_LOG(ERR,
@@ -2436,11 +2439,31 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
goto free_filter;
filter->filter_type = HWRM_CFA_NTUPLE_FILTER;
 
-   match = bnxt_match_fdir(bp, filter);
+   if (fdir->action.behavior == RTE_ETH_FDIR_REJECT)
+   vnic = STAILQ_FIRST(&bp->ff_pool[0]);
+   else
+   vnic = 
STAILQ_FIRST(&bp->ff_pool[fdir->action.rx_queue]);
+
+   match = bnxt_match_fdir(bp, filter, &mvnic);
if (match != NULL && filter_op == RTE_ETH_FILTER_ADD) {
-   PMD_DRV_LOG(ERR, "Flow already exists.\n");
-   ret = -EEXIST;
-   goto free_filter;
+   if (match->dst_id == vnic->fw_vnic_id) {
+   PMD_DRV_LOG(ERR, "Flow already exists.\n");
+   ret = -EEXIST;
+   goto free_filter;
+   } else {
+   match->dst_id = vnic->fw_vnic_id;
+   ret = bnxt_hwrm_set_ntuple_filter(bp,
+ match->dst_id,
+ match);
+   STAILQ_REMOVE(&mvnic->filter, match,
+ bnxt_filter_info, next);
+   STAILQ_INSERT_TAIL(&vnic->filter, match, next);
+   PMD_DRV_LOG(ERR,
+   "Filter with matching pattern exist\n");
+   PMD_DRV_LOG(ERR,
+   "Updated it to new destination q\n");
+   goto free_filter;
+   }
}
if (match == NULL && filter_op == RTE_ETH_FILTER_DELETE) {
PMD_DRV_LOG(ERR, "Flow does not exist.\n");
@@ -2448,12 +2471,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
goto free_filter;
}
 
-   if (fdir->action.behavior == RTE_ETH_FDIR_REJECT)
-   vnic = STAILQ_FIRST(&bp->ff_pool[0]);
-   else
-   vnic =
-   STAILQ_FIRST(&bp->ff_pool[fdir->action.rx_queue]);
-
if (filter_op == RTE_ETH_FILTER_ADD) {
ret = bnxt_hwrm_set_ntuple_filter(bp,

Re: [dpdk-dev] [PATCH v3] net/i40e: fix flow RSS configuration error

2018-03-25 Thread Zhang, Qi Z
> -Original Message-
> From: Zhao1, Wei
> Sent: Monday, March 26, 2018 9:12 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z ; Zhao1, Wei 
> Subject: [PATCH v3] net/i40e: fix flow RSS configuration error
> 
> I40e need a protection for rss rule flow configuration after one rule is set 
> for a
> port.
> 
> Fixes: ecad87d22383 ("net/i40e: move RSS to flow API")
> Signed-off-by: Wei Zhao 

Acked-by: Qi Zhang 

> Tested-by: Peng Yuan 
> ---
> Changes in v2:
> 
>  change fixes version number.
> 
> Changes in v3:
> 
>  change ret default number.
> ---
>  drivers/net/i40e/i40e_flow.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index
> 16c47cf..69d1ba5 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -4385,14 +4385,15 @@ i40e_config_rss_filter_set(struct rte_eth_dev
> *dev,  {
>   struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
>   struct i40e_hw *hw =
> I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + int ret;
> 
>   if (conf->queue_region_conf) {
> - i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
> + ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
>   conf->queue_region_conf = 0;
>   } else {
> - i40e_config_rss_filter(pf, conf, 1);
> + ret = i40e_config_rss_filter(pf, conf, 1);
>   }
> - return 0;
> + return ret;
>  }
> 
>  static int
> @@ -4545,6 +4546,8 @@ i40e_flow_create(struct rte_eth_dev *dev,
>   case RTE_ETH_FILTER_HASH:
>   ret = i40e_config_rss_filter_set(dev,
>   &cons_filter.rss_conf);
> + if (ret)
> + goto free_flow;
>   flow->rule = &pf->rss_info;
>   break;
>   default:
> --
> 2.7.5



Re: [dpdk-dev] [PATCH v3 1/7] crypto/virtio: add virtio related fundamental functions

2018-03-25 Thread Zhang, Roy Fan


> -Original Message-
> From: Jay Zhou [mailto:jianjay.z...@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo ; Zhang, Roy Fan
> ; tho...@monjalon.net;
> arei.gong...@huawei.com; Zeng, Xin ;
> weidong.hu...@huawei.com; wangxinxin.w...@huawei.com;
> longpe...@huawei.com; jianjay.z...@huawei.com
> Subject: [PATCH v3 1/7] crypto/virtio: add virtio related fundamental
> functions
> 
> Since there does not have the common virtio library, we have to put these
> files here. They are basically the same with virtio net related files with 
> some
> minor changes.
> 
> Signed-off-by: Jay Zhou 
> ---

Reviewed-by: Fan Zhang 
Acked-by: Fan Zhang 


Re: [dpdk-dev] [PATCH v3 3/7] cryptodev/virtio: core code of crypto devices

2018-03-25 Thread Zhang, Roy Fan


> -Original Message-
> From: Jay Zhou [mailto:jianjay.z...@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo ; Zhang, Roy Fan
> ; tho...@monjalon.net;
> arei.gong...@huawei.com; Zeng, Xin ;
> weidong.hu...@huawei.com; wangxinxin.w...@huawei.com;
> longpe...@huawei.com; jianjay.z...@huawei.com
> Subject: [PATCH v3 3/7] cryptodev/virtio: core code of crypto devices
> 
> The idea comes from QAT and virtio-net devices.
> 
> Signed-off-by: Jay Zhou 

Reviewed-by: Fan Zhang 
Acked-by: Fan Zhang 


Re: [dpdk-dev] [PATCH v3 6/7] cryptodev: add function tests for virtio crypto PMD

2018-03-25 Thread Zhang, Roy Fan


> -Original Message-
> From: Jay Zhou [mailto:jianjay.z...@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo ; Zhang, Roy Fan
> ; tho...@monjalon.net;
> arei.gong...@huawei.com; Zeng, Xin ;
> weidong.hu...@huawei.com; wangxinxin.w...@huawei.com;
> longpe...@huawei.com; jianjay.z...@huawei.com
> Subject: [PATCH v3 6/7] cryptodev: add function tests for virtio crypto PMD
> 
> Only RTE_CRYPTO_CIPHER_AES_CBC cipher
> algorithms are tested as unit test, it is supported both by the cryptodev-
> backend-builtin and cryptodev-vhost-user of qemu side.
> 
> Signed-off-by: Jay Zhou 

Reviewed-by: Fan Zhang 
Acked-by: Fan Zhang 


Re: [dpdk-dev] [PATCH v3 4/7] crypto/virtio: add makefile

2018-03-25 Thread Zhang, Roy Fan


> -Original Message-
> From: Jay Zhou [mailto:jianjay.z...@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo ; Zhang, Roy Fan
> ; tho...@monjalon.net;
> arei.gong...@huawei.com; Zeng, Xin ;
> weidong.hu...@huawei.com; wangxinxin.w...@huawei.com;
> longpe...@huawei.com; jianjay.z...@huawei.com
> Subject: [PATCH v3 4/7] crypto/virtio: add makefile
> 
> The virtio crypto PMD driver can be compiled now.
> 
> Signed-off-by: Jay Zhou 
> ---

Reviewed-by: Fan Zhang 
Acked-by: Fan Zhang 


Re: [dpdk-dev] [PATCH v3 5/7] cryptodev: add document for virtio crypto PMD

2018-03-25 Thread Zhang, Roy Fan


> -Original Message-
> From: Jay Zhou [mailto:jianjay.z...@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo ; Zhang, Roy Fan
> ; tho...@monjalon.net;
> arei.gong...@huawei.com; Zeng, Xin ;
> weidong.hu...@huawei.com; wangxinxin.w...@huawei.com;
> longpe...@huawei.com; jianjay.z...@huawei.com
> Subject: [PATCH v3 5/7] cryptodev: add document for virtio crypto PMD
> 
> Signed-off-by: Jay Zhou 
> ---

Reviewed-by: Fan Zhang 
Acked-by: Fan Zhang 


Re: [dpdk-dev] [PATCH v3 2/7] crpyto/virtio: add crypto related session structure

2018-03-25 Thread Zhang, Roy Fan


> -Original Message-
> From: Jay Zhou [mailto:jianjay.z...@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo ; Zhang, Roy Fan
> ; tho...@monjalon.net;
> arei.gong...@huawei.com; Zeng, Xin ;
> weidong.hu...@huawei.com; wangxinxin.w...@huawei.com;
> longpe...@huawei.com; jianjay.z...@huawei.com
> Subject: [PATCH v3 2/7] crpyto/virtio: add crypto related session structure
> 
> This structure will be used in the following patches, especially at creating 
> and
> destroying crypto sessions.
> 
> Signed-off-by: Jay Zhou 

Reviewed-by: Fan Zhang 
Acked-by: Fan Zhang d