DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking
@ 2014-12-10  3:32 Jincheng Miao
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 1/4] igb_uio: compatible with upstream longterm kernel and RHEL Jincheng Miao
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  3:32 UTC (permalink / raw)
  To: dev

The related kernel function is:
- pci_num_vf, it is introduced from upstream linux-2.6.34. For RHEL-based
kernel, it is defined from RHEL5.9.

- kstrtoul, this function is united kernel API to replace strict_strtoul in
the furture. It is introduced from linux-2.6.39. For RHEL6, it is defined
from RHEL6.4.

This patchset do some compatiblity work for these two functions, and
replace strict_strtoul which is depleted from linux-3.18.

v3:
  Adjust pci_num_vf() introduced RHEL version number.
  Seperate "replace strict_strtoul with kstrtoul" into 3 patches for igb_uio,
kni, and xen_dom0. Add compat.h in kni and xen_dom0 for compatible with
older kernels.

v2:
  Merge these two patch in one patchset.
  Compatible with old kernel for kstrtoul.
  Compatible with RHEL6 for pci_num_vf.

Jincheng Miao (4):
  igb_uio: compatible with upstream longterm kernel and RHEL
  igb_uio: replace strict_strtoul with kstrtoul
  kni: replace strict_strtoul with kstrtoul
  xen_dom0: replace strict_strtoul with kstrtoul

 lib/librte_eal/linuxapp/igb_uio/compat.h        |   11 ++++++++++-
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c       |    4 ++--
 lib/librte_eal/linuxapp/kni/compat.h            |   16 ++++++++++++++++
 lib/librte_eal/linuxapp/kni/kni_vhost.c         |    2 +-
 lib/librte_eal/linuxapp/xen_dom0/compat.h       |   16 ++++++++++++++++
 lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c |    2 +-
 6 files changed, 46 insertions(+), 5 deletions(-)
 create mode 100644 lib/librte_eal/linuxapp/kni/compat.h
 create mode 100644 lib/librte_eal/linuxapp/xen_dom0/compat.h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 1/4] igb_uio: compatible with upstream longterm kernel and RHEL
  2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
@ 2014-12-10  3:33 ` Jincheng Miao
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 2/4] igb_uio: replace strict_strtoul with kstrtoul Jincheng Miao
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  3:33 UTC (permalink / raw)
  To: dev

Function pci_num_vf() is introduced from upstream linux-2.6.34. So
this patch make compatible with longterm kernel linux-2.6.32.63.

For RHEL, function pci_num_vf() begins from RHEL5 update9. And
it is stub-defined when CONFIG_PCI_IOV is not enabled.

So dropped the CONFIG_PCI_IOV checking of commit 11ba0426.

For other distro like RHEL behaved to pci_num_vf(), we could simply
append following condition macro:
(!(defined(OTHER_RELEASE_CODE) && \
 OTHER_RELEASE_CODE >= OTHER_RELEASE_VERSION(X, Y)))

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
---
 lib/librte_eal/linuxapp/igb_uio/compat.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/librte_eal/linuxapp/igb_uio/compat.h b/lib/librte_eal/linuxapp/igb_uio/compat.h
index 676fa1b..a36f034 100644
--- a/lib/librte_eal/linuxapp/igb_uio/compat.h
+++ b/lib/librte_eal/linuxapp/igb_uio/compat.h
@@ -21,7 +21,8 @@
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && \
-	!defined(CONFIG_PCI_IOV)
+	(!(defined(RHEL_RELEASE_CODE) && \
+	 RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 9))) 
 
 static int pci_num_vf(struct pci_dev *dev)
 {
-- 
1.7.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 2/4] igb_uio: replace strict_strtoul with kstrtoul
  2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 1/4] igb_uio: compatible with upstream longterm kernel and RHEL Jincheng Miao
@ 2014-12-10  3:33 ` Jincheng Miao
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 3/4] kni: " Jincheng Miao
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  3:33 UTC (permalink / raw)
  To: dev

>From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

Kstrtoul exists from RHEL6.4, so for compatible with old kernel and RHEL,
add some logic to igb_uio/compat.h, same as what we do for pci_num_vf().

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
---
 lib/librte_eal/linuxapp/igb_uio/compat.h  |    8 ++++++++
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c |    4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/igb_uio/compat.h b/lib/librte_eal/linuxapp/igb_uio/compat.h
index a36f034..214d5de 100644
--- a/lib/librte_eal/linuxapp/igb_uio/compat.h
+++ b/lib/librte_eal/linuxapp/igb_uio/compat.h
@@ -44,6 +44,14 @@ static int pci_num_vf(struct pci_dev *dev)
 
 #endif /* < 2.6.34 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
