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 07523A2E1B for ; Wed, 4 Sep 2019 08:17:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50BBA1ECC1; Wed, 4 Sep 2019 08:17:42 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47]) by dpdk.org (Postfix) with ESMTP id 0482B1EBCB; Wed, 4 Sep 2019 08:17:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kL7cffY4niFdQoi9ho4lEn+7rz6SSggvat+DmGYj98hVlvXlXfj1b/VpoFHTTPh1WvZ0VvGLgtmx16nYbs8WFusvJUlvoQJrszZ4p5gkBIavagXPMEsSiy+PO02vYrzviUiPD8HDvxhB99/kDrDUt5+opocP+dCYBlIDIUaxpeieP8SNg/+u3vC+iCdaR94SsBoUtYPtQjX2IUylokDg8/pwYlT/ekChZQNla8HhD+4bVR1WJi/a5VVaGuWpdDjORUbSpM8wSoZXTMJBuRmwNTuE9v7fm5sN40lkyTYY+uuT7GSRfmn0du41EC7HESyrDKDJ9BBru86ly1QE4RxBZg== 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=6txoPnwF35Vu782rAVOAtzrMTyfc6pLGcGmp94RMHas=; b=d9nf4142KMOVJyqrOSwDqFc4BN6dAnO7i7M7sIVrQ+6bCEfTeZW16aU2Oeg4cUi5UbhxMiFbtyKU9cdLyaQDyUMS1ZNWZF9TcrKXFJ7wws4+QwWlhVLslVMTklo4vB2piWLdJdUTXDQWUSlAkehrHZxEltTO/ew5joCml9SvO5p22bKFH4O9AEvVoeh05+LvdY3Z51aoXAIUKFkn2snMEvseghErEqrtj/dRZSmczZ/Xt+6+jYQww+FtNBCQQjd7zuBt60ajZtTSnWbCRpXRHncPDX/v/BB+L51Wh9Zzby4uD3VMArx26m3/smAA6rtTJ/VdtMMj5mE836sTuU2HcQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6txoPnwF35Vu782rAVOAtzrMTyfc6pLGcGmp94RMHas=; b=hhqoq71x691Jfonjn3LhmqqNybOWa+XUGDK81IZgNTG90Rw4BruHoLt8IYn1MWAt/EYRNxLweojVBX/APF7Ji0EkRKNtrd0dq9c2DWRhoLdSAdPtRbtHq1kMbxL9lcS3HeKMvqkhUq3i97xhlpUGU2H1vs7ZYIdnHp/yQdxlFYU= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.39.139) by AM0PR0502MB3713.eurprd05.prod.outlook.com (52.133.43.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.20; Wed, 4 Sep 2019 06:17:40 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::7deb:8e17:1363:e00e]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::7deb:8e17:1363:e00e%7]) with mapi id 15.20.2220.022; Wed, 4 Sep 2019 06:17:40 +0000 From: Matan Azrad To: Slava Ovsiienko , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix transmit descriptor with VLAN insertions Thread-Index: AQHVYlQWS/d6+THJ1EeaDlm5n/3ba6cZ6xpggAALZACAARSG8A== Date: Wed, 4 Sep 2019 06:17:40 +0000 Message-ID: References: <1567514105-24264-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: aa78b51b-0c48-4505-6ded-08d730ff96d7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM0PR0502MB3713; x-ms-traffictypediagnostic: AM0PR0502MB3713:|AM0PR0502MB3713: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0150F3F97D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(346002)(136003)(366004)(396003)(199004)(189003)(13464003)(4326008)(316002)(99286004)(6246003)(26005)(110136005)(450100002)(25786009)(76176011)(256004)(71200400001)(71190400001)(7696005)(6506007)(66066001)(186003)(53546011)(53936002)(446003)(55016002)(486006)(11346002)(476003)(33656002)(6436002)(102836004)(8676002)(64756008)(478600001)(66556008)(52536014)(8936002)(14454004)(66446008)(74316002)(66946007)(3846002)(6116002)(76116006)(81166006)(81156014)(66476007)(9686003)(2906002)(86362001)(2501003)(305945005)(229853002)(7736002)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3713; H:AM0PR0502MB4019.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: H5fNWBQLhVjiRew8aOlNrt0dnynrohsb1k1oVvFUNhhIUUjr4Qg1qwGB3NYlxTAyEX/sNeum3Pwh2Welq8mUYy8NY8mCMUFsPPowfvKvxOX6GLHh0Rp8CvwG6/W8LEaB+quqfOzsWprc99VPHdE7Jny9ZdH5CDJt+LYVn8QkudnkiMO/cXJ9jwnhqUtszcaI6tprm1UhpAULY6XFTVFzm8JHiUd/T7gX+O34at5aT4y4MtR8fSpoznOhjybo9vVyFfz6P995LVwwRHNvat2FDsYgTr3DwIFeEx/SWCtL7fya69+EWlLrWkDF5f7JtcqtaW9+ZUZrDfmFGyMJ9vY1jjDNcFOjveWyU5wSB214hEXFL51FSZRexDtfkuZRuimtBSdKjCoR9VhN+bOjKs7bqFaiNemSqn85cHEvhJQekDU= 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: aa78b51b-0c48-4505-6ded-08d730ff96d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Sep 2019 06:17:40.0669 (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: y3ofEEnIN7KTCgY2pE1iBy/TDE84NgNzjrTH7En/E/2AMPWer5d57uwSiTkbnykEefqChvwB+hz+FGk0wArZvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3713 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix transmit descriptor with VLAN insertions 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" Hi From: Slava Ovsiienko > Hi, Matan >=20 > Please, see below. >=20 > > -----Original Message----- > > From: Matan Azrad > > Sent: Tuesday, September 3, 2019 16:05 > > To: Slava Ovsiienko ; dev@dpdk.org > > Cc: stable@dpdk.org > > Subject: RE: [PATCH] net/mlx5: fix transmit descriptor with VLAN > > insertions > > > > Hi Slava > > > > From: Viacheslav Ovsiienko > > > If VLAN tag insertion transmit offload is engaged > > > (DEV_TX_OFFLOAD_VLAN_INSERT in tx queue configuration is set) the > > > transmit descriptor may be built with wrong format, due to packet > > > length is not adjusted. Also, the ring buffer wrapup is not handled > correctly. > > > > > > Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Viacheslav Ovsiienko > > > --- > > > drivers/net/mlx5/mlx5_rxtx.c | 5 +++-- > > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/net/mlx5/mlx5_rxtx.c > > > b/drivers/net/mlx5/mlx5_rxtx.c index 8ec90c3..f540977 100644 > > > --- a/drivers/net/mlx5/mlx5_rxtx.c > > > +++ b/drivers/net/mlx5/mlx5_rxtx.c > > > @@ -2861,13 +2861,14 @@ enum mlx5_txcmp_code { > > > memcpy(pdst, buf, MLX5_DSEG_MIN_INLINE_SIZE); > > > buf +=3D MLX5_DSEG_MIN_INLINE_SIZE; > > > pdst +=3D MLX5_DSEG_MIN_INLINE_SIZE; > > > + len -=3D MLX5_DSEG_MIN_INLINE_SIZE; > > > /* Insert VLAN ethertype + VLAN tag. Pointer is aligned. */ > > > assert(pdst =3D=3D RTE_PTR_ALIGN(pdst, MLX5_WSEG_SIZE)); > > > + if (unlikely(pdst >=3D (uint8_t *)txq->wqes_end)) > > > > Why unlikely? > > Wraparound is expected even in good cases, no? >=20 > It is good case but supposed to be rare. Wraparound happens once on entir= e > ring buffer fill. 1/ring size - event - it is part of the good flow. I think it is better to let the branch prediction to do the work in this ca= se and in all other places when good flow may happen for both true or false= . > At this codepoint it ever has the less chance to happen - many of > wraparounds happen on data copying (the code below in this function). >=20 > With best regards, > Slava >=20 >=20 > > > > > > > > > + pdst =3D (uint8_t *)txq->wqes; > > > *(uint32_t *)pdst =3D rte_cpu_to_be_32((RTE_ETHER_TYPE_VLAN << > > > 16) | > > > loc->mbuf->vlan_tci); > > > pdst +=3D sizeof(struct rte_vlan_hdr); > > > - if (unlikely(pdst >=3D (uint8_t *)txq->wqes_end)) > > > - pdst =3D (uint8_t *)txq->wqes; > > > /* > > > * The WQEBB space availability is checked by caller. > > > * Here we should be aware of WQE ring buffer wraparound only. > > > -- > > > 1.8.3.1