avoid AltiVec keyword vector
The AltiVec header file is defining "vector", except in C++ build. The keyword "vector" may conflict easily. As a rule, it is better to use the alternative keyword "__vector", so we will be able to #undef vector after including AltiVec header. Later it may become possible to #undef vector in rte_altivec.h with a compatibility breakage. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
This commit is contained in:
parent
36edf3cc9b
commit
64fcadeac0
@ -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 long hdr_room = (__vector unsigned long){
|
||||
RTE_PKTMBUF_HEADROOM,
|
||||
RTE_PKTMBUF_HEADROOM};
|
||||
vector unsigned long dma_addr0, dma_addr1;
|
||||
__vector unsigned long 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 long){};
|
||||
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 long *)&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 long 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 long *)&mb0->buf_addr);
|
||||
vaddr1 = vec_ld(0, (__vector unsigned long *)&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 long *)&rxdp++->read);
|
||||
vec_st(dma_addr1, 0, (__vector unsigned long *)&rxdp++->read);
|
||||
}
|
||||
|
||||
rxq->rxrearm_start += RTE_I40E_RXQ_REARM_THRESH;
|
||||
@ -102,32 +102,32 @@ 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 long descs[4], struct rte_mbuf **rx_pkts)
|
||||
{
|
||||
vector unsigned int vlan0, vlan1, rss, l3_l4e;
|
||||
__vector unsigned int vlan0, vlan1, rss, l3_l4e;
|
||||
|
||||
/* mask everything except RSS, flow director and VLAN flags
|
||||
* bit2 is for VLAN tag, bit11 for flow director indication
|
||||
* bit13:12 for RSS indication.
|
||||
*/
|
||||
const vector unsigned int rss_vlan_msk = (vector unsigned int){
|
||||
const __vector unsigned int rss_vlan_msk = (__vector unsigned int){
|
||||
(int32_t)0x1c03804, (int32_t)0x1c03804,
|
||||
(int32_t)0x1c03804, (int32_t)0x1c03804};
|
||||
|
||||
/* map rss and vlan type to rss hash and vlan flag */
|
||||
const vector unsigned char vlan_flags = (vector unsigned char){
|
||||
const __vector unsigned char vlan_flags = (__vector unsigned char){
|
||||
0, 0, 0, 0,
|
||||
RTE_MBUF_F_RX_VLAN | RTE_MBUF_F_RX_VLAN_STRIPPED, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0};
|
||||
|
||||
const vector unsigned char rss_flags = (vector unsigned char){
|
||||
const __vector unsigned char rss_flags = (__vector unsigned char){
|
||||
0, RTE_MBUF_F_RX_FDIR, 0, 0,
|
||||
0, 0, RTE_MBUF_F_RX_RSS_HASH, RTE_MBUF_F_RX_RSS_HASH | RTE_MBUF_F_RX_FDIR,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0};
|
||||
|
||||
const vector unsigned char l3_l4e_flags = (vector unsigned char){
|
||||
const __vector unsigned char l3_l4e_flags = (__vector unsigned char){
|
||||
0,
|
||||
RTE_MBUF_F_RX_IP_CKSUM_BAD,
|
||||
RTE_MBUF_F_RX_L4_CKSUM_BAD,
|
||||
@ -139,23 +139,23 @@ desc_to_olflags_v(vector unsigned long descs[4], struct rte_mbuf **rx_pkts)
|
||||
| RTE_MBUF_F_RX_IP_CKSUM_BAD,
|
||||
0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
vlan0 = (vector unsigned int)vec_mergel(descs[0], descs[1]);
|
||||
vlan1 = (vector unsigned int)vec_mergel(descs[2], descs[3]);
|
||||
vlan0 = (vector unsigned int)vec_mergeh(vlan0, vlan1);
|
||||
vlan0 = (__vector unsigned int)vec_mergel(descs[0], descs[1]);
|
||||
vlan1 = (__vector unsigned int)vec_mergel(descs[2], descs[3]);
|
||||
vlan0 = (__vector unsigned int)vec_mergeh(vlan0, vlan1);
|
||||
|
||||
vlan1 = vec_and(vlan0, rss_vlan_msk);
|
||||
vlan0 = (vector unsigned int)vec_perm(vlan_flags,
|
||||
(vector unsigned char){},
|
||||
*(vector unsigned char *)&vlan1);
|
||||
vlan0 = (__vector unsigned int)vec_perm(vlan_flags,
|
||||
(__vector unsigned char){},
|
||||
*(__vector unsigned char *)&vlan1);
|
||||
|
||||
rss = vec_sr(vlan1, (vector unsigned int){11, 11, 11, 11});
|
||||
rss = (vector unsigned int)vec_perm(rss_flags, (vector unsigned char){},
|
||||
*(vector unsigned char *)&rss);
|
||||
rss = vec_sr(vlan1, (__vector unsigned int){11, 11, 11, 11});
|
||||
rss = (__vector unsigned int)vec_perm(rss_flags, (__vector unsigned char){},
|
||||
*(__vector unsigned char *)&rss);
|
||||
|
||||
l3_l4e = vec_sr(vlan1, (vector unsigned int){22, 22, 22, 22});
|
||||
l3_l4e = (vector unsigned int)vec_perm(l3_l4e_flags,
|
||||
(vector unsigned char){},
|
||||
*(vector unsigned char *)&l3_l4e);
|
||||
l3_l4e = vec_sr(vlan1, (__vector unsigned int){22, 22, 22, 22});
|
||||
l3_l4e = (__vector unsigned int)vec_perm(l3_l4e_flags,
|
||||
(__vector unsigned char){},
|
||||
*(__vector unsigned char *)&l3_l4e);
|
||||
|
||||
vlan0 = vec_or(vlan0, rss);
|
||||
vlan0 = vec_or(vlan0, l3_l4e);
|
||||
@ -169,23 +169,23 @@ 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 long 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 long ptype0 = vec_mergel(descs[0], descs[1]);
|
||||
__vector unsigned long 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 long){30, 30});
|
||||
ptype1 = vec_sr(ptype1, (__vector unsigned long){30, 30});
|
||||
|
||||
rx_pkts[0]->packet_type =
|
||||
ptype_tbl[(*(vector unsigned char *)&ptype0)[0]];
|
||||
ptype_tbl[(*(__vector unsigned char *)&ptype0)[0]];
|
||||
rx_pkts[1]->packet_type =
|
||||
ptype_tbl[(*(vector unsigned char *)&ptype0)[8]];
|
||||
ptype_tbl[(*(__vector unsigned char *)&ptype0)[8]];
|
||||
rx_pkts[2]->packet_type =
|
||||
ptype_tbl[(*(vector unsigned char *)&ptype1)[0]];
|
||||
ptype_tbl[(*(__vector unsigned char *)&ptype1)[0]];
|
||||
rx_pkts[3]->packet_type =
|
||||
ptype_tbl[(*(vector unsigned char *)&ptype1)[8]];
|
||||
ptype_tbl[(*(__vector unsigned char *)&ptype1)[8]];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -204,17 +204,17 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
|
||||
uint16_t nb_pkts_recd;
|
||||
int pos;
|
||||
uint64_t var;
|
||||
vector unsigned char shuf_msk;
|
||||
__vector unsigned char shuf_msk;
|
||||
uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
|
||||
|
||||
vector unsigned short crc_adjust = (vector unsigned short){
|
||||
__vector unsigned short crc_adjust = (__vector unsigned short){
|
||||
0, 0, /* ignore pkt_type field */
|
||||
rxq->crc_len, /* sub crc on pkt_len */
|
||||
0, /* ignore high-16bits of pkt_len */
|
||||
rxq->crc_len, /* sub crc on data_len */
|
||||
0, 0, 0 /* ignore non-length fields */
|
||||
};
|
||||
vector unsigned long dd_check, eop_check;
|
||||
__vector unsigned long 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,15 +240,15 @@ _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 long){0x0000000100000001ULL,
|
||||
0x0000000100000001ULL};
|
||||
|
||||
/* 4 packets EOP mask */
|
||||
eop_check = (vector unsigned long){0x0000000200000002ULL,
|
||||
eop_check = (__vector unsigned long){0x0000000200000002ULL,
|
||||
0x0000000200000002ULL};
|
||||
|
||||
/* mask to shuffle from desc. to mbuf */
|
||||
shuf_msk = (vector unsigned char){
|
||||
shuf_msk = (__vector unsigned char){
|
||||
0xFF, 0xFF, /* pkt_type set as unknown */
|
||||
0xFF, 0xFF, /* pkt_type set as unknown */
|
||||
14, 15, /* octet 15~14, low 16 bits pkt_len */
|
||||
@ -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 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 long 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
|
||||
* in one XMM reg.
|
||||
*/
|
||||
|
||||
/* B.1 load 2 mbuf point */
|
||||
mbp1 = *(vector unsigned long *)&sw_ring[pos];
|
||||
mbp1 = *(__vector unsigned long *)&sw_ring[pos];
|
||||
/* Read desc statuses backwards to avoid race condition */
|
||||
/* A.1 load desc[3] */
|
||||
descs[3] = *(vector unsigned long *)(rxdp + 3);
|
||||
descs[3] = *(__vector unsigned long *)(rxdp + 3);
|
||||
rte_compiler_barrier();
|
||||
|
||||
/* B.2 copy 2 mbuf point into rx_pkts */
|
||||
*(vector unsigned long *)&rx_pkts[pos] = mbp1;
|
||||
*(__vector unsigned long *)&rx_pkts[pos] = mbp1;
|
||||
|
||||
/* B.1 load 2 mbuf point */
|
||||
mbp2 = *(vector unsigned long *)&sw_ring[pos + 2];
|
||||
mbp2 = *(__vector unsigned long *)&sw_ring[pos + 2];
|
||||
|
||||
/* A.1 load desc[2-0] */
|
||||
descs[2] = *(vector unsigned long *)(rxdp + 2);
|
||||
descs[2] = *(__vector unsigned long *)(rxdp + 2);
|
||||
rte_compiler_barrier();
|
||||
descs[1] = *(vector unsigned long *)(rxdp + 1);
|
||||
descs[1] = *(__vector unsigned long *)(rxdp + 1);
|
||||
rte_compiler_barrier();
|
||||
descs[0] = *(vector unsigned long *)(rxdp);
|
||||
descs[0] = *(__vector unsigned long *)(rxdp);
|
||||
|
||||
/* B.2 copy 2 mbuf point into rx_pkts */
|
||||
*(vector unsigned long *)&rx_pkts[pos + 2] = mbp2;
|
||||
*(__vector unsigned long *)&rx_pkts[pos + 2] = mbp2;
|
||||
|
||||
if (split_packet) {
|
||||
rte_mbuf_prefetch_part2(rx_pkts[pos]);
|
||||
@ -315,78 +315,78 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
|
||||
rte_compiler_barrier();
|
||||
|
||||
/* pkt 3,4 shift the pktlen field to be 16-bit aligned*/
|
||||
const vector unsigned int len3 = vec_sl(
|
||||
vec_ld(0, (vector unsigned int *)&descs[3]),
|
||||
(vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
|
||||
const __vector unsigned int len3 = vec_sl(
|
||||
vec_ld(0, (__vector unsigned int *)&descs[3]),
|
||||
(__vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
|
||||
|
||||
const vector unsigned int len2 = vec_sl(
|
||||
vec_ld(0, (vector unsigned int *)&descs[2]),
|
||||
(vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
|
||||
const __vector unsigned int len2 = vec_sl(
|
||||
vec_ld(0, (__vector unsigned int *)&descs[2]),
|
||||
(__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 long)len3;
|
||||
descs[2] = (__vector unsigned long)len2;
|
||||
|
||||
/* D.1 pkt 3,4 convert format from desc to pktmbuf */
|
||||
pkt_mb4 = vec_perm((vector unsigned char)descs[3],
|
||||
(vector unsigned char){}, shuf_msk);
|
||||
pkt_mb3 = vec_perm((vector unsigned char)descs[2],
|
||||
(vector unsigned char){}, shuf_msk);
|
||||
pkt_mb4 = vec_perm((__vector unsigned char)descs[3],
|
||||
(__vector unsigned char){}, shuf_msk);
|
||||
pkt_mb3 = vec_perm((__vector unsigned char)descs[2],
|
||||
(__vector unsigned char){}, shuf_msk);
|
||||
|
||||
/* C.1 4=>2 filter staterr info only */
|
||||
sterr_tmp2 = vec_mergel((vector unsigned short)descs[3],
|
||||
(vector unsigned short)descs[2]);
|
||||
sterr_tmp2 = vec_mergel((__vector unsigned short)descs[3],
|
||||
(__vector unsigned short)descs[2]);
|
||||
/* C.1 4=>2 filter staterr info only */
|
||||
sterr_tmp1 = vec_mergel((vector unsigned short)descs[1],
|
||||
(vector unsigned short)descs[0]);
|
||||
sterr_tmp1 = vec_mergel((__vector unsigned short)descs[1],
|
||||
(__vector unsigned short)descs[0]);
|
||||
/* D.2 pkt 3,4 set in_port/nb_seg and remove crc */
|
||||
pkt_mb4 = (vector unsigned char)vec_sub(
|
||||
(vector unsigned short)pkt_mb4, crc_adjust);
|
||||
pkt_mb3 = (vector unsigned char)vec_sub(
|
||||
(vector unsigned short)pkt_mb3, crc_adjust);
|
||||
pkt_mb4 = (__vector unsigned char)vec_sub(
|
||||
(__vector unsigned short)pkt_mb4, crc_adjust);
|
||||
pkt_mb3 = (__vector unsigned char)vec_sub(
|
||||
(__vector unsigned short)pkt_mb3, crc_adjust);
|
||||
|
||||
/* pkt 1,2 shift the pktlen field to be 16-bit aligned*/
|
||||
const vector unsigned int len1 = vec_sl(
|
||||
vec_ld(0, (vector unsigned int *)&descs[1]),
|
||||
(vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
|
||||
const vector unsigned int len0 = vec_sl(
|
||||
vec_ld(0, (vector unsigned int *)&descs[0]),
|
||||
(vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
|
||||
const __vector unsigned int len1 = vec_sl(
|
||||
vec_ld(0, (__vector unsigned int *)&descs[1]),
|
||||
(__vector unsigned int){0, 0, 0, PKTLEN_SHIFT});
|
||||
const __vector unsigned int len0 = vec_sl(
|
||||
vec_ld(0, (__vector unsigned int *)&descs[0]),
|
||||
(__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 long)len1;
|
||||
descs[0] = (__vector unsigned long)len0;
|
||||
|
||||
/* D.1 pkt 1,2 convert format from desc to pktmbuf */
|
||||
pkt_mb2 = vec_perm((vector unsigned char)descs[1],
|
||||
(vector unsigned char){}, shuf_msk);
|
||||
pkt_mb1 = vec_perm((vector unsigned char)descs[0],
|
||||
(vector unsigned char){}, shuf_msk);
|
||||
pkt_mb2 = vec_perm((__vector unsigned char)descs[1],
|
||||
(__vector unsigned char){}, shuf_msk);
|
||||
pkt_mb1 = vec_perm((__vector unsigned char)descs[0],
|
||||
(__vector unsigned char){}, shuf_msk);
|
||||
|
||||
/* C.2 get 4 pkts staterr value */
|
||||
staterr = (vector unsigned short)vec_mergeh(
|
||||
staterr = (__vector unsigned short)vec_mergeh(
|
||||
sterr_tmp1, sterr_tmp2);
|
||||
|
||||
/* D.3 copy final 3,4 data to rx_pkts */
|
||||
vec_st(pkt_mb4, 0,
|
||||
(vector unsigned char *)&rx_pkts[pos + 3]
|
||||
(__vector unsigned char *)&rx_pkts[pos + 3]
|
||||
->rx_descriptor_fields1
|
||||
);
|
||||
vec_st(pkt_mb3, 0,
|
||||
(vector unsigned char *)&rx_pkts[pos + 2]
|
||||
(__vector unsigned char *)&rx_pkts[pos + 2]
|
||||
->rx_descriptor_fields1
|
||||
);
|
||||
|
||||
/* D.2 pkt 1,2 set in_port/nb_seg and remove crc */
|
||||
pkt_mb2 = (vector unsigned char)vec_sub(
|
||||
(vector unsigned short)pkt_mb2, crc_adjust);
|
||||
pkt_mb1 = (vector unsigned char)vec_sub(
|
||||
(vector unsigned short)pkt_mb1, crc_adjust);
|
||||
pkt_mb2 = (__vector unsigned char)vec_sub(
|
||||
(__vector unsigned short)pkt_mb2, crc_adjust);
|
||||
pkt_mb1 = (__vector unsigned char)vec_sub(
|
||||
(__vector unsigned short)pkt_mb1, crc_adjust);
|
||||
|
||||
/* C* extract and record EOP bit */
|
||||
if (split_packet) {
|
||||
vector unsigned char eop_shuf_mask =
|
||||
(vector unsigned char){
|
||||
__vector unsigned char eop_shuf_mask =
|
||||
(__vector unsigned char){
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
@ -394,19 +394,19 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
|
||||
};
|
||||
|
||||
/* and with mask to extract bits, flipping 1-0 */
|
||||
vector unsigned char eop_bits = vec_and(
|
||||
(vector unsigned char)vec_nor(staterr, staterr),
|
||||
(vector unsigned char)eop_check);
|
||||
__vector unsigned char eop_bits = vec_and(
|
||||
(__vector unsigned char)vec_nor(staterr, staterr),
|
||||
(__vector unsigned char)eop_check);
|
||||
/* the staterr values are not in order, as the count
|
||||
* of dd bits doesn't care. However, for end of
|
||||
* packet tracking, we do care, so shuffle. This also
|
||||
* compresses the 32-bit values to 8-bit
|
||||
*/
|
||||
eop_bits = vec_perm(eop_bits, (vector unsigned char){},
|
||||
eop_bits = vec_perm(eop_bits, (__vector unsigned char){},
|
||||
eop_shuf_mask);
|
||||
/* store the resulting 32-bit value */
|
||||
*split_packet = (vec_ld(0,
|
||||
(vector unsigned int *)&eop_bits))[0];
|
||||
(__vector unsigned int *)&eop_bits))[0];
|
||||
split_packet += RTE_I40E_DESCS_PER_LOOP;
|
||||
|
||||
/* zero-out next pointers */
|
||||
@ -417,22 +417,22 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
|
||||
}
|
||||
|
||||
/* C.3 calc available number of desc */
|
||||
staterr = vec_and(staterr, (vector unsigned short)dd_check);
|
||||
staterr = vec_and(staterr, (__vector unsigned short)dd_check);
|
||||
|
||||
/* D.3 copy final 1,2 data to rx_pkts */
|
||||
vec_st(pkt_mb2, 0,
|
||||
(vector unsigned char *)&rx_pkts[pos + 1]
|
||||
(__vector unsigned char *)&rx_pkts[pos + 1]
|
||||
->rx_descriptor_fields1
|
||||
);
|
||||
vec_st(pkt_mb1, 0,
|
||||
(vector unsigned char *)&rx_pkts[pos]->rx_descriptor_fields1
|
||||
(__vector unsigned char *)&rx_pkts[pos]->rx_descriptor_fields1
|
||||
);
|
||||
desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl);
|
||||
desc_to_olflags_v(descs, &rx_pkts[pos]);
|
||||
|
||||
/* C.4 calc available number of desc */
|
||||
var = __builtin_popcountll((vec_ld(0,
|
||||
(vector unsigned long *)&staterr)[0]));
|
||||
(__vector unsigned long *)&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 long descriptor = (__vector unsigned long){
|
||||
pkt->buf_iova + pkt->data_off, high_qw};
|
||||
*(vector unsigned long *)txdp = descriptor;
|
||||
*(__vector unsigned long *)txdp = descriptor;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -50,9 +50,9 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
|
||||
struct rte_mbuf **sw_ring_end;
|
||||
struct rte_mbuf **ref_rx_pkts;
|
||||
uint16_t nb_pkts_received = 0;
|
||||
const vector unsigned char zero = {0};
|
||||
const __vector unsigned char zero = {0};
|
||||
|
||||
const vector unsigned char shuf_msk1 = {
|
||||
const __vector unsigned char shuf_msk1 = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, /* packet type */
|
||||
4, 5, 0xFF, 0xFF, /* vlan tci */
|
||||
4, 5, /* dat len */
|
||||
@ -60,7 +60,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
|
||||
0xFF, 0xFF, 0xFF, 0xFF
|
||||
};
|
||||
|
||||
const vector unsigned char shuf_msk2 = {
|
||||
const __vector unsigned char shuf_msk2 = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, /* packet type */
|
||||
12, 13, 0xFF, 0xFF, /* pkt len */
|
||||
12, 13, /* dat len */
|
||||
@ -72,7 +72,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
|
||||
* Subtract the header length.
|
||||
* In which case do we need the header length in used->len ?
|
||||
*/
|
||||
const vector unsigned short len_adjust = {
|
||||
const __vector unsigned short len_adjust = {
|
||||
0, 0,
|
||||
(uint16_t)-vq->hw->vtnet_hdr_size, 0,
|
||||
(uint16_t)-vq->hw->vtnet_hdr_size, 0,
|
||||
@ -112,68 +112,68 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
|
||||
ref_rx_pkts = rx_pkts;
|
||||
for (nb_pkts_received = 0;
|
||||
nb_pkts_received < nb_total;) {
|
||||
vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
|
||||
vector unsigned char mbp[RTE_VIRTIO_DESC_PER_LOOP / 2];
|
||||
vector unsigned char pkt_mb[RTE_VIRTIO_DESC_PER_LOOP];
|
||||
__vector unsigned char desc[RTE_VIRTIO_DESC_PER_LOOP / 2];
|
||||
__vector unsigned char mbp[RTE_VIRTIO_DESC_PER_LOOP / 2];
|
||||
__vector unsigned char pkt_mb[RTE_VIRTIO_DESC_PER_LOOP];
|
||||
|
||||
mbp[0] = vec_vsx_ld(0, (unsigned char const *)(sw_ring + 0));
|
||||
desc[0] = vec_vsx_ld(0, (unsigned char const *)(rused + 0));
|
||||
*(vector unsigned char *)&rx_pkts[0] = mbp[0];
|
||||
*(__vector unsigned char *)&rx_pkts[0] = mbp[0];
|
||||
|
||||
mbp[1] = vec_vsx_ld(0, (unsigned char const *)(sw_ring + 2));
|
||||
desc[1] = vec_vsx_ld(0, (unsigned char const *)(rused + 2));
|
||||
*(vector unsigned char *)&rx_pkts[2] = mbp[1];
|
||||
*(__vector unsigned char *)&rx_pkts[2] = mbp[1];
|
||||
|
||||
mbp[2] = vec_vsx_ld(0, (unsigned char const *)(sw_ring + 4));
|
||||
desc[2] = vec_vsx_ld(0, (unsigned char const *)(rused + 4));
|
||||
*(vector unsigned char *)&rx_pkts[4] = mbp[2];
|
||||
*(__vector unsigned char *)&rx_pkts[4] = mbp[2];
|
||||
|
||||
mbp[3] = vec_vsx_ld(0, (unsigned char const *)(sw_ring + 6));
|
||||
desc[3] = vec_vsx_ld(0, (unsigned char const *)(rused + 6));
|
||||
*(vector unsigned char *)&rx_pkts[6] = mbp[3];
|
||||
*(__vector unsigned char *)&rx_pkts[6] = mbp[3];
|
||||
|
||||
pkt_mb[0] = vec_perm(desc[0], zero, shuf_msk1);
|
||||
pkt_mb[1] = vec_perm(desc[0], zero, shuf_msk2);
|
||||
pkt_mb[0] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[0] + len_adjust);
|
||||
pkt_mb[1] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[1] + len_adjust);
|
||||
*(vector unsigned char *)&rx_pkts[0]->rx_descriptor_fields1 =
|
||||
pkt_mb[0] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[0] + len_adjust);
|
||||
pkt_mb[1] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[1] + len_adjust);
|
||||
*(__vector unsigned char *)&rx_pkts[0]->rx_descriptor_fields1 =
|
||||
pkt_mb[0];
|
||||
*(vector unsigned char *)&rx_pkts[1]->rx_descriptor_fields1 =
|
||||
*(__vector unsigned char *)&rx_pkts[1]->rx_descriptor_fields1 =
|
||||
pkt_mb[1];
|
||||
|
||||
pkt_mb[2] = vec_perm(desc[1], zero, shuf_msk1);
|
||||
pkt_mb[3] = vec_perm(desc[1], zero, shuf_msk2);
|
||||
pkt_mb[2] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[2] + len_adjust);
|
||||
pkt_mb[3] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[3] + len_adjust);
|
||||
*(vector unsigned char *)&rx_pkts[2]->rx_descriptor_fields1 =
|
||||
pkt_mb[2] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[2] + len_adjust);
|
||||
pkt_mb[3] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[3] + len_adjust);
|
||||
*(__vector unsigned char *)&rx_pkts[2]->rx_descriptor_fields1 =
|
||||
pkt_mb[2];
|
||||
*(vector unsigned char *)&rx_pkts[3]->rx_descriptor_fields1 =
|
||||
*(__vector unsigned char *)&rx_pkts[3]->rx_descriptor_fields1 =
|
||||
pkt_mb[3];
|
||||
|
||||
pkt_mb[4] = vec_perm(desc[2], zero, shuf_msk1);
|
||||
pkt_mb[5] = vec_perm(desc[2], zero, shuf_msk2);
|
||||
pkt_mb[4] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[4] + len_adjust);
|
||||
pkt_mb[5] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[5] + len_adjust);
|
||||
*(vector unsigned char *)&rx_pkts[4]->rx_descriptor_fields1 =
|
||||
pkt_mb[4] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[4] + len_adjust);
|
||||
pkt_mb[5] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[5] + len_adjust);
|
||||
*(__vector unsigned char *)&rx_pkts[4]->rx_descriptor_fields1 =
|
||||
pkt_mb[4];
|
||||
*(vector unsigned char *)&rx_pkts[5]->rx_descriptor_fields1 =
|
||||
*(__vector unsigned char *)&rx_pkts[5]->rx_descriptor_fields1 =
|
||||
pkt_mb[5];
|
||||
|
||||
pkt_mb[6] = vec_perm(desc[3], zero, shuf_msk1);
|
||||
pkt_mb[7] = vec_perm(desc[3], zero, shuf_msk2);
|
||||
pkt_mb[6] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[6] + len_adjust);
|
||||
pkt_mb[7] = (vector unsigned char)
|
||||
((vector unsigned short)pkt_mb[7] + len_adjust);
|
||||
*(vector unsigned char *)&rx_pkts[6]->rx_descriptor_fields1 =
|
||||
pkt_mb[6] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[6] + len_adjust);
|
||||
pkt_mb[7] = (__vector unsigned char)
|
||||
((__vector unsigned short)pkt_mb[7] + len_adjust);
|
||||
*(__vector unsigned char *)&rx_pkts[6]->rx_descriptor_fields1 =
|
||||
pkt_mb[6];
|
||||
*(vector unsigned char *)&rx_pkts[7]->rx_descriptor_fields1 =
|
||||
*(__vector unsigned char *)&rx_pkts[7]->rx_descriptor_fields1 =
|
||||
pkt_mb[7];
|
||||
|
||||
if (unlikely(nb_used <= RTE_VIRTIO_DESC_PER_LOOP)) {
|
||||
|
@ -17,50 +17,50 @@
|
||||
static inline void
|
||||
processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
|
||||
{
|
||||
vector unsigned int te[FWDSTEP];
|
||||
vector unsigned int ve[FWDSTEP];
|
||||
vector unsigned int *p[FWDSTEP];
|
||||
__vector unsigned int te[FWDSTEP];
|
||||
__vector unsigned int ve[FWDSTEP];
|
||||
__vector unsigned int *p[FWDSTEP];
|
||||
|
||||
p[0] = rte_pktmbuf_mtod(pkt[0], vector unsigned int *);
|
||||
p[1] = rte_pktmbuf_mtod(pkt[1], vector unsigned int *);
|
||||
p[2] = rte_pktmbuf_mtod(pkt[2], vector unsigned int *);
|
||||
p[3] = rte_pktmbuf_mtod(pkt[3], vector unsigned int *);
|
||||
p[0] = rte_pktmbuf_mtod(pkt[0], __vector unsigned int *);
|
||||
p[1] = rte_pktmbuf_mtod(pkt[1], __vector unsigned int *);
|
||||
p[2] = rte_pktmbuf_mtod(pkt[2], __vector unsigned int *);
|
||||
p[3] = rte_pktmbuf_mtod(pkt[3], __vector unsigned int *);
|
||||
|
||||
ve[0] = (vector unsigned int)val_eth[dst_port[0]];
|
||||
ve[0] = (__vector unsigned int)val_eth[dst_port[0]];
|
||||
te[0] = *p[0];
|
||||
|
||||
ve[1] = (vector unsigned int)val_eth[dst_port[1]];
|
||||
ve[1] = (__vector unsigned int)val_eth[dst_port[1]];
|
||||
te[1] = *p[1];
|
||||
|
||||
ve[2] = (vector unsigned int)val_eth[dst_port[2]];
|
||||
ve[2] = (__vector unsigned int)val_eth[dst_port[2]];
|
||||
te[2] = *p[2];
|
||||
|
||||
ve[3] = (vector unsigned int)val_eth[dst_port[3]];
|
||||
ve[3] = (__vector unsigned int)val_eth[dst_port[3]];
|
||||
te[3] = *p[3];
|
||||
|
||||
/* Update first 12 bytes, keep rest bytes intact. */
|
||||
te[0] = (vector unsigned int)vec_sel(
|
||||
(vector unsigned short)ve[0],
|
||||
(vector unsigned short)te[0],
|
||||
(vector unsigned short) {0, 0, 0, 0,
|
||||
te[0] = (__vector unsigned int)vec_sel(
|
||||
(__vector unsigned short)ve[0],
|
||||
(__vector unsigned short)te[0],
|
||||
(__vector unsigned short) {0, 0, 0, 0,
|
||||
0, 0, 0xffff, 0xffff});
|
||||
|
||||
te[1] = (vector unsigned int)vec_sel(
|
||||
(vector unsigned short)ve[1],
|
||||
(vector unsigned short)te[1],
|
||||
(vector unsigned short) {0, 0, 0, 0,
|
||||
te[1] = (__vector unsigned int)vec_sel(
|
||||
(__vector unsigned short)ve[1],
|
||||
(__vector unsigned short)te[1],
|
||||
(__vector unsigned short) {0, 0, 0, 0,
|
||||
0, 0, 0xffff, 0xffff});
|
||||
|
||||
te[2] = (vector unsigned int)vec_sel(
|
||||
(vector unsigned short)ve[2],
|
||||
(vector unsigned short)te[2],
|
||||
(vector unsigned short) {0, 0, 0, 0, 0,
|
||||
te[2] = (__vector unsigned int)vec_sel(
|
||||
(__vector unsigned short)ve[2],
|
||||
(__vector unsigned short)te[2],
|
||||
(__vector unsigned short) {0, 0, 0, 0, 0,
|
||||
0, 0xffff, 0xffff});
|
||||
|
||||
te[3] = (vector unsigned int)vec_sel(
|
||||
(vector unsigned short)ve[3],
|
||||
(vector unsigned short)te[3],
|
||||
(vector unsigned short) {0, 0, 0, 0,
|
||||
te[3] = (__vector unsigned int)vec_sel(
|
||||
(__vector unsigned short)ve[3],
|
||||
(__vector unsigned short)te[3],
|
||||
(__vector unsigned short) {0, 0, 0, 0,
|
||||
0, 0, 0xffff, 0xffff});
|
||||
|
||||
*p[0] = te[0];
|
||||
@ -91,8 +91,9 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
|
||||
* This mask is used as an index into prebuild array of pnum values.
|
||||
*/
|
||||
static inline uint16_t *
|
||||
port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, vector unsigned short dp1,
|
||||
vector unsigned short dp2)
|
||||
port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp,
|
||||
__vector unsigned short dp1,
|
||||
__vector unsigned short dp2)
|
||||
{
|
||||
union {
|
||||
uint16_t u16[FWDSTEP + 1];
|
||||
@ -126,24 +127,24 @@ static inline void
|
||||
process_packet(struct rte_mbuf *pkt, uint16_t *dst_port)
|
||||
{
|
||||
struct rte_ether_hdr *eth_hdr;
|
||||
vector unsigned int te, ve;
|
||||
__vector unsigned int te, ve;
|
||||
|
||||
eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
|
||||
|
||||
te = *(vector unsigned int *)eth_hdr;
|
||||
ve = (vector unsigned int)val_eth[dst_port[0]];
|
||||
te = *(__vector unsigned int *)eth_hdr;
|
||||
ve = (__vector unsigned int)val_eth[dst_port[0]];
|
||||
|
||||
rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port,
|
||||
pkt->packet_type);
|
||||
|
||||
/* dynamically vec_sel te and ve for MASK_ETH (0x3f) */
|
||||
te = (vector unsigned int)vec_sel(
|
||||
(vector unsigned short)ve,
|
||||
(vector unsigned short)te,
|
||||
(vector unsigned short){0, 0, 0, 0,
|
||||
te = (__vector unsigned int)vec_sel(
|
||||
(__vector unsigned short)ve,
|
||||
(__vector unsigned short)te,
|
||||
(__vector unsigned short){0, 0, 0, 0,
|
||||
0, 0, 0xffff, 0xffff});
|
||||
|
||||
*(vector unsigned int *)eth_hdr = te;
|
||||
*(__vector unsigned int *)eth_hdr = te;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,7 +166,7 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
|
||||
*/
|
||||
k = RTE_ALIGN_FLOOR(nb_rx, FWDSTEP);
|
||||
if (k != 0) {
|
||||
vector unsigned short dp1, dp2;
|
||||
__vector unsigned short dp1, dp2;
|
||||
|
||||
lp = pnum;
|
||||
lp[0] = 1;
|
||||
@ -173,7 +174,7 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
|
||||
processx4_step3(pkts_burst, dst_port);
|
||||
|
||||
/* dp1: <d[0], d[1], d[2], d[3], ... > */
|
||||
dp1 = *(vector unsigned short *)dst_port;
|
||||
dp1 = *(__vector unsigned short *)dst_port;
|
||||
|
||||
for (j = FWDSTEP; j != k; j += FWDSTEP) {
|
||||
processx4_step3(&pkts_burst[j], &dst_port[j]);
|
||||
@ -182,7 +183,7 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
|
||||
* dp2:
|
||||
* <d[j-3], d[j-2], d[j-1], d[j], ... >
|
||||
*/
|
||||
dp2 = *((vector unsigned short *)
|
||||
dp2 = *((__vector unsigned short *)
|
||||
&dst_port[j - FWDSTEP + 1]);
|
||||
lp = port_groupx4(&pnum[j - FWDSTEP], lp, dp1, dp2);
|
||||
|
||||
@ -190,7 +191,7 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
|
||||
* dp1:
|
||||
* <d[j], d[j+1], d[j+2], d[j+3], ... >
|
||||
*/
|
||||
dp1 = vec_sro(dp2, (vector unsigned char) {
|
||||
dp1 = vec_sro(dp2, (__vector unsigned char) {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, (FWDSTEP - 1) * sizeof(dst_port[0])});
|
||||
}
|
||||
@ -198,8 +199,8 @@ send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst,
|
||||
/*
|
||||
* dp2: <d[j-3], d[j-2], d[j-1], d[j-1], ... >
|
||||
*/
|
||||
dp2 = vec_perm(dp1, (vector unsigned short){},
|
||||
(vector unsigned char){0xf9});
|
||||
dp2 = vec_perm(dp1, (__vector unsigned short){},
|
||||
(__vector unsigned char){0xf9});
|
||||
lp = port_groupx4(&pnum[j - FWDSTEP], lp, dp1, dp2);
|
||||
|
||||
/*
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
static inline void
|
||||
processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
|
||||
vector unsigned int *dip,
|
||||
__vector unsigned int *dip,
|
||||
uint32_t *ipv4_flag)
|
||||
{
|
||||
struct rte_ipv4_hdr *ipv4_hdr;
|
||||
@ -45,7 +45,7 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
|
||||
ipv4_flag[0] &= pkt[3]->packet_type;
|
||||
|
||||
rte_compiler_barrier();
|
||||
dip[0] = (vector unsigned int){x0, x1, x2, x3};
|
||||
dip[0] = (__vector unsigned int){x0, x1, x2, x3};
|
||||
}
|
||||
|
||||
/*
|
||||
@ -54,22 +54,22 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
|
||||
*/
|
||||
static inline void
|
||||
processx4_step2(const struct lcore_conf *qconf,
|
||||
vector unsigned int dip,
|
||||
__vector unsigned int dip,
|
||||
uint32_t ipv4_flag,
|
||||
uint8_t portid,
|
||||
struct rte_mbuf *pkt[FWDSTEP],
|
||||
uint16_t dprt[FWDSTEP])
|
||||
{
|
||||
rte_xmm_t dst;
|
||||
const vector unsigned char bswap_mask = (vector unsigned char){
|
||||
const __vector unsigned char bswap_mask = (__vector unsigned char){
|
||||
3, 2, 1, 0,
|
||||
7, 6, 5, 4,
|
||||
11, 10, 9, 8,
|
||||
15, 14, 13, 12};
|
||||
|
||||
/* Byte swap 4 IPV4 addresses. */
|
||||
dip = (vector unsigned int)vec_perm(*(vector unsigned char *)&dip,
|
||||
(vector unsigned char){}, bswap_mask);
|
||||
dip = (__vector unsigned int)vec_perm(*(__vector unsigned char *)&dip,
|
||||
(__vector unsigned char){}, bswap_mask);
|
||||
|
||||
/* if all 4 packets are IPV4. */
|
||||
if (likely(ipv4_flag)) {
|
||||
@ -101,7 +101,7 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
|
||||
{
|
||||
int32_t j;
|
||||
uint16_t dst_port[MAX_PKT_BURST];
|
||||
vector unsigned int dip[MAX_PKT_BURST / FWDSTEP];
|
||||
__vector unsigned int dip[MAX_PKT_BURST / FWDSTEP];
|
||||
uint32_t ipv4_flag[MAX_PKT_BURST / FWDSTEP];
|
||||
const int32_t k = RTE_ALIGN_FLOOR(nb_rx, FWDSTEP);
|
||||
|
||||
|
@ -41,7 +41,7 @@ resolve_priority_altivec(uint64_t transition, int n,
|
||||
{
|
||||
uint32_t x;
|
||||
xmm_t results, priority, results1, priority1;
|
||||
vector bool int selector;
|
||||
__vector bool int selector;
|
||||
xmm_t *saved_results, *saved_priority;
|
||||
|
||||
for (x = 0; x < categories; x += RTE_ACL_RESULTS_MULTIPLIER) {
|
||||
@ -110,8 +110,8 @@ transition4(xmm_t next_input, const uint64_t *trans,
|
||||
xmm_t in, node_type, r, t;
|
||||
xmm_t dfa_ofs, quad_ofs;
|
||||
xmm_t *index_mask, *tp;
|
||||
vector bool int dfa_msk;
|
||||
vector signed char zeroes = {};
|
||||
__vector bool int dfa_msk;
|
||||
__vector signed char zeroes = {};
|
||||
union {
|
||||
uint64_t d64[2];
|
||||
uint32_t d32[4];
|
||||
@ -127,7 +127,7 @@ transition4(xmm_t next_input, const uint64_t *trans,
|
||||
index_mask = (xmm_t *)&altivec_acl_const.xmm_index_mask.u32;
|
||||
t = vec_xor(*index_mask, *index_mask);
|
||||
in = vec_perm(next_input, (xmm_t){},
|
||||
*(vector unsigned char *)&altivec_acl_const.xmm_shuffle_input);
|
||||
*(__vector unsigned char *)&altivec_acl_const.xmm_shuffle_input);
|
||||
|
||||
/* Calc node type and node addr */
|
||||
node_type = vec_and(vec_nor(*index_mask, *index_mask), tr_lo);
|
||||
@ -137,30 +137,30 @@ transition4(xmm_t next_input, const uint64_t *trans,
|
||||
dfa_msk = vec_cmpeq(node_type, t);
|
||||
|
||||
/* DFA calculations. */
|
||||
r = vec_sr(in, (vector unsigned int){30, 30, 30, 30});
|
||||
r = vec_sr(in, (__vector unsigned int){30, 30, 30, 30});
|
||||
tp = (xmm_t *)&altivec_acl_const.range_base.u32;
|
||||
r = vec_add(r, *tp);
|
||||
t = vec_sr(in, (vector unsigned int){24, 24, 24, 24});
|
||||
t = vec_sr(in, (__vector unsigned int){24, 24, 24, 24});
|
||||
r = vec_perm(tr_hi, (xmm_t){(uint16_t)0 << 16},
|
||||
(vector unsigned char)r);
|
||||
(__vector unsigned char)r);
|
||||
|
||||
dfa_ofs = vec_sub(t, r);
|
||||
|
||||
/* QUAD/SINGLE calculations. */
|
||||
t = (xmm_t)vec_cmpgt((vector signed char)in, (vector signed char)tr_hi);
|
||||
t = (xmm_t)vec_cmpgt((__vector signed char)in, (__vector signed char)tr_hi);
|
||||
t = (xmm_t)vec_sel(
|
||||
vec_sel(
|
||||
(vector signed char)vec_sub(
|
||||
zeroes, (vector signed char)t),
|
||||
(vector signed char)t,
|
||||
vec_cmpgt((vector signed char)t, zeroes)),
|
||||
(__vector signed char)vec_sub(
|
||||
zeroes, (__vector signed char)t),
|
||||
(__vector signed char)t,
|
||||
vec_cmpgt((__vector signed char)t, zeroes)),
|
||||
zeroes,
|
||||
vec_cmpeq((vector signed char)t, zeroes));
|
||||
vec_cmpeq((__vector signed char)t, zeroes));
|
||||
|
||||
t = (xmm_t)vec_msum((vector signed char)t,
|
||||
(vector unsigned char)t, (xmm_t){});
|
||||
quad_ofs = (xmm_t)vec_msum((vector signed short)t,
|
||||
*(vector signed short *)&altivec_acl_const.xmm_ones_16.u16,
|
||||
t = (xmm_t)vec_msum((__vector signed char)t,
|
||||
(__vector unsigned char)t, (xmm_t){});
|
||||
quad_ofs = (xmm_t)vec_msum((__vector signed short)t,
|
||||
*(__vector signed short *)&altivec_acl_const.xmm_ones_16.u16,
|
||||
(xmm_t){});
|
||||
|
||||
/* blend DFA and QUAD/SINGLE. */
|
||||
@ -177,7 +177,7 @@ transition4(xmm_t next_input, const uint64_t *trans,
|
||||
*indices2 = (xmm_t){v.d32[0], v.d32[1], v.d32[2], v.d32[3]};
|
||||
|
||||
return vec_sr(next_input,
|
||||
(vector unsigned int){CHAR_BIT, CHAR_BIT, CHAR_BIT, CHAR_BIT});
|
||||
(__vector unsigned int){CHAR_BIT, CHAR_BIT, CHAR_BIT, CHAR_BIT});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -17,7 +17,7 @@ extern "C" {
|
||||
|
||||
#define RTE_VECT_DEFAULT_SIMD_BITWIDTH RTE_VECT_SIMD_256
|
||||
|
||||
typedef vector signed int xmm_t;
|
||||
typedef __vector signed int xmm_t;
|
||||
|
||||
#define XMM_SIZE (sizeof(xmm_t))
|
||||
#define XMM_MASK (XMM_SIZE - 1)
|
||||
|
@ -19,14 +19,14 @@ static inline void
|
||||
rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
|
||||
uint32_t defv)
|
||||
{
|
||||
vector signed int i24;
|
||||
xmm_t i24;
|
||||
rte_xmm_t i8;
|
||||
uint32_t tbl[4];
|
||||
uint64_t idx, pt, pt2;
|
||||
const uint32_t *ptbl;
|
||||
|
||||
const uint32_t mask = UINT8_MAX;
|
||||
const vector signed int mask8 = (xmm_t){mask, mask, mask, mask};
|
||||
const xmm_t mask8 = (xmm_t){mask, mask, mask, mask};
|
||||
|
||||
/*
|
||||
* RTE_LPM_VALID_EXT_ENTRY_BITMASK for 2 LPM entries
|
||||
@ -46,7 +46,7 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],
|
||||
|
||||
/* get 4 indexes for tbl24[]. */
|
||||
i24 = vec_sr((xmm_t) ip,
|
||||
(vector unsigned int){CHAR_BIT, CHAR_BIT, CHAR_BIT, CHAR_BIT});
|
||||
(__vector unsigned int){CHAR_BIT, CHAR_BIT, CHAR_BIT, CHAR_BIT});
|
||||
|
||||
/* extract values from tbl24[] */
|
||||
idx = (uint32_t)i24[0];
|
||||
|
Loading…
Reference in New Issue
Block a user