From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E516EA04B6;
	Tue, 13 Oct 2020 03:12:30 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2EA2B1D9CC;
	Tue, 13 Oct 2020 03:12:29 +0200 (CEST)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 0F20E1D9B7
 for <dev@dpdk.org>; Tue, 13 Oct 2020 03:12:26 +0200 (CEST)
IronPort-SDR: FHQ4wN25+kkzseixxtSG86eiORM2FCj+TqgT3EfdSSAXg90E8A9HuxVRJzGMqEtZqRhtNwc0hd
 LL/oyMQSJgcA==
X-IronPort-AV: E=McAfee;i="6000,8403,9772"; a="165887528"
X-IronPort-AV: E=Sophos;i="5.77,368,1596524400"; d="scan'208";a="165887528"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 12 Oct 2020 18:12:24 -0700
IronPort-SDR: MBOFzlzGMXu+7fZ0wZvUgOz6MEwrSIczqvqKdRTOPAoaqlErnojIQ0pVIW76/R5YBCI9R5hbLd
 RQEWSg3BjqCg==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.77,368,1596524400"; d="scan'208";a="463296815"
Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16])
 by orsmga004.jf.intel.com with ESMTP; 12 Oct 2020 18:12:24 -0700
Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by
 ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.1713.5; Mon, 12 Oct 2020 18:12:24 -0700
Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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; Mon, 12 Oct 2020 18:12:24 -0700
Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.54) by
 edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.1713.5; Mon, 12 Oct 2020 18:12:23 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=iNjaBLGgGrs4xhyUrV0RO0cDDoU+51pBb3wvsY5N0y6Kx5YKV3HlRbmu9PUCJd3XlrkHegPlcXaDqeQBfepH99r3dXTxHo8rjNSjLP971NtkmXYJHklCuNCb/SwKGTB00yAzK/ZAoBK1RkSYfdKMzMBrUuH/AWxUhpndUefxO3UCPVlxpBholsdvxj6axLLMST/WFKTQLBS9WDwvKfyBmXSr/NK+1y+uQnngGWrbDgj3jq5r45ukoXzDCN4OuTxTrAFWDsnz28Gah9CwJ3v9ot1s/t+oNAzNaftFFjzWcW+rorrvphQcIDO2QhFw7i0/bfwPfWcxirdkar7WDx0Cmw==
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=GPMXn0Dc47o6iBb4xOwP62siil1lvcqlgxik99OF10E=;
 b=mUSw76hJJZ7CsQvCGDIl8HyMNmPToS5Ml+Ko9YqoeMHM5FTeKRWaR4zGvKheamCFTBEUAaqSuJNne3P+UuL8x5Wba3mEibAvEUN4jQsUCABRwYmXWXlwAmVxNdYTvWgGYUrtQCy2XdUd3LDHFQcdABGGPs0YE7xfRwmtrhzC1TolVFQUe+xAe7j2j0IyYa3jT0p+D2vChJwzMYW1e+7zYFV/B9r0KIhatyJ6TpUL4iGX6zam3d7BJfUvDE3gwCHQzSTiHnvdUt/oycWYyrQSBAl0QN399mNgUX6DwTQv8I+15TBvXFJE8Ea/rl6j/Rh6dtzy4B1y8UYYZLqNmAYaiw==
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=GPMXn0Dc47o6iBb4xOwP62siil1lvcqlgxik99OF10E=;
 b=ohvTi88SVVpV40czgPfz61sYJ+lKNc89ILbIvmQWQb/TOeuopc8ZLsWsIOEWBSeohqpynAeXuGyhUJVxpqxd0eDFlbVwaCNT2vNnFPBCJbS943QJYR4jkYuMjJaqAG3KeugAiSvh75DRFO6t6f7DAmEZbDOp9Z5q1VpPUHOPvdw=
Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31)
 by BN6PR1101MB2113.namprd11.prod.outlook.com (2603:10b6:405:51::11)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.28; Tue, 13 Oct
 2020 01:12:17 +0000
