From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 2EE801B287 for ; Mon, 30 Oct 2017 16:38:25 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id b189so16649019wmd.4 for ; Mon, 30 Oct 2017 08:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A0Q9+hyI9ep33nobEZhzfzwb6t9rcNcrSU8usaNS43Y=; b=aM1YNimFvipa2erVd/ywUMytB8628ZSxiLvizMYUKtoFJHOUAlL52ZEzyTpQ+9YOm7 nWASoh6FB7oOUgcRjGus0iM+4HWUy9sPM/gu5A0b5ej10qQjKWAZU4Z3m9xG7shHOUIn 30u/RUyR/+M3+KVYoWyq+MA+fwX6QmCUEiGOUfSmVycyeTOl/1kwetvu9PDcSuACl71p DqXCy6oFozw88eayg+2ZDJM3YFSPJv2tsFZa2sc555gWZ/Jl24SLcGHsjGmOSTdHjE9o u+qRDXCQT+iNs8TlyarOEh//fdD1GWejeFPYpCO4ZSbeBdGn1oP2/pr0K0Vo+Ls468po Ijzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A0Q9+hyI9ep33nobEZhzfzwb6t9rcNcrSU8usaNS43Y=; b=G8yflhmuJAP3mSdTZFB20PQwb0NKUxp48D94/2QTB0Kd6Uw3SpKDBBBDpKjbFW1SrG VtmZJggoni+vRDtpyoaWqBvf//QdJwHLOfP6aTATfi9biHWHigYBqSFasgHJg9hl7N9x kH8kWNBcRE3/56JAomvPrxMsXp3P+ssI7BqTgTDLtBcUHUXyuKft1/3XQE+A814VCePX 53fujPWfY7UbWhL+1dSONJxs22m8tZb9QiqO8Ohxs6upBAtu4OPXKm/n0p1pkuY4M8Wz HS3ghniBdeANAJ1Bt1ztlVcCCHBlfJRa9+rxiWwd71vHB2N1+jBfgI1dI81LchPdcwSy vmHg== X-Gm-Message-State: AMCzsaVwpY73wAFY+L0hWmY8ZpmstwKra7p8zSoWhaTtJsZwmQ9V2qeH NN21Ef4gYWq8xD9lljd8S9g= X-Google-Smtp-Source: ABhQp+T5EVvpMOghj5YwhSx+l7NM2D30kl0yur4s6Ko6ppFENtr5x0nnwoYXKaAqCcR4PltMHxyw1A== X-Received: by 10.28.84.89 with SMTP id p25mr3747424wmi.112.1509377904781; Mon, 30 Oct 2017 08:38:24 -0700 (PDT) Received: from localhost ([2a00:23c5:bef3:400:4a51:b7ff:fe0b:4749]) by smtp.gmail.com with ESMTPSA id v28sm7688571wra.14.2017.10.30.08.38.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Oct 2017 08:38:23 -0700 (PDT) From: luca.boccassi@gmail.com To: Vladimir Kuramshin Cc: Bruce Richardson , dpdk stable Date: Mon, 30 Oct 2017 15:35:06 +0000 Message-Id: <20171030153511.13322-63-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171030153511.13322-1-luca.boccassi@gmail.com> References: <20171030153511.13322-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'examples/l2fwd-cat: fix build with PQOS 1.4' has been queued to LTS release 16.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2017 15:38:25 -0000 Hi, FYI, your patch has been queued to LTS release 16.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/01/17. So please shout if anyone has objections. Thanks. Kind regards, Luca Boccassi --- >>From eb1087cff53673435a9b8900d5a185411a3b5a6b Mon Sep 17 00:00:00 2001 From: Vladimir Kuramshin Date: Tue, 19 Sep 2017 12:40:44 +0300 Subject: [PATCH] examples/l2fwd-cat: fix build with PQOS 1.4 [ upstream commit 7a08b1d860a3adbc7315bc5ca532d541d07310af ] 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 Acked-by: Bruce Richardson --- examples/l2fwd-cat/Makefile | 5 +-- examples/l2fwd-cat/cat.c | 85 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 76 insertions(+), 14 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 bad39305a..f6f8b6881 100644 --- a/examples/l2fwd-cat/cat.c +++ b/examples/l2fwd-cat/cat.c @@ -53,7 +53,11 @@ static const struct pqos_cap *m_cap; static const struct pqos_cpuinfo *m_cpu; static const struct pqos_capability *m_cap_l3ca; +#if PQOS_VERSION <= 103 static unsigned m_sockets[PQOS_MAX_SOCKETS]; +#else +static unsigned int *m_sockets; +#endif static unsigned m_sock_count; static struct cat_config m_config[PQOS_MAX_CORES]; static unsigned m_config_count; @@ -271,16 +275,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 +357,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 +409,11 @@ check_cpus(void) goto exit; } +#if PQOS_VERSION <= 103 ret = pqos_l3ca_assoc_get(cpu_id, &cos_id); +#else + ret = pqos_alloc_assoc_get(cpu_id, &cos_id); +#endif if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to read COS " "associated to cpu %u.\n", @@ -512,7 +517,11 @@ 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; +#if PQOS_VERSION <= 103 ret = pqos_l3ca_assoc_get(cpu_id, &cos_id); +#else + ret = pqos_alloc_assoc_get(cpu_id, &cos_id); +#endif 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 +607,19 @@ configure_cat(unsigned cos_id_map[][PQOS_MAX_SOCKETS]) l3ca.cdp = m_config[i].cdp; if (m_config[i].cdp == 1) { +#if PQOS_VERSION <= 103 l3ca.code_mask = m_config[i].code_mask; l3ca.data_mask = m_config[i].data_mask; +#else + l3ca.u.s.code_mask = m_config[i].code_mask; + l3ca.u.s.data_mask = m_config[i].data_mask; +#endif } else +#if PQOS_VERSION <= 103 l3ca.ways_mask = m_config[i].mask; +#else + l3ca.u.ways_mask = m_config[i].mask; +#endif for (j = 0; j < m_sock_count; j++) { phy_pkg_id = m_sockets[j]; @@ -637,7 +655,11 @@ configure_cat(unsigned cos_id_map[][PQOS_MAX_SOCKETS]) cos_id = cos_id_map[i][phy_pkg_id]; +#if PQOS_VERSION <= 103 ret = pqos_l3ca_assoc_set(cpu_id, cos_id); +#else + ret = pqos_alloc_assoc_set(cpu_id, cos_id); +#endif if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to associate COS %u to " "cpu %u\n", cos_id, cpu_id); @@ -754,24 +776,43 @@ print_cat_config(void) if (tab[n].cdp == 1) { printf("PQOS: COS: %u, cMASK: 0x%llx, " "dMASK: 0x%llx\n", tab[n].class_id, +#if PQOS_VERSION <= 103 (unsigned long long)tab[n].code_mask, (unsigned long long)tab[n].data_mask); +#else + (unsigned long long)tab[n].u.s.code_mask, + (unsigned long long)tab[n].u.s.data_mask); +#endif } else { printf("PQOS: COS: %u, MASK: 0x%llx\n", tab[n].class_id, +#if PQOS_VERSION <= 103 (unsigned long long)tab[n].ways_mask); +#else + (unsigned long long)tab[n].u.ways_mask); +#endif } } } for (i = 0; i < m_sock_count; i++) { +#if PQOS_VERSION <= 103 unsigned lcores[PQOS_MAX_SOCKET_CORES] = {0}; +#else + unsigned int *lcores = NULL; +#endif unsigned lcount = 0; unsigned n = 0; +#if PQOS_VERSION <= 103 ret = pqos_cpu_get_cores(m_cpu, m_sockets[i], PQOS_MAX_SOCKET_CORES, &lcount, &lcores[0]); if (ret != PQOS_RETVAL_OK) { +#else + lcores = pqos_cpu_get_cores(m_cpu, m_sockets[i], + &lcount); + if (lcores == NULL || lcount == 0) { +#endif printf("PQOS: Error retrieving core information!\n"); return; } @@ -780,13 +821,21 @@ print_cat_config(void) for (n = 0; n < lcount; n++) { unsigned class_id = 0; +#if PQOS_VERSION <= 103 ret = pqos_l3ca_assoc_get(lcores[n], &class_id); +#else + ret = pqos_alloc_assoc_get(lcores[n], &class_id); +#endif 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]); } + +#if PQOS_VERSION > 103 + free(lcores); +#endif } } @@ -849,7 +898,12 @@ cat_fini(void) m_cap = NULL; m_cpu = NULL; m_cap_l3ca = NULL; +#if PQOS_VERSION <= 103 memset(m_sockets, 0, sizeof(m_sockets)); +#else + if (m_sockets != NULL) + free(m_sockets); +#endif m_sock_count = 0; memset(m_config, 0, sizeof(m_config)); m_config_count = 0; @@ -875,7 +929,11 @@ cat_exit(void) if (CPU_ISSET(cpu_id, &m_config[i].cpumask) == 0) continue; +#if PQOS_VERSION <= 103 ret = pqos_l3ca_assoc_set(cpu_id, 0); +#else + ret = pqos_alloc_assoc_set(cpu_id, 0); +#endif if (ret != PQOS_RETVAL_OK) { printf("PQOS: Failed to associate COS 0 to " "cpu %u\n", cpu_id); @@ -927,7 +985,9 @@ cat_init(int argc, char **argv) /* PQoS Initialization - Check and initialize CAT capability */ cfg.fd_log = STDOUT_FILENO; cfg.verbose = 0; +#if PQOS_VERSION <= 103 cfg.cdp_cfg = PQOS_REQUIRE_CDP_ANY; +#endif ret = pqos_init(&cfg); if (ret != PQOS_RETVAL_OK) { printf("PQOS: Error initializing PQoS library!\n"); @@ -953,9 +1013,14 @@ cat_init(int argc, char **argv) } /* Get CPU socket information */ +#if PQOS_VERSION <= 103 ret = pqos_cpu_get_sockets(m_cpu, PQOS_MAX_SOCKETS, &m_sock_count, m_sockets); if (ret != PQOS_RETVAL_OK) { +#else + m_sockets = pqos_cpu_get_sockets(m_cpu, &m_sock_count); + if (m_sockets == NULL) { +#endif printf("PQOS: Error retrieving CPU socket information!\n"); ret = -EFAULT; goto err; -- 2.11.0