+        (!(defined(RHEL_RELEASE_CODE) && \
+           RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))
+
+#define kstrtoul strict_strtoul
+
+#endif /* < 2.6.39 */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && \
 	(!(defined(RHEL_RELEASE_CODE) && \
 	   RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3)))
diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index d1ca26e..47ff2f3 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -83,7 +83,7 @@ store_max_vfs(struct device *dev, struct device_attribute *attr,
 	unsigned long max_vfs;
 	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
 
-	if (0 != strict_strtoul(buf, 0, &max_vfs))
+	if (0 != kstrtoul(buf, 0, &max_vfs))
 		return -EINVAL;
 
 	if (0 == max_vfs)
@@ -174,7 +174,7 @@ store_max_read_request_size(struct device *dev,
 	unsigned long size = 0;
 	int ret;
 
-	if (strict_strtoul(buf, 0, &size) != 0)
+	if (0 != kstrtoul(buf, 0, &size))
 		return -EINVAL;
 
 	ret = pcie_set_readrq(pci_dev, (int)size);
-- 
1.7.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 3/4] kni: replace strict_strtoul with kstrtoul
  2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 1/4] igb_uio: compatible with upstream longterm kernel and RHEL Jincheng Miao
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 2/4] igb_uio: replace strict_strtoul with kstrtoul Jincheng Miao
@ 2014-12-10  3:33 ` Jincheng Miao
  2014-12-10  8:39   ` Thomas Monjalon
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 4/4] xen_dom0: " Jincheng Miao
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  3:33 UTC (permalink / raw)
  To: dev

>From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

And add kni/compat.h for be compatible with older kernel.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
---
 lib/librte_eal/linuxapp/kni/compat.h    |   16 ++++++++++++++++
 lib/librte_eal/linuxapp/kni/kni_vhost.c |    2 +-
 2 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 lib/librte_eal/linuxapp/kni/compat.h

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
new file mode 100644
index 0000000..c8c662c
--- /dev/null
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -0,0 +1,16 @@
+/*
+ * Minimal wrappers to allow compiling kni on older kernels.
+ */
+
+#ifndef RHEL_RELEASE_VERSION
+#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
+        (!(defined(RHEL_RELEASE_CODE) && \
+           RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))
+
+#define kstrtoul strict_strtoul
+
+#endif /* < 2.6.39 */
+
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index 7bcc985..c05c868 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -740,7 +740,7 @@ set_sock_en(struct device *dev, struct device_attribute *attr,
 	unsigned long en;
 	int err = 0;
 
-	if (0 != strict_strtoul(buf, 0, &en))
+	if (0 != kstrtoul(buf, 0, &en))
 		return -EINVAL;
 
 	if (en)
-- 
1.7.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dpdk-dev] [PATCH 4/4] xen_dom0: replace strict_strtoul with kstrtoul
  2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
                   ` (2 preceding siblings ...)
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 3/4] kni: " Jincheng Miao
@ 2014-12-10  3:33 ` Jincheng Miao
  2014-12-10  8:39   ` Thomas Monjalon
  2014-12-10  3:58 ` [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Zhang, Helin
  2014-12-10  4:15 ` Jincheng Miao
  5 siblings, 1 reply; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  3:33 UTC (permalink / raw)
  To: dev

>From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

And add xen_dom0/compat.h for be compatible with older kernel.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
---
 lib/librte_eal/linuxapp/xen_dom0/compat.h       |   16 ++++++++++++++++
 lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c |    2 +-
 2 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 lib/librte_eal/linuxapp/xen_dom0/compat.h

diff --git a/lib/librte_eal/linuxapp/xen_dom0/compat.h b/lib/librte_eal/linuxapp/xen_dom0/compat.h
new file mode 100644
index 0000000..ca6e160
--- /dev/null
+++ b/lib/librte_eal/linuxapp/xen_dom0/compat.h
@@ -0,0 +1,16 @@
+/*
+ * Minimal wrappers to allow compiling xen_dom0 on older kernels.
+ */
+
+#ifndef RHEL_RELEASE_VERSION
+#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
+        (!(defined(RHEL_RELEASE_CODE) && \
+           RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))
+
+#define kstrtoul strict_strtoul
+
+#endif /* < 2.6.39 */
+
diff --git a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
index dfb271d..8a3727d 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
+++ b/lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c
@@ -123,7 +123,7 @@ store_memsize(struct device *dev, struct device_attribute *attr,
 	int err = 0;
 	unsigned long mem_size;
 
-	if (0 != strict_strtoul(buf, 0, &mem_size))
+	if (0 != kstrtoul(buf, 0, &mem_size))
 		return  -EINVAL;
 
 	mutex_lock(&dom0_dev.data_lock);
-- 
1.7.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking
  2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
                   ` (3 preceding siblings ...)
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 4/4] xen_dom0: " Jincheng Miao
@ 2014-12-10  3:58 ` Zhang, Helin
  2014-12-10  4:15 ` Jincheng Miao
  5 siblings, 0 replies; 12+ messages in thread
