kni: fix build with Linux 5.9

Starting from Linux 5.9 'get_user_pages_remote()' API doesn't get
'struct task_struct' parameter:
commit 64019a2e467a ("mm/gup: remove task_struct pointer for all gup code")

The change reflected to the KNI with version check.

Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Ferruh Yigit 2020-08-17 11:32:47 +01:00 committed by Thomas Monjalon
parent 2d962bb736
commit 87efaea637
2 changed files with 9 additions and 0 deletions

View File

@ -134,3 +134,7 @@
#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE
#define HAVE_TX_TIMEOUT_TXQUEUE
#endif
#if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE
#define HAVE_TSK_IN_GUP
#endif

View File

@ -101,8 +101,13 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk,
offset = iova & (PAGE_SIZE - 1);
/* Read one page struct info */
#ifdef HAVE_TSK_IN_GUP
ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
FOLL_TOUCH, &page, NULL, NULL);
#else
ret = get_user_pages_remote(tsk->mm, iova, 1,
FOLL_TOUCH, &page, NULL, NULL);
#endif
if (ret < 0)
return 0;