DPDK patches and discussions
 help / color / mirror / Atom feed
From: Saori USAMI <susami@igel.co.jp>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] pcap: set in_port value in packet mbuf data when each packet is received
Date: Fri,  5 Sep 2014 19:10:36 +0900
Message-ID: <1409911836-17294-1-git-send-email-susami@igel.co.jp> (raw)

The pkt.in_port parameter in mbuf should be set with an input port id
because DPDK apps may use it to know where each packet came from.

Signed-off-by: Saori USAMI <susami@igel.co.jp>
 lib/librte_pmd_pcap/rte_eth_pcap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index eebe768..cfd3de4 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -63,6 +63,7 @@ static uint64_t hz;
 struct pcap_rx_queue {
 	pcap_t *pcap;
+	uint8_t in_port;
 	struct rte_mempool *mb_pool;
 	volatile unsigned long rx_pkts;
 	volatile unsigned long err_pkts;
@@ -154,6 +155,7 @@ eth_pcap_rx(void *queue,
 			rte_memcpy(mbuf->pkt.data, packet, header.len);
 			mbuf->pkt.data_len = (uint16_t)header.len;
 			mbuf->pkt.pkt_len = mbuf->pkt.data_len;
+			mbuf->pkt.in_port = pcap_q->in_port;
 			bufs[num_rx] = mbuf;
 		} else {
@@ -373,6 +375,7 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,
 	struct pcap_rx_queue *pcap_q = &internals->rx_queue[rx_queue_id];
 	pcap_q->mb_pool = mb_pool;
 	dev->data->rx_queues[rx_queue_id] = pcap_q;
+	pcap_q->in_port = dev->data->port_id;
 	return 0;

             reply	other threads:[~2014-09-05 10:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 10:10 Saori USAMI [this message]
2014-09-24  3:37 ` Saori USAMI
2014-09-29 14:39 ` Thomas Monjalon

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:

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

  git send-email \
    --in-reply-to=1409911836-17294-1-git-send-email-susami@igel.co.jp \
    --to=susami@igel.co.jp \
    --cc=dev@dpdk.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git