Received: from BN8PR11MB3795.namprd11.prod.outlook.com
 ([fe80::e4a8:91ab:e032:b8ae]) by BN8PR11MB3795.namprd11.prod.outlook.com
 ([fe80::e4a8:91ab:e032:b8ae%5]) with mapi id 15.20.3455.029; Tue, 13 Oct 2020
 01:12:17 +0000
From: "Wang, Haiyue" <haiyue.wang@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>, "Power, Ciara"
 <ciara.power@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Zhao1, Wei" <wei.zhao1@intel.com>, "Guo, Jia" <jia.guo@intel.com>
Thread-Topic: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
Thread-Index: AQHWlyrQ+9L43nHRjUSWL5f7XEr8jqmQ3VfggAIw0oCAADFtkIAAgNoAgAByjuCAAAcagIAAkq9Q
Date: Tue, 13 Oct 2020 01:12:16 +0000
Message-ID: <BN8PR11MB3795743BD56F8DA2A8934732F7040@BN8PR11MB3795.namprd11.prod.outlook.com>
References: <20200807155859.63888-1-ciara.power@intel.com>
 <20200930130415.11211-1-ciara.power@intel.com>
 <20200930130415.11211-12-ciara.power@intel.com>
 <BN8PR11MB37952DC7AFD0510C81653464F7090@BN8PR11MB3795.namprd11.prod.outlook.com>
 <BYAPR11MB330112367B8F8509F2A735F49A060@BYAPR11MB3301.namprd11.prod.outlook.com>
 <BN8PR11MB37959E7B1F7C7D5232B96482F7070@BN8PR11MB3795.namprd11.prod.outlook.com>
 <BYAPR11MB33018528F2C8DF0AC5B1BDA49A070@BYAPR11MB3301.namprd11.prod.outlook.com>
 <BN8PR11MB37950D983685B3FC4D9699A5F7070@BN8PR11MB3795.namprd11.prod.outlook.com>
 <BYAPR11MB3301FF9DD0D2736C072A6BC89A070@BYAPR11MB3301.namprd11.prod.outlook.com>
