* [PATCH] pcap: set in_port value in packet mbuf data when each packet is received
@ 2014-09-05 10:10 Saori USAMI
[not found] ` <1409911836-17294-1-git-send-email-susami-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Saori USAMI @ 2014-09-05 10:10 UTC (permalink / raw)
To: dev-VfR2kkLFssw
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-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
---
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;
num_rx++;
} 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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1409911836-17294-1-git-send-email-susami-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>]
* Re: [PATCH] pcap: set in_port value in packet mbuf data when each packet is received [not found] ` <1409911836-17294-1-git-send-email-susami-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org> @ 2014-09-24 3:37 ` Saori USAMI 2014-09-29 14:39 ` Thomas Monjalon 1 sibling, 0 replies; 3+ messages in thread From: Saori USAMI @ 2014-09-24 3:37 UTC (permalink / raw) To: dev-VfR2kkLFssw Hi, How about the following patch for the next DPDK release? Thanks, Saori 2014-09-05 19:10 GMT+09:00 Saori USAMI <susami-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>: > 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-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org> > --- > 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; > num_rx++; > } 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; > } > > -- > 1.9.1 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pcap: set in_port value in packet mbuf data when each packet is received [not found] ` <1409911836-17294-1-git-send-email-susami-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org> 2014-09-24 3:37 ` Saori USAMI @ 2014-09-29 14:39 ` Thomas Monjalon 1 sibling, 0 replies; 3+ messages in thread From: Thomas Monjalon @ 2014-09-29 14:39 UTC (permalink / raw) To: Saori USAMI; +Cc: dev-VfR2kkLFssw > 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-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org> Acked, adapted to mbuf rework and applied. Thanks -- Thomas ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-29 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 10:10 [PATCH] pcap: set in_port value in packet mbuf data when each packet is received Saori USAMI
[not found] ` <1409911836-17294-1-git-send-email-susami-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
2014-09-24 3:37 ` Saori USAMI
2014-09-29 14:39 ` Thomas Monjalon
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.