[dpdk-dev] [PATCH] maintainers: claim responsability for crypto subtree
> -Original Message- > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > Sent: Thursday, September 15, 2016 8:17 AM > To: De Lara Guarch, Pablo > Cc: dev at dpdk.org > Subject: Re: [PATCH] maintainers: claim responsability for crypto subtree > > 2016-08-30 19:47, Pablo de Lara: > > From 16.07, I will be the maintainer of the crypto subtree. > [...] > > Crypto Drivers > > -- > > +T: Pablo de Lara > > I think that the syntax should be: > > M: Pablo de Lara > T: git://dpdk.org/dpdk-next-crypto > Oh yes, sorry about that. Will send a v2 shortly.
[dpdk-dev] ipv4 fragmentation bug?
I am sorry for the late reply. I am not sure anymore about is it a bug I found or the author of rte_ipv4_fragment_packet() realy wanted to constraint the size of mtu writing lines: frag_size = (uint16_t)(mtu_size - sizeof(struct ipv4_hdr)); /* Fragment size should be a multiply of 8. */ assert((frag_size & IPV4_HDR_FO_MASK) == 0); So, if we assume that any mtu size is valid then it's a bug and the function must be rewriten. Otherwise, since mtu_size is an input parameter of the function, validation should be stronger than just a assertion or it should be noted in the documentation that not all values for the paremater mtu_size are valid. I can write a patch. I just need a confirmation since I am not sure about the networking background regarding MTU. I tried to find anything about MTU in the RFC, but so far nothing. According to RFC all mtu sizes are valid. >2016-08-22 14:31 GMT+03:00 Thomas Monjalon : >Hi, > 2016-08-15 20:30 GMT+03:00 ? ??? : > > While playing with function rte_ipv4_fragment_packet I found that it > > incorrectly fragments packets. > > For example if the function takes 1200 bytes packet and mtu size 1000 it > > will produces two fragments. And when those fragments are reassembled back > > the resulting packet will be 4 bytes shorter than it should be. > > > > I played with linux ping program and it reports that a reply is truncated. > > 1204 bytes from 192.168.125.1: icmp_seq=1 ttl=64 (truncated) > > > > Looking at the source of rte_ipv4_fragment_packet I discovered the cause > > of the above behavior. > > > > Function makes the following assumption and the whole calculations are > > bases on that assumption. > > > > /* Fragment size should be a multiply of 8. */ > > IP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0); > > > > The problem is that this assert doesn?t make any sense. It's true that > > fragment size should be a multiply of 8, but what this line real checks is > > that > > the size of mtu minus 20 bytes should be multiply of 8. In other words > > it constrains the size of the mtu. So, if I take valid mtu value, say > > 1504, > > it will produce incorrect fragments when asserts are off. >Thanks for reporting. > >2016-08-15 20:48, ? ???: >> I'am sorry. Looks like having an mtu value multiply of 8 is a good practice. >> >> But mtu value 1504 is also widely used in qinq linux interfaces. >Please, would like to write a patch for master branch? >Or do you prefer to delegate it to someone reading this thread? -- Alexander Kiselev
[dpdk-dev] [PATCH] kni: support RHEL 7.3
> -Original Message- > From: Yigit, Ferruh > Sent: Thursday, September 15, 2016 3:13 AM > To: De Lara Guarch, Pablo; dev at dpdk.org > Subject: Re: [PATCH] kni: support RHEL 7.3 > > On 9/14/2016 7:25 PM, Pablo de Lara wrote: > > Add support for RHEL 7.3, which uses kernel 3.10, > > but backported features from newer kernels. > > > > Signed-off-by: Pablo de Lara > > --- > > lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 7 --- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > > index bdd0806..1e20a9e 100644 > > --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > > +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > > @@ -3891,7 +3891,7 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, > __always_unused int type) > > #if (( LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) ) \ > > || ( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,2) )) > > #define HAVE_NDO_DFLT_BRIDGE_ADD_MASK > > -#if (!( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,2) )) > > +#if (!( RHEL_RELEASE_CODE == RHEL_RELEASE_VERSION(7,2) )) > > What about following to simplify the logic: > +#if ( RHEL_RELEASE_CODE != RHEL_RELEASE_VERSION(7,2) ) > Good point. Will send a v2 with that :) Thanks, Pablo > Thanks, > ferruh
[dpdk-dev] [PATCH v2 2/2] mempool:pktmbuf pool default fallback for mempool ops error
In the rte_pktmbuf_pool_create, if the default external mempool is not available, the implementation can default to "ring_mp_mc", which is an software implementation. Signed-off-by: Hemant Agrawal --- lib/librte_mbuf/rte_mbuf.c | 5 + 1 file changed, 5 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 4846b89..4adb4f5 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -176,6 +176,11 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, rte_errno = rte_mempool_set_ops_byname(mp, RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL); + + /* on error, try falling back to the software based default pool */ + if (rte_errno == -EOPNOTSUPP) + rte_errno = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL); + if (rte_errno != 0) { RTE_LOG(ERR, MBUF, "error setting mempool handler\n"); return NULL; -- 1.9.1
[dpdk-dev] [PATCH v2 1/2] eal/mempool: introduce check for external mempool availability
External offloaded mempool may not be available always. This check enables run time verification of the presence of external mempool before the mempool ops are installed. An application built with a specific external mempool may work fine on host. But, may not work on VM, specificaly if non-hw specific interfaces are used e.g. virtio-net. This is required to make sure that same application can work in all environment for a given hw platform. The solution proposed here is that rte_mempool_set_ops_byname should return specific error in case the current execution environment is not supporting the given mempool. Thereby allowing it to fallback on software mempool implementation e.g. "ring_mp_mc" This patch introduces new optional "pool_verify" as mempool ops function to check if external mempool instance is available or not. Signed-off-by: Hemant Agrawal --- Changes in v2: * fixed the pool_verify copy in rte_mempool_register_ops --- lib/librte_mempool/rte_mempool.h | 21 + lib/librte_mempool/rte_mempool_ops.c | 19 +++ lib/librte_mempool/rte_mempool_ring.c | 4 lib/librte_mempool/rte_mempool_stack.c | 3 ++- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 0243f9e..8599df1 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -387,6 +387,12 @@ typedef int (*rte_mempool_dequeue_t)(struct rte_mempool *mp, */ typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp); +/** + * Return if the given external mempool is available for this instance. + * it is optional to implement for mempools + */ +typedef int (*rte_mempool_pool_verify)(const struct rte_mempool *mp); + /** Structure defining mempool operations structure */ struct rte_mempool_ops { char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ @@ -395,6 +401,8 @@ struct rte_mempool_ops { rte_mempool_enqueue_t enqueue; /**< Enqueue an object. */ rte_mempool_dequeue_t dequeue; /**< Dequeue an object. */ rte_mempool_get_count get_count; /**< Get qty of available objs. */ + rte_mempool_pool_verify pool_verify; + /**< Verify if external mempool is available for usages*/ } __rte_cache_aligned; #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ @@ -516,6 +524,18 @@ void rte_mempool_ops_free(struct rte_mempool *mp); /** + * @internal wrapper to verify the external mempool availability + * + * @param mp + * Pointer to the memory pool. + * @return + * 0: Success; external mempool instance is available + * - <0: Error; external mempool instance is not available + */ +int +rte_mempool_ops_pool_verify(const struct rte_mempool *mp); + +/** * Set the ops of a mempool. * * This can only be done on a mempool that is not populated, i.e. just after @@ -531,6 +551,7 @@ rte_mempool_ops_free(struct rte_mempool *mp); * - 0: Success; the mempool is now using the requested ops functions. * - -EINVAL - Invalid ops struct name provided. * - -EEXIST - mempool already has an ops struct assigned. + * - -EOPNOTSUPP - mempool instance not available. */ int rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name, diff --git a/lib/librte_mempool/rte_mempool_ops.c b/lib/librte_mempool/rte_mempool_ops.c index 5f24de2..c2e765f 100644 --- a/lib/librte_mempool/rte_mempool_ops.c +++ b/lib/librte_mempool/rte_mempool_ops.c @@ -85,6 +85,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h) ops->enqueue = h->enqueue; ops->dequeue = h->dequeue; ops->get_count = h->get_count; + ops->pool_verify = h->pool_verify; rte_spinlock_unlock(&rte_mempool_ops_table.sl); @@ -123,6 +124,18 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp) return ops->get_count(mp); } +/* wrapper to check if given external mempool is available for this instance.*/ +int +rte_mempool_ops_pool_verify(const struct rte_mempool *mp) +{ + struct rte_mempool_ops *ops; + + ops = rte_mempool_get_ops(mp->ops_index); + if (ops->pool_verify) + return ops->pool_verify(mp); + return 0; +} + /* sets mempool ops previously registered by rte_mempool_register_ops. */ int rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name, @@ -146,6 +159,12 @@ rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name, if (ops == NULL) return -EINVAL; + /*verify if the given mempool is available for this instance */ + if (ops->pool_verify) { + if (ops->pool_verify(mp)) + return -EOPNOTSUPP; + } + mp->ops_index = i; mp->pool_config = pool_config; return 0; diff --git a/lib/librte_mempool/rte_mempool_ring.c b/lib/librte_mempool/rte_mempool_ring.c index b9aa64d..d86d5e0 100644 --- a/lib/librte_mempool/rte_memp
[dpdk-dev] [PATCH v3 2/2] crypto/qat: adding support for 3DES cipher algorithm
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/15813/ Signed-off-by: Fiona Trahe --- doc/guides/cryptodevs/qat.rst| 4 +- doc/guides/rel_notes/release_16_11.rst | 1 + 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 | 59 +++- 5 files changed, 89 insertions(+), 5 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 3528499..16e5937 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_CIPHER_AES128_CBC`` * ``RTE_CRYPTO_CIPHER_AES192_CBC`` * ``RTE_CRYPTO_CIPHER_AES256_CBC`` @@ -72,7 +74,7 @@ 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 and Kasumi F8. +* Cipher only is not supported except Snow3G UEA2, Kasumi F8 and 3DES. * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) and Kasumi(F8) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 1dd0e6a..4eedc0e 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -51,6 +51,7 @@ New Features * Added support for SHA384-HMAC algorithm. * Added support for NULL algorithm. * Added support for KASUMI (F8 and F9) algorithm. + * Added support for 3DES block cipher algorithm. Resolved Issues --- 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 8ca422f..b46702f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -512,6 +512,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; @@ -553,8 +557,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 *)&cdesc->cd; @@ -845,3 +853,16 @@ int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg) } return 0; } + +int qat_alg_validate_3des_
[dpdk-dev] [PATCH v3 1/2] crypto/qat: code cleanup
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 198b551..8ca422f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -525,7 +525,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); @@ -534,7 +535,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 */ @@ -545,7 +546,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; } @@ -727,13 +728,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; @@ -803,56 +804,6 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, return 0; } -static void qat_alg_ablkc
[dpdk-dev] [PATCH v3 0/2] Add 3DES support to Quickassist PMD
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 included in the libcrypto patch, which will be sent separately. Changes since v1: * rebased qat.rst against Kasumi patch changes http://dpdk.org/dev/patchwork/patch/15320/ http://dpdk.org/dev/patchwork/patch/15322/ Changes since v2: * added 3DES to QAT PMD capabilities * added 3DES to 16.11 release notes. Fiona Trahe (2): crypto/qat: code cleanup crypto/qat: adding support for 3DES cipher algorithm doc/guides/cryptodevs/qat.rst| 4 +- doc/guides/rel_notes/release_16_11.rst | 1 + 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 | 65 - 6 files changed, 105 insertions(+), 69 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH v5 5/6] vhost: batch update used ring
On 09/14/2016 10:43 AM, Wang, Zhihong wrote: > > >> -Original Message- >> From: Maxime Coquelin [mailto:maxime.coquelin at redhat.com] >> Sent: Monday, September 12, 2016 11:46 PM >> To: Wang, Zhihong ; dev at dpdk.org >> Cc: yuanhan.liu at linux.intel.com; thomas.monjalon at 6wind.com >> Subject: Re: [PATCH v5 5/6] vhost: batch update used ring >> >> >> >> On 09/09/2016 05:39 AM, Zhihong Wang wrote: >>> This patch enables batch update of the used ring for better efficiency. >>> >>> Signed-off-by: Zhihong Wang >>> --- >>> Changes in v4: >>> >>> 1. Free shadow used ring in the right place. >>> >>> 2. Add failure check for shadow used ring malloc. >>> >>> lib/librte_vhost/vhost.c | 20 -- >>> lib/librte_vhost/vhost.h | 4 +++ >>> lib/librte_vhost/vhost_user.c | 31 + >>> lib/librte_vhost/virtio_net.c | 64 >> +++ >>> 4 files changed, 101 insertions(+), 18 deletions(-) >>> >>> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c >>> index 46095c3..cb31cdd 100644 >>> --- a/lib/librte_vhost/vhost.c >>> +++ b/lib/librte_vhost/vhost.c >>> @@ -119,10 +119,26 @@ cleanup_device(struct virtio_net *dev, int >> destroy) >>> static void >>> free_device(struct virtio_net *dev) >>> { >>> + struct vhost_virtqueue *vq_0; >>> + struct vhost_virtqueue *vq_1; >>> 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_0 = dev->virtqueue[i * VIRTIO_QNUM]; >>> + if (vq_0->shadow_used_ring) { >>> + rte_free(vq_0->shadow_used_ring); >>> + vq_0->shadow_used_ring = NULL; >>> + } >>> + >>> + vq_1 = dev->virtqueue[i * VIRTIO_QNUM + 1]; >>> + if (vq_1->shadow_used_ring) { >>> + rte_free(vq_1->shadow_used_ring); >>> + vq_1->shadow_used_ring = NULL; >>> + } >>> + >>> + /* malloc together, free together */ >>> + rte_free(vq_0); >>> + } >>> >>> rte_free(dev); >>> } >>> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h >>> index 9707dfc..381dc27 100644 >>> --- a/lib/librte_vhost/vhost.h >>> +++ b/lib/librte_vhost/vhost.h >>> @@ -85,6 +85,10 @@ struct vhost_virtqueue { >>> >>> /* Physical address of used ring, for logging */ >>> uint64_tlog_guest_addr; >>> + >>> + /* Shadow used ring for performance */ >>> + struct vring_used_elem *shadow_used_ring; >>> + uint32_tshadow_used_idx; >>> } __rte_cache_aligned; >>> >>> /* Old kernels have no such macro defined */ >>> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c >>> index eee99e9..d7cf1ed 100644 >>> --- a/lib/librte_vhost/vhost_user.c >>> +++ b/lib/librte_vhost/vhost_user.c >>> @@ -193,7 +193,21 @@ static int >>> vhost_user_set_vring_num(struct virtio_net *dev, >>> struct vhost_vring_state *state) >>> { >>> - dev->virtqueue[state->index]->size = state->num; >>> + struct vhost_virtqueue *vq; >>> + >>> + vq = dev->virtqueue[state->index]; >>> + vq->size = state->num; >>> + if (!vq->shadow_used_ring) { >>> + vq->shadow_used_ring = rte_malloc(NULL, >>> + vq->size * sizeof(struct vring_used_elem), >>> + RTE_CACHE_LINE_SIZE); >>> + if (!vq->shadow_used_ring) { >>> + RTE_LOG(ERR, VHOST_CONFIG, >>> + "Failed to allocate memory" >>> + " for shadow used ring.\n"); >>> + return -1; >>> + } >>> + } >>> >>> return 0; >>> } >>> @@ -611,14 +625,21 @@ static int >>> vhost_user_get_vring_base(struct virtio_net *dev, >>> struct vhost_vring_state *state) >>> { >>> + struct vhost_virtqueue *vq; >>> + >>> /* We have to stop the queue (virtio) if it is running. */ >>> if (dev->flags & VIRTIO_DEV_RUNNING) { >>> dev->flags &= ~VIRTIO_DEV_RUNNING; >>> notify_ops->destroy_device(dev->vid); >>> } >>> >>> + vq = dev->virtqueue[state->index]; >>> /* Here we are safe to get the last used index */ >>> - state->num = dev->virtqueue[state->index]->last_used_idx; >>> + state->num = vq->last_used_idx; >>> + if (vq->shadow_used_ring) { >>> + rte_free(vq->shadow_used_ring); >>> + vq->shadow_used_ring = NULL; >>> + } >>> >>> RTE_LOG(INFO, VHOST_CONFIG, >>> "vring base idx:%d file:%d\n", state->index, state->num); >>> @@ -627,10 +648,10 @@ vhost_user_get_vring_base(struct virtio_net >> *dev, >>> * sent and only sent in vhost_vring_stop. >>> * TODO: cleanup the vring, it isn't usable since here. >>> */ >>> - if (dev->virtqueue[state->index]->kickfd >= 0) >>> - close(dev->virtqueue[state->index]->kickfd); >>>
[dpdk-dev] [PATCH v5 2/6] vhost: rewrite enqueue
Hi, On 09/14/2016 10:20 AM, Wang, Zhihong wrote: >>> + desc_current = >>> + vq->avail->ring[(vq->last_used_idx) >> & >>> + (vq->size - 1)]; >>> + desc_chain_head = desc_current; >>> + desc = &vq->desc[desc_current]; >>> + desc_addr = gpa_to_vva(dev, desc->addr); >>> + if (unlikely(!desc_addr)) >>> + goto error; >>> >>> - desc = &vq->desc[desc->next]; >>> - desc_addr = gpa_to_vva(dev, desc->addr); >>> - if (unlikely(!desc_addr)) >>> - return -1; >>> - >>> - desc_offset = 0; >>> - desc_avail = desc->len; >>> + desc_chain_len = 0; >>> + desc_offset = 0; >> As I commented on v3, there is code duplication between next flag, and >> mrg buf cases: >> desc_offset = 0; >> >> and: >> >> desc = &vq->desc[desc_current]; >> desc_addr = gpa_to_vva(dev, desc->addr); >> if (unlikely(!desc_addr)) >> goto error; >> > > Do you mean to add something like: > > static inline int __attribute__((always_inline)) > get_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, > uint32_t desc_idx, struct vring_desc **desc, > uint64_t *desc_addr) > { > *desc = &vq->desc[desc_idx]; > *desc_addr = gpa_to_vva(dev, (*desc)->addr); > if (unlikely(!(*desc_addr))) > return -1; > > return 0; > } I meant, move this code after the if/else. You can do it in a function if it is done elsewhere in the file.
[dpdk-dev] [PATCH v3 2/2] app/test: add test cases for aes-sha224-hmac for Intel QAT driver
From: "Jain, Deepak K" Added aes-sha224-hmac algorithm to test file for Intel(R) QuickAssist Technology Driver Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe --- app/test/test_cryptodev_aes.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/test/test_cryptodev_aes.c b/app/test/test_cryptodev_aes.c index bf832b6..6ad2674 100644 --- a/app/test/test_cryptodev_aes.c +++ b/app/test/test_cryptodev_aes.c @@ -211,14 +211,16 @@ static const struct aes_test_case aes_test_cases[] = { .test_descr = "AES-128-CBC HMAC-SHA224 Encryption Digest", .test_data = &aes_test_data_8, .op_mask = AES_TEST_OP_ENC_AUTH_GEN, - .pmd_mask = AES_TEST_TARGET_PMD_MB + .pmd_mask = AES_TEST_TARGET_PMD_MB | + AES_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest " "Verify", .test_data = &aes_test_data_8, .op_mask = AES_TEST_OP_AUTH_VERIFY_DEC, - .pmd_mask = AES_TEST_TARGET_PMD_MB + .pmd_mask = AES_TEST_TARGET_PMD_MB | + AES_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest", -- 2.5.5
[dpdk-dev] [PATCH v3 1/2] crypto/qat: add aes-sha224-hmac capability to Intel QAT driver
From: "Jain, Deepak K" Added support of aes-sha224-hmac in Intel(R) QuickAssist driver Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe --- doc/guides/cryptodevs/qat.rst| 1 + doc/guides/rel_notes/release_16_11.rst | 1 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 33 drivers/crypto/qat/qat_crypto.c | 25 +- 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 485abb4..7f630be 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -53,6 +53,7 @@ Cipher algorithms: Hash algorithms: * ``RTE_CRYPTO_AUTH_SHA1_HMAC`` +* ``RTE_CRYPTO_AUTH_SHA224_HMAC`` * ``RTE_CRYPTO_AUTH_SHA256_HMAC`` * ``RTE_CRYPTO_AUTH_SHA512_HMAC`` * ``RTE_CRYPTO_AUTH_AES_XCBC_MAC`` diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 4f7d784..040e250 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -40,6 +40,7 @@ New Features The QAT PMD was updated with changes including the following: * Added support for MD5_HMAC algorithm. + * Added support for SHA224-HMAC algorithm. Resolved Issues 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 521a9c4..77e6548 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -71,6 +71,9 @@ static int qat_hash_get_state1_size(enum icp_qat_hw_auth_algo qat_hash_alg) case ICP_QAT_HW_AUTH_ALGO_SHA1: return QAT_HW_ROUND_UP(ICP_QAT_HW_SHA1_STATE1_SZ, QAT_HW_DEFAULT_ALIGNMENT); + case ICP_QAT_HW_AUTH_ALGO_SHA224: + return QAT_HW_ROUND_UP(ICP_QAT_HW_SHA224_STATE1_SZ, + QAT_HW_DEFAULT_ALIGNMENT); case ICP_QAT_HW_AUTH_ALGO_SHA256: return QAT_HW_ROUND_UP(ICP_QAT_HW_SHA256_STATE1_SZ, QAT_HW_DEFAULT_ALIGNMENT); @@ -107,6 +110,8 @@ static int qat_hash_get_digest_size(enum icp_qat_hw_auth_algo qat_hash_alg) switch (qat_hash_alg) { case ICP_QAT_HW_AUTH_ALGO_SHA1: return ICP_QAT_HW_SHA1_STATE1_SZ; + case ICP_QAT_HW_AUTH_ALGO_SHA224: + return ICP_QAT_HW_SHA224_STATE1_SZ; case ICP_QAT_HW_AUTH_ALGO_SHA256: return ICP_QAT_HW_SHA256_STATE1_SZ; case ICP_QAT_HW_AUTH_ALGO_SHA512: @@ -129,6 +134,8 @@ static int qat_hash_get_block_size(enum icp_qat_hw_auth_algo qat_hash_alg) switch (qat_hash_alg) { case ICP_QAT_HW_AUTH_ALGO_SHA1: return SHA_CBLOCK; + case ICP_QAT_HW_AUTH_ALGO_SHA224: + return SHA256_CBLOCK; case ICP_QAT_HW_AUTH_ALGO_SHA256: return SHA256_CBLOCK; case ICP_QAT_HW_AUTH_ALGO_SHA512: @@ -158,6 +165,17 @@ static int partial_hash_sha1(uint8_t *data_in, uint8_t *data_out) return 0; } +static int partial_hash_sha224(uint8_t *data_in, uint8_t *data_out) +{ + SHA256_CTX ctx; + + if (!SHA224_Init(&ctx)) + return -EFAULT; + SHA256_Transform(&ctx, data_in); + rte_memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); + return 0; +} + static int partial_hash_sha256(uint8_t *data_in, uint8_t *data_out) { SHA256_CTX ctx; @@ -220,6 +238,13 @@ static int partial_hash_compute(enum icp_qat_hw_auth_algo hash_alg, *hash_state_out_be32 = rte_bswap32(*(((uint32_t *)digest)+i)); break; + case ICP_QAT_HW_AUTH_ALGO_SHA224: + if (partial_hash_sha224(data_in, digest)) + return -EFAULT; + for (i = 0; i < digest_size >> 2; i++, hash_state_out_be32++) + *hash_state_out_be32 = + rte_bswap32(*(((uint32_t *)digest)+i)); + break; case ICP_QAT_HW_AUTH_ALGO_SHA256: if (partial_hash_sha256(data_in, digest)) return -EFAULT; @@ -575,6 +600,14 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, } state2_size = RTE_ALIGN_CEIL(ICP_QAT_HW_SHA1_STATE2_SZ, 8); break; + case ICP_QAT_HW_AUTH_ALGO_SHA224: + if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SHA224, + authkey, authkeylen, cdesc->cd_cur_ptr, &state1_size)) { + PMD_DRV_LOG(ERR, "(SHA)precompute failed"); + return -EFAULT; + } + state2_size = ICP_QAT_HW_SHA224_STATE2_SZ; + break; case ICP_QAT_HW_AUTH_ALGO_SHA256: if (qat_alg_do_precomputes(ICP_QAT_HW_AUTH_ALGO_SH
[dpdk-dev] [PATCH v3 0/2] add aes-sha224-hmac support to Intel QAT driver
This patchset adds support of aes-sha224-hmac in Intel(R) QuickAssist Technology driver. This patchset depends on following patchset: "crypto/qat: add MD5 HMAC capability to Intel QAT driver" (http://dpdk.org/dev/patchwork/patch/15754/) Jain, Deepak K (2): crypto/qat: add aes-sha224-hmac capability to Intel QAT driver app/test: add test cases for aes-sha224-hmac for Intel QAT driver Changes in v3: * Cover letter updated with correct information about sha224-hmac. Changes in v2: * Added new feature information in release_16_11.rst file. * Added information about sha224-hmac in capabilities. app/test/test_cryptodev_aes.c| 6 +++-- doc/guides/cryptodevs/qat.rst| 1 + doc/guides/rel_notes/release_16_11.rst | 1 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 33 drivers/crypto/qat/qat_crypto.c | 25 +- 5 files changed, 63 insertions(+), 3 deletions(-) -- 2.5.5
[dpdk-dev] [PATCH] maintainers: claim responsability for crypto subtree
2016-08-30 19:47, Pablo de Lara: > From 16.07, I will be the maintainer of the crypto subtree. [...] > Crypto Drivers > -- > +T: Pablo de Lara I think that the syntax should be: M: Pablo de Lara T: git://dpdk.org/dpdk-next-crypto
[dpdk-dev] [PATCH 19/19] kni: move kernel version ifdefs to compat header
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/compat.h| 12 lib/librte_eal/linuxapp/kni/kni_vhost.c | 16 +--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h index 9ae50a7..78da08e 100644 --- a/lib/librte_eal/linuxapp/kni/compat.h +++ b/lib/librte_eal/linuxapp/kni/compat.h @@ -20,6 +20,14 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) #define sk_sleep(s) ((s)->sk_sleep) +#else +#define HAVE_SOCKET_WQ +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) +#define HAVE_STATIC_SOCK_MAP_FD +#else +#define kni_sock_map_fd(s) sock_map_fd(s, 0) #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) @@ -39,6 +47,10 @@ #define HAVE_REBUILD_HEADER #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) +#define HAVE_SK_ALLOC_KERN_PARAM +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) #define HAVE_TRANS_START_HELPER #endif diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index 3ba0c57..f54c34b 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -40,7 +40,7 @@ #define RX_BURST_SZ 4 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) +#ifdef HAVE_STATIC_SOCK_MAP_FD static int kni_sock_map_fd(struct socket *sock) { struct file *file; @@ -57,8 +57,6 @@ static int kni_sock_map_fd(struct socket *sock) fd_install(fd, file); return fd; } -#else -#define kni_sock_map_fd(s) sock_map_fd(s, 0) #endif static struct proto kni_raw_proto = { @@ -225,17 +223,13 @@ kni_sock_poll(struct file *file, struct socket *sock, poll_table *wait) return POLLERR; kni = q->kni; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) +#ifdef HAVE_SOCKET_WQ pr_debug("start kni_poll on group %d, wq 0x%16llx\n", kni->group_id, (uint64_t)sock->wq); + poll_wait(file, &sock->wq->wait, wait); #else pr_debug("start kni_poll on group %d, wait at 0x%16llx\n", kni->group_id, (uint64_t)&sock->wait); -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - poll_wait(file, &sock->wq->wait, wait); -#else poll_wait(file, &sock->wait, wait); #endif @@ -663,7 +657,7 @@ kni_vhost_backend_init(struct kni_dev *kni) if (kni->vhost_queue != NULL) return -1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) +#ifdef HAVE_SK_ALLOC_KERN_PARAM q = (struct kni_vhost_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, &kni_raw_proto, 0); #else @@ -729,7 +723,7 @@ kni_vhost_backend_init(struct kni_dev *kni) kni->vq_status = BE_START; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) +#ifdef HAVE_SOCKET_WQ pr_debug("backend init sockfd=%d, sock->wq=0x%16llx,sk->sk_wq=0x%16llx", q->sockfd, (uint64_t)q->sock->wq, (uint64_t)q->sk.sk_wq); -- 2.7.4
[dpdk-dev] [PATCH 18/19] kni: prefer uint32_t to unsigned int
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_dev.h | 8 lib/librte_eal/linuxapp/kni/kni_fifo.h | 22 +++--- lib/librte_eal/linuxapp/kni/kni_misc.c | 17 +++-- lib/librte_eal/linuxapp/kni/kni_net.c | 24 lib/librte_eal/linuxapp/kni/kni_vhost.c | 25 - 5 files changed, 46 insertions(+), 50 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index 3693760..48f8dad 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -55,7 +55,7 @@ struct kni_dev { struct net_device_stats stats; int status; uint16_t group_id; /* Group ID of a group of KNI devices */ - unsigned int core_id;/* Core ID to bind */ + uint32_t core_id;/* Core ID to bind */ char name[RTE_KNI_NAMESIZE]; /* Network device name */ struct task_struct *pthread; @@ -96,7 +96,7 @@ struct kni_dev { void *mbuf_va; /* mbuf size */ - unsigned int mbuf_size; + uint32_t mbuf_size; /* synchro for request processing */ unsigned long synchro; @@ -113,7 +113,7 @@ struct kni_dev { }; #ifdef RTE_KNI_VHOST -unsigned int +uint32_t kni_poll(struct file *file, struct socket *sock, poll_table * wait); int kni_chk_vhost_rx(struct kni_dev *kni); int kni_vhost_init(struct kni_dev *kni); @@ -125,7 +125,7 @@ struct kni_vhost_queue { int vnet_hdr_sz; struct kni_dev *kni; int sockfd; - unsigned int flags; + uint32_t flags; struct sk_buff *cache; struct rte_kni_fifo *fifo; }; diff --git a/lib/librte_eal/linuxapp/kni/kni_fifo.h b/lib/librte_eal/linuxapp/kni/kni_fifo.h index 71bc2a9..77048a1 100644 --- a/lib/librte_eal/linuxapp/kni/kni_fifo.h +++ b/lib/librte_eal/linuxapp/kni/kni_fifo.h @@ -31,12 +31,12 @@ * Adds num elements into the fifo. Return the number actually written */ static inline unsigned -kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned int num) +kni_fifo_put(struct rte_kni_fifo *fifo, void **data, uint32_t num) { - unsigned int i = 0; - unsigned int fifo_write = fifo->write; - unsigned int fifo_read = fifo->read; - unsigned int new_write = fifo_write; + uint32_t i = 0; + uint32_t fifo_write = fifo->write; + uint32_t fifo_read = fifo->read; + uint32_t new_write = fifo_write; for (i = 0; i < num; i++) { new_write = (new_write + 1) & (fifo->len - 1); @@ -55,11 +55,11 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned int num) * Get up to num elements from the fifo. Return the number actully read */ static inline unsigned -kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned int num) +kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num) { - unsigned int i = 0; - unsigned int new_read = fifo->read; - unsigned int fifo_write = fifo->write; + uint32_t i = 0; + uint32_t new_read = fifo->read; + uint32_t fifo_write = fifo->write; for (i = 0; i < num; i++) { if (new_read == fifo_write) @@ -85,7 +85,7 @@ kni_fifo_count(struct rte_kni_fifo *fifo) /** * Get the num of available elements in the fifo */ -static inline unsigned int +static inline uint32_t kni_fifo_free_count(struct rte_kni_fifo *fifo) { return (fifo->read - fifo->write - 1) & (fifo->len - 1); @@ -96,7 +96,7 @@ kni_fifo_free_count(struct rte_kni_fifo *fifo) * Initializes the kni fifo structure */ static inline void -kni_fifo_init(struct rte_kni_fifo *fifo, unsigned int size) +kni_fifo_init(struct rte_kni_fifo *fifo, uint32_t size) { fifo->write = 0; fifo->read = 0; diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index e036a98..f0d76a3 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -52,7 +52,7 @@ static char *lo_mode; /* Kernel thread mode */ static char *kthread_mode; -static unsigned int multiple_kthread_on; +static uint32_t multiple_kthread_on; #define KNI_DEV_IN_USE_BIT_NUM 0 /* Bit number for device in use */ @@ -276,8 +276,8 @@ kni_check_param(struct kni_dev *kni, struct rte_kni_device_info *dev) } static int -kni_ioctl_create(struct net *net, - unsigned int ioctl_num, unsigned long ioctl_param) +kni_ioctl_create(struct net *net, uint32_t ioctl_num, + unsigned long ioctl_param) { struct kni_net *knet = net_generic(net, kni_net_id); int ret; @@ -470,8 +470,8 @@ kni_ioctl_create(struct net *net, } static int -kni_ioctl_release(struct net *net, - unsigned int ioctl_num, unsigned long ioctl_param) +kni_ioctl_release(struct net *net, uint32_t ioctl_num, + unsigned long ioctl_param) { struct kni_net *knet =
[dpdk-dev] [PATCH 17/19] kni: updated log messages
Remove some function entrance logs and changed log level of some logs. Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_misc.c | 9 ++--- lib/librte_eal/linuxapp/kni/kni_net.c | 6 ++ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 1bcb3db..e036a98 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -183,7 +183,7 @@ kni_open(struct inode *inode, struct file *file) /* Create kernel thread for single mode */ if (multiple_kthread_on == 0) { - pr_debug("Single kernel thread for all KNI devices\n"); + pr_info("Single kernel thread for all KNI devices\n"); /* Create kernel thread for RX */ knet->kni_kthread = kthread_run(kni_thread_single, (void *)knet, "kni_single"); @@ -192,7 +192,7 @@ kni_open(struct inode *inode, struct file *file) return PTR_ERR(knet->kni_kthread); } } else - pr_debug("Multiple kernel thread mode enabled\n"); + pr_info("Multiple kernel thread mode enabled\n"); file->private_data = get_net(net); pr_debug("/dev/kni opened\n"); @@ -593,8 +593,6 @@ kni_init(void) { int rc; - pr_debug(" DPDK kni module loading \n"); - if (kni_parse_kthread_mode() < 0) { pr_err("Invalid parameter for kthread_mode\n"); return -EINVAL; @@ -617,8 +615,6 @@ kni_init(void) /* Configure the lo mode according to the input parameter */ kni_net_config_lo_mode(lo_mode); - pr_debug(" DPDK kni module loaded \n"); - return 0; out: @@ -639,7 +635,6 @@ kni_exit(void) #else unregister_pernet_gen_subsys(kni_net_id, &kni_net_ops); #endif - pr_debug("### DPDK kni module unloaded ###\n"); } module_init(kni_init); diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 12dd89f..7c3e30b 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -560,8 +560,8 @@ kni_net_tx_timeout(struct net_device *dev) static int kni_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - pr_debug("kni_net_ioctl %d\n", - ((struct kni_dev *)netdev_priv(dev))->group_id); + pr_debug("kni_net_ioctl group:%d cmd:%d\n", + ((struct kni_dev *)netdev_priv(dev))->group_id, cmd); return 0; } @@ -704,8 +704,6 @@ kni_net_init(struct net_device *dev) { struct kni_dev *kni = netdev_priv(dev); - pr_debug("kni_net_init\n"); - init_waitqueue_head(&kni->wq); mutex_init(&kni->sync_lock); -- 2.7.4
[dpdk-dev] [PATCH 16/19] kni: remove compile time debug configuration
Since switched to kernel dynamic debugging it is possible to remove compile time debug log configuration. Signed-off-by: Ferruh Yigit --- config/common_base | 3 --- lib/librte_eal/linuxapp/kni/kni_dev.h | 18 - lib/librte_eal/linuxapp/kni/kni_misc.c | 8 +++--- lib/librte_eal/linuxapp/kni/kni_net.c | 8 +++--- lib/librte_eal/linuxapp/kni/kni_vhost.c | 46 - 5 files changed, 31 insertions(+), 52 deletions(-) diff --git a/config/common_base b/config/common_base index 7830535..4a9e5b0 100644 --- a/config/common_base +++ b/config/common_base @@ -533,12 +533,9 @@ CONFIG_RTE_PIPELINE_STATS_COLLECT=n CONFIG_RTE_LIBRTE_KNI=n CONFIG_RTE_KNI_KMOD=n CONFIG_RTE_KNI_PREEMPT_DEFAULT=y -CONFIG_RTE_KNI_KO_DEBUG=n CONFIG_RTE_KNI_VHOST=n CONFIG_RTE_KNI_VHOST_MAX_CACHE_SIZE=1024 CONFIG_RTE_KNI_VHOST_VNET_HDR_EN=n -CONFIG_RTE_KNI_VHOST_DEBUG_RX=n -CONFIG_RTE_KNI_VHOST_DEBUG_TX=n # # Compile the pdump library diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index 10e760e..3693760 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -112,12 +112,6 @@ struct kni_dev { #endif }; -#ifdef RTE_KNI_KO_DEBUG - #define KNI_DBG(args...) pr_debug(args) -#else - #define KNI_DBG(args...) -#endif - #ifdef RTE_KNI_VHOST unsigned int kni_poll(struct file *file, struct socket *sock, poll_table * wait); @@ -151,16 +145,4 @@ int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev); void igb_kni_remove(struct pci_dev *pdev); extern struct pci_device_id *igb_pci_tbl; -#ifdef RTE_KNI_VHOST_DEBUG_RX - #define KNI_DBG_RX(args...) pr_debug(args) -#else - #define KNI_DBG_RX(args...) -#endif - -#ifdef RTE_KNI_VHOST_DEBUG_TX - #define KNI_DBG_TX(args...) pr_debug(args) -#else - #define KNI_DBG_TX(args...) -#endif - #endif diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 64e20c1..1bcb3db 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -376,7 +376,7 @@ kni_ioctl_create(struct net *net, pr_debug("mbuf_va: 0x%p\n", dev_info.mbuf_va); pr_debug("mbuf_size:%u\n", kni->mbuf_size); - KNI_DBG("PCI: %02x:%02x.%02x %04x:%04x\n", + pr_debug("PCI: %02x:%02x.%02x %04x:%04x\n", dev_info.bus, dev_info.devid, dev_info.function, @@ -404,7 +404,7 @@ kni_ioctl_create(struct net *net, else ret = -1; - KNI_DBG("PCI found: pci=0x%p, lad_dev=0x%p\n", + pr_debug("PCI found: pci=0x%p, lad_dev=0x%p\n", pci, lad_dev); if (ret == 0) { kni->lad_dev = lad_dev; @@ -524,7 +524,7 @@ kni_ioctl(struct inode *inode, int ret = -EINVAL; struct net *net = current->nsproxy->net_ns; - KNI_DBG("IOCTL num=0x%0x param=0x%0lx\n", ioctl_num, ioctl_param); + pr_debug("IOCTL num=0x%0x param=0x%0lx\n", ioctl_num, ioctl_param); /* * Switch according to the ioctl called @@ -540,7 +540,7 @@ kni_ioctl(struct inode *inode, ret = kni_ioctl_release(net, ioctl_num, ioctl_param); break; default: - KNI_DBG("IOCTL default\n"); + pr_debug("IOCTL default\n"); break; } diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index a732cbd..12dd89f 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -547,7 +547,7 @@ kni_net_tx_timeout(struct net_device *dev) { struct kni_dev *kni = netdev_priv(dev); - KNI_DBG("Transmit timeout at %ld, latency %ld\n", jiffies, + pr_debug("Transmit timeout at %ld, latency %ld\n", jiffies, jiffies - dev->trans_start); kni->stats.tx_errors++; @@ -560,7 +560,7 @@ kni_net_tx_timeout(struct net_device *dev) static int kni_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - KNI_DBG("kni_net_ioctl %d\n", + pr_debug("kni_net_ioctl %d\n", ((struct kni_dev *)netdev_priv(dev))->group_id); return 0; @@ -578,7 +578,7 @@ kni_net_change_mtu(struct net_device *dev, int new_mtu) struct rte_kni_request req; struct kni_dev *kni = netdev_priv(dev); - KNI_DBG("kni_net_change_mtu new mtu %d to be set\n", new_mtu); + pr_debug("kni_net_change_mtu new mtu %d to be set\n", new_mtu); memset(&req, 0, sizeof(req)); req.req_id = RTE_KNI_REQ_CHANGE_MTU; @@ -704,7 +704,7 @@ kni_net_init(struct net_device *dev) { struct kni_dev *kni = netdev_priv(de
[dpdk-dev] [PATCH 15/19] kni: move functions to eliminate function declarations
Function implementations kept same. Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_misc.c | 301 - lib/librte_eal/linuxapp/kni/kni_net.c | 293 2 files changed, 287 insertions(+), 307 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 1941c26..64e20c1 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -47,35 +47,6 @@ MODULE_DESCRIPTION("Kernel Module for managing kni devices"); #define KNI_MAX_DEVICES 32 -static int kni_open(struct inode *inode, struct file *file); -static int kni_release(struct inode *inode, struct file *file); -static int kni_ioctl(struct inode *inode, unsigned int ioctl_num, - unsigned long ioctl_param); -static int kni_compat_ioctl(struct inode *inode, unsigned int ioctl_num, - unsigned long ioctl_param); -static int kni_dev_remove(struct kni_dev *dev); - -static int __init kni_parse_kthread_mode(void); - -/* KNI processing for single kernel thread mode */ -static int kni_thread_single(void *unused); -/* KNI processing for multiple kernel thread mode */ -static int kni_thread_multiple(void *param); - -static const struct file_operations kni_fops = { - .owner = THIS_MODULE, - .open = kni_open, - .release = kni_release, - .unlocked_ioctl = (void *)kni_ioctl, - .compat_ioctl = (void *)kni_compat_ioctl, -}; - -static struct miscdevice kni_misc = { - .minor = MISC_DYNAMIC_MINOR, - .name = KNI_DEVICE, - .fops = &kni_fops, -}; - /* loopback mode */ static char *lo_mode; @@ -146,72 +117,56 @@ static struct pernet_operations kni_net_ops = { #endif }; -static int __init -kni_init(void) +static int +kni_thread_single(void *data) { - int rc; - - pr_debug(" DPDK kni module loading \n"); - - if (kni_parse_kthread_mode() < 0) { - pr_err("Invalid parameter for kthread_mode\n"); - return -EINVAL; - } + struct kni_net *knet = data; + int j; + struct kni_dev *dev; -#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS - rc = register_pernet_subsys(&kni_net_ops); + while (!kthread_should_stop()) { + down_read(&knet->kni_list_lock); + for (j = 0; j < KNI_RX_LOOP_NUM; j++) { + list_for_each_entry(dev, &knet->kni_list_head, list) { +#ifdef RTE_KNI_VHOST + kni_chk_vhost_rx(dev); #else - rc = register_pernet_gen_subsys(&kni_net_id, &kni_net_ops); + kni_net_rx(dev); +#endif + kni_net_poll_resp(dev); + } + } + up_read(&knet->kni_list_lock); +#ifdef RTE_KNI_PREEMPT_DEFAULT + /* reschedule out for a while */ + schedule_timeout_interruptible( + usecs_to_jiffies(KNI_KTHREAD_RESCHEDULE_INTERVAL)); #endif - if (rc) - return -EPERM; - - rc = misc_register(&kni_misc); - if (rc != 0) { - pr_err("Misc registration failed\n"); - goto out; } - /* Configure the lo mode according to the input parameter */ - kni_net_config_lo_mode(lo_mode); - - pr_debug(" DPDK kni module loaded \n"); - return 0; - -out: -#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS - unregister_pernet_subsys(&kni_net_ops); -#else - unregister_pernet_gen_subsys(kni_net_id, &kni_net_ops); -#endif - return rc; } -static void __exit -kni_exit(void) +static int +kni_thread_multiple(void *param) { - misc_deregister(&kni_misc); -#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS - unregister_pernet_subsys(&kni_net_ops); + int j; + struct kni_dev *dev = (struct kni_dev *)param; + + while (!kthread_should_stop()) { + for (j = 0; j < KNI_RX_LOOP_NUM; j++) { +#ifdef RTE_KNI_VHOST + kni_chk_vhost_rx(dev); #else - unregister_pernet_gen_subsys(kni_net_id, &kni_net_ops); + kni_net_rx(dev); #endif - pr_debug("### DPDK kni module unloaded ###\n"); -} - -static int __init -kni_parse_kthread_mode(void) -{ - if (!kthread_mode) - return 0; - - if (strcmp(kthread_mode, "single") == 0) - return 0; - else if (strcmp(kthread_mode, "multiple") == 0) - multiple_kthread_on = 1; - else - return -1; + kni_net_poll_resp(dev); + } +#ifdef RTE_KNI_PREEMPT_DEFAULT + schedule_timeout_interruptible( + usecs_to_jiffies(KNI_KTHREAD_RESCHEDULE_INTERVAL)); +#endif + } return 0; } @@ -246,6 +201,27 @@ kni_open(struct inode *inode, struct file *file)
[dpdk-dev] [PATCH 14/19] kni: remove unnecessary 'out of memory' message
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_net.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 1dca5f0..9585879 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -156,7 +156,6 @@ kni_net_rx_normal(struct kni_dev *kni) skb = dev_alloc_skb(len + 2); if (!skb) { - pr_err("Out of mem, dropping pkts\n"); /* Update statistics */ kni->stats.rx_dropped++; continue; @@ -335,9 +334,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni) kni->mbuf_kva; skb = dev_alloc_skb(len + 2); - if (skb == NULL) - pr_err("Out of mem, dropping pkts\n"); - else { + if (skb) { /* Align IP on 16B boundary */ skb_reserve(skb, 2); memcpy(skb_put(skb, len), data_kva, len); @@ -349,7 +346,6 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni) /* Simulate real usage, allocate/copy skb twice */ skb = dev_alloc_skb(len + 2); if (skb == NULL) { - pr_err("Out of mem, dropping pkts\n"); kni->stats.rx_dropped++; continue; } -- 2.7.4
[dpdk-dev] [PATCH 13/19] kni: update kernel logging
Switch to dynamic logging functions. Depending kernel configuration this may cause previously visible logs disappear. How to enable dynamic logging: https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_dev.h | 13 --- lib/librte_eal/linuxapp/kni/kni_misc.c | 60 - lib/librte_eal/linuxapp/kni/kni_net.c | 34 +-- lib/librte_eal/linuxapp/kni/kni_vhost.c | 12 +++ 4 files changed, 61 insertions(+), 58 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index d30d7ab..10e760e 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -25,6 +25,11 @@ #ifndef _KNI_DEV_H_ #define _KNI_DEV_H_ +#ifdef pr_fmt +#undef pr_fmt +#endif +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -107,10 +112,8 @@ struct kni_dev { #endif }; -#define KNI_ERR(args...) printk(KERN_DEBUG "KNI: Error: " args) -#define KNI_PRINT(args...) printk(KERN_DEBUG "KNI: " args) #ifdef RTE_KNI_KO_DEBUG - #define KNI_DBG(args...) printk(KERN_DEBUG "KNI: " args) + #define KNI_DBG(args...) pr_debug(args) #else #define KNI_DBG(args...) #endif @@ -149,13 +152,13 @@ void igb_kni_remove(struct pci_dev *pdev); extern struct pci_device_id *igb_pci_tbl; #ifdef RTE_KNI_VHOST_DEBUG_RX - #define KNI_DBG_RX(args...) printk(KERN_DEBUG "KNI RX: " args) + #define KNI_DBG_RX(args...) pr_debug(args) #else #define KNI_DBG_RX(args...) #endif #ifdef RTE_KNI_VHOST_DEBUG_TX - #define KNI_DBG_TX(args...) printk(KERN_DEBUG "KNI TX: " args) + #define KNI_DBG_TX(args...) pr_debug(args) #else #define KNI_DBG_TX(args...) #endif diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 6dc8f6e..1941c26 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -151,10 +151,10 @@ kni_init(void) { int rc; - KNI_PRINT(" DPDK kni module loading \n"); + pr_debug(" DPDK kni module loading \n"); if (kni_parse_kthread_mode() < 0) { - KNI_ERR("Invalid parameter for kthread_mode\n"); + pr_err("Invalid parameter for kthread_mode\n"); return -EINVAL; } @@ -168,14 +168,14 @@ kni_init(void) rc = misc_register(&kni_misc); if (rc != 0) { - KNI_ERR("Misc registration failed\n"); + pr_err("Misc registration failed\n"); goto out; } /* Configure the lo mode according to the input parameter */ kni_net_config_lo_mode(lo_mode); - KNI_PRINT(" DPDK kni module loaded \n"); + pr_debug(" DPDK kni module loaded \n"); return 0; @@ -197,7 +197,7 @@ kni_exit(void) #else unregister_pernet_gen_subsys(kni_net_id, &kni_net_ops); #endif - KNI_PRINT("### DPDK kni module unloaded ###\n"); + pr_debug("### DPDK kni module unloaded ###\n"); } static int __init @@ -228,19 +228,19 @@ kni_open(struct inode *inode, struct file *file) /* Create kernel thread for single mode */ if (multiple_kthread_on == 0) { - KNI_PRINT("Single kernel thread for all KNI devices\n"); + pr_debug("Single kernel thread for all KNI devices\n"); /* Create kernel thread for RX */ knet->kni_kthread = kthread_run(kni_thread_single, (void *)knet, "kni_single"); if (IS_ERR(knet->kni_kthread)) { - KNI_ERR("Unable to create kernel threaed\n"); + pr_err("Unable to create kernel threaed\n"); return PTR_ERR(knet->kni_kthread); } } else - KNI_PRINT("Multiple kernel thread mode enabled\n"); + pr_debug("Multiple kernel thread mode enabled\n"); file->private_data = get_net(net); - KNI_PRINT("/dev/kni opened\n"); + pr_debug("/dev/kni opened\n"); return 0; } @@ -279,7 +279,7 @@ kni_release(struct inode *inode, struct file *file) clear_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use); put_net(net); - KNI_PRINT("/dev/kni closed\n"); + pr_debug("/dev/kni closed\n"); return 0; } @@ -367,7 +367,7 @@ kni_check_param(struct kni_dev *kni, struct rte_kni_device_info *dev) /* Check if network name has been used */ if (!strncmp(kni->name, dev->name, RTE_KNI_NAMESIZE)) { - KNI_ERR("KNI name %s duplicated\n", dev->name); + pr_err("KNI name %s duplicated\n", dev->name); return -1; } @@ -387,7 +387,7 @@ kni_ioctl_create(struct net *net, struct net_device *lad
[dpdk-dev] [PATCH 12/19] kni: prefer ether_addr_copy to memcpy
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/compat.h | 4 lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h index d79d626..9ae50a7 100644 --- a/lib/librte_eal/linuxapp/kni/compat.h +++ b/lib/librte_eal/linuxapp/kni/compat.h @@ -26,6 +26,10 @@ #define HAVE_CHANGE_CARRIER_CB #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) +#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN) +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) #define HAVE_IOV_ITER_MSGHDR #endif diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 0cbc499..6dc8f6e 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -524,7 +524,7 @@ kni_ioctl_create(struct net *net, pci_dev_put(pci); if (kni->lad_dev) - memcpy(net_dev->dev_addr, kni->lad_dev->dev_addr, ETH_ALEN); + ether_addr_copy(net_dev->dev_addr, kni->lad_dev->dev_addr); else /* * Generate random mac address. eth_random_addr() is the newer -- 2.7.4
[dpdk-dev] [RFC PATCH v2 3/5] librte_ether: add API's for VF management
Hi Thomas, > Subject: Re: [dpdk-dev] [RFC PATCH v2 3/5] librte_ether: add API's for VF > management > > 2016-09-12 16:28, Iremonger, Bernard: > > > On Fri, Aug 26, 2016 at 10:10:18AM +0100, Bernard Iremonger wrote: > > > > Add new API functions to configure and manage VF's on a NIC. > > > > > > > > add rte_eth_dev_vf_ping function. > > > > add rte_eth_dev_set_vf_vlan_anti_spoof function. > > > > add rte_eth_dev_set_vf_mac_anti_spoof function. > > > > > > > > Signed-off-by: azelezniak > > > > > > > > add rte_eth_dev_set_vf_vlan_strip function. > > > > add rte_eth_dev_set_vf_vlan_insert function. > > > > add rte_eth_dev_set_loopback function. > > > > add rte_eth_dev_set_all_queues_drop function. > > > > add rte_eth_dev_set_vf_split_drop_en function add > > > > rte_eth_dev_set_vf_mac_addr function. > > > > > > Do we really need to expose VF specific functions here? > > > It can be generic(PF/VF) function indexed only through port_id. > > > (example: as rte_eth_dev_set_vlan_anti_spoof(uint8_t port_id, > > > uint8_t on)) For instance, In Thunderx PMD, We are not exposing a > > > separate port_id for PF. We only enumerate 0..N VFs as 0..N ethdev > > > port_id > > > > Our intention with this patch is to control the VF from the PF. > > > > The following librte_ether functions already work in a similar way: > > > > rte_eth_dev_set_vf_rxmode(uint8_t port_id, uint16_t vf, uint16_t > > rx_mode, uint8_t on) > > > > rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on) > > > > rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on) > > > > int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf, uint16_t > > tx_rate, uint64_t q_msk) > > I have a bad feeling with these functions dedicated to VF from PF. > Are we sure there is no other way? > I mean we just need to know the VF with a port ID. When the VF is used in a VM the port ID of the VF is not visible to the PF. I don't think there is another way to do this. Regards, Bernard.
[dpdk-dev] [PATCH 11/19] kni: prefer min_t to min
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_net.c | 6 +++--- lib/librte_eal/linuxapp/kni/kni_vhost.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 81d139e..a6458fa 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -139,7 +139,7 @@ kni_net_rx_normal(struct kni_dev *kni) } /* Calculate the number of entries to dequeue from rx_q */ - num_rx = min(num_fq, (unsigned int)MBUF_BURST_SZ); + num_rx = min_t(unsigned int, num_fq, MBUF_BURST_SZ); /* Burst dequeue from rx_q */ num_rx = kni_fifo_get(kni->rx_q, (void **)va, num_rx); @@ -236,7 +236,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni) num = min(num_rq, num_tq); num = min(num, num_aq); num = min(num, num_fq); - num = min(num, (unsigned int)MBUF_BURST_SZ); + num = min_t(unsigned int, num, MBUF_BURST_SZ); /* Return if no entry to dequeue from rx_q */ if (num == 0) @@ -316,7 +316,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni) /* Calculate the number of entries to dequeue from rx_q */ num = min(num_rq, num_fq); - num = min(num, (unsigned int)MBUF_BURST_SZ); + num = min_t(unsigned int, num, MBUF_BURST_SZ); /* Return if no entry to dequeue from rx_q */ if (num == 0) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index eacfe3f..e460dd6 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -299,7 +299,7 @@ kni_chk_vhost_rx(struct kni_dev *kni) nb_mbuf = kni_fifo_count(kni->rx_q); nb_in = min(nb_mbuf, nb_skb); - nb_in = min(nb_in, (unsigned int)RX_BURST_SZ); + nb_in = min_t(unsigned int, nb_in, RX_BURST_SZ); nb_burst = (nb_in & ~BURST_MASK); nb_backlog = (nb_in & BURST_MASK); -- 2.7.4
[dpdk-dev] [PATCH 10/19] kni: macros with complex values should be enclosed in parentheses
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h index 962a4e7..d79d626 100644 --- a/lib/librte_eal/linuxapp/kni/compat.h +++ b/lib/librte_eal/linuxapp/kni/compat.h @@ -19,7 +19,7 @@ #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) -#define sk_sleep(s) (s)->sk_sleep +#define sk_sleep(s) ((s)->sk_sleep) #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) -- 2.7.4
[dpdk-dev] [PATCH 09/19] kni: do not use assignment in if condition
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_vhost.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index bef4889..eacfe3f 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -410,13 +410,14 @@ kni_sock_rcvmsg(struct socket *sock, #ifdef RTE_KNI_VHOST_VNET_HDR_EN if (likely(q->flags & IFF_VNET_HDR)) { vnet_hdr_len = q->vnet_hdr_sz; - if ((len -= vnet_hdr_len) < 0) + len -= vnet_hdr_len; + if (len < 0) return -EINVAL; } #endif - if (unlikely(0 == (pkt_len = kni_vhost_net_rx(q->kni, - m, vnet_hdr_len, len + pkt_len = kni_vhost_net_rx(q->kni, m, vnet_hdr_len, len); + if (unlikely(pkt_len == 0)) return 0; #ifdef RTE_KNI_VHOST_VNET_HDR_EN @@ -567,7 +568,8 @@ kni_sock_release(struct socket *sock) if (q == NULL) return 0; - if (NULL != (kni = q->kni)) { + kni = q->kni; + if (kni != NULL) { kni->vq_status = BE_STOP; KNI_VHOST_WAIT_WQ_SAFE(); kni->vhost_queue = NULL; -- 2.7.4
[dpdk-dev] [PATCH 08/19] kni: trailing statements should be on next line
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_vhost.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index ec39538..bef4889 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -244,11 +244,12 @@ kni_sock_poll(struct file *file, struct socket *sock, poll_table *wait) if (sock_writeable(&q->sk) || #ifdef SOCKWQ_ASYNC_NOSPACE - (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &q->sock->flags) && + (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &q->sock->flags) && + sock_writeable(&q->sk))) #else - (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &q->sock->flags) && + (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &q->sock->flags) && + sock_writeable(&q->sk))) #endif -sock_writeable(&q->sk))) mask |= POLLOUT | POLLWRNORM; return mask; -- 2.7.4
[dpdk-dev] [PATCH 07/19] kni: comparisons should place the constant on the right
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_vhost.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index f1345c3..ec39538 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -169,7 +169,7 @@ kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m, /* free skb to cache */ skb->data = NULL; - if (unlikely(1 != kni_fifo_put(q->fifo, (void **)&skb, 1))) + if (unlikely(kni_fifo_put(q->fifo, (void **)&skb, 1) != 1)) /* Failing should not happen */ KNI_ERR("Fail to enqueue entries into rx cache fifo\n"); @@ -197,8 +197,8 @@ kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m, kni->stats.rx_packets++; /* enqueue mbufs into free_q */ - va = (void*)kva - kni->mbuf_kva + kni->mbuf_va; - if (unlikely(1 != kni_fifo_put(kni->free_q, (void **)&va, 1))) + va = (void *)kva - kni->mbuf_kva + kni->mbuf_va; + if (unlikely(kni_fifo_put(kni->free_q, (void **)&va, 1) != 1)) /* Failing should not happen */ KNI_ERR("Fail to enqueue entries into free_q\n"); @@ -303,15 +303,13 @@ kni_chk_vhost_rx(struct kni_dev *kni) nb_backlog = (nb_in & BURST_MASK); /* enqueue skb_queue per BURST_SIZE bulk */ - if (0 != nb_burst) { - if (unlikely(RX_BURST_SZ != kni_fifo_get( -kni->rx_q, (void **)&va, -RX_BURST_SZ))) + if (nb_burst != 0) { + if (unlikely(kni_fifo_get(kni->rx_q, (void **)&va, RX_BURST_SZ) + != RX_BURST_SZ)) goto except; - if (unlikely(RX_BURST_SZ != kni_fifo_get( -q->fifo, (void **)&skb, -RX_BURST_SZ))) + if (unlikely(kni_fifo_get(q->fifo, (void **)&skb, RX_BURST_SZ) + != RX_BURST_SZ)) goto except; kni_vhost_enqueue_burst(kni, q, skb, va); @@ -319,12 +317,10 @@ kni_chk_vhost_rx(struct kni_dev *kni) /* all leftover, do one by one */ for (i = 0; i < nb_backlog; ++i) { - if (unlikely(1 != kni_fifo_get( -kni->rx_q,(void **)&va, 1))) + if (unlikely(kni_fifo_get(kni->rx_q, (void **)&va, 1) != 1)) goto except; - if (unlikely(1 != kni_fifo_get( -q->fifo, (void **)&skb, 1))) + if (unlikely(kni_fifo_get(q->fifo, (void **)&skb, 1) != 1)) goto except; kni_vhost_enqueue(kni, q, *skb, *va); @@ -797,7 +793,7 @@ set_sock_en(struct device *dev, struct device_attribute *attr, unsigned long en; int err = 0; - if (0 != kstrtoul(buf, 0, &en)) + if (kstrtoul(buf, 0, &en) != 0) return -EINVAL; if (en) -- 2.7.4
[dpdk-dev] [PATCH 06/19] kni: remove useless return
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_net.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index f4afd83..81d139e 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -512,7 +512,6 @@ kni_net_tx_timeout(struct net_device *dev) kni->stats.tx_errors++; netif_wake_queue(dev); - return; } /* -- 2.7.4
[dpdk-dev] [PATCH 05/19] kni: prefer unsigned int to unsigned
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_dev.h | 4 ++-- lib/librte_eal/linuxapp/kni/kni_fifo.h | 22 +++--- lib/librte_eal/linuxapp/kni/kni_net.c | 22 +++--- lib/librte_eal/linuxapp/kni/kni_vhost.c | 12 ++-- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index 059defc..d30d7ab 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -50,7 +50,7 @@ struct kni_dev { struct net_device_stats stats; int status; uint16_t group_id; /* Group ID of a group of KNI devices */ - unsigned core_id;/* Core ID to bind */ + unsigned int core_id;/* Core ID to bind */ char name[RTE_KNI_NAMESIZE]; /* Network device name */ struct task_struct *pthread; @@ -91,7 +91,7 @@ struct kni_dev { void *mbuf_va; /* mbuf size */ - unsigned mbuf_size; + unsigned int mbuf_size; /* synchro for request processing */ unsigned long synchro; diff --git a/lib/librte_eal/linuxapp/kni/kni_fifo.h b/lib/librte_eal/linuxapp/kni/kni_fifo.h index 4006b1f..71bc2a9 100644 --- a/lib/librte_eal/linuxapp/kni/kni_fifo.h +++ b/lib/librte_eal/linuxapp/kni/kni_fifo.h @@ -31,12 +31,12 @@ * Adds num elements into the fifo. Return the number actually written */ static inline unsigned -kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned num) +kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned int num) { - unsigned i = 0; - unsigned fifo_write = fifo->write; - unsigned fifo_read = fifo->read; - unsigned new_write = fifo_write; + unsigned int i = 0; + unsigned int fifo_write = fifo->write; + unsigned int fifo_read = fifo->read; + unsigned int new_write = fifo_write; for (i = 0; i < num; i++) { new_write = (new_write + 1) & (fifo->len - 1); @@ -55,11 +55,11 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, unsigned num) * Get up to num elements from the fifo. Return the number actully read */ static inline unsigned -kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned num) +kni_fifo_get(struct rte_kni_fifo *fifo, void **data, unsigned int num) { - unsigned i = 0; - unsigned new_read = fifo->read; - unsigned fifo_write = fifo->write; + unsigned int i = 0; + unsigned int new_read = fifo->read; + unsigned int fifo_write = fifo->write; for (i = 0; i < num; i++) { if (new_read == fifo_write) @@ -85,7 +85,7 @@ kni_fifo_count(struct rte_kni_fifo *fifo) /** * Get the num of available elements in the fifo */ -static inline unsigned +static inline unsigned int kni_fifo_free_count(struct rte_kni_fifo *fifo) { return (fifo->read - fifo->write - 1) & (fifo->len - 1); @@ -96,7 +96,7 @@ kni_fifo_free_count(struct rte_kni_fifo *fifo) * Initializes the kni fifo structure */ static inline void -kni_fifo_init(struct rte_kni_fifo *fifo, unsigned size) +kni_fifo_init(struct rte_kni_fifo *fifo, unsigned int size) { fifo->write = 0; fifo->read = 0; diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index aa17f2c..f4afd83 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -121,9 +121,9 @@ kni_net_config(struct net_device *dev, struct ifmap *map) static void kni_net_rx_normal(struct kni_dev *kni) { - unsigned ret; + unsigned int ret; uint32_t len; - unsigned i, num_rx, num_fq; + unsigned int i, num_rx, num_fq; struct rte_kni_mbuf *kva; struct rte_kni_mbuf *va[MBUF_BURST_SZ]; void *data_kva; @@ -139,7 +139,7 @@ kni_net_rx_normal(struct kni_dev *kni) } /* Calculate the number of entries to dequeue from rx_q */ - num_rx = min(num_fq, (unsigned)MBUF_BURST_SZ); + num_rx = min(num_fq, (unsigned int)MBUF_BURST_SZ); /* Burst dequeue from rx_q */ num_rx = kni_fifo_get(kni->rx_q, (void **)va, num_rx); @@ -209,9 +209,9 @@ kni_net_rx_normal(struct kni_dev *kni) static void kni_net_rx_lo_fifo(struct kni_dev *kni) { - unsigned ret; + unsigned int ret; uint32_t len; - unsigned i, num, num_rq, num_tq, num_aq, num_fq; + unsigned int i, num, num_rq, num_tq, num_aq, num_fq; struct rte_kni_mbuf *kva; struct rte_kni_mbuf *va[MBUF_BURST_SZ]; void *data_kva; @@ -236,7 +236,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni) num = min(num_rq, num_tq); num = min(num, num_aq); num = min(num, num_fq); - num = min(num, (unsigned)MBUF_BURST_SZ); + num = min(num, (unsigned int)MBUF_BURST_SZ); /* Return if no entry to dequeue from rx_q */ if (num == 0) @@ -298,9 +298,9 @@ kni_net_
[dpdk-dev] [PATCH 04/19] kni: whitespace, indentation, long line corrections
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_dev.h | 11 +++--- lib/librte_eal/linuxapp/kni/kni_ethtool.c | 39 +++- lib/librte_eal/linuxapp/kni/kni_fifo.h| 2 +- lib/librte_eal/linuxapp/kni/kni_misc.c| 18 +- lib/librte_eal/linuxapp/kni/kni_net.c | 17 + lib/librte_eal/linuxapp/kni/kni_vhost.c | 60 --- 6 files changed, 88 insertions(+), 59 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index 48e4562..059defc 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -84,7 +84,7 @@ struct kni_dev { /* response queue */ void *resp_q; - void * sync_kva; + void *sync_kva; void *sync_va; void *mbuf_kva; @@ -97,12 +97,13 @@ struct kni_dev { unsigned long synchro; #ifdef RTE_KNI_VHOST - struct kni_vhost_queue* vhost_queue; + struct kni_vhost_queue *vhost_queue; + volatile enum { BE_STOP = 0x1, BE_START = 0x2, BE_FINISH = 0x4, - }vq_status; + } vq_status; #endif }; @@ -128,8 +129,8 @@ struct kni_vhost_queue { struct kni_dev *kni; int sockfd; unsigned int flags; - struct sk_buff* cache; - struct rte_kni_fifo* fifo; + struct sk_buff *cache; + struct rte_kni_fifo *fifo; }; #endif diff --git a/lib/librte_eal/linuxapp/kni/kni_ethtool.c b/lib/librte_eal/linuxapp/kni/kni_ethtool.c index 06b6d46..0c88589 100644 --- a/lib/librte_eal/linuxapp/kni/kni_ethtool.c +++ b/lib/librte_eal/linuxapp/kni/kni_ethtool.c @@ -31,6 +31,7 @@ static int kni_check_if_running(struct net_device *dev) { struct kni_dev *priv = netdev_priv(dev); + if (priv->lad_dev) return 0; else @@ -41,6 +42,7 @@ static void kni_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { struct kni_dev *priv = netdev_priv(dev); + priv->lad_dev->ethtool_ops->get_drvinfo(priv->lad_dev, info); } @@ -48,6 +50,7 @@ static int kni_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->get_settings(priv->lad_dev, ecmd); } @@ -55,6 +58,7 @@ static int kni_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->set_settings(priv->lad_dev, ecmd); } @@ -62,6 +66,7 @@ static void kni_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct kni_dev *priv = netdev_priv(dev); + priv->lad_dev->ethtool_ops->get_wol(priv->lad_dev, wol); } @@ -69,6 +74,7 @@ static int kni_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->set_wol(priv->lad_dev, wol); } @@ -76,6 +82,7 @@ static int kni_nway_reset(struct net_device *dev) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->nway_reset(priv->lad_dev); } @@ -83,6 +90,7 @@ static int kni_get_eeprom_len(struct net_device *dev) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->get_eeprom_len(priv->lad_dev); } @@ -91,6 +99,7 @@ kni_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *bytes) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->get_eeprom(priv->lad_dev, eeprom, bytes); } @@ -100,6 +109,7 @@ kni_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *bytes) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->set_eeprom(priv->lad_dev, eeprom, bytes); } @@ -108,6 +118,7 @@ static void kni_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) { struct kni_dev *priv = netdev_priv(dev); + priv->lad_dev->ethtool_ops->get_ringparam(priv->lad_dev, ring); } @@ -115,6 +126,7 @@ static int kni_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) { struct kni_dev *priv = netdev_priv(dev); + return priv->lad_dev->ethtool_ops->set_ringparam(priv->lad_dev, ring); } @@ -122,6 +134,7 @@ static void kni_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { struct kni_dev *priv = netdev_priv(dev); + priv->lad_dev->ethtool_ops->get_pauseparam(priv->lad_dev, pause); } @@ -129,6 +142,7 @@ static int kni_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) {
[dpdk-dev] [PATCH 03/19] kni: make static struct const
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index c8a2ef1..551e7de 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -62,7 +62,7 @@ static int kni_thread_single(void *unused); /* KNI processing for multiple kernel thread mode */ static int kni_thread_multiple(void *param); -static struct file_operations kni_fops = { +static const struct file_operations kni_fops = { .owner = THIS_MODULE, .open = kni_open, .release = kni_release, -- 2.7.4
[dpdk-dev] [PATCH 02/19] kni: uninitialize global variables
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index a046142..c8a2ef1 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -77,11 +77,11 @@ static struct miscdevice kni_misc = { }; /* loopback mode */ -static char *lo_mode = NULL; +static char *lo_mode; /* Kernel thread mode */ -static char *kthread_mode = NULL; -static unsigned multiple_kthread_on = 0; +static char *kthread_mode; +static unsigned int multiple_kthread_on; #define KNI_DEV_IN_USE_BIT_NUM 0 /* Bit number for device in use */ -- 2.7.4
[dpdk-dev] [PATCH 01/19] kni: move externs to the header file
Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_dev.h | 13 + lib/librte_eal/linuxapp/kni/kni_misc.c | 13 - lib/librte_eal/linuxapp/kni/kni_vhost.c | 11 +-- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index a0e5cb6..48e4562 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -134,6 +134,19 @@ struct kni_vhost_queue { #endif +void kni_net_rx(struct kni_dev *kni); +void kni_net_init(struct net_device *dev); +void kni_net_config_lo_mode(char *lo_str); +void kni_net_poll_resp(struct kni_dev *kni); +void kni_set_ethtool_ops(struct net_device *netdev); + +int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev); +void ixgbe_kni_remove(struct pci_dev *pdev); +extern struct pci_device_id *ixgbe_pci_tbl; +int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev); +void igb_kni_remove(struct pci_dev *pdev); +extern struct pci_device_id *igb_pci_tbl; + #ifdef RTE_KNI_VHOST_DEBUG_RX #define KNI_DBG_RX(args...) printk(KERN_DEBUG "KNI RX: " args) #else diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 3501dc1..a046142 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -47,19 +47,6 @@ MODULE_DESCRIPTION("Kernel Module for managing kni devices"); #define KNI_MAX_DEVICES 32 -extern void kni_net_rx(struct kni_dev *kni); -extern void kni_net_init(struct net_device *dev); -extern void kni_net_config_lo_mode(char *lo_str); -extern void kni_net_poll_resp(struct kni_dev *kni); -extern void kni_set_ethtool_ops(struct net_device *netdev); - -extern int ixgbe_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev); -extern void ixgbe_kni_remove(struct pci_dev *pdev); -extern struct pci_device_id ixgbe_pci_tbl[]; -extern int igb_kni_probe(struct pci_dev *pdev, struct net_device **lad_dev); -extern void igb_kni_remove(struct pci_dev *pdev); -extern struct pci_device_id igb_pci_tbl[]; - static int kni_open(struct inode *inode, struct file *file); static int kni_release(struct inode *inode, struct file *file); static int kni_ioctl(struct inode *inode, unsigned int ioctl_num, diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index a3ca849..7aed96e 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "compat.h" #include "kni_dev.h" @@ -39,17 +40,7 @@ #define RX_BURST_SZ 4 -extern void put_unused_fd(unsigned int fd); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) -extern struct file* -sock_alloc_file(struct socket *sock, - int flags, const char *dname); - -extern int get_unused_fd_flags(unsigned flags); - -extern void fd_install(unsigned int fd, struct file *file); - static int kni_sock_map_fd(struct socket *sock) { struct file *file; -- 2.7.4
[dpdk-dev] [PATCH 00/19] KNI checkpatch cleanup
KNI checkpatch cleanup, mostly non-functional but cosmetic modifications. Only functional change is related logging, switched to kernel dynamic logging and compile time KNI debug options removed, some log message levels updated. Ferruh Yigit (19): kni: move externs to the header file kni: uninitialize global variables kni: make static struct const kni: whitespace, indentation, long line corrections kni: prefer unsigned int to unsigned kni: remove useless return kni: comparisons should place the constant on the right kni: trailing statements should be on next line kni: do not use assignment in if condition kni: macros with complex values should be enclosed in parentheses kni: prefer min_t to min kni: prefer ether_addr_copy to memcpy kni: update kernel logging kni: remove unnecessary 'out of memory' message kni: move functions to eliminate function declarations kni: remove compile time debug configuration kni: updated log messages kni: prefer uint32_t to unsigned int kni: move kernel version ifdefs to compat header config/common_base| 3 - lib/librte_eal/linuxapp/kni/compat.h | 18 +- lib/librte_eal/linuxapp/kni/kni_dev.h | 55 ++--- lib/librte_eal/linuxapp/kni/kni_ethtool.c | 39 ++- lib/librte_eal/linuxapp/kni/kni_fifo.h| 24 +- lib/librte_eal/linuxapp/kni/kni_misc.c| 398 ++ lib/librte_eal/linuxapp/kni/kni_net.c | 365 +-- lib/librte_eal/linuxapp/kni/kni_vhost.c | 199 +++ 8 files changed, 538 insertions(+), 563 deletions(-) -- 2.7.4
[dpdk-dev] [PATCH] scripts: disable optimization for ABI validation
2016-08-26 16:06, Ferruh Yigit: > abi-dumper giving following warning: > WARNING: incompatible build option detected: -O3 > > Although this patch won't fix warning, it is to ensure code compiled > with optimization disabled. > > Signed-off-by: Ferruh Yigit Applied, thanks
[dpdk-dev] [PATCH] drivers: advertise kmod dependencies in pmdinfo
Add a new macro DRIVER_REGISTER_KMOD_DEP() that allows a driver to declare the list of kernel modules required to run properly. Today, most PCI drivers require uio/vfio. Signed-off-by: Olivier Matz --- rfc -> v1: - the kmod information can be per-device using a modalias-like pattern - change syntax to use '&' and '|' instead of ',' and ':' - remove useless prerequisites in kmod lis: no need to specify both uio and uio_pci_generic, only the latter is required - update kmod list in szedata2 driver - remove kmod list in qat driver: it requires more than just loading a kmod, which is described in documentation buildtools/pmdinfogen/pmdinfogen.c | 1 + buildtools/pmdinfogen/pmdinfogen.h | 1 + drivers/net/bnx2x/bnx2x_ethdev.c| 2 ++ drivers/net/bnxt/bnxt_ethdev.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c| 1 + drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/igb_ethdev.c | 2 ++ drivers/net/ena/ena_ethdev.c| 1 + drivers/net/enic/enic_ethdev.c | 1 + drivers/net/fm10k/fm10k_ethdev.c| 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.c| 2 ++ drivers/net/mlx4/mlx4.c | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/nfp/nfp_net.c | 1 + drivers/net/qede/qede_ethdev.c | 2 ++ drivers/net/szedata2/rte_eth_szedata2.c | 2 ++ drivers/net/thunderx/nicvf_ethdev.c | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c| 1 + lib/librte_eal/common/include/rte_dev.h | 25 + tools/dpdk-pmdinfo.py | 5 - 23 files changed, 55 insertions(+), 1 deletion(-) diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c index e1bf2e4..1e5b6f3 100644 --- a/buildtools/pmdinfogen/pmdinfogen.c +++ b/buildtools/pmdinfogen/pmdinfogen.c @@ -269,6 +269,7 @@ struct opt_tag { static const struct opt_tag opt_tags[] = { {"_param_string_export", "params"}, + {"_kmod_dep_export", "kmod"}, }; static int complete_pmd_entry(struct elf_info *info, struct pmd_driver *drv) diff --git a/buildtools/pmdinfogen/pmdinfogen.h b/buildtools/pmdinfogen/pmdinfogen.h index 1da2966..2fab2aa 100644 --- a/buildtools/pmdinfogen/pmdinfogen.h +++ b/buildtools/pmdinfogen/pmdinfogen.h @@ -85,6 +85,7 @@ else \ enum opt_params { PMD_PARAM_STRING = 0, + PMD_KMOD_DEP, PMD_OPT_MAX }; diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index f3ab355..e422388 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -667,5 +667,7 @@ static struct rte_driver rte_bnx2xvf_driver = { PMD_REGISTER_DRIVER(rte_bnx2x_driver, bnx2x); DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map); +DRIVER_REGISTER_KMOD_DEP(bnx2x, "* igb_uio | uio_pci_generic | vfio"); PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf); DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map); +DRIVER_REGISTER_KMOD_DEP(bnx2xvf, "* igb_uio | uio_pci_generic | vfio"); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3795fac..cc9e2b2 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1068,3 +1068,4 @@ static struct rte_driver bnxt_pmd_drv = { PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt); DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map); +DRIVER_REGISTER_KMOD_DEP(bnxt, "* igb_uio | uio_pci_generic | vfio"); diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 9208a61..4bdf0ea 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1068,4 +1068,5 @@ static struct rte_driver rte_cxgbe_driver = { PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4); DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl); +DRIVER_REGISTER_KMOD_DEP(cxgb4, "* igb_uio | uio_pci_generic | vfio"); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index ad104ed..7bb51d4 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1806,3 +1806,4 @@ struct rte_driver em_pmd_drv = { PMD_REGISTER_DRIVER(em_pmd_drv, em); DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map); +DRIVER_REGISTER_KMOD_DEP(em, "* igb_uio | uio_pci_generic | vfio"); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 4e9e6a3..ba5f5e2 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -5257,5 +5257,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev) PMD_REGISTER_DRIVER(pmd_igb_drv, igb); DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map); +DRIVER_REGISTER_KMOD_DEP(igb, "* igb_uio | uio_pci_generic | vfio"); PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf); DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map); +DRIVER_REGISTER_KMOD_DEP(igbvf, "* igb_uio | uio_pci_generic | vfi
[dpdk-dev] [PATCH v3 02/15] eal/soc: add rte_eal_soc_register/unregister logic
2016-09-15 15:09, Jan Viktorin: > On Thu, 15 Sep 2016 14:00:25 +0100 > "Hunt, David" wrote: > > > > new file mode 100644 > > > index 000..56135ed > > > --- /dev/null > > > +++ b/lib/librte_eal/common/eal_common_soc.c > > > @@ -0,0 +1,56 @@ > > > +/*- > > > + * BSD LICENSE > > > + * > > > + * Copyright(c) 2016 RehiveTech. All rights reserved. > > > + * All rights reserved. > > > > Duplicate "All rights reserved" > > This is present in many source files in DPDK... I don't know why. > > lib/librte_eal/common/eal_common_pci.c > lib/librte_eal/common/eal_common_dev.c > ... It would deserve a dedicated thread to discuss legal sense of these things. I'm not a lawyer but I think "All rights reserved." has no real sense.
[dpdk-dev] [PATCH v3 12/15] ether: extract function eth_dev_get_intr_handle
2016-09-15 14:02, Hunt, David: > On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > > +static inline > > +struct rte_intr_handle *eth_dev_get_intr_handle(struct rte_eth_dev *dev) > > +{ > > + if (dev->pci_dev) { > > + return &dev->pci_dev->intr_handle; > > + } > > + > > + RTE_VERIFY(0); > > Rather than RTE_VERIFY(0), might I suggest using rte_panic with a more > relevant error message? RTE_ASSERT is preferred. We must stop adding some rte_panic calls except for debug.
[dpdk-dev] [PATCH v3 02/15] eal/soc: add rte_eal_soc_register/unregister logic
On Thu, 15 Sep 2016 14:00:25 +0100 "Hunt, David" wrote: > > new file mode 100644 > > index 000..56135ed > > --- /dev/null > > +++ b/lib/librte_eal/common/eal_common_soc.c > > @@ -0,0 +1,56 @@ > > +/*- > > + * BSD LICENSE > > + * > > + * Copyright(c) 2016 RehiveTech. All rights reserved. > > + * All rights reserved. > > Duplicate "All rights reserved" This is present in many source files in DPDK... I don't know why. lib/librte_eal/common/eal_common_pci.c lib/librte_eal/common/eal_common_dev.c ... Jan > > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions > > + * are met: > > + * > > + * * Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * * Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in > > + * the documentation and/or other materials provided with the > > + * distribution. > > + * * Neither the name of RehiveTech nor the names of its > > + * contributors may be used to endorse or promote products derived > > + * from this software without specific prior written permission. > > + *
[dpdk-dev] [PATCH v3 3/3] app/test: add Kasumi tests in QAT test suite
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Thursday, September 15, 2016 11:06 AM > To: dev at dpdk.org > Cc: Jain, Deepak K > Subject: [dpdk-dev] [PATCH v3 3/3] app/test: add Kasumi tests in QAT test > suite > > This patch adds Kausmi tests in the QAT tesuite. > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v3 2/3] crypto/qat: add Kasumi support in Intel(R) QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Thursday, September 15, 2016 11:04 AM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v3 2/3] crypto/qat: add Kasumi support in Intel(R) > QAT driver > > This patch add kasumi support in Intel(R) QuickAssist driver. > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v3 1/3] app/test: cleanup of test code for kasumi
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Thursday, September 15, 2016 11:04 AM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v3 1/3] app/test: cleanup of test code for kasumi > > Cleanup for easier kasumi enabling. > Changed name of funcitons for clear understanding. > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [RFC][PATCH V2 2/3] examples/vhost: Add vswitch command line options
On 9/13/2016 5:44 PM, Yuanhan Liu wrote: > On Mon, Sep 05, 2016 at 04:24:30PM +0530, Pankaj Chauhan wrote: >> Add command line options for selecting switch implementation >> and maximum ports for the vswitch.following are two new command >> line options: >> >> --switch [char string, Selects the switch imlementation] >> --max-ports [int, selects maximum number of ports to support] >> >> For example: >> >> $ ./vhost-switch -c 3 -n 2 --socket-mem 1024 --huge-dir /hugetlbfs -- -p >> 0x1 --dev-basename sock1 > > That means you were basing on the master branch. You should base on > next-virtio instead: http://dpdk.org/browse/next/dpdk-next-virtio/ Yes i were basing it on master, i will base the next version on dpdk-next-virtio. Sorry for this, i am bit new to dpdk upstream development . > >> --switch "vmdq" --max-ports 3 > > Normally, we should keep the old behaviour first. Say, making the vmdq > as the default switch mode. Yes if we don't give the '--switch' option then default is vmdq. > > However, actually, I don't quite like to make the vhost-switch to bind > to a hardare feature that tightly, that you may want to make a standalone > patch as the last one in this patchset to make the "switch" mode be the > default one. Sure i will split the patch to take care of this. > >> >> Signed-off-by: Pankaj Chauhan >> --- >> examples/vhost/main.c | 43 +++ >> 1 file changed, 43 insertions(+) >> >> diff --git a/examples/vhost/main.c b/examples/vhost/main.c >> index c949df4..a4e51ae 100644 >> --- a/examples/vhost/main.c >> +++ b/examples/vhost/main.c >> @@ -142,6 +142,10 @@ static uint32_t burst_rx_retry_num = BURST_RX_RETRIES; >> /* Character device basename. Can be set by user. */ >> static char dev_basename[MAX_BASENAME_SZ] = "vhost-net"; >> >> +/* vswitch device name and maximum number of ports */ >> +static char switch_dev[MAX_BASENAME_SZ] = "vmdq"; > > First of all, limiting it with MAX_BASENAME_SZ makes no sense here. > I will fix it, define a different constant for switch_dev name. > Secondly, you don't have to represent the switch mode with string, > you could simply use some numeric macros, or enum. > I used the string because the registration function (vs_register_switch) uses the switch name as string to register the switches and find the matching switch_dev given in command line. If we use macro or enum then we will have to add the MACRO for the switch id in common code every time a new switch implementation is added. Keeping a string as name, saves us from touching the common code for adding a new switch implementation. > Besides, I just had a quick glimplse of your patches (still couldn't > make a detailed look so far), and I'd ask you to do few more things > for v3: > > - I'm hoping you could split this patchset further, say **maybe** > one patch to introduce vswitch_port, one to introduce vswitch_ops > and another one to introduce vswitch_dev. This helps review. > Do you want me to split the vswitch_ops, vswitch_dev and vswitch_port introduction (mainly vswitch_common.h) in three patches with the patch body explaining them in bit detail, correct ? Their usage i.e vswitch_common.c can be kept in separate patch (4th one), is this fine? otherwise it fill be tricky to make vswitch_common.c to compilable without complete definition of vswitch_port, vswitch_dev and vswitch_ops > - make sure each commit is buldable. > I will take care of this in v3 > > And few more generic comments to the whole set: > > - use "__rte_unused" but not "__attribute__((unused))" > And we normally use it after but not before the key word. I will take care of this in v3 > > - follow the DPDK prefered way to define a function, the return type > and function name takes two lines. I will take care of this in v3 > > - run scripts/{checkpatches.sh,check-git-log.sh} and fix real warnings > if any before sending them out. > > This would at least help you catch "line over 80 chars" issue. Sure, will take care of this in v3 and onwards. Thanks, Pankaj > > Thanks. > --yliu >
[dpdk-dev] [PATCH v3] doc/guides: add info on how to enable QAT
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Tuesday, September 13, 2016 3:09 PM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Breen, Eoin > ; Jain, Deepak K > Subject: [dpdk-dev] [PATCH v3] doc/guides: add info on how to enable QAT > > From: Eoin Breen > > Signed-off-by: Eoin Breen > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v2] sched: fix releasing enqueued packets
> -Original Message- > From: Hiroyuki Mikita [mailto:h.mikita89 at gmail.com] > Sent: Monday, September 5, 2016 4:15 PM > To: Dumitrescu, Cristian > Cc: dev at dpdk.org > Subject: [PATCH v2] sched: fix releasing enqueued packets > > rte_sched_port_free should release only enqueued packets of all queues. > Previous behavior is that enqueued and already dequeued packets of > only first 4 queues are released. > > Fixes: 61383240 ("sched: release enqueued mbufs when freeing port") > > Signed-off-by: Hiroyuki Mikita > --- > v2: > * use rte_sched_port_queues_per_port to get the number of queues > * mask incremented qr by qsize - 1 > > lib/librte_sched/rte_sched.c | 18 +++--- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c > index 8696423..e6dace2 100644 > --- a/lib/librte_sched/rte_sched.c > +++ b/lib/librte_sched/rte_sched.c Acked-by: Cristian Dumitrescu Thank you!
[dpdk-dev] [RFC][PATCH V2 1/3] examples/vhost: Add vswitch (generic switch) framework
On 9/13/2016 12:21 PM, Tan, Jianfeng wrote: Hi Jianfeng, >>> >>> On 9/5/2016 6:54 PM, Pankaj Chauhan wrote: Introduce support for a generic framework for handling of switching between physical and vhost devices. The vswitch framework introduces the following concept: 1. vswitch_dev: Vswitch device is a logical switch which can have physical and virtio devices. The devices are operated/used using standard rte_eth API for physical devices and lib_vhost API for vhost devices, PMD API is not used for vhost devices. 2. vswitch_port: Any physical or virtio device that is added to vswitch. The port can have its own tx/rx functions for doing data transfer, which are exposed to the framework using generic function pointers (vs_port->do_tx/do_rx). This way the generic code can do tx/rx without understanding the type of device (Physical or virtio). Similarly each port has its own functions to select tx/rx queues. The framework provides default tx/rx queue selection functions to the port when port is added (for both physical and vhost devices). But the framework allows the switch implementation to override the queue selection functions (vs_port->get_txq/rxq) if required. 3. vswitch_ops: The ops is set of function pointers which are used to do operations like learning, unlearning, add/delete port, lookup_and_forward. The user of vswitch framework (vhost/main.[c,h])uses these function pointers to perform above mentioned operations, thus it remains agnostic of the underlying implementation. Different switching logics can implement their vswitch_device and vswitch_ops, and register with the framework. This framework makes vhost-switch application scalable in terms of: 1. Different switching logics (one of them is vmdq, vhost/vmdq.[c,h] 2. Number of ports. 3. Policies of selecting ports for rx and tx. Signed-off-by: Pankaj Chauhan >>> >>> After this patch set, how's mapping relationship between cores and >>> vswitch_dev? Old vhost example does not have the concept of switch, so >>> each core is binded with some VDEVs. Now, we still keep original logic? >>> >>> (a) If yes, provided that phys device could has no direct relationship >>> with vdevs in other switching logics, we may need to bind those physical >>> devices to cores too? In that case, switch_worker() will receiving pkts >>> from all devices (phys or virtual) and dispatch, which looks like: >>> >>> switch_worker() { >>> FOR each port binding to this core { >>> rx(port, pkts[], count); >>> vs_lookup_n_fwd( information_needed ); >>> } >>> } >> >> Since we support only one switch device running at one time. We bind >> the ports of the switchdev to the core. But The switch might have it's >> own logic to bind the port to the core. For example >> VMDQ only supports one Physical port, other switch can support more >> than one Physical port. In order to take care of that i have added two >> ops in swithdev_ops: >> >> 1. vs_sched_rx_port: >> >> struct vswitch_port *vs_sched_rx_port(struct vswitch_dev *vs_dev, enum >> vswitch_port_type ptype, >> uint16_t core_id) >> >> 2. vs_sched_tx_port: >> >> struct vswitch_port *vs_sched_tx_port(struct vswitch_dev *vs_dev, enum >> vswitch_port_type ptype, uint16_t >> core_id) >> >> The idea of providing these functions is that vhost/main requests the >> underlying switch implementation to schedule a port for rx or Tx, the >> current running core_id is also passed as parameter. So the switch can >> take a decision which port to do rx or tx based on core id, and may be >> some other custom policy. >> >> For example VMDQ always returns the one single Physical port in >> response to these functions called from any core. The other switch >> can return the ports bound to the cores. >> >> Similarly there are two port operations (vs_port->get_rxq and >> vs_port->get_txq), here also we pass core_id as parameter so that >> the underlying switch implementation can schedule the rx or tx queue >> based on the core_id. >> >> The above mentioned ops are used in drain_eth_rx() and >> do_drain_mbuf_table() (main.c) currently, and they leave binding of >> physical port and the queues to the underlying implementation. This >> way we can accommodate VMDQ which uses only one physical port and >> rxqueues based on VMDQ, OR any other switch which uses multiple >> physical port and rx/tx queue scheduling based on some other logic. >> >> Please suggest if this way of scheduling ports and tx/rx queues is >> fine or not? > > According to above explanation, in VMDQ switch, we cannot schedule two > queues (belongs to the same port) on the same core, right? > Yes. This would be a limitation i believe which will not b
[dpdk-dev] [PATCH] app/test: fix failing packet-framework table unit-tests
> -Original Message- > From: Singh, Jasvinder > Sent: Monday, September 12, 2016 12:06 PM > To: dev at dpdk.org > Cc: Dumitrescu, Cristian > Subject: [PATCH] app/test: fix failing packet-framework table unit-tests > > The pipeline object is not freed when a particular test-case of the unit-test > finishes. Using rte_pipeline_free() before returning the outcome for each > test-case fixes the issue. > > Fixes: 5205954791cb ("app/test: packet framework unit tests") > > Signed-off-by: Jasvinder Singh > --- Acked-by: Cristian Dumitrescu
[dpdk-dev] [PATCH 2/3] docs:tun/tap PMD information
Regards, Keith > On Sep 15, 2016, at 9:13 AM, Wiles, Keith wrote: > > self Nak - just noticed the copyright notices are wrong. My mistake I was looking at the wrong file the headers appear correct. > > Regards, > Keith > >> On Sep 15, 2016, at 9:10 AM, Keith Wiles wrote: >> >> Signed-off-by: Keith Wiles >> --- >> doc/guides/nics/tap.rst | 84 >> + >> 1 file changed, 84 insertions(+) >> create mode 100644 doc/guides/nics/tap.rst >> >> diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst >> new file mode 100644 >> index 000..072def8 >> --- /dev/null >> +++ b/doc/guides/nics/tap.rst >> @@ -0,0 +1,84 @@ >> +.. BSD LICENSE >> +Copyright(c) 2016 Intel Corporation. All rights reserved. >> +All rights reserved. >> + >> +Redistribution and use in source and binary forms, with or without >> +modification, are permitted provided that the following conditions >> +are met: >> + >> +* Redistributions of source code must retain the above copyright >> +notice, this list of conditions and the following disclaimer. >> +* Redistributions in binary form must reproduce the above copyright >> +notice, this list of conditions and the following disclaimer in >> +the documentation and/or other materials provided with the >> +distribution. >> +* Neither the name of Intel Corporation nor the names of its >> +contributors may be used to endorse or promote products derived >> +from this software without specific prior written permission. >> + >> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + >> +Tun/Tap Poll Mode Driver >> + >> + >> +The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local >> +host. The PMD allows for DPDK and the host to communicate using a raw device >> +interface on the host and in the DPDK application. >> + >> +The device created is a TAP device, which sends/receives packet in a raw >> format >> +with a L2 header. The usage for a TAP PMD is for connectivity to the local >> host >> +using a TAP interface. When the TAP PMD is initialized it will create a >> number >> +of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The >> +commands can be used to assign and query the virtual like device. >> + >> +These TAP interfaces can be used with wireshark or tcpdump or Pktgen-DPDK >> along >> +with being able to be used as a network connection to the DPDK application. >> The >> +method enable one or more interfaces is to use the --vdev=eth_tap option on >> the >> +DPDK application command line. Each --vdev=eth_tap option give will create >> an >> +interface named dtap0, dtap1, ... and so forth. >> + >> +.. code-block:: console >> + >> + The interfaced name can be changed by adding the iface=foo0 >> + e.g. --vedv=eth_tap,iface=foo0 --vdev=eth_tap,iface=foo1, ... >> + >> +.. code-block:: console >> + >> + Also the speed of the interface can be changed from 10G to whatever >> number >> + needed, but the interface does not enforce that speed. >> + e.g. --vdev=eth_tap,iface=foo0,speed=25000 >> + >> +After the DPDK application is started you can send and receive packets on >> the >> +interface using the standard rx_burst/tx_burst APIs in DPDK. From the host >> point >> +of view you can use any host tool like tcpdump, wireshark, ping, Pktgen and >> +others to communicate with the DPDK application. The DPDK application may >> not >> +understand network protocols like IPv4/6, UDP or TCP unless the application >> has >> +been written to understand these protocols. >> + >> +If you need the interface as a real network interface meaning running and >> has >> +a valid IP address then you can do this with the following commands: >> + >> +.. code-block:: console >> + >> + sudo ip link set dtap0 up; sudo ip addr add 192.168.0.250/24 dev dtap0 >> + sudo ip link set dtap1 up; sudo ip addr add 192.168.1.250/24 dev dtap1 >> + >> +Please change the IP addresses as you see fit. >> + >> +If routing is enabled on the host you can also communicate with the DPDK App >> +over the internet via a standard socket layer application as lon
[dpdk-dev] [PATCH] app/test: decrease memory requirements for sched
> -Original Message- > From: Olivier Matz [mailto:olivier.matz at 6wind.com] > Sent: Monday, September 12, 2016 12:39 PM > To: dev at dpdk.org; Dumitrescu, Cristian > Subject: [PATCH] app/test: decrease memory requirements for sched > > The sched test consumes 35MB memory. When memory is too fragmented > (with > 2M hugepages), the test can fail. > > To reduce this risk, decrease it to 4.5MB by modifying > n_pipes_per_subport and qsize. > > Signed-off-by: Olivier Matz > --- Acked-by: Cristian Dumitrescu
[dpdk-dev] [PATCH 2/3] docs:tun/tap PMD information
self Nak - just noticed the copyright notices are wrong. Regards, Keith > On Sep 15, 2016, at 9:10 AM, Keith Wiles wrote: > > Signed-off-by: Keith Wiles > --- > doc/guides/nics/tap.rst | 84 + > 1 file changed, 84 insertions(+) > create mode 100644 doc/guides/nics/tap.rst > > diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst > new file mode 100644 > index 000..072def8 > --- /dev/null > +++ b/doc/guides/nics/tap.rst > @@ -0,0 +1,84 @@ > +.. BSD LICENSE > +Copyright(c) 2016 Intel Corporation. All rights reserved. > +All rights reserved. > + > +Redistribution and use in source and binary forms, with or without > +modification, are permitted provided that the following conditions > +are met: > + > +* Redistributions of source code must retain the above copyright > +notice, this list of conditions and the following disclaimer. > +* Redistributions in binary form must reproduce the above copyright > +notice, this list of conditions and the following disclaimer in > +the documentation and/or other materials provided with the > +distribution. > +* Neither the name of Intel Corporation nor the names of its > +contributors may be used to endorse or promote products derived > +from this software without specific prior written permission. > + > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + > +Tun/Tap Poll Mode Driver > + > + > +The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local > +host. The PMD allows for DPDK and the host to communicate using a raw device > +interface on the host and in the DPDK application. > + > +The device created is a TAP device, which sends/receives packet in a raw > format > +with a L2 header. The usage for a TAP PMD is for connectivity to the local > host > +using a TAP interface. When the TAP PMD is initialized it will create a > number > +of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The > +commands can be used to assign and query the virtual like device. > + > +These TAP interfaces can be used with wireshark or tcpdump or Pktgen-DPDK > along > +with being able to be used as a network connection to the DPDK application. > The > +method enable one or more interfaces is to use the --vdev=eth_tap option on > the > +DPDK application command line. Each --vdev=eth_tap option give will create > an > +interface named dtap0, dtap1, ... and so forth. > + > +.. code-block:: console > + > + The interfaced name can be changed by adding the iface=foo0 > + e.g. --vedv=eth_tap,iface=foo0 --vdev=eth_tap,iface=foo1, ... > + > +.. code-block:: console > + > + Also the speed of the interface can be changed from 10G to whatever number > + needed, but the interface does not enforce that speed. > + e.g. --vdev=eth_tap,iface=foo0,speed=25000 > + > +After the DPDK application is started you can send and receive packets on the > +interface using the standard rx_burst/tx_burst APIs in DPDK. From the host > point > +of view you can use any host tool like tcpdump, wireshark, ping, Pktgen and > +others to communicate with the DPDK application. The DPDK application may not > +understand network protocols like IPv4/6, UDP or TCP unless the application > has > +been written to understand these protocols. > + > +If you need the interface as a real network interface meaning running and has > +a valid IP address then you can do this with the following commands: > + > +.. code-block:: console > + > + sudo ip link set dtap0 up; sudo ip addr add 192.168.0.250/24 dev dtap0 > + sudo ip link set dtap1 up; sudo ip addr add 192.168.1.250/24 dev dtap1 > + > +Please change the IP addresses as you see fit. > + > +If routing is enabled on the host you can also communicate with the DPDK App > +over the internet via a standard socket layer application as long as you > account > +for the protocol handing in the application. > + > +If you have a Network Stack in your DPDK application or something like it you > +can utilize that stack to handle the network protocols. Plus you would be > able > +to address the interface using an IP
[dpdk-dev] [PATCH v3 13/15] ether: extract function eth_dev_get_driver_name
On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > lib/librte_ether/rte_ethdev.c | 15 ++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 104ea4a..4fa65ca 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2568,6 +2568,17 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int > op, void *data) > return 0; > } > > +static inline > +const char *eth_dev_get_driver_name(const struct rte_eth_dev *dev) > +{ > + if (dev->pci_dev) { > + return dev->driver->pci_drv.driver.name; > + } > + > + RTE_VERIFY(0); Same comment as last patch, maybe add an rte_panic with more descriptive error message. > + return NULL; > +} > + > const struct rte_memzone * > rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char > *ring_name, >uint16_t queue_id, size_t size, unsigned align, > @@ -2575,9 +2586,11 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev > *dev, const char *ring_name, > { > char z_name[RTE_MEMZONE_NAMESIZE]; > const struct rte_memzone *mz; > + const char *drv_name; > > + drv_name = eth_dev_get_driver_name(dev); > snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", > - dev->driver->pci_drv.driver.name, ring_name, > + drv_name, ring_name, >dev->data->port_id, queue_id); > > mz = rte_memzone_lookup(z_name);
[dpdk-dev] [PATCH v3 12/15] ether: extract function eth_dev_get_intr_handle
On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > We abstract access to the intr_handle here as we want to get > it either from the pci_dev or soc_dev. > > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > lib/librte_ether/rte_ethdev.c | 15 +-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index e9f5467..104ea4a 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2526,6 +2526,17 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev, > rte_spinlock_unlock(&rte_eth_dev_cb_lock); > } > > +static inline > +struct rte_intr_handle *eth_dev_get_intr_handle(struct rte_eth_dev *dev) > +{ > + if (dev->pci_dev) { > + return &dev->pci_dev->intr_handle; > + } > + > + RTE_VERIFY(0); Rather than RTE_VERIFY(0), might I suggest using rte_panic with a more relevant error message? > + return NULL; > +} > + > int > rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data) > { > @@ -2538,7 +2549,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int > op, void *data) > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > dev = &rte_eth_devices[port_id]; > - intr_handle = &dev->pci_dev->intr_handle; > + intr_handle = eth_dev_get_intr_handle(dev); > if (!intr_handle->intr_vec) { > RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); > return -EPERM; > @@ -2598,7 +2609,7 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t > queue_id, > return -EINVAL; > } > > - intr_handle = &dev->pci_dev->intr_handle; > + intr_handle = eth_dev_get_intr_handle(dev); > if (!intr_handle->intr_vec) { > RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n"); > return -EPERM;
[dpdk-dev] [PATCH v3 02/15] eal/soc: add rte_eal_soc_register/unregister logic
On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > Registeration of a SoC driver through a helper DRIVER_REGISTER_SOC > (on the lines of DRIVER_REGISTER_PCI). soc_driver_list stores all the > registered drivers. > > Test case has been introduced to verify the registration and > deregistration. > > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > app/test/test_soc.c | 111 > > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 4 + > lib/librte_eal/common/eal_common_soc.c | 56 > lib/librte_eal/common/include/rte_soc.h | 26 ++ > lib/librte_eal/linuxapp/eal/Makefile| 1 + > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 + > 6 files changed, 201 insertions(+) > create mode 100644 lib/librte_eal/common/eal_common_soc.c > > diff --git a/app/test/test_soc.c b/app/test/test_soc.c > index 916a863..ac03e64 100644 > --- a/app/test/test_soc.c > +++ b/app/test/test_soc.c > @@ -75,6 +75,108 @@ static int test_compare_addr(void) > free(a2.name); > free(a1.name); > free(a0.name); > + > + return 0; > +} > + > +/** > + * Empty PMD driver based on the SoC infra. > + * > + * The rte_soc_device is usually wrapped in some higher-level struct > + * (eth_driver). We simulate such a wrapper with an anonymous struct here. > + */ > +struct test_wrapper { > + struct rte_soc_driver soc_drv; > +}; > + > +struct test_wrapper empty_pmd0 = { > + .soc_drv = { > + .driver = { > + .name = "empty_pmd0" > + }, > + }, > +}; > + > +struct test_wrapper empty_pmd1 = { > + .soc_drv = { > + .driver = { > + .name = "empty_pmd1" > + }, > + }, > +}; > + > +static int > +count_registered_socdrvs(void) > +{ > + int i; > + struct rte_soc_driver *drv; > + > + i = 0; > + TAILQ_FOREACH(drv, &soc_driver_list, next) > + i += 1; > + > + return i; > +} > + > +static int > +test_register_unregister(void) > +{ > + struct rte_soc_driver *drv; > + int count; > + > + rte_eal_soc_register(&empty_pmd0.soc_drv); > + > + TEST_ASSERT(!TAILQ_EMPTY(&soc_driver_list), > + "No PMD is present but the empty_pmd0 should be there"); > + drv = TAILQ_FIRST(&soc_driver_list); > + TEST_ASSERT(!strcmp(drv->driver.name, "empty_pmd0"), > + "The registered PMD is not empty_pmd0 but '%s'", > + drv->driver.name); > + > + rte_eal_soc_register(&empty_pmd1.soc_drv); > + > + count = count_registered_socdrvs(); > + TEST_ASSERT_EQUAL(count, 2, "Expected 2 PMDs but detected %d", count); > + > + rte_eal_soc_unregister(&empty_pmd0.soc_drv); > + count = count_registered_socdrvs(); > + TEST_ASSERT_EQUAL(count, 1, "Expected 1 PMDs but detected %d", count); > + > + rte_eal_soc_unregister(&empty_pmd1.soc_drv); > + > + printf("%s has been successful\n", __func__); > + return 0; > +} > + > +/* save real devices and drivers until the tests finishes */ > +struct soc_driver_list real_soc_driver_list = > + TAILQ_HEAD_INITIALIZER(real_soc_driver_list); > + > +static int test_soc_setup(void) > +{ > + struct rte_soc_driver *drv; > + > + /* no real drivers for the test */ > + while (!TAILQ_EMPTY(&soc_driver_list)) { > + drv = TAILQ_FIRST(&soc_driver_list); > + rte_eal_soc_unregister(drv); > + TAILQ_INSERT_TAIL(&real_soc_driver_list, drv, next); > + } > + > + return 0; > +} > + > +static int test_soc_cleanup(void) > +{ > + struct rte_soc_driver *drv; > + > + /* bring back real drivers after the test */ > + while (!TAILQ_EMPTY(&real_soc_driver_list)) { > + drv = TAILQ_FIRST(&real_soc_driver_list); > + TAILQ_REMOVE(&real_soc_driver_list, drv, next); > + rte_eal_soc_register(drv); > + } > + > return 0; > } > > @@ -84,6 +186,15 @@ test_soc(void) > if (test_compare_addr()) > return -1; > > + if (test_soc_setup()) > + return -1; > + > + if (test_register_unregister()) > + return -1; > + > + if (test_soc_cleanup()) > + return -1; > + > return 0; > } > > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > index 7b3d409..cda8009 100644 > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > @@ -168,4 +168,8 @@ DPDK_16.11 { > > rte_eal_dev_attach; > rte_eal_dev_detach; > + soc_driver_list; > + rte_eal_soc_register; > + rte_eal_soc_unregister; > + > } DPDK_16.07; > diff --git a/lib/librte_eal/common/eal_common_soc.c > b/lib/librte_eal/common/eal_common_soc.c > new file mode 100644 > index 000..56135ed > --- /dev/null > +++ b/lib/librte_eal/common
[dpdk-dev] [PATCH v3 01/15] eal/soc: introduce very essential SoC infra definitions
Some small comments below: On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > Define initial structures and functions for the SoC infrastructure. > This patch supports only a very minimal functions for now. > More features will be added in the following commits. > > Includes rte_device/rte_driver inheritance of > rte_soc_device/rte_soc_driver. > > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > app/test/Makefile | 1 + > app/test/test_soc.c | 90 + > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/eal_private.h | 4 + > lib/librte_eal/common/include/rte_soc.h | 138 > > 5 files changed, 234 insertions(+), 1 deletion(-) > create mode 100644 app/test/test_soc.c > create mode 100644 lib/librte_eal/common/include/rte_soc.h > > diff --git a/app/test/Makefile b/app/test/Makefile > index 611d77a..64b261d 100644 > --- a/app/test/Makefile > +++ b/app/test/Makefile > @@ -77,6 +77,7 @@ APP = test > # > SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) := commands.c > SRCS-y += test.c > +SRCS-y += test_soc.c > SRCS-y += resource.c > SRCS-y += test_resource.c > test_resource.res: test_resource.c > diff --git a/app/test/test_soc.c b/app/test/test_soc.c > new file mode 100644 > index 000..916a863 > --- /dev/null > +++ b/app/test/test_soc.c > @@ -0,0 +1,90 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2016 RehiveTech. All rights reserved. > + * All rights reserved. Remove un-needed "All rights reserved" > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of RehiveTech nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include "test.h" > + > +static char *safe_strdup(const char *s) > +{ > + char *c = strdup(s); > + > + if (c == NULL) > + rte_panic("failed to strdup '%s'\n", s); > + > + return c; > +} > + > +static int test_compare_addr(void) > +{ > + struct rte_soc_addr a0; > + struct rte_soc_addr a1; > + struct rte_soc_addr a2; > + > + a0.name = safe_strdup("ethernet0"); > + a0.fdt_path = NULL; > + > + a1.name = safe_strdup("ethernet0"); > + a1.fdt_path = NULL; > + > + a2.name = safe_strdup("ethernet1"); > + a2.fdt_path = NULL; > + > + TEST_ASSERT(!rte_eal_compare_soc_addr(&a0, &a1), > + "Failed to compare two soc addresses that equal"); > + TEST_ASSERT(rte_eal_compare_soc_addr(&a0, &a2), > + "Failed to compare two soc addresses that differs"); > + > + free(a2.name); > + free(a1.name); > + free(a0.name); > + return 0; > +} > + > +static int > +test_soc(void) > +{ > + if (test_compare_addr()) > + return -1; > + > + return 0; > +} > + > +REGISTER_TEST_COMMAND(soc_autotest, test_soc); > diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile > index dfd64aa..b414008 100644 > --- a/lib/librte_eal/common/Makefile > +++ b/lib/librte_eal/common/Makefile > @@ -33,7 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk > > INC := rte_branch_prediction.h rte_common.h > INC += rte_debug.h rte_eal.h rte_errno.h rte_launch.h rte_lcore.h > -INC += rte_log.h rte_memory.h rte_memzone.h rte_pci.h > +INC += rte_log.h rte_memory.h rte_memzone.h rte_soc.h rte_pci.h > INC += rte_p
[dpdk-dev] [PATCH] doc/guides: fix name of algorithm
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Tuesday, September 13, 2016 12:06 PM > To: dev at dpdk.org > Cc: Mcnamara, John ; De Lara Guarch, Pablo > ; Jain, Deepak K intel.com> > Subject: [dpdk-dev] [PATCH] doc/guides: fix name of algorithm > > Update documentation with correct names of algorithm supported. > > Fixes: 1703e94ac5cee ("qat: add driver for QuickAssist devices") > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v3 00/15] Introduce SoC device/driver framework for EAL
Shreyansh, Jan, Hemant, On 9/9/2016 9:43 AM, Shreyansh Jain wrote: > Introduction: > = > > This patch set is direct derivative of Jan's original series [1],[2]. > > - As this deviates substantially from original series, if need be I can > post it as a separate patch rather than v2. Please suggest. > - Also, there are comments on original v1 ([4]) which are _not_ > incorporated in this series as they refer to section no more in new > version. > - This v3 version is based on the rte_driver/device patchset v9 [10]. > That series introduced device structures (rte_driver/rte_device) > generalizing devices into PCI, VDEV, XXX. For the purpose of this > patchset, XXX=>SOC. > > ---snip--- FYI, I've reviewed this patch set, and it looks to me like there's some very good work here. Each patch in the set builds nicely on the one before, and logically introduces the changes one by one. I've no functional suggestions as the implementation looks clean, but I've one or two tiny suggestions on headers and error messages. I'll add a reply to the relevant patches in the set. Also, there's one or two issues thrown up by checkpatch, but I suspect they're false positives, as I'm using the 4.6 kernel version. Regards, Dave
[dpdk-dev] [PATCH v3 2/2] app/test: add test cases for NULL for Intel QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Tuesday, September 13, 2016 9:59 AM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v3 2/2] app/test: add test cases for NULL for Intel > QAT driver > > From: Deepak Kumar JAIN > > Added NULL algorithm to test file for Intel(R) QuickAssist Technology Driver > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v3 1/2] crypto/qat: add NULL capability to Intel QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Tuesday, September 13, 2016 9:59 AM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v3 1/2] crypto/qat: add NULL capability to Intel > QAT driver > > From: Deepak Kumar JAIN > > enabled NULL crypto for Intel(R) QuickAssist Technology > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v2 2/2] app/test: add test cases for aes-sha384-hmac for Intel QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Monday, September 12, 2016 8:51 PM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v2 2/2] app/test: add test cases for aes-sha384- > hmac for Intel QAT driver > > From: "Jain, Deepak K" > > Added aes-sha384-hmac algorithm to test file for Intel(R) QuickAssist > Technology Driver > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v2 1/2] crypto/qat: add aes-sha384-hmac capability to Intel QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Monday, September 12, 2016 8:51 PM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v2 1/2] crypto/qat: add aes-sha384-hmac > capability to Intel QAT driver > > From: "Jain, Deepak K" > > enabled support of aes-sha384-hmac in Intel(R) QuickAssist driver > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v2 2/2] app/test: add test cases for aes-sha224-hmac for Intel QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Monday, September 12, 2016 8:47 PM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v2 2/2] app/test: add test cases for aes-sha224- > hmac for Intel QAT driver > > From: "Jain, Deepak K" > > Added aes-sha224-hmac algorithm to test file for Intel(R) QuickAssist > Technology Driver > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH v2 1/2] crypto/qat: add aes-sha224-hmac capability to Intel QAT driver
> -Original Message- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Deepak Kumar Jain > Sent: Monday, September 12, 2016 8:47 PM > To: dev at dpdk.org > Cc: De Lara Guarch, Pablo ; Jain, Deepak K > > Subject: [dpdk-dev] [PATCH v2 1/2] crypto/qat: add aes-sha224-hmac > capability to Intel QAT driver > > From: "Jain, Deepak K" > > Added support of aes-sha224-hmac in Intel(R) QuickAssist driver > > Signed-off-by: Deepak Kumar Jain Acked-by: Fiona Trahe
[dpdk-dev] [PATCH] kni: fix compilation error when debug enabled
Fix build error with Linux kernel >= v4.7 Fix compile error because of Linux API change, 'trans_start' field removed from 'struct net_device'. Linux: 9b36627acecd ("net: remove dev->trans_start") Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index fc82193..371bbfa 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -508,7 +508,7 @@ kni_net_tx_timeout (struct net_device *dev) struct kni_dev *kni = netdev_priv(dev); KNI_DBG("Transmit timeout at %ld, latency %ld\n", jiffies, - jiffies - dev->trans_start); + jiffies - dev_trans_start(dev)); kni->stats.tx_errors++; netif_wake_queue(dev); -- 2.7.4
[dpdk-dev] [PATCH v9 13/25] ethdev: convert to eal hotplug
On Monday 12 September 2016 12:46 PM, David Marchand wrote: > On Wed, Sep 7, 2016 at 4:08 PM, Shreyansh Jain > wrote: > > [snip] > >> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c >> index fdeac86..86c9d1a 100644 >> --- a/lib/librte_ether/rte_ethdev.c >> +++ b/lib/librte_ether/rte_ethdev.c > > [snip] > >> + ret = rte_eal_dev_attach(name, args); >> + if (ret < 0) >> + goto err; >> + >> + /* no point looking at eth_dev_last_created_port if no port exists */ >> + if (!nb_ports) { >> + RTE_LOG(ERR, EAL, "No ports founds for device (%s)\n", name); > > No port found ? Yes, that will be corrected in next version. Thanks. > > -- Shreyansh
[dpdk-dev] [PATCH v9 06/25] eal: introduce init macros
On Monday 12 September 2016 12:45 PM, David Marchand wrote: > On Wed, Sep 7, 2016 at 4:07 PM, Shreyansh Jain > wrote: >> diff --git a/lib/librte_eal/common/include/rte_pci.h >> b/lib/librte_eal/common/include/rte_pci.h >> index fa74962..cf673e4 100644 >> --- a/lib/librte_eal/common/include/rte_pci.h >> +++ b/lib/librte_eal/common/include/rte_pci.h >> @@ -470,6 +470,16 @@ void rte_eal_pci_dump(FILE *f); >> */ >> void rte_eal_pci_register(struct rte_pci_driver *driver); >> >> +/** Helper for PCI device registeration from driver (eth, crypto) instance >> */ > > Typo: registration Ok - I will fix this. > >> +#define DRIVER_REGISTER_PCI(nm, pci_drv) \ >> +RTE_INIT(pciinitfn_ ##nm); \ >> +static void pciinitfn_ ##nm(void) \ >> +{ \ >> + (pci_drv).name = RTE_STR(nm);\ >> + rte_eal_pci_register(&pci_drv); \ >> +}\ >> +DRIVER_EXPORT_NAME(nm, __COUNTER__) > > Checkpatch complains about a missing space. Yes, '} \' is expected. somehow missed my merges though checkpatch did complain. Will fix this. > > -- - Shreyansh
[dpdk-dev] [PATCH] kni: support RHEL 7.3
On 9/14/2016 7:25 PM, Pablo de Lara wrote: > Add support for RHEL 7.3, which uses kernel 3.10, > but backported features from newer kernels. > > Signed-off-by: Pablo de Lara > --- > lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > index bdd0806..1e20a9e 100644 > --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h > @@ -3891,7 +3891,7 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, > __always_unused int type) > #if (( LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) ) \ > || ( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,2) )) > #define HAVE_NDO_DFLT_BRIDGE_ADD_MASK > -#if (!( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,2) )) > +#if (!( RHEL_RELEASE_CODE == RHEL_RELEASE_VERSION(7,2) )) What about following to simplify the logic: +#if ( RHEL_RELEASE_CODE != RHEL_RELEASE_VERSION(7,2) ) Thanks, ferruh
[dpdk-dev] [PATCH v3 3/3] app/test: add Kasumi tests in QAT test suite
This patch adds Kausmi tests in the QAT tesuite. Signed-off-by: Deepak Kumar Jain --- app/test/test_cryptodev.c | 244 +++-- app/test/test_cryptodev_kasumi_hash_test_vectors.h | 76 +++ app/test/test_cryptodev_kasumi_test_vectors.h | 103 - 3 files changed, 401 insertions(+), 22 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 89d627f..4751467 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1560,22 +1560,6 @@ create_snow3g_kasumi_auth_cipher_operation(const unsigned auth_tag_len, sym_op->auth.digest.data, sym_op->auth.digest.length); - /* iv */ - if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8) - iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8); - else - iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16); - - 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 = iv_pad_len; - - rte_memcpy(sym_op->cipher.iv.data, iv, iv_len); - /* aad */ /* * Always allocate the aad up to the block size. @@ -1588,7 +1572,6 @@ create_snow3g_kasumi_auth_cipher_operation(const unsigned auth_tag_len, aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8); else aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16); - sym_op->auth.aad.data = (uint8_t *)rte_pktmbuf_prepend( ut_params->ibuf, aad_buffer_len); TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data, @@ -1596,13 +1579,27 @@ create_snow3g_kasumi_auth_cipher_operation(const unsigned auth_tag_len, sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys( ut_params->ibuf); sym_op->auth.aad.length = aad_len; - memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); - TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); + /* iv */ + if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8) + iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8); + else + iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16); + + 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 = iv_pad_len; + + rte_memcpy(sym_op->cipher.iv.data, iv, iv_len); + sym_op->cipher.data.length = cipher_len; sym_op->cipher.data.offset = auth_offset + cipher_offset; @@ -1960,6 +1957,12 @@ test_kasumi_hash_generate_test_case_5(void) } static int +test_kasumi_hash_generate_test_case_6(void) +{ + return test_kasumi_authentication(&kasumi_hash_test_case_6); +} + +static int test_kasumi_hash_verify_test_case_1(void) { return test_kasumi_authentication_verify(&kasumi_hash_test_case_1); @@ -2818,6 +2821,174 @@ test_snow3g_auth_cipher(const struct snow3g_test_data *tdata) } static int +test_kasumi_auth_cipher(const struct kasumi_test_data *tdata) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct crypto_unittest_params *ut_params = &unittest_params; + + int retval; + + uint8_t *plaintext, *ciphertext; + unsigned plaintext_pad_len; + unsigned plaintext_len; + + /* Create KASUMI session */ + retval = create_snow3g_kasumi_auth_cipher_session( + ts_params->valid_devs[0], + RTE_CRYPTO_CIPHER_OP_ENCRYPT, + RTE_CRYPTO_AUTH_OP_GENERATE, + RTE_CRYPTO_AUTH_KASUMI_F9, + RTE_CRYPTO_CIPHER_KASUMI_F8, + tdata->key.data, tdata->key.len, + tdata->aad.len, tdata->digest.len); + if (retval < 0) + return retval; + ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); + + /* clear mbuf payload */ + memset(rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *), 0, + rte_pktmbuf_tailroom(ut_params->ibuf)); + + plaintext_len = ceil_byte_length(tdata->plaintext.len); + /* Append data which is padded to a multiple of */ + /* the algorithms block size */ + plaintext_pad_len = RTE_ALIGN_CEIL(plaintext_len, 16); + plaintext = (uint8_t *)rte_pktmbuf_append(ut_params->ibuf, + plaintext_pad_len); + memcpy(plaintext, tdata->plaintext.data, plaintext_len); + +
[dpdk-dev] [PATCH v3 2/3] crypto/qat: add Kasumi support in Intel(R) QAT driver
This patch add kasumi support in Intel(R) QuickAssist driver. Signed-off-by: Deepak Kumar Jain --- doc/guides/cryptodevs/qat.rst| 10 +-- doc/guides/rel_notes/release_16_11.rst | 2 +- drivers/crypto/qat/qat_adf/qat_algs.h| 10 ++- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 72 +++-- drivers/crypto/qat/qat_crypto.c | 79 ++-- 5 files changed, 158 insertions(+), 15 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 78cadc4..6cdfb93 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -51,6 +51,7 @@ Cipher algorithms: * ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2`` * ``RTE_CRYPTO_CIPHER_AES_GCM`` * ``RTE_CRYPTO_CIPHER_NULL`` +* ``RTE_CRYPTO_CIPHER_KASUMI_F8`` Hash algorithms: @@ -63,17 +64,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. -* Cipher only is not supported except Snow3G UEA2. +* Hash only is not supported except Snow3G UIA2 and Kasumi F9. +* 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(UIA2) supported only if hash length, hash offset fields are byte-aligned. +* Snow3g(UEA2) and Kasumi(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. * Snow3g (UIA2) not supported in the PMD of **Intel QuickAssist Technology C3xxx** device. diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 4bc67e0..1dd0e6a 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -50,7 +50,7 @@ New Features * Added support for SHA224-HMAC algorithm. * Added support for SHA384-HMAC algorithm. * Added support for NULL algorithm. - + * Added support for KASUMI (F8 and F9) algorithm. Resolved Issues --- diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index 6a86053..fad8471 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -51,6 +51,14 @@ #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 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, \ ICP_QAT_HW_CIPHER_NO_CONVERT, \ @@ -130,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 d9437bc..131800c 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, @@ -454,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) { @@ -504,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; prot
[dpdk-dev] [PATCH v3 1/3] app/test: cleanup of test code for kasumi
Cleanup for easier kasumi enabling. Changed name of funcitons for clear understanding. Signed-off-by: Deepak Kumar Jain --- app/test/test_cryptodev.c | 117 ++ 1 file changed, 55 insertions(+), 62 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 67ca912..89d627f 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1448,74 +1448,67 @@ create_snow3g_kasumi_cipher_hash_operation(const uint8_t *auth_tag, /* set crypto operation source mbuf */ sym_op->m_src = ut_params->ibuf; + /* digest */ + sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( + ut_params->ibuf, auth_tag_len); - /* iv */ - if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8) - iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8); + TEST_ASSERT_NOT_NULL(sym_op->auth.digest.data, + "no room to append auth tag"); + ut_params->digest = sym_op->auth.digest.data; + sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->ibuf, data_pad_len); + sym_op->auth.digest.length = auth_tag_len; + if (op == RTE_CRYPTO_AUTH_OP_GENERATE) + memset(sym_op->auth.digest.data, 0, auth_tag_len); else - iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16); - - 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 = iv_pad_len; - - rte_memcpy(sym_op->cipher.iv.data, iv, iv_len); + rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - sym_op->cipher.data.length = cipher_len; - sym_op->cipher.data.offset = cipher_offset; + TEST_HEXDUMP(stdout, "digest:", + sym_op->auth.digest.data, + sym_op->auth.digest.length); /* aad */ - /* - * Always allocate the aad up to the block size. - * The cryptodev API calls out - - * - the array must be big enough to hold the AAD, plus any - * space to round this up to the nearest multiple of the - * block size (8 bytes for KASUMI and 16 bytes for SNOW3G). - */ + /* + * Always allocate the aad up to the block size. + * The cryptodev API calls out - + * - the array must be big enough to hold the AAD, plus any + * space to round this up to the nearest multiple of the + * block size (8 bytes for KASUMI and 16 bytes for SNOW3G). + */ if (auth_algo == RTE_CRYPTO_AUTH_KASUMI_F9) aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 8); else aad_buffer_len = ALIGN_POW2_ROUNDUP(aad_len, 16); - sym_op->auth.aad.data = - (uint8_t *)rte_pktmbuf_mtod(ut_params->ibuf, uint8_t *); + (uint8_t *)rte_pktmbuf_prepend( + ut_params->ibuf, aad_buffer_len); TEST_ASSERT_NOT_NULL(sym_op->auth.aad.data, "no room to prepend aad"); sym_op->auth.aad.phys_addr = rte_pktmbuf_mtophys( ut_params->ibuf); sym_op->auth.aad.length = aad_len; - - memset(sym_op->auth.aad.data, 0, aad_buffer_len); + memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); + TEST_HEXDUMP(stdout, "aad:", + sym_op->auth.aad.data, aad_len); - TEST_HEXDUMP(stdout, "aad:", - sym_op->auth.aad.data, aad_len); - - /* digest */ - 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, - "no room to append auth tag"); - ut_params->digest = sym_op->auth.digest.data; - sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( - ut_params->ibuf, data_pad_len + aad_len); - sym_op->auth.digest.length = auth_tag_len; - if (op == RTE_CRYPTO_AUTH_OP_GENERATE) - memset(sym_op->auth.digest.data, 0, auth_tag_len); + /* iv */ + if (cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8) + iv_pad_len = RTE_ALIGN_CEIL(iv_len, 8); else - rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - - TEST_HEXDUMP(stdout, "digest:", - sym_op->auth.digest.data, - sym_op->auth.digest.length); + iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16); + sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend( + ut_param
[dpdk-dev] [PATCH v3 0/3] add kasumi in Intel(R) QuickAssist driver
This patchset contains patches to enable kasumi functionality in Intel(R) QuickAsisst Technology Driver. This patchset depends on following patch: "crypto/qat: add Intel(R) QuickAssist C3xxx device" (http://dpdk.org/dev/patchwork/patch/15794/ Deepak Kumar Jain (3): app/test: cleanup of test code for kasumi crypto/qat: add Kasumi support in Intel(R) QAT driver app/test: add Kasumi tests in QAT test suite Changes in v3: * Merged Cipher only and hash only patches into one patch. * Code cleaup for clear understanding. Changes in v2: * Updated Test code to apply cleanly on driver code * Added relevant documentation app/test/test_cryptodev.c | 361 - app/test/test_cryptodev_kasumi_hash_test_vectors.h | 76 + app/test/test_cryptodev_kasumi_test_vectors.h | 103 +- doc/guides/cryptodevs/qat.rst | 10 +- doc/guides/rel_notes/release_16_11.rst | 2 +- drivers/crypto/qat/qat_adf/qat_algs.h | 10 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 72 +++- drivers/crypto/qat/qat_crypto.c| 79 - 8 files changed, 614 insertions(+), 99 deletions(-) -- 2.5.5
[dpdk-dev] [PATCH v1]:rte_timer:timer lag issue correction
Hi, > > 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 Fixes line format is not corerct. Fixes line should contain commit hash that introduced the bug and its subject line. For your case below should be added. Fixes: 9b15ba89 ("timer: use a skip list") Thanks, Reshma
[dpdk-dev] [PATCH 3/3] drivers/net:build support for new tap device driver
Signed-off-by: Keith Wiles --- config/common_linuxapp | 3 +++ drivers/net/Makefile | 1 + mk/rte.app.mk | 1 + 3 files changed, 5 insertions(+) diff --git a/config/common_linuxapp b/config/common_linuxapp index 2483dfa..704c01c 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -44,3 +44,6 @@ CONFIG_RTE_LIBRTE_PMD_VHOST=y CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y CONFIG_RTE_LIBRTE_POWER=y CONFIG_RTE_VIRTIO_USER=y +CONFIG_RTE_LIBRTE_PMD_TAP=y +CONFIG_RTE_PMD_TAP_MAX_QUEUES=32 + diff --git a/drivers/net/Makefile b/drivers/net/Makefile index bc93230..b4afa98 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -55,6 +55,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt +DIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 1a0095b..bd1d10f 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -129,6 +129,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost endif # $(CONFIG_RTE_LIBRTE_VHOST) _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)+= -lrte_pmd_vmxnet3_uio +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_TAP)+= -lrte_pmd_tap ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb -- 2.8.0.GIT
[dpdk-dev] [PATCH 2/3] docs:tun/tap PMD information
Signed-off-by: Keith Wiles --- doc/guides/nics/tap.rst | 84 + 1 file changed, 84 insertions(+) create mode 100644 doc/guides/nics/tap.rst diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst new file mode 100644 index 000..072def8 --- /dev/null +++ b/doc/guides/nics/tap.rst @@ -0,0 +1,84 @@ +.. BSD LICENSE +Copyright(c) 2016 Intel Corporation. All rights reserved. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the +distribution. +* Neither the name of Intel Corporation nor the names of its +contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Tun/Tap Poll Mode Driver + + +The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local +host. The PMD allows for DPDK and the host to communicate using a raw device +interface on the host and in the DPDK application. + +The device created is a TAP device, which sends/receives packet in a raw format +with a L2 header. The usage for a TAP PMD is for connectivity to the local host +using a TAP interface. When the TAP PMD is initialized it will create a number +of tap devices in the host accessed via 'ifconfig -a' or 'ip' command. The +commands can be used to assign and query the virtual like device. + +These TAP interfaces can be used with wireshark or tcpdump or Pktgen-DPDK along +with being able to be used as a network connection to the DPDK application. The +method enable one or more interfaces is to use the --vdev=eth_tap option on the +DPDK application command line. Each --vdev=eth_tap option give will create an +interface named dtap0, dtap1, ... and so forth. + +.. code-block:: console + + The interfaced name can be changed by adding the iface=foo0 + e.g. --vedv=eth_tap,iface=foo0 --vdev=eth_tap,iface=foo1, ... + +.. code-block:: console + + Also the speed of the interface can be changed from 10G to whatever number + needed, but the interface does not enforce that speed. + e.g. --vdev=eth_tap,iface=foo0,speed=25000 + +After the DPDK application is started you can send and receive packets on the +interface using the standard rx_burst/tx_burst APIs in DPDK. From the host point +of view you can use any host tool like tcpdump, wireshark, ping, Pktgen and +others to communicate with the DPDK application. The DPDK application may not +understand network protocols like IPv4/6, UDP or TCP unless the application has +been written to understand these protocols. + +If you need the interface as a real network interface meaning running and has +a valid IP address then you can do this with the following commands: + +.. code-block:: console + + sudo ip link set dtap0 up; sudo ip addr add 192.168.0.250/24 dev dtap0 + sudo ip link set dtap1 up; sudo ip addr add 192.168.1.250/24 dev dtap1 + +Please change the IP addresses as you see fit. + +If routing is enabled on the host you can also communicate with the DPDK App +over the internet via a standard socket layer application as long as you account +for the protocol handing in the application. + +If you have a Network Stack in your DPDK application or something like it you +can utilize that stack to handle the network protocols. Plus you would be able +to address the interface using an IP address assigned to the internal interface. -- 2.8.0.GIT
[dpdk-dev] [PATCH 1/3] drivers/net:new PMD using tun/tap host interface
The rte_eth_tap.c PMD creates a device using TUN/TAP interfaces on the local host. The PMD allows for DPDK and the host to communicate using a raw device interface on the host and in the DPDK application. The device created is a Tap device with a L2 packet header. Signed-off-by: Keith Wiles --- drivers/net/tap/Makefile| 60 +++ drivers/net/tap/rte_eth_tap.c | 872 drivers/net/tap/rte_pmd_tap_version.map | 4 + 3 files changed, 936 insertions(+) create mode 100644 drivers/net/tap/Makefile create mode 100644 drivers/net/tap/rte_eth_tap.c create mode 100644 drivers/net/tap/rte_pmd_tap_version.map diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile new file mode 100644 index 000..442a2fe --- /dev/null +++ b/drivers/net/tap/Makefile @@ -0,0 +1,60 @@ +# BSD LICENSE +# +# Copyright(c) 2014 John W. Linville +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2014 6WIND S.A. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_tap.a + +EXPORT_MAP := rte_pmd_tap_version.map + +LIBABIVER := 1 + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_eal +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mempool +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_kvargs + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c new file mode 100644 index 000..027bb35 --- /dev/null +++ b/drivers/net/tap/rte_eth_tap.c @@ -0,0 +1,872 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2016 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INC
[dpdk-dev] [PATCH v2 2/2] vhost: add vhost-scsi support to vhost library
Since we changed the vhost library as a common framework to add other VIRTIO device type, here we add VIRTIO_ID_SCSI device type to vhost library to support vhost-scsi target. Signed-off-by: Changpeng Liu --- lib/librte_vhost/Makefile | 4 +- lib/librte_vhost/rte_virtio_dev.h | 1 + lib/librte_vhost/rte_virtio_scsi.h | 68 +++ lib/librte_vhost/socket.c | 2 + lib/librte_vhost/vhost_device.h| 3 + lib/librte_vhost/vhost_net.c | 2 +- lib/librte_vhost/vhost_scsi.c | 354 + lib/librte_vhost/vhost_scsi.h | 68 +++ lib/librte_vhost/vhost_user.c | 31 +++- lib/librte_vhost/vhost_user.h | 5 + lib/librte_vhost/virtio_scsi.c | 145 +++ 11 files changed, 675 insertions(+), 8 deletions(-) create mode 100644 lib/librte_vhost/rte_virtio_scsi.h create mode 100644 lib/librte_vhost/vhost_scsi.c create mode 100644 lib/librte_vhost/vhost_scsi.h create mode 100644 lib/librte_vhost/virtio_scsi.c diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile index af30491..e8fca35 100644 --- a/lib/librte_vhost/Makefile +++ b/lib/librte_vhost/Makefile @@ -48,10 +48,10 @@ endif # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c socket.c vhost_net.c vhost_user.c \ - virtio_net.c + virtio_net.c vhost_scsi.c virtio_scsi.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h rte_virtio_dev.h +SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h rte_virtio_scsi.h rte_virtio_dev.h # dependencies DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal diff --git a/lib/librte_vhost/rte_virtio_dev.h b/lib/librte_vhost/rte_virtio_dev.h index e3c857a..325a208 100644 --- a/lib/librte_vhost/rte_virtio_dev.h +++ b/lib/librte_vhost/rte_virtio_dev.h @@ -40,6 +40,7 @@ #define RTE_VHOST_USER_TX_ZERO_COPY(1ULL << 2) #define RTE_VHOST_USER_DEV_NET (1ULL << 32) +#define RTE_VHOST_USER_DEV_SCSI(1ULL << 33) /** * Device and vring operations. diff --git a/lib/librte_vhost/rte_virtio_scsi.h b/lib/librte_vhost/rte_virtio_scsi.h new file mode 100644 index 000..4e4cec5 --- /dev/null +++ b/lib/librte_vhost/rte_virtio_scsi.h @@ -0,0 +1,68 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _VIRTIO_SCSI_H_ +#define _VIRTIO_SCSI_H_ + +/** + * @file + * Interface to vhost net + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +enum {DIR_DMA_NONE, DIR_DMA_FROM_DEV, DIR_DMA_TO_DEV}; + +/* Register callbacks. */ +int rte_vhost_scsi_driver_callback_register(struct virtio_net_device_ops const * const); + +int rte_vhost_scsi_pop_request(int vid, uint16_t queue_id, + struct virtio_scsi_cmd_req **request, + struct virtio_scsi_cmd_resp **response, + struct iovec *iovs, int *iov_cnt, uint32_t *desc_idx, + uint32_t *xfer_direction); + +int rte_vhost_scsi_push_response(int vid, uint16_t queue_id, +uint32_t req_idx, uint32_t len); + + +#endif /* _VIRTIO_SCSI_H_ */ \ No newline at end of file diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 1474c98..2b3f854 100644 --- a/li
[dpdk-dev] [PATCH v2 1/2] vhost: change the vhost library to a common framework which can support more VIRTIO devices
For storage virtualization use cases, vhost-scsi becomes a more popular solution to support VMs. However a user space vhost-scsi-user solution does not exist currently. SPDK(Storage Performance Development Kit, https://github.com/spdk/spdk) will provide a user space vhost-scsi target to support multiple VMs through Qemu. Originally SPDK is built on top of DPDK libraries, so we would like to use DPDK vhost library as the communication channel between Qemu and vhost-scsi target application. Currently DPDK vhost library can only support VIRTIO_ID_NET device type, we would like to extend the library to support VIRTIO_ID_SCSI and VIRTIO_ID_BLK. Most of DPDK vhost library can be reused only several differences: 1. VIRTIO SCSI device has different vring queues compared with VIRTIO NET device, at least 3 vring queues needed for SCSI device type; 2. VIRTIO SCSI will need several extra message operation code, such as SCSI_SET_ENDPIONT/SCSI_CLEAR_ENDPOINT; First, we would like to extend DPDK vhost library as a common framework which be friendly to add other VIRTIO device types, to implement this feature, we add a new data structure virtio_dev, which can deliver socket messages to different VIRTIO devices, each specific VIRTIO device will register callback to virtio_dev. Secondly, we would to upstream a patch to Qemu community to add vhost-scsi specific operation command such as SCSI_SET_ENDPOINT and SCSI_CLEAR_ENDOINT, and user space feature bits. Finally, after the Qemu patch set was merged, we will add VIRTIO_ID_SCSI support to DPDK vhost library and an example vhost-scsi target which can add a SCSI device to VM through this example application. This patch set changed the vhost library as a common framework which can add other VIRTIO device type in future. Signed-off-by: Changpeng Liu --- lib/librte_vhost/Makefile | 4 +- lib/librte_vhost/rte_virtio_dev.h | 140 lib/librte_vhost/rte_virtio_net.h | 97 +- lib/librte_vhost/socket.c | 6 +- lib/librte_vhost/vhost.c | 421 lib/librte_vhost/vhost.h | 288 - lib/librte_vhost/vhost_device.h | 230 + lib/librte_vhost/vhost_net.c | 659 ++ lib/librte_vhost/vhost_net.h | 126 lib/librte_vhost/vhost_user.c | 451 +- lib/librte_vhost/vhost_user.h | 17 +- lib/librte_vhost/virtio_net.c | 37 ++- 12 files changed, 1426 insertions(+), 1050 deletions(-) create mode 100644 lib/librte_vhost/rte_virtio_dev.h delete mode 100644 lib/librte_vhost/vhost.c delete mode 100644 lib/librte_vhost/vhost.h create mode 100644 lib/librte_vhost/vhost_device.h create mode 100644 lib/librte_vhost/vhost_net.c create mode 100644 lib/librte_vhost/vhost_net.h diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile index 415ffc6..af30491 100644 --- a/lib/librte_vhost/Makefile +++ b/lib/librte_vhost/Makefile @@ -47,11 +47,11 @@ LDLIBS += -lnuma endif # all source are stored in SRCS-y -SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c socket.c vhost.c vhost_user.c \ +SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c socket.c vhost_net.c vhost_user.c \ virtio_net.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h +SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h rte_virtio_dev.h # dependencies DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal diff --git a/lib/librte_vhost/rte_virtio_dev.h b/lib/librte_vhost/rte_virtio_dev.h new file mode 100644 index 000..e3c857a --- /dev/null +++ b/lib/librte_vhost/rte_virtio_dev.h @@ -0,0 +1,140 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMP
[dpdk-dev] hw checksum offload feature issue
Hi, We are developing CGNAT VNF over DPDK. In that, we have NAT64 feature included which basically does IPv6 to IPv4 NAT translation and vice versa. When we do conversion from IPv6 to IPv4, we have used dpdk mbuf library function rte_pktmbuf_adj() to remove 20 bytes of IPv6 header at the beginning and create IPv4 header and other headers appropriately. Also, we have hw checksum offload feature enabled. So when the packet goes through NIC hw checksum, apart from calculating IPv4 and UDP/TCP checksum, it also modifies other header fields like eth header dest address field. SO, have you come across any issue like this ?? When we disable hw checksum feature, packet header fields are not modified and there is no issue. Thanks, Rajaram.