From patchwork Wed Dec 27 08:32:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 32768 X-Patchwork-Delegate: helin.zhang@intel.com 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 EC0281B2C4; Wed, 27 Dec 2017 09:40:14 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 51CAA1B2C3 for ; Wed, 27 Dec 2017 09:40:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Dec 2017 00:40:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,464,1508828400"; d="scan'208";a="5317775" Received: from dpdk2.bj.intel.com ([172.16.182.81]) by fmsmga007.fm.intel.com with ESMTP; 27 Dec 2017 00:40:11 -0800 From: Wei Zhao To: dev@dpdk.org Cc: orika@mellanox.com, Wei Zhao Date: Wed, 27 Dec 2017 16:32:15 +0800 Message-Id: <20171227083215.112330-1-wei.zhao1@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171226094905.83277-1-wei.zhao1@intel.com> References: <20171226094905.83277-1-wei.zhao1@intel.com> Subject: [dpdk-dev] [PATCH v2] examples/flow_filtering: add Tx queues setup process 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" This example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code. Signed-off-by: Wei Zhao Acked-by: Ori Kam --- v2: -add support the new tx offloads. --- examples/flow_filtering/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index 7d739b4..4a07b63 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -149,7 +149,18 @@ init_port(void) /**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = + DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; + struct rte_eth_txconf txq_conf; + struct rte_eth_dev_info dev_info; printf(":: initializing port: %d\n", port_id); ret = rte_eth_dev_configure(port_id, @@ -173,6 +184,21 @@ init_port(void) } } + rte_eth_dev_info_get(port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; + + for (i = 0; i < nr_queues; i++) { + ret = rte_eth_tx_queue_setup(port_id, i, 512, + rte_eth_dev_socket_id(port_id), + &txq_conf); + if (ret < 0) { + rte_exit(EXIT_FAILURE, + ":: Tx queue setup failed: err=%d, port=%u\n", + ret, port_id); + } + } + rte_eth_promiscuous_enable(port_id); ret = rte_eth_dev_start(port_id); if (ret < 0) {