[dpdk-dev] [PATCH v1] rte_timer:timer lag issue correction

2016-08-25 Thread Karmarkar Suyash
For Periodic timers ,if the lag gets introduced, the current code added 
additional
delay when the next peridoc timer was initialized by not taking into account 
the delay added, with this fix 
the code would start the next occurrence of timer keeping in account the lag 
added.Corrected the behavior.

Fixes:rte_timer: timer lag issue

---
 lib/librte_timer/rte_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index 43da836..18782fa 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -613,7 +613,7 @@ void rte_timer_manage(void)
status.owner = (int16_t)lcore_id;
rte_wmb();
tim->status.u32 = status.u32;
-   __rte_timer_reset(tim, cur_time + tim->period,
+   __rte_timer_reset(tim, tim->expire + tim->period,
tim->period, lcore_id, tim->f, tim->arg, 1);
rte_spinlock_unlock(_timer[lcore_id].list_lock);
}
-- 

Karmarkar Suyash (1):
  Signed-off-by: Karmarkar Suyash  
  -- 
2.9.3.windows.1



[dpdk-dev] [PATCH 0/3] Fix compability issues between crypto drivers for GCM test cases

2016-08-25 Thread Jain, Deepak K


> -Original Message-
> From: Kusztal, ArkadiuszX
> Sent: Thursday, August 25, 2016 1:03 PM
> To: dev at dpdk.org
> Cc: Trahe, Fiona ; Jain, Deepak K
> ; De Lara Guarch, Pablo
> ; Griffin, John  intel.com>;
> Kusztal, ArkadiuszX 
> Subject: [PATCH 0/3] Fix compability issues between crypto drivers for GCM
> test cases
> 
> This patchset fix pre-counter block issues between crypto divers for AES-
> GCM tests.
> Pre-counter block 96b computation from test file is moved into the AES-GCM
> PMD.
> This patch set fixes too problems with verification of digest for AES-GCM.
> 
> Arek Kusztal (3):
>   crypto/aesni_gcm: move pre-counter block to GCM driver
>   app/test: move pre-counter block computation from test files
>   app/test: fix verification of digest in GCM crypto test
> 
>  app/test/test_cryptodev.c| 20 
>  drivers/crypto/aesni_gcm/aesni_gcm_pmd.c |  7 ++-
>  2 files changed, 14 insertions(+), 13 deletions(-)
> 
> --
> 2.1.0
Acked-by: Deepak Kumar Jain 


[dpdk-dev] [PATCH v2] tools: add crypto device details

2016-08-25 Thread Jain, Deepak K


> -Original Message-
> From: Breen, Eoin
> Sent: Thursday, August 25, 2016 2:52 PM
> To: Jain, Deepak K ; Trahe, Fiona
> ; Griffin, John 
> Cc: dev at dpdk.org; Breen, Eoin 
> Subject: [PATCH v2] tools: add crypto device details
> 
> Adding the support to bind/unbind crypto devices with dpdk-devbind.py
> script, as now it is not restricted to network devices anymore.
> 
> Signed-off-by: Eoin Breen 
> ---
> Changes since v1:
> * Resolved coding issues
> 
>  tools/dpdk-devbind.py | 107
> ++
>  1 file changed, 99 insertions(+), 8 deletions(-)
> --
> 2.5.5
Acked-by: Deepak Kumar Jain 


[dpdk-dev] [PATCH] kni: bug fix in module_init and module_exit

2016-08-25 Thread 郭鹏飞


[dpdk-dev] [PATCH 2/2] crypto/qat: adding support for 3DES cipher algorithm

2016-08-25 Thread Fiona Trahe (fiona.tr...@intel.com)
From: Fiona Trahe 

3DES support added to QuickAssist PMD
With CTR and CBC mode.
Both cipher-only and chained with HMAC_SHAx

This patch depends on following patch :
  crypto/qat: enable support of Kasumi F8 in QAT cryptodev
  http://dpdk.org/dev/patchwork/patch/15277/

Signed-off-by: Fiona Trahe 
---
 doc/guides/cryptodevs/qat.rst|  4 +++-
 drivers/crypto/qat/qat_adf/qat_algs.h|  5 +
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 25 ++--
 drivers/crypto/qat/qat_crypto.c  | 17 +++-
 4 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index 7a78a1c..639a2e6 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -42,6 +42,8 @@ The QAT PMD has support for:

 Cipher algorithms:

+* ``RTE_CRYPTO_CIPHER_3DES_CBC``
+* ``RTE_CRYPTO_CIPHER_3DES_CTR``
 * ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC``
 * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC``
@@ -69,7 +71,7 @@ Limitations

 * Chained mbufs are not supported.
 * Hash only is not supported except Snow3G UIA2.
-* Cipher only is not supported except Snow3G UEA2.
+* Cipher only is not supported except Snow3G UEA2 and 3DES.
 * Only supports the session-oriented API implementation (session-less APIs are 
not supported).
 * Not performance tuned.
 * Snow3g(UEA2) supported only if cipher length, cipher offset fields are 
byte-aligned.
diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h 
b/drivers/crypto/qat/qat_adf/qat_algs.h
index 429f44f..530b9cc 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -59,6 +59,10 @@

 #define KASUMI_F8_KEY_MODIFIER_4_BYTES   0x

+/* 3DES key sizes */
+#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */
+#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */
+
 #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \
ICP_QAT_HW_CIPHER_NO_CONVERT, \
@@ -138,4 +142,5 @@ void qat_alg_ablkcipher_init_dec(struct 
qat_alg_ablkcipher_cd *cd,
 int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 #endif
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c 
b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index e131f8b..a0161cf 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -513,6 +513,10 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_KASUMI_BLK_SZ >> 3;
cipher_cd_ctrl->cipher_padding_sz =
(2 * ICP_QAT_HW_KASUMI_BLK_SZ) >> 3;
+   } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) {
+   total_key_size = ICP_QAT_HW_3DES_KEY_SZ;
+   cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_3DES_BLK_SZ >> 3;
+   proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags);
} else {
total_key_size = cipherkeylen;
cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3;
@@ -554,8 +558,12 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,

if (total_key_size > cipherkeylen) {
uint32_t padding_size =  total_key_size-cipherkeylen;
-
-   memset(cdesc->cd_cur_ptr, 0, padding_size);
+   if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES)
+   && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2))
+   /* K3 not provided so use K1 = K3*/
+   memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size);
+   else
+   memset(cdesc->cd_cur_ptr, 0, padding_size);
cdesc->cd_cur_ptr += padding_size;
}
cd_size = cdesc->cd_cur_ptr-(uint8_t *)>cd;
@@ -846,3 +854,16 @@ int qat_alg_validate_kasumi_key(int key_len, enum 
icp_qat_hw_cipher_algo *alg)
}
return 0;
 }
+
+int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
+{
+   switch (key_len) {
+   case QAT_3DES_KEY_SZ_OPT1:
+   case QAT_3DES_KEY_SZ_OPT2:
+   *alg = ICP_QAT_HW_CIPHER_ALGO_3DES;
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 67d0445..72979ca 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -482,8 +482,23 @@ 

[dpdk-dev] [PATCH 1/2] crypto/qat: code cleanup

2016-08-25 Thread Fiona Trahe (fiona.tr...@intel.com)
From: Fiona Trahe 

Cleanup of unused code.
Rename and simplify a badly named struct element, was aes, but
used for all types of ciphers
Print correct error msg (Unsupported rather than Undefined)
for all ciphers not supported by qat PMD.

Signed-off-by: Fiona Trahe 
---
 drivers/crypto/qat/qat_adf/icp_qat_hw.h  | 10 ++--
 drivers/crypto/qat/qat_adf/qat_algs.h|  1 -
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 63 +++-
 drivers/crypto/qat/qat_crypto.c  |  6 ++-
 4 files changed, 16 insertions(+), 64 deletions(-)

diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h 
b/drivers/crypto/qat/qat_adf/icp_qat_hw.h
index 4d4d8e4..a08094f 100644
--- a/drivers/crypto/qat/qat_adf/icp_qat_hw.h
+++ b/drivers/crypto/qat/qat_adf/icp_qat_hw.h
@@ -293,14 +293,12 @@ enum icp_qat_hw_cipher_convert {
 #define ICP_QAT_HW_ZUC_3G_EEA3_KEY_SZ 16
 #define ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ 16
 #define ICP_QAT_HW_MODE_F8_NUM_REG_TO_CLEAR 2
-#define INIT_SHRAM_CONSTANTS_TABLE_SZ 1024

-struct icp_qat_hw_cipher_aes256_f8 {
-   struct icp_qat_hw_cipher_config cipher_config;
-   uint8_t key[ICP_QAT_HW_AES_256_F8_KEY_SZ];
-};
+#define ICP_QAT_HW_CIPHER_MAX_KEY_SZ ICP_QAT_HW_AES_256_F8_KEY_SZ

 struct icp_qat_hw_cipher_algo_blk {
-   struct icp_qat_hw_cipher_aes256_f8 aes;
+   struct icp_qat_hw_cipher_config cipher_config;
+   uint8_t key[ICP_QAT_HW_CIPHER_MAX_KEY_SZ];
 } __rte_cache_aligned;
+
 #endif
diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h 
b/drivers/crypto/qat/qat_adf/qat_algs.h
index fad8471..429f44f 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -100,7 +100,6 @@ struct qat_session {
struct icp_qat_fw_la_bulk_req fw_req;
uint8_t aad_len;
struct qat_crypto_instance *inst;
-   uint8_t salt[ICP_QAT_HW_AES_BLK_SZ];
rte_spinlock_t lock;/* protects this struct */
 };

diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c 
b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index 9d1df56..e131f8b 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -526,7 +526,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
qat_alg_init_common_hdr(header, proto);

cipher = (struct icp_qat_hw_cipher_algo_blk *)cdesc->cd_cur_ptr;
-   cipher->aes.cipher_config.val =
+
+   cipher->cipher_config.val =
ICP_QAT_HW_CIPHER_CONFIG_BUILD(cdesc->qat_mode,
cdesc->qat_cipher_alg, key_convert,
cdesc->qat_dir);
@@ -535,7 +536,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
temp_key = (uint32_t *)(cdesc->cd_cur_ptr +
sizeof(struct icp_qat_hw_cipher_config)
+ cipherkeylen);
-   memcpy(cipher->aes.key, cipherkey, cipherkeylen);
+   memcpy(cipher->key, cipherkey, cipherkeylen);
memcpy(temp_key, cipherkey, cipherkeylen);

/* XOR Key with KASUMI F8 key modifier at 4 bytes level */
@@ -546,7 +547,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) +
cipherkeylen + cipherkeylen;
} else {
-   memcpy(cipher->aes.key, cipherkey, cipherkeylen);
+   memcpy(cipher->key, cipherkey, cipherkeylen);
cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) +
cipherkeylen;
}
@@ -728,13 +729,13 @@ int qat_alg_aead_session_create_content_desc_auth(struct 
qat_session *cdesc,

cipherconfig = (struct icp_qat_hw_cipher_algo_blk *)
(cdesc->cd_cur_ptr + state1_size + state2_size);
-   cipherconfig->aes.cipher_config.val =
+   cipherconfig->cipher_config.val =
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_ECB_MODE,
ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2,
ICP_QAT_HW_CIPHER_KEY_CONVERT,
ICP_QAT_HW_CIPHER_ENCRYPT);
-   memcpy(cipherconfig->aes.key, authkey, authkeylen);
-   memset(cipherconfig->aes.key + authkeylen,
+   memcpy(cipherconfig->key, authkey, authkeylen);
+   memset(cipherconfig->key + authkeylen,
0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ);
cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) +
authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ;
@@ -804,56 +805,6 @@ int qat_alg_aead_session_create_content_desc_auth(struct 
qat_session *cdesc,
return 0;
 }


[dpdk-dev] [PATCH 0/2] Add 3DES support to Quickassist PMD

2016-08-25 Thread Fiona Trahe (fiona.tr...@intel.com)
From: Fiona Trahe 

Some preparatory cleanup done in QAT PMD for adding 3DES
3DES support added to QuickAssist PMD With CTR and CBC mode.
Both cipher-only and chained with HMAC_SHAx

3DES test code is dependent on the libcrypto patch, 
so will be sent separately after that patch 


Fiona Trahe (2):
  crypto/qat: code cleanup
  crypto/qat: adding support for 3DES cipher algorithm

 doc/guides/cryptodevs/qat.rst|  4 +-
 drivers/crypto/qat/qat_adf/icp_qat_hw.h  | 10 ++-
 drivers/crypto/qat/qat_adf/qat_algs.h|  6 +-
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 88 
 drivers/crypto/qat/qat_crypto.c  | 23 ++-
 5 files changed, 63 insertions(+), 68 deletions(-)

-- 
2.5.0



[dpdk-dev] Huge ring allocation

2016-08-25 Thread anupam

> [2016-08-25T17:52:26+0530]: "Keith Wiles" (keith-wiles):

,[ keith-wiles ]
| Another issue sometimes is huge pages are allocated after the system
| has booted, which means you need to assign the number of huge pages very
| early in the boot process. This means adding a line in the sysctrl.conf
| file instead of poking the value later.
|
| vm.nr_hugepages=XXX
`
you might also try passing 'hugepages' option as kernel command line
parameters e.g.

   '... hugepages=N '

from linux-kernel's Documentation/vm/hugetlbpage.txt we have the
following

,[Documentation/vm/hugetlbpage.txt:69]
| The administrator can allocate persistent huge pages on the kernel boot
| command line by specifying the "hugepages=N" parameter, where 'N' = the
| number of huge pages requested.  This is the most reliable method of
| allocating huge pages as memory has not yet become fragmented.
`


---
thanks
anupam


[PATCH] kni: bug fix in module_init and module_exit unregister_XXX should be called when module exits or error occurs during module init, but register_XXX is called in case that HAVE_SIMPLIFIED_PERNET

2016-08-25 Thread Vincent Guo

---
 lib/librte_eal/linuxapp/kni/kni_misc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c 
b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 67e9b7d..d7850be 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -194,7 +194,7 @@ out:
 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 unregister_pernet_subsys(_net_ops);
 #else
-register_pernet_gen_subsys(_net_id, _net_ops);
+unregister_pernet_gen_subsys(kni_net_id, _net_ops);
 #endif
 return rc;
 }
@@ -206,7 +206,7 @@ kni_exit(void)
 #ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 unregister_pernet_subsys(_net_ops);
 #else
-register_pernet_gen_subsys(_net_id, _net_ops);
+unregister_pernet_gen_subsys(kni_net_id, _net_ops);
 #endif
 KNI_PRINT("### DPDK kni module unloaded  ###\n");
 }
-- 
1.7.1


[dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue.

2016-08-25 Thread Stephen Hemminger
On Wed, 24 Aug 2016 22:25:46 -0400
souvikdey33  wrote:

> +#The path for virtio devices are different. Get the correct path.
> + virtio = "/sys/bus/pci/devices/%s/" % dev_id
> +cmd = " ls %s | grep 'virt' " %virtio
> +virtio = commands.getoutput(cmd)

I am not a python export but in general it is better to use native language
facilities likes os.listdir() rather than using shell pipes.


[dpdk-dev] [PATCH] ethdev: add support for device offload capabilities

2016-08-25 Thread Stephen Hemminger
On Tue, 16 Apr 2013 14:42:33 +0200
Ivan Boule  wrote:

> + /* Default device offload capabilities to zero */
> + dev_info->rx_offload_capa = 0;
> + dev_info->tx_offload_capa = 0;

dev_info is already memset to 0 about 3 lines before this so this
is unnecessary.


[dpdk-dev] [PATCH] pci: fix probing blacklisted device with RTE_PCI_DRV_MULTIPLE flag

2016-08-25 Thread Stephen Hemminger
On Tue, 16 Apr 2013 10:31:48 +0200
Julien Courtat  wrote:

> + if ((dr->drv_flags & RTE_PCI_DRV_MULTIPLE) &&
> + (!dev->blacklisted)) {

parens around !dev->blacklisted are unnecessary


[dpdk-dev] Reminder: Registration for DPDK Userspace Summit 2016 - Dublin Ireland IS NOW OPEN

2016-08-25 Thread Butler, Siobhan A

Hi all,

Just a reminder to register now for DPDK Userspace Summit 2016! Call for 
submissions (presentations, lightning talks, or discussion topics) has been 
extended to September 1st - please send your proposal to dpdk.summit at 
intel.com or if you have any queries feel free 
to email me at Siobhan.a.butler at intel.com.


Following the success of DPDK Userspace Summit last October in Dublin we are 
delighted to invite you back to Userspace Summit October 2016! The two day, 
developer centric event will be run in a similar format to last year (see 
www.dpdksummit.com for past agenda and videos) and 
we hope that we will have many returning guests and many new guests at this 
event. Registration is now open at 
www.dpdksummit.com, get you're registration in early 
as places are limited to maintain the discussion and collaboration at the event 
again this year. If you have topic ideas or would like to put yourself forward 
as a speaker please don't hesitate to contact me (siobhan.a.butler at 
intel.com) or Tim O'Driscoll 
(tim.odriscoll at intel.com)
Can't wait to see you there!!

DPDK Userspace Summit 2016:

The Clayton Hotel
Ballsbridge,
 Dublin, Ireland
October 20th - 21st, 2016
9:00am - 5:30pm

Many Thanks,
Siobhan

P.S. there will be DPDKake :)


[dpdk-dev] [PATCH] kni: bug fix in module_init and module_exit

2016-08-25 Thread Ferruh Yigit
Hi Vincent,

On 8/25/2016 12:45 PM, ??? wrote:
> From 932e33f33cf2a19ac5fa4295535b6b0e20c61890 Mon Sep 17 00:00:00 2001
> From: Vincent Guo 
> Date: Thu, 25 Aug 2016 17:50:10 +0800
> Subject: [PATCH] kni: bug fix in module_init and module_exit
>  unregister_XXX should be called when module exits or error occurs
>  during module init, but register_XXX is called in case that
>  HAVE_SIMPLIFIED_PERNET_OPERATIONS is not set.
> 

Patch content is good, thanks for the fix, but patch doesn't apply
cleanly (leading spaces are missing)
Also in commit log, Signed-off-by and Fixes tags are missing.

And commit log can be simpler, something like:
"Fix pernet calls when HAVE_SIMPLIFIED_PERNET_OPERATIONS is not set."

Would you mind sending a new version of the patch?

Thanks,
ferruh



[dpdk-dev] [PATCH 3/3] lib/librte_cryptodev: change GMAC API comments

2016-08-25 Thread Arek Kusztal
File rte_crypto_sym.h GMAC API comments need to be changed
to comply to the GMAC specification. Main areas of changes is
aad pointer and aad len which now will be used to
provide plaintext.

Signed-off-by: Arek Kusztal 
---
 lib/librte_cryptodev/rte_crypto_sym.h | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/librte_cryptodev/rte_crypto_sym.h 
b/lib/librte_cryptodev/rte_crypto_sym.h
index d9bd821..770a868 100644
--- a/lib/librte_cryptodev/rte_crypto_sym.h
+++ b/lib/librte_cryptodev/rte_crypto_sym.h
@@ -307,8 +307,8 @@ struct rte_crypto_auth_xform {
 * @note
 *  For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC) mode of operation
 *  this field is not used and should be set to 0. Instead the length
-*  of the AAD data is specified in the message length to hash field of
-*  the rte_crypto_sym_op_data structure.
+*  of the AAD data is specified in additional authentication data
+*  length field of the rte_crypto_sym_op_data structure
 */
 };

@@ -482,8 +482,9 @@ struct rte_crypto_sym_op {
  * should be set instead.
  *
  * @note For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC)
- * mode of operation, this field specifies the start
- * of the AAD data in the source buffer.
+ * mode of operation, this field is set to 0. aad data
+ * pointer of rte_crypto_sym_op_data structure is
+ * used instead
  *
  * @note
  * For Snow3G @ RTE_CRYPTO_AUTH_SNOW3G_UIA2
@@ -502,8 +503,8 @@ struct rte_crypto_sym_op {
  *
  * @note
  * For AES-GMAC @ref RTE_CRYPTO_AUTH_AES_GMAC mode
- * of operation, this field specifies the length of
- * the AAD data in the source buffer.
+ * of operation, this field is set to 0.
+ * Auth.aad.length is used instead.
  *
  * @note
  * For Snow3G @ RTE_CRYPTO_AUTH_SNOW3G_UIA2
@@ -589,9 +590,7 @@ struct rte_crypto_sym_op {
 *
 * @note
 * For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC) mode of
-* operation, this field is not used and should be set
-* to 0. Instead the AAD data should be placed in the
-* source buffer.
+* operation, this field is used to pass plaintext.
 */
phys_addr_t phys_addr;  /**< physical address */
uint16_t length;/**< Length of digest */
-- 
2.1.0



[dpdk-dev] [PATCH 2/3] app/test: add GMAC authentication tests to cryptodev tests

2016-08-25 Thread Arek Kusztal
Added Galois Message Authentication Code (GMAC) tests to Cryptodev tests

Signed-off-by: Arek Kusztal 
---
 app/test/test_cryptodev.c  | 265 +
 app/test/test_cryptodev_gcm_test_vectors.h | 150 
 2 files changed, 415 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index fa16d32..d7dec2b 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -4035,8 +4035,259 @@ test_null_burst_operation(void)
return TEST_SUCCESS;
 }

