From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0173C568A for ; Fri, 17 Jul 2015 11:07:58 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 17 Jul 2015 02:07:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,494,1432623600"; d="scan'208";a="525844235" Received: from kmsmsx154.gar.corp.intel.com ([172.21.73.14]) by FMSMGA003.fm.intel.com with ESMTP; 17 Jul 2015 02:07:57 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 17 Jul 2015 17:07:24 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002; Fri, 17 Jul 2015 17:07:16 +0800 From: "Xu, Qian Q" To: "Wu, Jingjing" , "dev@dpdk.org" Thread-Topic: [PATCH] i40e: fix the VF rss issue when nb_rx_queue is less than nb_tx_queue Thread-Index: AQHQvQpLLs6obe0DEE+lTjLFZR9SDp3fYoUA Date: Fri, 17 Jul 2015 09:07:16 +0000 Message-ID: <82F45D86ADE5454A95A89742C8D1410E01D7D439@shsmsx102.ccr.corp.intel.com> References: <1436750501-6585-1-git-send-email-jingjing.wu@intel.com> In-Reply-To: <1436750501-6585-1-git-send-email-jingjing.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] i40e: fix the VF rss issue when nb_rx_queue is less than nb_tx_queue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2015 09:07:59 -0000 Tested-by: Qian Xu - Test Commit: 58d3da9eddad28012c16523aa0b5f63dae791bcb - OS: Fedora 21 - GCC: gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1) - CPU: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz - NIC: Intel Corporation Ethernet Controller XL710 for 40G = = bE QSFP+ - Target: x86_64-native-linuxapp-gcc - Guest: Fedora 20/ 3.11 kernel - Total 1 cases, 1 passed, 0 failed. Test case: L3FWD-VF on VM 1. Fortville PF generate 2VFs.=20 2. assign the VF to VM and launch the VM:=20 taskset -c 4-9 qemu-system-x86_64 \ -object memory-backend-file,id=3Dmem,size=3D2048M,mem-path=3D/mnt/huge -mem= -prealloc \ -enable-kvm -m 2048 -smp cores=3D6,sockets=3D1 -cpu host -name dpdk1-vm1 \ -drive file=3D/home/img/fc21-vm1.img \ -device pci-assign,host=3D03:02.0 \ -device pci-assign,host=3D03:02.1 \ -device pci-assign,host=3D05:02.0 \ -device pci-assign,host=3D05:02.1 \ -netdev tap,id=3Dipvm1,ifname=3Dtap3,script=3D/etc/qemu-ifup -device rtl813= 9,netdev=3Dipvm1,id=3Dnet0,mac=3D00:00:00:00:00:01 \ -localtime -nographic 3. keep pf in dpdk driver, run testpmd but not start 4. run l3fwd in the VM, and send packets to VFs, no packet drops.=20 Thanks Qian -----Original Message----- From: Wu, Jingjing=20 Sent: Monday, July 13, 2015 9:22 AM To: dev@dpdk.org Cc: Wu, Jingjing; Xu, Qian Q; Zhang, Helin Subject: [PATCH] i40e: fix the VF rss issue when nb_rx_queue is less than n= b_tx_queue From: "jingjing.wu" I40e VF driver uses the num_queue_pairs in vf structure to construct queue = index look up table. When the nb_rx_queue is less than nb_tx_queue, num_que= ue_pairs is equal to nb_tx_queue. It will make the table use invalid queue = index, then application cannot poll packets on these queues. This patch also moves the inline function i40e_align_floor from i40e_ethdev= .c to i40e_ethdev.h. Signed-off-by: jingjing.wu --- drivers/net/i40e/i40e_ethdev.c | 8 -------- drivers/net/i40e/i40e_ethdev.h | 8 ++++++++ drivers/net/i40e/i40e_ethdev_vf.c | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.= c index 5fb6b4c..051fd02 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -282,14 +282,6 @@ static struct eth_driver rte_i40e_pmd =3D { }; =20 static inline int -i40e_align_floor(int n) -{ - if (n =3D=3D 0) - return 0; - return (1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n))); -} - -static inline int rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev, struct rte_eth_link *link) { diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.= h index 883ee06..6185657 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -563,6 +563,14 @@ i40e_init_adminq_parameter(struct i40e_hw *hw) hw->aq.asq_buf_size =3D I40E_AQ_BUF_SZ; } =20 +static inline int +i40e_align_floor(int n) +{ + if (n =3D=3D 0) + return 0; + return 1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n)); } + #define I40E_VALID_FLOW(flow_type) \ ((flow_type) =3D=3D RTE_ETH_FLOW_FRAG_IPV4 || \ (flow_type) =3D=3D RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \ diff --git a/driver= s/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index b150b62..c4ce2cf 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1481,6 +1481,8 @@ i40evf_rx_init(struct rte_eth_dev *dev) =20 i40evf_config_rss(vf); for (i =3D 0; i < dev->data->nb_rx_queues; i++) { + if (!rxq[i] || !rxq[i]->q_set) + continue; if (i40evf_rxq_init(dev, rxq[i]) < 0) return -EFAULT; } @@ -1857,6 +1859,7 @@ i40evf_config_rss(struct i40e_vf *vf) struct i40e_hw *hw =3D I40E_VF_TO_HW(vf); struct rte_eth_rss_conf rss_conf; uint32_t i, j, lut =3D 0, nb_q =3D (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4; + uint16_t num; =20 if (vf->dev_data->dev_conf.rxmode.mq_mode !=3D ETH_MQ_RX_RSS) { i40evf_disable_rss(vf); @@ -1864,9 +1867,10 @@ i40evf_config_rss(struct i40e_vf *vf) return 0; } =20 + num =3D i40e_align_floor(vf->dev_data->nb_rx_queues); /* Fill out the look up table */ for (i =3D 0, j =3D 0; i < nb_q; i++, j++) { - if (j >=3D vf->num_queue_pairs) + if (j >=3D num) j =3D 0; lut =3D (lut << 8) | j; if ((i & 3) =3D=3D 3) -- 2.4.0