From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 463F741BA7; Thu, 2 Feb 2023 04:28:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C39AC406A2; Thu, 2 Feb 2023 04:28:26 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 7DEAB4067B for ; Thu, 2 Feb 2023 04:28:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675308504; x=1706844504; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=W3KUwXJiTNJDkjR/Pwds+aotIFHjPWyVBx8R9puwuQI=; b=eTrHjU8cm9xJwm/mV5V5Wac1P3DiXd1hIU39qkBo0sODgw5mx3oaaS9z 6GqmZuMDZyk0nEa6yVa41iDYa6ALlz2GED/ZFcfcUnzI9i/3Nlkur+YsC C85iVS4LwkmkstDTLtK9qijpOnWK3SwRfKf0Pvn/s4mfHfNo0kNjirToD SvVcV115hU8IAE7TIvGENnpphrvH9p6QoOfchTy4ZlnyldUDGbJaRikDb EMLZssyUCuCNgTlgjKaEIZM+s76SjncDXOU9tbNR+5hnjZceOcicHYAto 7Z+jj3wlFZxf/rew4jwv2RhiH16p6oZ2q+iD1WazHkft7PFqW6n+YJfIZ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="316340523" X-IronPort-AV: E=Sophos;i="5.97,266,1669104000"; d="scan'208";a="316340523" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2023 19:28:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="615098434" X-IronPort-AV: E=Sophos;i="5.97,266,1669104000"; d="scan'208";a="615098434" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga003.jf.intel.com with ESMTP; 01 Feb 2023 19:28:19 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 1 Feb 2023 19:28:17 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 1 Feb 2023 19:28:16 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 1 Feb 2023 19:28:16 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 1 Feb 2023 19:28:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LAIp4DZ/Vle+In100iJxrnC4AtlCPXHNWRwSjQ8zFtFqTJ21+y7El9WDfQn9NJDyD5c4t1ku6ybtR+TkolUtUQoEkdgWAymewpeCJWHSHfLdaswgJDFT7tS3RXYHueHbpkkSVwdUt1E9IPs/uvwbJaVK+4K4UmLA3SBUoryCx2jRGW0VsVVL9p2GjJu+7IA5Rfwofj8lXJp42Fo2QaxXH+eWgepEB1mfEAlfAQBmM6ThXSWxwAQ00gX9vJpXS6XpJZP3NnhK+RM9TFlDFwe35GTWBF3MUah14x6I07Tf7yxxPJ58L77oVsXOlcR5HJ314i/sNO5jgw5rNkk/IYB6Dw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zBqZVXXFxrzUNdo3G2X4Bg2Q2RH32Pw+dj5xtHeXzDU=; b=cskUcuX8odxfwJMmH2NAlyBb8ItuOnvXCHtwEaJ5ljTuaogSvtZ5Kpz71Iu1eeFhkzj+q+5ztJGqpdwupIFaPf1SbqoklgcW5OyHaox1Bp6U4UxHJROFngxgOe8WVZzwU67kXMncTzsDocuriObR+p029QiN8Vkkz7AafN9oieUXObVU63QX/ICuUtL7eYJ1D/F/UDMNlrVEL47d+PQXJTxZPoZP/pkMuAyHCc+L4f8hGWprfzkLDTohe5/Co+7niOTOP9kYeOBvbVnczjqfJgBfxD5aAL426+ACtHgIdAzJsveRkx6glbHtaUf0EeNKGopTafzYiC8W0Ud5WuMrzg== 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 Received: from MW3PR11MB4587.namprd11.prod.outlook.com (2603:10b6:303:58::7) by IA0PR11MB7308.namprd11.prod.outlook.com (2603:10b6:208:436::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25; Thu, 2 Feb 2023 03:28:14 +0000 Received: from MW3PR11MB4587.namprd11.prod.outlook.com ([fe80::8b2c:e748:6431:3cb0]) by MW3PR11MB4587.namprd11.prod.outlook.com ([fe80::8b2c:e748:6431:3cb0%4]) with mapi id 15.20.6064.025; Thu, 2 Feb 2023 03:28:13 +0000 From: "Wu, Jingjing" To: "Liu, Mingxia" , "dev@dpdk.org" CC: "Xing, Beilei" Subject: RE: [PATCH v3 2/6] common/idpf: add RSS set/get ops Thread-Topic: [PATCH v3 2/6] common/idpf: add RSS set/get ops Thread-Index: AQHZKxRVVLDOQ8CvCU6T4K87QKwAp6654RWQ Date: Thu, 2 Feb 2023 03:28:13 +0000 Message-ID: References: <20230111071545.504706-1-mingxia.liu@intel.com> <20230118071440.902155-1-mingxia.liu@intel.com> <20230118071440.902155-3-mingxia.liu@intel.com> In-Reply-To: <20230118071440.902155-3-mingxia.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW3PR11MB4587:EE_|IA0PR11MB7308:EE_ x-ms-office365-filtering-correlation-id: dc109c0e-2189-4ba2-2f14-08db04cd8438 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: u+z1Xnx1WtcQfGJH5ye77aAGB9VgzRdLhq+dtXgPFSIQToBcw8FdOOGrK4nY5afQYwDyYuHUH+Kc8EGljnwJ6zNK0WWuYZx81FvZNSbvKjZWrPl/22MGGKHDKaE6O0KZxdxTAvnwshVPAtUdzjBJbzg8Bi991qdwZcYNuVm4twgRgdVq8MP9EKejMG+tl8NE/xbtrw/uVu2Y5815rLGrXI7kGvvUkGIAKegUY5bCkcrV2Qqa19YsgCLfYfFYiEbrMsGrnOY9iZj8akcQjoxSgI9QETWbmwy1TK9LwG07BFwx28w1kknvhjWz3pD0935+WJud0bv7Q1FcW6v8NtAltpXVt/PcEm1Fn4MsRWeYu8o2e6xyhtr0zKrIzgRjHhLzXKqkmWs3Y7VYmpVF7T6vAPuuWoPt2AtI86hO2wY6y7OkZEOpjLfQCgzBkKEp77SzHDc3TAalIppJZvbfwylvL/hBoCvkp2YkDOY4Iwdn25UnCGQ7jqxBCv936A6oaCtpJNvelZysymInbqaNr25C1TCJLOtRkAfKI9jVsCOtO8dDAjRboTQrhsIHTgsM+KDPIaaxaGcHgYgBGQgEyKIDSLWX3XkqHs0vx1iiFFxjhANaAnRXKSC6jV5+O0Xp6wIkMtIdwQ4uADU4tJPMgFV8RJZiX2LKFPpVj8OTnJWjokzIBw0mqISayy808DpE3+J/N9WXGpNbSOLoLNiF0Y9+dg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW3PR11MB4587.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(396003)(346002)(376002)(136003)(366004)(39860400002)(451199018)(186003)(9686003)(107886003)(26005)(6506007)(4326008)(5660300002)(83380400001)(71200400001)(66556008)(66476007)(8676002)(110136005)(64756008)(66446008)(86362001)(66946007)(76116006)(41300700001)(316002)(2906002)(55016003)(82960400001)(8936002)(478600001)(38070700005)(122000001)(33656002)(38100700002)(52536014)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?N4CzyX01GaJjmANTBO70GB6K+GSoQT5MXkq+kNJ+xVM74IEQDB6bOTzW3lpH?= =?us-ascii?Q?j2Hf84RUboX7Efba2vCWSbwR4Yt9jyMGL8wufWX46FI3X+IO/n7L5d/ua/zd?= =?us-ascii?Q?TDNg5nt+jIZb0SJ+MmGmrCAW2Kd5GucoI1iSs5KArOylBIs31M+QTv/mqxaL?= =?us-ascii?Q?RhU2b8hD73k2J9K4n8QhC0oJWTPIYHU1eanJoqmvBoz7oDau4n1pMMIFSrZt?= =?us-ascii?Q?sZwVG5JWHWBWYLydLHmAbbeCELTg2mcrWoM2jUVPGQ9SIlzBDQBy1tDvrlGW?= =?us-ascii?Q?jQ4d3gQQ6ml6h80Q4z4EkEU1Oxa7Jgxyl96EpbiWesqI8YrW6QDAeh8nYEey?= =?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EZwbRsKY7DpjYCsFNSUNM7Ckv?= =?us-ascii?Q?nHiWnxIjOHrykVUk32YEgl1Ffq5WojIIHJqq7nf8/pryl91pU3SaHEIbEWsf?= =?us-ascii?Q?APsmmqp6v3xM+NLp/+ZG1G5MB++LB8bgvE2mOdkvEVBGusgYzLTVggvfK2tO?= =?us-ascii?Q?0M7E0SjaEcu4yRA1jl8UUBnQMBkQhSWCxKBUJhvXR70gncRbVys+W7G2iB6S?= =?us-ascii?Q?pvZmz+nkEaaRbf04oQr+bVPKTxCyHVNWXOP3tDeB7qwvqEXDS22kvHQKRhXG?= =?us-ascii?Q?KcChgIH3BWCWOMkiM+U8OKe1EOzCl/fVFyKIzNdu/mL0hR57To2Hjjni2PNm?= =?us-ascii?Q?2n6FhLh3yvmhlZU0Tu/X9msZVPvbJk5cWtIppL5O?= 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: MW3PR11MB4587.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc109c0e-2189-4ba2-2f14-08db04cd8438 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2023 03:28:13.5981 (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: ImHZYAjXcec8BBTJLaFXfFBYaZLsklkkEgy6HWSIuakBH0oKCnlgwjVtfSYI+n6qnD2KDsszavVMlmKSuvwPeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB7308 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > +static int idpf_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf) > +{ > + uint64_t hena =3D 0, valid_rss_hf =3D 0; According to the coding style, only the last variable on a line should be i= nitialized. > + int ret =3D 0; > + uint16_t i; > + > + /** > + * RTE_ETH_RSS_IPV4 and RTE_ETH_RSS_IPV6 can be considered as 2 > + * generalizations of all other IPv4 and IPv6 RSS types. > + */ > + if (rss_hf & RTE_ETH_RSS_IPV4) > + rss_hf |=3D idpf_ipv4_rss; > + > + if (rss_hf & RTE_ETH_RSS_IPV6) > + rss_hf |=3D idpf_ipv6_rss; > + > + for (i =3D 0; i < RTE_DIM(idpf_map_hena_rss); i++) { > + uint64_t bit =3D BIT_ULL(i); > + > + if (idpf_map_hena_rss[i] & rss_hf) { > + valid_rss_hf |=3D idpf_map_hena_rss[i]; > + hena |=3D bit; > + } > + } > + > + vport->rss_hf =3D hena; > + > + ret =3D idpf_vc_set_rss_hash(vport); > + if (ret !=3D 0) { > + PMD_DRV_LOG(WARNING, > + "fail to set RSS offload types, ret: %d", ret); > + return ret; > + } > + > + if (valid_rss_hf & idpf_ipv4_rss) > + valid_rss_hf |=3D rss_hf & RTE_ETH_RSS_IPV4; > + > + if (valid_rss_hf & idpf_ipv6_rss) > + valid_rss_hf |=3D rss_hf & RTE_ETH_RSS_IPV6; > + > + if (rss_hf & ~valid_rss_hf) > + PMD_DRV_LOG(WARNING, "Unsupported rss_hf 0x%" PRIx64, > + rss_hf & ~valid_rss_hf); It makes me a bit confused, valid_rss_hf is would be the sub of rss_hf acco= rding above assignment. Would it be possible to go here? And if it is possible, why not set valid_rss_hf before calling vc command? > + vport->last_general_rss_hf =3D valid_rss_hf; > + > + return ret; > +} > + > static int > idpf_init_rss(struct idpf_vport *vport) > { > @@ -256,6 +357,204 @@ idpf_init_rss(struct idpf_vport *vport) > return ret; > } >=20 > +static int > +idpf_rss_reta_update(struct rte_eth_dev *dev, > + struct rte_eth_rss_reta_entry64 *reta_conf, > + uint16_t reta_size) > +{ > + struct idpf_vport *vport =3D dev->data->dev_private; > + struct idpf_adapter *adapter =3D vport->adapter; > + uint16_t idx, shift; > + uint32_t *lut; > + int ret =3D 0; > + uint16_t i; > + > + if (adapter->caps.rss_caps =3D=3D 0 || dev->data->nb_rx_queues =3D=3D 0= ) { > + PMD_DRV_LOG(DEBUG, "RSS is not supported"); > + return -ENOTSUP; > + } > + > + if (reta_size !=3D vport->rss_lut_size) { > + PMD_DRV_LOG(ERR, "The size of hash lookup table configured " > + "(%d) doesn't match the number of hardware can " > + "support (%d)", > + reta_size, vport->rss_lut_size); > + return -EINVAL; > + } > + > + /* It MUST use the current LUT size to get the RSS lookup table, > + * otherwise if will fail with -100 error code. > + */ > + lut =3D rte_zmalloc(NULL, reta_size * sizeof(uint32_t), 0); > + if (!lut) { > + PMD_DRV_LOG(ERR, "No memory can be allocated"); > + return -ENOMEM; > + } > + /* store the old lut table temporarily */ > + rte_memcpy(lut, vport->rss_lut, reta_size * sizeof(uint32_t)); Stored the vport->rss_lut to lut? But you overwrite the lut below? > + > + for (i =3D 0; i < reta_size; i++) { > + idx =3D i / RTE_ETH_RETA_GROUP_SIZE; > + shift =3D i % RTE_ETH_RETA_GROUP_SIZE; > + if (reta_conf[idx].mask & (1ULL << shift)) > + lut[i] =3D reta_conf[idx].reta[shift]; > + } > + > + rte_memcpy(vport->rss_lut, lut, reta_size * sizeof(uint32_t)); > + /* send virtchnl ops to configure RSS */ > + ret =3D idpf_vc_set_rss_lut(vport); > + if (ret) { > + PMD_INIT_LOG(ERR, "Failed to configure RSS lut"); > + goto out; > + } > +out: > + rte_free(lut); > + > + return ret; > +}