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 271ECA0C4B; Fri, 15 Oct 2021 11:08:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F179F411E5; Fri, 15 Oct 2021 11:08:06 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id BC5BC411E5 for ; Fri, 15 Oct 2021 11:08:05 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10137"; a="314077424" X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="314077424" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 02:08:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="660460454" Received: from limiao-icelake.sh.intel.com ([10.67.115.199]) by orsmga005.jf.intel.com with ESMTP; 15 Oct 2021 02:08:04 -0700 From: Miao Li To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, miao.li@intel.com Date: Fri, 15 Oct 2021 17:09:11 +0000 Message-Id: <20211015170911.478394-6-miao.li@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015170911.478394-1-miao.li@intel.com> References: <20211015151223.425847-1-miao.li@intel.com> <20211015170911.478394-1-miao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 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 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 73a3ab5bc0..dac946c18f 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -505,7 +505,15 @@ 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){ + uint16_t actual_cksum, expected_cksum; + actual_cksum = pkt->hdr_checksum; + pkt->hdr_checksum = 0; + expected_cksum = rte_ipv4_cksum(pkt); + if (actual_cksum != expected_cksum) + return -2; + } /* * 3. The IP version number must be 4. If the version number is not 4 @@ -2637,6 +2645,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