Skip to contentSkip to conversation

enic: corrected the usage of VFIO_PRESENT

PATCH In review Sujith Sankar 4 participants 10 messages Dec 12, 2014 – Dec 16, 2014 7 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enic: corrected the usage of VFIO_PRESENT

This patch corrects the usage of the flag VFIO_PRESENT in enic driver. This has uncovered a few warnings, and this patch corrects those too.

---
 lib/librte_pmd_enic/Makefile    |  1 +
 lib/librte_pmd_enic/enic.h      |  1 +
 lib/librte_pmd_enic/enic_main.c | 12 ++++++++----
 3 files changed, 10 insertions(+), 4 deletions(-)
lib/librte_pmd_enic/Makefile +1 -0
index a2a623f..3271960 100644
@@ -39,6 +39,7 @@ LIB = librte_pmd_enic.a
 
 CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/vnic/
 CFLAGS += -I$(RTE_SDK)/lib/librte_pmd_enic/
+CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal/
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
 
lib/librte_pmd_enic/enic.h +1 -0
index c43417c..c692bab 100644
@@ -182,6 +182,7 @@ extern void enic_dev_stats_get(struct enic *enic,
 	struct rte_eth_stats *r_stats);
 extern void enic_dev_stats_clear(struct enic *enic);
 extern void enic_add_packet_filter(struct enic *enic);
+extern void *enic_err_intr_handler(void *arg);
 extern void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
 extern void enic_del_mac_address(struct enic *enic);
 extern unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
lib/librte_pmd_enic/enic_main.c +8 -4
index e4f43c5..469cb6c 100644
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>
 
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 	void *arg)
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif
 
 int enic_enable(struct enic *enic)
 {
@@ -978,12 +982,13 @@ static void enic_eventfd_init(struct enic *enic)
 void *enic_err_intr_handler(void *arg)
 {
 	struct enic *enic = (struct enic *)arg;
-	unsigned int intr = enic_msix_err_intr(enic);
-	ssize_t size;
 	uint64_t data;
 
 	while (1) {
-		size = read(enic->eventfd, &data, sizeof(data));
+		if (-1 == read(enic->eventfd, &data, sizeof(data))) {
+			dev_err(enic, "eventfd read failed with error %d\n", errno);
+			continue;
+		}
 		dev_err(enic, "Err intr.\n");
 		vnic_intr_return_all_credits(&enic->intr);
 
@@ -1035,7 +1040,6 @@ static int enic_set_intr_mode(struct enic *enic)
 	int *fds;
 	int size;
 	int ret = -1;
-	int index;
 
 	if (enic->intr_count < 1) {
 		dev_err(enic, "Unsupported resource conf.\n");
Signature · 1 line
1.9.1
#2 lore raw
In reply to a message not in the archive

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic driver.

Please, could you explain why the flag VFIO_PRESENT was not well used?

Quoted 1 line

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 11 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
 #include <rte_pci.h>
 #include <rte_memzone.h>

lib/librte_pmd_enic/enic_main.c line 50

Quoted 4 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 15 lines
lib/librte_pmd_enic/enic_main.c +2 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 	void *arg)
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif
Signature · 1 line
Thomas
#3 lore raw
Quoted 4 lines · Thomas Monjalon

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic driver.

Please, could you explain why the flag VFIO_PRESENT was not well used?

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors were generated during run-time.

Quoted 11 lines
Quoted 2 lines

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 10 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Thanks,
-Sujith

Quoted 21 lines
Quoted 18 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +1 -0
 	void *arg)
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif
Signature · 1 line
Thomas
#4 lore raw
Quoted 28 lines · Sujith Sankar (ssujith)
Quoted 3 lines · Thomas Monjalon

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic driver.

Please, could you explain why the flag VFIO_PRESENT was not well used?

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors were generated during run-time.

Quoted 10 lines
Quoted 1 line

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 9 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 2 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

You can remove VFIO_PRESENT check, it all been done in eal, you can check other nic pmds for reference.
And seems you done the interrupt logic all by your self?

Thanks,
Michael

Quoted 24 lines

Thanks,
-Sujith

Quoted 19 lines
Quoted 17 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +1 -0
 	void *arg)
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif
Signature · 1 line
Thomas
#6 lore raw
In reply to a message not in the archive
Quoted 34 lines · Michael
Quoted 30 lines · Sujith Sankar (ssujith)
Quoted 3 lines · Thomas Monjalon

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic driver.

Please, could you explain why the flag VFIO_PRESENT was not well used?

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors
were generated during run-time.

Quoted 10 lines
Quoted 1 line

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 9 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 2 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Quoted 6 lines

You can remove VFIO_PRESENT check, it all been done in eal, you can check other nic pmds for reference.
And seems you done the interrupt logic all by your self?

Thanks,
Michael

Thanks for the comment, Michael.

Without the code under VFIO_PRESENT flag, I was getting false notification of interrupt at the beginning (cat /proc/interrupts showed all 0s). Let me try to root cause it. I shall get back after some debugging and testing.

There was one more reason behind doing interrupt logic in enic. No matter how many interrupts the user configures, enic pmd needs only one. There is no way to communicate that to the EAL. I thought doing interrupt login in enic could avoid registering that many interrupts.

Thanks,
-Sujith

Quoted 25 lines
Quoted 24 lines

Thanks,
-Sujith

Quoted 19 lines
Quoted 17 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +1 -0
 	void *arg)
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif
Signature · 1 line
Thomas
#8 lore raw
In reply to a message not in the archive

