From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 1C2CA137C for ; Tue, 29 Aug 2017 11:52:38 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170829095236euoutp01815397308d06dfa290283e80be9a2498~fSFsSOz1v2238022380euoutp01T; Tue, 29 Aug 2017 09:52:36 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170829095235eucas1p2a0e1f45cb52638a36c5d748a780e1734~fSFrfCI1s2270122701eucas1p28; Tue, 29 Aug 2017 09:52:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 42.97.12944.36935A95; Tue, 29 Aug 2017 10:52:35 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170829095235eucas1p1c53a2ad6ba980aad25d51dfb6c6b8dd7~fSFq5zAzj0711907119eucas1p1r; Tue, 29 Aug 2017 09:52:35 +0000 (GMT) X-AuditID: cbfec7f4-f79ab6d000003290-ac-59a539631782 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 99.6D.18832.36935A95; Tue, 29 Aug 2017 10:52:35 +0100 (BST) Received: from localhost.localdomain ([106.109.129.68]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OVF001QZY3D2T00@eusync3.samsung.com>; Tue, 29 Aug 2017 10:52:35 +0100 (BST) From: Vladimir Kuramshin To: tomasz.kantecki@intel.com Cc: dev@dpdk.org, Vladimir Kuramshin Date: Tue, 29 Aug 2017 12:51:53 +0300 Message-id: <20170829095153.12627-1-v.kuram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BfKMDNCAg3OAe7CSvl2CW8bCnX/ZCq6ZVNxvnM3YwLhds4uRg0NC wETi7FKZLkZOIFNM4sK99WxdjFwcQgJLGCXWLjjNBJIQEmhkkti4Ix7EZhMwkli1cT8biC0i ICuxasdUMJtZwE7i9sN5zCC2sIC7xOd9R8F6WQRUJS6teAYW5xWwkfgzv5sVYpm8xLkHt5kn MHIvYGRYxSiSWlqcm55bbKhXnJhbXJqXrpecn7uJERhe24793LyD8dLG4EOMAhyMSjy8DHZL IoVYE8uKK3MPMUpwMCuJ8FpYLI0U4k1JrKxKLcqPLyrNSS0+xGgKtHwis5Rocj4w9PNK4g1N DM0tDY2MLSzMjYyUxHnVLzdFCgmkJ5akZqemFqQWwfQxcXBKNTA6F1rvkxdnOXHod6D7jidr sjfVh8n4Jrl/5c25o3UgLdZ/ndqfLYeaGZIWHtJ5b7byXbT59H2zXI94ePImeCybZNjc+XD5 ryvnJ7up+z5TOfRrmv6Tne82/TixP43z2naX4+ZOH/Y+eeYxb1r9Gp83V5106/nPnghgOree 4/uRP/f/zeXz1ojsVWIpzkg01GIuKk4EAMghSitFAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170829095235eucas1p1c53a2ad6ba980aad25d51dfb6c6b8dd7 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?VmxhZGltaXIgS3VyYW1zaGluG1NSUi1WaXJ0dWFsaXphdGlv?= =?UTF-8?B?biBMYWIb7IK87ISx7KCE7J6QG0V4cGVydCBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?VmxhZGltaXIgS3VyYW1zaGluG1NSUi1WaXJ0dWFsaXphdGlv?= =?UTF-8?B?biBMYWIbU2Ftc3VuZyBFbGVjdHJvbmljcxtFeHBlcnQgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20170829095235eucas1p1c53a2ad6ba980aad25d51dfb6c6b8dd7 X-RootMTR: 20170829095235eucas1p1c53a2ad6ba980aad25d51dfb6c6b8dd7 References: Subject: [dpdk-dev] [PATCH] examples/l2fwd-cat: fix build according to API changes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Aug 2017 09:52:38 -0000 Current version is compatible with PQOS version 1.3 but not compatible with higher versions. This change makes l2fwd-cat example compatible with versions since 1.4 Signed-off-by: Vladimir Kuramshin --- examples/l2fwd-cat/Makefile | 5 +--- examples/l2fwd-cat/cat.c | 60 ++++++++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile index ae921ade6..a7fe6d68e 100644 --- a/examples/l2fwd-cat/Makefile +++ b/examples/l2fwd-cat/Makefile @@ -40,9 +40,6 @@ endif # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc -# Location of PQoS library and includes, -PQOS_LIBRARY_PATH = $(PQOS_INSTALL_PATH)/libpqos.a - include $(RTE_SDK)/mk/rte.vars.mk # binary name @@ -65,6 +62,6 @@ CFLAGS += -I$(PQOS_INSTALL_PATH)/../include CFLAGS_cat.o := -D_GNU_SOURCE LDLIBS += -L$(PQOS_INSTALL_PATH) -LDLIBS += $(PQOS_LIBRARY_PATH) +LDLIBS += -lpqos include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/l2fwd-cat/cat.c b/examples/l2fwd-cat/cat.c index 6133bf5bb..4a0a22319 100644 --- a/examples/l2fwd-cat/cat.c +++ b/examples/l2fwd-cat/cat.c @@ -53,7 +53,7 @@ static const struct pqos_cap *m_cap; static const struct pqos_cpuinfo *m_cpu; static const struct pqos_capability *m_cap_l3ca; -static unsigned m_sockets[PQOS_MAX_SOCKETS]; +static unsigned *m_sockets; static unsigned m_sock_count; static struct cat_config m_config[PQOS_MAX_CORES]; static unsigned m_config_count; @@ -271,16 +271,16 @@ parse_l3ca(const char *l3ca) /* scan the separator '@', ','(next) or '\0'(finish) */ l3ca += strcspn(l3ca, "@,"); - if (*l3ca == '@') { - /* explicit assign cpu_set */ - offset = parse_set(l3ca + 1, &cpuset); - if (offset < 0 || CPU_COUNT(&cpuset) == 0) - goto err; + if (*l3ca != '@') + goto err; - end = l3ca + 1 + offset; - } else + /* explicit assign cpu_set */ + offset = parse_set(l3ca + 1, &cpuset); + if (offset < 0 || CPU_COUNT(&cpuset) == 0) goto err; + end = l3ca + 1 + offset; + if (*end != ',' && *end != '\0') goto err; @@ -353,9 +353,6 @@ parse_l3ca(const char *l3ca) idx++; } while (*end != '\0' && idx < PQOS_MAX_CORES); - if (m_config_count == 0) - goto err; - return 0; err: @@ -408,7 +405,7 @@ check_cpus(void) goto exit; } - ret = pqos_l3ca_assoc_get(cpu_id, &cos_id); + ret = pqos_alloc_assoc_get(cpu_id, &cos_id); if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to read COS " "associated to cpu %u.\n", @@ -512,7 +509,7 @@ check_and_select_classes(unsigned cos_id_map[][PQOS_MAX_SOCKETS]) for (j = 0; j < m_cpu->num_cores; j++) { cpu_id = m_cpu->cores[j].lcore; - ret = pqos_l3ca_assoc_get(cpu_id, &cos_id); + ret = pqos_alloc_assoc_get(cpu_id, &cos_id); if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to read COS associated to " "cpu %u on phy_pkg %u.\n", cpu_id, phy_pkg_id); @@ -598,10 +595,10 @@ configure_cat(unsigned cos_id_map[][PQOS_MAX_SOCKETS]) l3ca.cdp = m_config[i].cdp; if (m_config[i].cdp == 1) { - l3ca.code_mask = m_config[i].code_mask; - l3ca.data_mask = m_config[i].data_mask; + l3ca.u.s.code_mask = m_config[i].code_mask; + l3ca.u.s.data_mask = m_config[i].data_mask; } else - l3ca.ways_mask = m_config[i].mask; + l3ca.u.ways_mask = m_config[i].mask; for (j = 0; j < m_sock_count; j++) { phy_pkg_id = m_sockets[j]; @@ -637,7 +634,7 @@ configure_cat(unsigned cos_id_map[][PQOS_MAX_SOCKETS]) cos_id = cos_id_map[i][phy_pkg_id]; - ret = pqos_l3ca_assoc_set(cpu_id, cos_id); + ret = pqos_alloc_assoc_set(cpu_id, cos_id); if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to associate COS %u to " "cpu %u\n", cos_id, cpu_id); @@ -754,24 +751,24 @@ print_cat_config(void) if (tab[n].cdp == 1) { printf("PQOS: COS: %u, cMASK: 0x%llx, " "dMASK: 0x%llx\n", tab[n].class_id, - (unsigned long long)tab[n].code_mask, - (unsigned long long)tab[n].data_mask); + (unsigned long long)tab[n].u.s.code_mask, + (unsigned long long)tab[n].u.s.data_mask); } else { printf("PQOS: COS: %u, MASK: 0x%llx\n", tab[n].class_id, - (unsigned long long)tab[n].ways_mask); + (unsigned long long)tab[n].u.ways_mask); } } } for (i = 0; i < m_sock_count; i++) { - unsigned lcores[PQOS_MAX_SOCKET_CORES] = {0}; + unsigned *lcores = NULL; unsigned lcount = 0; unsigned n = 0; - ret = pqos_cpu_get_cores(m_cpu, m_sockets[i], - PQOS_MAX_SOCKET_CORES, &lcount, &lcores[0]); - if (ret != PQOS_RETVAL_OK) { + lcores = pqos_cpu_get_cores(m_cpu, m_sockets[i], + &lcount); + if (lcores == NULL || lcount == 0) { printf("PQOS: Error retrieving core information!\n"); return; } @@ -780,13 +777,15 @@ print_cat_config(void) for (n = 0; n < lcount; n++) { unsigned class_id = 0; - ret = pqos_l3ca_assoc_get(lcores[n], &class_id); + ret = pqos_alloc_assoc_get(lcores[n], &class_id); if (ret == PQOS_RETVAL_OK) printf("PQOS: CPU: %u, COS: %u\n", lcores[n], class_id); else printf("PQOS: CPU: %u, ERROR\n", lcores[n]); } + + free(lcores); } } @@ -849,7 +848,8 @@ cat_fini(void) m_cap = NULL; m_cpu = NULL; m_cap_l3ca = NULL; - memset(m_sockets, 0, sizeof(m_sockets)); + if (m_sockets != NULL) + free(m_sockets); m_sock_count = 0; memset(m_config, 0, sizeof(m_config)); m_config_count = 0; @@ -875,7 +875,7 @@ cat_exit(void) if (CPU_ISSET(cpu_id, &m_config[i].cpumask) == 0) continue; - ret = pqos_l3ca_assoc_set(cpu_id, 0); + ret = pqos_alloc_assoc_set(cpu_id, 0); if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to associate COS 0 to " "cpu %u\n", cpu_id); @@ -927,7 +927,6 @@ cat_init(int argc, char **argv) /* PQoS Initialization - Check and initialize CAT capability */ cfg.fd_log = STDOUT_FILENO; cfg.verbose = 0; - cfg.cdp_cfg = PQOS_REQUIRE_CDP_ANY; ret = pqos_init(&cfg); if (ret != PQOS_RETVAL_OK) { printf("PQOS: Error initializing PQoS library!\n"); @@ -953,9 +952,8 @@ cat_init(int argc, char **argv) } /* Get CPU socket information */ - ret = pqos_cpu_get_sockets(m_cpu, PQOS_MAX_SOCKETS, &m_sock_count, - m_sockets); - if (ret != PQOS_RETVAL_OK) { + m_sockets = pqos_cpu_get_sockets(m_cpu, &m_sock_count); + if (m_sockets == NULL) { printf("PQOS: Error retrieving CPU socket information!\n"); ret = -EFAULT; goto err; -- 2.14.1