+static int
+create_gmac_operation(enum rte_crypto_auth_operation op,
+   const struct gmac_test_data *tdata)
+{
+   struct crypto_testsuite_params *ts_params = _params;
+   struct crypto_unittest_params *ut_params = _params;
+   struct rte_crypto_sym_op *sym_op;
+
+   unsigned iv_pad_len;
+   unsigned aad_pad_len;
+
+   iv_pad_len = RTE_ALIGN_CEIL(tdata->iv.len, 16);
+   aad_pad_len = RTE_ALIGN_CEIL(tdata->aad.len, 16);
+
+   /* Generate Crypto op data structure */
+   ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+   RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+   TEST_ASSERT_NOT_NULL(ut_params->op,
+   "Failed to allocate symmetric crypto operation struct");
+
+   sym_op = ut_params->op->sym;
+   sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf,
+   aad_pad_len);
+   TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data,
+   "no room to append aad");
+
+   sym_op->auth.aad.length = tdata->aad.len;
+   sym_op->auth.aad.phys_addr =
+   rte_pktmbuf_mtophys(ut_params->ibuf);
+   memcpy(sym_op->auth.aad.data, tdata->aad.data, tdata->aad.len);
+
+   sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
+   ut_params->ibuf, tdata->gmac_tag.len);
+   TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
+   "no room to append digest");
+
+   sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(
+   ut_params->ibuf, aad_pad_len);
+   sym_op->auth.digest.length = tdata->gmac_tag.len;
+
+   if (op == RTE_CRYPTO_AUTH_OP_VERIFY) {
+   rte_memcpy(sym_op->auth.digest.data, tdata->gmac_tag.data,
+   tdata->gmac_tag.len);
+   TEST_HEXDUMP(stdout, "digest:",
+   sym_op->auth.digest.data,
+   sym_op->auth.digest.length);
+   }
+
+   sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(
+   ut_params->ibuf, iv_pad_len);
+   TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, "no room to prepend iv");
+
+   memset(sym_op->cipher.iv.data, 0, iv_pad_len);
+   sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
+   sym_op->cipher.iv.length = tdata->iv.len;
+
+   rte_memcpy(sym_op->cipher.iv.data, tdata->iv.data, tdata->iv.len);
+
+   TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len);
+
+   sym_op->cipher.data.length = 0;
+   sym_op->cipher.data.offset = 0;
+
+   sym_op->auth.data.offset = 0;
+   sym_op->auth.data.length = 0;
+
+   return 0;
+}
+
+static int create_gmac_session(uint8_t dev_id,
+   enum rte_crypto_cipher_operation op,
+   const struct gmac_test_data *tdata,
+   enum rte_crypto_auth_operation auth_op)
+{
+   uint8_t cipher_key[tdata->key.len];
+
+   struct crypto_unittest_params *ut_params = _params;
+
+   memcpy(cipher_key, tdata->key.data, tdata->key.len);
+
+   /* For GMAC we setup cipher parameters */
+   ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+   ut_params->cipher_xform.next = NULL;
+   ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_GCM;
+   ut_params->cipher_xform.cipher.op = op;
+   ut_params->cipher_xform.cipher.key.data = cipher_key;
+   ut_params->cipher_xform.cipher.key.length = tdata->key.len;
+
+   TEST_HEXDUMP(stdout, "key:", key, key_len);
+
+   ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
+   ut_params->auth_xform.next = NULL;
+
+   ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_AES_GMAC;
+   ut_params->auth_xform.auth.op = auth_op;
+   ut_params->auth_xform.auth.digest_length = tdata->gmac_tag.len;
+   ut_params->auth_xform.auth.add_auth_data_length = 0;
+   ut_params->auth_xform.auth.key.length = 0;
+   ut_params->auth_xform.auth.key.data = NULL;
+
+   ut_params->cipher_xform.next = _params->auth_xform;
+
+   ut_params->sess = rte_cryptodev_sym_session_create(dev_id,
+   _params->cipher_xform);
+
+   TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+
+   return 0;
+}
+
+static int
+test_AES_GMAC_authentication(const struct gmac_test_data *tdata)
+{
+   struct crypto_testsuite_params 

[dpdk-dev] [PATCH 1/3] crypto/qat: add GMAC capability to QAT crypto driver

2016-08-25 Thread Arek Kusztal
Added Galois Message Authentication Code (GMAC) capability to
QuickAssist Technology symmetric cryptographic driver.
GMAC is authentication only variant of Galois Counter Mode (GCM)
where all plaintext is provided with AAD pointer only.

Signed-off-by: Arek Kusztal 
---
 doc/guides/cryptodevs/qat.rst   |  1 +
 drivers/crypto/qat/qat_crypto.c | 42 -
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index a170474..892925b 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -64,6 +64,7 @@ Hash algorithms:
 * ``RTE_CRYPTO_AUTH_MD5_HMAC``
 * ``RTE_CRYPTO_AUTH_NULL``
 * ``RTE_CRYPTO_AUTH_KASUMI_F9``
+* ``RTE_CRYPTO_AUTH_AES_GMAC``

 Limitations
 ---
diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 8287540..0c1cc53 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -199,6 +199,31 @@ static const struct rte_cryptodev_capabilities 
qat_pmd_capabilities[] = {
}, }
}, }
},
+   {   /* AES GMAC (AUTH) */
+   .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   {.sym = {
+   .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+   {.auth = {
+   .algo = RTE_CRYPTO_AUTH_AES_GMAC,
+   .block_size = 16,
+   .key_size = {
+   .min = 16,
+   .max = 32,
+   .increment = 8
+   },
+   .digest_size = {
+   .min = 8,
+   .max = 16,
+   .increment = 4
+   },
+   .aad_size = {
+   .min = 8,
+   .max = 12,
+   .increment = 4
+   }
+   }, }
+   }, }
+   },
{   /* SNOW3G (UIA2) */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
{.sym = {
@@ -605,6 +630,9 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev 
*dev,
case RTE_CRYPTO_AUTH_AES_GCM:
session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_GALOIS_128;
break;
+   case RTE_CRYPTO_AUTH_AES_GMAC:
+   session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_GALOIS_128;
+   break;
case RTE_CRYPTO_AUTH_SNOW3G_UIA2:
session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2;
break;
@@ -624,7 +652,6 @@ qat_crypto_sym_configure_session_auth(struct rte_cryptodev 
*dev,
case RTE_CRYPTO_AUTH_SHA384:
case RTE_CRYPTO_AUTH_MD5:
case RTE_CRYPTO_AUTH_AES_CCM:
-   case RTE_CRYPTO_AUTH_AES_GMAC:
case RTE_CRYPTO_AUTH_AES_CMAC:
case RTE_CRYPTO_AUTH_AES_CBC_MAC:
case RTE_CRYPTO_AUTH_ZUC_EIA3:
@@ -891,6 +918,19 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t 
*out_msg)
qat_req->comn_hdr.serv_specif_flags,
ICP_QAT_FW_LA_GCM_IV_LEN_12_OCTETS);
}
+   if (op->sym->cipher.data.length == 0) {
+   /*
+* GMAC
+*/
+   qat_req->comn_mid.dest_data_addr =
+   qat_req->comn_mid.src_data_addr =
+   op->sym->auth.aad.phys_addr;
+   auth_param->u1.aad_adr = 0;
+   auth_param->auth_len = op->sym->auth.aad.length;
+   op->sym->auth.aad.length = 0;
+
+   }
+
}

 #ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX
-- 
2.1.0



[dpdk-dev] [PATCH 0/3] add GMAC capability Intel QAT driver

2016-08-25 Thread Arek Kusztal
This patches add AES GMAC capability to Intel(R) QuickAssist
Technology driver and corresponsing test cases.

This patchset depends on the following patches/patchsets:

"crypto/qat: enable Kasumi F9 support in QAT driver"
(http://dpdk.org/dev/patchwork/patch/15320/)

Arek Kusztal (3):
  crypto/qat: add GMAC capability to QAT crypto driver
  app/test: add GMAC authentication tests to cryptodev tests
  lib/librte_cryptodev: change GMAC API comments

 app/test/test_cryptodev.c  | 265 +
 app/test/test_cryptodev_gcm_test_vectors.h | 150 
 doc/guides/cryptodevs/qat.rst  |   1 +
 drivers/crypto/qat/qat_crypto.c|  42 -
 lib/librte_cryptodev/rte_crypto_sym.h  |  17 +-
 5 files changed, 465 insertions(+), 10 deletions(-)

-- 
2.1.0



[dpdk-dev] [PATCH 12/12] net/i40e/base: add FCoE support

2016-08-25 Thread Zhang Qi
Enable FCoE in get PHY capability.
Add data structure for FCoE statistics collection.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h |  12 +-
 drivers/net/i40e/base/i40e_type.h   | 219 
 2 files changed, 230 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 36e1569..4f06772 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1768,6 +1768,8 @@ struct i40e_aq_get_phy_abilities_resp {
 #define I40E_AQ_PHY_LINK_ENABLED   0x08
 #define I40E_AQ_PHY_AN_ENABLED 0x10
 #define I40E_AQ_PHY_FLAG_MODULE_QUAL   0x20
+#define I40E_AQ_PHY_FEC_ABILITY_KR 0x40
+#define I40E_AQ_PHY_FEC_ABILITY_RS 0x80
__le16  eee_capability;
 #define I40E_AQ_EEE_100BASE_TX 0x0002
 #define I40E_AQ_EEE_1000BASE_T 0x0004
@@ -1811,7 +1813,13 @@ struct i40e_aq_set_phy_config { /* same bits as above in 
all */
 #define I40E_AQ_PHY_TYPE_EXT_25G_CR0X02
 #define I40E_AQ_PHY_TYPE_EXT_25G_SR0x04
 #define I40E_AQ_PHY_TYPE_EXT_25G_LR0x08
-   u8  reserved[2];
+   u8  fec_config;
+#define I40E_AQ_SET_FEC_ABILITY_KR (1 << 0)
+#define I40E_AQ_SET_FEC_ABILITY_RS (1 << 1)
+#define I40E_AQ_SET_FEC_REQUEST_KR (1 << 2)
+#define I40E_AQ_SET_FEC_REQUEST_RS (1 << 3)
+#define I40E_AQ_SET_FEC_AUTO   (1 << 4)
+   u8  reserved;
 };

 I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
@@ -1901,6 +1909,8 @@ struct i40e_aqc_get_link_status {
u8  loopback; /* use defines from i40e_aqc_set_lb_mode */
__le16  max_frame_size;
u8  config;
+#define I40E_AQ_CONFIG_FEC_KR_ENA  0x01
+#define I40E_AQ_CONFIG_FEC_RS_ENA  0x02
 #define I40E_AQ_CONFIG_CRC_ENA 0x04
 #define I40E_AQ_CONFIG_PACING_MASK 0x78
u8  power_desc;
diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index de3cb2b..b5f72c3 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -1392,6 +1392,23 @@ struct i40e_veb_tc_stats {
u64 tc_tx_bytes[I40E_MAX_TRAFFIC_CLASS];
 };

+/* Statistics collected per function for FCoE */
+struct i40e_fcoe_stats {
+   u64 rx_fcoe_packets;/* fcoeprc */
+   u64 rx_fcoe_dwords; /* focedwrc */
+   u64 rx_fcoe_dropped;/* fcoerpdc */
+   u64 tx_fcoe_packets;/* fcoeptc */
+   u64 tx_fcoe_dwords; /* focedwtc */
+   u64 fcoe_bad_fccrc; /* fcoecrc */
+   u64 fcoe_last_error;/* fcoelast */
+   u64 fcoe_ddp_count; /* fcoeddpc */
+};
+
+/* offset to per function FCoE statistics block */
+#define I40E_FCOE_VF_STAT_OFFSET   0
+#define I40E_FCOE_PF_STAT_OFFSET   128
+#define I40E_FCOE_STAT_MAX (I40E_FCOE_PF_STAT_OFFSET + I40E_MAX_PF)
+
 /* Statistics collected by the MAC */
 struct i40e_hw_port_stats {
/* eth stats collected by the port */
@@ -1513,6 +1530,208 @@ struct i40e_hw_port_stats {

 #define I40E_SRRD_SRCTL_ATTEMPTS   10

+/* FCoE Tx context descriptor - Use the i40e_tx_context_desc struct */
+
+enum i40E_fcoe_tx_ctx_desc_cmd_bits {
+   I40E_FCOE_TX_CTX_DESC_OPCODE_SINGLE_SEND= 0x00, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_TSO_FC_CLASS2  = 0x01, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_TSO_FC_CLASS3  = 0x05, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_ETSO_FC_CLASS2 = 0x02, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_ETSO_FC_CLASS3 = 0x06, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_DWO_FC_CLASS2  = 0x03, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_DWO_FC_CLASS3  = 0x07, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_DDP_CTX_INVL   = 0x08, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_OPCODE_DWO_CTX_INVL   = 0x09, /* 4 BITS */
+   I40E_FCOE_TX_CTX_DESC_RELOFF= 0x10,
+   I40E_FCOE_TX_CTX_DESC_CLRSEQ= 0x20,
+   I40E_FCOE_TX_CTX_DESC_DIFENA= 0x40,
+   I40E_FCOE_TX_CTX_DESC_IL2TAG2   = 0x80
+};
+
+/* FCoE DIF/DIX Context descriptor */
+struct i40e_fcoe_difdix_context_desc {
+   __le64 flags_buff0_buff1_ref;
+   __le64 difapp_msk_bias;
+};
+
+#define I40E_FCOE_DIFDIX_CTX_QW0_FLAGS_SHIFT   0
+#define I40E_FCOE_DIFDIX_CTX_QW0_FLAGS_MASK(0xFFFULL << \
+   I40E_FCOE_DIFDIX_CTX_QW0_FLAGS_SHIFT)
+
+enum i40e_fcoe_difdix_ctx_desc_flags_bits {
+   /* 2 BITS */
+   I40E_FCOE_DIFDIX_CTX_DESC_RSVD  = 0x,
+   /* 1 BIT  */
+   I40E_FCOE_DIFDIX_CTX_DESC_APPTYPE_TAGCHK= 0x,
+   /* 1 BIT  */
+   I40E_FCOE_DIFDIX_CTX_DESC_APPTYPE_TAGNOTCHK = 0x0004,
+   /* 2 BITS */
+   I40E_FCOE_DIFDIX_CTX_DESC_GTYPE_OPAQUE   

[dpdk-dev] [PATCH 11/12] net/i40e/base: add function to get SAN MAC address

2016-08-25 Thread Zhang Qi
Add function that reads the adapter's SAN MAC address from NVM

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_common.c| 26 ++
 drivers/net/i40e/base/i40e_prototype.h |  1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 40aac06..9a6b3ed 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1189,6 +1189,32 @@ void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 
queue, bool enable)
 }

 /**
+ * i40e_get_san_mac_addr - get SAN MAC address
+ * @hw: pointer to the HW structure
+ * @mac_addr: pointer to SAN MAC address
+ *
+ * Reads the adapter's SAN MAC address from NVM
+ **/
+enum i40e_status_code i40e_get_san_mac_addr(struct i40e_hw *hw,
+   u8 *mac_addr)
+{
+   struct i40e_aqc_mac_address_read_data addrs;
+   enum i40e_status_code status;
+   u16 flags = 0;
+
+   status = i40e_aq_mac_address_read(hw, , , NULL);
+   if (status)
+   return status;
+
+   if (flags & I40E_AQC_SAN_ADDR_VALID)
+   memcpy(mac_addr, _san_mac, sizeof(addrs.pf_san_mac));
+   else
+   status = I40E_ERR_INVALID_MAC_ADDR;
+
+   return status;
+}
+
+/**
  *  i40e_read_pba_string - Reads part number string from EEPROM
  *  @hw: pointer to hardware structure
  *  @pba_num: stores the part number string from the EEPROM
diff --git a/drivers/net/i40e/base/i40e_prototype.h 
b/drivers/net/i40e/base/i40e_prototype.h
index f17636b..3aab5ca 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -440,6 +440,7 @@ enum i40e_status_code i40e_get_port_mac_addr(struct i40e_hw 
*hw, u8 *mac_addr);
 enum i40e_status_code i40e_read_pba_string(struct i40e_hw *hw, u8 *pba_num,
u32 pba_num_size);
 void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable);
+enum i40e_status_code i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
 enum i40e_aq_link_speed i40e_get_link_speed(struct i40e_hw *hw);
 /* prototype for functions used for NVM access */
 enum i40e_status_code i40e_init_nvm(struct i40e_hw *hw);
-- 
2.7.4



[dpdk-dev] [PATCH 10/12] net/i40e: minor changes for clean up

2016-08-25 Thread Zhang Qi
Remove unused device ID.
Remove unused compile option.
Adjust code alignment.
Standardize macros.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_common.c | 18 --
 drivers/net/i40e/base/i40e_devids.h |  1 -
 drivers/net/i40e/base/i40e_type.h   |  6 --
 drivers/net/i40e/i40e_ethdev.c  |  1 -
 4 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index ff64dca..40aac06 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -81,7 +81,6 @@ STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw 
*hw)
case I40E_DEV_ID_1G_BASE_T_X722:
case I40E_DEV_ID_10G_BASE_T_X722:
case I40E_DEV_ID_SFP_I_X722:
-   case I40E_DEV_ID_QSFP_I_X722:
hw->mac.type = I40E_MAC_X722;
break;
 #endif
@@ -383,8 +382,7 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask 
mask, void *desc,
d_buf[j] = buf[i];
i40e_debug(hw, mask,
   "\t0x%04X  %02X %02X %02X %02X %02X %02X 
%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
-  i_sav, d_buf[0], d_buf[1],
-  d_buf[2], d_buf[3],
+  i_sav, d_buf[0], d_buf[1], d_buf[2], 
d_buf[3],
   d_buf[4], d_buf[5], d_buf[6], d_buf[7],
   d_buf[8], d_buf[9], d_buf[10], d_buf[11],
   d_buf[12], d_buf[13], d_buf[14], d_buf[15]);
@@ -3822,16 +3820,8 @@ STATIC void i40e_parse_discover_capabilities(struct 
i40e_hw *hw, void *buff,
if (p->fcoe)
i40e_debug(hw, I40E_DEBUG_ALL, "device is FCoE capable\n");

-#ifdef I40E_FCOE_ENA
-   /* Software override ensuring FCoE is disabled if npar or mfp
-* mode because it is not supported in these modes.
-*/
-   if (p->npar_enable || p->flex10_enable)
-   p->fcoe = false;
-#else
/* Always disable FCoE if compiled without the I40E_FCOE_ENA flag */
p->fcoe = false;
-#endif

/* count the enabled ports (aka the "not disabled" ports) */
hw->num_ports = 0;
@@ -5482,12 +5472,12 @@ STATIC void i40e_fix_up_geneve_vni(
u16 tnl_type;
u32 ti;

-   tnl_type = (le16_to_cpu(f[i].flags) &
+   tnl_type = (LE16_TO_CPU(f[i].flags) &
   I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK) >>
   I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT;
if (tnl_type == I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE) {
-   ti = le32_to_cpu(f[i].tenant_id);
-   f[i].tenant_id = cpu_to_le32(ti << 8);
+   ti = LE32_TO_CPU(f[i].tenant_id);
+   f[i].tenant_id = CPU_TO_LE32(ti << 8);
}
}
 }
diff --git a/drivers/net/i40e/base/i40e_devids.h 
b/drivers/net/i40e/base/i40e_devids.h
index ed73e1d..8bd5793 100644
--- a/drivers/net/i40e/base/i40e_devids.h
+++ b/drivers/net/i40e/base/i40e_devids.h
@@ -68,7 +68,6 @@ POSSIBILITY OF SUCH DAMAGE.
 #define I40E_DEV_ID_1G_BASE_T_X722 0x37D1
 #define I40E_DEV_ID_10G_BASE_T_X7220x37D2
 #define I40E_DEV_ID_SFP_I_X722 0x37D3
-#define I40E_DEV_ID_QSFP_I_X7220x37D4
 #if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
 #define I40E_DEV_ID_X722_VF0x37CD
 #define I40E_DEV_ID_X722_VF_HV 0x37D9
diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index 86c072d..de3cb2b 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -157,8 +157,10 @@ enum i40e_debug_mask {
 #define I40E_PCI_LINK_SPEED_5000   0x2
 #define I40E_PCI_LINK_SPEED_8000   0x3

-#define I40E_MDIO_STCODE   0
-#define I40E_MDIO_OPCODE_ADDRESS   0
+#define I40E_MDIO_STCODE   I40E_MASK(0, \
+ I40E_GLGEN_MSCA_STCODE_SHIFT)
+#define I40E_MDIO_OPCODE_ADDRESS   I40E_MASK(0, \
+ I40E_GLGEN_MSCA_OPCODE_SHIFT)
 #define I40E_MDIO_OPCODE_WRITE I40E_MASK(1, \
  I40E_GLGEN_MSCA_OPCODE_SHIFT)
 #define I40E_MDIO_OPCODE_READ_INC_ADDR I40E_MASK(2, \
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index d0aeb70..acc25a2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -474,7 +474,6 @@ static const struct rte_pci_id pci_id_i40e_map[] = {
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_1G_BASE_T_X722) },
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_10G_BASE_T_X722) },
{ 

[dpdk-dev] [PATCH 09/12] net/i40e/base: enable proxy cmd for x722

2016-08-25 Thread Zhang Qi
Fill the data structure for set proxying configuration
command table entry for X722

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 38 ++---
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index a1594eb..36e1569 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -475,13 +475,15 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration);
 /* Set ARP Proxy command / response (indirect 0x0104) */
 struct i40e_aqc_arp_proxy_data {
__le16  command_flags;
-#define I40E_AQ_ARP_INIT_IPV4  0x0008
-#define I40E_AQ_ARP_UNSUP_CTL  0x0010
-#define I40E_AQ_ARP_ENA0x0020
-#define I40E_AQ_ARP_ADD_IPV4   0x0040
-#define I40E_AQ_ARP_DEL_IPV4   0x0080
+#define I40E_AQ_ARP_INIT_IPV4  0x0800
+#define I40E_AQ_ARP_UNSUP_CTL  0x1000
+#define I40E_AQ_ARP_ENA0x2000
+#define I40E_AQ_ARP_ADD_IPV4   0x4000
+#define I40E_AQ_ARP_DEL_IPV4   0x8000
__le16  table_id;
-   __le32  pfpm_proxyfc;
+   __le32  enabled_offloads;
+#define I40E_AQ_ARP_DIRECTED_OFFLOAD_ENABLE0x0020
+#define I40E_AQ_ARP_OFFLOAD_ENABLE 0x0800
__le32  ip_addr;
u8  mac_addr[6];
u8  reserved[2];
@@ -496,17 +498,19 @@ struct i40e_aqc_ns_proxy_data {
__le16  table_idx_ipv6_0;
__le16  table_idx_ipv6_1;
__le16  control;
-#define I40E_AQ_NS_PROXY_ADD_0 0x0100
-#define I40E_AQ_NS_PROXY_DEL_0 0x0200
-#define I40E_AQ_NS_PROXY_ADD_1 0x0400
-#define I40E_AQ_NS_PROXY_DEL_1 0x0800
-#define I40E_AQ_NS_PROXY_ADD_IPV6_00x1000
-#define I40E_AQ_NS_PROXY_DEL_IPV6_00x2000
-#define I40E_AQ_NS_PROXY_ADD_IPV6_10x4000
-#define I40E_AQ_NS_PROXY_DEL_IPV6_10x8000
-#define I40E_AQ_NS_PROXY_COMMAND_SEQ   0x0001
-#define I40E_AQ_NS_PROXY_INIT_IPV6_TBL 0x0002
-#define I40E_AQ_NS_PROXY_INIT_MAC_TBL  0x0004
+#define I40E_AQ_NS_PROXY_ADD_0 0x0001
+#define I40E_AQ_NS_PROXY_DEL_0 0x0002
+#define I40E_AQ_NS_PROXY_ADD_1 0x0004
+#define I40E_AQ_NS_PROXY_DEL_1 0x0008
+#define I40E_AQ_NS_PROXY_ADD_IPV6_00x0010
+#define I40E_AQ_NS_PROXY_DEL_IPV6_00x0020
+#define I40E_AQ_NS_PROXY_ADD_IPV6_10x0040
+#define I40E_AQ_NS_PROXY_DEL_IPV6_10x0080
+#define I40E_AQ_NS_PROXY_COMMAND_SEQ   0x0100
+#define I40E_AQ_NS_PROXY_INIT_IPV6_TBL 0x0200
+#define I40E_AQ_NS_PROXY_INIT_MAC_TBL  0x0400
+#define I40E_AQ_NS_PROXY_OFFLOAD_ENABLE0x0800
+#define I40E_AQ_NS_PROXY_DIRECTED_OFFLOAD_ENABLE   0x1000
u8  mac_addr_0[6];
u8  mac_addr_1[6];
u8  local_mac_addr[6];
-- 
2.7.4



[dpdk-dev] [PATCH 08/12] net/i40e/base: add multicast magic packet enable flag

2016-08-25 Thread Zhang Qi
Add a definiation for multicast magic packet enable flag

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 271bebe..a1594eb 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -556,6 +556,7 @@ I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data);
 /* Manage MAC Address Write Command (0x0108) */
 struct i40e_aqc_mac_address_write {
__le16  command_flags;
+#define I40E_AQC_MC_MAG_EN 0x0100
 #define I40E_AQC_WRITE_TYPE_LAA_ONLY   0x
 #define I40E_AQC_WRITE_TYPE_LAA_WOL0x4000
 #define I40E_AQC_WRITE_TYPE_PORT   0x8000
-- 
2.7.4



[dpdk-dev] [PATCH 07/12] net/i40e/base: enable set/get HMC resource profile

2016-08-25 Thread Zhang Qi
Enable admin queue command that can get or set HMC resource
profile

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 271f9b5..271bebe 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -224,6 +224,9 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_suspend_port_tx= 0x041B,
i40e_aqc_opc_resume_port_tx = 0x041C,
i40e_aqc_opc_configure_partition_bw = 0x041D,
+   /* hmc */
+   i40e_aqc_opc_query_hmc_resource_profile = 0x0500,
+   i40e_aqc_opc_set_hmc_resource_profile   = 0x0501,

/* phy commands*/
i40e_aqc_opc_get_phy_abilities  = 0x0600,
@@ -1663,6 +1666,24 @@ struct i40e_aqc_configure_partition_bw_data {

 I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data);

+/* Get and set the active HMC resource profile and status.
+ * (direct 0x0500) and (direct 0x0501)
+ */
+struct i40e_aq_get_set_hmc_resource_profile {
+   u8  pm_profile;
+   u8  pe_vf_enabled;
+   u8  reserved[14];
+};
+
+I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);
+
+enum i40e_aq_hmc_profile {
+   /* I40E_HMC_PROFILE_NO_CHANGE   = 0, reserved */
+   I40E_HMC_PROFILE_DEFAULT= 1,
+   I40E_HMC_PROFILE_FAVOR_VF   = 2,
+   I40E_HMC_PROFILE_EQUAL  = 3,
+};
+
 /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */

 /* set in param0 for get phy abilities to report qualified modules */
-- 
2.7.4



[dpdk-dev] [PATCH 06/12] net/i40e/base: enable wake on LAN for X722

2016-08-25 Thread Zhang Qi
Add macro and data structure to support wake on
LAN feature for X722.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 36 +
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 4ae4315..271f9b5 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -196,6 +196,7 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_remove_control_packet_filter   = 0x025B,
i40e_aqc_opc_add_cloud_filters  = 0x025C,
i40e_aqc_opc_remove_cloud_filters   = 0x025D,
+   i40e_aqc_opc_clear_wol_switch_filters   = 0x025E,

i40e_aqc_opc_add_mirror_rule= 0x0260,
i40e_aqc_opc_delete_mirror_rule = 0x0261,
@@ -581,9 +582,18 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_clear_pxe);
 struct i40e_aqc_set_wol_filter {
__le16 filter_index;
 #define I40E_AQC_MAX_NUM_WOL_FILTERS   8
+#define I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_SHIFT   15
+#define I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_MASK(0x1 << \
+   I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_SHIFT)
+
+#define I40E_AQC_SET_WOL_FILTER_INDEX_SHIFT0
+#define I40E_AQC_SET_WOL_FILTER_INDEX_MASK (0x7 << \
+   I40E_AQC_SET_WOL_FILTER_INDEX_SHIFT)
__le16 cmd_flags;
 #define I40E_AQC_SET_WOL_FILTER0x8000
 #define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000
