net/qede: fix ovs-dpdk failure when using odd number of queues on 100Gb mode
PATCH 1/2 net/qede: fix ovs-dpdk failure when using odd number of queues on 100Gb mode
As per HW design of 100Gb mode, device internally uses 2 engines (eng0 and eng1), and both engines need to be configured symmetrically. Based on this requirement, driver design chose an approach to allow user to allocate only even number of queues and split those queues on both engines equally.
This approach puts a limitation on number of queues to be allocated - i.e. user can't configure odd number of queues on 100Gb mode. OVS configures DPDK port with 1 rxq and 1 txq, which causes initialization of qede port to fail.
This patch changes the implementation of queue allocation method for 100Gb devices by removing above mentioned limitation and allowing user to configure odd number of queues.
Key changes in this patch -
- Allocate requested queue count on both engines, so that actual hardware queue count will be double of what user requested.
- Create a pair of queues from both engines and provide it to rte_ethdev queue structure. So ethdev will see only one queue for underlying queue pair created for hw engine pair.
- Rx and Tx methods from ethdev will provide that queue pair object and PMD will internally split Rx and Tx packet processing across both engines in separately installed Rx and Tx handlers.
- Consolidate statistics of both HW queues while reporting to application.
- Report engine wise queue statistics in xstats flow.
e.g. - rx_q<hw_eng_id>.<qid>_xxxxxxx
--- drivers/net/qede/qede_ethdev.c | 326 +++++++++++++---------------- drivers/net/qede/qede_ethdev.h | 5 +- drivers/net/qede/qede_filter.c | 5 +- drivers/net/qede/qede_rxtx.c | 368 ++++++++++++++++++++++++--------- drivers/net/qede/qede_rxtx.h | 26 ++- 5 files changed, 440 insertions(+), 290 deletions(-)
drivers/net/qede/qede_ethdev.c +145 -181
@@ -304,6 +304,7 @@ static void qede_print_adapter_info(struct qede_dev *qdev)static void qede_reset_queue_stats (struct qede_dev *qdev,bool xstats) { +struct rte_eth_dev *dev = (struct rte_eth_dev *)qdev->ethdev;struct ecore_dev *edev =QEDE_INIT_EDEV (qdev);unsigned int i =0 , j =0 , qid;unsigned int rxq_stat_cntrs, txq_stat_cntrs;
@@ -311,12 +312,12 @@ static void qede_reset_queue_stats(struct qede_dev *qdev, bool xstats)DP_VERBOSE (edev,ECORE_MSG_DEBUG ,"Clearing queue stats\n" ); - rxq_stat_cntrs =RTE_MIN (QEDE_RSS_COUNT (qdev), + rxq_stat_cntrs =RTE_MIN (QEDE_RSS_COUNT (dev),RTE_ETHDEV_QUEUE_STAT_CNTRS ); - txq_stat_cntrs =RTE_MIN (QEDE_TSS_COUNT (qdev), + txq_stat_cntrs =RTE_MIN (QEDE_TSS_COUNT (dev),RTE_ETHDEV_QUEUE_STAT_CNTRS ); -for_each_rss (qid) { +for (qid =0 ; qid < qdev->num_rx_queues; qid++) {OSAL_MEMSET (((char *)(qdev->fp_array[qid].rxq)) + offsetof(struct qede_rx_queue , rcv_pkts),0 ,sizeof (uint64_t ));
@@ -342,7 +343,7 @@ static void qede_reset_queue_stats(struct qede_dev *qdev, bool xstats) i =0 ; -for_each_tss (qid) { +for (qid =0 ; qid < qdev->num_tx_queues; qid++) { txq = qdev->fp_array[qid].txq; OSAL_MEMSET((uint64_t *)(uintptr_t)
@@ -991,7 +992,7 @@ int qede_config_rss(struct rte_eth_dev *eth_dev)for (i =0 ; i <ECORE_RSS_IND_TABLE_SIZE ; i++) { id = i /RTE_RETA_GROUP_SIZE ; pos = i %RTE_RETA_GROUP_SIZE ; - q = i %QEDE_RSS_COUNT (qdev); + q = i %QEDE_RSS_COUNT (eth_dev); reta_conf[id].reta[pos] = q; } if (qede_rss_reta_update(eth_dev, &reta_conf[0],
@@ -1165,22 +1166,6 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)PMD_INIT_FUNC_TRACE (edev); -/* Check requirements for 100G mode */ -if (ECORE_IS_CMT (edev)) { -if (eth_dev->data->nb_rx_queues <2 || - eth_dev->data->nb_tx_queues <2 ) { -DP_ERR (edev,"100G mode needs min. 2 RX/TX queues\n" ); -return -EINVAL ; - } - -if ((eth_dev->data->nb_rx_queues %2 !=0 ) || - (eth_dev->data->nb_tx_queues %2 !=0 )) { -DP_ERR (edev, -"100G mode needs even no. of RX/TX queues\n" ); -return -EINVAL ; - } - } -/* We need to have min 1 RX queue.There is no min check in * rte_eth_dev_configure(), so we are checking it here. */
@@ -1207,8 +1192,9 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)return -ENOTSUP ;qede_dealloc_fp_resc (eth_dev); - qdev->num_tx_queues = eth_dev->data->nb_tx_queues; - qdev->num_rx_queues = eth_dev->data->nb_rx_queues; + qdev->num_tx_queues = eth_dev->data->nb_tx_queues * edev->num_hwfns; + qdev->num_rx_queues = eth_dev->data->nb_rx_queues * edev->num_hwfns; +if (qede_alloc_fp_resc (qdev))return -ENOMEM ;
@@ -1233,7 +1219,12 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)return ret;DP_INFO (edev,"Device configured with RSS=%d TSS=%d\n" , -QEDE_RSS_COUNT (qdev),QEDE_TSS_COUNT (qdev)); +QEDE_RSS_COUNT (eth_dev),QEDE_TSS_COUNT (eth_dev)); + +if (ECORE_IS_CMT (edev)) +DP_INFO (edev,"Actual HW queues for CMT mode - RX = %d TX = %d\n" , + qdev->num_rx_queues, qdev->num_tx_queues); +return 0 ; }
@@ -1275,6 +1266,10 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev,else dev_info->max_rx_queues = (uint16_t )RTE_MIN (QEDE_MAX_RSS_CNT (qdev),ECORE_MAX_VF_CHAINS_PER_PF ); +/* Since CMT mode internally doubles the number of queues */ +if (ECORE_IS_CMT (edev)) + dev_info->max_rx_queues = dev_info->max_rx_queues /2 ; + dev_info->max_tx_queues = dev_info->max_rx_queues; dev_info->max_mac_addrs = qdev->dev_info.num_mac_filters;
@@ -1482,7 +1477,7 @@ qede_get_stats(struct rte_eth_dev *eth_dev, struct rte_eth_stats *eth_stats)struct qede_dev *qdev = eth_dev->data->dev_private;struct ecore_dev *edev = &qdev->edev;struct ecore_eth_stats stats; -unsigned int i =0 , j =0 , qid; +unsigned int i =0 , j =0 , qid, idx, hw_fn;unsigned int rxq_stat_cntrs, txq_stat_cntrs;struct qede_tx_queue *txq;
@@ -1518,44 +1513,59 @@ qede_get_stats(struct rte_eth_dev *eth_dev, struct rte_eth_stats *eth_stats) eth_stats->oerrors = stats.common.tx_err_drop_pkts;/* Queue stats */ - rxq_stat_cntrs =RTE_MIN (QEDE_RSS_COUNT (qdev), + rxq_stat_cntrs =RTE_MIN (QEDE_RSS_COUNT (eth_dev),RTE_ETHDEV_QUEUE_STAT_CNTRS ); - txq_stat_cntrs =RTE_MIN (QEDE_TSS_COUNT (qdev), + txq_stat_cntrs =RTE_MIN (QEDE_TSS_COUNT (eth_dev),RTE_ETHDEV_QUEUE_STAT_CNTRS ); -if ((rxq_stat_cntrs != (unsigned int )QEDE_RSS_COUNT (qdev)) || - (txq_stat_cntrs != (unsigned int )QEDE_TSS_COUNT (qdev))) +if (rxq_stat_cntrs != (unsigned int )QEDE_RSS_COUNT (eth_dev) || + txq_stat_cntrs != (unsigned int )QEDE_TSS_COUNT (eth_dev))DP_VERBOSE (edev,ECORE_MSG_DEBUG ,"Not all the queue stats will be displayed. Set" " RTE_ETHDEV_QUEUE_STAT_CNTRS config param" " appropriately and retry.\n" ); -for_each_rss (qid) { - eth_stats->q_ipackets[i] = - *(uint64_t *)( - ((char *)(qdev->fp_array[qid].rxq)) + - offsetof(struct qede_rx_queue , - rcv_pkts)); - eth_stats->q_errors[i] = - *(uint64_t *)( - ((char *)(qdev->fp_array[qid].rxq)) + - offsetof(struct qede_rx_queue , - rx_hw_errors)) + - *(uint64_t *)( - ((char *)(qdev->fp_array[qid].rxq)) + - offsetof(struct qede_rx_queue , - rx_alloc_errors)); +for (qid =0 ; qid < eth_dev->data->nb_rx_queues; qid++) { + eth_stats->q_ipackets[i] =0 ; + eth_stats->q_errors[i] =0 ; + +for_each_hwfn (edev, hw_fn) { + idx = qid * edev->num_hwfns + hw_fn; + + eth_stats->q_ipackets[i] += + *(uint64_t *) + (((char *)(qdev->fp_array[idx].rxq)) + + offsetof(struct qede_rx_queue , + rcv_pkts)); + eth_stats->q_errors[i] += + *(uint64_t *) + (((char *)(qdev->fp_array[idx].rxq)) + + offsetof(struct qede_rx_queue , + rx_hw_errors)) + + *(uint64_t *) + (((char *)(qdev->fp_array[idx].rxq)) + + offsetof(struct qede_rx_queue , + rx_alloc_errors)); + } + i++;if (i == rxq_stat_cntrs)break ; } -for_each_tss (qid) { - txq = qdev->fp_array[qid].txq; - eth_stats->q_opackets[j] = - *((uint64_t *)(uintptr_t ) - (((uint64_t )(uintptr_t )(txq)) + - offsetof(struct qede_tx_queue , - xmit_pkts))); +for (qid =0 ; qid < eth_dev->data->nb_tx_queues; qid++) { + eth_stats->q_opackets[j] =0 ; + +for_each_hwfn (edev, hw_fn) { + idx = qid * edev->num_hwfns + hw_fn; + + txq = qdev->fp_array[idx].txq; + eth_stats->q_opackets[j] += + *((uint64_t *)(uintptr_t ) + (((uint64_t )(uintptr_t )(txq)) + + offsetof(struct qede_tx_queue , + xmit_pkts))); + } + j++;if (j == txq_stat_cntrs)break ;
@@ -1566,18 +1576,18 @@ qede_get_stats(struct rte_eth_dev *eth_dev, struct rte_eth_stats *eth_stats)static unsigned qede_get_xstats_count (struct qede_dev *qdev) { +struct rte_eth_dev *dev = (struct rte_eth_dev *)qdev->ethdev; +if (ECORE_IS_BB (&qdev->edev))return RTE_DIM (qede_xstats_strings) +RTE_DIM (qede_bb_xstats_strings) + (RTE_DIM (qede_rxq_xstats_strings) * -RTE_MIN (QEDE_RSS_COUNT (qdev), -RTE_ETHDEV_QUEUE_STAT_CNTRS )); +QEDE_RSS_COUNT (dev) * qdev->edev.num_hwfns);else return RTE_DIM (qede_xstats_strings) +RTE_DIM (qede_ah_xstats_strings) + (RTE_DIM (qede_rxq_xstats_strings) * -RTE_MIN (QEDE_RSS_COUNT (qdev), -RTE_ETHDEV_QUEUE_STAT_CNTRS )); +QEDE_RSS_COUNT (dev)); } static int
@@ -1588,42 +1598,43 @@ qede_get_xstats_names(struct rte_eth_dev *dev,struct qede_dev *qdev = dev->data->dev_private;struct ecore_dev *edev = &qdev->edev;const unsigned int stat_cnt =qede_get_xstats_count (qdev); -unsigned int i, qid, stat_idx =0 ; -unsigned int rxq_stat_cntrs; +unsigned int i, qid, hw_fn, stat_idx =0 ; -if (xstats_names !=NULL ) { -for (i =0 ; i <RTE_DIM (qede_xstats_strings); i++) { +if (xstats_names ==NULL ) +return stat_cnt; + +for (i =0 ; i <RTE_DIM (qede_xstats_strings); i++) { +strlcpy (xstats_names[stat_idx].name, + qede_xstats_strings[i].name, +sizeof (xstats_names[stat_idx].name)); + stat_idx++; + } + +if (ECORE_IS_BB (edev)) { +for (i =0 ; i <RTE_DIM (qede_bb_xstats_strings); i++) {strlcpy (xstats_names[stat_idx].name, - qede_xstats_strings[i].name, + qede_bb_xstats_strings[i].name,sizeof (xstats_names[stat_idx].name)); stat_idx++; } - -if (ECORE_IS_BB (edev)) { -for (i =0 ; i <RTE_DIM (qede_bb_xstats_strings); i++) { -strlcpy (xstats_names[stat_idx].name, - qede_bb_xstats_strings[i].name, -sizeof (xstats_names[stat_idx].name)); - stat_idx++; - } - }else { -for (i =0 ; i <RTE_DIM (qede_ah_xstats_strings); i++) { -strlcpy (xstats_names[stat_idx].name, - qede_ah_xstats_strings[i].name, -sizeof (xstats_names[stat_idx].name)); - stat_idx++; - } + }else { +for (i =0 ; i <RTE_DIM (qede_ah_xstats_strings); i++) { +strlcpy (xstats_names[stat_idx].name, + qede_ah_xstats_strings[i].name, +sizeof (xstats_names[stat_idx].name)); + stat_idx++; } + } - rxq_stat_cntrs =RTE_MIN (QEDE_RSS_COUNT (qdev), -RTE_ETHDEV_QUEUE_STAT_CNTRS ); -for (qid =0 ; qid < rxq_stat_cntrs; qid++) { +for (qid =0 ; qid <QEDE_RSS_COUNT (dev); qid++) { +for_each_hwfn (edev, hw_fn) {for (i =0 ; i <RTE_DIM (qede_rxq_xstats_strings); i++) {snprintf (xstats_names[stat_idx].name, -sizeof (xstats_names[stat_idx].name), -"%.4s%d%s" , - qede_rxq_xstats_strings[i].name, qid, - qede_rxq_xstats_strings[i].name +4 ); +RTE_ETH_XSTATS_NAME_SIZE , +"%.4s%d.%d%s" , + qede_rxq_xstats_strings[i].name, + hw_fn, qid, + qede_rxq_xstats_strings[i].name +4 ); stat_idx++; } }
@@ -1640,8 +1651,7 @@ qede_get_xstats(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,struct ecore_dev *edev = &qdev->edev;struct ecore_eth_stats stats;const unsigned int num =qede_get_xstats_count (qdev); -unsigned int i, qid, stat_idx =0 ; -unsigned int rxq_stat_cntrs; +unsigned int i, qid, hw_fn, fpidx, stat_idx =0 ;if (n < num)return num;
@@ -1673,13 +1683,12 @@ qede_get_xstats(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, } } - rxq_stat_cntrs =RTE_MIN (QEDE_RSS_COUNT (qdev), -RTE_ETHDEV_QUEUE_STAT_CNTRS ); -for (qid =0 ; qid < rxq_stat_cntrs; qid++) { -for_each_rss (qid) { +for (qid =0 ; qid < dev->data->nb_rx_queues; qid++) { +for_each_hwfn (edev, hw_fn) {for (i =0 ; i <RTE_DIM (qede_rxq_xstats_strings); i++) { + fpidx = qid * edev->num_hwfns + hw_fn; xstats[stat_idx].value = *(uint64_t *)( - ((char *)(qdev->fp_array[qid].rxq)) + + ((char *)(qdev->fp_array[fpidx].rxq)) + qede_rxq_xstats_strings[i].offset); xstats[stat_idx].id = stat_idx; stat_idx++;
@@ -1938,7 +1947,8 @@ qede_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev) RTE_PTYPE_UNKNOWN }; -if (eth_dev->rx_pkt_burst == qede_recv_pkts) +if (eth_dev->rx_pkt_burst == qede_recv_pkts || + eth_dev->rx_pkt_burst == qede_recv_pkts_cmt)return ptypes;return NULL ;
@@ -1968,8 +1978,7 @@ int qede_rss_hash_update(struct rte_eth_dev *eth_dev,uint32_t *key = (uint32_t *)rss_conf->rss_key;uint64_t hf = rss_conf->rss_hf;uint8_t len = rss_conf->rss_key_len; -uint8_t idx; -uint8_t i; +uint8_t idx, i, j, fpidx;int rc;memset (&vport_update_params,0 ,sizeof (vport_update_params));
@@ -2003,14 +2012,18 @@ int qede_rss_hash_update(struct rte_eth_dev *eth_dev,/* tbl_size has to be set with capabilities */ rss_params.rss_table_size_log =7 ; vport_update_params.vport_id =0 ; -/* pass the L2 handles instead of qids */ -for (i =0 ; i <ECORE_RSS_IND_TABLE_SIZE ; i++) { - idx = i %QEDE_RSS_COUNT (qdev); - rss_params.rss_ind_table[i] = qdev->fp_array[idx].rxq->handle; - } - vport_update_params.rss_params = &rss_params;for_each_hwfn (edev, i) { +/* pass the L2 handles instead of qids */ +for (j =0 ; j <ECORE_RSS_IND_TABLE_SIZE ; j++) { + idx = j %QEDE_RSS_COUNT (eth_dev); + fpidx = idx * edev->num_hwfns + i; + rss_params.rss_ind_table[j] = + qdev->fp_array[fpidx].rxq->handle; + } + + vport_update_params.rss_params = &rss_params; + p_hwfn = &edev->hwfns[i]; vport_update_params.opaque_fid = p_hwfn->hw_info.opaque_fid; rc = ecore_sp_vport_update(p_hwfn, &vport_update_params,
@@ -2062,61 +2075,6 @@ static int qede_rss_hash_conf_get(struct rte_eth_dev *eth_dev,return 0 ; } -static bool qede_update_rss_parm_cmt (struct ecore_dev *edev, -struct ecore_rss_params *rss) -{ -int i, fn; -bool rss_mode =1 ;/* enable */ -struct ecore_queue_cid *cid; -struct ecore_rss_params *t_rss; - -/* In regular scenario, we'd simply need to take input handlers. -* But in CMT, we'd have to split the handlers according to the -* engine they were configured on. We'd then have to understand -* whether RSS is really required, since 2-queues on CMT doesn't -* require RSS. -*/ - -/* CMT should be round-robin */ -for (i =0 ; i <ECORE_RSS_IND_TABLE_SIZE ; i++) { - cid = rss->rss_ind_table[i]; - -if (cid->p_owner ==ECORE_LEADING_HWFN (edev)) - t_rss = &rss[0 ]; -else - t_rss = &rss[1 ]; - - t_rss->rss_ind_table[i / edev->num_hwfns] = cid; - } - - t_rss = &rss[1 ]; - t_rss->update_rss_ind_table =1 ; - t_rss->rss_table_size_log =7 ; - t_rss->update_rss_config =1 ; - -/* Make sure RSS is actually required */ -for_each_hwfn (edev, fn) { -for (i =1 ; i <ECORE_RSS_IND_TABLE_SIZE / edev->num_hwfns; - i++) { -if (rss[fn].rss_ind_table[i] != - rss[fn].rss_ind_table[0 ]) -break ; - } - -if (i ==ECORE_RSS_IND_TABLE_SIZE / edev->num_hwfns) { -DP_INFO (edev, -"CMT - 1 queue per-hwfn; Disabling RSS\n" ); - rss_mode =0 ; - goto out; - } - } - -out: - t_rss->rss_enable = rss_mode; - -return rss_mode; -} -int qede_rss_reta_update (struct rte_eth_dev *eth_dev,struct rte_eth_rss_reta_entry64 *reta_conf,uint16_t reta_size)
@@ -2125,8 +2083,8 @@ int qede_rss_reta_update(struct rte_eth_dev *eth_dev,struct ecore_dev *edev =QEDE_INIT_EDEV (qdev);struct ecore_sp_vport_update_params vport_update_params;struct ecore_rss_params *params; +uint16_t i, j, idx, fid, shift;struct ecore_hwfn *p_hwfn; -uint16_t i, idx, shift;uint8_t entry;int rc =0 ;
@@ -2137,40 +2095,36 @@ int qede_rss_reta_update(struct rte_eth_dev *eth_dev, }memset (&vport_update_params,0 ,sizeof (vport_update_params)); - params =rte_zmalloc ("qede_rss" ,sizeof (*params) * edev->num_hwfns, -RTE_CACHE_LINE_SIZE ); + params =rte_zmalloc ("qede_rss" ,sizeof (*params),RTE_CACHE_LINE_SIZE );if (params ==NULL ) {DP_ERR (edev,"failed to allocate memory\n" );return -ENOMEM ; } -for (i =0 ; i < reta_size; i++) { - idx = i /RTE_RETA_GROUP_SIZE ; - shift = i %RTE_RETA_GROUP_SIZE ; -if (reta_conf[idx].mask & (1ULL << shift)) { - entry = reta_conf[idx].reta[shift]; -/* Pass rxq handles to ecore */ - params->rss_ind_table[i] = - qdev->fp_array[entry].rxq->handle; -/* Update the local copy for RETA query command */ - qdev->rss_ind_table[i] = entry; - } - } - params->update_rss_ind_table =1 ; params->rss_table_size_log =7 ; params->update_rss_config =1 ; -/* Fix up RETA for CMT mode device */ -if (ECORE_IS_CMT (edev)) - qdev->rss_enable =qede_update_rss_parm_cmt (edev, - params); vport_update_params.vport_id =0 ;/* Use the current value of rss_enable */ params->rss_enable = qdev->rss_enable; vport_update_params.rss_params = params;for_each_hwfn (edev, i) { +for (j =0 ; j < reta_size; j++) { + idx = j /RTE_RETA_GROUP_SIZE ; + shift = j %RTE_RETA_GROUP_SIZE ; +if (reta_conf[idx].mask & (1ULL << shift)) { + entry = reta_conf[idx].reta[shift]; + fid = entry * edev->num_hwfns + i; +/* Pass rxq handles to ecore */ + params->rss_ind_table[j] = + qdev->fp_array[fid].rxq->handle; +/* Update the local copy for RETA query cmd */ + qdev->rss_ind_table[j] = entry; + } + } + p_hwfn = &edev->hwfns[i]; vport_update_params.opaque_fid = p_hwfn->hw_info.opaque_fid; rc = ecore_sp_vport_update(p_hwfn, &vport_update_params,
@@ -2257,7 +2211,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) qdev->mtu = mtu;/* Fix up RX buf size for all queues of the port */ -for_each_rss (i) { +for (i =0 ; i < qdev->num_rx_queues; i++) { fp = &qdev->fp_array[i];if (fp->rxq !=NULL ) { bufsz = (uint16_t)rte_pktmbuf_data_room_size(
@@ -2286,9 +2240,13 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)/* update max frame size */ dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len;/* Reassign back */ - dev->rx_pkt_burst = qede_recv_pkts; - dev->tx_pkt_burst = qede_xmit_pkts; - +if (ECORE_IS_CMT (edev)) { + dev->rx_pkt_burst = qede_recv_pkts_cmt; + dev->tx_pkt_burst = qede_xmit_pkts_cmt; + }else { + dev->rx_pkt_burst = qede_recv_pkts; + dev->tx_pkt_burst = qede_xmit_pkts; + }return 0 ; }
@@ -2429,10 +2387,6 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) pci_addr.bus, pci_addr.devid, pci_addr.function, eth_dev->data->port_id); - eth_dev->rx_pkt_burst = qede_recv_pkts; - eth_dev->tx_pkt_burst = qede_xmit_pkts; - eth_dev->tx_pkt_prepare = qede_xmit_prep_pkts; -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {DP_ERR (edev,"Skipping device init from secondary process\n" );return 0 ;
@@ -2490,6 +2444,16 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)strncpy ((char *)params.name,QEDE_PMD_VER_PREFIX ,QEDE_PMD_DRV_VER_STR_SIZE ); +if (ECORE_IS_CMT (edev)) { + eth_dev->rx_pkt_burst = qede_recv_pkts_cmt; + eth_dev->tx_pkt_burst = qede_xmit_pkts_cmt; + }else { + eth_dev->rx_pkt_burst = qede_recv_pkts; + eth_dev->tx_pkt_burst = qede_xmit_pkts; + } + + eth_dev->tx_pkt_prepare = qede_xmit_prep_pkts; +/* For CMT mode device do periodic polling for slowpath events. * This is required since uio device uses only one MSI-x * interrupt vector but we need one for each engine.
drivers/net/qede/qede_ethdev.h +3 -2
@@ -66,8 +66,8 @@ (edev)->dev_info.num_tc)#define QEDE_QUEUE_CNT (qdev) ((qdev)->num_queues) -#define QEDE_RSS_COUNT (qdev) ((qdev)->num_rx_queues) -#define QEDE_TSS_COUNT (qdev) ((qdev)->num_tx_queues) +#define QEDE_RSS_COUNT (dev) ((dev)->data->nb_rx_queues) +#define QEDE_TSS_COUNT (dev) ((dev)->data->nb_tx_queues)#define QEDE_DUPLEX_FULL 1#define QEDE_DUPLEX_HALF 2
@@ -215,6 +215,7 @@ struct qede_dev {struct qed_dev_eth_info dev_info;struct ecore_sb_info *sb_array;struct qede_fastpath *fp_array; +struct qede_fastpath_cmt *fp_array_cmt;uint16_t mtu;bool enable_tx_switching;bool rss_enable;
drivers/net/qede/qede_filter.c +2 -3
@@ -431,7 +431,7 @@ qede_fdir_filter_add(struct rte_eth_dev *eth_dev,return -EINVAL ; } -if (fdir->action.rx_queue >=QEDE_RSS_COUNT (qdev)) { +if (fdir->action.rx_queue >=QEDE_RSS_COUNT (eth_dev)) {DP_ERR (edev,"invalid queue number %u\n" , fdir->action.rx_queue);return -EINVAL ;
@@ -1345,7 +1345,6 @@ qede_flow_parse_actions(struct rte_eth_dev *dev,struct rte_flow_error *error, struct rte_flow *flow) { - struct qede_dev *qdev = QEDE_INIT_QDEV(dev); const struct rte_flow_action_queue *queue;if (actions ==NULL ) {
@@ -1360,7 +1359,7 @@ qede_flow_parse_actions(struct rte_eth_dev *dev,case RTE_FLOW_ACTION_TYPE_QUEUE : queue = actions->conf; -if (queue->index >=QEDE_RSS_COUNT (qdev)) { +if (queue->index >=QEDE_RSS_COUNT (dev)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions,
drivers/net/qede/qede_rxtx.c +269 -99
562 lines not on this page · raw message
drivers/net/qede/qede_rxtx.h +21 -5
@@ -81,10 +81,8 @@ ETH_RSS_VXLAN |\ ETH_RSS_GENEVE) -#define for_each_rss (i) for (i = 0; i < qdev->num_rx_queues; i++) -#define for_each_tss (i) for (i = 0; i < qdev->num_tx_queues; i++)#define QEDE_RXTX_MAX (qdev) \ - (RTE_MAX(QEDE_RSS_COUNT(qdev), QEDE_TSS_COUNT(qdev))) + (RTE_MAX(qdev->num_rx_queues, qdev->num_tx_queues))/* Macros for non-tunnel packet types lkup table */ #define QEDE_PKT_TYPE_UNKNOWN 0x0
@@ -179,6 +177,8 @@ struct qede_agg_info {* Structure associated with each RX queue. */ struct qede_rx_queue { +/* Always keep qdev as first member */ +struct qede_dev *qdev;struct rte_mempool *mb_pool;struct ecore_chain rx_bd_ring;struct ecore_chain rx_comp_ring;
@@ -199,7 +199,6 @@ struct qede_rx_queue {uint64_t rx_hw_errors;uint64_t rx_alloc_errors;struct qede_agg_info tpa_info[ETH_TPA_MAX_AGGS_NUM ]; -struct qede_dev *qdev;void *handle; };
@@ -217,6 +216,8 @@ union db_prod { };struct qede_tx_queue { +/* Always keep qdev as first member */ +struct qede_dev *qdev;struct ecore_chain tx_pbl;struct qede_tx_entry *sw_tx_ring;uint16_t nb_tx_desc;
@@ -231,7 +232,6 @@ struct qede_tx_queue {uint16_t port_id;uint64_t xmit_pkts;bool is_legacy; -struct qede_dev *qdev;void *handle; };
@@ -241,6 +241,18 @@ struct qede_fastpath {struct qede_tx_queue *txq; }; +/* This structure holds the inforation of fast path queues +* belonging to individual engines in CMT mode. +*/ +struct qede_fastpath_cmt { +/* Always keep this a first element */ +struct qede_dev *qdev; +/* fastpath info of engine 0 */ +struct qede_fastpath *fp0; +/* fastpath info of engine 1 */ +struct qede_fastpath *fp1; +}; +/* * RX/TX function prototypes */
@@ -261,12 +273,16 @@ void qede_tx_queue_release(void *tx_queue);uint16_t qede_xmit_pkts (void *p_txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +uint16_t qede_xmit_pkts_cmt (void *p_txq,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);uint16_t qede_xmit_prep_pkts (void *p_txq,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);uint16_t qede_recv_pkts (void *p_rxq,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +uint16_t qede_recv_pkts_cmt (void *p_rxq,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts); uint16_t qede_rxtx_pkts_dummy(void *p_rxq, struct rte_mbuf **pkts,
Signature · 1 line
2.17.1
PATCH 2/2 net/qede: implement rte_flow drop action
Add support to configure drop action in RTE_FLOW infrastructure. Also, add statistics counter for dropped packets due to this filter action "rx_gft_filter_drop"
--- drivers/net/qede/base/ecore_dev_api.h | 1 + drivers/net/qede/base/ecore_l2.c | 50 +++++++++++++++------------ drivers/net/qede/base/ecore_l2_api.h | 39 ++++++++++++++------- drivers/net/qede/qede_ethdev.c | 2 ++ drivers/net/qede/qede_ethdev.h | 1 + drivers/net/qede/qede_filter.c | 22 ++++++++---- 6 files changed, 75 insertions(+), 40 deletions(-)
drivers/net/qede/base/ecore_dev_api.h +1 -0
@@ -334,6 +334,7 @@ struct ecore_eth_stats_common {u64 rx_bcast_pkts;u64 mftag_filter_discards;u64 mac_filter_discards; +u64 gft_filter_drop;u64 tx_ucast_bytes;u64 tx_mcast_bytes;u64 tx_bcast_bytes;
drivers/net/qede/base/ecore_l2.c +28 -22
84 lines not on this page · raw message
drivers/net/qede/base/ecore_l2_api.h +27 -12
@@ -448,6 +448,31 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,struct ecore_ptt *p_ptt, struct ecore_arfs_config_params *p_cfg_params); +struct ecore_ntuple_filter_params { +/* Physically mapped address containing header of buffer to be used +* as filter. +*/ +dma_addr_t addr; + +/* Length of header in bytes */ +u16 length; + +/* Relative queue-id to receive classified packet */ +#define ECORE_RFS_NTUPLE_QID_RSS ((u16)-1) +u16 qid; + +/* Identifier can either be according to vport-id or vfid */ +bool b_is_vf; +u8 vport_id; +u8 vf_id; + +/* true if this filter is to be added. Else to be removed */ +bool b_is_add; + +/* If packet needs to be dropped */ +bool b_is_drop; +}; +/** * @brief - ecore_configure_rfs_ntuple_filter *
@@ -457,22 +482,12 @@ void ecore_arfs_mode_configure(struct ecore_hwfn *p_hwfn,* @params p_cb Used for ECORE_SPQ_MODE_CB,where client would initialize * it with cookie and callback function address, if not * using this mode then client must pass NULL. -* @params p_addr p_addr is an actual packet header that needs to be -* filter. It has to mapped with IO to read prior to -* calling this, [contains 4 tuples- src ip, dest ip, -* src port, dest port]. -* @params length length of p_addr header up to past the transport header. -* @params qid receive packet will be directed to this queue. -* @params vport_id -* @params b_is_add flag to add or remove filter. -* +* @params p_params */ enum _ecore_status_t ecore_configure_rfs_ntuple_filter (struct ecore_hwfn *p_hwfn,struct ecore_spq_comp_cb *p_cb, -dma_addr_t p_addr,u16 length, -u16 qid,u8 vport_id, -bool b_is_add); +struct ecore_ntuple_filter_params *p_params);/** * @brief - ecore_update_eth_rss_ind_table_entry
drivers/net/qede/qede_ethdev.c +2 -0
@@ -125,6 +125,8 @@ static const struct rte_qede_xstats_name_off qede_xstats_strings[] = { offsetof(struct ecore_eth_stats_common, mftag_filter_discards)}, {"rx_mac_filter_discards" , offsetof(struct ecore_eth_stats_common, mac_filter_discards)}, + {"rx_gft_filter_drop", + offsetof(struct ecore_eth_stats_common, gft_filter_drop)}, {"rx_hw_buffer_truncates", offsetof(struct ecore_eth_stats_common, brb_truncates)}, {"rx_hw_buffer_discards",
drivers/net/qede/qede_ethdev.h +1 -0
@@ -179,6 +179,7 @@ struct qede_arfs_entry {uint32_t soft_id;/* unused for now */ uint16_t pkt_len;/* actual packet length to match */ uint16_t rx_queue;/* queue to be steered to */ +bool is_drop;/* drop action */ const struct rte_memzone *mz;/* mz used to hold L2 frame */ struct qede_arfs_tuple tuple;SLIST_ENTRY (qede_arfs_entry) list;
drivers/net/qede/qede_filter.c +16 -6
@@ -272,6 +272,7 @@ qede_config_arfs_filter(struct rte_eth_dev *eth_dev, {struct qede_dev *qdev =QEDE_INIT_QDEV (eth_dev);struct ecore_dev *edev =QEDE_INIT_EDEV (qdev); +struct ecore_ntuple_filter_params params;char mz_name[RTE_MEMZONE_NAMESIZE ] = {0 };struct qede_arfs_entry *tmp =NULL ;const struct rte_memzone *mz;
@@ -344,12 +345,18 @@ qede_config_arfs_filter(struct rte_eth_dev *eth_dev,ecore_arfs_mode_configure (p_hwfn, p_hwfn->p_arfs_ptt, &qdev->arfs_info.arfs); } + +memset (¶ms,0 ,sizeof (params)); + params.addr = (dma_addr_t )mz->iova; + params.length = pkt_len; + params.qid = arfs->rx_queue; + params.vport_id =0 ; + params.b_is_add = add; + params.b_is_drop = arfs->is_drop; +/* configure filter with ECORE_SPQ_MODE_EBLOCK */ rc =ecore_configure_rfs_ntuple_filter (p_hwfn,NULL , - (dma_addr_t )mz->iova, - pkt_len, - arfs->rx_queue, -0 , add); + ¶ms);if (rc ==ECORE_SUCCESS ) {if (add) { arfs->pkt_len = pkt_len;
@@ -1371,12 +1378,15 @@ qede_flow_parse_actions(struct rte_eth_dev *dev, flow->entry.rx_queue = queue->index;break ; - +case RTE_FLOW_ACTION_TYPE_DROP : +if (flow) + flow->entry.is_drop = true; +break ;default :rte_flow_error_set (error,ENOTSUP ,RTE_FLOW_ERROR_TYPE_ACTION , actions, -"Action is not supported - only ACTION_TYPE_QUEUE supported" ); +"Action is not supported - only ACTION_TYPE_QUEUE and ACTION_TYPE_DROP supported" );return -rte_errno; } }
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 2/2] net/qede: implement rte_flow drop action
Quoted 9 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shahed Shaikh
Sent: Wednesday, September 4, 2019 5:01 PM
To: [email protected]
Cc: Rasesh Mody <[email protected]>; [email protected]; GR- Everest-DPDK-Dev <[email protected]>
Subject: [dpdk-dev] [PATCH 2/2] net/qede: implementrte_flowdrop actionAdd support to configure drop action in
RTE_FLOWinfrastructure. Also, add
It would be good to add supported rte_flow actions by qede driver in PMD documentation.
Reference:
https://doc.dpdk.org/guides/nics/octeontx2.html
Quoted 12 lines
statistics counter for dropped packets due to this filter action "
rx_gft_filter_drop"Signed-off-by Shahed Shaikh <[email protected]>--- drivers/net/qede/base/ecore_dev_api.h | 1 + drivers/net/qede/base/ecore_l2.c | 50 +++++++++++++++------------ drivers/net/qede/base/ecore_l2_api.h | 39 ++++++++++++++------- drivers/net/qede/qede_ethdev.c | 2 ++ drivers/net/qede/qede_ethdev.h | 1 + drivers/net/qede/qede_filter.c | 22 ++++++++---- 6 files changed, 75 insertions(+), 40 deletions(-)
Quoted 24 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shahed Shaikh
Sent: Wednesday, September 4, 2019 5:01 PM
To: [email protected]
Cc: Rasesh Mody <[email protected]>; [email protected]; GR- Everest-DPDK-Dev <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 1/2] net/qede: fix ovs-dpdk failure when using odd number of queues on 100Gb modeAs per HW design of 100Gb mode, device internally uses 2 engines (eng0 and eng1), and both engines need to be configured symmetrically. Based on this requirement, driver design chose an approach to allow user to allocate only even number of queues and split those queues on both engines equally.
This approach puts a limitation on number of queues to be allocated - i.e. user can't configure odd number of queues on 100Gb mode.
OVS configures DPDK port with 1 rxq and 1 txq, which causes initialization of qede port to fail.This patch changes the implementation of queue allocation method for 100Gb devices by removing above mentioned limitation and allowing user to configure odd number of queues.
Quoted 12 lines
Key changes in this patch -
- Allocate requested queue count on both engines, so that actual hardware queue count will be double of what user requested.
- Create a pair of queues from both engines and provide it torte_ethdevqueue structure. So ethdev will see only one queue for underlying queue pair created for hw engine pair.
- Rx and Tx methods from ethdev will provide that queue pair object and PMD will internally split Rx and Tx packet processing across both engines in separately installed Rx and Tx handlers.
- Consolidate statistics of both HW queues while reporting to application.
- Report engine wise queue statistics in xstats flow.
e.g. - rx_q<hw_eng_id>.<qid>_xxxxxxx
Multiple logical changes in one patch. Please split the patch to more logical ones for easy review.
Quoted 5 lines
Fixes 2af14ca79c0a ("net/qede: support 100G")Signed-off-by Shahed Shaikh <[email protected]>
Quoted 47 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, September 4, 2019 7:01 PM
To: Shahed Shaikh <[email protected]>; [email protected]
Cc: Rasesh Mody <[email protected]>; [email protected]; GR-Everest- DPDK-Dev <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH 1/2] net/qede: fix ovs-dpdk failure when using odd number of queues on 100Gb modeQuoted 24 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Shahed Shaikh
Sent: Wednesday, September 4, 2019 5:01 PM
To: [email protected]
Cc: Rasesh Mody <[email protected]>; [email protected]; GR- Everest-DPDK-Dev <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 1/2] net/qede: fix ovs-dpdk failure when using odd number of queues on 100Gb modeAs per HW design of 100Gb mode, device internally uses 2 engines (eng0 and eng1), and both engines need to be configured symmetrically. Based on this requirement, driver design chose an approach to allow user to allocate only even number of queues and split those queues on both engines equally.
This approach puts a limitation on number of queues to be allocated - i.e. user can't configure odd number of queues on 100Gb mode.
OVS configures DPDK port with 1 rxq and 1 txq, which causes initialization of qede port to fail.This patch changes the implementation of queue allocation method for 100Gb devices by removing above mentioned limitation and allowing user to configure odd number of queues.
Quoted 12 lines
Key changes in this patch -
- Allocate requested queue count on both engines, so that actual hardware queue count will be double of what user requested.
- Create a pair of queues from both engines and provide it torte_ethdevqueue structure. So ethdev will see only one queue for underlying queue pair created for hw engine pair.
- Rx and Tx methods from ethdev will provide that queue pair object and PMD will internally split Rx and Tx packet processing across both engines in separately installed Rx and Tx handlers.
- Consolidate statistics of both HW queues while reporting to application.
- Report engine wise queue statistics in xstats flow.
e.g. - rx_q<hw_eng_id>.<qid>_xxxxxxx
Quoted 2 lines
Multiple logical changes in one patch. Please split the patch to more logical ones for easy review.
Hi Jerin,
Sure, let me split this patch into logical patches.
Quoted 7 lines
Quoted 7 lines
Fixes 2af14ca79c0a ("net/qede: support 100G")Signed-off-by Shahed Shaikh <[email protected]>