From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B0393A04C7; Tue, 15 Sep 2020 09:10:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 980DD1BF83; Tue, 15 Sep 2020 09:10:34 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CFEEC1BF7F for ; Tue, 15 Sep 2020 09:10:32 +0200 (CEST) IronPort-SDR: d7lwr0Q/BgE25fO90XA4L7d0N/wohPbA0XmyHq0tNNh2vjkGvh0vFH8fFHnbhnfvU5tD3vAm7k HYS0ynlPQkBw== X-IronPort-AV: E=McAfee;i="6000,8403,9744"; a="156641209" X-IronPort-AV: E=Sophos;i="5.76,429,1592895600"; d="scan'208";a="156641209" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2020 00:10:31 -0700 IronPort-SDR: lPD5KWzDgZPBDHo2i4EQDOI4ScmEsy96J+Id8WHSld2s+k/M+rRWohlEEY0QAEhdB9YtoXix/B GfA5yECUkNvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,429,1592895600"; d="scan'208";a="451193287" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga004.jf.intel.com with ESMTP; 15 Sep 2020 00:10:23 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 15 Sep 2020 00:10:22 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 15 Sep 2020 00:10:22 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 15 Sep 2020 00:10:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Le6nTlXG5mM0KqFa0CXRkqLXPohByjIj/PDLa0zGxgtH6zW8xowYfEIHJcSewF6Nlj+LyYygJUUtZzbsLSIDbr5oJpMPZ+P8QDKGdCe17WqNNc9gvxxYQ70adBdfWtO3tDRtLRwsbbONmiJi761qSKG1xfaFFi5TpkIzrnvPTqsj9ZpDAZ804D6NFEfDSk0pfFZA8DDQOxXCEWQw5xEXBENOLZ7pYCv4HILQJShQXuJShWqMADeBLYBcIrqqvIDIayTocxwUy7YruxGbDT3XZfos7vL1HHvb3kjjVI/2KdTL2l+mCGAQlEv37vyXBjLNNrxaseU1Dh/RFabnBgiXCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mlxrZoqco8oRkIf43rqBmQYEMhoWvQyGzEJSAAyUbE0=; b=SdqWnw5n4XJJn/PWT+fHhmlWfyXO9Rig8SBOe0Z4mC2JdFHbqPeyJHc8cGalU8tjzpgPuJBIB9vNXW0pEBOfkAl1KtrQxs+hfZ5/7cGzpAcVrh5agz3Me2664JvZo2ewMAvBmZTAH7VsHZ+7Z8QY5pw0nUE5pQ9/lO4dv0Rc9YNHuWKIgdsjgnu3iMfGPycf0UvZQcJ2J/J+zM2WoaDB1YW7yL2E6q9Ny+x2pEjMJ43rUMzGcFXkBPKL37rmHwKnv2KIScYKqVP6k2bygQuQ7gLb3mRkQHMwOcnmsAEEIXzXT4UAP6Z5QaMG054I9MUG/1+t34hhQDO+iJD8NGD66A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mlxrZoqco8oRkIf43rqBmQYEMhoWvQyGzEJSAAyUbE0=; b=QYDXgCBgxaqB7iURAy9JoIR5bR5jyPzTxWXJOWaJ/w4h7tFwUf+uJzPC3vHMx8NPg0lbBLDgBPZhnyr7BjI3FWGpxXwt8iysJFh4WJdEDX+E+HSF4UB+b5Inny5ZrC9PLveZYI8QdeTbysd02qMbjOxrQWmWqAby9OHCe8o/T+w= Received: from BN7PR11MB2818.namprd11.prod.outlook.com (2603:10b6:406:ad::23) by BN6PR11MB3970.namprd11.prod.outlook.com (2603:10b6:405:7a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Tue, 15 Sep 2020 07:10:19 +0000 Received: from BN7PR11MB2818.namprd11.prod.outlook.com ([fe80::c95:a0c7:afc8:a602]) by BN7PR11MB2818.namprd11.prod.outlook.com ([fe80::c95:a0c7:afc8:a602%6]) with mapi id 15.20.3370.019; Tue, 15 Sep 2020 07:10:19 +0000 From: "Han, YingyaX" To: "Guo, Jia" , "Yang, Qiming" , "Xing, Beilei" , "Zhao1, Wei" , "Zhang, Qi Z" , "Wu, Jingjing" CC: "Richardson, Bruce" , "dev@dpdk.org" , "Guo, Jia" , "Zhang, Helin" , "mb@smartsharesystems.com" , "Yigit, Ferruh" , "Wang, Haiyue" , "stephen@networkplumber.org" , "barbette@kth.se" Thread-Topic: [dpdk-dev] [PATCH v3 4/5] net/ice: fix vector rx burst for ice Thread-Index: AQHWhnP4s3s++hdo0EGuxle7ZTABIalpUYdg Date: Tue, 15 Sep 2020 07:10:19 +0000 Message-ID: References: <20200827075452.1751-1-jia.guo@intel.com> <20200909063636.60205-1-jia.guo@intel.com> <20200909063636.60205-5-jia.guo@intel.com> In-Reply-To: <20200909063636.60205-5-jia.guo@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.193] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6e91ccdf-d017-4ffb-6587-08d8594667ae x-ms-traffictypediagnostic: BN6PR11MB3970: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: R7j7G5hN2IfBHZMBN5jSzn3PaR5gH2vMlfz4Ylt7bCkMh7ggb3Wzpz+wNc+pm3HlNJx2U4HEO9HzuYQeZXOVGktrvtGWF+N55Vnzkg7dpRCrlNeKFLuDZ703+jgi0JK24cffIt2HVA3hrbFl7WOXKVPao8UpthIfp3FTbjM1DjgciAC6zsjm0TAfIKFnsEOtGc3cvDdccaA9l6TV7n7PYH1lLnQSlPAeFhRFX0IhqdH5hQWUd7UqxwqSeER26YLrxcpbkiG+XSPdiM5LIxatjuiE0gAa/IO8z18giyo7y9+fuEypMokIwUDC4dRy3eziU4+5NQAxj1FERILR98jYKySYvjauBYWXD7DFNH+yN2XNpDRPBsbFCKzRu/HJE3Zy x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN7PR11MB2818.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(136003)(346002)(39860400002)(396003)(5660300002)(110136005)(8676002)(6506007)(53546011)(2906002)(6636002)(71200400001)(316002)(8936002)(186003)(54906003)(9686003)(33656002)(55016002)(26005)(52536014)(478600001)(7696005)(66946007)(66556008)(66476007)(4326008)(83380400001)(76116006)(86362001)(66446008)(64756008)(921003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: /1Czv9T7CXq8riRf62uTYDjifQp5XnE/Q6J1btNiCz3OXYHQePd8i8Gekrn8lgFiHaCF9MAk/XCClrv+sGEmusvBF3LyjxqGfvWdM9/Q3XyCdYNmkkThiOeMw+DKrvuCGBf2FCUHuyLok35HnRg6q2Ek8rw+uq8lSUPvucnzxbpJi56VMMypY0vDNmMaZH5KsA4B3vu1CR0ZTeU81OZ57IFw8gRSV8pic/uTI8OCgcmisKGtCLGfIY8Os9gXhJqdyWNF0z45s7PhbbVp7wKuwI3vx8YvWK1vzZ+GvUfq5Roqh4BXfukomaj17qu7pxvkWyfqzwAwqezB7vPc91OqmgpT8t9P4NTY+I/XrVm5jqkuz6pXAVhtKp9usiWNS4wTn1tGld5bAphz0EawvYEdyz8Hx5Zib2a5UWn0boHHwXF3jWMsv4JgzcUTqZy5pkeszcaqnHkpyxM9XqijlvzoMuuqFHIokAiBa9qkVVzLd5u7F/K5++8TbmsvqDfvFtMttvs2ra3JvF9iw4hc0/3G4kOOq5dbibFuUW5gWhPa1V03j94/Hz6ZgFfTTCMJaFo7r1wV+8joTbrawDjYo4OyLcGvN+8t57WGKOy5A/UB4CEaJofBM/vngYFrEbyBO1qh2Q7Rh0KG03F82iO7oZgJgQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN7PR11MB2818.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e91ccdf-d017-4ffb-6587-08d8594667ae X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2020 07:10:19.2102 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /i0iLJNFuURtWLpgQ8gp+XDzyZ2Mlf3nDB+6J6thqH0f/2irXXzB7EHjhhW7RPmHmhwdxyCRNC2hGRHp/QbCAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3970 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 4/5] net/ice: fix vector rx burst for ice X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Tested-by: Yingya Han -----Original Message----- From: dev On Behalf Of Jeff Guo Sent: Wednesday, September 9, 2020 2:37 PM To: Yang, Qiming ; Xing, Beilei ; Zhao1, Wei ; Zhang, Qi Z ; = Wu, Jingjing Cc: Richardson, Bruce ; dev@dpdk.org; Guo, Jia = ; Zhang, Helin ; mb@smartsharesys= tems.com; Yigit, Ferruh ; Wang, Haiyue ; stephen@networkplumber.org; barbette@kth.se Subject: [dpdk-dev] [PATCH v3 4/5] net/ice: fix vector rx burst for ice The limitation of burst size in vector rx was removed, since it should retr= ieve as much received packets as possible. And also the scattered receive p= ath should use a wrapper function to achieve the goal of burst maximizing. = And do some code cleaning for vector rx path. Signed-off-by: Jeff Guo --- drivers/net/ice/ice_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_avx2.c | 23 ++++++------ drivers/net/ice/ice= _rxtx_vec_sse.c | 56 +++++++++++++++++++---------- 3 files changed, 49 insertions(+), 31 deletions(-) diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index = 2fdcfb7d0..3ef5f300d 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -35,6 +35,7 @@ #define ICE_MAX_RX_BURST ICE_RXQ_REARM_THRESH #define ICE_TX_MAX_FREE_BUF_SZ 64 #define ICE_DESCS_PER_LOOP 4 +#define ICE_DESCS_PER_LOOP_AVX 8 =20 #define ICE_FDIR_PKT_LEN 512 =20 diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c b/drivers/net/ice/ice_rxtx= _vec_avx2.c index be50677c2..843e4f32a 100644 --- a/drivers/net/ice/ice_rxtx_vec_avx2.c +++ b/drivers/net/ice/ice_rxtx_vec_avx2.c @@ -29,7 +29,7 @@ ice_rxq_rearm(struct ice_rx_queue *rxq) __m128i dma_addr0; =20 dma_addr0 =3D _mm_setzero_si128(); - for (i =3D 0; i < ICE_DESCS_PER_LOOP; i++) { + for (i =3D 0; i < ICE_DESCS_PER_LOOP_AVX; i++) { rxep[i].mbuf =3D &rxq->fake_mbuf; _mm_store_si128((__m128i *)&rxdp[i].read, dma_addr0); @@ -132,12 +132,17 @@ ice_rxq_rearm(struct ice_rx_queue *rxq) ICE_PCI_REG_WRITE(rxq->qrx_tail, rx_id); } =20 +/** + * vPMD raw receive routine, only accept(nb_pkts >=3D=20 +ICE_DESCS_PER_LOOP_AVX) + * + * Notice: + * - nb_pkts < ICE_DESCS_PER_LOOP_AVX, just return no packet + * - floor align nb_pkts to a ICE_DESCS_PER_LOOP_AVX power-of-two */ static inline uint16_t _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, struct rte_mbuf **rx= _pkts, uint16_t nb_pkts, uint8_t *split_packet) { -#define ICE_DESCS_PER_= LOOP_AVX 8 - const uint32_t *ptype_tbl =3D rxq->vsi->adapter->ptype_tbl; const __m256i mbuf_init =3D _mm256_set_epi64x(0, 0, 0, rxq->mbuf_initializer); @@ -603,10 +608,6 @@ _ice_recv_raw_pkts_vec_avx2(struct ice_rx_queue *rxq, = struct rte_mbuf **rx_pkts, return received; } =20 -/** - * Notice: - * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet - */ uint16_t ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) @@ -616,8 +617,6 @@ ice_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf = **rx_pkts, =20 /** * vPMD receive routine that reassembles single burst of 32 scattered pack= ets - * Notice: - * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ static uint16_t ice_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkt= s, @@ -626,6 +625,9 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, st= ruct rte_mbuf **rx_pkts, struct ice_rx_queue *rxq =3D rx_queue; uint8_t split_flags[ICE_VPMD_RX_BURST] =3D {0}; =20 + /* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =3D RTE_MIN(nb_pkts, ICE_VPMD_RX_BURST); + /* get some new buffers */ uint16_t nb_bufs =3D _ice_recv_raw_pkts_vec_avx2(rxq, rx_pkts, nb_pkts, split_flags); @@ -657,9 +659,6 @@ ice_recv_scattered_burst_vec_avx2(void *rx_queue, struc= t rte_mbuf **rx_pkts, =20 /** * vPMD receive routine that reassembles scattered packets. - * Main receive routine that can handle arbitrary burst sizes - * Notice: - * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet */ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts= , diff --git a/drivers/net/ice/ice_rxtx_vec_sse.c b/drivers/net/ice/ice_rxt= x_vec_sse.c index 382ef31f3..c03e24092 100644 --- a/drivers/net/ice/ice_rxtx_vec_sse.c +++ b/drivers/net/ice/ice_rxtx_vec_sse.c @@ -205,10 +205,11 @@ ice_rx_desc_to_ptype_v(__m128i descs[4], struct rte_m= buf **rx_pkts, } =20 /** + * vPMD raw receive routine, only accept(nb_pkts >=3D ICE_DESCS_PER_LOOP) + * * Notice: * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet - * - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST - * numbers of DD bits + * - floor align nb_pkts to a ICE_DESCS_PER_LOOP power-of-two */ static inline uint16_t _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts= , @@ -264,9 +265,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, stru= ct rte_mbuf **rx_pkts, const __m128i eop_check =3D _mm_set_epi64x(0x0000000200000002LL, 0x0000000200000002LL); =20 - /* nb_pkts shall be less equal than ICE_MAX_RX_BURST */ - nb_pkts =3D RTE_MIN(nb_pkts, ICE_MAX_RX_BURST); - /* nb_pkts has to be floor-aligned to ICE_DESCS_PER_LOOP */ nb_pkts =3D RTE_ALIGN_FLOOR(nb_pkts, ICE_DESCS_PER_LOOP); =20 @@ -441,12 +439,6 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struc= t rte_mbuf **rx_pkts, return nb_pkts_recd; } =20 -/** - * Notice: - * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet - * - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST - * numbers of DD bits - */ uint16_t ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) @@ -454,19 +446,19 @@ ice_recv_pkts_vec(void *rx_queue, struct rte_mbuf **r= x_pkts, return _ice_recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL); } =20 -/* vPMD receive routine that reassembles scattered packets - * Notice: - * - nb_pkts < ICE_DESCS_PER_LOOP, just return no packet - * - nb_pkts > ICE_VPMD_RX_BURST, only scan ICE_VPMD_RX_BURST - * numbers of DD bits +/** + * vPMD receive routine that reassembles single burst of 32 scattered=20 +packets */ -uint16_t -ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +static uint16_t +ice_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) { struct ice_rx_queue *rxq =3D rx_queue; uint8_t split_flags[ICE_VPMD_RX_BURST] =3D {0}; =20 + /* split_flags only can support max of ICE_VPMD_RX_BURST */ + nb_pkts =3D RTE_MIN(nb_pkts, ICE_VPMD_RX_BURST); + /* get some new buffers */ uint16_t nb_bufs =3D _ice_recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, split_flags); @@ -496,6 +488,32 @@ ice_recv_scattered_pkts_vec(void *rx_queue, struct rte= _mbuf **rx_pkts, &split_flags[i]); } =20 +/** + * vPMD receive routine that reassembles scattered packets. + */ +uint16_t +ice_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + uint16_t retval =3D 0; + + while (nb_pkts > ICE_VPMD_RX_BURST) { + uint16_t burst; + + burst =3D ice_recv_scattered_burst_vec(rx_queue, + rx_pkts + retval, + ICE_VPMD_RX_BURST); + retval +=3D burst; + nb_pkts -=3D burst; + if (burst < ICE_VPMD_RX_BURST) + return retval; + } + + return retval + ice_recv_scattered_burst_vec(rx_queue, + rx_pkts + retval, + nb_pkts); +} + static inline void ice_vtx1(volatile struct ice_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags) -- 2.20.1