+#define I40E_AQC_SET_WOL_FILTER_ACTION_CLEAR   0
+#define I40E_AQC_SET_WOL_FILTER_ACTION_SET 1
__le16 valid_flags;
 #define I40E_AQC_SET_WOL_FILTER_ACTION_VALID   0x8000
 #define I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID0x4000
@@ -594,23 +604,29 @@ struct i40e_aqc_set_wol_filter {

 I40E_CHECK_CMD_LENGTH(i40e_aqc_set_wol_filter);

+struct i40e_aqc_set_wol_filter_data {
+   u8 filter[128];
+   u8 mask[16];
+};
+
+I40E_CHECK_STRUCT_LEN(0x90, i40e_aqc_set_wol_filter_data);
+
 /* Get Wake Reason (0x0121) */

 struct i40e_aqc_get_wake_reason_completion {
u8 reserved_1[2];
__le16 wake_reason;
+#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT 0
+#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_MASK (0xFF << \
+   I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT)
+#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT  8
+#define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_MASK   (0xFF << \
+   I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT)
u8 reserved_2[12];
 };

 I40E_CHECK_CMD_LENGTH(i40e_aqc_get_wake_reason_completion);

-struct i40e_aqc_set_wol_filter_data {
-   u8 filter[128];
-   u8 mask[16];
-};
-
-I40E_CHECK_STRUCT_LEN(0x90, i40e_aqc_set_wol_filter_data);
-
 #endif /* X722_SUPPORT */
 /* Switch configuration commands (0x02xx) */

@@ -694,6 +710,8 @@ struct i40e_aqc_set_port_parameters {
 #define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS 2 /* must set! */
 #define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA   4
__le16  bad_frame_vsi;
+#define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_SHIFT 0x0
+#define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_MASK  0x3FF
__le16  default_seid;/* reserved for command */
u8  reserved[10];
 };
@@ -745,6 +763,7 @@ I40E_CHECK_STRUCT_LEN(0x10, 
i40e_aqc_switch_resource_alloc_element_resp);
 /* Set Switch Configuration (direct 0x0205) */
 struct i40e_aqc_set_switch_config {
__le16  flags;
+/* flags used for both fields below */
 #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001
 #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER   0x0002
__le16  valid_flags;
@@ -1858,11 +1877,12 @@ struct i40e_aqc_get_link_status {
u8  config;
 #define I40E_AQ_CONFIG_CRC_ENA 0x04
 #define I40E_AQ_CONFIG_PACING_MASK 0x78
-   u8  external_power_ability;
+   u8  power_desc;
 #define I40E_AQ_LINK_POWER_CLASS_1 0x00
 #define I40E_AQ_LINK_POWER_CLASS_2 0x01
 #define I40E_AQ_LINK_POWER_CLASS_3 0x02
 #define I40E_AQ_LINK_POWER_CLASS_4 0x03
+#define I40E_AQ_PWR_CLASS_MASK 0x03
u8  reserved[4];
 };

-- 
2.7.4



[dpdk-dev] [PATCH 05/12] net/i40e/base: enable 25G get PHY abilities

2016-08-25 Thread Zhang Qi
Add extended PHY types to get PHY abilities command response struct
for 25G, then put PHY types for 25g into the proper PHY_Type_Ext field.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 15 +--
 drivers/net/i40e/base/i40e_common.c |  4 +++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2831593..4ae4315 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1733,7 +1733,13 @@ struct i40e_aq_get_phy_abilities_resp {
__le32  eeer_val;
u8  d3_lpan;
 #define I40E_AQ_SET_PHY_D3_LPAN_ENA0x01
-   u8  reserved[3];
+   u8  phy_type_ext;
+#define I40E_AQ_PHY_TYPE_EXT_25G_KR0X01
+#define I40E_AQ_PHY_TYPE_EXT_25G_CR0X02
+#define I40E_AQ_PHY_TYPE_EXT_25G_SR0x04
+#define I40E_AQ_PHY_TYPE_EXT_25G_LR0x08
+   u8  mod_type_ext;
+   u8  ext_comp_code;
u8  phy_id[4];
u8  module_type[3];
u8  qualified_module_count;
@@ -1755,7 +1761,12 @@ struct i40e_aq_set_phy_config { /* same bits as above in 
all */
__le16  eee_capability;
__le32  eeer;
u8  low_power_ctrl;
-   u8  reserved[3];
+   u8  phy_type_ext;
+#define I40E_AQ_PHY_TYPE_EXT_25G_KR0X01
+#define I40E_AQ_PHY_TYPE_EXT_25G_CR0X02
+#define I40E_AQ_PHY_TYPE_EXT_25G_SR0x04
+#define I40E_AQ_PHY_TYPE_EXT_25G_LR0x08
+   u8  reserved[2];
 };

 I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 1de0e39..ff64dca 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -1670,8 +1670,10 @@ enum i40e_status_code 
i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
if (hw->aq.asq_last_status == I40E_AQ_RC_EIO)
status = I40E_ERR_UNKNOWN_PHY;

-   if (report_init)
+   if (report_init) {
hw->phy.phy_types = LE32_TO_CPU(abilities->phy_type);
+   hw->phy.phy_types |= ((u64)abilities->phy_type_ext << 32);
+   }

return status;
 }
-- 
2.7.4



[dpdk-dev] [PATCH 04/12] net/i40e/base: add 25G PHY capability support

2016-08-25 Thread Zhang Qi
Add PHY type macros for 25G PHY capabilities.
Change data type and bit setting defines for 25G.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 11 ++-
 drivers/net/i40e/base/i40e_type.h   |  6 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h 
b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2b7a760..2831593 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -1691,6 +1691,7 @@ enum i40e_aq_phy_type {
 #define I40E_LINK_SPEED_10GB_SHIFT 0x3
 #define I40E_LINK_SPEED_40GB_SHIFT 0x4
 #define I40E_LINK_SPEED_20GB_SHIFT 0x5
+#define I40E_LINK_SPEED_25GB_SHIFT 0x6

 enum i40e_aq_link_speed {
I40E_LINK_SPEED_UNKNOWN = 0,
@@ -1698,7 +1699,8 @@ enum i40e_aq_link_speed {
I40E_LINK_SPEED_1GB = (1 << I40E_LINK_SPEED_1000MB_SHIFT),
I40E_LINK_SPEED_10GB= (1 << I40E_LINK_SPEED_10GB_SHIFT),
I40E_LINK_SPEED_40GB= (1 << I40E_LINK_SPEED_40GB_SHIFT),
-   I40E_LINK_SPEED_20GB= (1 << I40E_LINK_SPEED_20GB_SHIFT)
+   I40E_LINK_SPEED_20GB= (1 << I40E_LINK_SPEED_20GB_SHIFT),
+   I40E_LINK_SPEED_25GB= (1 << I40E_LINK_SPEED_25GB_SHIFT),
 };

 struct i40e_aqc_module_desc {
@@ -1833,6 +1835,13 @@ struct i40e_aqc_get_link_status {
 #define I40E_AQ_LINK_TX_DRAINED0x01
 #define I40E_AQ_LINK_TX_FLUSHED0x03
 #define I40E_AQ_LINK_FORCED_40G0x10
+/* 25G Error Codes */
+#define I40E_AQ_25G_NO_ERR 0X00
+#define I40E_AQ_25G_NOT_PRESENT0X01
+#define I40E_AQ_25G_NVM_CRC_ERR0X02
+#define I40E_AQ_25G_SBUS_UCODE_ERR 0X03
+#define I40E_AQ_25G_SERDES_UCODE_ERR   0X04
+#define I40E_AQ_25G_NIMB_UCODE_ERR 0X05
u8  loopback; /* use defines from i40e_aqc_set_lb_mode */
__le16  max_frame_size;
u8  config;
diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index 51abc37..86c072d 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -298,7 +298,7 @@ struct i40e_phy_info {
bool get_link_info;
enum i40e_media_type media_type;
/* all the phy types the NVM is capable of */
-   u32 phy_types;
+   u64 phy_types;
 };

 #define I40E_CAP_PHY_TYPE_SGMII BIT_ULL(I40E_PHY_TYPE_SGMII)
@@ -330,6 +330,10 @@ struct i40e_phy_info {
 #define I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL \
BIT_ULL(I40E_PHY_TYPE_1000BASE_T_OPTICAL)
 #define I40E_CAP_PHY_TYPE_20GBASE_KR2 BIT_ULL(I40E_PHY_TYPE_20GBASE_KR2)
+#define I40E_CAP_PHY_TYPE_25GBASE_KR BIT_ULL(I40E_AQ_PHY_TYPE_EXT_25G_KR + 32)
+#define I40E_CAP_PHY_TYPE_25GBASE_CR BIT_ULL(I40E_AQ_PHY_TYPE_EXT_25G_CR + 32)
+#define I40E_CAP_PHY_TYPE_25GBASE_SR BIT_ULL(I40E_AQ_PHY_TYPE_EXT_25G_SR + 32)
+#define I40E_CAP_PHY_TYPE_25GBASE_LR BIT_ULL(I40E_AQ_PHY_TYPE_EXT_25G_LR + 32)
 #define I40E_HW_CAP_MAX_GPIO   30
 #define I40E_HW_CAP_MDIO_PORT_MODE_MDIO0
 #define I40E_HW_CAP_MDIO_PORT_MODE_I2C 1
-- 
2.7.4



[dpdk-dev] [PATCH 03/12] net/i40e/base: define macros for PHY type cap

2016-08-25 Thread Zhang Qi
Define macros for PHY type capabilities to replace exist enum type.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_type.h | 60 +++
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_type.h 
b/drivers/net/i40e/base/i40e_type.h
index 5349419..51abc37 100644
--- a/drivers/net/i40e/base/i40e_type.h
+++ b/drivers/net/i40e/base/i40e_type.h
@@ -292,37 +292,6 @@ struct i40e_link_status {
 #define I40E_MODULE_TYPE_1000BASE_T0x08
 };

-enum i40e_aq_capabilities_phy_type {
-   I40E_CAP_PHY_TYPE_SGMII = BIT(I40E_PHY_TYPE_SGMII),
-   I40E_CAP_PHY_TYPE_1000BASE_KX   = 
BIT(I40E_PHY_TYPE_1000BASE_KX),
-   I40E_CAP_PHY_TYPE_10GBASE_KX4   = 
BIT(I40E_PHY_TYPE_10GBASE_KX4),
-   I40E_CAP_PHY_TYPE_10GBASE_KR= BIT(I40E_PHY_TYPE_10GBASE_KR),
-   I40E_CAP_PHY_TYPE_40GBASE_KR4   = 
BIT(I40E_PHY_TYPE_40GBASE_KR4),
-   I40E_CAP_PHY_TYPE_XAUI  = BIT(I40E_PHY_TYPE_XAUI),
-   I40E_CAP_PHY_TYPE_XFI   = BIT(I40E_PHY_TYPE_XFI),
-   I40E_CAP_PHY_TYPE_SFI   = BIT(I40E_PHY_TYPE_SFI),
-   I40E_CAP_PHY_TYPE_XLAUI = BIT(I40E_PHY_TYPE_XLAUI),
-   I40E_CAP_PHY_TYPE_XLPPI = BIT(I40E_PHY_TYPE_XLPPI),
-   I40E_CAP_PHY_TYPE_40GBASE_CR4_CU= 
BIT(I40E_PHY_TYPE_40GBASE_CR4_CU),
-   I40E_CAP_PHY_TYPE_10GBASE_CR1_CU= 
BIT(I40E_PHY_TYPE_10GBASE_CR1_CU),
-   I40E_CAP_PHY_TYPE_10GBASE_AOC   = 
BIT(I40E_PHY_TYPE_10GBASE_AOC),
-   I40E_CAP_PHY_TYPE_40GBASE_AOC   = 
BIT(I40E_PHY_TYPE_40GBASE_AOC),
-   I40E_CAP_PHY_TYPE_100BASE_TX= BIT(I40E_PHY_TYPE_100BASE_TX),
-   I40E_CAP_PHY_TYPE_1000BASE_T= BIT(I40E_PHY_TYPE_1000BASE_T),
-   I40E_CAP_PHY_TYPE_10GBASE_T = BIT(I40E_PHY_TYPE_10GBASE_T),
-   I40E_CAP_PHY_TYPE_10GBASE_SR= BIT(I40E_PHY_TYPE_10GBASE_SR),
-   I40E_CAP_PHY_TYPE_10GBASE_LR= BIT(I40E_PHY_TYPE_10GBASE_LR),
-   I40E_CAP_PHY_TYPE_10GBASE_SFPP_CU   = 
BIT(I40E_PHY_TYPE_10GBASE_SFPP_CU),
-   I40E_CAP_PHY_TYPE_10GBASE_CR1   = 
BIT(I40E_PHY_TYPE_10GBASE_CR1),
-   I40E_CAP_PHY_TYPE_40GBASE_CR4   = 
BIT(I40E_PHY_TYPE_40GBASE_CR4),
-   I40E_CAP_PHY_TYPE_40GBASE_SR4   = 
BIT(I40E_PHY_TYPE_40GBASE_SR4),
-   I40E_CAP_PHY_TYPE_40GBASE_LR4   = 
BIT(I40E_PHY_TYPE_40GBASE_LR4),
-   I40E_CAP_PHY_TYPE_1000BASE_SX   = 
BIT(I40E_PHY_TYPE_1000BASE_SX),
-   I40E_CAP_PHY_TYPE_1000BASE_LX   = 
BIT(I40E_PHY_TYPE_1000BASE_LX),
-   I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL= 
BIT(I40E_PHY_TYPE_1000BASE_T_OPTICAL),
-   I40E_CAP_PHY_TYPE_20GBASE_KR2   = BIT(I40E_PHY_TYPE_20GBASE_KR2)
-};
-
 struct i40e_phy_info {
struct i40e_link_status link_info;
struct i40e_link_status link_info_old;
@@ -332,6 +301,35 @@ struct i40e_phy_info {
u32 phy_types;
 };

+#define I40E_CAP_PHY_TYPE_SGMII BIT_ULL(I40E_PHY_TYPE_SGMII)
+#define I40E_CAP_PHY_TYPE_1000BASE_KX BIT_ULL(I40E_PHY_TYPE_1000BASE_KX)
+#define I40E_CAP_PHY_TYPE_10GBASE_KX4 BIT_ULL(I40E_PHY_TYPE_10GBASE_KX4)
+#define I40E_CAP_PHY_TYPE_10GBASE_KR BIT_ULL(I40E_PHY_TYPE_10GBASE_KR)
+#define I40E_CAP_PHY_TYPE_40GBASE_KR4 BIT_ULL(I40E_PHY_TYPE_40GBASE_KR4)
+#define I40E_CAP_PHY_TYPE_XAUI BIT_ULL(I40E_PHY_TYPE_XAUI)
+#define I40E_CAP_PHY_TYPE_XFI BIT_ULL(I40E_PHY_TYPE_XFI)
+#define I40E_CAP_PHY_TYPE_SFI BIT_ULL(I40E_PHY_TYPE_SFI)
+#define I40E_CAP_PHY_TYPE_XLAUI BIT_ULL(I40E_PHY_TYPE_XLAUI)
+#define I40E_CAP_PHY_TYPE_XLPPI BIT_ULL(I40E_PHY_TYPE_XLPPI)
+#define I40E_CAP_PHY_TYPE_40GBASE_CR4_CU BIT_ULL(I40E_PHY_TYPE_40GBASE_CR4_CU)
+#define I40E_CAP_PHY_TYPE_10GBASE_CR1_CU BIT_ULL(I40E_PHY_TYPE_10GBASE_CR1_CU)
+#define I40E_CAP_PHY_TYPE_10GBASE_AOC BIT_ULL(I40E_PHY_TYPE_10GBASE_AOC)
+#define I40E_CAP_PHY_TYPE_40GBASE_AOC BIT_ULL(I40E_PHY_TYPE_40GBASE_AOC)
+#define I40E_CAP_PHY_TYPE_100BASE_TX BIT_ULL(I40E_PHY_TYPE_100BASE_TX)
+#define I40E_CAP_PHY_TYPE_1000BASE_T BIT_ULL(I40E_PHY_TYPE_1000BASE_T)
+#define I40E_CAP_PHY_TYPE_10GBASE_T BIT_ULL(I40E_PHY_TYPE_10GBASE_T)
+#define I40E_CAP_PHY_TYPE_10GBASE_SR BIT_ULL(I40E_PHY_TYPE_10GBASE_SR)
+#define I40E_CAP_PHY_TYPE_10GBASE_LR BIT_ULL(I40E_PHY_TYPE_10GBASE_LR)
+#define I40E_CAP_PHY_TYPE_10GBASE_SFPP_CU 
BIT_ULL(I40E_PHY_TYPE_10GBASE_SFPP_CU)
+#define I40E_CAP_PHY_TYPE_10GBASE_CR1 BIT_ULL(I40E_PHY_TYPE_10GBASE_CR1)
+#define I40E_CAP_PHY_TYPE_40GBASE_CR4 BIT_ULL(I40E_PHY_TYPE_40GBASE_CR4)
+#define I40E_CAP_PHY_TYPE_40GBASE_SR4 BIT_ULL(I40E_PHY_TYPE_40GBASE_SR4)
+#define I40E_CAP_PHY_TYPE_40GBASE_LR4 BIT_ULL(I40E_PHY_TYPE_40GBASE_LR4)
+#define I40E_CAP_PHY_TYPE_1000BASE_SX BIT_ULL(I40E_PHY_TYPE_1000BASE_SX)
+#define I40E_CAP_PHY_TYPE_1000BASE_LX BIT_ULL(I40E_PHY_TYPE_1000BASE_LX)
+#define I40E_CAP_PHY_TYPE_1000BASE_T_OPTICAL \
+   

[dpdk-dev] [PATCH 02/12] net/i40e/base: fix UDP packet header

2016-08-25 Thread Zhang Qi
Correct Rx ptype payload layer for non_tunneled ipv6.

Fixes: 8db9e2a1b232 ("i40e: base driver")

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index a442067..1de0e39 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -773,7 +773,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
/* Non Tunneled IPv6 */
I40E_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3),
I40E_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3),
-   I40E_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY3),
+   I40E_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY4),
I40E_PTT_UNUSED_ENTRY(91),
I40E_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP,  PAY4),
I40E_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4),
-- 
2.7.4



[dpdk-dev] [PATCH 01/12] net/i40e/base: add function to clear default VSI

2016-08-25 Thread Zhang Qi
Add function that help to return the VSI to Promiscuous Unicast mode.

Signed-off-by: Zhang Qi 
---
 drivers/net/i40e/base/i40e_common.c| 28 
 drivers/net/i40e/base/i40e_prototype.h |  2 ++
 2 files changed, 30 insertions(+)

diff --git a/drivers/net/i40e/base/i40e_common.c 
b/drivers/net/i40e/base/i40e_common.c
index 98ed4b6..a442067 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -2215,6 +2215,34 @@ enum i40e_status_code i40e_aq_set_default_vsi(struct 
i40e_hw *hw,
 }

 /**
+ * i40e_aq_clear_default_vsi
+ * @hw: pointer to the hw struct
+ * @seid: vsi number
+ * @cmd_details: pointer to command details structure or NULL
+ **/
+enum i40e_status_code i40e_aq_clear_default_vsi(struct i40e_hw *hw,
+   u16 seid,
+   struct i40e_asq_cmd_details *cmd_details)
+{
+   struct i40e_aq_desc desc;
+   struct i40e_aqc_set_vsi_promiscuous_modes *cmd =
+   (struct i40e_aqc_set_vsi_promiscuous_modes *)
+   
+   enum i40e_status_code status;
+
+   i40e_fill_default_direct_cmd_desc(,
+   i40e_aqc_opc_set_vsi_promiscuous_modes);
+
+   cmd->promiscuous_flags = CPU_TO_LE16(0);
+   cmd->valid_flags = CPU_TO_LE16(I40E_AQC_SET_VSI_DEFAULT);
+   cmd->seid = CPU_TO_LE16(seid);
+
+   status = i40e_asq_send_command(hw, , NULL, 0, cmd_details);
+
+   return status;
+}
+
+/**
  * i40e_aq_set_vsi_unicast_promiscuous
  * @hw: pointer to the hw struct
  * @seid: vsi number
diff --git a/drivers/net/i40e/base/i40e_prototype.h 
b/drivers/net/i40e/base/i40e_prototype.h
index 03dda93..f17636b 100644
--- a/drivers/net/i40e/base/i40e_prototype.h
+++ b/drivers/net/i40e/base/i40e_prototype.h
@@ -124,6 +124,8 @@ enum i40e_status_code i40e_aq_set_phy_debug(struct i40e_hw 
*hw, u8 cmd_flags,
struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id,
struct i40e_asq_cmd_details *cmd_details);
+enum i40e_status_code i40e_aq_clear_default_vsi(struct i40e_hw *hw, u16 vsi_id,
+   struct i40e_asq_cmd_details *cmd_details);
 enum i40e_status_code i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
bool qualified_modules, bool report_init,
struct i40e_aq_get_phy_abilities_resp *abilities,
-- 
2.7.4



[dpdk-dev] [PATCH 00/12] net/i40e: share code update

2016-08-25 Thread Zhang Qi
The patch enable 25G PHY support, 
add WoL and proxy configure feature for X722
and other features for all i40e familiy.

Zhang Qi (12):
  net/i40e/base: add function to clear default VSI
  net/i40e/base: fix UDP packet header
  net/i40e/base: define macros for PHY type caps
  net/i40e/base: add 25G PHY capability support
  net/i40e/base: enable 25G get PHY abilities
  net/i40e/base: enable wake on LAN for X722
  net/i40e/base: enable set/get HMC resource profile
  net/i40e/base: add multicast magic packet enable flag
  net/i40e/base: enable proxy cfg cmd for X722
  net/i40e: minor changes for clean up
  net/i40e/base: add function to get SAN MAC address
  net/i40e/base: add FCoE support

 drivers/net/i40e/base/i40e_adminq_cmd.h | 132 +++---
 drivers/net/i40e/base/i40e_common.c |  78 +++--
 drivers/net/i40e/base/i40e_devids.h |   1 -
 drivers/net/i40e/base/i40e_prototype.h  |   3 +
 drivers/net/i40e/base/i40e_type.h   | 295 
 drivers/net/i40e/i40e_ethdev.c  |   1 -
 6 files changed, 428 insertions(+), 82 deletions(-)

-- 
2.7.4



[dpdk-dev] [PATCH] kni: add module parameter 'bind_to_core'

2016-08-25 Thread Ferruh Yigit
Hi Vladyslav,

On 8/16/2016 7:24 PM, Vladyslav Buslov wrote:
> Allow binding KNI thread to specific core in single threaded mode.

I think this is good idea.
But I am not sure about making this a module parameter, setting core can
be more dynamic.

There is already a kni->core_id field, which is only used for
multiple_kthread mode.
What do you think moving single thread creation into kni_ioctl_create()
and use first kni->core_id to bind the thread? If there is no
kni->core_id set, it will behave as it is now.

> 
> Signed-off-by: Vladyslav Buslov 
> ---
<...>



[dpdk-dev] Permanently binding NIC ports with DPDK drivers

2016-08-25 Thread Panu Matilainen
On 08/25/2016 02:01 PM, Ferruh Yigit wrote:
> On 8/25/2016 5:57 AM, Keren Hochman wrote:
>> Hi,
>> I there a way to permanently bind a nic port when using DPDK drier with
>> kernel < 3.6 ? (In this kernel VFIO driver is not supported)?
>> Thanks, Keren
>>
>
> There was a tool from Panu for this purpose:
> http://dpdk.org/ml/archives/dev/2015-December/029500.html

Yup, but driverctl uses the newer driver_override binding feature which 
is only in kernel >= 3.16 so it's of no use with kernel < 3.6.

- Panu -



[dpdk-dev] [PATCH v2] tools: add crypto device details

2016-08-25 Thread Eoin Breen
Adding the support to bind/unbind crypto devices with
dpdk-devbind.py script, as now it is not restricted
to network devices anymore.

Signed-off-by: Eoin Breen 
---
Changes since v1:
* Resolved coding issues

 tools/dpdk-devbind.py | 107 ++
 1 file changed, 99 insertions(+), 8 deletions(-)

diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py
index b69ca2a..c7576b9 100755
--- a/tools/dpdk-devbind.py
+++ b/tools/dpdk-devbind.py
@@ -40,6 +40,7 @@ from os.path import exists, abspath, dirname, basename

 # The PCI base class for NETWORK devices
 NETWORK_BASE_CLASS = "02"
+CRYPTO_BASE_CLASS = "0b"

 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -299,6 +300,71 @@ def get_nic_details():
 devices[d]["Module_str"] = ",".join(modules)


+def get_crypto_details():
+'''This function populates the "devices" dictionary. The keys used are
+the pci addresses (domain:bus:slot.func). The values are themselves
+dictionaries - one for each NIC.'''
+global devices
+global dpdk_drivers
+
+# clear any old data
+# devices = {}
+# first loop through and read details for all devices
+# request machine readable format, with numeric IDs
+dev = {}
+dev_lines = check_output(["lspci", "-Dvmmn"]).splitlines()
+for dev_line in dev_lines:
+if (len(dev_line) == 0):
+if (dev["Class"][0:2] == CRYPTO_BASE_CLASS):
+# convert device and vendor ids to numbers, then add to global
+dev["Vendor"] = int(dev["Vendor"], 16)
+dev["Device"] = int(dev["Device"], 16)
+# use dict to make copy of dev
+devices[dev["Slot"]] = dict(dev)
+else:
+name, value = dev_line.decode().split("\t", 1)
+dev[name.rstrip(":")] = value
+# check what is the interface if any for an ssh connection if
+# any to this host, so we can mark it later.
+ssh_if = []
+route = check_output(["ip", "-o", "route"])
+# filter out all lines for 169.254 routes
+route = "\n".join(filter(lambda ln: not ln.startswith("169.254"),
+ route.decode().splitlines()))
+rt_info = route.split()
+for i in range(len(rt_info) - 1):
+if rt_info[i] == "dev":
+ssh_if.append(rt_info[i+1])
+
+# based on the basic info, get extended text details
+for d in devices.keys():
+# get additional info and add it to existing data
+devices[d] = devices[d].copy()
+devices[d].update(get_pci_device_details(d).items())
+
+for _if in ssh_if:
+if _if in devices[d]["Interface"].split(","):
+devices[d]["Ssh_if"] = True
+devices[d]["Active"] = "*Active*"
+break
+
+# add igb_uio to list of supporting modules if needed
+if "Module_str" in devices[d]:
+for driver in dpdk_drivers:
+if driver not in devices[d]["Module_str"]:
+devices[d]["Module_str"] = \
+devices[d]["Module_str"] + ",%s" % driver
+else:
+devices[d]["Module_str"] = ",".join(dpdk_drivers)
+
+# make sure the driver and module strings do not have any duplicates
+if has_driver(d):
+modules = devices[d]["Module_str"].split(",")
+if devices[d]["Driver_str"] in modules:
+modules.remove(devices[d]["Driver_str"])
+devices[d]["Module_str"] = ",".join(modules)
+
+
 def dev_id_from_dev_name(dev_name):
 '''Take a device "name" - a string passed in by user to identify a NIC
 device, and determine the device id - i.e. the domain:bus:slot.func - for
@@ -480,15 +546,16 @@ def show_status():
 dpdk_drv = []
 no_drv = []

-# split our list of devices into the three categories above
+# split our list of network devices into the three categories above
 for d in devices.keys():
-if not has_driver(d):
-no_drv.append(devices[d])
-continue
-if devices[d]["Driver_str"] in dpdk_drivers:
-dpdk_drv.append(devices[d])
-else:
-kernel_drv.append(devices[d])
+if (NETWORK_BASE_CLASS in devices[d]["Class"]):
+if not has_driver(d):
+no_drv.append(devices[d])
+continue
+if devices[d]["Driver_str"] in dpdk_drivers:
+dpdk_drv.append(devices[d])
+else:
+kernel_drv.append(devices[d])

 # print each category separately, so we can clearly see what's used by DPDK
 display_devices("Network devices using DPDK-compatible driver", dpdk_drv,
@@ -498,6 +565,28 @@ def show_status():
 "unused=%(Module_str)s %(Active)s")
 display_devices("Other network devices", no_drv, 

[dpdk-dev] dpdk 16.07, issues with rte_mempool_create and rte_kni_alloc()

2016-08-25 Thread Ferruh Yigit
On 8/10/2016 11:51 AM, Ferruh Yigit wrote:
> Hi Gopakumar,
> 
> On 8/4/2016 5:14 PM, Ferruh Yigit wrote:
>> On 8/1/2016 10:19 PM, Gopakumar Choorakkot Edakkunni wrote:
>>> Well, for my purpose I just ended up creating a seperate/smaller pool
>>> earlier during bootup to try to guarantee its from one memseg.
>>>
>>> But I am assuming that this KNI restriction is something thats "currently"
>>> not fixed and is "fixable" ? 
>>
>>
>>> Any ideas on what the summary of the reason
>>> for this restriction is - I was gonna check if I can fix that
>>
>> KNI expects all mbufs are from a physically continuous memory. This is
>> because of current address translation implementation.
>>
>> mbufs allocated in userspace and accessed from both user and kernel
>> space, so mbuf userspace virtual address needs to be converted into
>> kernelspace virtual address.
>>
>> Currently this address translation done by first calculating an offset
>> between virtual addresses using first filed of mempool, later applying
>> same offset to all mbufs. This is why all mbufs should be in physically
>> continuous memory.
>>
>> I think this address translation can be done in different way which can
>> remove the restriction, but not sure about the effect of the
>> performance. I will send a patch for this.
> 
> I have sent a patch to remove KNI restriction:
> http://dpdk.org/dev/patchwork/patch/15171/
> 
> Can you please test this patch with a mempool with multiple memzone?
> You need to remove following check in KNI manually:
> if (mp->nb_mem_chunks != 1)
> goto kni_fail;

Hi Gopakumar,

Off the list.

Any chance to test this?

Thanks,
ferruh



[dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash

2016-08-25 Thread Ferruh Yigit
Hi ZhouYates,

On 8/25/2016 2:41 PM, Ferruh Yigit wrote:
> From: ZhouYates 

I have re-sent your exact patch which was sent as attachment.
Thank you for the patch, can you please follow contribution guide for
next version of the patch? More details on:
http://dpdk.org/doc/guides/contributing/patches.html#sending-patches

> 
> Signed-off-by: ZhouYates 
> ---
>  lib/librte_eal/linuxapp/kni/kni_misc.c |4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c 
> b/lib/librte_eal/linuxapp/kni/kni_misc.c
> index 59d15ca..7ef17f5 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> @@ -448,7 +448,6 @@ kni_ioctl_create(struct net *net,
>  
>   kni = netdev_priv(net_dev);
>  
> - kni->net_dev = net_dev;
>   kni->group_id = dev_info.group_id;
>   kni->core_id = dev_info.core_id;
>   strncpy(kni->name, dev_info.name, RTE_KNI_NAMESIZE);
> @@ -561,6 +560,9 @@ kni_ioctl_create(struct net *net,
>   kni_dev_remove(kni);

But this cause allocated net_dev not freed here ...

>   return -ENODEV;
>   }
> + /*Set the kni->net_dev when the net_dev has registered success.
> +  * Avoid unregistering unregistered net_dev by kni_dev_remove.*/

Can you please use multi line comment syntax same as rest of the
document. Or perhaps first line can be enough.


> + kni->net_dev = net_dev;
>  
>  #ifdef RTE_KNI_VHOST
>   kni_vhost_init(kni);
> 



[dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash

2016-08-25 Thread Ferruh Yigit
From: ZhouYates 

Signed-off-by: ZhouYates 
---
 lib/librte_eal/linuxapp/kni/kni_misc.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c 
b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 59d15ca..7ef17f5 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -448,7 +448,6 @@ kni_ioctl_create(struct net *net,

kni = netdev_priv(net_dev);

-   kni->net_dev = net_dev;
kni->group_id = dev_info.group_id;
kni->core_id = dev_info.core_id;
strncpy(kni->name, dev_info.name, RTE_KNI_NAMESIZE);
@@ -561,6 +560,9 @@ kni_ioctl_create(struct net *net,
kni_dev_remove(kni);
return -ENODEV;
}
+   /*Set the kni->net_dev when the net_dev has registered success.
+* Avoid unregistering unregistered net_dev by kni_dev_remove.*/
+   kni->net_dev = net_dev;

 #ifdef RTE_KNI_VHOST
kni_vhost_init(kni);
-- 
1.7.1



[dpdk-dev] [PATCH v2 4/4] app/test: add kasumi f8 test into QAT testsuite

2016-08-25 Thread Deepak Kumar Jain
From: Deepak Kumar JAIN 

Signed-off-by: Deepak Kumar Jain 
---
 app/test/test_cryptodev.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index a0dae4f..fa16d32 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -4156,6 +4156,10 @@ static struct unit_test_suite cryptodev_qat_testsuite  = 
{
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_generate_test_case_6),

+   /** KASUMI encrypt only (F8) */
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_kasumi_encryption_test_case_1),
+
TEST_CASES_END() /**< NULL terminate unit test array */
}
 };
