[dpdk-dev] [PATCH v15 1/2] kni: support userspace VA

Ferruh Yigit ferruh.yigit at intel.com
Wed Nov 20 11:47:36 CET 2019


On 11/17/2019 3:12 PM, David Marchand wrote:
> From: Vamsi Attunuru <vattunuru at marvell.com>
> 
> Patch adds support for kernel module to work in IOVA = VA mode by
> providing address translation routines to convert userspace VA to
> kernel VA.
> 
> KNI performance using PA is not changed by this patch.
> But comparing KNI using PA to KNI using VA, the latter will have lower
> performance due to the cost of the added translation.
> 
> This translation is implemented only with kernel versions starting 4.6.0.
> 
> Signed-off-by: Vamsi Attunuru <vattunuru at marvell.com>
> Signed-off-by: Kiran Kumar K <kirankumark at marvell.com>
> ---
> Changelog since v14:
> - reworded commitlog,
> 
> ---
>  kernel/linux/kni/compat.h                     | 14 +++++
>  kernel/linux/kni/kni_dev.h                    | 42 +++++++++++++
>  kernel/linux/kni/kni_misc.c                   | 39 +++++++++---
>  kernel/linux/kni/kni_net.c                    | 62 +++++++++++++++----
>  .../linux/eal/include/rte_kni_common.h        |  1 +
>  5 files changed, 136 insertions(+), 22 deletions(-)
> 
> diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h
> index 562d8bf94..062b170ef 100644
> --- a/kernel/linux/kni/compat.h
> +++ b/kernel/linux/kni/compat.h
> @@ -121,3 +121,17 @@
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
>  #define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
>  #endif
> +
> +#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE
> +
> +#define HAVE_IOVA_TO_KVA_MAPPING_SUPPORT
> +
> +#if KERNEL_VERSION(4, 9, 0) > LINUX_VERSION_CODE
> +#define GET_USER_PAGES_REMOTE_API_V1
> +#elif KERNEL_VERSION(4, 9, 0) == LINUX_VERSION_CODE
> +#define GET_USER_PAGES_REMOTE_API_V2
> +#else
> +#define GET_USER_PAGES_REMOTE_API_V3
> +#endif

A build error has been reported [1], it looks like only version check is not
enough for the distro kernel version that may be backported some related commits.

I am also checking if we can find another way to check which version of the
function to use, but can you also please check?

Thanks,
ferruh


[1]
In file included from
/tmp/dpdk/i686-native-linuxapp-gcc/build/kernel/linux/kni/kni_net.c:25:0:
/tmp/dpdk/kernel/linux/kni/kni_dev.h: In function ‘iova_to_phys’:
/tmp/dpdk/kernel/linux/kni/kni_dev.h:114:9: error: expected ‘)’ before numeric
constant
         0, 0, &page, NULL);
         ^
/tmp/dpdk/kernel/linux/kni/kni_dev.h:113:8: error: too few arguments to function
‘get_user_pages_remote’
  ret = get_user_pages_remote(tsk, tsk->mm, iova, 1
        ^~~~~~~~~~~~~~~~~~~~~
In file included from
/usr/src/linux-headers-4.8.0-22-generic/include/linux/scatterlist.h:7:0,
                 from
/usr/src/linux-headers-4.8.0-22-generic/include/linux/dmaengine.h:24,
                 from
/usr/src/linux-headers-4.8.0-22-generic/include/linux/netdevice.h:38,
                 from
/tmp/dpdk/i686-native-linuxapp-gcc/build/kernel/linux/kni/kni_net.c:14:
/usr/src/linux-headers-4.8.0-22-generic/include/linux/mm.h:1311:6: note:
declared here
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from
/tmp/dpdk/i686-native-linuxapp-gcc/build/kernel/linux/kni/kni_misc.c:22:0:
/tmp/dpdk/kernel/linux/kni/kni_dev.h: In function ‘iova_to_phys’:
/tmp/dpdk/kernel/linux/kni/kni_dev.h:114:9: error: expected ‘)’ before numeric
constant
         0, 0, &page, NULL);
         ^
/tmp/dpdk/kernel/linux/kni/kni_dev.h:113:8: error: too few arguments to function
‘get_user_pages_remote’
  ret = get_user_pages_remote(tsk, tsk->mm, iova, 1
        ^~~~~~~~~~~~~~~~~~~~~
In file included from
/usr/src/linux-headers-4.8.0-22-generic/include/linux/scatterlist.h:7:0,
                 from
/usr/src/linux-headers-4.8.0-22-generic/include/linux/dmaengine.h:24,
                 from
/usr/src/linux-headers-4.8.0-22-generic/include/linux/netdevice.h:38,
                 from
/tmp/dpdk/i686-native-linuxapp-gcc/build/kernel/linux/kni/kni_misc.c:9:
/usr/src/linux-headers-4.8.0-22-generic/include/linux/mm.h:1311:6: note:
declared here
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~




More information about the dev mailing list