From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0053.outbound.protection.outlook.com [104.47.32.53]) by dpdk.org (Postfix) with ESMTP id CE9BD1B44E for ; Tue, 9 Oct 2018 11:31:56 +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=HqGyQhQJ1UTYy2BCSXkY2YhgK02wHU0WXW5ZIIBOQ6Q=; b=uE3LXyEE55PeXCa8gScu204t4LBTXPEV/RgjaIDc7DfaOCdAgxvajDQ/fRBGQdQygQsDbkwnMCEKBtB7VbW23B3SjLOSshdRU4rDjIdPsJT5OHoyMXDm6Hy+A8tZjB4hrnVY7azGzPnTlWVCxSxOSiYSM2YmTkRV9NsVBbCNZs8= Received: from BLUPR0701MB1651.namprd07.prod.outlook.com (10.163.84.21) by BLUPR0701MB1650.namprd07.prod.outlook.com (10.163.84.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Tue, 9 Oct 2018 09:31:55 +0000 Received: from BLUPR0701MB1651.namprd07.prod.outlook.com ([fe80::7c97:1527:4c0:8b46]) by BLUPR0701MB1651.namprd07.prod.outlook.com ([fe80::7c97:1527:4c0:8b46%3]) with mapi id 15.20.1207.024; Tue, 9 Oct 2018 09:31:55 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Igor Russkikh , "ferruh.yigit@intel.com" , Pavel Belous Thread-Topic: [PATCH v4 15/22] net/atlantic: RSS and RETA manipulation API Thread-Index: AQHUX7LqRMpYI0sgDUi+8X5N25edjA== Date: Tue, 9 Oct 2018 09:31:55 +0000 Message-ID: <8577b11f1957da0e2b6bb3494ac8c9abac3d0f22.1539075891.git.igor.russkikh@aquantia.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM0PR01CA0028.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::41) To BLUPR0701MB1651.namprd07.prod.outlook.com (2a01:111:e400:58c6::21) 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; BLUPR0701MB1650; 6:BY0xUZkuke+CKD4a1zaoyXZdzfGg33U5Cv1SquV6YSL/fMM0z0INmzss7ti+n7VyC5/DTnRJRMCs14DrQA1rAPwLhCFG/z/EubIVhXcjCL4+OUEb68wY0Rldmn8ZKAnwGn32+gNBiA+Xj+0HWdSR1xRlfZKp3u9M4mIM0tx8snhc5V8SHIM4GBvxIGNFiL+Mrumh8TWnV9sBrWN5pWJbv+oB55T4yvTJ6FDhkQX+JDrXhuVWm3zxU6Z8QLPDzo8teQjlkGCbsbfFpv7HI4Yj8iVsDpsaCugPMHj43nB2uqwmK26x7YdTeYSYhvxdMlvNugqxhMMUwRQzhUd12oLie5ZJQcsuECmIBz0A+3OzlFoW7J5UXmmZ5jBc4lFC1uj7InfOhGzdXj2a5xzgmsTHsyPatF4kfNz7wdNPYI4zqmuEAgUN7ZS8MvXoOLQfMCbrqnCNSD/9kkBZnXAKkzGkyQ==; 5:A1YP1oOM2cV3iBN/rXiNPvOQ4LFwvux6yXWv2iWkjC6wmTDSfgM0AhRuiAAYiqvkGnzcOHY4zLKKtV8X9z5emMe/ht/emMWJ/WRbZyRKD0YHbJ/C3C61LDfw/SSo+dXnMOmn6OxThKJyNPiErCKSBR5bWALX0fRKB0q9eyMviVY=; 7:2BemT5iHfwl7LKcNlntLpo2Zr/55i4AH4RpkJfv1EJUOzzf7KHXb68tIEtz12lLSBlCWPGVYspycJd5awlZbvNg+HNaSIKx3R6MsZCJMIioQ3mr9YVM8qwpp9DVs87ba/m3JX1MmpI2kJZpC+z+4d71GuqJPfPzXl48wRcnANaRdIc7Y9zPrTdat/iKtJDh7Vw/sd+cAkig1mLJP8Uw/Uek/Dg2jePzrNHNocZQd7oftkGNhSoudZayzwIFnWy3E x-ms-office365-filtering-correlation-id: 87b8b924-690f-404d-5253-08d62dca0d24 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; x-ms-traffictypediagnostic: BLUPR0701MB1650: 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)(8121501046)(5005006)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(149066)(150057)(6041310)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39850400004)(346002)(376002)(396003)(136003)(189003)(199004)(81156014)(5640700003)(6116002)(71200400001)(105586002)(68736007)(316002)(3846002)(107886003)(71190400001)(26005)(118296001)(2616005)(5250100002)(25786009)(4326008)(102836004)(44832011)(446003)(476003)(11346002)(186003)(2906002)(106356001)(97736004)(2501003)(2351001)(486006)(478600001)(99286004)(53936002)(386003)(1730700003)(5660300001)(6506007)(36756003)(66066001)(54906003)(305945005)(256004)(14444005)(86362001)(575784001)(7736002)(2900100001)(76176011)(8936002)(52116002)(8676002)(6486002)(72206003)(6436002)(14454004)(81166006)(6512007)(6916009)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:BLUPR0701MB1651.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: eQHI2hRmyGSt+alCtaVxhGGQ6pRxchdZzaSeALCEMrMV0grFQJky+9d4Nl8T3UqhEEgTmltouk8oEvmkOaqtW64x/3AOUeWQaBozo9PUccJx2wfPRicXR92wK4FsxvKmRJLr4yhH7i/tAiXMHun0QixsK88oFpdhohCPR3ZMI+yCOOXeWpwC+Q/ci/hpATa8gyIysdBxL1fSIldd+rqSM59Jrw2Q2irriygW+PPeSiZkVL+opeq7iAhNrnuaEGTIpWVNK6tYfkZ1DNRinc76sEG2Oji8LCbccB9f2yliVgpUkfGC5FvUmofmY2GN83tg2QwKA9eUKu1O4EojkQ9z0mSUT1qyPeNmIpFH2/6P5u0= 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: 87b8b924-690f-404d-5253-08d62dca0d24 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 09:31:55.1675 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1650 Subject: [dpdk-dev] [PATCH v4 15/22] net/atlantic: 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: Tue, 09 Oct 2018 09:31:57 -0000 Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- drivers/net/atlantic/atl_ethdev.c | 107 ++++++++++++++++++++++++++++++++++= ++++ drivers/net/atlantic/atl_ethdev.h | 14 +++++ drivers/net/atlantic/atl_rxtx.c | 5 ++ 3 files changed, 126 insertions(+) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_e= thdev.c index a6ce2c47e0d7..d6ec20d19a9a 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -64,6 +64,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); @@ -216,6 +229,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 =20 @@ -333,12 +351,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 */ @@ -840,6 +864,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; @@ -1091,6 +1119,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 88801822262f..582832457cdf 100644 --- a/drivers/net/atlantic/atl_rxtx.c +++ b/drivers/net/atlantic/atl_rxtx.c @@ -327,6 +327,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; @@ -370,6 +371,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