From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016ce01.pphosted.com (mx0a-0016ce01.pphosted.com [67.231.148.157]) by dpdk.org (Postfix) with ESMTP id 1D8165A0C for ; Sat, 7 May 2016 06:30:30 +0200 (CEST) Received: from pps.filterd (m0095336.ppops.net [127.0.0.1]) by mx0a-0016ce01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u474UPQG019040 for ; Fri, 6 May 2016 21:30:30 -0700 Received: from avcashub1.qlogic.com ([198.186.0.115]) by mx0a-0016ce01.pphosted.com with ESMTP id 22s2eqgh7w-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 06 May 2016 21:30:30 -0700 Received: from avluser05.qlc.com (10.1.113.115) by qlc.com (10.1.4.190) with Microsoft SMTP Server id 14.3.235.1; Fri, 6 May 2016 21:30:29 -0700 Received: (from rmody@localhost) by avluser05.qlc.com (8.14.4/8.14.4/Submit) id u474UTsi022560; Fri, 6 May 2016 21:30:29 -0700 X-Authentication-Warning: avluser05.qlc.com: rmody set sender to rasesh.mody@qlogic.com using -f From: Rasesh Mody To: CC: , Sony Chacko Date: Fri, 6 May 2016 21:30:13 -0700 Message-ID: <1462595421-22505-2-git-send-email-rasesh.mody@qlogic.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1462595421-22505-1-git-send-email-rasesh.mody@qlogic.com> References: <1462595421-22505-1-git-send-email-rasesh.mody@qlogic.com> MIME-Version: 1.0 Content-Type: text/plain disclaimer: bypass X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8157 signatures=670715 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1605070067 Subject: [dpdk-dev] [PATCH 1/9] qede: update hash config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2016 04:30:31 -0000 From: Sony Chacko Add support for rss_hash_update. Signed-off-by: Sony Chacko --- doc/guides/nics/overview.rst | 2 +- doc/guides/nics/qede.rst | 3 +-- drivers/net/qede/qede_eth_if.h | 1 + drivers/net/qede/qede_ethdev.c | 43 ++++++++++++++++++++++++++++++++++++++++ drivers/net/qede/qede_rxtx.c | 42 +++++++++++++++++++++++++++------------ 5 files changed, 75 insertions(+), 16 deletions(-) diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst index a309752..e62d27b 100644 --- a/doc/guides/nics/overview.rst +++ b/doc/guides/nics/overview.rst @@ -102,7 +102,7 @@ Most of these differences are summarized below. Unicast MAC filter Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Multicast MAC filter Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y RSS hash Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y - RSS key update Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y + RSS key update Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y RSS reta update Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y VMDq Y Y Y Y Y Y Y SR-IOV Y Y Y Y Y Y Y Y Y Y diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst index 9ff3d1d..c5fbd83 100644 --- a/doc/guides/nics/qede.rst +++ b/doc/guides/nics/qede.rst @@ -51,7 +51,7 @@ Supported Features - VLAN offload - Filtering and stripping - Stateless checksum offloads (IPv4/TCP/UDP) - Multiple Rx/Tx queues (queue-pairs) -- RSS (with default table/key) +- RSS (with user configurable table/key) - TSS - Multiple MAC address - Default pause flow control @@ -61,7 +61,6 @@ Non-supported Features ---------------------- - Scatter-Gather Rx/Tx frames -- User configurable RETA table/key - Unequal number of Rx/Tx queues - MTU change (dynamic) - SR-IOV PF diff --git a/drivers/net/qede/qede_eth_if.h b/drivers/net/qede/qede_eth_if.h index 61f677c..26968eb 100644 --- a/drivers/net/qede/qede_eth_if.h +++ b/drivers/net/qede/qede_eth_if.h @@ -53,6 +53,7 @@ struct qed_dev_eth_info { struct qed_update_vport_rss_params { uint16_t rss_ind_table[128]; uint32_t rss_key[10]; + u8 rss_caps; }; struct qed_stop_rxq_params { diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 1273fd3..84ff6f8 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -753,6 +753,47 @@ qede_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev) return NULL; } +int qede_rss_hash_update(struct rte_eth_dev *eth_dev, + struct rte_eth_rss_conf *rss_conf) +{ + struct qed_update_vport_params vport_update_params; + struct qede_dev *qdev = eth_dev->data->dev_private; + struct ecore_dev *edev = &qdev->edev; + uint8_t rss_caps; + uint32_t *key = (uint32_t *)rss_conf->rss_key; + uint64_t hf = rss_conf->rss_hf; + int i; + + if (hf == 0) + DP_ERR(edev, "hash function 0 will disable RSS\n"); + + rss_caps = 0; + rss_caps |= (hf & ETH_RSS_IPV4) ? ECORE_RSS_IPV4 : 0; + rss_caps |= (hf & ETH_RSS_IPV6) ? ECORE_RSS_IPV6 : 0; + rss_caps |= (hf & ETH_RSS_IPV6_EX) ? ECORE_RSS_IPV6 : 0; + rss_caps |= (hf & ETH_RSS_NONFRAG_IPV4_TCP) ? ECORE_RSS_IPV4_TCP : 0; + rss_caps |= (hf & ETH_RSS_NONFRAG_IPV6_TCP) ? ECORE_RSS_IPV6_TCP : 0; + rss_caps |= (hf & ETH_RSS_IPV6_TCP_EX) ? ECORE_RSS_IPV6_TCP : 0; + + /* If the mapping doesn't fit any supported, return */ + if (rss_caps == 0 && hf != 0) + return -EINVAL; + + memset(&vport_update_params, 0, sizeof(vport_update_params)); + + if (key != NULL) + memcpy(qdev->rss_params.rss_key, rss_conf->rss_key, + rss_conf->rss_key_len); + + qdev->rss_params.rss_caps = rss_caps; + memcpy(&vport_update_params.rss_params, &qdev->rss_params, + sizeof(vport_update_params.rss_params)); + vport_update_params.update_rss_flg = 1; + vport_update_params.vport_id = 0; + + return qdev->ops->vport_update(edev, &vport_update_params); +} + static const struct eth_dev_ops qede_eth_dev_ops = { .dev_configure = qede_dev_configure, .dev_infos_get = qede_dev_info_get, @@ -780,6 +821,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = { .flow_ctrl_set = qede_flow_ctrl_set, .flow_ctrl_get = qede_flow_ctrl_get, .dev_supported_ptypes_get = qede_dev_supported_ptypes_get, + .rss_hash_update = qede_rss_hash_update, }; static const struct eth_dev_ops qede_eth_vf_dev_ops = { @@ -804,6 +846,7 @@ static const struct eth_dev_ops qede_eth_vf_dev_ops = { .vlan_offload_set = qede_vlan_offload_set, .vlan_filter_set = qede_vlan_filter_set, .dev_supported_ptypes_get = qede_dev_supported_ptypes_get, + .rss_hash_update = qede_rss_hash_update, }; static void qede_update_pf_params(struct ecore_dev *edev) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 20c1cf8..23f9692 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -543,13 +543,18 @@ static int qede_config_rss(struct rte_eth_dev *eth_dev, struct qed_update_vport_rss_params *rss_params) { + struct rte_eth_rss_conf rss_conf; enum rte_eth_rx_mq_mode mode = eth_dev->data->dev_conf.rxmode.mq_mode; - struct rte_eth_rss_conf rss_conf = - eth_dev->data->dev_conf.rx_adv_conf.rss_conf; struct qede_dev *qdev = eth_dev->data->dev_private; struct ecore_dev *edev = &qdev->edev; + uint8_t rss_caps; unsigned int i; + uint64_t hf; + uint32_t *key; + rss_conf = eth_dev->data->dev_conf.rx_adv_conf.rss_conf; + key = (uint32_t *)rss_conf.rss_key; + hf = rss_conf.rss_hf; PMD_INIT_FUNC_TRACE(edev); /* Check if RSS conditions are met. @@ -564,16 +569,12 @@ qede_config_rss(struct rte_eth_dev *eth_dev, DP_INFO(edev, "RSS flag is set\n"); - if (rss_conf.rss_hf == 0) { - DP_NOTICE(edev, false, "No RSS hash function to apply\n"); - return -EINVAL; - } + if (rss_conf.rss_hf == 0) + DP_NOTICE(edev, false, "RSS hash function = 0, disables RSS\n"); - if (rss_conf.rss_key != NULL) { - DP_NOTICE(edev, false, - "User provided RSS key is not supported\n"); - return -EINVAL; - } + if (rss_conf.rss_key != NULL) + memcpy(qdev->rss_params.rss_key, rss_conf.rss_key, + rss_conf.rss_key_len); memset(rss_params, 0, sizeof(*rss_params)); @@ -581,8 +582,23 @@ qede_config_rss(struct rte_eth_dev *eth_dev, rss_params->rss_ind_table[i] = qede_rxfh_indir_default(i, QEDE_RSS_CNT(qdev)); - qede_prandom_bytes(rss_params->rss_key, - sizeof(rss_params->rss_key)); + /* key and protocols */ + if (rss_conf.rss_key == NULL) + qede_prandom_bytes(rss_params->rss_key, + sizeof(rss_params->rss_key)); + else + memcpy(rss_params->rss_key, rss_conf.rss_key, + rss_conf.rss_key_len); + + rss_caps = 0; + rss_caps |= (hf & ETH_RSS_IPV4) ? ECORE_RSS_IPV4 : 0; + rss_caps |= (hf & ETH_RSS_IPV6) ? ECORE_RSS_IPV6 : 0; + rss_caps |= (hf & ETH_RSS_IPV6_EX) ? ECORE_RSS_IPV6 : 0; + rss_caps |= (hf & ETH_RSS_NONFRAG_IPV4_TCP) ? ECORE_RSS_IPV4_TCP : 0; + rss_caps |= (hf & ETH_RSS_NONFRAG_IPV6_TCP) ? ECORE_RSS_IPV6_TCP : 0; + rss_caps |= (hf & ETH_RSS_IPV6_TCP_EX) ? ECORE_RSS_IPV6_TCP : 0; + + rss_params->rss_caps = rss_caps; DP_INFO(edev, "RSS check passes\n"); -- 1.7.10.3