@@ -113,7 +113,6 @@
static void
hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq)
{
- uintptr_t p;
struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
mb_def.nb_segs = 1;
@@ -121,28 +120,9 @@
mb_def.port = rxq->port_id;
rte_mbuf_refcnt_set(&mb_def, 1);
- /* compile-time verifies the rearm_data first 8bytes */
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) <
- offsetof(struct rte_mbuf, rearm_data));
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) <
- offsetof(struct rte_mbuf, rearm_data));
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) <
- offsetof(struct rte_mbuf, rearm_data));
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) <
- offsetof(struct rte_mbuf, rearm_data));
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) -
- offsetof(struct rte_mbuf, rearm_data) > 6);
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) -
- offsetof(struct rte_mbuf, rearm_data) > 6);
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) -
- offsetof(struct rte_mbuf, rearm_data) > 6);
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) -
- offsetof(struct rte_mbuf, rearm_data) > 6);
-
/* prevent compiler reordering: rearm_data covers previous fields */
rte_compiler_barrier();
- p = (uintptr_t)&mb_def.rearm_data;
- rxq->mbuf_initializer = *(uint64_t *)p;
+ rxq->mbuf_initializer = *rte_mbuf_rearm_data(&mb_def);
}
void
@@ -156,14 +156,6 @@
0, 0, 0, /* ignore non-length fields */
};
- /* compile-time verifies the shuffle mask */
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) !=
- offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4);
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) !=
- offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash.rss) !=
- offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12);
-
for (pos = 0; pos < nb_pkts; pos += HNS3_DEFAULT_DESCS_PER_LOOP,
rxdp += HNS3_DEFAULT_DESCS_PER_LOOP) {
uint64x2x2_t descs[HNS3_DEFAULT_DESCS_PER_LOOP];
@@ -236,23 +228,23 @@
pkt_mb4 = vreinterpretq_u8_u16(tmp);
/* save packet info to rx_pkts mbuf */
- vst1q_u8((void *)&sw_ring[pos + 0].mbuf->rx_descriptor_fields1,
+ vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 0].mbuf),
pkt_mb1);
- vst1q_u8((void *)&sw_ring[pos + 1].mbuf->rx_descriptor_fields1,
+ vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 1].mbuf),
pkt_mb2);
- vst1q_u8((void *)&sw_ring[pos + 2].mbuf->rx_descriptor_fields1,
+ vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 2].mbuf),
pkt_mb3);
- vst1q_u8((void *)&sw_ring[pos + 3].mbuf->rx_descriptor_fields1,
+ vst1q_u8(rte_mbuf_rx_descriptor_fields1(sw_ring[pos + 3].mbuf),
pkt_mb4);
/* store the first 8 bytes of packets mbuf's rearm_data */
- *(uint64_t *)&sw_ring[pos + 0].mbuf->rearm_data =
+ *rte_mbuf_rearm_data(sw_ring[pos + 0].mbuf) =
rxq->mbuf_initializer;
- *(uint64_t *)&sw_ring[pos + 1].mbuf->rearm_data =
+ *rte_mbuf_rearm_data(sw_ring[pos + 1].mbuf) =
rxq->mbuf_initializer;
- *(uint64_t *)&sw_ring[pos + 2].mbuf->rearm_data =
+ *rte_mbuf_rearm_data(sw_ring[pos + 2].mbuf) =
rxq->mbuf_initializer;
- *(uint64_t *)&sw_ring[pos + 3].mbuf->rearm_data =
+ *rte_mbuf_rearm_data(sw_ring[pos + 3].mbuf) =
rxq->mbuf_initializer;
rte_prefetch_non_temporal(rxdp + HNS3_DEFAULT_DESCS_PER_LOOP);
@@ -123,9 +123,9 @@
mbuf_init = svdup_n_u64(rxq->mbuf_initializer);
/* save mbuf_initializer */
svst1_scatter_u64base_offset_u64(PG64_256BIT, mbp1st,
- offsetof(struct rte_mbuf, rearm_data), mbuf_init);
+ offsetof(struct rte_mbuf, data_off), mbuf_init);
svst1_scatter_u64base_offset_u64(PG64_256BIT, mbp2st,
- offsetof(struct rte_mbuf, rearm_data), mbuf_init);
+ offsetof(struct rte_mbuf, data_off), mbuf_init);
next_rxdp = rxdp + HNS3_SVE_DEFAULT_DESCS_PER_LOOP;
rte_prefetch_non_temporal(next_rxdp);