-- 
2.5.5



[dpdk-dev] [PATCH v2 3/4] crypto/qat: enable support of Kasumi F8 in QAT cryptodev

2016-08-25 Thread Deepak Kumar Jain
From: Deepak Kumar JAIN 

This patch enables the support of Kasumi F8
for Intel Quick Assist Technology.

Signed-off-by: Deepak Kumar Jain 
---
 doc/guides/cryptodevs/qat.rst|  5 +--
 drivers/crypto/qat/qat_adf/qat_algs.h|  3 +-
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 44 +---
 drivers/crypto/qat/qat_crypto.c  | 39 +++--
 4 files changed, 81 insertions(+), 10 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index 6b73d95..0502483 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -51,6 +51,7 @@ Cipher algorithms:
 * ``RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2``
 * ``RTE_CRYPTO_CIPHER_AES_GCM``
 * ``RTE_CRYPTO_CIPHER_NULL``
+* ``RTE_CRYPTO_CIPHER_KASUMI_F8``

 Hash algorithms:

@@ -70,10 +71,10 @@ Limitations

 * Chained mbufs are not supported.
 * Hash only is not supported except Snow3G UIA2 and KASUMI F9.
-* Cipher only is not supported except Snow3G UEA2.
+* Cipher only is not supported except Snow3G UEA2 and KASUMI F8.
 * Only supports the session-oriented API implementation (session-less APIs are 
not supported).
 * Not performance tuned.
-* Snow3g(UEA2) supported only if cipher length, cipher offset fields are 
byte-aligned.
+* Snow3g(UEA2) and KAUSMI(F8) supported only if cipher length, cipher offset 
fields are byte-aligned.
 * Snow3g(UIA2) and KASUMI(F9) supported only if hash length, hash offset 
fields are byte-aligned.
 * No BSD support as BSD QAT kernel driver not available.

diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h 
b/drivers/crypto/qat/qat_adf/qat_algs.h
index 0cc176f..fad8471 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -57,6 +57,7 @@
  */
 #define KASUMI_F9_KEY_MODIFIER_4_BYTES   0x

+#define KASUMI_F8_KEY_MODIFIER_4_BYTES   0x

 #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \
@@ -137,5 +138,5 @@ void qat_alg_ablkcipher_init_dec(struct 
qat_alg_ablkcipher_cd *cd,

 int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
-
+int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 #endif
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c 
b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index 085a652..9d1df56 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -457,7 +457,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
uint32_t total_key_size;
uint16_t proto = ICP_QAT_FW_LA_NO_PROTO;/* no CCM/GCM/Snow3G */
uint16_t cipher_offset, cd_size;
-
+   uint32_t wordIndex  = 0;
+   uint32_t *temp_key = NULL;
PMD_INIT_FUNC_TRACE();

if (cdesc->qat_cmd == ICP_QAT_FW_LA_CMD_CIPHER) {
@@ -507,6 +508,11 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
cipher_cd_ctrl->cipher_state_sz =
ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ >> 3;
proto = ICP_QAT_FW_LA_SNOW_3G_PROTO;
+   } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_KASUMI) {
+   total_key_size = ICP_QAT_HW_KASUMI_F8_KEY_SZ;
+   cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_KASUMI_BLK_SZ >> 3;
+   cipher_cd_ctrl->cipher_padding_sz =
+   (2 * ICP_QAT_HW_KASUMI_BLK_SZ) >> 3;
} else {
total_key_size = cipherkeylen;
cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3;
@@ -524,9 +530,27 @@ int qat_alg_aead_session_create_content_desc_cipher(struct 
qat_session *cdesc,
ICP_QAT_HW_CIPHER_CONFIG_BUILD(cdesc->qat_mode,
cdesc->qat_cipher_alg, key_convert,
cdesc->qat_dir);
-   memcpy(cipher->aes.key, cipherkey, cipherkeylen);
-   cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) +
-   cipherkeylen;
+
+   if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_KASUMI) {
+   temp_key = (uint32_t *)(cdesc->cd_cur_ptr +
+   sizeof(struct icp_qat_hw_cipher_config)
+   + cipherkeylen);
+   memcpy(cipher->aes.key, cipherkey, cipherkeylen);
+   memcpy(temp_key, cipherkey, cipherkeylen);
+
+   /* XOR Key with KASUMI F8 key modifier at 4 bytes level */
+   for (wordIndex = 0; wordIndex < (cipherkeylen >> 2);
+   wordIndex++)
+   temp_key[wordIndex] ^= KASUMI_F8_KEY_MODIFIER_4_BYTES;
+
+   

[dpdk-dev] [PATCH v2 2/4] app/test: add Kasumi f9 tests in QAT test suite

2016-08-25 Thread Deepak Kumar Jain
From: Deepak Kumar JAIN 

This patch adds Kausmi f9 tests in the QAT tesuite and add
an additional test for Kasumi F9.

Signed-off-by: Deepak Kumar Jain 
---
 app/test/test_cryptodev.c  | 12 ++
 app/test/test_cryptodev_kasumi_hash_test_vectors.h | 43 ++
 2 files changed, 55 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 67ca912..a0dae4f 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -1967,6 +1967,12 @@ test_kasumi_hash_generate_test_case_5(void)
 }

 static int
+test_kasumi_hash_generate_test_case_6(void)
+{
+   return test_kasumi_authentication(_hash_test_case_6);
+}
+
+static int
 test_kasumi_hash_verify_test_case_1(void)
 {
return test_kasumi_authentication_verify(_hash_test_case_1);
@@ -4146,6 +4152,10 @@ static struct unit_test_suite cryptodev_qat_testsuite  = 
{
TEST_CASE_ST(ut_setup, ut_teardown,
test_null_auth_cipher_operation),

+   /** KASUMI F9 Authentication only **/
+   TEST_CASE_ST(ut_setup, ut_teardown,
+   test_kasumi_hash_generate_test_case_6),
+
TEST_CASES_END() /**< NULL terminate unit test array */
}
 };
@@ -4247,6 +4257,8 @@ static struct unit_test_suite 
cryptodev_sw_kasumi_testsuite  = {
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_generate_test_case_5),
TEST_CASE_ST(ut_setup, ut_teardown,
+   test_kasumi_hash_generate_test_case_6),
+   TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_verify_test_case_1),
TEST_CASE_ST(ut_setup, ut_teardown,
test_kasumi_hash_verify_test_case_2),
diff --git a/app/test/test_cryptodev_kasumi_hash_test_vectors.h 
b/app/test/test_cryptodev_kasumi_hash_test_vectors.h
index c080b9f..fc48355 100644
--- a/app/test/test_cryptodev_kasumi_hash_test_vectors.h
+++ b/app/test/test_cryptodev_kasumi_hash_test_vectors.h
@@ -257,4 +257,47 @@ struct kasumi_hash_test_data kasumi_hash_test_case_5 = {
.len  = 4
}
 };
+struct kasumi_hash_test_data kasumi_hash_test_case_6 = {
+   .key = {
+   .data = {
+   0x83, 0xFD, 0x23, 0xA2, 0x44, 0xA7, 0x4C, 0xF3,
+   0x58, 0xDA, 0x30, 0x19, 0xF1, 0x72, 0x26, 0x35
+   },
+   .len = 16
+   },
+   .aad = {
+   .data = {
+   0x36, 0xAF, 0x61, 0x44, 0x4F, 0x30, 0x2A, 0xD2
+   },
+   .len = 8
+   },
+   .plaintext = {
+   .data = {
+   0x35, 0xC6, 0x87, 0x16, 0x63, 0x3C, 0x66, 0xFB,
+   0x75, 0x0C, 0x26, 0x68, 0x65, 0xD5, 0x3C, 0x11,
+   0xEA, 0x05, 0xB1, 0xE9, 0xFA, 0x49, 0xC8, 0x39,
+   0x8D, 0x48, 0xE1, 0xEF, 0xA5, 0x90, 0x9D, 0x39,
+   0x47, 0x90, 0x28, 0x37, 0xF5, 0xAE, 0x96, 0xD5,
+   0xA0, 0x5B, 0xC8, 0xD6, 0x1C, 0xA8, 0xDB, 0xEF,
+   0x1B, 0x13, 0xA4, 0xB4, 0xAB, 0xFE, 0x4F, 0xB1,
+   0x00, 0x60, 0x45, 0xB6, 0x74, 0xBB, 0x54, 0x72,
+   0x93, 0x04, 0xC3, 0x82, 0xBE, 0x53, 0xA5, 0xAF,
+   0x05, 0x55, 0x61, 0x76, 0xF6, 0xEA, 0xA2, 0xEF,
+   0x1D, 0x05, 0xE4, 0xB0, 0x83, 0x18, 0x1E, 0xE6,
+   0x74, 0xCD, 0xA5, 0xA4, 0x85, 0xF7, 0x4D, 0x7A,
+   0xC0
+   },
+   .len = 776
+   },
+   .validAuthLenInBits = {
+   .len = 768
+   },
+   .validAuthOffsetLenInBits = {
+   .len = 64
+   },
+   .digest = {
+   .data = {0x95, 0xAE, 0x41, 0xBA},
+   .len  = 4
+   }
+};
 #endif /* TEST_CRYPTODEV_KASUMI_HASH_TEST_VECTORS_H_ */
