From patchwork Wed Jul 17 07:58:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 56579 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 617C61DBF; Wed, 17 Jul 2019 09:58:43 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0809023D for ; Wed, 17 Jul 2019 09:58:38 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 00:58:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,273,1559545200"; d="scan'208";a="187509429" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.99]) by fmsmga001.fm.intel.com with ESMTP; 17 Jul 2019 00:58:37 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski , shahafs@mellanox.com Date: Wed, 17 Jul 2019 09:58:04 +0200 Message-Id: <20190717075806.2320-2-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190717075806.2320-1-marcinx.a.zapolski@intel.com> References: <20190715095623.579-1-marcinx.a.zapolski@intel.com> <20190717075806.2320-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [v2 1/3] examples/l3fwd*: fix use of internal struct 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" Modify l3fwd and related example apps to use locally defined port_conf instead of global rte_eth_devices which is not a part of public API. Apps should not be using internal DPDK data structures directly. Fixes: 1ef9600b2d20 ("examples/l3fwd: convert to ethdev offloads API") Fixes: ba8c103d2455 ("examples/l3fwd-acl: convert to new ethdev offloads API") Fixes: 40df1d7a695d ("examples/l3fwd-power: convert to new ethdev offloads API") Fixes: 43fc038262b8 ("examples/l3fwd-vf: convert to new ethdev offloads API") Fixes: 373149c631fe ("examples/performance-thread: convert to new offloads API") Cc: shahafs@mellanox.com Signed-off-by: Marcin Zapolski --- examples/l3fwd-acl/main.c | 6 +----- examples/l3fwd-power/main.c | 6 +----- examples/l3fwd-vf/main.c | 7 +------ examples/l3fwd/main.c | 6 +----- examples/performance-thread/l3fwd-thread/main.c | 6 +----- 5 files changed, 5 insertions(+), 26 deletions(-) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 09b7c3850..0c44df767 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -2022,14 +2022,10 @@ main(int argc, char **argv) fflush(stdout); /* init RX queues */ for (queue = 0; queue < qconf->n_rx_queue; ++queue) { - struct rte_eth_dev *dev; - struct rte_eth_conf *conf; struct rte_eth_rxconf rxq_conf; portid = qconf->rx_queue_list[queue].port_id; queueid = qconf->rx_queue_list[queue].queue_id; - dev = &rte_eth_devices[portid]; - conf = &dev->data->dev_conf; if (numa_on) socketid = (uint8_t) @@ -2042,7 +2038,7 @@ main(int argc, char **argv) rte_eth_dev_info_get(portid, &dev_info); rxq_conf = dev_info.default_rxconf; - rxq_conf.offloads = conf->rxmode.offloads; + rxq_conf.offloads = port_conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, socketid, &rxq_conf, pktmbuf_pool[socketid]); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 99c1208ce..7ac4cbe87 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -2378,13 +2378,9 @@ main(int argc, char **argv) /* init RX queues */ for(queue = 0; queue < qconf->n_rx_queue; ++queue) { struct rte_eth_rxconf rxq_conf; - struct rte_eth_dev *dev; - struct rte_eth_conf *conf; portid = qconf->rx_queue_list[queue].port_id; queueid = qconf->rx_queue_list[queue].queue_id; - dev = &rte_eth_devices[portid]; - conf = &dev->data->dev_conf; if (numa_on) socketid = \ @@ -2397,7 +2393,7 @@ main(int argc, char **argv) rte_eth_dev_info_get(portid, &dev_info); rxq_conf = dev_info.default_rxconf; - rxq_conf.offloads = conf->rxmode.offloads; + rxq_conf.offloads = port_conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, socketid, &rxq_conf, pktmbuf_pool[socketid]); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 1432f8969..572e74cf5 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -1022,13 +1022,8 @@ main(int argc, char **argv) fflush(stdout); /* init RX queues */ for(queue = 0; queue < qconf->n_rx_queue; ++queue) { - struct rte_eth_dev *dev; - struct rte_eth_conf *conf; - portid = qconf->rx_queue_list[queue].port_id; queueid = qconf->rx_queue_list[queue].queue_id; - dev = &rte_eth_devices[portid]; - conf = &dev->data->dev_conf; if (numa_on) socketid = (uint8_t)rte_lcore_to_socket_id(lcore_id); @@ -1040,7 +1035,7 @@ main(int argc, char **argv) rte_eth_dev_info_get(portid, &dev_info); rxq_conf = dev_info.default_rxconf; - rxq_conf.offloads = conf->rxmode.offloads; + rxq_conf.offloads = port_conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, socketid, &rxq_conf, pktmbuf_pool[socketid]); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 570693b32..3800bad19 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -971,14 +971,10 @@ main(int argc, char **argv) fflush(stdout); /* init RX queues */ for(queue = 0; queue < qconf->n_rx_queue; ++queue) { - struct rte_eth_dev *dev; - struct rte_eth_conf *conf; struct rte_eth_rxconf rxq_conf; portid = qconf->rx_queue_list[queue].port_id; queueid = qconf->rx_queue_list[queue].queue_id; - dev = &rte_eth_devices[portid]; - conf = &dev->data->dev_conf; if (numa_on) socketid = @@ -991,7 +987,7 @@ main(int argc, char **argv) rte_eth_dev_info_get(portid, &dev_info); rxq_conf = dev_info.default_rxconf; - rxq_conf.offloads = conf->rxmode.offloads; + rxq_conf.offloads = port_conf.rxmode.offloads; if (!per_port_pool) ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, socketid, diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index dd468958a..0121c71cb 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -3645,14 +3645,10 @@ main(int argc, char **argv) /* init RX queues */ for (queue = 0; queue < rx_thread[i].n_rx_queue; ++queue) { - struct rte_eth_dev *dev; - struct rte_eth_conf *conf; struct rte_eth_rxconf rxq_conf; portid = rx_thread[i].rx_queue_list[queue].port_id; queueid = rx_thread[i].rx_queue_list[queue].queue_id; - dev = &rte_eth_devices[portid]; - conf = &dev->data->dev_conf; if (numa_on) socketid = (uint8_t)rte_lcore_to_socket_id(lcore_id); @@ -3664,7 +3660,7 @@ main(int argc, char **argv) rte_eth_dev_info_get(portid, &dev_info); rxq_conf = dev_info.default_rxconf; - rxq_conf.offloads = conf->rxmode.offloads; + rxq_conf.offloads = port_conf.rxmode.offloads; ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, socketid, &rxq_conf, From patchwork Wed Jul 17 07:58:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 56580 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC34F2BBB; Wed, 17 Jul 2019 09:58:45 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id CB09923D for ; Wed, 17 Jul 2019 09:58:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 00:58:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,273,1559545200"; d="scan'208";a="187509432" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.99]) by fmsmga001.fm.intel.com with ESMTP; 17 Jul 2019 00:58:38 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski , alialnu@mellanox.com, Bruce Richardson Date: Wed, 17 Jul 2019 09:58:05 +0200 Message-Id: <20190717075806.2320-3-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190717075806.2320-1-marcinx.a.zapolski@intel.com> References: <20190715095623.579-1-marcinx.a.zapolski@intel.com> <20190717075806.2320-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [v2 2/3] examples/ip_fragmentation: fix use of internal struct 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" Modify ip_fragmentation example app to use rte_eth_info_get instead of global rte_eth_devices structure. Apps should not be using internal DPDK data structures directly. Fixes: 9758b956dcf4 ("examples/ip_fragmentation: fix Tx queues init") Cc: alialnu@mellanox.com Signed-off-by: Marcin Zapolski Acked-by: Bruce Richardson --- examples/ip_fragmentation/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 85c0100f7..a2a14e827 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -989,7 +989,7 @@ main(int argc, char **argv) if (rte_lcore_is_enabled(lcore_id) == 0) continue; - if (queueid >= rte_eth_devices[portid].data->nb_tx_queues) + if (queueid >= dev_info.nb_tx_queues) break; socket = (int) rte_lcore_to_socket_id(lcore_id); From patchwork Wed Jul 17 07:58:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 56581 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 68A532F42; Wed, 17 Jul 2019 09:58:48 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0BA1023D for ; Wed, 17 Jul 2019 09:58:40 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 00:58:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,273,1559545200"; d="scan'208";a="187509437" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.99]) by fmsmga001.fm.intel.com with ESMTP; 17 Jul 2019 00:58:39 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski , nelio.laranjeiro@6wind.com, Bruce Richardson Date: Wed, 17 Jul 2019 09:58:06 +0200 Message-Id: <20190717075806.2320-4-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190717075806.2320-1-marcinx.a.zapolski@intel.com> References: <20190715095623.579-1-marcinx.a.zapolski@intel.com> <20190717075806.2320-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [v2 3/3] examples/ipsec-secgw: fix use of internal struct 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" Modify ipsec-secgw example app to use rte_eth_dev_info_get instead of rte_eth_dev. Apps should not be using internal DPDK data structures directly. Fixes: a4677f78368b ("examples/ipsec-secgw: add target queues in flow actions") Cc: nelio.laranjeiro@6wind.com Signed-off-by: Marcin Zapolski Reviewed-by: Bruce Richardson Acked-by: Nelio Laranjeiro --- examples/ipsec-secgw/ipsec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 7b8533077..7d3f5f736 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -186,23 +186,22 @@ create_session(struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa) .rss_key = rss_key, .rss_key_len = 40, }; - struct rte_eth_dev *eth_dev; + struct rte_eth_dev_info dev_info; uint16_t queue[RTE_MAX_QUEUES_PER_PORT]; struct rte_flow_action_rss action_rss; unsigned int i; unsigned int j; + rte_eth_dev_info_get(sa->portid, &dev_info); sa->action[2].type = RTE_FLOW_ACTION_TYPE_END; /* Try RSS. */ sa->action[1].type = RTE_FLOW_ACTION_TYPE_RSS; sa->action[1].conf = &action_rss; - eth_dev = ctx->device; rte_eth_dev_rss_hash_conf_get(sa->portid, &rss_conf); for (i = 0, j = 0; - i < eth_dev->data->nb_rx_queues; ++i) - if (eth_dev->data->rx_queues[i]) - queue[j++] = i; + i < dev_info.nb_rx_queues; ++i) + queue[j++] = i; action_rss = (struct rte_flow_action_rss){ .types = rss_conf.rss_hf, .key_len = rss_conf.rss_key_len,