* [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
@ 2021-03-11 16:11 Piotr Kubaj
2021-03-11 20:58 ` Ajit Khaparde
2021-03-15 19:48 ` David Christensen
0 siblings, 2 replies; 9+ messages in thread
From: Piotr Kubaj @ 2021-03-11 16:11 UTC (permalink / raw)
To: nicolas.chautru, declan.doherty, ajit.khaparde, somnath.kotur,
beilei.xing, jia.guo, haiyue.wang, jiawenwu, jianwang, drc
Cc: dev, Piotr Kubaj
There are couple of issues when building with Clang:
1. vector is a keyword and should not be used in code. I undefined it,
but it would probably be better to just change the variable name.
2. vector long is deprecated by Clang and should not be used. I switched
here to vector int.
3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
available in other libc's. Use the portable method of reading TBR when
glibc is not used. Taken from
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/sys/platform/ppc.h
Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
---
app/test-bbdev/test_bbdev_vector.h | 3 +
.../cperf_test_vector_parsing.h | 3 +
app/test-crypto-perf/cperf_test_verify.c | 3 +
drivers/net/bnxt/bnxt_irq.h | 3 +
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 70 +++++++++----------
drivers/net/ixgbe/ixgbe_ethdev.c | 3 +
drivers/net/ixgbe/ixgbe_rxtx.c | 3 +
drivers/net/txgbe/txgbe_ethdev.c | 3 +
lib/librte_eal/ppc/include/rte_altivec.h | 3 +
lib/librte_eal/ppc/include/rte_cycles.h | 8 +++
10 files changed, 67 insertions(+), 35 deletions(-)
diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h
index 4e5dbf5d5..665443fa8 100644
--- a/app/test-bbdev/test_bbdev_vector.h
+++ b/app/test-bbdev/test_bbdev_vector.h
@@ -71,6 +71,9 @@ struct test_bbdev_vector {
};
/* fills test vector parameters based on test file */
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
int
test_bbdev_vector_read(const char *filename,
struct test_bbdev_vector *vector);
diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.h b/app/test-crypto-perf/cperf_test_vector_parsing.h
index 247b14221..76a86cea5 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.h
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.h
@@ -18,6 +18,9 @@
* @return
* 0 on success, (-1) on error.
*/
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
int
free_test_vector(struct cperf_test_vector *vector, struct cperf_options *opts);
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 2939aeaa9..14010a5a2 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -91,6 +91,9 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,
return NULL;
}
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
static int
cperf_verify_op(struct rte_crypto_op *op,
const struct cperf_options *options,
diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h
index 7b02f3097..59a9c4224 100644
--- a/drivers/net/bnxt/bnxt_irq.h
+++ b/drivers/net/bnxt/bnxt_irq.h
@@ -8,6 +8,9 @@
struct bnxt_irq {
rte_intr_callback_fn handler;
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
unsigned int vector;
uint8_t requested;
char name[RTE_ETH_NAME_MAX_LEN + 2];
diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index 1ad74646d..d4230a68b 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -27,10 +27,10 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
struct i40e_rx_entry *rxep = &rxq->sw_ring[rxq->rxrearm_start];
struct rte_mbuf *mb0, *mb1;
- vector unsigned long hdr_room = (vector unsigned long){
+ vector unsigned int hdr_room = (vector unsigned int){
RTE_PKTMBUF_HEADROOM,
RTE_PKTMBUF_HEADROOM};
- vector unsigned long dma_addr0, dma_addr1;
+ vector unsigned int dma_addr0, dma_addr1;
rxdp = rxq->rx_ring + rxq->rxrearm_start;
@@ -40,11 +40,11 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
RTE_I40E_RXQ_REARM_THRESH) < 0) {
if (rxq->rxrearm_nb + RTE_I40E_RXQ_REARM_THRESH >=
rxq->nb_rx_desc) {
- dma_addr0 = (vector unsigned long){};
+ dma_addr0 = (vector unsigned int){};
for (i = 0; i < RTE_I40E_DESCS_PER_LOOP; i++) {
rxep[i].mbuf = &rxq->fake_mbuf;
vec_st(dma_addr0, 0,
- (vector unsigned long *)&rxdp[i].read);
+ (vector unsigned int *)&rxdp[i].read);
}
}
rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed +=
@@ -54,7 +54,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
/* Initialize the mbufs in vector, process 2 mbufs in one loop */
for (i = 0; i < RTE_I40E_RXQ_REARM_THRESH; i += 2, rxep += 2) {
- vector unsigned long vaddr0, vaddr1;
+ vector unsigned int vaddr0, vaddr1;
uintptr_t p0, p1;
mb0 = rxep[0].mbuf;
@@ -72,8 +72,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
*(uint64_t *)p1 = rxq->mbuf_initializer;
/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
- vaddr0 = vec_ld(0, (vector unsigned long *)&mb0->buf_addr);
- vaddr1 = vec_ld(0, (vector unsigned long *)&mb1->buf_addr);
+ vaddr0 = vec_ld(0, (vector unsigned int *)&mb0->buf_addr);
+ vaddr1 = vec_ld(0, (vector unsigned int *)&mb1->buf_addr);
/* convert pa to dma_addr hdr/data */
dma_addr0 = vec_mergel(vaddr0, vaddr0);
@@ -84,8 +84,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
dma_addr1 = vec_add(dma_addr1, hdr_room);
/* flush desc with pa dma_addr */
- vec_st(dma_addr0, 0, (vector unsigned long *)&rxdp++->read);
- vec_st(dma_addr1, 0, (vector unsigned long *)&rxdp++->read);
+ vec_st(dma_addr0, 0, (vector unsigned int *)&rxdp++->read);
+ vec_st(dma_addr1, 0, (vector unsigned int *)&rxdp++->read);
}
rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH;
@@ -102,7 +102,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
}
static inline void
-desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
+desc_to_olflags_v(vector unsigned int descs[4], struct rte_mbuf **rx_pkts)
{
vector unsigned int vlan0, vlan1, rss, l3_l4e;
@@ -169,14 +169,14 @@ desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
#define PKTLEN_SHIFT 10
static inline void
-desc_to_ptype_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts,
+desc_to_ptype_v(vector unsigned int descs[4], struct rte_mbuf **rx_pkts,
uint32_t *ptype_tbl)
{
- vector unsigned long ptype0 = vec_mergel(descs[0], descs[1]);
- vector unsigned long ptype1 = vec_mergel(descs[2], descs[3]);
+ vector unsigned int ptype0 = vec_mergel(descs[0], descs[1]);
+ vector unsigned int ptype1 = vec_mergel(descs[2], descs[3]);
- ptype0 = vec_sr(ptype0, (vector unsigned long){30, 30});
- ptype1 = vec_sr(ptype1, (vector unsigned long){30, 30});
+ ptype0 = vec_sr(ptype0, (vector unsigned int){30, 30});
+ ptype1 = vec_sr(ptype1, (vector unsigned int){30, 30});
rx_pkts[0]->packet_type =
ptype_tbl[(*(vector unsigned char *)&ptype0)[0]];
@@ -214,7 +214,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
rxq->crc_len, /* sub crc on data_len */
0, 0, 0 /* ignore non-length fields */
};
- vector unsigned long dd_check, eop_check;
+ vector unsigned int dd_check, eop_check;
/* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */
nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_I40E_DESCS_PER_LOOP);
@@ -240,11 +240,11 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
return 0;
/* 4 packets DD mask */
- dd_check = (vector unsigned long){0x0000000100000001ULL,
+ dd_check = (vector unsigned int){0x0000000100000001ULL,
0x0000000100000001ULL};
/* 4 packets EOP mask */
- eop_check = (vector unsigned long){0x0000000200000002ULL,
+ eop_check = (vector unsigned int){0x0000000200000002ULL,
0x0000000200000002ULL};
/* mask to shuffle from desc. to mbuf */
@@ -274,35 +274,35 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts;
pos += RTE_I40E_DESCS_PER_LOOP,
rxdp += RTE_I40E_DESCS_PER_LOOP) {
- vector unsigned long descs[RTE_I40E_DESCS_PER_LOOP];
+ vector unsigned int descs[RTE_I40E_DESCS_PER_LOOP];
vector unsigned char pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4;
vector unsigned short staterr, sterr_tmp1, sterr_tmp2;
- vector unsigned long mbp1, mbp2; /* two mbuf pointer
+ vector unsigned int mbp1, mbp2; /* two mbuf pointer
* in one XMM reg.
*/
/* B.1 load 1 mbuf point */
- mbp1 = *(vector unsigned long *)&sw_ring[pos];
+ mbp1 = *(vector unsigned int *)&sw_ring[pos];
/* Read desc statuses backwards to avoid race condition */
/* A.1 load 4 pkts desc */
- descs[3] = *(vector unsigned long *)(rxdp + 3);
+ descs[3] = *(vector unsigned int *)(rxdp + 3);
rte_compiler_barrier();
/* B.2 copy 2 mbuf point into rx_pkts */
- *(vector unsigned long *)&rx_pkts[pos] = mbp1;
+ *(vector unsigned int *)&rx_pkts[pos] = mbp1;
/* B.1 load 1 mbuf point */
- mbp2 = *(vector unsigned long *)&sw_ring[pos + 2];
+ mbp2 = *(vector unsigned int *)&sw_ring[pos + 2];
- descs[2] = *(vector unsigned long *)(rxdp + 2);
+ descs[2] = *(vector unsigned int *)(rxdp + 2);
rte_compiler_barrier();
/* B.1 load 2 mbuf point */
- descs[1] = *(vector unsigned long *)(rxdp + 1);
+ descs[1] = *(vector unsigned int *)(rxdp + 1);
rte_compiler_barrier();
- descs[0] = *(vector unsigned long *)(rxdp);
+ descs[0] = *(vector unsigned int *)(rxdp);
/* B.2 copy 2 mbuf point into rx_pkts */
- *(vector unsigned long *)&rx_pkts[pos + 2] = mbp2;
+ *(vector unsigned int *)&rx_pkts[pos + 2] = mbp2;
if (split_packet) {
rte_mbuf_prefetch_part2(rx_pkts[pos]);
@@ -324,8 +324,8 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
(vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
/* merge the now-aligned packet length fields back in */
- descs[3] = (vector unsigned long)len3;
- descs[2] = (vector unsigned long)len2;
+ descs[3] = (vector unsigned int)len3;
+ descs[2] = (vector unsigned int)len2;
/* D.1 pkt 3,4 convert format from desc to pktmbuf */
pkt_mb4 = vec_perm((vector unsigned char)descs[3],
@@ -354,8 +354,8 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
(vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
/* merge the now-aligned packet length fields back in */
- descs[1] = (vector unsigned long)len1;
- descs[0] = (vector unsigned long)len0;
+ descs[1] = (vector unsigned int)len1;
+ descs[0] = (vector unsigned int)len0;
/* D.1 pkt 1,2 convert format from desc to pktmbuf */
pkt_mb2 = vec_perm((vector unsigned char)descs[1],
@@ -432,7 +432,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
/* C.4 calc avaialbe number of desc */
var = __builtin_popcountll((vec_ld(0,
- (vector unsigned long *)&staterr)[0]));
+ (vector unsigned int *)&staterr)[0]));
nb_pkts_recd += var;
if (likely(var != RTE_I40E_DESCS_PER_LOOP))
break;
@@ -533,9 +533,9 @@ vtx1(volatile struct i40e_tx_desc *txdp,
((uint64_t)flags << I40E_TXD_QW1_CMD_SHIFT) |
((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
- vector unsigned long descriptor = (vector unsigned long){
+ vector unsigned int descriptor = (vector unsigned int){
pkt->buf_iova + pkt->data_off, high_qw};
- *(vector unsigned long *)txdp = descriptor;
+ *(vector unsigned int *)txdp = descriptor;
}
static inline void
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 761a0f26b..59ffe92ea 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5597,6 +5597,9 @@ ixgbe_vt_check(struct ixgbe_hw *hw)
static uint32_t
ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr)
{
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
uint32_t vector = 0;
switch (hw->mac.mc_filter_type) {
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 7d23bab29..88d71131e 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -4740,6 +4740,9 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool)
* @vector the MSIX vector for this queue
* @type RX/TX/MISC
*/
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
static void
ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type)
{
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 90137d0ce..2747246a1 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -3382,6 +3382,9 @@ txgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
static uint32_t
txgbe_uta_vector(struct txgbe_hw *hw, struct rte_ether_addr *uc_addr)
{
+#if defined(__clang__) && defined(__powerpc64__)
+#undef vector
+#endif
uint32_t vector = 0;
switch (hw->mac.mc_filter_type) {
diff --git a/lib/librte_eal/ppc/include/rte_altivec.h b/lib/librte_eal/ppc/include/rte_altivec.h
index 1551a9454..3fcc819c1 100644
--- a/lib/librte_eal/ppc/include/rte_altivec.h
+++ b/lib/librte_eal/ppc/include/rte_altivec.h
@@ -7,6 +7,9 @@
#define _RTE_ALTIVEC_H_
/* To include altivec.h, GCC version must be >= 4.8 */
+#ifdef __clang__
+#define vector __vector
+#endif
#include <altivec.h>
/*
diff --git a/lib/librte_eal/ppc/include/rte_cycles.h b/lib/librte_eal/ppc/include/rte_cycles.h
index 5585f9273..9925d1d0d 100644
--- a/lib/librte_eal/ppc/include/rte_cycles.h
+++ b/lib/librte_eal/ppc/include/rte_cycles.h
@@ -10,7 +10,9 @@
extern "C" {
#endif
+#ifdef __GLIBC__
#include <sys/platform/ppc.h>
+#endif
#include "generic/rte_cycles.h"
@@ -26,7 +28,13 @@ extern "C" {
static inline uint64_t
rte_rdtsc(void)
{
+#ifdef __GLIBC__
return __ppc_get_timebase();
+#else
+ uint64_t __tb;
+ __asm__ volatile ("mfspr %0, 268" : "=r" (__tb));
+ return __tb;
+#endif
}
static inline uint64_t
--
2.30.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
2021-03-11 16:11 [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc Piotr Kubaj
@ 2021-03-11 20:58 ` Ajit Khaparde
2021-03-15 19:48 ` David Christensen
1 sibling, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2021-03-11 20:58 UTC (permalink / raw)
To: Piotr Kubaj
Cc: Nicolas Chautru, declan.doherty, Somnath Kotur, Beilei Xing,
Jeff Guo, Haiyue Wang, Jiawen Wu, Jian Wang, David Christensen,
dpdk-dev
[-- Attachment #1: Type: text/plain, Size: 16638 bytes --]
On Thu, Mar 11, 2021 at 8:11 AM Piotr Kubaj <pkubaj@freebsd.org> wrote:
>
> There are couple of issues when building with Clang:
> 1. vector is a keyword and should not be used in code. I undefined it,
> but it would probably be better to just change the variable name.
> 2. vector long is deprecated by Clang and should not be used. I switched
> here to vector int.
> 3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
> available in other libc's. Use the portable method of reading TBR when
> glibc is not used. Taken from
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/sys/platform/ppc.h
>
> Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> ---
> app/test-bbdev/test_bbdev_vector.h | 3 +
> .../cperf_test_vector_parsing.h | 3 +
> app/test-crypto-perf/cperf_test_verify.c | 3 +
> drivers/net/bnxt/bnxt_irq.h | 3 +
> drivers/net/i40e/i40e_rxtx_vec_altivec.c | 70 +++++++++----------
> drivers/net/ixgbe/ixgbe_ethdev.c | 3 +
> drivers/net/ixgbe/ixgbe_rxtx.c | 3 +
> drivers/net/txgbe/txgbe_ethdev.c | 3 +
> lib/librte_eal/ppc/include/rte_altivec.h | 3 +
> lib/librte_eal/ppc/include/rte_cycles.h | 8 +++
> 10 files changed, 67 insertions(+), 35 deletions(-)
>
> diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h
> index 4e5dbf5d5..665443fa8 100644
> --- a/app/test-bbdev/test_bbdev_vector.h
> +++ b/app/test-bbdev/test_bbdev_vector.h
> @@ -71,6 +71,9 @@ struct test_bbdev_vector {
> };
>
> /* fills test vector parameters based on test file */
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
> int
> test_bbdev_vector_read(const char *filename,
> struct test_bbdev_vector *vector);
> diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.h b/app/test-crypto-perf/cperf_test_vector_parsing.h
> index 247b14221..76a86cea5 100644
> --- a/app/test-crypto-perf/cperf_test_vector_parsing.h
> +++ b/app/test-crypto-perf/cperf_test_vector_parsing.h
> @@ -18,6 +18,9 @@
> * @return
> * 0 on success, (-1) on error.
> */
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
> int
> free_test_vector(struct cperf_test_vector *vector, struct cperf_options *opts);
>
> diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
> index 2939aeaa9..14010a5a2 100644
> --- a/app/test-crypto-perf/cperf_test_verify.c
> +++ b/app/test-crypto-perf/cperf_test_verify.c
> @@ -91,6 +91,9 @@ cperf_verify_test_constructor(struct rte_mempool *sess_mp,
> return NULL;
> }
>
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
> static int
> cperf_verify_op(struct rte_crypto_op *op,
> const struct cperf_options *options,
> diff --git a/drivers/net/bnxt/bnxt_irq.h b/drivers/net/bnxt/bnxt_irq.h
> index 7b02f3097..59a9c4224 100644
> --- a/drivers/net/bnxt/bnxt_irq.h
> +++ b/drivers/net/bnxt/bnxt_irq.h
> @@ -8,6 +8,9 @@
>
> struct bnxt_irq {
> rte_intr_callback_fn handler;
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
For bnxt PMD, I can submit a patch to rename vector.
Thanks for bringing this up.
> unsigned int vector;
> uint8_t requested;
> char name[RTE_ETH_NAME_MAX_LEN + 2];
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
> index 1ad74646d..d4230a68b 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
> @@ -27,10 +27,10 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
> struct i40e_rx_entry *rxep = &rxq->sw_ring[rxq->rxrearm_start];
> struct rte_mbuf *mb0, *mb1;
>
> - vector unsigned long hdr_room = (vector unsigned long){
> + vector unsigned int hdr_room = (vector unsigned int){
> RTE_PKTMBUF_HEADROOM,
> RTE_PKTMBUF_HEADROOM};
> - vector unsigned long dma_addr0, dma_addr1;
> + vector unsigned int dma_addr0, dma_addr1;
>
> rxdp = rxq->rx_ring + rxq->rxrearm_start;
>
> @@ -40,11 +40,11 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
> RTE_I40E_RXQ_REARM_THRESH) < 0) {
> if (rxq->rxrearm_nb + RTE_I40E_RXQ_REARM_THRESH >=
> rxq->nb_rx_desc) {
> - dma_addr0 = (vector unsigned long){};
> + dma_addr0 = (vector unsigned int){};
> for (i = 0; i < RTE_I40E_DESCS_PER_LOOP; i++) {
> rxep[i].mbuf = &rxq->fake_mbuf;
> vec_st(dma_addr0, 0,
> - (vector unsigned long *)&rxdp[i].read);
> + (vector unsigned int *)&rxdp[i].read);
> }
> }
> rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed +=
> @@ -54,7 +54,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
>
> /* Initialize the mbufs in vector, process 2 mbufs in one loop */
> for (i = 0; i < RTE_I40E_RXQ_REARM_THRESH; i += 2, rxep += 2) {
> - vector unsigned long vaddr0, vaddr1;
> + vector unsigned int vaddr0, vaddr1;
> uintptr_t p0, p1;
>
> mb0 = rxep[0].mbuf;
> @@ -72,8 +72,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
> *(uint64_t *)p1 = rxq->mbuf_initializer;
>
> /* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
> - vaddr0 = vec_ld(0, (vector unsigned long *)&mb0->buf_addr);
> - vaddr1 = vec_ld(0, (vector unsigned long *)&mb1->buf_addr);
> + vaddr0 = vec_ld(0, (vector unsigned int *)&mb0->buf_addr);
> + vaddr1 = vec_ld(0, (vector unsigned int *)&mb1->buf_addr);
>
> /* convert pa to dma_addr hdr/data */
> dma_addr0 = vec_mergel(vaddr0, vaddr0);
> @@ -84,8 +84,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
> dma_addr1 = vec_add(dma_addr1, hdr_room);
>
> /* flush desc with pa dma_addr */
> - vec_st(dma_addr0, 0, (vector unsigned long *)&rxdp++->read);
> - vec_st(dma_addr1, 0, (vector unsigned long *)&rxdp++->read);
> + vec_st(dma_addr0, 0, (vector unsigned int *)&rxdp++->read);
> + vec_st(dma_addr1, 0, (vector unsigned int *)&rxdp++->read);
> }
>
> rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH;
> @@ -102,7 +102,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
> }
>
> static inline void
> -desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
> +desc_to_olflags_v(vector unsigned int descs[4], struct rte_mbuf **rx_pkts)
> {
> vector unsigned int vlan0, vlan1, rss, l3_l4e;
>
> @@ -169,14 +169,14 @@ desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
> #define PKTLEN_SHIFT 10
>
> static inline void
> -desc_to_ptype_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts,
> +desc_to_ptype_v(vector unsigned int descs[4], struct rte_mbuf **rx_pkts,
> uint32_t *ptype_tbl)
> {
> - vector unsigned long ptype0 = vec_mergel(descs[0], descs[1]);
> - vector unsigned long ptype1 = vec_mergel(descs[2], descs[3]);
> + vector unsigned int ptype0 = vec_mergel(descs[0], descs[1]);
> + vector unsigned int ptype1 = vec_mergel(descs[2], descs[3]);
>
> - ptype0 = vec_sr(ptype0, (vector unsigned long){30, 30});
> - ptype1 = vec_sr(ptype1, (vector unsigned long){30, 30});
> + ptype0 = vec_sr(ptype0, (vector unsigned int){30, 30});
> + ptype1 = vec_sr(ptype1, (vector unsigned int){30, 30});
>
> rx_pkts[0]->packet_type =
> ptype_tbl[(*(vector unsigned char *)&ptype0)[0]];
> @@ -214,7 +214,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
> rxq->crc_len, /* sub crc on data_len */
> 0, 0, 0 /* ignore non-length fields */
> };
> - vector unsigned long dd_check, eop_check;
> + vector unsigned int dd_check, eop_check;
>
> /* nb_pkts has to be floor-aligned to RTE_I40E_DESCS_PER_LOOP */
> nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_I40E_DESCS_PER_LOOP);
> @@ -240,11 +240,11 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
> return 0;
>
> /* 4 packets DD mask */
> - dd_check = (vector unsigned long){0x0000000100000001ULL,
> + dd_check = (vector unsigned int){0x0000000100000001ULL,
> 0x0000000100000001ULL};
>
> /* 4 packets EOP mask */
> - eop_check = (vector unsigned long){0x0000000200000002ULL,
> + eop_check = (vector unsigned int){0x0000000200000002ULL,
> 0x0000000200000002ULL};
>
> /* mask to shuffle from desc. to mbuf */
> @@ -274,35 +274,35 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
> for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts;
> pos += RTE_I40E_DESCS_PER_LOOP,
> rxdp += RTE_I40E_DESCS_PER_LOOP) {
> - vector unsigned long descs[RTE_I40E_DESCS_PER_LOOP];
> + vector unsigned int descs[RTE_I40E_DESCS_PER_LOOP];
> vector unsigned char pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4;
> vector unsigned short staterr, sterr_tmp1, sterr_tmp2;
> - vector unsigned long mbp1, mbp2; /* two mbuf pointer
> + vector unsigned int mbp1, mbp2; /* two mbuf pointer
> * in one XMM reg.
> */
>
> /* B.1 load 1 mbuf point */
> - mbp1 = *(vector unsigned long *)&sw_ring[pos];
> + mbp1 = *(vector unsigned int *)&sw_ring[pos];
> /* Read desc statuses backwards to avoid race condition */
> /* A.1 load 4 pkts desc */
> - descs[3] = *(vector unsigned long *)(rxdp + 3);
> + descs[3] = *(vector unsigned int *)(rxdp + 3);
> rte_compiler_barrier();
>
> /* B.2 copy 2 mbuf point into rx_pkts */
> - *(vector unsigned long *)&rx_pkts[pos] = mbp1;
> + *(vector unsigned int *)&rx_pkts[pos] = mbp1;
>
> /* B.1 load 1 mbuf point */
> - mbp2 = *(vector unsigned long *)&sw_ring[pos + 2];
> + mbp2 = *(vector unsigned int *)&sw_ring[pos + 2];
>
> - descs[2] = *(vector unsigned long *)(rxdp + 2);
> + descs[2] = *(vector unsigned int *)(rxdp + 2);
> rte_compiler_barrier();
> /* B.1 load 2 mbuf point */
> - descs[1] = *(vector unsigned long *)(rxdp + 1);
> + descs[1] = *(vector unsigned int *)(rxdp + 1);
> rte_compiler_barrier();
> - descs[0] = *(vector unsigned long *)(rxdp);
> + descs[0] = *(vector unsigned int *)(rxdp);
>
> /* B.2 copy 2 mbuf point into rx_pkts */
> - *(vector unsigned long *)&rx_pkts[pos + 2] = mbp2;
> + *(vector unsigned int *)&rx_pkts[pos + 2] = mbp2;
>
> if (split_packet) {
> rte_mbuf_prefetch_part2(rx_pkts[pos]);
> @@ -324,8 +324,8 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
> (vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
>
> /* merge the now-aligned packet length fields back in */
> - descs[3] = (vector unsigned long)len3;
> - descs[2] = (vector unsigned long)len2;
> + descs[3] = (vector unsigned int)len3;
> + descs[2] = (vector unsigned int)len2;
>
> /* D.1 pkt 3,4 convert format from desc to pktmbuf */
> pkt_mb4 = vec_perm((vector unsigned char)descs[3],
> @@ -354,8 +354,8 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
> (vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
>
> /* merge the now-aligned packet length fields back in */
> - descs[1] = (vector unsigned long)len1;
> - descs[0] = (vector unsigned long)len0;
> + descs[1] = (vector unsigned int)len1;
> + descs[0] = (vector unsigned int)len0;
>
> /* D.1 pkt 1,2 convert format from desc to pktmbuf */
> pkt_mb2 = vec_perm((vector unsigned char)descs[1],
> @@ -432,7 +432,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
>
> /* C.4 calc avaialbe number of desc */
> var = __builtin_popcountll((vec_ld(0,
> - (vector unsigned long *)&staterr)[0]));
> + (vector unsigned int *)&staterr)[0]));
> nb_pkts_recd += var;
> if (likely(var != RTE_I40E_DESCS_PER_LOOP))
> break;
> @@ -533,9 +533,9 @@ vtx1(volatile struct i40e_tx_desc *txdp,
> ((uint64_t)flags << I40E_TXD_QW1_CMD_SHIFT) |
> ((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));
>
> - vector unsigned long descriptor = (vector unsigned long){
> + vector unsigned int descriptor = (vector unsigned int){
> pkt->buf_iova + pkt->data_off, high_qw};
> - *(vector unsigned long *)txdp = descriptor;
> + *(vector unsigned int *)txdp = descriptor;
> }
>
> static inline void
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 761a0f26b..59ffe92ea 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -5597,6 +5597,9 @@ ixgbe_vt_check(struct ixgbe_hw *hw)
> static uint32_t
> ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr)
> {
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
> uint32_t vector = 0;
>
> switch (hw->mac.mc_filter_type) {
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index 7d23bab29..88d71131e 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -4740,6 +4740,9 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool)
> * @vector the MSIX vector for this queue
> * @type RX/TX/MISC
> */
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
> static void
> ixgbe_set_ivar(struct rte_eth_dev *dev, u8 entry, u8 vector, s8 type)
> {
> diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
> index 90137d0ce..2747246a1 100644
> --- a/drivers/net/txgbe/txgbe_ethdev.c
> +++ b/drivers/net/txgbe/txgbe_ethdev.c
> @@ -3382,6 +3382,9 @@ txgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> static uint32_t
> txgbe_uta_vector(struct txgbe_hw *hw, struct rte_ether_addr *uc_addr)
> {
> +#if defined(__clang__) && defined(__powerpc64__)
> +#undef vector
> +#endif
> uint32_t vector = 0;
>
> switch (hw->mac.mc_filter_type) {
> diff --git a/lib/librte_eal/ppc/include/rte_altivec.h b/lib/librte_eal/ppc/include/rte_altivec.h
> index 1551a9454..3fcc819c1 100644
> --- a/lib/librte_eal/ppc/include/rte_altivec.h
> +++ b/lib/librte_eal/ppc/include/rte_altivec.h
> @@ -7,6 +7,9 @@
> #define _RTE_ALTIVEC_H_
>
> /* To include altivec.h, GCC version must be >= 4.8 */
> +#ifdef __clang__
> +#define vector __vector
> +#endif
> #include <altivec.h>
>
> /*
> diff --git a/lib/librte_eal/ppc/include/rte_cycles.h b/lib/librte_eal/ppc/include/rte_cycles.h
> index 5585f9273..9925d1d0d 100644
> --- a/lib/librte_eal/ppc/include/rte_cycles.h
> +++ b/lib/librte_eal/ppc/include/rte_cycles.h
> @@ -10,7 +10,9 @@
> extern "C" {
> #endif
>
> +#ifdef __GLIBC__
> #include <sys/platform/ppc.h>
> +#endif
>
> #include "generic/rte_cycles.h"
>
> @@ -26,7 +28,13 @@ extern "C" {
> static inline uint64_t
> rte_rdtsc(void)
> {
> +#ifdef __GLIBC__
> return __ppc_get_timebase();
> +#else
> + uint64_t __tb;
> + __asm__ volatile ("mfspr %0, 268" : "=r" (__tb));
> + return __tb;
> +#endif
> }
>
> static inline uint64_t
> --
> 2.30.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
2021-03-11 16:11 [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc Piotr Kubaj
2021-03-11 20:58 ` Ajit Khaparde
@ 2021-03-15 19:48 ` David Christensen
2021-03-22 20:14 ` Piotr Kubaj
2021-03-22 23:42 ` Piotr Kubaj
1 sibling, 2 replies; 9+ messages in thread
From: David Christensen @ 2021-03-15 19:48 UTC (permalink / raw)
To: Piotr Kubaj, nicolas.chautru, declan.doherty, ajit.khaparde,
somnath.kotur, beilei.xing, jia.guo, haiyue.wang, jiawenwu,
jianwang
Cc: dev
On 3/11/21 8:11 AM, Piotr Kubaj wrote:
> There are couple of issues when building with Clang:
> 1. vector is a keyword and should not be used in code. I undefined it,
> but it would probably be better to just change the variable name.
> 2. vector long is deprecated by Clang and should not be used. I switched
> here to vector int.
> 3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
> available in other libc's. Use the portable method of reading TBR when
> glibc is not used. Taken from
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/sys/platform/ppc.h
>
> Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> ---
Build with patch on my POWER9 system with RHEL 8.3 (gcc 8.3.1 20191121)
generates the following errors:
ninja -C build
ninja: Entering directory `build'
[1221/2455] Compiling C object
'drivers/a715181@@tmp_rte_net_i40e@sta/net_i40e_i40e_rxtx_vec_altivec.c.o'.
../drivers/net/i40e/i40e_rxtx_vec_altivec.c: In function
‘_recv_raw_pkts_vec’:
../drivers/net/i40e/i40e_rxtx_vec_altivec.c:243:35: warning: conversion
from ‘long long unsigned int’ to ‘unsigned int’ changes value from
‘4294967297’ to ‘1’ [-Woverflow]
dd_check = (vector unsigned int){0x0000000100000001ULL,
^~~~~~~~~~~~~~~~~~~~~
../drivers/net/i40e/i40e_rxtx_vec_altivec.c:244:8: warning: conversion
from ‘long long unsigned int’ to ‘unsigned int’ changes value from
‘4294967297’ to ‘1’ [-Woverflow]
0x0000000100000001ULL};
^~~~~~~~~~~~~~~~~~~~~
../drivers/net/i40e/i40e_rxtx_vec_altivec.c:247:36: warning: conversion
from ‘long long unsigned int’ to ‘unsigned int’ changes value from
‘8589934594’ to ‘2’ [-Woverflow]
eop_check = (vector unsigned int){0x0000000200000002ULL,
^~~~~~~~~~~~~~~~~~~~~
../drivers/net/i40e/i40e_rxtx_vec_altivec.c:248:9: warning: conversion
from ‘long long unsigned int’ to ‘unsigned int’ changes value from
‘8589934594’ to ‘2’ [-Woverflow]
0x0000000200000002ULL};
^~~~~~~~~~~~~~~~~~~~~
[1736/2455] Compiling C object
'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'.
In file included from ../drivers/event/dsw/dsw_evdev.c:7:
../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
declaration of function ‘__ppc_get_timebase’; did you mean
‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
return __ppc_get_timebase();
^~~~~~~~~~~~~~~~~~
__builtin_ppc_get_timebase
../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
[1862/2455] Compiling C object
'app/a172ced@@dpdk-testpmd@exe/test-pmd_ieee1588fwd.c.o'.
In file included from ../app/test-pmd/ieee1588fwd.c:6:
../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
declaration of function ‘__ppc_get_timebase’; did you mean
‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
return __ppc_get_timebase();
^~~~~~~~~~~~~~~~~~
__builtin_ppc_get_timebase
../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
[2330/2455] Linking target drivers/librte_event_dsw.so.21.2.
FAILED: drivers/librte_event_dsw.so.21.2
cc -o drivers/librte_event_dsw.so.21.2
'drivers/a715181@@rte_event_dsw@sha/meson-generated_.._rte_event_dsw.pmd.c.o'
'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'
'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_event.c.o'
'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_xstats.c.o'
-Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC
-Wl,--start-group -Wl,-soname,librte_event_dsw.so.21 -Wl,--no-as-needed
-pthread -lm -ldl -lnuma lib/librte_eventdev.so.21.2
lib/librte_eal.so.21.2 lib/librte_kvargs.so.21.2
lib/librte_telemetry.so.21.2 lib/librte_ring.so.21.2
lib/librte_ethdev.so.21.2 lib/librte_net.so.21.2 lib/librte_mbuf.so.21.2
lib/librte_mempool.so.21.2 lib/librte_meter.so.21.2
lib/librte_hash.so.21.2 lib/librte_rcu.so.21.2 lib/librte_timer.so.21.2
lib/librte_cryptodev.so.21.2 drivers/librte_bus_vdev.so.21.2
-Wl,--end-group
-Wl,--version-script=/home/drc/src/dpdk/drivers/event/dsw/version.map
'-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/'
-Wl,-rpath-link,/home/drc/src/dpdk/build/lib:/home/drc/src/dpdk/build/drivers
drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o: In
function `dsw_start':
dsw_evdev.c:(.text+0x1078): undefined reference to `__ppc_get_timebase'
collect2: error: ld returned 1 exit status
[2359/2455] Compiling C object
'app/test/3062f5d@@dpdk-test@exe/test_trace_perf.c.o'.
In file included from ../app/test/test_trace_perf.c:5:
../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
declaration of function ‘__ppc_get_timebase’; did you mean
‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
return __ppc_get_timebase();
^~~~~~~~~~~~~~~~~~
__builtin_ppc_get_timebase
../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
[2366/2455] Compiling C object
'drivers/a715181@@tmp_rte_event_octeontx2@sta/event_octeontx2_otx2_worker_dual.c.o'.
ninja: build stopped: subcommand failed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
2021-03-15 19:48 ` David Christensen
@ 2021-03-22 20:14 ` Piotr Kubaj
2021-03-22 23:42 ` Piotr Kubaj
1 sibling, 0 replies; 9+ messages in thread
From: Piotr Kubaj @ 2021-03-22 20:14 UTC (permalink / raw)
To: David Christensen
Cc: nicolas.chautru, declan.doherty, ajit.khaparde, somnath.kotur,
beilei.xing, jia.guo, haiyue.wang, jiawenwu, jianwang, dev
[-- Attachment #1.1: Type: text/plain, Size: 6238 bytes --]
Thank you for your input.
I did not have Linux installed on my box previously and assumed
__GLIBC__ is always defined when glibc i used.
I just tested that this patch works on both Linux (Fedora 33) and
FreeBSD (13.0-RC3 powerpc64le).
On 21-03-15 12:48:19, David Christensen wrote:
>
>
> On 3/11/21 8:11 AM, Piotr Kubaj wrote:
> > There are couple of issues when building with Clang:
> > 1. vector is a keyword and should not be used in code. I undefined it,
> > but it would probably be better to just change the variable name.
> > 2. vector long is deprecated by Clang and should not be used. I switched
> > here to vector int.
> > 3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
> > available in other libc's. Use the portable method of reading TBR when
> > glibc is not used. Taken from
> > https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/sys/platform/ppc.h
> >
> > Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> > ---
>
> Build with patch on my POWER9 system with RHEL 8.3 (gcc 8.3.1 20191121)
> generates the following errors:
>
>
> ninja -C build
> ninja: Entering directory `build'
> [1221/2455] Compiling C object
> 'drivers/a715181@@tmp_rte_net_i40e@sta/net_i40e_i40e_rxtx_vec_altivec.c.o'.
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c: In function
> ‘_recv_raw_pkts_vec’:
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:243:35: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘4294967297’ to ‘1’ [-Woverflow]
> dd_check = (vector unsigned int){0x0000000100000001ULL,
> ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:244:8: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘4294967297’ to ‘1’ [-Woverflow]
> 0x0000000100000001ULL};
> ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:247:36: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘8589934594’ to ‘2’ [-Woverflow]
> eop_check = (vector unsigned int){0x0000000200000002ULL,
> ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:248:9: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘8589934594’ to ‘2’ [-Woverflow]
> 0x0000000200000002ULL};
> ^~~~~~~~~~~~~~~~~~~~~
> [1736/2455] Compiling C object
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'.
> In file included from ../drivers/event/dsw/dsw_evdev.c:7:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
> declaration of function ‘__ppc_get_timebase’; did you mean
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
> return __ppc_get_timebase();
> ^~~~~~~~~~~~~~~~~~
> __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [1862/2455] Compiling C object
> 'app/a172ced@@dpdk-testpmd@exe/test-pmd_ieee1588fwd.c.o'.
> In file included from ../app/test-pmd/ieee1588fwd.c:6:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
> declaration of function ‘__ppc_get_timebase’; did you mean
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
> return __ppc_get_timebase();
> ^~~~~~~~~~~~~~~~~~
> __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [2330/2455] Linking target drivers/librte_event_dsw.so.21.2.
> FAILED: drivers/librte_event_dsw.so.21.2
> cc -o drivers/librte_event_dsw.so.21.2
> 'drivers/a715181@@rte_event_dsw@sha/meson-generated_.._rte_event_dsw.pmd.c.o'
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_event.c.o'
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_xstats.c.o'
> -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC
> -Wl,--start-group -Wl,-soname,librte_event_dsw.so.21 -Wl,--no-as-needed
> -pthread -lm -ldl -lnuma lib/librte_eventdev.so.21.2
> lib/librte_eal.so.21.2 lib/librte_kvargs.so.21.2
> lib/librte_telemetry.so.21.2 lib/librte_ring.so.21.2
> lib/librte_ethdev.so.21.2 lib/librte_net.so.21.2 lib/librte_mbuf.so.21.2
> lib/librte_mempool.so.21.2 lib/librte_meter.so.21.2
> lib/librte_hash.so.21.2 lib/librte_rcu.so.21.2 lib/librte_timer.so.21.2
> lib/librte_cryptodev.so.21.2 drivers/librte_bus_vdev.so.21.2
> -Wl,--end-group
> -Wl,--version-script=/home/drc/src/dpdk/drivers/event/dsw/version.map
> '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/'
> -Wl,-rpath-link,/home/drc/src/dpdk/build/lib:/home/drc/src/dpdk/build/drivers
> drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o: In
> function `dsw_start':
> dsw_evdev.c:(.text+0x1078): undefined reference to `__ppc_get_timebase'
> collect2: error: ld returned 1 exit status
> [2359/2455] Compiling C object
> 'app/test/3062f5d@@dpdk-test@exe/test_trace_perf.c.o'.
> In file included from ../app/test/test_trace_perf.c:5:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
> declaration of function ‘__ppc_get_timebase’; did you mean
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
> return __ppc_get_timebase();
> ^~~~~~~~~~~~~~~~~~
> __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [2366/2455] Compiling C object
> 'drivers/a715181@@tmp_rte_event_octeontx2@sta/event_octeontx2_otx2_worker_dual.c.o'.
> ninja: build stopped: subcommand failed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
2021-03-15 19:48 ` David Christensen
2021-03-22 20:14 ` Piotr Kubaj
@ 2021-03-22 23:42 ` Piotr Kubaj
2021-05-05 14:58 ` David Marchand
1 sibling, 1 reply; 9+ messages in thread
From: Piotr Kubaj @ 2021-03-22 23:42 UTC (permalink / raw)
To: David Christensen
Cc: Piotr Kubaj, nicolas.chautru, declan.doherty, ajit.khaparde,
somnath.kotur, beilei.xing, jia.guo, haiyue.wang, jiawenwu,
jianwang, dev
[-- Attachment #1.1: Type: text/plain, Size: 6097 bytes --]
Looks like I forgot to commit the change that includes headers for sysctlbyname().
Patch attached.
On 21-03-15 12:48:19, David Christensen wrote:
>
>
> On 3/11/21 8:11 AM, Piotr Kubaj wrote:
> > There are couple of issues when building with Clang:
> > 1. vector is a keyword and should not be used in code. I undefined it,
> > but it would probably be better to just change the variable name.
> > 2. vector long is deprecated by Clang and should not be used. I switched
> > here to vector int.
> > 3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
> > available in other libc's. Use the portable method of reading TBR when
> > glibc is not used. Taken from
> > https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/sys/platform/ppc.h
> >
> > Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
> > ---
>
> Build with patch on my POWER9 system with RHEL 8.3 (gcc 8.3.1 20191121)
> generates the following errors:
>
>
> ninja -C build
> ninja: Entering directory `build'
> [1221/2455] Compiling C object
> 'drivers/a715181@@tmp_rte_net_i40e@sta/net_i40e_i40e_rxtx_vec_altivec.c.o'.
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c: In function
> ‘_recv_raw_pkts_vec’:
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:243:35: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘4294967297’ to ‘1’ [-Woverflow]
> dd_check = (vector unsigned int){0x0000000100000001ULL,
> ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:244:8: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘4294967297’ to ‘1’ [-Woverflow]
> 0x0000000100000001ULL};
> ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:247:36: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘8589934594’ to ‘2’ [-Woverflow]
> eop_check = (vector unsigned int){0x0000000200000002ULL,
> ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:248:9: warning: conversion
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from
> ‘8589934594’ to ‘2’ [-Woverflow]
> 0x0000000200000002ULL};
> ^~~~~~~~~~~~~~~~~~~~~
> [1736/2455] Compiling C object
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'.
> In file included from ../drivers/event/dsw/dsw_evdev.c:7:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
> declaration of function ‘__ppc_get_timebase’; did you mean
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
> return __ppc_get_timebase();
> ^~~~~~~~~~~~~~~~~~
> __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [1862/2455] Compiling C object
> 'app/a172ced@@dpdk-testpmd@exe/test-pmd_ieee1588fwd.c.o'.
> In file included from ../app/test-pmd/ieee1588fwd.c:6:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
> declaration of function ‘__ppc_get_timebase’; did you mean
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
> return __ppc_get_timebase();
> ^~~~~~~~~~~~~~~~~~
> __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [2330/2455] Linking target drivers/librte_event_dsw.so.21.2.
> FAILED: drivers/librte_event_dsw.so.21.2
> cc -o drivers/librte_event_dsw.so.21.2
> 'drivers/a715181@@rte_event_dsw@sha/meson-generated_.._rte_event_dsw.pmd.c.o'
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o'
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_event.c.o'
> 'drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_xstats.c.o'
> -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC
> -Wl,--start-group -Wl,-soname,librte_event_dsw.so.21 -Wl,--no-as-needed
> -pthread -lm -ldl -lnuma lib/librte_eventdev.so.21.2
> lib/librte_eal.so.21.2 lib/librte_kvargs.so.21.2
> lib/librte_telemetry.so.21.2 lib/librte_ring.so.21.2
> lib/librte_ethdev.so.21.2 lib/librte_net.so.21.2 lib/librte_mbuf.so.21.2
> lib/librte_mempool.so.21.2 lib/librte_meter.so.21.2
> lib/librte_hash.so.21.2 lib/librte_rcu.so.21.2 lib/librte_timer.so.21.2
> lib/librte_cryptodev.so.21.2 drivers/librte_bus_vdev.so.21.2
> -Wl,--end-group
> -Wl,--version-script=/home/drc/src/dpdk/drivers/event/dsw/version.map
> '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/'
> -Wl,-rpath-link,/home/drc/src/dpdk/build/lib:/home/drc/src/dpdk/build/drivers
> drivers/a715181@@tmp_rte_event_dsw@sta/event_dsw_dsw_evdev.c.o: In
> function `dsw_start':
> dsw_evdev.c:(.text+0x1078): undefined reference to `__ppc_get_timebase'
> collect2: error: ld returned 1 exit status
> [2359/2455] Compiling C object
> 'app/test/3062f5d@@dpdk-test@exe/test_trace_perf.c.o'.
> In file included from ../app/test/test_trace_perf.c:5:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit
> declaration of function ‘__ppc_get_timebase’; did you mean
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
> return __ppc_get_timebase();
> ^~~~~~~~~~~~~~~~~~
> __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [2366/2455] Compiling C object
> 'drivers/a715181@@tmp_rte_event_octeontx2@sta/event_octeontx2_otx2_worker_dual.c.o'.
> ninja: build stopped: subcommand failed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
2021-03-22 23:42 ` Piotr Kubaj
@ 2021-05-05 14:58 ` David Marchand
[not found] ` <YJMes69UJORrjT1G@KGPE-D16>
0 siblings, 1 reply; 9+ messages in thread
From: David Marchand @ 2021-05-05 14:58 UTC (permalink / raw)
To: Piotr Kubaj
Cc: David Christensen, Piotr Kubaj, Nicolas Chautru, Declan Doherty,
Ajit Khaparde, Somnath Kotur, Beilei Xing, Jeff Guo, Wang,
Haiyue, Jiawen Wu, Jian Wang, dev
On Tue, Mar 23, 2021 at 6:48 PM Piotr Kubaj <pkubaj@anongoth.pl> wrote:
>
> Looks like I forgot to commit the change that includes headers for sysctlbyname().
>
> Patch attached.
The mailing list drops attachments.
Please submit a v2.
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
[not found] ` <YJMes69UJORrjT1G@KGPE-D16>
@ 2021-05-07 20:28 ` David Christensen
2021-05-07 20:30 ` David Christensen
1 sibling, 0 replies; 9+ messages in thread
From: David Christensen @ 2021-05-07 20:28 UTC (permalink / raw)
To: Piotr Kubaj, David Marchand
Cc: Nicolas Chautru, Declan Doherty, Ajit Khaparde, Somnath Kotur,
Beilei Xing, Jeff Guo, Wang, Haiyue, Jiawen Wu, Jian Wang, dev
On 5/5/21 3:39 PM, Piotr Kubaj wrote:
> diff --git a/lib/librte_eal/ppc/include/rte_altivec.h b/lib/librte_eal/ppc/include/rte_altivec.h
> index 1551a9454..3fcc819c1 100644
> --- a/lib/librte_eal/ppc/include/rte_altivec.h
> +++ b/lib/librte_eal/ppc/include/rte_altivec.h
> @@ -7,6 +7,9 @@
> #define_RTE_ALTIVEC_H_
>
> /* To include altivec.h, GCC version must be >= 4.8 */
> +#ifdef __clang__
> +#define vector __vector
> +#endif
> #include <altivec.h>
>
> /*
> diff --git a/lib/librte_eal/ppc/include/rte_cycles.h b/lib/librte_eal/ppc/include/rte_cycles.h
> index 5585f9273..a8307ceaf 100644
> --- a/lib/librte_eal/ppc/include/rte_cycles.h
> +++ b/lib/librte_eal/ppc/include/rte_cycles.h
> @@ -10,7 +10,13 @@
> extern "C" {
> #endif
>
> +#ifdef linux
> +#include <features.h>
> +#endif
> +
> +#ifdef __GLIBC__
> #include <sys/platform/ppc.h>
> +#endif
>
> #include "generic/rte_cycles.h"
>
> @@ -26,7 +32,13 @@ extern "C" {
> static inline uint64_t
> rte_rdtsc(void)
> {
> +#ifdef __GLIBC__
> return __ppc_get_timebase();
> +#else
> + uint64_t __tb;
> + __asm__ volatile ("mfspr %0, 268" : "=r" (__tb));
> + return __tb;
> +#endif
> }
>
> static inline uint64_t
> diff --git a/lib/librte_eal/ppc/rte_cycles.c b/lib/librte_eal/ppc/rte_cycles.c
> index 3180adb0f..48545c4d6 100644
> --- a/lib/librte_eal/ppc/rte_cycles.c
> +++ b/lib/librte_eal/ppc/rte_cycles.c
> @@ -2,12 +2,28 @@
> * Copyright (C) IBM Corporation 2019.
> */
>
> +#ifdef linux
> +#include <features.h>
> +#elif defined(__FreeBSD__)
> +#include <sys/types.h>
> +#include <sys/sysctl.h>
> +#endif
> +
> +#ifdef __GLIBC__
> #include <sys/platform/ppc.h>
> +#endif
>
> #include "eal_private.h"
>
> uint64_t
> get_tsc_freq_arch(void)
> {
> +#ifdef __GLIBC__
> return __ppc_get_timebase_freq();
> +#elif defined(__FreeBSD__)
> + uint64_t freq;
> + size_t length = sizeof(freq);
> + sysctlbyname("kern.timecounter.tc.timebase.frequency", &freq, &length, NULL, 0);
> + return freq;
> +#endif
> }
> --
> 2.31.0
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
[not found] ` <YJMes69UJORrjT1G@KGPE-D16>
2021-05-07 20:28 ` David Christensen
@ 2021-05-07 20:30 ` David Christensen
[not found] ` <YJXae53gvmmXwY4n@KGPE-D16>
1 sibling, 1 reply; 9+ messages in thread
From: David Christensen @ 2021-05-07 20:30 UTC (permalink / raw)
To: Piotr Kubaj, David Marchand
Cc: Nicolas Chautru, Declan Doherty, Ajit Khaparde, Somnath Kotur,
Beilei Xing, Jeff Guo, Wang, Haiyue, Jiawen Wu, Jian Wang, dev
On 5/5/21 3:39 PM, Piotr Kubaj wrote:
> lib/librte_eal/ppc/include/rte_altivec.h | 3 +++
> lib/librte_eal/ppc/include/rte_cycles.h | 12 ++++++++++++
> lib/librte_eal/ppc/rte_cycles.c | 16 ++++++++++++++++
Directory path "librte_eal" has been changed to "eal" so a v3 patch is
likely needed.
Dave
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc
[not found] ` <YJXae53gvmmXwY4n@KGPE-D16>
@ 2021-05-11 14:02 ` David Marchand
0 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2021-05-11 14:02 UTC (permalink / raw)
To: Piotr Kubaj
Cc: David Christensen, Nicolas Chautru, Declan Doherty,
Ajit Khaparde, Somnath Kotur, Beilei Xing, Jeff Guo, Wang,
Haiyue, Jiawen Wu, Jian Wang, dev
On Sat, May 8, 2021 at 2:25 AM Piotr Kubaj <pkubaj@anongoth.pl> wrote:
>
> Including below.
> From 87ad59cc894b227444936fb6a7968932abdc460f Mon Sep 17 00:00:00 2001
> From: Piotr Kubaj <pkubaj@FreeBSD.org>
> Date: Tue, 23 Mar 2021 00:40:47 +0100
> Subject: [PATCH] ppc64le: fix build without glibc
>
> __ppc_get_timebase() is only present when glibc is used.
>
> Signed-off-by: Piotr Kubaj <pkubaj@FreeBSD.org>
I can't find this new revision of the patch in patchwork and I am not sure why.
Please, send this patch like you did for your v1, but properly
versioned v3 (if I counted correctly).
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-05-11 14:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 16:11 [dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc Piotr Kubaj
2021-03-11 20:58 ` Ajit Khaparde
2021-03-15 19:48 ` David Christensen
2021-03-22 20:14 ` Piotr Kubaj
2021-03-22 23:42 ` Piotr Kubaj
2021-05-05 14:58 ` David Marchand
[not found] ` <YJMes69UJORrjT1G@KGPE-D16>
2021-05-07 20:28 ` David Christensen
2021-05-07 20:30 ` David Christensen
[not found] ` <YJXae53gvmmXwY4n@KGPE-D16>
2021-05-11 14:02 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).