2014-12-16 10:00, Sujith Sankar:

Quoted 50 lines · Michael
Quoted 35 lines · Sujith Sankar (ssujith)
Quoted 31 lines · Thomas Monjalon
Quoted 4 lines

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic driver.

Please, could you explain why the flag VFIO_PRESENT was not well used?

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors were generated during run-time.

Quoted 10 lines
Quoted 1 line

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 10 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 2 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Quoted 6 lines

You can remove VFIO_PRESENT check, it all been done in eal, you can check other nic pmds for reference.
And seems you done the interrupt logic all by your self?

Thanks,
Michael

Thanks for the comment, Michael.

Without the code under VFIO_PRESENT flag, I was getting false notification of interrupt at the beginning (cat /proc/interrupts showed all 0s). Let me try to root cause it. I shall get back after some debugging and testing.

Quoted 4 lines

There was one more reason behind doing interrupt logic in enic. No matter how many interrupts the user configures, enic pmd needs only one. There is no way to communicate that to the EAL. I thought doing interrupt login in enic could avoid registering that many interrupts.

If you think something is wrong or could be improved in EAL, it's really better to patch it instead of workarounding in the PMD.

Thanks

Signature · 1 line
Thomas
#10 lore raw
In reply to a message not in the archive
Quoted 34 lines
Quoted 4 lines · Thomas Monjalon

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic driver.

Please, could you explain why the flag VFIO_PRESENT was not well used?

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors were generated during run-time.

Quoted 11 lines
Quoted 2 lines

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 10 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 27 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Thanks,
-Sujith

Quoted 21 lines
Quoted 13 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +0 -0
 	void *arg)

lib/librte_pmd_enic/enic_main.c enic_intr_handler(__rte_unused struct · line 579

Quoted 5 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif

--
Thomas

Hi Sujith

Thomas is correct, VFIO code is designed to be EAL-only (mainly because it's Linuxapp-specific, and PMD's are intended to be cross-platform at least when it comes to compilation). Whatever it is that you're working around is better fixed in the EAL itself rather than in the PMD.

Thanks,
Anatoly

#12 lore raw
In reply to a message not in the archive
Quoted 64 lines · Anatoly
Quoted 36 lines
Quoted 2 lines · Thomas Monjalon

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic

driver.

Quoted 2 lines

Please, could you explain why the flag VFIO_PRESENT was not well used?

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors
were generated during run-time.

Quoted 11 lines
Quoted 2 lines

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 10 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 27 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Thanks,
-Sujith

Quoted 21 lines
Quoted 13 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +0 -0
 	void *arg)

lib/librte_pmd_enic/enic_main.c enic_intr_handler(__rte_unused struct · line 579

Quoted 5 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif

--
Thomas

Quoted 6 lines

Hi Sujith

Thomas is correct, VFIO code is designed to be EAL-only (mainly because it's Linuxapp-specific, and PMD's are intended to be cross-platform at least when it comes to compilation). Whatever it is that you're working around is better fixed in the EAL itself rather than in the PMD.

I agree with you and Thomas. Let me find the root cause for the false trigger.

Thanks,
-Sujith

Quoted 3 lines

Thanks,
Anatoly

#14 lore raw
In reply to a message not in the archive
Quoted 84 lines

-----Original Message-----
From: Sujith Sankar (ssujith) [mailto:[email protected]]
Sent: Tuesday, December 16, 2014 10:34 AM
To: Burakov, Anatoly; Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] enic: corrected the usage of VFIO_PRESENT

Quoted 1 line · Anatoly
Quoted 1 line

On 16/12/14 4:54 am, "Thomas Monjalon"

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines · wrote:

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic

driver.

Quoted 2 lines

Please, could you explain why the flag VFIO_PRESENT was not well

used?

