[dpdk-dev] [PATCH] examples/vm_power_manager: remove dependency on internal header file

2016-07-04 Thread Marvin Liu
Macro CHANNEL_CMDS_MAX_CPUS stand for the maximum number of cores
controlled by virtual channels. This macro only be used in the example,
so remove it from library to example header file.

Signed-off-by: Marvin Liu 

diff --git a/examples/vm_power_manager/channel_manager.h 
b/examples/vm_power_manager/channel_manager.h
index 67e26ec..47c3b9c 100644
--- a/examples/vm_power_manager/channel_manager.h
+++ b/examples/vm_power_manager/channel_manager.h
@@ -41,7 +41,13 @@ extern "C" {
 #include 
 #include 
 #include 
-#include "channel_commands.h"
+
+/* Maximum number of CPUs */
+#define CHANNEL_CMDS_MAX_CPUS64
+#if CHANNEL_CMDS_MAX_CPUS > 64
+#error Maximum number of cores is 64, overflow is guaranteed to \
+cause problems with VM Power Management
+#endif

 /* Maximum name length including '\0' terminator */
 #define CHANNEL_MGR_MAX_NAME_LEN64
diff --git a/lib/librte_power/channel_commands.h 
b/lib/librte_power/channel_commands.h
index de6d926..383897b 100644
--- a/lib/librte_power/channel_commands.h
+++ b/lib/librte_power/channel_commands.h
@@ -40,13 +40,6 @@ extern "C" {

 #include 

-/* Maximum number of CPUs */
-#define CHANNEL_CMDS_MAX_CPUS64
-#if CHANNEL_CMDS_MAX_CPUS > 64
-#error Maximum number of cores is 64, overflow is guaranteed to \
-   cause problems with VM Power Management
-#endif
-
 /* Maximum number of channels per VM */
 #define CHANNEL_CMDS_MAX_VM_CHANNELS 64

-- 
1.9.3



[dpdk-dev] [PATCH v3] examples/vm_power_manager: fix build with libvirt version < 0.9.3

2016-04-11 Thread Marvin Liu
vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo for
retrieve domU vcpu information. This API implemented from version 0.9.3.
Suse11 SP3 32bit default libvirt version is 0.8.8, so there'll be build
error. Add judgement in sample Makefile to alarm unsupport environment.

examples/vm_power_manager/channel_manager.c: In function
?update_pcpus_mask?:
channel_manager.c:117:3: error: implicit declaration of function
?virDomainGetVcpuPinInfo?

Fixes: 8db653ff7889 ("vm power management application")

Signed-off-by: Marvin Liu 

diff --git a/examples/Makefile b/examples/Makefile
index a8bc381..027ee57 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -87,6 +87,10 @@ DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += vhost
 DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen
 DIRS-y += vmdq
 DIRS-y += vmdq_dcb
+ifeq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager
+else
+$(warning "vm_power_manager requires libvirt version >= 0.9.3")
+endif

 include $(RTE_SDK)/mk/rte.extsubdir.mk
-- 
1.9.3



[dpdk-dev] [PATCH v2] examples/vm_power_manager: fix build with libvirt version < 0.9.3

2016-04-11 Thread Marvin Liu
vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo for
retrieve domU vcpu information. This API implemented from version 0.9.3.
Suse11 SP3 32bit default libvirt version is 0.8.8, so there'll be build
error. Add judgement in sample Makefile to skip unsupport environment.

examples/vm_power_manager/channel_manager.c: In function
?update_pcpus_mask?:
channel_manager.c:117:3: error: implicit declaration of function
?virDomainGetVcpuPinInfo?

Fixes: 2e099bc5d104 ("fix split of compiler and linker options")

Signed-off-by: Marvin Liu 

diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..08e301f 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -36,6 +36,9 @@ endif
 # Default target, can be overridden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc

+# check libvirt version >= 0.9.3
+ifeq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
+
 include $(RTE_SDK)/mk/rte.vars.mk

 # binary name
@@ -57,3 +60,10 @@ CFLAGS_main.o += -Wno-return-type
 endif

 include $(RTE_SDK)/mk/rte.extapp.mk
+
+else
+.PHONY: all clean
+all:
+$(info "vm_power_manager required libvirt version >= 0.9.3, please update 
libvirt-devel first")
+clean:
+endif
-- 
1.9.3



[dpdk-dev] [PATCH] examples/vm_power_manager: fix build with libvirt version < 0.9.3

2016-04-11 Thread Marvin Liu
vm_power_manager utilize libvirt API virDomainGetVcpuPinInfo for
retrieve domU vcpu information. This API implemented from version 0.9.3.
Suse11 SP3 32bit default libvirt version is 0.8.8, so there'll be build
error. Add judgement in sample Makefile to skip unsupport environment.

examples/vm_power_manager/channel_manager.c: In function
?update_pcpus_mask?:
channel_manager.c:117:3: error: implicit declaration of function
?virDomainGetVcpuPinInfo?

Fixes: 2e099bc5d104 ("fix split of compiler and linker options")

Signed-off-by: Marvin Liu 

diff --git a/examples/vm_power_manager/Makefile 
b/examples/vm_power_manager/Makefile
index 113dbc4..49a6b9b 100644
--- a/examples/vm_power_manager/Makefile
+++ b/examples/vm_power_manager/Makefile
@@ -33,9 +33,19 @@ ifeq ($(RTE_SDK),)
 $(error "Please define RTE_SDK environment variable")
 endif

+LIBVIRT_COMMON = libvirt-common.h
+LIBVIRT_HEADER = libvirt.h
+INCLUDE_PATH = /usr/include/libvirt/
+
+HEADER_FILE = $(shell if [ -f $(INCLUDE_PATH)$(LIBVIRT_COMMON) ]; then echo 
$(LIBVIRT_COMMON);else echo $(LIBVIRT_HEADER); fi;)
+LIBVIRT_INCLUDE = $(INCLUDE_PATH)$(HEADER_FILE)
+
+LIBVIR_VER = $(shell gawk '/LIBVIR_VERSION_NUMBER .*/{print $$3}' 
$(LIBVIRT_INCLUDE))
+
 # Default target, can be overridden by command line or environment
 RTE_TARGET ?= x86_64-native-linuxapp-gcc

+ifeq ($(shell test $(LIBVIR_VER) -ge 9003 && echo 1), 1)
 include $(RTE_SDK)/mk/rte.vars.mk

 # binary name
@@ -57,3 +67,10 @@ CFLAGS_main.o += -Wno-return-type
 endif

 include $(RTE_SDK)/mk/rte.extapp.mk
+
+else
+.PHONY: all clean
+all:
+$(warning "vm_power_manager required libvirt version >= 0.9.3, please update 
libvirt-devel first")
+clean:
+endif
-- 
1.9.3



[dpdk-dev] [PATCH v2] testpmd: fix build on FreeBSD

2016-03-22 Thread Marvin Liu
Build log:
/root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
's6_addr32' in 'struct in6_addr'
rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);

This is caused by macro "s6_addr32" not defined on FreeBSD and testpmd
swap big endian parameter to host endian. Move the swap action to i40e
ethdev will fix this issue.

Fixes: 7b1312891b69 ("ethdev: add IP in GRE tunnel")

Signed-off-by: Marvin Liu 

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9d52b8c..4f3d1e4 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6678,14 +6678,12 @@ cmd_tunnel_filter_parsed(void *parsed_result,

if (res->ip_value.family == AF_INET) {
tunnel_filter_conf.ip_addr.ipv4_addr =
-   rte_be_to_cpu_32(res->ip_value.addr.ipv4.s_addr);
+   res->ip_value.addr.ipv4.s_addr;
tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV4;
} else {
-   int i;
-   for (i = 0; i < 4; i++) {
-   tunnel_filter_conf.ip_addr.ipv6_addr[i] =
-   rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
-   }
+   memcpy(&(tunnel_filter_conf.ip_addr.ipv6_addr),
+   &(res->ip_value.addr.ipv6),
+   sizeof(struct in6_addr));
tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
}

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 10e0d38..43c2d5c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -6015,6 +6015,7 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
uint8_t add)
 {
uint16_t ip_type;
+   uint32_t ipv4_addr;
uint8_t i, tun_type = 0;
/* internal varialbe to convert ipv6 byte order */
uint32_t convert_ipv6[4];
@@ -6040,14 +6041,15 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
pfilter->inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan);
if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) {
ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4;
+   ipv4_addr = rte_be_to_cpu_32(tunnel_filter->ip_addr.ipv4_addr);
rte_memcpy(>ipaddr.v4.data,
-   
_cpu_to_le_32(tunnel_filter->ip_addr.ipv4_addr),
+   _cpu_to_le_32(ipv4_addr),
sizeof(pfilter->ipaddr.v4.data));
} else {
ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6;
for (i = 0; i < 4; i++) {
convert_ipv6[i] =
-   rte_cpu_to_le_32(tunnel_filter->ip_addr.ipv6_addr[i]);
+   
rte_cpu_to_le_32(rte_be_to_cpu_32(tunnel_filter->ip_addr.ipv6_addr[i]));
}
rte_memcpy(>ipaddr.v6.data, _ipv6,
sizeof(pfilter->ipaddr.v6.data));
-- 
1.9.3



[dpdk-dev] [PATCH] testpmd: fix build on FreeBSD

2016-03-21 Thread Marvin Liu
Build log:
/root/dpdk/app/test-pmd/cmdline.c:6687:45: error: no member named
's6_addr32' in 'struct in6_addr'
rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);

This is caused by macro "s6_addr32" not defined on FreeBSD.

Signed-off-by: Marvin Liu 

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 9d52b8c..51ad23b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6684,7 +6684,11 @@ cmd_tunnel_filter_parsed(void *parsed_result,
int i;
for (i = 0; i < 4; i++) {
tunnel_filter_conf.ip_addr.ipv6_addr[i] =
+#ifdef RTE_EXEC_ENV_BSDAPP
+   
rte_be_to_cpu_32(res->ip_value.addr.ipv6.__u6_addr.__u6_addr32[i]);
+#else
rte_be_to_cpu_32(res->ip_value.addr.ipv6.s6_addr32[i]);
+#endif
}
tunnel_filter_conf.ip_type = RTE_TUNNEL_IPTYPE_IPV6;
}
-- 
1.9.3



[dpdk-dev] [PATCH] fix bug can not build example application for missing link library

2014-12-17 Thread Marvin Liu
From: Yong Liu <yong@intel.com>

main.o: In function `rte_pktmbuf_free':
main.c:(.text+0x9c): undefined reference to `per_lcore__lcore_id'

Signed-off-by: Marvin liu 
---
 mk/rte.app.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 5fc3118..b51d814 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -61,7 +61,7 @@ ifeq ($(NO_AUTOLIBS),)

 LDLIBS += --whole-archive

-ifeq ($(RTE_BUILD_COMBINE_LIBS),n)
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

 ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
 LDLIBS += -lrte_distributor
@@ -129,7 +129,7 @@ endif

 LDLIBS += --start-group

-ifeq ($(RTE_BUILD_COMBINE_LIBS),n)
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)

 ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
 LDLIBS += -lrte_kvargs
@@ -251,7 +251,7 @@ build: _postbuild

 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1

-ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
 LDLIBS += -l$(RTE_LIBNAME)
 endif

-- 
1.9.3