From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B24BC5A58 for ; Wed, 3 Jun 2015 08:52:23 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 02 Jun 2015 23:52:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,545,1427785200"; d="scan'208";a="501962505" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by FMSMGA003.fm.intel.com with ESMTP; 02 Jun 2015 23:52:22 -0700 Received: from kmsmsx154.gar.corp.intel.com (172.21.73.14) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 3 Jun 2015 14:52:19 +0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 3 Jun 2015 14:52:18 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.94]) by SHSMSX101.ccr.corp.intel.com ([10.239.4.153]) with mapi id 14.03.0224.002; Wed, 3 Jun 2015 14:52:18 +0800 From: "Wu, Jingjing" To: "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [PATCH v2] i40evf: fix of supporting jumbo frame Thread-Index: AQHQiGbtxafC5HstC0qtPJV+T4sCJ52agkNg Date: Wed, 3 Jun 2015 06:52:17 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F8C38F37@SHSMSX104.ccr.corp.intel.com> References: <1429687117-3421-1-git-send-email-helin.zhang@intel.com> <1430962859-26782-1-git-send-email-helin.zhang@intel.com> In-Reply-To: <1430962859-26782-1-git-send-email-helin.zhang@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 v2] i40evf: fix of supporting jumbo frame 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, 03 Jun 2015 06:52:24 -0000 Acked-by: Jingjing Wu > -----Original Message----- > From: Zhang, Helin > Sent: Thursday, May 07, 2015 9:41 AM > To: dev@dpdk.org > Cc: Cao, Min; Wu, Jingjing; Liu, Jijiang; Xu, Qian Q; Zhang, Helin > Subject: [PATCH v2] i40evf: fix of supporting jumbo frame >=20 > It wouldn't check the configured maximum packet length, and then the > scattered receiving function wouldn't be selected at all even if it wants= to > receive a jumbo frame. The fix is to select the correct RX function accor= ding > to the configurations. >=20 > Signed-off-by: Helin Zhang > --- > lib/librte_pmd_i40e/i40e_ethdev.h | 2 + > lib/librte_pmd_i40e/i40e_ethdev_vf.c | 85 +++++++++++++++++++++++-- > --------- > lib/librte_pmd_i40e/i40e_rxtx.c | 1 - > 3 files changed, 59 insertions(+), 29 deletions(-) >=20 > v2 changes: > * Removed maximum packet length check and jumbo frame check in > i40evf_dev_start(), as the same checks are already in each queue > initialization. >=20 > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.h > b/lib/librte_pmd_i40e/i40e_ethdev.h > index b9bed5a..7ecd249 100644 > --- a/lib/librte_pmd_i40e/i40e_ethdev.h > +++ b/lib/librte_pmd_i40e/i40e_ethdev.h > @@ -36,6 +36,8 @@ >=20 > #include >=20 > +#define I40E_VLAN_TAG_SIZE 4 > + > #define I40E_AQ_LEN 32 > #define I40E_AQ_BUF_SZ 4096 > /* Number of queues per TC should be one of 1, 2, 4, 8, 16, 32, 64 */ di= ff --git > a/lib/librte_pmd_i40e/i40e_ethdev_vf.c > b/lib/librte_pmd_i40e/i40e_ethdev_vf.c > index a0d808f..e260bb5 100644 > --- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c > +++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c > @@ -1417,23 +1417,74 @@ i40evf_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vlan_id, int on) } >=20 > static int > +i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) { > + struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); > + struct rte_eth_dev_data *dev_data =3D dev->data; > + struct rte_pktmbuf_pool_private *mbp_priv; > + uint16_t buf_size, len; > + > + rxq->qrx_tail =3D hw->hw_addr + I40E_QRX_TAIL1(rxq->queue_id); > + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); > + I40EVF_WRITE_FLUSH(hw); > + > + /* Calculate the maximum packet length allowed */ > + mbp_priv =3D rte_mempool_get_priv(rxq->mp); > + buf_size =3D (uint16_t)(mbp_priv->mbuf_data_room_size - > + RTE_PKTMBUF_HEADROOM); > + rxq->hs_mode =3D i40e_header_split_none; > + rxq->rx_hdr_len =3D 0; > + rxq->rx_buf_len =3D RTE_ALIGN(buf_size, (1 << > I40E_RXQ_CTX_DBUFF_SHIFT)); > + len =3D rxq->rx_buf_len * I40E_MAX_CHAINED_RX_BUFFERS; > + rxq->max_pkt_len =3D RTE_MIN(len, > + dev_data->dev_conf.rxmode.max_rx_pkt_len); > + > + /** > + * Check if the jumbo frame and maximum packet length are set > correctly > + */ > + if (dev_data->dev_conf.rxmode.jumbo_frame =3D=3D 1) { > + if (rxq->max_pkt_len <=3D ETHER_MAX_LEN || > + rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { > + PMD_DRV_LOG(ERR, "maximum packet length must > be " > + "larger than %u and smaller than %u, as > jumbo " > + "frame is enabled", > (uint32_t)ETHER_MAX_LEN, > + (uint32_t)I40E_FRAME_SIZE_MAX); > + return I40E_ERR_CONFIG; > + } > + } else { > + if (rxq->max_pkt_len < ETHER_MIN_LEN || > + rxq->max_pkt_len > ETHER_MAX_LEN) { > + PMD_DRV_LOG(ERR, "maximum packet length must > be " > + "larger than %u and smaller than %u, as > jumbo " > + "frame is disabled", > (uint32_t)ETHER_MIN_LEN, > + (uint32_t)ETHER_MAX_LEN); > + return I40E_ERR_CONFIG; > + } > + } > + > + if (dev_data->dev_conf.rxmode.enable_scatter > + || (rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) > > buf_size) { > + dev_data->scattered_rx =3D 1; > + dev->rx_pkt_burst =3D i40e_recv_scattered_pkts; > + } > + > + return 0; > +} > + > +static int > i40evf_rx_init(struct rte_eth_dev *dev) { > struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > uint16_t i; > struct i40e_rx_queue **rxq =3D > (struct i40e_rx_queue **)dev->data->rx_queues; > - struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data- > >dev_private); >=20 > i40evf_config_rss(vf); > for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > - rxq[i]->qrx_tail =3D hw->hw_addr + I40E_QRX_TAIL1(i); > - I40E_PCI_REG_WRITE(rxq[i]->qrx_tail, rxq[i]->nb_rx_desc - > 1); > + if (i40evf_rxq_init(dev, rxq[i]) < 0) > + return -EFAULT; > } >=20 > - /* Flush the operation to write registers */ > - I40EVF_WRITE_FLUSH(hw); > - > return 0; > } >=20 > @@ -1474,28 +1525,6 @@ i40evf_dev_start(struct rte_eth_dev *dev) > PMD_INIT_FUNC_TRACE(); >=20 > vf->max_pkt_len =3D dev->data->dev_conf.rxmode.max_rx_pkt_len; > - if (dev->data->dev_conf.rxmode.jumbo_frame =3D=3D 1) { > - if (vf->max_pkt_len <=3D ETHER_MAX_LEN || > - vf->max_pkt_len > I40E_FRAME_SIZE_MAX) { > - PMD_DRV_LOG(ERR, "maximum packet length must > " > - "be larger than %u and smaller than %u," > - "as jumbo frame is enabled", > - (uint32_t)ETHER_MAX_LEN, > - (uint32_t)I40E_FRAME_SIZE_MAX); > - return I40E_ERR_CONFIG; > - } > - } else { > - if (vf->max_pkt_len < ETHER_MIN_LEN || > - vf->max_pkt_len > ETHER_MAX_LEN) { > - PMD_DRV_LOG(ERR, "maximum packet length must > be " > - "larger than %u and smaller than %u, " > - "as jumbo frame is disabled", > - (uint32_t)ETHER_MIN_LEN, > - (uint32_t)ETHER_MAX_LEN); > - return I40E_ERR_CONFIG; > - } > - } > - > vf->num_queue_pairs =3D RTE_MAX(dev->data->nb_rx_queues, > dev->data->nb_tx_queues); >=20 > diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_r= xtx.c > index 493cfa3..49d1030 100644 > --- a/lib/librte_pmd_i40e/i40e_rxtx.c > +++ b/lib/librte_pmd_i40e/i40e_rxtx.c > @@ -64,7 +64,6 @@ > #define DEFAULT_TX_FREE_THRESH 32 > #define I40E_MAX_PKT_TYPE 256 >=20 > -#define I40E_VLAN_TAG_SIZE 4 > #define I40E_TX_MAX_BURST 32 >=20 > #define I40E_DMA_MEM_ALIGN 4096 > -- > 1.7.7