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 98A10A0589; Sat, 21 Mar 2020 12:40:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C8DB611A2; Sat, 21 Mar 2020 12:40:22 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by dpdk.org (Postfix) with ESMTP id 6A5AFF90 for ; Sat, 21 Mar 2020 12:40:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U3Qe3fXm8xFfwdBG2LzZqFC4xXnhcZtF4nPFtRsGQSgjotUC5ZZ2Bb9MgHotdsd973Tgqj1yjx7HrOLS9soZxRPAF6s+smuF7rPC9qL2NlL14cghv/dDOnqccm9KEGSld+rmnjAmki9sVJ6zf/9fNjJe51ygbCYa5wKVPVMozK5XSORQF/VNxLn08Bnc8lFJN60+25YLwolDhnGR57dEn4HfUM/ZGFjadVDOavbC6Df6NDpkgTy48sAV6ee77WO11PIunWSF9v5/f99JMxvmYIQQBEjYtgdPzTXmAqCZp1acPifeaqKJAqbslhmtfUaGhKG1jKCY+LCkKaYN+s1Zow== 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=ImHLlvnV6y7kbl6jFBLGAi0A+HFDpvh5OxPUD5eHNVo=; b=IhGxbSmS/jCQNZvrHC4shf06b95X6e6I8/1sHalt1kDKZq7UyXGVW8qQkBSMMUbFTkqExvMf5w9MHIkJ+MV7TQoKw9ScqcIs+oG+zV4tFJIltyhwWpE97uxEadgmTnDTMrFFNkXNto+3ygAIANBdlIBZ//ulIDZDTiIJuLg9QnDeLG+pFQp8vrjYnUwxsYQOV7VSVeGppVHR1mkRcok3zMSWTgT4OvsY4+gDLVRl7+T3qbfv6sioGYB3U5v5+xm7xKYVvfWgkiQ+0dlfpmR7+nIjGkcUkFF+mYjDoEVjfF9Y97T4N4XXyQxiAFKC/9l4WffvpcxbG/CVBVg2hpkUeg== 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=ImHLlvnV6y7kbl6jFBLGAi0A+HFDpvh5OxPUD5eHNVo=; b=1CEJsZBOGHTuVoR5YdiG4zntXMbit/CrRgJNPSzFTDAZXkxTtlPNEwTXLBWgj94wTYY0/eH88XYly8Q9kACMBx6YpwFj2A8eFQ+4XBP0gJdULoCA/s2ONIKBGzxMbm9hZnSjvkLuFUYOqhkhSFnr0r0IJSwtEy2Yx/BaoBwXBvM= Received: from DM6PR12MB2987.namprd12.prod.outlook.com (2603:10b6:5:3b::25) by DM6PR12MB2730.namprd12.prod.outlook.com (2603:10b6:5:41::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.22; Sat, 21 Mar 2020 11:40:19 +0000 Received: from DM6PR12MB2987.namprd12.prod.outlook.com ([fe80::1500:497a:6cb9:53bd]) by DM6PR12MB2987.namprd12.prod.outlook.com ([fe80::1500:497a:6cb9:53bd%2]) with mapi id 15.20.2814.025; Sat, 21 Mar 2020 11:40:19 +0000 From: "Kumar, Ravi1" To: "Namburu, Chandu-babu" , "dev@dpdk.org" CC: "Somalapuram, Amaranath" Thread-Topic: [PATCH v1] net/axgbe: add RSS reta/hash query and update Thread-Index: AQHV/qrVdgmlHQVpe0m5MXuCDUnlS6hS7ieg Date: Sat, 21 Mar 2020 11:40:19 +0000 Message-ID: References: <20200320112914.18620-1-chandu@amd.com> In-Reply-To: <20200320112914.18620-1-chandu@amd.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Enabled=true; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_SetDate=2020-03-21T11:42:17Z; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Method=Privileged; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_Name=Public_0; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_ActionId=35ae74b0-75ef-4f29-a181-00000d2663b3; MSIP_Label_0d814d60-469d-470c-8cb0-58434e2bf457_ContentBits=1 msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_enabled: true msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_setdate: 2020-03-21T11:42:20Z msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_method: Privileged msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_name: Public_0 msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_actionid: d4c45c04-1d0c-4dbc-9d7f-00002b040649 msip_label_0d814d60-469d-470c-8cb0-58434e2bf457_contentbits: 0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; x-originating-ip: [106.207.11.195] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 271edfdb-edef-4b6b-06ac-08d7cd8ca20f x-ms-traffictypediagnostic: DM6PR12MB2730:|DM6PR12MB2730: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3631; x-forefront-prvs: 034902F5BC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(66476007)(76116006)(110136005)(66946007)(66446008)(2906002)(64756008)(71200400001)(81166006)(66556008)(7696005)(8676002)(33656002)(6506007)(8936002)(4326008)(81156014)(26005)(186003)(478600001)(55016002)(9686003)(5660300002)(52536014)(316002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2730; H:DM6PR12MB2987.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 06SLBeIcvu4vT3pZQXsE6Sd5stNqkP6Bm0BMtlXxzxo296UUFA6u4SOHoCoWz5vslPttkIqQQCdcbcdO4Biz00VqEpmzuqvxjuXq3ewjUBlYsnDjbR9Bv532C6cPKzcxzxinR8k+AvGHIHyhYBfPP/G4Q33EYJoRVvrIBKoiGy7u9/lfMoqDr1EOhDBJRsKXJ3a/sxVTHkfuGijSc8PTE8J5bJg71jIepUZqk9fFKdEHPiBdL9nFaTbwVAWkwxXZ6dwdHLT86Mdu/3fMOXKSCvmaBe79DIoZcOqpUFCD6goUV5lIJJsCulGKNHunxsjAgtaaP5ugrcnwLg8UcGJGitXHBR6/AOgIIppqQ61O0dNxpa9SS2nxw+gG50lFv4fZEYH5gBgBb28OKmZERT4mq9WSzmU/seEoDK1zUKn6+5CfCTr1gElbu8ggUOE2S3d3 x-ms-exchange-antispam-messagedata: EItgT33wbw/q6+ifb62fxEwcjWtJmyzMMZWHFzaH9c3RbDHAYlbM+/QKXbX6aH5GEZILkMk6YBh0iI67IdD5hf/kPQ2Qx3yd+9XCIpbR14Tw8PjcdkZ8Ymv2QSsDWPsE91L9pPSinczXzE9HbHL3nw== 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: 271edfdb-edef-4b6b-06ac-08d7cd8ca20f X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2020 11:40:19.2374 (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: YrZz9gC1IwDdb5KhHFTht3+u2HJN572E3ci2DkwTgkITyso7e9cpR0M9qrJre0lslFR0y36v88v6FcBxqTCGxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2730 Subject: Re: [dpdk-dev] [PATCH v1] 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 Public Use] Acked-by: Ravi Kumar >From: Chandu Babu N > >add support for RSS ethdev_ops reta_update, reta_query rss_hash_update, rs= s_hash_conf_get > >Signed-off-by: Chandu Babu N >--- > drivers/net/axgbe/axgbe_dev.c | 5 +- > drivers/net/axgbe/axgbe_ethdev.c | 146 +++++++++++++++++++++++++++++++ > drivers/net/axgbe/axgbe_ethdev.h | 3 + > 3 files changed, 152 insertions(+), 2 deletions(-) > >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 *pdat= a, unsigned int type, > return -EBUSY; > } >=20 >-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; > } >=20 >-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; >=20 > 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; >=20 > if (rss_hf & (ETH_RSS_IPV4 | ETH_RSS_IPV6)) diff --git a/drivers/net/axg= be/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c >index 867058845..f42bb7a0d 100644 >--- a/drivers/net/axgbe/axgbe_ethdev.c >+++ b/drivers/net/axgbe/axgbe_ethdev.c >@@ -60,6 +60,18 @@ axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *de= v, > 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=20 >+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 +213,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 +466,136 @@ axgbe_dev_mac_addr_add(struct rte_eth_dev *dev, stru= ct rte_ether_addr *mac_addr, > return 0; > } >=20 >+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 || 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 || 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) { >+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n"); >+ return -EINVAL; >+ } >+ >+ if (rss_conf->rss_key && >+ 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) >+ 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) { >+ PMD_DRV_LOG(ERR, "rss_conf value isn't valid\n"); >+ return -EINVAL; >+ } >+ >+ if (rss_conf->rss_key && >+ 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) { dif= f --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; >=20 > /* 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 ad= d); >+int axgbe_write_rss_lookup_table(struct axgbe_port *pdata); int=20 >+axgbe_write_rss_hash_key(struct axgbe_port *pdata); >=20 > #endif /* RTE_ETH_AXGBE_H_ */ >-- >2.17.1 >