Quoted 55 lines
Quoted 27 lines

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors were generated during run-time.

Quoted 11 lines
Quoted 2 lines

This has uncovered a few warnings, and this patch corrects those too.

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 10 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 27 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Thanks,
-Sujith

Quoted 21 lines
Quoted 13 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +0 -0
 	void *arg)

lib/librte_pmd_enic/enic_main.c enic_intr_handler(__rte_unused struct · line 579

Quoted 5 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif

--
Thomas

Quoted 6 lines

Hi Sujith

Thomas is correct, VFIO code is designed to be EAL-only (mainly because it's Linuxapp-specific, and PMD's are intended to be cross-platform at least when it comes to compilation). Whatever it is that you're working around is better fixed in the EAL itself rather than in the PMD.

Quoted 5 lines

I agree with you and Thomas. Let me find the root cause for the false trigger.

Thanks,
-Sujith

You may find it in EAL VFIO interrupts code. When VFIO enables some interrupt types, it manually sends a trigger. Normally, this "trigger" just enables interrupts, but maybe for ENIC it's different. I therefore suggest you to look there first.

Thanks,
Anatoly

#16 lore raw
In reply to a message not in the archive
Quoted 89 lines · Anatoly
Quoted 89 lines

-----Original Message-----
From: Sujith Sankar (ssujith) [mailto:[email protected]]
Sent: Tuesday, December 16, 2014 10:34 AM
To: Burakov, Anatoly; Thomas Monjalon
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] enic: corrected the usage of VFIO_PRESENT

Quoted 1 line · Anatoly
Quoted 1 line

On 16/12/14 4:54 am, "Thomas Monjalon"

<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines · wrote:

2014-12-12 13:48, Sujith Sankar:

Quoted 1 line

This patch corrects the usage of the flag VFIO_PRESENT in enic

driver.

Quoted 2 lines

Please, could you explain why the flag VFIO_PRESENT was not well

used?

Quoted 7 lines
Quoted 7 lines

Without including eal_vfio.h, VFIO_PRESENT is not available in enic. Hence VFIO specific code in enic was not getting compiled and some errors were generated during run-time.

Quoted 2 lines
Quoted 2 lines

This has uncovered a few warnings, and this patch corrects those

too.

Quoted 48 lines
Quoted 20 lines
Quoted 9 lines

[...]

Quoted 8 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -39,6 +39,7 @@
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <libgen.h>
+#include <sys/ioctl.h>
 
Quoted 10 lines

lib/librte_pmd_enic/enic_main.c line 50

Quoted 7 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include <rte_pci.h>
 #include <rte_memzone.h>
@@ -46,6 +47,7 @@
 #include <rte_mbuf.h>
 #include <rte_string_fns.h>
 #include <rte_ethdev.h>
+#include <eal_vfio.h>

This header was not designed to be included by PMDs. It will break compilation on BSD.

Quoted 27 lines

Is there an alternative to make VFIO_PRESENT available in enic? Please advise.

Thanks,
-Sujith

Quoted 21 lines
Quoted 13 lines
lib/librte_pmd_enic/enic_main.c +1 -0
 #include "enic_compat.h"
 #include "enic.h"
@@ -561,6 +563,7 @@ enic_free_consistent(__rte_unused struct
 rte_pci_device *hwdev,
 	/* Nothing to be done */
 }
 
+#ifndef VFIO_PRESENT
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
lib/librte_pmd_enic/enic_main.c +0 -0
 	void *arg)

lib/librte_pmd_enic/enic_main.c enic_intr_handler(__rte_unused struct · line 579

Quoted 5 lines
lib/librte_pmd_enic/enic_main.c +1 -0
@@ -572,6 +575,7 @@ enic_intr_handler(__rte_unused struct
 rte_intr_handle *handle,
 
 	enic_log_q_error(enic);
 }
+#endif

--
Thomas

Quoted 6 lines

Hi Sujith

Thomas is correct, VFIO code is designed to be EAL-only (mainly because it's Linuxapp-specific, and PMD's are intended to be cross-platform at least when it comes to compilation). Whatever it is that you're working around is better fixed in the EAL itself rather than in the PMD.

I agree with you and Thomas. Let me find the root cause for the false trigger.

Quoted 8 lines
Quoted 3 lines

Thanks,
-Sujith

You may find it in EAL VFIO interrupts code. When VFIO enables some interrupt types, it manually sends a trigger. Normally, this "trigger" just enables interrupts, but maybe for ENIC it's different. I therefore suggest you to look there first.

Ok. Thanks for the info, Anatoly.
ENIC does not need that trigger. Let me take a look at that first.

Thanks,
-Sujith

Quoted 3 lines

Thanks,
Anatoly