-- 
2.5.5



[dpdk-dev] [PATCH v2 1/4] crypto/qat: enable Kasumi F9 support in QAT driver

2016-08-25 Thread Deepak Kumar Jain
From: Deepak Kumar JAIN 

The changes in this patch enables the Kasumi F9 functionality
for Intel Quick Assist Technology

Signed-off-by: Deepak Kumar Jain 
---
 doc/guides/cryptodevs/qat.rst|  5 ++--
 drivers/crypto/qat/qat_adf/qat_algs.h|  7 ++
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 30 ++--
 drivers/crypto/qat/qat_crypto.c  | 30 +++-
 4 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index f6091dd..6b73d95 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -63,17 +63,18 @@ Hash algorithms:
 * ``RTE_CRYPTO_AUTH_SNOW3G_UIA2``
 * ``RTE_CRYPTO_AUTH_MD5_HMAC``
 * ``RTE_CRYPTO_AUTH_NULL``
+* ``RTE_CRYPTO_AUTH_KASUMI_F9``

 Limitations
 ---

 * Chained mbufs are not supported.
-* Hash only is not supported except Snow3G UIA2.
+* Hash only is not supported except Snow3G UIA2 and KASUMI F9.
 * Cipher only is not supported except Snow3G UEA2.
 * Only supports the session-oriented API implementation (session-less APIs are 
not supported).
 * Not performance tuned.
 * Snow3g(UEA2) supported only if cipher length, cipher offset fields are 
byte-aligned.
-* Snow3g(UIA2) supported only if hash length, hash offset fields are 
byte-aligned.
+* Snow3g(UIA2) and KASUMI(F9) supported only if hash length, hash offset 
fields are byte-aligned.
 * No BSD support as BSD QAT kernel driver not available.


diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h 
b/drivers/crypto/qat/qat_adf/qat_algs.h
index 6a86053..0cc176f 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs.h
+++ b/drivers/crypto/qat/qat_adf/qat_algs.h
@@ -51,6 +51,13 @@
 #include "icp_qat_fw.h"
 #include "icp_qat_fw_la.h"

