[OpenWrt-Devel] [PATCH 4/4] lantiq: lantiq-deu: Make the DEU driver compatible with 4.2 and newer

Hauke Mehrtens hauke at hauke-m.de
Thu Dec 31 08:42:26 EST 2015



On 12/31/2015 01:10 AM, Martin Blumenstingl wrote:
> Upstream linux 4.2 commit 84be456f883c4685680fba8e5154b5f72e92957e
> "remove <asm/scatterlist.h>" moves scatterlist.h to linux/ instead of asm/.
> 
> Upstream linux 4.3 commit b0d955ba4688fcba8112884931aea1f1e6f50f03
> "crypto: aead - Remove old AEAD interfaces" removed aead_request_set_assoc.
> aead_request_set_ad should be used instead.
> ---
>  package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h    |  6 ++++++
>  package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h |  6 ++++++
>  package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h    |  7 +++++++
>  package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.h    |  6 ++++++
>  package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c       |  7 +++++++
>  package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c  |  7 +++++++
>  package/kernel/lantiq/ltq-deu/src/ltq_deu_testmgr.c    | 10 ++++++++++
>  7 files changed, 49 insertions(+)
> 
> diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h
> index 1d84da3..f030d62 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h
> +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_ar9.h
> @@ -54,7 +54,13 @@
>  #include <crypto/algapi.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
> +#include <linux/scatterlist.h>
> +#else
>  #include <asm/scatterlist.h>
> +#endif
> +
>  #include <linux/skbuff.h>
>  #include <linux/netdevice.h>
>  #include "ifxmips_deu.h"
> diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h
> index 62ad96d..32e055c 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h
> +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_danube.h
> @@ -53,7 +53,13 @@
>  #include <crypto/algapi.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
> +#include <linux/scatterlist.h>
> +#else
>  #include <asm/scatterlist.h>
> +#endif
> +
>  #include <linux/skbuff.h>
>  #include <linux/netdevice.h>
>  #include "ifxmips_deu.h"
> diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h
> index 5198a4a..c376266 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h
> +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h
> @@ -31,11 +31,18 @@
>  #ifndef IFXMIPS_DEU_DMA_H
>  #define IFXMIPS_DEU_DMA_H
>  
> +#include <linux/version.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
>  #include <linux/crypto.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
> +#include <linux/scatterlist.h>
> +#else
>  #include <asm/scatterlist.h>
> +#endif
> +
>  #include <asm/byteorder.h>
>  #include <linux/skbuff.h>
>  #include <linux/netdevice.h>
> diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.h
> index d2cfd11..f801c24 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.h
> +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_vr9.h
> @@ -54,7 +54,13 @@
>  #include <crypto/algapi.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
> +#include <linux/scatterlist.h>
> +#else
>  #include <asm/scatterlist.h>
> +#endif
> +
>  #include <linux/skbuff.h>
>  #include <linux/netdevice.h>
>  #include "ifxmips_deu.h"
> diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
> index a5f5f90..e546a92 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
> +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1.c
> @@ -40,6 +40,7 @@
>  
>  
>  /* Project header */
> +#include <linux/version.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> @@ -48,7 +49,13 @@
>  #include <crypto/sha.h>
>  #include <crypto/internal/hash.h>
>  #include <linux/types.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
> +#include <linux/scatterlist.h>
> +#else
>  #include <asm/scatterlist.h>
> +#endif
> +
>  #include <asm/byteorder.h>
>  
>  #if defined(CONFIG_DANUBE)
> diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
> index a5a6c39..be16152 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
> +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_sha1_hmac.c
> @@ -40,6 +40,7 @@
>  
>  
>  /* Project header */
> +#include <linux/version.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/mm.h>
> @@ -47,7 +48,13 @@
>  #include <linux/cryptohash.h>
>  #include <crypto/internal/hash.h>
>  #include <linux/types.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
> +#include <linux/scatterlist.h>
> +#else
>  #include <asm/scatterlist.h>
> +#endif
> +
>  #include <asm/byteorder.h>
>  #include <linux/delay.h>
>  
> diff --git a/package/kernel/lantiq/ltq-deu/src/ltq_deu_testmgr.c b/package/kernel/lantiq/ltq-deu/src/ltq_deu_testmgr.c
> index 054cac3..36848ee 100644
> --- a/package/kernel/lantiq/ltq-deu/src/ltq_deu_testmgr.c
> +++ b/package/kernel/lantiq/ltq-deu/src/ltq_deu_testmgr.c
> @@ -13,6 +13,8 @@
>   *
>   */
>  
> +#include <linux/version.h>
> +#include <crypto/aead.h>
>  #include <crypto/hash.h>
>  #include <linux/err.h>
>  #include <linux/module.h>
> @@ -475,7 +477,11 @@ static int test_aead(struct crypto_aead *tfm, int enc,
>  			aead_request_set_crypt(req, sg, sg,
>  					       template[i].ilen, iv);
>  
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
>  			aead_request_set_assoc(req, asg, template[i].alen);
> +#else
> +			aead_request_set_ad(req, template[i].alen);
> +#endif

I think this change is wrong. Compare it to the changes done in the
upstream version this code is derived from:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8a525fcd46751f8538c240baa4d37d55896c5a29

Do we need the extended testmgr.c code? otherwise I would just remove
it. For me it looks like it was used to test the performance of the
crypto engine and test the driver.

>  
>  			ret = enc ?
>  				crypto_aead_encrypt(req) :
> @@ -616,7 +622,11 @@ static int test_aead(struct crypto_aead *tfm, int enc,
>  					       template[i].ilen,
>  					       iv);
>  
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
>  			aead_request_set_assoc(req, asg, template[i].alen);
> +#else
> +			aead_request_set_ad(req, template[i].alen);
> +#endif
>  
>  			ret = enc ?
>  				crypto_aead_encrypt(req) :
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list