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 95DB2A0527; Fri, 24 Jul 2020 17:10:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E91441C02A; Fri, 24 Jul 2020 17:10:33 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 802201C027 for ; Fri, 24 Jul 2020 17:10:32 +0200 (CEST) IronPort-SDR: IiqvQOLE0xE2YqLhHe5LclvfuwvgtJ/LcBsKy8gPkWHWO9A1247kYQwjJfMzj3/xP4jdElQlSv jZSaW0/h9CoA== X-IronPort-AV: E=McAfee;i="6000,8403,9692"; a="150708717" X-IronPort-AV: E=Sophos;i="5.75,391,1589266800"; d="scan'208";a="150708717" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2020 08:10:31 -0700 IronPort-SDR: 7SEIs7mmceB7YAKj473aRS676IbaVue8cIyp4YFE069OSZUgk0FEt+7YLDj6lh3CzSFIgkKzPu nAg2OHCUYj1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,391,1589266800"; d="scan'208";a="328941545" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by orsmga007.jf.intel.com with ESMTP; 24 Jul 2020 08:10:30 -0700 From: Ferruh Yigit To: Ferruh Yigit Cc: dev@dpdk.org, Jecky Pei Date: Fri, 24 Jul 2020 16:10:28 +0100 Message-Id: <20200724151028.1297434-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200701074941.3847658-1-ferruh.yigit@intel.com> References: <20200701074941.3847658-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] net/kni: set packet input port in 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 Reviewed-by: Ferruh Yigit --- drivers/net/kni/rte_eth_kni.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index cde98f0bb2..831fe96c96 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,8 +79,11 @@ 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; @@ -372,6 +376,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