+/*
+ * Key Modifier (KM) value used in Kasumi algorithm in F9 mode to XOR
+ * Integrity Key (IK)
+ */
+#define KASUMI_F9_KEY_MODIFIER_4_BYTES   0x
+
+
 #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \
ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \
ICP_QAT_HW_CIPHER_NO_CONVERT, \
diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c 
b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
index d9437bc..085a652 100644
--- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
+++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
@@ -96,6 +96,9 @@ static int qat_hash_get_state1_size(enum icp_qat_hw_auth_algo 
qat_hash_alg)
case ICP_QAT_HW_AUTH_ALGO_MD5:
return QAT_HW_ROUND_UP(ICP_QAT_HW_MD5_STATE1_SZ,
QAT_HW_DEFAULT_ALIGNMENT);
+   case ICP_QAT_HW_AUTH_ALGO_KASUMI_F9:
+   return QAT_HW_ROUND_UP(ICP_QAT_HW_KASUMI_F9_STATE1_SZ,
+   QAT_HW_DEFAULT_ALIGNMENT);
case ICP_QAT_HW_AUTH_ALGO_DELIMITER:
/* return maximum state1 size in this case */
return QAT_HW_ROUND_UP(ICP_QAT_HW_SHA512_STATE1_SZ,
@@ -559,6 +562,8 @@ int qat_alg_aead_session_create_content_desc_auth(struct 
qat_session *cdesc,
uint16_t state1_size = 0, state2_size = 0;
uint16_t hash_offset, cd_size;
uint32_t *aad_len = NULL;
+   uint32_t wordIndex  = 0;
+   uint32_t *pTempKey;

PMD_INIT_FUNC_TRACE();

@@ -605,7 +610,8 @@ int qat_alg_aead_session_create_content_desc_auth(struct 
qat_session *cdesc,
ICP_QAT_HW_AUTH_CONFIG_BUILD(ICP_QAT_HW_AUTH_MODE1,
cdesc->qat_hash_alg, digestsize);

-   if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2)
+   if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2
+   || cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_KASUMI_F9)
hash->auth_counter.counter = 0;
else
hash->auth_counter.counter = rte_bswap32(
@@ -722,12 +728,32 @@ int qat_alg_aead_session_create_content_desc_auth(struct 
qat_session *cdesc,
break;
case ICP_QAT_HW_AUTH_ALGO_NULL:
break;
+   case ICP_QAT_HW_AUTH_ALGO_KASUMI_F9:
+   state1_size = qat_hash_get_state1_size(
+   ICP_QAT_HW_AUTH_ALGO_KASUMI_F9);
+   state2_size = ICP_QAT_HW_KASUMI_F9_STATE2_SZ;
+   memset(cdesc->cd_cur_ptr, 0, state1_size + state2_size);
+   pTempKey = (uint32_t *)(cdesc->cd_cur_ptr + state1_size
+   + authkeylen);
+   /*
+   ** The Inner Hash Initial State2 block must contain IK
+   ** (Initialisation Key), followed by IK XOR-ed with KM
+   ** (Key Modifier): IK||(IK^KM).
+   **/
+   /* write the auth key */
+   memcpy(cdesc->cd_cur_ptr + state1_size, authkey, authkeylen);
+   /* initialise temp key with auth 

[dpdk-dev] [PATCH v2 0/4] add kasumi in Intel(R) QuickAssist driver

2016-08-25 Thread Deepak Kumar Jain
This patchset contains patches to enable kasumi cipher only and hash only 
functionality in Intel(R) QuickAsisst Technology Driver.

This patchset depends on following patch:
"crypto/qat: add NULL capability to Intel QAT driver"
(http://dpdk.org/dev/patchwork/patch/15230/)

Changes since V1:
* Updated Test code to apply cleanly on driver code
* Added relevant documentation

Deepak Kumar JAIN (4):
  crypto/qat: enable Kasumi F9 support in QAT driver
  app/test: add Kasumi f9 tests in QAT test suite
  crypto/qat: enable support of Kasumi F8 in QAT cryptodev
  app/test: add kasumi f8 test into QAT testsuite

 app/test/test_cryptodev.c  | 16 +
 app/test/test_cryptodev_kasumi_hash_test_vectors.h | 43 +
 doc/guides/cryptodevs/qat.rst  | 10 +--
 drivers/crypto/qat/qat_adf/qat_algs.h  | 10 ++-
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   | 74 --
 drivers/crypto/qat/qat_crypto.c| 69 ++--
 6 files changed, 207 insertions(+), 15 deletions(-)

-- 
2.5.5



[dpdk-dev] [PATCH v2] crypto/qat: add Intel QuickAssist C62x device

2016-08-25 Thread Deepak Kumar Jain
From: Deepak Kumar JAIN 

Signed-off-by: Deepak Kumar Jain 
---
Changes since V1:
Removed trialing white spaces

 doc/guides/cryptodevs/qat.rst  | 82 --
 drivers/crypto/qat/rte_qat_cryptodev.c |  3 ++
 2 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index bb62f22..f6091dd 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -27,11 +27,12 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-Quick Assist Crypto Poll Mode Driver
+Intel(R) QuickAssist (QAT) Crypto Poll Mode Driver
 

 The QAT PMD provides poll mode crypto driver support for **Intel QuickAssist
-Technology DH895xxC** hardware accelerator.
+Technology DH895xxC** and **Intel QuickAssist Technology C62x**
+hardware accelerator.


 Features
@@ -86,9 +87,13 @@ If you are running on kernel 4.4 or greater, see 
instructions for
 `Installation using kernel.org driver`_ below. If you are on a kernel earlier
 than 4.4, see `Installation using 01.org QAT driver`_.

+For **Intel QuickAssist Technology C62x** device, kernel 4.5 or greater is
+needed. See instructions for `instructions using kernel.org driver`_ below.
+

 Installation using 01.org QAT driver
 
+NOTE: There is no driver available for **Intel QuickAssist Technology C62x** 
on 01.org.

 Download the latest QuickAssist Technology Driver from `01.org
 
`_
@@ -166,6 +171,7 @@ If the build or install fails due to mismatching kernel 
sources you may need to
 Installation using kernel.org driver
 

+For **Intel QuickAssist Technology DH895xxC**:
 Assuming you are running on at least a 4.4 kernel, you can use the stock 
kernel.org QAT
 driver to start the QAT hardware.

@@ -185,9 +191,9 @@ You should see the following output::
 qat_dh895xcc5626  0
 intel_qat  82336  1 qat_dh895xcc

-Next, you need to expose the VFs using the sysfs file system.
+Next, you need to expose the Virtual Functions (VFs) using the sysfs file 
system.

-First find the bdf of the DH895xCC device::
+First find the bdf of the physical function (PF) of the DH895xCC device::

 lspci -d : 435

@@ -225,10 +231,53 @@ cd to your linux source root directory and start the qat 
kernel modules:
 ``IOMMU should be enabled for SR-IOV to work correctly``


+For **Intel QuickAssist Technology C62x**:
+Assuming you are running on at least a 4.5 kernel, you can use the stock 
kernel.org QAT
+driver to start the QAT hardware.
+
+The steps below assume you are:
+
+* Running DPDK on a platform with one ``C62x`` device.
+* On a kernel at least version 4.5.
+
+In BIOS ensure that SRIOV is enabled and VT-d is disabled.
+
+Ensure the QAT driver is loaded on your system, by executing::
+
+lsmod | grep qat
+
+You should see the following output::
+
+qat_c62x   16384  0
+intel_qat 122880  1 qat_c62x
+
+Next, you need to expose the VFs using the sysfs file system.
+
+First find the bdf of the C62x device::
+
+lspci -d:37c8
+
+You should see output similar to::
+
+1a:00.0 Co-processor: Intel Corporation Device 37c8
+3d:00.0 Co-processor: Intel Corporation Device 37c8
+3f:00.0 Co-processor: Intel Corporation Device 37c8
+
+For each c62x device there are 3 PFs.
+Using the sysfs, for each PF, enable the 16 VFs::
+
+echo 16 > /sys/bus/pci/drivers/c6xx/\:1a\:00.0/sriov_numvfs
+
+If you get an error, it's likely you're using a QAT kernel driver earlier than 
kernel 4.5.

+To verify that the VFs are available for use - use ``lspci -d:37c9`` to confirm
+the bdf of the 48 VF devices are available per ``C62x`` device.
+
+To complete the installation - follow instructions in `Binding the available 
VFs to the DPDK UIO driver`_.
 Binding the available VFs to the DPDK UIO driver
 

+For **Intel(R) QuickAssist Technology DH895xcc** device:
 The unbind command below assumes ``bdfs`` of ``03:01.00-03:04.07``, if yours 
are different adjust the unbind command below::

cd $RTE_SDK
@@ -245,3 +294,28 @@ The unbind command below assumes ``bdfs`` of 
``03:01.00-03:04.07``, if yours are
echo "8086 0443" > /sys/bus/pci/drivers/igb_uio/new_id

 You can use ``lspci -vvd:443`` to confirm that all devices are now in use by 
igb_uio kernel driver.
+
+For **Intel(R) QuickAssist Technology C62x** device:
+The unbind command below assumes ``bdfs`` of ``1a:01.00-1a:02.07``, 
``3d:01.00-3d:02.07`` and ``3f:01.00-3f:02.07``,
+if yours are different adjust the unbind command below::
+
+   cd $RTE_SDK
+   modprobe uio
+   insmod ./build/kmod/igb_uio.ko
+
+   for device in $(seq 

[dpdk-dev] [PATCH] net/bnxt: make driver less verbose

2016-08-25 Thread Ajit Khaparde
On Thu, Aug 25, 2016 at 6:05 AM, Ferruh Yigit 
wrote:

> This line printed for every application even if driver is not used at
> all. Removing the line to reduce the noise.
>
> Signed-off-by: Ferruh Yigit 
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_
> ethdev.c
> index 3795fac..37d0322 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -1056,7 +1056,6 @@ static struct eth_driver bnxt_rte_pmd = {
>
>  static int bnxt_rte_pmd_init(const char *name, const char *params
> __rte_unused)
>  {
> -   RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
>
How about changing the log level to DEBUG?

-   RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
+   RTE_LOG(DEBUG, PMD, "bnxt_rte_pmd_init() called for %s\n", name);

That should reduce the noise till the user explicitly changes the log level.

Thanks
?


> rte_eth_driver_register(_rte_pmd);
> return 0;
>  }
> --
> 2.7.4
>
>


[dpdk-dev] pthread_create fails with error code 11 (pthread_create: Cannot allocate memory)

2016-08-25 Thread Ajay Khambadkone
Let me rephrase the question. 

I just started a skeleton app that uses dpdk, did the rte_eal_init.

After that I did a pthread_create that failed, why does this happen? 

How do I get around this?

-Ajay

-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Ajay Khambadkone
Sent: Wednesday, August 24, 2016 5:14 PM
To: dev at dpdk.org
Subject: [dpdk-dev] pthread_create fails with error code 11 (pthread_create: 
Cannot allocate memory)

I am running dpdk with my existing application and after rte_eal_init, other 
inits and rte_eal_remote_launch, It end up going through my existing app that 
starts some more threads.

I do see all the rte_* ran successfully. But the pthread_create calls from my 
existing app fails with the following logs,

VMM rlimit set to 160
pthread_create: Cannot allocate memory
pthread_create: 11
movik_terminate called - program will exit


I have hugetables set up. I tried reducing the stack using ulimit -s 1024 and I 
still see the same issue.

Any idea?

-Ajay




[dpdk-dev] [PATCH 3/3] app/test: fix verification of digest in GCM crypto test

2016-08-25 Thread Arek Kusztal
This patch fixes verification of digest in test_cryptodev.c file
for AES GCM test cases

Fixes: eec136f3c54f ("aesni_gcm: add driver for AES-GCM crypto operations")

Signed-off-by: Arek Kusztal 
---
 app/test/test_cryptodev.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 227bd7d..215056f 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2988,13 +2988,13 @@ test_snow3g_encrypted_authentication_test_case_1(void)
 static int
 create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op,
const uint8_t *key, const uint8_t key_len,
-   const uint8_t aad_len, const uint8_t auth_len)
+   const uint8_t aad_len, const uint8_t auth_len,
+   enum rte_crypto_auth_operation auth_op)
 {
uint8_t cipher_key[key_len];

struct crypto_unittest_params *ut_params = _params;

-
memcpy(cipher_key, key, key_len);

/* Setup Cipher Parameters */
@@ -3002,7 +3002,7 @@ create_gcm_session(uint8_t dev_id, enum 
rte_crypto_cipher_operation op,
ut_params->cipher_xform.next = NULL;

ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_GCM;
-   ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
+   ut_params->auth_xform.auth.op = auth_op;
ut_params->cipher_xform.cipher.op = op;
ut_params->cipher_xform.cipher.key.data = cipher_key;
ut_params->cipher_xform.cipher.key.length = key_len;
@@ -3057,8 +3057,6 @@ create_gcm_operation(enum rte_crypto_cipher_operation op,

struct rte_crypto_sym_op *sym_op = ut_params->op->sym;

-
-
sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append(
ut_params->ibuf, auth_tag_len);
TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data,
@@ -3135,7 +3133,8 @@ test_mb_AES_GCM_authenticated_encryption(const struct 
gcm_test_data *tdata)
retval = create_gcm_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_ENCRYPT,
tdata->key.data, tdata->key.len,
-   tdata->aad.len, tdata->auth_tag.len);
+   tdata->aad.len, tdata->auth_tag.len,
+   RTE_CRYPTO_AUTH_OP_GENERATE);
if (retval < 0)
return retval;

@@ -3265,7 +3264,8 @@ test_mb_AES_GCM_authenticated_decryption(const struct 
gcm_test_data *tdata)
retval = create_gcm_session(ts_params->valid_devs[0],
RTE_CRYPTO_CIPHER_OP_DECRYPT,
tdata->key.data, tdata->key.len,
-   tdata->aad.len, tdata->auth_tag.len);
+   tdata->aad.len, tdata->auth_tag.len,
+   RTE_CRYPTO_AUTH_OP_VERIFY);
if (retval < 0)
return retval;

-- 
2.1.0



[dpdk-dev] [PATCH 2/3] app/test: move pre-counter block computation from test files

2016-08-25 Thread Arek Kusztal
This patch removes pre-counter block computation from
test_cryptodev.c file for AES GCM

Signed-off-by: Arek Kusztal 
---
 app/test/test_cryptodev.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 647787d..227bd7d 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3083,14 +3083,10 @@ create_gcm_operation(enum rte_crypto_cipher_operation 
op,

memset(sym_op->cipher.iv.data, 0, iv_pad_len);
sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf);
-   sym_op->cipher.iv.length = iv_pad_len;
+   sym_op->cipher.iv.length = iv_len;

rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);

-   /* CalcY0 */
-   if (iv_len != 16)
-   sym_op->cipher.iv.data[15] = 1;
-
/*
 * Always allocate the aad up to the block size.
 * The cryptodev API calls out -
-- 
2.1.0



[dpdk-dev] [PATCH 1/3] crypto/aesni_gcm: move pre-counter block to GCM driver

2016-08-25 Thread Arek Kusztal
This patch moves computing of pre-counter block into the AESNI-GCM
driver so it can be moved from test files.

Signed-off-by: Arek Kusztal 
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c 
b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dc0b033..d8b6287 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -230,11 +230,16 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp, struct 
rte_crypto_sym_op *op,
op->cipher.data.offset);

/* sanity checks */
-   if (op->cipher.iv.length != 16 && op->cipher.iv.length != 0) {
+   if (op->cipher.iv.length != 16 && op->cipher.iv.length != 12 &&
+   op->cipher.iv.length != 0) {
GCM_LOG_ERR("iv");
return -1;
}

+   if (op->cipher.iv.length == 12) {
+   op->cipher.iv.data[15] = 1;
+   }
+
if (op->auth.aad.length != 12 && op->auth.aad.length != 8 &&
op->auth.aad.length != 0) {
GCM_LOG_ERR("iv");
-- 
2.1.0



[dpdk-dev] [PATCH 0/3] Fix compability issues between crypto drivers for GCM test cases

2016-08-25 Thread Arek Kusztal
This patchset fix pre-counter block issues between crypto divers for AES-GCM 
tests.
Pre-counter block 96b computation from test file is moved into the AES-GCM PMD.
This patch set fixes too problems with verification of digest for AES-GCM.

Arek Kusztal (3):
  crypto/aesni_gcm: move pre-counter block to GCM driver
  app/test: move pre-counter block computation from test files
  app/test: fix verification of digest in GCM crypto test

 app/test/test_cryptodev.c| 20 
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c |  7 ++-
 2 files changed, 14 insertions(+), 13 deletions(-)

-- 
2.1.0



[dpdk-dev] [PATCH 3/3] kni: remove mempool number of mem chunk check

2016-08-25 Thread Ferruh Yigit
KNI supports only single mem chunk restriction is no more valid.

Signed-off-by: Ferruh Yigit 
---
 lib/librte_kni/rte_kni.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 21bf9d4..08bd999 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -412,12 +412,6 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
dev_info.sync_va = mz->addr;
dev_info.sync_phys = mz->phys_addr;

-
-   /* MBUF mempool */
-   /* KNI currently requires to have only one memory chunk */
-   if (pktmbuf_pool->nb_mem_chunks != 1)
-   goto kni_fail;
-
ctx->pktmbuf_pool = pktmbuf_pool;
ctx->group_id = conf->group_id;
ctx->slot_id = slot->id;
-- 
2.7.4



[dpdk-dev] [PATCH 2/3] kni: don't use mbuf_va and mbuf_kva

2016-08-25 Thread Ferruh Yigit
These variables was for address translation and no more used.

Signed-off-by: Ferruh Yigit 
---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 6 --
 lib/librte_kni/rte_kni.c   | 2 --
 2 files changed, 8 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c 
b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 41a331f..1efbcd7 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -458,9 +458,6 @@ kni_ioctl_create(struct net *net,
kni->sync_va = dev_info.sync_va;
kni->sync_kva = phys_to_virt(dev_info.sync_phys);

-   kni->mbuf_kva = phys_to_virt(dev_info.mbuf_phys);
-   kni->mbuf_va = dev_info.mbuf_va;
-
 #ifdef RTE_KNI_VHOST
kni->vhost_queue = NULL;
kni->vq_status = BE_STOP;
@@ -479,9 +476,6 @@ kni_ioctl_create(struct net *net,
(unsigned long long) dev_info.req_phys, kni->req_q);
KNI_PRINT("resp_phys:0x%016llx, resp_q addr:0x%p\n",
(unsigned long long) dev_info.resp_phys, kni->resp_q);
-   KNI_PRINT("mbuf_phys:0x%016llx, mbuf_kva:   0x%p\n",
-   (unsigned long long) dev_info.mbuf_phys, kni->mbuf_kva);
-   KNI_PRINT("mbuf_va:  0x%p\n", dev_info.mbuf_va);
KNI_PRINT("mbuf_size:%u\n", kni->mbuf_size);

KNI_DBG("PCI: %02x:%02x.%02x %04x:%04x\n",
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 0f7c9e5..21bf9d4 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -418,8 +418,6 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
if (pktmbuf_pool->nb_mem_chunks != 1)
goto kni_fail;

-   dev_info.mbuf_va = STAILQ_FIRST(_pool->mem_list)->addr;
-   dev_info.mbuf_phys = STAILQ_FIRST(_pool->mem_list)->phys_addr;
ctx->pktmbuf_pool = pktmbuf_pool;
ctx->group_id = conf->group_id;
ctx->slot_id = slot->id;
-- 
2.7.4



[dpdk-dev] [PATCH 1/3] kni: remove single mempool, single mem_chunk restriction

2016-08-25 Thread Ferruh Yigit
Use mempool buf_addr and buf_physaddr fields for address translation.

Since each mbuf address calculated separately, the restriction of all
mbufs should come from a continuous memory restriction is no more valid.

mbuf related FIFO's content changed, rx_q and alloc_q now carries
physical address of mbufs. tx_q and free_q content not changed, they
still carries virtual address of mbufs.

Signed-off-by: Ferruh Yigit 
---
 .../linuxapp/eal/include/exec-env/rte_kni_common.h |   3 +-
 lib/librte_eal/linuxapp/kni/kni_net.c  | 123 ++---
 lib/librte_kni/rte_kni.c   |  39 ++-
 3 files changed, 118 insertions(+), 47 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h 
b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index 2acdfd9..ea1cd0b 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -111,7 +111,8 @@ struct rte_kni_fifo {
  */
 struct rte_kni_mbuf {
void *buf_addr __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)));
-   char pad0[10];
+   uint64_t buf_physaddr;
+   char pad0[2];
uint16_t data_off;  /**< Start address of data in segment buffer. */
char pad1[2];
uint8_t nb_segs;/**< Number of segments. */
diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c 
b/lib/librte_eal/linuxapp/kni/kni_net.c
index fc82193..7d411b4 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -61,6 +61,44 @@ static int kni_net_process_request(struct kni_dev *kni,
 /* kni rx function pointer, with default to normal rx */
 static kni_net_rx_t kni_net_rx_func = kni_net_rx_normal;

+/* physical address to kernel virtual address */
+static void *
+pa2kva(void *pa)
+{
+   return phys_to_virt((unsigned long)pa);
+}
+
+/* physical address to virtual address */
+static void *
+pa2va(void *pa, struct rte_kni_mbuf *m)
+{
+   void *va;
+
+   va = (void *)((unsigned long)pa +
+   (unsigned long)m->buf_addr -
+   (unsigned long)m->buf_physaddr);
+   return va;
+}
+
+/* mbuf data kernel virtual address from mbuf kernel virtual address */
+static void *
+kva2data_kva(struct rte_kni_mbuf *m)
+{
+   return phys_to_virt(m->buf_physaddr + m->data_off);
+}
+
+/* virtual address to physical address */
+static void *
+va2pa(void *va, struct rte_kni_mbuf *m)
+{
+   void *pa;
+
+   pa = (void *)((unsigned long)va -
+   ((unsigned long)m->buf_addr -
+(unsigned long)m->buf_physaddr));
+   return pa;
+}
+
 /*
  * Open and close
  */
@@ -125,8 +163,9 @@ kni_net_rx_normal(struct kni_dev *kni)
uint32_t len;
unsigned i, num_rx, num_fq;
struct rte_kni_mbuf *kva;
-   struct rte_kni_mbuf *va[MBUF_BURST_SZ];
-   void * data_kva;
+   void *pa[MBUF_BURST_SZ];
+   void *va[MBUF_BURST_SZ];
+   void *data_kva;

struct sk_buff *skb;
struct net_device *dev = kni->net_dev;
@@ -142,17 +181,16 @@ kni_net_rx_normal(struct kni_dev *kni)
num_rx = min(num_fq, (unsigned)MBUF_BURST_SZ);

/* Burst dequeue from rx_q */
-   num_rx = kni_fifo_get(kni->rx_q, (void **)va, num_rx);
+   num_rx = kni_fifo_get(kni->rx_q, pa, num_rx);
if (num_rx == 0)
return;

/* Transfer received packets to netif */
for (i = 0; i < num_rx; i++) {
-   kva = (void *)va[i] - kni->mbuf_va + kni->mbuf_kva;
+   kva = pa2kva(pa[i]);
len = kva->pkt_len;
-
-   data_kva = kva->buf_addr + kva->data_off - kni->mbuf_va
-   + kni->mbuf_kva;
+   data_kva = kva2data_kva(kva);
+   va[i] = pa2va(pa[i], kva);

skb = dev_alloc_skb(len + 2);
if (!skb) {
@@ -178,9 +216,8 @@ kni_net_rx_normal(struct kni_dev *kni)
if (!kva->next)
break;

-   kva = kva->next - kni->mbuf_va + kni->mbuf_kva;
-   data_kva = kva->buf_addr + kva->data_off
-   - kni->mbuf_va + kni->mbuf_kva;
+   kva = pa2kva(va2pa(kva->next, kva));
+   data_kva = kva2data_kva(kva);
}
}

@@ -197,7 +234,7 @@ kni_net_rx_normal(struct kni_dev *kni)
}

/* Burst enqueue mbufs into free_q */
-   ret = kni_fifo_put(kni->free_q, (void **)va, num_rx);
+   ret = kni_fifo_put(kni->free_q, va, num_rx);
if (ret != num_rx)
/* Failing should not happen */
KNI_ERR("Fail to enqueue entries into free_q\n");
@@ -213,11 +250,13 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
uint32_t len;
unsigned i, 

[dpdk-dev] Huge ring allocation

2016-08-25 Thread Wiles, Keith

Regards,
Keith

> On Aug 25, 2016, at 1:05 AM, Gregory Etelson  wrote:
> 
> Hello,
> 
> I have a DPDK process that creates pktmbuf pool with 2_000_000 objects
> In CentOS 6.x x86-64, ring size of this pool is 16MB
> 8 2MB hugepages required to hold such ring.

Have you try to use 1G huge pages, is that an option?

> In some cases, hugepages are too fragmented and there are no 8 contiguous 
> hugepages for the ring.
> As the result, the process has enough hugepages memory, but ring allocation 
> fails.

Another issue sometimes is huge pages are allocated after the system has 
booted, which means you need to assign the number of huge pages very early in 
the boot process. This means adding a line in the sysctrl.conf file instead of 
poking the value later.

vm.nr_hugepages=XXX

> I use a workaround for these cases and create a ring with standard OS 
> allocation routines.
> Is there another way I could use unclaimed dpdk hugepages for that allocation 
> ?
> 
> Regards,
> Gregory



[dpdk-dev] [PATCH] net/bnxt: make driver less verbose

2016-08-25 Thread Ferruh Yigit
This line printed for every application even if driver is not used at
all. Removing the line to reduce the noise.

Signed-off-by: Ferruh Yigit 
---
 drivers/net/bnxt/bnxt_ethdev.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3795fac..37d0322 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1056,7 +1056,6 @@ static struct eth_driver bnxt_rte_pmd = {

 static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
 {
-   RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
rte_eth_driver_register(_rte_pmd);
return 0;
 }
-- 
2.7.4



[dpdk-dev] Permanently binding NIC ports with DPDK drivers

2016-08-25 Thread Ferruh Yigit
On 8/25/2016 5:57 AM, Keren Hochman wrote:
> Hi,
> I there a way to permanently bind a nic port when using DPDK drier with
> kernel < 3.6 ? (In this kernel VFIO driver is not supported)?
> Thanks, Keren
> 

There was a tool from Panu for this purpose:
http://dpdk.org/ml/archives/dev/2015-December/029500.html

Regards,
ferruh



[dpdk-dev] [PATCH v3 1/5] vhost: rewrite enqueue

2016-08-25 Thread Yuanhan Liu
On Mon, Aug 22, 2016 at 11:35:47AM +0200, Maxime Coquelin wrote:
> >-virtio_enqueue_offload(m, _hdr.hdr);
> >-copy_virtio_net_hdr(dev, desc_addr, virtio_hdr);
> >+/* handle virtio header */
> >+virtio_hdr = (struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)desc_addr;
> >+virtio_enqueue_offload(mbuf, &(virtio_hdr->hdr));
> Parenthesis around virtio_hdr->hdr shouldn't be needed.
> > vhost_log_write(dev, desc->addr, dev->vhost_hlen);
> >-PRINT_PACKET(dev, (uintptr_t)desc_addr, dev->vhost_hlen, 0);
> Looks like you remove the PRINT_PACKET calls.
> Does it impact performance?

Yes, it does. But it's only enabled for debug mode. Besides that,
it's just a NOOP.

> In any case, it should be mentionned in the commit message.

Agreed. But for this case, we should not remove it: it breaks the
debug-ability.

--yliu


[dpdk-dev] [PATCH v3 4/5] vhost: batch update used ring

2016-08-25 Thread Yuanhan Liu
On Fri, Aug 19, 2016 at 01:43:49AM -0400, Zhihong Wang wrote:
> This patch enables batch update of the used ring for better efficiency.
> 
> Signed-off-by: Zhihong Wang 
...
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index 1785695..87d09fa 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -152,10 +152,14 @@ cleanup_device(struct virtio_net *dev, int destroy)
>  static void
>  free_device(struct virtio_net *dev)
>  {
> + struct vhost_virtqueue *vq;
>   uint32_t i;
>  
> - for (i = 0; i < dev->virt_qp_nb; i++)
> - rte_free(dev->virtqueue[i * VIRTIO_QNUM]);
> + for (i = 0; i < dev->virt_qp_nb; i++) {
> + vq = dev->virtqueue[i * VIRTIO_QNUM];
> + rte_free(vq->shadow_used_ring);
> + rte_free(vq);
> + }
>   rte_free(dev);
>  }
> @@ -418,13 +422,18 @@ int
>  vhost_set_vring_num(int vid, struct vhost_vring_state *state)
>  {
>   struct virtio_net *dev;
> + struct vhost_virtqueue *vq;
>  
>   dev = get_device(vid);
>   if (dev == NULL)
>   return -1;
>  
>   /* State->index refers to the queue index. The txq is 1, rxq is 0. */
> - dev->virtqueue[state->index]->size = state->num;
> + vq = dev->virtqueue[state->index];
> + vq->size = state->num;
> + vq->shadow_used_ring = rte_malloc("",
> + vq->size * sizeof(struct vring_used_elem),
> + RTE_CACHE_LINE_SIZE);

Few notes here:

- I think the typical way to not specific a string type is using NULL,
  but not "".

- You should check the return value of rte_malloc: it could fail.

- Note that free_device() is invoked only when the vhost-user connection
  is broken (say the guest is halt). However, vhost_set_vring_num() could
  be invoked many times for a connection, say when you restart testpmd
  many times. This would lead to memory leak.

  The right way is to free it on get_vring_base().

--yliu


[dpdk-dev] [PATCH 7/7] vhost: simplify features set/get

2016-08-25 Thread Maxime Coquelin


On 08/25/2016 10:36 AM, Xu, Qian Q wrote:
>
>
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Maxime Coquelin
> Sent: Thursday, August 25, 2016 3:19 PM
> To: Yuanhan Liu 
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 7/7] vhost: simplify features set/get
>
>
>
> On 08/25/2016 05:03 AM, Yuanhan Liu wrote:
>> On Wed, Aug 24, 2016 at 10:11:57AM +0200, Maxime Coquelin wrote:
>>>
>>>
>>> On 08/18/2016 10:48 AM, Yuanhan Liu wrote:
 No need to use a pointer to store/retrieve features.

 Signed-off-by: Yuanhan Liu 
 ---
 lib/librte_vhost/vhost_user.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

 diff --git a/lib/librte_vhost/vhost_user.c
 b/lib/librte_vhost/vhost_user.c index ef4a0c1..eee99e9 100644
 --- a/lib/librte_vhost/vhost_user.c
 +++ b/lib/librte_vhost/vhost_user.c
 @@ -155,23 +155,22 @@ vhost_user_reset_owner(struct virtio_net *dev)
 /*
  * The features that we support are requested.
  */
 -static int
 -vhost_user_get_features(uint64_t *pu)
 +static uint64_t
 +vhost_user_get_features(void)
 {
 -  *pu = VHOST_FEATURES;
 -  return 0;
 +  return VHOST_FEATURES;
 }
>>>
>>> This is not the topic of this series, but I wonder if it could make
>>> sense to be able to override supported features at device init time.
>>
>> Not quite sure I understood it correctly: is
>> rte_vhost_feature_disable() the answer you are looking for?
> Not really.
>
> I meant a per-device supported features, and something you could set also via 
> the vhost PMD options, without needing to recompile.
>
> But maybe it would make more sense to do it a guest level?
>
> Maxime
>
> ---Agreed, as you know we have the vhost PMD port and virtio-user PMD 
> port and we can launch both vhost/virtio on the host, but we
> Can't set the mergeable in the command line, we may need add some feature 
> settings for virtio-user interface. It will be much easier to
> Run tests or application.

I never tried virtio-user PMD on host, but my proposal should be
applicable there too.

Regards,
Maxime


[dpdk-dev] [PATCH] tools: add crypto device details

2016-08-25 Thread Eoin Breen
Adding the support to bind/unbind crypto devices with
dpdk-devbind.py script, as now it is not restricted
to network devices anymore.

Signed-off-by: Eoin Breen 
---
 tools/dpdk-devbind.py | 106 ++
 1 file changed, 98 insertions(+), 8 deletions(-)

diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py
index b69ca2a..39fc5c0 100755
--- a/tools/dpdk-devbind.py
+++ b/tools/dpdk-devbind.py
@@ -40,6 +40,7 @@ from os.path import exists, abspath, dirname, basename

 # The PCI base class for NETWORK devices
 NETWORK_BASE_CLASS = "02"
+CRYPTO_BASE_CLASS = "0b"

 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -298,6 +299,70 @@ def get_nic_details():
 modules.remove(devices[d]["Driver_str"])
 devices[d]["Module_str"] = ",".join(modules)

+def get_crypto_details():
+'''This function populates the "devices" dictionary. The keys used are
+the pci addresses (domain:bus:slot.func). The values are themselves
+dictionaries - one for each NIC.'''
+global devices
+global dpdk_drivers
+
+# clear any old data
+# devices = {}
+# first loop through and read details for all devices
+# request machine readable format, with numeric IDs
+dev = {}
+dev_lines = check_output(["lspci", "-Dvmmn"]).splitlines()
+for dev_line in dev_lines:
+if (len(dev_line) == 0):
+if (dev["Class"][0:2] == CRYPTO_BASE_CLASS):
+# convert device and vendor ids to numbers, then add to global
+dev["Vendor"] = int(dev["Vendor"], 16)
+dev["Device"] = int(dev["Device"], 16)
+# use dict to make copy of dev
+devices[dev["Slot"]] = dict(dev)
+else:
+name, value = dev_line.decode().split("\t", 1)
+dev[name.rstrip(":")] = value
+# check what is the interface if any for an ssh connection if
+# any to this host, so we can mark it later.
+ssh_if = []
+route = check_output(["ip", "-o", "route"])
+# filter out all lines for 169.254 routes
+route = "\n".join(filter(lambda ln: not ln.startswith("169.254"),
+ route.decode().splitlines()))
+rt_info = route.split()
+for i in range(len(rt_info) - 1):
+if rt_info[i] == "dev":
+ssh_if.append(rt_info[i+1])
+
+# based on the basic info, get extended text details
+for d in devices.keys():
+# get additional info and add it to existing data
+devices[d] = devices[d].copy()
+devices[d].update(get_pci_device_details(d).items())
+
+for _if in ssh_if:
+if _if in devices[d]["Interface"].split(","):
+devices[d]["Ssh_if"] = True
+devices[d]["Active"] = "*Active*"
+break
+
+# add igb_uio to list of supporting modules if needed
+if "Module_str" in devices[d]:
+for driver in dpdk_drivers:
+if driver not in devices[d]["Module_str"]:
+devices[d]["Module_str"] = \
+devices[d]["Module_str"] + ",%s" % driver
+else:
+devices[d]["Module_str"] = ",".join(dpdk_drivers)
+
+# make sure the driver and module strings do not have any duplicates
+if has_driver(d):
+modules = devices[d]["Module_str"].split(",")
+if devices[d]["Driver_str"] in modules:
+modules.remove(devices[d]["Driver_str"])
+devices[d]["Module_str"] = ",".join(modules)
+

 def dev_id_from_dev_name(dev_name):
 '''Take a device "name" - a string passed in by user to identify a NIC
@@ -480,15 +545,16 @@ def show_status():
 dpdk_drv = []
 no_drv = []

-# split our list of devices into the three categories above
+# split our list of network devices into the three categories above
 for d in devices.keys():
-if not has_driver(d):
-no_drv.append(devices[d])
-continue
-if devices[d]["Driver_str"] in dpdk_drivers:
-dpdk_drv.append(devices[d])
-else:
-kernel_drv.append(devices[d])
+if (NETWORK_BASE_CLASS in devices[d]["Class"]):
+if not has_driver(d):
+no_drv.append(devices[d])
+continue
+if devices[d]["Driver_str"] in dpdk_drivers:
+dpdk_drv.append(devices[d])
+else:
+kernel_drv.append(devices[d])

 # print each category separately, so we can clearly see what's used by DPDK
 display_devices("Network devices using DPDK-compatible driver", dpdk_drv,
@@ -498,6 +564,28 @@ def show_status():
 "unused=%(Module_str)s %(Active)s")
 display_devices("Other network devices", no_drv, "unused=%(Module_str)s")

+# split our list of crypto devices into the three 

[dpdk-dev] [PATCH 7/7] vhost: simplify features set/get

2016-08-25 Thread Yuanhan Liu
On Wed, Aug 24, 2016 at 10:11:57AM +0200, Maxime Coquelin wrote:
> 
> 
> On 08/18/2016 10:48 AM, Yuanhan Liu wrote:
> >No need to use a pointer to store/retrieve features.
> >
> >Signed-off-by: Yuanhan Liu 
> >---
> > lib/librte_vhost/vhost_user.c | 20 
> > 1 file changed, 8 insertions(+), 12 deletions(-)
> >
> >diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> >index ef4a0c1..eee99e9 100644
> >--- a/lib/librte_vhost/vhost_user.c
> >+++ b/lib/librte_vhost/vhost_user.c
> >@@ -155,23 +155,22 @@ vhost_user_reset_owner(struct virtio_net *dev)
> > /*
> >  * The features that we support are requested.
> >  */
> >-static int
> >-vhost_user_get_features(uint64_t *pu)
> >+static uint64_t
> >+vhost_user_get_features(void)
> > {
> >-*pu = VHOST_FEATURES;
> >-return 0;
> >+return VHOST_FEATURES;
> > }
> 
> This is not the topic of this series, but I wonder if it
> could make sense to be able to override supported features
> at device init time.

Not quite sure I understood it correctly: is rte_vhost_feature_disable()
the answer you are looking for?

> It may not match with the orignal purpose of supported features,
> but could be useful at least for testing without recompilation.
> 
> For this patch:
> Reviewed-by: Maxime Coquelin 

Again, appreicate your time on review!

--yliu


[dpdk-dev] [PATCH] tools: add crypto device details

2016-08-25 Thread Mcnamara, John
> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Eoin Breen
> Sent: Thursday, August 25, 2016 11:05 AM
> To: Jain, Deepak K ; Trahe, Fiona
> ; Griffin, John 
> Cc: dev at dpdk.org; Breen, Eoin 
> Subject: [dpdk-dev] [PATCH] tools: add crypto device details
> 
> Adding the support to bind/unbind crypto devices with dpdk-devbind.py
> script, as now it is not restricted to network devices anymore.
> 

Hi Eoin,

There are a couple of small pep8 issues to fix:


$ pep8 tools/dpdk-devbind.py   
tools/dpdk-devbind.py:302:1: E302 expected 2 blank lines, found 1
tools/dpdk-devbind.py:653:33: E261 at least two spaces before inline comment

See: http://dpdk.org/doc/guides/contributing/coding_style.html#python-code

John


[dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue.

2016-08-25 Thread Mcnamara, John
> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Thursday, August 25, 2016 11:19 AM
> To: Mcnamara, John 
> Cc: dev at dpdk.org; souvikdey33 ; nhorman at 
> tuxdriver.com
> Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface
> issue.
> 
> 2016-08-25 09:51, Mcnamara, John:
> > The word fix on the command line normally means you should add a
> > "Fixes" line to the body but in this case the issue was probably
> > always there (or at least since virtio support was added) so you can
> probably omit it.
> 
> Even if it has always been there, we need to know the commit origin.
> The "Fixes:" line makes things clear and helps when backporting.
> Thanks

In that case the fixline should be:

Fixes: 629395b063e8 ("igb_uio: remove PCI id table")

John




[dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue.

2016-08-25 Thread Mcnamara, John
Hi,

Welcome to DPDK and thanks for the contribution. It looks like a useful fix.

Since you are a new contributor the user guide on "Contributing Code to DPDK"
explains some of the steps involved:

http://dpdk.org/doc/guides/contributing/patches.html

Some comments below.


> -Original Message-
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of souvikdey33
> Sent: Thursday, August 25, 2016 3:26 AM
> To: nhorman at tuxdriver.com; dev at dpdk.org
> Cc: souvikdey33 
> Subject: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue.

As you will see in the guide above the subject line should be lowercase and
shouldn't end with a full stop. Also, the prefix would be better as "tools". 
Something like this:

tools: fix issue with virtio interfaces

The word fix on the command line normally means you should add a "Fixes" line
to the body but in this case the issue was probably always there (or at least
since virtio support was added) so you can probably omit it.

> 
> This change is required to have the interface name for virtio interfaces.
> When we execute the status command the for virtio inerfaces we get Sample
> output without the change:
> :00:04.0 'Virtio network device' if= drv=virtio-pci
> unused=virtio_pci,igb_uio Though for other drivers this works.
> Sample output with the change:
> :00:04.0 'Virtio network device' if=eth0 drv=virtio-pci
> unused=virtio_pci,igb_uio
> 
> souvikdey33 (1):
>   Signed-off-by: souvikdey33 

You should add your real name to the sign off.



> diff --git a/tools/dpdk-devbind.py b/tools/dpdk-devbind.py index
> b69ca2a..9829e25 100755
> --- a/tools/dpdk-devbind.py
> +++ b/tools/dpdk-devbind.py
> @@ -36,6 +36,8 @@ import sys
>  import os
>  import getopt
>  import subprocess
> +import commands

The commands module is deprecated in Python 2 and removed in Python 3.
Python 2 and 3 should both be supported by the DPDK tools. In which case
you can use subprocess.check_output(), or similar, instead.


> +
>  from os.path import exists, abspath, dirname, basename
> 
>  # The PCI base class for NETWORK devices @@ -222,8 +224,15 @@ def
> get_pci_device_details(dev_id):
>  device[name] = value
>  # check for a unix interface name
>  sys_path = "/sys/bus/pci/devices/%s/net/" % dev_id
> +#The path for virtio devices are different. Get the correct path.
> + virtio = "/sys/bus/pci/devices/%s/" % dev_id

This space/tab indentation gives a Python error.


> +cmd = " ls %s | grep 'virt' " %virtio
> +virtio = commands.getoutput(cmd)
> +virtio_sys_path = "/sys/bus/pci/devices/%s/%s/net/" %
> +(dev_id,virtio)
>  if exists(sys_path):
>  device["Interface"] = ",".join(os.listdir(sys_path))
> +elif exists(virt_path):
> +device["Interface"] = ",".join(os.listdir(virtio_sys_path))
>  else:
>  device["Interface"] = ""
>  # check if a port is used for ssh connection

There a number of small Python formatting issues in the patch. The DPDK Python
code follows the pep8 guidelines:

http://dpdk.org/doc/guides/contributing/coding_style.html#python-code

Here are the warnings:

$ pep8 tools/dpdk-devbind.py 
tools/dpdk-devbind.py:227:5:  E265 block comment should start with '# '
tools/dpdk-devbind.py:228:1:  E101 indentation contains mixed spaces and 
tabs
tools/dpdk-devbind.py:228:1:  W191 indentation contains tabs
tools/dpdk-devbind.py:228:2:  E113 unexpected indentation
tools/dpdk-devbind.py:229:1:  E101 indentation contains mixed spaces and 
tabs
tools/dpdk-devbind.py:229:36: E225 missing whitespace around operator
tools/dpdk-devbind.py:231:66: E231 missing whitespace after ','

Could you fix those issues and submit a V2 of the patch.

Thanks.

John



[dpdk-dev] [PATCH] vhost: add pmd xstats

2016-08-25 Thread Yang, Zhiyong


> -Original Message-
> From: Panu Matilainen [mailto:pmatilai at redhat.com]
> Sent: Wednesday, August 24, 2016 8:37 PM
> To: Thomas Monjalon ; Yuanhan Liu
> 
> Cc: dev at dpdk.org; Yang, Zhiyong 
> Subject: Re: [dpdk-dev] [PATCH] vhost: add pmd xstats
> 
> On 08/24/2016 11:44 AM, Thomas Monjalon wrote:
> > 2016-08-24 13:46, Yuanhan Liu:
> >> On Tue, Aug 23, 2016 at 12:45:54PM +0300, Panu Matilainen wrote:
> >> Since collecting data of vhost_update_packet_xstats will have
> >> some effect on RX/TX performance, so, Setting compiling switch
> >> CONFIG_RTE_LIBRTE_PMD_VHOST_UPDATE_XSTATS=n by default
> in the
> > file
> >> config/common_base, if needing xstats data, you can enable it(y).
> >
> > NAK, such things need to be switchable at run-time.
> >
> > - Panu -
> 
>  Considering the following reasons using the compiler switch, not
>  command-line at run-time.
> 
>  1.Similar xstats update functions are always collecting stats data
>  in the background when rx/tx are running, such as the physical NIC
>  or virtio, which have no switch. Compiler switch for vhost pmd
>  xstats is added as a option when performance is viewed as critical
> factor.
> 
>  2. No data structure and API in any layer support the xstats update
>  switch at run-time. Common data structure (struct rte_eth_dev_data)
>  has no device-specific data member, if implementing enable/disable
>  of vhost_update _packet_xstats at run-time, must define a
>  flag(device-specific) in it, because the definition of struct
>  vhost_queue in the driver code (eth_vhost_rx/eth_vhost_tx
> processing)is not visible from device perspective.
> 
>  3. I tested RX/TX with v1 patch (y) as reference based on Intel(R)
>  Xeon(R) CPU E5-2699 v3 @ 2.30GHz, for 64byts packets in burst mode,
>  32 packets in one RX/TX processing. Overhead of
>  vhost_update_packet_xstats is less than 3% for the rx/tx
>  processing. It looks that vhost_update_packet_xstats has a limited
> effect on performance drop.
> >>>
> >>> Well, either the performance overhead is acceptable and it should
> >>> always be on (like with physical NICs I think). Or it is not. In
> >>> which case it needs to be turnable on and off, at run-time.
> >>> Rebuilding is not an option in the world of distros.
> >>
> >> I think the less than 3% overhead is acceptable here, that I agree
> >> with Panu we should always keep it on. If someone compains it later
> >> that even 3% is too big for them, let's consider to make it be
> >> switchable at run-time. Either we could introduce a generic eth API
> >> for that, Or just introduce a vhost one if that doesn't make too much
> >> sense to other eth drivers.
> >
> > +1
> > It may have sense to introduce a generic run-time option for stats.
> >
> 
> Yup, sounds good.
> 
It sounds better , if DPDK can add generic API and structure to the switch
of xstats update. So, any device can use it at run time if necessary.

Can we define one bit data member (xstats_update) in the data structure
struct rte_eth_dev_data?
such as:
uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
scattered_rx : 1,  /**< RX of scattered packets is ON(1) / OFF(0) */
all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
dev_started : 1,   /**< Device state: STARTED(1) / STOPPED(0). */
lro : 1,   /**< RX LRO is ON(1) / OFF(0) */
xstats_update: 1;   /**< xstats update is ON(1) / OFF(0) */

Define 3 functions:

void rte_eth_xstats_update_enable(uint8_t port_id);
void rte_eth_xstats_update_disable(uint8_t port_id);
int rte_eth_xstats_update_get(uint8_t port_id);

Or define two:

/* uint8_t xstats_update ; 1 on, 0 off*/
void rte_eth_xstats_update_enable(uint8_t port_id, uint8_t xstats_update);
int rte_eth_xstats_update_get(uint8_t port_id);

In the struct eth_dev_ops, adding two functions to pass xstats_update to
driver, because the rxq/txq can't access xstats_update directly.
So, add a xstats flag per queue data structure. 
for example 
struct vhost_queue {
..
Uint64_t  xstats_flag;
..
};
typedef uint16_t (*eth_rx_burst_t)(void *rxq,
   struct rte_mbuf **rx_pkts,
   uint16_t nb_pkts);
typedef uint16_t (*eth_tx_burst_t)(void *txq,
   struct rte_mbuf **tx_pkts,
   uint16_t nb_pkts);

struct eth_dev_ops {
..
eth_xstats_update_enable_t  xstats_update_enable; /**< xstats ON. */
eth_xstats_update_disable_t xstats_update_disable;/**< xstats OFF. */
..
};

--zhiyong--


[dpdk-dev] [PATCH 7/7] vhost: simplify features set/get

2016-08-25 Thread Maxime Coquelin


On 08/25/2016 05:03 AM, Yuanhan Liu wrote:
> On Wed, Aug 24, 2016 at 10:11:57AM +0200, Maxime Coquelin wrote:
>>
>>
>> On 08/18/2016 10:48 AM, Yuanhan Liu wrote:
>>> No need to use a pointer to store/retrieve features.
>>>
>>> Signed-off-by: Yuanhan Liu 
>>> ---
>>> lib/librte_vhost/vhost_user.c | 20 
>>> 1 file changed, 8 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
>>> index ef4a0c1..eee99e9 100644
>>> --- a/lib/librte_vhost/vhost_user.c
>>> +++ b/lib/librte_vhost/vhost_user.c
>>> @@ -155,23 +155,22 @@ vhost_user_reset_owner(struct virtio_net *dev)
>>> /*
>>>  * The features that we support are requested.
>>>  */
>>> -static int
>>> -vhost_user_get_features(uint64_t *pu)
>>> +static uint64_t
>>> +vhost_user_get_features(void)
>>> {
>>> -   *pu = VHOST_FEATURES;
>>> -   return 0;
>>> +   return VHOST_FEATURES;
>>> }
>>
>> This is not the topic of this series, but I wonder if it
>> could make sense to be able to override supported features
>> at device init time.
>
> Not quite sure I understood it correctly: is rte_vhost_feature_disable()
> the answer you are looking for?
Not really.

I meant a per-device supported features, and something you could set
also via the vhost PMD options, without needing to recompile.

But maybe it would make more sense to do it a guest level?

Maxime


[dpdk-dev] Huge ring allocation

2016-08-25 Thread Gregory Etelson
Hello,

I have a DPDK process that creates pktmbuf pool with 2_000_000 objects
In CentOS 6.x x86-64, ring size of this pool is 16MB
8 2MB hugepages required to hold such ring.
In some cases, hugepages are too fragmented and there are no 8 contiguous 
hugepages for the ring.
As the result, the process has enough hugepages memory, but ring allocation 
fails.
I use a workaround for these cases and create a ring with standard OS 
allocation routines.
Is there another way I could use unclaimed dpdk hugepages for that allocation ?

Regards,
Gregory



[dpdk-dev] Vhost user: Increase robustness by kicking guest at ring full

2016-08-25 Thread Patrik Andersson R
Hi,

during trouble shooting sessions (OVS 2.4.1, DPDK 2.2.0) it was noticed
that some guests trigger the SET_VRING_CALL message rather frequently. This
can be all from a few times per minute up to 10 times per second.

 From DPDK log:
...
2016-08-01T19:58:39.829222+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL, 1
2016-08-01T19:58:39.829232+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: vring call idx:0 file:251
2016-08-01T19:58:39.829246+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL, 1
2016-08-01T19:58:39.829250+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: vring call idx:0 file:215
2016-08-01T19:58:40.778491+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL, 1
2016-08-01T19:58:40.778501+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: vring call idx:0 file:251
2016-08-01T19:58:40.778517+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL, 1
2016-08-01T19:58:40.778521+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: vring call idx:0 file:215
2016-08-01T19:58:41.813467+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL, 1
2016-08-01T19:58:41.813479+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: vring call idx:0 file:251
2016-08-01T19:58:41.813499+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: read message VHOST_USER_SET_VRING_CALL, 1
2016-08-01T19:58:41.813505+09:00 compute-0-6 ovs-vswitchd[140481]: 
VHOST_CONFIG: vring call idx:0 file:215
...

Note that the ", 1" at the end of the log entries is the file handle index
added in a debug build of DPDK, not part of vanilla DPDK.


At high packet rate this might induce the kicking of the guest to fail
repeatedly while enqueueing packets, due to the vq->callfd not being valid
during the time its being reconfigured.

Sporadically this leads to the virtio ring becoming full. Once full the
enqueue functionality in DPDK stops kicking the guest. As the guest is
interrupt driven and has not received all kicks it will not empty the
virtio ring. Possibly there is some flaw also in the guest virtio driver
to make this happen.

To "solve" this problem, the kick operation in virtio_dev_merge_rx() was
excluded from the pkt_idx > 0 condition. A similar change was done in
virtio_dev_rx().


Original vhost_rxtx.c, virtio_dev_merge_rx():
...
merge_rx_exit:
 if (likely(pkt_idx)) {
 /* flush used->idx update before we read avail->flags. */
 rte_mb();

 /* Kick the guest if necessary. */
 if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
 eventfd_write(vq->callfd, (eventfd_t)1);
 }

 return pkt_idx;
}
...


Questions

   - Is it a valid operation to change the call/kick file descriptors
 (frequently) during device operation?

   - For stability reasons it seems to me that performing a kick even 
when the
 virtio ring is full is prudent. Since the check for packets put on the
 ring is there at all in the code, could it be that there is a penalty
 of kicking at ring full?

   - Would there be other ways to protect against the call file descriptor
 changing frequently? Assuming that virtio device events in the 
guest will
 cause the occasional SET_VRING_CALL message as part of normal 
operation.


Any discussion on this topic will be appreciated.


Regards,

Patrik



[dpdk-dev] [PATCH] app/testpmd: fix DCB config issue on ixgbe

2016-08-25 Thread Iremonger, Bernard
Hi Wenzhuo,



> > > > Subject: [dpdk-dev] [PATCH] app/testpmd: fix DCB config issue on
> > > > ixgbe
> > > >
> > > > An issue is found that DCB cannot be configured on ixgbe NICs.
> > > > It's said the TX queue number is not right.
> > > > On ixgbe the max TX queue number is not fixed, it depends on the
> > > > multi- queue mode.
> > > >
> > > > This patch adds the device configuration before getting info in
> > > > the DCB configuration process. So the right info can be got
> > > > depending on the configuration.
> > > >
> > > > Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported
> > > > Tx
> > > > queues)
> >
> > As the fix in this patch is to testpmd, I don't think the fixes line is 
> > correct.
> The bug is introduced by this patch. Before this patch, APP need not care
> about the multi-queue mode when it want to get the max queue number.
> 
> >
> > > > Signed-off-by: Wenzhuo Lu 
> > > > ---
> > > >  app/test-pmd/testpmd.c | 39
> > > > +--
> > > >  1 file changed, 21 insertions(+), 18 deletions(-)
> > > >
> > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > > > 1428974..ba41bea 100644
> > > > --- a/app/test-pmd/testpmd.c
> > > > +++ b/app/test-pmd/testpmd.c
> > > > @@ -1962,17 +1962,30 @@ init_port_dcb_config(portid_t pid,
> > > >  uint8_t pfc_en)
> > > >  {
> > > > struct rte_eth_conf port_conf;
> > > > -   struct rte_eth_dev_info dev_info;
> > > > struct rte_port *rte_port;
> > > > int retval;
> > > > uint16_t i;
> > > >
> > > > -   rte_eth_dev_info_get(pid, _info);
> > > > +   rte_port = [pid];
> > > > +
> > > > +   memset(_conf, 0, sizeof(struct rte_eth_conf));
> > > > +   /* Enter DCB configuration status */
> > > > +   dcb_config = 1;
> > > > +
> > > > +   /*set configuration of DCB in vt mode and DCB in non-vt mode*/
> > > > +   retval = get_eth_dcb_conf(_conf, dcb_mode, num_tcs,
> > > > pfc_en);
> > > > +   if (retval < 0)
> > > > +   return retval;
> > > > +   port_conf.rxmode.hw_vlan_filter = 1;
> > > > +
> > > > +   (void)rte_eth_dev_configure(pid, 0, 0, _conf);
> > >
> > > The return value of rte_eth_dev_configure() should be checked.
> > > Calling rte_eth_dev_configure() with  parameters nb_rx_q and nb_tx_q
> > > equal to 0 returns -EINVAL, and does nothing.
> > > Should the values of nb_rx_q and nb_tx_q be non zero?
> The 0 is used on purpose. Because I don't want to configure the queues. The
> only purpose is to  make all the configuration to write into the device. And
> that's why the return value is ignored by (void).

It might be useful to add a comment to explain why rte_eth_dev_configure() is 
being called in this way.

> > The call to rte_eth_dev_configure() may not be necessary, as it is
> > also called when the port is started.
> In rte_ethdev.h, we can see it's said that rte_eth_dev_configure should be
> called before any other function of ethernet API. As the DCB configuration is
> changed here. We have to call rte_eth_dev_configure to make the
> configuration is right before we can use rte_eth_dev_info_get.
> 
> >
> > > > +   rte_eth_dev_info_get(pid, _port->dev_info);
> > > >
> > > > /* If dev_info.vmdq_pool_base is greater than 0,
> > > >  * the queue id of vmdq pools is started after pf queues.
> > > >  */
> > > > -   if (dcb_mode == DCB_VT_ENABLED && dev_info.vmdq_pool_base >
> > > > 0) {
> > > > +   if (dcb_mode == DCB_VT_ENABLED &&
> > > > +   rte_port->dev_info.vmdq_pool_base > 0) {
> > > > printf("VMDQ_DCB multi-queue mode is nonsensical"
> > > > " for port %d.", pid);
> > > > return -1;
> > > > @@ -1982,13 +1995,13 @@ init_port_dcb_config(portid_t pid,
> > > >  * and has the same number of rxq and txq in dcb mode
> > > >  */
> > > > if (dcb_mode == DCB_VT_ENABLED) {
> > > > -   nb_rxq = dev_info.max_rx_queues;
> > > > -   nb_txq = dev_info.max_tx_queues;
> > > > +   nb_rxq = rte_port->dev_info.max_rx_queues;
> > > > +   nb_txq = rte_port->dev_info.max_tx_queues;
> >
> > If nb_rxq and nb_txq are set to max_rx_queues and max_tx_queues
> > respectively, there is a failure when the port is started in
> > ixgbe_check_mq_mode() at line
> > 1990 in ixgbe_ethdev.c.
> > SRIOV is active, nb_rx_q=128 nb_tx_q=128 queue number must be less
> > than or equal to 1.
> I haven't hit this issue. Would you like to give more details about how to hit
> it? I'll check if I miss something.

There is a Niantic PF and VF bound to igb_uio. Port 0 is the PF and Port 1 is 
the VF.
./testpmd -c 3f -l 1-5 -n 4 -- -i
testpmd> set corelist 2,3,4,5
testpmd> port stop 0  /* PF is 0 */
testpmd> port config 0 dcb vt on 4 pfc on
testpmd> port start 0 /* PF is 0 */
line 1990   ixgbe_ethdev.c
SRIOV is active, nb_rx_q=128 nb_tx_q=128 queue number must be 

[dpdk-dev] [PATCH 7/7] vhost: simplify features set/get

2016-08-25 Thread Xu, Qian Q


-Original Message-
From: dev [mailto:dev-boun...@dpdk.org] On Behalf Of Maxime Coquelin
Sent: Thursday, August 25, 2016 3:19 PM
To: Yuanhan Liu 
Cc: dev at dpdk.org
Subject: Re: [dpdk-dev] [PATCH 7/7] vhost: simplify features set/get



On 08/25/2016 05:03 AM, Yuanhan Liu wrote:
> On Wed, Aug 24, 2016 at 10:11:57AM +0200, Maxime Coquelin wrote:
>>
>>
>> On 08/18/2016 10:48 AM, Yuanhan Liu wrote:
>>> No need to use a pointer to store/retrieve features.
>>>
>>> Signed-off-by: Yuanhan Liu 
>>> ---
>>> lib/librte_vhost/vhost_user.c | 20 
>>> 1 file changed, 8 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/lib/librte_vhost/vhost_user.c 
>>> b/lib/librte_vhost/vhost_user.c index ef4a0c1..eee99e9 100644
>>> --- a/lib/librte_vhost/vhost_user.c
>>> +++ b/lib/librte_vhost/vhost_user.c
>>> @@ -155,23 +155,22 @@ vhost_user_reset_owner(struct virtio_net *dev)
>>> /*
>>>  * The features that we support are requested.
>>>  */
>>> -static int
>>> -vhost_user_get_features(uint64_t *pu)
>>> +static uint64_t
>>> +vhost_user_get_features(void)
>>> {
>>> -   *pu = VHOST_FEATURES;
>>> -   return 0;
>>> +   return VHOST_FEATURES;
>>> }
>>
>> This is not the topic of this series, but I wonder if it could make 
>> sense to be able to override supported features at device init time.
>
> Not quite sure I understood it correctly: is 
> rte_vhost_feature_disable() the answer you are looking for?
Not really.

I meant a per-device supported features, and something you could set also via 
the vhost PMD options, without needing to recompile.

But maybe it would make more sense to do it a guest level?

Maxime

---Agreed, as you know we have the vhost PMD port and virtio-user PMD port 
and we can launch both vhost/virtio on the host, but we 
Can't set the mergeable in the command line, we may need add some feature 
settings for virtio-user interface. It will be much easier to 
Run tests or application. 

Qian



[dpdk-dev] Permanently binding NIC ports with DPDK drivers

2016-08-25 Thread Keren Hochman
Hi,
I there a way to permanently bind a nic port when using DPDK drier with
kernel < 3.6 ? (In this kernel VFIO driver is not supported)?
Thanks, Keren


[dpdk-dev] dpdk 16.07, issues with rte_mempool_create and rte_kni_alloc()

2016-08-25 Thread Gopakumar Choorakkot Edakkunni
Thank you Ferruh, I will give this a spin over the weekend and let you know.

Rgds,
Gopa.

On Thu, Aug 25, 2016 at 6:51 AM, Ferruh Yigit 
wrote:

> On 8/10/2016 11:51 AM, Ferruh Yigit wrote:
> > Hi Gopakumar,
> >
> > On 8/4/2016 5:14 PM, Ferruh Yigit wrote:
> >> On 8/1/2016 10:19 PM, Gopakumar Choorakkot Edakkunni wrote:
> >>> Well, for my purpose I just ended up creating a seperate/smaller pool
> >>> earlier during bootup to try to guarantee its from one memseg.
> >>>
> >>> But I am assuming that this KNI restriction is something thats
> "currently"
> >>> not fixed and is "fixable" ?
> >>
> >>
> >>> Any ideas on what the summary of the reason
> >>> for this restriction is - I was gonna check if I can fix that
> >>
> >> KNI expects all mbufs are from a physically continuous memory. This is
> >> because of current address translation implementation.
> >>
> >> mbufs allocated in userspace and accessed from both user and kernel
> >> space, so mbuf userspace virtual address needs to be converted into
> >> kernelspace virtual address.
> >>
> >> Currently this address translation done by first calculating an offset
> >> between virtual addresses using first filed of mempool, later applying
> >> same offset to all mbufs. This is why all mbufs should be in physically
> >> continuous memory.
> >>
> >> I think this address translation can be done in different way which can
> >> remove the restriction, but not sure about the effect of the
> >> performance. I will send a patch for this.
> >
> > I have sent a patch to remove KNI restriction:
> > http://dpdk.org/dev/patchwork/patch/15171/
> >
> > Can you please test this patch with a mempool with multiple memzone?
> > You need to remove following check in KNI manually:
> > if (mp->nb_mem_chunks != 1)
> > goto kni_fail;
>
> Hi Gopakumar,
>
> Off the list.
>
> Any chance to test this?
>
> Thanks,
> ferruh
>
>


[dpdk-dev] [PATCH v3 4/5] vhost: batch update used ring

2016-08-25 Thread Wang, Zhihong


> -Original Message-
> From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> Sent: Thursday, August 25, 2016 11:48 AM
> To: Wang, Zhihong 
> Cc: dev at dpdk.org; maxime.coquelin at redhat.com
> Subject: Re: [PATCH v3 4/5] vhost: batch update used ring
> 
> On Fri, Aug 19, 2016 at 01:43:49AM -0400, Zhihong Wang wrote:
> > This patch enables batch update of the used ring for better efficiency.
> >
> > Signed-off-by: Zhihong Wang 
> ...
> > diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> > index 1785695..87d09fa 100644
> > --- a/lib/librte_vhost/virtio-net.c
> > +++ b/lib/librte_vhost/virtio-net.c
> > @@ -152,10 +152,14 @@ cleanup_device(struct virtio_net *dev, int
> destroy)
> >  static void
> >  free_device(struct virtio_net *dev)
> >  {
> > +   struct vhost_virtqueue *vq;
> > uint32_t i;
> >
> > -   for (i = 0; i < dev->virt_qp_nb; i++)
> > -   rte_free(dev->virtqueue[i * VIRTIO_QNUM]);
> > +   for (i = 0; i < dev->virt_qp_nb; i++) {
> > +   vq = dev->virtqueue[i * VIRTIO_QNUM];
> > +   rte_free(vq->shadow_used_ring);
> > +   rte_free(vq);
> > +   }
> > rte_free(dev);
> >  }
> > @@ -418,13 +422,18 @@ int
> >  vhost_set_vring_num(int vid, struct vhost_vring_state *state)
> >  {
> > struct virtio_net *dev;
> > +   struct vhost_virtqueue *vq;
> >
> > dev = get_device(vid);
> > if (dev == NULL)
> > return -1;
> >
> > /* State->index refers to the queue index. The txq is 1, rxq is 0. */
> > -   dev->virtqueue[state->index]->size = state->num;
> > +   vq = dev->virtqueue[state->index];
> > +   vq->size = state->num;
> > +   vq->shadow_used_ring = rte_malloc("",
> > +   vq->size * sizeof(struct vring_used_elem),
> > +   RTE_CACHE_LINE_SIZE);
> 
> Few notes here:
> 
> - I think the typical way to not specific a string type is using NULL,
>   but not "".
> 
> - You should check the return value of rte_malloc: it could fail.
> 
> - Note that free_device() is invoked only when the vhost-user connection
>   is broken (say the guest is halt). However, vhost_set_vring_num() could
>   be invoked many times for a connection, say when you restart testpmd
>   many times. This would lead to memory leak.
> 
>   The right way is to free it on get_vring_base().

Good catch! Thanks.

> 
>   --yliu


[dpdk-dev] [PATCH] app/testpmd: fix DCB config issue on ixgbe

2016-08-25 Thread Lu, Wenzhuo
Hi Bernard,

> -Original Message-
> From: Iremonger, Bernard
> Sent: Wednesday, August 24, 2016 11:22 PM
> To: Iremonger, Bernard; Lu, Wenzhuo; dev at dpdk.org
> Cc: De Lara Guarch, Pablo; Lu, Wenzhuo
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: fix DCB config issue on ixgbe
> 
> Hi Wenzhuo,
> 
> 
> 
> > > Subject: [dpdk-dev] [PATCH] app/testpmd: fix DCB config issue on
> > > ixgbe
> > >
> > > An issue is found that DCB cannot be configured on ixgbe NICs. It's
> > > said the TX queue number is not right.
> > > On ixgbe the max TX queue number is not fixed, it depends on the
> > > multi- queue mode.
> > >
> > > This patch adds the device configuration before getting info in the
> > > DCB configuration process. So the right info can be got depending on
> > > the configuration.
> > >
> > > Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported Tx
> > > queues)
> 
> As the fix in this patch is to testpmd, I don't think the fixes line is 
> correct.
The bug is introduced by this patch. Before this patch, APP need not care about 
the multi-queue mode when it want to get the max queue number.

> 
> > > Signed-off-by: Wenzhuo Lu 
> > > ---
> > >  app/test-pmd/testpmd.c | 39 +--
> > >  1 file changed, 21 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > > 1428974..ba41bea 100644
> > > --- a/app/test-pmd/testpmd.c
> > > +++ b/app/test-pmd/testpmd.c
> > > @@ -1962,17 +1962,30 @@ init_port_dcb_config(portid_t pid,
> > >uint8_t pfc_en)
> > >  {
> > >   struct rte_eth_conf port_conf;
> > > - struct rte_eth_dev_info dev_info;
> > >   struct rte_port *rte_port;
> > >   int retval;
> > >   uint16_t i;
> > >
> > > - rte_eth_dev_info_get(pid, _info);
> > > + rte_port = [pid];
> > > +
> > > + memset(_conf, 0, sizeof(struct rte_eth_conf));
> > > + /* Enter DCB configuration status */
> > > + dcb_config = 1;
> > > +
> > > + /*set configuration of DCB in vt mode and DCB in non-vt mode*/
> > > + retval = get_eth_dcb_conf(_conf, dcb_mode, num_tcs,
> > > pfc_en);
> > > + if (retval < 0)
> > > + return retval;
> > > + port_conf.rxmode.hw_vlan_filter = 1;
> > > +
> > > + (void)rte_eth_dev_configure(pid, 0, 0, _conf);
> >
> > The return value of rte_eth_dev_configure() should be checked.
> > Calling rte_eth_dev_configure() with  parameters nb_rx_q and nb_tx_q
> > equal to 0 returns -EINVAL, and does nothing.
> > Should the values of nb_rx_q and nb_tx_q be non zero?
The 0 is used on purpose. Because I don't want to configure the queues. The 
only purpose is to  make all the configuration to write into the device. And 
that's why the return value is ignored by (void).

> 
> The call to rte_eth_dev_configure() may not be necessary, as it is also called
> when the port is started.
In rte_ethdev.h, we can see it's said that rte_eth_dev_configure should be 
called before any other function of ethernet API. As the DCB configuration is 
changed here. We have to call rte_eth_dev_configure to make the configuration 
is right before we can use rte_eth_dev_info_get.

> 
> > > + rte_eth_dev_info_get(pid, _port->dev_info);
> > >
> > >   /* If dev_info.vmdq_pool_base is greater than 0,
> > >* the queue id of vmdq pools is started after pf queues.
> > >*/
> > > - if (dcb_mode == DCB_VT_ENABLED && dev_info.vmdq_pool_base >
> > > 0) {
> > > + if (dcb_mode == DCB_VT_ENABLED &&
> > > + rte_port->dev_info.vmdq_pool_base > 0) {
> > >   printf("VMDQ_DCB multi-queue mode is nonsensical"
> > >   " for port %d.", pid);
> > >   return -1;
> > > @@ -1982,13 +1995,13 @@ init_port_dcb_config(portid_t pid,
> > >* and has the same number of rxq and txq in dcb mode
> > >*/
> > >   if (dcb_mode == DCB_VT_ENABLED) {
> > > - nb_rxq = dev_info.max_rx_queues;
> > > - nb_txq = dev_info.max_tx_queues;
> > > + nb_rxq = rte_port->dev_info.max_rx_queues;
> > > + nb_txq = rte_port->dev_info.max_tx_queues;
> 
> If nb_rxq and nb_txq are set to max_rx_queues and max_tx_queues respectively,
> there is a failure when the port is started in ixgbe_check_mq_mode() at line
> 1990 in ixgbe_ethdev.c.
> SRIOV is active, nb_rx_q=128 nb_tx_q=128 queue number must be less than or
> equal to 1.
I haven't hit this issue. Would you like to give more details about how to hit 
it? I'll check if I miss something.

> 
> nb_rxq and nb_txq are equal to 1 at this point, if they are not changed, port 
> start
> completes successfully.
> 
> 
> > >   } else {
> > >   /*if vt is disabled, use all pf queues */
> > > - if (dev_info.vmdq_pool_base == 0) {
> > > - nb_rxq = dev_info.max_rx_queues;
> > > - nb_txq = dev_info.max_tx_queues;
> > > + if (rte_port->dev_info.vmdq_pool_base == 0) {
> > > + nb_rxq = rte_port->dev_info.max_rx_queues;
> > > + nb_txq = rte_port->dev_info.max_tx_queues;
> > >

[dpdk-dev] [PATCH v2 2/2] test_lpm6: make test_lpm6* compatible with the new rte_lpm6.c lib

2016-08-25 Thread Nikita Kozlov
Modify of test_lpm6.c to reflect that we no longer have a maximum number
of rules.

Check in some places that we are using the same number of tbl8 as the
previous implementation after a rte_lpm6_delete.

Signed-off-by: Nikita Kozlov 
Signed-off-by: Baptiste Daroussin 
---
 app/test/test_lpm6.c  | 244 +++---
 app/test/test_lpm6_perf.c |   6 +-
 lib/librte_table/rte_table_lpm_ipv6.c |   7 +-
 3 files changed, 84 insertions(+), 173 deletions(-)

diff --git a/app/test/test_lpm6.c b/app/test/test_lpm6.c
index 0fd0ef7..7929e44 100644
--- a/app/test/test_lpm6.c
+++ b/app/test/test_lpm6.c
@@ -77,8 +77,6 @@ static int32_t test22(void);
 static int32_t test23(void);
 static int32_t test24(void);
 static int32_t test25(void);
-static int32_t test26(void);
-static int32_t test27(void);

 rte_lpm6_test tests6[] = {
 /* Test Cases */
@@ -108,13 +106,10 @@ rte_lpm6_test tests6[] = {
test23,
test24,
test25,
-   test26,
-   test27,
 };

 #define NUM_LPM6_TESTS(sizeof(tests6)/sizeof(tests6[0]))
 #define MAX_DEPTH128
-#define MAX_RULES100
 #define NUMBER_TBL8S   (1 << 16)
 #define MAX_NUM_TBL8S  (1 << 21)
 #define PASS 0
@@ -153,7 +148,6 @@ test0(void)
struct rte_lpm6 *lpm = NULL;
struct rte_lpm6_config config;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -161,14 +155,7 @@ test0(void)
lpm = rte_lpm6_create(NULL, SOCKET_ID_ANY, );
TEST_LPM_ASSERT(lpm == NULL);

-   /* rte_lpm6_create: max_rules = 0 */
-   /* Note: __func__ inserts the function name, in this case "test0". */
-   config.max_rules = 0;
-   lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, );
-   TEST_LPM_ASSERT(lpm == NULL);
-
/* socket_id < -1 is invalid */
-   config.max_rules = MAX_RULES;
lpm = rte_lpm6_create(__func__, -2, );
TEST_LPM_ASSERT(lpm == NULL);

@@ -195,7 +182,6 @@ test1(void)
struct rte_lpm6 *lpm1 = NULL, *lpm2 = NULL, *lpm3 = NULL;
struct rte_lpm6_config config;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -219,7 +205,6 @@ test1(void)

 /*
  * Create lpm table then delete lpm table 20 times
- * Use a slightly different rules size each time
  */
 int32_t
 test2(void)
@@ -233,7 +218,6 @@ test2(void)

/* rte_lpm6_free: Free NULL */
for (i = 0; i < 20; i++) {
-   config.max_rules = MAX_RULES - i;
lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, );
TEST_LPM_ASSERT(lpm != NULL);

@@ -256,7 +240,6 @@ test3(void)
struct rte_lpm6 *lpm = NULL;
struct rte_lpm6_config config;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -278,10 +261,10 @@ test4(void)
struct rte_lpm6_config config;

uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-   uint8_t depth = 24, next_hop = 100;
+   uint8_t depth = 24;
+   uint16_t next_hop = 100;
int32_t status = 0;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -319,7 +302,6 @@ test5(void)
uint8_t depth = 24;
int32_t status = 0;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -354,10 +336,9 @@ test6(void)
struct rte_lpm6 *lpm = NULL;
struct rte_lpm6_config config;
uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-   uint8_t next_hop_return = 0;
+   uint16_t next_hop_return = 0;
int32_t status = 0;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -392,10 +373,9 @@ test7(void)
struct rte_lpm6 *lpm = NULL;
struct rte_lpm6_config config;
uint8_t ip[10][16];
-   int16_t next_hop_return[10];
+   int32_t next_hop_return[10];
int32_t status = 0;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -433,7 +413,6 @@ test8(void)
uint8_t depth[10];
int32_t status = 0;

-   config.max_rules = MAX_RULES;
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;

@@ -469,11 +448,11 @@ test9(void)
struct rte_lpm6 *lpm = NULL;
struct rte_lpm6_config config;
uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-   uint8_t depth = 16, next_hop_add = 100, next_hop_return = 0;
+   uint8_t depth = 16;
+   uint16_t next_hop_add = 100, next_hop_return = 0;
int32_t status = 0;
uint8_t i;

-   config.max_rules = MAX_RULES;

[dpdk-dev] [PATCH v2 1/2] lpm6: speed inmprovement on delete rule

2016-08-25 Thread Nikita Kozlov
Rewrite rte_lpm6_delete* logic for deleting only the selected rule
instead of deleting all rules and re-inserting them.

the delete_step() function is called recursively and delete the rule
until the rule depth is covered. Then it calls delete_expand_step()
which will ensure to delete the expanded part of the rule if any.

The tbl8 are now allocated more dynamically through tbl8_alloc() which
will walk through all tbl8 for finding an empty one.

The rules are now stored in a RB-tree so we can have a dynamic number of
them. This part of the patch is inspired by
http://dpdk.org/dev/patchwork/patch/7981/ .

Adding of rte_lpm6_tbl8_count() and rte_lpm6_tbl8_free_count() which
permits to check that we are freeing correctly our tbl8 and permits to
check how much free tbl8 we have for adding new rules.

For consistency with lpm4, increase lpm6 nexthop size from 8bit to
16bit.

This patch was written in collaboration with Baptiste Daroussin from Gandi.

Signed-off-by: Nikita Kozlov 
Signed-off-by: Baptiste Daroussin 
---
 lib/librte_lpm/Makefile|   2 +-
 lib/librte_lpm/rte_lpm6.c  | 626 +++--
 lib/librte_lpm/rte_lpm6.h  |  50 ++-
 lib/librte_lpm/rte_lpm_version.map |  12 +
 4 files changed, 525 insertions(+), 165 deletions(-)

diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 656ade2..cbab7da 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -39,7 +39,7 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)

 EXPORT_MAP := rte_lpm_version.map

-LIBABIVER := 2
+LIBABIVER := 3

 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_LPM) := rte_lpm.c rte_lpm6.c
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 32fdba0..e449152 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -52,6 +52,12 @@
 #include 
 #include 
 #include 
+#include 
+#ifdef RTE_EXEC_ENV_BSDAPP
+# include 
+#else
+# include 
+#endif

 #include "rte_lpm6.h"

@@ -97,27 +103,46 @@ struct rte_lpm6_tbl_entry {
 /** Rules tbl entry structure. */
 struct rte_lpm6_rule {
uint8_t ip[RTE_LPM6_IPV6_ADDR_SIZE]; /**< Rule IP address. */
-   uint8_t next_hop; /**< Rule next hop. */
+   uint16_t next_hop; /**< Rule next hop. */
uint8_t depth; /**< Rule depth. */
+   RB_ENTRY(rte_lpm6_rule) link;
 };

 /** LPM6 structure. */
 struct rte_lpm6 {
/* LPM metadata. */
char name[RTE_LPM6_NAMESIZE];/**< Name of the lpm. */
-   uint32_t max_rules;  /**< Max number of rules. */
-   uint32_t used_rules; /**< Used rules so far. */
uint32_t number_tbl8s;   /**< Number of tbl8s to allocate. */
-   uint32_t next_tbl8;  /**< Next tbl8 to be used. */
+
+   /* LPM rules. */
+   RB_HEAD(rte_lpm6_rules_tree, rte_lpm6_rule) rules[RTE_LPM6_MAX_DEPTH + 
1];

/* LPM Tables. */
-   struct rte_lpm6_rule *rules_tbl; /**< LPM rules. */
struct rte_lpm6_tbl_entry tbl24[RTE_LPM6_TBL24_NUM_ENTRIES]
__rte_cache_aligned; /**< LPM tbl24 table. */
struct rte_lpm6_tbl_entry tbl8[0]
__rte_cache_aligned; /**< LPM tbl8 table. */
 };

+/* Comparison function for red-black tree nodes.
+   "If the first argument is smaller than the second, the function
+   returns a value smaller than zero.  If they are equal, the function
+   returns zero.  Otherwise, it should return a value greater than zero."
+*/
+static inline int rules_cmp(const struct rte_lpm6_rule *r1,
+   const struct rte_lpm6_rule *r2)
+{
+   return memcmp(r1->ip, r2->ip, RTE_LPM6_IPV6_ADDR_SIZE);
+}
+
+/* Satisfy old style attribute in tree.h header */
+#ifndef __unused
+#define __unused __attribute__ ((unused))
+#endif
+
+/* Generate internal functions and make them static. */
+RB_GENERATE_STATIC(rte_lpm6_rules_tree, rte_lpm6_rule, link, rules_cmp)
+
 /*
  * Takes an array of uint8_t (IPv6 address) and masks it using the depth.
  * It leaves untouched one bit per unit in the depth variable
@@ -126,8 +151,8 @@ struct rte_lpm6 {
 static inline void
 mask_ip(uint8_t *ip, uint8_t depth)
 {
-int16_t part_depth, mask;
-int i;
+   int16_t part_depth, mask;
+   int i;

part_depth = depth;

@@ -152,7 +177,8 @@ rte_lpm6_create(const char *name, int socket_id,
char mem_name[RTE_LPM6_NAMESIZE];
struct rte_lpm6 *lpm = NULL;
struct rte_tailq_entry *te;
-   uint64_t mem_size, rules_size;
+   uint64_t mem_size;
+   unsigned int depth;
struct rte_lpm6_list *lpm_list;

lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list);
@@ -161,7 +187,6 @@ rte_lpm6_create(const char *name, int socket_id,

/* Check user arguments. */
if ((name == NULL) || (socket_id < -1) || (config == NULL) ||
-   (config->max_rules == 0) ||

[dpdk-dev] [PATCH v2 0/2] lpm6: speed improvement on delete rule

2016-08-25 Thread Nikita Kozlov
This serie of pathes focus on improving the speed of deleting rules in lpm6.

It also contains some other improvement like having a dynamic number of
rules in lpm6 and increasing the lpm6 nexthop size to 16bit for matching
the nexthop size in lpm4.

The performances improvement can be seen by running test_lpm6_perf but
because of the limited number of rules added (1000) the improvement seen is
just about a x10 with this test.

For testing it further we have tested it with a full ipv6 bgp view which 
represent 29296 routes in our test:
* With the dpdk 16.04 it tooks an average of 8.46095e+09 cycles to delete a rule
(calculated with mesuring rte_rdtsc before and after the delete, the
average is calculated by the first 10 delete, it represents several
seconds on a E5-2650 v2)
* With the patch it tooks 10077.1 cycles (same number of deleted rules,
same machine, same rules inserted) for the same test.

This patch was written in collaboration with Baptiste Daroussin from Gandi.

Changes since V1:
- use system bsd-tree.h
- fix a bug when valid_group field was overwritten 

Nikita Kozlov (2):
  lpm6: speed inmprovement on delete rule
  test_lpm6: make test_lpm6* compatible with the new rte_lpm6.c lib

 app/test/test_lpm6.c  | 244 +
 app/test/test_lpm6_perf.c |   6 +-
 lib/librte_lpm/Makefile   |   2 +-
 lib/librte_lpm/rte_lpm6.c | 626 +-
 lib/librte_lpm/rte_lpm6.h |  50 ++-
 lib/librte_lpm/rte_lpm_version.map|  12 +
 lib/librte_table/rte_table_lpm_ipv6.c |   7 +-
 7 files changed, 609 insertions(+), 338 deletions(-)

-- 
2.9.2


[dpdk-dev] [PATCH] drivers: make driver names consistent

2016-08-25 Thread Pablo de Lara
As discussed in the past release, driver names are modified
to be more consistent, and the future driver should follow
this new convention.

Driver names consist of:
"driver category"_"driver folder name"_"optional extra name".

For example:
- Crypto null driver   -> "crypto_null"
- Network IXGBE VF driver  -> "net_ixgbe_vf"

Signed-off-by: Pablo de Lara 
---
 app/pdump/main.c  |  4 ++--
 doc/guides/cryptodevs/aesni_gcm.rst   |  6 +++---
 doc/guides/cryptodevs/aesni_mb.rst|  6 +++---
 doc/guides/cryptodevs/kasumi.rst  |  6 +++---
 doc/guides/cryptodevs/null.rst|  6 +++---
 doc/guides/cryptodevs/snow3g.rst  |  6 +++---
 doc/guides/nics/pcap_ring.rst | 26 +-
 doc/guides/nics/vhost.rst |  2 +-
 doc/guides/xen/pkt_switch.rst | 10 +-
 drivers/net/af_packet/rte_eth_af_packet.c |  4 ++--
 drivers/net/bnx2x/bnx2x_ethdev.c  |  8 
 drivers/net/bnxt/bnxt_ethdev.c|  4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c|  4 ++--
 drivers/net/cxgbe/cxgbe_ethdev.c  |  4 ++--
 drivers/net/e1000/em_ethdev.c |  4 ++--
 drivers/net/e1000/igb_ethdev.c|  8 
 drivers/net/ena/ena_ethdev.c  |  4 ++--
 drivers/net/enic/enic_ethdev.c|  4 ++--
 drivers/net/fm10k/fm10k_ethdev.c  |  4 ++--
 drivers/net/i40e/i40e_ethdev.c|  4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c  |  8 
 drivers/net/mlx4/mlx4.c   |  4 ++--
 drivers/net/mlx5/mlx5.c   |  4 ++--
 drivers/net/mpipe/mpipe_tilegx.c  |  4 ++--
 drivers/net/nfp/nfp_net.c |  4 ++--
 drivers/net/null/rte_eth_null.c   |  4 ++--
 drivers/net/pcap/rte_eth_pcap.c   |  4 ++--
 drivers/net/qede/qede_ethdev.c|  8 
 drivers/net/ring/rte_eth_ring.c   |  4 ++--
 drivers/net/szedata2/rte_eth_szedata2.c   |  2 +-
 drivers/net/thunderx/nicvf_ethdev.c   |  4 ++--
 drivers/net/vhost/rte_eth_vhost.c |  4 ++--
 drivers/net/virtio/virtio_ethdev.c|  4 ++--
 drivers/net/virtio/virtio_user_ethdev.c   |  4 ++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c  |  4 ++--
 drivers/net/xenvirt/rte_eth_xenvirt.c |  4 ++--
 lib/librte_cryptodev/rte_cryptodev.h  | 12 ++--
 38 files changed, 105 insertions(+), 105 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index b76cfd0..f3ef181 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -68,8 +68,8 @@
 #define CMD_LINE_OPT_SER_SOCK_PATH "server-socket-path"
 #define CMD_LINE_OPT_CLI_SOCK_PATH "client-socket-path"

-#define VDEV_PCAP "eth_pcap_%s_%d,tx_pcap=%s"
-#define VDEV_IFACE "eth_pcap_%s_%d,tx_iface=%s"
+#define VDEV_PCAP "net_pcap_%s_%d,tx_pcap=%s"
+#define VDEV_IFACE "net_pcap_%s_%d,tx_iface=%s"
 #define TX_STREAM_SIZE 64

 #define MP_NAME "pdump_pool_%d"
diff --git a/doc/guides/cryptodevs/aesni_gcm.rst 
b/doc/guides/cryptodevs/aesni_gcm.rst
index 7ff1c6b..04bf43c 100644
--- a/doc/guides/cryptodevs/aesni_gcm.rst
+++ b/doc/guides/cryptodevs/aesni_gcm.rst
@@ -64,9 +64,9 @@ In order to enable this virtual crypto PMD, user must:

 To use the PMD in an application, user must:

-* Call rte_eal_vdev_init("cryptodev_aesni_gcm_pmd") within the application.
+* Call rte_eal_vdev_init("crypto_aesni_gcm") within the application.

-* Use --vdev="cryptodev_aesni_gcm_pmd" in the EAL options, which will call 
rte_eal_vdev_init() internally.
+* Use --vdev="crypto_aesni_gcm" in the EAL options, which will call 
rte_eal_vdev_init() internally.

 The following parameters (all optional) can be provided in the previous two 
calls:

@@ -81,7 +81,7 @@ Example:

 .. code-block:: console

-./l2fwd-crypto -c 40 -n 4 
--vdev="cryptodev_aesni_gcm_pmd,socket_id=1,max_nb_sessions=128"
+./l2fwd-crypto -c 40 -n 4 
--vdev="crypto_aesni_gcm,socket_id=1,max_nb_sessions=128"

 Limitations
 ---
diff --git a/doc/guides/cryptodevs/aesni_mb.rst 
b/doc/guides/cryptodevs/aesni_mb.rst
index 60a8914..a827751 100644
--- a/doc/guides/cryptodevs/aesni_mb.rst
+++ b/doc/guides/cryptodevs/aesni_mb.rst
@@ -96,9 +96,9 @@ In order to enable this virtual crypto PMD, user must:

 To use the PMD in an application, user must:

-* Call rte_eal_vdev_init("cryptodev_aesni_mb_pmd") within the application.
+* Call rte_eal_vdev_init("crypto_aesni_mb") within the application.

-* Use --vdev="cryptodev_aesni_mb_pmd" in the EAL options, which will call 
rte_eal_vdev_init() internally.
+* Use --vdev="crypto_aesni_mb" in the EAL options, which will call 
rte_eal_vdev_init() internally.

 The following parameters (all optional) can be provided in the previous two 
calls:

@@ -113,4 +113,4 @@ Example:

 .. code-block:: console

-./l2fwd-crypto -c 40 -n 4 
--vdev="cryptodev_aesni_mb_pmd,socket_id=1,max_nb_sessions=128"
+./l2fwd-crypto -c 40 -n 4