In-Reply-To: <BYAPR11MB3301FF9DD0D2736C072A6BC89A070@BYAPR11MB3301.namprd11.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-reaction: no-action
dlp-version: 11.5.1.3
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.102.204.38]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 93386b6e-496c-456c-f540-08d86f1506b3
x-ms-traffictypediagnostic: BN6PR1101MB2113:
x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BN6PR1101MB2113C68E9FCD28D415C690CBF7040@BN6PR1101MB2113.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:8882;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 4qypBjQKCjd8AUw0dBoaks72fK9tLPRI1nb6Neuhgxfp0/TRcYsKqJYB67iZXIgjYd3GnR0IHJflEMsqqYL185llHpEcDweMEJ1SpjL1mnRyROfvMe/OxbuNKjfRROuoAMY2KZEOjJZSJz81o9xztdePpq/QNjCTLQ1nBEUiIEdnv3TPQkyKKrsPyY4oYgaJ7NHdFdCM7oHH2Bvuf90dt15bK6jzQzjC7NtSAJpduqzkQ+/gVU7zNRTZO+PENok0lCU9r+eYByCHhWtRJz1PihvYaZ0Ua9oJrdskt62sTPTjPPAtmz7aZq6fzk41plTcFdEe2R1Ax/wYf13uhb/AJw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(366004)(396003)(346002)(136003)(39860400002)(376002)(86362001)(8936002)(71200400001)(8676002)(33656002)(2906002)(107886003)(66946007)(26005)(110136005)(186003)(76116006)(53546011)(7696005)(66556008)(66446008)(64756008)(52536014)(6506007)(66476007)(316002)(478600001)(83380400001)(54906003)(55016002)(5660300002)(9686003)(4326008);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata: gZEQCbuLaHGklUKbg2pwfW2pmnBC5mlVSAKnyYOFJyYT1uzq3WTSWpr6jU3QKp9iM865LCXVEy5Pnvvod7H2dX/hDa/07CvTu9UnzvBQKlCigGihdQR7t6/kXON6B5atZrGYG5AWwOwJOnr/IwluNdd6oalo2NnLK+0YRPz12vHjBmT6SY4CzkIRA2zXy5RV7HSMLD7q1ztjzeml0oheKmncrDkmhMloDLx4pOry9SI+YyoJa4DvzPoB+tyvz2G5eMWuPuxVjV2xNR7zpA+0jHBjMrQg1KKCNkcxx/97O4Q88BWkXSysJr7QyNeboD5tVERvmRQbsnONeHg6Utc6+L3N0XYYxH9gkRqpnbCowEmGys2acVV4lQayHpcGOO1SxcGZMqz6j8yVdiWwh9jJJq4wEOBcUz+BNmZZq7O7q/9iitXAq117aeRR2s6DU1NimTtzAoffQhiVBIiaKLv6exf5Ufl7MMaA48FAYTMLkyKrrYr8Wll1VTMiexgOecNbuCk3GqD853+NnVpzrRqES7QJVYtwdYhFmga4TZtwUnL6BZIThQjwiydkGnxm+p4VSl9DlUEcj4A7wD1VpY0y35xpqb6UaoRVi8+Po+RlESeAAd4lk7UnRmPDhKgJyCQe4P8qTgZjsSHvIElYeFUjqg==
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: BN8PR11MB3795.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 93386b6e-496c-456c-f540-08d86f1506b3
X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Oct 2020 01:12:16.9868 (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: SHTjC2bMlFwMfA1/FJ89WB59IVihGkkMpqZzrZyyqLky5iP+0GCFcxOmV4GI3wTvf27mKaA2nmvzYvvuaA6/Dg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2113
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-dev] [PATCH v3 11/18] net/ixgbe: add checks for max SIMD
	bitwidth
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

