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 EA0E2A034E; Thu, 4 Jun 2020 07:27:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7EF5B1D5C7; Thu, 4 Jun 2020 07:27:54 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by dpdk.org (Postfix) with ESMTP id BA8BD1D59A for ; Thu, 4 Jun 2020 07:27:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F56FBFe7rLnlQLxBtR9nKBdx+kvpykIfsD+SAFiwYRZNzzSINm0wkKQMveutQNSJwi6/qDl1jZq1QV85r9iFwJ3ep+NPMjIU+Nh7CXIXR4/4KR0ovN2HhvPHcEQ4l9RWRS2O5j0tXPuqdNj/xCp0RJQztionS7+vZXelA+nxF1gIObjFtgZNqAWfTheVuMkBJIi0rEr4uESKxZpQir1Z7yuKNuN/5FUzFRVYM+OTcoj0m+a9xA+fnxGfn73wpgKt3qkFtG2k4OzzoIB12bGcSkNIMwPtbPRUUxoHzKzd7Ea11ucwSmllvYfDS9VQNR9AgsFw0X5Z86SGO1gHntlwqw== 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=K26FVIuEYjwWHaJcxxDFfEuItNS/7I8YnQVgiRWhBUI=; b=CN7ebBtD8jstnTBTSfraqbYzZx2S10jhYp9lT5ultKI5ypekzjSEbLe2VdZzpTyWwZdKGXyuRIy7Dym3WHQIKQQFMuHlIPCSh995Yd8IWMit87euQrTN9dszA1fU2V68W9XLDg7kRwVbQXkntPVfc2C+3WShEkTxsTxAE+Hsx3lG5WceEq0F9CF++t2AtXuyWf2pFXLBByMx1CvzRjZ/8wYFJ/j+9I3OoldL3P9tbe6XVjLGuofw5mLJ164WtsLIaEegztc8JVe9mpHTGegoNMibP3e4iuKucIxpsG87+xkeFeg8Cl2jmacDvHHnmIfl24z3eFDLY6eod5HUAeqF+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K26FVIuEYjwWHaJcxxDFfEuItNS/7I8YnQVgiRWhBUI=; b=J7ddKuxNkOwSwoxsxj66XA/56aj9/mOZIKO88iC3ulu0TbwIXAgnaIg1ILLRCMWvcNY2xAj76Nmea6PNcs/HpqUkNg1fP3h+/WNfGi1W+6qi4UZEVGpngHM4/3752X4mqN4jzhVlZJB2aUb3s1OT5rXOldBcpG+bdgHove2Jeo4= Received: from CY4PR12MB1574.namprd12.prod.outlook.com (2603:10b6:910:e::23) by CY4PR12MB1829.namprd12.prod.outlook.com (2603:10b6:903:11d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Thu, 4 Jun 2020 05:27:50 +0000 Received: from CY4PR12MB1574.namprd12.prod.outlook.com ([fe80::7405:91a0:a2ea:b344]) by CY4PR12MB1574.namprd12.prod.outlook.com ([fe80::7405:91a0:a2ea:b344%6]) with mapi id 15.20.3045.024; Thu, 4 Jun 2020 05:27:50 +0000 From: "Somalapuram, Amaranath" To: "Namburu, Chandu-babu" , "dev@dpdk.org" Thread-Topic: [PATCH v2] net/axgbe: add RSS reta/hash query and update Thread-Index: AQHWNa89WVYeFtX3DkG0XSB504ubuKjH9Y+Q Date: Thu, 4 Jun 2020 05:27:49 +0000 Message-ID: References: <20200320112914.18620-1-chandu@amd.com> <20200529114920.17179-1-chandu@amd.com> In-Reply-To: <20200529114920.17179-1-chandu@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_ActionId=1677e86d-caed-4937-aeb1-000063be1010; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_ContentBits=0; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_Enabled=true; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_Method=Standard; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_Name=Internal Use Only - Unrestricted; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_SetDate=2020-06-04T05:24:49Z; MSIP_Label_76546daa-41b6-470c-bb85-f6f40f044d7f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; x-originating-ip: [2405:201:d805:fef:e178:9d4d:818a:793e] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e7ecb162-05a1-49a8-b8c7-08d8084805d0 x-ms-traffictypediagnostic: CY4PR12MB1829: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-forefront-prvs: 04244E0DC5 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bWXzot0UOrjxp7YKDnqcTB8BLmYyU78QTxiBXITLXrQAebal06oggGk9D8yVw0H4wsl7UBhss1bpoEIOVDdwoLGOyhSmUTY+JmTZHkVkAPINuxCWL8zrC/M99QZE+9zWHVVCxMehtktV1pKj90/HalU5VyB9To4NJHyoXrJlfICr2JSmbBAG8PiyyXWF2GBNnT/xQGF8SsuIXlljTBSD7Z+f5HZqCRFvUl1mmzObNyDzc9mo0ygiKyDFHZ7FGWr1dpuC4wNn6OTyjVQaoTRw2/czcPeIoryLquG7HoGO/APTZx7izUZWMWVTSMje6i+cuim1zavIeTqIOz/jlghtKg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR12MB1574.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(396003)(376002)(39860400002)(136003)(366004)(76116006)(186003)(6506007)(8936002)(7696005)(52536014)(53546011)(66946007)(86362001)(66476007)(64756008)(66446008)(66556008)(9686003)(55016002)(15650500001)(316002)(478600001)(2906002)(8676002)(5660300002)(33656002)(83380400001)(71200400001)(110136005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: AL2o0RuG+030b9gQ6tULjepy5tVymSCqh43Xke9jwYab5fPpFMq3lLlwVLJ+bk8ACcMJRO9645ayJyl/21lbGEO8Js+P41j7jHFObER2wb9cwJGRou7jb2bROw10VJ6WshBoPbk/oOmNjh7pFJqgawbqnnfO+HB6lPKWsYxv7svk0fAa/TcpmTZEBUgutGItgbhDAdR17i+X3xaLxZe/0g+mco2sgJWpONSVrYpjGIplFXj/cxVuTA12vwkQ6HNobXP4fMbPxBH7GvstyiXt3kpXEuOgoBPVysMThuOWrT60n2XmxouOreC08+SiCFyuOS26/XjwkQDFQ82cMtNXHN2ZSzgAljBdRQkwIkqK7Z+cg12oz56p0CbRbZKjOdS6S5ROhI9Bmq4A/9f0/QFA2vJRrdzSCgZ585fuP8cJAK9SCL409tNpzg3T3Orm64D5pXir0Sc3g0B08MTOWQxPjKH9y0VaW8sWSBHos7rCSsVuVjno80uik7DZZ0NRBJB4J7DOnqhb/3rb5syq6PeXGpGlCufHYo6ypJqLmQWwRSiDPIPnpUQmtoFd2ZnqPRY+ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7ecb162-05a1-49a8-b8c7-08d8084805d0 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jun 2020 05:27:49.9678 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mfAZmFQ+2FjVqUjf4ocG+MPHGvKlX6p5I7/G9LuRYJtcrNjts1118HrvXXRpAr/N6wwZu9tAe0NewoeGJSH/8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1829 Subject: Re: [dpdk-dev] [PATCH v2] net/axgbe: add RSS reta/hash query and update 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" [AMD Official Use Only - Internal Distribution Only] For series, Acked-by: Somalapuram Amaranath -----Original Message----- From: Namburu, Chandu-babu Sent: Friday, May 29, 2020 5:19 PM To: dev@dpdk.org Cc: Somalapuram, Amaranath Subject: [PATCH v2] net/axgbe: add RSS reta/hash query and update From: Chandu Babu N add support for RSS reta/hash query and update function v2: modification as per Andrew Rybchenko review comments Signed-off-by: Chandu Babu N --- doc/guides/nics/features/axgbe.ini | 2 + drivers/net/axgbe/axgbe_dev.c | 5 +- drivers/net/axgbe/axgbe_ethdev.c | 144 +++++++++++++++++++++++++++++ drivers/net/axgbe/axgbe_ethdev.h | 3 + 4 files changed, 152 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/= axgbe.ini index 0becaa097..34df0d1ee 100644 --- a/doc/guides/nics/features/axgbe.ini +++ b/doc/guides/nics/features/axgbe.ini @@ -11,6 +11,8 @@ Scattered Rx =3D Y Promiscuous mode =3D Y Allmulticast mode =3D Y RSS hash =3D Y +RSS key update =3D Y +RSS reta update =3D Y CRC offload =3D Y L3 checksum offload =3D Y L4 checksum offload =3D Y diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c = index 5f0f19592..af62eae3b 100644 --- a/drivers/net/axgbe/axgbe_dev.c +++ b/drivers/net/axgbe/axgbe_dev.c @@ -614,7 +614,7 @@ static int axgbe_write_rss_reg(struct axgbe_port *pdata= , unsigned int type, return -EBUSY; } -static int axgbe_write_rss_hash_key(struct axgbe_port *pdata) +int axgbe_write_rss_hash_key(struct axgbe_port *pdata) { struct rte_eth_rss_conf *rss_conf; unsigned int key_regs =3D sizeof(pdata->rss_key) / sizeof(u32); @@ -638,7 = +638,7 @@ static int axgbe_write_rss_hash_key(struct axgbe_port *pdata) return 0; } -static int axgbe_write_rss_lookup_table(struct axgbe_port *pdata) +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata) { unsigned int i; int ret; @@ -683,6 +683,7 @@ static void axgbe_rss_options(struct axgbe_port *pdata) uint64_t rss_hf; rss_conf =3D &pdata->eth_dev->data->dev_conf.rx_adv_conf.rss_conf; +pdata->rss_hf =3D rss_conf->rss_hf; rss_hf =3D rss_conf->rss_hf; if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git a/drivers/net/axgbe= /axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 867058845..619250fb0 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -60,6 +60,16 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev= , const uint64_t *ids, unsigned int size); static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev); +static int axgbe_dev_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +static int axgbe_dev_rss_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +static int axgbe_dev_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); static int +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); static int axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int axgbe_flow_ctrl_get= (struct rte_eth_dev *dev, @@ -201,6 +211,10 @@ static const struct eth_dev_= ops axgbe_eth_dev_ops =3D { .xstats_get_names =3D axgbe_dev_xstats_get_names, .xstats_get_names_by_id =3D axgbe_dev_xstats_get_names_by_id, .xstats_get_by_id =3D axgbe_dev_xstats_get_by_id, +.reta_update =3D axgbe_dev_rss_reta_update, +.reta_query =3D axgbe_dev_rss_reta_query, +.rss_hash_update =3D axgbe_dev_rss_hash_update, +.rss_hash_conf_get =3D axgbe_dev_rss_hash_conf_get, .dev_infos_get =3D axgbe_dev_info_get, .rx_queue_setup =3D axgbe_dev_rx_queue_setup, .rx_queue_release =3D axgbe_dev_rx_queue_release, @@ -450,6 +464,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, struc= t rte_ether_addr *mac_addr, return 0; } +static int +axgbe_dev_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ +struct axgbe_port *pdata =3D dev->data->dev_private; +unsigned int i, idx, shift; +int ret; + +if (!pdata->rss_enable) { +PMD_DRV_LOG(ERR, "RSS not enabled\n"); +return -ENOTSUP; +} + +if (reta_size =3D=3D 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) { +PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size); +return -EINVAL; +} + +for (i =3D 0; i < reta_size; i++) { +idx =3D i / RTE_RETA_GROUP_SIZE; +shift =3D i % RTE_RETA_GROUP_SIZE; +if ((reta_conf[idx].mask & (1ULL << shift)) =3D=3D 0) +continue; +pdata->rss_table[i] =3D reta_conf[idx].reta[shift]; +} + +/* Program the lookup table */ +ret =3D axgbe_write_rss_lookup_table(pdata); +return ret; +} + +static int +axgbe_dev_rss_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ +struct axgbe_port *pdata =3D dev->data->dev_private; +unsigned int i, idx, shift; + +if (!pdata->rss_enable) { +PMD_DRV_LOG(ERR, "RSS not enabled\n"); +return -ENOTSUP; +} + +if (reta_size =3D=3D 0 || reta_size > AXGBE_RSS_MAX_TABLE_SIZE) { +PMD_DRV_LOG(ERR, "reta_size %d is not supported\n", reta_size); +return -EINVAL; +} + +for (i =3D 0; i < reta_size; i++) { +idx =3D i / RTE_RETA_GROUP_SIZE; +shift =3D i % RTE_RETA_GROUP_SIZE; +if ((reta_conf[idx].mask & (1ULL << shift)) =3D=3D 0) +continue; +reta_conf[idx].reta[shift] =3D pdata->rss_table[i]; +} +return 0; +} + +static int +axgbe_dev_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) { +struct axgbe_port *pdata =3D dev->data->dev_private; +int ret; + +if (!pdata->rss_enable) { +PMD_DRV_LOG(ERR, "RSS not enabled\n"); +return -ENOTSUP; +} + +if (rss_conf =3D=3D NULL) { +PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n"); +return -EINVAL; +} + +if (rss_conf->rss_key !=3D NULL && + rss_conf->rss_key_len =3D=3D AXGBE_RSS_HASH_KEY_SIZE) { +rte_memcpy(pdata->rss_key, rss_conf->rss_key, + AXGBE_RSS_HASH_KEY_SIZE); +/* Program the hash key */ +ret =3D axgbe_write_rss_hash_key(pdata); +if (ret !=3D 0) +return ret; +} + +pdata->rss_hf =3D rss_conf->rss_hf & AXGBE_RSS_OFFLOAD; + +if (pdata->rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) +AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1); +if (pdata->rss_hf & + (ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV6_TCP)) +AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1); +if (pdata->rss_hf & + (ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_NONFRAG_IPV6_UDP)) +AXGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1); + +/* Set the RSS options */ +AXGMAC_IOWRITE(pdata, MAC_RSSCR, pdata->rss_options); + +return 0; +} + +static int +axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) { +struct axgbe_port *pdata =3D dev->data->dev_private; + +if (!pdata->rss_enable) { +PMD_DRV_LOG(ERR, "RSS not enabled\n"); +return -ENOTSUP; +} + +if (rss_conf =3D=3D NULL) { +PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n"); +return -EINVAL; +} + +if (rss_conf->rss_key !=3D NULL && + rss_conf->rss_key_len >=3D AXGBE_RSS_HASH_KEY_SIZE) { +rte_memcpy(rss_conf->rss_key, pdata->rss_key, + AXGBE_RSS_HASH_KEY_SIZE); +} +rss_conf->rss_key_len =3D AXGBE_RSS_HASH_KEY_SIZE; +rss_conf->rss_hf =3D pdata->rss_hf; +return 0; +} + static void axgbe_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { diff= --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.= h index f10ec4a40..cedce5af6 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -594,6 +594,7 @@ struct axgbe_port { uint32_t rss_table[AXGBE_RSS_MAX_TABLE_SIZE]; uint32_t rss_options; int rss_enable; +uint64_t rss_hf; /* Hardware features of the device */ struct axgbe_hw_features hw_feat; @@ -653,5 +654,7 @@ void axgbe_init_function_ptrs_i2c(struct axgbe_i2c_if *= i2c_if); void axgbe_set_mac_addn_addr(struct axgbe_port *pdata, u8 *addr, uint32_t index); void axgbe_set_mac_hash_table(struct axgbe_port *pdata, u8 *addr, bool add= ); +int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int +axgbe_write_rss_hash_key(struct axgbe_port *pdata); #endif /* RTE_ETH_AXGBE_H_ */ -- 2.17.1