From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0066.outbound.protection.outlook.com [104.47.37.66]) by dpdk.org (Postfix) with ESMTP id AC1B51B4F8 for ; Thu, 11 Oct 2018 12:35:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oxh6XcZsDF6TmpOpD3JDQ4EEGDbrtJdeiCNypLWLkrQ=; b=b1696dyVRLsfWwZABznyPqhnjd3paDc1+dGHYwJowfPqavvvb0TRHtfc8Chc4rrjOVWW26EG5wRC6vk0TlRK8+xlH9U3N20qLQLYvdoQtpiE/EXzVvmANGJ80EYG+zs7JYhXzwsbTjApY22t0JjN6qpFcYNebD0K1tdDsMWL3G0= Received: from BY1PR0701MB1660.namprd07.prod.outlook.com (10.162.110.22) by BY1PR0701MB1208.namprd07.prod.outlook.com (10.160.105.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.27; Thu, 11 Oct 2018 10:35:31 +0000 Received: from BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17]) by BY1PR0701MB1660.namprd07.prod.outlook.com ([fe80::346d:e756:e70e:17%3]) with mapi id 15.20.1228.020; Thu, 11 Oct 2018 10:35:31 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" Thread-Topic: [PATCH v5 16/23] net/atlantic: support for RSS and RETA manipulation API Thread-Index: AQHUYU4i8xooCkLdA06BBQrJK6cpgQ== Date: Thu, 11 Oct 2018 10:35:31 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR04CA0088.eurprd04.prod.outlook.com (2603:10a6:803:64::23) To BY1PR0701MB1660.namprd07.prod.outlook.com (2a01:111:e400:522a::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY1PR0701MB1208; 6:ski8SZY+vNICdPO0rsA3IxMG73rBOqjCK/8U87RhOzpulUzyLsGfpMteaVW/8tebW3zGyC/Ar0ypKygLq67N69S2MNHuWdTgSt6/CpxDuthkuH0evxbVEGDbXnW9l+LoSRrhykUjefYbpoR54I5v5YVPat7fHCep4cM+2D8GlxZV3vWijSXWfGWlqD5QsIr9AqnN+XrcbqtZf5NFe+LSh6dPIFtWGe2tVoXhL6ovjYHN0UKquQU6T0XiNLT7RbSaI446mpuyhBQVFaw5mAS4/nBPrD3jq1stYtsBhdHFglZM+yVXW+Anc0+0G02MYXq9Cdkka2xDRcmctBhJ+fzddWOKIoq5EcMkkvIRiWzXyJaYlKvkNLfY8YvhsF2ZpnReU2l+y50m26XBupTCiivltbry08gBDo1p4v8CbWvNLl6ymhdlqfziGKIM01Mya/AAU0bL+tCVHCVO8CmKaZcyLmZYm4vXRLq7+RGtSTnR7ds=; 5:S7v2BJAlguWCOI0xOlNqy/naS2gFUa9Ztodh1aQMiupfd65swwrL5oyRrKB9VajGAYErK7qQxjH4OOYFYG0zZY4uy17dYrRM+wVxGj89XPVYVEiVjdGt23pYZ6T+3FjJ87gUMjVQ/KhDeZC5Dl8SXhKuJpALDh913UV7DaawxmM=; 7:vnI02ergXz68ghCT+MFxZIB4p8gZ7NR9HolEsnoWSTYZzfzY5/DntpbyPTwxMs3qouIhsU/ElneLaptYG2WfZHoQMd/o8VZr+9RuVPr8hvDdIhpKc0DNKbNeWyTG77k2F1eOR2Fd/9qlwzx8IELTpjFwWPoHaFKPwTpggxq0v4/ISGDa+UNws3i8gUujrSoFL6+8e2lpzUKZM8dbc5EimBJes8GLDE9TBFCxQyNUofuXKvT/6BEmh8Y4tWTRnMzC x-ms-office365-filtering-correlation-id: f4618486-8c4c-4b7f-d449-08d62f654487 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BY1PR0701MB1208; x-ms-traffictypediagnostic: BY1PR0701MB1208: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(201708071742011)(7699051); SRVR:BY1PR0701MB1208; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1208; x-forefront-prvs: 08220FA8D6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(376002)(39840400004)(346002)(396003)(136003)(366004)(199004)(189003)(26005)(99286004)(72206003)(478600001)(76176011)(14454004)(486006)(256004)(97736004)(14444005)(8676002)(316002)(5660300001)(8936002)(476003)(66066001)(4326008)(305945005)(11346002)(2616005)(71190400001)(6116002)(2351001)(54906003)(575784001)(86362001)(446003)(6506007)(6916009)(7736002)(386003)(25786009)(105586002)(106356001)(6512007)(2906002)(36756003)(3846002)(71200400001)(102836004)(68736007)(186003)(118296001)(5250100002)(44832011)(2501003)(81166006)(1730700003)(2900100001)(52116002)(53936002)(6486002)(6436002)(81156014)(5640700003)(309714004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1208; H:BY1PR0701MB1660.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: KS47FQcF7IhtwYP3P/UMunYTHevRKU4hF6jIOzkmHJgs7wZDKxr/jRxIAp6N/m8plMmWHp+AnPfjnxR4buXDqeJFUOdvhRQ7pF7h72T5rTHsuKEcFGl5ptqxGjq+JZ7emhCUTK71qqS1W/vQ3S04VSPuFUQXBUP7c7JiABhsdtNik50VgH+x22VGWe2Qoux+Xs6Z0zespA9FscUNTK6dpMy0dqG6PZmYfcfEowZ+YbaH6ivy6JTAkZeMLzHv3zos2bXRA3ubylHWF5oM++6JBYji1dijrAgZaVX7XqfO5lJlrxfCkFlDm5MZoe0LpwZEuuuzmmqgGbNmXC1c35xoqOhHHZslWxs27hJhgT56ZEw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4618486-8c4c-4b7f-d449-08d62f654487 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 10:35:31.3293 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1208 Subject: [dpdk-dev] [PATCH v5 16/23] net/atlantic: support for RSS and RETA manipulation API 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: , X-List-Received-Date: Thu, 11 Oct 2018 10:35:35 -0000 Add support for Receive Side Scaling feature. RSS hash and reta table configuration. Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- doc/guides/nics/atlantic.rst | 1 + doc/guides/nics/features/atlantic.ini | 3 + drivers/net/atlantic/atl_ethdev.c | 107 ++++++++++++++++++++++++++++++= ++++ drivers/net/atlantic/atl_ethdev.h | 14 +++++ drivers/net/atlantic/atl_rxtx.c | 5 ++ 5 files changed, 130 insertions(+) diff --git a/doc/guides/nics/atlantic.rst b/doc/guides/nics/atlantic.rst index b09c79babdf4..80591b13c185 100644 --- a/doc/guides/nics/atlantic.rst +++ b/doc/guides/nics/atlantic.rst @@ -16,6 +16,7 @@ Supported features - Promiscuous mode - Multicast mode - Port statistics +- RSS (Receive Side Scaling) - Checksum offload - Jumbo Frame upto 16K =20 diff --git a/doc/guides/nics/features/atlantic.ini b/doc/guides/nics/featur= es/atlantic.ini index 8e5041002049..fa49e48e166d 100644 --- a/doc/guides/nics/features/atlantic.ini +++ b/doc/guides/nics/features/atlantic.ini @@ -11,6 +11,9 @@ Queue start/stop =3D Y Jumbo frame =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/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index f9f1e9f0ed86..b3f99829ce9f 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -58,6 +58,19 @@ static int atl_dev_interrupt_action(struct rte_eth_dev *= dev, struct rte_intr_handle *handle); static void atl_dev_interrupt_handler(void *param); =20 +/* RSS */ +static int atl_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +static int atl_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +static int atl_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); +static int atl_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); + + static int eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev); static int eth_atl_pci_remove(struct rte_pci_device *pci_dev); @@ -209,6 +222,11 @@ static const struct eth_dev_ops atl_eth_dev_ops =3D { =20 .rxq_info_get =3D atl_rxq_info_get, .txq_info_get =3D atl_txq_info_get, + + .reta_update =3D atl_reta_update, + .reta_query =3D atl_reta_query, + .rss_hash_update =3D atl_rss_hash_update, + .rss_hash_conf_get =3D atl_rss_hash_conf_get, }; =20 static inline int32_t @@ -261,12 +279,18 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) /* Hardware configuration - hardcode */ adapter->hw_cfg.is_lro =3D false; adapter->hw_cfg.wol =3D false; + adapter->hw_cfg.is_rss =3D false; + adapter->hw_cfg.num_rss_queues =3D HW_ATL_B0_RSS_MAX; + adapter->hw_cfg.link_speed_msk =3D AQ_NIC_RATE_10G | AQ_NIC_RATE_5G | AQ_NIC_RATE_2G5 | AQ_NIC_RATE_1G | AQ_NIC_RATE_100M; =20 + adapter->hw_cfg.aq_rss.indirection_table_size =3D + HW_ATL_B0_RSS_REDIRECTION_MAX; + hw->aq_nic_cfg =3D &adapter->hw_cfg; =20 /* disable interrupt */ @@ -748,6 +772,10 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_e= th_dev_info *dev_info) dev_info->rx_desc_lim =3D rx_desc_lim; dev_info->tx_desc_lim =3D tx_desc_lim; =20 + dev_info->hash_key_size =3D HW_ATL_B0_RSS_HASHKEY_BITS / 8; + dev_info->reta_size =3D HW_ATL_B0_RSS_REDIRECTION_MAX; + dev_info->flow_type_rss_offloads =3D ATL_RSS_OFFLOAD_ALL; + dev_info->speed_capa =3D ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G; dev_info->speed_capa |=3D ETH_LINK_SPEED_100M; dev_info->speed_capa |=3D ETH_LINK_SPEED_2_5G; @@ -999,6 +1027,85 @@ atl_dev_interrupt_handler(void *param) atl_dev_interrupt_action(dev, dev->intr_handle); } =20 +static int +atl_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + int i; + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct aq_hw_cfg_s *cf =3D ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private)= ; + + for (i =3D 0; i < reta_size && i < cf->aq_rss.indirection_table_size; i++= ) + cf->aq_rss.indirection_table[i] =3D min(reta_conf->reta[i], + dev->data->nb_rx_queues - 1); + + hw_atl_b0_hw_rss_set(hw, &cf->aq_rss); + return 0; +} + +static int +atl_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + int i; + struct aq_hw_cfg_s *cf =3D ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private)= ; + + for (i =3D 0; i < reta_size && i < cf->aq_rss.indirection_table_size; i++= ) + reta_conf->reta[i] =3D cf->aq_rss.indirection_table[i]; + reta_conf->mask =3D ~0U; + return 0; +} + +static int +atl_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) +{ + struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct aq_hw_cfg_s *cfg =3D + ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private); + static u8 def_rss_key[40] =3D { + 0x1e, 0xad, 0x71, 0x87, 0x65, 0xfc, 0x26, 0x7d, + 0x0d, 0x45, 0x67, 0x74, 0xcd, 0x06, 0x1a, 0x18, + 0xb6, 0xc1, 0xf0, 0xc7, 0xbb, 0x18, 0xbe, 0xf8, + 0x19, 0x13, 0x4b, 0xa9, 0xd0, 0x3e, 0xfe, 0x70, + 0x25, 0x03, 0xab, 0x50, 0x6a, 0x8b, 0x82, 0x0c + }; + + cfg->is_rss =3D !!rss_conf->rss_hf; + if (rss_conf->rss_key) { + memcpy(cfg->aq_rss.hash_secret_key, rss_conf->rss_key, + rss_conf->rss_key_len); + cfg->aq_rss.hash_secret_key_size =3D rss_conf->rss_key_len; + } else { + memcpy(cfg->aq_rss.hash_secret_key, def_rss_key, + sizeof(def_rss_key)); + cfg->aq_rss.hash_secret_key_size =3D sizeof(def_rss_key); + } + + hw_atl_b0_hw_rss_set(hw, &cfg->aq_rss); + hw_atl_b0_hw_rss_hash_set(hw, &cfg->aq_rss); + return 0; +} + +static int +atl_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) +{ + struct aq_hw_cfg_s *cfg =3D + ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private); + + rss_conf->rss_hf =3D cfg->is_rss ? ATL_RSS_OFFLOAD_ALL : 0; + if (rss_conf->rss_key) { + rss_conf->rss_key_len =3D cfg->aq_rss.hash_secret_key_size; + memcpy(rss_conf->rss_key, cfg->aq_rss.hash_secret_key, + rss_conf->rss_key_len); + } + + return 0; +} + RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map); RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic"); diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_e= thdev.h index dbb42140816b..f0854e0f1d9f 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -10,6 +10,17 @@ #include "atl_types.h" #include "hw_atl/hw_atl_utils.h" =20 +#define ATL_RSS_OFFLOAD_ALL ( \ + ETH_RSS_IPV4 | \ + ETH_RSS_NONFRAG_IPV4_TCP | \ + ETH_RSS_NONFRAG_IPV4_UDP | \ + ETH_RSS_IPV6 | \ + ETH_RSS_NONFRAG_IPV6_TCP | \ + ETH_RSS_NONFRAG_IPV6_UDP | \ + ETH_RSS_IPV6_EX | \ + ETH_RSS_IPV6_TCP_EX | \ + ETH_RSS_IPV6_UDP_EX) + #define ATL_DEV_PRIVATE_TO_HW(adapter) \ (&((struct atl_adapter *)adapter)->hw) =20 @@ -19,6 +30,9 @@ #define ATL_DEV_PRIVATE_TO_INTR(adapter) \ (&((struct atl_adapter *)adapter)->intr) =20 +#define ATL_DEV_PRIVATE_TO_CFG(adapter) \ + (&((struct atl_adapter *)adapter)->hw_cfg) + #define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0) #define ATL_FLAG_NEED_LINK_CONFIG (uint32_t)(4 << 0) =20 diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxt= x.c index 5a49c4fc65e1..0724a35ef140 100644 --- a/drivers/net/atlantic/atl_rxtx.c +++ b/drivers/net/atlantic/atl_rxtx.c @@ -336,6 +336,7 @@ int atl_rx_init(struct rte_eth_dev *eth_dev) { struct aq_hw_s *hw =3D ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct aq_rss_parameters *rss_params =3D &hw->aq_nic_cfg->aq_rss; struct atl_rx_queue *rxq; uint64_t base_addr =3D 0; int i =3D 0; @@ -379,6 +380,10 @@ atl_rx_init(struct rte_eth_dev *eth_dev) } } =20 + for (i =3D rss_params->indirection_table_size; i--;) + rss_params->indirection_table[i] =3D i & + (eth_dev->data->nb_rx_queues - 1); + hw_atl_b0_hw_rss_set(hw, rss_params); return err; } =20 --=20 2.7.4