Skip to contentSkip to conversation

igb_uio: kernel version check for using kstrtoul or strict_strtoul

PATCH In review Helin Zhang 3 participants 5 messages Dec 10, 2014 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb_uio: kernel version check for using kstrtoul or strict_strtoul

strict_strtoul() was just a redefinition of kstrtoul() for a long time. From kernel version of 3.18, strict_strtoul() will not be defined at all. A compile time kernel version check is needed to decide which function or macro can be used for a specific version of kernel.

---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +4 -0
index d1ca26e..2fcc5f4 100644
@@ -83,7 +83,11 @@ 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 LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
 	if (0 != strict_strtoul(buf, 0, &max_vfs))
+#else
+	if (0 != kstrtoul(buf, 0, &max_vfs))
+#endif
 		return -EINVAL;
 
 	if (0 == max_vfs)
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1418179099-4822-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

Here is my patch for it, and it also resolves issue of pci_num_vf() definition.

And I will send V3 for a while.

Quoted 27 lines · Helin Zhang

strict_strtoul() was just a redefinition of kstrtoul() for a long time. From kernel version of 3.18, strict_strtoul() will not be defined at all. A compile time kernel version check is needed to decide which function or macro can be used for a specific version of kernel.

---
  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +4 -0
index d1ca26e..2fcc5f4 100644
@@ -83,7 +83,11 @@ 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 LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
  	if (0 != strict_strtoul(buf, 0, &max_vfs))
+#else
+	if (0 != kstrtoul(buf, 0, &max_vfs))
+#endif
  		return -EINVAL;
 
  	if (0 == max_vfs)

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Jincheng

Did you attach anything? I can see the text only. Could you forward your patch mail to me directly? Thanks a lot!

Regards,
Helin

Quoted 41 lines

-----Original Message-----
From: Jincheng Miao [mailto:[email protected]]
Sent: Wednesday, December 10, 2014 10:55 AM
To: Zhang, Helin; [email protected]
Subject: Re: [dpdk-dev] [PATCH] igb_uio: kernel version check for using kstrtoul or strict_strtoul

Here is my patch for it, and it also resolves issue of pci_num_vf() definition.

And I will send V3 for a while.

lib/librte_eal/linuxapp/igb_uio/igb_uio.c store_max_vfs(struct device *dev, struct

Quoted 17 lines · Helin Zhang

strict_strtoul() was just a redefinition of kstrtoul() for a long time. From kernel version of 3.18, strict_strtoul() will not be defined at all. A compile time kernel version check is needed to decide which function or macro can be used for a specific version of kernel.

---
  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +0 -0
index d1ca26e..2fcc5f4 100644
@@ -83,7 +83,11 @@ store_max_vfs(struct device *dev, struct

device_attribute *attr,

Quoted 10 lines
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +3 -0
  	unsigned long max_vfs;
  	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
  	if (0 != strict_strtoul(buf, 0, &max_vfs))
+#else
+	if (0 != kstrtoul(buf, 0, &max_vfs)) #endif
  		return -EINVAL;
 
  	if (0 == max_vfs)
#5 lore raw
Quoted 4 lines · Helin

Hi Jincheng

Did you attach anything? I can see the text only. Could you forward your patch mail to me directly? Thanks a lot!

Hi Helin,

I indeed ever saw one patch that was similar this one :) but not sure if it is post by Jincheng.

You can go through patchwork to have a look.

Thanks,
Michael

Quoted 45 lines

Regards,
Helin

Quoted 41 lines

-----Original Message-----
From: Jincheng Miao [mailto:[email protected]]
Sent: Wednesday, December 10, 2014 10:55 AM
To: Zhang, Helin; [email protected]
Subject: Re: [dpdk-dev] [PATCH] igb_uio: kernel version check for using kstrtoul or strict_strtoul

Here is my patch for it, and it also resolves issue of pci_num_vf() definition.

And I will send V3 for a while.

lib/librte_eal/linuxapp/igb_uio/igb_uio.c store_max_vfs(struct device *dev, struct

Quoted 17 lines · Helin Zhang

strict_strtoul() was just a redefinition of kstrtoul() for a long time. From kernel version of 3.18, strict_strtoul() will not be defined at all. A compile time kernel version check is needed to decide which function or macro can be used for a specific version of kernel.

---
  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +0 -0
index d1ca26e..2fcc5f4 100644
@@ -83,7 +83,11 @@ store_max_vfs(struct device *dev, struct

device_attribute *attr,

Quoted 10 lines
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +3 -0
  	unsigned long max_vfs;
  	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
  	if (0 != strict_strtoul(buf, 0, &max_vfs))
+#else
+	if (0 != kstrtoul(buf, 0, &max_vfs)) #endif
  		return -EINVAL;
 
  	if (0 == max_vfs)
#6 lore raw
In reply to a message not in the archive

Hi Jincheng

I have seen your v3 patch, and ack-ed it. I just dropped my patch for the same issue. Thank you so much!

Regards,
Helin

Quoted 41 lines

-----Original Message-----
From: Jincheng Miao [mailto:[email protected]]
Sent: Wednesday, December 10, 2014 10:55 AM
To: Zhang, Helin; [email protected]
Subject: Re: [dpdk-dev] [PATCH] igb_uio: kernel version check for using kstrtoul or strict_strtoul

Here is my patch for it, and it also resolves issue of pci_num_vf() definition.

And I will send V3 for a while.

lib/librte_eal/linuxapp/igb_uio/igb_uio.c store_max_vfs(struct device *dev, struct

Quoted 17 lines · Helin Zhang

strict_strtoul() was just a redefinition of kstrtoul() for a long time. From kernel version of 3.18, strict_strtoul() will not be defined at all. A compile time kernel version check is needed to decide which function or macro can be used for a specific version of kernel.

---
  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +0 -0
index d1ca26e..2fcc5f4 100644
@@ -83,7 +83,11 @@ store_max_vfs(struct device *dev, struct

device_attribute *attr,

Quoted 10 lines
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +3 -0
  	unsigned long max_vfs;
  	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
  	if (0 != strict_strtoul(buf, 0, &max_vfs))
+#else
+	if (0 != kstrtoul(buf, 0, &max_vfs)) #endif
  		return -EINVAL;
 
  	if (0 == max_vfs)