DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 5/6] mbuf: rename in_port to just port
Date: Wed, 27 Aug 2014 16:50:27 +0100	[thread overview]
Message-ID: <1409154628-30825-6-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1409154628-30825-1-git-send-email-bruce.richardson@intel.com>

In some cases we may want to tag a packet for a particular destination
or output port, so rename the "in_port" field in the mbuf to just "port"
so that it can be re-used for this purpose if an application needs it.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/dpdk_qat/main.c                                   | 2 +-
 examples/ipv4_multicast/main.c                             | 2 +-
 examples/load_balancer/runtime.c                           | 2 +-
 examples/multi_process/client_server_mp/mp_client/client.c | 2 +-
 lib/librte_mbuf/rte_mbuf.c                                 | 4 ++--
 lib/librte_mbuf/rte_mbuf.h                                 | 6 +++---
 lib/librte_pmd_e1000/em_rxtx.c                             | 4 ++--
 lib/librte_pmd_e1000/igb_rxtx.c                            | 4 ++--
 lib/librte_pmd_i40e/i40e_rxtx.c                            | 8 ++++----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                          | 8 ++++----
 lib/librte_pmd_virtio/virtio_rxtx.c                        | 2 +-
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c                      | 4 ++--
 lib/librte_pmd_xenvirt/rte_eth_xenvirt.c                   | 2 +-
 13 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c
index 75c9876..1599a0a 100644
--- a/examples/dpdk_qat/main.c
+++ b/examples/dpdk_qat/main.c
@@ -384,7 +384,7 @@ main_loop(__attribute__((unused)) void *dummy)
 			}
 		}
 
-		port = dst_ports[pkt->in_port];
+		port = dst_ports[pkt->port];
 
 		/* Transmit the packet */
 		nic_tx_send_packet(pkt, (uint8_t)port);
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index cc12d9d..2232851 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -337,7 +337,7 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone)
 	hdr->nb_segs = (uint8_t)(pkt->nb_segs + 1);
 
 	/* copy metadata from source packet*/
-	hdr->in_port = pkt->in_port;
+	hdr->port = pkt->port;
 	hdr->vlan_macip = pkt->vlan_macip;
 	hdr->hash = pkt->hash;
 
diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c
index b69917b..a53f33f 100644
--- a/examples/load_balancer/runtime.c
+++ b/examples/load_balancer/runtime.c
@@ -540,7 +540,7 @@ app_lcore_worker(
 			ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
 
 			if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) {
-				port = pkt->in_port;
+				port = pkt->port;
 			}
 
 			pos = lp->mbuf_out[port].n_mbufs;
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 71e4a48..ee2338c 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -211,7 +211,7 @@ enqueue_packet(struct rte_mbuf *buf, uint8_t port)
 static void
 handle_packet(struct rte_mbuf *buf)
 {
-	const uint8_t in_port = buf->in_port;
+	const uint8_t in_port = buf->port;
 	const uint8_t out_port = output_ports[in_port];
 
 	enqueue_packet(buf, out_port);
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 967e4d8..b8b6bbe 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -122,7 +122,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
 	/* init some constant fields */
 	m->pool = mp;
 	m->nb_segs = 1;
-	m->in_port = 0xff;
+	m->port = 0xff;
 }
 
 /* do some sanity checks on a mbuf: panic if it fails */
@@ -176,7 +176,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 	       m, (uint64_t)m->buf_physaddr, (unsigned)m->buf_len);
 	fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx16", nb_segs=%u, "
 	       "in_port=%u\n", m->pkt_len, m->ol_flags,
