DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [vmxnet3-usermap PATCH v2 16/17] pmd: adapt to new rte_mbuf structure
Date: Mon, 19 May 2014 15:56:28 +0200	[thread overview]
Message-ID: <1400507789-18453-17-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1400507789-18453-1-git-send-email-olivier.matz@6wind.com>

The rte_mbuf structure is modified by the following commits in dpdk:
 mbuf: rename vlan_macip_len in hw_offload and increase its size
 mbuf: change ol_flags to 32 bits
 mbuf: replace data pointer by an offset
 mbuf: merge physaddr and buf_len in a bitfield
 mbuf: remove the rte_pktmbuf structure
 mbuf: remove rte_ctrlmbuf

We need to modify to conform to this new struct.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 pmd/vmxnet3.c | 51 ++++++++++++++++++++++++---------------------------
 1 file changed, 24 insertions(+), 27 deletions(-)

diff --git a/pmd/vmxnet3.c b/pmd/vmxnet3.c
index 3f3f715..69bc4d5 100644
--- a/pmd/vmxnet3.c
+++ b/pmd/vmxnet3.c
@@ -54,7 +54,7 @@
 
 typedef void rte_txq_t;
 typedef void rte_rxq_t;
-#define RTE_MBUF_VLAN_MAC_IP(m) (m)->pkt.vlan_macip.f.vlan_tci
+#define RTE_MBUF_VLAN_MAC_IP(m) (m)->hw_offload.vlan_tci
 
 #define VMXNET3_MAX_MAC_ADDRS 1
 
@@ -73,14 +73,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 {
 	struct rte_mbuf *m;
 	m = __rte_mbuf_raw_alloc(mp);
-	__rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
+	__rte_mbuf_sanity_check(m, 0);
 	return m;
 }
 
 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
-	(uint64_t) ((mb)->buf_physaddr       + \
-	(uint64_t) ((char *)((mb)->pkt.data) - \
-	(char *)(mb)->buf_addr))
+	(uint64_t) ((mb)->buf_physaddr + (mb)->data_off)
 
 #ifndef min
 #define min(x, y) ((x)<(y) ? (x) : (y))
@@ -314,16 +312,15 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
 
 		/* Buffer information */
 		if ((*binfo & 0x01) == VMXNET3_RXD_BTYPE_HEAD) {
-			buf->pkt.data = ((char *)buf->buf_addr +
-					 RTE_PKTMBUF_HEADROOM);
+			buf->data_off = RTE_PKTMBUF_HEADROOM;
 		} else {
-			buf->pkt.data = (char *)buf->buf_addr;
+			buf->data_off = 0;
 		}
-		buf->pkt.nb_segs = 1;
-		buf->pkt.next = NULL;
-		buf->pkt.pkt_len = rcd->len;
-		buf->pkt.data_len = rcd->len;
-		buf->pkt.in_port = rq->port_id;
+		buf->nb_segs = 1;
+		buf->next = NULL;
+		buf->pkt_len = rcd->len;
+		buf->data_len = rcd->len;
+		buf->in_port = rq->port_id;
 		buf->ol_flags = 0; // RSS - FDIR // Error
 		RTE_MBUF_VLAN_MAC_IP(buf) = 0;
 
@@ -344,11 +341,11 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
 			head = tail = buf;
 			prev_tail = NULL;
 		} else {
-			tail->pkt.next = buf;
+			tail->next = buf;
 			prev_tail = tail;
 			tail = buf;
-			++head->pkt.nb_segs;
-			head->pkt.pkt_len += rcd->len;
+			++head->nb_segs;
+			head->pkt_len += rcd->len;
 		}
 
 		assert(head != NULL);