> -----Original Message-----
> From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Sent: Tuesday, October 13, 2020 00:25
> To: Wang, Haiyue <haiyue.wang@intel.com>; Power, Ciara <ciara.power@intel=
.com>; dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>
> Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitwidth
>=20
>=20
> > > -----Original Message-----
> > > From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> > > Sent: Monday, October 12, 2020 17:09
> > > To: Wang, Haiyue <haiyue.wang@intel.com>; Power, Ciara <ciara.power@i=
ntel.com>; dev@dpdk.org
> > > Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>
> > > Subject: RE: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD bitw=
idth
> > >
> > > > > > > From: Power, Ciara <ciara.power@intel.com>
> > > > > > > Sent: Wednesday, September 30, 2020 21:04
> > > > > > > To: dev@dpdk.org
> > > > > > > Cc: Power, Ciara <ciara.power@intel.com>; Zhao1, Wei <wei.zha=
o1@intel.com>; Guo, Jia
> > > > > > > <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>
> > > > > > > Subject: [PATCH v3 11/18] net/ixgbe: add checks for max SIMD =
bitwidth
> > > > > > >
> > > > > > > When choosing a vector path to take, an extra condition must =
be
> > > > > > > satisfied to ensure the max SIMD bitwidth allows for the CPU =
enabled
> > > > > > > path.
> > > > > > >
> > > > > > > Cc: Wei Zhao <wei.zhao1@intel.com>
> > > > > > > Cc: Jeff Guo <jia.guo@intel.com>
> > > > > > >
> > > > > > > Signed-off-by: Ciara Power <ciara.power@intel.com>
> > > > > > > ---
> > > > > > >  drivers/net/ixgbe/ixgbe_rxtx.c | 7 +++++--
> > > > > > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixg=
be/ixgbe_rxtx.c
> > > > > > > index 977ecf5137..eadc7183f2 100644
> > > > > > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> > > > > > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> > > > > > > @@ -2503,7 +2503,9 @@ ixgbe_set_tx_function(struct rte_eth_de=
v *dev, struct ixgbe_tx_queue
> > > *txq)
> > > > > > >  		dev->tx_pkt_prepare =3D NULL;
> > > > > > >  		if (txq->tx_rs_thresh <=3D RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
> > > > > > >  				(rte_eal_process_type() !=3D RTE_PROC_PRIMARY ||
> > > > > > > -					ixgbe_txq_vec_setup(txq) =3D=3D 0)) {
> > > > > > > +					ixgbe_txq_vec_setup(txq) =3D=3D 0) &&
> > > > > > > +				rte_get_max_simd_bitwidth()
> > > > > >
> > > > > > As Konstantin mentioned: " I think it is a bit safer to do all =
checks first before
> > > > > >  doing txq_vec_setup()."
> > > > > >
> > > > > > Fox x86 & arm platforms, the setup is always 0, since 'sw_ring_=
v' is union with
> > > > > > 'sw_ring' which is initialize at 'ixgbe_dev_tx_queue_setup'.
> > > > > >
> > > > > > 	union {
> > > > > > 		struct ixgbe_tx_entry *sw_ring; /**< address of SW ring for s=
calar PMD. */
> > > > > > 		struct ixgbe_tx_entry_v *sw_ring_v; /**< address of SW ring f=
or vector PMD */
> > > > > > 	};
> > > > > >
> > > > > > static inline int
> > > > > > ixgbe_txq_vec_setup_default(struct ixgbe_tx_queue *txq,
> > > > > > 			    const struct ixgbe_txq_ops *txq_ops)
> > > > > > {
> > > > > > 	if (txq->sw_ring_v =3D=3D NULL)
> > > > > > 		return -1;
> > > > > >
> > > > > > 	/* leave the first one for overflow */
> > > > > > 	txq->sw_ring_v =3D txq->sw_ring_v + 1;
> > > > > > 	txq->ops =3D txq_ops;
> > > > > >
> > > > > > 	return 0;
> > > > > > }
> > > > > >
> > > > > > So we need check the SIMD bitwidth firstly to avoid changing th=
e sw_ring* pointer address.
> > > > > >
> > > > > >
> > > > > > Also, looks like we need to add check on:
> > > > > >
> > > > > > int
> > > > > > ixgbe_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt)
> > > > > > {
> > > > > > 	struct ixgbe_tx_queue *txq =3D (struct ixgbe_tx_queue *)tx_que=
ue;
> > > > > > 	if (txq->offloads =3D=3D 0 &&
> > > > > > #ifdef RTE_LIBRTE_SECURITY
> > > > > > 			!(txq->using_ipsec) &&
> > > > > > #endif
> > > > > > 			txq->tx_rs_thresh >=3D RTE_PMD_IXGBE_TX_MAX_BURST) {
> > > > > > 		if (txq->tx_rs_thresh <=3D RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
> > > > > >                                                      <---------=
---------- Add the same check
> > > > > > 				(rte_eal_process_type() !=3D RTE_PROC_PRIMARY ||
> > > > > > 					txq->sw_ring_v !=3D NULL)) {
> > > > > > 			return ixgbe_tx_done_cleanup_vec(txq, free_cnt);
> > > > >
> > > > > Could you probably explain a bit more why it is needed?
> > > >
> > > > To align with the vector selection path:
> > > >
> > > > 		if (txq->tx_rs_thresh <=3D RTE_IXGBE_TX_MAX_FREE_BUF_SZ &&
> > > > 				(rte_eal_process_type() !=3D RTE_PROC_PRIMARY ||
> > > > 					ixgbe_txq_vec_setup(txq) =3D=3D 0))
> > >
> > >
> > > Ok, so to make sure that TX is running in vector mode?
> >
> > That's right, since no variable to save the vector mode selection,
> > then the check condition should be the same.
>=20
> What I am saying, that here instead of conditions we  should check
> was vector mode already selected or not.
> Probably the easiest way to do it - check what tx function is setup.
>=20

Misunderstood, yes, this is more intuitive and clean.

> > > > > > > 2.17.1