From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ED927A0350; Wed, 1 Jul 2020 09:49:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D39791C0C5; Wed, 1 Jul 2020 09:49:47 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 903A71C01E for ; Wed, 1 Jul 2020 09:49:45 +0200 (CEST) IronPort-SDR: K1dtLNnStrQqeR3kL6rrwBZPAyc5vUxDSpVp/hfzu4WtVFig6CIFPI9gX2pqYszxJLewL+QH2D s3i1Z/VAvSGQ== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208005154" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208005154" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 00:49:44 -0700 IronPort-SDR: JkQ9BOwuW/94p+PKO6a08dFdT27AksYvJlkmA1iIAuSnkn5bnjAarqO6A7ETykUL5Lo/yZMNeB E/YeAgqwM76Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="303742142" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by fmsmga004.fm.intel.com with ESMTP; 01 Jul 2020 00:49:43 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit , jiancheng pei Date: Wed, 1 Jul 2020 08:49:41 +0100 Message-Id: <20200701074941.3847658-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/kni: set packet input port in eth_kni_rx() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: jiancheng pei Store port_id in pmd_internals when eth kni device is created. Then set packet port of rte_mbuf in function eth_kni_rx. Signed-off-by: Jecky Pei --- Sending patch to the email list on behalf of the Jecky, initially he sent as github pull request. --- drivers/net/kni/rte_eth_kni.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index d88cb1778..e3f5b101d 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -47,6 +47,7 @@ struct pmd_queue { struct pmd_internals { struct rte_kni *kni; + uint16_t port_id; int is_kni_started; pthread_t thread; @@ -78,9 +79,13 @@ eth_kni_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) struct pmd_queue *kni_q = q; struct rte_kni *kni = kni_q->internals->kni; uint16_t nb_pkts; + int i; nb_pkts = rte_kni_rx_burst(kni, bufs, nb_bufs); - + for (i = 0; i < nb_pkts; i++) { + bufs[i]->port = kni_q->internals->port_id; + } + kni_q->rx.pkts += nb_pkts; return nb_pkts; @@ -372,6 +377,7 @@ eth_kni_create(struct rte_vdev_device *vdev, return NULL; internals = eth_dev->data->dev_private; + internals->port_id = eth_dev->data->port_id; data = eth_dev->data; data->nb_rx_queues = 1; data->nb_tx_queues = 1; -- 2.25.4