From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C807A0C47; Tue, 12 Oct 2021 08:21:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F9F54111A; Tue, 12 Oct 2021 08:21:36 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id D4E084111A for ; Tue, 12 Oct 2021 08:21:34 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10134"; a="226953506" X-IronPort-AV: E=Sophos;i="5.85,366,1624345200"; d="scan'208";a="226953506" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2021 23:21:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,366,1624345200"; d="scan'208";a="591613094" Received: from limiao-icelake.sh.intel.com ([10.67.115.199]) by orsmga004.jf.intel.com with ESMTP; 11 Oct 2021 23:21:33 -0700 From: Miao Li To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, miao.li@intel.com Date: Tue, 12 Oct 2021 14:22:50 +0000 Message-Id: <20211012142250.410803-6-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211012142250.410803-1-miao.li@intel.com> References: <20210924102309.231304-1-miao.li@intel.com> <20211012142250.410803-1-miao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 5/5] examples/l3fwd-power: support virtio/vhost X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" In l3fwd-power, there is default port configuration which requires RSS and IPV4/UDP/TCP checksum. Once device does not support these, the l3fwd-power will exit and report an error. This patch updates the port configuration based on device capabilities after getting the device information to support devices like virtio and vhost. Signed-off-by: Miao Li --- examples/l3fwd-power/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 73a3ab5bc0..61c15e01d2 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -505,7 +505,9 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) return -1; /* 2. The IP checksum must be correct. */ - /* this is checked in H/W */ + /* if this is not checked in H/W, check it. */ + if ((port_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM) == 0) + rte_ipv4_cksum(pkt); /* * 3. The IP version number must be 4. If the version number is not 4 @@ -2637,6 +2639,11 @@ main(int argc, char **argv) local_port_conf.rx_adv_conf.rss_conf.rss_hf); } + if (local_port_conf.rx_adv_conf.rss_conf.rss_hf == 0) + local_port_conf.rxmode.mq_mode = ETH_MQ_RX_NONE; + local_port_conf.rxmode.offloads &= dev_info.rx_offload_capa; + port_conf.rxmode.offloads = local_port_conf.rxmode.offloads; + ret = rte_eth_dev_configure(portid, nb_rx_queue, (uint16_t)n_tx_queue, &local_port_conf); if (ret < 0) -- 2.25.1