@@ -381,8 +378,8 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
 			assert(head != tail);
 			if (unlikely(rcd->len == 0)) {
 				/* Remove useless empty fragment. */
-				prev_tail->pkt.next = NULL;
-				--head->pkt.nb_segs;
+				prev_tail->next = NULL;
+				--head->nb_segs;
 				tail = prev_tail;
 				prev_tail = NULL;
 				rte_pktmbuf_free(buf);
@@ -474,7 +471,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
 
 	/* Make sure len doesn't overflow. */
 	assert(len >= 0);
-	assert((unsigned int)len <= mbuf->pkt.pkt_len);
+	assert((unsigned int)len <= mbuf->pkt_len);
 
 	/* Zero-sized packets can't be transmitted. Silently ignore them. */
 	if (len == 0) {
@@ -488,7 +485,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
 	 * than the first segment size and less or equal to
 	 * VMXNET3_HDR_COPY_SIZE.
 	 */
-	copy_size = ((mbuf->pkt.data_len < len) ? mbuf->pkt.data_len : len);
+	copy_size = ((mbuf->data_len < len) ? mbuf->data_len : len);
 	if (copy_size > VMXNET3_HDR_COPY_SIZE)
 		copy_size = VMXNET3_HDR_COPY_SIZE;
 
@@ -502,11 +499,11 @@ send_packet(struct vmxnet3_tx_queue *tq,
 	 * An extra descriptor is required for the data ring part if
 	 * copy_size is nonzero.
 	 */
-	count = mbuf->pkt.nb_segs;
+	count = mbuf->nb_segs;
 	assert(count >= 1);
-	if (mbuf->pkt.data_len == copy_size) {
+	if (mbuf->data_len == copy_size) {
 		/* First segment is either in the data ring or empty. */
-		cur = mbuf->pkt.next;
+		cur = mbuf->next;
 		offset = 0;
 	} else {
 		/* Rest of the first segment needs its own descriptor. */
@@ -550,7 +547,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
 		dw2 |= (copy_size & (VMXNET3_TXD_GEN - 1));
 		tdd = tq->data_ring.base + tq->tx_ring.next2fill;
 		/* Copy to the data ring. */
-		memcpy(tdd->data, mbuf->pkt.data, copy_size);
+		memcpy(tdd->data, rte_pktmbuf_mtod(mbuf, char *), copy_size);
 		tmp.txd.addr =
 			rte_cpu_to_le_64(tq->data_ring.basePA +
 					 tq->tx_ring.next2fill *
@@ -581,7 +578,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
 		int buf_size;
 
 		assert(cur != NULL);
-		buf_size = min(len, (cur->pkt.data_len - offset));
+		buf_size = min(len, (cur->data_len - offset));
 		if (buf_size == 0) {
 			/*
 			 * Can't fill a descriptor with an empty segment,
@@ -625,7 +622,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
 		gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
 	skip:
 		offset = 0;
-		cur = cur->pkt.next;
+		cur = cur->next;
 	}
 
 	/* Reverse gen bit in SOP descriptor. */
@@ -781,7 +778,7 @@ eth_tx_burst(rte_txq_t *txq,
 	int num;
 
 	for (num = 0; num < nb_pkts; num++) {
-		int ret = send_packet(tq, tx_pkts[num]->pkt.pkt_len,
+		int ret = send_packet(tq, tx_pkts[num]->pkt_len,
 				      tx_pkts[num]);
 		if (ret == -1) {
 			break;
-- 
1.9.2

  parent reply	other threads:[~2014-05-19 13:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 13:56 [dpdk-dev] [PATCH v2 00/17] ixgbe/mbuf: add TSO support Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 01/17] igb/ixgbe: fix IP checksum calculation Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 02/17] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 03/17] mbuf: remove rte_ctrlmbuf Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 04/17] mbuf: remove the rte_pktmbuf structure Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 05/17] mbuf: merge physaddr and buf_len in a bitfield Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 06/17] mbuf: cosmetic changes in rte_mbuf structure Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 07/17] mbuf: replace data pointer by an offset Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 08/17] mbuf: add functions to get the name of an ol_flag Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 09/17] mbuf: change ol_flags to 32 bits Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 10/17] mbuf: rename vlan_macip_len in hw_offload and increase its size Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 11/17] testpmd: modify source address to validate checksum calculation Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 12/17] mbuf: generic support of TCP segmentation offload Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 13/17] ixgbe: support " Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [virtio-net-pmd PATCH v2 14/17] pmd: adapt to new rte_mbuf structure Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [vmxnet3-usermap PATCH v2 15/17] pmd: remove support of old dpdk versions Olivier Matz
2014-05-19 13:56 ` Olivier Matz [this message]
2014-05-19 13:56 ` [dpdk-dev] [memnic PATCH v2 17/17] pmd: adapt to new rte_mbuf structure Olivier Matz
2014-05-22 15:02 ` [dpdk-dev] [PATCH v2 00/17] add TSO support Thomas Monjalon
2014-05-22 16:09   ` Venkatesan, Venky
2014-05-23 14:22     ` Olivier MATZ
2014-05-23 14:43       ` Venkatesan, Venky
2014-05-26 11:59         ` Olivier MATZ
2014-05-23 12:47   ` Ananyev, Konstantin
2014-05-23 14:32     ` Olivier MATZ
2014-05-26 15:20       ` Ananyev, Konstantin
2014-11-03  7:32 ` [dpdk-dev] [PATCH v2 00/17] ixgbe/mbuf: " Liu, Jijiang
2014-11-03 10:12   ` Olivier MATZ

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=1400507789-18453-17-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@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).