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 191B2A057B; Thu, 2 Apr 2020 12:02:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DC7A41BE8D; Thu, 2 Apr 2020 12:02:54 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130042.outbound.protection.outlook.com [40.107.13.42]) by dpdk.org (Postfix) with ESMTP id A88892C15 for ; Thu, 2 Apr 2020 12:02:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F94HnqA277TRyLygfAJ/Nfx6UkH+tJJ5/Mt/4cHSq52PW2Zug5BjqZ3dEyN3srLugM6Z9ntE/+Qwx+DYKwDduYmqLKzqa7wFHlEYO+NmRUSbEhHYbtVT/9hr6TjRhsIY0BQmfDFr81EE4AvI2u669Kgl+z0HM476P+/tRbKsRRLlh7tqWevGCvvJTqAjOnbETblHYVc90vD3N2BVqSLuSFUKDQRWbMg/00eHktLnP8XmY/rKnWeDZDrSTSTYlKsgXXCmJXRbCLn4Y0Jt6cvb7BCv42Ai4aGvoUMSmcTopVTvnwgu12VXN5FcZvLre7tU6OnJW8WRFpTu1i15FfyAEQ== 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=QkHnm1UKZ85ZzLLzZegRcoyPxYd8DOxLma18LaeqF8s=; b=Ptc9hzHRYyhwXyvl3yu/t4ZAmDQiYSdcS6fSxwTWERLNNVmM1tKWXVrWNmjkgMeThKptqdiswuPu2Je/LJMXyG2mqSnSpf+f80BthRy8qWS9EVXM4VxePPv3BcF+shROA7UJ/Z2c+wAq9patlHI0MKtsCh/SKsxnjus3mQoO3svVLhG8FMW7JANNi+OsmhBh8b57PMXoiweDAPJBSWWygRc9GZ3GeyA0Z5pbf9uHvF3UKeUpj7vjq8OOFzO+/LCuThJN4w/oamEuduPkPxtXK/QlKBLwr7CNQNQlEoRNrHneSTNYFBzhHElKU7D7ti9+T7BwgpU/GbSGJ102F5OuHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QkHnm1UKZ85ZzLLzZegRcoyPxYd8DOxLma18LaeqF8s=; b=R1xuFVaIEDhBM8rtt/MLt7PlNGJjdDe08tORxW6/WT9DvuigUvsgHOpQ6AIjynRT4RI+/3mPkFrJGR5/xFxtQGHG2h67br6LShyQjgbJNCERrnWzdRZSGPMIx33XvLue193+XaZTk6PwTxvJV9KSmlAYq5H+GK2eHlzMhyCE6eU= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3489.eurprd05.prod.outlook.com (10.170.126.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15; Thu, 2 Apr 2020 10:02:52 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da5:7919:35c1:894]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::da5:7919:35c1:894%6]) with mapi id 15.20.2856.019; Thu, 2 Apr 2020 10:02:52 +0000 From: Slava Ovsiienko To: Alexander Kozyrev , "dev@dpdk.org" CC: Raslan Darawsheh , Matan Azrad , "ferruh.yigit@intel.com" , Thomas Monjalon Thread-Topic: [PATCH 4/4] net/mlx5: add multi-segment packets in MPRQ mode Thread-Index: AQHWB6a8uOH0Q/bFC0adp/zFr/IIWKhlnGaA Date: Thu, 2 Apr 2020 10:02:52 +0000 Message-ID: References: <1585691559-17409-1-git-send-email-akozyrev@mellanox.com> <1585691559-17409-5-git-send-email-akozyrev@mellanox.com> In-Reply-To: <1585691559-17409-5-git-send-email-akozyrev@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0371fa6f-bed6-406f-aab7-08d7d6ed020d x-ms-traffictypediagnostic: AM4PR05MB3489:|AM4PR05MB3489: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3173; x-forefront-prvs: 0361212EA8 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM4PR05MB3265.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10009020)(4636009)(136003)(396003)(39860400002)(366004)(346002)(376002)(110136005)(53546011)(71200400001)(81166006)(478600001)(81156014)(4326008)(64756008)(8936002)(66446008)(66556008)(66476007)(86362001)(55016002)(9686003)(66946007)(316002)(6506007)(186003)(26005)(2906002)(8676002)(7696005)(5660300002)(52536014)(54906003)(33656002)(76116006); DIR:OUT; SFP:1101; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BGxAzNUGfzYXjBQw2/6w1QTRp9PspJO5NrgQ/oxWJdRKPgq1iiTfThOwXHTabg7dyV0+DKQH7jC6ryGn5oznGVA7sGnxSiAIFbbci1Glj3SLTTvx7Fkp96VORI5vMK1y3E4pejw8dfoqxOoAZMAFns1Po1ot/ho+NNWCFBW9pZZUlokzspnU3pwpu7zjxoZCYBR9NfQbMp2glngAnb434DT/WN5Z2a0AeOWbOLHdWPn0L6KLiBZcUDA/vQ6XZmi550muXtxse0D7P5yySmySYJtmL2lYw0fGGc0trBTQBB8wFTI0Xki4HbHWFYgmAMB6nvkli7185aFUOeTVsCNS+p33JudifDKKhkJcS7GdZCTuF/MQYbT2kFbXcka4gux3bG36vFXR+ywVYWtyDf8EVIqQXzRu+HDRYkZDcIh0/rMNgJ/S1fsrLbqdUhTOGnsa x-ms-exchange-antispam-messagedata: UWWo/oUBQHmkGk1uU5GgkTSUG2dbIh+KZwsAY5dcET7ohcx7KuwtT1hDPgcxeic5fkc5SnLil4Dr4QrmbfPOneAZNCKaEqBDy+o8sl/1LNB28LFUKENxEVeVG7ZV+0UgQdHjOVncbuY2avCjgL4izg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0371fa6f-bed6-406f-aab7-08d7d6ed020d X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Apr 2020 10:02:52.5248 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HZ4VAotRoz3/cCWrgSxaDHZZVSFqcMDmuVtVRT35auIVqVvpOpkg4RFdRuQ8Xmkl453A790kCbhfeJjEfNfUVKr2bTFHE7Hk4ho5B/6fXDw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3489 Subject: Re: [dpdk-dev] [PATCH 4/4] net/mlx5: add multi-segment packets in MPRQ mode 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" > -----Original Message----- > From: Alexander Kozyrev > Sent: Wednesday, April 1, 2020 0:53 > To: dev@dpdk.org > Cc: Raslan Darawsheh ; Matan Azrad > ; Slava Ovsiienko ; > ferruh.yigit@intel.com; Thomas Monjalon > Subject: [PATCH 4/4] net/mlx5: add multi-segment packets in MPRQ mode >=20 > The multi-stride operations now allow to reduce a stride size while suppo= rting > Jumbo frames. That means that it is possible to have mbufs configured wit= h a > size smaller than the whole packet received. It is not an issue during no= rmal > MPRQ operations since we attach external buffers instead of copying the d= ata > into the mbuf itself. But it is not the case in "emergency mode" > when we have to copy every packet because of no more external mbufs are > available. Assemble a multi-segment packet to overcome this issue in case > scatter mode is enabled, drop a packet if not. >=20 > Signed-off-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_rxtx.c | 47 > ++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 39 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c = index > 4c27952..7ce3732 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -1734,22 +1734,52 @@ enum mlx5_txcmp_code { > * Memcpy packets to the target mbuf if: > * - The size of packet is smaller than > mprq_max_memcpy_len. > * - Out of buffer in the Mempool for Multi-Packet RQ. > - * - There is no space for a headroom and scatter is disabled. > + * - The packet's stride overlaps a headroom and scatter is off. > */ > if (len <=3D rxq->mprq_max_memcpy_len || > rxq->mprq_repl =3D=3D NULL || > (hdrm_overlap > 0 && !rxq->strd_scatter_en)) { > - /* > - * When memcpy'ing packet due to out-of-buffer, the > - * packet must be smaller than the target mbuf. > - */ > - if (unlikely(rte_pktmbuf_tailroom(pkt) < len)) { > + if (likely(rte_pktmbuf_tailroom(pkt) >=3D len)) { > + rte_memcpy(rte_pktmbuf_mtod(pkt, void *), > + addr, len); > + DATA_LEN(pkt) =3D len; > + } else if (rxq->strd_scatter_en) { > + struct rte_mbuf *prev =3D pkt; > + uint32_t seg_len =3D > + RTE_MIN(rte_pktmbuf_tailroom(pkt), > len); > + uint32_t rem_len =3D len - seg_len; > + > + rte_memcpy(rte_pktmbuf_mtod(pkt, void *), > + addr, seg_len); > + DATA_LEN(pkt) =3D seg_len; > + while (rem_len) { > + struct rte_mbuf *next =3D > + rte_pktmbuf_alloc(rxq->mp); > + > + if (unlikely(next =3D=3D NULL)) { > + rte_pktmbuf_free(pkt); > + ++rxq->stats.rx_nombuf; > + goto out; > + } > + NEXT(prev) =3D next; > + SET_DATA_OFF(next, 0); > + addr =3D RTE_PTR_ADD(addr, seg_len); > + seg_len =3D RTE_MIN > + (rte_pktmbuf_tailroom(next), > + rem_len); > + rte_memcpy > + (rte_pktmbuf_mtod(next, > void *), > + addr, seg_len); > + DATA_LEN(next) =3D seg_len; > + rem_len -=3D seg_len; > + prev =3D next; > + ++NB_SEGS(pkt); > + } > + } else { > rte_pktmbuf_free_seg(pkt); > ++rxq->stats.idropped; > continue; > } > - rte_memcpy(rte_pktmbuf_mtod(pkt, void *), addr, > len); > - DATA_LEN(pkt) =3D len; > } else { > rte_iova_t buf_iova; > struct rte_mbuf_ext_shared_info *shinfo; @@ - > 1826,6 +1856,7 @@ enum mlx5_txcmp_code { > *(pkts++) =3D pkt; > ++i; > } > +out: > /* Update the consumer indexes. */ > rxq->consumed_strd =3D consumed_strd; > rte_cio_wmb(); > -- > 1.8.3.1