From: Zhang, Helin @ 2014-12-10  3:58 UTC (permalink / raw)
  To: Jincheng Miao, dev

Acked-by: Helin Zhang <helin.zhang@intel.com>

Note: Don't forget to add the version number to your patch name next time. E.g. [PATCH v3 0/4]

> -----Original Message-----
> From: Jincheng Miao [mailto:jmiao@redhat.com]
> Sent: Wednesday, December 10, 2014 11:33 AM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Zhang, Helin; Jincheng Miao
> Subject: [PATCH 0/4] compatibility fallback and replacement of kernel function
> invoking
> 
> The related kernel function is:
> - pci_num_vf, it is introduced from upstream linux-2.6.34. For RHEL-based
> kernel, it is defined from RHEL5.9.
> 
> - kstrtoul, this function is united kernel API to replace strict_strtoul in the
> furture. It is introduced from linux-2.6.39. For RHEL6, it is defined from
> RHEL6.4.
> 
> This patchset do some compatiblity work for these two functions, and replace
> strict_strtoul which is depleted from linux-3.18.
> 
> v3:
>   Adjust pci_num_vf() introduced RHEL version number.
>   Seperate "replace strict_strtoul with kstrtoul" into 3 patches for igb_uio, kni,
> and xen_dom0. Add compat.h in kni and xen_dom0 for compatible with older
> kernels.
> 
> v2:
>   Merge these two patch in one patchset.
>   Compatible with old kernel for kstrtoul.
>   Compatible with RHEL6 for pci_num_vf.
> 
> Jincheng Miao (4):
>   igb_uio: compatible with upstream longterm kernel and RHEL
>   igb_uio: replace strict_strtoul with kstrtoul
>   kni: replace strict_strtoul with kstrtoul
>   xen_dom0: replace strict_strtoul with kstrtoul
> 
>  lib/librte_eal/linuxapp/igb_uio/compat.h        |   11 ++++++++++-
>  lib/librte_eal/linuxapp/igb_uio/igb_uio.c       |    4 ++--
>  lib/librte_eal/linuxapp/kni/compat.h            |   16
> ++++++++++++++++
>  lib/librte_eal/linuxapp/kni/kni_vhost.c         |    2 +-
>  lib/librte_eal/linuxapp/xen_dom0/compat.h       |   16
> ++++++++++++++++
>  lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c |    2 +-
>  6 files changed, 46 insertions(+), 5 deletions(-)  create mode 100644
> lib/librte_eal/linuxapp/kni/compat.h
>  create mode 100644 lib/librte_eal/linuxapp/xen_dom0/compat.h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking
  2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
                   ` (4 preceding siblings ...)
  2014-12-10  3:58 ` [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Zhang, Helin
@ 2014-12-10  4:15 ` Jincheng Miao
  5 siblings, 0 replies; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  4:15 UTC (permalink / raw)
  To: dev, helin.zhang

Forget to add 'v3' in header.

@helin, thanks for your review.

On 12/10/2014 11:32 AM, Jincheng Miao wrote:
> The related kernel function is:
> - pci_num_vf, it is introduced from upstream linux-2.6.34. For RHEL-based
> kernel, it is defined from RHEL5.9.
>
> - kstrtoul, this function is united kernel API to replace strict_strtoul in
> the furture. It is introduced from linux-2.6.39. For RHEL6, it is defined
> from RHEL6.4.
>
> This patchset do some compatiblity work for these two functions, and
> replace strict_strtoul which is depleted from linux-3.18.
>
> v3:
>    Adjust pci_num_vf() introduced RHEL version number.
>    Seperate "replace strict_strtoul with kstrtoul" into 3 patches for igb_uio,
> kni, and xen_dom0. Add compat.h in kni and xen_dom0 for compatible with
> older kernels.
>
> v2:
>    Merge these two patch in one patchset.
>    Compatible with old kernel for kstrtoul.
>    Compatible with RHEL6 for pci_num_vf.
>
> Jincheng Miao (4):
>    igb_uio: compatible with upstream longterm kernel and RHEL
>    igb_uio: replace strict_strtoul with kstrtoul
>    kni: replace strict_strtoul with kstrtoul
>    xen_dom0: replace strict_strtoul with kstrtoul
>
>   lib/librte_eal/linuxapp/igb_uio/compat.h        |   11 ++++++++++-
>   lib/librte_eal/linuxapp/igb_uio/igb_uio.c       |    4 ++--
>   lib/librte_eal/linuxapp/kni/compat.h            |   16 ++++++++++++++++
>   lib/librte_eal/linuxapp/kni/kni_vhost.c         |    2 +-
>   lib/librte_eal/linuxapp/xen_dom0/compat.h       |   16 ++++++++++++++++
>   lib/librte_eal/linuxapp/xen_dom0/dom0_mm_misc.c |    2 +-
>   6 files changed, 46 insertions(+), 5 deletions(-)
>   create mode 100644 lib/librte_eal/linuxapp/kni/compat.h
>   create mode 100644 lib/librte_eal/linuxapp/xen_dom0/compat.h
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] kni: replace strict_strtoul with kstrtoul
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 3/4] kni: " Jincheng Miao
@ 2014-12-10  8:39   ` Thomas Monjalon
  2014-12-10  8:48     ` Jincheng Miao
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Monjalon @ 2014-12-10  8:39 UTC (permalink / raw)
  To: Jincheng Miao; +Cc: dev

Hi Jincheng,

2014-12-10 11:33, Jincheng Miao:
> From upstream kernel commit 3db2e9cd, strict_strto* serial functions
> are removed. So that we should directly used kstrtoul instead.
> 
> And add kni/compat.h for be compatible with older kernel.
> 
> Signed-off-by: Jincheng Miao <jmiao@redhat.com>
[...]
> new file mode 100644
> index 0000000..c8c662c
> --- /dev/null
> +++ b/lib/librte_eal/linuxapp/kni/compat.h
> @@ -0,0 +1,16 @@
> +/*
> + * Minimal wrappers to allow compiling kni on older kernels.
> + */
> +
> +#ifndef RHEL_RELEASE_VERSION
> +#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
> +#endif
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
> +        (!(defined(RHEL_RELEASE_CODE) && \
> +           RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))

The first indent character must be a tab (highlighted by checkpatch).

[...]
> --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
> @@ -740,7 +740,7 @@ set_sock_en(struct device *dev, struct device_attribute *attr,
>  	unsigned long en;
>  	int err = 0;
>  
> -	if (0 != strict_strtoul(buf, 0, &en))
> +	if (0 != kstrtoul(buf, 0, &en))
>  		return -EINVAL;
>  
>  	if (en)

It seems you forgot to include the new compat.h.

Did you do some tests with different Fedora/RHEL versions?

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 4/4] xen_dom0: replace strict_strtoul with kstrtoul
  2014-12-10  3:33 ` [dpdk-dev] [PATCH 4/4] xen_dom0: " Jincheng Miao
@ 2014-12-10  8:39   ` Thomas Monjalon
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Monjalon @ 2014-12-10  8:39 UTC (permalink / raw)
  To: Jincheng Miao; +Cc: dev

2014-12-10 11:33, Jincheng Miao:
> From upstream kernel commit 3db2e9cd, strict_strto* serial functions
> are removed. So that we should directly used kstrtoul instead.
> 
> And add xen_dom0/compat.h for be compatible with older kernel.
> 
> Signed-off-by: Jincheng Miao <jmiao@redhat.com>

Same comments as patch 3/4 apply here.

-- 
Thomas

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] kni: replace strict_strtoul with kstrtoul
  2014-12-10  8:39   ` Thomas Monjalon
@ 2014-12-10  8:48     ` Jincheng Miao
  2014-12-10  9:18       ` Thomas Monjalon
  0 siblings, 1 reply; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  8:48 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



----- Original Message -----
> Hi Jincheng,
> 
> 2014-12-10 11:33, Jincheng Miao:
> > From upstream kernel commit 3db2e9cd, strict_strto* serial functions
> > are removed. So that we should directly used kstrtoul instead.
> > 
> > And add kni/compat.h for be compatible with older kernel.
> > 
> > Signed-off-by: Jincheng Miao <jmiao@redhat.com>
> [...]
> > new file mode 100644
> > index 0000000..c8c662c
> > --- /dev/null
> > +++ b/lib/librte_eal/linuxapp/kni/compat.h
> > @@ -0,0 +1,16 @@
> > +/*
> > + * Minimal wrappers to allow compiling kni on older kernels.
> > + */
> > +
> > +#ifndef RHEL_RELEASE_VERSION
> > +#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
> > +#endif
> > +
> > +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
> > +        (!(defined(RHEL_RELEASE_CODE) && \
> > +           RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))
> 
> The first indent character must be a tab (highlighted by checkpatch).

Yes, I think the TAB is replaced by my vim :(

> 
> [...]
> > --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
> > +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
> > @@ -740,7 +740,7 @@ set_sock_en(struct device *dev, struct device_attribute
> > *attr,
> >  	unsigned long en;
> >  	int err = 0;
> >  
> > -	if (0 != strict_strtoul(buf, 0, &en))
> > +	if (0 != kstrtoul(buf, 0, &en))
> >  		return -EINVAL;
> >  
> >  	if (en)
> 
> It seems you forgot to include the new compat.h.
> 
> Did you do some tests with different Fedora/RHEL versions?

Yes, missing compat.h in kni_vhost.c.


And, I want to get your opinion about adding compat.h to kni and xen_dom0.
The pros: easy to implement and minimal wrapper for older kernel.
The cons: there is so many compat.h, and the file kcompat.h also makes user confuse.


> 
> Thanks
> --
> Thomas
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] kni: replace strict_strtoul with kstrtoul
  2014-12-10  8:48     ` Jincheng Miao
@ 2014-12-10  9:18       ` Thomas Monjalon
  2014-12-10  9:39         ` Jincheng Miao
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Monjalon @ 2014-12-10  9:18 UTC (permalink / raw)
  To: Jincheng Miao; +Cc: dev

2014-12-10 03:48, Jincheng Miao:
> > It seems you forgot to include the new compat.h.
> > 
> > Did you do some tests with different Fedora/RHEL versions?
> 
> Yes, missing compat.h in kni_vhost.c.
> 
> 
> And, I want to get your opinion about adding compat.h to kni and xen_dom0.
> The pros: easy to implement and minimal wrapper for older kernel.

Yes I think it's the good approach.

> The cons: there is so many compat.h, and the file kcompat.h also makes user confuse.

Why kcompat makes user confuse?

Do you think you could send a new version quickly to integrate it in the
next RC (probably today)?

Please test it with RHEL.

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH 3/4] kni: replace strict_strtoul with kstrtoul
  2014-12-10  9:18       ` Thomas Monjalon
@ 2014-12-10  9:39         ` Jincheng Miao
  0 siblings, 0 replies; 12+ messages in thread
From: Jincheng Miao @ 2014-12-10  9:39 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev



----- Original Message -----
> 2014-12-10 03:48, Jincheng Miao:
> > > It seems you forgot to include the new compat.h.
> > > 
> > > Did you do some tests with different Fedora/RHEL versions?
> > 
> > Yes, missing compat.h in kni_vhost.c.
> > 
> > 
> > And, I want to get your opinion about adding compat.h to kni and xen_dom0.
> > The pros: easy to implement and minimal wrapper for older kernel.
> 
> Yes I think it's the good approach.
> 
> > The cons: there is so many compat.h, and the file kcompat.h also makes user
> > confuse.
> 
> Why kcompat makes user confuse?

Because a lot of compat fallback in kcompat too.
For example, for kni, there is compat.h and kcompat.h.
I just confuse about it before.
But if you agree it, I will also agree it.

> 
> Do you think you could send a new version quickly to integrate it in the
> next RC (probably today)?
> 
> Please test it with RHEL.

Yes, I am working on it.

I will report my test result latter.

Jincheng Miao

> 
> Thanks
> --
> Thomas
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-12-10  9:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10  3:32 [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Jincheng Miao
2014-12-10  3:33 ` [dpdk-dev] [PATCH 1/4] igb_uio: compatible with upstream longterm kernel and RHEL Jincheng Miao
2014-12-10  3:33 ` [dpdk-dev] [PATCH 2/4] igb_uio: replace strict_strtoul with kstrtoul Jincheng Miao
2014-12-10  3:33 ` [dpdk-dev] [PATCH 3/4] kni: " Jincheng Miao
2014-12-10  8:39   ` Thomas Monjalon
2014-12-10  8:48     ` Jincheng Miao
2014-12-10  9:18       ` Thomas Monjalon
2014-12-10  9:39         ` Jincheng Miao
2014-12-10  3:33 ` [dpdk-dev] [PATCH 4/4] xen_dom0: " Jincheng Miao
2014-12-10  8:39   ` Thomas Monjalon
2014-12-10  3:58 ` [dpdk-dev] [PATCH 0/4] compatibility fallback and replacement of kernel function invoking Zhang, Helin
2014-12-10  4:15 ` Jincheng Miao

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git