From patchwork Fri Sep 5 10:10:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saori USAMI X-Patchwork-Id: 3 Return-Path: Received: from mail-ig0-f174.google.com (mail-ig0-f174.google.com [209.85.213.174]) by dpdk.org (Postfix) with ESMTP id 62BF468C2 for ; Fri, 5 Sep 2014 12:06:40 +0200 (CEST) Received: by mail-ig0-f174.google.com with SMTP id a13so724912igq.1 for ; Fri, 05 Sep 2014 03:11:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Iuzsfo0o+gLAAjXQ94jI7hYRih+C2BBGwutRrOYJTTw=; b=bCC94ukUm4E5E5nicAUuQirBLnKCVc5TvJXjnbNKMMAsa/9gkckBAVaDBjTSTPL3wj w/CBoAz7VN/OJaC98Do/FBVXRtooBd6200ZllEDiCScRHYKJNWMCUcG9Q5DyWjnAbi6A /xm4PSB5bOSRgHAvdMF2N5UfITIf1/Hup9TblTl8I9Vbz8+331AfR8ZCs5aG97EH3OEw u1FY1P5BsJRAVqVPsCwBfwS7LGeZXTnCw8UV3E+l4lZfrYeCGfTbp5ySKXwV2Xu+wbnA FVu6rKey23wqGzlhxDWjdnmMAgYRjYloYqWwwdsiDGmQyijKWxoHOtXTwKh4YgO6mcIP XbUQ== X-Gm-Message-State: ALoCoQlcA2N/Q5S8LPJGLf5SpwDBfSlhxOGDF2pQDmBaqIqdgJKAEiIDJmz3odLHE0vHC1vKqDb3 X-Received: by 10.66.65.202 with SMTP id z10mr19737561pas.20.1409911883856; Fri, 05 Sep 2014 03:11:23 -0700 (PDT) Received: from Negima.hq.igel.co.jp ([219.106.231.132]) by mx.google.com with ESMTPSA id ge5sm1339762pbc.81.2014.09.05.03.11.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Sep 2014 03:11:22 -0700 (PDT) From: Saori USAMI To: dev@dpdk.org Date: Fri, 5 Sep 2014 19:10:36 +0900 Message-Id: <1409911836-17294-1-git-send-email-susami@igel.co.jp> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] pcap: set in_port value in packet mbuf data when each packet is received X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2014 10:06:40 -0000 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 --- 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; }