-	       (unsigned)m->nb_segs, (unsigned)m->in_port);
+	       (unsigned)m->nb_segs, (unsigned)m->port);
 	nb_segs = m->nb_segs;
 
 	while (m && nb_segs != 0) {
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index d5b9a50..fc35006 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -166,7 +166,7 @@ struct rte_mbuf {
 
 	/* these fields are valid for first segment only */
 	uint8_t nb_segs;        /**< Number of segments. */
-	uint8_t in_port;        /**< Input port. */
+	uint8_t port;           /**< Input port. */
 	uint32_t pkt_len;       /**< Total pkt len: sum of all segment data_len. */
 
 	/* offload features, valid for first segment only */
@@ -542,7 +542,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
 	m->pkt_len = 0;
 	m->vlan_macip.data = 0;
 	m->nb_segs = 1;
-	m->in_port = 0xff;
+	m->port = 0xff;
 
 	m->ol_flags = 0;
 	buf_ofs = (RTE_PKTMBUF_HEADROOM <= m->buf_len) ?
@@ -606,7 +606,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *md)
 	mi->next = md->next;
 	mi->data = md->data;
 	mi->data_len = md->data_len;
-	mi->in_port = md->in_port;
+	mi->port = md->port;
 	mi->vlan_macip = md->vlan_macip;
 	mi->hash = md->hash;
 
diff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c
index 058e1bd..074c9b3 100644
--- a/lib/librte_pmd_e1000/em_rxtx.c
+++ b/lib/librte_pmd_e1000/em_rxtx.c
@@ -777,7 +777,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->ol_flags = rx_desc_status_to_pkt_flags(status);
 		rxm->ol_flags = (uint16_t)(rxm->ol_flags |
@@ -1003,7 +1003,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - IP checksum flag,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 
 		first_seg->ol_flags = rx_desc_status_to_pkt_flags(status);
 		first_seg->ol_flags = (uint16_t)(first_seg->ol_flags |
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index 99bb9d9..8b33b6d 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -759,7 +759,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->hash.rss = rxd.wb.lower.hi_dword.rss;
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
@@ -994,7 +994,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 		first_seg->hash.rss = rxd.wb.lower.hi_dword.rss;
 
 		/*
diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index faf6095..9b84edb 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -690,7 +690,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 		mb->next = NULL;
 		mb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->nb_segs = 1;
-		mb->in_port = rxq->port_id;
+		mb->port = rxq->port_id;
 		dma_addr = rte_cpu_to_le_64(\
 			RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mb));
 		rxdp[i].read.hdr_addr = dma_addr;
@@ -851,7 +851,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->next = NULL;
 		rxm->pkt_len = rx_packet_len;
 		rxm->data_len = rx_packet_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		rxm->vlan_macip.f.vlan_tci = rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT) ?
@@ -1005,7 +1005,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
 								ETHER_CRC_LEN);
 		}
 
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 		first_seg->vlan_macip.f.vlan_tci = (rx_status &
 			(1 << I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) ?
 			rte_le_to_cpu_16(rxd.wb.qword0.lo_dword.l2tag1) : 0;
@@ -2022,7 +2022,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq)
 		mbuf->next = NULL;
 		mbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->nb_segs = 1;
-		mbuf->in_port = rxq->port_id;
+		mbuf->port = rxq->port_id;
 
 		dma_addr =
 			rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index c95e117..eec1458 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -998,7 +998,7 @@ ixgbe_rx_alloc_bufs(struct igb_rx_queue *rxq)
 		mb->next = NULL;
 		mb->data = (char *)mb->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mb->nb_segs = 1;
-		mb->in_port = rxq->port_id;
+		mb->port = rxq->port_id;
 
 		/* populate the descriptors */
 		dma_addr = (uint64_t)mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
@@ -1253,7 +1253,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->pkt_len = pkt_len;
 		rxm->data_len = pkt_len;
-		rxm->in_port = rxq->port_id;
+		rxm->port = rxq->port_id;
 
 		hlen_type_rss = rte_le_to_cpu_32(rxd.wb.lower.lo_dword.data);
 		/* Only valid if PKT_RX_VLAN_PKT set in pkt_flags */
@@ -1496,7 +1496,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 *      - VLAN TCI, if any,
 		 *      - error flags.
 		 */
-		first_seg->in_port = rxq->port_id;
+		first_seg->port = rxq->port_id;
 
 		/*
 		 * The vlan_tci field is only valid when PKT_RX_VLAN_PKT is
@@ -3215,7 +3215,7 @@ ixgbe_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 		mbuf->next = NULL;
 		mbuf->data = (char *)mbuf->buf_addr + RTE_PKTMBUF_HEADROOM;
 		mbuf->nb_segs = 1;
-		mbuf->in_port = rxq->port_id;
+		mbuf->port = rxq->port_id;
 
 		dma_addr =
 			rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR_DEFAULT(mbuf));
diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c
index 07bc7b2..2d043cb 100644
--- a/lib/librte_pmd_virtio/virtio_rxtx.c
+++ b/lib/librte_pmd_virtio/virtio_rxtx.c
@@ -469,7 +469,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			continue;
 		}
 
-		rxm->in_port = rxvq->port_id;
+		rxm->port = rxvq->port_id;
 		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 		rxm->nb_segs = 1;
 		rxm->next = NULL;
diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 7dd5a98..3536765 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -557,12 +557,12 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 				rxm->ol_flags = 0;
 
 			/* Initialize newly received packet buffer */
-			rxm->in_port = rxq->port_id;
+			rxm->port = rxq->port_id;
 			rxm->nb_segs = 1;
 			rxm->next = NULL;
 			rxm->pkt_len = (uint16_t)rcd->len;
 			rxm->data_len = (uint16_t)rcd->len;
-			rxm->in_port = rxq->port_id;
+			rxm->port = rxq->port_id;
 			rxm->vlan_macip.f.vlan_tci = 0;
 			rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 
diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
index c118652..22215ed 100644
--- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
+++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c
@@ -113,7 +113,7 @@ eth_xenvirt_rx(void *q, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		rxm->data = (char *)rxm->buf_addr + RTE_PKTMBUF_HEADROOM;
 		rxm->data_len = (uint16_t)(len[i] - sizeof(struct virtio_net_hdr));
 		rxm->nb_segs = 1;
-		rxm->in_port = pi->port_id;
+		rxm->port = pi->port_id;
 		rxm->pkt_len  = (uint32_t)(len[i] - sizeof(struct virtio_net_hdr));
 	}
 	/* allocate new mbuf for the used descriptor */
-- 
1.9.3

  parent reply	other threads:[~2014-08-27 15:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27 15:50 [dpdk-dev] [PATCH 0/6] Mbuf structure Rework, part 1 Bruce Richardson
2014-08-27 15:50 ` [dpdk-dev] [PATCH 1/6] ixgbe: put only non-zero initializer in definition Bruce Richardson
2014-08-27 15:50 ` [dpdk-dev] [PATCH 2/6] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT Bruce Richardson
2014-08-27 15:50 ` [dpdk-dev] [PATCH 3/6] mbuf: remove rte_ctrlmbuf Bruce Richardson
2014-08-27 15:50 ` [dpdk-dev] [PATCH 4/6] mbuf: remove the rte_pktmbuf structure Bruce Richardson
2014-08-27 15:50 ` Bruce Richardson [this message]
2014-08-27 15:50 ` [dpdk-dev] [PATCH 6/6] mbuf: flatten struct vlan_macip into mbuf struct Bruce Richardson
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 0/6] Mbuf structure Rework, part 1 Bruce Richardson
2014-09-17  9:30   ` Thomas Monjalon
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 1/6] ixgbe: put only non-zero initializer in definition Bruce Richardson
2014-09-05 16:14   ` De Lara Guarch, Pablo
2014-09-08  7:55   ` Olivier MATZ
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 2/6] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT Bruce Richardson
2014-09-05 16:14   ` De Lara Guarch, Pablo
2014-09-08  8:01   ` Olivier MATZ
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 3/6] mbuf: remove rte_ctrlmbuf Bruce Richardson
2014-09-05 16:15   ` De Lara Guarch, Pablo
2014-09-08  8:21   ` Olivier MATZ
2014-09-09  8:48     ` Richardson, Bruce
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 4/6] mbuf: remove the rte_pktmbuf structure Bruce Richardson
2014-09-04 13:25   ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2014-09-05 16:17     ` De Lara Guarch, Pablo
2014-09-08  8:29     ` Olivier MATZ
2014-09-05 16:15   ` [dpdk-dev] [PATCH v2 " De Lara Guarch, Pablo
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 5/6] mbuf: rename in_port to just port Bruce Richardson
2014-09-05 16:16   ` De Lara Guarch, Pablo
2014-09-08  8:45   ` Olivier MATZ
2014-08-28 15:42 ` [dpdk-dev] [PATCH v2 6/6] mbuf: flatten struct vlan_macip into mbuf struct Bruce Richardson
2014-09-05 16:21   ` De Lara Guarch, Pablo
2014-09-07 19:40     ` Richardson, Bruce
2014-09-08  9:07   ` Olivier MATZ
2014-09-09 14:40     ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2014-09-09 15:20       ` De Lara Guarch, Pablo
2014-09-08 12:32 ` [dpdk-dev] [PATCH 0/6] Mbuf structure Rework, part 1 Olivier MATZ
2014-09-09  9:03   ` Richardson, Bruce

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=1409154628-30825-6-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.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).