patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	stable@dpdk.org, Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 2/3] net/nfp: standard the data endian of NFD3 Tx descritor
Date: Tue, 15 Apr 2025 10:54:52 +0800	[thread overview]
Message-ID: <20250415025453.1348238-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20250415025453.1348238-1-chaoyong.he@corigine.com>

The data endian of NFD3 Tx descriptor should be little, and the related
logic also should modify.

Fixes: 3745dd9dd86f ("net/nfp: adjust coding style for NFD3")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_ctrl.c |  4 ++--
 drivers/net/nfp/nfd3/nfp_nfd3.h          | 14 +++++++-------
 drivers/net/nfp/nfd3/nfp_nfd3_dp.c       |  8 ++++----
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 23d1b770d8..6ac2caf367 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -194,10 +194,10 @@ nfp_flower_ctrl_vnic_nfd3_xmit(struct nfp_app_fw_flower *app_fw_flower,
 	*lmbuf = mbuf;
 	dma_addr = rte_mbuf_data_iova(mbuf);
 
-	txds->data_len = mbuf->pkt_len;
+	txds->data_len = rte_cpu_to_le_16(mbuf->pkt_len);
 	txds->dma_len = txds->data_len;
 	txds->dma_addr_hi = (dma_addr >> 32) & 0xff;
-	txds->dma_addr_lo = (dma_addr & 0xffffffff);
+	txds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
 	txds->offset_eop = FLOWER_PKT_DATA_OFFSET | NFD3_DESC_TX_EOP;
 
 	txq->wr_p++;
diff --git a/drivers/net/nfp/nfd3/nfp_nfd3.h b/drivers/net/nfp/nfd3/nfp_nfd3.h
index 96ea23b3df..dc24f4fa1d 100644
--- a/drivers/net/nfp/nfd3/nfp_nfd3.h
+++ b/drivers/net/nfp/nfd3/nfp_nfd3.h
@@ -17,13 +17,13 @@
 struct nfp_net_nfd3_tx_desc {
 	union {
 		struct __rte_packed_begin {
-			uint8_t dma_addr_hi; /**< High bits of host buf address */
-			uint16_t dma_len;    /**< Length to DMA for this desc */
+			uint8_t dma_addr_hi;   /**< High bits of host buf address */
+			rte_le16_t dma_len;    /**< Length to DMA for this desc */
 			/** Offset in buf where pkt starts + highest bit is eop flag */
 			uint8_t offset_eop;
-			uint32_t dma_addr_lo; /**< Low 32bit of host buf addr */
+			rte_le32_t dma_addr_lo; /**< Low 32bit of host buf addr */
 
-			uint16_t mss;         /**< MSS to be used for LSO */
+			rte_le16_t mss;         /**< MSS to be used for LSO */
 			uint8_t lso_hdrlen;   /**< LSO, where the data starts */
 			uint8_t flags;        /**< TX Flags, see @NFD3_DESC_TX_* */
 
@@ -32,11 +32,11 @@ struct nfp_net_nfd3_tx_desc {
 					uint8_t l3_offset; /**< L3 header offset */
 					uint8_t l4_offset; /**< L4 header offset */
 				};
-				uint16_t vlan; /**< VLAN tag to add if indicated */
+				rte_le16_t vlan; /**< VLAN tag to add if indicated */
 			};
-			uint16_t data_len;     /**< Length of frame + meta data */
+			rte_le16_t data_len;     /**< Length of frame + meta data */
 		} __rte_packed_end;
-		uint32_t vals[4];
+		rte_le32_t vals[4];
 	};
 };
 
diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
index 3ffcbb2576..6466a5a4fb 100644
--- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
+++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c
@@ -139,7 +139,7 @@ nfp_net_nfd3_tx_vlan(struct nfp_net_txq *txq,
 
 	if ((mb->ol_flags & RTE_MBUF_F_TX_VLAN) != 0) {
 		txd->flags |= NFD3_DESC_TX_VLAN;
-		txd->vlan = mb->vlan_tci;
+		txd->vlan = rte_cpu_to_le_16(mb->vlan_tci);
 	}
 }
 
@@ -300,7 +300,7 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue,
 		 * Checksum and VLAN flags just in the first descriptor for a
 		 * multisegment packet, but TSO info needs to be in all of them.
 		 */
-		txd.data_len = pkt->pkt_len;
+		txd.data_len = rte_cpu_to_le_16((uint16_t)pkt->pkt_len);
 		nfp_net_nfd3_tx_tso(txq, &txd, pkt);
 		nfp_net_nfd3_tx_cksum(txq, &txd, pkt);
 		nfp_net_nfd3_tx_vlan(txq, &txd, pkt);
@@ -330,10 +330,10 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue,
 			dma_addr = rte_mbuf_data_iova(pkt);
 
 			/* Filling descriptors fields */
-			txds->dma_len = dma_size;
+			txds->dma_len = rte_cpu_to_le_16(dma_size);
 			txds->data_len = txd.data_len;
 			txds->dma_addr_hi = (dma_addr >> 32) & 0xff;
-			txds->dma_addr_lo = (dma_addr & 0xffffffff);
+			txds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
 			free_descs--;
 
 			txq->wr_p++;
-- 
2.43.5


  parent reply	other threads:[~2025-04-15  2:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250415025453.1348238-1-chaoyong.he@corigine.com>
2025-04-15  2:54 ` [PATCH 1/3] net/nfp: standard the data endian of Rx descriptor Chaoyong He
2025-04-15  2:54 ` Chaoyong He [this message]
2025-04-15  2:54 ` [PATCH 3/3] net/nfp: standard the data endian of NFDk Tx descritor Chaoyong He
2025-04-16  0:10   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250415025453.1348238-3-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).