From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m13-31.163.com (m13-31.163.com [220.181.13.31]) by dpdk.org (Postfix) with ESMTP id 6233F93C6 for ; Wed, 21 Oct 2015 11:54:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:MIME-Version:Message-ID; bh=bjYMu iY6EqThbCfWdcQ2HMYH2Zr5Vxt3/7aNoE239V8=; b=FoZdTxhnsvO6YOGhxgkgF 8H2Bsioh2WRAOKUd6t5fRIYznyMv7eA0eH2W89oHvlDFiZck05jP2dWHSMVT6/SS 9hnoRyGZf68V/5H08ZMVFUZzZX/OQWrBLGbSj9EbidgQsY6USW4gfWZDshohgLxQ Wi0f44uN8SILDFDOrw6QR0= Received: from mablexidana$163.com ( [182.92.253.20] ) by ajax-webmail-wmsvr31 (Coremail) ; Wed, 21 Oct 2015 17:54:13 +0800 (CST) X-Originating-IP: [182.92.253.20] Date: Wed, 21 Oct 2015 17:54:13 +0800 (CST) From: mablexidana To: dev@dpdk.org X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20150911(74783.7961) Copyright (c) 2002-2015 www.mailtech.cn 163com X-CM-CTRLDATA: Sbvup2Zvb3Rlcl9odG09Mzg0ODo1Ng== MIME-Version: 1.0 Message-ID: <5e5d9466.100a4.15089d2018f.Coremail.mablexidana@163.com> X-CM-TRANSID: H8GowAB3fwPFYCdW14eLAA--.2982W X-CM-SenderInfo: xpdezvp0lgt0rd6rljoofrz/xtbBDhiasFQG1nrmOAACse X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH] fix lpm bugs 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: Wed, 21 Oct 2015 09:54:17 -0000 aGk6CiAgICBXZSB0ZXN0IHNvbWUgbHBtIGNhc2VzIGFuZCBmaW5kIHNvbWUgYnVncywgYmVsb3cg aXMgaG93IHRvIGZpeCBpdC4gdGhhbmtzIDopCi0tLQogbGliL2xpYnJ0ZV9scG0vcnRlX2xwbS5j IHwgNSArKystLQogMSBmaWxlIGNoYW5nZWQsIDMgaW5zZXJ0aW9ucygrKSwgMiBkZWxldGlvbnMo LSkKCgpkaWZmIC0tZ2l0IGEvbGliL2xpYnJ0ZV9scG0vcnRlX2xwbS5jIGIvbGliL2xpYnJ0ZV9s cG0vcnRlX2xwbS5jCmluZGV4IDE2M2JhM2MuLmI1MTk5ZmYgMTAwNjQ0Ci0tLSBhL2xpYi9saWJy dGVfbHBtL3J0ZV9scG0uYworKysgYi9saWIvbGlicnRlX2xwbS9ydGVfbHBtLmMKQEAgLTczNSw3 ICs3MzUsNyBAQCBkZWxldGVfZGVwdGhfc21hbGwoc3RydWN0IHJ0ZV9scG0gKmxwbSwgdWludDMy X3QgaXBfbWFza2VkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbHBt LT50YmwyNFtpXS5kZXB0aCA8PSBkZXB0aCApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBscG0tPnRibDI0W2ldLnZhbGlkID0gSU5WQUxJRDsKICAgICAgICAgICAgICAgICAgICAg ICAgfQotICAgICAgICAgICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAg ICAgZWxzZSBpZiAobHBtLT50YmwyNFtpXS5leHRfZW50cnkgPT0gMSl7CiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBJ ZiBUQkwyNCBlbnRyeSBpcyBleHRlbmRlZCwgdGhlbiB0aGVyZSBoYXMKICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKiB0byBiZSBhIHJ1bGUgd2l0aCBkZXB0aCA+PSAyNSBpbiB0aGUK QEAgLTc3MCw2ICs3NzAsNyBAQCBkZWxldGVfZGVwdGhfc21hbGwoc3RydWN0IHJ0ZV9scG0gKmxw bSwgdWludDMyX3QgaXBfbWFza2VkLAoKCiAgICAgICAgICAgICAgICBzdHJ1Y3QgcnRlX2xwbV90 Ymw4X2VudHJ5IG5ld190Ymw4X2VudHJ5ID0gewogICAgICAgICAgICAgICAgICAgICAgICAudmFs aWQgPSBWQUxJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgLnZhbGlkX2dyb3VwID0gVkFMSUQs CiAgICAgICAgICAgICAgICAgICAgICAgIC5kZXB0aCA9IHN1Yl9ydWxlX2RlcHRoLAogICAgICAg ICAgICAgICAgICAgICAgICAubmV4dF9ob3AgPSBscG0tPnJ1bGVzX3RibAogICAgICAgICAgICAg ICAgICAgICAgICBbc3ViX3J1bGVfaW5kZXhdLm5leHRfaG9wLApAQCAtNzgxLDcgKzc4Miw3IEBA IGRlbGV0ZV9kZXB0aF9zbWFsbChzdHJ1Y3QgcnRlX2xwbSAqbHBtLCB1aW50MzJfdCBpcF9tYXNr ZWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBscG0tPnRibDI0W2ld LmRlcHRoIDw9IGRlcHRoICkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxwbS0+ dGJsMjRbaV0gPSBuZXdfdGJsMjRfZW50cnk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAg ICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgIGVsc2Ug IGlmIChscG0tPnRibDI0W2ldLmV4dF9lbnRyeSA9PSAxKSB7CiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKiBJZiBUQkwy NCBlbnRyeSBpcyBleHRlbmRlZCwgdGhlbiB0aGVyZSBoYXMKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKiB0byBiZSBhIHJ1bGUgd2l0aCBkZXB0aCA+PSAyNSBpbiB0aGUKLS0KMS44 LjUuMiAoQXBwbGUgR2l0LTQ4KQ== >From konstantin.ananyev@intel.com Wed Oct 21 12:05:58 2015 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 5CB6C93C6 for ; Wed, 21 Oct 2015 12:05:58 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 21 Oct 2015 03:05:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,711,1437462000"; d="scan'208";a="668680145" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga003.jf.intel.com with ESMTP; 21 Oct 2015 03:05:56 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.75]) by IRSMSX103.ger.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0248.002; Wed, 21 Oct 2015 11:05:55 +0100 From: "Ananyev, Konstantin" To: Yuanhan Liu , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v6 10/13] ixgbe: support VMDq RSS in non-SRIOV environment Thread-Index: AQHRAlYYP7r2l83IvEiKWAom8bEFYJ51Gm8w Date: Wed, 21 Oct 2015 10:05:54 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836AB3299@irsmsx105.ger.corp.intel.com> References: <1444369572-1157-1-git-send-email-yuanhan.liu@linux.intel.com> <1444369572-1157-11-git-send-email-yuanhan.liu@linux.intel.com> In-Reply-To: <1444369572-1157-11-git-send-email-yuanhan.liu@linux.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "marcel@redhat.com" , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v6 10/13] ixgbe: support VMDq RSS in non-SRIOV environment 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: Wed, 21 Oct 2015 10:05:59 -0000 Hi=20 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yuanhan Liu > Sent: Friday, October 09, 2015 6:46 AM > To: dev@dpdk.org > Cc: Michael S. Tsirkin; marcel@redhat.com > Subject: [dpdk-dev] [PATCH v6 10/13] ixgbe: support VMDq RSS in non-SRIOV= environment >=20 > From: Changchun Ouyang >=20 > In non-SRIOV environment, VMDq RSS could be enabled by MRQC register. > In theory, the queue number per pool could be 2 or 4, but only 2 queues > are available due to HW limitation, the same limit also exists in Linux > ixgbe driver. >=20 > Signed-off-by: Changchun Ouyang > Signed-off-by: Yuanhan Liu > --- > drivers/net/ixgbe/ixgbe_rxtx.c | 86 +++++++++++++++++++++++++++++++++++-= ------ > lib/librte_ether/rte_ethdev.c | 11 ++++++ > 2 files changed, 84 insertions(+), 13 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxt= x.c > index a598a72..e502fe8 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -3445,16 +3445,16 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev) > return; > } >=20 > -/* > - * VMDq only support for 10 GbE NIC. > +/** > + * Config pool for VMDq on 10 GbE NIC. > */ > static void > -ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev) > +ixgbe_vmdq_pool_configure(struct rte_eth_dev *dev) > { > struct rte_eth_vmdq_rx_conf *cfg; > struct ixgbe_hw *hw; > enum rte_eth_nb_pools num_pools; > - uint32_t mrqc, vt_ctl, vlanctrl; > + uint32_t vt_ctl, vlanctrl; > uint32_t vmolr =3D 0; > int i; >=20 > @@ -3463,12 +3463,6 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev= ) > cfg =3D &dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf; > num_pools =3D cfg->nb_queue_pools; >=20 > - ixgbe_rss_disable(dev); > - > - /* MRQC: enable vmdq */ > - mrqc =3D IXGBE_MRQC_VMDQEN; > - IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); > - > /* PFVTCTL: turn on virtualisation and set the default pool */ > vt_ctl =3D IXGBE_VT_CTL_VT_ENABLE | IXGBE_VT_CTL_REPLEN; > if (cfg->enable_default_pool) > @@ -3534,7 +3528,29 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev= ) > IXGBE_WRITE_FLUSH(hw); > } >=20 > -/* > +/** > + * VMDq only support for 10 GbE NIC. > + */ > +static void > +ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev) > +{ > + struct ixgbe_hw *hw; > + uint32_t mrqc; > + > + PMD_INIT_FUNC_TRACE(); > + hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + ixgbe_rss_disable(dev); > + > + /* MRQC: enable vmdq */ > + mrqc =3D IXGBE_MRQC_VMDQEN; > + IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); > + IXGBE_WRITE_FLUSH(hw); > + > + ixgbe_vmdq_pool_configure(dev); > +} > + > +/** > * ixgbe_dcb_config_tx_hw_config - Configure general VMDq TX parameters > * @hw: pointer to hardware structure > */ > @@ -3639,6 +3655,41 @@ ixgbe_config_vf_rss(struct rte_eth_dev *dev) > } >=20 > static int > +ixgbe_config_vmdq_rss(struct rte_eth_dev *dev) > +{ > + struct ixgbe_hw *hw; > + uint32_t mrqc; > + > + ixgbe_rss_configure(dev); > + > + hw =3D IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + /* MRQC: enable VMDQ RSS */ > + mrqc =3D IXGBE_READ_REG(hw, IXGBE_MRQC); > + mrqc &=3D ~IXGBE_MRQC_MRQE_MASK; > + > + switch (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) { > + case 2: > + mrqc |=3D IXGBE_MRQC_VMDQRSS64EN; > + break; > + > + case 4: > + mrqc |=3D IXGBE_MRQC_VMDQRSS32EN; > + break; > + > + default: > + PMD_INIT_LOG(ERR, "Invalid pool number in non-IOV mode with VMDQ RSS")= ; > + return -EINVAL; > + } > + > + IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); > + > + ixgbe_vmdq_pool_configure(dev); > + > + return 0; > +} So ixgbe_config_vmdq_rss() checks nb_q_per_pool value, and might return an = error if the value is invalid. Though this return value seems just ignored by ixgbe_dev_mq_rx_configure() = below. Probably, it is better to move nb_q_per_pool value checking into rte_eth_de= v_check_mq_mode(), as is done for other modes? I know it is no ideal, as it probably should be HW specific check, but seems anyway better than just ignoring the error. Konstantin > + > +static int > ixgbe_config_vf_default(struct rte_eth_dev *dev) > { > struct ixgbe_hw *hw =3D > @@ -3694,6 +3745,10 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev) > ixgbe_vmdq_rx_hw_configure(dev); > break; >=20 > + case ETH_MQ_RX_VMDQ_RSS: > + ixgbe_config_vmdq_rss(dev); > + break; > + > case ETH_MQ_RX_NONE: > /* if mq_mode is none, disable rss mode.*/ > default: ixgbe_rss_disable(dev); > @@ -4186,6 +4241,8 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) >=20 > /* Setup RX queues */ > for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > + uint32_t psrtype =3D 0; > + > rxq =3D dev->data->rx_queues[i]; >=20 > /* > @@ -4213,12 +4270,10 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) > if (rx_conf->header_split) { > if (hw->mac.type =3D=3D ixgbe_mac_82599EB) { > /* Must setup the PSRTYPE register */ > - uint32_t psrtype; > psrtype =3D IXGBE_PSRTYPE_TCPHDR | > IXGBE_PSRTYPE_UDPHDR | > IXGBE_PSRTYPE_IPV4HDR | > IXGBE_PSRTYPE_IPV6HDR; > - IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(rxq->reg_idx), psrtype); > } > srrctl =3D ((rx_conf->split_hdr_size << > IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & > @@ -4228,6 +4283,11 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) > #endif > srrctl =3D IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF; >=20 > + /* Set RQPL for VMDQ RSS according to max Rx queue */ > + psrtype |=3D (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool >> 1) << > + IXGBE_PSRTYPE_RQPL_SHIFT; > + IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(rxq->reg_idx), psrtype); > + > /* Set if packets are dropped when no descriptors available */ > if (rxq->drop_en) > srrctl |=3D IXGBE_SRRCTL_DROP_EN; > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c > index f593f6e..fe9dc5c 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -1067,6 +1067,17 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_= t nb_rx_q, uint16_t nb_tx_q, > return -EINVAL; > } > } > + > + if (dev_conf->rxmode.mq_mode =3D=3D ETH_MQ_RX_VMDQ_RSS) { > + uint32_t nb_queue_pools =3D > + dev_conf->rx_adv_conf.vmdq_rx_conf.nb_queue_pools; > + struct rte_eth_dev_info dev_info; > + > + rte_eth_dev_info_get(port_id, &dev_info); > + dev->data->dev_conf.rxmode.mq_mode =3D ETH_MQ_RX_VMDQ_RSS; > + RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =3D > + dev_info.vmdq_queue_num / nb_queue_pools; > + } > } > return 0; > } > -- > 1.9.0