net/qede: support RSS hash configuration

Add support for setting hash configuration based on adapter capability
and update corresponding NIC documentation.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
This commit is contained in:
Sony Chacko 2016-06-15 22:47:03 -07:00 committed by Bruce Richardson
parent 1160de6779
commit 4c98f2768e
5 changed files with 75 additions and 16 deletions

View File

@ -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 Y 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 Y
Multicast MAC filter 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 Y
RSS hash Y Y Y Y Y Y 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 Y
RSS key update 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 Y Y Y
RSS reta 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 Y Y
VMDq 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 Y SR-IOV Y Y Y Y Y Y Y Y Y Y Y

View File

@ -51,7 +51,7 @@ Supported Features
- VLAN offload - Filtering and stripping - VLAN offload - Filtering and stripping
- Stateless checksum offloads (IPv4/TCP/UDP) - Stateless checksum offloads (IPv4/TCP/UDP)
- Multiple Rx/Tx queues (queue-pairs) - Multiple Rx/Tx queues (queue-pairs)
- RSS (with default table/key) - RSS (with user configurable table/key)
- TSS - TSS
- Multiple MAC address - Multiple MAC address
- Default pause flow control - Default pause flow control
@ -61,7 +61,6 @@ Non-supported Features
---------------------- ----------------------
- Scatter-Gather Rx/Tx frames - Scatter-Gather Rx/Tx frames
- User configurable RETA table/key
- Unequal number of Rx/Tx queues - Unequal number of Rx/Tx queues
- MTU change (dynamic) - MTU change (dynamic)
- SR-IOV PF - SR-IOV PF

View File

@ -53,6 +53,7 @@ struct qed_dev_eth_info {
struct qed_update_vport_rss_params { struct qed_update_vport_rss_params {
uint16_t rss_ind_table[128]; uint16_t rss_ind_table[128];
uint32_t rss_key[10]; uint32_t rss_key[10];
u8 rss_caps;
}; };
struct qed_stop_rxq_params { struct qed_stop_rxq_params {

View File

@ -753,6 +753,47 @@ qede_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev)
return NULL; 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 = { static const struct eth_dev_ops qede_eth_dev_ops = {
.dev_configure = qede_dev_configure, .dev_configure = qede_dev_configure,
.dev_infos_get = qede_dev_info_get, .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_set = qede_flow_ctrl_set,
.flow_ctrl_get = qede_flow_ctrl_get, .flow_ctrl_get = qede_flow_ctrl_get,
.dev_supported_ptypes_get = qede_dev_supported_ptypes_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 = { 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_offload_set = qede_vlan_offload_set,
.vlan_filter_set = qede_vlan_filter_set, .vlan_filter_set = qede_vlan_filter_set,
.dev_supported_ptypes_get = qede_dev_supported_ptypes_get, .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) static void qede_update_pf_params(struct ecore_dev *edev)

View File

@ -532,13 +532,18 @@ static int
qede_config_rss(struct rte_eth_dev *eth_dev, qede_config_rss(struct rte_eth_dev *eth_dev,
struct qed_update_vport_rss_params *rss_params) 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; 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 qede_dev *qdev = eth_dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev; struct ecore_dev *edev = &qdev->edev;
uint8_t rss_caps;
unsigned int i; 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); PMD_INIT_FUNC_TRACE(edev);
/* Check if RSS conditions are met. /* Check if RSS conditions are met.
@ -553,16 +558,12 @@ qede_config_rss(struct rte_eth_dev *eth_dev,
DP_INFO(edev, "RSS flag is set\n"); DP_INFO(edev, "RSS flag is set\n");
if (rss_conf.rss_hf == 0) { if (rss_conf.rss_hf == 0)
DP_NOTICE(edev, false, "No RSS hash function to apply\n"); DP_NOTICE(edev, false, "RSS hash function = 0, disables RSS\n");
return -EINVAL;
}
if (rss_conf.rss_key != NULL) { if (rss_conf.rss_key != NULL)
DP_NOTICE(edev, false, memcpy(qdev->rss_params.rss_key, rss_conf.rss_key,
"User provided RSS key is not supported\n"); rss_conf.rss_key_len);
return -EINVAL;
}
memset(rss_params, 0, sizeof(*rss_params)); memset(rss_params, 0, sizeof(*rss_params));
@ -570,8 +571,23 @@ qede_config_rss(struct rte_eth_dev *eth_dev,
rss_params->rss_ind_table[i] = qede_rxfh_indir_default(i, rss_params->rss_ind_table[i] = qede_rxfh_indir_default(i,
QEDE_RSS_CNT(qdev)); QEDE_RSS_CNT(qdev));
qede_prandom_bytes(rss_params->rss_key, /* key and protocols */
sizeof(rss_params->rss_key)); 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"); DP_INFO(edev, "RSS check passes\n");