summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaori Usami <susami@igel.co.jp>2014-09-05 19:10:36 +0900
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-09-29 16:34:50 +0200
commite35d434667f7832ed96a10386bbf8bf71afbeaaf (patch)
treef78d8cd66b59453cb12168d33a7527c0c3f56c99
parentb10eef348d1a2919e0b1cc06743256a73548da63 (diff)
downloaddpdk-e35d434667f7832ed96a10386bbf8bf71afbeaaf.zip
dpdk-e35d434667f7832ed96a10386bbf8bf71afbeaaf.tar.gz
dpdk-e35d434667f7832ed96a10386bbf8bf71afbeaaf.tar.xz
pcap: set port id in received mbuf
The 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> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
-rw-r--r--lib/librte_pmd_pcap/rte_eth_pcap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index 2ff1e77..19492e8 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;
@@ -155,6 +156,7 @@ eth_pcap_rx(void *queue,
header.len);
mbuf->data_len = (uint16_t)header.len;
mbuf->pkt_len = mbuf->data_len;
+ mbuf->port = pcap_q->in_port;
bufs[num_rx] = mbuf;
num_rx++;
} else {
@@ -376,6 +378,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;
}