From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 31B5043C03; Tue, 27 Feb 2024 06:43:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C40F542EBF; Tue, 27 Feb 2024 06:42:27 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C135F42E41 for ; Tue, 27 Feb 2024 06:41:42 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 22A4320B74C8; Mon, 26 Feb 2024 21:41:40 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 22A4320B74C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709012501; bh=yTftrNn5EzqwSkfgdh2/JNeoGLzIoWQcsQFehRUEk7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N31xheo+PaSIh9OqzRqEEgxEDmZv/57NKxgTRoSVASDlGBaluOE87hH4SSx2Sqga0 VGUHgFHFG40VB6Xy4/Dh+9azIy7vRGlfdUg6BOodq1mAMREDMfUnH0s5nlkZqz3tVz jTtOIehXjIiT4VrBelx+i3nv9wlIBc8To7z9MVbo= From: Tyler Retzlaff To: dev@dpdk.org Cc: Ajit Khaparde , Andrew Boyer , Andrew Rybchenko , Bruce Richardson , Chenbo Xia , Chengwen Feng , Dariusz Sosnowski , David Christensen , Hyong Youb Kim , Jerin Jacob , Jie Hai , Jingjing Wu , John Daley , Kevin Laatz , Kiran Kumar K , Konstantin Ananyev , Maciej Czekaj , Matan Azrad , Maxime Coquelin , Nithin Dabilpuram , Ori Kam , Ruifeng Wang , Satha Rao , Somnath Kotur , Suanming Mou , Sunil Kumar Kori , Viacheslav Ovsiienko , Yisen Zhuang , Yuying Zhang , mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 08/23] net/hns3: use mbuf descriptor accessors Date: Mon, 26 Feb 2024 21:41:24 -0800 Message-Id: <1709012499-12813-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> References: <1706657173-26166-1-git-send-email-roretzla@linux.microsoft.com> <1709012499-12813-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org RTE_MARKER typedefs are a GCC extension unsupported by MSVC. Use new rte_mbuf_rearm_data and rte_mbuf_rx_descriptor_fields1 accessors that provide a compatible type pointer without using the marker fields. Signed-off-by: Tyler Retzlaff --- drivers/net/hns3/hns3_rxtx_vec.c | 22 +--------------------- drivers/net/hns3/hns3_rxtx_vec_neon.h | 24 ++++++++---------------- drivers/net/hns3/hns3_rxtx_vec_sve.c | 4 ++-- 3 files changed, 11 insertions(+), 39 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c index 9708ec6..d6c9e80 100644 --- a/drivers/net/hns3/hns3_rxtx_vec.c +++ b/drivers/net/hns3/hns3_rxtx_vec.c @@ -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 diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h index 0dc6b9f..6f46131 100644 --- a/drivers/net/hns3/hns3_rxtx_vec_neon.h +++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h @@ -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); diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c index 8aa4448..f6259d1 100644 --- a/drivers/net/hns3/hns3_rxtx_vec_sve.c +++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c @@ -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); -- 1.8.3.1